/tests/benchmarks/

face_vglite.h | 91 + src/plugins/graphicssystems/testlite/main.cpp | 71 + .../testlite/qgraphicssystem_testlite.cpp | 80 + .../testlite/qgraphicssystem_testlite.h | 89 + .../testlite/qwindowsurface_testlite.cpp | 528 ++++++ .../testlite/qwindowsurface_testlite.h | 88 + src/plugins/graphicssystems/testlite/testlite.pro | 17 + src/plugins/graphicssystems/testlite/x11util.cpp | 684 +++++++ src/plugins/graphicssystems/testlite/x11util.h | 126 ++ src/plugins/graphicssystems/vnc/main.cpp | 72 + .../graphicssystems/vnc/qgraphicssystem_vnc.cpp | 109 ++ .../graphicssystems/vnc/qgraphicssystem_vnc.h | 105 ++ src/plugins/graphicssystems/vnc/qvncserver.cpp | 1912 ++++++++++++++++++++ src/plugins/graphicssystems/vnc/qvncserver.h | 524 ++++++ .../graphicssystems/vnc/qwindowsurface_vnc.cpp | 106 ++ .../graphicssystems/vnc/qwindowsurface_vnc.h | 77 + src/plugins/graphicssystems/vnc/vnc.pro | 16 + tools/tools.pro | 2 +- 101 files changed, 10339 insertions(+), 101 deletions(-) create mode 100644 src/gui/egl/qegl_lite.cpp create mode 100644 src/gui/image/qpixmap_lite.cpp create mode 100644 src/gui/kernel/qapplication_lite.cpp create mode 100644 src/gui/kernel/qclipboard_lite.cpp create mode 100644 src/gui/kernel/qcursor_lite.cpp create mode 100644 src/gui/kernel/qdesktopwidget_lite.cpp create mode 100644 src/gui/kernel/qgenericplugin_lite.cpp create mode 100644 src/gui/kernel/qgenericplugin_lite.h create mode 100644 src/gui/kernel/qgenericpluginfactory_lite.cpp create mode 100644 src/gui/kernel/qgenericpluginfactory_lite.h create mode 100644 src/gui/kernel/qsound_lite.cpp create mode 100644 src/gui/kernel/qwidget_lite.cpp create mode 100644 src/gui/painting/qcolormap_lite.cpp create mode 100644 src/gui/painting/qpaintdevice_lite.cpp create mode 100644 src/plugins/generic/linuxinput/linuxinput.pro create mode 100644 src/plugins/generic/linuxinput/main.cpp create mode 100644 src/plugins/generic/linuxinput/qlinuxinput.cpp create mode 100644 src/plugins/generic/linuxinput/qlinuxinput.h create mode 100644 src/plugins/graphicssystems/linuxfb/linuxfb.pro create mode 100644 src/plugins/graphicssystems/linuxfb/main.cpp create mode 100644 src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp create mode 100644 src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.h create mode 100644 src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.cpp create mode 100644 src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.h create mode 100644 src/plugins/graphicssystems/minimal/main.cpp create mode 100644 src/plugins/graphicssystems/minimal/minimal.pro create mode 100644 src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.cpp create mode 100644 src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.h create mode 100644 src/plugins/graphicssystems/minimal/qwindowsurface_minimal.cpp create mode 100644 src/plugins/graphicssystems/minimal/qwindowsurface_minimal.h create mode 100644 src/plugins/graphicssystems/openvglite/main.cpp create mode 100644 src/plugins/graphicssystems/openvglite/openvglite.pro create mode 100644 src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.cpp create mode 100644 src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.h create mode 100644 src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.cpp create mode 100644 src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.h create mode 100644 src/plugins/graphicssystems/testlite/main.cpp create mode 100644 src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp create mode 100644 src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.h create mode 100644 src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp create mode 100644 src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h create mode 100644 src/plugins/graphicssystems/testlite/testlite.pro create mode 100644 src/plugins/graphicssystems/testlite/x11util.cpp create mode 100644 src/plugins/graphicssystems/testlite/x11util.h create mode 100644 src/plugins/graphicssystems/vnc/main.cpp create mode 100644 src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp create mode 100644 src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h create mode 100644 src/plugins/graphicssystems/vnc/qvncserver.cpp create mode 100644 src/plugins/graphicssystems/vnc/qvncserver.h create mode 100644 src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp create mode 100644 src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h create mode 100644 src/plugins/graphicssystems/vnc/vnc.pro diff --git a/configure b/configure index 70c91c2..332b739 100755 --- a/configure +++ b/configure @@ -166,9 +166,12 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown PLATFORM_X11=no PLATFORM_MAC=no -PLATFORM_QWS=no +PLATFORM_QWS=maybe +PLATFORM_EMBLITE=no +BUILD_ON_MAC=no; +[ -d /System/Library/Frameworks/Carbon.framework ] && BUILD_ON_MAC=yes -if [ -f "$relpath"/src/gui/kernel/qapplication_mac.mm ] && [ -d /System/Library/Frameworks/Carbon.framework ]; then +if [ -f "$relpath"/src/gui/kernel/qapplication_mac.mm ] && [ $BUILD_ON_MAC = "yes" ]; then # Qt/Mac # ~ the Carbon SDK exists # ~ src/gui/base/qapplication_mac.cpp is present @@ -262,6 +265,16 @@ earlyArgParse() VAL=$1 fi ;; + -embedded-lite) + VAR=embedded-lite + # this option may or may not be followed by an argument + if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then + VAL=auto + else + shift; + VAL=$1 + fi + ;; -h|help|--help|-help) if [ "$VAL" = "yes" ]; then OPT_HELP="$VAL" @@ -298,12 +311,27 @@ earlyArgParse() PLATFORM_X11=no PLATFORM_MAC=no PLATFORM_QWS=yes + PLATFORM_EMBLITE=no fi else echo "No license exists to enable Qt for Embedded Linux. Disabling." CFG_EMBEDDED=no fi ;; + embedded-lite) + CFG_EMBEDDED="$VAL" + if [ "$PLATFORM_QWS" != "no" ]; then + if [ "$PLATFORM_QWS" = "maybe" ]; then + PLATFORM_X11=no + PLATFORM_MAC=no + PLATFORM_QWS=no + PLATFORM_EMBLITE=yes + fi + else + echo "No license exists to enable Qt for Embedded Linux Lite. Disabling." + CFG_EMBEDDED=no + fi + ;; developer-build) CFG_DEV="yes" ;; @@ -363,6 +391,7 @@ elif [ $COMMERCIAL_USER = "yes" ]; then # one of commercial editions [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes [ "$PLATFORM_QWS" = "maybe" ] && PLATFORM_QWS=yes + [ "$PLATFORM_EMBLITE" = "maybe" ] && PLATFORM_EMBLITE=yes # read in the license file if [ -f "$LICENSE_FILE" ]; then @@ -450,7 +479,7 @@ elif [ $COMMERCIAL_USER = "yes" ]; then if [ "$PlatformCode" = "X" ]; then # Qt All-OS LICENSE_EXTENSION="-ALLOS" - elif [ "$PLATFORM_QWS" = "yes" ]; then + elif [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then case $PlatformCode in 2|4|8|A|B|E|G|J|K|P|Q|S|U|V|W) # Qt for Embedded Linux @@ -917,7 +946,7 @@ while [ "$#" -gt 0 ]; do ;; #Qt style options that pass an argument -qconfig) - if [ "$PLATFORM_QWS" != "yes" ]; then + if [ "$PLATFORM_QWS" != "yes" -a "$PLATFORM_EMBLITE" != "yes" ]; then echo echo "WARNING: -qconfig is only tested and supported on Qt for Embedded Linux." echo @@ -957,6 +986,16 @@ while [ "$#" -gt 0 ]; do VAL=$1 fi ;; + -embedded-lite) + VAR=embedded-lite + # this option may or may not be followed by an argument + if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then + VAL=auto + else + shift; + VAL=$1 + fi + ;; -opengl) VAR=opengl # this option may or may not be followed by an argument @@ -1171,12 +1210,27 @@ while [ "$#" -gt 0 ]; do PLATFORM_X11=no PLATFORM_MAC=no PLATFORM_QWS=yes + PLATFORM_EMBLITE=no fi else echo "No license exists to enable Qt for Embedded Linux. Disabling." CFG_EMBEDDED=no fi ;; + embedded-lite) + CFG_EMBEDDED="$VAL" + if [ "$PLATFORM_EMBLITE" != "no" ]; then + if [ "$PLATFORM_EMBLITE" = "maybe" ]; then + PLATFORM_X11=no + PLATFORM_MAC=no + PLATFORM_QWS=no + PLATFORM_EMBLITE=yes + fi + else + echo "No license exists to enable Qt for Embedded Linux Lite. Disabling." + CFG_EMBEDDED=no + fi + ;; sse) if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then CFG_SSE="$VAL" @@ -1273,6 +1327,8 @@ while [ "$#" -gt 0 ]; do PLATFORM_MAC=no elif [ "$PLATFORM_QWS" = "yes" ]; then PLATFORM_QWS=no + elif [ "$PLATFORM_EMBLITE" = "yes" ]; then + PLATFORM_EMBLITE=no fi if [ "$CFG_FRAMEWORK" = "auto" ]; then CFG_FRAMEWORK=no @@ -1469,7 +1525,7 @@ while [ "$#" -gt 0 ]; do fi ;; feature-*) - if [ "$PLATFORM_QWS" = "yes" ]; then + if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then FEATURE=`echo $VAR | sed "s,^[^-]*-\([^-]*\),\1," | tr 'abcdefghijklmnopqrstuvwxyz-' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` if [ "$VAL" = "no" ]; then QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_$FEATURE" @@ -2140,7 +2196,7 @@ if [ "$OPT_SHADOW" = "yes" ]; then [ "$OPT_VERBOSE" = "yes" ] && echo "Performing shadow build..." fi -if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "yes" ]; then +if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "yes" ]; then echo echo "WARNING: -debug-and-release is not supported anymore on Qt/X11 and Qt for Embedded Linux" echo "By default, Qt is built in release mode with separate debug information, so" @@ -2243,7 +2299,7 @@ if [ "$CFG_DEV" = "yes" ]; then fi # symlink fonts to be able to run application from build directory -if [ "$PLATFORM_QWS" = "yes" ] && [ ! -e "${outpath}/lib/fonts" ]; then +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ] && [ ! -e "${outpath}/lib/fonts" ]; then if [ "$PLATFORM" = "$XPLATFORM" ]; then mkdir -p "${outpath}/lib" ln -s "${relpath}/lib/fonts" "${outpath}/lib/fonts" @@ -2283,6 +2339,7 @@ fi ### help #------------------------------------------------------------------------------- [ "$PLATFORM_QWS" = "yes" -a "$CFG_EMBEDDED" = "no" ] && CFG_EMBEDDED=auto +[ "$PLATFORM_EMBLITE" = "yes" -a "$CFG_EMBEDDED" = "no" ] && CFG_EMBEDDED=auto if [ "$CFG_EMBEDDED" != "no" ]; then case "$UNAME_SYSTEM:$UNAME_RELEASE" in Darwin:*) @@ -2361,6 +2418,7 @@ if [ "$CFG_EMBEDDED" != "no" ]; then echo "Qt for Embedded Linux is not supported on this platform. Disabling." CFG_EMBEDDED=no PLATFORM_QWS=no + PLATFORM_EMBLITE=no ;; esac fi @@ -2525,7 +2583,7 @@ if [ -z "$PLATFORM" ]; then esac fi -if [ "$PLATFORM_QWS" = "yes" ]; then +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then CFG_SM=no PLATFORMS=`find "$relpath/mkspecs/qws" | sed "s,$relpath/mkspecs/qws/,,"` else @@ -2809,7 +2867,7 @@ fi if [ "$OPT_VERBOSE" = "yes" ]; then echo "System architecture: '$CFG_ARCH'" - if [ "$PLATFORM_QWS" = "yes" ]; then + if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then echo "Host architecture: '$CFG_HOST_ARCH'" fi fi @@ -2988,7 +3046,7 @@ if [ "$CFG_USE_GNUMAKE" = "auto" ] && "$MAKE" -v | grep "GNU Make" >/dev/null 2> fi # If -opengl wasn't specified, don't try to auto-detect -if [ "$PLATFORM_QWS" = "yes" ] && [ "$CFG_OPENGL" = "auto" ]; then +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ] && [ "$CFG_OPENGL" = "auto" ]; then CFG_OPENGL=no fi @@ -3043,7 +3101,7 @@ fi if [ -z "$QT_INSTALL_PREFIX" ]; then if [ "$CFG_DEV" = "yes" ]; then QT_INSTALL_PREFIX="$outpath" # In Development, we use sandboxed builds by default - elif [ "$PLATFORM_QWS" = "yes" ]; then + elif [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then QT_INSTALL_PREFIX="/usr/local/Trolltech/QtEmbedded-${QT_VERSION}" if [ "$PLATFORM" != "$XPLATFORM" ]; then QT_INSTALL_PREFIX="${QT_INSTALL_PREFIX}-${CFG_ARCH}" @@ -3248,7 +3306,7 @@ Installation options: -prefix ...... This will install everything relative to (default $QT_INSTALL_PREFIX) EOF -if [ "$PLATFORM_QWS" = "yes" ]; then +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then cat <: arm mips x86 generic + -embedded-lite This will enable the embedded lite build, you must + have a proper license for this switch to work. + Example values for : arm mips x86 generic + Qt/Embedded Lite does not use QWS. + -armfpa ............. Target platform is uses the ARM-FPA floating point format. -no-armfpa .......... Target platform does not use the ARM-FPA floating point format. @@ -3829,7 +3892,7 @@ EOF fi -if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_X11" = "yes" ]; then +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" -o "$PLATFORM_X11" = "yes" ]; then if [ "$CFG_GLIB" = "no" ]; then GBY=" " GBN="+" @@ -3853,7 +3916,7 @@ fi # Help # LICENSING, INTERACTIVE PART # ----------------------------------------------------------------------------- -if [ "$PLATFORM_QWS" = "yes" ]; then +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then Platform="Qt for Embedded Linux" elif [ "$PLATFORM_MAC" = "yes" ]; then Platform="Qt/Mac" @@ -4298,7 +4361,7 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ]; EXTRA_LFLAGS="\$(QMAKE_RPATH)\"$rpath\" $EXTRA_LFLAGS" done fi - if [ "$PLATFORM_MAC" = "yes" ]; then + if [ "$BUILD_ON_MAC" = "yes" ]; then echo "export MACOSX_DEPLOYMENT_TARGET = 10.4" >> "$mkfile" echo "CARBON_LFLAGS =-framework ApplicationServices" >>"$mkfile" echo "CARBON_CFLAGS =-fconstant-cfstrings" >>"$mkfile" @@ -4801,7 +4864,7 @@ fi # auto-detect iconv(3) support if [ "$CFG_ICONV" != "no" ]; then - if [ "$PLATFORM_QWS" = "yes" ]; then + if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "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 $MAC_CONFIG_TEST_COMMANDLINE; then CFG_ICONV=yes @@ -4852,7 +4915,7 @@ if [ "$PLATFORM_MAC" = "yes" -a ! -z "$QT_NAMESPACE" ]; then QT_NAMESPACE_MAC_CRC=`"$mactests/crc.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/mac/crc $QT_NAMESPACE $L_FLAGS $I_FLAGS $l_FLAGS` fi -if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ]; then +if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then # detect EGL support if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/egl" "EGL (EGL/egl.h)" $L_FLAGS $I_FLAGS $l_FLAGS; then @@ -5314,7 +5377,7 @@ if [ "$PLATFORM_MAC" = "yes" ]; then fi # QWS -if [ "$PLATFORM_QWS" = "yes" ]; then +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then # auto-detect OpenGL support (es1 = OpenGL ES 1.x Common, es1cl = ES 1.x common lite, es2 = OpenGL ES 2.x) if [ "$CFG_OPENGL" = "yes" ]; then @@ -5504,7 +5567,7 @@ fi if [ "$CFG_DOUBLEFORMAT" = "auto" ]; then - if [ "$PLATFORM_QWS" != "yes" ]; then + if [ "$PLATFORM_QWS" != "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then CFG_DOUBLEFORMAT=normal else "$unixtests/doubleformat.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" @@ -5772,7 +5835,12 @@ fi #------------------------------------------------------------------------------- ### fix this: user input should be validated in a loop -if [ "$CFG_QWS_DEPTHS" = "prompted" -a "$PLATFORM_QWS" = "yes" ]; then +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then + PROMPT_FOR_DEPTHS="yes" +else + PROMPT_FOR_DEPTHS="no" +fi +if [ "$CFG_QWS_DEPTHS" = "prompted" -a "$PROMPT_FOR_DEPTHS" = "yes" ]; then echo echo "Choose pixel-depths to support:" echo @@ -5931,7 +5999,7 @@ else fi if [ "$CFG_OPENGL" = "es1" ] || [ "$CFG_OPENGL" = "es1cl" ] || [ "$CFG_OPENGL" = "es2" ]; then - if [ "$PLATFORM_QWS" = "yes" ]; then + if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then QCONFIG_FLAGS="$QCONFIG_FLAGS Q_BACKINGSTORE_SUBSURFACES" QCONFIG_FLAGS="$QCONFIG_FLAGS Q_USE_EGLWINDOWSURFACE" fi @@ -5979,6 +6047,12 @@ if [ "$PLATFORM_QWS" = "yes" ]; then QT_CONFIG="$QT_CONFIG embedded" rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes fi +if [ "$PLATFORM_EMBLITE" = "yes" ]; then + QMAKE_OUTDIR="${QMAKE_OUTDIR}-emb-$CFG_EMBEDDED" + QMAKE_CONFIG="$QMAKE_CONFIG embedded_lite" + QT_CONFIG="$QT_CONFIG embedded_lite" + rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes +fi QMakeVar set PRECOMPILED_DIR ".pch/$QMAKE_OUTDIR" QMakeVar set OBJECTS_DIR ".obj/$QMAKE_OUTDIR" QMakeVar set MOC_DIR ".moc/$QMAKE_OUTDIR" @@ -6200,7 +6274,7 @@ if [ '!' -z "$I_FLAGS" ]; then fi # turn off exceptions for the compilers that support it -if [ "$PLATFORM_QWS" = "yes" ]; then +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then COMPILER=`echo $XPLATFORM | cut -f 3- -d-` else COMPILER=`echo $PLATFORM | cut -f 2- -d-` @@ -6208,6 +6282,9 @@ fi if [ "$CFG_EXCEPTIONS" = "unspecified" -a "$PLATFORM_QWS" = "yes" ]; then CFG_EXCEPTIONS=no fi +if [ "$CFG_EXCEPTIONS" = "unspecified" -a "$PLATFORM_EMBLITE" = "yes" ]; then + CFG_EXCEPTIONS=no +fi if [ "$CFG_EXCEPTIONS" != "no" ]; then QTCONFIG_CONFIG="$QTCONFIG_CONFIG exceptions" @@ -6537,7 +6614,7 @@ esac # ipv6 # # X11 : x11sm xinerama xcursor xfixes xrandr xrender mitshm fontconfig xkb -# Embedded: embedded freetype +# Embedded: embedded embedded_lite freetype # ALL_OPTIONS= BUILD_CONFIG= @@ -6834,6 +6911,11 @@ if [ "$PLATFORM_QWS" = "yes" ]; then done fi # QWS +if [ "$PLATFORM_EMBLITE" = "yes" ]; then + # Add LITE to config.h + QCONFIG_FLAGS="$QCONFIG_FLAGS Q_WS_LITE QT_NO_QWS_QPF QT_NO_QWS_QPF2" +fi + if [ "${CFG_USE_FLOATMATH}" = "yes" ]; then QCONFIG_FLAGS="${QCONFIG_FLAGS} QT_USE_MATH_H_FLOATS" fi @@ -7221,7 +7303,7 @@ else echo "Architecture: $CFG_ARCH" fi -if [ "$PLATFORM_QWS" = "yes" ]; then +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then echo "Host architecture: $CFG_HOST_ARCH" fi @@ -7320,7 +7402,7 @@ else fi echo "zlib support ........ $CFG_ZLIB" echo "Session management .. $CFG_SM" -if [ "$PLATFORM_QWS" = "yes" ]; then +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then echo "Embedded support .... $CFG_EMBEDDED" if [ "$CFG_QWS_FREETYPE" = "auto" ]; then echo "Freetype2 support ... $CFG_QWS_FREETYPE ($CFG_LIBFREETYPE)" diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 787eba7..d29cd5f 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1227,7 +1227,16 @@ bool qSharedBuild() Defined on Qt for Embedded Linux. - \sa Q_WS_MAC, Q_WS_WIN, Q_WS_X11 + \sa Q_WS_MAC, Q_WS_WIN, Q_WS_X11, Q_WS_LITE +*/ + +/*! + \macro Q_WS_LITE + \relates + + Defined on Qt for Embedded Linux, Lite version. + + \sa Q_WS_MAC, Q_WS_WIN, Q_WS_X11, Q_WS_QWS */ /*! diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index a2c532f..158fa53 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -284,7 +284,7 @@ namespace QT_NAMESPACE {} # endif #endif -#if defined(Q_OS_MAC64) && !defined(QT_MAC_USE_COCOA) && !defined(QT_BUILD_QMAKE) +#if defined(Q_WS_MAC64) && !defined(QT_MAC_USE_COCOA) && !defined(QT_BUILD_QMAKE) #error "You are building a 64-bit application, but using a 32-bit version of Qt. Check your build configuration." #endif @@ -799,7 +799,7 @@ namespace QT_NAMESPACE {} # define Q_WS_PM # error "Qt does not work with OS/2 Presentation Manager or Workplace Shell" #elif defined(Q_OS_UNIX) -# if defined(Q_OS_MAC) && !defined(__USE_WS_X11__) && !defined(Q_WS_QWS) +# if defined(Q_OS_MAC) && !defined(__USE_WS_X11__) && !defined(Q_WS_QWS) && !defined(Q_WS_LITE) # define Q_WS_MAC # define Q_WS_MACX # if defined(Q_OS_MAC64) @@ -811,7 +811,7 @@ namespace QT_NAMESPACE {} # if (defined(__SERIES60_31__) || defined(__S60_32__) || defined(__S60_50__)) && !defined(QT_NO_S60) # define Q_WS_S60 # endif -# elif !defined(Q_WS_QWS) +# elif !defined(Q_WS_QWS) && !defined(Q_WS_LITE) # define Q_WS_X11 # endif #endif @@ -1056,7 +1056,7 @@ redefine to built-in booleans to make autotests work properly */ typedef int QNoImplicitBoolCast; -#if defined(QT_ARCH_ARM) || defined(QT_ARCH_ARMV6) || defined(QT_ARCH_AVR32) || (defined(QT_ARCH_MIPS) && (defined(Q_WS_QWS) || defined(Q_OS_WINCE))) || defined(QT_ARCH_SH) || defined(QT_ARCH_SH4A) +#if defined(QT_ARCH_ARM) || defined(QT_ARCH_ARMV6) || defined(QT_ARCH_AVR32) || (defined(QT_ARCH_MIPS) && (defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_WINCE))) || defined(QT_ARCH_SH) || defined(QT_ARCH_SH4A) #define QT_NO_FPU #endif diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 8f34e30..c37122c 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1537,7 +1537,7 @@ public: typedef void *HANDLE; #elif defined(Q_WS_X11) typedef unsigned long HANDLE; -#elif defined(Q_WS_QWS) +#elif defined(Q_WS_QWS) || defined(Q_WS_LITE) typedef void * HANDLE; #elif defined(Q_OS_SYMBIAN) typedef unsigned long int HANDLE; // equivalent to TUint32 diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 48671ba..94aad7a 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -1133,7 +1133,7 @@ static QString getPath(QSettings::Format format, QSettings::Scope scope) if (env == 0) { userPath = homePath; userPath += QLatin1Char('/'); -#ifdef Q_WS_QWS +#if defined(Q_WS_QWS) || defined(Q_WS_LITE) userPath += QLatin1String("Settings"); #else userPath += QLatin1String(".config"); diff --git a/src/corelib/io/qsettings_p.h b/src/corelib/io/qsettings_p.h index dc1beb3..3dff0e3 100644 --- a/src/corelib/io/qsettings_p.h +++ b/src/corelib/io/qsettings_p.h @@ -69,7 +69,7 @@ QT_BEGIN_NAMESPACE -#if defined(Q_WS_QWS) +#if defined(Q_WS_QWS) || defined(Q_WS_LITE) #define QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER #endif diff --git a/src/gui/accessible/accessible.pri b/src/gui/accessible/accessible.pri index ad2fb4c..afa5ecd 100644 --- a/src/gui/accessible/accessible.pri +++ b/src/gui/accessible/accessible.pri @@ -12,7 +12,7 @@ contains(QT_CONFIG, accessibility) { accessible/qaccessiblewidget.cpp \ accessible/qaccessibleplugin.cpp - mac:!embedded { + mac:!embedded:!embedded_lite { HEADERS += accessible/qaccessible_mac_p.h OBJECTIVE_SOURCES += accessible/qaccessible_mac.mm \ accessible/qaccessible_mac_cocoa.mm diff --git a/src/gui/dialogs/dialogs.pri b/src/gui/dialogs/dialogs.pri index b9fad41..08584a9 100644 --- a/src/gui/dialogs/dialogs.pri +++ b/src/gui/dialogs/dialogs.pri @@ -27,7 +27,7 @@ HEADERS += \ dialogs/qwizard.h \ dialogs/qprintpreviewdialog.h -!embedded:mac { +!embedded:!embedded_lite:mac { OBJECTIVE_SOURCES += dialogs/qcolordialog_mac.mm \ dialogs/qfiledialog_mac.mm \ dialogs/qfontdialog_mac.mm \ @@ -46,7 +46,7 @@ win32 { !win32-borland:!wince*: LIBS += -lshell32 # the filedialog needs this library } -!mac:!embedded:!symbian:unix { +!mac:!embedded:!symbian:unix|embedded_lite { HEADERS += dialogs/qpagesetupdialog_unix_p.h SOURCES += dialogs/qprintdialog_unix.cpp \ dialogs/qpagesetupdialog_unix.cpp diff --git a/src/gui/egl/egl.pri b/src/gui/egl/egl.pri index 75a3d91..9ba7017 100644 --- a/src/gui/egl/egl.pri +++ b/src/gui/egl/egl.pri @@ -12,10 +12,14 @@ unix { embedded { SOURCES += egl/qegl_qws.cpp } else { - symbian { - SOURCES += egl/qegl_symbian.cpp + embedded_lite { + SOURCES += egl/qegl_lite.cpp } else { - SOURCES += egl/qegl_x11.cpp + symbian { + SOURCES += egl/qegl_symbian.cpp + } else { + SOURCES += egl/qegl_x11.cpp + } } } } diff --git a/src/gui/egl/qegl_lite.cpp b/src/gui/egl/qegl_lite.cpp new file mode 100644 index 0000000..784b252 --- /dev/null +++ b/src/gui/egl/qegl_lite.cpp @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include "qegl_p.h" + +#if !defined(QT_NO_EGL) + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +bool QEglContext::createSurface(QPaintDevice *device, const QEglProperties *properties) +{ + Q_UNUSED(device); + Q_UNUSED(properties); + return false; +} + +EGLDisplay QEglContext::getDisplay(QPaintDevice *device) +{ + Q_UNUSED(device); + return eglGetDisplay(EGLNativeDisplayType(EGL_DEFAULT_DISPLAY)); +} + +static QGraphicsSystemScreen *screenForDevice(QPaintDevice *device) +{ + QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); + if (!gs) + return 0; + + QList screens = gs->screens(); + + int screenNumber; + if (device && device->devType() == QInternal::Widget) + screenNumber = qApp->desktop()->screenNumber(static_cast(device)); + else + screenNumber = 0; + if (screenNumber < 0 || screenNumber >= screens.size()) + return 0; + return screens[screenNumber]; +} + +// Set pixel format and other properties based on a paint device. +void QEglProperties::setPaintDeviceFormat(QPaintDevice *dev) +{ + if (!dev) + return; + + // Find the QGLScreen for this paint device. + QGraphicsSystemScreen *screen = screenForDevice(dev); + if (!screen) + return; + int devType = dev->devType(); + if (devType == QInternal::Image) + setPixelFormat(static_cast(dev)->format()); + else + setPixelFormat(screen->format()); +} + +QT_END_NAMESPACE + +#endif // !QT_NO_EGL diff --git a/src/gui/embedded/qkbd_qws.cpp b/src/gui/embedded/qkbd_qws.cpp index 4d97ba7..9a496ac 100644 --- a/src/gui/embedded/qkbd_qws.cpp +++ b/src/gui/embedded/qkbd_qws.cpp @@ -48,8 +48,16 @@ #include #include +#ifdef Q_WS_QWS #include "qwindowsystem_qws.h" #include "qscreen_qws.h" +#endif + +#ifdef Q_WS_LITE +#include +#include +#endif + #include "qtimer.h" #include @@ -352,7 +360,16 @@ QWSKeyboardHandler::~QWSKeyboardHandler() void QWSKeyboardHandler::processKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers modifiers, bool isPress, bool autoRepeat) { +#if defined(Q_WS_QWS) qwsServer->processKeyEvent(unicode, keycode, modifiers, isPress, autoRepeat); +#elif defined(Q_WS_LITE) + QEvent::Type type = isPress ? QEvent::KeyPress : QEvent::KeyRelease; + QString str; + if (unicode != 0xffff) + str = QString(unicode); + QKeyEvent ke(type, keycode, modifiers, str); + QApplicationPrivate::handleKeyEvent(0, &ke); +#endif } /*! @@ -375,6 +392,7 @@ void QWSKeyboardHandler::processKeyEvent(int unicode, int keycode, Qt::KeyboardM */ int QWSKeyboardHandler::transformDirKey(int key) { +#ifdef Q_WS_QWS static int dir_keyrot = -1; if (dir_keyrot < 0) { // get the rotation @@ -387,6 +405,9 @@ int QWSKeyboardHandler::transformDirKey(int key) } int xf = qt_screen->transformOrientation() + dir_keyrot; return (key-Qt::Key_Left+xf)%4+Qt::Key_Left; +#else + return 0; +#endif } /*! @@ -452,7 +473,7 @@ void QWSKeyboardHandler::endAutoRepeat() Maps \a keycode according to a keymap and sends that key event to the \l{Qt for Embedded Linux} server application. - + Please see the \l{Qt for Embedded Linux Character Input} and the \l {kmap2qmap} documentations for a description on how to create and use keymap files. diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 7c24002..6949e39 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -4,7 +4,7 @@ QT = core DEFINES += QT_BUILD_GUI_LIB QT_NO_USING_NAMESPACE win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x65000000 -!win32:!embedded:!mac:!symbian:CONFIG += x11 +!win32:!embedded:!embedded_lite:!mac:!symbian:CONFIG += x11 unix:QMAKE_PKGCONFIG_REQUIRES = QtCore diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index 0970385..67f0699 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -61,11 +61,14 @@ win32 { embedded { SOURCES += image/qpixmap_qws.cpp } +embedded_lite { + SOURCES += image/qpixmap_lite.cpp +} x11 { HEADERS += image/qpixmap_x11_p.h SOURCES += image/qpixmap_x11.cpp } -mac { +!embedded:!embedded_lite:mac { HEADERS += image/qpixmap_mac_p.h SOURCES += image/qpixmap_mac.cpp } diff --git a/src/gui/image/qpixmap_lite.cpp b/src/gui/image/qpixmap_lite.cpp new file mode 100644 index 0000000..4ba69fa --- /dev/null +++ b/src/gui/image/qpixmap_lite.cpp @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) +{ + Q_UNUSED(window); + Q_UNUSED(x); + Q_UNUSED(y); + Q_UNUSED(w); + Q_UNUSED(h); + return QPixmap(); +} diff --git a/src/gui/image/qpixmapdatafactory.cpp b/src/gui/image/qpixmapdatafactory.cpp index 53c93ad..fab6af8 100644 --- a/src/gui/image/qpixmapdatafactory.cpp +++ b/src/gui/image/qpixmapdatafactory.cpp @@ -53,6 +53,9 @@ #ifdef Q_WS_MAC # include #endif +#ifdef Q_WS_LITE +# include +#endif #include "private/qapplication_p.h" #include "private/qgraphicssystem_p.h" @@ -79,6 +82,8 @@ QPixmapData* QSimplePixmapDataFactory::create(QPixmapData::PixelType type) return new QRasterPixmapData(type); #elif defined(Q_WS_MAC) return new QMacPixmapData(type); +#elif defined(Q_WS_LITE) + return new QRasterPixmapData(type); #else #error QSimplePixmapDataFactory::create() not implemented #endif diff --git a/src/gui/inputmethod/inputmethod.pri b/src/gui/inputmethod/inputmethod.pri index 6d9f748..b3b7a3a 100644 --- a/src/gui/inputmethod/inputmethod.pri +++ b/src/gui/inputmethod/inputmethod.pri @@ -19,7 +19,7 @@ embedded { HEADERS += inputmethod/qwsinputcontext_p.h SOURCES += inputmethod/qwsinputcontext_qws.cpp } -mac:!embedded { +mac:!embedded:!embedded_lite { HEADERS += inputmethod/qmacinputcontext_p.h SOURCES += inputmethod/qmacinputcontext_mac.cpp } diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 8489817..85c838b 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -181,7 +181,25 @@ embedded { } -!embedded:!x11:mac { +embedded_lite { + HEADERS += \ + kernel/qgenericpluginfactory_lite.h \ + kernel/qgenericplugin_lite.h + + SOURCES += \ + kernel/qapplication_lite.cpp \ + kernel/qclipboard_lite.cpp \ + kernel/qcursor_lite.cpp \ + kernel/qdnd_qws.cpp \ + kernel/qdesktopwidget_lite.cpp \ + kernel/qgenericpluginfactory_lite.cpp \ + kernel/qgenericplugin_lite.cpp \ + kernel/qkeymapper_qws.cpp \ + kernel/qsound_lite.cpp \ + kernel/qwidget_lite.cpp +} + +!embedded:!embedded_lite:!x11:mac { SOURCES += \ kernel/qclipboard_mac.cpp \ kernel/qmime_mac.cpp \ diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 511c797..2bcaa68 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -741,6 +741,8 @@ void QApplicationPrivate::construct( { initResources(); + graphics_system_name = qgetenv("QT_DEFAULT_GRAPHICS_SYSTEM"); + qt_is_gui_used = (qt_appType != QApplication::Tty); process_cmdline(); // Must be called before initialize() diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp new file mode 100644 index 0000000..eec3e6c --- /dev/null +++ b/src/gui/kernel/qapplication_lite.cpp @@ -0,0 +1,624 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qapplication_p.h" +#include "qcolormap.h" +#include "qpixmapcache.h" +#if !defined(QT_NO_GLIB) +#include "private/qeventdispatcher_glib_p.h" +#endif +#include "private/qeventdispatcher_unix_p.h" +#ifndef QT_NO_CURSOR +#include "private/qcursor_p.h" +#endif + +#include "qgenericpluginfactory_lite.h" +#include + +#include + +#include + + +QT_BEGIN_NAMESPACE + +static QString appName; +static const char *appFont = 0; // application font + +QWidget *qt_button_down = 0; // widget got last button-down + +static bool app_do_modal = false; +extern QWidgetList *qt_modal_stack; // stack of modal widgets + +int qt_last_x = 0; +int qt_last_y = 0; + +QString QApplicationPrivate::appName() const +{ + return QT_PREPEND_NAMESPACE(appName); +} + +void QApplicationPrivate::createEventDispatcher() +{ + Q_Q(QApplication); +#if !defined(QT_NO_GLIB) + if (qgetenv("QT_NO_GLIB").isEmpty() && QEventDispatcherGlib::versionSupported()) + eventDispatcher = new QEventDispatcherGlib(q); + else +#endif + eventDispatcher = new QEventDispatcherUNIX(q); +} + +static bool qt_try_modal(QWidget *widget, const QEvent *event) +{ + QWidget * top = 0; + + if (QApplicationPrivate::tryModalHelper(widget, &top)) + return true; + + bool block_event = false; + bool paint_event = false; + + switch (event->type()) { +#if 0 + case QEvent::Focus: + if (!static_cast(event)->simpleData.get_focus) + break; + // drop through +#endif + case QEvent::MouseButtonPress: // disallow mouse/key events + case QEvent::MouseButtonRelease: + case QEvent::MouseMove: + case QEvent::KeyPress: + case QEvent::KeyRelease: + block_event = true; + break; + default: + break; + } + + if ((block_event || paint_event) && top->parentWidget() == 0) + top->raise(); + + return !block_event; +} + + + +void QApplicationPrivate::enterModal_sys(QWidget *widget) +{ + qDebug() << ">>>>>>>> enterModal_sys" << app_do_modal << widget; + if (!qt_modal_stack) + qt_modal_stack = new QWidgetList; + qt_modal_stack->insert(0, widget); + app_do_modal = true; +} + +void QApplicationPrivate::leaveModal_sys(QWidget *widget ) +{ + qDebug() << "<<<<<<<<< leaveModal_sys" << app_do_modal << widget; + if (qt_modal_stack && qt_modal_stack->removeAll(widget)) { + if (qt_modal_stack->isEmpty()) { + delete qt_modal_stack; + qt_modal_stack = 0; + } + } + app_do_modal = qt_modal_stack != 0; +} + +bool QApplicationPrivate::modalState() +{ + return app_do_modal; +} + +void QApplicationPrivate::closePopup(QWidget *popup) +{ + Q_Q(QApplication); + if (!popupWidgets) + return; + popupWidgets->removeAll(popup); + +//### +// if (popup == qt_popup_down) { +// qt_button_down = 0; +// qt_popup_down = 0; +// } + + if (QApplicationPrivate::popupWidgets->count() == 0) { // this was the last popup + delete QApplicationPrivate::popupWidgets; + QApplicationPrivate::popupWidgets = 0; + + //### replay mouse event? + + //### transfer/release mouse grab + + //### transfer/release keyboard grab + + //give back focus + + if (active_window) { + if (QWidget *fw = active_window->focusWidget()) { + if (fw != QApplication::focusWidget()) { + fw->setFocus(Qt::PopupFocusReason); + } else { + QFocusEvent e(QEvent::FocusIn, Qt::PopupFocusReason); + q->sendEvent(fw, &e); + } + } + } + + } else { + // A popup was closed, so the previous popup gets the focus. + + QWidget* aw = QApplicationPrivate::popupWidgets->last(); + if (QWidget *fw = aw->focusWidget()) + fw->setFocus(Qt::PopupFocusReason); + + //### regrab the keyboard and mouse in case 'popup' lost the grab + + + } + +} + +static int openPopupCount = 0; +void QApplicationPrivate::openPopup(QWidget *popup) +{ + openPopupCount++; + if (!popupWidgets) { // create list + popupWidgets = new QWidgetList; + + /* only grab if you are the first/parent popup */ + //#### ->grabMouse(popup,true); + //#### ->grabKeyboard(popup,true); + //### popupGrabOk = true; + } + popupWidgets->append(popup); // add to end of list + + // popups are not focus-handled by the window system (the first + // popup grabbed the keyboard), so we have to do that manually: A + // new popup gets the focus + if (popup->focusWidget()) { + popup->focusWidget()->setFocus(Qt::PopupFocusReason); + } else if (popupWidgets->count() == 1) { // this was the first popup + if (QWidget *fw = QApplication::focusWidget()) { + QFocusEvent e(QEvent::FocusOut, Qt::PopupFocusReason); + QApplication::sendEvent(fw, &e); + } + } +} + +void QApplicationPrivate::initializeMultitouch_sys() +{ +} + +void QApplicationPrivate::cleanupMultitouch_sys() +{ +} + +void QApplicationPrivate::initializeWidgetPaletteHash() +{ +} + +void QApplication::setCursorFlashTime(int msecs) +{ + QApplicationPrivate::cursor_flash_time = msecs; +} + +int QApplication::cursorFlashTime() +{ + return QApplicationPrivate::cursor_flash_time; +} + +void QApplication::setDoubleClickInterval(int ms) +{ + QApplicationPrivate::mouse_double_click_time = ms; +} + +int QApplication::doubleClickInterval() +{ + return QApplicationPrivate::mouse_double_click_time; +} + +void QApplication::setKeyboardInputInterval(int ms) +{ + QApplicationPrivate::keyboard_input_time = ms; +} + +int QApplication::keyboardInputInterval() +{ + return QApplicationPrivate::keyboard_input_time; +} + +#ifndef QT_NO_WHEELEVENT +void QApplication::setWheelScrollLines(int lines) +{ + QApplicationPrivate::wheel_scroll_lines = lines; +} + +int QApplication::wheelScrollLines() +{ + return QApplicationPrivate::wheel_scroll_lines; +} +#endif + +void QApplication::setEffectEnabled(Qt::UIEffect effect, bool enable) +{ + switch (effect) { + case Qt::UI_AnimateMenu: + QApplicationPrivate::animate_menu = enable; + break; + case Qt::UI_FadeMenu: + if (enable) + QApplicationPrivate::animate_menu = true; + QApplicationPrivate::fade_menu = enable; + break; + case Qt::UI_AnimateCombo: + QApplicationPrivate::animate_combo = enable; + break; + case Qt::UI_AnimateTooltip: + QApplicationPrivate::animate_tooltip = enable; + break; + case Qt::UI_FadeTooltip: + if (enable) + QApplicationPrivate::animate_tooltip = true; + QApplicationPrivate::fade_tooltip = enable; + break; + case Qt::UI_AnimateToolBox: + QApplicationPrivate::animate_toolbox = enable; + break; + default: + QApplicationPrivate::animate_ui = enable; + break; + } +} + +bool QApplication::isEffectEnabled(Qt::UIEffect effect) +{ + if (QColormap::instance().depth() < 16 || !QApplicationPrivate::animate_ui) + return false; + + switch(effect) { + case Qt::UI_AnimateMenu: + return QApplicationPrivate::animate_menu; + case Qt::UI_FadeMenu: + return QApplicationPrivate::fade_menu; + case Qt::UI_AnimateCombo: + return QApplicationPrivate::animate_combo; + case Qt::UI_AnimateTooltip: + return QApplicationPrivate::animate_tooltip; + case Qt::UI_FadeTooltip: + return QApplicationPrivate::fade_tooltip; + case Qt::UI_AnimateToolBox: + return QApplicationPrivate::animate_toolbox; + default: + return QApplicationPrivate::animate_ui; + } +} + +#ifndef QT_NO_CURSOR +void QApplication::setOverrideCursor(const QCursor &) +{ + // XXX +} + +void QApplication::restoreOverrideCursor() +{ + // XXX +} + +#endif// QT_NO_CURSOR + +QWidget *QApplication::topLevelAt(const QPoint &pos) +{ +//### We have to implement a windowsystem-aware way to do this + + //fallback implementation assuming widgets are in stacking order + + QWidgetList list = topLevelWidgets(); + for (int i = list.size()-1; i >= 0; --i) { + QWidget *w = list[i]; + //### mask is ignored + if (w != QApplication::desktop() && w->isVisible() && w->geometry().contains(pos)) + return w; + } + + return 0; +} + +void QApplication::beep() +{ +} + +void QApplication::alert(QWidget *, int) +{ +} + +static void init_plugins(const QList pluginList) +{ + for (int i = 0; i < pluginList.count(); ++i) { + QByteArray pluginSpec = pluginList.at(i); + qDebug() << "init_plugins" << i << pluginSpec; + int colonPos = pluginSpec.indexOf(':'); + QObject *plugin; + if (colonPos < 0) + plugin = QGenericPluginFactory::create(QLatin1String(pluginSpec), QString()); + else + plugin = QGenericPluginFactory::create(QLatin1String(pluginSpec.mid(0, colonPos)), + QLatin1String(pluginSpec.mid(colonPos+1))); + qDebug() << " created" << plugin; + } +} + +class QDummyInputContext : public QInputContext +{ +public: + explicit QDummyInputContext(QObject* parent = 0) : QInputContext(parent) {} + ~QDummyInputContext() {} + QString identifierName() { return QString(); } + QString language() { return QString(); } + + void reset() {} + bool isComposing() const { return false; } + +}; + +void qt_init(QApplicationPrivate *priv, int type) +{ + Q_UNUSED(type); + + char *p; + char **argv = priv->argv; + int argc = priv->argc; + + if (argv && *argv) { //apparently, we allow people to pass 0 on the other platforms + p = strrchr(argv[0], '/'); + appName = QString::fromLocal8Bit(p ? p + 1 : argv[0]); + } + + QList pluginList; + + // Get command line params + + int j = argc ? 1 : 0; + for (int i=1; iargc) { + priv->argv[j] = 0; + priv->argc = j; + } + + + + +#if 0 + QByteArray pluginEnv = qgetenv("QT_LITE_PLUGINS"); + if (!pluginEnv.isEmpty()) { + pluginList.append(pluginEnv.split(';')); + } +#endif + + + qDebug() << pluginList; + + init_plugins(pluginList); + + QColormap::initialize(); + QFont::initialize(); +#ifndef QT_NO_CURSOR +// QCursorData::initialize(); +#endif + + qApp->setObjectName(appName); + +#ifndef QT_NO_QWS_INPUTMETHODS + qApp->setInputContext(new QDummyInputContext(qApp)); +#endif +} + +void qt_cleanup() +{ + QPixmapCache::clear(); +#ifndef QT_NO_CURSOR + QCursorData::cleanup(); +#endif + QFont::cleanup(); + QColormap::cleanup(); +} + + +/*! + +\a tlw == 0 means that \a ev is in global coords only + + +*/ + +void QApplicationPrivate::handleMouseEvent(QWidget *tlw, const QMouseEvent &ev) +{ +// qDebug() << "handleMouseEvent" << tlw << ev.pos() << hex << ev.buttons(); + + static QWidget *implicit_mouse_grabber=0; + + QPoint localPoint = ev.pos(); + QPoint globalPoint = ev.globalPos(); + bool trustLocalPoint = !!tlw; //is there something the local point can be local to? + QWidget *mouseWidget = tlw; + + qt_last_x = globalPoint.x(); + qt_last_y = globalPoint.y(); + + if (self->inPopupMode()) { + //popup mouse handling is magical... + mouseWidget = qApp->activePopupWidget(); + trustLocalPoint = (mouseWidget == tlw); + + //### how should popup mode and implicit mouse grab interact? + + } else if (tlw && app_do_modal && !qt_try_modal(tlw, &ev) ) { + //even if we're blocked by modality, we should deliver the mouse release event.. + //### this code is not completely correct: multiple buttons can be pressed simultaneously + if (!(implicit_mouse_grabber && ev.buttons() == Qt::NoButton)) { + //qDebug() << "modal blocked mouse event to" << tlw; + return; + } + } else { + QWidget *mouseWindow = tlw; + + // find the tlw if we didn't get it from the plugin + if (!mouseWindow) { + mouseWindow = QApplication::topLevelAt(globalPoint); + } + + if (!mouseWindow && !implicit_mouse_grabber) + return; //nowhere to send it + + // which child should have it? + mouseWidget = mouseWindow; + if (mouseWindow) { + QWidget *w = mouseWindow->childAt(ev.pos()); + if (w) { + mouseWidget = w; + } + } + + //handle implicit mouse grab + if (ev.type() == QEvent::MouseButtonPress && !implicit_mouse_grabber) { + implicit_mouse_grabber = mouseWidget; + + Q_ASSERT(mouseWindow); + mouseWindow->activateWindow(); //focus + } else if (implicit_mouse_grabber) { + mouseWidget = implicit_mouse_grabber; + mouseWindow = mouseWidget->window(); + trustLocalPoint = (mouseWindow == tlw); + } + } + Q_ASSERT(mouseWidget); + + if (trustLocalPoint) { + // we have a sensible localPoint, so we prefer that, since the + // window system may know more than we do + localPoint = mouseWidget->mapFrom(tlw, localPoint); + } else { + // we don't want to map a local point from a different toplevel + // and we definitely don't want to map from the null pointer + localPoint = mouseWidget->mapFromGlobal(globalPoint); + } + + if (ev.buttons() == Qt::NoButton) { + //qDebug() << "resetting mouse grabber"; + implicit_mouse_grabber = 0; + } + + // Remember, we might enter a modal event loop when sending the event, + // so think carefully before adding code below this point. + + // qDebug() << "sending mouse ev." << ev.type() << localPoint << globalPoint << ev.button() << ev.buttons() << mouseWidget << "mouse grabber" << implicit_mouse_grabber; + + QMouseEvent e(ev.type(), localPoint, globalPoint, ev.button(), ev.buttons(), ev.modifiers()); + QApplication::sendSpontaneousEvent(mouseWidget, &e); + +} + + + +// Remember, Qt convention is: keyboard state is state *before* + +void QApplicationPrivate::handleKeyEvent(QWidget *tlw, QKeyEvent *e) +{ + QWidget *focusW = 0; + if (self->inPopupMode()) { + QWidget *popupW = qApp->activePopupWidget(); + focusW = popupW->focusWidget() ? popupW->focusWidget() : popupW; + } + if (!focusW) + focusW = QApplication::focusWidget(); + if (!focusW) + focusW = tlw; + if (!focusW) + focusW = QApplication::activeWindow(); + + //qDebug() << "handleKeyEvent" << hex << e->key() << e->modifiers() << e->text() << "widget" << focusW; + + if (!focusW) + return; + if (app_do_modal && !qt_try_modal(focusW, e)) + return; + + QApplication::sendSpontaneousEvent(focusW, e); +} + + +void QApplicationPrivate::handleGeometryChange(QWidget *tlw, const QRect &newRect) +{ + QRect cr(tlw->geometry()); + + bool isResize = cr.size() != newRect.size(); + bool isMove = cr.topLeft() != newRect.topLeft(); + tlw->data->crect = newRect; + if (isResize) { + QResizeEvent e(tlw->data->crect.size(), cr.size()); + QApplication::sendSpontaneousEvent(tlw, &e); + } + + if (isMove) { + //### frame geometry + QMoveEvent e(tlw->data->crect.topLeft(), cr.topLeft()); + QApplication::sendSpontaneousEvent(tlw, &e); + } +} +QT_END_NAMESPACE diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 3b6cd43..84182cb 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -571,6 +571,12 @@ public: void _q_readRX71MultiTouchEvents(); #endif +#ifdef Q_WS_LITE + static void handleMouseEvent(QWidget *tlw, const QMouseEvent &ev); + static void handleKeyEvent(QWidget *tlw, QKeyEvent *e); + static void handleGeometryChange(QWidget *tlw, const QRect &newRect); +#endif + private: #ifdef Q_WS_QWS QMap maxWindowRects; diff --git a/src/gui/kernel/qclipboard_lite.cpp b/src/gui/kernel/qclipboard_lite.cpp new file mode 100644 index 0000000..0d9268f --- /dev/null +++ b/src/gui/kernel/qclipboard_lite.cpp @@ -0,0 +1,163 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qclipboard.h" + +#ifndef QT_NO_CLIPBOARD + +#include "qmimedata.h" +#include "qapplication.h" + +QT_BEGIN_NAMESPACE + +QT_USE_NAMESPACE + + +class QClipboardData +{ +public: + QClipboardData(); + ~QClipboardData(); + + void setSource(QMimeData* s) + { + if (s == src) + return; + delete src; + src = s; + } + QMimeData* source() + { return src; } + + void clear(); + +private: + QMimeData* src; +}; + +QClipboardData::QClipboardData() +{ + src = 0; +} + +QClipboardData::~QClipboardData() +{ + delete src; +} + +void QClipboardData::clear() +{ + delete src; + src = 0; +} + + +static QClipboardData *internalCbData = 0; + +static void cleanupClipboardData() +{ + delete internalCbData; + internalCbData = 0; +} + +static QClipboardData *clipboardData() +{ + if (internalCbData == 0) { + internalCbData = new QClipboardData; + qAddPostRoutine(cleanupClipboardData); + } + return internalCbData; +} + + +void QClipboard::clear(Mode mode) +{ + setText(QString(), mode); +} + + +bool QClipboard::event(QEvent *e) +{ + return QObject::event(e); +} + +const QMimeData* QClipboard::mimeData(Mode mode) const +{ + if (mode != Clipboard) return 0; + + QClipboardData *d = clipboardData(); + return d->source(); +} + +void QClipboard::setMimeData(QMimeData* src, Mode mode) +{ + if (mode != Clipboard) return; + + QClipboardData *d = clipboardData(); + + d->setSource(src); + + emitChanged(QClipboard::Clipboard); +} + +bool QClipboard::supportsMode(Mode mode) const +{ + return (mode == Clipboard); +} + +bool QClipboard::ownsMode(Mode mode) const +{ + if (mode == Clipboard) + qWarning("QClipboard::ownsClipboard: UNIMPLEMENTED!"); + return false; +} + +void QClipboard::connectNotify( const char * ) +{ +} + +void QClipboard::ownerDestroyed() +{ +} + +#endif // QT_NO_CLIPBOARD + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h index 2a919b3..115a4cc 100644 --- a/src/gui/kernel/qcursor.h +++ b/src/gui/kernel/qcursor.h @@ -120,7 +120,7 @@ public: static int x11Screen(); #elif defined(Q_WS_MAC) Qt::HANDLE handle() const; -#elif defined(Q_WS_QWS) +#elif defined(Q_WS_QWS) || defined(Q_WS_LITE) int handle() const; #endif #endif diff --git a/src/gui/kernel/qcursor_lite.cpp b/src/gui/kernel/qcursor_lite.cpp new file mode 100644 index 0000000..5af03fc --- /dev/null +++ b/src/gui/kernel/qcursor_lite.cpp @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +QT_USE_NAMESPACE + +#ifndef QT_NO_CURSOR + +static int nextCursorId = Qt::BitmapCursor; + +/***************************************************************************** + Internal QCursorData class + *****************************************************************************/ + +QCursorData::QCursorData(Qt::CursorShape s) + : cshape(s), bm(0), bmm(0), hx(0), hy(0), id(s) +{ + ref = 1; +} + +QCursorData::~QCursorData() +{ + delete bm; + delete bmm; +} + + +/***************************************************************************** + Global cursors + *****************************************************************************/ + +extern QCursorData *qt_cursorTable[Qt::LastCursor + 1]; // qcursor.cpp + +int QCursor::handle() const +{ + return d->id; +} + + +QCursorData *QCursorData::setBitmap(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY) +{ + if (!QCursorData::initialized) + QCursorData::initialize(); + if (bitmap.depth() != 1 || mask.depth() != 1 || bitmap.size() != mask.size()) { + qWarning("QCursor: Cannot create bitmap cursor; invalid bitmap(s)"); + QCursorData *c = qt_cursorTable[0]; + c->ref.ref(); + return c; + } + QCursorData *d = new QCursorData; + d->bm = new QBitmap(bitmap); + d->bmm = new QBitmap(mask); + d->cshape = Qt::BitmapCursor; + d->id = ++nextCursorId; + d->hx = hotX >= 0 ? hotX : bitmap.width() / 2; + d->hy = hotY >= 0 ? hotY : bitmap.height() / 2; + + return d; +} + +void QCursorData::update() +{ +} + +#endif //QT_NO_CURSOR + +extern int qt_last_x,qt_last_y; + +QPoint QCursor::pos() +{ + return QPoint(qt_last_x, qt_last_y); +} + +void QCursor::setPos(int x, int y) +{ + // Need to check, since some X servers generate null mouse move + // events, causing looping in applications which call setPos() on + // every mouse move event. + // + if (pos() == QPoint(x, y)) + return; +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qcursor_p.h b/src/gui/kernel/qcursor_p.h index 94b751a..17164e7 100644 --- a/src/gui/kernel/qcursor_p.h +++ b/src/gui/kernel/qcursor_p.h @@ -88,7 +88,7 @@ struct QCursorData { short hx, hy; #if defined (Q_WS_MAC) int mId; -#elif defined(Q_WS_QWS) +#elif defined(Q_WS_QWS) || defined(Q_WS_LITE) int id; #endif #if defined (Q_WS_WIN) diff --git a/src/gui/kernel/qdesktopwidget_lite.cpp b/src/gui/kernel/qdesktopwidget_lite.cpp new file mode 100644 index 0000000..7aea787 --- /dev/null +++ b/src/gui/kernel/qdesktopwidget_lite.cpp @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdesktopwidget.h" +#include "private/qapplication_p.h" +#include "private/qgraphicssystem_p.h" + +QT_BEGIN_NAMESPACE + +QT_USE_NAMESPACE + +QDesktopWidget::QDesktopWidget() + : QWidget(0, Qt::Desktop) +{ + setObjectName(QLatin1String("desktop")); +} + +QDesktopWidget::~QDesktopWidget() +{ +} + +bool QDesktopWidget::isVirtualDesktop() const +{ + return true; +} + +int QDesktopWidget::primaryScreen() const +{ + return 0; +} + +int QDesktopWidget::numScreens() const +{ + QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); + if (!gs) + return 0; + return qMax(gs->screens().size(), 1); +} + +QWidget *QDesktopWidget::screen(int) +{ + return this; +} + +const QRect QDesktopWidget::availableGeometry(int screenNo) const +{ + QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); + if (!gs) + return QRect(); + QList screens = gs->screens(); + if (screenNo == -1) + screenNo = 0; + if (screenNo < 0 || screenNo >= screens.size()) + return QRect(); + else + return screens[screenNo]->availableGeometry(); +} + +const QRect QDesktopWidget::screenGeometry(int screenNo) const +{ + QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); + if (!gs) + return QRect(); + QList screens = gs->screens(); + if (screenNo == -1) + screenNo = 0; + if (screenNo < 0 || screenNo >= screens.size()) + return QRect(); + else + return screens[screenNo]->geometry(); +} + +int QDesktopWidget::screenNumber(const QWidget *w) const +{ + if (!w) + return 0; + + QRect frame = w->frameGeometry(); + if (!w->isWindow()) + frame.moveTopLeft(w->mapToGlobal(QPoint(0, 0))); + const QPoint midpoint = (frame.topLeft() + frame.bottomRight()) / 2; + return screenNumber(midpoint); +} + +int QDesktopWidget::screenNumber(const QPoint &p) const +{ + QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); + if (!gs) + return -1; + QList screens = gs->screens(); + + for (int i = 0; i < screens.size(); ++i) + if (screens[i]->geometry().contains(p)) + return i; + + return -1; +} + +void QDesktopWidget::resizeEvent(QResizeEvent *) +{ +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h index 1f64015..a9d5056 100644 --- a/src/gui/kernel/qdnd_p.h +++ b/src/gui/kernel/qdnd_p.h @@ -262,7 +262,7 @@ public: private: QPixmap *pm_cursor; int n_cursor; -#ifdef Q_WS_QWS +#if defined(Q_WS_QWS) || defined(Q_WS_LITE) Qt::DropAction currentActionForOverrideCursor; #endif diff --git a/src/gui/kernel/qgenericplugin_lite.cpp b/src/gui/kernel/qgenericplugin_lite.cpp new file mode 100644 index 0000000..29d7728 --- /dev/null +++ b/src/gui/kernel/qgenericplugin_lite.cpp @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgenericplugin_lite.h" + +#ifndef QT_NO_LIBRARY + +QT_BEGIN_NAMESPACE + +/*! + \class QGenericPlugin + \ingroup plugins + \ingroup lite + + \brief The QGenericPlugin class is an abstract base class for + window-system related plugins in Qt for Embedded Linux LITE. + + Note that this class is only available in \l{Qt for Embedded Linux LITE}. + + A mouse plugin can be created by subclassing + QGenericPlugin and reimplementing the pure virtual keys() and + create() functions. By exporting the derived class using the + Q_EXPORT_PLUGIN2() macro, The default implementation of the + QGenericPluginFactory class will automatically detect the plugin and + load the driver into the server application at run-time. See \l + {How to Create Qt Plugins} for details. + + \sa QGenericPluginFactory +*/ + +/*! + \fn QStringList QGenericPlugin::keys() const + + Implement this function to return the list of valid keys, i.e. the + drivers supported by this plugin. + + \sa create() +*/ + +/*! + Constructs a plugin with the given \a parent. + + Note that this constructor is invoked automatically by the + Q_EXPORT_PLUGIN2() macro, so there is no need for calling it + explicitly. +*/ +QGenericPlugin::QGenericPlugin(QObject *parent) + : QObject(parent) +{ +} + +/*! + Destroys the plugin. + + Note that Qt destroys a plugin automatically when it is no longer + used, so there is no need for calling the destructor explicitly. +*/ +QGenericPlugin::~QGenericPlugin() +{ +} + +/*! + \fn QObject* QGenericPlugin::create(const QString &key, const QString& specification) + + Implement this function to create a driver matching the type + specified by the given \a key and \a specification parameters. Note that + keys are case-insensitive. + + \sa keys() +*/ + +QT_END_NAMESPACE + +#endif // QT_NO_LIBRARY diff --git a/src/gui/kernel/qgenericplugin_lite.h b/src/gui/kernel/qgenericplugin_lite.h new file mode 100644 index 0000000..2c0ee7a --- /dev/null +++ b/src/gui/kernel/qgenericplugin_lite.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGENERICPLUGIN_LITE_H +#define QGENERICPLUGIN_LITE_H + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_LIBRARY + +//class QGenericObject; ????? + + struct Q_GUI_EXPORT QGenericPluginFactoryInterface : public QFactoryInterface +{ + virtual QObject* create(const QString &name, const QString &spec) = 0; +}; + +#define QGenericPluginFactoryInterface_iid "com.trolltech.Qt.QGenericPluginFactoryInterface" +Q_DECLARE_INTERFACE(QGenericPluginFactoryInterface, QGenericPluginFactoryInterface_iid) + +class Q_GUI_EXPORT QGenericPlugin : public QObject, public QGenericPluginFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QGenericPluginFactoryInterface:QFactoryInterface) +public: + explicit QGenericPlugin(QObject *parent = 0); + ~QGenericPlugin(); + + virtual QStringList keys() const = 0; + virtual QObject* create(const QString& name, const QString &spec) = 0; +}; + +#endif // QT_NO_LIBRARY + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMOUSEDRIVERPLUGIN_QWS_H diff --git a/src/gui/kernel/qgenericpluginfactory_lite.cpp b/src/gui/kernel/qgenericpluginfactory_lite.cpp new file mode 100644 index 0000000..4e5b12b --- /dev/null +++ b/src/gui/kernel/qgenericpluginfactory_lite.cpp @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgenericpluginfactory_lite.h" + +#include "qapplication.h" +#include "private/qfactoryloader_p.h" +#include "qgenericplugin_lite.h" +#include "qdebug.h" + +QT_BEGIN_NAMESPACE + +#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL) +#ifndef QT_NO_LIBRARY + +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, + (QGenericPluginFactoryInterface_iid, + QLatin1String("/generic"), Qt::CaseInsensitive)) + +#endif //QT_NO_LIBRARY +#endif //QT_MAKEDLL + +/*! + \class QGenericPluginFactory + \ingroup qws + + \brief The QGenericPluginFactory class creates window-system + related plugin drivers in Qt for Embedded Linux LITE. + + Note that this class is only available in \l{Qt for Embedded Linux LITE}. + + + \sa QGenericPlugin +*/ + +/*! + Creates the driver specified by \a key, using the given \a specification. + + Note that the keys are case-insensitive. + + \sa keys() +*/ +QObject *QGenericPluginFactory::create(const QString& key, const QString &specification) +{ + QString driver = key.toLower(); + +#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL) +#ifndef QT_NO_LIBRARY + if (QGenericPluginFactoryInterface *factory = qobject_cast(loader()->instance(driver))) + return factory->create(driver, specification); +#endif +#endif + return 0; +} + +/*! + Returns the list of valid keys, i.e. the available mouse drivers. + + \sa create() +*/ +QStringList QGenericPluginFactory::keys() +{ + QStringList list; + +#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL) +#ifndef QT_NO_LIBRARY + QStringList plugins = loader()->keys(); + for (int i = 0; i < plugins.size(); ++i) { + if (!list.contains(plugins.at(i))) + list += plugins.at(i); + } +#endif //QT_NO_LIBRARY +#endif //QT_MAKEDLL + return list; +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qgenericpluginfactory_lite.h b/src/gui/kernel/qgenericpluginfactory_lite.h new file mode 100644 index 0000000..3be4614 --- /dev/null +++ b/src/gui/kernel/qgenericpluginfactory_lite.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGENERICPLUGINFACTORY_LITE_H +#define QGENERICPLUGINFACTORY_LITE_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QString; +class QObject; + +class Q_GUI_EXPORT QGenericPluginFactory +{ +public: + static QStringList keys(); + static QObject *create(const QString&, const QString &); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QGENERICPLUGINFACTORY_QWS_H diff --git a/src/gui/kernel/qsound_lite.cpp b/src/gui/kernel/qsound_lite.cpp new file mode 100644 index 0000000..2e2c1e8 --- /dev/null +++ b/src/gui/kernel/qsound_lite.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qapplication.h" + +#ifndef QT_NO_SOUND + +#include "qsound.h" +#include "qsound_p.h" + +class QAuServerLite : public QAuServer +{ + Q_OBJECT +public: + QAuServerLite( QObject* parent ); + + void play( QSound* s ) {} + void stop( QSound* s ) {} + bool okay() { return false; } +}; + +QAuServerLite::QAuServerLite(QObject* parent) : + QAuServer(parent) +{ +} + +QAuServer* qt_new_audio_server() +{ + return new QAuServerLite(qApp); +} + +#include "qsound_lite.moc" + +#endif // QT_NO_SOUND + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 44f9db1..a3b861e 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -5266,7 +5266,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP //actually send the paint event QPaintEvent e(toBePainted); QCoreApplication::sendSpontaneousEvent(q, &e); -#if !defined(Q_WS_MAC) && !defined(Q_WS_QWS) +#if !defined(Q_WS_MAC) && !defined(Q_WS_QWS) && !defined(Q_WS_LITE) if (backingStore && !onScreen && !asRoot && (q->internalWinId() || !q->nativeParentWidget()->isWindow())) backingStore->markDirtyOnScreen(toBePainted, q, offset); #endif diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp new file mode 100644 index 0000000..bbc7766 --- /dev/null +++ b/src/gui/kernel/qwidget_lite.cpp @@ -0,0 +1,616 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwidget.h" +#include "qevent.h" +#include "qapplication.h" +#include "private/qbackingstore_p.h" +#include "private/qwidget_p.h" +#include "private/qgraphicssystem_p.h" +#include "private/qapplication_p.h" + +QT_BEGIN_NAMESPACE + +void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool /*destroyOldWindow*/) +{ + Q_Q(QWidget); + + Q_UNUSED(window); + Q_UNUSED(initializeWindow); + // XXX + + + Qt::WindowFlags flags = data.window_flags; + +#if 1 + QWindowSurface *surface = q->windowSurface(); + if (surface && (flags & Qt::Window)) + data.window_flags = surface->setWindowFlags(data.window_flags); +#endif +// qDebug() << "create_sys" << q; +} + +void QWidget::destroy(bool destroyWindow, bool destroySubWindows) +{ + Q_UNUSED(destroyWindow); + Q_UNUSED(destroySubWindows); + // XXX + + + if ((windowType() == Qt::Popup)) + qApp->d_func()->closePopup(this); + +} + +void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) +{ + Q_Q(QWidget); + + QWidget *oldParent = q->parentWidget(); + Qt::WindowFlags oldFlags = data.window_flags; + if (parent != newparent) { + QObjectPrivate::setParent_helper(newparent); //### why does this have to be done in the _sys function??? + + } + if (!newparent) { + f |= Qt::Window; + } + data.window_flags = f; + if (f & Qt::Window) { + //qDebug() << "setParent_sys" << q << newparent << hex << f; + if (QWindowSurface *surface = q->windowSurface()) + data.window_flags = surface->setWindowFlags(data.window_flags); + } + // XXX Reparenting child to toplevel or vice versa ### + if ((f&Qt::Window) && !(oldFlags&Qt::Window)) { + qDebug() << "setParent_sys() change to toplevel"; + q->create(); //### this cannot be right + } else if ((f&Qt::Window) && !(oldFlags&Qt::Window)) { + qDebug() << "######## setParent_sys() change from toplevel not implemented ########"; + } +} + +QPoint QWidget::mapToGlobal(const QPoint &pos) const +{ + int x=pos.x(), y=pos.y(); + const QWidget* w = this; + while (w) { + x += w->data->crect.x(); + y += w->data->crect.y(); + w = w->isWindow() ? 0 : w->parentWidget(); + } + return QPoint(x, y); +} + +QPoint QWidget::mapFromGlobal(const QPoint &pos) const +{ + int x=pos.x(), y=pos.y(); + const QWidget* w = this; + while (w) { + x -= w->data->crect.x(); + y -= w->data->crect.y(); + w = w->isWindow() ? 0 : w->parentWidget(); + } + return QPoint(x, y); +} + +void QWidgetPrivate::updateSystemBackground() {} + +#ifndef QT_NO_CURSOR +void QWidgetPrivate::setCursor_sys(const QCursor &cursor) +{ + Q_UNUSED(cursor); + Q_Q(QWidget); + if (q->isVisible()) + updateCursor(); +} + +void QWidgetPrivate::unsetCursor_sys() +{ + Q_Q(QWidget); + if (q->isVisible()) + updateCursor(); +} + +void QWidgetPrivate::updateCursor() const +{ + // XXX +} + +#endif //QT_NO_CURSOR + +void QWidgetPrivate::setWindowTitle_sys(const QString &caption) +{ + Q_UNUSED(caption); + // XXX +} + +void QWidgetPrivate::setWindowIcon_sys(bool /*forceReset*/) +{ +} + +void QWidgetPrivate::setWindowIconText_sys(const QString &iconText) +{ + Q_UNUSED(iconText); +} + +QWidget *qt_pressGrab = 0; +QWidget *qt_mouseGrb = 0; +static QWidget *keyboardGrb = 0; + +void QWidget::grabMouse() +{ + if (qt_mouseGrb) + qt_mouseGrb->releaseMouse(); + + // XXX + //qwsDisplay()->grabMouse(this,true); + + qt_mouseGrb = this; + qt_pressGrab = 0; +} + +#ifndef QT_NO_CURSOR +void QWidget::grabMouse(const QCursor &cursor) +{ + Q_UNUSED(cursor); + + if (qt_mouseGrb) + qt_mouseGrb->releaseMouse(); + + // XXX + //qwsDisplay()->grabMouse(this,true); + //qwsDisplay()->selectCursor(this, cursor.handle()); + qt_mouseGrb = this; + qt_pressGrab = 0; +} +#endif + +void QWidget::releaseMouse() +{ + if (qt_mouseGrb == this) { + // XXX + //qwsDisplay()->grabMouse(this,false); + qt_mouseGrb = 0; + } +} + +void QWidget::grabKeyboard() +{ + if (keyboardGrb) + keyboardGrb->releaseKeyboard(); + // XXX + //qwsDisplay()->grabKeyboard(this, true); + keyboardGrb = this; +} + +void QWidget::releaseKeyboard() +{ + if (keyboardGrb == this) { + // XXX + //qwsDisplay()->grabKeyboard(this, false); + keyboardGrb = 0; + } +} + +QWidget *QWidget::mouseGrabber() +{ + if (qt_mouseGrb) + return qt_mouseGrb; + return qt_pressGrab; +} + +QWidget *QWidget::keyboardGrabber() +{ + return keyboardGrb; +} + +void QWidget::activateWindow() +{ + // XXX +// qDebug() << "QWidget::activateWindow" << this; + QApplication::setActiveWindow(this); //##### +} + +void QWidgetPrivate::show_sys() +{ + Q_Q(QWidget); + q->setAttribute(Qt::WA_Mapped); + if (q->testAttribute(Qt::WA_DontShowOnScreen)) { + invalidateBuffer(q->rect()); + return; + } + + QApplication::postEvent(q, new QUpdateLaterEvent(q->rect())); + + if (!q->isWindow()) + return; + + if (QWindowSurface *surface = q->windowSurface()) { + const QRect geomRect = q->geometry(); + if (surface->geometry() != geomRect) + surface->setGeometry(geomRect); + surface->setVisible(true); + } + + if (q->windowType() != Qt::Popup) + q->activateWindow(); //### +} + + +void QWidgetPrivate::hide_sys() +{ + Q_Q(QWidget); + q->setAttribute(Qt::WA_Mapped, false); + if (!q->isWindow()) { + QWidget *p = q->parentWidget(); + if (p &&p->isVisible()) { + invalidateBuffer(q->rect()); + } + return; + } + if (QWindowSurface *surface = q->windowSurface()) { + surface->setVisible(false); + } + + //### we don't yet have proper focus event handling + if (q == QApplicationPrivate::active_window) + QApplication::setActiveWindow(0); + +} + +void QWidgetPrivate::setMaxWindowState_helper() +{ + // XXX +} + +void QWidgetPrivate::setFullScreenSize_helper() +{ + // XXX +} + +static Qt::WindowStates effectiveState(Qt::WindowStates state) + { + if (state & Qt::WindowMinimized) + return Qt::WindowMinimized; + else if (state & Qt::WindowFullScreen) + return Qt::WindowFullScreen; + else if (state & Qt::WindowMaximized) + return Qt::WindowMaximized; + return Qt::WindowNoState; + } + +void QWidget::setWindowState(Qt::WindowStates newstate) +{ + Q_D(QWidget); + Qt::WindowStates oldstate = windowState(); + if (oldstate == newstate) + return; + if (isWindow() && !testAttribute(Qt::WA_WState_Created)) + create(); + + data->window_state = newstate; + data->in_set_window_state = 1; + bool needShow = false; + Qt::WindowStates newEffectiveState = effectiveState(newstate); + Qt::WindowStates oldEffectiveState = effectiveState(oldstate); + if (isWindow() && newEffectiveState != oldEffectiveState) { + d->createTLExtra(); + if (oldEffectiveState == Qt::WindowNoState) { //normal + d->topData()->normalGeometry = geometry(); + } else if (oldEffectiveState == Qt::WindowFullScreen) { + setParent(0, d->topData()->savedFlags); + needShow = true; + } else if (oldEffectiveState == Qt::WindowMinimized) { + needShow = true; + } + + if (newEffectiveState == Qt::WindowMinimized) { + //### not ideal... + hide(); + needShow = false; + } else if (newEffectiveState == Qt::WindowFullScreen) { + d->topData()->savedFlags = windowFlags(); + setParent(0, Qt::FramelessWindowHint | (windowFlags() & Qt::WindowStaysOnTopHint)); + d->setFullScreenSize_helper(); + raise(); + needShow = true; + } else if (newEffectiveState == Qt::WindowMaximized) { + createWinId(); + d->setMaxWindowState_helper(); + } else { //normal + QRect r = d->topData()->normalGeometry; + if (r.width() >= 0) { + d->topData()->normalGeometry = QRect(0,0,-1,-1); + setGeometry(r); + } + } + } + data->in_set_window_state = 0; + + if (needShow) + show(); + + if (newstate & Qt::WindowActive) + activateWindow(); + + QWindowStateChangeEvent e(oldstate); + QApplication::sendEvent(this, &e); +} + +void QWidgetPrivate::setFocus_sys() +{ + +} + +void QWidgetPrivate::raise_sys() +{ + // XXX +} + +void QWidgetPrivate::lower_sys() +{ + // XXX +} + +void QWidgetPrivate::stackUnder_sys(QWidget*) +{ + // XXX +} + +void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) +{ + Q_Q(QWidget); + if (extra) { // any size restrictions? + w = qMin(w,extra->maxw); + h = qMin(h,extra->maxh); + w = qMax(w,extra->minw); + h = qMax(h,extra->minh); + } + + QPoint oldp = q->geometry().topLeft(); + QSize olds = q->size(); + QRect r(x, y, w, h); + + bool isResize = olds != r.size(); + isMove = oldp != r.topLeft(); //### why do we have isMove as a parameter? + + + // We only care about stuff that changes the geometry, or may + // cause the window manager to change its state + if (r.size() == olds && oldp == r.topLeft()) + return; + + if (!data.in_set_window_state) { + q->data->window_state &= ~Qt::WindowMaximized; + q->data->window_state &= ~Qt::WindowFullScreen; + if (q->isWindow()) + topData()->normalGeometry = QRect(0, 0, -1, -1); + } + + QPoint oldPos = q->pos(); + data.crect = r; + + if (q->isVisible()) { + + if (q->isWindow()) { + const QWidgetBackingStore *bs = maybeBackingStore(); + if (bs->windowSurface) + bs->windowSurface->setGeometry(q->frameGeometry()); + } else { + if (isMove && !isResize) + moveRect(QRect(oldPos, olds), x - oldPos.x(), y - oldPos.y()); + else + invalidateBuffer_resizeHelper(oldPos, olds); + } + + if (isMove) { + QMoveEvent e(q->pos(), oldPos); + QApplication::sendEvent(q, &e); + } + if (isResize) { + QResizeEvent e(r.size(), olds); + QApplication::sendEvent(q, &e); + } + } else { // not visible + if (isMove && q->pos() != oldPos) + q->setAttribute(Qt::WA_PendingMoveEvent, true); + if (isResize) + q->setAttribute(Qt::WA_PendingResizeEvent, true); + } + +} + +void QWidgetPrivate::setConstraints_sys() +{ +} + +void QWidgetPrivate::scroll_sys(int dx, int dy) +{ + Q_Q(QWidget); + scrollChildren(dx, dy); + scrollRect(q->rect(), dx, dy); +} + +void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r) +{ + scrollRect(r, dx, dy); +} + +static QGraphicsSystemScreen *qt_screenForWidget(const QWidget *w) +{ + if (!w) + return 0; + QRect frame = w->frameGeometry(); + if (!w->isWindow()) + frame.moveTopLeft(w->mapToGlobal(QPoint(0, 0))); + const QPoint p = (frame.topLeft() + frame.bottomRight()) / 2; + + QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); + if (!gs) { + qWarning("qt_screenForWidget: no graphics system"); + return 0; + } + QList screens = gs->screens(); + + for (int i = 0; i < screens.size(); ++i) { + if (screens[i]->geometry().contains(p)) + return screens[i]; + } + + // Assume screen zero if we have it. + if (!screens.isEmpty()) + return screens[0]; + else + qWarning("qt_screenForWidget: no screens"); + + return 0; +} + +int QWidget::metric(PaintDeviceMetric m) const +{ + Q_D(const QWidget); + + QGraphicsSystemScreen *screen = qt_screenForWidget(this); + if (!screen) { + if (m == PdmDpiX || m == PdmDpiY) + return 72; + return QPaintDevice::metric(m); + } + int val; + if (m == PdmWidth) { + val = data->crect.width(); + } else if (m == PdmWidthMM) { + val = data->crect.width() * screen->physicalSize().width() / screen->geometry().width(); + } else if (m == PdmHeight) { + val = data->crect.height(); + } else if (m == PdmHeightMM) { + val = data->crect.height() * screen->physicalSize().height() / screen->geometry().height(); + } else if (m == PdmDepth) { + return screen->depth(); + } else if (m == PdmDpiX || m == PdmPhysicalDpiX) { + if (d->extra && d->extra->customDpiX) + return d->extra->customDpiX; + else if (d->parent) + return static_cast(d->parent)->metric(m); + return qRound(screen->geometry().width() / double(screen->physicalSize().width() / 25.4)); + } else if (m == PdmDpiY || m == PdmPhysicalDpiY) { + if (d->extra && d->extra->customDpiY) + return d->extra->customDpiY; + else if (d->parent) + return static_cast(d->parent)->metric(m); + return qRound(screen->geometry().height() / double(screen->physicalSize().height() / 25.4)); + } else { + val = QPaintDevice::metric(m);// XXX + } + return val; +} + +void QWidgetPrivate::createSysExtra() +{ +} + +void QWidgetPrivate::deleteSysExtra() +{ +} + +void QWidgetPrivate::createTLSysExtra() +{ +} + +void QWidgetPrivate::deleteTLSysExtra() +{ +} + +void QWidgetPrivate::registerDropSite(bool on) +{ + Q_UNUSED(on); +} + +void QWidgetPrivate::setMask_sys(const QRegion ®ion) +{ + Q_UNUSED(region); + // XXX +} + +void QWidgetPrivate::updateFrameStrut() +{ + // XXX +} + +void QWidgetPrivate::setWindowOpacity_sys(qreal level) +{ + Q_UNUSED(level); + // XXX +} + +void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect) +{ + Q_UNUSED(dontShow); + Q_UNUSED(oldRect); + // XXX +} + +QPaintEngine *QWidget::paintEngine() const +{ + qWarning("QWidget::paintEngine: Should no longer be called"); + return 0; //##### @@@ +} + +QWindowSurface *QWidgetPrivate::createDefaultWindowSurface_sys() +{ + Q_Q(QWidget); + if (q->windowType() == Qt::Desktop) + return 0; + q->ensurePolished(); + + QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); + if (!gs) + return 0; + + return gs->createWindowSurface(q); +} + +void QWidgetPrivate::setModal_sys() +{ +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index f69c3a7..3636ffb 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -681,6 +681,12 @@ public: void updateCursor() const; #endif QScreen* getScreen() const; +#elif defined(Q_WS_LITE) + void setMaxWindowState_helper(); + void setFullScreenSize_helper(); +#ifndef QT_NO_CURSOR + void updateCursor() const; +#endif #elif defined(Q_OS_SYMBIAN) // <--------------------------------------------------------- SYMBIAN static QWidget *mouseGrabber; static QWidget *keyboardGrabber; diff --git a/src/gui/kernel/qwindowdefs.h b/src/gui/kernel/qwindowdefs.h index da3425d..a114bb1 100644 --- a/src/gui/kernel/qwindowdefs.h +++ b/src/gui/kernel/qwindowdefs.h @@ -131,6 +131,12 @@ QT_END_HEADER #endif // Q_WS_QWS +#if defined(Q_WS_LITE) + +typedef unsigned long WId; + +#endif // Q_WS_LITE + #if defined(Q_OS_SYMBIAN) class CCoeControl; typedef CCoeControl * WId; diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 5abac2f..1f2076c 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -136,7 +136,7 @@ unix:x11 { painting/qpaintengine_x11.cpp } -!embedded:!x11:mac { +!embedded:!embedded_lite:!x11:mac { HEADERS += \ painting/qpaintengine_mac_p.h \ painting/qgraphicssystem_mac_p.h \ @@ -152,14 +152,14 @@ unix:x11 { painting/qprintengine_mac.mm \ } -unix:!mac:!symbian { +unix:!mac:!symbian|embedded_lite { HEADERS += \ painting/qprinterinfo_unix_p.h SOURCES += \ painting/qprinterinfo_unix.cpp } -win32|x11|mac|embedded|symbian { +win32|x11|mac|embedded|embedded_lite|symbian { SOURCES += painting/qbackingstore.cpp HEADERS += painting/qbackingstore_p.h } @@ -176,13 +176,19 @@ embedded { painting/qpaintdevice_qws.cpp } +embedded_lite { + SOURCES += \ + painting/qcolormap_lite.cpp \ + painting/qpaintdevice_lite.cpp +} + symbian { SOURCES += \ painting/qregion_s60.cpp \ painting/qcolormap_s60.cpp } -x11|embedded { +x11|embedded|embedded_lite { contains(QT_CONFIG,qtopia) { DEFINES += QT_NO_CUPS QT_NO_LPR } else { @@ -348,7 +354,7 @@ x11 { SOURCES += painting/qwindowsurface_x11.cpp } -mac { +!embedded:!embedded_lite:mac { HEADERS += painting/qwindowsurface_mac_p.h SOURCES += painting/qwindowsurface_mac.cpp } diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index e82f36e..d1ead97 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -691,9 +691,12 @@ void QWidgetBackingStore::markDirtyOnScreen(const QRegion ®ion, QWidget *widg } // Alien widgets. - if (!widget->internalWinId()) { - QWidget *nativeParent = widget->nativeParentWidget(); - // Alien widgets with the top-level as the native parent (common case). + if (!widget->internalWinId() && !widget->isWindow()) { //### LITEHACK we need winid support!!! +#ifdef Q_WS_LITE + QWidget *nativeParent = widget->window(); //### LITEHACK so far only toplevels are native +#else + QWidget *nativeParent = widget->nativeParentWidget(); // Alien widgets with the top-level as the native parent (common case). +#endif if (nativeParent == tlw) { if (!widget->testAttribute(Qt::WA_WState_InPaintEvent)) dirtyOnScreen += region.translated(topLevelOffset); diff --git a/src/gui/painting/qcolormap_lite.cpp b/src/gui/painting/qcolormap_lite.cpp new file mode 100644 index 0000000..b8ae1af --- /dev/null +++ b/src/gui/painting/qcolormap_lite.cpp @@ -0,0 +1,235 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qcolormap.h" +#include "qcolor.h" +#include "qpaintdevice.h" +#include "private/qapplication_p.h" +#include "private/qgraphicssystem_p.h" + +QT_BEGIN_NAMESPACE + +class QColormapPrivate +{ +public: + inline QColormapPrivate() + : ref(1), mode(QColormap::Direct), depth(0), numcolors(0) + { } + + QAtomicInt ref; + + QColormap::Mode mode; + int depth; + int numcolors; +}; + +static QColormapPrivate *screenMap = 0; + +void QColormap::initialize() +{ + screenMap = new QColormapPrivate; + + QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); + if (!gs) + return; + QList screens = gs->screens(); + if (screens.isEmpty()) + return; + + screenMap->depth = screens[0]->depth(); + if (screenMap->depth < 8) { + screenMap->mode = QColormap::Indexed; + screenMap->numcolors = 256; + } else { + screenMap->mode = QColormap::Direct; + screenMap->numcolors = -1; + } +} + +void QColormap::cleanup() +{ + delete screenMap; + screenMap = 0; +} + +QColormap QColormap::instance(int /*screen*/) +{ + return QColormap(); +} + +QColormap::QColormap() + : d(screenMap) +{ d->ref.ref(); } + +QColormap::QColormap(const QColormap &colormap) + :d (colormap.d) +{ d->ref.ref(); } + +QColormap::~QColormap() +{ + if (!d->ref.deref()) + delete d; +} + +QColormap::Mode QColormap::mode() const +{ return d->mode; } + + +int QColormap::depth() const +{ return d->depth; } + + +int QColormap::size() const +{ + return d->numcolors; +} + +#ifndef QT_QWS_DEPTH16_RGB +#define QT_QWS_DEPTH16_RGB 565 +#endif +static const int qt_rbits = (QT_QWS_DEPTH16_RGB/100); +static const int qt_gbits = (QT_QWS_DEPTH16_RGB/10%10); +static const int qt_bbits = (QT_QWS_DEPTH16_RGB%10); +static const int qt_red_shift = qt_bbits+qt_gbits-(8-qt_rbits); +static const int qt_green_shift = qt_bbits-(8-qt_gbits); +static const int qt_neg_blue_shift = 8-qt_bbits; +static const int qt_blue_mask = (1<> qt_neg_blue_shift; + + return (tb & qt_blue_mask) | (tg & qt_green_mask) | (tr & qt_red_mask); +} + +inline QRgb qt_conv16ToRgb(ushort c) +{ + const int r=(c & qt_red_mask); + const int g=(c & qt_green_mask); + const int b=(c & qt_blue_mask); + const int tr = r >> qt_red_shift | r >> qt_red_rounding_shift; + const int tg = g >> qt_green_shift | g >> qt_green_rounding_shift; + const int tb = b << qt_neg_blue_shift | b >> qt_blue_rounding_shift; + + return qRgb(tr,tg,tb); +} + +uint QColormap::pixel(const QColor &color) const +{ + QRgb rgb = color.rgba(); + if (d->mode == QColormap::Direct) { + switch(d->depth) { + case 16: + return qt_convRgbTo16(rgb); + case 24: + case 32: + { + const int r = qRed(rgb); + const int g = qGreen(rgb); + const int b = qBlue(rgb); + const int red_shift = 16; + const int green_shift = 8; + const int red_mask = 0xff0000; + const int green_mask = 0x00ff00; + const int blue_mask = 0x0000ff; + const int tg = g << green_shift; +#ifdef QT_QWS_DEPTH_32_BGR + if (qt_screen->pixelType() == QScreen::BGRPixel) { + const int tb = b << red_shift; + return 0xff000000 | (r & blue_mask) | (tg & green_mask) | (tb & red_mask); + } +#endif + const int tr = r << red_shift; + return 0xff000000 | (b & blue_mask) | (tg & green_mask) | (tr & red_mask); + } + } + } + //XXX + //return qt_screen->alloc(qRed(rgb), qGreen(rgb), qBlue(rgb)); + return 0; +} + +const QColor QColormap::colorAt(uint pixel) const +{ + if (d->mode == Direct) { + if (d->depth == 16) { + pixel = qt_conv16ToRgb(pixel); + } + const int red_shift = 16; + const int green_shift = 8; + const int red_mask = 0xff0000; + const int green_mask = 0x00ff00; + const int blue_mask = 0x0000ff; +#ifdef QT_QWS_DEPTH_32_BGR + if (qt_screen->pixelType() == QScreen::BGRPixel) { + return QColor((pixel & blue_mask), + (pixel & green_mask) >> green_shift, + (pixel & red_mask) >> red_shift); + } +#endif + return QColor((pixel & red_mask) >> red_shift, + (pixel & green_mask) >> green_shift, + (pixel & blue_mask)); + } +#if 0 // XXX + Q_ASSERT_X(int(pixel) < qt_screen->numCols(), "QColormap::colorAt", "pixel out of bounds of palette"); + return QColor(qt_screen->clut()[pixel]); +#endif + return QColor(); +} + +const QVector QColormap::colormap() const +{ + return QVector(); +} + +QColormap &QColormap::operator=(const QColormap &colormap) +{ qAtomicAssign(d, colormap.d); return *this; } + +QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystem.cpp b/src/gui/painting/qgraphicssystem.cpp index a7f5efb..ce8e500 100644 --- a/src/gui/painting/qgraphicssystem.cpp +++ b/src/gui/painting/qgraphicssystem.cpp @@ -50,6 +50,9 @@ #ifdef Q_WS_MAC # include #endif +#ifdef Q_WS_LITE +# include +#endif QT_BEGIN_NAMESPACE @@ -68,11 +71,26 @@ QPixmapData *QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixelType typ return new QRasterPixmapData(type); #elif defined(Q_WS_MAC) return new QMacPixmapData(type); +#elif defined(Q_WS_LITE) + return new QRasterPixmapData(type); #elif !defined(Q_WS_QWS) #error QGraphicsSystem::createDefaultPixmapData() not implemented #endif return 0; } +QList QGraphicsSystem::screens() const +{ + return QList(); +} + +QGraphicsSystemScreen::~QGraphicsSystemScreen() +{ +} + +QRect QGraphicsSystemScreen::availableGeometry() const +{ + return geometry(); +} QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystem_p.h b/src/gui/painting/qgraphicssystem_p.h index c4f87f7..7e1ef67 100644 --- a/src/gui/painting/qgraphicssystem_p.h +++ b/src/gui/painting/qgraphicssystem_p.h @@ -60,6 +60,18 @@ QT_BEGIN_NAMESPACE class QPixmapFilter; +class Q_GUI_EXPORT QGraphicsSystemScreen +{ +public: + virtual ~QGraphicsSystemScreen(); + + virtual QRect geometry() const = 0; + virtual QRect availableGeometry() const; + virtual int depth() const = 0; + virtual QImage::Format format() const = 0; + virtual QSize physicalSize() const = 0; +}; + class Q_GUI_EXPORT QGraphicsSystem { public: @@ -68,6 +80,8 @@ public: virtual ~QGraphicsSystem() = 0; + virtual QList screens() const; + //### Remove this & change qpixmap.cpp & qbitmap.cpp once every platform is gaurenteed // to have a graphics system. static QPixmapData *createDefaultPixmapData(QPixmapData::PixelType type); diff --git a/src/gui/painting/qpaintdevice.cpp b/src/gui/painting/qpaintdevice.cpp index 7ee0818..b6bd40c 100644 --- a/src/gui/painting/qpaintdevice.cpp +++ b/src/gui/painting/qpaintdevice.cpp @@ -59,10 +59,12 @@ QPaintDevice::~QPaintDevice() } +#ifndef Q_WS_LITE int QPaintDevice::metric(PaintDeviceMetric) const { qWarning("QPaintDevice::metrics: Device has no metric information"); return 0; } +#endif QT_END_NAMESPACE diff --git a/src/gui/painting/qpaintdevice_lite.cpp b/src/gui/painting/qpaintdevice_lite.cpp new file mode 100644 index 0000000..2560bf5 --- /dev/null +++ b/src/gui/painting/qpaintdevice_lite.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qpaintdevice.h" +#include "qpainter.h" +#include "qwidget.h" +#include "qbitmap.h" +#include "qapplication.h" + +QT_BEGIN_NAMESPACE + +extern void qt_painter_removePaintDevice(QPaintDevice *); //qpainter.cpp + +int QPaintDevice::metric(PaintDeviceMetric m) const +{ + qWarning("QPaintDevice::metrics: Device has no metric information"); + if (m == PdmDpiX) { + return 72; + } else if (m == PdmDpiY) { + return 72; + } else if (m == PdmNumColors) { + // FIXME: does this need to be a real value? + return 256; + } else { + qDebug("Unrecognised metric %d!",m); + return 0; + } +} + +QT_END_NAMESPACE diff --git a/src/gui/painting/qpaintengine.h b/src/gui/painting/qpaintengine.h index 921db4f..6da0a2f 100644 --- a/src/gui/painting/qpaintengine.h +++ b/src/gui/painting/qpaintengine.h @@ -270,6 +270,9 @@ private: friend class QtopiaPrintEnginePrivate; friend class QProxyFontEngine; #endif +#ifdef Q_WS_LITE + friend class QProxyFontEngine; +#endif friend class QPainter; friend class QPainterPrivate; friend class QWidget; diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index d138663..3e3e8b9 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -1627,7 +1627,7 @@ QT_END_INCLUDE_NAMESPACE QT_BEGIN_INCLUDE_NAMESPACE # include "qregion_win.cpp" QT_END_INCLUDE_NAMESPACE -#elif defined(Q_WS_QWS) +#elif defined(Q_WS_QWS) || defined(Q_WS_LITE) static QRegionPrivate qrp; QRegion::QRegionData QRegion::shared_empty = {Q_BASIC_ATOMIC_INITIALIZER(1), &qrp}; #endif @@ -4233,7 +4233,7 @@ QRect QRegion::boundingRect() const Returns true if \a rect is guaranteed to be fully contained in \a region. A false return value does not guarantee the opposite. */ -#ifdef Q_WS_QWS +#if defined(Q_WS_QWS) || defined(Q_WS_LITE) Q_GUI_EXPORT #endif bool qt_region_strictContains(const QRegion ®ion, const QRect &rect) diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h index 226e3fa..786283c 100644 --- a/src/gui/painting/qregion.h +++ b/src/gui/painting/qregion.h @@ -59,7 +59,7 @@ QT_MODULE(Gui) template class QVector; class QVariant; -#if defined(Q_WS_QWS) || defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) struct QRegionPrivate; #endif @@ -160,7 +160,7 @@ public: #endif HIMutableShapeRef toHIMutableShape() const; static QRegion fromHIShapeRef(HIShapeRef shape); -#elif defined(Q_WS_QWS) +#elif defined(Q_WS_QWS) || defined(Q_WS_LITE) inline void *handle() const { return d->qt_rgn; } #endif #endif @@ -200,7 +200,7 @@ private: #elif defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA) mutable RgnHandle unused; // Here for binary compatability reasons. ### Qt 5 remove. #endif -#if defined(Q_WS_QWS) || defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) QRegionPrivate *qt_rgn; #endif }; diff --git a/src/gui/painting/qwindowsurface.cpp b/src/gui/painting/qwindowsurface.cpp index 1bd343d..c750a05 100644 --- a/src/gui/painting/qwindowsurface.cpp +++ b/src/gui/painting/qwindowsurface.cpp @@ -349,4 +349,35 @@ void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset) } } + +#ifdef Q_WS_LITE +/*! +Requests setting the window flags of this surface to \a type. Returns the actual flags set. +*/ +Qt::WindowFlags QWindowSurface::setWindowFlags(Qt::WindowFlags type) +{ + Q_UNUSED(type); + qDebug() << "QWindowSurface::setWindowFlags" << hex << type; + return Qt::Window; +} + +/*! + Returns the effective window flags for this surface. +*/ +Qt::WindowFlags QWindowSurface::windowFlags() const +{ + return Qt::Window; +} + +/*! +Reimplemented in subclasses to show the surface if \a visible is \c true, and hide it if \a visible is \c false. +*/ + +void QWindowSurface::setVisible(bool visible) +{ + Q_UNUSED(visible); +} + +#endif + QT_END_NAMESPACE diff --git a/src/gui/painting/qwindowsurface_p.h b/src/gui/painting/qwindowsurface_p.h index 502e10d..06d3dad 100644 --- a/src/gui/painting/qwindowsurface_p.h +++ b/src/gui/painting/qwindowsurface_p.h @@ -89,6 +89,11 @@ public: virtual QPoint offset(const QWidget *widget) const; inline QRect rect(const QWidget *widget) const; +#ifdef Q_WS_LITE + virtual void setVisible(bool visible); + virtual Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); + virtual Qt::WindowFlags windowFlags() const; +#endif bool hasStaticContentsSupport() const; void setStaticContents(const QRegion ®ion); diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri index 767ade0..78d0359 100644 --- a/src/gui/styles/styles.pri +++ b/src/gui/styles/styles.pri @@ -33,7 +33,7 @@ contains( styles, all ) { styles = mac windows windowsxp windowsvista } -x11|embedded|!macx-*:styles -= mac +x11|embedded|embedded_lite|!macx-*:styles -= mac x11{ QMAKE_CXXFLAGS += $$QT_CFLAGS_QGTKSTYLE diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 03f69db..b9ce238 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -172,6 +172,8 @@ Q_GUI_EXPORT int qt_defaultDpiX() if (!subScreens.isEmpty()) screen = subScreens.at(0); dpi = qRound(screen->width() / (screen->physicalWidth() / qreal(25.4))); +#elif defined(Q_WS_LITE) + dpi = 72; #elif defined(Q_OS_SYMBIAN) dpi = S60->defaultDpiX; #endif // Q_WS_X11 @@ -200,6 +202,8 @@ Q_GUI_EXPORT int qt_defaultDpiY() if (!subScreens.isEmpty()) screen = subScreens.at(0); dpi = qRound(screen->height() / (screen->physicalHeight() / qreal(25.4))); +#elif defined(Q_WS_LITE) + dpi = 72; #elif defined(Q_OS_SYMBIAN) dpi = S60->defaultDpiY; #endif // Q_WS_X11 diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h index 9fe660a..33aa4c4 100644 --- a/src/gui/text/qfont.h +++ b/src/gui/text/qfont.h @@ -46,7 +46,7 @@ #include #include -#if defined(Q_WS_X11) || defined(Q_WS_QWS) +#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_LITE) typedef struct FT_FaceRec_* FT_Face; #endif @@ -232,7 +232,7 @@ public: #ifdef Q_WS_MAC quint32 macFontID() const; #endif -#if defined(Q_WS_X11) || defined(Q_WS_QWS) +#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_LITE) FT_Face freetypeFace() const; #endif diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 78847ef..98d848f 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -56,7 +56,7 @@ #include #include -#if (defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE) +#if (defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE) # include # include FT_TRUETYPE_TABLES_H #endif @@ -153,10 +153,11 @@ struct QtFontSize QtFontEncoding *encodingID(int id, uint xpoint = 0, uint xres = 0, uint yres = 0, uint avgwidth = 0, bool add = false); #endif // Q_WS_X11 -#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) + +#if defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) QByteArray fileName; int fileIndex; -#endif // defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) +#endif // defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) }; @@ -230,14 +231,14 @@ struct QtFontStyle delete [] weightName; delete [] setwidthName; #endif -#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) while (count) { // bitfield count-- in while condition does not work correctly in mwccsym2 count--; #ifdef Q_WS_X11 free(pixelSizes[count].encodings); #endif -#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) pixelSizes[count].fileName.~QByteArray(); #endif } @@ -255,7 +256,7 @@ struct QtFontStyle const char *weightName; const char *setwidthName; #endif // Q_WS_X11 -#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) bool antialiased; #endif @@ -296,7 +297,7 @@ QtFontSize *QtFontStyle::pixelSize(unsigned short size, bool add) pixelSizes[count].count = 0; pixelSizes[count].encodings = 0; #endif -#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) new (&pixelSizes[count].fileName) QByteArray; pixelSizes[count].fileIndex = 0; #endif @@ -382,7 +383,7 @@ struct QtFontFamily fixedPitchComputed(false), #endif name(n), count(0), foundries(0) -#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) +#if defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) , bogusWritingSystems(false) #endif { @@ -422,7 +423,7 @@ struct QtFontFamily int count; QtFontFoundry **foundries; -#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) +#if defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) bool bogusWritingSystems; QStringList fallbackFamilies; #endif @@ -469,7 +470,8 @@ QtFontFoundry *QtFontFamily::foundry(const QString &f, bool create) // ### copied to tools/makeqpf/qpf2.cpp -#if (defined(Q_WS_QWS) && !defined(QT_NO_FREETYPE)) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) || (defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)) +#if ((defined(Q_WS_QWS) || defined(Q_WS_LITE)) && !defined(QT_NO_FREETYPE)) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) || (defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)) + // see the Unicode subset bitfields in the MSDN docs static int requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2] = { // Any, @@ -604,7 +606,7 @@ class QFontDatabasePrivate public: QFontDatabasePrivate() : count(0), families(0), reregisterAppFonts(false) -#if defined(Q_WS_QWS) +#if defined(Q_WS_QWS) || defined(Q_WS_LITE) , stream(0) #endif #if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) @@ -652,11 +654,11 @@ public: void invalidate(); -#if defined(Q_WS_QWS) +#if defined(Q_WS_QWS) || defined(Q_WS_LITE) bool loadFromCache(const QString &fontPath); void addQPF2File(const QByteArray &file); #endif // Q_WS_QWS -#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) +#if defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) void addFont(const QString &familyname, const char *foundryname, int weight, bool italic, int pixelSize, const QByteArray &file, int fileIndex, bool antialiased, @@ -665,7 +667,7 @@ public: QStringList addTTFile(const QByteArray &file, const QByteArray &fontData = QByteArray()); #endif // QT_NO_FREETYPE #endif -#if defined(Q_WS_QWS) +#if defined(Q_WS_QWS) || defined (Q_WS_LITE) QDataStream *stream; QStringList fallbackFamilies; #elif defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) @@ -719,7 +721,7 @@ QtFontFamily *QFontDatabasePrivate::family(const QString &f, bool create) return families[pos]; } -#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) +#if defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) void QFontDatabasePrivate::addFont(const QString &familyname, const char *foundryname, int weight, bool italic, int pixelSize, const QByteArray &file, int fileIndex, bool antialiased, const QList &writingSystems) @@ -750,7 +752,7 @@ void QFontDatabasePrivate::addFont(const QString &familyname, const char *foundr size->fileName = file; size->fileIndex = fileIndex; -#if defined(Q_WS_QWS) +#if defined(Q_WS_QWS) || defined(Q_WS_LITE) if (stream) { *stream << familyname << foundry->name << weight << quint8(italic) << pixelSize << file << fileIndex << quint8(antialiased); @@ -765,7 +767,7 @@ void QFontDatabasePrivate::addFont(const QString &familyname, const char *foundr } #endif -#if (defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE) +#if (defined(Q_WS_QWS) || defined (Q_WS_LITE) || defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE) QStringList QFontDatabasePrivate::addTTFile(const QByteArray &file, const QByteArray &fontData) { QStringList families; @@ -877,7 +879,7 @@ static const int scriptForWritingSystem[] = { }; -#if defined Q_WS_QWS || (defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG)) || defined(Q_WS_WIN) +#if defined Q_WS_QWS || defined(Q_WS_LITE) || (defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG)) || defined(Q_WS_WIN) static inline bool requiresOpenType(int writingSystem) { return ((writingSystem >= QFontDatabase::Syriac && writingSystem <= QFontDatabase::Sinhala) @@ -951,7 +953,7 @@ static void match(int script, const QFontDef &request, const QString &family_name, const QString &foundry_name, int force_encoding_id, QtFontDesc *desc, const QList &blacklistedFamilies = QList()); -#if defined(Q_WS_X11) || defined(Q_WS_QWS) +#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_LITE) static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDef *fontDef) { fontDef->family = desc.family->name; @@ -1039,7 +1041,7 @@ QT_BEGIN_INCLUDE_NAMESPACE # include "qfontdatabase_mac.cpp" #elif defined(Q_WS_WIN) # include "qfontdatabase_win.cpp" -#elif defined(Q_WS_QWS) +#elif defined(Q_WS_QWS) || defined(Q_WS_LITE) # include "qfontdatabase_qws.cpp" #elif defined(Q_OS_SYMBIAN) # include "qfontdatabase_s60.cpp" diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h index e62bb31..9b92c57 100644 --- a/src/gui/text/qfontdatabase.h +++ b/src/gui/text/qfontdatabase.h @@ -151,7 +151,7 @@ public: private: static void createDatabase(); static void parseFontName(const QString &name, QString &foundry, QString &family); -#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) static QFontEngine *findFont(int script, const QFontPrivate *fp, const QFontDef &request); #endif static void load(const QFontPrivate *d, int script); diff --git a/src/gui/text/qfontdatabase_qws.cpp b/src/gui/text/qfontdatabase_qws.cpp index 0a9630f..62c67a3 100644 --- a/src/gui/text/qfontdatabase_qws.cpp +++ b/src/gui/text/qfontdatabase_qws.cpp @@ -40,8 +40,10 @@ ****************************************************************************/ #include "qdir.h" +#if defined(Q_WS_QWS) #include "qscreen_qws.h" //so we can check for rotation #include "qwindowsystem_qws.h" +#endif #include "qlibraryinfo.h" #include "qabstractfileengine.h" #include @@ -153,7 +155,11 @@ extern QString qws_fontCacheDir(); #ifndef QT_FONTS_ARE_RESOURCES bool QFontDatabasePrivate::loadFromCache(const QString &fontPath) { +#ifdef Q_WS_QWS const bool weAreTheServer = QWSServer::instance(); +#else + const bool weAreTheServer = true; // assume single-process +#endif QString fontDirFile = fontPath + QLatin1String("/fontdir"); @@ -687,6 +693,7 @@ QFontEngine *loadEngine(int script, const QFontPrivate *fp, { QScopedPointer engine(loadSingleEngine(script, fp, request, family, foundry, style, size)); +#ifndef QT_NO_QWS_QPF if (!engine.isNull() && script == QUnicodeTables::Common && !(request.styleStrategy & QFont::NoFontMerging) && !engine->symbol) { @@ -700,6 +707,7 @@ QFontEngine *loadEngine(int script, const QFontPrivate *fp, engine.take(); engine.reset(fe); } +#endif return engine.take(); } diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 7a3b3e1..74d72c4 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -816,7 +816,7 @@ QFontEngineGlyphCache *QFontEngine::glyphCache(QFontEngineGlyphCache::Type key, return 0; } -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) static inline QFixed kerning(int left, int right, const QFontEngine::KernPair *pairs, int numPairs) { uint left_right = (left << 16) + right; @@ -1182,7 +1182,7 @@ glyph_metrics_t QFontEngineBox::boundingBox(const QGlyphLayout &glyphs) return overall; } -#if defined(Q_WS_QWS) +#if defined(Q_WS_QWS) || defined(Q_WS_LITE) void QFontEngineBox::draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &ti) { if (!ti.glyphs.numGlyphs) diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index 4cc5c5e..9e10eab 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -256,7 +256,7 @@ public: QGlyphSet *loadTransformedGlyphSet(const QTransform &matrix); bool loadGlyphs(QGlyphSet *gs, glyph_t *glyphs, int num_glyphs, GlyphFormat format = Format_Render); -#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) virtual void draw(QPaintEngine * /*p*/, qreal /*x*/, qreal /*y*/, const QTextItemInt & /*si*/) {} #endif diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index d654215..dc17c83 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -234,7 +234,7 @@ public: bool symbol; mutable HB_FontRec hbFont; mutable HB_Face hbFace; -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) struct KernPair { uint left_right; QFixed adjust; diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri index b28ecd7..2375f08 100644 --- a/src/gui/text/text.pri +++ b/src/gui/text/text.pri @@ -85,7 +85,7 @@ unix:x11 { text/qfontengine_ft.cpp } -!embedded:!x11:mac { +!embedded:!embedded_lite:!x11:mac { SOURCES += \ text/qfont_mac.cpp OBJECTIVE_SOURCES += text/qfontengine_mac.mm @@ -106,6 +106,19 @@ embedded { DEFINES += QT_NO_FONTCONFIG } +embedded_lite { + SOURCES += \ + text/qfont_qws.cpp \ + text/qfontengine_ft.cpp \ + text/qfontengine_qpf.cpp \ + text/qabstractfontengine_qws.cpp + HEADERS += \ + text/qfontengine_ft_p.h \ + text/qabstractfontengine_qws.h \ + text/qabstractfontengine_p.h + DEFINES += QT_NO_FONTCONFIG +} + symbian { SOURCES += \ text/qfont_s60.cpp diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp index 76f583d..da4de73 100644 --- a/src/gui/util/qdesktopservices.cpp +++ b/src/gui/util/qdesktopservices.cpp @@ -45,7 +45,7 @@ #include -#if defined(Q_WS_QWS) +#if defined(Q_WS_QWS) || defined(Q_WS_LITE) #include "qdesktopservices_qws.cpp" #elif defined(Q_WS_X11) #include "qdesktopservices_x11.cpp" diff --git a/src/gui/util/util.pri b/src/gui/util/util.pri index cdbb7cc..e718c7b 100644 --- a/src/gui/util/util.pri +++ b/src/gui/util/util.pri @@ -30,12 +30,12 @@ unix:x11 { util/qsystemtrayicon_x11.cpp } -embedded { +embedded|embedded_lite { SOURCES += \ util/qsystemtrayicon_qws.cpp } -!embedded:!x11:mac { +!embedded:!embedded_lite:!x11:mac { OBJECTIVE_SOURCES += util/qsystemtrayicon_mac.mm } diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index da18f86..db6a572 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -112,7 +112,7 @@ void QLineControl::updateDisplayText() Copies the currently selected text into the clipboard using the given \a mode. - + \note If the echo mode is set to a mode other than Normal then copy will not work. This is to prevent using copy as a method of bypassing password features of the line control. @@ -479,7 +479,7 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event) /*! \internal - Draws the display text for the line control using the given + Draws the display text for the line control using the given \a painter, \a clip, and \a offset. Which aspects of the display text are drawn is specified by the given \a flags. diff --git a/src/gui/widgets/widgets.pri b/src/gui/widgets/widgets.pri index 4567902..5ee693c 100644 --- a/src/gui/widgets/widgets.pri +++ b/src/gui/widgets/widgets.pri @@ -146,7 +146,7 @@ SOURCES += \ widgets/qprintpreviewwidget.cpp \ widgets/qactiontokeyeventmapper.cpp -!embedded:mac { +!embedded:!embedded_lite:mac { HEADERS += widgets/qmacnativewidget_mac.h \ widgets/qmaccocoaviewcontainer_mac.h OBJECTIVE_HEADERS += widgets/qcocoatoolbardelegate_mac_p.h \ diff --git a/src/plugins/generic/linuxinput/linuxinput.pro b/src/plugins/generic/linuxinput/linuxinput.pro new file mode 100644 index 0000000..ad9f6a9 --- /dev/null +++ b/src/plugins/generic/linuxinput/linuxinput.pro @@ -0,0 +1,18 @@ +TARGET = qlinuxinputplugin +include(../../qpluginbase.pri) + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/generic +target.path = $$[QT_INSTALL_PLUGINS]/generic +INSTALLS += target + +DEFINES += QT_QWS_KBD_LINUXINPUT + +HEADERS = qlinuxinput.h + +SOURCES = main.cpp \ + qlinuxinput.cpp + +HEADERS += $$QT_SOURCE_TREE/src/gui/embedded/qkbd_qws.h \ + $$QT_SOURCE_TREE/src/gui/embedded/qkbd_qws_p.h + +SOURCES += $$QT_SOURCE_TREE/src/gui/embedded/qkbd_qws.cpp diff --git a/src/plugins/generic/linuxinput/main.cpp b/src/plugins/generic/linuxinput/main.cpp new file mode 100644 index 0000000..21209b8 --- /dev/null +++ b/src/plugins/generic/linuxinput/main.cpp @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qlinuxinput.h" + +QT_BEGIN_NAMESPACE + +class QLinuxInputPlugin : public QGenericPlugin +{ +public: + QLinuxInputPlugin(); + + QStringList keys() const; + QObject* create(const QString &key, const QString &specification); +}; + +QLinuxInputPlugin::QLinuxInputPlugin() + : QGenericPlugin() +{ +} + +QStringList QLinuxInputPlugin::keys() const +{ + return (QStringList() + << QLatin1String("LinuxInputMouse") + << QLatin1String("LinuxInputKeyboard")); +} + +QObject* QLinuxInputPlugin::create(const QString &key, + const QString &specification) +{ + if (!key.compare(QLatin1String("LinuxInputMouse"), Qt::CaseInsensitive)) + return new QLinuxInputMouseHandler(key, specification); + if (!key.compare(QLatin1String("LinuxInputKeyboard"), Qt::CaseInsensitive)) + return new QLinuxInputKeyboardHandler(key, specification); + return 0; + } + +Q_EXPORT_PLUGIN2(qlinuxinputplugin, QLinuxInputPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/generic/linuxinput/qlinuxinput.cpp b/src/plugins/generic/linuxinput/qlinuxinput.cpp new file mode 100644 index 0000000..2ce687d --- /dev/null +++ b/src/plugins/generic/linuxinput/qlinuxinput.cpp @@ -0,0 +1,371 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include "qlinuxinput.h" + + +#include +#include +#include +#include +#include + +#include + + +#include +#include // overrides QT_OPEN + +#include +#include + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +QLinuxInputMouseHandler::QLinuxInputMouseHandler(const QString &key, + const QString &specification) + : m_notify(0), m_x(0), m_y(0), m_buttons(0) +{ + qDebug() << "QLinuxInputMouseHandler" << key << specification; + + + setObjectName(QLatin1String("LinuxInputSubsystem Mouse Handler")); + + QString dev = QLatin1String("/dev/input/event0"); + if (specification.startsWith(QLatin1String("/dev/"))) + dev = specification; + + m_fd = QT_OPEN(dev.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0); + if (m_fd >= 0) { + m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this); + connect(m_notify, SIGNAL(activated(int)), this, SLOT(readMouseData())); + } else { + qWarning("Cannot open mouse input device '%s': %s", qPrintable(dev), strerror(errno)); + return; + } + +} + + +QLinuxInputMouseHandler::~QLinuxInputMouseHandler() +{ + if (m_fd >= 0) + QT_CLOSE(m_fd); +} + +void QLinuxInputMouseHandler::readMouseData() +{ + struct ::input_event buffer[32]; + int n = 0; + + forever { + n = QT_READ(m_fd, reinterpret_cast(buffer) + n, sizeof(buffer) - n); + + if (n == 0) { + qWarning("Got EOF from the input device."); + return; + } else if (n < 0 && (errno != EINTR && errno != EAGAIN)) { + qWarning("Could not read from input device: %s", strerror(errno)); + return; + } else if (n % sizeof(buffer[0]) == 0) { + break; + } + } + + n /= sizeof(buffer[0]); + + for (int i = 0; i < n; ++i) { + struct ::input_event *data = &buffer[i]; + + bool unknown = false; + if (data->type == EV_ABS) { + if (data->code == ABS_X) { + m_x = data->value; + } else if (data->code == ABS_Y) { + m_y = data->value; + } else { + unknown = true; + } + } else if (data->type == EV_REL) { + if (data->code == REL_X) { + m_x += data->value; + } else if (data->code == REL_Y) { + m_y += data->value; + } else { + unknown = true; + } + } else if (data->type == EV_KEY && data->code == BTN_TOUCH) { + m_buttons = data->value ? Qt::LeftButton : Qt::NoButton; + } else if (data->type == EV_KEY) { + Qt::MouseButton button = Qt::NoButton; + switch (data->code) { + case BTN_LEFT: button = Qt::LeftButton; break; + case BTN_MIDDLE: button = Qt::MidButton; break; + case BTN_RIGHT: button = Qt::RightButton; break; + } + if (data->value) + m_buttons |= button; + else + m_buttons &= ~button; + + Qt::KeyboardModifiers modifiers = Qt::NoModifier; //### + QMouseEvent m(data->value ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease, + QPoint(m_x, m_y), QPoint(m_x, m_y), button, m_buttons, modifiers); + QApplicationPrivate::handleMouseEvent(0, m); + } else if (data->type == EV_SYN && data->code == SYN_REPORT) { + QPoint pos(m_x, m_y); + + Qt::KeyboardModifiers modifiers = Qt::NoModifier; //### + QMouseEvent m(QEvent::MouseMove, QPoint(m_x, m_y), QPoint(m_x, m_y), + Qt::NoButton, m_buttons, modifiers); + QApplicationPrivate::handleMouseEvent(0, m); + + // pos = m_handler->transform(pos); + //m_handler->limitToScreen(pos); + //m_handler->mouseChanged(pos, m_buttons); + + } else if (data->type == EV_MSC && data->code == MSC_SCAN) { + // kernel encountered an unmapped key - just ignore it + continue; + } else { + unknown = true; + } + if (unknown) { + qWarning("unknown mouse event type=%x, code=%x, value=%x", data->type, data->code, data->value); + } + } +} + + + + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +//Keyboard handler + + + + +class QWSLinuxInputKeyboardHandler : public QWSKeyboardHandler +{ +public: + QWSLinuxInputKeyboardHandler(const QString&); + ~QWSLinuxInputKeyboardHandler(); + + virtual bool filterInputEvent(quint16 &input_code, qint32 &input_value); + +//private: +// QWSLinuxInputKbPrivate *d; +}; + + +QWSLinuxInputKeyboardHandler::QWSLinuxInputKeyboardHandler(const QString &device) + : QWSKeyboardHandler(device) +{ +} + +QWSLinuxInputKeyboardHandler::~QWSLinuxInputKeyboardHandler() +{ +} + +bool QWSLinuxInputKeyboardHandler::filterInputEvent(quint16 &, qint32 &) +{ + return false; +} + + +QLinuxInputKeyboardHandler::QLinuxInputKeyboardHandler(const QString &key, const QString &specification) + : m_handler(0), m_fd(-1), m_tty_fd(-1), m_orig_kbmode(K_XLATE) +{ + setObjectName(QLatin1String("LinuxInputSubsystem Keyboard Handler")); + + QString dev = QLatin1String("/dev/input/event1"); + int repeat_delay = -1; + int repeat_rate = -1; + + QStringList args = specification.split(QLatin1Char(':')); + foreach (const QString &arg, args) { + if (arg.startsWith(QLatin1String("repeat-delay="))) + repeat_delay = arg.mid(13).toInt(); + else if (arg.startsWith(QLatin1String("repeat-rate="))) + repeat_rate = arg.mid(12).toInt(); + else if (arg.startsWith(QLatin1String("/dev/"))) + dev = arg; + } + + m_handler = new QWSLinuxInputKeyboardHandler(dev); //This is a hack to avoid copying all the QWS code + + m_fd = QT_OPEN(dev.toLocal8Bit().constData(), O_RDWR, 0); + if (m_fd >= 0) { + if (repeat_delay > 0 && repeat_rate > 0) { + int kbdrep[2] = { repeat_delay, repeat_rate }; + ::ioctl(m_fd, EVIOCSREP, kbdrep); + } + + QSocketNotifier *notifier; + notifier = new QSocketNotifier(m_fd, QSocketNotifier::Read, this); + connect(notifier, SIGNAL(activated(int)), this, SLOT(readKeycode())); + + // play nice in case we are started from a shell (e.g. for debugging) + m_tty_fd = isatty(0) ? 0 : -1; + + if (m_tty_fd >= 0) { + // save tty config for restore. + tcgetattr(m_tty_fd, &m_tty_attr); + + struct ::termios termdata; + tcgetattr(m_tty_fd, &termdata); + + // record the original mode so we can restore it again in the destructor. + ::ioctl(m_tty_fd, KDGKBMODE, &m_orig_kbmode); + + // setting this tranlation mode is even needed in INPUT mode to prevent + // the shell from also interpreting codes, if the process has a tty + // attached: e.g. Ctrl+C wouldn't copy, but kill the application. + ::ioctl(m_tty_fd, KDSKBMODE, K_MEDIUMRAW); + + // set the tty layer to pass-through + termdata.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP); + termdata.c_oflag = 0; + termdata.c_cflag = CREAD | CS8; + termdata.c_lflag = 0; + termdata.c_cc[VTIME]=0; + termdata.c_cc[VMIN]=1; + cfsetispeed(&termdata, 9600); + cfsetospeed(&termdata, 9600); + tcsetattr(m_tty_fd, TCSANOW, &termdata); + } + } else { + qWarning("Cannot open keyboard input device '%s': %s", qPrintable(dev), strerror(errno)); + return; + } +} + +QLinuxInputKeyboardHandler::~QLinuxInputKeyboardHandler() +{ + if (m_tty_fd >= 0) { + ::ioctl(m_tty_fd, KDSKBMODE, m_orig_kbmode); + tcsetattr(m_tty_fd, TCSANOW, &m_tty_attr); + } + if (m_fd >= 0) + QT_CLOSE(m_fd); + delete m_handler; +} + +void QLinuxInputKeyboardHandler::switchLed(int led, bool state) +{ + struct ::input_event led_ie; + ::gettimeofday(&led_ie.time, 0); + led_ie.type = EV_LED; + led_ie.code = led; + led_ie.value = state; + + QT_WRITE(m_fd, &led_ie, sizeof(led_ie)); +} + + + +void QLinuxInputKeyboardHandler::readKeycode() +{ + struct ::input_event buffer[32]; + int n = 0; + + forever { + n = QT_READ(m_fd, reinterpret_cast(buffer) + n, sizeof(buffer) - n); + + if (n == 0) { + qWarning("Got EOF from the input device."); + return; + } else if (n < 0 && (errno != EINTR && errno != EAGAIN)) { + qWarning("Could not read from input device: %s", strerror(errno)); + return; + } else if (n % sizeof(buffer[0]) == 0) { + break; + } + } + + n /= sizeof(buffer[0]); + + for (int i = 0; i < n; ++i) { + if (buffer[i].type != EV_KEY) + continue; + + quint16 code = buffer[i].code; + qint32 value = buffer[i].value; + + if (m_handler->filterInputEvent(code, value)) + continue; + + QWSKeyboardHandler::KeycodeAction ka; + ka = m_handler->processKeycode(code, value != 0, value == 2); + + switch (ka) { + case QWSKeyboardHandler::CapsLockOn: + case QWSKeyboardHandler::CapsLockOff: + switchLed(LED_CAPSL, ka == QWSKeyboardHandler::CapsLockOn); + break; + + case QWSKeyboardHandler::NumLockOn: + case QWSKeyboardHandler::NumLockOff: + switchLed(LED_NUML, ka == QWSKeyboardHandler::NumLockOn); + break; + + case QWSKeyboardHandler::ScrollLockOn: + case QWSKeyboardHandler::ScrollLockOff: + switchLed(LED_SCROLLL, ka == QWSKeyboardHandler::ScrollLockOn); + break; + + default: + // ignore console switching and reboot + break; + } + } +} + + + + + +QT_END_NAMESPACE diff --git a/src/plugins/generic/linuxinput/qlinuxinput.h b/src/plugins/generic/linuxinput/qlinuxinput.h new file mode 100644 index 0000000..5a90c8f --- /dev/null +++ b/src/plugins/generic/linuxinput/qlinuxinput.h @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QLINUXINPUT_H +#define QLINUXINPUT_H + +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QSocketNotifier; + +class QLinuxInputMouseHandler : public QObject +{ + Q_OBJECT +public: + QLinuxInputMouseHandler(const QString &key, const QString &specification); + ~QLinuxInputMouseHandler(); + +private slots: + void readMouseData(); + +private: + QSocketNotifier * m_notify; + int m_fd; + int m_x, m_y; + Qt::MouseButtons m_buttons; +}; + + +class QWSLinuxInputKeyboardHandler; + +class QLinuxInputKeyboardHandler : public QObject +{ + Q_OBJECT +public: + QLinuxInputKeyboardHandler(const QString &key, const QString &specification); + ~QLinuxInputKeyboardHandler(); + + +private: + void switchLed(int, bool); + +private slots: + void readKeycode(); + +private: + QWSLinuxInputKeyboardHandler *m_handler; + int m_fd; + int m_tty_fd; + struct termios m_tty_attr; + int m_orig_kbmode; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QLINUXINPUT_H diff --git a/src/plugins/graphicssystems/graphicssystems.pro b/src/plugins/graphicssystems/graphicssystems.pro index 14e3cfc..12b2c51 100644 --- a/src/plugins/graphicssystems/graphicssystems.pro +++ b/src/plugins/graphicssystems/graphicssystems.pro @@ -1,9 +1,23 @@ TEMPLATE = subdirs SUBDIRS += trace contains(QT_CONFIG, opengl):SUBDIRS += opengl -contains(QT_CONFIG, openvg):contains(QT_CONFIG, egl):SUBDIRS += openvg +contains(QT_CONFIG, openvg):contains(QT_CONFIG, egl) { + embedded_lite { + SUBDIRS += openvglite + } else { + SUBDIRS += openvg + } +} contains(QT_CONFIG, shivavg) { # Only works under X11 at present !win32:!embedded:!mac:SUBDIRS += shivavg } + +embedded_lite: { + SUBDIRS += minimal +} + +embedded_lite:x11 { + SUBDIRS += linuxfb +} \ No newline at end of file diff --git a/src/plugins/graphicssystems/linuxfb/linuxfb.pro b/src/plugins/graphicssystems/linuxfb/linuxfb.pro new file mode 100644 index 0000000..1251d2f --- /dev/null +++ b/src/plugins/graphicssystems/linuxfb/linuxfb.pro @@ -0,0 +1,10 @@ +TARGET = qlinuxfbgraphicssystem +include(../../qpluginbase.pri) + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems + +SOURCES = main.cpp qgraphicssystem_linuxfb.cpp qwindowsurface_linuxfb.cpp +HEADERS = qgraphicssystem_linuxfb.h qwindowsurface_linuxfb.h + +target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +INSTALLS += target diff --git a/src/plugins/graphicssystems/linuxfb/main.cpp b/src/plugins/graphicssystems/linuxfb/main.cpp new file mode 100644 index 0000000..ef6234d --- /dev/null +++ b/src/plugins/graphicssystems/linuxfb/main.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qgraphicssystem_linuxfb.h" + +QT_BEGIN_NAMESPACE + +class QLinuxFbGraphicsSystemPlugin : public QGraphicsSystemPlugin +{ +public: + QStringList keys() const; + QGraphicsSystem *create(const QString&); +}; + +QStringList QLinuxFbGraphicsSystemPlugin::keys() const +{ + QStringList list; + list << "LinuxFb"; + return list; +} + +QGraphicsSystem* QLinuxFbGraphicsSystemPlugin::create(const QString& system) +{ + if (system.toLower() == "linuxfb") + return new QLinuxFbGraphicsSystem; + + return 0; +} + +Q_EXPORT_PLUGIN2(linuxfb, QLinuxFbGraphicsSystemPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp new file mode 100644 index 0000000..cd0ced2 --- /dev/null +++ b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp @@ -0,0 +1,797 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgraphicssystem_linuxfb.h" +#include "qwindowsurface_linuxfb.h" +#include +#include // overrides QT_OPEN + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if !defined(Q_OS_DARWIN) && !defined(Q_OS_FREEBSD) +#include + +#ifdef __i386__ +#include +#endif +#endif + +QT_BEGIN_NAMESPACE + +class QLinuxFbGraphicsSystemPrivate +{ +public: + QLinuxFbGraphicsSystemPrivate(); + ~QLinuxFbGraphicsSystemPrivate(); + + void openTty(); + void closeTty(); + + int fd; + int startupw; + int startuph; + int startupd; + bool blank; + + bool doGraphicsMode; +#ifdef QT_QWS_DEPTH_GENERIC + bool doGenericColors; +#endif + int ttyfd; + long oldKdMode; + QString ttyDevice; + QString displaySpec; +}; + +QLinuxFbGraphicsSystemPrivate::QLinuxFbGraphicsSystemPrivate() + : fd(-1), blank(true), doGraphicsMode(true), +#ifdef QT_QWS_DEPTH_GENERIC + doGenericColors(false), +#endif + ttyfd(-1), oldKdMode(KD_TEXT) +{ +} + +QLinuxFbGraphicsSystemPrivate::~QLinuxFbGraphicsSystemPrivate() +{ + closeTty(); +} + +void QLinuxFbGraphicsSystemPrivate::openTty() +{ + const char *const devs[] = {"/dev/tty0", "/dev/tty", "/dev/console", 0}; + + if (ttyDevice.isEmpty()) { + for (const char * const *dev = devs; *dev; ++dev) { + ttyfd = QT_OPEN(*dev, O_RDWR); + if (ttyfd != -1) + break; + } + } else { + ttyfd = QT_OPEN(ttyDevice.toAscii().constData(), O_RDWR); + } + + if (ttyfd == -1) + return; + + if (doGraphicsMode) { + ioctl(ttyfd, KDGETMODE, &oldKdMode); + if (oldKdMode != KD_GRAPHICS) { + int ret = ioctl(ttyfd, KDSETMODE, KD_GRAPHICS); + if (ret == -1) + doGraphicsMode = false; + } + } + + // No blankin' screen, no blinkin' cursor!, no cursor! + const char termctl[] = "\033[9;0]\033[?33l\033[?25l\033[?1c"; + QT_WRITE(ttyfd, termctl, sizeof(termctl)); +} + +void QLinuxFbGraphicsSystemPrivate::closeTty() +{ + if (ttyfd == -1) + return; + + if (doGraphicsMode) + ioctl(ttyfd, KDSETMODE, oldKdMode); + + // Blankin' screen, blinkin' cursor! + const char termctl[] = "\033[9;15]\033[?33h\033[?25h\033[?0c"; + QT_WRITE(ttyfd, termctl, sizeof(termctl)); + + QT_CLOSE(ttyfd); + ttyfd = -1; +} + +QLinuxFbGraphicsSystem::QLinuxFbGraphicsSystem() +{ + d_ptr = new QLinuxFbGraphicsSystemPrivate(); + + // XXX + QString displaySpec = QString::fromLatin1(qgetenv("QWS_DISPLAY")); + + if (!connect(displaySpec)) + qFatal("QLinuxFbGraphicsSystem: could not initialize screen"); + + mPrimaryScreen = new QLinuxFbGraphicsSystemScreen(); + mPrimaryScreen->mGeometry = QRect(0, 0, w, h); + mPrimaryScreen->mDepth = d; + mPrimaryScreen->mFormat = screenFormat; + mPrimaryScreen->mPhysicalSize = QSize(physWidth, physHeight); + + // Create a QImage directly on the screen's framebuffer. + // This is the blit target for copying windows to the screen. + mPrimaryScreen->mScreenImage = new QImage(data, w, h, lstep, screenFormat); + + mScreens.append(mPrimaryScreen); +} + +QLinuxFbGraphicsSystem::~QLinuxFbGraphicsSystem() +{ + delete mPrimaryScreen; + delete d_ptr; +} + +bool QLinuxFbGraphicsSystem::connect(const QString &displaySpec) +{ + const QStringList args = displaySpec.split(QLatin1Char(':')); + + if (args.contains(QLatin1String("nographicsmodeswitch"))) + d_ptr->doGraphicsMode = false; + +#ifdef QT_QWS_DEPTH_GENERIC + if (args.contains(QLatin1String("genericcolors"))) + d_ptr->doGenericColors = true; +#endif + + QRegExp ttyRegExp(QLatin1String("tty=(.*)")); + if (args.indexOf(ttyRegExp) != -1) + d_ptr->ttyDevice = ttyRegExp.cap(1); + +#if 0 +#if Q_BYTE_ORDER == Q_BIG_ENDIAN +#ifndef QT_QWS_FRAMEBUFFER_LITTLE_ENDIAN + if (args.contains(QLatin1String("littleendian"))) +#endif + QScreen::setFrameBufferLittleEndian(true); +#endif +#endif + + // Check for explicitly specified device + const int len = 8; // "/dev/fbx" + int m = displaySpec.indexOf(QLatin1String("/dev/fb")); + + QString dev; + if (m > 0) + dev = displaySpec.mid(m, len); + else + dev = QLatin1String("/dev/fb0"); + + if (access(dev.toLatin1().constData(), R_OK|W_OK) == 0) + d_ptr->fd = QT_OPEN(dev.toLatin1().constData(), O_RDWR); + if (d_ptr->fd == -1) { + if (access(dev.toLatin1().constData(), R_OK) == 0) + d_ptr->fd = QT_OPEN(dev.toLatin1().constData(), O_RDONLY); + if (d_ptr->fd == 1) { + qWarning("Error opening framebuffer device %s", qPrintable(dev)); + return false; + } + } + + fb_fix_screeninfo finfo; + fb_var_screeninfo vinfo; + //####################### + // Shut up Valgrind + memset(&vinfo, 0, sizeof(vinfo)); + memset(&finfo, 0, sizeof(finfo)); + //####################### + + /* Get fixed screen information */ + if (d_ptr->fd != -1 && ioctl(d_ptr->fd, FBIOGET_FSCREENINFO, &finfo)) { + perror("QLinuxFbGraphicsSystem::connect"); + qWarning("Error reading fixed information"); + return false; + } + + if (finfo.type == FB_TYPE_VGA_PLANES) { + qWarning("VGA16 video mode not supported"); + return false; + } + + /* Get variable screen information */ + if (d_ptr->fd != -1 && ioctl(d_ptr->fd, FBIOGET_VSCREENINFO, &vinfo)) { + perror("QLinuxFbGraphicsSystem::connect"); + qWarning("Error reading variable information"); + return false; + } + + grayscale = vinfo.grayscale; + d = vinfo.bits_per_pixel; + if (d == 24) { + d = vinfo.red.length + vinfo.green.length + vinfo.blue.length; + if (d <= 0) + d = 24; // reset if color component lengths are not reported + } else if (d == 16) { + d = vinfo.red.length + vinfo.green.length + vinfo.blue.length; + if (d <= 0) + d = 16; + } + lstep = finfo.line_length; + + int xoff = vinfo.xoffset; + int yoff = vinfo.yoffset; + const char* qwssize; + if((qwssize=::getenv("QWS_SIZE")) && sscanf(qwssize,"%dx%d",&w,&h)==2) { + if (d_ptr->fd != -1) { + if ((uint)w > vinfo.xres) w = vinfo.xres; + if ((uint)h > vinfo.yres) h = vinfo.yres; + } + dw=w; + dh=h; + int xxoff, yyoff; + if (sscanf(qwssize, "%*dx%*d+%d+%d", &xxoff, &yyoff) == 2) { + if (xxoff < 0 || xxoff + w > (int)(vinfo.xres)) + xxoff = vinfo.xres - w; + if (yyoff < 0 || yyoff + h > (int)(vinfo.yres)) + yyoff = vinfo.yres - h; + xoff += xxoff; + yoff += yyoff; + } else { + xoff += (vinfo.xres - w)/2; + yoff += (vinfo.yres - h)/2; + } + } else { + dw=w=vinfo.xres; + dh=h=vinfo.yres; + } + + if (w == 0 || h == 0) { + qWarning("QLinuxFbGraphicsSystem::connect(): Unable to find screen geometry, " + "will use 320x240."); + dw = w = 320; + dh = h = 240; + } + + setPixelFormat(vinfo); + + // Handle display physical size spec. + QStringList displayArgs = displaySpec.split(QLatin1Char(':')); + QRegExp mmWidthRx(QLatin1String("mmWidth=?(\\d+)")); + int dimIdxW = displayArgs.indexOf(mmWidthRx); + QRegExp mmHeightRx(QLatin1String("mmHeight=?(\\d+)")); + int dimIdxH = displayArgs.indexOf(mmHeightRx); + if (dimIdxW >= 0) { + mmWidthRx.exactMatch(displayArgs.at(dimIdxW)); + physWidth = mmWidthRx.cap(1).toInt(); + if (dimIdxH < 0) + physHeight = dh*physWidth/dw; + } + if (dimIdxH >= 0) { + mmHeightRx.exactMatch(displayArgs.at(dimIdxH)); + physHeight = mmHeightRx.cap(1).toInt(); + if (dimIdxW < 0) + physWidth = dw*physHeight/dh; + } + if (dimIdxW < 0 && dimIdxH < 0) { + if (vinfo.width != 0 && vinfo.height != 0 + && vinfo.width != UINT_MAX && vinfo.height != UINT_MAX) { + physWidth = vinfo.width; + physHeight = vinfo.height; + } else { + const int dpi = 72; + physWidth = qRound(dw * 25.4 / dpi); + physHeight = qRound(dh * 25.4 / dpi); + } + } + + dataoffset = yoff * lstep + xoff * d / 8; + //qDebug("Using %dx%dx%d screen",w,h,d); + + /* Figure out the size of the screen in bytes */ + size = h * lstep; + + mapsize = finfo.smem_len; + + data = (unsigned char *)-1; + if (d_ptr->fd != -1) + data = (unsigned char *)mmap(0, mapsize, PROT_READ | PROT_WRITE, + MAP_SHARED, d_ptr->fd, 0); + + if ((long)data == -1) { + perror("QLinuxFbGraphicsSystem::connect"); + qWarning("Error: failed to map framebuffer device to memory."); + return false; + } else { + data += dataoffset; + } + +#if 0 + canaccel = useOffscreen(); + if(canaccel) + setupOffScreen(); +#endif + canaccel = false; + + // Now read in palette + if((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4)) { + screencols= (vinfo.bits_per_pixel==8) ? 256 : 16; + int loopc; + fb_cmap startcmap; + startcmap.start=0; + startcmap.len=screencols; + startcmap.red=(unsigned short int *) + malloc(sizeof(unsigned short int)*screencols); + startcmap.green=(unsigned short int *) + malloc(sizeof(unsigned short int)*screencols); + startcmap.blue=(unsigned short int *) + malloc(sizeof(unsigned short int)*screencols); + startcmap.transp=(unsigned short int *) + malloc(sizeof(unsigned short int)*screencols); + if (d_ptr->fd == -1 || ioctl(d_ptr->fd, FBIOGETCMAP, &startcmap)) { + perror("QLinuxFbGraphicsSystem::connect"); + qWarning("Error reading palette from framebuffer, using default palette"); + createPalette(startcmap, vinfo, finfo); + } + int bits_used = 0; + for(loopc=0;loopc> 8, + startcmap.green[loopc] >> 8, + startcmap.blue[loopc] >> 8); + bits_used |= startcmap.red[loopc] + | startcmap.green[loopc] + | startcmap.blue[loopc]; + } + // WORKAROUND: Some framebuffer drivers only return 8 bit + // color values, so we need to not bit shift them.. + if ((bits_used & 0x00ff) && !(bits_used & 0xff00)) { + for(loopc=0;loopcopenTty(); + + // Grab current mode so we can reset it + fb_var_screeninfo vinfo; + fb_fix_screeninfo finfo; + //####################### + // Shut up Valgrind + memset(&vinfo, 0, sizeof(vinfo)); + memset(&finfo, 0, sizeof(finfo)); + //####################### + + if (ioctl(d_ptr->fd, FBIOGET_VSCREENINFO, &vinfo)) { + perror("QLinuxFbScreen::initDevice"); + qFatal("Error reading variable information in card init"); + return false; + } + +#ifdef DEBUG_VINFO + qDebug("Greyscale %d",vinfo.grayscale); + qDebug("Nonstd %d",vinfo.nonstd); + qDebug("Red %d %d %d",vinfo.red.offset,vinfo.red.length, + vinfo.red.msb_right); + qDebug("Green %d %d %d",vinfo.green.offset,vinfo.green.length, + vinfo.green.msb_right); + qDebug("Blue %d %d %d",vinfo.blue.offset,vinfo.blue.length, + vinfo.blue.msb_right); + qDebug("Transparent %d %d %d",vinfo.transp.offset,vinfo.transp.length, + vinfo.transp.msb_right); +#endif + + d_ptr->startupw=vinfo.xres; + d_ptr->startuph=vinfo.yres; + d_ptr->startupd=vinfo.bits_per_pixel; + grayscale = vinfo.grayscale; + + if (ioctl(d_ptr->fd, FBIOGET_FSCREENINFO, &finfo)) { + perror("QLinuxFbScreen::initDevice"); + qCritical("Error reading fixed information in card init"); + // It's not an /error/ as such, though definitely a bad sign + // so we return true + return true; + } + +#ifdef __i386__ + // Now init mtrr + if(!::getenv("QWS_NOMTRR")) { + int mfd=QT_OPEN("/proc/mtrr",O_WRONLY,0); + // MTRR entry goes away when file is closed - i.e. + // hopefully when QWS is killed + if(mfd != -1) { + mtrr_sentry sentry; + sentry.base=(unsigned long int)finfo.smem_start; + //qDebug("Physical framebuffer address %p",(void*)finfo.smem_start); + // Size needs to be in 4k chunks, but that's not always + // what we get thanks to graphics card registers. Write combining + // these is Not Good, so we write combine what we can + // (which is not much - 4 megs on an 8 meg card, it seems) + unsigned int size=finfo.smem_len; + size=size >> 22; + size=size << 22; + sentry.size=size; + sentry.type=MTRR_TYPE_WRCOMB; + if(ioctl(mfd,MTRRIOC_ADD_ENTRY,&sentry)==-1) { + //printf("Couldn't add mtrr entry for %lx %lx, %s\n", + //sentry.base,sentry.size,strerror(errno)); + } + } + + // Should we close mfd here? + //QT_CLOSE(mfd); + } +#endif + if ((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4) || (finfo.visual==FB_VISUAL_DIRECTCOLOR)) + { + fb_cmap cmap; + createPalette(cmap, vinfo, finfo); + if (ioctl(d_ptr->fd, FBIOPUTCMAP, &cmap)) { + perror("QLinuxFbScreen::initDevice"); + qWarning("Error writing palette to framebuffer"); + } + free(cmap.red); + free(cmap.green); + free(cmap.blue); + free(cmap.transp); + } + +#if 0 + if (canaccel) { + *entryp=0; + *lowest = mapsize; + insert_entry(*entryp, *lowest, *lowest); // dummy entry to mark start + } + + shared->fifocount = 0; + shared->buffer_offset = 0xffffffff; // 0 would be a sensible offset (screen) + shared->linestep = 0; + shared->cliptop = 0xffffffff; + shared->clipleft = 0xffffffff; + shared->clipright = 0xffffffff; + shared->clipbottom = 0xffffffff; + shared->rop = 0xffffffff; +#endif + +#ifdef QT_QWS_DEPTH_GENERIC + if (pixelFormat() == QImage::Format_Invalid && screencols == 0 + && d_ptr->doGenericColors) + { + qt_set_generic_blit(this, vinfo.bits_per_pixel, + vinfo.red.length, vinfo.green.length, + vinfo.blue.length, vinfo.transp.length, + vinfo.red.offset, vinfo.green.offset, + vinfo.blue.offset, vinfo.transp.offset); + } +#endif + +#if 0 +#ifndef QT_NO_QWS_CURSOR + QScreenCursor::initSoftwareCursor(); +#endif +#endif + blank(false); + + return true; +} + +void QLinuxFbGraphicsSystem::setPixelFormat(struct fb_var_screeninfo info) +{ + const fb_bitfield rgba[4] = { info.red, info.green, + info.blue, info.transp }; + + QImage::Format format = QImage::Format_Invalid; + + switch (d) { + case 32: { + const fb_bitfield argb8888[4] = {{16, 8, 0}, {8, 8, 0}, + {0, 8, 0}, {24, 8, 0}}; + const fb_bitfield abgr8888[4] = {{0, 8, 0}, {8, 8, 0}, + {16, 8, 0}, {24, 8, 0}}; + if (memcmp(rgba, argb8888, 4 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_ARGB32; + } else if (memcmp(rgba, argb8888, 3 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_RGB32; + } else if (memcmp(rgba, abgr8888, 3 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_RGB32; + pixeltype = BGRPixel; + } + break; + } + case 24: { + const fb_bitfield rgb888[4] = {{16, 8, 0}, {8, 8, 0}, + {0, 8, 0}, {0, 0, 0}}; + const fb_bitfield bgr888[4] = {{0, 8, 0}, {8, 8, 0}, + {16, 8, 0}, {0, 0, 0}}; + if (memcmp(rgba, rgb888, 3 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_RGB888; + } else if (memcmp(rgba, bgr888, 3 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_RGB888; + pixeltype = BGRPixel; + } + break; + } + case 18: { + const fb_bitfield rgb666[4] = {{12, 6, 0}, {6, 6, 0}, + {0, 6, 0}, {0, 0, 0}}; + if (memcmp(rgba, rgb666, 3 * sizeof(fb_bitfield)) == 0) + format = QImage::Format_RGB666; + break; + } + case 16: { + const fb_bitfield rgb565[4] = {{11, 5, 0}, {5, 6, 0}, + {0, 5, 0}, {0, 0, 0}}; + const fb_bitfield bgr565[4] = {{0, 5, 0}, {5, 6, 0}, + {11, 5, 0}, {0, 0, 0}}; + if (memcmp(rgba, rgb565, 3 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_RGB16; + } else if (memcmp(rgba, bgr565, 3 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_RGB16; + pixeltype = BGRPixel; + } + break; + } + case 15: { + const fb_bitfield rgb1555[4] = {{10, 5, 0}, {5, 5, 0}, + {0, 5, 0}, {15, 1, 0}}; + const fb_bitfield bgr1555[4] = {{0, 5, 0}, {5, 5, 0}, + {10, 5, 0}, {15, 1, 0}}; + if (memcmp(rgba, rgb1555, 3 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_RGB555; + } else if (memcmp(rgba, bgr1555, 3 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_RGB555; + pixeltype = BGRPixel; + } + break; + } + case 12: { + const fb_bitfield rgb444[4] = {{8, 4, 0}, {4, 4, 0}, + {0, 4, 0}, {0, 0, 0}}; + if (memcmp(rgba, rgb444, 3 * sizeof(fb_bitfield)) == 0) + format = QImage::Format_RGB444; + break; + } + case 8: + break; + case 1: + format = QImage::Format_Mono; //###: LSB??? + break; + default: + break; + } + + screenFormat = format; +} + +void QLinuxFbGraphicsSystem::createPalette(fb_cmap &cmap, fb_var_screeninfo &vinfo, fb_fix_screeninfo &finfo) +{ + if((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4)) { + screencols= (vinfo.bits_per_pixel==8) ? 256 : 16; + cmap.start=0; + cmap.len=screencols; + cmap.red=(unsigned short int *) + malloc(sizeof(unsigned short int)*screencols); + cmap.green=(unsigned short int *) + malloc(sizeof(unsigned short int)*screencols); + cmap.blue=(unsigned short int *) + malloc(sizeof(unsigned short int)*screencols); + cmap.transp=(unsigned short int *) + malloc(sizeof(unsigned short int)*screencols); + + if (screencols==16) { + if (finfo.type == FB_TYPE_PACKED_PIXELS) { + // We'll setup a grayscale cmap for 4bpp linear + int val = 0; + for (int idx = 0; idx < 16; ++idx, val += 17) { + cmap.red[idx] = (val<<8)|val; + cmap.green[idx] = (val<<8)|val; + cmap.blue[idx] = (val<<8)|val; + screenclut[idx]=qRgb(val, val, val); + } + } else { + // Default 16 colour palette + // Green is now trolltech green so certain images look nicer + // black d_gray l_gray white red green blue cyan magenta yellow + unsigned char reds[16] = { 0x00, 0x7F, 0xBF, 0xFF, 0xFF, 0xA2, 0x00, 0xFF, 0xFF, 0x00, 0x7F, 0x7F, 0x00, 0x00, 0x00, 0x82 }; + unsigned char greens[16] = { 0x00, 0x7F, 0xBF, 0xFF, 0x00, 0xC5, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F }; + unsigned char blues[16] = { 0x00, 0x7F, 0xBF, 0xFF, 0x00, 0x11, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0x7F, 0x7F, 0x7F, 0x00, 0x00 }; + + for (int idx = 0; idx < 16; ++idx) { + cmap.red[idx] = ((reds[idx]) << 8)|reds[idx]; + cmap.green[idx] = ((greens[idx]) << 8)|greens[idx]; + cmap.blue[idx] = ((blues[idx]) << 8)|blues[idx]; + cmap.transp[idx] = 0; + screenclut[idx]=qRgb(reds[idx], greens[idx], blues[idx]); + } + } + } else { + if (grayscale) { + // Build grayscale palette + int i; + for(i=0;iblank == on) + return; + +#if defined(QT_QWS_IPAQ) + if (on) + system("apm -suspend"); +#else + if (d_ptr->fd == -1) + return; +// Some old kernel versions don't have this. These defines should go +// away eventually +#if defined(FBIOBLANK) +#if defined(VESA_POWERDOWN) && defined(VESA_NO_BLANKING) + ioctl(d_ptr->fd, FBIOBLANK, on ? VESA_POWERDOWN : VESA_NO_BLANKING); +#else + ioctl(d_ptr->fd, FBIOBLANK, on ? 1 : 0); +#endif +#endif +#endif + + d_ptr->blank = on; +} + +QPixmapData *QLinuxFbGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const +{ + return new QRasterPixmapData(type); +} + +QWindowSurface *QLinuxFbGraphicsSystem::createWindowSurface(QWidget *widget) const +{ + if (widget->windowType() == Qt::Desktop) + return 0; // Don't create an explicit window surface for the destkop. + return new QLinuxFbWindowSurface(mPrimaryScreen, widget); +} + +QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.h b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.h new file mode 100644 index 0000000..3446008 --- /dev/null +++ b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.h @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_LINUXFB_H +#define QGRAPHICSSYSTEM_LINUXFB_H + +#include + +QT_BEGIN_NAMESPACE + +class QLinuxFbGraphicsSystemScreen : public QGraphicsSystemScreen +{ +public: + QLinuxFbGraphicsSystemScreen() + : mDepth(16), mFormat(QImage::Format_RGB16), mScreenImage(0) {} + ~QLinuxFbGraphicsSystemScreen() { delete mScreenImage; } + + QRect geometry() const { return mGeometry; } + int depth() const { return mDepth; } + QImage::Format format() const { return mFormat; } + QSize physicalSize() const { return mPhysicalSize; } + +public: + QRect mGeometry; + int mDepth; + QImage::Format mFormat; + QSize mPhysicalSize; + QImage *mScreenImage; + +}; + +class QLinuxFbGraphicsSystemPrivate; +struct fb_cmap; +struct fb_var_screeninfo; +struct fb_fix_screeninfo; + +class QLinuxFbGraphicsSystem : public QGraphicsSystem +{ +public: + QLinuxFbGraphicsSystem(); + ~QLinuxFbGraphicsSystem(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QWindowSurface *createWindowSurface(QWidget *widget) const; + + QList screens() const { return mScreens; } + +private: + QLinuxFbGraphicsSystemScreen *mPrimaryScreen; + QList mScreens; + QLinuxFbGraphicsSystemPrivate *d_ptr; + + enum PixelType { NormalPixel, BGRPixel }; + + QRgb screenclut[256]; + int screencols; + + uchar * data; + + QImage::Format screenFormat; + int w; + int lstep; + int h; + int d; + PixelType pixeltype; + bool grayscale; + + int dw; + int dh; + + int size; // Screen size + int mapsize; // Total mapped memory + + int displayId; + + int physWidth; + int physHeight; + + bool canaccel; + int dataoffset; + int cacheStart; + + bool connect(const QString &displaySpec); + bool initDevice(); + void setPixelFormat(struct fb_var_screeninfo); + void createPalette(fb_cmap &cmap, fb_var_screeninfo &vinfo, fb_fix_screeninfo &finfo); + void blank(bool on); +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.cpp b/src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.cpp new file mode 100644 index 0000000..bfc2f83 --- /dev/null +++ b/src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.cpp @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsurface_linuxfb.h" +#include "qgraphicssystem_linuxfb.h" +#include +#include +#include + +QT_BEGIN_NAMESPACE + +QLinuxFbWindowSurface::QLinuxFbWindowSurface + (QLinuxFbGraphicsSystemScreen *screen, QWidget *window) + : QWindowSurface(window), + mScreen(screen) +{ +} + +QLinuxFbWindowSurface::~QLinuxFbWindowSurface() +{ +} + +QPaintDevice *QLinuxFbWindowSurface::paintDevice() +{ + return &mImage; +} + +void QLinuxFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + Q_UNUSED(offset); + + QRect rect = geometry(); + QPoint topLeft = rect.topLeft(); + + QPainter painter(mScreen->mScreenImage); + if (region.numRects() == 1) { + QRect wrect = region.boundingRect(); + painter.drawImage(wrect.topLeft() + topLeft, mImage, wrect); + } else { + QVector rects = region.rects(); + foreach (QRect wrect, rects) + painter.drawImage(wrect.topLeft() + topLeft, mImage, wrect); + } +} + +void QLinuxFbWindowSurface::setGeometry(const QRect &r) +{ +#ifdef QT_LITE_FORCE_FULLSCREEN +// any size you like as long as it's full-screen... + QRect rect(mScreen->availableGeometry()); + QApplicationPrivate::handleGeometryChange(this->window(), rect); +#else + QRect rect(r); +#endif + QWindowSurface::setGeometry(rect); + if (mImage.size() != rect.size()) + mImage = QImage(rect.size(), mScreen->format()); +} + +bool QLinuxFbWindowSurface::scroll(const QRegion &area, int dx, int dy) +{ + return QWindowSurface::scroll(area, dx, dy); +} + +void QLinuxFbWindowSurface::beginPaint(const QRegion ®ion) +{ + Q_UNUSED(region); +} + +void QLinuxFbWindowSurface::endPaint(const QRegion ®ion) +{ + Q_UNUSED(region); +} + +QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.h b/src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.h new file mode 100644 index 0000000..763f362 --- /dev/null +++ b/src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSURFACE_LINUXFB_H +#define QWINDOWSURFACE_LINUXFB_H + +#include + +QT_BEGIN_NAMESPACE + +class QLinuxFbGraphicsSystemScreen; + +class QLinuxFbWindowSurface : public QWindowSurface +{ +public: + QLinuxFbWindowSurface + (QLinuxFbGraphicsSystemScreen *screen, QWidget *window); + ~QLinuxFbWindowSurface(); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void setGeometry(const QRect &rect); + bool scroll(const QRegion &area, int dx, int dy); + + void beginPaint(const QRegion ®ion); + void endPaint(const QRegion ®ion); + +private: + QLinuxFbGraphicsSystemScreen *mScreen; + QImage mImage; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/graphicssystems/minimal/main.cpp b/src/plugins/graphicssystems/minimal/main.cpp new file mode 100644 index 0000000..f7d5eef --- /dev/null +++ b/src/plugins/graphicssystems/minimal/main.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qgraphicssystem_minimal.h" + +QT_BEGIN_NAMESPACE + +class QMinimalGraphicsSystemPlugin : public QGraphicsSystemPlugin +{ +public: + QStringList keys() const; + QGraphicsSystem *create(const QString&); +}; + +QStringList QMinimalGraphicsSystemPlugin::keys() const +{ + QStringList list; + list << "Minimal"; + return list; +} + +QGraphicsSystem* QMinimalGraphicsSystemPlugin::create(const QString& system) +{ + if (system.toLower() == "minimal") + return new QMinimalGraphicsSystem; + + return 0; +} + +Q_EXPORT_PLUGIN2(minimal, QMinimalGraphicsSystemPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/minimal/minimal.pro b/src/plugins/graphicssystems/minimal/minimal.pro new file mode 100644 index 0000000..11604dd --- /dev/null +++ b/src/plugins/graphicssystems/minimal/minimal.pro @@ -0,0 +1,10 @@ +TARGET = qminimalgraphicssystem +include(../../qpluginbase.pri) + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems + +SOURCES = main.cpp qgraphicssystem_minimal.cpp qwindowsurface_minimal.cpp +HEADERS = qgraphicssystem_minimal.h qwindowsurface_minimal.h + +target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +INSTALLS += target diff --git a/src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.cpp b/src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.cpp new file mode 100644 index 0000000..31023fc --- /dev/null +++ b/src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgraphicssystem_minimal.h" +#include "qwindowsurface_minimal.h" +#include + +QT_BEGIN_NAMESPACE + +QMinimalGraphicsSystem::QMinimalGraphicsSystem() +{ + mPrimaryScreen = new QMinimalGraphicsSystemScreen(); + + mPrimaryScreen->mGeometry = QRect(0, 0, 240, 320); + mPrimaryScreen->mDepth = 16; + mPrimaryScreen->mFormat = QImage::Format_RGB16; + mPrimaryScreen->mPhysicalSize = QSize(40, 54); + + mScreens.append(mPrimaryScreen); +} + +QPixmapData *QMinimalGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const +{ + return new QRasterPixmapData(type); +} + +QWindowSurface *QMinimalGraphicsSystem::createWindowSurface(QWidget *widget) const +{ + return new QMinimalWindowSurface(mPrimaryScreen, widget); +} + +QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.h b/src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.h new file mode 100644 index 0000000..b15f6f6 --- /dev/null +++ b/src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_MINIMAL_H +#define QGRAPHICSSYSTEM_MINIMAL_H + +#include + +QT_BEGIN_NAMESPACE + +class QMinimalGraphicsSystemScreen : public QGraphicsSystemScreen +{ +public: + QMinimalGraphicsSystemScreen() + : mDepth(16), mFormat(QImage::Format_RGB16) {} + ~QMinimalGraphicsSystemScreen() {} + + QRect geometry() const { return mGeometry; } + int depth() const { return mDepth; } + QImage::Format format() const { return mFormat; } + QSize physicalSize() const { return mPhysicalSize; } + +public: + QRect mGeometry; + int mDepth; + QImage::Format mFormat; + QSize mPhysicalSize; +}; + +class QMinimalGraphicsSystem : public QGraphicsSystem +{ +public: + QMinimalGraphicsSystem(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QWindowSurface *createWindowSurface(QWidget *widget) const; + + QList screens() const { return mScreens; } + +private: + QMinimalGraphicsSystemScreen *mPrimaryScreen; + QList mScreens; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/graphicssystems/minimal/qwindowsurface_minimal.cpp b/src/plugins/graphicssystems/minimal/qwindowsurface_minimal.cpp new file mode 100644 index 0000000..e9d7d69 --- /dev/null +++ b/src/plugins/graphicssystems/minimal/qwindowsurface_minimal.cpp @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsurface_minimal.h" +#include "qgraphicssystem_minimal.h" +#include + +QT_BEGIN_NAMESPACE + +QMinimalWindowSurface::QMinimalWindowSurface + (QMinimalGraphicsSystemScreen *screen, QWidget *window) + : QWindowSurface(window), + mScreen(screen) +{ + //qDebug() << "QMinimalWindowSurface::QMinimalWindowSurface:" << (long)this; +} + +QMinimalWindowSurface::~QMinimalWindowSurface() +{ +} + +QPaintDevice *QMinimalWindowSurface::paintDevice() +{ + //qDebug() << "QMinimalWindowSurface::paintDevice"; + return &mImage; +} + +void QMinimalWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + Q_UNUSED(region); + Q_UNUSED(offset); + + static int c = 0; + QString filename = QString("output%1.png").arg(c++, 4, 10, QLatin1Char('0')); + qDebug() << "QMinimalWindowSurface::flush() saving contents to" << filename.toLocal8Bit().constData(); + mImage.save(filename); +} + +void QMinimalWindowSurface::setGeometry(const QRect &rect) +{ + //qDebug() << "QMinimalWindowSurface::setGeometry:" << (long)this << rect; + QWindowSurface::setGeometry(rect); + if (mImage.size() != rect.size()) + mImage = QImage(rect.size(), mScreen->format()); +} + +bool QMinimalWindowSurface::scroll(const QRegion &area, int dx, int dy) +{ + return QWindowSurface::scroll(area, dx, dy); +} + +void QMinimalWindowSurface::beginPaint(const QRegion ®ion) +{ + Q_UNUSED(region); +} + +void QMinimalWindowSurface::endPaint(const QRegion ®ion) +{ + Q_UNUSED(region); +} + +QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/minimal/qwindowsurface_minimal.h b/src/plugins/graphicssystems/minimal/qwindowsurface_minimal.h new file mode 100644 index 0000000..89dc860 --- /dev/null +++ b/src/plugins/graphicssystems/minimal/qwindowsurface_minimal.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSURFACE_MINIMAL_H +#define QWINDOWSURFACE_MINIMAL_H + +#include + +QT_BEGIN_NAMESPACE + +class QMinimalGraphicsSystemScreen; + +class QMinimalWindowSurface : public QWindowSurface +{ +public: + QMinimalWindowSurface + (QMinimalGraphicsSystemScreen *screen, QWidget *window); + ~QMinimalWindowSurface(); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void setGeometry(const QRect &rect); + bool scroll(const QRegion &area, int dx, int dy); + + void beginPaint(const QRegion ®ion); + void endPaint(const QRegion ®ion); + +private: + QMinimalGraphicsSystemScreen *mScreen; + QImage mImage; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/graphicssystems/openvglite/main.cpp b/src/plugins/graphicssystems/openvglite/main.cpp new file mode 100644 index 0000000..3a73f5c --- /dev/null +++ b/src/plugins/graphicssystems/openvglite/main.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qgraphicssystem_vglite.h" + +QT_BEGIN_NAMESPACE + +class QVGGraphicsSystemPlugin : public QGraphicsSystemPlugin +{ +public: + QStringList keys() const; + QGraphicsSystem *create(const QString&); +}; + +QStringList QVGGraphicsSystemPlugin::keys() const +{ + QStringList list; + list << "OpenVG"; + return list; +} + +QGraphicsSystem* QVGGraphicsSystemPlugin::create(const QString& system) +{ + if (system.toLower() == "openvg") + return new QVGLiteGraphicsSystem; + + return 0; +} + +Q_EXPORT_PLUGIN2(openvg, QVGGraphicsSystemPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/openvglite/openvglite.pro b/src/plugins/graphicssystems/openvglite/openvglite.pro new file mode 100644 index 0000000..9d7860a --- /dev/null +++ b/src/plugins/graphicssystems/openvglite/openvglite.pro @@ -0,0 +1,12 @@ +TARGET = qvglitegraphicssystem +include(../../qpluginbase.pri) + +QT += openvg + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems + +SOURCES = main.cpp qgraphicssystem_vglite.cpp qwindowsurface_vglite.cpp +HEADERS = qgraphicssystem_vglite.h qwindowsurface_vglite.h + +target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +INSTALLS += target diff --git a/src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.cpp b/src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.cpp new file mode 100644 index 0000000..cc5b012 --- /dev/null +++ b/src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.cpp @@ -0,0 +1,193 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgraphicssystem_vglite.h" +#include "qwindowsurface_vglite.h" +#include +#include +#include +#ifdef OPENVG_USBHP_INIT +extern "C" { +#include +}; +#endif + +QT_BEGIN_NAMESPACE + +QVGLiteGraphicsSystem::QVGLiteGraphicsSystem() + : w(0), h(0), d(0), dw(0), dh(0), physWidth(0), physHeight(0), + surface(0), context(0), rootWindow(0), + screenFormat(QImage::Format_RGB16), preservedSwap(false) +{ +#ifdef OPENVG_USBHP_INIT + initLibrary(); +#endif + + // The graphics system is also the screen definition. + mScreens.append(this); + + QString displaySpec = QString::fromLatin1(qgetenv("QWS_DISPLAY")); + QStringList displayArgs = displaySpec.split(QLatin1Char(':')); + + // Initialize EGL and create the global EGL context. + context = qt_vg_create_context(0); + if (!context) { + qFatal("QVGLiteGraphicsSystem: could not initialize EGL"); + return; + } + + // Get the root window handle to use. Default to zero. + QRegExp winidRx(QLatin1String("winid=?(\\d+)")); + int winidIdx = displayArgs.indexOf(winidRx); + int handle = 0; + if (winidIdx >= 0) { + winidRx.exactMatch(displayArgs.at(winidIdx)); + handle = winidRx.cap(1).toInt(); + } + + // Create a full-screen window based on the native handle. + // If the context is premultiplied, the window should be too. + QEglProperties props; +#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT + EGLint surfaceType = 0; + if (context->configAttrib(EGL_SURFACE_TYPE, &surfaceType) && + (surfaceType & EGL_VG_ALPHA_FORMAT_PRE_BIT) != 0) + props.setValue(EGL_VG_ALPHA_FORMAT, EGL_VG_ALPHA_FORMAT_PRE); +#endif + rootWindow = eglCreateWindowSurface + (context->display(), context->config(), + (EGLNativeWindowType)handle, props.properties()); + if (rootWindow == EGL_NO_SURFACE) { + delete context; + context = 0; + qFatal("QVGLiteGraphicsSystem: could not create full-screen window"); + return; + } + + // Try to turn on preserved swap behaviour on the root window. + // This will allow us to optimize compositing to focus on just + // the screen region that has changed. Otherwise we must + // re-composite the entire screen every frame. +#if !defined(QVG_NO_PRESERVED_SWAP) + eglGetError(); // Clear error state first. + eglSurfaceAttrib(context->display(), rootWindow, + EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); + preservedSwap = (eglGetError() == EGL_SUCCESS); +#else + preservedSwap = false; +#endif + + // Fetch the root window properties. + eglQuerySurface(context->display(), rootWindow, EGL_WIDTH, &w); + eglQuerySurface(context->display(), rootWindow, EGL_HEIGHT, &h); + screenFormat = qt_vg_config_to_image_format(context); + switch (screenFormat) { + case QImage::Format_ARGB32_Premultiplied: + case QImage::Format_ARGB32: + case QImage::Format_RGB32: + default: + d = 32; + break; + case QImage::Format_RGB16: + case QImage::Format_ARGB4444_Premultiplied: + d = 16; + break; + } + dw = w; + dh = h; + qDebug("screen size: %dx%dx%d", w, h, d); + + // Handle display physical size spec. From qscreenlinuxfb_qws.cpp. + QRegExp mmWidthRx(QLatin1String("mmWidth=?(\\d+)")); + int dimIdxW = displayArgs.indexOf(mmWidthRx); + QRegExp mmHeightRx(QLatin1String("mmHeight=?(\\d+)")); + int dimIdxH = displayArgs.indexOf(mmHeightRx); + if (dimIdxW >= 0) { + mmWidthRx.exactMatch(displayArgs.at(dimIdxW)); + physWidth = mmWidthRx.cap(1).toInt(); + if (dimIdxH < 0) + physHeight = dh*physWidth/dw; + } + if (dimIdxH >= 0) { + mmHeightRx.exactMatch(displayArgs.at(dimIdxH)); + physHeight = mmHeightRx.cap(1).toInt(); + if (dimIdxW < 0) + physWidth = dw*physHeight/dh; + } + if (dimIdxW < 0 && dimIdxH < 0) { + const int dpi = 72; + physWidth = qRound(dw * 25.4 / dpi); + physHeight = qRound(dh * 25.4 / dpi); + } +} + +QVGLiteGraphicsSystem::~QVGLiteGraphicsSystem() +{ +} + +QPixmapData *QVGLiteGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const +{ +#if !defined(QVGLite_NO_SINGLE_CONTEXT) && !defined(QVGLite_NO_PIXMAP_DATA) + // Pixmaps can use QVGLitePixmapData; bitmaps must use raster. + if (type == QPixmapData::PixmapType) + return new QVGPixmapData(type); + else + return new QRasterPixmapData(type); +#else + return new QRasterPixmapData(type); +#endif +} + +QWindowSurface *QVGLiteGraphicsSystem::createWindowSurface(QWidget *widget) const +{ + if (widget->windowType() == Qt::Desktop) + return 0; // Don't create an explicit window surface for the destkop. + if (surface) { + qWarning() << "QVGLiteGraphicsSystem: only one window surface " + "is supported at a time"; + return 0; + } + surface = new QVGLiteWindowSurface + (const_cast(this), widget); + return surface; +} + +QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.h b/src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.h new file mode 100644 index 0000000..74fc41e --- /dev/null +++ b/src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.h @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_VGLITE_H +#define QGRAPHICSSYSTEM_VGLITE_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QVGLiteWindowSurface; + +class QVGLiteGraphicsSystem : public QGraphicsSystem, + public QGraphicsSystemScreen +{ +public: + QVGLiteGraphicsSystem(); + ~QVGLiteGraphicsSystem(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QWindowSurface *createWindowSurface(QWidget *widget) const; + QList screens() const { return mScreens; } + + QRect geometry() const { return QRect(0, 0, w, h); } + int depth() const { return d; } + QImage::Format format() const { return screenFormat; } + QSize physicalSize() const { return QSize(physWidth, physHeight); } + +private: + friend class QVGLiteWindowSurface; + + int w; + int h; + int d; + + int dw; + int dh; + + int physWidth; + int physHeight; + + mutable QVGLiteWindowSurface *surface; + QEglContext *context; + EGLSurface rootWindow; + QImage::Format screenFormat; + bool preservedSwap; + + QList mScreens; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.cpp b/src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.cpp new file mode 100644 index 0000000..d250a8e --- /dev/null +++ b/src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.cpp @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsurface_vglite.h" +#include "qgraphicssystem_vglite.h" +#include +#include +#include + +QT_BEGIN_NAMESPACE + +QVGLiteWindowSurface::QVGLiteWindowSurface + (QVGLiteGraphicsSystem *gs, QWidget *window) + : QWindowSurface(window), graphicsSystem(gs), + isPaintingActive(false), engine(0) +{ +} + +QVGLiteWindowSurface::~QVGLiteWindowSurface() +{ + graphicsSystem->surface = 0; + if (engine) + qt_vg_destroy_paint_engine(engine); +} + +QPaintDevice *QVGLiteWindowSurface::paintDevice() +{ + qt_vg_make_current(graphicsSystem->context, graphicsSystem->rootWindow); + isPaintingActive = true; + // TODO: clear the parts of the back buffer that are not + // covered by the window surface to black. + return this; +} + +void QVGLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + Q_UNUSED(region); + Q_UNUSED(offset); + QEglContext *context = graphicsSystem->context; + if (context) { + if (!isPaintingActive) + qt_vg_make_current(context, graphicsSystem->rootWindow); + context->swapBuffers(); + qt_vg_done_current(context); + context->setSurface(EGL_NO_SURFACE); + isPaintingActive = false; + } +} + +void QVGLiteWindowSurface::setGeometry(const QRect &rect) +{ + QWindowSurface::setGeometry(rect); +} + +bool QVGLiteWindowSurface::scroll(const QRegion &area, int dx, int dy) +{ + return QWindowSurface::scroll(area, dx, dy); +} + +void QVGLiteWindowSurface::beginPaint(const QRegion ®ion) +{ + Q_UNUSED(region); +} + +void QVGLiteWindowSurface::endPaint(const QRegion ®ion) +{ + Q_UNUSED(region); +} + +QPaintEngine *QVGLiteWindowSurface::paintEngine() const +{ + if (!engine) + engine = qt_vg_create_paint_engine(); + return engine; +} + +// We need to get access to QWidget::metric() from QVGLiteWindowSurface::metric, +// but it is not a friend of QWidget. To get around this, we create a +// fake QX11PaintEngine class, which is a friend. +class QX11PaintEngine +{ +public: + static int metric(const QWidget *widget, QPaintDevice::PaintDeviceMetric met) + { + return widget->metric(met); + } +}; + +int QVGLiteWindowSurface::metric(PaintDeviceMetric met) const +{ + return QX11PaintEngine::metric(window(), met); +} diff --git a/src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.h b/src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.h new file mode 100644 index 0000000..c1ae02e --- /dev/null +++ b/src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.h @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSURFACE_VGLITE_H +#define QWINDOWSURFACE_VGLITE_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 +#include + +QT_BEGIN_NAMESPACE + +class QVGLiteGraphicsSystem; +class QVGPaintEngine; + +class Q_OPENVG_EXPORT QVGLiteWindowSurface : public QWindowSurface, public QPaintDevice +{ +public: + QVGLiteWindowSurface(QVGLiteGraphicsSystem *gs, QWidget *window); + ~QVGLiteWindowSurface(); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void setGeometry(const QRect &rect); + bool scroll(const QRegion &area, int dx, int dy); + + void beginPaint(const QRegion ®ion); + void endPaint(const QRegion ®ion); + + QPaintEngine *paintEngine() const; + +protected: + int metric(PaintDeviceMetric metric) const; + +private: + QVGLiteGraphicsSystem *graphicsSystem; + bool isPaintingActive; + mutable QVGPaintEngine *engine; +}; + +QT_END_NAMESPACE + +#endif // QWINDOWSURFACE_VGLITE_H diff --git a/src/plugins/graphicssystems/testlite/main.cpp b/src/plugins/graphicssystems/testlite/main.cpp new file mode 100644 index 0000000..6271829 --- /dev/null +++ b/src/plugins/graphicssystems/testlite/main.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qgraphicssystem_testlite.h" + +QT_BEGIN_NAMESPACE + +class QTestLiteGraphicsSystemPlugin : public QGraphicsSystemPlugin +{ +public: + QStringList keys() const; + QGraphicsSystem *create(const QString&); +}; + +QStringList QTestLiteGraphicsSystemPlugin::keys() const +{ + QStringList list; + list << "TestLite"; + return list; +} + +QGraphicsSystem* QTestLiteGraphicsSystemPlugin::create(const QString& system) +{ + if (system.toLower() == "testlite") + return new QTestLiteGraphicsSystem; + + return 0; +} + +Q_EXPORT_PLUGIN2(testlite, QTestLiteGraphicsSystemPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp new file mode 100644 index 0000000..b1948b9 --- /dev/null +++ b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgraphicssystem_testlite.h" +#include "qwindowsurface_testlite.h" +#include +#include + +#include "x11util.h" + +QT_BEGIN_NAMESPACE + +QTestLiteGraphicsSystem::QTestLiteGraphicsSystem() +{ + xd = new MyDisplay; + + mPrimaryScreen = new QTestLiteGraphicsSystemScreen(); + + mPrimaryScreen->mGeometry = QRect + (0, 0, xd->width, xd->height); + mPrimaryScreen->mDepth = 32; + mPrimaryScreen->mFormat = QImage::Format_RGB32; + mPrimaryScreen->mPhysicalSize = + QSize(xd->physicalWidth, xd->physicalHeight); + + mScreens.append(mPrimaryScreen); +} + +QPixmapData *QTestLiteGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const +{ + return new QRasterPixmapData(type); +} + +QWindowSurface *QTestLiteGraphicsSystem::createWindowSurface(QWidget *widget) const +{ + if (widget->windowType() == Qt::Desktop) + return 0; // Don't create an explicit window surface for the destkop. + return new QTestLiteWindowSurface + (const_cast(this), mPrimaryScreen, widget); +} + +QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.h b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.h new file mode 100644 index 0000000..cb88ee8 --- /dev/null +++ b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.h @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_TESTLITE_H +#define QGRAPHICSSYSTEM_TESTLITE_H + +#include + +QT_BEGIN_NAMESPACE + +class MyDisplay; + +class QTestLiteGraphicsSystemScreen : public QGraphicsSystemScreen +{ +public: + QTestLiteGraphicsSystemScreen() + : mDepth(16), mFormat(QImage::Format_RGB16) {} + ~QTestLiteGraphicsSystemScreen() {} + + QRect geometry() const { return mGeometry; } + int depth() const { return mDepth; } + QImage::Format format() const { return mFormat; } + QSize physicalSize() const { return mPhysicalSize; } + +public: + QRect mGeometry; + int mDepth; + QImage::Format mFormat; + QSize mPhysicalSize; +}; + +class QTestLiteGraphicsSystem : public QGraphicsSystem +{ +public: + QTestLiteGraphicsSystem(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QWindowSurface *createWindowSurface(QWidget *widget) const; + + QList screens() const { return mScreens; } + + MyDisplay *xd; + +private: + QTestLiteGraphicsSystemScreen *mPrimaryScreen; + QList mScreens; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp new file mode 100644 index 0000000..6996809 --- /dev/null +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp @@ -0,0 +1,528 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsurface_testlite.h" +#include "qgraphicssystem_testlite.h" + +#include +#include + +#include "x11util.h" + +QT_BEGIN_NAMESPACE + +QTestLiteWindowSurface::QTestLiteWindowSurface + (QTestLiteGraphicsSystem *graphicsSystem, + QTestLiteGraphicsSystemScreen *screen, QWidget *window) + : QWindowSurface(window), + mGraphicsSystem(graphicsSystem), + mScreen(screen), + xw(0) +{ + + + xw = new MyWindow(graphicsSystem->xd, 0,0,300,300); + xw->windowSurface = this; + + qDebug() << "QTestLiteWindowSurface::QTestLiteWindowSurface:" << xw->window; + + setWindowFlags(window->windowFlags()); //##### This should not be the plugin's responsibility +} + +QTestLiteWindowSurface::~QTestLiteWindowSurface() +{ + qDebug() << "~QTestLiteWindowSurface" << xw->window; + delete xw; +} + +QPaintDevice *QTestLiteWindowSurface::paintDevice() +{ + return &xw->img; +} + +void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + Q_UNUSED(region); + Q_UNUSED(offset); + + // qDebug() << "QTestLiteWindowSurface::flush:" << (long)this; + + xw->paintEvent(); +} + +void QTestLiteWindowSurface::setGeometry(const QRect &rect) +{ + //qDebug() << "QTestLiteWindowSurface::setGeometry:" << rect << xw->window; + QWindowSurface::setGeometry(rect); + + if (xw->img.size() != rect.size()) + xw->img = QImage(rect.size(), mScreen->format()); + + //if unchanged ### +// xw->setSize(rect.width(), rect.height()); + xw->setGeometry(rect.x(), rect.y(), rect.width(), rect.height()); +} + +bool QTestLiteWindowSurface::scroll(const QRegion &area, int dx, int dy) +{ + return QWindowSurface::scroll(area, dx, dy); +} + +void QTestLiteWindowSurface::beginPaint(const QRegion ®ion) +{ + Q_UNUSED(region); +} + +void QTestLiteWindowSurface::endPaint(const QRegion ®ion) +{ + Q_UNUSED(region); +} + + + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Mouse event stuff + + + + +static Qt::MouseButtons translateMouseButtons(int s) +{ + Qt::MouseButtons ret = 0; + if (s & Button1Mask) + ret |= Qt::LeftButton; + if (s & Button2Mask) + ret |= Qt::MidButton; + if (s & Button3Mask) + ret |= Qt::RightButton; + return ret; +} + + +static Qt::KeyboardModifiers translateModifiers(int s) +{ + const uchar qt_alt_mask = Mod1Mask; + const uchar qt_meta_mask = Mod4Mask; + + + Qt::KeyboardModifiers ret = 0; + if (s & ShiftMask) + ret |= Qt::ShiftModifier; + if (s & ControlMask) + ret |= Qt::ControlModifier; + if (s & qt_alt_mask) + ret |= Qt::AltModifier; + if (s & qt_meta_mask) + ret |= Qt::MetaModifier; +#if 0 + if (s & qt_mode_switch_mask) + ret |= Qt::GroupSwitchModifier; +#endif + return ret; +} + +void QTestLiteWindowSurface::handleMouseEvent(QEvent::Type type, void *ev) +{ + static QPoint mousePoint; + + XButtonEvent *e = static_cast(ev); + + Qt::MouseButton button = Qt::NoButton; + Qt::MouseButtons buttons = translateMouseButtons(e->state); + Qt::KeyboardModifiers modifiers = translateModifiers(e->state); + if (type != QEvent::MouseMove) { + switch (e->button) { + case Button1: button = Qt::LeftButton; break; + case Button2: button = Qt::MidButton; break; + case Button3: button = Qt::RightButton; break; + default: break; + } + } + + if (type == QEvent::MouseButtonPress && mousePoint != QPoint(e->x_root, e->y_root)) { + //we've missed a mouse move event somewhere (maybe because we + //haven't implemented mouse tracking yet); let's synthesize it. + QMouseEvent me(QEvent::MouseMove, QPoint(e->x, e->y), QPoint(e->x_root, e->y_root), + Qt::NoButton, buttons, modifiers); + QApplicationPrivate::handleMouseEvent(window(), me); + } + + buttons ^= button; // X event uses state *before*, Qt uses state *after* + + QMouseEvent me(type, QPoint(e->x, e->y), QPoint(e->x_root, e->y_root), button, buttons, modifiers); + QApplicationPrivate::handleMouseEvent(window(), me); + mousePoint = QPoint(e->x_root, e->y_root); +} + +void QTestLiteWindowSurface::handleGeometryChange(int x, int y, int w, int h) +{ + QApplicationPrivate::handleGeometryChange(window(), QRect(x,y,w,h)); +} + + + + + + + + + + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Key event stuff -- not pretty either +// +// What we want to do is to port Robert's keytable code properly + + + + + + + +// keyboard mapping table +static const unsigned int keyTbl[] = { + + // misc keys + + XK_Escape, Qt::Key_Escape, + XK_Tab, Qt::Key_Tab, + XK_ISO_Left_Tab, Qt::Key_Backtab, + XK_BackSpace, Qt::Key_Backspace, + XK_Return, Qt::Key_Return, + XK_Insert, Qt::Key_Insert, + XK_Delete, Qt::Key_Delete, + XK_Clear, Qt::Key_Delete, + XK_Pause, Qt::Key_Pause, + XK_Print, Qt::Key_Print, + 0x1005FF60, Qt::Key_SysReq, // hardcoded Sun SysReq + 0x1007ff00, Qt::Key_SysReq, // hardcoded X386 SysReq + + // cursor movement + + XK_Home, Qt::Key_Home, + XK_End, Qt::Key_End, + XK_Left, Qt::Key_Left, + XK_Up, Qt::Key_Up, + XK_Right, Qt::Key_Right, + XK_Down, Qt::Key_Down, + XK_Prior, Qt::Key_PageUp, + XK_Next, Qt::Key_PageDown, + + // modifiers + + XK_Shift_L, Qt::Key_Shift, + XK_Shift_R, Qt::Key_Shift, + XK_Shift_Lock, Qt::Key_Shift, + XK_Control_L, Qt::Key_Control, + XK_Control_R, Qt::Key_Control, + XK_Meta_L, Qt::Key_Meta, + XK_Meta_R, Qt::Key_Meta, + XK_Alt_L, Qt::Key_Alt, + XK_Alt_R, Qt::Key_Alt, + XK_Caps_Lock, Qt::Key_CapsLock, + XK_Num_Lock, Qt::Key_NumLock, + XK_Scroll_Lock, Qt::Key_ScrollLock, + XK_Super_L, Qt::Key_Super_L, + XK_Super_R, Qt::Key_Super_R, + XK_Menu, Qt::Key_Menu, + XK_Hyper_L, Qt::Key_Hyper_L, + XK_Hyper_R, Qt::Key_Hyper_R, + XK_Help, Qt::Key_Help, + 0x1000FF74, Qt::Key_Backtab, // hardcoded HP backtab + 0x1005FF10, Qt::Key_F11, // hardcoded Sun F36 (labeled F11) + 0x1005FF11, Qt::Key_F12, // hardcoded Sun F37 (labeled F12) + + // numeric and function keypad keys + + XK_KP_Space, Qt::Key_Space, + XK_KP_Tab, Qt::Key_Tab, + XK_KP_Enter, Qt::Key_Enter, + //XK_KP_F1, Qt::Key_F1, + //XK_KP_F2, Qt::Key_F2, + //XK_KP_F3, Qt::Key_F3, + //XK_KP_F4, Qt::Key_F4, + XK_KP_Home, Qt::Key_Home, + XK_KP_Left, Qt::Key_Left, + XK_KP_Up, Qt::Key_Up, + XK_KP_Right, Qt::Key_Right, + XK_KP_Down, Qt::Key_Down, + XK_KP_Prior, Qt::Key_PageUp, + XK_KP_Next, Qt::Key_PageDown, + XK_KP_End, Qt::Key_End, + XK_KP_Begin, Qt::Key_Clear, + XK_KP_Insert, Qt::Key_Insert, + XK_KP_Delete, Qt::Key_Delete, + XK_KP_Equal, Qt::Key_Equal, + XK_KP_Multiply, Qt::Key_Asterisk, + XK_KP_Add, Qt::Key_Plus, + XK_KP_Separator, Qt::Key_Comma, + XK_KP_Subtract, Qt::Key_Minus, + XK_KP_Decimal, Qt::Key_Period, + XK_KP_Divide, Qt::Key_Slash, + + // International input method support keys + + // International & multi-key character composition + XK_ISO_Level3_Shift, Qt::Key_AltGr, + XK_Multi_key, Qt::Key_Multi_key, + XK_Codeinput, Qt::Key_Codeinput, + XK_SingleCandidate, Qt::Key_SingleCandidate, + XK_MultipleCandidate, Qt::Key_MultipleCandidate, + XK_PreviousCandidate, Qt::Key_PreviousCandidate, + + // Misc Functions + XK_Mode_switch, Qt::Key_Mode_switch, + XK_script_switch, Qt::Key_Mode_switch, + + // Japanese keyboard support + XK_Kanji, Qt::Key_Kanji, + XK_Muhenkan, Qt::Key_Muhenkan, + //XK_Henkan_Mode, Qt::Key_Henkan_Mode, + XK_Henkan_Mode, Qt::Key_Henkan, + XK_Henkan, Qt::Key_Henkan, + XK_Romaji, Qt::Key_Romaji, + XK_Hiragana, Qt::Key_Hiragana, + XK_Katakana, Qt::Key_Katakana, + XK_Hiragana_Katakana, Qt::Key_Hiragana_Katakana, + XK_Zenkaku, Qt::Key_Zenkaku, + XK_Hankaku, Qt::Key_Hankaku, + XK_Zenkaku_Hankaku, Qt::Key_Zenkaku_Hankaku, + XK_Touroku, Qt::Key_Touroku, + XK_Massyo, Qt::Key_Massyo, + XK_Kana_Lock, Qt::Key_Kana_Lock, + XK_Kana_Shift, Qt::Key_Kana_Shift, + XK_Eisu_Shift, Qt::Key_Eisu_Shift, + XK_Eisu_toggle, Qt::Key_Eisu_toggle, + //XK_Kanji_Bangou, Qt::Key_Kanji_Bangou, + //XK_Zen_Koho, Qt::Key_Zen_Koho, + //XK_Mae_Koho, Qt::Key_Mae_Koho, + XK_Kanji_Bangou, Qt::Key_Codeinput, + XK_Zen_Koho, Qt::Key_MultipleCandidate, + XK_Mae_Koho, Qt::Key_PreviousCandidate, + +#ifdef XK_KOREAN + // Korean keyboard support + XK_Hangul, Qt::Key_Hangul, + XK_Hangul_Start, Qt::Key_Hangul_Start, + XK_Hangul_End, Qt::Key_Hangul_End, + XK_Hangul_Hanja, Qt::Key_Hangul_Hanja, + XK_Hangul_Jamo, Qt::Key_Hangul_Jamo, + XK_Hangul_Romaja, Qt::Key_Hangul_Romaja, + //XK_Hangul_Codeinput, Qt::Key_Hangul_Codeinput, + XK_Hangul_Codeinput, Qt::Key_Codeinput, + XK_Hangul_Jeonja, Qt::Key_Hangul_Jeonja, + XK_Hangul_Banja, Qt::Key_Hangul_Banja, + XK_Hangul_PreHanja, Qt::Key_Hangul_PreHanja, + XK_Hangul_PostHanja, Qt::Key_Hangul_PostHanja, + //XK_Hangul_SingleCandidate,Qt::Key_Hangul_SingleCandidate, + //XK_Hangul_MultipleCandidate,Qt::Key_Hangul_MultipleCandidate, + //XK_Hangul_PreviousCandidate,Qt::Key_Hangul_PreviousCandidate, + XK_Hangul_SingleCandidate, Qt::Key_SingleCandidate, + XK_Hangul_MultipleCandidate,Qt::Key_MultipleCandidate, + XK_Hangul_PreviousCandidate,Qt::Key_PreviousCandidate, + XK_Hangul_Special, Qt::Key_Hangul_Special, + //XK_Hangul_switch, Qt::Key_Hangul_switch, + XK_Hangul_switch, Qt::Key_Mode_switch, +#endif // XK_KOREAN + + // dead keys + XK_dead_grave, Qt::Key_Dead_Grave, + XK_dead_acute, Qt::Key_Dead_Acute, + XK_dead_circumflex, Qt::Key_Dead_Circumflex, + XK_dead_tilde, Qt::Key_Dead_Tilde, + XK_dead_macron, Qt::Key_Dead_Macron, + XK_dead_breve, Qt::Key_Dead_Breve, + XK_dead_abovedot, Qt::Key_Dead_Abovedot, + XK_dead_diaeresis, Qt::Key_Dead_Diaeresis, + XK_dead_abovering, Qt::Key_Dead_Abovering, + XK_dead_doubleacute, Qt::Key_Dead_Doubleacute, + XK_dead_caron, Qt::Key_Dead_Caron, + XK_dead_cedilla, Qt::Key_Dead_Cedilla, + XK_dead_ogonek, Qt::Key_Dead_Ogonek, + XK_dead_iota, Qt::Key_Dead_Iota, + XK_dead_voiced_sound, Qt::Key_Dead_Voiced_Sound, + XK_dead_semivoiced_sound, Qt::Key_Dead_Semivoiced_Sound, + XK_dead_belowdot, Qt::Key_Dead_Belowdot, + XK_dead_hook, Qt::Key_Dead_Hook, + XK_dead_horn, Qt::Key_Dead_Horn, + +#if 0 + // Special multimedia keys + // currently only tested with MS internet keyboard + + // browsing keys + XF86XK_Back, Qt::Key_Back, + XF86XK_Forward, Qt::Key_Forward, + XF86XK_Stop, Qt::Key_Stop, + XF86XK_Refresh, Qt::Key_Refresh, + XF86XK_Favorites, Qt::Key_Favorites, + XF86XK_AudioMedia, Qt::Key_LaunchMedia, + XF86XK_OpenURL, Qt::Key_OpenUrl, + XF86XK_HomePage, Qt::Key_HomePage, + XF86XK_Search, Qt::Key_Search, + + // media keys + XF86XK_AudioLowerVolume, Qt::Key_VolumeDown, + XF86XK_AudioMute, Qt::Key_VolumeMute, + XF86XK_AudioRaiseVolume, Qt::Key_VolumeUp, + XF86XK_AudioPlay, Qt::Key_MediaPlay, + XF86XK_AudioStop, Qt::Key_MediaStop, + XF86XK_AudioPrev, Qt::Key_MediaPrevious, + XF86XK_AudioNext, Qt::Key_MediaNext, + XF86XK_AudioRecord, Qt::Key_MediaRecord, + + // launch keys + XF86XK_Mail, Qt::Key_LaunchMail, + XF86XK_MyComputer, Qt::Key_Launch0, + XF86XK_Calculator, Qt::Key_Launch1, + XF86XK_Standby, Qt::Key_Standby, + + XF86XK_Launch0, Qt::Key_Launch2, + XF86XK_Launch1, Qt::Key_Launch3, + XF86XK_Launch2, Qt::Key_Launch4, + XF86XK_Launch3, Qt::Key_Launch5, + XF86XK_Launch4, Qt::Key_Launch6, + XF86XK_Launch5, Qt::Key_Launch7, + XF86XK_Launch6, Qt::Key_Launch8, + XF86XK_Launch7, Qt::Key_Launch9, + XF86XK_Launch8, Qt::Key_LaunchA, + XF86XK_Launch9, Qt::Key_LaunchB, + XF86XK_LaunchA, Qt::Key_LaunchC, + XF86XK_LaunchB, Qt::Key_LaunchD, + XF86XK_LaunchC, Qt::Key_LaunchE, + XF86XK_LaunchD, Qt::Key_LaunchF, +#endif + +#if 0 + // Qtopia keys + QTOPIAXK_Select, Qt::Key_Select, + QTOPIAXK_Yes, Qt::Key_Yes, + QTOPIAXK_No, Qt::Key_No, + QTOPIAXK_Cancel, Qt::Key_Cancel, + QTOPIAXK_Printer, Qt::Key_Printer, + QTOPIAXK_Execute, Qt::Key_Execute, + QTOPIAXK_Sleep, Qt::Key_Sleep, + QTOPIAXK_Play, Qt::Key_Play, + QTOPIAXK_Zoom, Qt::Key_Zoom, + QTOPIAXK_Context1, Qt::Key_Context1, + QTOPIAXK_Context2, Qt::Key_Context2, + QTOPIAXK_Context3, Qt::Key_Context3, + QTOPIAXK_Context4, Qt::Key_Context4, + QTOPIAXK_Call, Qt::Key_Call, + QTOPIAXK_Hangup, Qt::Key_Hangup, + QTOPIAXK_Flip, Qt::Key_Flip, +#endif + 0, 0 +}; + + +static int lookupCode(unsigned int xkeycode) +{ + const unsigned int *p = keyTbl; + while (*p) { + if (*p == xkeycode) + return *++p; + p += 2; + } + + return 0; +} + + +void QTestLiteWindowSurface::handleKeyEvent(QEvent::Type type, void *ev) +{ + XKeyEvent *e = static_cast(ev); + + KeySym keySym; + QByteArray chars; + chars.resize(513); + + int count = XLookupString(e, chars.data(), chars.size(), &keySym, 0); + +// qDebug() << "QTLWS::handleKeyEvent" << count << hex << "XKeysym:" << keySym; +// if (count) +// qDebug() << hex << int(chars[0]) << "String:" << chars; + + Qt::KeyboardModifiers modifiers = translateModifiers(e->state); + + int qtcode = lookupCode(keySym); +// qDebug() << "lookup: " << hex << keySym << qtcode; + + if (qtcode) { + QKeyEvent keyEvent(type, qtcode, modifiers); + QApplicationPrivate::handleKeyEvent(window(), &keyEvent); + } else if (chars[0]) { + int qtcode = chars.toUpper()[0]; //Not exactly right... + QKeyEvent keyEvent(type, qtcode, modifiers, QString::fromLatin1(chars)); + QApplicationPrivate::handleKeyEvent(window(), &keyEvent); + } else { + qWarning() << "unknown X keycode" << hex << e->keycode << keySym; + } +} + + + +Qt::WindowFlags QTestLiteWindowSurface::setWindowFlags(Qt::WindowFlags flags) +{ + Q_ASSERT(flags & Qt::Window); + + window_flags = flags; + + xw->setWindowFlags(flags); + + return window_flags; + +} + +Qt::WindowFlags QTestLiteWindowSurface::windowFlags() const +{ + return window_flags; +} + +void QTestLiteWindowSurface::setVisible(bool visible) +{ + //qDebug() << "QTestLiteWindowSurface::setVisible" << visible << xw->window; + xw->setVisible(visible); +} + + +QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h new file mode 100644 index 0000000..33b55e9 --- /dev/null +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSURFACE_TESTLITE_H +#define QWINDOWSURFACE_TESTLITE_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class MyWindow; +class QTestLiteGraphicsSystem; +class QTestLiteGraphicsSystemScreen; + +class QTestLiteWindowSurface : public QWindowSurface +{ +public: + QTestLiteWindowSurface + (QTestLiteGraphicsSystem *graphicsSystem, + QTestLiteGraphicsSystemScreen *screen, QWidget *window); + ~QTestLiteWindowSurface(); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void setGeometry(const QRect &rect); + bool scroll(const QRegion &area, int dx, int dy); + + void beginPaint(const QRegion ®ion); + void endPaint(const QRegion ®ion); + + void handleMouseEvent(QEvent::Type, void *); //forwarding X types is apparently impossible :( + void handleKeyEvent(QEvent::Type, void *); + void handleGeometryChange(int x, int y, int w, int h); + + + Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); + Qt::WindowFlags windowFlags() const; + void setVisible(bool visible); + +private: + QTestLiteGraphicsSystem *mGraphicsSystem; + QTestLiteGraphicsSystemScreen *mScreen; + Qt::WindowFlags window_flags; + MyWindow *xw; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/graphicssystems/testlite/testlite.pro b/src/plugins/graphicssystems/testlite/testlite.pro new file mode 100644 index 0000000..af8a437 --- /dev/null +++ b/src/plugins/graphicssystems/testlite/testlite.pro @@ -0,0 +1,17 @@ +TARGET = qtestlitegraphicssystem +include(../../qpluginbase.pri) + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems + +SOURCES = main.cpp qgraphicssystem_testlite.cpp qwindowsurface_testlite.cpp +HEADERS = qgraphicssystem_testlite.h qwindowsurface_testlite.h + + +HEADERS += x11util.h +SOURCES += x11util.cpp + +LIBS += -lX11 + + +target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +INSTALLS += target diff --git a/src/plugins/graphicssystems/testlite/x11util.cpp b/src/plugins/graphicssystems/testlite/x11util.cpp new file mode 100644 index 0000000..f77356a --- /dev/null +++ b/src/plugins/graphicssystems/testlite/x11util.cpp @@ -0,0 +1,684 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include +#include + +#include "x11util.h" +#include "qwindowsurface_testlite.h" + +#include +#include + + +#include + + + +//### remove stuff we don't want from qt_x11_p.h +#undef ATOM +#undef X11 + + + + + +static int (*original_x_errhandler)(Display *dpy, XErrorEvent *); +static bool seen_badwindow; + + +//### copied from qapplication_x11.cpp + +static int qt_x_errhandler(Display *dpy, XErrorEvent *err) +{ + +qDebug() << "qt_x_errhandler" << err->error_code; + + switch (err->error_code) { + case BadAtom: +#if 0 + if (err->request_code == 20 /* X_GetProperty */ + && (err->resourceid == XA_RESOURCE_MANAGER + || err->resourceid == XA_RGB_DEFAULT_MAP + || err->resourceid == ATOM(_NET_SUPPORTED) + || err->resourceid == ATOM(_NET_SUPPORTING_WM_CHECK) + || err->resourceid == ATOM(KDE_FULL_SESSION) + || err->resourceid == ATOM(KWIN_RUNNING) + || err->resourceid == ATOM(XdndProxy) + || err->resourceid == ATOM(XdndAware)) + + + ) { + // Perhaps we're running under SECURITY reduction? :/ + return 0; + } +#endif + qDebug() << "BadAtom"; + break; + + case BadWindow: + if (err->request_code == 2 /* X_ChangeWindowAttributes */ + || err->request_code == 38 /* X_QueryPointer */) { + for (int i = 0; i < ScreenCount(dpy); ++i) { + if (err->resourceid == RootWindow(dpy, i)) { + // Perhaps we're running under SECURITY reduction? :/ + return 0; + } + } + } + seen_badwindow = true; + if (err->request_code == 25 /* X_SendEvent */) { + for (int i = 0; i < ScreenCount(dpy); ++i) { + if (err->resourceid == RootWindow(dpy, i)) { + // Perhaps we're running under SECURITY reduction? :/ + return 0; + } + } +#if 0 + if (X11->xdndHandleBadwindow()) { + qDebug("xdndHandleBadwindow returned true"); + return 0; + } +#endif + } +#if 0 + if (X11->ignore_badwindow) + return 0; +#endif + break; + + case BadMatch: + if (err->request_code == 42 /* X_SetInputFocus */) + return 0; + break; + + default: +#if 0 //!defined(QT_NO_XINPUT) + if (err->request_code == X11->xinput_major + && err->error_code == (X11->xinput_errorbase + XI_BadDevice) + && err->minor_code == 3 /* X_OpenDevice */) { + return 0; + } +#endif + break; + } + + char errstr[256]; + XGetErrorText( dpy, err->error_code, errstr, 256 ); + char buffer[256]; + char request_str[256]; + qsnprintf(buffer, 256, "%d", err->request_code); + XGetErrorDatabaseText(dpy, "XRequest", buffer, "", request_str, 256); + if (err->request_code < 128) { + // X error for a normal protocol request + qWarning( "X Error: %s %d\n" + " Major opcode: %d (%s)\n" + " Resource id: 0x%lx", + errstr, err->error_code, + err->request_code, + request_str, + err->resourceid ); + } else { + // X error for an extension request + const char *extensionName = 0; +#if 0 + if (err->request_code == X11->xrender_major) + extensionName = "RENDER"; + else if (err->request_code == X11->xrandr_major) + extensionName = "RANDR"; + else if (err->request_code == X11->xinput_major) + extensionName = "XInputExtension"; + else if (err->request_code == X11->mitshm_major) + extensionName = "MIT-SHM"; +#endif + char minor_str[256]; + if (extensionName) { + qsnprintf(buffer, 256, "%s.%d", extensionName, err->minor_code); + XGetErrorDatabaseText(dpy, "XRequest", buffer, "", minor_str, 256); + } else { + extensionName = "Uknown extension"; + qsnprintf(minor_str, 256, "Unknown request"); + } + qWarning( "X Error: %s %d\n" + " Extension: %d (%s)\n" + " Minor opcode: %d (%s)\n" + " Resource id: 0x%lx", + errstr, err->error_code, + err->request_code, + extensionName, + err->minor_code, + minor_str, + err->resourceid ); + } + + // ### we really should distinguish between severe, non-severe and + // ### application specific errors + + return 0; +} + + + + + + + + + +bool MyDisplay::handleEvent(XEvent *xe) +{ + //qDebug() << "handleEvent" << xe->xany.type << xe->xany.window; + int quit = false; + MyWindow *xw = 0; + foreach (MyWindow *w, windowList) { + if (w->window == xe->xany.window) { + xw = w; + break; + } + } + if (!xw) { + qWarning() << "Unknown window" << xe->xany.window << "received event" << hex << xe->type; + return quit; + } + + switch (xe->type) { + case Expose: + if (xw) + if (xe->xexpose.count == 0) + xw->paintEvent(); + break; + case ConfigureNotify: + if (xw) + xw->resizeEvent(&xe->xconfigure); + break; +#if 1 + + case ButtonPress: + xw->mousePressEvent(&xe->xbutton); + break; + + case ButtonRelease: + xw->mouseReleaseEvent(&xe->xbutton); + break; + + case MotionNotify: + xw->mouseMoveEvent(&xe->xbutton); + break; + + case XKeyPress: + xw->keyPressEvent(&xe->xkey); + break; + + case XKeyRelease: + xw->keyReleaseEvent(&xe->xkey); + break; +#endif + + default: + qDebug() << "Other X event" << hex << xe->type; + break; + } + return quit; +}; + + +MyDisplay::MyDisplay() +{ + char *display_name = getenv("DISPLAY"); + display = XOpenDisplay(display_name); + if (!display) { + fprintf(stderr, "Cannot connect to X server: %s\n", + display_name); + exit(1); + } + + original_x_errhandler = XSetErrorHandler(qt_x_errhandler); + + if (qgetenv("DO_X_SYNCHRONIZE").toInt()) + XSynchronize(display, true); + + + screen = DefaultScreen(display); + width = DisplayWidth(display, screen); + height = DisplayHeight(display, screen); + physicalWidth = DisplayWidthMM(display, screen); + physicalHeight = DisplayHeightMM(display, screen); + + int xSocketNumber = XConnectionNumber(display); + qDebug() << "X socket:"<< xSocketNumber; + + QSocketNotifier *sock = new QSocketNotifier(xSocketNumber, QSocketNotifier::Read, this); + connect(sock, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); +} + + +MyDisplay::~MyDisplay() +{ + XCloseDisplay(display); +} + + +void MyDisplay::eventDispatcher() +{ +// qDebug() << "eventDispatcher"; + + + ulong marker = XNextRequest(display); +// int i = 0; + while (XPending(display)) { + XEvent event; + XNextEvent(display, &event); + /* done = */ + handleEvent(&event); + + if (event.xany.serial >= marker) { + qDebug() << "potential livelock averted"; +#if 0 + if (XEventsQueued(display, QueuedAfterFlush)) { + qDebug() << " with events queued"; + QTimer::singleShot(0, this, SLOT(eventDispatcher())); + } +#endif + break; + } + } +} + + +MyWindow::MyWindow(MyDisplay *display, int x, int y, int w, int h) +{ + xd = display; + + xd->windowList.append(this); + + qDebug() << "MyWindow::MyWindow"; + + window = XCreateSimpleWindow(xd->display, xd->rootWindow(), + x, y, w, h, 0 /*border_width*/, + xd->blackPixel(), xd->whitePixel()); + + width = -1; + height = -1; + xpos = -1; + ypos = -1; + + XSetWindowBackgroundPixmap(xd->display, window, XNone); + + XSelectInput(xd->display, window, ExposureMask | KeyPressMask | KeyReleaseMask | + ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | StructureNotifyMask); + + gc = createGC(); +} + +MyWindow::~MyWindow() +{ + XFreeGC(xd->display, gc); + XDestroyWindow(xd->display, window); + + xd->windowList.removeAll(this); +} + +GC MyWindow::createGC() +{ + GC gc; + + gc = XCreateGC(xd->display, window, 0, 0); + if (gc < 0) { + qWarning("MyWindow::createGC() could not create GC"); + } + return gc; +} + + + +void MyWindow::paintEvent() +{ + Visual *visual = DefaultVisual(xd->display, xd->screen); + + if (!img.isNull()) { + QImage image = img.convertToFormat(QImage::Format_RGB32); + XImage *xi = XCreateImage(xd->display, visual, 24, ZPixmap, + 0, (char *) image.scanLine(0), image.width(), image.height(), + 32, image.bytesPerLine()); + + int x = 0; + int y = 0; + + /*int r =*/ XPutImage(xd->display, window, gc, xi, 0, 0, x, y, image.width(), image.height()); + + xi->data = 0; // QImage owns these bits + XDestroyImage(xi); + } +} + +void MyWindow::resizeEvent(XConfigureEvent *e) +{ + + if ((e->width != width || e->height != height) && e->x == 0 && e->y == 0) { + //qDebug() << "resize with bogus pos" << e->x << e->y << e->width << e->height << "window"<< hex << window; + } else { + //qDebug() << "geometry change" << e->x << e->y << e->width << e->height << "window"<< hex << window; + xpos = e->x; + ypos = e->y; + } + width = e->width; + height = e->height; + + windowSurface->handleGeometryChange(xpos, ypos, width, height); +} + + +void MyWindow::setSize(int w, int h) +{ + XResizeWindow(xd->display, window, w, h); +} + +void MyWindow::setGeometry(int x, int y, int w, int h) +{ + XMoveResizeWindow(xd->display, window, x, y, w, h); +} + + +void MyWindow::mousePressEvent(XButtonEvent *e) +{ + windowSurface->handleMouseEvent(QEvent::MouseButtonPress, e); +} + +void MyWindow::mouseReleaseEvent(XButtonEvent *e) +{ + windowSurface->handleMouseEvent(QEvent::MouseButtonRelease, e); +} + +void MyWindow::mouseMoveEvent(XButtonEvent *e) +{ + windowSurface->handleMouseEvent(QEvent::MouseMove, e); +} + +#ifdef KeyPress +#undef KeyPress +#endif + +void MyWindow::keyPressEvent(XKeyEvent *e) +{ + windowSurface->handleKeyEvent(QEvent::KeyPress, e); +} + +#ifdef KeyRelease +#undef KeyRelease +#endif + +void MyWindow::keyReleaseEvent(XKeyEvent *e) +{ + windowSurface->handleKeyEvent(QEvent::KeyRelease, e); +} + + +// WindowFlag stuff, lots of copied code from qwidget_x11.cpp... + +//We're hacking here... + + +// MWM support +struct QtMWMHints { + ulong flags, functions, decorations; + long input_mode; + ulong status; +}; + +enum { + MWM_HINTS_FUNCTIONS = (1L << 0), + + MWM_FUNC_ALL = (1L << 0), + MWM_FUNC_RESIZE = (1L << 1), + MWM_FUNC_MOVE = (1L << 2), + MWM_FUNC_MINIMIZE = (1L << 3), + MWM_FUNC_MAXIMIZE = (1L << 4), + MWM_FUNC_CLOSE = (1L << 5), + + MWM_HINTS_DECORATIONS = (1L << 1), + + MWM_DECOR_ALL = (1L << 0), + MWM_DECOR_BORDER = (1L << 1), + MWM_DECOR_RESIZEH = (1L << 2), + MWM_DECOR_TITLE = (1L << 3), + MWM_DECOR_MENU = (1L << 4), + MWM_DECOR_MINIMIZE = (1L << 5), + MWM_DECOR_MAXIMIZE = (1L << 6), + + MWM_HINTS_INPUT_MODE = (1L << 2), + + MWM_INPUT_MODELESS = 0L, + MWM_INPUT_PRIMARY_APPLICATION_MODAL = 1L, + MWM_INPUT_FULL_APPLICATION_MODAL = 3L +}; + +static Atom mwm_hint_atom = XNone; + +static QtMWMHints GetMWMHints(Display *display, Window window) +{ + QtMWMHints mwmhints; + + Atom type; + int format; + ulong nitems, bytesLeft; + uchar *data = 0; + if ((XGetWindowProperty(display, window, mwm_hint_atom, 0, 5, false, + mwm_hint_atom, &type, &format, &nitems, &bytesLeft, + &data) == Success) + && (type == mwm_hint_atom + && format == 32 + && nitems >= 5)) { + mwmhints = *(reinterpret_cast(data)); + } else { + mwmhints.flags = 0L; + mwmhints.functions = MWM_FUNC_ALL; + mwmhints.decorations = MWM_DECOR_ALL; + mwmhints.input_mode = 0L; + mwmhints.status = 0L; + } + + if (data) + XFree(data); + + return mwmhints; +} + +static void SetMWMHints(Display *display, Window window, const QtMWMHints &mwmhints) +{ + if (mwmhints.flags != 0l) { + XChangeProperty(display, window, mwm_hint_atom, mwm_hint_atom, 32, + PropModeReplace, (unsigned char *) &mwmhints, 5); + } else { + XDeleteProperty(display, window, mwm_hint_atom); + } +} + +// Returns true if we should set WM_TRANSIENT_FOR on \a w +static inline bool isTransient(const QWidget *w) +{ + return ((w->windowType() == Qt::Dialog + || w->windowType() == Qt::Sheet + || w->windowType() == Qt::Tool + || w->windowType() == Qt::SplashScreen + || w->windowType() == Qt::ToolTip + || w->windowType() == Qt::Drawer + || w->windowType() == Qt::Popup) + && !w->testAttribute(Qt::WA_X11BypassTransientForHint)); +} + + + +Qt::WindowFlags MyWindow::setWindowFlags(Qt::WindowFlags flags) +{ + + if (mwm_hint_atom == XNone) { + mwm_hint_atom = XInternAtom(xd->display, "_MOTIF_WM_HINTS\0", False); + } + + qDebug() << "MyWindow::setWindowFlags" << hex << mwm_hint_atom << "flags" << flags; + + Qt::WindowType type = static_cast(int(flags & Qt::WindowType_Mask)); + + if (type == Qt::ToolTip) + flags |= Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint; + if (type == Qt::Popup) + flags |= Qt::X11BypassWindowManagerHint; + + bool topLevel = (flags & Qt::Window); + bool popup = (type == Qt::Popup); + bool dialog = (type == Qt::Dialog + || type == Qt::Sheet); + bool desktop = (type == Qt::Desktop); + bool tool = (type == Qt::Tool || type == Qt::SplashScreen + || type == Qt::ToolTip || type == Qt::Drawer); + + + XSetWindowAttributes wsa; + + QtMWMHints mwmhints; + mwmhints.flags = 0L; + mwmhints.functions = 0L; + mwmhints.decorations = 0; + mwmhints.input_mode = 0L; + mwmhints.status = 0L; + + + ulong wsa_mask = 0; + if (type != Qt::SplashScreen) { // && customize) { + mwmhints.flags |= MWM_HINTS_DECORATIONS; + + bool customize = flags & Qt::CustomizeWindowHint; + if (!(flags & Qt::FramelessWindowHint) && !(customize && !(flags & Qt::WindowTitleHint))) { + mwmhints.decorations |= MWM_DECOR_BORDER; + mwmhints.decorations |= MWM_DECOR_RESIZEH; + + if (flags & Qt::WindowTitleHint) + mwmhints.decorations |= MWM_DECOR_TITLE; + + if (flags & Qt::WindowSystemMenuHint) + mwmhints.decorations |= MWM_DECOR_MENU; + + if (flags & Qt::WindowMinimizeButtonHint) { + mwmhints.decorations |= MWM_DECOR_MINIMIZE; + mwmhints.functions |= MWM_FUNC_MINIMIZE; + } + + if (flags & Qt::WindowMaximizeButtonHint) { + mwmhints.decorations |= MWM_DECOR_MAXIMIZE; + mwmhints.functions |= MWM_FUNC_MAXIMIZE; + } + + if (flags & Qt::WindowCloseButtonHint) + mwmhints.functions |= MWM_FUNC_CLOSE; + } + } else { + // if type == Qt::SplashScreen + mwmhints.decorations = MWM_DECOR_ALL; + } + + if (tool) { + wsa.save_under = True; + wsa_mask |= CWSaveUnder; + } + + if (flags & Qt::X11BypassWindowManagerHint) { + wsa.override_redirect = True; + wsa_mask |= CWOverrideRedirect; + } +#if 0 + if (wsa_mask && initializeWindow) { + Q_ASSERT(id); + XChangeWindowAttributes(dpy, id, wsa_mask, &wsa); + } +#endif + if (mwmhints.functions != 0) { + mwmhints.flags |= MWM_HINTS_FUNCTIONS; + mwmhints.functions |= MWM_FUNC_MOVE | MWM_FUNC_RESIZE; + } else { + mwmhints.functions = MWM_FUNC_ALL; + } + + if (!(flags & Qt::FramelessWindowHint) + && flags & Qt::CustomizeWindowHint + && flags & Qt::WindowTitleHint + && !(flags & + (Qt::WindowMinimizeButtonHint + | Qt::WindowMaximizeButtonHint + | Qt::WindowCloseButtonHint))) { + // a special case - only the titlebar without any button + mwmhints.flags = MWM_HINTS_FUNCTIONS; + mwmhints.functions = MWM_FUNC_MOVE | MWM_FUNC_RESIZE; + mwmhints.decorations = 0; + } + + SetMWMHints(xd->display, window, mwmhints); + +//##### only if initializeWindow??? + + if (popup) { // popup widget + qDebug() << "Doing XChangeWindowAttributes for popup" << wsa.override_redirect; + // set EWMH window types + // setNetWmWindowTypes(); + + wsa.override_redirect = True; + wsa.save_under = True; + XChangeWindowAttributes(xd->display, window, CWOverrideRedirect | CWSaveUnder, + &wsa); + } else { + + qDebug() << "Doing XChangeWindowAttributes for non-popup"; + + } + + return flags; +} + +void MyWindow::setVisible(bool visible) +{ +// qDebug() << "MyWindow::setVisible" << visible << hex << window; + if (visible) + XMapWindow(xd->display, window); + else + XUnmapWindow(xd->display, window); +} diff --git a/src/plugins/graphicssystems/testlite/x11util.h b/src/plugins/graphicssystems/testlite/x11util.h new file mode 100644 index 0000000..3d813c0 --- /dev/null +++ b/src/plugins/graphicssystems/testlite/x11util.h @@ -0,0 +1,126 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MYX11UTIL_H +#define MYX11UTIL_H + +#include +#include + +#include + +#include +#include + + +class MyWindow; + +class MyDisplay : public QObject +{ + Q_OBJECT; +public: + MyDisplay(); + ~MyDisplay(); + + Window rootWindow() { return RootWindow(display, screen); } + unsigned long blackPixel() { return BlackPixel(display, screen); } + unsigned long whitePixel() { return WhitePixel(display, screen); } + + bool handleEvent(XEvent *xe); + +public slots: + void eventDispatcher(); + +public: //### + Display * display; + int screen; + int width, height; + int physicalWidth; + int physicalHeight; + + QList windowList; +}; + +class QTestLiteWindowSurface; //### abstract callback interface, anyone? + +class MyWindow : public QObject +{ + Q_OBJECT; +public: + MyWindow(MyDisplay *xd, int x, int y, int w, int h); + ~MyWindow(); + + + void mousePressEvent(XButtonEvent*); + void mouseReleaseEvent(XButtonEvent*); + void mouseMoveEvent(XButtonEvent*); + + void keyPressEvent(XKeyEvent*); + void keyReleaseEvent(XKeyEvent*); + + + void paintEvent(); + void resizeEvent(XConfigureEvent *configure_event); + void setSize(int w, int h); + void setGeometry(int x, int y, int w, int h); + + GC createGC(); + + Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); + void setVisible(bool visible); + +public: //### + + int xpos, ypos; + int width, height; + QImage img; + Window window; + MyDisplay *xd; + GC gc; + + QTestLiteWindowSurface *windowSurface; +}; + + + + + +#endif // MYX11UTIL_H diff --git a/src/plugins/graphicssystems/vnc/main.cpp b/src/plugins/graphicssystems/vnc/main.cpp new file mode 100644 index 0000000..7deb91a --- /dev/null +++ b/src/plugins/graphicssystems/vnc/main.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qgraphicssystem_vnc.h" +#include + +QT_BEGIN_NAMESPACE + +class QVNCGraphicsSystemPlugin : public QGraphicsSystemPlugin +{ +public: + QStringList keys() const; + QGraphicsSystem *create(const QString&); +}; + +QStringList QVNCGraphicsSystemPlugin::keys() const +{ + QStringList list; + list << "VNC"; + return list; +} + +QGraphicsSystem* QVNCGraphicsSystemPlugin::create(const QString& system) +{ + if (system.toLower() == "vnc") + return new QVNCGraphicsSystem; + + return 0; +} + +Q_EXPORT_PLUGIN2(vnc, QVNCGraphicsSystemPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp new file mode 100644 index 0000000..4890e09 --- /dev/null +++ b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgraphicssystem_vnc.h" +#include "qwindowsurface_vnc.h" +#include +#include + +#include + + + + +QVNCGraphicsSystemScreen::QVNCGraphicsSystemScreen() + : mDepth(16), mFormat(QImage::Format_RGB16), mScreenImage(0) +{ + mGeometry = QRect(0,0,800, 600); + + mDepth = 32; + mFormat = QImage::Format_RGB32; + mPhysicalSize = (mGeometry.size()*254)/720; + + + mScreenImage = new QImage(mGeometry.size(), mFormat); + d_ptr = new QVNCGraphicsSystemScreenPrivate(this); +} + + +QVNCGraphicsSystemScreen::~QVNCGraphicsSystemScreen() +{ + delete mScreenImage; +} + +QVNCDirtyMap *QVNCGraphicsSystemScreen::dirtyMap() +{ + return d_ptr->dirty; +} + + +void QVNCGraphicsSystemScreen::setDirty(const QRect &rect) +{ + d_ptr->setDirty(rect); +} + + +QVNCGraphicsSystem::QVNCGraphicsSystem() +{ +//////// xd = new MyDisplay; + + mPrimaryScreen = new QVNCGraphicsSystemScreen(); + + + int dw = mPrimaryScreen->geometry().width(); + int dh = mPrimaryScreen->geometry().height(); + + + mScreens.append(mPrimaryScreen); +} + +QPixmapData *QVNCGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const +{ + return new QRasterPixmapData(type); +} + +QWindowSurface *QVNCGraphicsSystem::createWindowSurface(QWidget *widget) const +{ + if (widget->windowType() == Qt::Desktop) + return 0; // Don't create an explicit window surface for the destkop. + return new QVNCWindowSurface + (const_cast(this), mPrimaryScreen, widget); +} diff --git a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h new file mode 100644 index 0000000..d9b4375 --- /dev/null +++ b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_VNC_H +#define QGRAPHICSSYSTEM_VNC_H + +#include + +QT_BEGIN_NAMESPACE + +class QVNCServer; +class QVNCDirtyMap; + + +class QVNCGraphicsSystemScreenPrivate; + +class QVNCGraphicsSystemScreen : public QGraphicsSystemScreen +{ +public: + QVNCGraphicsSystemScreen(); + ~QVNCGraphicsSystemScreen(); + + QRect geometry() const { return mGeometry; } + int depth() const { return mDepth; } + QImage::Format format() const { return mFormat; } + QSize physicalSize() const { return mPhysicalSize; } + int linestep() const { return mScreenImage ? mScreenImage->bytesPerLine() : 0; } + uchar *base() const { return mScreenImage ? mScreenImage->bits() : 0; } + QVNCDirtyMap *dirtyMap(); + + void setDirty(const QRect &rect); + +public: + QRect mGeometry; + int mDepth; + QImage::Format mFormat; + QSize mPhysicalSize; + QImage *mScreenImage; + QVNCServer *server; + + QVNCGraphicsSystemScreenPrivate *d_ptr; +}; + +class QVNCGraphicsSystemPrivate; + + +class QVNCGraphicsSystem : public QGraphicsSystem +{ +public: + QVNCGraphicsSystem(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QWindowSurface *createWindowSurface(QWidget *widget) const; + + QList screens() const { return mScreens; } + +private: + QVNCGraphicsSystemScreen *mPrimaryScreen; + QList mScreens; +}; + + + +QT_END_NAMESPACE + +#endif //QGRAPHICSSYSTEM_VNC_H + diff --git a/src/plugins/graphicssystems/vnc/qvncserver.cpp b/src/plugins/graphicssystems/vnc/qvncserver.cpp new file mode 100644 index 0000000..c3677a0 --- /dev/null +++ b/src/plugins/graphicssystems/vnc/qvncserver.cpp @@ -0,0 +1,1912 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qvncserver.h" + +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include + +#include + + +#define QT_QWS_VNC_DEBUG +#define QT_NO_QWS_CURSOR //### + + +QT_BEGIN_NAMESPACE + + + +//copied from qscreen_qws.h +#ifndef QT_QWS_DEPTH16_RGB +#define QT_QWS_DEPTH16_RGB 565 +#endif +static const int qt_rbits = (QT_QWS_DEPTH16_RGB/100); +static const int qt_gbits = (QT_QWS_DEPTH16_RGB/10%10); +static const int qt_bbits = (QT_QWS_DEPTH16_RGB%10); +static const int qt_red_shift = qt_bbits+qt_gbits-(8-qt_rbits); +static const int qt_green_shift = qt_bbits-(8-qt_gbits); +static const int qt_neg_blue_shift = 8-qt_bbits; +static const int qt_blue_mask = (1<> qt_red_shift | r >> qt_red_rounding_shift; + const int tg = g >> qt_green_shift | g >> qt_green_rounding_shift; + const int tb = b << qt_neg_blue_shift | b >> qt_blue_rounding_shift; + + return qRgb(tr,tg,tb); +} + + + +//=========================================================================== + +static const struct { + int keysym; + int keycode; +} keyMap[] = { + { 0xff08, Qt::Key_Backspace }, + { 0xff09, Qt::Key_Tab }, + { 0xff0d, Qt::Key_Return }, + { 0xff1b, Qt::Key_Escape }, + { 0xff63, Qt::Key_Insert }, + { 0xffff, Qt::Key_Delete }, + { 0xff50, Qt::Key_Home }, + { 0xff57, Qt::Key_End }, + { 0xff55, Qt::Key_PageUp }, + { 0xff56, Qt::Key_PageDown }, + { 0xff51, Qt::Key_Left }, + { 0xff52, Qt::Key_Up }, + { 0xff53, Qt::Key_Right }, + { 0xff54, Qt::Key_Down }, + { 0xffbe, Qt::Key_F1 }, + { 0xffbf, Qt::Key_F2 }, + { 0xffc0, Qt::Key_F3 }, + { 0xffc1, Qt::Key_F4 }, + { 0xffc2, Qt::Key_F5 }, + { 0xffc3, Qt::Key_F6 }, + { 0xffc4, Qt::Key_F7 }, + { 0xffc5, Qt::Key_F8 }, + { 0xffc6, Qt::Key_F9 }, + { 0xffc7, Qt::Key_F10 }, + { 0xffc8, Qt::Key_F11 }, + { 0xffc9, Qt::Key_F12 }, + { 0xffe1, Qt::Key_Shift }, + { 0xffe2, Qt::Key_Shift }, + { 0xffe3, Qt::Key_Control }, + { 0xffe4, Qt::Key_Control }, + { 0xffe7, Qt::Key_Meta }, + { 0xffe8, Qt::Key_Meta }, + { 0xffe9, Qt::Key_Alt }, + { 0xffea, Qt::Key_Alt }, + { 0, 0 } +}; + +void QRfbRect::read(QTcpSocket *s) +{ + quint16 buf[4]; + s->read((char*)buf, 8); + x = ntohs(buf[0]); + y = ntohs(buf[1]); + w = ntohs(buf[2]); + h = ntohs(buf[3]); +} + +void QRfbRect::write(QTcpSocket *s) const +{ + quint16 buf[4]; + buf[0] = htons(x); + buf[1] = htons(y); + buf[2] = htons(w); + buf[3] = htons(h); + s->write((char*)buf, 8); +} + +void QRfbPixelFormat::read(QTcpSocket *s) +{ + char buf[16]; + s->read(buf, 16); + bitsPerPixel = buf[0]; + depth = buf[1]; + bigEndian = buf[2]; + trueColor = buf[3]; + + quint16 a = ntohs(*(quint16 *)(buf + 4)); + redBits = 0; + while (a) { a >>= 1; redBits++; } + + a = ntohs(*(quint16 *)(buf + 6)); + greenBits = 0; + while (a) { a >>= 1; greenBits++; } + + a = ntohs(*(quint16 *)(buf + 8)); + blueBits = 0; + while (a) { a >>= 1; blueBits++; } + + redShift = buf[10]; + greenShift = buf[11]; + blueShift = buf[12]; +} + +void QRfbPixelFormat::write(QTcpSocket *s) +{ + char buf[16]; + buf[0] = bitsPerPixel; + buf[1] = depth; + buf[2] = bigEndian; + buf[3] = trueColor; + + quint16 a = 0; + for (int i = 0; i < redBits; i++) a = (a << 1) | 1; + *(quint16 *)(buf + 4) = htons(a); + + a = 0; + for (int i = 0; i < greenBits; i++) a = (a << 1) | 1; + *(quint16 *)(buf + 6) = htons(a); + + a = 0; + for (int i = 0; i < blueBits; i++) a = (a << 1) | 1; + *(quint16 *)(buf + 8) = htons(a); + + buf[10] = redShift; + buf[11] = greenShift; + buf[12] = blueShift; + s->write(buf, 16); +} + + +void QRfbServerInit::setName(const char *n) +{ + delete[] name; + name = new char [strlen(n) + 1]; + strcpy(name, n); +} + +void QRfbServerInit::read(QTcpSocket *s) +{ + s->read((char *)&width, 2); + width = ntohs(width); + s->read((char *)&height, 2); + height = ntohs(height); + format.read(s); + + quint32 len; + s->read((char *)&len, 4); + len = ntohl(len); + + name = new char [len + 1]; + s->read(name, len); + name[len] = '\0'; +} + +void QRfbServerInit::write(QTcpSocket *s) +{ + quint16 t = htons(width); + s->write((char *)&t, 2); + t = htons(height); + s->write((char *)&t, 2); + format.write(s); + quint32 len = strlen(name); + len = htonl(len); + s->write((char *)&len, 4); + s->write(name, strlen(name)); +} + +bool QRfbSetEncodings::read(QTcpSocket *s) +{ + if (s->bytesAvailable() < 3) + return false; + + char tmp; + s->read(&tmp, 1); // padding + s->read((char *)&count, 2); + count = ntohs(count); + + return true; +} + +bool QRfbFrameBufferUpdateRequest::read(QTcpSocket *s) +{ + if (s->bytesAvailable() < 9) + return false; + + s->read(&incremental, 1); + rect.read(s); + + return true; +} + +bool QRfbKeyEvent::read(QTcpSocket *s) +{ + if (s->bytesAvailable() < 7) + return false; + + s->read(&down, 1); + quint16 tmp; + s->read((char *)&tmp, 2); // padding + + quint32 key; + s->read((char *)&key, 4); + key = ntohl(key); + + unicode = 0; + keycode = 0; + int i = 0; + while (keyMap[i].keysym && !keycode) { + if (keyMap[i].keysym == (int)key) + keycode = keyMap[i].keycode; + i++; + } + if (!keycode) { + if (key <= 0xff) { + unicode = key; + if (key >= 'a' && key <= 'z') + keycode = Qt::Key_A + key - 'a'; + else if (key >= ' ' && key <= '~') + keycode = Qt::Key_Space + key - ' '; + } + } + + return true; +} + +bool QRfbPointerEvent::read(QTcpSocket *s) +{ + if (s->bytesAvailable() < 5) + return false; + + char buttonMask; + s->read(&buttonMask, 1); + buttons = Qt::NoButton; + if (buttonMask & 1) + buttons |= Qt::LeftButton; + if (buttonMask & 2) + buttons |= Qt::MidButton; + if (buttonMask & 4) + buttons |= Qt::RightButton; + + quint16 tmp; + s->read((char *)&tmp, 2); + x = ntohs(tmp); + s->read((char *)&tmp, 2); + y = ntohs(tmp); + + return true; +} + +bool QRfbClientCutText::read(QTcpSocket *s) +{ + if (s->bytesAvailable() < 7) + return false; + + char tmp[3]; + s->read(tmp, 3); // padding + s->read((char *)&length, 4); + length = ntohl(length); + + return true; +} + +//=========================================================================== + +QVNCServer::QVNCServer(QVNCGraphicsSystemScreen *screen) + : qvnc_screen(screen) +{ + init(5900); +} + +QVNCServer::QVNCServer(QVNCGraphicsSystemScreen *screen, int id) + : qvnc_screen(screen) +{ + init(5900 + id); +} + +void QVNCServer::init(uint port) +{ + qDebug() << "QVNCServer::init" << port; + + handleMsg = false; + client = 0; + encodingsPending = 0; + cutTextPending = 0; + keymod = 0; + state = Unconnected; + dirtyCursor = false; + + refreshRate = 25; + timer = new QTimer(this); + timer->setSingleShot(true); + connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate())); + + serverSocket = new QTcpServer(this); + if (!serverSocket->listen(QHostAddress::Any, port)) + qDebug() << "QVNCServer could not connect:" << serverSocket->errorString(); + else + qDebug("QVNCServer created on port %d", port); + + connect(serverSocket, SIGNAL(newConnection()), this, SLOT(newConnection())); + +#ifndef QT_NO_QWS_CURSOR + qvnc_cursor = 0; +#endif + encoder = 0; +} + +QVNCServer::~QVNCServer() +{ + delete encoder; + encoder = 0; + delete client; + client = 0; +#ifndef QT_NO_QWS_CURSOR + delete qvnc_cursor; + qvnc_cursor = 0; +#endif +} + +void QVNCServer::setDirty() +{ + if (state == Connected && !timer->isActive() && + ((dirtyMap()->numDirty > 0) || dirtyCursor)) { + timer->start(); + } +} + +void QVNCServer::newConnection() +{ + if (client) + delete client; + + client = serverSocket->nextPendingConnection(); + connect(client,SIGNAL(readyRead()),this,SLOT(readClient())); + connect(client,SIGNAL(disconnected()),this,SLOT(discardClient())); + handleMsg = false; + encodingsPending = 0; + cutTextPending = 0; + supportHextile = false; + wantUpdate = false; + + timer->start(1000 / refreshRate); + dirtyMap()->reset(); + + // send protocol version + const char *proto = "RFB 003.003\n"; + client->write(proto, 12); + state = Protocol; + +// if (!qvnc_screen->screen()) +// QWSServer::instance()->enablePainting(true); +} + +void QVNCServer::readClient() +{ + switch (state) { + case Protocol: + if (client->bytesAvailable() >= 12) { + char proto[13]; + client->read(proto, 12); + proto[12] = '\0'; + qDebug("Client protocol version %s", proto); + // No authentication + quint32 auth = htonl(1); + client->write((char *) &auth, sizeof(auth)); + state = Init; + } + break; + + case Init: + if (client->bytesAvailable() >= 1) { + quint8 shared; + client->read((char *) &shared, 1); + + // Server Init msg + QRfbServerInit sim; + QRfbPixelFormat &format = sim.format; + switch (qvnc_screen->depth()) { + case 32: + format.bitsPerPixel = 32; + format.depth = 32; + format.bigEndian = 0; + format.trueColor = true; + format.redBits = 8; + format.greenBits = 8; + format.blueBits = 8; + format.redShift = 16; + format.greenShift = 8; + format.blueShift = 0; + break; + + case 24: + format.bitsPerPixel = 24; + format.depth = 24; + format.bigEndian = 0; + format.trueColor = true; + format.redBits = 8; + format.greenBits = 8; + format.blueBits = 8; + format.redShift = 16; + format.greenShift = 8; + format.blueShift = 0; + break; + + case 18: + format.bitsPerPixel = 24; + format.depth = 18; + format.bigEndian = 0; + format.trueColor = true; + format.redBits = 6; + format.greenBits = 6; + format.blueBits = 6; + format.redShift = 12; + format.greenShift = 6; + format.blueShift = 0; + break; + + case 16: + format.bitsPerPixel = 16; + format.depth = 16; + format.bigEndian = 0; + format.trueColor = true; + format.redBits = 5; + format.greenBits = 6; + format.blueBits = 5; + format.redShift = 11; + format.greenShift = 5; + format.blueShift = 0; + break; + + case 15: + format.bitsPerPixel = 16; + format.depth = 15; + format.bigEndian = 0; + format.trueColor = true; + format.redBits = 5; + format.greenBits = 5; + format.blueBits = 5; + format.redShift = 10; + format.greenShift = 5; + format.blueShift = 0; + break; + + case 12: + format.bitsPerPixel = 16; + format.depth = 12; + format.bigEndian = 0; + format.trueColor = true; + format.redBits = 4; + format.greenBits = 4; + format.blueBits = 4; + format.redShift = 8; + format.greenShift = 4; + format.blueShift = 0; + break; + + case 8: + case 4: + format.bitsPerPixel = 8; + format.depth = 8; + format.bigEndian = 0; + format.trueColor = false; + format.redBits = 0; + format.greenBits = 0; + format.blueBits = 0; + format.redShift = 0; + format.greenShift = 0; + format.blueShift = 0; + break; + + default: + qDebug("QVNC cannot drive depth %d", qvnc_screen->depth()); + discardClient(); + return; + } + sim.width = qvnc_screen->geometry().width(); + sim.height = qvnc_screen->geometry().height(); + sim.setName("Qt for Embedded Linux VNC Server"); + sim.write(client); + state = Connected; + } + break; + + case Connected: + do { + if (!handleMsg) { + client->read((char *)&msgType, 1); + handleMsg = true; + } + if (handleMsg) { + switch (msgType ) { + case SetPixelFormat: + setPixelFormat(); + break; + case FixColourMapEntries: + qDebug("Not supported: FixColourMapEntries"); + handleMsg = false; + break; + case SetEncodings: + setEncodings(); + break; + case FramebufferUpdateRequest: + frameBufferUpdateRequest(); + break; + case KeyEvent: + keyEvent(); + break; + case PointerEvent: + pointerEvent(); + break; + case ClientCutText: + clientCutText(); + break; + default: + qDebug("Unknown message type: %d", (int)msgType); + handleMsg = false; + } + } + } while (!handleMsg && client->bytesAvailable()); + break; + default: + break; + } +} + +#if 0//Q_BYTE_ORDER == Q_BIG_ENDIAN +bool QVNCGraphicsSystemScreen::swapBytes() const +{ + if (depth() != 16) + return false; + + if (screen()) + return screen()->frameBufferLittleEndian(); + return frameBufferLittleEndian(); +} +#endif + +void QVNCServer::setPixelFormat() +{ + if (client->bytesAvailable() >= 19) { + char buf[3]; + client->read(buf, 3); // just padding + pixelFormat.read(client); +#ifdef QT_QWS_VNC_DEBUG + qDebug("Want format: %d %d %d %d %d %d %d %d %d %d", + int(pixelFormat.bitsPerPixel), + int(pixelFormat.depth), + int(pixelFormat.bigEndian), + int(pixelFormat.trueColor), + int(pixelFormat.redBits), + int(pixelFormat.greenBits), + int(pixelFormat.blueBits), + int(pixelFormat.redShift), + int(pixelFormat.greenShift), + int(pixelFormat.blueShift)); +#endif + if (!pixelFormat.trueColor) { + qDebug("Can only handle true color clients"); + discardClient(); + } + handleMsg = false; + sameEndian = (QSysInfo::ByteOrder == QSysInfo::BigEndian) == !!pixelFormat.bigEndian; + needConversion = pixelConversionNeeded(); +#if Q_BYTE_ORDER == Q_BIG_ENDIAN + swapBytes = qvnc_screen->swapBytes(); +#endif + } +} + +void QVNCServer::setEncodings() +{ + QRfbSetEncodings enc; + + if (!encodingsPending && enc.read(client)) { + encodingsPending = enc.count; + if (!encodingsPending) + handleMsg = false; + } + + if (encoder) { + delete encoder; + encoder = 0; + } + + enum Encodings { + Raw = 0, + CopyRect = 1, + RRE = 2, + CoRRE = 4, + Hextile = 5, + ZRLE = 16, + Cursor = -239, + DesktopSize = -223 + }; + + if (encodingsPending && (unsigned)client->bytesAvailable() >= + encodingsPending * sizeof(quint32)) { + for (int i = 0; i < encodingsPending; ++i) { + qint32 enc; + client->read((char *)&enc, sizeof(qint32)); + enc = ntohl(enc); +#ifdef QT_QWS_VNC_DEBUG + qDebug("QVNCServer::setEncodings: %d", enc); +#endif + switch (enc) { + case Raw: + if (!encoder) { + encoder = new QRfbRawEncoder(this); +#ifdef QT_QWS_VNC_DEBUG + qDebug("QVNCServer::setEncodings: using raw"); +#endif + } + break; + case CopyRect: + supportCopyRect = true; + break; + case RRE: + supportRRE = true; + break; + case CoRRE: + supportCoRRE = true; + break; + case Hextile: + supportHextile = true; + if (encoder) + break; + switch (qvnc_screen->depth()) { +#ifdef QT_QWS_DEPTH_8 + case 8: + encoder = new QRfbHextileEncoder(this); + break; +#endif +#ifdef QT_QWS_DEPTH_12 + case 12: + encoder = new QRfbHextileEncoder(this); + break; +#endif +#ifdef QT_QWS_DEPTH_15 + case 15: + encoder = new QRfbHextileEncoder(this); + break; +#endif +#ifdef QT_QWS_DEPTH_16 + case 16: + encoder = new QRfbHextileEncoder(this); + break; +#endif +#ifdef QT_QWS_DEPTH_18 + case 18: + encoder = new QRfbHextileEncoder(this); + break; +#endif +#ifdef QT_QWS_DEPTH_24 + case 24: + encoder = new QRfbHextileEncoder(this); + break; +#endif +#ifdef QT_QWS_DEPTH_32 + case 32: + encoder = new QRfbHextileEncoder(this); + break; +#endif + default: + break; + } +#ifdef QT_QWS_VNC_DEBUG + qDebug("QVNCServer::setEncodings: using hextile"); +#endif + break; + case ZRLE: + supportZRLE = true; + break; + case Cursor: + supportCursor = true; +#ifndef QT_NO_QWS_CURSOR + if (!qvnc_screen->screen() || qt_screencursor->isAccelerated()) { + delete qvnc_cursor; + qvnc_cursor = new QVNCClientCursor(this); + } +#endif + break; + case DesktopSize: + supportDesktopSize = true; + break; + default: + break; + } + } + handleMsg = false; + encodingsPending = 0; + } + + if (!encoder) { + encoder = new QRfbRawEncoder(this); +#ifdef QT_QWS_VNC_DEBUG + qDebug("QVNCServer::setEncodings: fallback using raw"); +#endif + } +} + +void QVNCServer::frameBufferUpdateRequest() +{ + QRfbFrameBufferUpdateRequest ev; + + if (ev.read(client)) { + if (!ev.incremental) { + QRect r(ev.rect.x, ev.rect.y, ev.rect.w, ev.rect.h); +////### r.translate(qvnc_screen->offset()); + qvnc_screen->d_ptr->setDirty(r, true); + } + wantUpdate = true; + checkUpdate(); + handleMsg = false; + } +} + +static bool buttonChange(Qt::MouseButtons before, Qt::MouseButtons after, Qt::MouseButton *button, bool *isPress) +{ + if (before == after) + return false; + for (int b = Qt::LeftButton; b <= Qt::MidButton; b<<=1) { + if ((before & b) != (after & b)) { + *button = static_cast(b); + *isPress = (after & b); + return true; + } + } + return false; +} + +void QVNCServer::pointerEvent() +{ + QRfbPointerEvent ev; + if (ev.read(client)) { +// const QPoint offset = qvnc_screen->offset(); +// QWSServer::sendMouseEvent(offset + QPoint(ev.x, ev.y), ev.buttons); + + + //qDebug() << "pointerEvent" << ev.x << ev.y << hex << ev.buttons; + + QEvent::Type type = QEvent::MouseMove; + Qt::MouseButton button = Qt::NoButton; + bool isPress; + if (buttonChange(buttons, ev.buttons, &button, &isPress)) + type = isPress ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; + QMouseEvent me(type, QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), button, ev.buttons, keymod); + QApplicationPrivate::handleMouseEvent(0, me); + buttons = ev.buttons; + handleMsg = false; + } +} + +void QVNCServer::keyEvent() +{ + QRfbKeyEvent ev; + + if (ev.read(client)) { + if (ev.keycode == Qt::Key_Shift) + keymod = ev.down ? keymod | Qt::ShiftModifier : + keymod & ~Qt::ShiftModifier; + else if (ev.keycode == Qt::Key_Control) + keymod = ev.down ? keymod | Qt::ControlModifier : + keymod & ~Qt::ControlModifier; + else if (ev.keycode == Qt::Key_Alt) + keymod = ev.down ? keymod | Qt::AltModifier : + keymod & ~Qt::AltModifier; + if (ev.unicode || ev.keycode) { +// qDebug() << "keyEvent" << hex << ev.unicode << ev.keycode << keymod << ev.down; + QEvent::Type type = ev.down ? QEvent::KeyPress : QEvent::KeyRelease; + QString str; + if (ev.unicode && ev.unicode != 0xffff) + str = QString(ev.unicode); + QKeyEvent keyEvent(type, ev.keycode, keymod, str); + QApplicationPrivate::handleKeyEvent(0, &keyEvent); + } + handleMsg = false; + } +} + +void QVNCServer::clientCutText() +{ + QRfbClientCutText ev; + + if (ev.read(client)) { + cutTextPending = ev.length; + if (!cutTextPending) + handleMsg = false; + } + + if (cutTextPending && client->bytesAvailable() >= cutTextPending) { + char *text = new char [cutTextPending+1]; + client->read(text, cutTextPending); + delete [] text; + cutTextPending = 0; + handleMsg = false; + } +} + +// stride in bytes +template +bool QRfbSingleColorHextile::read(const uchar *data, + int width, int height, int stride) +{ + const int depth = encoder->server->screen()->depth(); + if (width % (depth / 8)) // hw: should rather fallback to simple loop + return false; + + static int alwaysFalse = qgetenv("QT_VNC_NOCHECKFILL").toInt(); + if (alwaysFalse) + return false; + + switch (depth) { + case 4: { + const quint8 *data8 = reinterpret_cast(data); + if ((data8[0] & 0xf) != (data8[0] >> 4)) + return false; + width /= 2; + } // fallthrough + case 8: { + const quint8 *data8 = reinterpret_cast(data); + if (data8[0] != data8[1]) + return false; + width /= 2; + } // fallthrough + case 12: + case 15: + case 16: { + const quint16 *data16 = reinterpret_cast(data); + if (data16[0] != data16[1]) + return false; + width /= 2; + } // fallthrough + case 18: + case 24: + case 32: { + const quint32 *data32 = reinterpret_cast(data); + const quint32 first = data32[0]; + const int linestep = (stride / sizeof(quint32)) - width; + for (int y = 0; y < height; ++y) { + for (int x = 0; x < width; ++x) { + if (*(data32++) != first) + return false; + } + data32 += linestep; + } + break; + } + default: + return false; + } + + SRC color = reinterpret_cast(data)[0]; + encoder->newBg |= (color != encoder->bg); + encoder->bg = color; + return true; +} + +template +void QRfbSingleColorHextile::write(QTcpSocket *socket) const +{ + if (true || encoder->newBg) { + const int bpp = encoder->server->clientBytesPerPixel(); + const int padding = 3; + QVarLengthArray buffer(padding + 1 + bpp); + buffer[padding] = 2; // BackgroundSpecified + encoder->server->convertPixels(buffer.data() + padding + 1, + reinterpret_cast(&encoder->bg), + 1); + socket->write(buffer.data() + padding, bpp + 1); +// encoder->newBg = false; + } else { + char subenc = 0; + socket->write(&subenc, 1); + } +} + +template +bool QRfbDualColorHextile::read(const uchar *data, + int width, int height, int stride) +{ + const SRC *ptr = reinterpret_cast(data); + const int linestep = (stride / sizeof(SRC)) - width; + + SRC c1; + SRC c2 = 0; + int n1 = 0; + int n2 = 0; + int x = 0; + int y = 0; + + c1 = *ptr; + + // find second color + while (y < height) { + while (x < width) { + if (*ptr == c1) { + ++n1; + } else { + c2 = *ptr; + goto found_second_color; + } + ++ptr; + ++x; + } + x = 0; + ptr += linestep; + ++y; + } + +found_second_color: + // finish counting + while (y < height) { + while (x < width) { + if (*ptr == c1) { + ++n1; + } else if (*ptr == c2) { + ++n2; + } else { + return false; + } + ++ptr; + ++x; + } + x = 0; + ptr += linestep; + ++y; + } + + if (n2 > n1) { + const quint32 tmpC = c1; + c1 = c2; + c2 = tmpC; + } + + encoder->newBg |= (c1 != encoder->bg); + encoder->newFg |= (c2 != encoder->fg); + + encoder->bg = c1; + encoder->fg = c2; + + // create map + bool inRect = false; + numRects = 0; + ptr = reinterpret_cast(data); + for (y = 0; y < height; ++y) { + for (x = 0; x < width; ++x) { + if (inRect && *ptr == encoder->bg) { + // rect finished + setWidth(x - lastx()); + next(); + inRect = false; + } else if (!inRect && *ptr == encoder->fg) { + // rect start + setX(x); + setY(y); + setHeight(1); + inRect = true; + } + ++ptr; + } + if (inRect) { + // finish rect + setWidth(width - lastx()); + next(); + inRect = false; + } + ptr += linestep; + } + + return true; +} + +template +void QRfbDualColorHextile::write(QTcpSocket *socket) const +{ + const int bpp = encoder->server->clientBytesPerPixel(); + const int padding = 3; + QVarLengthArray buffer(padding + 2 * bpp + sizeof(char) + sizeof(numRects)); + char &subenc = buffer[padding]; + int n = padding + sizeof(subenc); + + subenc = 0x8; // AnySubrects + + if (encoder->newBg) { + subenc |= 0x2; // Background + encoder->server->convertPixels(buffer.data() + n, (char*)&encoder->bg, 1); + n += bpp; +// encoder->newBg = false; + } + + if (encoder->newFg) { + subenc |= 0x4; // Foreground + encoder->server->convertPixels(buffer.data() + n, (char*)&encoder->fg, 1); + n += bpp; +// encoder->newFg = false; + } + buffer[n] = numRects; + n += sizeof(numRects); + + socket->write(buffer.data() + padding, n - padding); + socket->write((char*)rects, numRects * sizeof(Rect)); +} + +template +void QRfbDualColorHextile::next() +{ + for (int r = numRects - 1; r >= 0; --r) { + if (recty(r) == lasty()) + continue; + if (recty(r) < lasty() - 1) // only search previous scanline + break; + if (rectx(r) == lastx() && width(r) == width(numRects)) { + ++rects[r].wh; + return; + } + } + ++numRects; +} + +template +inline void QRfbMultiColorHextile::setColor(SRC color) +{ + encoder->server->convertPixels(reinterpret_cast(rect(numRects)), + (const char*)&color, 1); +} + +template +inline bool QRfbMultiColorHextile::beginRect() +{ + if ((rects.size() + bpp + 2) > maxRectsSize) + return false; + rects.resize(rects.size() + bpp + 2); + return true; +} + +template +inline void QRfbMultiColorHextile::endRect() +{ + setHeight(numRects, 1); + ++numRects; +} + +template +bool QRfbMultiColorHextile::read(const uchar *data, + int width, int height, int stride) +{ + const SRC *ptr = reinterpret_cast(data); + const int linestep = (stride / sizeof(SRC)) - width; + + bpp = encoder->server->clientBytesPerPixel(); + + if (encoder->newBg) + encoder->bg = ptr[0]; + + const SRC bg = encoder->bg; + SRC color = bg; + bool inRect = false; + + numRects = 0; + rects.clear(); + + for (int y = 0; y < height; ++y) { + for (int x = 0; x < width; ++x) { + if (inRect && *ptr != color) { // end rect + setWidth(numRects, x - rectx(numRects)); + endRect(); + inRect = false; + } + + if (!inRect && *ptr != bg) { // begin rect + if (!beginRect()) + return false; + inRect = true; + color = *ptr; + setColor(color); + setX(numRects, x); + setY(numRects, y); + } + ++ptr; + } + if (inRect) { // end rect + setWidth(numRects, width - rectx(numRects)); + endRect(); + inRect = false; + } + ptr += linestep; + } + + return true; +} + +template +void QRfbMultiColorHextile::write(QTcpSocket *socket) const +{ + const int padding = 3; + QVarLengthArray buffer(bpp + padding + sizeof(quint8) + sizeof(numRects)); + + quint8 &subenc = buffer[padding]; + int n = padding + sizeof(quint8); + + subenc = 8 | 16; // AnySubrects | SubrectsColoured + + if (encoder->newBg) { + subenc |= 0x2; // Background + encoder->server->convertPixels(reinterpret_cast(buffer.data() + n), + reinterpret_cast(&encoder->bg), + 1); + n += bpp; +// encoder->newBg = false; + } + + buffer[n] = numRects; + n += sizeof(numRects); + + socket->write(reinterpret_cast(buffer.data() + padding), + n - padding); + socket->write(reinterpret_cast(rects.constData()), + rects.size()); +} + +bool QVNCServer::pixelConversionNeeded() const +{ + if (!sameEndian) + return true; + +#if Q_BYTE_ORDER == Q_BIG_ENDIAN + if (qvnc_screen->swapBytes()) + return true; +#endif + + const int screendepth = qvnc_screen->depth(); + if (screendepth != pixelFormat.bitsPerPixel) + return true; + + switch (screendepth) { + case 32: + case 24: + return false; + case 18: + return (pixelFormat.redBits == 6 + && pixelFormat.greenBits == 6 + && pixelFormat.blueBits == 6); + case 16: + return (pixelFormat.redBits == 5 + && pixelFormat.greenBits == 6 + && pixelFormat.blueBits == 5); + case 15: + return (pixelFormat.redBits == 5 + && pixelFormat.greenBits == 5 + && pixelFormat.blueBits == 5); + case 12: + return (pixelFormat.redBits == 4 + && pixelFormat.greenBits == 4 + && pixelFormat.blueBits == 4); + } + return true; +} + +// count: number of pixels +void QVNCServer::convertPixels(char *dst, const char *src, int count) const +{ + const int screendepth = qvnc_screen->depth(); + const bool isBgr = false; //### qvnc_screen->pixelType() == QScreen::BGRPixel; + + // cutoffs +#if Q_BYTE_ORDER == Q_BIG_ENDIAN + if (!swapBytes) +#endif + if (sameEndian) { + if (screendepth == pixelFormat.bitsPerPixel) { // memcpy cutoffs + + switch (screendepth) { + case 32: + memcpy(dst, src, count * sizeof(quint32)); + return; + case 16: + if (pixelFormat.redBits == 5 + && pixelFormat.greenBits == 6 + && pixelFormat.blueBits == 5) + { + memcpy(dst, src, count * sizeof(quint16)); + return; + } + } + } else if (screendepth == 16 && pixelFormat.bitsPerPixel == 32) { +#if defined(__i386__) // Currently fails on ARM if dst is not 4 byte aligned + const quint32 *src32 = reinterpret_cast(src); + quint32 *dst32 = reinterpret_cast(dst); + int count32 = count * sizeof(quint16) / sizeof(quint32); + while (count32--) { + const quint32 s = *src32++; + quint32 result1; + quint32 result2; + + // red + result1 = ((s & 0xf8000000) | ((s & 0xe0000000) >> 5)) >> 8; + result2 = ((s & 0x0000f800) | ((s & 0x0000e000) >> 5)) << 8; + + // green + result1 |= ((s & 0x07e00000) | ((s & 0x06000000) >> 6)) >> 11; + result2 |= ((s & 0x000007e0) | ((s & 0x00000600) >> 6)) << 5; + + // blue + result1 |= ((s & 0x001f0000) | ((s & 0x001c0000) >> 5)) >> 13; + result2 |= ((s & 0x0000001f) | ((s & 0x0000001c) >> 5)) << 3; + + *dst32++ = result2; + *dst32++ = result1; + } + if (count & 0x1) { + const quint16 *src16 = reinterpret_cast(src); + dst32[count - 1] = qt_conv16ToRgb(src16[count - 1]); + } + return; +#endif + } + } + + const int bytesPerPixel = (pixelFormat.bitsPerPixel + 7) / 8; + +// nibble = 0; + + for (int i = 0; i < count; ++i) { + int r, g, b; + + switch (screendepth) { +#if 0 + case 4: { + if (!nibble) { + r = ((*src) & 0x0f) << 4; + } else { + r = (*src) & 0xf0; + src++; + } + nibble = !nibble; + g = b = r; + break; + } +#endif +#if 0 + case 8: { + QRgb rgb = qvnc_screen->clut()[int(*src)]; + r = qRed(rgb); + g = qGreen(rgb); + b = qBlue(rgb); + src++; + break; + } +#endif +#ifdef QT_QWS_DEPTH_12 + case 12: { + quint32 p = quint32(*reinterpret_cast(src)); + r = qRed(p); + g = qGreen(p); + b = qBlue(p); + src += sizeof(qrgb444); + break; + } +#endif +#ifdef QT_QWS_DEPTH_15 + case 15: { + quint32 p = quint32(*reinterpret_cast(src)); + r = qRed(p); + g = qGreen(p); + b = qBlue(p); + src += sizeof(qrgb555); + break; + } +#endif + case 16: { + quint16 p = *reinterpret_cast(src); +#if Q_BYTE_ORDER == Q_BIG_ENDIAN + if (swapBytes) + p = ((p & 0xff) << 8) | ((p & 0xff00) >> 8); +#endif + r = (p >> 11) & 0x1f; + g = (p >> 5) & 0x3f; + b = p & 0x1f; + r <<= 3; + g <<= 2; + b <<= 3; + src += sizeof(quint16); + break; + } +#ifdef QT_QWS_DEPTH_18 + case 18: { + quint32 p = quint32(*reinterpret_cast(src)); + r = qRed(p); + g = qGreen(p); + b = qBlue(p); + src += sizeof(qrgb666); + break; + } +#endif +#ifdef QT_QWS_DEPTH_24 + case 24: { + quint32 p = quint32(*reinterpret_cast(src)); + r = qRed(p); + g = qGreen(p); + b = qBlue(p); + src += sizeof(qrgb888); + break; + } +#endif + case 32: { + quint32 p = *reinterpret_cast(src); + r = (p >> 16) & 0xff; + g = (p >> 8) & 0xff; + b = p & 0xff; + src += sizeof(quint32); + break; + } + default: { + r = g = b = 0; + qDebug("QVNCServer: don't support %dbpp display", screendepth); + return; + } + } + +#if Q_BYTE_ORDER == Q_BIG_ENDIAN + if (swapBytes ^ isBgr) +#else + if (isBgr) +#endif + qSwap(r, b); + + r >>= (8 - pixelFormat.redBits); + g >>= (8 - pixelFormat.greenBits); + b >>= (8 - pixelFormat.blueBits); + + int pixel = (r << pixelFormat.redShift) | + (g << pixelFormat.greenShift) | + (b << pixelFormat.blueShift); + + if (sameEndian || pixelFormat.bitsPerPixel == 8) { + memcpy(dst, &pixel, bytesPerPixel); // XXX: do a simple for-loop instead? + dst += bytesPerPixel; + continue; + } + + + if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { + switch (pixelFormat.bitsPerPixel) { + case 16: + pixel = (((pixel & 0x0000ff00) << 8) | + ((pixel & 0x000000ff) << 24)); + break; + case 32: + pixel = (((pixel & 0xff000000) >> 24) | + ((pixel & 0x00ff0000) >> 8) | + ((pixel & 0x0000ff00) << 8) | + ((pixel & 0x000000ff) << 24)); + break; + default: + qDebug("Cannot handle %d bpp client", pixelFormat.bitsPerPixel); + } + } else { // QSysInfo::ByteOrder == QSysInfo::LittleEndian + switch (pixelFormat.bitsPerPixel) { + case 16: + pixel = (((pixel & 0xff000000) >> 8) | + ((pixel & 0x00ff0000) << 8)); + break; + case 32: + pixel = (((pixel & 0xff000000) >> 24) | + ((pixel & 0x00ff0000) >> 8) | + ((pixel & 0x0000ff00) << 8) | + ((pixel & 0x000000ff) << 24)); + break; + default: + qDebug("Cannot handle %d bpp client", + pixelFormat.bitsPerPixel); + break; + } + } + memcpy(dst, &pixel, bytesPerPixel); // XXX: simple for-loop instead? + dst += bytesPerPixel; + } +} + +#ifndef QT_NO_QWS_CURSOR +static void blendCursor(QImage &image, const QRect &imageRect) +{ + const QRect cursorRect = qt_screencursor->boundingRect(); + const QRect intersection = (cursorRect & imageRect); + const QRect destRect = intersection.translated(-imageRect.topLeft()); + const QRect srcRect = intersection.translated(-cursorRect.topLeft()); + + QPainter painter(&image); + painter.drawImage(destRect, qt_screencursor->image(), srcRect); + painter.end(); +} +#endif // QT_NO_QWS_CURSOR + +QVNCDirtyMap::QVNCDirtyMap(QVNCGraphicsSystemScreen *s) + : bytesPerPixel(0), numDirty(0), screen(s) +{ + bytesPerPixel = (screen->depth() + 7) / 8; + QSize screenSize = screen->geometry().size(); + bufferWidth = screenSize.width(); + bufferHeight = screenSize.height(); + bufferStride = bufferWidth * bytesPerPixel; + buffer = new uchar[bufferHeight * bufferStride]; + + mapWidth = (bufferWidth + MAP_TILE_SIZE - 1) / MAP_TILE_SIZE; + mapHeight = (bufferHeight + MAP_TILE_SIZE - 1) / MAP_TILE_SIZE; + numTiles = mapWidth * mapHeight; + map = new uchar[numTiles]; +} + +QVNCDirtyMap::~QVNCDirtyMap() +{ + delete[] map; + delete[] buffer; +} + +void QVNCDirtyMap::reset() +{ + memset(map, 1, numTiles); + memset(buffer, 0, bufferHeight * bufferStride); + numDirty = numTiles; +} + +inline bool QVNCDirtyMap::dirty(int x, int y) const +{ + return map[y * mapWidth + x]; +} + +inline void QVNCDirtyMap::setClean(int x, int y) +{ + map[y * mapWidth + x] = 0; + --numDirty; +} + +template +void QVNCDirtyMapOptimized::setDirty(int tileX, int tileY, bool force) +{ + static bool alwaysForce = qgetenv("QT_VNC_NO_COMPAREBUFFER").toInt(); + if (alwaysForce) + force = true; + + bool changed = false; + + if (!force) { + const int lstep = screen->linestep(); + const int startX = tileX * MAP_TILE_SIZE; + const int startY = tileY * MAP_TILE_SIZE; + const uchar *scrn = screen->base() + + startY * lstep + startX * bytesPerPixel; + uchar *old = buffer + startY * bufferStride + startX * sizeof(T); + + const int tileHeight = (startY + MAP_TILE_SIZE > bufferHeight ? + bufferHeight - startY : MAP_TILE_SIZE); + const int tileWidth = (startX + MAP_TILE_SIZE > bufferWidth ? + bufferWidth - startX : MAP_TILE_SIZE); + const bool doInlines = (tileWidth == MAP_TILE_SIZE); + + int y = tileHeight; + + if (doInlines) { // hw: memcmp/memcpy is inlined when using constants + while (y) { + if (memcmp(old, scrn, sizeof(T) * MAP_TILE_SIZE)) { + changed = true; + break; + } + scrn += lstep; + old += bufferStride; + --y; + } + + while (y) { + memcpy(old, scrn, sizeof(T) * MAP_TILE_SIZE); + scrn += lstep; + old += bufferStride; + --y; + } + } else { + while (y) { + if (memcmp(old, scrn, sizeof(T) * tileWidth)) { + changed = true; + break; + } + scrn += lstep; + old += bufferStride; + --y; + } + + while (y) { + memcpy(old, scrn, sizeof(T) * tileWidth); + scrn += lstep; + old += bufferStride; + --y; + } + } + } + + const int mapIndex = tileY * mapWidth + tileX; + if ((force || changed) && !map[mapIndex]) { + map[mapIndex] = 1; + ++numDirty; + } +} + +template +QRfbHextileEncoder::QRfbHextileEncoder(QVNCServer *s) + : QRfbEncoder(s), + singleColorHextile(this), dualColorHextile(this), multiColorHextile(this) +{ +} + +/* + \internal + Send dirty rects using hextile encoding. +*/ +template +void QRfbHextileEncoder::write() +{ +// QWSDisplay::grab(true); + + QVNCDirtyMap *map = server->dirtyMap(); + QTcpSocket *socket = server->clientSocket(); + + const quint32 encoding = htonl(5); // hextile encoding + const int bytesPerPixel = server->clientBytesPerPixel(); + + { + const char tmp[2] = { 0, 0 }; // msg type, padding + socket->write(tmp, sizeof(tmp)); + } + { + const quint16 count = htons(map->numDirty); + socket->write((char *)&count, sizeof(count)); + } + + if (map->numDirty <= 0) { +// QWSDisplay::ungrab(); + return; + } + + newBg = true; + newFg = true; + + const QImage screenImage = server->screenImage(); + QRfbRect rect(0, 0, MAP_TILE_SIZE, MAP_TILE_SIZE); + + QSize screenSize = server->screen()->geometry().size(); + + for (int y = 0; y < map->mapHeight; ++y) { + if (rect.y + MAP_TILE_SIZE > screenSize.height()) + rect.h = screenSize.height() - rect.y; + rect.w = MAP_TILE_SIZE; + for (int x = 0; x < map->mapWidth; ++x) { + if (!map->dirty(x, y)) + continue; + map->setClean(x, y); + + rect.x = x * MAP_TILE_SIZE; + if (rect.x + MAP_TILE_SIZE > screenSize.width()) //###deviceWidth ??? + rect.w = screenSize.width() - rect.x; + rect.write(socket); + + socket->write((char *)&encoding, sizeof(encoding)); + + const uchar *screendata = screenImage.scanLine(rect.y) + + rect.x * screenImage.depth() / 8; + int linestep = screenImage.bytesPerLine(); + +#ifndef QT_NO_QWS_CURSOR + // hardware cursors must be blended with the screen memory + const bool doBlendCursor = qt_screencursor + && !server->hasClientCursor() + && qt_screencursor->isAccelerated(); + QImage tileImage; + if (doBlendCursor) { + const QRect tileRect(rect.x, rect.y, rect.w, rect.h); + const QRect cursorRect = qt_screencursor->boundingRect() + .translated(-server->screen()->offset()); + if (tileRect.intersects(cursorRect)) { + tileImage = screenImage.copy(tileRect); + blendCursor(tileImage, + tileRect.translated(server->screen()->offset())); + screendata = tileImage.bits(); + linestep = tileImage.bytesPerLine(); + } + } +#endif // QT_NO_QWS_CURSOR + + if (singleColorHextile.read(screendata, rect.w, rect.h, linestep)) { + singleColorHextile.write(socket); + } else if (dualColorHextile.read(screendata, rect.w, rect.h, linestep)) { + dualColorHextile.write(socket); + } else if (multiColorHextile.read(screendata, rect.w, rect.h, linestep)) { + multiColorHextile.write(socket); + } else if (server->doPixelConversion()) { + const int bufferSize = rect.w * rect.h * bytesPerPixel + 1; + const int padding = sizeof(quint32) - sizeof(char); + buffer.resize(bufferSize + padding); + + buffer[padding] = 1; // Raw subencoding + + // convert pixels + char *b = buffer.data() + padding + 1; + const int bstep = rect.w * bytesPerPixel; + for (int i = 0; i < rect.h; ++i) { + server->convertPixels(b, (const char*)screendata, rect.w); + screendata += linestep; + b += bstep; + } + socket->write(buffer.constData() + padding, bufferSize); + } else { + quint8 subenc = 1; // Raw subencoding + socket->write((char *)&subenc, 1); + + // send pixels + for (int i = 0; i < rect.h; ++i) { + socket->write((const char*)screendata, + rect.w * bytesPerPixel); + screendata += linestep; + } + } + } + if (socket->state() == QAbstractSocket::UnconnectedState) + break; + rect.y += MAP_TILE_SIZE; + } + socket->flush(); + Q_ASSERT(map->numDirty == 0); + +// QWSDisplay::ungrab(); +} + +void QRfbRawEncoder::write() +{ +// QWSDisplay::grab(false); + + QVNCDirtyMap *map = server->dirtyMap(); + QTcpSocket *socket = server->clientSocket(); + + const int bytesPerPixel = server->clientBytesPerPixel(); + QSize screenSize = server->screen()->geometry().size(); + + // create a region from the dirty rects and send the region's merged rects. + QRegion rgn; + if (map) { + for (int y = 0; y < map->mapHeight; ++y) { + for (int x = 0; x < map->mapWidth; ++x) { + if (!map->dirty(x, y)) + continue; + rgn += QRect(x * MAP_TILE_SIZE, y * MAP_TILE_SIZE, + MAP_TILE_SIZE, MAP_TILE_SIZE); + map->setClean(x, y); + } + } + + rgn &= QRect(0, 0, screenSize.width(), + screenSize.height()); + } + const QVector rects = rgn.rects(); + + { + const char tmp[2] = { 0, 0 }; // msg type, padding + socket->write(tmp, sizeof(tmp)); + } + + { + const quint16 count = htons(rects.size()); + socket->write((char *)&count, sizeof(count)); + } + + if (rects.size() <= 0) { +// QWSDisplay::ungrab(); + return; + } + + const QImage *screenImage = server->screenImage(); + + for (int i = 0; i < rects.size(); ++i) { + const QRect tileRect = rects.at(i); + const QRfbRect rect(tileRect.x(), tileRect.y(), + tileRect.width(), tileRect.height()); + rect.write(socket); + + const quint32 encoding = htonl(0); // raw encoding + socket->write((char *)&encoding, sizeof(encoding)); + + int linestep = screenImage->bytesPerLine(); + const uchar *screendata = screenImage->scanLine(rect.y) + + rect.x * screenImage->depth() / 8; + +#ifndef QT_NO_QWS_CURSOR + // hardware cursors must be blended with the screen memory + const bool doBlendCursor = qt_screencursor + && !server->hasClientCursor() + && qt_screencursor->isAccelerated(); + QImage tileImage; + if (doBlendCursor) { + const QRect cursorRect = qt_screencursor->boundingRect() + .translated(-server->screen()->offset()); + if (tileRect.intersects(cursorRect)) { + tileImage = screenImage->copy(tileRect); + blendCursor(tileImage, + tileRect.translated(server->screen()->offset())); + screendata = tileImage.bits(); + linestep = tileImage.bytesPerLine(); + } + } +#endif // QT_NO_QWS_CURSOR + + if (server->doPixelConversion()) { + const int bufferSize = rect.w * rect.h * bytesPerPixel; + if (bufferSize > buffer.size()) + buffer.resize(bufferSize); + + // convert pixels + char *b = buffer.data(); + const int bstep = rect.w * bytesPerPixel; + for (int i = 0; i < rect.h; ++i) { + server->convertPixels(b, (const char*)screendata, rect.w); + screendata += linestep; + b += bstep; + } + socket->write(buffer.constData(), bufferSize); + } else { + for (int i = 0; i < rect.h; ++i) { + socket->write((const char*)screendata, rect.w * bytesPerPixel); + screendata += linestep; + } + } + if (socket->state() == QAbstractSocket::UnconnectedState) + break; + } + socket->flush(); + +// QWSDisplay::ungrab(); +} + +inline QImage *QVNCServer::screenImage() const +{ + return qvnc_screen->mScreenImage; +} + +void QVNCServer::checkUpdate() +{ + if (!wantUpdate) + return; + + if (dirtyCursor) { +#ifndef QT_NO_QWS_CURSOR + Q_ASSERT(qvnc_cursor); + qvnc_cursor->write(); +#endif + dirtyCursor = false; + wantUpdate = false; + return; + } + + if (dirtyMap()->numDirty > 0) { + if (encoder) + encoder->write(); + wantUpdate = false; + } +} + +void QVNCServer::discardClient() +{ + timer->stop(); + state = Unconnected; + delete encoder; + encoder = 0; +#ifndef QT_NO_QWS_CURSOR + delete qvnc_cursor; + qvnc_cursor = 0; +#endif +// if (!qvnc_screen->screen()) +// QWSServer::instance()->enablePainting(false); +} + + + +QVNCGraphicsSystemScreenPrivate::QVNCGraphicsSystemScreenPrivate(QVNCGraphicsSystemScreen *parent) + : dpiX(72), dpiY(72), doOnScreenSurface(false), refreshRate(25), + vncServer(0), q_ptr(parent) +{ +#if 0//ndef QT_NO_QWS_SIGNALHANDLER + QWSSignalHandler::instance()->addObject(this); +#endif + + vncServer = new QVNCServer(q_ptr); + vncServer->setRefreshRate(refreshRate); + + + Q_ASSERT(q_ptr->depth() == 32); + + dirty = new QVNCDirtyMapOptimized(q_ptr); +} + +QVNCGraphicsSystemScreenPrivate::~QVNCGraphicsSystemScreenPrivate() +{ +} + + +void QVNCGraphicsSystemScreenPrivate::setDirty(const QRect& rect, bool force) +{ + if (rect.isEmpty()) + return; + +// if (q_ptr->screen()) +// q_ptr->screen()->setDirty(rect); + + if (!vncServer || !vncServer->isConnected()) { +// qDebug() << "QVNCGraphicsSystemScreenPrivate::setDirty() - Not connected"; + return; + } + const QRect r = rect; // .translated(-q_ptr->offset()); + const int x1 = r.x() / MAP_TILE_SIZE; + int y = r.y() / MAP_TILE_SIZE; + for (; (y <= r.bottom() / MAP_TILE_SIZE) && y < dirty->mapHeight; y++) + for (int x = x1; (x <= r.right() / MAP_TILE_SIZE) && x < dirty->mapWidth; x++) + dirty->setDirty(x, y, force); + + vncServer->setDirty(); +} + + + + +QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/vnc/qvncserver.h b/src/plugins/graphicssystems/vnc/qvncserver.h new file mode 100644 index 0000000..e7eb531 --- /dev/null +++ b/src/plugins/graphicssystems/vnc/qvncserver.h @@ -0,0 +1,524 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCREENVNC_P_H +#define QSCREENVNC_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of the QLibrary class. This header file may change from version to version +// without notice, or even be removed. +// +// We mean it. +// + +#include "qgraphicssystem_vnc.h" +#define QT_NO_QWS_CURSOR + +#ifndef QT_NO_QWS_VNC + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QVNCServer; + +#ifndef QT_NO_QWS_CURSOR +class QVNCCursor : public QProxyScreenCursor +{ +public: + QVNCCursor(QVNCGraphicsSystemScreen *s); + ~QVNCCursor(); + + void hide(); + void show(); + void set(const QImage &image, int hotx, int hoty); + void move(int x, int y); + +private: + void setDirty(const QRect &r) const; + QVNCGraphicsSystemScreen *screen; +}; + +class QVNCClientCursor : public QProxyScreenCursor +{ +public: + QVNCClientCursor(QVNCServer *s); + ~QVNCClientCursor(); + + void set(const QImage &image, int hotx, int hoty); + void write() const; + +private: + QVNCServer *server; +}; +#endif // QT_NO_QWS_CURSOR + +#define MAP_TILE_SIZE 16 +#define MAP_WIDTH 1280 / MAP_TILE_SIZE +#define MAP_HEIGHT 1024 / MAP_TILE_SIZE + +class QVNCDirtyMap +{ +public: + QVNCDirtyMap(QVNCGraphicsSystemScreen *screen); + virtual ~QVNCDirtyMap(); + + void reset(); + bool dirty(int x, int y) const; + virtual void setDirty(int x, int y, bool force = false) = 0; + void setClean(int x, int y); + + int bytesPerPixel; + + int numDirty; + int mapWidth; + int mapHeight; + +protected: + uchar *map; + QVNCGraphicsSystemScreen *screen; + uchar *buffer; + int bufferWidth; + int bufferHeight; + int bufferStride; + int numTiles; +}; + +template +class QVNCDirtyMapOptimized : public QVNCDirtyMap +{ +public: + QVNCDirtyMapOptimized(QVNCGraphicsSystemScreen *screen) : QVNCDirtyMap(screen) {} + ~QVNCDirtyMapOptimized() {} + + void setDirty(int x, int y, bool force = false); +}; + +class QRfbRect +{ +public: + QRfbRect() {} + QRfbRect(quint16 _x, quint16 _y, quint16 _w, quint16 _h) { + x = _x; y = _y; w = _w; h = _h; + } + + void read(QTcpSocket *s); + void write(QTcpSocket *s) const; + + quint16 x; + quint16 y; + quint16 w; + quint16 h; +}; + +class QRfbPixelFormat +{ +public: + static int size() { return 16; } + + void read(QTcpSocket *s); + void write(QTcpSocket *s); + + int bitsPerPixel; + int depth; + bool bigEndian; + bool trueColor; + int redBits; + int greenBits; + int blueBits; + int redShift; + int greenShift; + int blueShift; +}; + +class QRfbServerInit +{ +public: + QRfbServerInit() { name = 0; } + ~QRfbServerInit() { delete[] name; } + + int size() const { return QRfbPixelFormat::size() + 8 + strlen(name); } + void setName(const char *n); + + void read(QTcpSocket *s); + void write(QTcpSocket *s); + + quint16 width; + quint16 height; + QRfbPixelFormat format; + char *name; +}; + +class QRfbSetEncodings +{ +public: + bool read(QTcpSocket *s); + + quint16 count; +}; + +class QRfbFrameBufferUpdateRequest +{ +public: + bool read(QTcpSocket *s); + + char incremental; + QRfbRect rect; +}; + +class QRfbKeyEvent +{ +public: + bool read(QTcpSocket *s); + + char down; + int keycode; + int unicode; +}; + +class QRfbPointerEvent +{ +public: + bool read(QTcpSocket *s); + + Qt::MouseButtons buttons; + quint16 x; + quint16 y; +}; + +class QRfbClientCutText +{ +public: + bool read(QTcpSocket *s); + + quint32 length; +}; + +class QVNCGraphicsSystemScreenPrivate : public QObject +{ +public: + QVNCGraphicsSystemScreenPrivate(QVNCGraphicsSystemScreen *parent); + ~QVNCGraphicsSystemScreenPrivate(); + + void setDirty(const QRect &rect, bool force = false); + void configure(); + + qreal dpiX; + qreal dpiY; + bool doOnScreenSurface; + QVNCDirtyMap *dirty; + int refreshRate; + QVNCServer *vncServer; + +#if !defined(QT_NO_QWS_MULTIPROCESS) && !defined(QT_NO_SHAREDMEMORY) + QSharedMemory shm; +#endif + + QVNCGraphicsSystemScreen *q_ptr; +}; + +class QRfbEncoder +{ +public: + QRfbEncoder(QVNCServer *s) : server(s) {} + virtual ~QRfbEncoder() {} + + virtual void write() = 0; + +protected: + QVNCServer *server; +}; + +class QRfbRawEncoder : public QRfbEncoder +{ +public: + QRfbRawEncoder(QVNCServer *s) : QRfbEncoder(s) {} + + void write(); + +private: + QByteArray buffer; +}; + +template class QRfbHextileEncoder; + +template +class QRfbSingleColorHextile +{ +public: + QRfbSingleColorHextile(QRfbHextileEncoder *e) : encoder(e) {} + bool read(const uchar *data, int width, int height, int stride); + void write(QTcpSocket *socket) const; + +private: + QRfbHextileEncoder *encoder; +}; + +template +class QRfbDualColorHextile +{ +public: + QRfbDualColorHextile(QRfbHextileEncoder *e) : encoder(e) {} + bool read(const uchar *data, int width, int height, int stride); + void write(QTcpSocket *socket) const; + +private: + struct Rect { + quint8 xy; + quint8 wh; + } Q_PACKED rects[8 * 16]; + + quint8 numRects; + QRfbHextileEncoder *encoder; + +private: + inline int lastx() const { return rectx(numRects); } + inline int lasty() const { return recty(numRects); } + inline int rectx(int r) const { return rects[r].xy >> 4; } + inline int recty(int r) const { return rects[r].xy & 0x0f; } + inline int width(int r) const { return (rects[r].wh >> 4) + 1; } + inline int height(int r) const { return (rects[r].wh & 0x0f) + 1; } + + inline void setX(int r, int x) { + rects[r].xy = (x << 4) | (rects[r].xy & 0x0f); + } + inline void setY(int r, int y) { + rects[r].xy = (rects[r].xy & 0xf0) | y; + } + inline void setWidth(int r, int width) { + rects[r].wh = ((width - 1) << 4) | (rects[r].wh & 0x0f); + } + inline void setHeight(int r, int height) { + rects[r].wh = (rects[r].wh & 0xf0) | (height - 1); + } + + inline void setWidth(int width) { setWidth(numRects, width); } + inline void setHeight(int height) { setHeight(numRects, height); } + inline void setX(int x) { setX(numRects, x); } + inline void setY(int y) { setY(numRects, y); } + void next(); +}; + +template +class QRfbMultiColorHextile +{ +public: + QRfbMultiColorHextile(QRfbHextileEncoder *e) : encoder(e) {} + bool read(const uchar *data, int width, int height, int stride); + void write(QTcpSocket *socket) const; + +private: + inline quint8* rect(int r) { + return rects.data() + r * (bpp + 2); + } + inline const quint8* rect(int r) const { + return rects.constData() + r * (bpp + 2); + } + inline void setX(int r, int x) { + quint8 *ptr = rect(r) + bpp; + *ptr = (x << 4) | (*ptr & 0x0f); + } + inline void setY(int r, int y) { + quint8 *ptr = rect(r) + bpp; + *ptr = (*ptr & 0xf0) | y; + } + void setColor(SRC color); + inline int rectx(int r) const { + const quint8 *ptr = rect(r) + bpp; + return *ptr >> 4; + } + inline int recty(int r) const { + const quint8 *ptr = rect(r) + bpp; + return *ptr & 0x0f; + } + inline void setWidth(int r, int width) { + quint8 *ptr = rect(r) + bpp + 1; + *ptr = ((width - 1) << 4) | (*ptr & 0x0f); + } + inline void setHeight(int r, int height) { + quint8 *ptr = rect(r) + bpp + 1; + *ptr = (*ptr & 0xf0) | (height - 1); + } + + bool beginRect(); + void endRect(); + + static const int maxRectsSize = 16 * 16; + QVarLengthArray rects; + + quint8 bpp; + quint8 numRects; + QRfbHextileEncoder *encoder; +}; + +template +class QRfbHextileEncoder : public QRfbEncoder +{ +public: + QRfbHextileEncoder(QVNCServer *s); + void write(); + +private: + enum SubEncoding { + Raw = 1, + BackgroundSpecified = 2, + ForegroundSpecified = 4, + AnySubrects = 8, + SubrectsColoured = 16 + }; + + QByteArray buffer; + QRfbSingleColorHextile singleColorHextile; + QRfbDualColorHextile dualColorHextile; + QRfbMultiColorHextile multiColorHextile; + + SRC bg; + SRC fg; + bool newBg; + bool newFg; + + friend class QRfbSingleColorHextile; + friend class QRfbDualColorHextile; + friend class QRfbMultiColorHextile; +}; + +class QVNCServer : public QObject +{ + Q_OBJECT +public: + QVNCServer(QVNCGraphicsSystemScreen *screen); + QVNCServer(QVNCGraphicsSystemScreen *screen, int id); + ~QVNCServer(); + + void setDirty(); + void setDirtyCursor() { dirtyCursor = true; setDirty(); } + inline bool isConnected() const { return state == Connected; } + inline void setRefreshRate(int rate) { refreshRate = rate; } + + enum ClientMsg { SetPixelFormat = 0, + FixColourMapEntries = 1, + SetEncodings = 2, + FramebufferUpdateRequest = 3, + KeyEvent = 4, + PointerEvent = 5, + ClientCutText = 6 }; + + enum ServerMsg { FramebufferUpdate = 0, + SetColourMapEntries = 1 }; + + void convertPixels(char *dst, const char *src, int count) const; + + inline int clientBytesPerPixel() const { + return pixelFormat.bitsPerPixel / 8; + } + + inline QVNCGraphicsSystemScreen* screen() const { return qvnc_screen; } + inline QVNCDirtyMap* dirtyMap() const { return qvnc_screen->dirtyMap(); } + inline QTcpSocket* clientSocket() const { return client; } + QImage *screenImage() const; + inline bool doPixelConversion() const { return needConversion; } +#ifndef QT_NO_QWS_CURSOR + inline bool hasClientCursor() const { return qvnc_cursor != 0; } +#endif + +private: + void setPixelFormat(); + void setEncodings(); + void frameBufferUpdateRequest(); + void pointerEvent(); + void keyEvent(); + void clientCutText(); + bool pixelConversionNeeded() const; + +private slots: + void newConnection(); + void readClient(); + void checkUpdate(); + void discardClient(); + +private: + void init(uint port); + enum ClientState { Unconnected, Protocol, Init, Connected }; + QTimer *timer; + QTcpServer *serverSocket; + QTcpSocket *client; + ClientState state; + quint8 msgType; + bool handleMsg; + QRfbPixelFormat pixelFormat; + Qt::KeyboardModifiers keymod; + Qt::MouseButtons buttons; + int encodingsPending; + int cutTextPending; + uint supportCopyRect : 1; + uint supportRRE : 1; + uint supportCoRRE : 1; + uint supportHextile : 1; + uint supportZRLE : 1; + uint supportCursor : 1; + uint supportDesktopSize : 1; + bool wantUpdate; + bool sameEndian; + bool needConversion; +#if Q_BYTE_ORDER == Q_BIG_ENDIAN + bool swapBytes; +#endif + bool dirtyCursor; + int refreshRate; + QVNCGraphicsSystemScreen *qvnc_screen; +#ifndef QT_NO_QWS_CURSOR + QVNCClientCursor *qvnc_cursor; +#endif + + QRfbEncoder *encoder; +}; + + +QT_END_NAMESPACE +#endif // QT_NO_QWS_VNC +#endif // QSCREENVNC_P_H diff --git a/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp b/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp new file mode 100644 index 0000000..9429eb2 --- /dev/null +++ b/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include "qwindowsurface_vnc.h" +#include "qgraphicssystem_vnc.h" +#include +#include +#include + +QT_BEGIN_NAMESPACE + +QVNCWindowSurface::QVNCWindowSurface(QVNCGraphicsSystem *graphicsSystem, + QVNCGraphicsSystemScreen *screen, QWidget *window) + : QWindowSurface(window), + mScreen(screen) +{ +} + +QVNCWindowSurface::~QVNCWindowSurface() +{ +} + +QPaintDevice *QVNCWindowSurface::paintDevice() +{ + return mScreen->mScreenImage; +} + +void QVNCWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + Q_UNUSED(offset); + + QRect rect = geometry(); + QPoint topLeft = rect.topLeft(); + + mScreen->setDirty(region.boundingRect()); + // server->flush(region); + +} + +void QVNCWindowSurface::setGeometry(const QRect &) +{ + +// any size you like as long as it's full-screen... + + QRect rect(mScreen->availableGeometry()); + QApplicationPrivate::handleGeometryChange(this->window(), rect); + + QWindowSurface::setGeometry(rect); +} + +bool QVNCWindowSurface::scroll(const QRegion &area, int dx, int dy) +{ + return QWindowSurface::scroll(area, dx, dy); +} + +void QVNCWindowSurface::beginPaint(const QRegion ®ion) +{ + Q_UNUSED(region); +} + +void QVNCWindowSurface::endPaint(const QRegion ®ion) +{ + Q_UNUSED(region); +} + +QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h b/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h new file mode 100644 index 0000000..3a85db3 --- /dev/null +++ b/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSURFACE_TESTLITE_H +#define QWINDOWSURFACE_TESTLITE_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class MyWindow; +class QVNCGraphicsSystem; +class QVNCGraphicsSystemScreen; + +class QVNCWindowSurface : public QWindowSurface +{ +public: + QVNCWindowSurface(QVNCGraphicsSystem *graphicsSystem, + QVNCGraphicsSystemScreen *screen, QWidget *window); + ~QVNCWindowSurface(); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void setGeometry(const QRect &rect); + bool scroll(const QRegion &area, int dx, int dy); + + void beginPaint(const QRegion ®ion); + void endPaint(const QRegion ®ion); + +private: + QVNCGraphicsSystem *mGraphicsSystem; + QVNCGraphicsSystemScreen *mScreen; + MyWindow *xw; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/graphicssystems/vnc/vnc.pro b/src/plugins/graphicssystems/vnc/vnc.pro new file mode 100644 index 0000000..20e48ad --- /dev/null +++ b/src/plugins/graphicssystems/vnc/vnc.pro @@ -0,0 +1,16 @@ +TARGET = qvncgraphicssystem +include(../../qpluginbase.pri) + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems + + + +SOURCES = main.cpp qgraphicssystem_vnc.cpp qwindowsurface_vnc.cpp +HEADERS = qgraphicssystem_vnc.h qwindowsurface_vnc.h + +HEADERS += qvncserver.h +SOURCES += qvncserver.cpp + + +target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +INSTALLS += target diff --git a/tools/tools.pro b/tools/tools.pro index 4b36115..f079357 100644 --- a/tools/tools.pro +++ b/tools/tools.pro @@ -16,7 +16,7 @@ no-png { SUBDIRS += linguist symbian: SUBDIRS = designer wince*: SUBDIRS = qtestlib designer - unix:!mac:!embedded:contains(QT_CONFIG, qt3support):SUBDIRS += qtconfig + unix:!mac:!embedded:!embedded_lite:contains(QT_CONFIG, qt3support):SUBDIRS += qtconfig win32:!wince*:SUBDIRS += activeqt } -- cgit v0.12 From 7f808c0b4b640ee0f0d7e5f6ace98bda7de5730c Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 30 Sep 2009 16:45:16 +0200 Subject: Update to the latest version of the copyright headers. --- src/gui/egl/qegl_lite.cpp | 8 ++++---- src/gui/image/qpixmap_lite.cpp | 8 ++++---- src/gui/kernel/qapplication_lite.cpp | 8 ++++---- src/gui/kernel/qclipboard_lite.cpp | 8 ++++---- src/gui/kernel/qcursor_lite.cpp | 8 ++++---- src/gui/kernel/qdesktopwidget_lite.cpp | 8 ++++---- src/gui/kernel/qgenericplugin_lite.cpp | 8 ++++---- src/gui/kernel/qgenericplugin_lite.h | 8 ++++---- src/gui/kernel/qgenericpluginfactory_lite.cpp | 8 ++++---- src/gui/kernel/qgenericpluginfactory_lite.h | 8 ++++---- src/gui/kernel/qsound_lite.cpp | 8 ++++---- src/gui/kernel/qwidget_lite.cpp | 8 ++++---- src/gui/painting/qcolormap_lite.cpp | 8 ++++---- src/gui/painting/qpaintdevice_lite.cpp | 8 ++++---- src/plugins/generic/linuxinput/main.cpp | 8 ++++---- src/plugins/generic/linuxinput/qlinuxinput.cpp | 8 ++++---- src/plugins/generic/linuxinput/qlinuxinput.h | 8 ++++---- src/plugins/graphicssystems/linuxfb/main.cpp | 8 ++++---- src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp | 8 ++++---- src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.h | 8 ++++---- src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.cpp | 8 ++++---- src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.h | 8 ++++---- src/plugins/graphicssystems/minimal/main.cpp | 8 ++++---- src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.cpp | 8 ++++---- src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.h | 8 ++++---- src/plugins/graphicssystems/minimal/qwindowsurface_minimal.cpp | 8 ++++---- src/plugins/graphicssystems/minimal/qwindowsurface_minimal.h | 8 ++++---- src/plugins/graphicssystems/openvglite/main.cpp | 8 ++++---- src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.cpp | 8 ++++---- src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.h | 8 ++++---- src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.cpp | 8 ++++---- src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.h | 8 ++++---- src/plugins/graphicssystems/testlite/main.cpp | 8 ++++---- src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp | 8 ++++---- src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.h | 8 ++++---- src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp | 8 ++++---- src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h | 8 ++++---- src/plugins/graphicssystems/testlite/x11util.cpp | 8 ++++---- src/plugins/graphicssystems/testlite/x11util.h | 8 ++++---- src/plugins/graphicssystems/vnc/main.cpp | 8 ++++---- src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp | 8 ++++---- src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h | 8 ++++---- src/plugins/graphicssystems/vnc/qvncserver.cpp | 8 ++++---- src/plugins/graphicssystems/vnc/qvncserver.h | 8 ++++---- src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp | 8 ++++---- src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h | 8 ++++---- 46 files changed, 184 insertions(+), 184 deletions(-) diff --git a/src/gui/egl/qegl_lite.cpp b/src/gui/egl/qegl_lite.cpp index 784b252..40439c6 100644 --- a/src/gui/egl/qegl_lite.cpp +++ b/src/gui/egl/qegl_lite.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/gui/image/qpixmap_lite.cpp b/src/gui/image/qpixmap_lite.cpp index 4ba69fa..90761ca 100644 --- a/src/gui/image/qpixmap_lite.cpp +++ b/src/gui/image/qpixmap_lite.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index eec3e6c..384c987 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/gui/kernel/qclipboard_lite.cpp b/src/gui/kernel/qclipboard_lite.cpp index 0d9268f..92b9e83 100644 --- a/src/gui/kernel/qclipboard_lite.cpp +++ b/src/gui/kernel/qclipboard_lite.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/gui/kernel/qcursor_lite.cpp b/src/gui/kernel/qcursor_lite.cpp index 5af03fc..a6ae7d3 100644 --- a/src/gui/kernel/qcursor_lite.cpp +++ b/src/gui/kernel/qcursor_lite.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/gui/kernel/qdesktopwidget_lite.cpp b/src/gui/kernel/qdesktopwidget_lite.cpp index 7aea787..fed1f9c 100644 --- a/src/gui/kernel/qdesktopwidget_lite.cpp +++ b/src/gui/kernel/qdesktopwidget_lite.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/gui/kernel/qgenericplugin_lite.cpp b/src/gui/kernel/qgenericplugin_lite.cpp index 29d7728..6a0fdb6 100644 --- a/src/gui/kernel/qgenericplugin_lite.cpp +++ b/src/gui/kernel/qgenericplugin_lite.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/gui/kernel/qgenericplugin_lite.h b/src/gui/kernel/qgenericplugin_lite.h index 2c0ee7a..a468a9f 100644 --- a/src/gui/kernel/qgenericplugin_lite.h +++ b/src/gui/kernel/qgenericplugin_lite.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/gui/kernel/qgenericpluginfactory_lite.cpp b/src/gui/kernel/qgenericpluginfactory_lite.cpp index 4e5b12b..76accbe 100644 --- a/src/gui/kernel/qgenericpluginfactory_lite.cpp +++ b/src/gui/kernel/qgenericpluginfactory_lite.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/gui/kernel/qgenericpluginfactory_lite.h b/src/gui/kernel/qgenericpluginfactory_lite.h index 3be4614..86886f1 100644 --- a/src/gui/kernel/qgenericpluginfactory_lite.h +++ b/src/gui/kernel/qgenericpluginfactory_lite.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/gui/kernel/qsound_lite.cpp b/src/gui/kernel/qsound_lite.cpp index 2e2c1e8..a4c74a8 100644 --- a/src/gui/kernel/qsound_lite.cpp +++ b/src/gui/kernel/qsound_lite.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index bbc7766..2eba1a1 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/gui/painting/qcolormap_lite.cpp b/src/gui/painting/qcolormap_lite.cpp index b8ae1af..1c1e9cf 100644 --- a/src/gui/painting/qcolormap_lite.cpp +++ b/src/gui/painting/qcolormap_lite.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/gui/painting/qpaintdevice_lite.cpp b/src/gui/painting/qpaintdevice_lite.cpp index 2560bf5..0d1ca92 100644 --- a/src/gui/painting/qpaintdevice_lite.cpp +++ b/src/gui/painting/qpaintdevice_lite.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/generic/linuxinput/main.cpp b/src/plugins/generic/linuxinput/main.cpp index 21209b8..25e80eb 100644 --- a/src/plugins/generic/linuxinput/main.cpp +++ b/src/plugins/generic/linuxinput/main.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the plugins of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/generic/linuxinput/qlinuxinput.cpp b/src/plugins/generic/linuxinput/qlinuxinput.cpp index 2ce687d..48084d0 100644 --- a/src/plugins/generic/linuxinput/qlinuxinput.cpp +++ b/src/plugins/generic/linuxinput/qlinuxinput.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/generic/linuxinput/qlinuxinput.h b/src/plugins/generic/linuxinput/qlinuxinput.h index 5a90c8f..26ba6a7 100644 --- a/src/plugins/generic/linuxinput/qlinuxinput.h +++ b/src/plugins/generic/linuxinput/qlinuxinput.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/linuxfb/main.cpp b/src/plugins/graphicssystems/linuxfb/main.cpp index ef6234d..4d03fe5 100644 --- a/src/plugins/graphicssystems/linuxfb/main.cpp +++ b/src/plugins/graphicssystems/linuxfb/main.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the plugins of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp index cd0ced2..95c636f 100644 --- a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp +++ b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the plugins of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.h b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.h index 3446008..7ceaf037 100644 --- a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.h +++ b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the plugins of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.cpp b/src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.cpp index bfc2f83..dbe5dd7 100644 --- a/src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.cpp +++ b/src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtOpenVG module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.h b/src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.h index 763f362..37efcb0 100644 --- a/src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.h +++ b/src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtOpenVG module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/minimal/main.cpp b/src/plugins/graphicssystems/minimal/main.cpp index f7d5eef..2e9d80e 100644 --- a/src/plugins/graphicssystems/minimal/main.cpp +++ b/src/plugins/graphicssystems/minimal/main.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the plugins of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.cpp b/src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.cpp index 31023fc..78aff06 100644 --- a/src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.cpp +++ b/src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the plugins of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.h b/src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.h index b15f6f6..5bf230f 100644 --- a/src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.h +++ b/src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the plugins of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/minimal/qwindowsurface_minimal.cpp b/src/plugins/graphicssystems/minimal/qwindowsurface_minimal.cpp index e9d7d69..a87e690 100644 --- a/src/plugins/graphicssystems/minimal/qwindowsurface_minimal.cpp +++ b/src/plugins/graphicssystems/minimal/qwindowsurface_minimal.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtOpenVG module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/minimal/qwindowsurface_minimal.h b/src/plugins/graphicssystems/minimal/qwindowsurface_minimal.h index 89dc860..c7593e7 100644 --- a/src/plugins/graphicssystems/minimal/qwindowsurface_minimal.h +++ b/src/plugins/graphicssystems/minimal/qwindowsurface_minimal.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtOpenVG module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/openvglite/main.cpp b/src/plugins/graphicssystems/openvglite/main.cpp index 3a73f5c..dc0b4a8 100644 --- a/src/plugins/graphicssystems/openvglite/main.cpp +++ b/src/plugins/graphicssystems/openvglite/main.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the plugins of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.cpp b/src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.cpp index cc5b012..41b2303 100644 --- a/src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.cpp +++ b/src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the plugins of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.h b/src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.h index 74fc41e..512793d 100644 --- a/src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.h +++ b/src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the plugins of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.cpp b/src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.cpp index d250a8e..c73e35a 100644 --- a/src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.cpp +++ b/src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtOpenVG module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.h b/src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.h index c1ae02e..59faba8 100644 --- a/src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.h +++ b/src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtOpenVG module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/testlite/main.cpp b/src/plugins/graphicssystems/testlite/main.cpp index 6271829..28caea7 100644 --- a/src/plugins/graphicssystems/testlite/main.cpp +++ b/src/plugins/graphicssystems/testlite/main.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the plugins of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp index b1948b9..9cb0424 100644 --- a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the plugins of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.h b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.h index cb88ee8..ad7f581 100644 --- a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.h +++ b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the plugins of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp index 6996809..74ccceb 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtOpenVG module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h index 33b55e9..80739b0 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtOpenVG module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/testlite/x11util.cpp b/src/plugins/graphicssystems/testlite/x11util.cpp index f77356a..c9ca6aa 100644 --- a/src/plugins/graphicssystems/testlite/x11util.cpp +++ b/src/plugins/graphicssystems/testlite/x11util.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtOpenVG module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/testlite/x11util.h b/src/plugins/graphicssystems/testlite/x11util.h index 3d813c0..3d3134f 100644 --- a/src/plugins/graphicssystems/testlite/x11util.h +++ b/src/plugins/graphicssystems/testlite/x11util.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtOpenVG module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/vnc/main.cpp b/src/plugins/graphicssystems/vnc/main.cpp index 7deb91a..f10748a 100644 --- a/src/plugins/graphicssystems/vnc/main.cpp +++ b/src/plugins/graphicssystems/vnc/main.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the plugins of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp index 4890e09..9a7c198 100644 --- a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp +++ b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the plugins of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h index d9b4375..375b467 100644 --- a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h +++ b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the plugins of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/vnc/qvncserver.cpp b/src/plugins/graphicssystems/vnc/qvncserver.cpp index c3677a0..36d8cc6 100644 --- a/src/plugins/graphicssystems/vnc/qvncserver.cpp +++ b/src/plugins/graphicssystems/vnc/qvncserver.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the plugins of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/vnc/qvncserver.h b/src/plugins/graphicssystems/vnc/qvncserver.h index e7eb531..ed07ce1 100644 --- a/src/plugins/graphicssystems/vnc/qvncserver.h +++ b/src/plugins/graphicssystems/vnc/qvncserver.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the plugins of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp b/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp index 9429eb2..07668fb 100644 --- a/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp +++ b/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtOpenVG module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. diff --git a/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h b/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h index 3a85db3..40428ef 100644 --- a/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h +++ b/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtOpenVG module of the Qt Toolkit. @@ -20,10 +21,9 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. -- cgit v0.12 From 1a8fc08d9cf7ceb9af3fdd48c590f65b2ad2b57b Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 1 Oct 2009 14:32:29 +0200 Subject: Use the same default style as QWS. --- src/gui/kernel/qapplication.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index bceffc5..613dbb5 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -1981,7 +1981,7 @@ QString desktopstyle; desktopstyle = QLatin1String("Windows"); // default style for Symbian without S60 #elif defined(Q_WS_X11) && defined(Q_OS_IRIX) desktopstyle = QLatin1String("SGI"); // default style for X11 on IRIX -#elif defined(Q_WS_QWS) +#elif defined(Q_WS_QWS) || defined (Q_WS_LITE) desktopstyle = QLatin1String("Plastique"); // default style for X11 and small devices #elif defined(Q_WS_X11) desktopstyle = QApplicationPrivate::x11_desktop_style(); // default runtime dependant style for X11 -- cgit v0.12 From 13a0b4935900093607f2b3b7688e1452d22770fd Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Mon, 5 Oct 2009 13:27:01 +0200 Subject: check for lighthouse when configuring webkit - if so, exclude X11 Reviewed-by: Paul --- src/3rdparty/webkit/WebCore/WebCore.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index 540abad..854cf5f 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -20,6 +20,7 @@ TEMPLATE = lib TARGET = QtWebKit contains(QT_CONFIG, embedded):CONFIG += embedded +contains(QT_CONFIG, embedded_lite):CONFIG += embedded CONFIG(QTDIR_build) { GENERATED_SOURCES_DIR = $$PWD/generated -- cgit v0.12 From 1c58e823cec0cea8210a83596b4c43333a5ded0c Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 6 Oct 2009 17:33:04 +0200 Subject: Fix isHidden() logic in setParent_sys() -- browser demo works now! --- src/gui/kernel/qwidget_lite.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index 2eba1a1..dfcbeaa 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -84,6 +84,7 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) { Q_Q(QWidget); + QWidget *oldParent = q->parentWidget(); Qt::WindowFlags oldFlags = data.window_flags; if (parent != newparent) { @@ -93,7 +94,14 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) if (!newparent) { f |= Qt::Window; } + + bool explicitlyHidden = q->testAttribute(Qt::WA_WState_Hidden) && q->testAttribute(Qt::WA_WState_ExplicitShowHide); + data.window_flags = f; + q->setAttribute(Qt::WA_WState_Created, false); + q->setAttribute(Qt::WA_WState_Visible, false); + q->setAttribute(Qt::WA_WState_Hidden, false); + if (f & Qt::Window) { //qDebug() << "setParent_sys" << q << newparent << hex << f; if (QWindowSurface *surface = q->windowSurface()) @@ -101,11 +109,16 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) } // XXX Reparenting child to toplevel or vice versa ### if ((f&Qt::Window) && !(oldFlags&Qt::Window)) { - qDebug() << "setParent_sys() change to toplevel"; + //qDebug() << "setParent_sys() change to toplevel"; q->create(); //### this cannot be right } else if ((f&Qt::Window) && !(oldFlags&Qt::Window)) { qDebug() << "######## setParent_sys() change from toplevel not implemented ########"; } + + if (q->isWindow() || (!newparent || newparent->isVisible()) || explicitlyHidden) + q->setAttribute(Qt::WA_WState_Hidden); + q->setAttribute(Qt::WA_WState_ExplicitShowHide, explicitlyHidden); + } QPoint QWidget::mapToGlobal(const QPoint &pos) const -- cgit v0.12 From cd584e3654ab8971aa9868c3375d5f26817396dc Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 6 Oct 2009 17:34:20 +0200 Subject: Remove some debug output. --- .../testlite/qwindowsurface_testlite.cpp | 4 ++-- src/plugins/graphicssystems/testlite/x11util.cpp | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp index 74ccceb..640e487 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp @@ -62,14 +62,14 @@ QTestLiteWindowSurface::QTestLiteWindowSurface xw = new MyWindow(graphicsSystem->xd, 0,0,300,300); xw->windowSurface = this; - qDebug() << "QTestLiteWindowSurface::QTestLiteWindowSurface:" << xw->window; +// qDebug() << "QTestLiteWindowSurface::QTestLiteWindowSurface:" << xw->window; setWindowFlags(window->windowFlags()); //##### This should not be the plugin's responsibility } QTestLiteWindowSurface::~QTestLiteWindowSurface() { - qDebug() << "~QTestLiteWindowSurface" << xw->window; +// qDebug() << "~QTestLiteWindowSurface" << xw->window; delete xw; } diff --git a/src/plugins/graphicssystems/testlite/x11util.cpp b/src/plugins/graphicssystems/testlite/x11util.cpp index c9ca6aa..b443e3e 100644 --- a/src/plugins/graphicssystems/testlite/x11util.cpp +++ b/src/plugins/graphicssystems/testlite/x11util.cpp @@ -256,7 +256,9 @@ bool MyDisplay::handleEvent(XEvent *xe) #endif default: +#ifdef MYX11_DEBUG qDebug() << "Other X event" << hex << xe->type; +#endif break; } return quit; @@ -286,8 +288,9 @@ MyDisplay::MyDisplay() physicalHeight = DisplayHeightMM(display, screen); int xSocketNumber = XConnectionNumber(display); +#ifdef MYX11_DEBUG qDebug() << "X socket:"<< xSocketNumber; - +#endif QSocketNotifier *sock = new QSocketNotifier(xSocketNumber, QSocketNotifier::Read, this); connect(sock, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); } @@ -313,7 +316,9 @@ void MyDisplay::eventDispatcher() handleEvent(&event); if (event.xany.serial >= marker) { +#ifdef MYX11_DEBUG qDebug() << "potential livelock averted"; +#endif #if 0 if (XEventsQueued(display, QueuedAfterFlush)) { qDebug() << " with events queued"; @@ -332,8 +337,9 @@ MyWindow::MyWindow(MyDisplay *display, int x, int y, int w, int h) xd->windowList.append(this); +#ifdef MYX11_DEBUG qDebug() << "MyWindow::MyWindow"; - +#endif window = XCreateSimpleWindow(xd->display, xd->rootWindow(), x, y, w, h, 0 /*border_width*/, xd->blackPixel(), xd->whitePixel()); @@ -556,8 +562,9 @@ Qt::WindowFlags MyWindow::setWindowFlags(Qt::WindowFlags flags) mwm_hint_atom = XInternAtom(xd->display, "_MOTIF_WM_HINTS\0", False); } +#ifdef MYX11_DEBUG qDebug() << "MyWindow::setWindowFlags" << hex << mwm_hint_atom << "flags" << flags; - +#endif Qt::WindowType type = static_cast(int(flags & Qt::WindowType_Mask)); if (type == Qt::ToolTip) @@ -657,7 +664,9 @@ Qt::WindowFlags MyWindow::setWindowFlags(Qt::WindowFlags flags) //##### only if initializeWindow??? if (popup) { // popup widget +#ifdef MYX11_DEBUG qDebug() << "Doing XChangeWindowAttributes for popup" << wsa.override_redirect; +#endif // set EWMH window types // setNetWmWindowTypes(); @@ -666,9 +675,9 @@ Qt::WindowFlags MyWindow::setWindowFlags(Qt::WindowFlags flags) XChangeWindowAttributes(xd->display, window, CWOverrideRedirect | CWSaveUnder, &wsa); } else { - +#ifdef MYX11_DEBUG qDebug() << "Doing XChangeWindowAttributes for non-popup"; - +#endif } return flags; -- cgit v0.12 From 899eda0138c3899a2c8c5cfaea7d7685d4490475 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 7 Oct 2009 18:43:52 +0200 Subject: Handle closeEvent() --- src/gui/kernel/qapplication_lite.cpp | 9 +++++ src/gui/kernel/qapplication_p.h | 1 + .../testlite/qwindowsurface_testlite.cpp | 7 ++-- .../testlite/qwindowsurface_testlite.h | 2 +- src/plugins/graphicssystems/testlite/x11util.cpp | 39 +++++++++++++++++++--- src/plugins/graphicssystems/testlite/x11util.h | 2 +- 6 files changed, 51 insertions(+), 9 deletions(-) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 384c987..6d4f30b 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -50,6 +50,8 @@ #include "private/qcursor_p.h" #endif +#include "private/qwidget_p.h" + #include "qgenericpluginfactory_lite.h" #include @@ -621,4 +623,11 @@ void QApplicationPrivate::handleGeometryChange(QWidget *tlw, const QRect &newRec QApplication::sendSpontaneousEvent(tlw, &e); } } + + +void QApplicationPrivate::handleCloseEvent(QWidget *tlw) +{ + tlw->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent); +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 784ebf6..9cd3f4c 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -581,6 +581,7 @@ public: static void handleMouseEvent(QWidget *tlw, const QMouseEvent &ev); static void handleKeyEvent(QWidget *tlw, QKeyEvent *e); static void handleGeometryChange(QWidget *tlw, const QRect &newRect); + static void handleCloseEvent(QWidget *tlw); #endif #if defined(Q_WS_S60) diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp index 640e487..2ad3224 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp @@ -199,9 +199,10 @@ void QTestLiteWindowSurface::handleGeometryChange(int x, int y, int w, int h) } - - - +void QTestLiteWindowSurface::handleCloseEvent() +{ + QApplicationPrivate::handleCloseEvent(window()); +} diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h index 80739b0..7edc448 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h @@ -70,7 +70,7 @@ public: void handleMouseEvent(QEvent::Type, void *); //forwarding X types is apparently impossible :( void handleKeyEvent(QEvent::Type, void *); void handleGeometryChange(int x, int y, int w, int h); - + void handleCloseEvent(); Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); Qt::WindowFlags windowFlags() const; diff --git a/src/plugins/graphicssystems/testlite/x11util.cpp b/src/plugins/graphicssystems/testlite/x11util.cpp index b443e3e..6c8377a 100644 --- a/src/plugins/graphicssystems/testlite/x11util.cpp +++ b/src/plugins/graphicssystems/testlite/x11util.cpp @@ -60,14 +60,15 @@ #undef ATOM #undef X11 - - - +//#define MYX11_DEBUG static int (*original_x_errhandler)(Display *dpy, XErrorEvent *); static bool seen_badwindow; +static Atom wmProtocolsAtom; +static Atom wmDeleteWindowAtom; + //### copied from qapplication_x11.cpp static int qt_x_errhandler(Display *dpy, XErrorEvent *err) @@ -223,6 +224,22 @@ bool MyDisplay::handleEvent(XEvent *xe) } switch (xe->type) { + + case ClientMessage: + if (xe->xclient.format == 32 && xe->xclient.message_type == wmProtocolsAtom) { + Atom a = xe->xclient.data.l[0]; + if (a == wmDeleteWindowAtom) + xw->closeEvent(); +#ifdef MYX11_DEBUG + qDebug() << "ClientMessage WM_PROTOCOLS" << a; +#endif + } +#ifdef MYX11_DEBUG + else + qDebug() << "ClientMessage" << xe->xclient.format << xe->xclient.message_type; +#endif + break; + case Expose: if (xw) if (xe->xexpose.count == 0) @@ -293,6 +310,10 @@ MyDisplay::MyDisplay() #endif QSocketNotifier *sock = new QSocketNotifier(xSocketNumber, QSocketNotifier::Read, this); connect(sock, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); + + wmProtocolsAtom = XInternAtom (display, "WM_PROTOCOLS", False); + wmDeleteWindowAtom = XInternAtom (display, "WM_DELETE_WINDOW", False); + } @@ -355,6 +376,13 @@ MyWindow::MyWindow(MyDisplay *display, int x, int y, int w, int h) ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | StructureNotifyMask); gc = createGC(); + + XChangeProperty (xd->display, window, + wmProtocolsAtom, + XA_ATOM, 32, PropModeAppend, + (unsigned char *) &wmDeleteWindowAtom, 1); + + } MyWindow::~MyWindow() @@ -376,7 +404,10 @@ GC MyWindow::createGC() return gc; } - +void MyWindow::closeEvent() +{ + windowSurface->handleCloseEvent(); +} void MyWindow::paintEvent() { diff --git a/src/plugins/graphicssystems/testlite/x11util.h b/src/plugins/graphicssystems/testlite/x11util.h index 3d3134f..fbd9ef7 100644 --- a/src/plugins/graphicssystems/testlite/x11util.h +++ b/src/plugins/graphicssystems/testlite/x11util.h @@ -96,7 +96,7 @@ public: void keyPressEvent(XKeyEvent*); void keyReleaseEvent(XKeyEvent*); - + void closeEvent(); void paintEvent(); void resizeEvent(XConfigureEvent *configure_event); void setSize(int w, int h); -- cgit v0.12 From 281f685524eae4d015e4e9069a38ef7d30fceda1 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 9 Oct 2009 15:28:28 +0200 Subject: Small code cleanup --- src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h b/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h index 40428ef..3fd1f12 100644 --- a/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h +++ b/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h @@ -39,15 +39,14 @@ ** ****************************************************************************/ -#ifndef QWINDOWSURFACE_TESTLITE_H -#define QWINDOWSURFACE_TESTLITE_H +#ifndef QWINDOWSURFACE_VNC_H +#define QWINDOWSURFACE_VNC_H #include #include QT_BEGIN_NAMESPACE -class MyWindow; class QVNCGraphicsSystem; class QVNCGraphicsSystemScreen; @@ -69,7 +68,6 @@ public: private: QVNCGraphicsSystem *mGraphicsSystem; QVNCGraphicsSystemScreen *mScreen; - MyWindow *xw; }; QT_END_NAMESPACE -- cgit v0.12 From 240d918f2ebc3a7dd8b683eabc1f2c1b1b8b2143 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 9 Oct 2009 16:07:34 +0200 Subject: Simple example Lighthouse backend that connects to QVFb This is not fully functional, but should be useful for debugging purposes. Only supports one full-screen window. --- src/plugins/graphicssystems/qvfb/main.cpp | 72 ++++ .../graphicssystems/qvfb/qgraphicssystem_qvfb.cpp | 438 +++++++++++++++++++++ .../graphicssystems/qvfb/qgraphicssystem_qvfb.h | 95 +++++ src/plugins/graphicssystems/qvfb/qvfb.pro | 12 + .../graphicssystems/qvfb/qwindowsurface_qvfb.cpp | 104 +++++ .../graphicssystems/qvfb/qwindowsurface_qvfb.h | 74 ++++ 6 files changed, 795 insertions(+) create mode 100644 src/plugins/graphicssystems/qvfb/main.cpp create mode 100644 src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.cpp create mode 100644 src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.h create mode 100644 src/plugins/graphicssystems/qvfb/qvfb.pro create mode 100644 src/plugins/graphicssystems/qvfb/qwindowsurface_qvfb.cpp create mode 100644 src/plugins/graphicssystems/qvfb/qwindowsurface_qvfb.h diff --git a/src/plugins/graphicssystems/qvfb/main.cpp b/src/plugins/graphicssystems/qvfb/main.cpp new file mode 100644 index 0000000..b28dde8 --- /dev/null +++ b/src/plugins/graphicssystems/qvfb/main.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qgraphicssystem_qvfb.h" +#include + +QT_BEGIN_NAMESPACE + +class QVFbGraphicsSystemPlugin : public QGraphicsSystemPlugin +{ +public: + QStringList keys() const; + QGraphicsSystem *create(const QString&); +}; + +QStringList QVFbGraphicsSystemPlugin::keys() const +{ + QStringList list; + list << "QVFb"; + return list; +} + +QGraphicsSystem* QVFbGraphicsSystemPlugin::create(const QString& system) +{ + if (system.toLower() == "qvfb") + return new QVFbGraphicsSystem; + + return 0; +} + +Q_EXPORT_PLUGIN2(qvfb, QVFbGraphicsSystemPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.cpp b/src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.cpp new file mode 100644 index 0000000..10e4e53 --- /dev/null +++ b/src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.cpp @@ -0,0 +1,438 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include // overrides QT_OPEN + +#include +#include + +#include "qgraphicssystem_qvfb.h" +#include "qwindowsurface_qvfb.h" +#include +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + + +class QVFbGraphicsSystemScreenKeyboardHandler : public QObject +{ + Q_OBJECT +public: + QVFbGraphicsSystemScreenKeyboardHandler(); + ~QVFbGraphicsSystemScreenKeyboardHandler(); + +private slots: + void readKeyboardData(); + +private: + int kbdFD; + int kbdIdx; + int kbdBufferLen; + unsigned char *kbdBuffer; + QSocketNotifier *keyNotifier; +}; + +QVFbGraphicsSystemScreenKeyboardHandler::QVFbGraphicsSystemScreenKeyboardHandler() +{ + int displayId = 0; //TODO displayId + const QString keyboardDev = QString::fromLatin1(QT_VFB_KEYBOARD_PIPE) + .arg(displayId); + + + kbdFD = -1; + kbdIdx = 0; + kbdBufferLen = sizeof(QVFbKeyData) * 5; + kbdBuffer = new unsigned char [kbdBufferLen]; + + kbdFD = QT_OPEN(keyboardDev.toLatin1().constData(), O_RDWR | O_NDELAY); + + if (kbdFD == -1) { + perror("QVFbGraphicsSystemScreenKeyboardHandler"); + qWarning("QVFbGraphicsSystemScreenKeyboardHandler: Unable to open device %s", + qPrintable(keyboardDev)); + return; + } + + // Clear pending input + char buf[2]; + while (QT_READ(kbdFD, buf, 1) > 0) { } + + keyNotifier = new QSocketNotifier(kbdFD, QSocketNotifier::Read, this); + connect(keyNotifier, SIGNAL(activated(int)),this, SLOT(readKeyboardData())); + +} + +QVFbGraphicsSystemScreenKeyboardHandler::~QVFbGraphicsSystemScreenKeyboardHandler() +{ + if (kbdFD >= 0) + QT_CLOSE(kbdFD); + delete [] kbdBuffer; +} + + +void QVFbGraphicsSystemScreenKeyboardHandler::readKeyboardData() +{ + int n; + do { + n = QT_READ(kbdFD, kbdBuffer+kbdIdx, kbdBufferLen - kbdIdx); + if (n > 0) + kbdIdx += n; + } while (n > 0); + + int idx = 0; + while (kbdIdx - idx >= (int)sizeof(QVFbKeyData)) { + QVFbKeyData *kd = (QVFbKeyData *)(kbdBuffer + idx); + if (kd->unicode == 0 && kd->keycode == 0 && kd->modifiers == 0 && kd->press) { + // magic exit key + qWarning("Instructed to quit by Virtual Keyboard"); + qApp->quit(); + } + + //QWSServer::processKeyEvent(kd->unicode ? kd->unicode : 0xffff, kd->keycode, kd->modifiers, kd->press, kd->repeat); + + QEvent::Type type = kd->press ? QEvent::KeyPress : QEvent::KeyRelease; + + QString text; + if (kd->unicode && kd->unicode != 0xffff) + text += QChar(kd->unicode); + +// qDebug() << "readKeyboardData" << type << hex << kd->keycode << kd->modifiers << text; + + QKeyEvent ke(type, kd->keycode, kd->modifiers, text, kd->repeat, int(text.length())); + QApplicationPrivate::handleKeyEvent(0, &ke); + idx += sizeof(QVFbKeyData); + } + + int surplus = kbdIdx - idx; + for (int i = 0; i < surplus; i++) + kbdBuffer[i] = kbdBuffer[idx+i]; + kbdIdx = surplus; +} + + + + +class QVFbGraphicsSystemScreenMouseHandler : public QObject +{ + Q_OBJECT +public: + QVFbGraphicsSystemScreenMouseHandler(); + ~QVFbGraphicsSystemScreenMouseHandler(); + +private slots: + void readMouseData(); + +private: + int mouseFD; + int mouseIdx; + enum {mouseBufSize = 128}; + uchar mouseBuf[mouseBufSize]; + QSocketNotifier *mouseNotifier; + + int oldButtonState; +}; + +QVFbGraphicsSystemScreenMouseHandler::QVFbGraphicsSystemScreenMouseHandler() +{ + int displayId = 0; //TODO: displayId + QString mouseDev = QString::fromLatin1(QT_VFB_MOUSE_PIPE) + .arg(displayId); + + mouseFD = QT_OPEN(mouseDev.toLatin1().constData(), O_RDWR | O_NDELAY); + + if (mouseFD == -1) { + perror("QVFbMouseHandler::QVFbMouseHandler"); + qWarning("QVFbMouseHander: Unable to open device %s", + qPrintable(mouseDev)); + return; + } + + // Clear pending input + char buf[2]; + while (QT_READ(mouseFD, buf, 1) > 0) { } + + mouseIdx = 0; + oldButtonState = 0; + mouseNotifier = new QSocketNotifier(mouseFD, QSocketNotifier::Read, this); + connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData())); +} + + +QVFbGraphicsSystemScreenMouseHandler::~QVFbGraphicsSystemScreenMouseHandler() +{ + if (mouseFD >= 0) + QT_CLOSE(mouseFD); +} + +void QVFbGraphicsSystemScreenMouseHandler::readMouseData() +{ + int n; + do { + n = QT_READ(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx); + if (n > 0) + mouseIdx += n; + } while (n > 0); + + int idx = 0; + static const int packetsize = sizeof(QPoint) + 2*sizeof(int); + while (mouseIdx-idx >= packetsize) { + uchar *mb = mouseBuf+idx; + QPoint mousePos = *reinterpret_cast(mb); + mb += sizeof(QPoint); + int bstate = *reinterpret_cast(mb); + mb += sizeof(int); + int wheel = *reinterpret_cast(mb); + + int button = bstate ^ oldButtonState; + QEvent::Type type = QEvent::MouseMove; + + if (button) { + type = (button & bstate) ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; + } + QMouseEvent me(type, mousePos, mousePos, + Qt::MouseButton(button), Qt::MouseButtons(bstate), Qt::NoModifier); + QApplicationPrivate::handleMouseEvent(0, me); + +// qDebug() << "readMouseData" << mousePos << button << bstate << oldButtonState << type; + + oldButtonState = bstate; + + idx += packetsize; + } + + int surplus = mouseIdx - idx; + for (int i = 0; i < surplus; i++) + mouseBuf[i] = mouseBuf[idx+i]; + mouseIdx = surplus; + +} + + +class QVFbGraphicsSystemScreenPrivate +{ +public: + QVFbGraphicsSystemScreenPrivate(QVFbGraphicsSystemScreen *) + : shmrgn(0), hdr(0), data(0), mouseHandler(0), keyboardHandler(0) + { + connect(0); //for now we only handle one screen + } + + ~QVFbGraphicsSystemScreenPrivate() { disconnect(); } + void setDirty(const QRect &r); + + bool connect(int displayId); + void disconnect(); + + QImage *screenImage() { return &img; } + QSize screenSize() { return img.size(); } + + int depth() const { return img.depth(); } + QImage::Format format() const { return img.format(); } + +private: + unsigned char *shmrgn; + QVFbHeader *hdr; + uchar *data; + QVFbGraphicsSystemScreenMouseHandler *mouseHandler; + QVFbGraphicsSystemScreenKeyboardHandler *keyboardHandler; + + + QImage img; +}; + + +void QVFbGraphicsSystemScreenPrivate::setDirty(const QRect &r) +{ + hdr->dirty = true; + hdr->update = hdr->update.united(r); +} + + +bool QVFbGraphicsSystemScreenPrivate::connect(int displayId) +{ + + key_t key = ftok(QByteArray(QT_VFB_MOUSE_PIPE).replace("%1", QByteArray::number(displayId)), 'b'); + + if (key == -1) + return false; + + + int shmId = shmget(key, 0, 0); + if (shmId != -1) + shmrgn = (unsigned char *)shmat(shmId, 0, 0); + else + return false; + + if ((long)shmrgn == -1 || shmrgn == 0) { + qDebug("No shmrgn %ld", (long)shmrgn); + return false; + } + + hdr = (QVFbHeader *)shmrgn; + data = shmrgn + hdr->dataoffset; + + int w = hdr->width; + int h = hdr->height; + int d = hdr->depth; + int lstep = hdr->linestep; + + QImage::Format format = QImage::Format_Invalid; + if (d == 32) + format = QImage::Format_ARGB32_Premultiplied; + else if (d == 16) + format = QImage::Format_RGB16; + + + if (format == QImage::Format_Invalid) { + img = QImage(); + return false; + } + + img = QImage(data, w, h, lstep, format); + + qDebug("connected %dx%d %d bpp", w, h, d); + + + mouseHandler = new QVFbGraphicsSystemScreenMouseHandler; + keyboardHandler = new QVFbGraphicsSystemScreenKeyboardHandler; + return true; +} + +void QVFbGraphicsSystemScreenPrivate::disconnect() +{ + if ((long)shmrgn != -1 && shmrgn) { + shmdt((char*)shmrgn); + shmrgn = 0; + } + delete mouseHandler; + mouseHandler = 0; + delete keyboardHandler; + keyboardHandler = 0; +} + + +QVFbGraphicsSystemScreen::QVFbGraphicsSystemScreen() +{ + d_ptr = new QVFbGraphicsSystemScreenPrivate(this); +} + + +QVFbGraphicsSystemScreen::~QVFbGraphicsSystemScreen() +{ + delete d_ptr; +} + +void QVFbGraphicsSystemScreen::setDirty(const QRect &rect) +{ + d_ptr->setDirty(rect); +} + + + +QRect QVFbGraphicsSystemScreen::geometry() const { + return QRect(QPoint(), d_ptr->screenSize()); +} + + +int QVFbGraphicsSystemScreen::depth() const +{ + return d_ptr->depth(); +} + +QImage::Format QVFbGraphicsSystemScreen::format() const +{ + return d_ptr->format(); +} + +QSize QVFbGraphicsSystemScreen::physicalSize() const { + return (d_ptr->screenSize()*254)/720; +} + +#if 0 +int QVFbGraphicsSystemScreen::linestep() const { + return d_ptr->screenImage() ? d_ptr->screenImage()->bytesPerLine() : 0; +} + +uchar *QVFbGraphicsSystemScreen::base() const { + return d_ptr->screenImage() ? d_ptr->screenImage()->bits() : 0; +} +#endif + +QImage *QVFbGraphicsSystemScreen::screenImage() +{ + return d_ptr->screenImage(); +} + +QVFbGraphicsSystem::QVFbGraphicsSystem() +{ + mPrimaryScreen = new QVFbGraphicsSystemScreen(); + + mScreens.append(mPrimaryScreen); +} + +QPixmapData *QVFbGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const +{ + return new QRasterPixmapData(type); +} + +QWindowSurface *QVFbGraphicsSystem::createWindowSurface(QWidget *widget) const +{ + if (widget->windowType() == Qt::Desktop) + return 0; // Don't create an explicit window surface for the destkop. + return new QVFbWindowSurface + (const_cast(this), mPrimaryScreen, widget); +} + +QT_END_NAMESPACE + +#include "qgraphicssystem_qvfb.moc" diff --git a/src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.h b/src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.h new file mode 100644 index 0000000..b31869c --- /dev/null +++ b/src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_QVFB_H +#define QGRAPHICSSYSTEM_QVFB_H + +#include + +QT_BEGIN_NAMESPACE + + +class QVFbGraphicsSystemScreenPrivate; + +class QVFbGraphicsSystemScreen : public QGraphicsSystemScreen +{ +public: + QVFbGraphicsSystemScreen(); + ~QVFbGraphicsSystemScreen(); + + QRect geometry() const; + int depth() const; + QImage::Format format() const; + QSize physicalSize() const; + + QImage *screenImage(); + + void setDirty(const QRect &rect); + +public: + + QVFbGraphicsSystemScreenPrivate *d_ptr; +}; + +class QVFbGraphicsSystemPrivate; + + +class QVFbGraphicsSystem : public QGraphicsSystem +{ +public: + QVFbGraphicsSystem(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QWindowSurface *createWindowSurface(QWidget *widget) const; + + QList screens() const { return mScreens; } + +private: + QVFbGraphicsSystemScreen *mPrimaryScreen; + QList mScreens; +}; + + + +QT_END_NAMESPACE + + +#endif diff --git a/src/plugins/graphicssystems/qvfb/qvfb.pro b/src/plugins/graphicssystems/qvfb/qvfb.pro new file mode 100644 index 0000000..b321725 --- /dev/null +++ b/src/plugins/graphicssystems/qvfb/qvfb.pro @@ -0,0 +1,12 @@ +TARGET = qvfbgraphicssystem +include(../../qpluginbase.pri) + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems + + + +SOURCES = main.cpp qgraphicssystem_qvfb.cpp qwindowsurface_qvfb.cpp +HEADERS = qgraphicssystem_qvfb.h qwindowsurface_qvfb.h + +target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +INSTALLS += target diff --git a/src/plugins/graphicssystems/qvfb/qwindowsurface_qvfb.cpp b/src/plugins/graphicssystems/qvfb/qwindowsurface_qvfb.cpp new file mode 100644 index 0000000..c49f082 --- /dev/null +++ b/src/plugins/graphicssystems/qvfb/qwindowsurface_qvfb.cpp @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include "qwindowsurface_qvfb.h" +#include "qgraphicssystem_qvfb.h" +#include +#include +#include + +QT_BEGIN_NAMESPACE + +QVFbWindowSurface::QVFbWindowSurface(QVFbGraphicsSystem *graphicsSystem, + QVFbGraphicsSystemScreen *screen, QWidget *window) + : QWindowSurface(window), + mScreen(screen) +{ +} + +QVFbWindowSurface::~QVFbWindowSurface() +{ +} + +QPaintDevice *QVFbWindowSurface::paintDevice() +{ + return mScreen->screenImage(); +} + +void QVFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + Q_UNUSED(offset); + + QRect rect = geometry(); + QPoint topLeft = rect.topLeft(); + + mScreen->setDirty(region.boundingRect()); +} + +void QVFbWindowSurface::setGeometry(const QRect &) +{ + +// any size you like as long as it's full-screen... + + QRect rect(mScreen->availableGeometry()); + QApplicationPrivate::handleGeometryChange(this->window(), rect); + + QWindowSurface::setGeometry(rect); +} + +bool QVFbWindowSurface::scroll(const QRegion &area, int dx, int dy) +{ + return QWindowSurface::scroll(area, dx, dy); +} + +void QVFbWindowSurface::beginPaint(const QRegion ®ion) +{ + Q_UNUSED(region); +} + +void QVFbWindowSurface::endPaint(const QRegion ®ion) +{ + Q_UNUSED(region); +} + +QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/qvfb/qwindowsurface_qvfb.h b/src/plugins/graphicssystems/qvfb/qwindowsurface_qvfb.h new file mode 100644 index 0000000..1971caa --- /dev/null +++ b/src/plugins/graphicssystems/qvfb/qwindowsurface_qvfb.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSURFACE_QVFB_H +#define QWINDOWSURFACE_QVFB_H + +#include + +QT_BEGIN_NAMESPACE + +class QVFbGraphicsSystem; +class QVFbGraphicsSystemScreen; + +class QVFbWindowSurface : public QWindowSurface +{ +public: + QVFbWindowSurface(QVFbGraphicsSystem *graphicsSystem, + QVFbGraphicsSystemScreen *screen, QWidget *window); + ~QVFbWindowSurface(); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void setGeometry(const QRect &rect); + bool scroll(const QRegion &area, int dx, int dy); + + void beginPaint(const QRegion ®ion); + void endPaint(const QRegion ®ion); + +private: + QVFbGraphicsSystem *mGraphicsSystem; + QVFbGraphicsSystemScreen *mScreen; +}; + +QT_END_NAMESPACE + +#endif -- cgit v0.12 From 976f07cbc50a9875d5a094dfd4f3c2d47cba52b4 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 9 Oct 2009 17:08:29 +0200 Subject: Remove some more debug output --- src/gui/kernel/qapplication_lite.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 6d4f30b..0615073 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -127,7 +127,6 @@ static bool qt_try_modal(QWidget *widget, const QEvent *event) void QApplicationPrivate::enterModal_sys(QWidget *widget) { - qDebug() << ">>>>>>>> enterModal_sys" << app_do_modal << widget; if (!qt_modal_stack) qt_modal_stack = new QWidgetList; qt_modal_stack->insert(0, widget); @@ -136,7 +135,6 @@ void QApplicationPrivate::enterModal_sys(QWidget *widget) void QApplicationPrivate::leaveModal_sys(QWidget *widget ) { - qDebug() << "<<<<<<<<< leaveModal_sys" << app_do_modal << widget; if (qt_modal_stack && qt_modal_stack->removeAll(widget)) { if (qt_modal_stack->isEmpty()) { delete qt_modal_stack; -- cgit v0.12 From 0be3fc435c0ada8d5f93389cdf4c96193f015f8f Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 9 Oct 2009 18:05:48 +0200 Subject: Add support for wheel events --- src/gui/kernel/qapplication_lite.cpp | 40 ++++++++++++++++++++++ src/gui/kernel/qapplication_p.h | 1 + .../testlite/qwindowsurface_testlite.cpp | 17 +++++++++ 3 files changed, 58 insertions(+) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 0615073..f551228 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -575,6 +575,45 @@ void QApplicationPrivate::handleMouseEvent(QWidget *tlw, const QMouseEvent &ev) } +//### there's a lot of duplicated logic here -- refactoring required! + +void QApplicationPrivate::handleWheelEvent(QWidget *tlw, QWheelEvent &ev) +{ +// QPoint localPoint = ev.pos(); + QPoint globalPoint = ev.globalPos(); +// bool trustLocalPoint = !!tlw; //is there something the local point can be local to? + QWidget *mouseWidget = tlw; + + qt_last_x = globalPoint.x(); + qt_last_y = globalPoint.y(); + + QWidget *mouseWindow = tlw; + + // find the tlw if we didn't get it from the plugin + if (!mouseWindow) { + mouseWindow = QApplication::topLevelAt(globalPoint); + } + + if (!mouseWindow) + return; + + if (app_do_modal && !qt_try_modal(mouseWindow, &ev) ) { + qDebug() << "modal blocked wheel event" << mouseWindow; + return; + } + QPoint p = mouseWindow->mapFromGlobal(globalPoint); + QWidget *w = mouseWindow->childAt(p); + if (w) { + mouseWidget = w; + p = mouseWidget->mapFromGlobal(globalPoint); + } + + QWheelEvent e(p, globalPoint, ev.delta(), ev.buttons(), ev.modifiers(), + ev.orientation()); + QApplication::sendSpontaneousEvent(mouseWidget, &e); +} + + // Remember, Qt convention is: keyboard state is state *before* @@ -628,4 +667,5 @@ void QApplicationPrivate::handleCloseEvent(QWidget *tlw) tlw->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent); } + QT_END_NAMESPACE diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 9cd3f4c..32004ba 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -582,6 +582,7 @@ public: static void handleKeyEvent(QWidget *tlw, QKeyEvent *e); static void handleGeometryChange(QWidget *tlw, const QRect &newRect); static void handleCloseEvent(QWidget *tlw); + static void handleWheelEvent(QWidget *tlw, QWheelEvent &e); #endif #if defined(Q_WS_S60) diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp index 2ad3224..c2ad094 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp @@ -174,6 +174,23 @@ void QTestLiteWindowSurface::handleMouseEvent(QEvent::Type type, void *ev) case Button1: button = Qt::LeftButton; break; case Button2: button = Qt::MidButton; break; case Button3: button = Qt::RightButton; break; + case Button4: + case Button5: + case 6: + case 7: { + //mouse wheel + if (type == QEvent::MouseButtonPress) { + //logic borrowed from qapplication_x11.cpp + int delta = 120 * ((e->button == Button4 || e->button == 6) ? 1 : -1); + bool hor = (((e->button == Button4 || e->button == Button5) + && (modifiers & Qt::AltModifier)) + || (e->button == 6 || e->button == 7)); + QWheelEvent we(QPoint(e->x, e->y), QPoint(e->x_root, e->y_root), delta, + buttons, modifiers, hor ? Qt::Horizontal : Qt::Vertical); + QApplicationPrivate::handleWheelEvent(window(),we); + } + return; + } default: break; } } -- cgit v0.12 From 7a078ab4f9abf814766c310ab41575d89bb622ce Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 12 Oct 2009 15:07:49 +0200 Subject: Make tooltips work. --- src/gui/kernel/qwidget_lite.cpp | 2 +- src/plugins/graphicssystems/testlite/x11util.cpp | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index dfcbeaa..1c48e10 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -284,7 +284,7 @@ void QWidgetPrivate::show_sys() surface->setVisible(true); } - if (q->windowType() != Qt::Popup) + if (q->windowType() != Qt::Popup && q->windowType() != Qt::ToolTip && !(q->windowFlags() & Qt::X11BypassWindowManagerHint)) q->activateWindow(); //### } diff --git a/src/plugins/graphicssystems/testlite/x11util.cpp b/src/plugins/graphicssystems/testlite/x11util.cpp index 6c8377a..e4d3e89 100644 --- a/src/plugins/graphicssystems/testlite/x11util.cpp +++ b/src/plugins/graphicssystems/testlite/x11util.cpp @@ -219,7 +219,7 @@ bool MyDisplay::handleEvent(XEvent *xe) } } if (!xw) { - qWarning() << "Unknown window" << xe->xany.window << "received event" << hex << xe->type; + qWarning() << "Unknown window" << hex << xe->xany.window << "received event" << xe->type; return quit; } @@ -358,13 +358,16 @@ MyWindow::MyWindow(MyDisplay *display, int x, int y, int w, int h) xd->windowList.append(this); -#ifdef MYX11_DEBUG - qDebug() << "MyWindow::MyWindow"; -#endif window = XCreateSimpleWindow(xd->display, xd->rootWindow(), x, y, w, h, 0 /*border_width*/, xd->blackPixel(), xd->whitePixel()); + +#ifdef MYX11_DEBUG + qDebug() << "MyWindow::MyWindow" << hex << window; +#endif + + width = -1; height = -1; xpos = -1; @@ -373,7 +376,8 @@ MyWindow::MyWindow(MyDisplay *display, int x, int y, int w, int h) XSetWindowBackgroundPixmap(xd->display, window, XNone); XSelectInput(xd->display, window, ExposureMask | KeyPressMask | KeyReleaseMask | - ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | StructureNotifyMask); + PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | + StructureNotifyMask); gc = createGC(); @@ -387,6 +391,9 @@ MyWindow::MyWindow(MyDisplay *display, int x, int y, int w, int h) MyWindow::~MyWindow() { +#ifdef MYX11_DEBUG + qDebug() << "~MyWindow" << hex << window; +#endif XFreeGC(xd->display, gc); XDestroyWindow(xd->display, window); -- cgit v0.12 From 09a75f3dd9a005b648111af6373660c0f48e772f Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 12 Oct 2009 15:27:29 +0200 Subject: Implement mouse double clicks for testlite. --- src/plugins/graphicssystems/testlite/x11util.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/plugins/graphicssystems/testlite/x11util.cpp b/src/plugins/graphicssystems/testlite/x11util.cpp index e4d3e89..fc442a2 100644 --- a/src/plugins/graphicssystems/testlite/x11util.cpp +++ b/src/plugins/graphicssystems/testlite/x11util.cpp @@ -44,6 +44,7 @@ #include #include +#include #include "x11util.h" #include "qwindowsurface_testlite.h" @@ -385,8 +386,6 @@ MyWindow::MyWindow(MyDisplay *display, int x, int y, int w, int h) wmProtocolsAtom, XA_ATOM, 32, PropModeAppend, (unsigned char *) &wmDeleteWindowAtom, 1); - - } MyWindow::~MyWindow() @@ -466,7 +465,25 @@ void MyWindow::setGeometry(int x, int y, int w, int h) void MyWindow::mousePressEvent(XButtonEvent *e) { - windowSurface->handleMouseEvent(QEvent::MouseButtonPress, e); + static long prevTime = 0; + static Window prevWindow; + static int prevX = -999; + static int prevY = -999; + + QEvent::Type type = QEvent::MouseButtonPress; + + if (e->window == prevWindow && long(e->time) - prevTime < QApplication::doubleClickInterval() + && qAbs(e->x - prevX) < 5 && qAbs(e->y - prevY) < 5) { + type = QEvent::MouseButtonDblClick; + prevTime = e->time - QApplication::doubleClickInterval(); //no double click next time + } else { + prevTime = e->time; + } + prevWindow = e->window; + prevX = e->x; + prevY = e->y; + + windowSurface->handleMouseEvent(type, e); } void MyWindow::mouseReleaseEvent(XButtonEvent *e) -- cgit v0.12 From 7d27d9732e1f528396b27022720d60d38fe9717a Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Wed, 30 Sep 2009 13:57:33 +0200 Subject: Fix auto-test build. Reviewed-by:jesper --- tests/auto/qlistview/tst_qlistview.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index 499fb0b..d9cab02 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -59,6 +59,8 @@ #include #endif +#include "../../shared/util.h" + //TESTED_CLASS= //TESTED_FILES= -- cgit v0.12 From ba321e277e392c276c1ff8b32f8fca7d26ed0fbe Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 14 Oct 2009 11:29:18 +0200 Subject: Function keys --- src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp index c2ad094..bec0b60 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp @@ -475,6 +475,9 @@ static const unsigned int keyTbl[] = { static int lookupCode(unsigned int xkeycode) { + if (xkeycode >= XK_F1 && xkeycode <= XK_F35) + return Qt::Key_F1 + (int(xkeycode) - XK_F1); + const unsigned int *p = keyTbl; while (*p) { if (*p == xkeycode) -- cgit v0.12 From 9a5fce0d7d66e0635678eb129f765b39ea11e600 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 14 Oct 2009 09:29:57 +0200 Subject: Fix some autotest failures and get rid of some compiler warnings --- src/gui/image/qpixmap.cpp | 6 ++++-- src/gui/kernel/qapplication.cpp | 2 +- src/gui/kernel/qapplication_lite.cpp | 20 ++++++++++++++++++++ src/gui/kernel/qwidget.cpp | 15 +++++++++++++-- src/gui/kernel/qwidget_lite.cpp | 3 +++ src/plugins/graphicssystems/testlite/x11util.cpp | 2 ++ tests/auto/qaction/tst_qaction.cpp | 2 +- 7 files changed, 44 insertions(+), 6 deletions(-) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 558ae54..21fb23e 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -1689,8 +1689,8 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) In addition, on Symbian, the QPixmap class supports conversion to and from CFbsBitmap: the toSymbianCFbsBitmap() function creates - CFbsBitmap equivalent to the QPixmap, based on given mode and returns - a CFbsBitmap object. The fromSymbianCFbsBitmap() function returns a + CFbsBitmap equivalent to the QPixmap, based on given mode and returns + a CFbsBitmap object. The fromSymbianCFbsBitmap() function returns a QPixmap that is equivalent to the given bitmap and given mode. \section1 Pixmap Transformations @@ -1874,6 +1874,8 @@ int QPixmap::defaultDepth() return 32; #elif defined(Q_OS_SYMBIAN) return S60->screenDepth; +#elif defined(Q_WS_LITE) + return 32; //LITE: use graphicssystem (we should do that in general) #endif } diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 613dbb5..77e6ea8 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -757,7 +757,7 @@ void QApplicationPrivate::construct( { initResources(); - graphics_system_name = qgetenv("QT_DEFAULT_GRAPHICS_SYSTEM"); + graphics_system_name = QLatin1String(qgetenv("QT_DEFAULT_GRAPHICS_SYSTEM")); qt_is_gui_used = (qt_appType != QApplication::Tty); process_cmdline(); diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index f551228..8c3f7f5 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -477,9 +477,29 @@ void qt_cleanup() #endif QFont::cleanup(); QColormap::cleanup(); + delete QApplicationPrivate::inputContext; + QApplicationPrivate::inputContext = 0; + + QApplicationPrivate::active_window = 0; //### this should not be necessary } +#ifdef QT3_SUPPORT +void QApplication::setMainWidget(QWidget *mainWidget) +{ + QApplicationPrivate::main_widget = mainWidget; + if (QApplicationPrivate::main_widget && windowIcon().isNull() + && QApplicationPrivate::main_widget->testAttribute(Qt::WA_SetWindowIcon)) + setWindowIcon(QApplicationPrivate::main_widget->windowIcon()); +} +#endif + + +//------------------------------------------------------------ +// +// Callback functions for plugins: +// + /*! \a tlw == 0 means that \a ev is in global coords only diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 3217222..1abbd9f 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1444,7 +1444,7 @@ QWidget::~QWidget() } } -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) //### LITE else if (!internalWinId() && isVisible()) { qApp->d_func()->sendSyntheticEnterLeave(this); #ifdef Q_WS_QWS @@ -2319,7 +2319,10 @@ WId QWidget::effectiveWinId() const return id; QWidget *realParent = nativeParentWidget(); Q_ASSERT(realParent); +#ifndef Q_WS_LITE + //### we really need to implement winId functionality Q_ASSERT(realParent->internalWinId()); +#endif return realParent->internalWinId(); } @@ -4004,6 +4007,9 @@ QWidget *QWidget::window() const */ QWidget *QWidget::nativeParentWidget() const { +#ifdef Q_WS_LITE + return window(); //### we don't have native child widgets yet +#endif QWidget *parent = parentWidget(); while (parent && !parent->internalWinId()) parent = parent->parentWidget(); @@ -10145,6 +10151,11 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) Q_ASSERT_X(sizeof(d->high_attributes)*8 >= (Qt::WA_AttributeCount - sizeof(uint)*8), "QWidget::setAttribute(WidgetAttribute, bool)", "QWidgetPrivate::high_attributes[] too small to contain all attributes in WidgetAttribute"); +#ifdef Q_WS_LITE + //### we don't have native child widgets, and WinId isn't really there yet + if (attribute == Qt::WA_NativeWindow) + return; +#endif #ifdef Q_WS_WIN // ### Don't use PaintOnScreen+paintEngine() to do native painting in 5.0 @@ -11454,7 +11465,7 @@ QWidget *QWidgetPrivate::widgetInNavigationDirection(Direction direction) QWidget *targetWidget = 0; int shortestDistance = INT_MAX; foreach(QWidget *targetCandidate, QApplication::allWidgets()) { - + if (targetCandidate->focusProxy()) //skip if focus proxy set continue; diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index 1c48e10..cab8cda 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -78,6 +78,9 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) if ((windowType() == Qt::Popup)) qApp->d_func()->closePopup(this); + //### we don't have proper focus event handling yet + if (this == QApplicationPrivate::active_window) + QApplication::setActiveWindow(0); } void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) diff --git a/src/plugins/graphicssystems/testlite/x11util.cpp b/src/plugins/graphicssystems/testlite/x11util.cpp index fc442a2..41767c9 100644 --- a/src/plugins/graphicssystems/testlite/x11util.cpp +++ b/src/plugins/graphicssystems/testlite/x11util.cpp @@ -220,7 +220,9 @@ bool MyDisplay::handleEvent(XEvent *xe) } } if (!xw) { +#ifdef MYX11_DEBUG qWarning() << "Unknown window" << hex << xe->xany.window << "received event" << xe->type; +#endif return quit; } diff --git a/tests/auto/qaction/tst_qaction.cpp b/tests/auto/qaction/tst_qaction.cpp index 4aad8ca..1e3b143 100644 --- a/tests/auto/qaction/tst_qaction.cpp +++ b/tests/auto/qaction/tst_qaction.cpp @@ -242,7 +242,7 @@ void tst_QAction::setStandardKeys() QList expected; #if defined(Q_WS_MAC) || defined(Q_OS_SYMBIAN) expected << QKeySequence("CTRL+C"); -#elif defined(Q_WS_WIN) || defined(Q_WS_QWS) +#elif defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_LITE) expected << QKeySequence("CTRL+C") << QKeySequence("CTRL+INSERT"); #else expected << QKeySequence("CTRL+C") << QKeySequence("F16") << QKeySequence("CTRL+INSERT"); -- cgit v0.12 From 58073ea549f50b8de46902e45c111473a5c8d9fa Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 14 Oct 2009 13:26:03 +0200 Subject: Repaint when window is resized. Some of this ought to be done in Qt, and should not be the responsibility of the plugin. --- .../testlite/qwindowsurface_testlite.cpp | 20 +++++++++++++++++--- .../testlite/qwindowsurface_testlite.h | 1 + src/plugins/graphicssystems/testlite/x11util.cpp | 3 +++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp index bec0b60..087fb1c 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp @@ -89,13 +89,26 @@ void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const xw->paintEvent(); } -void QTestLiteWindowSurface::setGeometry(const QRect &rect) + +void QTestLiteWindowSurface::geometryChanged(const QRect &rect) { - //qDebug() << "QTestLiteWindowSurface::setGeometry:" << rect << xw->window; QWindowSurface::setGeometry(rect); - if (xw->img.size() != rect.size()) + if (xw->img.size() != rect.size()) { xw->img = QImage(rect.size(), mScreen->format()); + window()->update(); //### this is the wrong place for this... + } + +} + + +void QTestLiteWindowSurface::setGeometry(const QRect &rect) +{ + QRect oldRect = geometry(); + if (rect == oldRect) + return; + + QTestLiteWindowSurface::geometryChanged(rect); //if unchanged ### // xw->setSize(rect.width(), rect.height()); @@ -212,6 +225,7 @@ void QTestLiteWindowSurface::handleMouseEvent(QEvent::Type type, void *ev) void QTestLiteWindowSurface::handleGeometryChange(int x, int y, int w, int h) { + geometryChanged(QRect(x,y,w,h)); QApplicationPrivate::handleGeometryChange(window(), QRect(x,y,w,h)); } diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h index 7edc448..44a8d57 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h @@ -62,6 +62,7 @@ public: QPaintDevice *paintDevice(); void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); void setGeometry(const QRect &rect); + void geometryChanged(const QRect &rect); bool scroll(const QRegion &area, int dx, int dy); void beginPaint(const QRegion ®ion); diff --git a/src/plugins/graphicssystems/testlite/x11util.cpp b/src/plugins/graphicssystems/testlite/x11util.cpp index 41767c9..d744e28 100644 --- a/src/plugins/graphicssystems/testlite/x11util.cpp +++ b/src/plugins/graphicssystems/testlite/x11util.cpp @@ -450,6 +450,9 @@ void MyWindow::resizeEvent(XConfigureEvent *e) width = e->width; height = e->height; +#ifdef MYX11_DEBUG + qDebug() << hex << window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << "geometry" << xpos << ypos << width << height; +#endif windowSurface->handleGeometryChange(xpos, ypos, width, height); } -- cgit v0.12 From 1dcdfda53128e745edc3aaa16e659c273cc77cd7 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 14 Oct 2009 13:56:56 +0200 Subject: Make tooltips work better --- src/plugins/graphicssystems/testlite/x11util.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/graphicssystems/testlite/x11util.cpp b/src/plugins/graphicssystems/testlite/x11util.cpp index d744e28..26076b1 100644 --- a/src/plugins/graphicssystems/testlite/x11util.cpp +++ b/src/plugins/graphicssystems/testlite/x11util.cpp @@ -640,6 +640,7 @@ Qt::WindowFlags MyWindow::setWindowFlags(Qt::WindowFlags flags) bool tool = (type == Qt::Tool || type == Qt::SplashScreen || type == Qt::ToolTip || type == Qt::Drawer); + bool tooltip = (type == Qt::ToolTip); XSetWindowAttributes wsa; @@ -723,7 +724,7 @@ Qt::WindowFlags MyWindow::setWindowFlags(Qt::WindowFlags flags) //##### only if initializeWindow??? - if (popup) { // popup widget + if (popup || tooltip) { // popup widget #ifdef MYX11_DEBUG qDebug() << "Doing XChangeWindowAttributes for popup" << wsa.override_redirect; #endif -- cgit v0.12 From 7750f3821c7cd526c33bfa09378378da3980a2e6 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 14 Oct 2009 13:45:21 +0200 Subject: basic support for multiple top level windows in the VNC backend This supports a simple stack of windows, with the most recently created sitting on top. --- .../graphicssystems/vnc/qgraphicssystem_vnc.cpp | 28 ++++++++++++++++++- .../graphicssystems/vnc/qgraphicssystem_vnc.h | 7 +++++ .../graphicssystems/vnc/qwindowsurface_vnc.cpp | 32 +++++++++++++++------- .../graphicssystems/vnc/qwindowsurface_vnc.h | 3 ++ 4 files changed, 59 insertions(+), 11 deletions(-) diff --git a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp index 9a7c198..b50e5b5 100644 --- a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp +++ b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp @@ -45,6 +45,7 @@ #include #include +#include @@ -77,6 +78,23 @@ QVNCDirtyMap *QVNCGraphicsSystemScreen::dirtyMap() void QVNCGraphicsSystemScreen::setDirty(const QRect &rect) { + QPainter compositePainter(mScreenImage); + + // Blank the affected area, just in case there's nothing to display here + // Question - What's the background color? + // Another option would be to push a base level window that is the size of the display + + compositePainter.fillRect(rect, Qt::black); + + for (int i = 0; i < windowStack.length(); i++) { + QRect windowRect = windowStack[i]->geometry(); + QRect intersect = windowRect.intersected(rect); + QRect windowIntersect = intersect.translated(-windowRect.left(), + -windowRect.top()); + compositePainter.drawImage(intersect, windowStack[i]->image(), + windowIntersect); + } + d_ptr->setDirty(rect); } @@ -104,6 +122,14 @@ QWindowSurface *QVNCGraphicsSystem::createWindowSurface(QWidget *widget) const { if (widget->windowType() == Qt::Desktop) return 0; // Don't create an explicit window surface for the destkop. - return new QVNCWindowSurface + QVNCWindowSurface * newSurface = new QVNCWindowSurface (const_cast(this), mPrimaryScreen, widget); + mPrimaryScreen->addWindowSurface(newSurface); + return newSurface; +} + +void QVNCGraphicsSystemScreen::removeWindowSurface(QVNCWindowSurface * surface) +{ + windowStack.removeOne(surface); + setDirty(surface->geometry()); } diff --git a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h index 375b467..d593096 100644 --- a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h +++ b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h @@ -43,6 +43,7 @@ #define QGRAPHICSSYSTEM_VNC_H #include +#include "qwindowsurface_vnc.h" QT_BEGIN_NAMESPACE @@ -68,6 +69,9 @@ public: void setDirty(const QRect &rect); + void removeWindowSurface(QVNCWindowSurface * surface); + void addWindowSurface(QVNCWindowSurface * surface) { windowStack.append(surface); } + public: QRect mGeometry; int mDepth; @@ -77,6 +81,8 @@ public: QVNCServer *server; QVNCGraphicsSystemScreenPrivate *d_ptr; +private: + QList windowStack; }; class QVNCGraphicsSystemPrivate; @@ -92,6 +98,7 @@ public: QList screens() const { return mScreens; } + private: QVNCGraphicsSystemScreen *mPrimaryScreen; QList mScreens; diff --git a/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp b/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp index 07668fb..af171f5 100644 --- a/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp +++ b/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp @@ -53,15 +53,17 @@ QVNCWindowSurface::QVNCWindowSurface(QVNCGraphicsSystem *graphicsSystem, : QWindowSurface(window), mScreen(screen) { + mImage = QImage(window->size(), mScreen->format()); } QVNCWindowSurface::~QVNCWindowSurface() { + mScreen->removeWindowSurface(this); } QPaintDevice *QVNCWindowSurface::paintDevice() { - return mScreen->mScreenImage; + return &mImage; } void QVNCWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) @@ -69,20 +71,30 @@ void QVNCWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoi Q_UNUSED(widget); Q_UNUSED(offset); - QRect rect = geometry(); - QPoint topLeft = rect.topLeft(); - - mScreen->setDirty(region.boundingRect()); - // server->flush(region); - + QRect currentGeometry = geometry(); + // If this is a move, redraw the previous location + if (oldGeometry != currentGeometry) { + mScreen->setDirty(oldGeometry); + oldGeometry = currentGeometry; + } + + QRect dirtyClient = region.boundingRect(); + QRect dirtyRegion(currentGeometry.left() + dirtyClient.left(), + currentGeometry.top() + dirtyClient.top(), + dirtyClient.width(), + dirtyClient.height()); + mScreen->setDirty(dirtyRegion); } -void QVNCWindowSurface::setGeometry(const QRect &) +void QVNCWindowSurface::setGeometry(const QRect &rect) { + // store previous geometry for screen update + oldGeometry = geometry(); -// any size you like as long as it's full-screen... + // change the widget's QImage if this is a resize + if (mImage.size() != rect.size()) + mImage = QImage(rect.size(), mScreen->format()); - QRect rect(mScreen->availableGeometry()); QApplicationPrivate::handleGeometryChange(this->window(), rect); QWindowSurface::setGeometry(rect); diff --git a/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h b/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h index 3fd1f12..b9af493 100644 --- a/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h +++ b/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h @@ -64,10 +64,13 @@ public: void beginPaint(const QRegion ®ion); void endPaint(const QRegion ®ion); + inline const QImage image() { return mImage; } private: QVNCGraphicsSystem *mGraphicsSystem; QVNCGraphicsSystemScreen *mScreen; + QRect oldGeometry; + QImage mImage; }; QT_END_NAMESPACE -- cgit v0.12 From eb9c3bee3cef8660cb2a05012f41f183a64c40de Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 15 Oct 2009 15:31:38 +0200 Subject: Fix popup mouse event delivery and start implementing enter/leave events If a popup has children, make sure to deliver mouse event to the child instead of the window. --- src/gui/kernel/qapplication_lite.cpp | 71 ++++++++++++---------- src/gui/kernel/qapplication_p.h | 2 + .../testlite/qwindowsurface_testlite.cpp | 8 +++ .../testlite/qwindowsurface_testlite.h | 2 + src/plugins/graphicssystems/testlite/x11util.cpp | 42 +++++++++++-- src/plugins/graphicssystems/testlite/x11util.h | 5 +- 6 files changed, 91 insertions(+), 39 deletions(-) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 8c3f7f5..884cfac 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -451,9 +451,6 @@ void qt_init(QApplicationPrivate *priv, int type) } #endif - - qDebug() << pluginList; - init_plugins(pluginList); QColormap::initialize(); @@ -507,6 +504,17 @@ void QApplication::setMainWidget(QWidget *mainWidget) */ + +void QApplicationPrivate::handleEnterEvent(QWidget *tlw) +{ + dispatchEnterLeave(tlw, 0); +} + +void QApplicationPrivate::handleLeaveEvent(QWidget *tlw) +{ + dispatchEnterLeave(0, tlw); +} + void QApplicationPrivate::handleMouseEvent(QWidget *tlw, const QMouseEvent &ev) { // qDebug() << "handleMouseEvent" << tlw << ev.pos() << hex << ev.buttons(); @@ -516,15 +524,15 @@ void QApplicationPrivate::handleMouseEvent(QWidget *tlw, const QMouseEvent &ev) QPoint localPoint = ev.pos(); QPoint globalPoint = ev.globalPos(); bool trustLocalPoint = !!tlw; //is there something the local point can be local to? - QWidget *mouseWidget = tlw; + QWidget *mouseWindow = tlw; qt_last_x = globalPoint.x(); qt_last_y = globalPoint.y(); if (self->inPopupMode()) { //popup mouse handling is magical... - mouseWidget = qApp->activePopupWidget(); - trustLocalPoint = (mouseWidget == tlw); + mouseWindow = qApp->activePopupWidget(); + trustLocalPoint = (mouseWindow == tlw); //### how should popup mode and implicit mouse grab interact? @@ -532,41 +540,40 @@ void QApplicationPrivate::handleMouseEvent(QWidget *tlw, const QMouseEvent &ev) //even if we're blocked by modality, we should deliver the mouse release event.. //### this code is not completely correct: multiple buttons can be pressed simultaneously if (!(implicit_mouse_grabber && ev.buttons() == Qt::NoButton)) { - //qDebug() << "modal blocked mouse event to" << tlw; + qDebug() << "modal blocked mouse event to" << tlw; return; } - } else { - QWidget *mouseWindow = tlw; + } - // find the tlw if we didn't get it from the plugin - if (!mouseWindow) { - mouseWindow = QApplication::topLevelAt(globalPoint); - } + // find the tlw if we didn't get it from the plugin + if (!mouseWindow) { + mouseWindow = QApplication::topLevelAt(globalPoint); + } - if (!mouseWindow && !implicit_mouse_grabber) - return; //nowhere to send it + if (!mouseWindow && !implicit_mouse_grabber) + return; //nowhere to send it - // which child should have it? - mouseWidget = mouseWindow; - if (mouseWindow) { - QWidget *w = mouseWindow->childAt(ev.pos()); - if (w) { - mouseWidget = w; - } + // which child should have it? + QWidget *mouseWidget = mouseWindow; + if (mouseWindow) { + QWidget *w = mouseWindow->childAt(ev.pos()); + if (w) { + mouseWidget = w; } + } - //handle implicit mouse grab - if (ev.type() == QEvent::MouseButtonPress && !implicit_mouse_grabber) { - implicit_mouse_grabber = mouseWidget; + //handle implicit mouse grab + if (ev.type() == QEvent::MouseButtonPress && !implicit_mouse_grabber) { + implicit_mouse_grabber = mouseWidget; - Q_ASSERT(mouseWindow); - mouseWindow->activateWindow(); //focus - } else if (implicit_mouse_grabber) { - mouseWidget = implicit_mouse_grabber; - mouseWindow = mouseWidget->window(); - trustLocalPoint = (mouseWindow == tlw); - } + Q_ASSERT(mouseWindow); + mouseWindow->activateWindow(); //focus + } else if (implicit_mouse_grabber) { + mouseWidget = implicit_mouse_grabber; + mouseWindow = mouseWidget->window(); + trustLocalPoint = (mouseWindow == tlw); } + Q_ASSERT(mouseWidget); if (trustLocalPoint) { diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 52d0642..a5496d6 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -566,6 +566,8 @@ public: static void handleGeometryChange(QWidget *tlw, const QRect &newRect); static void handleCloseEvent(QWidget *tlw); static void handleWheelEvent(QWidget *tlw, QWheelEvent &e); + static void handleEnterEvent(QWidget *tlw); + static void handleLeaveEvent(QWidget *tlw); #endif #if defined(Q_WS_S60) diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp index 087fb1c..e0b9b9f 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp @@ -236,7 +236,15 @@ void QTestLiteWindowSurface::handleCloseEvent() } +void QTestLiteWindowSurface::handleEnterEvent() +{ + QApplicationPrivate::handleEnterEvent(window()); +} +void QTestLiteWindowSurface::handleLeaveEvent() +{ + QApplicationPrivate::handleLeaveEvent(window()); +} //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h index 44a8d57..af57c0b 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h @@ -72,6 +72,8 @@ public: void handleKeyEvent(QEvent::Type, void *); void handleGeometryChange(int x, int y, int w, int h); void handleCloseEvent(); + void handleEnterEvent(); + void handleLeaveEvent(); Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); Qt::WindowFlags windowFlags() const; diff --git a/src/plugins/graphicssystems/testlite/x11util.cpp b/src/plugins/graphicssystems/testlite/x11util.cpp index 26076b1..0c6f3c5 100644 --- a/src/plugins/graphicssystems/testlite/x11util.cpp +++ b/src/plugins/graphicssystems/testlite/x11util.cpp @@ -252,7 +252,6 @@ bool MyDisplay::handleEvent(XEvent *xe) if (xw) xw->resizeEvent(&xe->xconfigure); break; -#if 1 case ButtonPress: xw->mousePressEvent(&xe->xbutton); @@ -273,11 +272,18 @@ bool MyDisplay::handleEvent(XEvent *xe) case XKeyRelease: xw->keyReleaseEvent(&xe->xkey); break; -#endif + + case EnterNotify: + xw->enterEvent(&xe->xcrossing); + break; + + case LeaveNotify: + xw->leaveEvent(&xe->xcrossing); + break; default: #ifdef MYX11_DEBUG - qDebug() << "Other X event" << hex << xe->type; + qDebug() << hex << xe->xany.window << "Other X event" << xe->type; #endif break; } @@ -285,6 +291,7 @@ bool MyDisplay::handleEvent(XEvent *xe) }; + MyDisplay::MyDisplay() { char *display_name = getenv("DISPLAY"); @@ -379,6 +386,7 @@ MyWindow::MyWindow(MyDisplay *display, int x, int y, int w, int h) XSetWindowBackgroundPixmap(xd->display, window, XNone); XSelectInput(xd->display, window, ExposureMask | KeyPressMask | KeyReleaseMask | + EnterWindowMask | LeaveWindowMask | FocusChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | StructureNotifyMask); @@ -456,18 +464,38 @@ void MyWindow::resizeEvent(XConfigureEvent *e) windowSurface->handleGeometryChange(xpos, ypos, width, height); } - +#if 0 void MyWindow::setSize(int w, int h) { XResizeWindow(xd->display, window, w, h); } +#endif void MyWindow::setGeometry(int x, int y, int w, int h) { +#ifdef MYX11_DEBUG + qDebug() << "MyWindow::setGeometry" << hex << window << dec << x << y << w << h; +#endif XMoveResizeWindow(xd->display, window, x, y, w, h); } +void MyWindow::enterEvent(XCrossingEvent *e) +{ +#ifdef MYX11_DEBUG + qDebug() << "MyWindow::enterEvent" << hex << window; +#endif + windowSurface->handleEnterEvent(); +} + +void MyWindow::leaveEvent(XCrossingEvent *e) +{ +#ifdef MYX11_DEBUG + qDebug() << "MyWindow::enterEvent" << hex << window; +#endif + windowSurface->handleLeaveEvent(); +} + void MyWindow::mousePressEvent(XButtonEvent *e) { static long prevTime = 0; @@ -623,7 +651,7 @@ Qt::WindowFlags MyWindow::setWindowFlags(Qt::WindowFlags flags) } #ifdef MYX11_DEBUG - qDebug() << "MyWindow::setWindowFlags" << hex << mwm_hint_atom << "flags" << flags; + qDebug() << "MyWindow::setWindowFlags" << hex << window << "flags" << flags; #endif Qt::WindowType type = static_cast(int(flags & Qt::WindowType_Mask)); @@ -746,7 +774,9 @@ Qt::WindowFlags MyWindow::setWindowFlags(Qt::WindowFlags flags) void MyWindow::setVisible(bool visible) { -// qDebug() << "MyWindow::setVisible" << visible << hex << window; +#ifdef MYX11_DEBUG + qDebug() << "MyWindow::setVisible" << visible << hex << window; +#endif if (visible) XMapWindow(xd->display, window); else diff --git a/src/plugins/graphicssystems/testlite/x11util.h b/src/plugins/graphicssystems/testlite/x11util.h index fbd9ef7..39fc331 100644 --- a/src/plugins/graphicssystems/testlite/x11util.h +++ b/src/plugins/graphicssystems/testlite/x11util.h @@ -96,10 +96,13 @@ public: void keyPressEvent(XKeyEvent*); void keyReleaseEvent(XKeyEvent*); + void enterEvent(XCrossingEvent*); + void leaveEvent(XCrossingEvent*); + void closeEvent(); void paintEvent(); void resizeEvent(XConfigureEvent *configure_event); - void setSize(int w, int h); +// void setSize(int w, int h); void setGeometry(int x, int y, int w, int h); GC createGC(); -- cgit v0.12 From 3fc6f2c08d9648afc489175363a335e56b3f6526 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Thu, 15 Oct 2009 17:29:02 +0200 Subject: Allow VNC top level widgits to be hidden via QGraphicsSystemScreen::setVisible() --- src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp | 4 ++++ src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp | 8 +++++++- src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h | 4 +++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp index b50e5b5..52f354a 100644 --- a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp +++ b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp @@ -87,10 +87,14 @@ void QVNCGraphicsSystemScreen::setDirty(const QRect &rect) compositePainter.fillRect(rect, Qt::black); for (int i = 0; i < windowStack.length(); i++) { + if (!windowStack[i]->visible()) + continue; QRect windowRect = windowStack[i]->geometry(); QRect intersect = windowRect.intersected(rect); QRect windowIntersect = intersect.translated(-windowRect.left(), -windowRect.top()); + if (intersect.isNull()) + continue; compositePainter.drawImage(intersect, windowStack[i]->image(), windowIntersect); } diff --git a/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp b/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp index af171f5..a3bce49 100644 --- a/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp +++ b/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp @@ -51,7 +51,8 @@ QT_BEGIN_NAMESPACE QVNCWindowSurface::QVNCWindowSurface(QVNCGraphicsSystem *graphicsSystem, QVNCGraphicsSystemScreen *screen, QWidget *window) : QWindowSurface(window), - mScreen(screen) + mScreen(screen), + visibleFlag(false) { mImage = QImage(window->size(), mScreen->format()); } @@ -115,4 +116,9 @@ void QVNCWindowSurface::endPaint(const QRegion ®ion) Q_UNUSED(region); } +void QVNCWindowSurface::setVisible(bool visible) +{ + visibleFlag = visible; + mScreen->setDirty(geometry()); +} QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h b/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h index b9af493..477fe1b 100644 --- a/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h +++ b/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h @@ -65,12 +65,14 @@ public: void beginPaint(const QRegion ®ion); void endPaint(const QRegion ®ion); inline const QImage image() { return mImage; } - + void setVisible(bool visible); + bool visible() { return visibleFlag; } private: QVNCGraphicsSystem *mGraphicsSystem; QVNCGraphicsSystemScreen *mScreen; QRect oldGeometry; QImage mImage; + bool visibleFlag; }; QT_END_NAMESPACE -- cgit v0.12 From bfdba4c5099bf57e0ec723b1b054ea8298e27f8e Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 16 Oct 2009 13:33:02 +0200 Subject: Adjustable screen size for VNC --- src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp index 52f354a..a97c594 100644 --- a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp +++ b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp @@ -53,7 +53,16 @@ QVNCGraphicsSystemScreen::QVNCGraphicsSystemScreen() : mDepth(16), mFormat(QImage::Format_RGB16), mScreenImage(0) { - mGeometry = QRect(0,0,800, 600); + int w = 800; + int h = 600; + int ew, eh; + const char *str; + if ((str=::getenv("QT_VNC_SIZE")) && sscanf(str,"%dx%d",&ew,&eh)==2) { + w = ew; + h = eh; + } + + mGeometry = QRect(0,0,w, h); mDepth = 32; mFormat = QImage::Format_RGB32; -- cgit v0.12 From d4cbb6936131867073fc026d3c4697af36a0e2d4 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 16 Oct 2009 11:56:23 +0200 Subject: One more fix for popup mouse events If the mouse handler doesn't provide local coordinates, we have to map before finding the child widget --- src/gui/kernel/qapplication_lite.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 884cfac..b3ad06f 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -517,13 +517,12 @@ void QApplicationPrivate::handleLeaveEvent(QWidget *tlw) void QApplicationPrivate::handleMouseEvent(QWidget *tlw, const QMouseEvent &ev) { -// qDebug() << "handleMouseEvent" << tlw << ev.pos() << hex << ev.buttons(); + // qDebug() << "handleMouseEvent" << tlw << ev.pos() << ev.globalPos() << hex << ev.buttons(); static QWidget *implicit_mouse_grabber=0; QPoint localPoint = ev.pos(); QPoint globalPoint = ev.globalPos(); - bool trustLocalPoint = !!tlw; //is there something the local point can be local to? QWidget *mouseWindow = tlw; qt_last_x = globalPoint.x(); @@ -532,8 +531,8 @@ void QApplicationPrivate::handleMouseEvent(QWidget *tlw, const QMouseEvent &ev) if (self->inPopupMode()) { //popup mouse handling is magical... mouseWindow = qApp->activePopupWidget(); - trustLocalPoint = (mouseWindow == tlw); + implicit_mouse_grabber = 0; //### how should popup mode and implicit mouse grab interact? } else if (tlw && app_do_modal && !qt_try_modal(tlw, &ev) ) { @@ -553,10 +552,15 @@ void QApplicationPrivate::handleMouseEvent(QWidget *tlw, const QMouseEvent &ev) if (!mouseWindow && !implicit_mouse_grabber) return; //nowhere to send it + if (mouseWindow && mouseWindow != tlw) { + //we did not get a sensible localPoint from the window system, so let's calculate it + localPoint = mouseWindow->mapFromGlobal(globalPoint); + } + // which child should have it? QWidget *mouseWidget = mouseWindow; if (mouseWindow) { - QWidget *w = mouseWindow->childAt(ev.pos()); + QWidget *w = mouseWindow->childAt(localPoint); if (w) { mouseWidget = w; } @@ -571,20 +575,14 @@ void QApplicationPrivate::handleMouseEvent(QWidget *tlw, const QMouseEvent &ev) } else if (implicit_mouse_grabber) { mouseWidget = implicit_mouse_grabber; mouseWindow = mouseWidget->window(); - trustLocalPoint = (mouseWindow == tlw); + if (mouseWindow != tlw) + localPoint = mouseWindow->mapFromGlobal(globalPoint); } Q_ASSERT(mouseWidget); - if (trustLocalPoint) { - // we have a sensible localPoint, so we prefer that, since the - // window system may know more than we do - localPoint = mouseWidget->mapFrom(tlw, localPoint); - } else { - // we don't want to map a local point from a different toplevel - // and we definitely don't want to map from the null pointer - localPoint = mouseWidget->mapFromGlobal(globalPoint); - } + //localPoint is local to mouseWindow, but it needs to be local to mouseWidget + localPoint = mouseWidget->mapFrom(mouseWindow, localPoint); if (ev.buttons() == Qt::NoButton) { //qDebug() << "resetting mouse grabber"; -- cgit v0.12 From 59cab5edd7db8a8e8d16ebbb89329eafb5147b46 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 16 Oct 2009 16:33:43 +0200 Subject: Implement enter/leave events for Lighthouse --- src/gui/kernel/qapplication.cpp | 6 +++--- src/gui/kernel/qapplication_lite.cpp | 12 +++++++++++- src/gui/kernel/qapplication_p.h | 2 +- src/gui/kernel/qwidget.cpp | 14 +++++++------- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 191cdf4..74f2971 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -498,7 +498,7 @@ inline bool QApplicationPrivate::isAlien(QWidget *widget) return false; #if defined(Q_WS_MAC) // Fake alien behavior on the Mac :) return !widget->isWindow() && widget->window()->testAttribute(Qt::WA_DontShowOnScreen); -#elif defined(Q_WS_QWS) +#elif defined(Q_WS_QWS) || defined(Q_WS_LITE) return !widget->isWindow() # ifdef Q_BACKINGSTORE_SUBSURFACES && !(widget->d_func()->maybeTopData() && widget->d_func()->maybeTopData()->windowSurface) @@ -3004,7 +3004,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event, return result; } -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_QWS) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_LITE) /* This function should only be called when the widget changes visibility, i.e. when the \a widget is shown, hidden or deleted. This function does nothing @@ -3016,7 +3016,7 @@ extern QWidget *qt_button_down; void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget) { #ifndef QT_NO_CURSOR -#ifdef Q_WS_QWS +#if defined(Q_WS_QWS) || defined(Q_WS_LITE) if (!widget || widget->isWindow()) return; #else diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index b3ad06f..0ddcfab 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -72,6 +72,7 @@ extern QWidgetList *qt_modal_stack; // stack of modal widgets int qt_last_x = 0; int qt_last_y = 0; +QPointer qt_last_mouse_receiver = 0; QString QApplicationPrivate::appName() const { @@ -508,11 +509,15 @@ void QApplication::setMainWidget(QWidget *mainWidget) void QApplicationPrivate::handleEnterEvent(QWidget *tlw) { dispatchEnterLeave(tlw, 0); + qt_last_mouse_receiver = tlw; } void QApplicationPrivate::handleLeaveEvent(QWidget *tlw) { - dispatchEnterLeave(0, tlw); + dispatchEnterLeave(0, qt_last_mouse_receiver); + if (!tlw->isAncestorOf(qt_last_mouse_receiver)) //(???) this should not happen + dispatchEnterLeave(0, tlw); + qt_last_mouse_receiver = 0; } void QApplicationPrivate::handleMouseEvent(QWidget *tlw, const QMouseEvent &ev) @@ -589,6 +594,11 @@ void QApplicationPrivate::handleMouseEvent(QWidget *tlw, const QMouseEvent &ev) implicit_mouse_grabber = 0; } + if (mouseWidget != qt_last_mouse_receiver) { + dispatchEnterLeave(mouseWidget, qt_last_mouse_receiver); + qt_last_mouse_receiver = mouseWidget; + } + // Remember, we might enter a modal event loop when sending the event, // so think carefully before adding code below this point. diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index a5496d6..2622f1c 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -504,7 +504,7 @@ public: static TUint resolveS60ScanCode(TInt scanCode, TUint keysym); QSet nativeWindows; #endif -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_LITE) void sendSyntheticEnterLeave(QWidget *widget); #endif diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 88d90ee..4d8386b 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1440,13 +1440,13 @@ QWidget::~QWidget() } } -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) //### LITE +#if defined(Q_WS_WIN) || defined(Q_WS_X11) else if (!internalWinId() && isVisible()) { qApp->d_func()->sendSyntheticEnterLeave(this); -#ifdef Q_WS_QWS - } else if (isVisible()) { + } +#elif defined(Q_WS_QWS) || defined(Q_WS_LITE) + else if (isVisible()) { qApp->d_func()->sendSyntheticEnterLeave(this); -#endif } #endif @@ -7200,7 +7200,7 @@ void QWidgetPrivate::hide_helper() // next bit tries to move the focus if the focus widget is now // hidden. if (wasVisible) { -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_LITE) qApp->d_func()->sendSyntheticEnterLeave(q); #endif @@ -7332,7 +7332,7 @@ void QWidget::setVisible(bool visible) d->show_helper(); -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_LITE) qApp->d_func()->sendSyntheticEnterLeave(this); #endif } @@ -7447,7 +7447,7 @@ void QWidgetPrivate::hideChildren(bool spontaneous) widget->d_func()->hide_sys(); } } -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_LITE) qApp->d_func()->sendSyntheticEnterLeave(widget); #endif #ifndef QT_NO_ACCESSIBILITY -- cgit v0.12 From 4a77f349127eca7e5c46ba1eafba20ebb8736ebb Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Mon, 19 Oct 2009 13:54:43 +0200 Subject: consolidate repainting of multiple QRects for the VNC display Schedule repainting of the VNC display backing store to allow multiple regions to be repainted in a single go. Requests are scheduled using a 0 timer. --- .../graphicssystems/vnc/qgraphicssystem_vnc.cpp | 61 +++++++++++++++------- .../graphicssystems/vnc/qgraphicssystem_vnc.h | 20 ++++++- 2 files changed, 61 insertions(+), 20 deletions(-) diff --git a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp index a97c594..6fe174c 100644 --- a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp +++ b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp @@ -47,7 +47,7 @@ #include #include - +#include QVNCGraphicsSystemScreen::QVNCGraphicsSystemScreen() @@ -71,12 +71,20 @@ QVNCGraphicsSystemScreen::QVNCGraphicsSystemScreen() mScreenImage = new QImage(mGeometry.size(), mFormat); d_ptr = new QVNCGraphicsSystemScreenPrivate(this); + + helper = new QVNCGraphicsSystemScreenTimerHelper(this); + repaintTimer = new QTimer(); + repaintTimer->setSingleShot(true); + repaintTimer->setInterval(0); + QObject::connect(repaintTimer, SIGNAL(timeout()), helper, SLOT(fireSlot())); } QVNCGraphicsSystemScreen::~QVNCGraphicsSystemScreen() { delete mScreenImage; + delete repaintTimer; + delete helper; } QVNCDirtyMap *QVNCGraphicsSystemScreen::dirtyMap() @@ -87,28 +95,43 @@ QVNCDirtyMap *QVNCGraphicsSystemScreen::dirtyMap() void QVNCGraphicsSystemScreen::setDirty(const QRect &rect) { + repaintRegion += rect; + if (!repaintTimer->isActive()) { + repaintTimer->start(); + } +} + +void QVNCGraphicsSystemScreen::doRedraw() +{ + if (repaintRegion.isEmpty()) + return; QPainter compositePainter(mScreenImage); - // Blank the affected area, just in case there's nothing to display here - // Question - What's the background color? - // Another option would be to push a base level window that is the size of the display - - compositePainter.fillRect(rect, Qt::black); - - for (int i = 0; i < windowStack.length(); i++) { - if (!windowStack[i]->visible()) - continue; - QRect windowRect = windowStack[i]->geometry(); - QRect intersect = windowRect.intersected(rect); - QRect windowIntersect = intersect.translated(-windowRect.left(), - -windowRect.top()); - if (intersect.isNull()) - continue; - compositePainter.drawImage(intersect, windowStack[i]->image(), - windowIntersect); + QVector rects = repaintRegion.rects(); + + for (int rectIndex = 0; rectIndex < repaintRegion.numRects(); rectIndex++) { + QRect rect = rects[rectIndex]; + // Blank the affected area, just in case there's nothing to display + // Question - What's the background color? + // Another option - a base level window that is the size of the display + compositePainter.fillRect(rect, Qt::black); + for (int i = 0; i < windowStack.length(); i++) { + if (!windowStack[i]->visible()) + continue; + QRect windowRect = windowStack[i]->geometry(); + QRect intersect = windowRect.intersected(rect); + QRect windowIntersect = intersect.translated(-windowRect.left(), + -windowRect.top()); + if (intersect.isNull()) + continue; + compositePainter.drawImage(intersect, windowStack[i]->image(), + windowIntersect); + d_ptr->setDirty(rect); + } + } - d_ptr->setDirty(rect); + repaintRegion = QRegion(); } diff --git a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h index d593096..497bd23 100644 --- a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h +++ b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h @@ -50,9 +50,10 @@ QT_BEGIN_NAMESPACE class QVNCServer; class QVNCDirtyMap; - class QVNCGraphicsSystemScreenPrivate; +class QVNCGraphicsSystemScreenTimerHelper; + class QVNCGraphicsSystemScreen : public QGraphicsSystemScreen { public: @@ -83,6 +84,23 @@ public: QVNCGraphicsSystemScreenPrivate *d_ptr; private: QList windowStack; + QRegion repaintRegion; + QTimer * repaintTimer; + QVNCGraphicsSystemScreenTimerHelper * helper; + void doRedraw(); + friend class QVNCGraphicsSystemScreenTimerHelper; +}; + +class QVNCGraphicsSystemScreenTimerHelper : public QObject +{ + Q_OBJECT +public: + QVNCGraphicsSystemScreenTimerHelper(QVNCGraphicsSystemScreen * s) + { screen = s; } +public slots: + void fireSlot() { screen->doRedraw(); } +private: + QVNCGraphicsSystemScreen * screen; }; class QVNCGraphicsSystemPrivate; -- cgit v0.12 From 950dc68999454fa3873a6b5c5a695529d02a57c4 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Mon, 19 Oct 2009 13:54:43 +0200 Subject: consolidate repainting of multiple QRects for the VNC display Schedule repainting of the VNC display backing store to allow multiple regions to be repainted in a single go. Requests are scheduled using a 0 timer. --- src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp index 6fe174c..95e6641 100644 --- a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp +++ b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp @@ -126,9 +126,8 @@ void QVNCGraphicsSystemScreen::doRedraw() continue; compositePainter.drawImage(intersect, windowStack[i]->image(), windowIntersect); - d_ptr->setDirty(rect); } - + d_ptr->setDirty(rect); } repaintRegion = QRegion(); -- cgit v0.12 From c0395ffd43858e700e2f9015b892c2e978ee8881 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 22 Oct 2009 16:01:48 +0200 Subject: Simplistic showMaximized/showFullScreen implementation --- src/gui/kernel/qwidget_lite.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index cab8cda..d5e4ac2 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -46,6 +46,7 @@ #include "private/qwidget_p.h" #include "private/qgraphicssystem_p.h" #include "private/qapplication_p.h" +#include "qdesktopwidget.h" QT_BEGIN_NAMESPACE @@ -315,12 +316,21 @@ void QWidgetPrivate::hide_sys() void QWidgetPrivate::setMaxWindowState_helper() { - // XXX + setFullScreenSize_helper(); //### decoration size } void QWidgetPrivate::setFullScreenSize_helper() { - // XXX + Q_Q(QWidget); + + const uint old_state = data.in_set_window_state; + data.in_set_window_state = 1; + + const QRect screen = qApp->desktop()->screenGeometry(qApp->desktop()->screenNumber(q)); + q->move(screen.topLeft()); + q->resize(screen.size()); + + data.in_set_window_state = old_state; } static Qt::WindowStates effectiveState(Qt::WindowStates state) -- cgit v0.12 From 67475f1f482cfb90c357f9e6d96592a1a29f8e7c Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 22 Oct 2009 16:02:36 +0200 Subject: WinId for toplevel windows. --- src/gui/kernel/qwidget_lite.cpp | 20 ++++++++++++++------ src/gui/painting/qwindowsurface.cpp | 6 ++++++ src/gui/painting/qwindowsurface_p.h | 1 + .../testlite/qwindowsurface_testlite.cpp | 8 ++++++++ .../testlite/qwindowsurface_testlite.h | 1 + 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index d5e4ac2..cbda042 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -58,15 +58,23 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool /*destro Q_UNUSED(initializeWindow); // XXX - Qt::WindowFlags flags = data.window_flags; -#if 1 + if (!(flags & Qt::Window) || q->windowType() == Qt::Desktop) + return; // we only care about real toplevels + QWindowSurface *surface = q->windowSurface(); - if (surface && (flags & Qt::Window)) - data.window_flags = surface->setWindowFlags(data.window_flags); -#endif -// qDebug() << "create_sys" << q; + + if (!surface) + surface = createDefaultWindowSurface(); + + Q_ASSERT(surface); + + data.window_flags = surface->setWindowFlags(data.window_flags); + + setWinId(surface->winId()); + + qDebug() << "create_sys" << q << q->internalWinId(); } void QWidget::destroy(bool destroyWindow, bool destroySubWindows) diff --git a/src/gui/painting/qwindowsurface.cpp b/src/gui/painting/qwindowsurface.cpp index 8add040..1b0a2ef 100644 --- a/src/gui/painting/qwindowsurface.cpp +++ b/src/gui/painting/qwindowsurface.cpp @@ -378,6 +378,12 @@ void QWindowSurface::setVisible(bool visible) Q_UNUSED(visible); } + +WId QWindowSurface::winId() const +{ + return WId(0); +} + #endif QT_END_NAMESPACE diff --git a/src/gui/painting/qwindowsurface_p.h b/src/gui/painting/qwindowsurface_p.h index a84c461..88cc8ba 100644 --- a/src/gui/painting/qwindowsurface_p.h +++ b/src/gui/painting/qwindowsurface_p.h @@ -93,6 +93,7 @@ public: virtual void setVisible(bool visible); virtual Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); virtual Qt::WindowFlags windowFlags() const; + virtual WId winId() const; #endif bool hasStaticContentsSupport() const; diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp index e0b9b9f..b14efb8 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp @@ -568,4 +568,12 @@ void QTestLiteWindowSurface::setVisible(bool visible) } +WId QTestLiteWindowSurface::winId() const +{ + if (xw) + return (WId) xw->window; + else + return WId(0); +} + QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h index af57c0b..59db81f 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h @@ -78,6 +78,7 @@ public: Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); Qt::WindowFlags windowFlags() const; void setVisible(bool visible); + WId winId() const; private: QTestLiteGraphicsSystem *mGraphicsSystem; -- cgit v0.12 From 1ac68040623df0ba1feaa96b5056c82e75b2faa9 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 22 Oct 2009 16:12:07 +0200 Subject: Remove debug output --- src/gui/kernel/qwidget_lite.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index cbda042..1eb93d3 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -74,7 +74,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool /*destro setWinId(surface->winId()); - qDebug() << "create_sys" << q << q->internalWinId(); +// qDebug() << "create_sys" << q << q->internalWinId(); } void QWidget::destroy(bool destroyWindow, bool destroySubWindows) -- cgit v0.12 From 14832f985044a7b978c68cdbdcc466f32aacb71d Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Fri, 30 Oct 2009 16:42:38 +0100 Subject: lighthouse VNC cursor support --- .../graphicssystems/vnc/qgraphicssystem_vnc.cpp | 25 +- .../graphicssystems/vnc/qgraphicssystem_vnc.h | 5 +- src/plugins/graphicssystems/vnc/qvnccursor.cpp | 689 +++++++++++++++++++++ src/plugins/graphicssystems/vnc/qvnccursor.h | 100 +++ src/plugins/graphicssystems/vnc/qvncserver.cpp | 12 +- src/plugins/graphicssystems/vnc/qvncserver.h | 2 + .../graphicssystems/vnc/qwindowsurface_vnc.cpp | 1 + src/plugins/graphicssystems/vnc/vnc.pro | 2 + 8 files changed, 829 insertions(+), 7 deletions(-) create mode 100644 src/plugins/graphicssystems/vnc/qvnccursor.cpp create mode 100644 src/plugins/graphicssystems/vnc/qvnccursor.h diff --git a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp index 95e6641..98e994c 100644 --- a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp +++ b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp @@ -49,6 +49,9 @@ #include +#include + +#include "qvnccursor.h" QVNCGraphicsSystemScreen::QVNCGraphicsSystemScreen() : mDepth(16), mFormat(QImage::Format_RGB16), mScreenImage(0) @@ -77,6 +80,9 @@ QVNCGraphicsSystemScreen::QVNCGraphicsSystemScreen() repaintTimer->setSingleShot(true); repaintTimer->setInterval(0); QObject::connect(repaintTimer, SIGNAL(timeout()), helper, SLOT(fireSlot())); + + cursor = new QVNCCursor(d_ptr->vncServer, this); + d_ptr->vncServer->setCursor(cursor); } @@ -103,8 +109,11 @@ void QVNCGraphicsSystemScreen::setDirty(const QRect &rect) void QVNCGraphicsSystemScreen::doRedraw() { + repaintRegion += cursor->dirtyRect(); + if (repaintRegion.isEmpty()) return; + QPainter compositePainter(mScreenImage); QVector rects = repaintRegion.rects(); @@ -127,9 +136,14 @@ void QVNCGraphicsSystemScreen::doRedraw() compositePainter.drawImage(intersect, windowStack[i]->image(), windowIntersect); } - d_ptr->setDirty(rect); } + QRect pointerRect = cursor->drawCursor(compositePainter); + repaintRegion += pointerRect; + rects = repaintRegion.rects(); + for (int i = 0; i < rects.size(); i ++) + d_ptr->setDirty(rects[i]); + repaintRegion = QRegion(); } @@ -141,8 +155,8 @@ QVNCGraphicsSystem::QVNCGraphicsSystem() mPrimaryScreen = new QVNCGraphicsSystemScreen(); - int dw = mPrimaryScreen->geometry().width(); - int dh = mPrimaryScreen->geometry().height(); + //int dw = mPrimaryScreen->geometry().width(); + //int dh = mPrimaryScreen->geometry().height(); mScreens.append(mPrimaryScreen); @@ -168,3 +182,8 @@ void QVNCGraphicsSystemScreen::removeWindowSurface(QVNCWindowSurface * surface) windowStack.removeOne(surface); setDirty(surface->geometry()); } + +void QVNCGraphicsSystemScreen::pointerEvent(QMouseEvent & me) +{ + QApplicationPrivate::handleMouseEvent(0, me); +} diff --git a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h index 497bd23..eb48f86 100644 --- a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h +++ b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h @@ -44,6 +44,7 @@ #include #include "qwindowsurface_vnc.h" +#include "qvnccursor.h" QT_BEGIN_NAMESPACE @@ -72,6 +73,7 @@ public: void removeWindowSurface(QVNCWindowSurface * surface); void addWindowSurface(QVNCWindowSurface * surface) { windowStack.append(surface); } + void pointerEvent(QMouseEvent & me); public: QRect mGeometry; @@ -79,7 +81,6 @@ public: QImage::Format mFormat; QSize mPhysicalSize; QImage *mScreenImage; - QVNCServer *server; QVNCGraphicsSystemScreenPrivate *d_ptr; private: @@ -89,6 +90,8 @@ private: QVNCGraphicsSystemScreenTimerHelper * helper; void doRedraw(); friend class QVNCGraphicsSystemScreenTimerHelper; + + QVNCCursor * cursor; }; class QVNCGraphicsSystemScreenTimerHelper : public QObject diff --git a/src/plugins/graphicssystems/vnc/qvnccursor.cpp b/src/plugins/graphicssystems/vnc/qvnccursor.cpp new file mode 100644 index 0000000..111ee3c --- /dev/null +++ b/src/plugins/graphicssystems/vnc/qvnccursor.cpp @@ -0,0 +1,689 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include + +#include + +#include "qvnccursor.h" +#include "qvncserver.h" +#include "qgraphicssystem_vnc.h" + +QT_BEGIN_NAMESPACE + +QVNCCursor::QVNCCursor(QVNCServer * srvr, QVNCGraphicsSystemScreen *scr ) + :useVncCursor(false), currentRect(QRect()), + prevRect(QRect()), server(srvr), screen(scr) +{ + d_ptr = new QVNCCursorPrivate(0, 0, 0, 0, 0, 0); +} + +void QVNCCursor::setCursorMode(bool vnc) +{ + if (vnc == useVncCursor) + return; + if (vnc) { + screen->setDirty(prevRect); + prevRect = QRect(); + sendClientCursor(); + } else { + clearClientCursor(); + } + useVncCursor = vnc; +} + +void QVNCCursor::setCursor(Qt::CursorShape shape) +{ + d_ptr->set(shape); + if (useVncCursor) { + sendClientCursor(); + } +} + +void QVNCCursor::setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) +{ + d_ptr->set(data, mask, width, height, hotX, hotY); + if (useVncCursor) { + sendClientCursor(); + } +} + +QRect QVNCCursor::dirtyRect() +{ + if (!useVncCursor) { + QRect rect = prevRect; + prevRect = QRect(); + return rect; + } + return QRect(); +} + +QRect QVNCCursor::drawCursor(QPainter & painter) +{ + if (useVncCursor) + return QRect(); + + if (currentRect.isNull()) + return QRect(); + + prevRect = currentRect; + painter.drawImage(prevRect, *d_ptr->image()); + return prevRect; +} + +void QVNCCursor::pointerEvent(QMouseEvent & e) +{ + QWidget *widget = QApplication::widgetAt(e.pos()); + + // Determine which cursor to use + if (currentWidget != widget) { + if (widget) { + QCursor widgetCursor = widget->cursor(); + Qt::CursorShape shape = widgetCursor.shape(); + + if (shape == Qt::BitmapCursor) { + // application supplied cursor + const QBitmap * map = widgetCursor.bitmap(); + const QBitmap * mask = widgetCursor.mask(); + QPoint spot = widgetCursor.hotSpot(); + setCursor(map->toImage().bits(), mask->toImage().bits(), map->width(), map->height(), spot.x(), spot.y()); + } else { + // system cursor + setCursor(shape); + } + } else { + // default cursor + setCursor(Qt::ArrowCursor); + } + currentWidget = widget; + } else if (!widget) { + // default cursor + setCursor(Qt::ArrowCursor); + } + if (!useVncCursor) { + currentRect = d_ptr->image()->rect().translated(-d_ptr->hotspot().x(), -d_ptr->hotspot().y()); + currentRect.translate(e.pos()); + screen->setDirty(QRect()); + } + + screen->pointerEvent(e); +} + +void QVNCCursor::clearClientCursor() +{ + QImage *image = d_ptr->image(); + if (image->isNull()) + return; + QTcpSocket *socket = server->clientSocket(); + if (!socket) { + return; + } + // FramebufferUpdate header + { + const quint16 tmp[6] = { htons(0), + htons(1), + htons(0), htons(0), + htons(0), + htons(0) }; + socket->write((char*)tmp, sizeof(tmp)); + + const quint32 encoding = htonl(-239); + socket->write((char*)(&encoding), sizeof(encoding)); + } +} + +void QVNCCursor::sendClientCursor() +{ + QImage *image = d_ptr->image(); + if (image->isNull()) + return; + QTcpSocket *socket = server->clientSocket(); + if (!socket) { + return; + } + // FramebufferUpdate header + { + const quint16 tmp[6] = { htons(0), + htons(1), + htons(d_ptr->hotspot().x()), htons(d_ptr->hotspot().y()), + htons(image->width()), + htons(image->height()) }; + socket->write((char*)tmp, sizeof(tmp)); + + const quint32 encoding = htonl(-239); + socket->write((char*)(&encoding), sizeof(encoding)); + } + + // write pixels + //Q_ASSERT(cursor->hasAlphaChannel()); + const QImage img = image->convertToFormat(QImage::Format_RGB32); + const int n = server->clientBytesPerPixel() * img.width(); + char *buffer = new char[n]; + for (int i = 0; i < img.height(); ++i) { + server->convertPixels(buffer, (const char*)img.scanLine(i), img.width()); + socket->write(buffer, n); + } + delete[] buffer; + + // write mask + const QImage bitmap = image->createAlphaMask().convertToFormat(QImage::Format_Mono); + Q_ASSERT(bitmap.depth() == 1); + Q_ASSERT(bitmap.size() == img.size()); + const int width = (bitmap.width() + 7) / 8; + for (int i = 0; i < bitmap.height(); ++i) + socket->write((const char*)bitmap.scanLine(i), width); +} + +// End of display and pointer event handling code +// Beginning of built-in cursor graphics +// from src/gui/embedded/QVNCCursorPrivate_qws.cpp + +static QVNCCursorPrivate *systemCursorTable[Qt::LastCursor+1]; +static bool systemCursorTableInit = false; + +// 16 x 16 +static const uchar cur_arrow_bits[] = { + 0x07, 0x00, 0x39, 0x00, 0xc1, 0x01, 0x02, 0x0e, 0x02, 0x10, 0x02, 0x08, + 0x04, 0x04, 0x04, 0x02, 0x04, 0x04, 0x88, 0x08, 0x48, 0x11, 0x28, 0x22, + 0x10, 0x44, 0x00, 0x28, 0x00, 0x10, 0x00, 0x00 }; +static const uchar mcur_arrow_bits[] = { + 0x07, 0x00, 0x3f, 0x00, 0xff, 0x01, 0xfe, 0x0f, 0xfe, 0x1f, 0xfe, 0x0f, + 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x07, 0xf8, 0x0f, 0x78, 0x1f, 0x38, 0x3e, + 0x10, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00, 0x00 }; + +static const unsigned char cur_up_arrow_bits[] = { + 0x80, 0x00, 0x40, 0x01, 0x40, 0x01, 0x20, 0x02, 0x20, 0x02, 0x10, 0x04, + 0x10, 0x04, 0x08, 0x08, 0x78, 0x0f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, + 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01}; +static const unsigned char mcur_up_arrow_bits[] = { + 0x80, 0x00, 0xc0, 0x01, 0xc0, 0x01, 0xe0, 0x03, 0xe0, 0x03, 0xf0, 0x07, + 0xf0, 0x07, 0xf8, 0x0f, 0xf8, 0x0f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01}; + +static const unsigned char cur_cross_bits[] = { + 0xc0, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, + 0x7f, 0x7f, 0x01, 0x40, 0x7f, 0x7f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, + 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01, 0x00, 0x00}; +static const unsigned char mcur_cross_bits[] = { + 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0x00, 0x00}; + +static const uchar cur_ibeam_bits[] = { + 0x00, 0x00, 0xe0, 0x03, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, + 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, + 0x80, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00 }; +static const uchar mcur_ibeam_bits[] = { + 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0x00, 0x00 }; + +static const uchar cur_ver_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f, + 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00 }; +static const uchar mcur_ver_bits[] = { + 0x00, 0x00, 0x80, 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0xf8, 0x3f, + 0xfc, 0x7f, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xfc, 0x7f, 0xf8, 0x3f, + 0xf0, 0x1f, 0xe0, 0x0f, 0xc0, 0x07, 0x80, 0x03 }; + +static const uchar cur_hor_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x30, 0x18, + 0x38, 0x38, 0xfc, 0x7f, 0xfc, 0x7f, 0x38, 0x38, 0x30, 0x18, 0x20, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar mcur_hor_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x40, 0x04, 0x60, 0x0c, 0x70, 0x1c, 0x78, 0x3c, + 0xfc, 0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfc, 0x7f, 0x78, 0x3c, + 0x70, 0x1c, 0x60, 0x0c, 0x40, 0x04, 0x00, 0x00 }; +static const uchar cur_bdiag_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x3e, 0x00, 0x3c, 0x00, 0x3e, + 0x00, 0x37, 0x88, 0x23, 0xd8, 0x01, 0xf8, 0x00, 0x78, 0x00, 0xf8, 0x00, + 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar mcur_bdiag_bits[] = { + 0x00, 0x00, 0xc0, 0x7f, 0x80, 0x7f, 0x00, 0x7f, 0x00, 0x7e, 0x04, 0x7f, + 0x8c, 0x7f, 0xdc, 0x77, 0xfc, 0x63, 0xfc, 0x41, 0xfc, 0x00, 0xfc, 0x01, + 0xfc, 0x03, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00 }; +static const uchar cur_fdiag_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0xf8, 0x00, 0x78, 0x00, + 0xf8, 0x00, 0xd8, 0x01, 0x88, 0x23, 0x00, 0x37, 0x00, 0x3e, 0x00, 0x3c, + 0x00, 0x3e, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00 }; +static const uchar mcur_fdiag_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x01, 0xfc, 0x00, + 0xfc, 0x41, 0xfc, 0x63, 0xdc, 0x77, 0x8c, 0x7f, 0x04, 0x7f, 0x00, 0x7e, + 0x00, 0x7f, 0x80, 0x7f, 0xc0, 0x7f, 0x00, 0x00 }; +static const uchar cur_blank_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +// 20 x 20 +static const uchar forbidden_bits[] = { + 0x00,0x00,0x00,0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xf0,0x00,0x38,0xc0,0x01, + 0x7c,0x80,0x03,0xec,0x00,0x03,0xce,0x01,0x07,0x86,0x03,0x06,0x06,0x07,0x06, + 0x06,0x0e,0x06,0x06,0x1c,0x06,0x0e,0x38,0x07,0x0c,0x70,0x03,0x1c,0xe0,0x03, + 0x38,0xc0,0x01,0xf0,0xe0,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00,0x00,0x00,0x00 }; + +static const uchar forbiddenm_bits[] = { + 0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xff,0x00,0xf8,0xff,0x01,0xfc,0xf0,0x03, + 0xfe,0xc0,0x07,0xfe,0x81,0x07,0xff,0x83,0x0f,0xcf,0x07,0x0f,0x8f,0x0f,0x0f, + 0x0f,0x1f,0x0f,0x0f,0x3e,0x0f,0x1f,0xfc,0x0f,0x1e,0xf8,0x07,0x3e,0xf0,0x07, + 0xfc,0xe0,0x03,0xf8,0xff,0x01,0xf0,0xff,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00}; + +// 32 x 32 +static const uchar wait_data_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, + 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x08, 0x20, 0x00, + 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, + 0x00, 0x50, 0x15, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x40, 0x05, 0x00, + 0x00, 0x80, 0x02, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x20, 0x08, 0x00, + 0x00, 0x10, 0x10, 0x00, 0x00, 0x08, 0x21, 0x00, 0x00, 0x88, 0x22, 0x00, + 0x00, 0x48, 0x25, 0x00, 0x00, 0xa8, 0x2a, 0x00, 0x00, 0xfc, 0x7f, 0x00, + 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar wait_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, + 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xf8, 0x3f, 0x00, + 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, + 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xc0, 0x07, 0x00, + 0x00, 0x80, 0x03, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0xe0, 0x0f, 0x00, + 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, + 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, + 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +static const uchar hsplit_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x41, 0x82, 0x00, 0x80, 0x41, 0x82, 0x01, 0xc0, 0x7f, 0xfe, 0x03, + 0x80, 0x41, 0x82, 0x01, 0x00, 0x41, 0x82, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar hsplitm_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, + 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe3, 0xc7, 0x00, + 0x80, 0xe3, 0xc7, 0x01, 0xc0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x07, + 0xc0, 0xff, 0xff, 0x03, 0x80, 0xe3, 0xc7, 0x01, 0x00, 0xe3, 0xc7, 0x00, + 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, + 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar vsplit_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar vsplitm_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, + 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, + 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, + 0x80, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, + 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar phand_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, + 0x7e, 0x04, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x70, 0x08, 0x00, 0x00, + 0x08, 0x08, 0x00, 0x00, 0x70, 0x14, 0x00, 0x00, 0x08, 0x22, 0x00, 0x00, + 0x30, 0x41, 0x00, 0x00, 0xc0, 0x20, 0x00, 0x00, 0x40, 0x12, 0x00, 0x00, + 0x80, 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar phandm_bits[] = { + 0xfe, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, + 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, + 0xfc, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, + 0xf8, 0xff, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, + 0xc0, 0x1f, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +static const uchar size_all_data_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x80, 0x81, 0xc0, 0x00, + 0xc0, 0xff, 0xff, 0x01, 0x80, 0x81, 0xc0, 0x00, 0x00, 0x81, 0x40, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar size_all_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, + 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc2, 0x21, 0x00, + 0x00, 0xc3, 0x61, 0x00, 0x80, 0xc3, 0xe1, 0x00, 0xc0, 0xff, 0xff, 0x01, + 0xe0, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0x01, 0x80, 0xc3, 0xe1, 0x00, + 0x00, 0xc3, 0x61, 0x00, 0x00, 0xc2, 0x21, 0x00, 0x00, 0xc0, 0x01, 0x00, + 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +static const uchar whatsthis_bits[] = { + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0xf0, 0x07, 0x00, + 0x09, 0x18, 0x0e, 0x00, 0x11, 0x1c, 0x0e, 0x00, 0x21, 0x1c, 0x0e, 0x00, + 0x41, 0x1c, 0x0e, 0x00, 0x81, 0x1c, 0x0e, 0x00, 0x01, 0x01, 0x07, 0x00, + 0x01, 0x82, 0x03, 0x00, 0xc1, 0xc7, 0x01, 0x00, 0x49, 0xc0, 0x01, 0x00, + 0x95, 0xc0, 0x01, 0x00, 0x93, 0xc0, 0x01, 0x00, 0x21, 0x01, 0x00, 0x00, + 0x20, 0xc1, 0x01, 0x00, 0x40, 0xc2, 0x01, 0x00, 0x40, 0x02, 0x00, 0x00, + 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; +static const uchar whatsthism_bits[] = { + 0x01, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x07, 0x00, 0x07, 0xf8, 0x0f, 0x00, + 0x0f, 0xfc, 0x1f, 0x00, 0x1f, 0x3e, 0x1f, 0x00, 0x3f, 0x3e, 0x1f, 0x00, + 0x7f, 0x3e, 0x1f, 0x00, 0xff, 0x3e, 0x1f, 0x00, 0xff, 0x9d, 0x0f, 0x00, + 0xff, 0xc3, 0x07, 0x00, 0xff, 0xe7, 0x03, 0x00, 0x7f, 0xe0, 0x03, 0x00, + 0xf7, 0xe0, 0x03, 0x00, 0xf3, 0xe0, 0x03, 0x00, 0xe1, 0xe1, 0x03, 0x00, + 0xe0, 0xe1, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, + 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; + +static const uchar busy_bits[] = { + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, + 0x41, 0xe0, 0xff, 0x00, 0x81, 0x20, 0x80, 0x00, 0x01, 0xe1, 0xff, 0x00, + 0x01, 0x42, 0x40, 0x00, 0xc1, 0x47, 0x40, 0x00, 0x49, 0x40, 0x55, 0x00, + 0x95, 0x80, 0x2a, 0x00, 0x93, 0x00, 0x15, 0x00, 0x21, 0x01, 0x0a, 0x00, + 0x20, 0x01, 0x11, 0x00, 0x40, 0x82, 0x20, 0x00, 0x40, 0x42, 0x44, 0x00, + 0x80, 0x41, 0x4a, 0x00, 0x00, 0x40, 0x55, 0x00, 0x00, 0xe0, 0xff, 0x00, + 0x00, 0x20, 0x80, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +static const uchar busym_bits[] = { + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, + 0x7f, 0xe0, 0xff, 0x00, 0xff, 0xe0, 0xff, 0x00, 0xff, 0xe1, 0xff, 0x00, + 0xff, 0xc3, 0x7f, 0x00, 0xff, 0xc7, 0x7f, 0x00, 0x7f, 0xc0, 0x7f, 0x00, + 0xf7, 0x80, 0x3f, 0x00, 0xf3, 0x00, 0x1f, 0x00, 0xe1, 0x01, 0x0e, 0x00, + 0xe0, 0x01, 0x1f, 0x00, 0xc0, 0x83, 0x3f, 0x00, 0xc0, 0xc3, 0x7f, 0x00, + 0x80, 0xc1, 0x7f, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0xe0, 0xff, 0x00, + 0x00, 0xe0, 0xff, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +// 16 x 16 +static const uchar openhand_bits[] = { + 0x80,0x01,0x58,0x0e,0x64,0x12,0x64,0x52,0x48,0xb2,0x48,0x92, + 0x16,0x90,0x19,0x80,0x11,0x40,0x02,0x40,0x04,0x40,0x04,0x20, + 0x08,0x20,0x10,0x10,0x20,0x10,0x00,0x00}; +static const uchar openhandm_bits[] = { + 0x80,0x01,0xd8,0x0f,0xfc,0x1f,0xfc,0x5f,0xf8,0xff,0xf8,0xff, + 0xfe,0xff,0xff,0xff,0xff,0x7f,0xfe,0x7f,0xfc,0x7f,0xfc,0x3f, + 0xf8,0x3f,0xf0,0x1f,0xe0,0x1f,0x00,0x00}; +static const uchar closedhand_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0x48,0x32,0x08,0x50, + 0x10,0x40,0x18,0x40,0x04,0x40,0x04,0x20,0x08,0x20,0x10,0x10, + 0x20,0x10,0x20,0x10,0x00,0x00,0x00,0x00}; +static const uchar closedhandm_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0xf8,0x3f,0xf8,0x7f, + 0xf0,0x7f,0xf8,0x7f,0xfc,0x7f,0xfc,0x3f,0xf8,0x3f,0xf0,0x1f, + 0xe0,0x1f,0xe0,0x1f,0x00,0x00,0x00,0x00}; + +void QVNCCursorPrivate::createSystemCursor(int id) +{ + if (!systemCursorTableInit) { + for (int i = 0; i <= Qt::LastCursor; i++) + systemCursorTable[i] = 0; + systemCursorTableInit = true; + } + switch (id) { + // 16x16 cursors + case Qt::ArrowCursor: + systemCursorTable[Qt::ArrowCursor] = + new QVNCCursorPrivate(cur_arrow_bits, mcur_arrow_bits, 16, 16, 0, 0); + break; + + case Qt::UpArrowCursor: + systemCursorTable[Qt::UpArrowCursor] = + new QVNCCursorPrivate(cur_up_arrow_bits, mcur_up_arrow_bits, 16, 16, 7, 0); + break; + + case Qt::CrossCursor: + systemCursorTable[Qt::CrossCursor] = + new QVNCCursorPrivate(cur_cross_bits, mcur_cross_bits, 16, 16, 7, 7); + break; + + case Qt::IBeamCursor: + systemCursorTable[Qt::IBeamCursor] = + new QVNCCursorPrivate(cur_ibeam_bits, mcur_ibeam_bits, 16, 16, 7, 7); + break; + + case Qt::SizeVerCursor: + systemCursorTable[Qt::SizeVerCursor] = + new QVNCCursorPrivate(cur_ver_bits, mcur_ver_bits, 16, 16, 7, 7); + break; + + case Qt::SizeHorCursor: + systemCursorTable[Qt::SizeHorCursor] = + new QVNCCursorPrivate(cur_hor_bits, mcur_hor_bits, 16, 16, 7, 7); + break; + + case Qt::SizeBDiagCursor: + systemCursorTable[Qt::SizeBDiagCursor] = + new QVNCCursorPrivate(cur_bdiag_bits, mcur_bdiag_bits, 16, 16, 7, 7); + break; + + case Qt::SizeFDiagCursor: + systemCursorTable[Qt::SizeFDiagCursor] = + new QVNCCursorPrivate(cur_fdiag_bits, mcur_fdiag_bits, 16, 16, 7, 7); + break; + + case Qt::BlankCursor: + systemCursorTable[Qt::BlankCursor] = + new QVNCCursorPrivate(0, 0, 0, 0, 0, 0); + break; + + // 20x20 cursors + case Qt::ForbiddenCursor: + systemCursorTable[Qt::ForbiddenCursor] = + new QVNCCursorPrivate(forbidden_bits, forbiddenm_bits, 20, 20, 10, 10); + break; + + // 32x32 cursors + case Qt::WaitCursor: + systemCursorTable[Qt::WaitCursor] = + new QVNCCursorPrivate(wait_data_bits, wait_mask_bits, 32, 32, 15, 15); + break; + + case Qt::SplitVCursor: + systemCursorTable[Qt::SplitVCursor] = + new QVNCCursorPrivate(vsplit_bits, vsplitm_bits, 32, 32, 15, 15); + break; + + case Qt::SplitHCursor: + systemCursorTable[Qt::SplitHCursor] = + new QVNCCursorPrivate(hsplit_bits, hsplitm_bits, 32, 32, 15, 15); + break; + + case Qt::SizeAllCursor: + systemCursorTable[Qt::SizeAllCursor] = + new QVNCCursorPrivate(size_all_data_bits, size_all_mask_bits, 32, 32, 15, 15); + break; + + case Qt::PointingHandCursor: + systemCursorTable[Qt::PointingHandCursor] = + new QVNCCursorPrivate(phand_bits, phandm_bits, 32, 32, 0, 0); + break; + + case Qt::WhatsThisCursor: + systemCursorTable[Qt::WhatsThisCursor] = + new QVNCCursorPrivate(whatsthis_bits, whatsthism_bits, 32, 32, 0, 0); + break; + case Qt::BusyCursor: + systemCursorTable[Qt::BusyCursor] = + new QVNCCursorPrivate(busy_bits, busym_bits, 32, 32, 0, 0); + break; + + case Qt::OpenHandCursor: + systemCursorTable[Qt::OpenHandCursor] = + new QVNCCursorPrivate(openhand_bits, openhandm_bits, 16, 16, 8, 8); + break; + case Qt::ClosedHandCursor: + systemCursorTable[Qt::ClosedHandCursor] = + new QVNCCursorPrivate(closedhand_bits, closedhandm_bits, 16, 16, 8, 8); + break; + default: + qWarning("Unknown system cursor %d", id); + } +} + +void QVNCCursorPrivate::set(Qt::CursorShape id) +{ + QVNCCursorPrivate *cursor = 0; + if (id >= 0 && id <= Qt::LastCursor) { + if (!systemCursorTable[id]) + createSystemCursor(id); + cursor = systemCursorTable[id]; + } + + if (cursor == 0) { + if (!systemCursorTable[Qt::ArrowCursor]) + createSystemCursor(Qt::ArrowCursor); + cursor = systemCursorTable[Qt::ArrowCursor]; + } + cursorImage = cursor->cursorImage; + hot = cursor->hot; +} + +void QVNCCursorPrivate::set(const uchar *data, const uchar *mask, + int width, int height, int hx, int hy) +{ + hot.setX(hx); + hot.setY(hy); + + cursorImage = QImage(width,height, QImage::Format_Indexed8); + + if (!width || !height || !data || !mask || cursorImage.isNull()) + return; + + cursorImage.setNumColors(3); + cursorImage.setColor(0, 0xff000000); + cursorImage.setColor(1, 0xffffffff); + cursorImage.setColor(2, 0x00000000); + + int bytesPerLine = (width + 7) / 8; + int p = 0; + int d, m; + + int x = -1, w = 0; + + uchar *cursor_data = cursorImage.bits(); + int bpl = cursorImage.bytesPerLine(); + for (int i = 0; i < height; i++) + { + for (int j = 0; j < bytesPerLine; j++, data++, mask++) + { + for (int b = 0; b < 8 && j*8+b < width; b++) + { + d = *data & (1 << b); + m = *mask & (1 << b); + if (d && m) p = 0; + else if (!d && m) p = 1; + else p = 2; + cursor_data[j*8+b] = p; + + // calc region + if (x < 0 && m) + x = j*8+b; + else if (x >= 0 && !m) { + x = -1; + w = 0; + } + if (m) + w++; + } + } + if (x >= 0) { + x = -1; + w = 0; + } + cursor_data += bpl; + } + +} + +QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/vnc/qvnccursor.h b/src/plugins/graphicssystems/vnc/qvnccursor.h new file mode 100644 index 0000000..1c0ce8a --- /dev/null +++ b/src/plugins/graphicssystems/vnc/qvnccursor.h @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QVNCCURSOR_H +#define QVNCCURSOR_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QVNCGraphicsSystemScreen; +class QVNCServer; + +// Cursor graphics management +class QVNCCursorPrivate { +public: + QVNCCursorPrivate(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) + { set(data, mask, width, height, hotX, hotY); } + QImage * image() { return &cursorImage; } + QPoint hotspot() { return hot; } + QImage cursorImage; + QPoint hot; + void set(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); + void set(Qt::CursorShape); +private: + static void createSystemCursor(int id); +}; + +class QVNCCursor { +public: + QVNCCursor(QVNCServer *, QVNCGraphicsSystemScreen *); + + // input methods + void setCursorMode(bool vnc); + void setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); + void setCursor(Qt::CursorShape shape); + void pointerEvent(QMouseEvent & event); + + // output methods + QRect drawCursor(QPainter &); + QRect dirtyRect(); + + // VNC client communication + void sendClientCursor(); + void clearClientCursor(); +private: + bool useVncCursor; // VNC or local + + QRect currentRect; // next place to draw the cursor + QRect prevRect; // last place the cursor was drawn + + QVNCServer * server; // VNC server to get events from + QVNCGraphicsSystemScreen * screen; // Where to request an update + QWidget * currentWidget; // widget currently under the cursor + + QVNCCursorPrivate * d_ptr; +}; + +QT_END_NAMESPACE + +#endif // QVNCCURSOR_H diff --git a/src/plugins/graphicssystems/vnc/qvncserver.cpp b/src/plugins/graphicssystems/vnc/qvncserver.cpp index 36d8cc6..ad20eec 100644 --- a/src/plugins/graphicssystems/vnc/qvncserver.cpp +++ b/src/plugins/graphicssystems/vnc/qvncserver.cpp @@ -349,13 +349,13 @@ bool QRfbClientCutText::read(QTcpSocket *s) //=========================================================================== QVNCServer::QVNCServer(QVNCGraphicsSystemScreen *screen) - : qvnc_screen(screen) + : qvnc_screen(screen), cursor(0) { init(5900); } QVNCServer::QVNCServer(QVNCGraphicsSystemScreen *screen, int id) - : qvnc_screen(screen) + : qvnc_screen(screen), cursor(0) { init(5900 + id); } @@ -679,6 +679,7 @@ void QVNCServer::setEncodings() DesktopSize = -223 }; + supportCursor = false; if (encodingsPending && (unsigned)client->bytesAvailable() >= encodingsPending * sizeof(quint32)) { for (int i = 0; i < encodingsPending; ++i) { @@ -782,6 +783,8 @@ void QVNCServer::setEncodings() qDebug("QVNCServer::setEncodings: fallback using raw"); #endif } + if (cursor) + cursor->setCursorMode(supportCursor); } void QVNCServer::frameBufferUpdateRequest() @@ -830,7 +833,10 @@ void QVNCServer::pointerEvent() if (buttonChange(buttons, ev.buttons, &button, &isPress)) type = isPress ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; QMouseEvent me(type, QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), button, ev.buttons, keymod); - QApplicationPrivate::handleMouseEvent(0, me); + if (cursor) + cursor->pointerEvent(me); + else + QApplicationPrivate::handleMouseEvent(0, me); buttons = ev.buttons; handleMsg = false; } diff --git a/src/plugins/graphicssystems/vnc/qvncserver.h b/src/plugins/graphicssystems/vnc/qvncserver.h index ed07ce1..351c094 100644 --- a/src/plugins/graphicssystems/vnc/qvncserver.h +++ b/src/plugins/graphicssystems/vnc/qvncserver.h @@ -466,6 +466,7 @@ public: inline bool hasClientCursor() const { return qvnc_cursor != 0; } #endif + void setCursor(QVNCCursor *c) { cursor = c; } private: void setPixelFormat(); void setEncodings(); @@ -516,6 +517,7 @@ private: #endif QRfbEncoder *encoder; + QVNCCursor * cursor; }; diff --git a/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp b/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp index a3bce49..24ae846 100644 --- a/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp +++ b/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp @@ -54,6 +54,7 @@ QVNCWindowSurface::QVNCWindowSurface(QVNCGraphicsSystem *graphicsSystem, mScreen(screen), visibleFlag(false) { + Q_UNUSED(graphicsSystem); mImage = QImage(window->size(), mScreen->format()); } diff --git a/src/plugins/graphicssystems/vnc/vnc.pro b/src/plugins/graphicssystems/vnc/vnc.pro index 20e48ad..69cd1f7 100644 --- a/src/plugins/graphicssystems/vnc/vnc.pro +++ b/src/plugins/graphicssystems/vnc/vnc.pro @@ -11,6 +11,8 @@ HEADERS = qgraphicssystem_vnc.h qwindowsurface_vnc.h HEADERS += qvncserver.h SOURCES += qvncserver.cpp +HEADERS += qvnccursor.h +SOURCES += qvnccursor.cpp target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems INSTALLS += target -- cgit v0.12 From 2f76e87dba10d001ae7c3e445ef2fade9a255c2b Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Fri, 30 Oct 2009 10:31:34 -0700 Subject: Make QGraphicsSystemScreen a QObject This has several advantages: We already see the various screen drivers making QObject-based helper classes for timers, socketNotifiers etc Also, this gives us more introspection from applications that now can query things from the screen. Reviewed-by: TrustMe --- src/gui/painting/qgraphicssystem.cpp | 4 ++++ src/gui/painting/qgraphicssystem_p.h | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qgraphicssystem.cpp b/src/gui/painting/qgraphicssystem.cpp index 777b93d..1565c45 100644 --- a/src/gui/painting/qgraphicssystem.cpp +++ b/src/gui/painting/qgraphicssystem.cpp @@ -89,6 +89,10 @@ QList QGraphicsSystem::screens() const return QList(); } +QGraphicsSystemScreen::QGraphicsSystemScreen(QObject *parent) + : QObject(parent) +{} + QGraphicsSystemScreen::~QGraphicsSystemScreen() { } diff --git a/src/gui/painting/qgraphicssystem_p.h b/src/gui/painting/qgraphicssystem_p.h index ea1031f..a2d03f0 100644 --- a/src/gui/painting/qgraphicssystem_p.h +++ b/src/gui/painting/qgraphicssystem_p.h @@ -60,9 +60,11 @@ QT_BEGIN_NAMESPACE class QPixmapFilter; -class Q_GUI_EXPORT QGraphicsSystemScreen +class Q_GUI_EXPORT QGraphicsSystemScreen : public QObject { + Q_OBJECT public: + QGraphicsSystemScreen(QObject *parent = 0); virtual ~QGraphicsSystemScreen(); virtual QRect geometry() const = 0; -- cgit v0.12 From a69dce80169686ae156ec5e1898ab33676f3eb40 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 2 Nov 2009 13:07:18 +0100 Subject: Use correct keycode for Ctrl+ --- .../graphicssystems/testlite/qwindowsurface_testlite.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp index b14efb8..9e24f55 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp @@ -521,20 +521,22 @@ void QTestLiteWindowSurface::handleKeyEvent(QEvent::Type type, void *ev) int count = XLookupString(e, chars.data(), chars.size(), &keySym, 0); -// qDebug() << "QTLWS::handleKeyEvent" << count << hex << "XKeysym:" << keySym; -// if (count) -// qDebug() << hex << int(chars[0]) << "String:" << chars; +// qDebug() << "QTLWS::handleKeyEvent" << count << hex << "XKeysym:" << keySym; +// if (count) +// qDebug() << hex << int(chars[0]) << "String:" << chars; Qt::KeyboardModifiers modifiers = translateModifiers(e->state); int qtcode = lookupCode(keySym); -// qDebug() << "lookup: " << hex << keySym << qtcode; +// qDebug() << "lookup: " << hex << keySym << qtcode << "mod" << modifiers; if (qtcode) { QKeyEvent keyEvent(type, qtcode, modifiers); QApplicationPrivate::handleKeyEvent(window(), &keyEvent); } else if (chars[0]) { int qtcode = chars.toUpper()[0]; //Not exactly right... + if (modifiers & Qt::ControlModifier && qtcode < ' ') + qtcode = chars[0] + '@'; QKeyEvent keyEvent(type, qtcode, modifiers, QString::fromLatin1(chars)); QApplicationPrivate::handleKeyEvent(window(), &keyEvent); } else { -- cgit v0.12 From 505f9cb67a79ccfbd6b9216cf4ad66521fc5d990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 2 Nov 2009 14:56:59 +0100 Subject: initial commit of minimaldfb --- src/plugins/graphicssystems/minimaldfb/main.cpp | 71 ++++++++ .../graphicssystems/minimaldfb/minimaldfb.pro | 13 ++ .../minimaldfb/qgraphicssystem_minimaldfb.cpp | 183 +++++++++++++++++++++ .../minimaldfb/qgraphicssystem_minimaldfb.h | 93 +++++++++++ .../minimaldfb/qwindowsurface_minimaldfb.cpp | 150 +++++++++++++++++ .../minimaldfb/qwindowsurface_minimaldfb.h | 80 +++++++++ 6 files changed, 590 insertions(+) create mode 100644 src/plugins/graphicssystems/minimaldfb/main.cpp create mode 100644 src/plugins/graphicssystems/minimaldfb/minimaldfb.pro create mode 100644 src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp create mode 100644 src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h create mode 100644 src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp create mode 100644 src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h diff --git a/src/plugins/graphicssystems/minimaldfb/main.cpp b/src/plugins/graphicssystems/minimaldfb/main.cpp new file mode 100644 index 0000000..fe9407c --- /dev/null +++ b/src/plugins/graphicssystems/minimaldfb/main.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qgraphicssystem_minimaldfb.h" + +QT_BEGIN_NAMESPACE + +class QDirectFbGraphicsSystemPlugin : public QGraphicsSystemPlugin +{ +public: + QStringList keys() const; + QGraphicsSystem *create(const QString&); +}; + +QStringList QDirectFbGraphicsSystemPlugin::keys() const +{ + QStringList list; + list << "MinimalDfb"; + return list; +} + +QGraphicsSystem* QDirectFbGraphicsSystemPlugin::create(const QString& system) +{ + if (system.toLower() == "minimaldfb") + return new QDirectFbGraphicsSystem; + + return 0; +} + +Q_EXPORT_PLUGIN2(directfb, QDirectFbGraphicsSystemPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro b/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro new file mode 100644 index 0000000..a3b7f5c --- /dev/null +++ b/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro @@ -0,0 +1,13 @@ +TARGET = qdirectfbgraphicssystem +include(../../qpluginbase.pri) + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems + +QMAKE_CXXFLAGS += -I/usr/include/directfb +LIBS += -ldirectfb -lfusion -ldirect -lpthread + +SOURCES = main.cpp qgraphicssystem_minimaldfb.cpp qwindowsurface_minimaldfb.cpp +HEADERS = qgraphicssystem_minimaldfb.h qwindowsurface_minimaldfb.h + +target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +INSTALLS += target diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp new file mode 100644 index 0000000..7c06748 --- /dev/null +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp @@ -0,0 +1,183 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgraphicssystem_minimaldfb.h" +#include "qwindowsurface_minimaldfb.h" +#include +#include +#include + +QT_BEGIN_NAMESPACE + +QDirectFbGraphicsSystemScreen::QDirectFbGraphicsSystemScreen(IDirectFB *dfb, int display) +{ + DFBResult result = dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &m_layer); + if (result != DFB_OK) { + DirectFBError("QDirectFbGraphicsSystemScreen::connect: " + "Unable to get primary display layer!", result); + } + + IDirectFBSurface *topLevelSurface; + m_layer->GetSurface(m_layer, &topLevelSurface); + m_format = QDirectFbGraphicsSystem::imageFormatFromSurface(topLevelSurface); + + result = m_layer->GetScreen(m_layer,&m_screen); + if (result != DFB_OK) { + DirectFBError("QDirectFbGraphicsSystemScreen: Failed to get screen", result); + } + + int w(0),h(0); + m_screen->GetSize(m_screen,&w,&h); + m_geometry = QRect(0,0,w,h); + const int dpi = 72; + const qreal inch = 25.4; + m_depth = 32; + m_physicalSize = QSize(qRound(w * inch / dpi), qRound(h *inch / dpi)); +} + +QDirectFbGraphicsSystemScreen::~QDirectFbGraphicsSystemScreen() +{ +} + +IDirectFBWindow *QDirectFbGraphicsSystemScreen::createWindow(const QRect &rect) +{ + IDirectFBWindow *window; + + DFBWindowDescription description; + memset(&description,0,sizeof(DFBWindowDescription)); +// description.flags = DWDESC_SURFACE_CAPS; + description.width = rect.width(); + description.height = rect.height(); + description.posx = rect.x(); + description.posy = rect.y(); +// description.flags |= DWDESC_OPTIONS; +// description.options = DWOP_GHOST|DWOP_ALPHACHANNEL; +// description.caps = (DFBWindowDescription) (DWCAPS_NODECORATION|DWCAPS_DOUBLEBUFFER); +// description.surface_caps = DSCAPS_PREMULTIPLIED; + + DFBResult result = m_layer->CreateWindow(m_layer,&description,&window); + if (result != DFB_OK) { + DirectFBError("QDirectFbGraphicsSystemScreen: failed to create window",result); + } + return window; +} + +QDirectFbGraphicsSystem::QDirectFbGraphicsSystem() +{ + DFBResult result = DFB_OK; + + { // pass command line arguments to DirectFB + const QStringList args = QCoreApplication::arguments(); + int argc = args.size(); + char **argv = new char*[argc]; + + for (int i = 0; i < argc; ++i) + argv[i] = qstrdup(args.at(i).toLocal8Bit().constData()); + + result = DirectFBInit(&argc, &argv); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreen: error initializing DirectFB", + result); + } + delete[] argv; + } + + result = DirectFBCreate(&dfb); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreen: error creating DirectFB interface", + result); + } + + mPrimaryScreen = new QDirectFbGraphicsSystemScreen(dfb,0); + mScreens.append(mPrimaryScreen); +} + +QPixmapData *QDirectFbGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const +{ + return new QRasterPixmapData(type); +} + +QWindowSurface *QDirectFbGraphicsSystem::createWindowSurface(QWidget *widget) const +{ + return new QDirectFbWindowSurface (mPrimaryScreen, widget); +} + +QImage::Format QDirectFbGraphicsSystem::imageFormatFromSurface(IDirectFBSurface *surface) +{ + DFBSurfacePixelFormat format; + surface->GetPixelFormat(surface, &format); + + switch (format) { + case DSPF_LUT8: + return QImage::Format_Indexed8; + case DSPF_RGB24: + return QImage::Format_RGB888; + case DSPF_ARGB4444: + return QImage::Format_ARGB4444_Premultiplied; + case DSPF_RGB444: + return QImage::Format_RGB444; + case DSPF_RGB555: + case DSPF_ARGB1555: + return QImage::Format_RGB555; + case DSPF_RGB16: + return QImage::Format_RGB16; + case DSPF_ARGB6666: + return QImage::Format_ARGB6666_Premultiplied; + case DSPF_RGB18: + return QImage::Format_RGB666; + case DSPF_RGB32: + return QImage::Format_RGB32; + case DSPF_ARGB: { + DFBSurfaceCapabilities caps; + const DFBResult result = surface->GetCapabilities(surface, &caps); + Q_ASSERT(result == DFB_OK); + Q_UNUSED(result); + return (caps & DSCAPS_PREMULTIPLIED + ? QImage::Format_ARGB32_Premultiplied + : QImage::Format_ARGB32); } + default: + break; + } + return QImage::Format_Invalid; + +} + +QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h new file mode 100644 index 0000000..fbc5498 --- /dev/null +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_MINIMAL_H +#define QGRAPHICSSYSTEM_MINIMAL_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QDirectFbGraphicsSystemScreen : public QGraphicsSystemScreen +{ +public: + QDirectFbGraphicsSystemScreen(IDirectFB *dfb, int display); + ~QDirectFbGraphicsSystemScreen(); + + QRect geometry() const { return m_geometry; } + int depth() const { return m_depth; } + QImage::Format format() const { return m_format; } + QSize physicalSize() const { return m_physicalSize; } + + IDirectFBWindow *createWindow(const QRect &); + +public: + QRect m_geometry; + int m_depth; + QImage::Format m_format; + QSize m_physicalSize; + + IDirectFBScreen *m_screen; + IDirectFBDisplayLayer *m_layer; +}; + +class QDirectFbGraphicsSystem : public QGraphicsSystem +{ +public: + QDirectFbGraphicsSystem(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QWindowSurface *createWindowSurface(QWidget *widget) const; + + QList screens() const { return mScreens; } + + static QImage::Format imageFormatFromSurface(IDirectFBSurface *surface); + +private: + IDirectFB *dfb; + QDirectFbGraphicsSystemScreen *mPrimaryScreen; + QList mScreens; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp new file mode 100644 index 0000000..76fad68 --- /dev/null +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -0,0 +1,150 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsurface_minimaldfb.h" +#include "qgraphicssystem_minimaldfb.h" +#include + +QT_BEGIN_NAMESPACE + +QDirectFbWindowSurface::QDirectFbWindowSurface + (QDirectFbGraphicsSystemScreen *screen, QWidget *window) + : QWindowSurface(window), m_screen(screen), m_lock(false) +{ + window->setWindowSurface(this); + m_dfbWindow = m_screen->createWindow(window->rect()); + DFBResult result = m_dfbWindow->GetSurface(m_dfbWindow,&m_dfbSurface); + if (result != DFB_OK) { + DirectFBError("QDirectFbWindowSurface::QDirectFbWindowSurface: unable to get windows surface",result); + } + + + +} + +QDirectFbWindowSurface::~QDirectFbWindowSurface() +{ +} + +QPaintDevice *QDirectFbWindowSurface::paintDevice() +{ + return m_image; +} + +void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + Q_UNUSED(offset); + + const quint8 windowOpacity = quint8(widget->windowOpacity() * 0xff); + m_dfbWindow->SetOpacity(m_dfbWindow,windowOpacity); + + QVector rects = region.rects(); + for (int i = 0 ; i < rects.size(); i++) { + const QRect rect = rects.at(i); + DFBRegion dfbReg = { rect.x() + offset.x(),rect.y() + offset.y(),rect.right() + offset.x(),rect.bottom() + offset.y()}; + m_dfbSurface->Flip(m_dfbSurface,&dfbReg,DSFLIP_BLIT); + } +} + +void QDirectFbWindowSurface::setGeometry(const QRect &rect) +{ +// qDebug() << "QDirectF.bWindowSurface::setGeometry:" << (long)this << rect; + bool wasLocked = false; + if (m_lock){ + m_dfbSurface->Unlock(m_dfbSurface); + wasLocked = true; + } + m_dfbSurface->Release(m_dfbSurface); + QWindowSurface::setGeometry(rect); + m_dfbWindow->SetBounds(m_dfbWindow, rect.x(),rect.y(), + rect.width(), rect.height()); +// m_dfbWindow->Resize(m_dfbWindow,rect.width(),rect.height()); +// m_dfbWindow->MoveTo(m_dfbWindow,rect.x(),rect.y()); + DFBResult result = m_dfbWindow->GetSurface(m_dfbWindow,&m_dfbSurface); + if (result != DFB_OK) + qDebug() << "could not resurface"; + + if (wasLocked) + lockSurfaceToImage(); +} + +bool QDirectFbWindowSurface::scroll(const QRegion &area, int dx, int dy) +{ + return QWindowSurface::scroll(area, dx, dy); +} + +void QDirectFbWindowSurface::beginPaint(const QRegion ®ion) +{ + Q_UNUSED(region); + if (!m_lock) + lockSurfaceToImage(); +} + +void QDirectFbWindowSurface::endPaint(const QRegion ®ion) +{ + Q_UNUSED(region); + if (m_lock){ + m_dfbSurface->Unlock(m_dfbSurface); + m_lock = false; + } +} + +void QDirectFbWindowSurface::lockSurfaceToImage() +{ + if (m_lock) + return; + m_lock = true; + + int w,h; + m_dfbSurface->GetSize(m_dfbSurface,&w,&h); + uchar *data; + int bpl; + DFBResult result = m_dfbSurface->Lock(m_dfbSurface,static_cast(DSLF_READ|DSLF_WRITE),reinterpret_cast(&data),&bpl); + if (!result == DFB_OK) { + DirectFBError("QDirectFbWindowSurface::lockSurfaceToImage() failed to lock surface",result); + return; + } + QImage::Format format = QDirectFbGraphicsSystem::imageFormatFromSurface(m_dfbSurface); + m_image = new QImage(data,w,h,bpl,format); +} + +QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h new file mode 100644 index 0000000..fe88878 --- /dev/null +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSURFACE_MINIMAL_H +#define QWINDOWSURFACE_MINIMAL_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QDirectFbGraphicsSystemScreen; + +class QDirectFbWindowSurface : public QWindowSurface +{ +public: + QDirectFbWindowSurface + (QDirectFbGraphicsSystemScreen *screen, QWidget *window); + ~QDirectFbWindowSurface(); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void setGeometry(const QRect &rect); + bool scroll(const QRegion &area, int dx, int dy); + + void beginPaint(const QRegion ®ion); + void endPaint(const QRegion ®ion); + +private: + void lockSurfaceToImage(); + + QDirectFbGraphicsSystemScreen *m_screen; + QImage *m_image; + bool m_lock; + + IDirectFBWindow *m_dfbWindow; + IDirectFBSurface *m_dfbSurface; +}; + +QT_END_NAMESPACE + +#endif -- cgit v0.12 From f8c70ab13a3f54da54e2c68a2a96ef18916f9178 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 4 Nov 2009 13:46:09 +0100 Subject: Fix autotest screenNumberForPoint on Lighthouse --- src/gui/kernel/qdesktopwidget_lite.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qdesktopwidget_lite.cpp b/src/gui/kernel/qdesktopwidget_lite.cpp index fed1f9c..a3535fb 100644 --- a/src/gui/kernel/qdesktopwidget_lite.cpp +++ b/src/gui/kernel/qdesktopwidget_lite.cpp @@ -131,7 +131,7 @@ int QDesktopWidget::screenNumber(const QPoint &p) const if (screens[i]->geometry().contains(p)) return i; - return -1; + return primaryScreen(); //even better would be closest screen } void QDesktopWidget::resizeEvent(QResizeEvent *) -- cgit v0.12 From a43f98dea9024f84223ae8c8c59db1b4e5ead588 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 4 Nov 2009 15:52:03 +0100 Subject: Compile after latest qvfbhdr changes --- src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.cpp b/src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.cpp index 10e4e53..77942c9 100644 --- a/src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.cpp +++ b/src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.cpp @@ -85,8 +85,7 @@ private: QVFbGraphicsSystemScreenKeyboardHandler::QVFbGraphicsSystemScreenKeyboardHandler() { int displayId = 0; //TODO displayId - const QString keyboardDev = QString::fromLatin1(QT_VFB_KEYBOARD_PIPE) - .arg(displayId); + const QString keyboardDev = QT_VFB_KEYBOARD_PIPE(displayId); kbdFD = -1; @@ -185,8 +184,7 @@ private: QVFbGraphicsSystemScreenMouseHandler::QVFbGraphicsSystemScreenMouseHandler() { int displayId = 0; //TODO: displayId - QString mouseDev = QString::fromLatin1(QT_VFB_MOUSE_PIPE) - .arg(displayId); + QString mouseDev = QT_VFB_MOUSE_PIPE(displayId); mouseFD = QT_OPEN(mouseDev.toLatin1().constData(), O_RDWR | O_NDELAY); @@ -301,7 +299,7 @@ void QVFbGraphicsSystemScreenPrivate::setDirty(const QRect &r) bool QVFbGraphicsSystemScreenPrivate::connect(int displayId) { - key_t key = ftok(QByteArray(QT_VFB_MOUSE_PIPE).replace("%1", QByteArray::number(displayId)), 'b'); + key_t key = ftok(QT_VFB_MOUSE_PIPE(displayId).toLatin1(), 'b'); if (key == -1) return false; -- cgit v0.12 From 49696780e9cf026b2a7063976eb42f823a6792d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 9 Nov 2009 14:07:50 +0100 Subject: Adding the blitter paint engine --- src/gui/painting/painting.pri | 2 + src/gui/painting/qpaintengine.h | 1 + src/gui/painting/qpaintengine_blitter.cpp | 638 ++++++++++++++++++++++++++++++ src/gui/painting/qpaintengine_blitter_p.h | 94 +++++ src/gui/painting/qpaintengine_raster_p.h | 2 + 5 files changed, 737 insertions(+) create mode 100644 src/gui/painting/qpaintengine_blitter.cpp create mode 100644 src/gui/painting/qpaintengine_blitter_p.h diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 0f63198..4a32e71 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -17,6 +17,7 @@ HEADERS += \ painting/qpaintengine_p.h \ painting/qpaintengine_alpha_p.h \ painting/qpaintengine_preview_p.h \ + painting/qpaintengine_blitter_p.h \ painting/qpaintengineex_p.h \ painting/qpainter.h \ painting/qpainter_p.h \ @@ -63,6 +64,7 @@ SOURCES += \ painting/qpaintengine.cpp \ painting/qpaintengine_alpha.cpp \ painting/qpaintengine_preview.cpp \ + painting/qpaintengine_blitter.cpp \ painting/qpaintengineex.cpp \ painting/qpainter.cpp \ painting/qpainterpath.cpp \ diff --git a/src/gui/painting/qpaintengine.h b/src/gui/painting/qpaintengine.h index c540be4..321bbf5 100644 --- a/src/gui/painting/qpaintengine.h +++ b/src/gui/painting/qpaintengine.h @@ -213,6 +213,7 @@ public: OpenVG, OpenGL2, PaintBuffer, + Blitter, User = 50, // first user type id MaxUser = 100 // last user type id diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp new file mode 100644 index 0000000..367a8b5 --- /dev/null +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -0,0 +1,638 @@ +#include "private/qpaintengine_blitter_p.h" +#include "private/qpaintengine_raster_p.h" +#include "private/qpainter_p.h" +#include "private/qapplication_p.h" + +#define STATE_XFORM_SCALE 0x00000001 +#define STATE_XFORM_COMPLEX 0x00000002 + +#define STATE_BRUSH_PATTERN 0x00000010 +#define STATE_BRUSH_ALPHA 0x00000020 + +#define STATE_PEN_ENABLED 0x00000100 + +#define STATE_ANTIALIASING 0x00001000 +#define STATE_ALPHA 0x00002000 +#define STATE_BLENDING_COMPLEX 0x00004000 + +#define STATE_CLIPSYS_COMPLEX 0x00010000 +#define STATE_CLIP_COMPLEX 0x00020000 + +//#define RASTEROVERLAY + +#ifdef RASTEROVERLAY +QColor rasterColor(255,0,0,100); +QBrush rasterBrush(rasterColor); +#endif + +static inline void updateStateBits(uint *state, uint mask, bool on) +{ + *state = on ? (*state | mask) : (*state & ~mask); +} + +class CapabilitiesToStateMask +{ +public: + CapabilitiesToStateMask(QBlittable::Capabilities capabilities) + : m_capabilities(capabilities), + fillRectMask(0), fillRectState(0), + drawRectMask(0), drawRectState(0), + drawPixmapMask(0), drawPixmapState(0) + { + if (capabilities & QBlittable::SolidRectCapability) { + setFillRectMask(); + } + if (capabilities & QBlittable::SourcePixmapCapability) { + setSourcePixmapMask(); + } + if (capabilities & QBlittable::SourceOverPixmapCapability) { + setSourceOverPixmapMask(); + } + } + + inline bool canBlitterFillRect() const + { + return !fillRectState || (fillRectState & fillRectMask); + } + + inline bool canBlitterDrawRectMask() const + { + return drawRectState & drawRectMask; + } + + bool canBlitterDrawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) const + { + if ((!drawPixmapState) || drawPixmapState & drawPixmapMask) { + if (m_capabilities & (QBlittable::SourceOverPixmapCapability + | QBlittable::SourceOverScaledPixmapCapability)) { + if (r.size() != sr.size()) { + return m_capabilities & QBlittable::SourceOverScaledPixmapCapability; + } else { + return m_capabilities & QBlittable::SourceOverPixmapCapability; + } + } + if ((m_capabilities & QBlittable::SourcePixmapCapability) && r.size() == sr.size() && !pm.hasAlphaChannel()) { + return m_capabilities & QBlittable::SourcePixmapCapability; + } + } + return false; + } + + inline void updateFillRectBits(uint mask, bool on) { + updateStateBits(&fillRectState,mask,on); + } + + inline void updateDrawRectBits(uint mask, bool on) { + updateStateBits(&drawRectState,mask,on); + } + + inline void updateDrawPixmapBits(uint mask, bool on) { + updateStateBits(&drawPixmapState,mask,on); + } + inline void updateAllWithBits(uint mask, bool on) { + updateStateBits(&fillRectState,mask,on); + updateStateBits(&drawRectState,mask,on); + updateStateBits(&drawPixmapState,mask,on); + } + +public: + + void setFillRectMask() { + updateStateBits(&fillRectMask, STATE_XFORM_SCALE, false); + updateStateBits(&fillRectMask, STATE_XFORM_COMPLEX, false); + + updateStateBits(&fillRectMask, STATE_BRUSH_PATTERN, false); + updateStateBits(&fillRectMask, STATE_BRUSH_ALPHA, false); + + updateStateBits(&fillRectMask, STATE_PEN_ENABLED, false); + + updateStateBits(&fillRectMask, STATE_ANTIALIASING, false); + updateStateBits(&fillRectMask, STATE_ALPHA, false); + updateStateBits(&fillRectMask, STATE_BLENDING_COMPLEX, false); + + updateStateBits(&fillRectMask, STATE_CLIPSYS_COMPLEX, false); + updateStateBits(&fillRectMask, STATE_CLIP_COMPLEX, false); + } + + void setSourcePixmapMask() { + updateStateBits(&drawPixmapMask, STATE_XFORM_SCALE, true); + updateStateBits(&drawPixmapMask, STATE_XFORM_COMPLEX, false); + + updateStateBits(&drawPixmapMask, STATE_BRUSH_PATTERN, false); + updateStateBits(&drawPixmapMask, STATE_BRUSH_ALPHA, false); + + updateStateBits(&drawPixmapMask, STATE_PEN_ENABLED, false); + + updateStateBits(&drawPixmapMask, STATE_ANTIALIASING, false); + updateStateBits(&drawPixmapMask, STATE_ALPHA, false); + updateStateBits(&drawPixmapMask, STATE_BLENDING_COMPLEX, false); + + updateStateBits(&drawPixmapMask, STATE_CLIPSYS_COMPLEX, false); + updateStateBits(&drawPixmapMask, STATE_CLIP_COMPLEX, false); + } + + void setSourceOverPixmapMask() { + setSourcePixmapMask(); + } + + QBlittable::Capabilities m_capabilities; + uint fillRectMask; + uint fillRectState; + uint drawRectMask; + uint drawRectState; + uint drawPixmapMask; + uint drawPixmapState; +}; + +class QBlitterPaintEnginePrivate : public QPaintEngineExPrivate +{ +public: + QBlitterPaintEnginePrivate(QPaintDevice *p) + : QPaintEngineExPrivate(), + raster(new QRasterPaintEngine(p)), isBlitterLocked(false), + capabillities(0), hasXForm(false) + { + if (QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem()) { +// QBlittable *b = gs->createBlitter(p); +// if (b) { +// blitter=b; +// capabillities = new CapabilitiesToStateMask(blitter->capabilities()); +// blitter->unlock(); +// } else +// qWarning("No blitter returned from the graphics system. QBlitterPaintEngine will not work"); + } + + } + + inline void lock() { + if (!isBlitterLocked) { + raster->d_func()->rasterBuffer->prepare(blitter->lock()); + isBlitterLocked = true; + } + } + + inline void unlock() { + if (isBlitterLocked) { + blitter->unlock(); + isBlitterLocked = false; + } + } + + void fillRect(const QRectF &rect, const QColor &color) { + unlock(); + QRectF targetRect = rect; + if (hasXForm) { + targetRect = state->matrix.mapRect(rect); + } + QClipData *clipData = raster->state()->clip; + if (clipData) { + if (clipData->hasRectClip) + blitter->fillRect(targetRect & clipData->clipRect, color); + else if (clipData->hasRegionClip) { + QVector rects = clipData->clipRegion.rects(); + for ( int i = 0; i < rects.size(); i++ ) { + QRect intersectRect = rects.at(i).intersected(targetRect.toRect()); + if (!intersectRect.isEmpty()) { + blitter->fillRect(intersectRect,color); + } + } + } + }else { + if (targetRect.x() >= 0 && targetRect.y() >= 0 + && targetRect.width() <= raster->paintDevice()->width() + && targetRect.height() <= raster->paintDevice()->height()) + blitter->fillRect(targetRect,color); + else { + QRectF deviceRect(0,0,raster->paintDevice()->width(), raster->paintDevice()->height()); + blitter->fillRect(deviceRect&targetRect,color); + } + } + } + + void clipAndDrawPixmap(const QRectF &clip, const QRectF &target, const QPixmap &pm, const QRectF &sr) { + QRectF intersectedRect = clip.intersected(target); + if (intersectedRect.isEmpty()) + return; + + QRectF source = sr; + if(intersectedRect.size() != target.size()) { + qreal deltaTop = target.top() - intersectedRect.top(); + qreal deltaLeft = target.left() - intersectedRect.left(); + qreal deltaBottom = target.bottom() - intersectedRect.bottom(); + qreal deltaRight = target.right() - intersectedRect.right(); + source.adjust(-deltaLeft,-deltaTop,deltaRight,deltaBottom); + } + blitter->drawPixmap(intersectedRect, pm, source); + } + + void updateClip() { + const QClipData *clip = raster->d_func()->clip(); + bool complex = clip != 0 && !(clip->hasRectClip || clip->hasRegionClip); + capabillities->updateAllWithBits(STATE_CLIP_COMPLEX, complex); + } + + void systemStateChanged() { + raster->d_func()->systemStateChanged(); + } + + QRasterPaintEngine *raster; + QRasterPaintEngineState *state; + + QBlittable *blitter; + bool isBlitterLocked; + + CapabilitiesToStateMask *capabillities; + + uint hasXForm; +}; + +QBlitterPaintEngine::QBlitterPaintEngine(QPaintDevice *p) + : QPaintEngineEx(*(new QBlitterPaintEnginePrivate(p))) +{ +} + +QBlitterPaintEngine::~QBlitterPaintEngine() +{ + Q_D(QBlitterPaintEngine); +} + +QPainterState *QBlitterPaintEngine::createState(QPainterState *orig) const +{ + Q_D(const QBlitterPaintEngine); + return d->raster->createState(orig); +} + +bool QBlitterPaintEngine::begin(QPaintDevice *pdev) +{ + Q_D(QBlitterPaintEngine); + + d->raster->setSystemRect(systemRect()); + d->raster->setSystemClip(systemClip()); + + bool ok = d->raster->begin(pdev); + return ok; +} + + +bool QBlitterPaintEngine::end() +{ + Q_D(QBlitterPaintEngine); + + d->raster->setPaintDevice(0); + d->raster->setActive(false); + return d->raster->end(); +} + + +void QBlitterPaintEngine::fill(const QVectorPath &path, const QBrush &brush) +{ + Q_D(QBlitterPaintEngine); + + if (path.shape() == QVectorPath::RectangleHint) { + QRectF rect(((QPointF *) path.points())[0], ((QPointF *) path.points())[2]); + fillRect(rect, brush); + } else { + d->lock(); + d->raster->fill(path, brush); +#ifdef RASTEROVERLAY + d->raster->fill(path,rasterBrush); +#endif + } +} + +void QBlitterPaintEngine::fillRect(const QRectF &rect, const QColor &color) +{ + Q_D(QBlitterPaintEngine); + if (d->capabillities->canBlitterFillRect() && color.alpha() == 255) { + d->fillRect(rect, color); + } else { + d->lock(); + d->raster->fillRect(rect, color); +#ifdef RASTEROVERLAY + d->raster->fillRect(rect,rasterColor); +#endif + } +} + +void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) +{ + if(rect.size().isEmpty()) + return; + Q_D(QBlitterPaintEngine); + if (qbrush_style(brush) == Qt::SolidPattern + && qbrush_color(brush).alpha() == 255 + && d->capabillities->canBlitterFillRect()) + { + d->fillRect(rect, qbrush_color(brush)); + }else if (brush.style() == Qt::TexturePattern + && d->capabillities->canBlitterDrawPixmap(rect,brush.texture(),rect)) + { + bool rectIsFilled = false; + QRectF transformedRect = state()->matrix.mapRect(rect); + qreal x = transformedRect.x(); + qreal y = transformedRect.y(); + QPixmap pm = brush.texture(); + d->unlock(); + int srcX = (int)(rect.x() - d->raster->state()->brushOrigin.x()) % pm.width(); + if (srcX < 0) + srcX = pm.width() + srcX; + const int startX = srcX; + int srcY = (int)(rect.y() - d->raster->state()->brushOrigin.y())% pm.height(); + if (srcY < 0) + srcY = pm.height() + srcY; + while (!rectIsFilled) { + qreal blitWidth = (pm.width() ) - srcX; + qreal blitHeight = (pm.height() ) - srcY; + if (x + blitWidth > transformedRect.right()) + blitWidth = transformedRect.right() -x; + if (y + blitHeight > transformedRect.bottom()) + blitHeight = transformedRect.bottom() - y; + const QClipData *clipData = d->raster->d_func()->clip(); + if (clipData->hasRectClip) { + QRect targetRect = QRect(x,y,blitWidth,blitHeight).intersected(clipData->clipRect); + if (targetRect.isValid()) { + int tmpSrcX = srcX + (targetRect.x() - x); + int tmpSrcY = srcY + (targetRect.y() - y); + QRect srcRect(tmpSrcX,tmpSrcY,targetRect.width(),targetRect.height()); + d->blitter->drawPixmap(targetRect,pm,srcRect); + } + } else if (clipData->hasRegionClip) { + QVector clipRects = clipData->clipRegion.rects(); + QRect unclippedTargetRect(x,y,blitWidth,blitHeight); + QRegion intersectedRects = clipData->clipRegion.intersected(unclippedTargetRect); + + for ( int i = 0; i < intersectedRects.rects().size(); i++ ) { + QRect targetRect = intersectedRects.rects().at(i); + if (!targetRect.isValid() || targetRect.isEmpty()) + continue; + int tmpSrcX = srcX + (targetRect.x() - x); + int tmpSrcY = srcY + (targetRect.y() - y); + QRect srcRect(tmpSrcX,tmpSrcY,targetRect.width(),targetRect.height()); + d->blitter->drawPixmap(targetRect,pm,srcRect); + } + } else Q_ASSERT(false);//should never happen + x+=blitWidth; + if (x>=transformedRect.right()) { + x = transformedRect.x(); + srcX = startX; + srcY = 0; + y+=blitHeight; + if (y>=transformedRect.bottom()) + rectIsFilled = true; + } else + srcX = 0; + } + + } else { + d->lock(); + d->raster->fillRect(rect, brush); +#ifdef RASTEROVERLAY + d->raster->fillRect(rect,rasterBrush); +#endif + } + +} + +void QBlitterPaintEngine::stroke(const QVectorPath &path, const QPen &pen) +{ + Q_D(QBlitterPaintEngine); + d->lock(); + d->raster->stroke(path, pen); +#ifdef RASTEROVERLAY + d->raster->stroke(path,QPen(rasterColor)); +#endif +} + +void QBlitterPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) +{ + Q_D(QBlitterPaintEngine); + d->raster->clip(path, op); + d->updateClip(); +} +void QBlitterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op){ + Q_D(QBlitterPaintEngine); + d->raster->clip(rect,op); + d->updateClip(); +} +void QBlitterPaintEngine::clip(const QRegion ®ion, Qt::ClipOperation op) +{ + Q_D(QBlitterPaintEngine); + d->raster->clip(region,op); + d->updateClip(); +} + +void QBlitterPaintEngine::clipEnabledChanged() +{ + Q_D(QBlitterPaintEngine); + d->raster->clipEnabledChanged(); +} + +void QBlitterPaintEngine::penChanged() +{ + Q_D(QBlitterPaintEngine); + d->raster->penChanged(); + d->capabillities->updateDrawRectBits(STATE_PEN_ENABLED,qpen_style(d->state->pen) != Qt::NoPen); +} + +void QBlitterPaintEngine::brushChanged() +{ + Q_D(QBlitterPaintEngine); + d->raster->brushChanged(); + + bool solid = qbrush_style(d->state->brush) == Qt::SolidPattern; + + d->capabillities->updateDrawRectBits(STATE_BRUSH_PATTERN, !solid); + d->capabillities->updateDrawRectBits(STATE_BRUSH_ALPHA, + qbrush_color(d->state->brush).alpha() < 255); +} + +void QBlitterPaintEngine::brushOriginChanged() +{ + Q_D(QBlitterPaintEngine); + d->raster->brushOriginChanged(); +} + +void QBlitterPaintEngine::opacityChanged() +{ + Q_D(QBlitterPaintEngine); + d->raster->opacityChanged(); + + bool translucent = d->state->opacity < 1; + d->capabillities->updateAllWithBits(STATE_ALPHA,translucent); +} + +void QBlitterPaintEngine::compositionModeChanged() +{ + Q_D(QBlitterPaintEngine); + d->raster->compositionModeChanged(); + + bool nonTrivial = d->state->composition_mode != QPainter::CompositionMode_SourceOver + && d->state->composition_mode != QPainter::CompositionMode_Source; + + d->capabillities->updateAllWithBits(STATE_BLENDING_COMPLEX,nonTrivial); +} + +void QBlitterPaintEngine::renderHintsChanged() +{ + Q_D(QBlitterPaintEngine); + d->raster->renderHintsChanged(); + + bool aa = d->state->renderHints & QPainter::Antialiasing; + d->capabillities->updateFillRectBits(STATE_ANTIALIASING, aa); + d->capabillities->updateDrawRectBits(STATE_ANTIALIASING, aa); + +} + +void QBlitterPaintEngine::transformChanged() +{ + Q_D(QBlitterPaintEngine); + d->raster->transformChanged(); + + QTransform::TransformationType type = d->state->matrix.type(); + + d->capabillities->updateAllWithBits(STATE_XFORM_COMPLEX, type > QTransform::TxScale); + + d->hasXForm = type >= QTransform::TxTranslate; + +} + +void QBlitterPaintEngine::drawRects(const QRect *rects, int rectCount) +{ + Q_D(QBlitterPaintEngine); + if (d->capabillities->canBlitterDrawRectMask()) { + for (int i=0; ifillRect(rects[i], qbrush_color(d->state->brush)); + } + } else { + QPaintEngineEx::drawRects(rects, rectCount); +#ifdef RASTEROVERLAY + d->raster->drawRects(rects,rectCount); +#endif + } +} + +void QBlitterPaintEngine::drawRects(const QRectF *rects, int rectCount) +{ + Q_D(QBlitterPaintEngine); + if (d->capabillities->canBlitterDrawRectMask()) { + for (int i=0; ifillRect(rects[i], qbrush_color(d->state->brush)); + } + } else { + QPaintEngineEx::drawRects(rects, rectCount); +#ifdef RASTEROVERLAY + d->raster->drawRects(rects,rectCount); +#endif + } +} + +void QBlitterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) +{ + Q_D(QBlitterPaintEngine); + if (d->capabillities->canBlitterDrawPixmap(r,pm,sr)) { + + d->unlock(); + QRectF targetRect = r; + if (d->hasXForm) { + targetRect = state()->matrix.mapRect(r); + } + const QClipData *clipData = d->raster->d_func()->clip(); + if (clipData) { + if (clipData->hasRectClip) { + d->clipAndDrawPixmap(clipData->clipRect,targetRect,pm,sr); + }else if (clipData->hasRegionClip) { + QVectorrects = clipData->clipRegion.rects(); + for (int i = 0; iclipAndDrawPixmap(rects.at(i),targetRect,pm,sr); + } + } + } else { + QRectF deviceRect(0,0,d->raster->paintDevice()->width(), d->raster->paintDevice()->height()); + d->clipAndDrawPixmap(deviceRect,targetRect,pm,sr); + } + }else { + d->lock(); + d->raster->drawPixmap(r, pm, sr); +#ifdef RASTEROVERLAY + d->raster->fillRect(r,rasterColor); +#endif + } +} + +void QBlitterPaintEngine::drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, + Qt::ImageConversionFlags flags) +{ + Q_D(QBlitterPaintEngine); + d->lock(); + d->raster->drawImage(r, pm, sr, flags); +#ifdef RASTEROVERLAY + d->raster->fillRect(r,rasterColor); +#endif +} + + +void QBlitterPaintEngine::drawTextItem(const QPointF &pos, const QTextItem &ti) +{ + Q_D(QBlitterPaintEngine); + d->lock(); + d->raster->drawTextItem(pos, ti); +#ifdef RASTEROVERLAY + QFontMetricsF fm(ti.font()); + QRectF rect = fm.tightBoundingRect(ti.text()); + rect.moveBottomLeft(pos); + d->raster->fillRect(rect, rasterColor); +#endif +} + + +void QBlitterPaintEngine::setState(QPainterState *s) +{ + Q_D(QBlitterPaintEngine); + QPaintEngineEx::setState(s); + d->raster->setState(s); + d->state = (QRasterPaintEngineState *) s; + + clipEnabledChanged(); + penChanged(); + brushChanged(); + brushOriginChanged(); + opacityChanged(); + compositionModeChanged(); + renderHintsChanged(); + transformChanged(); + + d->updateClip(); +} + +class QBlittablePrivate +{ +public: + QBlittable::Capabilities caps; +}; + + +QBlittable::QBlittable(Capabilities caps) + : d_ptr(new QBlittablePrivate) +{ + d_ptr->caps = caps; +} + +QBlittable::QBlittable(QBlittablePrivate &d, Capabilities caps) + : d_ptr(&d) +{ + d_ptr->caps = caps; +} + + +QBlittable::~QBlittable() +{ + delete d_ptr; +} + + +QBlittable::Capabilities QBlittable::capabilities() const +{ + Q_D(const QBlittable); + return d->caps; +} + diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h new file mode 100644 index 0000000..90493a4 --- /dev/null +++ b/src/gui/painting/qpaintengine_blitter_p.h @@ -0,0 +1,94 @@ +#ifndef QPAINTENGINE_BLITTER_P_H +#define QPAINTENGINE_BLITTER_P_H + +#include "private/qpaintengineex_p.h" + +class QRasterPaintEngine; +class QBlittablePrivate; +class QBlitterPaintEnginePrivate; + +// ### find name +class Q_GUI_EXPORT QBlittable +{ + Q_DECLARE_PRIVATE(QBlittable); +public: + enum Capability { + + SolidRectCapability = 0x0001, + SourcePixmapCapability = 0x0002, + SourceOverPixmapCapability = 0x0004, + SourceOverScaledPixmapCapability = 0x0008, + + // Internal ones + OutlineCapability = 0x0001000, + }; + Q_DECLARE_FLAGS(Capabilities, Capability); + + QBlittable(Capabilities caps); + virtual ~QBlittable(); + + Capabilities capabilities() const; + + virtual void fillRect(const QRectF &rect, const QColor &color) = 0; + virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect) = 0; + + virtual QImage *lock() = 0; + virtual void unlock() = 0; + +protected: + QBlittablePrivate *d_ptr; + + QBlittable(QBlittablePrivate &d, Capabilities caps); +}; + + +class Q_GUI_EXPORT QBlitterPaintEngine : public QPaintEngineEx +{ + Q_DECLARE_PRIVATE(QBlitterPaintEngine); +public: + QBlitterPaintEngine(QPaintDevice *p); + ~QBlitterPaintEngine(); + + virtual QPainterState *createState(QPainterState *orig) const; + + virtual QPaintEngine::Type type() const { return Blitter; } + + virtual bool begin(QPaintDevice *pdev); + virtual bool end(); + + virtual void fill(const QVectorPath &path, const QBrush &brush); + virtual void stroke(const QVectorPath &path, const QPen &pen); + + virtual void clip(const QVectorPath &path, Qt::ClipOperation op); + virtual void clip(const QRect &rect, Qt::ClipOperation op); + virtual void clip(const QRegion ®ion, Qt::ClipOperation op); + + virtual void clipEnabledChanged(); + virtual void penChanged(); + virtual void brushChanged(); + virtual void brushOriginChanged(); + virtual void opacityChanged(); + virtual void compositionModeChanged(); + virtual void renderHintsChanged(); + virtual void transformChanged(); + + virtual void fillRect(const QRectF &rect, const QBrush &brush); + virtual void fillRect(const QRectF &rect, const QColor &color); + + virtual void drawRects(const QRect *rects, int rectCount); + virtual void drawRects(const QRectF *rects, int rectCount); + + virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr); + + virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags); + + virtual void drawTextItem(const QPointF &pos, const QTextItem &ti); + + virtual void setState(QPainterState *s); + + inline QPainterState *state() { return static_cast(QPaintEngine::state); } + inline const QPainterState *state() const { return static_cast(QPaintEngine::state); } + +}; + +#endif // QPAINTENGINE_BLITTER_P_H diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h index 1787d16..36e8b13 100644 --- a/src/gui/painting/qpaintengine_raster_p.h +++ b/src/gui/painting/qpaintengine_raster_p.h @@ -252,6 +252,8 @@ protected: QRasterPaintEngine(QRasterPaintEnginePrivate &d, QPaintDevice *); private: friend struct QSpanData; + friend class QBlitterPaintEngine; + friend class QBlitterPaintEnginePrivate; void init(); void fillRect(const QRectF &rect, QSpanData *data); -- cgit v0.12 From 617f572f459f4406b3f0316e45abdceba01c0c26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 9 Nov 2009 14:08:22 +0100 Subject: Using the correct geometry --- src/plugins/graphicssystems/minimaldfb/minimaldfb.pro | 2 +- .../graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp | 8 +++++++- .../graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp | 3 --- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro b/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro index a3b7f5c..d4c93fd 100644 --- a/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro +++ b/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro @@ -1,4 +1,4 @@ -TARGET = qdirectfbgraphicssystem +TARGET = qminimaldfb include(../../qpluginbase.pri) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp index 7c06748..bf46d4c 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp @@ -54,8 +54,10 @@ QDirectFbGraphicsSystemScreen::QDirectFbGraphicsSystemScreen(IDirectFB *dfb, int DirectFBError("QDirectFbGraphicsSystemScreen::connect: " "Unable to get primary display layer!", result); } + m_layer->SetCooperativeLevel(m_layer,DLSCL_SHARED); IDirectFBSurface *topLevelSurface; + //This line gives a warning m_layer->GetSurface(m_layer, &topLevelSurface); m_format = QDirectFbGraphicsSystem::imageFormatFromSurface(topLevelSurface); @@ -65,7 +67,11 @@ QDirectFbGraphicsSystemScreen::QDirectFbGraphicsSystemScreen(IDirectFB *dfb, int } int w(0),h(0); - m_screen->GetSize(m_screen,&w,&h); + //Asking the screen for its size gives the desktop geometry on X11 + //Thats not something we want, so as the topLevelSorface instead +// m_screen->GetSize(m_screen,&w,&h); + topLevelSurface->GetSize(topLevelSurface,&w,&h); + m_geometry = QRect(0,0,w,h); const int dpi = 72; const qreal inch = 25.4; diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp index 76fad68..e75a43c 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -55,9 +55,6 @@ QDirectFbWindowSurface::QDirectFbWindowSurface if (result != DFB_OK) { DirectFBError("QDirectFbWindowSurface::QDirectFbWindowSurface: unable to get windows surface",result); } - - - } QDirectFbWindowSurface::~QDirectFbWindowSurface() -- cgit v0.12 From d279d7d64fda1a1fd253a21875e1c832093b00c8 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 11 Nov 2009 11:34:12 +0100 Subject: Common framebuffer functionality for VNC and linuxfb, cursor event notification --- src/gui/kernel/qapplication.cpp | 8 +- src/gui/kernel/qapplication_p.h | 2 + src/gui/kernel/qwidget_lite.cpp | 24 + src/gui/painting/painting.pri | 5 +- src/gui/painting/qgraphicssystem_p.h | 2 + src/gui/painting/qgraphicssystemcursor.cpp | 600 +++++++++++++++++++++ src/gui/painting/qgraphicssystemcursor.h | 98 ++++ src/plugins/graphicssystems/fb_base/fb_base.cpp | 205 +++++++ src/plugins/graphicssystems/fb_base/fb_base.h | 90 ++++ src/plugins/graphicssystems/fb_base/fb_base.pro | 23 + src/plugins/graphicssystems/linuxfb/linuxfb.pro | 5 +- .../linuxfb/qgraphicssystem_linuxfb.cpp | 66 ++- .../linuxfb/qgraphicssystem_linuxfb.h | 26 +- .../linuxfb/qwindowsurface_linuxfb.cpp | 114 ---- .../linuxfb/qwindowsurface_linuxfb.h | 73 --- .../graphicssystems/vnc/qgraphicssystem_vnc.cpp | 110 +--- .../graphicssystems/vnc/qgraphicssystem_vnc.h | 50 +- src/plugins/graphicssystems/vnc/qvnccursor.cpp | 541 +------------------ src/plugins/graphicssystems/vnc/qvnccursor.h | 27 +- src/plugins/graphicssystems/vnc/qvncserver.cpp | 8 +- src/plugins/graphicssystems/vnc/qvncserver.h | 5 +- .../graphicssystems/vnc/qwindowsurface_vnc.cpp | 125 ----- .../graphicssystems/vnc/qwindowsurface_vnc.h | 80 --- src/plugins/graphicssystems/vnc/vnc.pro | 9 +- 24 files changed, 1173 insertions(+), 1123 deletions(-) create mode 100644 src/gui/painting/qgraphicssystemcursor.cpp create mode 100644 src/gui/painting/qgraphicssystemcursor.h create mode 100644 src/plugins/graphicssystems/fb_base/fb_base.cpp create mode 100644 src/plugins/graphicssystems/fb_base/fb_base.h create mode 100644 src/plugins/graphicssystems/fb_base/fb_base.pro delete mode 100644 src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.cpp delete mode 100644 src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.h delete mode 100644 src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp delete mode 100644 src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 74f2971..c36dc44 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -2655,7 +2655,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) { // Update cursor for alien/graphics widgets. const bool enterOnAlien = (enter && (isAlien(enter) || enter->testAttribute(Qt::WA_DontShowOnScreen))); -#if defined(Q_WS_X11) +#if defined(Q_WS_X11) || defined(Q_WS_LITE) //Whenever we leave an alien widget on X11, we need to reset its nativeParentWidget()'s cursor. // This is not required on Windows as the cursor is reset on every single mouse move. QWidget *parentOfLeavingCursor = 0; @@ -2676,7 +2676,11 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) { if (!parentOfLeavingCursor->window()->graphicsProxyWidget()) #endif { +#if defined(Q_WS_X11) qt_x11_enforce_cursor(parentOfLeavingCursor,true); +#elif defined(Q_WS_LITE) + qt_lite_set_cursor(parentOfLeavingCursor, true); +#endif } } #endif @@ -2700,6 +2704,8 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) { qt_x11_enforce_cursor(cursorWidget, true); #elif defined(Q_WS_S60) qt_symbian_set_cursor(cursorWidget, true); +#elif defined(Q_WS_LITE) + qt_lite_set_cursor(cursorWidget, true); #endif } } diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 2622f1c..baec8ca 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -606,6 +606,8 @@ Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window, extern void qt_x11_enforce_cursor(QWidget *); #elif defined(Q_OS_SYMBIAN) extern void qt_symbian_set_cursor(QWidget *, bool); +#elif defined (Q_WS_LITE) + extern void qt_lite_set_cursor(QWidget *, bool); #endif QT_END_NAMESPACE diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index 1eb93d3..a4d60a7 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -48,6 +48,8 @@ #include "private/qapplication_p.h" #include "qdesktopwidget.h" +#include "qgraphicssystemcursor.h" + QT_BEGIN_NAMESPACE void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool /*destroyOldWindow*/) @@ -647,4 +649,26 @@ void QWidgetPrivate::setModal_sys() { } +void qt_lite_set_cursor(QWidget * w, bool force) +{ + static QPointer lastUnderMouse = 0; + if (force) { + lastUnderMouse = w; + } else if (w->testAttribute(Qt::WA_WState_Created) && lastUnderMouse + && lastUnderMouse->effectiveWinId() == w->effectiveWinId()) { + w = lastUnderMouse; + } + + QWidget * curWin = QApplication::activeWindow(); + if (!curWin && w && w->internalWinId()) + return; + QWidget* cW = w && !w->internalWinId() ? w : curWin; + if (!cW || cW->window() != w->window() || + !cW->isVisible() || !cW->underMouse() || QApplication::overrideCursor()) + return; + + if (QGraphicsSystemCursor::instance) { + QGraphicsSystemCursor::instance->changeCursor(w); + } +} QT_END_NAMESPACE diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 4a32e71..2c6deda 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -182,7 +182,10 @@ embedded { embedded_lite { SOURCES += \ painting/qcolormap_lite.cpp \ - painting/qpaintdevice_lite.cpp + painting/qpaintdevice_lite.cpp \ + painting/qgraphicssystemcursor.cpp + HEADERS += \ + painting/qgraphicssystemcursor.h } symbian { diff --git a/src/gui/painting/qgraphicssystem_p.h b/src/gui/painting/qgraphicssystem_p.h index a2d03f0..7cc6247 100644 --- a/src/gui/painting/qgraphicssystem_p.h +++ b/src/gui/painting/qgraphicssystem_p.h @@ -72,6 +72,8 @@ public: virtual int depth() const = 0; virtual QImage::Format format() const = 0; virtual QSize physicalSize() const = 0; + virtual void setDirty(QRect) { } + virtual void pointerEvent(QMouseEvent &) { } }; class Q_GUI_EXPORT QGraphicsSystem diff --git a/src/gui/painting/qgraphicssystemcursor.cpp b/src/gui/painting/qgraphicssystemcursor.cpp new file mode 100644 index 0000000..91a6535 --- /dev/null +++ b/src/gui/painting/qgraphicssystemcursor.cpp @@ -0,0 +1,600 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "qgraphicssystemcursor.h" +//#include "qlighthousegraphicsscreen.h" + +#include +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +QPointer QGraphicsSystemCursor::instance = 0; + +QGraphicsSystemCursor::QGraphicsSystemCursor(QGraphicsSystemScreen *scr ) + :currentRect(QRect()), prevRect(QRect()), screen(scr) +{ + graphic = new QGraphicsSystemCursorImage(0, 0, 0, 0, 0, 0); + instance = this; + QWidget * widget = QApplication::widgetAt(QCursor::pos()); + changeCursor(widget); +} + +QGraphicsSystemCursor::~QGraphicsSystemCursor() +{ +} + +void QGraphicsSystemCursor::setCursor(Qt::CursorShape shape) +{ + graphic->set(shape); +} + +void QGraphicsSystemCursor::setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) +{ + graphic->set(data, mask, width, height, hotX, hotY); +} + +QRect QGraphicsSystemCursor::dirtyRect() +{ + if (!prevRect.isNull()) { + QRect rect = prevRect; + prevRect = QRect(); + return rect; + } + return QRect(); +} + +QRect QGraphicsSystemCursor::drawCursor(QPainter & painter) +{ + if (currentRect.isNull()) + return QRect(); + + prevRect = currentRect; + painter.drawImage(prevRect, *graphic->image()); + return prevRect; +} + +void QGraphicsSystemCursor::pointerEvent(QMouseEvent & e) +{ + currentRect = graphic->image()->rect().translated(-graphic->hotspot().x(), + -graphic->hotspot().y()); + currentRect.translate(e.pos()); + screen->setDirty(currentRect); + + screen->pointerEvent(e); +} + +void QGraphicsSystemCursor::changeCursor(QWidget * widget) +{ + if (widget) { + QCursor widgetCursor = widget->cursor(); + Qt::CursorShape shape = widgetCursor.shape(); + + if (shape == Qt::BitmapCursor) { + // application supplied cursor + const QBitmap * map = widgetCursor.bitmap(); + const QBitmap * mask = widgetCursor.mask(); + QPoint spot = widgetCursor.hotSpot(); + setCursor(map->toImage().bits(), mask->toImage().bits(), map->width(), map->height(), spot.x(), spot.y()); + } else { + // system cursor + setCursor(shape); + } + } else { + // default cursor + setCursor(Qt::ArrowCursor); + } +} + +// End of display and pointer event handling code +// Beginning of built-in cursor graphics +// from src/gui/embedded/QGraphicsSystemCursorImage_qws.cpp + +static QGraphicsSystemCursorImage *systemCursorTable[Qt::LastCursor+1]; +static bool systemCursorTableInit = false; + +// 16 x 16 +static const uchar cur_arrow_bits[] = { + 0x07, 0x00, 0x39, 0x00, 0xc1, 0x01, 0x02, 0x0e, 0x02, 0x10, 0x02, 0x08, + 0x04, 0x04, 0x04, 0x02, 0x04, 0x04, 0x88, 0x08, 0x48, 0x11, 0x28, 0x22, + 0x10, 0x44, 0x00, 0x28, 0x00, 0x10, 0x00, 0x00 }; +static const uchar mcur_arrow_bits[] = { + 0x07, 0x00, 0x3f, 0x00, 0xff, 0x01, 0xfe, 0x0f, 0xfe, 0x1f, 0xfe, 0x0f, + 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x07, 0xf8, 0x0f, 0x78, 0x1f, 0x38, 0x3e, + 0x10, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00, 0x00 }; + +static const unsigned char cur_up_arrow_bits[] = { + 0x80, 0x00, 0x40, 0x01, 0x40, 0x01, 0x20, 0x02, 0x20, 0x02, 0x10, 0x04, + 0x10, 0x04, 0x08, 0x08, 0x78, 0x0f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, + 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01}; +static const unsigned char mcur_up_arrow_bits[] = { + 0x80, 0x00, 0xc0, 0x01, 0xc0, 0x01, 0xe0, 0x03, 0xe0, 0x03, 0xf0, 0x07, + 0xf0, 0x07, 0xf8, 0x0f, 0xf8, 0x0f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01}; + +static const unsigned char cur_cross_bits[] = { + 0xc0, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, + 0x7f, 0x7f, 0x01, 0x40, 0x7f, 0x7f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, + 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01, 0x00, 0x00}; +static const unsigned char mcur_cross_bits[] = { + 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0x00, 0x00}; + +static const uchar cur_ibeam_bits[] = { + 0x00, 0x00, 0xe0, 0x03, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, + 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, + 0x80, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00 }; +static const uchar mcur_ibeam_bits[] = { + 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0x00, 0x00 }; + +static const uchar cur_ver_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f, + 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00 }; +static const uchar mcur_ver_bits[] = { + 0x00, 0x00, 0x80, 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0xf8, 0x3f, + 0xfc, 0x7f, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xfc, 0x7f, 0xf8, 0x3f, + 0xf0, 0x1f, 0xe0, 0x0f, 0xc0, 0x07, 0x80, 0x03 }; + +static const uchar cur_hor_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x30, 0x18, + 0x38, 0x38, 0xfc, 0x7f, 0xfc, 0x7f, 0x38, 0x38, 0x30, 0x18, 0x20, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar mcur_hor_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x40, 0x04, 0x60, 0x0c, 0x70, 0x1c, 0x78, 0x3c, + 0xfc, 0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfc, 0x7f, 0x78, 0x3c, + 0x70, 0x1c, 0x60, 0x0c, 0x40, 0x04, 0x00, 0x00 }; +static const uchar cur_bdiag_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x3e, 0x00, 0x3c, 0x00, 0x3e, + 0x00, 0x37, 0x88, 0x23, 0xd8, 0x01, 0xf8, 0x00, 0x78, 0x00, 0xf8, 0x00, + 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar mcur_bdiag_bits[] = { + 0x00, 0x00, 0xc0, 0x7f, 0x80, 0x7f, 0x00, 0x7f, 0x00, 0x7e, 0x04, 0x7f, + 0x8c, 0x7f, 0xdc, 0x77, 0xfc, 0x63, 0xfc, 0x41, 0xfc, 0x00, 0xfc, 0x01, + 0xfc, 0x03, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00 }; +static const uchar cur_fdiag_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0xf8, 0x00, 0x78, 0x00, + 0xf8, 0x00, 0xd8, 0x01, 0x88, 0x23, 0x00, 0x37, 0x00, 0x3e, 0x00, 0x3c, + 0x00, 0x3e, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00 }; +static const uchar mcur_fdiag_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x01, 0xfc, 0x00, + 0xfc, 0x41, 0xfc, 0x63, 0xdc, 0x77, 0x8c, 0x7f, 0x04, 0x7f, 0x00, 0x7e, + 0x00, 0x7f, 0x80, 0x7f, 0xc0, 0x7f, 0x00, 0x00 }; +static const uchar cur_blank_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +// 20 x 20 +static const uchar forbidden_bits[] = { + 0x00,0x00,0x00,0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xf0,0x00,0x38,0xc0,0x01, + 0x7c,0x80,0x03,0xec,0x00,0x03,0xce,0x01,0x07,0x86,0x03,0x06,0x06,0x07,0x06, + 0x06,0x0e,0x06,0x06,0x1c,0x06,0x0e,0x38,0x07,0x0c,0x70,0x03,0x1c,0xe0,0x03, + 0x38,0xc0,0x01,0xf0,0xe0,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00,0x00,0x00,0x00 }; + +static const uchar forbiddenm_bits[] = { + 0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xff,0x00,0xf8,0xff,0x01,0xfc,0xf0,0x03, + 0xfe,0xc0,0x07,0xfe,0x81,0x07,0xff,0x83,0x0f,0xcf,0x07,0x0f,0x8f,0x0f,0x0f, + 0x0f,0x1f,0x0f,0x0f,0x3e,0x0f,0x1f,0xfc,0x0f,0x1e,0xf8,0x07,0x3e,0xf0,0x07, + 0xfc,0xe0,0x03,0xf8,0xff,0x01,0xf0,0xff,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00}; + +// 32 x 32 +static const uchar wait_data_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, + 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x08, 0x20, 0x00, + 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, + 0x00, 0x50, 0x15, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x40, 0x05, 0x00, + 0x00, 0x80, 0x02, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x20, 0x08, 0x00, + 0x00, 0x10, 0x10, 0x00, 0x00, 0x08, 0x21, 0x00, 0x00, 0x88, 0x22, 0x00, + 0x00, 0x48, 0x25, 0x00, 0x00, 0xa8, 0x2a, 0x00, 0x00, 0xfc, 0x7f, 0x00, + 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar wait_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, + 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xf8, 0x3f, 0x00, + 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, + 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xc0, 0x07, 0x00, + 0x00, 0x80, 0x03, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0xe0, 0x0f, 0x00, + 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, + 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, + 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +static const uchar hsplit_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x41, 0x82, 0x00, 0x80, 0x41, 0x82, 0x01, 0xc0, 0x7f, 0xfe, 0x03, + 0x80, 0x41, 0x82, 0x01, 0x00, 0x41, 0x82, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar hsplitm_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, + 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe3, 0xc7, 0x00, + 0x80, 0xe3, 0xc7, 0x01, 0xc0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x07, + 0xc0, 0xff, 0xff, 0x03, 0x80, 0xe3, 0xc7, 0x01, 0x00, 0xe3, 0xc7, 0x00, + 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, + 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar vsplit_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar vsplitm_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, + 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, + 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, + 0x80, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, + 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar phand_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, + 0x7e, 0x04, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x70, 0x08, 0x00, 0x00, + 0x08, 0x08, 0x00, 0x00, 0x70, 0x14, 0x00, 0x00, 0x08, 0x22, 0x00, 0x00, + 0x30, 0x41, 0x00, 0x00, 0xc0, 0x20, 0x00, 0x00, 0x40, 0x12, 0x00, 0x00, + 0x80, 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar phandm_bits[] = { + 0xfe, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, + 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, + 0xfc, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, + 0xf8, 0xff, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, + 0xc0, 0x1f, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +static const uchar size_all_data_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x80, 0x81, 0xc0, 0x00, + 0xc0, 0xff, 0xff, 0x01, 0x80, 0x81, 0xc0, 0x00, 0x00, 0x81, 0x40, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar size_all_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, + 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc2, 0x21, 0x00, + 0x00, 0xc3, 0x61, 0x00, 0x80, 0xc3, 0xe1, 0x00, 0xc0, 0xff, 0xff, 0x01, + 0xe0, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0x01, 0x80, 0xc3, 0xe1, 0x00, + 0x00, 0xc3, 0x61, 0x00, 0x00, 0xc2, 0x21, 0x00, 0x00, 0xc0, 0x01, 0x00, + 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +static const uchar whatsthis_bits[] = { + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0xf0, 0x07, 0x00, + 0x09, 0x18, 0x0e, 0x00, 0x11, 0x1c, 0x0e, 0x00, 0x21, 0x1c, 0x0e, 0x00, + 0x41, 0x1c, 0x0e, 0x00, 0x81, 0x1c, 0x0e, 0x00, 0x01, 0x01, 0x07, 0x00, + 0x01, 0x82, 0x03, 0x00, 0xc1, 0xc7, 0x01, 0x00, 0x49, 0xc0, 0x01, 0x00, + 0x95, 0xc0, 0x01, 0x00, 0x93, 0xc0, 0x01, 0x00, 0x21, 0x01, 0x00, 0x00, + 0x20, 0xc1, 0x01, 0x00, 0x40, 0xc2, 0x01, 0x00, 0x40, 0x02, 0x00, 0x00, + 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; +static const uchar whatsthism_bits[] = { + 0x01, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x07, 0x00, 0x07, 0xf8, 0x0f, 0x00, + 0x0f, 0xfc, 0x1f, 0x00, 0x1f, 0x3e, 0x1f, 0x00, 0x3f, 0x3e, 0x1f, 0x00, + 0x7f, 0x3e, 0x1f, 0x00, 0xff, 0x3e, 0x1f, 0x00, 0xff, 0x9d, 0x0f, 0x00, + 0xff, 0xc3, 0x07, 0x00, 0xff, 0xe7, 0x03, 0x00, 0x7f, 0xe0, 0x03, 0x00, + 0xf7, 0xe0, 0x03, 0x00, 0xf3, 0xe0, 0x03, 0x00, 0xe1, 0xe1, 0x03, 0x00, + 0xe0, 0xe1, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, + 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; + +static const uchar busy_bits[] = { + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, + 0x41, 0xe0, 0xff, 0x00, 0x81, 0x20, 0x80, 0x00, 0x01, 0xe1, 0xff, 0x00, + 0x01, 0x42, 0x40, 0x00, 0xc1, 0x47, 0x40, 0x00, 0x49, 0x40, 0x55, 0x00, + 0x95, 0x80, 0x2a, 0x00, 0x93, 0x00, 0x15, 0x00, 0x21, 0x01, 0x0a, 0x00, + 0x20, 0x01, 0x11, 0x00, 0x40, 0x82, 0x20, 0x00, 0x40, 0x42, 0x44, 0x00, + 0x80, 0x41, 0x4a, 0x00, 0x00, 0x40, 0x55, 0x00, 0x00, 0xe0, 0xff, 0x00, + 0x00, 0x20, 0x80, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +static const uchar busym_bits[] = { + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, + 0x7f, 0xe0, 0xff, 0x00, 0xff, 0xe0, 0xff, 0x00, 0xff, 0xe1, 0xff, 0x00, + 0xff, 0xc3, 0x7f, 0x00, 0xff, 0xc7, 0x7f, 0x00, 0x7f, 0xc0, 0x7f, 0x00, + 0xf7, 0x80, 0x3f, 0x00, 0xf3, 0x00, 0x1f, 0x00, 0xe1, 0x01, 0x0e, 0x00, + 0xe0, 0x01, 0x1f, 0x00, 0xc0, 0x83, 0x3f, 0x00, 0xc0, 0xc3, 0x7f, 0x00, + 0x80, 0xc1, 0x7f, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0xe0, 0xff, 0x00, + 0x00, 0xe0, 0xff, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +// 16 x 16 +static const uchar openhand_bits[] = { + 0x80,0x01,0x58,0x0e,0x64,0x12,0x64,0x52,0x48,0xb2,0x48,0x92, + 0x16,0x90,0x19,0x80,0x11,0x40,0x02,0x40,0x04,0x40,0x04,0x20, + 0x08,0x20,0x10,0x10,0x20,0x10,0x00,0x00}; +static const uchar openhandm_bits[] = { + 0x80,0x01,0xd8,0x0f,0xfc,0x1f,0xfc,0x5f,0xf8,0xff,0xf8,0xff, + 0xfe,0xff,0xff,0xff,0xff,0x7f,0xfe,0x7f,0xfc,0x7f,0xfc,0x3f, + 0xf8,0x3f,0xf0,0x1f,0xe0,0x1f,0x00,0x00}; +static const uchar closedhand_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0x48,0x32,0x08,0x50, + 0x10,0x40,0x18,0x40,0x04,0x40,0x04,0x20,0x08,0x20,0x10,0x10, + 0x20,0x10,0x20,0x10,0x00,0x00,0x00,0x00}; +static const uchar closedhandm_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0xf8,0x3f,0xf8,0x7f, + 0xf0,0x7f,0xf8,0x7f,0xfc,0x7f,0xfc,0x3f,0xf8,0x3f,0xf0,0x1f, + 0xe0,0x1f,0xe0,0x1f,0x00,0x00,0x00,0x00}; + +void QGraphicsSystemCursorImage::createSystemCursor(int id) +{ + if (!systemCursorTableInit) { + for (int i = 0; i <= Qt::LastCursor; i++) + systemCursorTable[i] = 0; + systemCursorTableInit = true; + } + switch (id) { + // 16x16 cursors + case Qt::ArrowCursor: + systemCursorTable[Qt::ArrowCursor] = + new QGraphicsSystemCursorImage(cur_arrow_bits, mcur_arrow_bits, 16, 16, 0, 0); + break; + + case Qt::UpArrowCursor: + systemCursorTable[Qt::UpArrowCursor] = + new QGraphicsSystemCursorImage(cur_up_arrow_bits, mcur_up_arrow_bits, 16, 16, 7, 0); + break; + + case Qt::CrossCursor: + systemCursorTable[Qt::CrossCursor] = + new QGraphicsSystemCursorImage(cur_cross_bits, mcur_cross_bits, 16, 16, 7, 7); + break; + + case Qt::IBeamCursor: + systemCursorTable[Qt::IBeamCursor] = + new QGraphicsSystemCursorImage(cur_ibeam_bits, mcur_ibeam_bits, 16, 16, 7, 7); + break; + + case Qt::SizeVerCursor: + systemCursorTable[Qt::SizeVerCursor] = + new QGraphicsSystemCursorImage(cur_ver_bits, mcur_ver_bits, 16, 16, 7, 7); + break; + + case Qt::SizeHorCursor: + systemCursorTable[Qt::SizeHorCursor] = + new QGraphicsSystemCursorImage(cur_hor_bits, mcur_hor_bits, 16, 16, 7, 7); + break; + + case Qt::SizeBDiagCursor: + systemCursorTable[Qt::SizeBDiagCursor] = + new QGraphicsSystemCursorImage(cur_bdiag_bits, mcur_bdiag_bits, 16, 16, 7, 7); + break; + + case Qt::SizeFDiagCursor: + systemCursorTable[Qt::SizeFDiagCursor] = + new QGraphicsSystemCursorImage(cur_fdiag_bits, mcur_fdiag_bits, 16, 16, 7, 7); + break; + + case Qt::BlankCursor: + systemCursorTable[Qt::BlankCursor] = + new QGraphicsSystemCursorImage(0, 0, 0, 0, 0, 0); + break; + + // 20x20 cursors + case Qt::ForbiddenCursor: + systemCursorTable[Qt::ForbiddenCursor] = + new QGraphicsSystemCursorImage(forbidden_bits, forbiddenm_bits, 20, 20, 10, 10); + break; + + // 32x32 cursors + case Qt::WaitCursor: + systemCursorTable[Qt::WaitCursor] = + new QGraphicsSystemCursorImage(wait_data_bits, wait_mask_bits, 32, 32, 15, 15); + break; + + case Qt::SplitVCursor: + systemCursorTable[Qt::SplitVCursor] = + new QGraphicsSystemCursorImage(vsplit_bits, vsplitm_bits, 32, 32, 15, 15); + break; + + case Qt::SplitHCursor: + systemCursorTable[Qt::SplitHCursor] = + new QGraphicsSystemCursorImage(hsplit_bits, hsplitm_bits, 32, 32, 15, 15); + break; + + case Qt::SizeAllCursor: + systemCursorTable[Qt::SizeAllCursor] = + new QGraphicsSystemCursorImage(size_all_data_bits, size_all_mask_bits, 32, 32, 15, 15); + break; + + case Qt::PointingHandCursor: + systemCursorTable[Qt::PointingHandCursor] = + new QGraphicsSystemCursorImage(phand_bits, phandm_bits, 32, 32, 0, 0); + break; + + case Qt::WhatsThisCursor: + systemCursorTable[Qt::WhatsThisCursor] = + new QGraphicsSystemCursorImage(whatsthis_bits, whatsthism_bits, 32, 32, 0, 0); + break; + case Qt::BusyCursor: + systemCursorTable[Qt::BusyCursor] = + new QGraphicsSystemCursorImage(busy_bits, busym_bits, 32, 32, 0, 0); + break; + + case Qt::OpenHandCursor: + systemCursorTable[Qt::OpenHandCursor] = + new QGraphicsSystemCursorImage(openhand_bits, openhandm_bits, 16, 16, 8, 8); + break; + case Qt::ClosedHandCursor: + systemCursorTable[Qt::ClosedHandCursor] = + new QGraphicsSystemCursorImage(closedhand_bits, closedhandm_bits, 16, 16, 8, 8); + break; + default: + qWarning("Unknown system cursor %d", id); + } +} + +void QGraphicsSystemCursorImage::set(Qt::CursorShape id) +{ + QGraphicsSystemCursorImage *cursor = 0; + if (id >= 0 && id <= Qt::LastCursor) { + if (!systemCursorTable[id]) + createSystemCursor(id); + cursor = systemCursorTable[id]; + } + + if (cursor == 0) { + if (!systemCursorTable[Qt::ArrowCursor]) + createSystemCursor(Qt::ArrowCursor); + cursor = systemCursorTable[Qt::ArrowCursor]; + } + cursorImage = cursor->cursorImage; + hot = cursor->hot; +} + +void QGraphicsSystemCursorImage::set(const uchar *data, const uchar *mask, + int width, int height, int hx, int hy) +{ + hot.setX(hx); + hot.setY(hy); + + cursorImage = QImage(width,height, QImage::Format_Indexed8); + + if (!width || !height || !data || !mask || cursorImage.isNull()) + return; + + cursorImage.setNumColors(3); + cursorImage.setColor(0, 0xff000000); + cursorImage.setColor(1, 0xffffffff); + cursorImage.setColor(2, 0x00000000); + + int bytesPerLine = (width + 7) / 8; + int p = 0; + int d, m; + + int x = -1, w = 0; + + uchar *cursor_data = cursorImage.bits(); + int bpl = cursorImage.bytesPerLine(); + for (int i = 0; i < height; i++) + { + for (int j = 0; j < bytesPerLine; j++, data++, mask++) + { + for (int b = 0; b < 8 && j*8+b < width; b++) + { + d = *data & (1 << b); + m = *mask & (1 << b); + if (d && m) p = 0; + else if (!d && m) p = 1; + else p = 2; + cursor_data[j*8+b] = p; + + // calc region + if (x < 0 && m) + x = j*8+b; + else if (x >= 0 && !m) { + x = -1; + w = 0; + } + if (m) + w++; + } + } + if (x >= 0) { + x = -1; + w = 0; + } + cursor_data += bpl; + } + +} + +QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystemcursor.h b/src/gui/painting/qgraphicssystemcursor.h new file mode 100644 index 0000000..cb5c471 --- /dev/null +++ b/src/gui/painting/qgraphicssystemcursor.h @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QGRAPHICSSYSTEMCURSOR_H +#define QGRAPHICSSYSTEMCURSOR_H + +#include +#include +#include +#include +#include +#include "qgraphicssystem_p.h" + +QT_BEGIN_NAMESPACE + +// Cursor graphics management +class QGraphicsSystemCursorImage { +public: + QGraphicsSystemCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) + { set(data, mask, width, height, hotX, hotY); } + QImage * image() { return &cursorImage; } + QPoint hotspot() { return hot; } + void set(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); + void set(Qt::CursorShape); +private: + static void createSystemCursor(int id); + QImage cursorImage; + QPoint hot; +}; + +class Q_GUI_EXPORT QGraphicsSystemCursor : public QObject { +public: + QGraphicsSystemCursor(QGraphicsSystemScreen *); + virtual ~QGraphicsSystemCursor(); + + // input methods + virtual void setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); + virtual void setCursor(Qt::CursorShape shape); + virtual void pointerEvent(QMouseEvent & event); + virtual void changeCursor(QWidget * widget); + + // output methods + virtual QRect drawCursor(QPainter &); + virtual QRect dirtyRect(); + + static QPointer instance; + +protected: + + QRect currentRect; // next place to draw the cursor + QRect prevRect; // last place the cursor was drawn + + QGraphicsSystemScreen * screen; // Where to request an update + QWidget * currentWidget; // widget currently under the cursor + + QGraphicsSystemCursorImage * graphic; +}; + +QT_END_NAMESPACE + +#endif // QGRAPHICSSYSTEMCURSOR_H diff --git a/src/plugins/graphicssystems/fb_base/fb_base.cpp b/src/plugins/graphicssystems/fb_base/fb_base.cpp new file mode 100644 index 0000000..ffa5d4e --- /dev/null +++ b/src/plugins/graphicssystems/fb_base/fb_base.cpp @@ -0,0 +1,205 @@ +#include "fb_base.h" + +#include +#include +#include + +#include + +QGraphicsSystemFbScreen::QGraphicsSystemFbScreen() : cursor(0), mGeometry(), mDepth(16), mFormat(QImage::Format_RGB16), mScreenImage(0) +{ + mScreenImage = new QImage(mGeometry.size(), mFormat); + redrawTimer.setSingleShot(true); + redrawTimer.setInterval(0); + QObject::connect(&redrawTimer, SIGNAL(timeout()), this, SLOT(doRedraw())); +} + +void QGraphicsSystemFbScreen::setGeometry(QRect rect) +{ + delete mScreenImage; + mGeometry = rect; + mScreenImage = new QImage(mGeometry.size(), mFormat); +} + +void QGraphicsSystemFbScreen::setDepth(int depth) +{ + mDepth = depth; +} + +void QGraphicsSystemFbScreen::setPhysicalSize(QSize size) +{ + mPhysicalSize = size; +} + +void QGraphicsSystemFbScreen::setFormat(QImage::Format format) +{ + mFormat = format; + delete mScreenImage; + mScreenImage = new QImage(mGeometry.size(), mFormat); +} + +QGraphicsSystemFbScreen::~QGraphicsSystemFbScreen() +{ + delete mScreenImage; +} + +void QGraphicsSystemFbScreen::setDirty(const QRect &rect) +{ + repaintRegion += rect; + if (!redrawTimer.isActive()) { + redrawTimer.start(); + } +} + +QRegion QGraphicsSystemFbScreen::doRedraw() +{ + QRegion touchedRegion; + if (cursor) + repaintRegion += cursor->dirtyRect(); + if (repaintRegion.isEmpty()) + return touchedRegion; + + QPainter compositePainter(mScreenImage); + QVector rects = repaintRegion.rects(); + + for (int rectIndex = 0; rectIndex < repaintRegion.numRects(); rectIndex++) { + QRect rect = rects[rectIndex]; + // Blank the affected area, just in case there's nothing to display + compositePainter.fillRect(rect, Qt::black); + for (int i = 0; i < windowStack.length(); i++) { + if (!windowStack[i]->visible()) + continue; + QRect windowRect = windowStack[i]->geometry(); + QRect intersect = windowRect.intersected(rect); + QRect windowIntersect = intersect.translated(-windowRect.left(), + -windowRect.top()); + if (intersect.isNull()) + continue; + compositePainter.drawImage(intersect, windowStack[i]->image(), + windowIntersect); + } + } + + QRect cursorRect; + if (cursor) { + cursorRect = cursor->drawCursor(compositePainter); + touchedRegion += cursorRect; + } + touchedRegion += repaintRegion; + repaintRegion = QRegion(); + + return touchedRegion; +} + +void QGraphicsSystemFbScreen::removeWindowSurface(QGraphicsSystemFbWindowSurface * surface) +{ + windowStack.removeOne(surface); + setDirty(surface->geometry()); +} + +void QGraphicsSystemFbScreen::raise(QGraphicsSystemFbWindowSurface * surface) +{ + int index = windowStack.indexOf(surface); + if (index <= 0) + return; + windowStack.move(index, index - 1); +} + +void QGraphicsSystemFbScreen::lower(QGraphicsSystemFbWindowSurface * surface) +{ + int index = windowStack.indexOf(surface); + if (index == -1 || index == (windowStack.size() - 1)) + return; + windowStack.move(index, index + 1); +} + +void QGraphicsSystemFbScreen::top(QGraphicsSystemFbWindowSurface * surface) +{ + int index = windowStack.indexOf(surface); + if (index == -1) + return; + windowStack.move(index, 0); +} + +void QGraphicsSystemFbScreen::bottom(QGraphicsSystemFbWindowSurface * surface) +{ + int index = windowStack.indexOf(surface); + if (index == -1) + return; + windowStack.move(index, windowStack.size() - 1); +} + + +void QGraphicsSystemFbScreen::pointerEvent(QMouseEvent & me) +{ + QApplicationPrivate::handleMouseEvent(0, me); +} + + +QGraphicsSystemFbWindowSurface::QGraphicsSystemFbWindowSurface(QGraphicsSystemFbScreen *screen, QWidget *window) + : QWindowSurface(window), + mScreen(screen), + visibleFlag(false) +{ + mImage = QImage(window->size(), mScreen->format()); +} + +QGraphicsSystemFbWindowSurface::~QGraphicsSystemFbWindowSurface() +{ + mScreen->removeWindowSurface(this); +} + +void QGraphicsSystemFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + Q_UNUSED(offset); + + QRect currentGeometry = geometry(); + // If this is a move, redraw the previous location + if (oldGeometry != currentGeometry) { + mScreen->setDirty(oldGeometry); + oldGeometry = currentGeometry; + } + + QRect dirtyClient = region.boundingRect(); + QRect dirtyRegion(currentGeometry.left() + dirtyClient.left(), + currentGeometry.top() + dirtyClient.top(), + dirtyClient.width(), + dirtyClient.height()); + mScreen->setDirty(dirtyRegion); +} + +void QGraphicsSystemFbWindowSurface::setGeometry(const QRect &rect) +{ + // store previous geometry for screen update + oldGeometry = geometry(); + + // change the widget's QImage if this is a resize + if (mImage.size() != rect.size()) + mImage = QImage(rect.size(), mScreen->format()); + + QApplicationPrivate::handleGeometryChange(this->window(), rect); + + QWindowSurface::setGeometry(rect); +} + +bool QGraphicsSystemFbWindowSurface::scroll(const QRegion &area, int dx, int dy) +{ + return QWindowSurface::scroll(area, dx, dy); +} + +void QGraphicsSystemFbWindowSurface::beginPaint(const QRegion ®ion) +{ + Q_UNUSED(region); +} + +void QGraphicsSystemFbWindowSurface::endPaint(const QRegion ®ion) +{ + Q_UNUSED(region); +} + +void QGraphicsSystemFbWindowSurface::setVisible(bool visible) +{ + visibleFlag = visible; + mScreen->setDirty(geometry()); +} diff --git a/src/plugins/graphicssystems/fb_base/fb_base.h b/src/plugins/graphicssystems/fb_base/fb_base.h new file mode 100644 index 0000000..fba7a7a --- /dev/null +++ b/src/plugins/graphicssystems/fb_base/fb_base.h @@ -0,0 +1,90 @@ +#ifndef QLIGHTHOUSEGRAPHICSSCREEN_H +#define QLIGHTHOUSEGRAPHICSSCREEN_H + +#include +#include +#include +#include +#include +#include + +class QMouseEvent; +class QSize; +class QPainter; + +class QGraphicsSystemFbWindowSurface; +class QGraphicsSystemFbScreen; + +class QGraphicsSystemFbWindowSurface : public QWindowSurface +{ +public: + QGraphicsSystemFbWindowSurface(QGraphicsSystemFbScreen *screen, QWidget *window); + ~QGraphicsSystemFbWindowSurface(); + + virtual QPaintDevice *paintDevice() { return &mImage; } + virtual void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + virtual bool scroll(const QRegion &area, int dx, int dy); + + virtual void beginPaint(const QRegion ®ion); + virtual void endPaint(const QRegion ®ion); + virtual void setVisible(bool visible); + virtual bool visible() { return visibleFlag; } + + const QImage image() { return mImage; } + void setGeometry(const QRect &rect); +protected: + QGraphicsSystemFbScreen *mScreen; + QRect oldGeometry; + QImage mImage; + bool visibleFlag; +}; + +class QGraphicsSystemFbScreen : public QGraphicsSystemScreen +{ + Q_OBJECT +public: + QGraphicsSystemFbScreen(); + ~QGraphicsSystemFbScreen(); + + virtual QRect geometry() const { return mGeometry; } + virtual int depth() const { return mDepth; } + virtual QImage::Format format() const { return mFormat; } + virtual QSize physicalSize() const { return mPhysicalSize; } + + virtual void setGeometry(QRect rect); + virtual void setDepth(int depth); + virtual void setFormat(QImage::Format format); + virtual void setPhysicalSize(QSize size); + + virtual void setDirty(const QRect &rect); + + virtual void removeWindowSurface(QGraphicsSystemFbWindowSurface * surface); + virtual void addWindowSurface(QGraphicsSystemFbWindowSurface * surface) { windowStack.append(surface); } + virtual void raise(QGraphicsSystemFbWindowSurface * surface); + virtual void lower(QGraphicsSystemFbWindowSurface * surface); + virtual void top(QGraphicsSystemFbWindowSurface * surface); + virtual void bottom(QGraphicsSystemFbWindowSurface * surface); + + virtual void pointerEvent(QMouseEvent & me); + + QImage * image() const { return mScreenImage; } + QPaintDevice * paintDevice() const { return mScreenImage; } + +protected: + QList windowStack; + QRegion repaintRegion; + QGraphicsSystemCursor * cursor; + QTimer redrawTimer; + +protected slots: + virtual QRegion doRedraw(); + +protected: + QRect mGeometry; + int mDepth; + QImage::Format mFormat; + QSize mPhysicalSize; + QImage *mScreenImage; +}; + +#endif // QLIGHTHOUSEGRAPHICSSCREEN_H diff --git a/src/plugins/graphicssystems/fb_base/fb_base.pro b/src/plugins/graphicssystems/fb_base/fb_base.pro new file mode 100644 index 0000000..e08c0c5 --- /dev/null +++ b/src/plugins/graphicssystems/fb_base/fb_base.pro @@ -0,0 +1,23 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2009-11-05T13:22:31 +# +#------------------------------------------------- + +#QT -= core gui +TARGET = fb_base +#include(../../qpluginbase.pri) + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems + +TEMPLATE = lib + +#DEFINES += STATIC_LIBRARY +CONFIG += staticlib + +SOURCES += fb_base.cpp + +HEADERS += fb_base.h + +target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +INSTALLS += target diff --git a/src/plugins/graphicssystems/linuxfb/linuxfb.pro b/src/plugins/graphicssystems/linuxfb/linuxfb.pro index 1251d2f..ea92573 100644 --- a/src/plugins/graphicssystems/linuxfb/linuxfb.pro +++ b/src/plugins/graphicssystems/linuxfb/linuxfb.pro @@ -3,8 +3,9 @@ include(../../qpluginbase.pri) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems -SOURCES = main.cpp qgraphicssystem_linuxfb.cpp qwindowsurface_linuxfb.cpp -HEADERS = qgraphicssystem_linuxfb.h qwindowsurface_linuxfb.h +SOURCES = main.cpp qgraphicssystem_linuxfb.cpp +HEADERS = qgraphicssystem_linuxfb.h target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +LIBS += -L$$[QT_INSTALL_PLUGINS]/graphicssystems -lfb_base INSTALLS += target diff --git a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp index 95c636f..291b118 100644 --- a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp +++ b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp @@ -40,9 +40,11 @@ ****************************************************************************/ #include "qgraphicssystem_linuxfb.h" -#include "qwindowsurface_linuxfb.h" +#include "../fb_base/fb_base.h" #include #include // overrides QT_OPEN +#include +#include #include #include @@ -163,15 +165,11 @@ QLinuxFbGraphicsSystem::QLinuxFbGraphicsSystem() if (!connect(displaySpec)) qFatal("QLinuxFbGraphicsSystem: could not initialize screen"); - mPrimaryScreen = new QLinuxFbGraphicsSystemScreen(); - mPrimaryScreen->mGeometry = QRect(0, 0, w, h); - mPrimaryScreen->mDepth = d; - mPrimaryScreen->mFormat = screenFormat; - mPrimaryScreen->mPhysicalSize = QSize(physWidth, physHeight); - // Create a QImage directly on the screen's framebuffer. // This is the blit target for copying windows to the screen. - mPrimaryScreen->mScreenImage = new QImage(data, w, h, lstep, screenFormat); + mPrimaryScreen = new QLinuxFbGraphicsSystemScreen(data, w, h, lstep, + screenFormat); + mPrimaryScreen->setPhysicalSize(QSize(physWidth, physHeight)); mScreens.append(mPrimaryScreen); } @@ -791,7 +789,57 @@ QWindowSurface *QLinuxFbGraphicsSystem::createWindowSurface(QWidget *widget) con { if (widget->windowType() == Qt::Desktop) return 0; // Don't create an explicit window surface for the destkop. - return new QLinuxFbWindowSurface(mPrimaryScreen, widget); + QGraphicsSystemFbWindowSurface * surface = + new QGraphicsSystemFbWindowSurface(mPrimaryScreen, widget); + mPrimaryScreen->addWindowSurface(surface); + return surface; +} + +QLinuxFbGraphicsSystemScreen::QLinuxFbGraphicsSystemScreen(uchar * d, int w, + int h, int lstep, QImage::Format screenFormat) +{ + data = d; + mGeometry = QRect(0,0,w,h); + bytesPerLine = lstep; + mFormat = screenFormat; + mDepth = 16; + mScreenImage = new QImage(mGeometry.width(), mGeometry.height(), + mFormat); + mFbScreenImage = new QImage(data, mGeometry.width(), mGeometry.height(), + bytesPerLine, mFormat); +} + +void QLinuxFbGraphicsSystemScreen::setGeometry(QRect rect) +{ + mGeometry = rect; + delete mFbScreenImage; + mFbScreenImage = new QImage(data, mGeometry.width(), mGeometry.height(), + bytesPerLine, mFormat); + delete mScreenImage; + mScreenImage = new QImage(mGeometry.width(), mGeometry.height(), + mFormat); +} + +void QLinuxFbGraphicsSystemScreen::setFormat(QImage::Format format) +{ + mFormat = format; + delete mFbScreenImage; + mFbScreenImage = new QImage(data, mGeometry.width(), mGeometry.height(), + bytesPerLine, mFormat); + delete mScreenImage; + mScreenImage = new QImage(mGeometry.width(), mGeometry.height(), + mFormat); } +QRegion QLinuxFbGraphicsSystemScreen::doRedraw() +{ + QRegion touched; + touched = QGraphicsSystemFbScreen::doRedraw(); + + QPainter compositePainter(mFbScreenImage); + QVector rects = touched.rects(); + for (int i = 0; i < rects.size(); i++) + compositePainter.drawImage(rects[i], *mScreenImage, rects[i]); + return touched; +} QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.h b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.h index 7ceaf037..f85718a 100644 --- a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.h +++ b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.h @@ -43,28 +43,24 @@ #define QGRAPHICSSYSTEM_LINUXFB_H #include +#include "../fb_base/fb_base.h" QT_BEGIN_NAMESPACE -class QLinuxFbGraphicsSystemScreen : public QGraphicsSystemScreen +class QLinuxFbGraphicsSystemScreen : public QGraphicsSystemFbScreen { public: - QLinuxFbGraphicsSystemScreen() - : mDepth(16), mFormat(QImage::Format_RGB16), mScreenImage(0) {} - ~QLinuxFbGraphicsSystemScreen() { delete mScreenImage; } + QLinuxFbGraphicsSystemScreen(uchar * d, int w, int h, int lstep, QImage::Format screenFormat); + void setGeometry(QRect rect); + void setFormat(QImage::Format format); - QRect geometry() const { return mGeometry; } - int depth() const { return mDepth; } - QImage::Format format() const { return mFormat; } - QSize physicalSize() const { return mPhysicalSize; } - -public: - QRect mGeometry; - int mDepth; - QImage::Format mFormat; - QSize mPhysicalSize; - QImage *mScreenImage; +public slots: + QRegion doRedraw(); +private: + QImage * mFbScreenImage; + uchar * data; + int bytesPerLine; }; class QLinuxFbGraphicsSystemPrivate; diff --git a/src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.cpp b/src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.cpp deleted file mode 100644 index dbe5dd7..0000000 --- a/src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwindowsurface_linuxfb.h" -#include "qgraphicssystem_linuxfb.h" -#include -#include -#include - -QT_BEGIN_NAMESPACE - -QLinuxFbWindowSurface::QLinuxFbWindowSurface - (QLinuxFbGraphicsSystemScreen *screen, QWidget *window) - : QWindowSurface(window), - mScreen(screen) -{ -} - -QLinuxFbWindowSurface::~QLinuxFbWindowSurface() -{ -} - -QPaintDevice *QLinuxFbWindowSurface::paintDevice() -{ - return &mImage; -} - -void QLinuxFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) -{ - Q_UNUSED(widget); - Q_UNUSED(offset); - - QRect rect = geometry(); - QPoint topLeft = rect.topLeft(); - - QPainter painter(mScreen->mScreenImage); - if (region.numRects() == 1) { - QRect wrect = region.boundingRect(); - painter.drawImage(wrect.topLeft() + topLeft, mImage, wrect); - } else { - QVector rects = region.rects(); - foreach (QRect wrect, rects) - painter.drawImage(wrect.topLeft() + topLeft, mImage, wrect); - } -} - -void QLinuxFbWindowSurface::setGeometry(const QRect &r) -{ -#ifdef QT_LITE_FORCE_FULLSCREEN -// any size you like as long as it's full-screen... - QRect rect(mScreen->availableGeometry()); - QApplicationPrivate::handleGeometryChange(this->window(), rect); -#else - QRect rect(r); -#endif - QWindowSurface::setGeometry(rect); - if (mImage.size() != rect.size()) - mImage = QImage(rect.size(), mScreen->format()); -} - -bool QLinuxFbWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - return QWindowSurface::scroll(area, dx, dy); -} - -void QLinuxFbWindowSurface::beginPaint(const QRegion ®ion) -{ - Q_UNUSED(region); -} - -void QLinuxFbWindowSurface::endPaint(const QRegion ®ion) -{ - Q_UNUSED(region); -} - -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.h b/src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.h deleted file mode 100644 index 37efcb0..0000000 --- a/src/plugins/graphicssystems/linuxfb/qwindowsurface_linuxfb.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_LINUXFB_H -#define QWINDOWSURFACE_LINUXFB_H - -#include - -QT_BEGIN_NAMESPACE - -class QLinuxFbGraphicsSystemScreen; - -class QLinuxFbWindowSurface : public QWindowSurface -{ -public: - QLinuxFbWindowSurface - (QLinuxFbGraphicsSystemScreen *screen, QWidget *window); - ~QLinuxFbWindowSurface(); - - QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void setGeometry(const QRect &rect); - bool scroll(const QRegion &area, int dx, int dy); - - void beginPaint(const QRegion ®ion); - void endPaint(const QRegion ®ion); - -private: - QLinuxFbGraphicsSystemScreen *mScreen; - QImage mImage; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp index 98e994c..7815f24 100644 --- a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp +++ b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp @@ -40,7 +40,8 @@ ****************************************************************************/ #include "qgraphicssystem_vnc.h" -#include "qwindowsurface_vnc.h" +#include "../fb_base/fb_base.h" +#include #include #include @@ -49,12 +50,9 @@ #include -#include - -#include "qvnccursor.h" QVNCGraphicsSystemScreen::QVNCGraphicsSystemScreen() - : mDepth(16), mFormat(QImage::Format_RGB16), mScreenImage(0) + : QGraphicsSystemFbScreen::QGraphicsSystemFbScreen() { int w = 800; int h = 600; @@ -65,32 +63,16 @@ QVNCGraphicsSystemScreen::QVNCGraphicsSystemScreen() h = eh; } - mGeometry = QRect(0,0,w, h); - - mDepth = 32; - mFormat = QImage::Format_RGB32; - mPhysicalSize = (mGeometry.size()*254)/720; + setGeometry(QRect(0,0,w, h)); + setDepth(32); + setFormat(QImage::Format_RGB32); + setPhysicalSize((geometry().size()*254)/720); - mScreenImage = new QImage(mGeometry.size(), mFormat); d_ptr = new QVNCGraphicsSystemScreenPrivate(this); - helper = new QVNCGraphicsSystemScreenTimerHelper(this); - repaintTimer = new QTimer(); - repaintTimer->setSingleShot(true); - repaintTimer->setInterval(0); - QObject::connect(repaintTimer, SIGNAL(timeout()), helper, SLOT(fireSlot())); - cursor = new QVNCCursor(d_ptr->vncServer, this); - d_ptr->vncServer->setCursor(cursor); -} - - -QVNCGraphicsSystemScreen::~QVNCGraphicsSystemScreen() -{ - delete mScreenImage; - delete repaintTimer; - delete helper; + d_ptr->vncServer->setCursor(static_cast(cursor)); } QVNCDirtyMap *QVNCGraphicsSystemScreen::dirtyMap() @@ -98,67 +80,22 @@ QVNCDirtyMap *QVNCGraphicsSystemScreen::dirtyMap() return d_ptr->dirty; } - -void QVNCGraphicsSystemScreen::setDirty(const QRect &rect) -{ - repaintRegion += rect; - if (!repaintTimer->isActive()) { - repaintTimer->start(); - } -} - -void QVNCGraphicsSystemScreen::doRedraw() +QRegion QVNCGraphicsSystemScreen::doRedraw() { - repaintRegion += cursor->dirtyRect(); - - if (repaintRegion.isEmpty()) - return; - - QPainter compositePainter(mScreenImage); - - QVector rects = repaintRegion.rects(); - - for (int rectIndex = 0; rectIndex < repaintRegion.numRects(); rectIndex++) { - QRect rect = rects[rectIndex]; - // Blank the affected area, just in case there's nothing to display - // Question - What's the background color? - // Another option - a base level window that is the size of the display - compositePainter.fillRect(rect, Qt::black); - for (int i = 0; i < windowStack.length(); i++) { - if (!windowStack[i]->visible()) - continue; - QRect windowRect = windowStack[i]->geometry(); - QRect intersect = windowRect.intersected(rect); - QRect windowIntersect = intersect.translated(-windowRect.left(), - -windowRect.top()); - if (intersect.isNull()) - continue; - compositePainter.drawImage(intersect, windowStack[i]->image(), - windowIntersect); - } - } + QRegion touched; + touched = QGraphicsSystemFbScreen::doRedraw(); - QRect pointerRect = cursor->drawCursor(compositePainter); - repaintRegion += pointerRect; - rects = repaintRegion.rects(); - for (int i = 0; i < rects.size(); i ++) + QVector rects = touched.rects(); + for (int i = 0; i < rects.size(); i++) d_ptr->setDirty(rects[i]); - - repaintRegion = QRegion(); + return touched; } QVNCGraphicsSystem::QVNCGraphicsSystem() { -//////// xd = new MyDisplay; - mPrimaryScreen = new QVNCGraphicsSystemScreen(); - - //int dw = mPrimaryScreen->geometry().width(); - //int dh = mPrimaryScreen->geometry().height(); - - mScreens.append(mPrimaryScreen); } @@ -171,19 +108,8 @@ QWindowSurface *QVNCGraphicsSystem::createWindowSurface(QWidget *widget) const { if (widget->windowType() == Qt::Desktop) return 0; // Don't create an explicit window surface for the destkop. - QVNCWindowSurface * newSurface = new QVNCWindowSurface - (const_cast(this), mPrimaryScreen, widget); - mPrimaryScreen->addWindowSurface(newSurface); - return newSurface; -} - -void QVNCGraphicsSystemScreen::removeWindowSurface(QVNCWindowSurface * surface) -{ - windowStack.removeOne(surface); - setDirty(surface->geometry()); -} - -void QVNCGraphicsSystemScreen::pointerEvent(QMouseEvent & me) -{ - QApplicationPrivate::handleMouseEvent(0, me); + QGraphicsSystemFbWindowSurface * surface; + surface = new QGraphicsSystemFbWindowSurface(mPrimaryScreen, widget); + mPrimaryScreen->addWindowSurface(surface); + return surface; } diff --git a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h index eb48f86..b3349b7 100644 --- a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h +++ b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h @@ -43,8 +43,8 @@ #define QGRAPHICSSYSTEM_VNC_H #include -#include "qwindowsurface_vnc.h" #include "qvnccursor.h" +#include "../fb_base/fb_base.h" QT_BEGIN_NAMESPACE @@ -53,57 +53,21 @@ class QVNCDirtyMap; class QVNCGraphicsSystemScreenPrivate; -class QVNCGraphicsSystemScreenTimerHelper; - -class QVNCGraphicsSystemScreen : public QGraphicsSystemScreen +class QVNCGraphicsSystemScreen : public QGraphicsSystemFbScreen { public: QVNCGraphicsSystemScreen(); - ~QVNCGraphicsSystemScreen(); - - QRect geometry() const { return mGeometry; } - int depth() const { return mDepth; } - QImage::Format format() const { return mFormat; } - QSize physicalSize() const { return mPhysicalSize; } - int linestep() const { return mScreenImage ? mScreenImage->bytesPerLine() : 0; } - uchar *base() const { return mScreenImage ? mScreenImage->bits() : 0; } - QVNCDirtyMap *dirtyMap(); - - void setDirty(const QRect &rect); - void removeWindowSurface(QVNCWindowSurface * surface); - void addWindowSurface(QVNCWindowSurface * surface) { windowStack.append(surface); } - void pointerEvent(QMouseEvent & me); + int linestep() const { return image() ? image()->bytesPerLine() : 0; } + uchar *base() const { return image() ? image()->bits() : 0; } + QVNCDirtyMap *dirtyMap(); public: - QRect mGeometry; - int mDepth; - QImage::Format mFormat; - QSize mPhysicalSize; - QImage *mScreenImage; - QVNCGraphicsSystemScreenPrivate *d_ptr; -private: - QList windowStack; - QRegion repaintRegion; - QTimer * repaintTimer; - QVNCGraphicsSystemScreenTimerHelper * helper; - void doRedraw(); - friend class QVNCGraphicsSystemScreenTimerHelper; - - QVNCCursor * cursor; -}; -class QVNCGraphicsSystemScreenTimerHelper : public QObject -{ - Q_OBJECT -public: - QVNCGraphicsSystemScreenTimerHelper(QVNCGraphicsSystemScreen * s) - { screen = s; } -public slots: - void fireSlot() { screen->doRedraw(); } private: - QVNCGraphicsSystemScreen * screen; + QVNCServer *server; + QRegion doRedraw(); }; class QVNCGraphicsSystemPrivate; diff --git a/src/plugins/graphicssystems/vnc/qvnccursor.cpp b/src/plugins/graphicssystems/vnc/qvnccursor.cpp index 111ee3c..ec9a4ee 100644 --- a/src/plugins/graphicssystems/vnc/qvnccursor.cpp +++ b/src/plugins/graphicssystems/vnc/qvnccursor.cpp @@ -54,16 +54,14 @@ QT_BEGIN_NAMESPACE QVNCCursor::QVNCCursor(QVNCServer * srvr, QVNCGraphicsSystemScreen *scr ) - :useVncCursor(false), currentRect(QRect()), - prevRect(QRect()), server(srvr), screen(scr) + :QGraphicsSystemCursor::QGraphicsSystemCursor(scr), useVncCursor(false), server(srvr) { - d_ptr = new QVNCCursorPrivate(0, 0, 0, 0, 0, 0); } void QVNCCursor::setCursorMode(bool vnc) { - if (vnc == useVncCursor) - return; +// if (vnc == useVncCursor) +// return; if (vnc) { screen->setDirty(prevRect); prevRect = QRect(); @@ -76,7 +74,7 @@ void QVNCCursor::setCursorMode(bool vnc) void QVNCCursor::setCursor(Qt::CursorShape shape) { - d_ptr->set(shape); + QGraphicsSystemCursor::setCursor(shape); if (useVncCursor) { sendClientCursor(); } @@ -84,22 +82,12 @@ void QVNCCursor::setCursor(Qt::CursorShape shape) void QVNCCursor::setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) { - d_ptr->set(data, mask, width, height, hotX, hotY); + QGraphicsSystemCursor::setCursor(data, mask, width, height, hotX, hotY); if (useVncCursor) { sendClientCursor(); } } -QRect QVNCCursor::dirtyRect() -{ - if (!useVncCursor) { - QRect rect = prevRect; - prevRect = QRect(); - return rect; - } - return QRect(); -} - QRect QVNCCursor::drawCursor(QPainter & painter) { if (useVncCursor) @@ -108,54 +96,11 @@ QRect QVNCCursor::drawCursor(QPainter & painter) if (currentRect.isNull()) return QRect(); - prevRect = currentRect; - painter.drawImage(prevRect, *d_ptr->image()); - return prevRect; -} - -void QVNCCursor::pointerEvent(QMouseEvent & e) -{ - QWidget *widget = QApplication::widgetAt(e.pos()); - - // Determine which cursor to use - if (currentWidget != widget) { - if (widget) { - QCursor widgetCursor = widget->cursor(); - Qt::CursorShape shape = widgetCursor.shape(); - - if (shape == Qt::BitmapCursor) { - // application supplied cursor - const QBitmap * map = widgetCursor.bitmap(); - const QBitmap * mask = widgetCursor.mask(); - QPoint spot = widgetCursor.hotSpot(); - setCursor(map->toImage().bits(), mask->toImage().bits(), map->width(), map->height(), spot.x(), spot.y()); - } else { - // system cursor - setCursor(shape); - } - } else { - // default cursor - setCursor(Qt::ArrowCursor); - } - currentWidget = widget; - } else if (!widget) { - // default cursor - setCursor(Qt::ArrowCursor); - } - if (!useVncCursor) { - currentRect = d_ptr->image()->rect().translated(-d_ptr->hotspot().x(), -d_ptr->hotspot().y()); - currentRect.translate(e.pos()); - screen->setDirty(QRect()); - } - - screen->pointerEvent(e); + return QGraphicsSystemCursor::drawCursor(painter); } void QVNCCursor::clearClientCursor() { - QImage *image = d_ptr->image(); - if (image->isNull()) - return; QTcpSocket *socket = server->clientSocket(); if (!socket) { return; @@ -176,7 +121,7 @@ void QVNCCursor::clearClientCursor() void QVNCCursor::sendClientCursor() { - QImage *image = d_ptr->image(); + QImage *image = graphic->image(); if (image->isNull()) return; QTcpSocket *socket = server->clientSocket(); @@ -187,7 +132,7 @@ void QVNCCursor::sendClientCursor() { const quint16 tmp[6] = { htons(0), htons(1), - htons(d_ptr->hotspot().x()), htons(d_ptr->hotspot().y()), + htons(graphic->hotspot().x()), htons(graphic->hotspot().y()), htons(image->width()), htons(image->height()) }; socket->write((char*)tmp, sizeof(tmp)); @@ -216,474 +161,4 @@ void QVNCCursor::sendClientCursor() socket->write((const char*)bitmap.scanLine(i), width); } -// End of display and pointer event handling code -// Beginning of built-in cursor graphics -// from src/gui/embedded/QVNCCursorPrivate_qws.cpp - -static QVNCCursorPrivate *systemCursorTable[Qt::LastCursor+1]; -static bool systemCursorTableInit = false; - -// 16 x 16 -static const uchar cur_arrow_bits[] = { - 0x07, 0x00, 0x39, 0x00, 0xc1, 0x01, 0x02, 0x0e, 0x02, 0x10, 0x02, 0x08, - 0x04, 0x04, 0x04, 0x02, 0x04, 0x04, 0x88, 0x08, 0x48, 0x11, 0x28, 0x22, - 0x10, 0x44, 0x00, 0x28, 0x00, 0x10, 0x00, 0x00 }; -static const uchar mcur_arrow_bits[] = { - 0x07, 0x00, 0x3f, 0x00, 0xff, 0x01, 0xfe, 0x0f, 0xfe, 0x1f, 0xfe, 0x0f, - 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x07, 0xf8, 0x0f, 0x78, 0x1f, 0x38, 0x3e, - 0x10, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00, 0x00 }; - -static const unsigned char cur_up_arrow_bits[] = { - 0x80, 0x00, 0x40, 0x01, 0x40, 0x01, 0x20, 0x02, 0x20, 0x02, 0x10, 0x04, - 0x10, 0x04, 0x08, 0x08, 0x78, 0x0f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, - 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01}; -static const unsigned char mcur_up_arrow_bits[] = { - 0x80, 0x00, 0xc0, 0x01, 0xc0, 0x01, 0xe0, 0x03, 0xe0, 0x03, 0xf0, 0x07, - 0xf0, 0x07, 0xf8, 0x0f, 0xf8, 0x0f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, - 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01}; - -static const unsigned char cur_cross_bits[] = { - 0xc0, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, - 0x7f, 0x7f, 0x01, 0x40, 0x7f, 0x7f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, - 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01, 0x00, 0x00}; -static const unsigned char mcur_cross_bits[] = { - 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, - 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, - 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0x00, 0x00}; - -static const uchar cur_ibeam_bits[] = { - 0x00, 0x00, 0xe0, 0x03, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, - 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, - 0x80, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00 }; -static const uchar mcur_ibeam_bits[] = { - 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, - 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, - 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0x00, 0x00 }; - -static const uchar cur_ver_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, - 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f, - 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00 }; -static const uchar mcur_ver_bits[] = { - 0x00, 0x00, 0x80, 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0xf8, 0x3f, - 0xfc, 0x7f, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xfc, 0x7f, 0xf8, 0x3f, - 0xf0, 0x1f, 0xe0, 0x0f, 0xc0, 0x07, 0x80, 0x03 }; - -static const uchar cur_hor_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x30, 0x18, - 0x38, 0x38, 0xfc, 0x7f, 0xfc, 0x7f, 0x38, 0x38, 0x30, 0x18, 0x20, 0x08, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar mcur_hor_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x40, 0x04, 0x60, 0x0c, 0x70, 0x1c, 0x78, 0x3c, - 0xfc, 0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfc, 0x7f, 0x78, 0x3c, - 0x70, 0x1c, 0x60, 0x0c, 0x40, 0x04, 0x00, 0x00 }; -static const uchar cur_bdiag_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x3e, 0x00, 0x3c, 0x00, 0x3e, - 0x00, 0x37, 0x88, 0x23, 0xd8, 0x01, 0xf8, 0x00, 0x78, 0x00, 0xf8, 0x00, - 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar mcur_bdiag_bits[] = { - 0x00, 0x00, 0xc0, 0x7f, 0x80, 0x7f, 0x00, 0x7f, 0x00, 0x7e, 0x04, 0x7f, - 0x8c, 0x7f, 0xdc, 0x77, 0xfc, 0x63, 0xfc, 0x41, 0xfc, 0x00, 0xfc, 0x01, - 0xfc, 0x03, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00 }; -static const uchar cur_fdiag_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0xf8, 0x00, 0x78, 0x00, - 0xf8, 0x00, 0xd8, 0x01, 0x88, 0x23, 0x00, 0x37, 0x00, 0x3e, 0x00, 0x3c, - 0x00, 0x3e, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00 }; -static const uchar mcur_fdiag_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x01, 0xfc, 0x00, - 0xfc, 0x41, 0xfc, 0x63, 0xdc, 0x77, 0x8c, 0x7f, 0x04, 0x7f, 0x00, 0x7e, - 0x00, 0x7f, 0x80, 0x7f, 0xc0, 0x7f, 0x00, 0x00 }; -static const uchar cur_blank_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -// 20 x 20 -static const uchar forbidden_bits[] = { - 0x00,0x00,0x00,0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xf0,0x00,0x38,0xc0,0x01, - 0x7c,0x80,0x03,0xec,0x00,0x03,0xce,0x01,0x07,0x86,0x03,0x06,0x06,0x07,0x06, - 0x06,0x0e,0x06,0x06,0x1c,0x06,0x0e,0x38,0x07,0x0c,0x70,0x03,0x1c,0xe0,0x03, - 0x38,0xc0,0x01,0xf0,0xe0,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00,0x00,0x00,0x00 }; - -static const uchar forbiddenm_bits[] = { - 0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xff,0x00,0xf8,0xff,0x01,0xfc,0xf0,0x03, - 0xfe,0xc0,0x07,0xfe,0x81,0x07,0xff,0x83,0x0f,0xcf,0x07,0x0f,0x8f,0x0f,0x0f, - 0x0f,0x1f,0x0f,0x0f,0x3e,0x0f,0x1f,0xfc,0x0f,0x1e,0xf8,0x07,0x3e,0xf0,0x07, - 0xfc,0xe0,0x03,0xf8,0xff,0x01,0xf0,0xff,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00}; - -// 32 x 32 -static const uchar wait_data_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, - 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x08, 0x20, 0x00, - 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, - 0x00, 0x50, 0x15, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x40, 0x05, 0x00, - 0x00, 0x80, 0x02, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x20, 0x08, 0x00, - 0x00, 0x10, 0x10, 0x00, 0x00, 0x08, 0x21, 0x00, 0x00, 0x88, 0x22, 0x00, - 0x00, 0x48, 0x25, 0x00, 0x00, 0xa8, 0x2a, 0x00, 0x00, 0xfc, 0x7f, 0x00, - 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar wait_mask_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, - 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xf8, 0x3f, 0x00, - 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, - 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xc0, 0x07, 0x00, - 0x00, 0x80, 0x03, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0xe0, 0x0f, 0x00, - 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, - 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, - 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -static const uchar hsplit_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, - 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, - 0x00, 0x41, 0x82, 0x00, 0x80, 0x41, 0x82, 0x01, 0xc0, 0x7f, 0xfe, 0x03, - 0x80, 0x41, 0x82, 0x01, 0x00, 0x41, 0x82, 0x00, 0x00, 0x40, 0x02, 0x00, - 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, - 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar hsplitm_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, - 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe3, 0xc7, 0x00, - 0x80, 0xe3, 0xc7, 0x01, 0xc0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x07, - 0xc0, 0xff, 0xff, 0x03, 0x80, 0xe3, 0xc7, 0x01, 0x00, 0xe3, 0xc7, 0x00, - 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, - 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar vsplit_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar vsplitm_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, - 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, - 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, - 0x80, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, - 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar phand_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, - 0x7e, 0x04, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x70, 0x08, 0x00, 0x00, - 0x08, 0x08, 0x00, 0x00, 0x70, 0x14, 0x00, 0x00, 0x08, 0x22, 0x00, 0x00, - 0x30, 0x41, 0x00, 0x00, 0xc0, 0x20, 0x00, 0x00, 0x40, 0x12, 0x00, 0x00, - 0x80, 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar phandm_bits[] = { - 0xfe, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, - 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, - 0xfc, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, - 0xf8, 0xff, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, - 0xc0, 0x1f, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, - 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -static const uchar size_all_data_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x80, 0x81, 0xc0, 0x00, - 0xc0, 0xff, 0xff, 0x01, 0x80, 0x81, 0xc0, 0x00, 0x00, 0x81, 0x40, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar size_all_mask_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, - 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc2, 0x21, 0x00, - 0x00, 0xc3, 0x61, 0x00, 0x80, 0xc3, 0xe1, 0x00, 0xc0, 0xff, 0xff, 0x01, - 0xe0, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0x01, 0x80, 0xc3, 0xe1, 0x00, - 0x00, 0xc3, 0x61, 0x00, 0x00, 0xc2, 0x21, 0x00, 0x00, 0xc0, 0x01, 0x00, - 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0xe0, 0x03, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -static const uchar whatsthis_bits[] = { - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0xf0, 0x07, 0x00, - 0x09, 0x18, 0x0e, 0x00, 0x11, 0x1c, 0x0e, 0x00, 0x21, 0x1c, 0x0e, 0x00, - 0x41, 0x1c, 0x0e, 0x00, 0x81, 0x1c, 0x0e, 0x00, 0x01, 0x01, 0x07, 0x00, - 0x01, 0x82, 0x03, 0x00, 0xc1, 0xc7, 0x01, 0x00, 0x49, 0xc0, 0x01, 0x00, - 0x95, 0xc0, 0x01, 0x00, 0x93, 0xc0, 0x01, 0x00, 0x21, 0x01, 0x00, 0x00, - 0x20, 0xc1, 0x01, 0x00, 0x40, 0xc2, 0x01, 0x00, 0x40, 0x02, 0x00, 0x00, - 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -static const uchar whatsthism_bits[] = { - 0x01, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x07, 0x00, 0x07, 0xf8, 0x0f, 0x00, - 0x0f, 0xfc, 0x1f, 0x00, 0x1f, 0x3e, 0x1f, 0x00, 0x3f, 0x3e, 0x1f, 0x00, - 0x7f, 0x3e, 0x1f, 0x00, 0xff, 0x3e, 0x1f, 0x00, 0xff, 0x9d, 0x0f, 0x00, - 0xff, 0xc3, 0x07, 0x00, 0xff, 0xe7, 0x03, 0x00, 0x7f, 0xe0, 0x03, 0x00, - 0xf7, 0xe0, 0x03, 0x00, 0xf3, 0xe0, 0x03, 0x00, 0xe1, 0xe1, 0x03, 0x00, - 0xe0, 0xe1, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, - 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; - -static const uchar busy_bits[] = { - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, - 0x41, 0xe0, 0xff, 0x00, 0x81, 0x20, 0x80, 0x00, 0x01, 0xe1, 0xff, 0x00, - 0x01, 0x42, 0x40, 0x00, 0xc1, 0x47, 0x40, 0x00, 0x49, 0x40, 0x55, 0x00, - 0x95, 0x80, 0x2a, 0x00, 0x93, 0x00, 0x15, 0x00, 0x21, 0x01, 0x0a, 0x00, - 0x20, 0x01, 0x11, 0x00, 0x40, 0x82, 0x20, 0x00, 0x40, 0x42, 0x44, 0x00, - 0x80, 0x41, 0x4a, 0x00, 0x00, 0x40, 0x55, 0x00, 0x00, 0xe0, 0xff, 0x00, - 0x00, 0x20, 0x80, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -static const uchar busym_bits[] = { - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, - 0x7f, 0xe0, 0xff, 0x00, 0xff, 0xe0, 0xff, 0x00, 0xff, 0xe1, 0xff, 0x00, - 0xff, 0xc3, 0x7f, 0x00, 0xff, 0xc7, 0x7f, 0x00, 0x7f, 0xc0, 0x7f, 0x00, - 0xf7, 0x80, 0x3f, 0x00, 0xf3, 0x00, 0x1f, 0x00, 0xe1, 0x01, 0x0e, 0x00, - 0xe0, 0x01, 0x1f, 0x00, 0xc0, 0x83, 0x3f, 0x00, 0xc0, 0xc3, 0x7f, 0x00, - 0x80, 0xc1, 0x7f, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0xe0, 0xff, 0x00, - 0x00, 0xe0, 0xff, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -// 16 x 16 -static const uchar openhand_bits[] = { - 0x80,0x01,0x58,0x0e,0x64,0x12,0x64,0x52,0x48,0xb2,0x48,0x92, - 0x16,0x90,0x19,0x80,0x11,0x40,0x02,0x40,0x04,0x40,0x04,0x20, - 0x08,0x20,0x10,0x10,0x20,0x10,0x00,0x00}; -static const uchar openhandm_bits[] = { - 0x80,0x01,0xd8,0x0f,0xfc,0x1f,0xfc,0x5f,0xf8,0xff,0xf8,0xff, - 0xfe,0xff,0xff,0xff,0xff,0x7f,0xfe,0x7f,0xfc,0x7f,0xfc,0x3f, - 0xf8,0x3f,0xf0,0x1f,0xe0,0x1f,0x00,0x00}; -static const uchar closedhand_bits[] = { - 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0x48,0x32,0x08,0x50, - 0x10,0x40,0x18,0x40,0x04,0x40,0x04,0x20,0x08,0x20,0x10,0x10, - 0x20,0x10,0x20,0x10,0x00,0x00,0x00,0x00}; -static const uchar closedhandm_bits[] = { - 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0xf8,0x3f,0xf8,0x7f, - 0xf0,0x7f,0xf8,0x7f,0xfc,0x7f,0xfc,0x3f,0xf8,0x3f,0xf0,0x1f, - 0xe0,0x1f,0xe0,0x1f,0x00,0x00,0x00,0x00}; - -void QVNCCursorPrivate::createSystemCursor(int id) -{ - if (!systemCursorTableInit) { - for (int i = 0; i <= Qt::LastCursor; i++) - systemCursorTable[i] = 0; - systemCursorTableInit = true; - } - switch (id) { - // 16x16 cursors - case Qt::ArrowCursor: - systemCursorTable[Qt::ArrowCursor] = - new QVNCCursorPrivate(cur_arrow_bits, mcur_arrow_bits, 16, 16, 0, 0); - break; - - case Qt::UpArrowCursor: - systemCursorTable[Qt::UpArrowCursor] = - new QVNCCursorPrivate(cur_up_arrow_bits, mcur_up_arrow_bits, 16, 16, 7, 0); - break; - - case Qt::CrossCursor: - systemCursorTable[Qt::CrossCursor] = - new QVNCCursorPrivate(cur_cross_bits, mcur_cross_bits, 16, 16, 7, 7); - break; - - case Qt::IBeamCursor: - systemCursorTable[Qt::IBeamCursor] = - new QVNCCursorPrivate(cur_ibeam_bits, mcur_ibeam_bits, 16, 16, 7, 7); - break; - - case Qt::SizeVerCursor: - systemCursorTable[Qt::SizeVerCursor] = - new QVNCCursorPrivate(cur_ver_bits, mcur_ver_bits, 16, 16, 7, 7); - break; - - case Qt::SizeHorCursor: - systemCursorTable[Qt::SizeHorCursor] = - new QVNCCursorPrivate(cur_hor_bits, mcur_hor_bits, 16, 16, 7, 7); - break; - - case Qt::SizeBDiagCursor: - systemCursorTable[Qt::SizeBDiagCursor] = - new QVNCCursorPrivate(cur_bdiag_bits, mcur_bdiag_bits, 16, 16, 7, 7); - break; - - case Qt::SizeFDiagCursor: - systemCursorTable[Qt::SizeFDiagCursor] = - new QVNCCursorPrivate(cur_fdiag_bits, mcur_fdiag_bits, 16, 16, 7, 7); - break; - - case Qt::BlankCursor: - systemCursorTable[Qt::BlankCursor] = - new QVNCCursorPrivate(0, 0, 0, 0, 0, 0); - break; - - // 20x20 cursors - case Qt::ForbiddenCursor: - systemCursorTable[Qt::ForbiddenCursor] = - new QVNCCursorPrivate(forbidden_bits, forbiddenm_bits, 20, 20, 10, 10); - break; - - // 32x32 cursors - case Qt::WaitCursor: - systemCursorTable[Qt::WaitCursor] = - new QVNCCursorPrivate(wait_data_bits, wait_mask_bits, 32, 32, 15, 15); - break; - - case Qt::SplitVCursor: - systemCursorTable[Qt::SplitVCursor] = - new QVNCCursorPrivate(vsplit_bits, vsplitm_bits, 32, 32, 15, 15); - break; - - case Qt::SplitHCursor: - systemCursorTable[Qt::SplitHCursor] = - new QVNCCursorPrivate(hsplit_bits, hsplitm_bits, 32, 32, 15, 15); - break; - - case Qt::SizeAllCursor: - systemCursorTable[Qt::SizeAllCursor] = - new QVNCCursorPrivate(size_all_data_bits, size_all_mask_bits, 32, 32, 15, 15); - break; - - case Qt::PointingHandCursor: - systemCursorTable[Qt::PointingHandCursor] = - new QVNCCursorPrivate(phand_bits, phandm_bits, 32, 32, 0, 0); - break; - - case Qt::WhatsThisCursor: - systemCursorTable[Qt::WhatsThisCursor] = - new QVNCCursorPrivate(whatsthis_bits, whatsthism_bits, 32, 32, 0, 0); - break; - case Qt::BusyCursor: - systemCursorTable[Qt::BusyCursor] = - new QVNCCursorPrivate(busy_bits, busym_bits, 32, 32, 0, 0); - break; - - case Qt::OpenHandCursor: - systemCursorTable[Qt::OpenHandCursor] = - new QVNCCursorPrivate(openhand_bits, openhandm_bits, 16, 16, 8, 8); - break; - case Qt::ClosedHandCursor: - systemCursorTable[Qt::ClosedHandCursor] = - new QVNCCursorPrivate(closedhand_bits, closedhandm_bits, 16, 16, 8, 8); - break; - default: - qWarning("Unknown system cursor %d", id); - } -} - -void QVNCCursorPrivate::set(Qt::CursorShape id) -{ - QVNCCursorPrivate *cursor = 0; - if (id >= 0 && id <= Qt::LastCursor) { - if (!systemCursorTable[id]) - createSystemCursor(id); - cursor = systemCursorTable[id]; - } - - if (cursor == 0) { - if (!systemCursorTable[Qt::ArrowCursor]) - createSystemCursor(Qt::ArrowCursor); - cursor = systemCursorTable[Qt::ArrowCursor]; - } - cursorImage = cursor->cursorImage; - hot = cursor->hot; -} - -void QVNCCursorPrivate::set(const uchar *data, const uchar *mask, - int width, int height, int hx, int hy) -{ - hot.setX(hx); - hot.setY(hy); - - cursorImage = QImage(width,height, QImage::Format_Indexed8); - - if (!width || !height || !data || !mask || cursorImage.isNull()) - return; - - cursorImage.setNumColors(3); - cursorImage.setColor(0, 0xff000000); - cursorImage.setColor(1, 0xffffffff); - cursorImage.setColor(2, 0x00000000); - - int bytesPerLine = (width + 7) / 8; - int p = 0; - int d, m; - - int x = -1, w = 0; - - uchar *cursor_data = cursorImage.bits(); - int bpl = cursorImage.bytesPerLine(); - for (int i = 0; i < height; i++) - { - for (int j = 0; j < bytesPerLine; j++, data++, mask++) - { - for (int b = 0; b < 8 && j*8+b < width; b++) - { - d = *data & (1 << b); - m = *mask & (1 << b); - if (d && m) p = 0; - else if (!d && m) p = 1; - else p = 2; - cursor_data[j*8+b] = p; - - // calc region - if (x < 0 && m) - x = j*8+b; - else if (x >= 0 && !m) { - x = -1; - w = 0; - } - if (m) - w++; - } - } - if (x >= 0) { - x = -1; - w = 0; - } - cursor_data += bpl; - } - -} - QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/vnc/qvnccursor.h b/src/plugins/graphicssystems/vnc/qvnccursor.h index 1c0ce8a..1a53da7 100644 --- a/src/plugins/graphicssystems/vnc/qvnccursor.h +++ b/src/plugins/graphicssystems/vnc/qvnccursor.h @@ -41,6 +41,7 @@ #ifndef QVNCCURSOR_H #define QVNCCURSOR_H +#include "qgraphicssystemcursor.h" #include #include #include @@ -50,22 +51,7 @@ QT_BEGIN_NAMESPACE class QVNCGraphicsSystemScreen; class QVNCServer; -// Cursor graphics management -class QVNCCursorPrivate { -public: - QVNCCursorPrivate(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) - { set(data, mask, width, height, hotX, hotY); } - QImage * image() { return &cursorImage; } - QPoint hotspot() { return hot; } - QImage cursorImage; - QPoint hot; - void set(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); - void set(Qt::CursorShape); -private: - static void createSystemCursor(int id); -}; - -class QVNCCursor { +class QVNCCursor : public QGraphicsSystemCursor { public: QVNCCursor(QVNCServer *, QVNCGraphicsSystemScreen *); @@ -73,11 +59,9 @@ public: void setCursorMode(bool vnc); void setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); void setCursor(Qt::CursorShape shape); - void pointerEvent(QMouseEvent & event); // output methods QRect drawCursor(QPainter &); - QRect dirtyRect(); // VNC client communication void sendClientCursor(); @@ -85,14 +69,7 @@ public: private: bool useVncCursor; // VNC or local - QRect currentRect; // next place to draw the cursor - QRect prevRect; // last place the cursor was drawn - QVNCServer * server; // VNC server to get events from - QVNCGraphicsSystemScreen * screen; // Where to request an update - QWidget * currentWidget; // widget currently under the cursor - - QVNCCursorPrivate * d_ptr; }; QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/vnc/qvncserver.cpp b/src/plugins/graphicssystems/vnc/qvncserver.cpp index ad20eec..fd66f47 100644 --- a/src/plugins/graphicssystems/vnc/qvncserver.cpp +++ b/src/plugins/graphicssystems/vnc/qvncserver.cpp @@ -680,6 +680,7 @@ void QVNCServer::setEncodings() }; supportCursor = false; + if (encodingsPending && (unsigned)client->bytesAvailable() >= encodingsPending * sizeof(quint32)) { for (int i = 0; i < encodingsPending; ++i) { @@ -783,6 +784,7 @@ void QVNCServer::setEncodings() qDebug("QVNCServer::setEncodings: fallback using raw"); #endif } + if (cursor) cursor->setCursorMode(supportCursor); } @@ -833,10 +835,8 @@ void QVNCServer::pointerEvent() if (buttonChange(buttons, ev.buttons, &button, &isPress)) type = isPress ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; QMouseEvent me(type, QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), button, ev.buttons, keymod); - if (cursor) + if(cursor) cursor->pointerEvent(me); - else - QApplicationPrivate::handleMouseEvent(0, me); buttons = ev.buttons; handleMsg = false; } @@ -1827,7 +1827,7 @@ void QRfbRawEncoder::write() inline QImage *QVNCServer::screenImage() const { - return qvnc_screen->mScreenImage; + return qvnc_screen->image(); } void QVNCServer::checkUpdate() diff --git a/src/plugins/graphicssystems/vnc/qvncserver.h b/src/plugins/graphicssystems/vnc/qvncserver.h index 351c094..79b2098 100644 --- a/src/plugins/graphicssystems/vnc/qvncserver.h +++ b/src/plugins/graphicssystems/vnc/qvncserver.h @@ -54,6 +54,7 @@ // #include "qgraphicssystem_vnc.h" +#include "qvnccursor.h" #define QT_NO_QWS_CURSOR #ifndef QT_NO_QWS_VNC @@ -466,7 +467,7 @@ public: inline bool hasClientCursor() const { return qvnc_cursor != 0; } #endif - void setCursor(QVNCCursor *c) { cursor = c; } + void setCursor(QVNCCursor * c) { cursor = c; } private: void setPixelFormat(); void setEncodings(); @@ -517,7 +518,7 @@ private: #endif QRfbEncoder *encoder; - QVNCCursor * cursor; + QVNCCursor *cursor; }; diff --git a/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp b/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp deleted file mode 100644 index 24ae846..0000000 --- a/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include "qwindowsurface_vnc.h" -#include "qgraphicssystem_vnc.h" -#include -#include -#include - -QT_BEGIN_NAMESPACE - -QVNCWindowSurface::QVNCWindowSurface(QVNCGraphicsSystem *graphicsSystem, - QVNCGraphicsSystemScreen *screen, QWidget *window) - : QWindowSurface(window), - mScreen(screen), - visibleFlag(false) -{ - Q_UNUSED(graphicsSystem); - mImage = QImage(window->size(), mScreen->format()); -} - -QVNCWindowSurface::~QVNCWindowSurface() -{ - mScreen->removeWindowSurface(this); -} - -QPaintDevice *QVNCWindowSurface::paintDevice() -{ - return &mImage; -} - -void QVNCWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) -{ - Q_UNUSED(widget); - Q_UNUSED(offset); - - QRect currentGeometry = geometry(); - // If this is a move, redraw the previous location - if (oldGeometry != currentGeometry) { - mScreen->setDirty(oldGeometry); - oldGeometry = currentGeometry; - } - - QRect dirtyClient = region.boundingRect(); - QRect dirtyRegion(currentGeometry.left() + dirtyClient.left(), - currentGeometry.top() + dirtyClient.top(), - dirtyClient.width(), - dirtyClient.height()); - mScreen->setDirty(dirtyRegion); -} - -void QVNCWindowSurface::setGeometry(const QRect &rect) -{ - // store previous geometry for screen update - oldGeometry = geometry(); - - // change the widget's QImage if this is a resize - if (mImage.size() != rect.size()) - mImage = QImage(rect.size(), mScreen->format()); - - QApplicationPrivate::handleGeometryChange(this->window(), rect); - - QWindowSurface::setGeometry(rect); -} - -bool QVNCWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - return QWindowSurface::scroll(area, dx, dy); -} - -void QVNCWindowSurface::beginPaint(const QRegion ®ion) -{ - Q_UNUSED(region); -} - -void QVNCWindowSurface::endPaint(const QRegion ®ion) -{ - Q_UNUSED(region); -} - -void QVNCWindowSurface::setVisible(bool visible) -{ - visibleFlag = visible; - mScreen->setDirty(geometry()); -} -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h b/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h deleted file mode 100644 index 477fe1b..0000000 --- a/src/plugins/graphicssystems/vnc/qwindowsurface_vnc.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_VNC_H -#define QWINDOWSURFACE_VNC_H - -#include -#include - -QT_BEGIN_NAMESPACE - -class QVNCGraphicsSystem; -class QVNCGraphicsSystemScreen; - -class QVNCWindowSurface : public QWindowSurface -{ -public: - QVNCWindowSurface(QVNCGraphicsSystem *graphicsSystem, - QVNCGraphicsSystemScreen *screen, QWidget *window); - ~QVNCWindowSurface(); - - QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void setGeometry(const QRect &rect); - bool scroll(const QRegion &area, int dx, int dy); - - void beginPaint(const QRegion ®ion); - void endPaint(const QRegion ®ion); - inline const QImage image() { return mImage; } - void setVisible(bool visible); - bool visible() { return visibleFlag; } -private: - QVNCGraphicsSystem *mGraphicsSystem; - QVNCGraphicsSystemScreen *mScreen; - QRect oldGeometry; - QImage mImage; - bool visibleFlag; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/graphicssystems/vnc/vnc.pro b/src/plugins/graphicssystems/vnc/vnc.pro index 69cd1f7..aecb371 100644 --- a/src/plugins/graphicssystems/vnc/vnc.pro +++ b/src/plugins/graphicssystems/vnc/vnc.pro @@ -3,10 +3,8 @@ include(../../qpluginbase.pri) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems - - -SOURCES = main.cpp qgraphicssystem_vnc.cpp qwindowsurface_vnc.cpp -HEADERS = qgraphicssystem_vnc.h qwindowsurface_vnc.h +SOURCES = main.cpp qgraphicssystem_vnc.cpp +HEADERS = qgraphicssystem_vnc.h HEADERS += qvncserver.h SOURCES += qvncserver.cpp @@ -15,4 +13,7 @@ HEADERS += qvnccursor.h SOURCES += qvnccursor.cpp target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems + +LIBS += -L$$[QT_INSTALL_PLUGINS]/graphicssystems -lfb_base + INSTALLS += target -- cgit v0.12 From fc0c5aa573d834041b9ea164fc4b19eda7e66ab7 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 11 Nov 2009 13:55:00 +0100 Subject: include fb_base code using fb_base.pri, rather than as a library --- src/plugins/graphicssystems/fb_base/fb_base.pri | 2 ++ src/plugins/graphicssystems/linuxfb/linuxfb.pro | 3 ++- src/plugins/graphicssystems/vnc/vnc.pro | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 src/plugins/graphicssystems/fb_base/fb_base.pri diff --git a/src/plugins/graphicssystems/fb_base/fb_base.pri b/src/plugins/graphicssystems/fb_base/fb_base.pri new file mode 100644 index 0000000..41bd87f --- /dev/null +++ b/src/plugins/graphicssystems/fb_base/fb_base.pri @@ -0,0 +1,2 @@ +SOURCES += ../fb_base/fb_base.cpp +HEADERS += ../fb_base/fb_base.h diff --git a/src/plugins/graphicssystems/linuxfb/linuxfb.pro b/src/plugins/graphicssystems/linuxfb/linuxfb.pro index ea92573..031b843 100644 --- a/src/plugins/graphicssystems/linuxfb/linuxfb.pro +++ b/src/plugins/graphicssystems/linuxfb/linuxfb.pro @@ -6,6 +6,7 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems SOURCES = main.cpp qgraphicssystem_linuxfb.cpp HEADERS = qgraphicssystem_linuxfb.h +include(../fb_base/fb_base.pri) + target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems -LIBS += -L$$[QT_INSTALL_PLUGINS]/graphicssystems -lfb_base INSTALLS += target diff --git a/src/plugins/graphicssystems/vnc/vnc.pro b/src/plugins/graphicssystems/vnc/vnc.pro index aecb371..0b73b5b 100644 --- a/src/plugins/graphicssystems/vnc/vnc.pro +++ b/src/plugins/graphicssystems/vnc/vnc.pro @@ -12,8 +12,8 @@ SOURCES += qvncserver.cpp HEADERS += qvnccursor.h SOURCES += qvnccursor.cpp -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +include(../fb_base/fb_base.pri) -LIBS += -L$$[QT_INSTALL_PLUGINS]/graphicssystems -lfb_base +target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems INSTALLS += target -- cgit v0.12 From f50552ccfbe9a71d798d00a2d963898c98654256 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 11 Nov 2009 14:08:41 +0100 Subject: send client cursor via QVNCServer checkUpdate(), rather than asynchronously --- src/plugins/graphicssystems/vnc/qvnccursor.cpp | 12 ++++++++---- src/plugins/graphicssystems/vnc/qvncserver.cpp | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/graphicssystems/vnc/qvnccursor.cpp b/src/plugins/graphicssystems/vnc/qvnccursor.cpp index ec9a4ee..80ab750 100644 --- a/src/plugins/graphicssystems/vnc/qvnccursor.cpp +++ b/src/plugins/graphicssystems/vnc/qvnccursor.cpp @@ -65,9 +65,9 @@ void QVNCCursor::setCursorMode(bool vnc) if (vnc) { screen->setDirty(prevRect); prevRect = QRect(); - sendClientCursor(); + server->setDirtyCursor(); } else { - clearClientCursor(); + server->setDirtyCursor(); } useVncCursor = vnc; } @@ -76,7 +76,7 @@ void QVNCCursor::setCursor(Qt::CursorShape shape) { QGraphicsSystemCursor::setCursor(shape); if (useVncCursor) { - sendClientCursor(); + server->setDirtyCursor(); } } @@ -84,7 +84,7 @@ void QVNCCursor::setCursor(const uchar *data, const uchar *mask, int width, int { QGraphicsSystemCursor::setCursor(data, mask, width, height, hotX, hotY); if (useVncCursor) { - sendClientCursor(); + server->setDirtyCursor(); } } @@ -121,6 +121,10 @@ void QVNCCursor::clearClientCursor() void QVNCCursor::sendClientCursor() { + if (useVncCursor == false) { + clearClientCursor(); + return; + } QImage *image = graphic->image(); if (image->isNull()) return; diff --git a/src/plugins/graphicssystems/vnc/qvncserver.cpp b/src/plugins/graphicssystems/vnc/qvncserver.cpp index fd66f47..ef6b4a1 100644 --- a/src/plugins/graphicssystems/vnc/qvncserver.cpp +++ b/src/plugins/graphicssystems/vnc/qvncserver.cpp @@ -1840,6 +1840,7 @@ void QVNCServer::checkUpdate() Q_ASSERT(qvnc_cursor); qvnc_cursor->write(); #endif + cursor->sendClientCursor(); dirtyCursor = false; wantUpdate = false; return; -- cgit v0.12 From 3ca4be160028e042691fb990ed57126add3a5448 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Thu, 12 Nov 2009 15:39:45 +0100 Subject: Support for override cursors, and fixed cursor change without a widget enter/leave --- src/gui/kernel/qapplication_lite.cpp | 10 +++++++--- src/gui/kernel/qwidget_lite.cpp | 16 +++++++++++++--- src/gui/painting/qgraphicssystemcursor.cpp | 29 +++++++++++++++++------------ src/gui/painting/qgraphicssystemcursor.h | 1 + 4 files changed, 38 insertions(+), 18 deletions(-) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 0ddcfab..061ac5b 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -336,14 +336,18 @@ bool QApplication::isEffectEnabled(Qt::UIEffect effect) } #ifndef QT_NO_CURSOR -void QApplication::setOverrideCursor(const QCursor &) +void QApplication::setOverrideCursor(const QCursor &cursor) { - // XXX + qApp->d_func()->cursor_list.prepend(cursor); + qt_lite_set_cursor(0, false); } void QApplication::restoreOverrideCursor() { - // XXX + if (qApp->d_func()->cursor_list.isEmpty()) + return; + qApp->d_func()->cursor_list.removeFirst(); + qt_lite_set_cursor(0, false); } #endif// QT_NO_CURSOR diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index a4d60a7..6a579ad 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -167,14 +167,14 @@ void QWidgetPrivate::setCursor_sys(const QCursor &cursor) Q_UNUSED(cursor); Q_Q(QWidget); if (q->isVisible()) - updateCursor(); + qt_lite_set_cursor(q, false); } void QWidgetPrivate::unsetCursor_sys() { Q_Q(QWidget); if (q->isVisible()) - updateCursor(); + qt_lite_set_cursor(q, false); } void QWidgetPrivate::updateCursor() const @@ -652,7 +652,16 @@ void QWidgetPrivate::setModal_sys() void qt_lite_set_cursor(QWidget * w, bool force) { static QPointer lastUnderMouse = 0; - if (force) { + if (w == 0) { // override cursor stack emptied + QCursor * override = QApplication::overrideCursor(); + if (override) { + if (QGraphicsSystemCursor::instance) { + QGraphicsSystemCursor::instance->changeCursor(override); + } + return; + } + w = QApplication::widgetAt(QCursor::pos()); + } else if (force) { lastUnderMouse = w; } else if (w->testAttribute(Qt::WA_WState_Created) && lastUnderMouse && lastUnderMouse->effectiveWinId() == w->effectiveWinId()) { @@ -663,6 +672,7 @@ void qt_lite_set_cursor(QWidget * w, bool force) if (!curWin && w && w->internalWinId()) return; QWidget* cW = w && !w->internalWinId() ? w : curWin; + if (!cW || cW->window() != w->window() || !cW->isVisible() || !cW->underMouse() || QApplication::overrideCursor()) return; diff --git a/src/gui/painting/qgraphicssystemcursor.cpp b/src/gui/painting/qgraphicssystemcursor.cpp index 91a6535..9bf5d02 100644 --- a/src/gui/painting/qgraphicssystemcursor.cpp +++ b/src/gui/painting/qgraphicssystemcursor.cpp @@ -105,22 +105,27 @@ void QGraphicsSystemCursor::pointerEvent(QMouseEvent & e) screen->pointerEvent(e); } +void QGraphicsSystemCursor::changeCursor(QCursor * widgetCursor) +{ + Qt::CursorShape shape = widgetCursor->shape(); + + if (shape == Qt::BitmapCursor) { + // application supplied cursor + const QBitmap * map = widgetCursor->bitmap(); + const QBitmap * mask = widgetCursor->mask(); + QPoint spot = widgetCursor->hotSpot(); + setCursor(map->toImage().bits(), mask->toImage().bits(), map->width(), map->height(), spot.x(), spot.y()); + } else { + // system cursor + setCursor(shape); + } +} + void QGraphicsSystemCursor::changeCursor(QWidget * widget) { if (widget) { QCursor widgetCursor = widget->cursor(); - Qt::CursorShape shape = widgetCursor.shape(); - - if (shape == Qt::BitmapCursor) { - // application supplied cursor - const QBitmap * map = widgetCursor.bitmap(); - const QBitmap * mask = widgetCursor.mask(); - QPoint spot = widgetCursor.hotSpot(); - setCursor(map->toImage().bits(), mask->toImage().bits(), map->width(), map->height(), spot.x(), spot.y()); - } else { - // system cursor - setCursor(shape); - } + changeCursor(&widgetCursor); } else { // default cursor setCursor(Qt::ArrowCursor); diff --git a/src/gui/painting/qgraphicssystemcursor.h b/src/gui/painting/qgraphicssystemcursor.h index cb5c471..eab7203 100644 --- a/src/gui/painting/qgraphicssystemcursor.h +++ b/src/gui/painting/qgraphicssystemcursor.h @@ -75,6 +75,7 @@ public: virtual void setCursor(Qt::CursorShape shape); virtual void pointerEvent(QMouseEvent & event); virtual void changeCursor(QWidget * widget); + virtual void changeCursor(QCursor * widgetCursor); // output methods virtual QRect drawCursor(QPainter &); -- cgit v0.12 From 6f22069b01d089ef7151b2d78d56c13c71924b62 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 6 Nov 2009 13:41:17 +0100 Subject: Make tst_QWidget lower() and stackUnder() test functions pass --- src/gui/kernel/qwidget_lite.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index 6a579ad..615d4dd 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -419,17 +419,31 @@ void QWidgetPrivate::setFocus_sys() void QWidgetPrivate::raise_sys() { - // XXX + Q_Q(QWidget); + if (q->isWindow()) { + qWarning() << "raise_sys not implemented for tlw" << q; + } } void QWidgetPrivate::lower_sys() { - // XXX + Q_Q(QWidget); + if (q->isWindow()) { + Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); + qWarning() << "lower_sys not implemented for tlw" << q; + } else if (QWidget *p = q->parentWidget()) { + setDirtyOpaqueRegion(); + p->d_func()->invalidateBuffer(effectiveRectFor(q->geometry())); + } } void QWidgetPrivate::stackUnder_sys(QWidget*) { - // XXX + Q_Q(QWidget); + if (QWidget *p = q->parentWidget()) { + setDirtyOpaqueRegion(); + p->d_func()->invalidateBuffer(effectiveRectFor(q->geometry())); + } } void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) -- cgit v0.12 From 9904436eb0f3ebdabfba527fe659f4964af8bf06 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 11 Nov 2009 16:46:55 +0100 Subject: Starting to implement grabWindow() for Lighthouse --- src/gui/image/qpixmap_lite.cpp | 9 +++------ src/gui/painting/qgraphicssystem.cpp | 14 ++++++++++++++ src/gui/painting/qgraphicssystem_p.h | 6 +++++- .../graphicssystems/testlite/qgraphicssystem_testlite.cpp | 8 ++++++++ .../graphicssystems/testlite/qgraphicssystem_testlite.h | 2 ++ 5 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/gui/image/qpixmap_lite.cpp b/src/gui/image/qpixmap_lite.cpp index 90761ca..d263855 100644 --- a/src/gui/image/qpixmap_lite.cpp +++ b/src/gui/image/qpixmap_lite.cpp @@ -40,13 +40,10 @@ ****************************************************************************/ #include +#include +#include QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) { - Q_UNUSED(window); - Q_UNUSED(x); - Q_UNUSED(y); - Q_UNUSED(w); - Q_UNUSED(h); - return QPixmap(); + return QApplicationPrivate::graphicsSystem()->grabWindow(window, x, y, w, h); } diff --git a/src/gui/painting/qgraphicssystem.cpp b/src/gui/painting/qgraphicssystem.cpp index 1565c45..2071127 100644 --- a/src/gui/painting/qgraphicssystem.cpp +++ b/src/gui/painting/qgraphicssystem.cpp @@ -84,11 +84,23 @@ QPixmapData *QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixelType typ return 0; } +#ifdef Q_WS_LITE QList QGraphicsSystem::screens() const { return QList(); } +QPixmap QGraphicsSystem::grabWindow(WId window, int x, int y, int width, int height) const +{ + Q_UNUSED(window); + Q_UNUSED(x); + Q_UNUSED(y); + Q_UNUSED(width); + Q_UNUSED(height); + return QPixmap(); +} + + QGraphicsSystemScreen::QGraphicsSystemScreen(QObject *parent) : QObject(parent) {} @@ -102,4 +114,6 @@ QRect QGraphicsSystemScreen::availableGeometry() const return geometry(); } +#endif //Q_WS_LITE + QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystem_p.h b/src/gui/painting/qgraphicssystem_p.h index 7cc6247..ddba22d 100644 --- a/src/gui/painting/qgraphicssystem_p.h +++ b/src/gui/painting/qgraphicssystem_p.h @@ -60,6 +60,7 @@ QT_BEGIN_NAMESPACE class QPixmapFilter; +#ifdef Q_WS_LITE class Q_GUI_EXPORT QGraphicsSystemScreen : public QObject { Q_OBJECT @@ -75,6 +76,7 @@ public: virtual void setDirty(QRect) { } virtual void pointerEvent(QMouseEvent &) { } }; +#endif // Q_WS_LITE class Q_GUI_EXPORT QGraphicsSystem { @@ -84,8 +86,10 @@ public: virtual ~QGraphicsSystem() = 0; +#ifdef Q_WS_LITE virtual QList screens() const; - + virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const; +#endif //### Remove this & change qpixmap.cpp & qbitmap.cpp once every platform is gaurenteed // to have a graphics system. static QPixmapData *createDefaultPixmapData(QPixmapData::PixelType type); diff --git a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp index 9cb0424..9991e75 100644 --- a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp @@ -77,4 +77,12 @@ QWindowSurface *QTestLiteGraphicsSystem::createWindowSurface(QWidget *widget) co (const_cast(this), mPrimaryScreen, widget); } + +QPixmap QTestLiteGraphicsSystem::grabWindow(WId window, int x, int y, int width, int height) const +{ + qDebug() << "grabWindow" << hex << window << dec<< x << y << width << height; + return QPixmap(); +} + + QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.h b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.h index ad7f581..b2cd496 100644 --- a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.h +++ b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.h @@ -75,6 +75,8 @@ public: QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QWindowSurface *createWindowSurface(QWidget *widget) const; + QPixmap grabWindow(WId window, int x, int y, int width, int height) const; + QList screens() const { return mScreens; } MyDisplay *xd; -- cgit v0.12 From 2e3b33c91578e6ec9524b15965449d81e09fb56f Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Fri, 13 Nov 2009 16:34:52 +0100 Subject: support raise/lower for widgets that are a lighthouse window --- src/gui/kernel/qwidget_lite.cpp | 9 +++++++-- src/gui/painting/qgraphicssystem_p.h | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index 615d4dd..d52d432 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -51,6 +51,7 @@ #include "qgraphicssystemcursor.h" QT_BEGIN_NAMESPACE +static QGraphicsSystemScreen *qt_screenForWidget(const QWidget *w); void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool /*destroyOldWindow*/) { @@ -421,7 +422,9 @@ void QWidgetPrivate::raise_sys() { Q_Q(QWidget); if (q->isWindow()) { - qWarning() << "raise_sys not implemented for tlw" << q; + QWindowSurface *surface = q->windowSurface(); + QGraphicsSystemScreen *screen = qt_screenForWidget(q); + screen->raise(surface); } } @@ -430,7 +433,9 @@ void QWidgetPrivate::lower_sys() Q_Q(QWidget); if (q->isWindow()) { Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); - qWarning() << "lower_sys not implemented for tlw" << q; + QWindowSurface *surface = q->windowSurface(); + QGraphicsSystemScreen *screen = qt_screenForWidget(q); + screen->lower(surface); } else if (QWidget *p = q->parentWidget()) { setDirtyOpaqueRegion(); p->d_func()->invalidateBuffer(effectiveRectFor(q->geometry())); diff --git a/src/gui/painting/qgraphicssystem_p.h b/src/gui/painting/qgraphicssystem_p.h index ddba22d..5b5848e 100644 --- a/src/gui/painting/qgraphicssystem_p.h +++ b/src/gui/painting/qgraphicssystem_p.h @@ -75,6 +75,9 @@ public: virtual QSize physicalSize() const = 0; virtual void setDirty(QRect) { } virtual void pointerEvent(QMouseEvent &) { } + + virtual void raise(QWindowSurface *) { qWarning("This plugin does not support raise()"); } + virtual void lower(QWindowSurface *) { qWarning("This plugin does not support lower()"); } }; #endif // Q_WS_LITE -- cgit v0.12 From 9c89de22a012aab0cb8c0be48374896df69f9d2a Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Fri, 13 Nov 2009 16:35:52 +0100 Subject: correct the order of window stacking, support raise and lower --- src/plugins/graphicssystems/fb_base/fb_base.cpp | 31 +++++++------------------ src/plugins/graphicssystems/fb_base/fb_base.h | 8 +++---- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/src/plugins/graphicssystems/fb_base/fb_base.cpp b/src/plugins/graphicssystems/fb_base/fb_base.cpp index ffa5d4e..c4c009f 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.cpp +++ b/src/plugins/graphicssystems/fb_base/fb_base.cpp @@ -66,7 +66,7 @@ QRegion QGraphicsSystemFbScreen::doRedraw() QRect rect = rects[rectIndex]; // Blank the affected area, just in case there's nothing to display compositePainter.fillRect(rect, Qt::black); - for (int i = 0; i < windowStack.length(); i++) { + for (int i = windowStack.length() - 1; i >= 0; i--) { if (!windowStack[i]->visible()) continue; QRect windowRect = windowStack[i]->geometry(); @@ -97,39 +97,26 @@ void QGraphicsSystemFbScreen::removeWindowSurface(QGraphicsSystemFbWindowSurface setDirty(surface->geometry()); } -void QGraphicsSystemFbScreen::raise(QGraphicsSystemFbWindowSurface * surface) +void QGraphicsSystemFbScreen::raise(QWindowSurface * surface) { - int index = windowStack.indexOf(surface); + QGraphicsSystemFbWindowSurface *s = static_cast(surface); + int index = windowStack.indexOf(s); if (index <= 0) return; windowStack.move(index, index - 1); + setDirty(s->geometry()); } -void QGraphicsSystemFbScreen::lower(QGraphicsSystemFbWindowSurface * surface) +void QGraphicsSystemFbScreen::lower(QWindowSurface * surface) { - int index = windowStack.indexOf(surface); + QGraphicsSystemFbWindowSurface *s = static_cast(surface); + int index = windowStack.indexOf(s); if (index == -1 || index == (windowStack.size() - 1)) return; windowStack.move(index, index + 1); + setDirty(s->geometry()); } -void QGraphicsSystemFbScreen::top(QGraphicsSystemFbWindowSurface * surface) -{ - int index = windowStack.indexOf(surface); - if (index == -1) - return; - windowStack.move(index, 0); -} - -void QGraphicsSystemFbScreen::bottom(QGraphicsSystemFbWindowSurface * surface) -{ - int index = windowStack.indexOf(surface); - if (index == -1) - return; - windowStack.move(index, windowStack.size() - 1); -} - - void QGraphicsSystemFbScreen::pointerEvent(QMouseEvent & me) { QApplicationPrivate::handleMouseEvent(0, me); diff --git a/src/plugins/graphicssystems/fb_base/fb_base.h b/src/plugins/graphicssystems/fb_base/fb_base.h index fba7a7a..bd69443 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.h +++ b/src/plugins/graphicssystems/fb_base/fb_base.h @@ -59,11 +59,9 @@ public: virtual void setDirty(const QRect &rect); virtual void removeWindowSurface(QGraphicsSystemFbWindowSurface * surface); - virtual void addWindowSurface(QGraphicsSystemFbWindowSurface * surface) { windowStack.append(surface); } - virtual void raise(QGraphicsSystemFbWindowSurface * surface); - virtual void lower(QGraphicsSystemFbWindowSurface * surface); - virtual void top(QGraphicsSystemFbWindowSurface * surface); - virtual void bottom(QGraphicsSystemFbWindowSurface * surface); + virtual void addWindowSurface(QGraphicsSystemFbWindowSurface * surface) { windowStack.prepend(surface); } + virtual void raise(QWindowSurface * surface); + virtual void lower(QWindowSurface * surface); virtual void pointerEvent(QMouseEvent & me); -- cgit v0.12 From 364825a39178fecc0c723ddc0ec7409b2f9b2956 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Fri, 13 Nov 2009 17:29:42 +0100 Subject: lower is to the bottom, not 1 lower, raise is to the top, not 1 higher --- src/plugins/graphicssystems/fb_base/fb_base.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/graphicssystems/fb_base/fb_base.cpp b/src/plugins/graphicssystems/fb_base/fb_base.cpp index c4c009f..cb1b478 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.cpp +++ b/src/plugins/graphicssystems/fb_base/fb_base.cpp @@ -103,7 +103,7 @@ void QGraphicsSystemFbScreen::raise(QWindowSurface * surface) int index = windowStack.indexOf(s); if (index <= 0) return; - windowStack.move(index, index - 1); + windowStack.move(index, 0); setDirty(s->geometry()); } @@ -113,7 +113,7 @@ void QGraphicsSystemFbScreen::lower(QWindowSurface * surface) int index = windowStack.indexOf(s); if (index == -1 || index == (windowStack.size() - 1)) return; - windowStack.move(index, index + 1); + windowStack.move(index, windowStack.size() - 1); setDirty(s->geometry()); } -- cgit v0.12 From 12bc7c80b94b5f3acbf87f268c4e68ba4bc89381 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Mon, 16 Nov 2009 13:57:53 +0100 Subject: remove an unnecessary call to QGraphicsSystemScreen::setDirty() in QGraphicsSystemCursor::pointerEvent() --- src/gui/painting/qgraphicssystemcursor.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/painting/qgraphicssystemcursor.cpp b/src/gui/painting/qgraphicssystemcursor.cpp index 9bf5d02..08dcbbe 100644 --- a/src/gui/painting/qgraphicssystemcursor.cpp +++ b/src/gui/painting/qgraphicssystemcursor.cpp @@ -100,7 +100,6 @@ void QGraphicsSystemCursor::pointerEvent(QMouseEvent & e) currentRect = graphic->image()->rect().translated(-graphic->hotspot().x(), -graphic->hotspot().y()); currentRect.translate(e.pos()); - screen->setDirty(currentRect); screen->pointerEvent(e); } -- cgit v0.12 From 993b3831d3b2704f492c17313a210497b6f9bb5f Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Mon, 16 Nov 2009 16:12:52 +0100 Subject: moved top-level raise/lower from QGraphicsSystemScreen to QWindowSurface, testlite support --- src/gui/kernel/qwidget_lite.cpp | 6 ++---- src/gui/painting/qgraphicssystem_p.h | 3 --- src/gui/painting/qwindowsurface_p.h | 3 +++ src/plugins/graphicssystems/fb_base/fb_base.cpp | 10 ++++++++++ src/plugins/graphicssystems/fb_base/fb_base.h | 4 ++++ .../graphicssystems/testlite/qwindowsurface_testlite.cpp | 11 +++++++++++ .../graphicssystems/testlite/qwindowsurface_testlite.h | 2 ++ 7 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index d52d432..cd4fa18 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -423,8 +423,7 @@ void QWidgetPrivate::raise_sys() Q_Q(QWidget); if (q->isWindow()) { QWindowSurface *surface = q->windowSurface(); - QGraphicsSystemScreen *screen = qt_screenForWidget(q); - screen->raise(surface); + surface->raise(); } } @@ -434,8 +433,7 @@ void QWidgetPrivate::lower_sys() if (q->isWindow()) { Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); QWindowSurface *surface = q->windowSurface(); - QGraphicsSystemScreen *screen = qt_screenForWidget(q); - screen->lower(surface); + surface->lower(); } else if (QWidget *p = q->parentWidget()) { setDirtyOpaqueRegion(); p->d_func()->invalidateBuffer(effectiveRectFor(q->geometry())); diff --git a/src/gui/painting/qgraphicssystem_p.h b/src/gui/painting/qgraphicssystem_p.h index 5b5848e..ddba22d 100644 --- a/src/gui/painting/qgraphicssystem_p.h +++ b/src/gui/painting/qgraphicssystem_p.h @@ -75,9 +75,6 @@ public: virtual QSize physicalSize() const = 0; virtual void setDirty(QRect) { } virtual void pointerEvent(QMouseEvent &) { } - - virtual void raise(QWindowSurface *) { qWarning("This plugin does not support raise()"); } - virtual void lower(QWindowSurface *) { qWarning("This plugin does not support lower()"); } }; #endif // Q_WS_LITE diff --git a/src/gui/painting/qwindowsurface_p.h b/src/gui/painting/qwindowsurface_p.h index 88cc8ba..5e95d80 100644 --- a/src/gui/painting/qwindowsurface_p.h +++ b/src/gui/painting/qwindowsurface_p.h @@ -94,6 +94,9 @@ public: virtual Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); virtual Qt::WindowFlags windowFlags() const; virtual WId winId() const; + + virtual void raise() { qWarning("This plugin does not support raise()"); } + virtual void lower() { qWarning("This plugin does not support lower()"); } #endif bool hasStaticContentsSupport() const; diff --git a/src/plugins/graphicssystems/fb_base/fb_base.cpp b/src/plugins/graphicssystems/fb_base/fb_base.cpp index cb1b478..b992b15 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.cpp +++ b/src/plugins/graphicssystems/fb_base/fb_base.cpp @@ -97,6 +97,11 @@ void QGraphicsSystemFbScreen::removeWindowSurface(QGraphicsSystemFbWindowSurface setDirty(surface->geometry()); } +void QGraphicsSystemFbWindowSurface::raise() +{ + mScreen->raise(this); +} + void QGraphicsSystemFbScreen::raise(QWindowSurface * surface) { QGraphicsSystemFbWindowSurface *s = static_cast(surface); @@ -107,6 +112,11 @@ void QGraphicsSystemFbScreen::raise(QWindowSurface * surface) setDirty(s->geometry()); } +void QGraphicsSystemFbWindowSurface::lower() +{ + mScreen->lower(this); +} + void QGraphicsSystemFbScreen::lower(QWindowSurface * surface) { QGraphicsSystemFbWindowSurface *s = static_cast(surface); diff --git a/src/plugins/graphicssystems/fb_base/fb_base.h b/src/plugins/graphicssystems/fb_base/fb_base.h index bd69443..83c3e06 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.h +++ b/src/plugins/graphicssystems/fb_base/fb_base.h @@ -32,6 +32,10 @@ public: const QImage image() { return mImage; } void setGeometry(const QRect &rect); + + virtual void raise(); + virtual void lower(); + protected: QGraphicsSystemFbScreen *mScreen; QRect oldGeometry; diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp index 9e24f55..be86cb5 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp @@ -578,4 +578,15 @@ WId QTestLiteWindowSurface::winId() const return WId(0); } +void QTestLiteWindowSurface::raise() +{ + WId window = winId(); + XRaiseWindow(mGraphicsSystem->xd->display, window); +} + +void QTestLiteWindowSurface::lower() +{ + WId window = winId(); + XLowerWindow(mGraphicsSystem->xd->display, window); +} QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h index 59db81f..3603e93 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h @@ -79,6 +79,8 @@ public: Qt::WindowFlags windowFlags() const; void setVisible(bool visible); WId winId() const; + void raise(); + void lower(); private: QTestLiteGraphicsSystem *mGraphicsSystem; -- cgit v0.12 From b594232e02bab7f082c78ca354e02b4a7e9842e2 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Tue, 17 Nov 2009 09:07:01 +0100 Subject: remap global mouse event position to the toplevel's coordinates --- src/plugins/graphicssystems/fb_base/fb_base.cpp | 22 +++++++++++++++++++++- src/plugins/graphicssystems/fb_base/fb_base.h | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/plugins/graphicssystems/fb_base/fb_base.cpp b/src/plugins/graphicssystems/fb_base/fb_base.cpp index b992b15..281d0e0 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.cpp +++ b/src/plugins/graphicssystems/fb_base/fb_base.cpp @@ -129,9 +129,29 @@ void QGraphicsSystemFbScreen::lower(QWindowSurface * surface) void QGraphicsSystemFbScreen::pointerEvent(QMouseEvent & me) { - QApplicationPrivate::handleMouseEvent(0, me); + QWidget * widget = topLevelAt(me.pos()); + if (!widget) { + QApplicationPrivate::handleMouseEvent(0, me); + return; + } + QPoint localPosition = me.pos(); + QPoint topLeft = widget->geometry().topLeft(); + localPosition.setX(localPosition.x() - topLeft.x()); + localPosition.setY(localPosition.y() - topLeft.y()); + QMouseEvent e(me.type(), localPosition, me.globalPos(), me.button(), me.buttons(), me.modifiers()); + QApplicationPrivate::handleMouseEvent(widget, e); } +QWidget * QGraphicsSystemFbScreen::topLevelAt(QPoint p) +{ + for(int i = 0; i < windowStack.size(); i++) { + if (windowStack[i]->geometry().contains(p, false)) { + qDebug() << "toplevel at" << p << windowStack[i]->window()->objectName(); + return windowStack[i]->window(); + } + } + return 0; +} QGraphicsSystemFbWindowSurface::QGraphicsSystemFbWindowSurface(QGraphicsSystemFbScreen *screen, QWidget *window) : QWindowSurface(window), diff --git a/src/plugins/graphicssystems/fb_base/fb_base.h b/src/plugins/graphicssystems/fb_base/fb_base.h index 83c3e06..18519ec 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.h +++ b/src/plugins/graphicssystems/fb_base/fb_base.h @@ -66,6 +66,7 @@ public: virtual void addWindowSurface(QGraphicsSystemFbWindowSurface * surface) { windowStack.prepend(surface); } virtual void raise(QWindowSurface * surface); virtual void lower(QWindowSurface * surface); + virtual QWidget * topLevelAt(QPoint p); virtual void pointerEvent(QMouseEvent & me); -- cgit v0.12 From 8a38b9bf663998cfe17e041d3013669e77dffac2 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Tue, 17 Nov 2009 09:12:47 +0100 Subject: Verify that a window is visible before reporting it as the selected toplevel --- src/plugins/graphicssystems/fb_base/fb_base.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/graphicssystems/fb_base/fb_base.cpp b/src/plugins/graphicssystems/fb_base/fb_base.cpp index 281d0e0..5a8daec 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.cpp +++ b/src/plugins/graphicssystems/fb_base/fb_base.cpp @@ -145,7 +145,8 @@ void QGraphicsSystemFbScreen::pointerEvent(QMouseEvent & me) QWidget * QGraphicsSystemFbScreen::topLevelAt(QPoint p) { for(int i = 0; i < windowStack.size(); i++) { - if (windowStack[i]->geometry().contains(p, false)) { + if (windowStack[i]->geometry().contains(p, false) && + windowStack[i]->visible()) { qDebug() << "toplevel at" << p << windowStack[i]->window()->objectName(); return windowStack[i]->window(); } -- cgit v0.12 From 20f7847fce7b41952121367e7889bc58597ca41a Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Tue, 17 Nov 2009 09:48:38 +0100 Subject: remove a qDebug() in topLevelAt() --- src/plugins/graphicssystems/fb_base/fb_base.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/graphicssystems/fb_base/fb_base.cpp b/src/plugins/graphicssystems/fb_base/fb_base.cpp index 5a8daec..7e00381 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.cpp +++ b/src/plugins/graphicssystems/fb_base/fb_base.cpp @@ -147,7 +147,6 @@ QWidget * QGraphicsSystemFbScreen::topLevelAt(QPoint p) for(int i = 0; i < windowStack.size(); i++) { if (windowStack[i]->geometry().contains(p, false) && windowStack[i]->visible()) { - qDebug() << "toplevel at" << p << windowStack[i]->window()->objectName(); return windowStack[i]->window(); } } -- cgit v0.12 From 8fc2eec5b3282665f76f1e0313a03608bf4e7bc1 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Tue, 17 Nov 2009 15:06:10 +0100 Subject: Check if a window is minimized before drawing it, or reporting it via topLevelAt() --- src/plugins/graphicssystems/fb_base/fb_base.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/graphicssystems/fb_base/fb_base.cpp b/src/plugins/graphicssystems/fb_base/fb_base.cpp index 7e00381..a091f73 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.cpp +++ b/src/plugins/graphicssystems/fb_base/fb_base.cpp @@ -69,6 +69,8 @@ QRegion QGraphicsSystemFbScreen::doRedraw() for (int i = windowStack.length() - 1; i >= 0; i--) { if (!windowStack[i]->visible()) continue; + if (windowStack[i]->window()->isMinimized()) + continue; QRect windowRect = windowStack[i]->geometry(); QRect intersect = windowRect.intersected(rect); QRect windowIntersect = intersect.translated(-windowRect.left(), @@ -146,7 +148,8 @@ QWidget * QGraphicsSystemFbScreen::topLevelAt(QPoint p) { for(int i = 0; i < windowStack.size(); i++) { if (windowStack[i]->geometry().contains(p, false) && - windowStack[i]->visible()) { + windowStack[i]->visible() && + !windowStack[i]->window()->isMinimized()) { return windowStack[i]->window(); } } -- cgit v0.12 From c357ab6fbb673f75e9f2ccb2da5d3a938eaadf1f Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Thu, 19 Nov 2009 11:43:20 +0100 Subject: added QGraphicsSystemScreen::topLevelAt(): find the window at a global position This is used to determine which widget to send a pointer event to, and to implement QApplication::widgetAt(). --- src/gui/kernel/qapplication_lite.cpp | 23 +++++++++-------------- src/gui/painting/qgraphicssystem.cpp | 13 +++++++++++++ src/gui/painting/qgraphicssystem_p.h | 1 + src/gui/painting/qgraphicssystemcursor.cpp | 3 +-- src/plugins/graphicssystems/fb_base/fb_base.cpp | 2 +- src/plugins/graphicssystems/fb_base/fb_base.h | 2 +- 6 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 061ac5b..b0f5074 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -56,7 +56,7 @@ #include #include - +#include "private/qgraphicssystem_p.h" #include @@ -354,19 +354,14 @@ void QApplication::restoreOverrideCursor() QWidget *QApplication::topLevelAt(const QPoint &pos) { -//### We have to implement a windowsystem-aware way to do this - - //fallback implementation assuming widgets are in stacking order - - QWidgetList list = topLevelWidgets(); - for (int i = list.size()-1; i >= 0; --i) { - QWidget *w = list[i]; - //### mask is ignored - if (w != QApplication::desktop() && w->isVisible() && w->geometry().contains(pos)) - return w; - } - - return 0; + QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); + if (!gs) + return 0; + QGraphicsSystemScreen *screen = gs->screens().first(); + if (!screen) + return 0; + QWidget *w = screen->topLevelAt(pos); + return w; } void QApplication::beep() diff --git a/src/gui/painting/qgraphicssystem.cpp b/src/gui/painting/qgraphicssystem.cpp index 2071127..948223d 100644 --- a/src/gui/painting/qgraphicssystem.cpp +++ b/src/gui/painting/qgraphicssystem.cpp @@ -85,6 +85,19 @@ QPixmapData *QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixelType typ } #ifdef Q_WS_LITE +QWidget *QGraphicsSystemScreen::topLevelAt(const QPoint & pos) const +{ + QWidgetList list = QApplication::topLevelWidgets(); + for (int i = list.size()-1; i >= 0; --i) { + QWidget *w = list[i]; + //### mask is ignored + if (w != QApplication::desktop() && w->isVisible() && w->geometry().contains(pos)) + return w; + } + + return 0; +} + QList QGraphicsSystem::screens() const { return QList(); diff --git a/src/gui/painting/qgraphicssystem_p.h b/src/gui/painting/qgraphicssystem_p.h index ddba22d..1bfca58 100644 --- a/src/gui/painting/qgraphicssystem_p.h +++ b/src/gui/painting/qgraphicssystem_p.h @@ -75,6 +75,7 @@ public: virtual QSize physicalSize() const = 0; virtual void setDirty(QRect) { } virtual void pointerEvent(QMouseEvent &) { } + virtual QWidget *topLevelAt(const QPoint &point) const; }; #endif // Q_WS_LITE diff --git a/src/gui/painting/qgraphicssystemcursor.cpp b/src/gui/painting/qgraphicssystemcursor.cpp index 08dcbbe..b919d0a 100644 --- a/src/gui/painting/qgraphicssystemcursor.cpp +++ b/src/gui/painting/qgraphicssystemcursor.cpp @@ -57,8 +57,7 @@ QGraphicsSystemCursor::QGraphicsSystemCursor(QGraphicsSystemScreen *scr ) { graphic = new QGraphicsSystemCursorImage(0, 0, 0, 0, 0, 0); instance = this; - QWidget * widget = QApplication::widgetAt(QCursor::pos()); - changeCursor(widget); + setCursor(Qt::ArrowCursor); } QGraphicsSystemCursor::~QGraphicsSystemCursor() diff --git a/src/plugins/graphicssystems/fb_base/fb_base.cpp b/src/plugins/graphicssystems/fb_base/fb_base.cpp index a091f73..d872593 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.cpp +++ b/src/plugins/graphicssystems/fb_base/fb_base.cpp @@ -144,7 +144,7 @@ void QGraphicsSystemFbScreen::pointerEvent(QMouseEvent & me) QApplicationPrivate::handleMouseEvent(widget, e); } -QWidget * QGraphicsSystemFbScreen::topLevelAt(QPoint p) +QWidget * QGraphicsSystemFbScreen::topLevelAt(const QPoint & p) const { for(int i = 0; i < windowStack.size(); i++) { if (windowStack[i]->geometry().contains(p, false) && diff --git a/src/plugins/graphicssystems/fb_base/fb_base.h b/src/plugins/graphicssystems/fb_base/fb_base.h index 18519ec..8c1bb56 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.h +++ b/src/plugins/graphicssystems/fb_base/fb_base.h @@ -66,7 +66,7 @@ public: virtual void addWindowSurface(QGraphicsSystemFbWindowSurface * surface) { windowStack.prepend(surface); } virtual void raise(QWindowSurface * surface); virtual void lower(QWindowSurface * surface); - virtual QWidget * topLevelAt(QPoint p); + virtual QWidget * topLevelAt(const QPoint & p) const; virtual void pointerEvent(QMouseEvent & me); -- cgit v0.12 From 19689dd51a93668fda2273472985114e86a9b8d5 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Thu, 19 Nov 2009 15:15:17 +0100 Subject: Report cursor movement to QApplicationPrivate::handleMouseEvent() directly We had this running through qvnccursor -> QVNCGraphicsSystemScreen -> QApplicationPrivate, but that doesn't work with the generic Linux input plugin. --- src/gui/kernel/qapplication_lite.cpp | 4 ++++ src/gui/painting/qgraphicssystem_p.h | 5 +++-- src/gui/painting/qgraphicssystemcursor.cpp | 5 ++--- src/gui/painting/qgraphicssystemcursor.h | 2 +- src/plugins/graphicssystems/fb_base/fb_base.cpp | 15 --------------- src/plugins/graphicssystems/fb_base/fb_base.h | 2 -- src/plugins/graphicssystems/vnc/qvnccursor.cpp | 6 ++++-- src/plugins/graphicssystems/vnc/qvncserver.cpp | 3 +-- 8 files changed, 15 insertions(+), 27 deletions(-) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index b0f5074..f2be5c7 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -57,6 +57,7 @@ #include #include "private/qgraphicssystem_p.h" +#include "qgraphicssystemcursor.h" #include @@ -525,6 +526,9 @@ void QApplicationPrivate::handleMouseEvent(QWidget *tlw, const QMouseEvent &ev) static QWidget *implicit_mouse_grabber=0; + if (QGraphicsSystemCursor::instance) + QGraphicsSystemCursor::instance->pointerEvent(ev); + QPoint localPoint = ev.pos(); QPoint globalPoint = ev.globalPos(); QWidget *mouseWindow = tlw; diff --git a/src/gui/painting/qgraphicssystem_p.h b/src/gui/painting/qgraphicssystem_p.h index 1bfca58..0b0dfb5 100644 --- a/src/gui/painting/qgraphicssystem_p.h +++ b/src/gui/painting/qgraphicssystem_p.h @@ -56,6 +56,8 @@ #include "private/qpixmapdata_p.h" #include "private/qwindowsurface_p.h" +#include + QT_BEGIN_NAMESPACE class QPixmapFilter; @@ -73,8 +75,7 @@ public: virtual int depth() const = 0; virtual QImage::Format format() const = 0; virtual QSize physicalSize() const = 0; - virtual void setDirty(QRect) { } - virtual void pointerEvent(QMouseEvent &) { } + virtual void setDirty(const QRect &) {} virtual QWidget *topLevelAt(const QPoint &point) const; }; #endif // Q_WS_LITE diff --git a/src/gui/painting/qgraphicssystemcursor.cpp b/src/gui/painting/qgraphicssystemcursor.cpp index b919d0a..6aef76c 100644 --- a/src/gui/painting/qgraphicssystemcursor.cpp +++ b/src/gui/painting/qgraphicssystemcursor.cpp @@ -94,13 +94,12 @@ QRect QGraphicsSystemCursor::drawCursor(QPainter & painter) return prevRect; } -void QGraphicsSystemCursor::pointerEvent(QMouseEvent & e) +void QGraphicsSystemCursor::pointerEvent(const QMouseEvent & e) { currentRect = graphic->image()->rect().translated(-graphic->hotspot().x(), -graphic->hotspot().y()); currentRect.translate(e.pos()); - - screen->pointerEvent(e); + screen->setDirty(QRect(QRect(e.pos(), QSize(1, 1)))); } void QGraphicsSystemCursor::changeCursor(QCursor * widgetCursor) diff --git a/src/gui/painting/qgraphicssystemcursor.h b/src/gui/painting/qgraphicssystemcursor.h index eab7203..de7ce84 100644 --- a/src/gui/painting/qgraphicssystemcursor.h +++ b/src/gui/painting/qgraphicssystemcursor.h @@ -73,7 +73,7 @@ public: // input methods virtual void setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); virtual void setCursor(Qt::CursorShape shape); - virtual void pointerEvent(QMouseEvent & event); + virtual void pointerEvent(const QMouseEvent & event); virtual void changeCursor(QWidget * widget); virtual void changeCursor(QCursor * widgetCursor); diff --git a/src/plugins/graphicssystems/fb_base/fb_base.cpp b/src/plugins/graphicssystems/fb_base/fb_base.cpp index d872593..6ecfd1b 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.cpp +++ b/src/plugins/graphicssystems/fb_base/fb_base.cpp @@ -129,21 +129,6 @@ void QGraphicsSystemFbScreen::lower(QWindowSurface * surface) setDirty(s->geometry()); } -void QGraphicsSystemFbScreen::pointerEvent(QMouseEvent & me) -{ - QWidget * widget = topLevelAt(me.pos()); - if (!widget) { - QApplicationPrivate::handleMouseEvent(0, me); - return; - } - QPoint localPosition = me.pos(); - QPoint topLeft = widget->geometry().topLeft(); - localPosition.setX(localPosition.x() - topLeft.x()); - localPosition.setY(localPosition.y() - topLeft.y()); - QMouseEvent e(me.type(), localPosition, me.globalPos(), me.button(), me.buttons(), me.modifiers()); - QApplicationPrivate::handleMouseEvent(widget, e); -} - QWidget * QGraphicsSystemFbScreen::topLevelAt(const QPoint & p) const { for(int i = 0; i < windowStack.size(); i++) { diff --git a/src/plugins/graphicssystems/fb_base/fb_base.h b/src/plugins/graphicssystems/fb_base/fb_base.h index 8c1bb56..8e54f47 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.h +++ b/src/plugins/graphicssystems/fb_base/fb_base.h @@ -68,8 +68,6 @@ public: virtual void lower(QWindowSurface * surface); virtual QWidget * topLevelAt(const QPoint & p) const; - virtual void pointerEvent(QMouseEvent & me); - QImage * image() const { return mScreenImage; } QPaintDevice * paintDevice() const { return mScreenImage; } diff --git a/src/plugins/graphicssystems/vnc/qvnccursor.cpp b/src/plugins/graphicssystems/vnc/qvnccursor.cpp index 80ab750..a0107b5 100644 --- a/src/plugins/graphicssystems/vnc/qvnccursor.cpp +++ b/src/plugins/graphicssystems/vnc/qvnccursor.cpp @@ -60,8 +60,6 @@ QVNCCursor::QVNCCursor(QVNCServer * srvr, QVNCGraphicsSystemScreen *scr ) void QVNCCursor::setCursorMode(bool vnc) { -// if (vnc == useVncCursor) -// return; if (vnc) { screen->setDirty(prevRect); prevRect = QRect(); @@ -77,6 +75,8 @@ void QVNCCursor::setCursor(Qt::CursorShape shape) QGraphicsSystemCursor::setCursor(shape); if (useVncCursor) { server->setDirtyCursor(); + } else { + screen->setDirty(QRect(QRect(0,0,1,1)); } } @@ -85,6 +85,8 @@ void QVNCCursor::setCursor(const uchar *data, const uchar *mask, int width, int QGraphicsSystemCursor::setCursor(data, mask, width, height, hotX, hotY); if (useVncCursor) { server->setDirtyCursor(); + } else { + screen->setDirty(QRect(0,0,1,1)); } } diff --git a/src/plugins/graphicssystems/vnc/qvncserver.cpp b/src/plugins/graphicssystems/vnc/qvncserver.cpp index ef6b4a1..fcff255 100644 --- a/src/plugins/graphicssystems/vnc/qvncserver.cpp +++ b/src/plugins/graphicssystems/vnc/qvncserver.cpp @@ -835,8 +835,7 @@ void QVNCServer::pointerEvent() if (buttonChange(buttons, ev.buttons, &button, &isPress)) type = isPress ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; QMouseEvent me(type, QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), button, ev.buttons, keymod); - if(cursor) - cursor->pointerEvent(me); + QApplicationPrivate::handleMouseEvent(0, me); buttons = ev.buttons; handleMsg = false; } -- cgit v0.12 From 869c9dad8f4c42db47c448a4c644dc2e54c60c2b Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Thu, 19 Nov 2009 15:23:03 +0100 Subject: Add a cursor to linuxfb --- src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp index 291b118..2a0007b 100644 --- a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp +++ b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp @@ -807,6 +807,7 @@ QLinuxFbGraphicsSystemScreen::QLinuxFbGraphicsSystemScreen(uchar * d, int w, mFormat); mFbScreenImage = new QImage(data, mGeometry.width(), mGeometry.height(), bytesPerLine, mFormat); + cursor = new QGraphicsSystemCursor(this); } void QLinuxFbGraphicsSystemScreen::setGeometry(QRect rect) -- cgit v0.12 From e105e78d81b3696044af693ed65f88034c3e92da Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 19 Nov 2009 17:06:13 +0100 Subject: Compile --- src/gui/painting/qgraphicssystem.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/painting/qgraphicssystem.cpp b/src/gui/painting/qgraphicssystem.cpp index 948223d..f9382ec 100644 --- a/src/gui/painting/qgraphicssystem.cpp +++ b/src/gui/painting/qgraphicssystem.cpp @@ -52,6 +52,8 @@ #endif #ifdef Q_WS_LITE # include +# include +# include #endif #ifdef Q_WS_S60 # include -- cgit v0.12 From 4485749550e99b71ba14a2baaef492f1da3c0478 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Thu, 19 Nov 2009 18:00:25 +0100 Subject: missing ) in QVNCCursor::setCursor --- src/plugins/graphicssystems/vnc/qvnccursor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/graphicssystems/vnc/qvnccursor.cpp b/src/plugins/graphicssystems/vnc/qvnccursor.cpp index a0107b5..aa0f109 100644 --- a/src/plugins/graphicssystems/vnc/qvnccursor.cpp +++ b/src/plugins/graphicssystems/vnc/qvnccursor.cpp @@ -76,7 +76,7 @@ void QVNCCursor::setCursor(Qt::CursorShape shape) if (useVncCursor) { server->setDirtyCursor(); } else { - screen->setDirty(QRect(QRect(0,0,1,1)); + screen->setDirty(QRect(QRect(0,0,1,1))); } } -- cgit v0.12 From cd4c5e2af80e5161b301a9798686220eb4731be6 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Mon, 23 Nov 2009 15:14:38 +0100 Subject: enable enter/leave event dispatching where the entered widget is null With framebuffer backends (vnc, linuxfb), there can be screen coordinates where no toplevel exists. dispatchEnterLeave() still needs to be called to allow the cursor to be reset when leaving a widget that sets a cursor. --- src/gui/kernel/qapplication.cpp | 6 +++++- src/gui/kernel/qapplication_lite.cpp | 2 +- src/gui/kernel/qwidget_lite.cpp | 17 +++++++++++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index bbf7b40..bb90285 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -2660,7 +2660,11 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) { #if defined(Q_WS_X11) qt_x11_enforce_cursor(parentOfLeavingCursor,true); #elif defined(Q_WS_LITE) - qt_lite_set_cursor(parentOfLeavingCursor, true); + if (enter == QApplication::desktop()) { + qt_lite_set_cursor(enter, true); + } else { + qt_lite_set_cursor(parentOfLeavingCursor, true); + } #endif } } diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index f2be5c7..cdaa855 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -558,7 +558,7 @@ void QApplicationPrivate::handleMouseEvent(QWidget *tlw, const QMouseEvent &ev) } if (!mouseWindow && !implicit_mouse_grabber) - return; //nowhere to send it + mouseWindow = QApplication::desktop(); if (mouseWindow && mouseWindow != tlw) { //we did not get a sensible localPoint from the window system, so let's calculate it diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index cd4fa18..88df81f 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -669,8 +669,13 @@ void QWidgetPrivate::setModal_sys() void qt_lite_set_cursor(QWidget * w, bool force) { static QPointer lastUnderMouse = 0; - if (w == 0) { // override cursor stack emptied - QCursor * override = QApplication::overrideCursor(); + + QCursor * override = QApplication::overrideCursor(); + + if (override && w != 0) + return; + + if (w == 0) { if (override) { if (QGraphicsSystemCursor::instance) { QGraphicsSystemCursor::instance->changeCursor(override); @@ -678,6 +683,8 @@ void qt_lite_set_cursor(QWidget * w, bool force) return; } w = QApplication::widgetAt(QCursor::pos()); + if (w == 0) // clear the override cursor while over empty space + w = QApplication::desktop(); } else if (force) { lastUnderMouse = w; } else if (w->testAttribute(Qt::WA_WState_Created) && lastUnderMouse @@ -685,6 +692,12 @@ void qt_lite_set_cursor(QWidget * w, bool force) w = lastUnderMouse; } + if (w == QApplication::desktop()) { + if (QGraphicsSystemCursor::instance) { + QGraphicsSystemCursor::instance->changeCursor(w); + } + } + QWidget * curWin = QApplication::activeWindow(); if (!curWin && w && w->internalWinId()) return; -- cgit v0.12 From 52df0e48813c97e27644fb6052c541af39a8dc92 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Tue, 24 Nov 2009 11:03:33 +0100 Subject: mark the screen dirty after a cursor change --- src/gui/painting/qgraphicssystemcursor.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/painting/qgraphicssystemcursor.cpp b/src/gui/painting/qgraphicssystemcursor.cpp index 6aef76c..300c719 100644 --- a/src/gui/painting/qgraphicssystemcursor.cpp +++ b/src/gui/painting/qgraphicssystemcursor.cpp @@ -116,6 +116,7 @@ void QGraphicsSystemCursor::changeCursor(QCursor * widgetCursor) // system cursor setCursor(shape); } + screen->setDirty(currentRect); } void QGraphicsSystemCursor::changeCursor(QWidget * widget) @@ -126,6 +127,7 @@ void QGraphicsSystemCursor::changeCursor(QWidget * widget) } else { // default cursor setCursor(Qt::ArrowCursor); + screen->setDirty(currentRect); } } -- cgit v0.12 From 4750df7a21748416541c88572ff46f83861745fd Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Tue, 24 Nov 2009 11:35:04 +0100 Subject: recalculate the cursor's current QRect when changing the cursor graphic --- src/gui/painting/qgraphicssystemcursor.cpp | 16 ++++++++++++---- src/gui/painting/qgraphicssystemcursor.h | 3 +++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qgraphicssystemcursor.cpp b/src/gui/painting/qgraphicssystemcursor.cpp index 300c719..cad914d 100644 --- a/src/gui/painting/qgraphicssystemcursor.cpp +++ b/src/gui/painting/qgraphicssystemcursor.cpp @@ -94,12 +94,18 @@ QRect QGraphicsSystemCursor::drawCursor(QPainter & painter) return prevRect; } +QRect QGraphicsSystemCursor::getCurrentRect() +{ + QRect rect = graphic->image()->rect().translated(-graphic->hotspot().x(), + -graphic->hotspot().y()); + rect.translate(QCursor::pos()); + return rect; +} + void QGraphicsSystemCursor::pointerEvent(const QMouseEvent & e) { - currentRect = graphic->image()->rect().translated(-graphic->hotspot().x(), - -graphic->hotspot().y()); - currentRect.translate(e.pos()); - screen->setDirty(QRect(QRect(e.pos(), QSize(1, 1)))); + currentRect = getCurrentRect(); + screen->setDirty(currentRect); } void QGraphicsSystemCursor::changeCursor(QCursor * widgetCursor) @@ -116,6 +122,7 @@ void QGraphicsSystemCursor::changeCursor(QCursor * widgetCursor) // system cursor setCursor(shape); } + currentRect = getCurrentRect(); screen->setDirty(currentRect); } @@ -127,6 +134,7 @@ void QGraphicsSystemCursor::changeCursor(QWidget * widget) } else { // default cursor setCursor(Qt::ArrowCursor); + currentRect = getCurrentRect(); screen->setDirty(currentRect); } } diff --git a/src/gui/painting/qgraphicssystemcursor.h b/src/gui/painting/qgraphicssystemcursor.h index de7ce84..ea30319 100644 --- a/src/gui/painting/qgraphicssystemcursor.h +++ b/src/gui/painting/qgraphicssystemcursor.h @@ -92,6 +92,9 @@ protected: QWidget * currentWidget; // widget currently under the cursor QGraphicsSystemCursorImage * graphic; + +private: + QRect getCurrentRect(); }; QT_END_NAMESPACE -- cgit v0.12 From efa0d024fc262b89189c0589a0ee81fe083635b1 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 24 Nov 2009 13:57:27 +0100 Subject: Cursor shapes for the testlite backend --- .../testlite/qgraphicssystem_testlite.cpp | 55 +++++++++++++ .../testlite/qwindowsurface_testlite.cpp | 6 ++ .../testlite/qwindowsurface_testlite.h | 2 + src/plugins/graphicssystems/testlite/x11util.cpp | 93 +++++++++++++++++++++- src/plugins/graphicssystems/testlite/x11util.h | 1 + 5 files changed, 155 insertions(+), 2 deletions(-) diff --git a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp index 9991e75..64386b7 100644 --- a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp @@ -44,12 +44,62 @@ #include #include +#include + + #include "x11util.h" QT_BEGIN_NAMESPACE +class MyCursor : QGraphicsSystemCursor +{ +public: + MyCursor(QGraphicsSystemScreen *screen) : QGraphicsSystemCursor(screen) {} + + // input methods + void setCursor(const uchar */*data*/, const uchar */*mask*/, int width, int height, int hotX, int hotY) {qDebug() << "setCursor data..." << width << height << hotX << hotY;} + + void setCursor(Qt::CursorShape shape) { + static int oldshape = -1; + if (shape != oldshape) { + qDebug() << "setCursor" << shape; QGraphicsSystemCursor::setCursor(shape); + oldshape = shape; + } + } + + void changeCursor(QWidget * widget) { + + QTestLiteWindowSurface *ws = 0; + if (widget) { + QWidget *window = widget->window(); + ws = static_cast(window->windowSurface()); + } + + //qDebug() << "changeCursor" << widget << ws; + if (!ws) + return; + + ws->setCursor(widget->cursor().shape()); + } + +// void changeCursor(QCursor * widgetCursor) { +// //qDebug() << "changeCursor widgetCursor"; +// QGraphicsSystemCursor::changeCursor(widgetCursor); +// } + + //#### remove this + void pointerEvent(const QMouseEvent & event) { + Q_UNUSED(event); +#if 0 + qDebug() << "pointerEvent" << event.globalPos(); +#endif + } +}; + + QTestLiteGraphicsSystem::QTestLiteGraphicsSystem() { + xd = new MyDisplay; mPrimaryScreen = new QTestLiteGraphicsSystemScreen(); @@ -62,6 +112,10 @@ QTestLiteGraphicsSystem::QTestLiteGraphicsSystem() QSize(xd->physicalWidth, xd->physicalHeight); mScreens.append(mPrimaryScreen); + + + (void)new MyCursor(mPrimaryScreen); + } QPixmapData *QTestLiteGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const @@ -85,4 +139,5 @@ QPixmap QTestLiteGraphicsSystem::grabWindow(WId window, int x, int y, int width, } + QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp index be86cb5..495b572 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp @@ -589,4 +589,10 @@ void QTestLiteWindowSurface::lower() WId window = winId(); XLowerWindow(mGraphicsSystem->xd->display, window); } + + +void QTestLiteWindowSurface::setCursor(Qt::CursorShape shape) +{ + xw->setCursorShape(shape); +} QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h index 3603e93..cedd66c 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h @@ -82,6 +82,8 @@ public: void raise(); void lower(); + void setCursor(Qt::CursorShape shape); + private: QTestLiteGraphicsSystem *mGraphicsSystem; QTestLiteGraphicsSystemScreen *mScreen; diff --git a/src/plugins/graphicssystems/testlite/x11util.cpp b/src/plugins/graphicssystems/testlite/x11util.cpp index 0c6f3c5..5830550 100644 --- a/src/plugins/graphicssystems/testlite/x11util.cpp +++ b/src/plugins/graphicssystems/testlite/x11util.cpp @@ -55,6 +55,7 @@ #include +#include //### remove stuff we don't want from qt_x11_p.h @@ -480,7 +481,7 @@ void MyWindow::setGeometry(int x, int y, int w, int h) } -void MyWindow::enterEvent(XCrossingEvent *e) +void MyWindow::enterEvent(XCrossingEvent *) { #ifdef MYX11_DEBUG qDebug() << "MyWindow::enterEvent" << hex << window; @@ -488,7 +489,7 @@ void MyWindow::enterEvent(XCrossingEvent *e) windowSurface->handleEnterEvent(); } -void MyWindow::leaveEvent(XCrossingEvent *e) +void MyWindow::leaveEvent(XCrossingEvent *) { #ifdef MYX11_DEBUG qDebug() << "MyWindow::enterEvent" << hex << window; @@ -782,3 +783,91 @@ void MyWindow::setVisible(bool visible) else XUnmapWindow(xd->display, window); } + + +void MyWindow::setCursorShape(int cshape) +{ + if (cshape < 0 || cshape > Qt::LastCursor) + return; + + static Cursor cursors[Qt::LastCursor+1] = {XNone}; + + Cursor cursor = cursors[cshape]; + if (!cursor) { + switch (cshape) { + case Qt::ArrowCursor: + cursor = XCreateFontCursor(xd->display, XC_left_ptr); + break; + case Qt::UpArrowCursor: + cursor = XCreateFontCursor(xd->display, XC_center_ptr); + break; + case Qt::CrossCursor: + cursor = XCreateFontCursor(xd->display, XC_crosshair); + break; + case Qt::WaitCursor: + cursor = XCreateFontCursor(xd->display, XC_watch); + break; + case Qt::IBeamCursor: + cursor = XCreateFontCursor(xd->display, XC_xterm); + break; + case Qt::SizeAllCursor: + cursor = XCreateFontCursor(xd->display, XC_fleur); + break; + case Qt::PointingHandCursor: + cursor = XCreateFontCursor(xd->display, XC_hand2); + break; + case Qt::SizeBDiagCursor: + cursor = XCreateFontCursor(xd->display, XC_top_right_corner); + break; + case Qt::SizeFDiagCursor: + cursor = XCreateFontCursor(xd->display, XC_bottom_right_corner); + break; + case Qt::SizeVerCursor: + case Qt::SplitVCursor: + cursor = XCreateFontCursor(xd->display, XC_sb_v_double_arrow); + break; + case Qt::SizeHorCursor: + case Qt::SplitHCursor: + cursor = XCreateFontCursor(xd->display, XC_sb_h_double_arrow); + break; + case Qt::WhatsThisCursor: + cursor = XCreateFontCursor(xd->display, XC_question_arrow); + break; + case Qt::ForbiddenCursor: + cursor = XCreateFontCursor(xd->display, XC_circle); + break; + case Qt::BusyCursor: + cursor = XCreateFontCursor(xd->display, XC_watch); + break; + + default: //default cursor for all the rest + break; + } + cursors[cshape] = cursor; + } + XDefineCursor(xd->display, window, cursor); +} + + +#if 0 + + + switch (cshape) { // map Q cursor to X cursor + case Qt::BlankCursor: + XColor bg, fg; + bg.red = 255 << 8; + bg.green = 255 << 8; + bg.blue = 255 << 8; + fg.red = 0; + fg.green = 0; + fg.blue = 0; + pm = XCreateBitmapFromData(dpy, rootwin, cur_blank_bits, 16, 16); + pmm = XCreateBitmapFromData(dpy, rootwin, cur_blank_bits, 16, 16); + hcurs = XCreatePixmapCursor(dpy, pm, pmm, &fg, &bg, 8, 8); + return; + break; + default: + qWarning("QCursor::update: Invalid cursor shape %d", cshape); + return; + } +#endif diff --git a/src/plugins/graphicssystems/testlite/x11util.h b/src/plugins/graphicssystems/testlite/x11util.h index 39fc331..e9d4c7b 100644 --- a/src/plugins/graphicssystems/testlite/x11util.h +++ b/src/plugins/graphicssystems/testlite/x11util.h @@ -109,6 +109,7 @@ public: Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); void setVisible(bool visible); + void setCursorShape(int cshape); public: //### -- cgit v0.12 From 7dea84cd015538dc327e489113919d75c8e275bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 16 Nov 2009 11:33:26 +0100 Subject: Added QBlittablePixmapData Is going to be used by everyone that reimplements QBlittable --- src/gui/image/image.pri | 2 + src/gui/image/qimage.h | 1 + src/gui/image/qpixmap_blitter.cpp | 65 +++++++++++++++++++++++++++++++ src/gui/image/qpixmap_blitter_p.h | 60 ++++++++++++++++++++++++++++ src/gui/image/qpixmapdata_p.h | 2 +- src/gui/painting/qgraphicssystem_p.h | 2 + src/gui/painting/qpaintengine_blitter.cpp | 31 ++++++++------- src/gui/painting/qpaintengine_blitter_p.h | 9 ++--- 8 files changed, 152 insertions(+), 20 deletions(-) create mode 100644 src/gui/image/qpixmap_blitter.cpp create mode 100644 src/gui/image/qpixmap_blitter_p.h diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index 634c3f3..b232848 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -23,6 +23,7 @@ HEADERS += \ image/qpictureformatplugin.h \ image/qpixmap.h \ image/qpixmap_raster_p.h \ + miage/qpixmap_blitter_p.h \ image/qpixmapcache.h \ image/qpixmapcache_p.h \ image/qpixmapdata_p.h \ @@ -51,6 +52,7 @@ SOURCES += \ image/qiconengineplugin.cpp \ image/qmovie.cpp \ image/qpixmap_raster.cpp \ + image/qpixmap_blitter.cpp \ image/qnativeimage.cpp \ image/qimagepixmapcleanuphooks.cpp \ diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index d8809ef..f5c22bc 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -317,6 +317,7 @@ private: QImageData *d; friend class QRasterPixmapData; + friend class QBlittablePixmapData; friend class QPixmapCacheEntry; friend Q_GUI_EXPORT qint64 qt_image_id(const QImage &image); friend const QVector *qt_image_colortable(const QImage &image); diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp new file mode 100644 index 0000000..9730ecc --- /dev/null +++ b/src/gui/image/qpixmap_blitter.cpp @@ -0,0 +1,65 @@ +#include "qpixmap_blitter_p.h" + +#include +#include + +QBlittablePixmapData::QBlittablePixmapData(PixelType type) + : QPixmapData(type,BlitterClass), m_blittable(0), m_engine(0) +{ +} + +QBlittablePixmapData::~QBlittablePixmapData() +{ +} + +void QBlittablePixmapData::resize(int width, int height) +{ + delete m_blittable; + m_blittable = QApplicationPrivate::graphicsSystem()->createBlittable(QRect(0,0,width,height)); + m_engine = 0; +} + +int QBlittablePixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const +{ + QImage *image = m_blittable->lock(); + return image->metric(metric); +} + +void QBlittablePixmapData::fill(const QColor &color) +{ + if (m_blittable->capabilities() & QBlittable::SolidRectCapability) + m_blittable->fillRect(m_blittable->rect(),color); + else + m_blittable->lock()->fill(color.rgb()); +} + +QImage *QBlittablePixmapData::buffer() +{ + return m_blittable->lock(); +} + +QImage QBlittablePixmapData::toImage() +{ + return m_blittable->lock()->copy(); +} + +bool QBlittablePixmapData::hasAlphaChannel() +{ + return m_blittable->lock()->hasAlphaChannel(); +} + +void QBlittablePixmapData::fromImage(const QImage &image, + Qt::ImageConversionFlags flags) +{ + m_blittable = new QImageBlitter(image); + m_engine = 0; +} + +QPaintEngine *QBlittablePixmapData::paintEngine() const +{ + if (!m_engine) { + QBlittablePixmapData *that = const_cast(this); + that->m_engine = new QBlitterPaintEngine(that); + } + return m_engine; +} diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h new file mode 100644 index 0000000..5e93ef4 --- /dev/null +++ b/src/gui/image/qpixmap_blitter_p.h @@ -0,0 +1,60 @@ +#ifndef QPIXMAP_BLITTER_P_H +#define QPIXMAP_BLITTER_P_H + +#include +#include + +class QImageBlitter : public QBlittable +{ +public: + QImageBlitter(const QImage &img) + : QBlittable(img.rect(),0), image(img) + { + } + + void fillRect(const QRectF &, const QColor &) + { + //should never be called + } + void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) + { + //should never be called + } + + QImage *lock() + { + return ℑ + } + + void unlock() + { + } + +private: + QImage image; +}; + +class QBlittablePixmapData : public QPixmapData +{ +public: + QBlittablePixmapData(PixelType type); + ~QBlittablePixmapData(); + + QBlittable *blittable() const { return m_blittable; } + + void resize(int width, int height); + int metric(QPaintDevice::PaintDeviceMetric metric) const; + void fill(const QColor &color); + QImage *buffer(); + QImage toImage(); + bool hasAlphaChannel(); + void fromImage(const QImage &image, Qt::ImageConversionFlags flags); + + QPaintEngine *paintEngine() const; + +protected: + QBlitterPaintEngine *m_engine; + QBlittable *m_blittable; +}; + +#endif // QPIXMAP_BLITTER_P_H diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h index 41e2923..292092f 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qpixmapdata_p.h @@ -73,7 +73,7 @@ public: }; #endif enum ClassId { RasterClass, X11Class, MacClass, DirectFBClass, - OpenGLClass, OpenVGClass, CustomClass = 1024 }; + OpenGLClass, OpenVGClass, BlitterClass, CustomClass = 1024 }; QPixmapData(PixelType pixelType, int classId); virtual ~QPixmapData(); diff --git a/src/gui/painting/qgraphicssystem_p.h b/src/gui/painting/qgraphicssystem_p.h index 0b0dfb5..275afc0 100644 --- a/src/gui/painting/qgraphicssystem_p.h +++ b/src/gui/painting/qgraphicssystem_p.h @@ -55,6 +55,7 @@ #include "private/qpixmapdata_p.h" #include "private/qwindowsurface_p.h" +#include "private/qpaintengine_blitter_p.h" #include @@ -85,6 +86,7 @@ class Q_GUI_EXPORT QGraphicsSystem public: virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0; virtual QWindowSurface *createWindowSurface(QWidget *widget) const = 0; + virtual QBlittable *createBlittable(const QRect &rect) { return 0; } virtual ~QGraphicsSystem() = 0; diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index 367a8b5..b134d84 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -147,9 +147,9 @@ public: class QBlitterPaintEnginePrivate : public QPaintEngineExPrivate { public: - QBlitterPaintEnginePrivate(QPaintDevice *p) - : QPaintEngineExPrivate(), - raster(new QRasterPaintEngine(p)), isBlitterLocked(false), + QBlitterPaintEnginePrivate(QPixmapData *p) + : QPaintEngineExPrivate(), pixmap(p), + raster(new QRasterPaintEngine(&pixmap)), isBlitterLocked(false), capabillities(0), hasXForm(false) { if (QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem()) { @@ -235,6 +235,7 @@ public: raster->d_func()->systemStateChanged(); } + QPixmap pixmap; QRasterPaintEngine *raster; QRasterPaintEngineState *state; @@ -246,7 +247,7 @@ public: uint hasXForm; }; -QBlitterPaintEngine::QBlitterPaintEngine(QPaintDevice *p) +QBlitterPaintEngine::QBlitterPaintEngine(QPixmapData *p) : QPaintEngineEx(*(new QBlitterPaintEnginePrivate(p))) { } @@ -607,23 +608,19 @@ void QBlitterPaintEngine::setState(QPainterState *s) class QBlittablePrivate { public: + QBlittablePrivate(const QRect &rect, QBlittable::Capabilities caps) + : m_rect(rect), caps(caps) + {} QBlittable::Capabilities caps; + QRect m_rect; }; -QBlittable::QBlittable(Capabilities caps) - : d_ptr(new QBlittablePrivate) +QBlittable::QBlittable(const QRect &rect, Capabilities caps) + : d_ptr(new QBlittablePrivate(rect,caps)) { - d_ptr->caps = caps; } -QBlittable::QBlittable(QBlittablePrivate &d, Capabilities caps) - : d_ptr(&d) -{ - d_ptr->caps = caps; -} - - QBlittable::~QBlittable() { delete d_ptr; @@ -636,3 +633,9 @@ QBlittable::Capabilities QBlittable::capabilities() const return d->caps; } +QRect QBlittable::rect() const +{ + Q_D(const QBlittable); + return d->m_rect; +} + diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h index 90493a4..16b7b2c 100644 --- a/src/gui/painting/qpaintengine_blitter_p.h +++ b/src/gui/painting/qpaintengine_blitter_p.h @@ -22,12 +22,13 @@ public: // Internal ones OutlineCapability = 0x0001000, }; - Q_DECLARE_FLAGS(Capabilities, Capability); + Q_DECLARE_FLAGS (Capabilities, Capability); - QBlittable(Capabilities caps); + QBlittable(const QRect &rect, Capabilities caps); virtual ~QBlittable(); Capabilities capabilities() const; + QRect rect() const; virtual void fillRect(const QRectF &rect, const QColor &color) = 0; virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect) = 0; @@ -37,8 +38,6 @@ public: protected: QBlittablePrivate *d_ptr; - - QBlittable(QBlittablePrivate &d, Capabilities caps); }; @@ -46,7 +45,7 @@ class Q_GUI_EXPORT QBlitterPaintEngine : public QPaintEngineEx { Q_DECLARE_PRIVATE(QBlitterPaintEngine); public: - QBlitterPaintEngine(QPaintDevice *p); + QBlitterPaintEngine(QPixmapData *p); ~QBlitterPaintEngine(); virtual QPainterState *createState(QPainterState *orig) const; -- cgit v0.12 From e6d223f9989ebe9805ddda007c9372143f9f1db6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 20 Nov 2009 09:44:56 +0100 Subject: Made the blitter api work in lighthouse --- src/gui/image/qpixmap_blitter.cpp | 61 ++++++++++++-- src/gui/image/qpixmap_blitter_p.h | 11 +-- src/gui/image/qpixmapdata_p.h | 1 + src/gui/painting/qgraphicssystem_p.h | 2 +- src/gui/painting/qpaintengine_blitter.cpp | 51 ++++++------ src/gui/painting/qpaintengine_blitter_p.h | 3 +- src/gui/painting/qpaintengine_raster.cpp | 4 +- .../graphicssystems/minimaldfb/minimaldfb.pro | 8 +- .../minimaldfb/qblitter_directfb.cpp | 94 ++++++++++++++++++++++ .../graphicssystems/minimaldfb/qblitter_directfb.h | 24 ++++++ .../minimaldfb/qgraphicssystem_minimaldfb.cpp | 65 ++++++++++----- .../minimaldfb/qgraphicssystem_minimaldfb.h | 4 +- .../minimaldfb/qwindowsurface_minimaldfb.cpp | 55 +++++-------- .../minimaldfb/qwindowsurface_minimaldfb.h | 5 +- 14 files changed, 287 insertions(+), 101 deletions(-) create mode 100644 src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp create mode 100644 src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index 9730ecc..5ecc01d 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -3,8 +3,8 @@ #include #include -QBlittablePixmapData::QBlittablePixmapData(PixelType type) - : QPixmapData(type,BlitterClass), m_blittable(0), m_engine(0) +QBlittablePixmapData::QBlittablePixmapData(QPixmapData::PixelType type) + : QPixmapData(type,BlitterClass), m_engine(0), m_blittable(0) { } @@ -12,17 +12,62 @@ QBlittablePixmapData::~QBlittablePixmapData() { } +QBlittable *QBlittablePixmapData::blittable() +{ + if (!m_blittable) { + m_blittable = QApplicationPrivate::graphicsSystem()->createBlittable(QRect(0,0,w,h)); + } + + return m_blittable; +} + +void QBlittablePixmapData::setBlittable(QBlittable *blittable) +{ + if (m_blittable) + delete m_blittable; + m_blittable = blittable; +} + void QBlittablePixmapData::resize(int width, int height) { delete m_blittable; - m_blittable = QApplicationPrivate::graphicsSystem()->createBlittable(QRect(0,0,width,height)); + m_blittable = 0; + delete m_engine; m_engine = 0; + d = 32; + w = width; + h = height; +// d = image.depth(); + is_null = (w <= 0 || h <= 0); } +extern int qt_defaultDpiX(); +extern int qt_defaultDpiY(); int QBlittablePixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const { - QImage *image = m_blittable->lock(); - return image->metric(metric); + switch (metric) { + case QPaintDevice::PdmWidth: + return w; + case QPaintDevice::PdmHeight: + return h; + case QPaintDevice::PdmWidthMM: + return qRound(w * 25.4 / qt_defaultDpiX()); + case QPaintDevice::PdmHeightMM: + return qRound(h * 25.4 / qt_defaultDpiY()); + case QPaintDevice::PdmDepth: + return 32; + case QPaintDevice::PdmDpiX: // fall-through + case QPaintDevice::PdmPhysicalDpiX: + return qt_defaultDpiX(); + case QPaintDevice::PdmDpiY: // fall-through + case QPaintDevice::PdmPhysicalDpiY: + return qt_defaultDpiY(); + default: + qWarning("QRasterPixmapData::metric(): Unhandled metric type %d", metric); + break; + } + + return 0; } void QBlittablePixmapData::fill(const QColor &color) @@ -38,18 +83,18 @@ QImage *QBlittablePixmapData::buffer() return m_blittable->lock(); } -QImage QBlittablePixmapData::toImage() +QImage QBlittablePixmapData::toImage() const { return m_blittable->lock()->copy(); } -bool QBlittablePixmapData::hasAlphaChannel() +bool QBlittablePixmapData::hasAlphaChannel() const { return m_blittable->lock()->hasAlphaChannel(); } void QBlittablePixmapData::fromImage(const QImage &image, - Qt::ImageConversionFlags flags) + Qt::ImageConversionFlags) { m_blittable = new QImageBlitter(image); m_engine = 0; diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h index 5e93ef4..3ed2fe4 100644 --- a/src/gui/image/qpixmap_blitter_p.h +++ b/src/gui/image/qpixmap_blitter_p.h @@ -34,20 +34,21 @@ private: QImage image; }; -class QBlittablePixmapData : public QPixmapData +class Q_GUI_EXPORT QBlittablePixmapData : public QPixmapData { public: - QBlittablePixmapData(PixelType type); + QBlittablePixmapData(QPixmapData::PixelType type); ~QBlittablePixmapData(); - QBlittable *blittable() const { return m_blittable; } + QBlittable *blittable(); + void setBlittable(QBlittable *blittable); void resize(int width, int height); int metric(QPaintDevice::PaintDeviceMetric metric) const; void fill(const QColor &color); QImage *buffer(); - QImage toImage(); - bool hasAlphaChannel(); + QImage toImage() const; + bool hasAlphaChannel() const; void fromImage(const QImage &image, Qt::ImageConversionFlags flags); QPaintEngine *paintEngine() const; diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h index 292092f..a668f0a 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qpixmapdata_p.h @@ -137,6 +137,7 @@ private: friend class QX11PixmapData; friend class QS60PixmapData; friend class QImagePixmapCleanupHooks; // Needs to set is_cached + friend class QBlittablPixmapData; friend class QGLTextureCache; //Needs to check the reference count friend class QExplicitlySharedDataPointer; diff --git a/src/gui/painting/qgraphicssystem_p.h b/src/gui/painting/qgraphicssystem_p.h index 275afc0..5fce93d 100644 --- a/src/gui/painting/qgraphicssystem_p.h +++ b/src/gui/painting/qgraphicssystem_p.h @@ -86,7 +86,7 @@ class Q_GUI_EXPORT QGraphicsSystem public: virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0; virtual QWindowSurface *createWindowSurface(QWidget *widget) const = 0; - virtual QBlittable *createBlittable(const QRect &rect) { return 0; } + virtual QBlittable *createBlittable(const QRect &) const { return 0; } virtual ~QGraphicsSystem() = 0; diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index b134d84..0632ae0 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -2,6 +2,7 @@ #include "private/qpaintengine_raster_p.h" #include "private/qpainter_p.h" #include "private/qapplication_p.h" +#include "private/qpixmap_blitter_p.h" #define STATE_XFORM_SCALE 0x00000001 #define STATE_XFORM_COMPLEX 0x00000002 @@ -147,21 +148,16 @@ public: class QBlitterPaintEnginePrivate : public QPaintEngineExPrivate { public: - QBlitterPaintEnginePrivate(QPixmapData *p) - : QPaintEngineExPrivate(), pixmap(p), - raster(new QRasterPaintEngine(&pixmap)), isBlitterLocked(false), - capabillities(0), hasXForm(false) - { - if (QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem()) { -// QBlittable *b = gs->createBlitter(p); -// if (b) { -// blitter=b; -// capabillities = new CapabilitiesToStateMask(blitter->capabilities()); -// blitter->unlock(); -// } else -// qWarning("No blitter returned from the graphics system. QBlitterPaintEngine will not work"); - } + QBlitterPaintEnginePrivate(QBlittablePixmapData *p) + : QPaintEngineExPrivate(), + isBlitterLocked(false), + hasXForm(false) + { + blitter= p->blittable(); + raster = new QRasterPaintEngine(p->buffer()); + capabillities = new CapabilitiesToStateMask(blitter->capabilities()); + lock(); } inline void lock() { @@ -179,31 +175,35 @@ public: } void fillRect(const QRectF &rect, const QColor &color) { - unlock(); + lock(); QRectF targetRect = rect; if (hasXForm) { targetRect = state->matrix.mapRect(rect); } QClipData *clipData = raster->state()->clip; if (clipData) { - if (clipData->hasRectClip) + if (clipData->hasRectClip) { + unlock(); blitter->fillRect(targetRect & clipData->clipRect, color); - else if (clipData->hasRegionClip) { + } else if (clipData->hasRegionClip) { QVector rects = clipData->clipRegion.rects(); for ( int i = 0; i < rects.size(); i++ ) { QRect intersectRect = rects.at(i).intersected(targetRect.toRect()); if (!intersectRect.isEmpty()) { + unlock(); blitter->fillRect(intersectRect,color); } } } - }else { + } else { if (targetRect.x() >= 0 && targetRect.y() >= 0 && targetRect.width() <= raster->paintDevice()->width() - && targetRect.height() <= raster->paintDevice()->height()) + && targetRect.height() <= raster->paintDevice()->height()) { + unlock(); blitter->fillRect(targetRect,color); - else { + } else { QRectF deviceRect(0,0,raster->paintDevice()->width(), raster->paintDevice()->height()); + unlock(); blitter->fillRect(deviceRect&targetRect,color); } } @@ -247,14 +247,13 @@ public: uint hasXForm; }; -QBlitterPaintEngine::QBlitterPaintEngine(QPixmapData *p) +QBlitterPaintEngine::QBlitterPaintEngine(QBlittablePixmapData *p) : QPaintEngineEx(*(new QBlitterPaintEnginePrivate(p))) { } QBlitterPaintEngine::~QBlitterPaintEngine() { - Q_D(QBlitterPaintEngine); } QPainterState *QBlitterPaintEngine::createState(QPainterState *orig) const @@ -407,17 +406,20 @@ void QBlitterPaintEngine::stroke(const QVectorPath &path, const QPen &pen) void QBlitterPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) { Q_D(QBlitterPaintEngine); + d->lock(); d->raster->clip(path, op); d->updateClip(); } void QBlitterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op){ Q_D(QBlitterPaintEngine); + d->lock(); d->raster->clip(rect,op); d->updateClip(); } void QBlitterPaintEngine::clip(const QRegion ®ion, Qt::ClipOperation op) { Q_D(QBlitterPaintEngine); + d->lock(); d->raster->clip(region,op); d->updateClip(); } @@ -425,12 +427,14 @@ void QBlitterPaintEngine::clip(const QRegion ®ion, Qt::ClipOperation op) void QBlitterPaintEngine::clipEnabledChanged() { Q_D(QBlitterPaintEngine); + d->lock(); d->raster->clipEnabledChanged(); } void QBlitterPaintEngine::penChanged() { Q_D(QBlitterPaintEngine); + d->lock(); d->raster->penChanged(); d->capabillities->updateDrawRectBits(STATE_PEN_ENABLED,qpen_style(d->state->pen) != Qt::NoPen); } @@ -589,6 +593,7 @@ void QBlitterPaintEngine::drawTextItem(const QPointF &pos, const QTextItem &ti) void QBlitterPaintEngine::setState(QPainterState *s) { Q_D(QBlitterPaintEngine); + d->lock(); QPaintEngineEx::setState(s); d->raster->setState(s); d->state = (QRasterPaintEngineState *) s; @@ -609,7 +614,7 @@ class QBlittablePrivate { public: QBlittablePrivate(const QRect &rect, QBlittable::Capabilities caps) - : m_rect(rect), caps(caps) + : caps(caps), m_rect(rect) {} QBlittable::Capabilities caps; QRect m_rect; diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h index 16b7b2c..8cd2f74 100644 --- a/src/gui/painting/qpaintengine_blitter_p.h +++ b/src/gui/painting/qpaintengine_blitter_p.h @@ -6,6 +6,7 @@ class QRasterPaintEngine; class QBlittablePrivate; class QBlitterPaintEnginePrivate; +class QBlittablePixmapData; // ### find name class Q_GUI_EXPORT QBlittable @@ -45,7 +46,7 @@ class Q_GUI_EXPORT QBlitterPaintEngine : public QPaintEngineEx { Q_DECLARE_PRIVATE(QBlitterPaintEngine); public: - QBlitterPaintEngine(QPixmapData *p); + QBlitterPaintEngine(QBlittablePixmapData *p); ~QBlitterPaintEngine(); virtual QPainterState *createState(QPainterState *orig) const; diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 3f33319..5e3203a 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -458,8 +458,8 @@ bool QRasterPaintEngine::begin(QPaintDevice *device) if (device->devType() == QInternal::Pixmap) { QPixmap *pixmap = static_cast(device); - if (pixmap->data->classId() == QPixmapData::RasterClass) - d->device = pixmap->data->buffer(); + if (pixmap->data->classId() == QPixmapData::RasterClass || pixmap->data->classId() == QPixmapData::BlitterClass) + d->device = pixmap->data->buffer(); } else { d->device = device; } diff --git a/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro b/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro index d4c93fd..8822a5b 100644 --- a/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro +++ b/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro @@ -3,11 +3,11 @@ include(../../qpluginbase.pri) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems -QMAKE_CXXFLAGS += -I/usr/include/directfb -LIBS += -ldirectfb -lfusion -ldirect -lpthread +QMAKE_CXXFLAGS += -I/usr/local/include/directfb +LIBS += -L/usr/local/lib -ldirectfb -lfusion -ldirect -lpthread -SOURCES = main.cpp qgraphicssystem_minimaldfb.cpp qwindowsurface_minimaldfb.cpp -HEADERS = qgraphicssystem_minimaldfb.h qwindowsurface_minimaldfb.h +SOURCES = main.cpp qgraphicssystem_minimaldfb.cpp qwindowsurface_minimaldfb.cpp qblitter_directfb.cpp +HEADERS = qgraphicssystem_minimaldfb.h qwindowsurface_minimaldfb.h qblitter_directfb.h target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems INSTALLS += target diff --git a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp new file mode 100644 index 0000000..6800543 --- /dev/null +++ b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp @@ -0,0 +1,94 @@ +#include "qblitter_directfb.h" +#include "qgraphicssystem_minimaldfb.h" + +#include + +#include + +QDirectFbBlitter::QDirectFbBlitter(const QRect &rect, IDirectFBSurface *surface) + : QBlittable(rect, QBlittable::Capabilities(QBlittable::SolidRectCapability + |QBlittable::SourcePixmapCapability + |QBlittable::SourceOverPixmapCapability + |QBlittable::SourceOverScaledPixmapCapability)) +// 0)) +{ + DFBSurfaceDescription surfaceDesc; + surfaceDesc.width = rect.width(); + surfaceDesc.height = rect.height(); + surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT); + + if (surface) { + m_surface = surface; + } else { + IDirectFB *dfb = QDirectFbGraphicsSystem::dfbInterface(); + dfb->CreateSurface(dfb,&surfaceDesc, &m_surface); + } +} + +void QDirectFbBlitter::fillRect(const QRectF &rect, const QColor &color) +{ + m_surface->SetColor(m_surface, color.red(), color.green(), color.blue(), color.alpha()); + m_surface->SetDrawingFlags(m_surface, DSDRAW_NOFX); + m_surface->FillRectangle(m_surface, rect.x(), rect.y(), + rect.width(), rect.height()); +} + +void QDirectFbBlitter::drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &srcRect) +{ + quint32 blittingFlags = pixmap.hasAlphaChannel() ? DSBLIT_BLEND_ALPHACHANNEL : DSBLIT_NOFX; + + m_surface->SetBlittingFlags(m_surface, DFBSurfaceBlittingFlags(blittingFlags)); + m_surface->SetColor(m_surface, 0xff, 0xff, 0xff, 255); + +// QPixmapData *data = pixmap.pixmapData(); +// Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); +// QDirectFBPixmapData *dfbData = static_cast(data); +// IDirectFBSurface *s = dfbData->directFBSurface(); +// const DFBRectangle sRect = { srcRect.x(), srcRect.y(), rect.width(), rect.height() }; +// +// DFBResult result; +// if (rect.width() == srcRect.width() && rect.height() == srcRect.height()) +// result = surface->Blit(surface, s, &sRect, rect.x(), rect.y()); +// else { +// const DFBRectangle dRect = { rect.x(), rect.y(), rect.width(), rect.height() }; +// result = surface->StretchBlit(surface, s, &sRect, &dRect); +// } +// if (result != DFB_OK) +// DirectFBError("QDirectFBBlitter::drawPixmap()", result); + +} + +QImage *QDirectFbBlitter::lock() +{ + if (m_image.isNull()) { + if(!m_surface) + qDebug() << "Trying to lock null surface"; + if (!this->rect().isValid()) { + qDebug() << "No valid blitter rect"; + return 0; + } + + + + void *mem; + int bpl; + const DFBResult result = m_surface->Lock(m_surface, DFBSurfaceLockFlags(DSLF_WRITE|DSLF_READ), static_cast(&mem), &bpl); + if (result == DFB_OK) { + QImage::Format format = QDirectFbGraphicsSystem::imageFormatFromSurface(m_surface); + int w, h; + m_surface->GetSize(m_surface,&w,&h); + m_image = QImage(static_cast(mem),w,h,format); + } else { + DirectFBError("Failed to lock image", result); + } + + } + + return &m_image; +} + +void QDirectFbBlitter::unlock() +{ + m_surface->Unlock(m_surface); + m_image = QImage(); +} diff --git a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h new file mode 100644 index 0000000..d60a390 --- /dev/null +++ b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h @@ -0,0 +1,24 @@ +#ifndef QDIRECTFBBLITTER_H +#define QDIRECTFBBLITTER_H + +#include + +#include + +class QDirectFbBlitter : public QBlittable +{ +public: + QDirectFbBlitter(const QRect &rect, IDirectFBSurface *surface = 0); + virtual ~QDirectFbBlitter(){ } + + virtual void fillRect(const QRectF &rect, const QColor &color); + virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect); + + virtual QImage *lock(); + virtual void unlock(); + + IDirectFBSurface *m_surface; + QImage m_image; +}; + +#endif // QDIRECTFBBLITTER_H diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp index bf46d4c..a59cfd2 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp @@ -41,7 +41,13 @@ #include "qgraphicssystem_minimaldfb.h" #include "qwindowsurface_minimaldfb.h" -#include +#include "qblitter_directfb.h" + +#include +#include + +#include +#include #include #include @@ -51,7 +57,7 @@ QDirectFbGraphicsSystemScreen::QDirectFbGraphicsSystemScreen(IDirectFB *dfb, int { DFBResult result = dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &m_layer); if (result != DFB_OK) { - DirectFBError("QDirectFbGraphicsSystemScreen::connect: " + DirectFBError("QDirectFbGraphicsSystemScreen " "Unable to get primary display layer!", result); } m_layer->SetCooperativeLevel(m_layer,DLSCL_SHARED); @@ -106,30 +112,34 @@ IDirectFBWindow *QDirectFbGraphicsSystemScreen::createWindow(const QRect &rect) return window; } +IDirectFB *QDirectFbGraphicsSystem::dfb = 0; + QDirectFbGraphicsSystem::QDirectFbGraphicsSystem() { - DFBResult result = DFB_OK; - - { // pass command line arguments to DirectFB - const QStringList args = QCoreApplication::arguments(); - int argc = args.size(); - char **argv = new char*[argc]; - - for (int i = 0; i < argc; ++i) - argv[i] = qstrdup(args.at(i).toLocal8Bit().constData()); + if (!dfb) { + DFBResult result = DFB_OK; + + { // pass command line arguments to DirectFB + const QStringList args = QCoreApplication::arguments(); + int argc = args.size(); + char **argv = new char*[argc]; + + for (int i = 0; i < argc; ++i) + argv[i] = qstrdup(args.at(i).toLocal8Bit().constData()); + + result = DirectFBInit(&argc, &argv); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreen: error initializing DirectFB", + result); + } + delete[] argv; + } - result = DirectFBInit(&argc, &argv); + result = DirectFBCreate(&dfb); if (result != DFB_OK) { - DirectFBError("QDirectFBScreen: error initializing DirectFB", + DirectFBError("QDirectFBScreen: error creating DirectFB interface", result); } - delete[] argv; - } - - result = DirectFBCreate(&dfb); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreen: error creating DirectFB interface", - result); } mPrimaryScreen = new QDirectFbGraphicsSystemScreen(dfb,0); @@ -138,12 +148,20 @@ QDirectFbGraphicsSystem::QDirectFbGraphicsSystem() QPixmapData *QDirectFbGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const { - return new QRasterPixmapData(type); + return new QBlittablePixmapData(type); +// return new QRasterPixmapData(type); } QWindowSurface *QDirectFbGraphicsSystem::createWindowSurface(QWidget *widget) const { return new QDirectFbWindowSurface (mPrimaryScreen, widget); +// return new QRasterWindowSurface(widget); +} + +QBlittable *QDirectFbGraphicsSystem::createBlittable(const QRect &rect) const +{ + return new QDirectFbBlitter(rect); +// return 0; } QImage::Format QDirectFbGraphicsSystem::imageFormatFromSurface(IDirectFBSurface *surface) @@ -186,4 +204,9 @@ QImage::Format QDirectFbGraphicsSystem::imageFormatFromSurface(IDirectFBSurface } +IDirectFB *QDirectFbGraphicsSystem::dfbInterface() +{ + return dfb; +} + QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h index fbc5498..148086c 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h @@ -77,13 +77,15 @@ public: QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QWindowSurface *createWindowSurface(QWidget *widget) const; + QBlittable *createBlittable(const QRect &rect) const; QList screens() const { return mScreens; } static QImage::Format imageFormatFromSurface(IDirectFBSurface *surface); + static IDirectFB *dfbInterface(); private: - IDirectFB *dfb; + static IDirectFB *dfb; QDirectFbGraphicsSystemScreen *mPrimaryScreen; QList mScreens; }; diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp index e75a43c..86d16d3 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -41,6 +41,9 @@ #include "qwindowsurface_minimaldfb.h" #include "qgraphicssystem_minimaldfb.h" +#include "qblitter_directfb.h" +#include + #include QT_BEGIN_NAMESPACE @@ -55,6 +58,13 @@ QDirectFbWindowSurface::QDirectFbWindowSurface if (result != DFB_OK) { DirectFBError("QDirectFbWindowSurface::QDirectFbWindowSurface: unable to get windows surface",result); } + QDirectFbBlitter *blitter = new QDirectFbBlitter(window->rect(), m_dfbSurface); + pmdata = new QBlittablePixmapData(QPixmapData::PixmapType); + pmdata->resize(window->width(),window->height()); + pmdata->setBlittable(blitter); + + m_pixmap = new QPixmap(pmdata); + } QDirectFbWindowSurface::~QDirectFbWindowSurface() @@ -63,7 +73,7 @@ QDirectFbWindowSurface::~QDirectFbWindowSurface() QPaintDevice *QDirectFbWindowSurface::paintDevice() { - return m_image; + return m_pixmap; } void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) @@ -71,6 +81,7 @@ void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const Q_UNUSED(widget); Q_UNUSED(offset); + m_dfbSurface->Unlock(m_dfbSurface); const quint8 windowOpacity = quint8(widget->windowOpacity() * 0xff); m_dfbWindow->SetOpacity(m_dfbWindow,windowOpacity); @@ -85,11 +96,7 @@ void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const void QDirectFbWindowSurface::setGeometry(const QRect &rect) { // qDebug() << "QDirectF.bWindowSurface::setGeometry:" << (long)this << rect; - bool wasLocked = false; - if (m_lock){ - m_dfbSurface->Unlock(m_dfbSurface); - wasLocked = true; - } + m_dfbSurface->Release(m_dfbSurface); QWindowSurface::setGeometry(rect); m_dfbWindow->SetBounds(m_dfbWindow, rect.x(),rect.y(), @@ -98,10 +105,15 @@ void QDirectFbWindowSurface::setGeometry(const QRect &rect) // m_dfbWindow->MoveTo(m_dfbWindow,rect.x(),rect.y()); DFBResult result = m_dfbWindow->GetSurface(m_dfbWindow,&m_dfbSurface); if (result != DFB_OK) - qDebug() << "could not resurface"; + DirectFBError("QDirectFbWindowSurface::setGeometry() failed to retrieve new surface",result); + + QPixmap *oldpixmap = m_pixmap; + QDirectFbBlitter *blitter = new QDirectFbBlitter(rect, m_dfbSurface); + pmdata->resize(rect.width(),rect.height()); + pmdata->setBlittable(blitter); + m_pixmap = new QPixmap(pmdata); + delete oldpixmap; - if (wasLocked) - lockSurfaceToImage(); } bool QDirectFbWindowSurface::scroll(const QRegion &area, int dx, int dy) @@ -112,36 +124,11 @@ bool QDirectFbWindowSurface::scroll(const QRegion &area, int dx, int dy) void QDirectFbWindowSurface::beginPaint(const QRegion ®ion) { Q_UNUSED(region); - if (!m_lock) - lockSurfaceToImage(); } void QDirectFbWindowSurface::endPaint(const QRegion ®ion) { Q_UNUSED(region); - if (m_lock){ - m_dfbSurface->Unlock(m_dfbSurface); - m_lock = false; - } -} - -void QDirectFbWindowSurface::lockSurfaceToImage() -{ - if (m_lock) - return; - m_lock = true; - - int w,h; - m_dfbSurface->GetSize(m_dfbSurface,&w,&h); - uchar *data; - int bpl; - DFBResult result = m_dfbSurface->Lock(m_dfbSurface,static_cast(DSLF_READ|DSLF_WRITE),reinterpret_cast(&data),&bpl); - if (!result == DFB_OK) { - DirectFBError("QDirectFbWindowSurface::lockSurfaceToImage() failed to lock surface",result); - return; - } - QImage::Format format = QDirectFbGraphicsSystem::imageFormatFromSurface(m_dfbSurface); - m_image = new QImage(data,w,h,bpl,format); } QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h index fe88878..98575ff 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h @@ -43,6 +43,8 @@ #define QWINDOWSURFACE_MINIMAL_H #include +#include + #include QT_BEGIN_NAMESPACE @@ -68,7 +70,8 @@ private: void lockSurfaceToImage(); QDirectFbGraphicsSystemScreen *m_screen; - QImage *m_image; + QPixmap *m_pixmap; + QBlittablePixmapData *pmdata; bool m_lock; IDirectFBWindow *m_dfbWindow; -- cgit v0.12 From 79b6ad01115cc9208e8a22d8dc925215da9792ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 24 Nov 2009 13:25:23 +0100 Subject: Cleanup blitter and minimaldfb A QBlittable is now aware if it is locked or not. Created a seperate header file for DirectFB convenience functions --- src/gui/image/qpixmap_blitter.cpp | 5 +- src/gui/image/qpixmap_blitter_p.h | 8 +- src/gui/painting/qpaintengine_blitter.cpp | 28 +++++- src/gui/painting/qpaintengine_blitter_p.h | 6 +- .../graphicssystems/minimaldfb/minimaldfb.pro | 21 +++-- .../minimaldfb/qblitter_directfb.cpp | 86 ++++++++--------- .../graphicssystems/minimaldfb/qblitter_directfb.h | 5 +- .../minimaldfb/qdirectfbconvenience.cpp | 43 +++++++++ .../minimaldfb/qdirectfbconvenience.h | 22 +++++ .../minimaldfb/qgraphicssystem_minimaldfb.cpp | 102 ++++++--------------- .../minimaldfb/qgraphicssystem_minimaldfb.h | 4 +- .../minimaldfb/qwindowsurface_minimaldfb.cpp | 8 +- 12 files changed, 188 insertions(+), 150 deletions(-) create mode 100644 src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp create mode 100644 src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index 5ecc01d..82e0045 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -10,6 +10,8 @@ QBlittablePixmapData::QBlittablePixmapData(QPixmapData::PixelType type) QBlittablePixmapData::~QBlittablePixmapData() { + delete m_blittable; + delete m_engine; } QBlittable *QBlittablePixmapData::blittable() @@ -34,10 +36,9 @@ void QBlittablePixmapData::resize(int width, int height) m_blittable = 0; delete m_engine; m_engine = 0; - d = 32; + d = QApplicationPrivate::graphicsSystem()->screens().at(0)->depth(); w = width; h = height; -// d = image.depth(); is_null = (w <= 0 || h <= 0); } extern int qt_defaultDpiX(); diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h index 3ed2fe4..5e01a12 100644 --- a/src/gui/image/qpixmap_blitter_p.h +++ b/src/gui/image/qpixmap_blitter_p.h @@ -21,12 +21,13 @@ public: //should never be called } - QImage *lock() +protected: + QImage *doLock() { return ℑ } - void unlock() + void doUnlock() { } @@ -36,6 +37,7 @@ private: class Q_GUI_EXPORT QBlittablePixmapData : public QPixmapData { +// Q_DECLARE_PRIVATE(QBlittablePixmapData); public: QBlittablePixmapData(QPixmapData::PixelType type); ~QBlittablePixmapData(); @@ -52,10 +54,10 @@ public: void fromImage(const QImage &image, Qt::ImageConversionFlags flags); QPaintEngine *paintEngine() const; - protected: QBlitterPaintEngine *m_engine; QBlittable *m_blittable; + }; #endif // QPIXMAP_BLITTER_P_H diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index 0632ae0..7336dcc 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -157,7 +157,6 @@ public: blitter= p->blittable(); raster = new QRasterPaintEngine(p->buffer()); capabillities = new CapabilitiesToStateMask(blitter->capabilities()); - lock(); } inline void lock() { @@ -175,12 +174,12 @@ public: } void fillRect(const QRectF &rect, const QColor &color) { - lock(); +// lock(); QRectF targetRect = rect; if (hasXForm) { targetRect = state->matrix.mapRect(rect); } - QClipData *clipData = raster->state()->clip; + QClipData *clipData = state->clip; if (clipData) { if (clipData->hasRectClip) { unlock(); @@ -614,10 +613,12 @@ class QBlittablePrivate { public: QBlittablePrivate(const QRect &rect, QBlittable::Capabilities caps) - : caps(caps), m_rect(rect) + : caps(caps), m_rect(rect), locked(false), cachedImg(0) {} QBlittable::Capabilities caps; QRect m_rect; + bool locked; + QImage *cachedImg; }; @@ -644,3 +645,22 @@ QRect QBlittable::rect() const return d->m_rect; } +QImage *QBlittable::lock() +{ + Q_D(QBlittable); + if (!d->locked) { + d->cachedImg = doLock(); + d->locked = true; + } + + return d->cachedImg; +} + +void QBlittable::unlock() +{ + Q_D(QBlittable); + if (d->locked) { + doUnlock(); + d->locked = false; + } +} diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h index 8cd2f74..6a5462e 100644 --- a/src/gui/painting/qpaintengine_blitter_p.h +++ b/src/gui/painting/qpaintengine_blitter_p.h @@ -34,10 +34,12 @@ public: virtual void fillRect(const QRectF &rect, const QColor &color) = 0; virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect) = 0; - virtual QImage *lock() = 0; - virtual void unlock() = 0; + QImage *lock(); + void unlock(); protected: + virtual QImage *doLock() = 0; + virtual void doUnlock() = 0; QBlittablePrivate *d_ptr; }; diff --git a/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro b/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro index 8822a5b..c3f20ff 100644 --- a/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro +++ b/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro @@ -1,13 +1,20 @@ TARGET = qminimaldfb include(../../qpluginbase.pri) - QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems - QMAKE_CXXFLAGS += -I/usr/local/include/directfb -LIBS += -L/usr/local/lib -ldirectfb -lfusion -ldirect -lpthread - -SOURCES = main.cpp qgraphicssystem_minimaldfb.cpp qwindowsurface_minimaldfb.cpp qblitter_directfb.cpp -HEADERS = qgraphicssystem_minimaldfb.h qwindowsurface_minimaldfb.h qblitter_directfb.h - +LIBS += -L/usr/local/lib \ + -ldirectfb \ + -lfusion \ + -ldirect \ + -lpthread +SOURCES = main.cpp \ + qgraphicssystem_minimaldfb.cpp \ + qwindowsurface_minimaldfb.cpp \ + qblitter_directfb.cpp \ + qdirectfbconvenience.cpp +HEADERS = qgraphicssystem_minimaldfb.h \ + qwindowsurface_minimaldfb.h \ + qblitter_directfb.h \ + qdirectfbconvenience.h target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems INSTALLS += target diff --git a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp index 6800543..05221ce 100644 --- a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp @@ -1,5 +1,8 @@ #include "qblitter_directfb.h" #include "qgraphicssystem_minimaldfb.h" +#include "qdirectfbconvenience.h" + +#include #include @@ -10,17 +13,16 @@ QDirectFbBlitter::QDirectFbBlitter(const QRect &rect, IDirectFBSurface *surface) |QBlittable::SourcePixmapCapability |QBlittable::SourceOverPixmapCapability |QBlittable::SourceOverScaledPixmapCapability)) -// 0)) { - DFBSurfaceDescription surfaceDesc; - surfaceDesc.width = rect.width(); - surfaceDesc.height = rect.height(); - surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT); - if (surface) { m_surface = surface; } else { - IDirectFB *dfb = QDirectFbGraphicsSystem::dfbInterface(); + DFBSurfaceDescription surfaceDesc; + surfaceDesc.width = rect.width(); + surfaceDesc.height = rect.height(); + surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT); + + IDirectFB *dfb = QDirectFbConvenience::dfbInterface(); dfb->CreateSurface(dfb,&surfaceDesc, &m_surface); } } @@ -40,55 +42,47 @@ void QDirectFbBlitter::drawPixmap(const QRectF &rect, const QPixmap &pixmap, con m_surface->SetBlittingFlags(m_surface, DFBSurfaceBlittingFlags(blittingFlags)); m_surface->SetColor(m_surface, 0xff, 0xff, 0xff, 255); -// QPixmapData *data = pixmap.pixmapData(); -// Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); -// QDirectFBPixmapData *dfbData = static_cast(data); -// IDirectFBSurface *s = dfbData->directFBSurface(); -// const DFBRectangle sRect = { srcRect.x(), srcRect.y(), rect.width(), rect.height() }; -// -// DFBResult result; -// if (rect.width() == srcRect.width() && rect.height() == srcRect.height()) -// result = surface->Blit(surface, s, &sRect, rect.x(), rect.y()); -// else { -// const DFBRectangle dRect = { rect.x(), rect.y(), rect.width(), rect.height() }; -// result = surface->StretchBlit(surface, s, &sRect, &dRect); -// } -// if (result != DFB_OK) -// DirectFBError("QDirectFBBlitter::drawPixmap()", result); + QPixmapData *data = pixmap.pixmapData(); + Q_ASSERT(data->classId() == QPixmapData::BlitterClass); + QBlittablePixmapData *blitPm = static_cast(data); + QDirectFbBlitter *dfbBlitter = static_cast(blitPm->blittable()); -} + IDirectFBSurface *s = dfbBlitter->m_surface; + const DFBRectangle sRect = { srcRect.x(), srcRect.y(), rect.width(), rect.height() }; -QImage *QDirectFbBlitter::lock() -{ - if (m_image.isNull()) { - if(!m_surface) - qDebug() << "Trying to lock null surface"; - if (!this->rect().isValid()) { - qDebug() << "No valid blitter rect"; - return 0; + DFBResult result; + if (rect.width() == srcRect.width() && rect.height() == srcRect.height()) + result = m_surface->Blit(m_surface, s, &sRect, rect.x(), rect.y()); + else { + const DFBRectangle dRect = { rect.x(), rect.y(), rect.width(), rect.height() }; + result = m_surface->StretchBlit(m_surface, s, &sRect, &dRect); } + if (result != DFB_OK) + DirectFBError("QDirectFBBlitter::drawPixmap()", result); +} - - void *mem; - int bpl; - const DFBResult result = m_surface->Lock(m_surface, DFBSurfaceLockFlags(DSLF_WRITE|DSLF_READ), static_cast(&mem), &bpl); - if (result == DFB_OK) { - QImage::Format format = QDirectFbGraphicsSystem::imageFormatFromSurface(m_surface); - int w, h; - m_surface->GetSize(m_surface,&w,&h); - m_image = QImage(static_cast(mem),w,h,format); - } else { - DirectFBError("Failed to lock image", result); - } - +QImage *QDirectFbBlitter::doLock() +{ + Q_ASSERT(m_surface); + Q_ASSERT(rect().isValid()); + + void *mem; + int bpl; + const DFBResult result = m_surface->Lock(m_surface, DFBSurfaceLockFlags(DSLF_WRITE|DSLF_READ), static_cast(&mem), &bpl); + if (result == DFB_OK) { + QImage::Format format = QDirectFbConvenience::imageFormatFromSurface(m_surface); + int w, h; + m_surface->GetSize(m_surface,&w,&h); + m_image = QImage(static_cast(mem),w,h,format); + } else { + DirectFBError("Failed to lock image", result); } return &m_image; } -void QDirectFbBlitter::unlock() +void QDirectFbBlitter::doUnlock() { m_surface->Unlock(m_surface); - m_image = QImage(); } diff --git a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h index d60a390..252bf80 100644 --- a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h +++ b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h @@ -14,8 +14,9 @@ public: virtual void fillRect(const QRectF &rect, const QColor &color); virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect); - virtual QImage *lock(); - virtual void unlock(); +protected: + virtual QImage *doLock(); + virtual void doUnlock(); IDirectFBSurface *m_surface; QImage m_image; diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp new file mode 100644 index 0000000..d958482 --- /dev/null +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp @@ -0,0 +1,43 @@ +#include "qdirectfbconvenience.h" + +IDirectFB *QDirectFbConvenience::dfb = 0; + +QImage::Format QDirectFbConvenience::imageFormatFromSurface(IDirectFBSurface *surface) +{ + DFBSurfacePixelFormat format; + surface->GetPixelFormat(surface, &format); + + switch (format) { + case DSPF_LUT8: + return QImage::Format_Indexed8; + case DSPF_RGB24: + return QImage::Format_RGB888; + case DSPF_ARGB4444: + return QImage::Format_ARGB4444_Premultiplied; + case DSPF_RGB444: + return QImage::Format_RGB444; + case DSPF_RGB555: + case DSPF_ARGB1555: + return QImage::Format_RGB555; + case DSPF_RGB16: + return QImage::Format_RGB16; + case DSPF_ARGB6666: + return QImage::Format_ARGB6666_Premultiplied; + case DSPF_RGB18: + return QImage::Format_RGB666; + case DSPF_RGB32: + return QImage::Format_RGB32; + case DSPF_ARGB: { + DFBSurfaceCapabilities caps; + const DFBResult result = surface->GetCapabilities(surface, &caps); + Q_ASSERT(result == DFB_OK); + Q_UNUSED(result); + return (caps & DSCAPS_PREMULTIPLIED + ? QImage::Format_ARGB32_Premultiplied + : QImage::Format_ARGB32); } + default: + break; + } + return QImage::Format_Invalid; + +} diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h new file mode 100644 index 0000000..7e426db --- /dev/null +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h @@ -0,0 +1,22 @@ +#ifndef QDIRECTFBCONVENIENCE_H +#define QDIRECTFBCONVENIENCE_H + +#include + +#include + +class QDirectFbConvenience +{ +public: + static QImage::Format imageFormatFromSurface(IDirectFBSurface *surface); + + //This is set by the graphicssystem constructor + static IDirectFB *dfbInterface() { return dfb; } + +private: + static void setDfbInterface(IDirectFB *dfbInterface) {dfb = dfbInterface;} + static IDirectFB *dfb; + friend class QDirectFbGraphicsSystem; +}; + +#endif // QDIRECTFBCONVENIENCE_H diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp index a59cfd2..117e4b5 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp @@ -42,6 +42,7 @@ #include "qgraphicssystem_minimaldfb.h" #include "qwindowsurface_minimaldfb.h" #include "qblitter_directfb.h" +#include "qdirectfbconvenience.h" #include #include @@ -65,7 +66,7 @@ QDirectFbGraphicsSystemScreen::QDirectFbGraphicsSystemScreen(IDirectFB *dfb, int IDirectFBSurface *topLevelSurface; //This line gives a warning m_layer->GetSurface(m_layer, &topLevelSurface); - m_format = QDirectFbGraphicsSystem::imageFormatFromSurface(topLevelSurface); + m_format = QDirectFbConvenience::imageFormatFromSurface(topLevelSurface); result = m_layer->GetScreen(m_layer,&m_screen); if (result != DFB_OK) { @@ -73,9 +74,9 @@ QDirectFbGraphicsSystemScreen::QDirectFbGraphicsSystemScreen(IDirectFB *dfb, int } int w(0),h(0); + //Asking the screen for its size gives the desktop geometry on X11 - //Thats not something we want, so as the topLevelSorface instead -// m_screen->GetSize(m_screen,&w,&h); + //Thats not something we want, so ask the topLevelSorface instead topLevelSurface->GetSize(topLevelSurface,&w,&h); m_geometry = QRect(0,0,w,h); @@ -112,35 +113,32 @@ IDirectFBWindow *QDirectFbGraphicsSystemScreen::createWindow(const QRect &rect) return window; } -IDirectFB *QDirectFbGraphicsSystem::dfb = 0; QDirectFbGraphicsSystem::QDirectFbGraphicsSystem() { - if (!dfb) { - DFBResult result = DFB_OK; - - { // pass command line arguments to DirectFB - const QStringList args = QCoreApplication::arguments(); - int argc = args.size(); - char **argv = new char*[argc]; - - for (int i = 0; i < argc; ++i) - argv[i] = qstrdup(args.at(i).toLocal8Bit().constData()); - - result = DirectFBInit(&argc, &argv); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreen: error initializing DirectFB", - result); - } - delete[] argv; - } - - result = DirectFBCreate(&dfb); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreen: error creating DirectFB interface", - result); - } + IDirectFB *dfb; + DFBResult result = DFB_OK; + + const QStringList args = QCoreApplication::arguments(); + int argc = args.size(); + char **argv = new char*[argc]; + + for (int i = 0; i < argc; ++i) + argv[i] = qstrdup(args.at(i).toLocal8Bit().constData()); + + result = DirectFBInit(&argc, &argv); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreen: error initializing DirectFB", + result); + } + delete[] argv; + + result = DirectFBCreate(&dfb); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreen: error creating DirectFB interface", + result); } + QDirectFbConvenience::setDfbInterface(dfb); mPrimaryScreen = new QDirectFbGraphicsSystemScreen(dfb,0); mScreens.append(mPrimaryScreen); @@ -149,64 +147,16 @@ QDirectFbGraphicsSystem::QDirectFbGraphicsSystem() QPixmapData *QDirectFbGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const { return new QBlittablePixmapData(type); -// return new QRasterPixmapData(type); } QWindowSurface *QDirectFbGraphicsSystem::createWindowSurface(QWidget *widget) const { return new QDirectFbWindowSurface (mPrimaryScreen, widget); -// return new QRasterWindowSurface(widget); } QBlittable *QDirectFbGraphicsSystem::createBlittable(const QRect &rect) const { return new QDirectFbBlitter(rect); -// return 0; -} - -QImage::Format QDirectFbGraphicsSystem::imageFormatFromSurface(IDirectFBSurface *surface) -{ - DFBSurfacePixelFormat format; - surface->GetPixelFormat(surface, &format); - - switch (format) { - case DSPF_LUT8: - return QImage::Format_Indexed8; - case DSPF_RGB24: - return QImage::Format_RGB888; - case DSPF_ARGB4444: - return QImage::Format_ARGB4444_Premultiplied; - case DSPF_RGB444: - return QImage::Format_RGB444; - case DSPF_RGB555: - case DSPF_ARGB1555: - return QImage::Format_RGB555; - case DSPF_RGB16: - return QImage::Format_RGB16; - case DSPF_ARGB6666: - return QImage::Format_ARGB6666_Premultiplied; - case DSPF_RGB18: - return QImage::Format_RGB666; - case DSPF_RGB32: - return QImage::Format_RGB32; - case DSPF_ARGB: { - DFBSurfaceCapabilities caps; - const DFBResult result = surface->GetCapabilities(surface, &caps); - Q_ASSERT(result == DFB_OK); - Q_UNUSED(result); - return (caps & DSCAPS_PREMULTIPLIED - ? QImage::Format_ARGB32_Premultiplied - : QImage::Format_ARGB32); } - default: - break; - } - return QImage::Format_Invalid; - -} - -IDirectFB *QDirectFbGraphicsSystem::dfbInterface() -{ - return dfb; } QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h index 148086c..462e963 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h @@ -81,11 +81,9 @@ public: QList screens() const { return mScreens; } - static QImage::Format imageFormatFromSurface(IDirectFBSurface *surface); - static IDirectFB *dfbInterface(); + private: - static IDirectFB *dfb; QDirectFbGraphicsSystemScreen *mPrimaryScreen; QList mScreens; }; diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp index 86d16d3..3dcf5be 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -60,7 +60,9 @@ QDirectFbWindowSurface::QDirectFbWindowSurface } QDirectFbBlitter *blitter = new QDirectFbBlitter(window->rect(), m_dfbSurface); pmdata = new QBlittablePixmapData(QPixmapData::PixmapType); - pmdata->resize(window->width(),window->height()); + int width,height; + m_dfbSurface->GetSize(m_dfbSurface, &width, &height); + pmdata->resize(width,height); pmdata->setBlittable(blitter); m_pixmap = new QPixmap(pmdata); @@ -95,14 +97,10 @@ void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const void QDirectFbWindowSurface::setGeometry(const QRect &rect) { -// qDebug() << "QDirectF.bWindowSurface::setGeometry:" << (long)this << rect; - m_dfbSurface->Release(m_dfbSurface); QWindowSurface::setGeometry(rect); m_dfbWindow->SetBounds(m_dfbWindow, rect.x(),rect.y(), rect.width(), rect.height()); -// m_dfbWindow->Resize(m_dfbWindow,rect.width(),rect.height()); -// m_dfbWindow->MoveTo(m_dfbWindow,rect.x(),rect.y()); DFBResult result = m_dfbWindow->GetSurface(m_dfbWindow,&m_dfbSurface); if (result != DFB_OK) DirectFBError("QDirectFbWindowSurface::setGeometry() failed to retrieve new surface",result); -- cgit v0.12 From cd33927ac31c37ed3feb6a5a3be28d3d152bda19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 25 Nov 2009 10:54:54 +0100 Subject: Fix QBlittablePixmapData::fromImage There is still a stride problem when running the browser demo --- src/gui/image/qpixmap_blitter.cpp | 28 +++++++++++++++++----------- src/gui/image/qpixmap_blitter_p.h | 33 +-------------------------------- src/gui/image/qpixmapdata_p.h | 1 - 3 files changed, 18 insertions(+), 44 deletions(-) diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index 82e0045..35d6ddb 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -1,5 +1,7 @@ #include "qpixmap_blitter_p.h" +#include + #include #include @@ -14,10 +16,11 @@ QBlittablePixmapData::~QBlittablePixmapData() delete m_engine; } -QBlittable *QBlittablePixmapData::blittable() +QBlittable *QBlittablePixmapData::blittable() const { if (!m_blittable) { - m_blittable = QApplicationPrivate::graphicsSystem()->createBlittable(QRect(0,0,w,h)); + QBlittablePixmapData *that = const_cast(this); + that->m_blittable = QApplicationPrivate::graphicsSystem()->createBlittable(QRect(0,0,w,h)); } return m_blittable; @@ -73,32 +76,35 @@ int QBlittablePixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const void QBlittablePixmapData::fill(const QColor &color) { - if (m_blittable->capabilities() & QBlittable::SolidRectCapability) - m_blittable->fillRect(m_blittable->rect(),color); + if (blittable()->capabilities() & QBlittable::SolidRectCapability) + blittable()->fillRect(m_blittable->rect(),color); else - m_blittable->lock()->fill(color.rgb()); + blittable()->lock()->fill(color.rgb()); } QImage *QBlittablePixmapData::buffer() { - return m_blittable->lock(); + return blittable()->lock(); } QImage QBlittablePixmapData::toImage() const { - return m_blittable->lock()->copy(); + return blittable()->lock()->copy(); } bool QBlittablePixmapData::hasAlphaChannel() const { - return m_blittable->lock()->hasAlphaChannel(); + return blittable()->lock()->hasAlphaChannel(); } void QBlittablePixmapData::fromImage(const QImage &image, - Qt::ImageConversionFlags) + Qt::ImageConversionFlags flags) { - m_blittable = new QImageBlitter(image); - m_engine = 0; + resize(image.width(),image.height()); + QImage *thisImg = blittable()->lock(); + QPainter p(thisImg); + p.drawImage(0,0,image,flags); + } QPaintEngine *QBlittablePixmapData::paintEngine() const diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h index 5e01a12..ca834dc 100644 --- a/src/gui/image/qpixmap_blitter_p.h +++ b/src/gui/image/qpixmap_blitter_p.h @@ -4,37 +4,6 @@ #include #include -class QImageBlitter : public QBlittable -{ -public: - QImageBlitter(const QImage &img) - : QBlittable(img.rect(),0), image(img) - { - } - - void fillRect(const QRectF &, const QColor &) - { - //should never be called - } - void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) - { - //should never be called - } - -protected: - QImage *doLock() - { - return ℑ - } - - void doUnlock() - { - } - -private: - QImage image; -}; - class Q_GUI_EXPORT QBlittablePixmapData : public QPixmapData { // Q_DECLARE_PRIVATE(QBlittablePixmapData); @@ -42,7 +11,7 @@ public: QBlittablePixmapData(QPixmapData::PixelType type); ~QBlittablePixmapData(); - QBlittable *blittable(); + QBlittable *blittable() const; void setBlittable(QBlittable *blittable); void resize(int width, int height); diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h index a668f0a..292092f 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qpixmapdata_p.h @@ -137,7 +137,6 @@ private: friend class QX11PixmapData; friend class QS60PixmapData; friend class QImagePixmapCleanupHooks; // Needs to set is_cached - friend class QBlittablPixmapData; friend class QGLTextureCache; //Needs to check the reference count friend class QExplicitlySharedDataPointer; -- cgit v0.12 From 33e4969e7c7244943d48433cdb5ac086c517737a Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 25 Nov 2009 14:07:54 +0100 Subject: simplify QGraphicsSystemCursor, update vnc and testlite plugins --- src/gui/kernel/qwidget_lite.cpp | 13 ++++++---- src/gui/painting/qgraphicssystemcursor.cpp | 17 +++---------- src/gui/painting/qgraphicssystemcursor.h | 7 +++--- .../testlite/qgraphicssystem_testlite.cpp | 24 ++++--------------- src/plugins/graphicssystems/testlite/x11util.cpp | 1 + src/plugins/graphicssystems/vnc/qvnccursor.cpp | 28 +++++++--------------- src/plugins/graphicssystems/vnc/qvnccursor.h | 4 +--- 7 files changed, 30 insertions(+), 64 deletions(-) diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index 88df81f..0f4dec7 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -678,7 +678,7 @@ void qt_lite_set_cursor(QWidget * w, bool force) if (w == 0) { if (override) { if (QGraphicsSystemCursor::instance) { - QGraphicsSystemCursor::instance->changeCursor(override); + QGraphicsSystemCursor::instance->changeCursor(override, QApplication::topLevelAt(QCursor::pos())); } return; } @@ -692,10 +692,12 @@ void qt_lite_set_cursor(QWidget * w, bool force) w = lastUnderMouse; } - if (w == QApplication::desktop()) { + if (w == QApplication::desktop() && !override) { if (QGraphicsSystemCursor::instance) { - QGraphicsSystemCursor::instance->changeCursor(w); + QCursor c(Qt::ArrowCursor); + QGraphicsSystemCursor::instance->changeCursor(&c, w); } + return; } QWidget * curWin = QApplication::activeWindow(); @@ -704,11 +706,12 @@ void qt_lite_set_cursor(QWidget * w, bool force) QWidget* cW = w && !w->internalWinId() ? w : curWin; if (!cW || cW->window() != w->window() || - !cW->isVisible() || !cW->underMouse() || QApplication::overrideCursor()) + !cW->isVisible() || !cW->underMouse() || override) return; if (QGraphicsSystemCursor::instance) { - QGraphicsSystemCursor::instance->changeCursor(w); + QCursor c = w->cursor(); + QGraphicsSystemCursor::instance->changeCursor(&c, w); } } QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystemcursor.cpp b/src/gui/painting/qgraphicssystemcursor.cpp index cad914d..3afaf4b 100644 --- a/src/gui/painting/qgraphicssystemcursor.cpp +++ b/src/gui/painting/qgraphicssystemcursor.cpp @@ -104,12 +104,14 @@ QRect QGraphicsSystemCursor::getCurrentRect() void QGraphicsSystemCursor::pointerEvent(const QMouseEvent & e) { + Q_UNUSED(e); currentRect = getCurrentRect(); screen->setDirty(currentRect); } -void QGraphicsSystemCursor::changeCursor(QCursor * widgetCursor) +void QGraphicsSystemCursor::changeCursor(QCursor * widgetCursor, QWidget * widget) { + Q_UNUSED(widget); Qt::CursorShape shape = widgetCursor->shape(); if (shape == Qt::BitmapCursor) { @@ -126,19 +128,6 @@ void QGraphicsSystemCursor::changeCursor(QCursor * widgetCursor) screen->setDirty(currentRect); } -void QGraphicsSystemCursor::changeCursor(QWidget * widget) -{ - if (widget) { - QCursor widgetCursor = widget->cursor(); - changeCursor(&widgetCursor); - } else { - // default cursor - setCursor(Qt::ArrowCursor); - currentRect = getCurrentRect(); - screen->setDirty(currentRect); - } -} - // End of display and pointer event handling code // Beginning of built-in cursor graphics // from src/gui/embedded/QGraphicsSystemCursorImage_qws.cpp diff --git a/src/gui/painting/qgraphicssystemcursor.h b/src/gui/painting/qgraphicssystemcursor.h index ea30319..1e26db2 100644 --- a/src/gui/painting/qgraphicssystemcursor.h +++ b/src/gui/painting/qgraphicssystemcursor.h @@ -71,11 +71,8 @@ public: virtual ~QGraphicsSystemCursor(); // input methods - virtual void setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); - virtual void setCursor(Qt::CursorShape shape); virtual void pointerEvent(const QMouseEvent & event); - virtual void changeCursor(QWidget * widget); - virtual void changeCursor(QCursor * widgetCursor); + virtual void changeCursor(QCursor * widgetCursor, QWidget * widget); // output methods virtual QRect drawCursor(QPainter &); @@ -94,6 +91,8 @@ protected: QGraphicsSystemCursorImage * graphic; private: + void setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); + void setCursor(Qt::CursorShape shape); QRect getCurrentRect(); }; diff --git a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp index 64386b7..450905c 100644 --- a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp @@ -56,37 +56,23 @@ class MyCursor : QGraphicsSystemCursor public: MyCursor(QGraphicsSystemScreen *screen) : QGraphicsSystemCursor(screen) {} - // input methods - void setCursor(const uchar */*data*/, const uchar */*mask*/, int width, int height, int hotX, int hotY) {qDebug() << "setCursor data..." << width << height << hotX << hotY;} - - void setCursor(Qt::CursorShape shape) { - static int oldshape = -1; - if (shape != oldshape) { - qDebug() << "setCursor" << shape; QGraphicsSystemCursor::setCursor(shape); - oldshape = shape; - } - } - - void changeCursor(QWidget * widget) { - + void changeCursor(QCursor * cursor, QWidget * widget) { QTestLiteWindowSurface *ws = 0; if (widget) { QWidget *window = widget->window(); ws = static_cast(window->windowSurface()); + } else { + // No X11 cursor control when there is no widget under the cursor + return; } //qDebug() << "changeCursor" << widget << ws; if (!ws) return; - ws->setCursor(widget->cursor().shape()); + ws->setCursor(cursor->shape()); } -// void changeCursor(QCursor * widgetCursor) { -// //qDebug() << "changeCursor widgetCursor"; -// QGraphicsSystemCursor::changeCursor(widgetCursor); -// } - //#### remove this void pointerEvent(const QMouseEvent & event) { Q_UNUSED(event); diff --git a/src/plugins/graphicssystems/testlite/x11util.cpp b/src/plugins/graphicssystems/testlite/x11util.cpp index 5830550..e2fbd62 100644 --- a/src/plugins/graphicssystems/testlite/x11util.cpp +++ b/src/plugins/graphicssystems/testlite/x11util.cpp @@ -846,6 +846,7 @@ void MyWindow::setCursorShape(int cshape) cursors[cshape] = cursor; } XDefineCursor(xd->display, window, cursor); + XFlush(xd->display); } diff --git a/src/plugins/graphicssystems/vnc/qvnccursor.cpp b/src/plugins/graphicssystems/vnc/qvnccursor.cpp index aa0f109..55d1c61 100644 --- a/src/plugins/graphicssystems/vnc/qvnccursor.cpp +++ b/src/plugins/graphicssystems/vnc/qvnccursor.cpp @@ -58,36 +58,26 @@ QVNCCursor::QVNCCursor(QVNCServer * srvr, QVNCGraphicsSystemScreen *scr ) { } -void QVNCCursor::setCursorMode(bool vnc) +void QVNCCursor::changeCursor(QCursor * widgetCursor, QWidget * widget) { - if (vnc) { - screen->setDirty(prevRect); - prevRect = QRect(); - server->setDirtyCursor(); - } else { - server->setDirtyCursor(); - } - useVncCursor = vnc; -} - -void QVNCCursor::setCursor(Qt::CursorShape shape) -{ - QGraphicsSystemCursor::setCursor(shape); + QGraphicsSystemCursor::changeCursor(widgetCursor, widget); if (useVncCursor) { server->setDirtyCursor(); } else { - screen->setDirty(QRect(QRect(0,0,1,1))); + screen->setDirty(QRect(0,0,1,1)); } } -void QVNCCursor::setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) +void QVNCCursor::setCursorMode(bool vnc) { - QGraphicsSystemCursor::setCursor(data, mask, width, height, hotX, hotY); - if (useVncCursor) { + if (vnc) { + screen->setDirty(prevRect); + prevRect = QRect(); server->setDirtyCursor(); } else { - screen->setDirty(QRect(0,0,1,1)); + server->setDirtyCursor(); } + useVncCursor = vnc; } QRect QVNCCursor::drawCursor(QPainter & painter) diff --git a/src/plugins/graphicssystems/vnc/qvnccursor.h b/src/plugins/graphicssystems/vnc/qvnccursor.h index 1a53da7..a90b7e2 100644 --- a/src/plugins/graphicssystems/vnc/qvnccursor.h +++ b/src/plugins/graphicssystems/vnc/qvnccursor.h @@ -57,9 +57,7 @@ public: // input methods void setCursorMode(bool vnc); - void setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); - void setCursor(Qt::CursorShape shape); - + void changeCursor(QCursor * widgetCursor, QWidget * widget); // output methods QRect drawCursor(QPainter &); -- cgit v0.12 From a684c3429445ca88736ac8065a9d7ecfe58f3857 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 25 Nov 2009 15:02:50 +0100 Subject: QGraphicsSystemCursor::getInstance() method to replace direct instance pointer access --- src/gui/kernel/qapplication_lite.cpp | 5 +++-- src/gui/kernel/qwidget_lite.cpp | 20 +++++++++----------- src/gui/painting/qgraphicssystemcursor.h | 4 +++- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index cdaa855..a42bfd7 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -526,8 +526,9 @@ void QApplicationPrivate::handleMouseEvent(QWidget *tlw, const QMouseEvent &ev) static QWidget *implicit_mouse_grabber=0; - if (QGraphicsSystemCursor::instance) - QGraphicsSystemCursor::instance->pointerEvent(ev); + QPointer cursor = QGraphicsSystemCursor::getInstance(); + if (cursor) + cursor->pointerEvent(ev); QPoint localPoint = ev.pos(); QPoint globalPoint = ev.globalPos(); diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index 0f4dec7..5a629c0 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -675,11 +675,13 @@ void qt_lite_set_cursor(QWidget * w, bool force) if (override && w != 0) return; + QPointer cursor = QGraphicsSystemCursor::getInstance(); + if (!cursor) + return; + if (w == 0) { if (override) { - if (QGraphicsSystemCursor::instance) { - QGraphicsSystemCursor::instance->changeCursor(override, QApplication::topLevelAt(QCursor::pos())); - } + cursor->changeCursor(override, QApplication::topLevelAt(QCursor::pos())); return; } w = QApplication::widgetAt(QCursor::pos()); @@ -693,10 +695,8 @@ void qt_lite_set_cursor(QWidget * w, bool force) } if (w == QApplication::desktop() && !override) { - if (QGraphicsSystemCursor::instance) { - QCursor c(Qt::ArrowCursor); - QGraphicsSystemCursor::instance->changeCursor(&c, w); - } + QCursor c(Qt::ArrowCursor); + cursor->changeCursor(&c, w); return; } @@ -709,9 +709,7 @@ void qt_lite_set_cursor(QWidget * w, bool force) !cW->isVisible() || !cW->underMouse() || override) return; - if (QGraphicsSystemCursor::instance) { - QCursor c = w->cursor(); - QGraphicsSystemCursor::instance->changeCursor(&c, w); - } + QCursor c = w->cursor(); + cursor->changeCursor(&c, w); } QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystemcursor.h b/src/gui/painting/qgraphicssystemcursor.h index 1e26db2..f4d911f 100644 --- a/src/gui/painting/qgraphicssystemcursor.h +++ b/src/gui/painting/qgraphicssystemcursor.h @@ -78,9 +78,10 @@ public: virtual QRect drawCursor(QPainter &); virtual QRect dirtyRect(); - static QPointer instance; + static QPointer getInstance() { return instance; } protected: + static QPointer instance; QRect currentRect; // next place to draw the cursor QRect prevRect; // last place the cursor was drawn @@ -91,6 +92,7 @@ protected: QGraphicsSystemCursorImage * graphic; private: + void setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); void setCursor(Qt::CursorShape shape); QRect getCurrentRect(); -- cgit v0.12 From 19039afd151f2c2401659904b89968d302149493 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Thu, 26 Nov 2009 12:53:59 +0100 Subject: remove an unused member from QGraphicsSystemCursor --- src/gui/painting/qgraphicssystemcursor.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/painting/qgraphicssystemcursor.h b/src/gui/painting/qgraphicssystemcursor.h index f4d911f..d385ac0 100644 --- a/src/gui/painting/qgraphicssystemcursor.h +++ b/src/gui/painting/qgraphicssystemcursor.h @@ -87,7 +87,6 @@ protected: QRect prevRect; // last place the cursor was drawn QGraphicsSystemScreen * screen; // Where to request an update - QWidget * currentWidget; // widget currently under the cursor QGraphicsSystemCursorImage * graphic; -- cgit v0.12 From c290785d0f8e1ef7af4bdff683aab40b8ff33681 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Thu, 26 Nov 2009 13:39:06 +0100 Subject: move software cursor from QGraphicsSystemCursor into QGraphicsSystemSoftwareCursor --- src/gui/painting/qgraphicssystemcursor.cpp | 72 +-------------------- src/gui/painting/qgraphicssystemcursor.h | 24 ++----- src/plugins/graphicssystems/fb_base/fb_base.cpp | 74 +++++++++++++++++++++- src/plugins/graphicssystems/fb_base/fb_base.h | 26 +++++++- .../linuxfb/qgraphicssystem_linuxfb.cpp | 2 +- .../testlite/qgraphicssystem_testlite.cpp | 8 --- src/plugins/graphicssystems/vnc/qvnccursor.cpp | 12 ++-- src/plugins/graphicssystems/vnc/qvnccursor.h | 5 +- 8 files changed, 111 insertions(+), 112 deletions(-) diff --git a/src/gui/painting/qgraphicssystemcursor.cpp b/src/gui/painting/qgraphicssystemcursor.cpp index 3afaf4b..022dc64 100644 --- a/src/gui/painting/qgraphicssystemcursor.cpp +++ b/src/gui/painting/qgraphicssystemcursor.cpp @@ -53,79 +53,9 @@ QT_BEGIN_NAMESPACE QPointer QGraphicsSystemCursor::instance = 0; QGraphicsSystemCursor::QGraphicsSystemCursor(QGraphicsSystemScreen *scr ) - :currentRect(QRect()), prevRect(QRect()), screen(scr) + : screen(scr) { - graphic = new QGraphicsSystemCursorImage(0, 0, 0, 0, 0, 0); instance = this; - setCursor(Qt::ArrowCursor); -} - -QGraphicsSystemCursor::~QGraphicsSystemCursor() -{ -} - -void QGraphicsSystemCursor::setCursor(Qt::CursorShape shape) -{ - graphic->set(shape); -} - -void QGraphicsSystemCursor::setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) -{ - graphic->set(data, mask, width, height, hotX, hotY); -} - -QRect QGraphicsSystemCursor::dirtyRect() -{ - if (!prevRect.isNull()) { - QRect rect = prevRect; - prevRect = QRect(); - return rect; - } - return QRect(); -} - -QRect QGraphicsSystemCursor::drawCursor(QPainter & painter) -{ - if (currentRect.isNull()) - return QRect(); - - prevRect = currentRect; - painter.drawImage(prevRect, *graphic->image()); - return prevRect; -} - -QRect QGraphicsSystemCursor::getCurrentRect() -{ - QRect rect = graphic->image()->rect().translated(-graphic->hotspot().x(), - -graphic->hotspot().y()); - rect.translate(QCursor::pos()); - return rect; -} - -void QGraphicsSystemCursor::pointerEvent(const QMouseEvent & e) -{ - Q_UNUSED(e); - currentRect = getCurrentRect(); - screen->setDirty(currentRect); -} - -void QGraphicsSystemCursor::changeCursor(QCursor * widgetCursor, QWidget * widget) -{ - Q_UNUSED(widget); - Qt::CursorShape shape = widgetCursor->shape(); - - if (shape == Qt::BitmapCursor) { - // application supplied cursor - const QBitmap * map = widgetCursor->bitmap(); - const QBitmap * mask = widgetCursor->mask(); - QPoint spot = widgetCursor->hotSpot(); - setCursor(map->toImage().bits(), mask->toImage().bits(), map->width(), map->height(), spot.x(), spot.y()); - } else { - // system cursor - setCursor(shape); - } - currentRect = getCurrentRect(); - screen->setDirty(currentRect); } // End of display and pointer event handling code diff --git a/src/gui/painting/qgraphicssystemcursor.h b/src/gui/painting/qgraphicssystemcursor.h index d385ac0..42727a8 100644 --- a/src/gui/painting/qgraphicssystemcursor.h +++ b/src/gui/painting/qgraphicssystemcursor.h @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE // Cursor graphics management -class QGraphicsSystemCursorImage { +class Q_GUI_EXPORT QGraphicsSystemCursorImage { public: QGraphicsSystemCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) { set(data, mask, width, height, hotX, hotY); } @@ -68,33 +68,17 @@ private: class Q_GUI_EXPORT QGraphicsSystemCursor : public QObject { public: QGraphicsSystemCursor(QGraphicsSystemScreen *); - virtual ~QGraphicsSystemCursor(); // input methods - virtual void pointerEvent(const QMouseEvent & event); - virtual void changeCursor(QCursor * widgetCursor, QWidget * widget); - - // output methods - virtual QRect drawCursor(QPainter &); - virtual QRect dirtyRect(); + virtual void pointerEvent(const QMouseEvent & event) { Q_UNUSED(event); } + virtual void changeCursor(QCursor * widgetCursor, QWidget * widget) = 0; static QPointer getInstance() { return instance; } protected: - static QPointer instance; - - QRect currentRect; // next place to draw the cursor - QRect prevRect; // last place the cursor was drawn + static QPointer instance; // limit 1 cursor at a time QGraphicsSystemScreen * screen; // Where to request an update - - QGraphicsSystemCursorImage * graphic; - -private: - - void setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); - void setCursor(Qt::CursorShape shape); - QRect getCurrentRect(); }; QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/fb_base/fb_base.cpp b/src/plugins/graphicssystems/fb_base/fb_base.cpp index 6ecfd1b..27cb8a4 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.cpp +++ b/src/plugins/graphicssystems/fb_base/fb_base.cpp @@ -3,9 +3,81 @@ #include #include #include - +#include #include +QGraphicsSystemSoftwareCursor::QGraphicsSystemSoftwareCursor(QGraphicsSystemScreen *scr) + : QGraphicsSystemCursor(scr), currentRect(QRect()), prevRect(QRect()) +{ + graphic = new QGraphicsSystemCursorImage(0, 0, 0, 0, 0, 0); + setCursor(Qt::ArrowCursor); +} + +QRect QGraphicsSystemSoftwareCursor::getCurrentRect() +{ + QRect rect = graphic->image()->rect().translated(-graphic->hotspot().x(), + -graphic->hotspot().y()); + rect.translate(QCursor::pos()); + return rect; +} + + +void QGraphicsSystemSoftwareCursor::pointerEvent(const QMouseEvent & e) +{ + Q_UNUSED(e); + currentRect = getCurrentRect(); + screen->setDirty(currentRect); +} + +QRect QGraphicsSystemSoftwareCursor::drawCursor(QPainter & painter) +{ + if (currentRect.isNull()) + return QRect(); + + prevRect = currentRect; + painter.drawImage(prevRect, *graphic->image()); + return prevRect; +} + +QRect QGraphicsSystemSoftwareCursor::dirtyRect() +{ + if (!prevRect.isNull()) { + QRect rect = prevRect; + prevRect = QRect(); + return rect; + } + return QRect(); +} + +void QGraphicsSystemSoftwareCursor::setCursor(Qt::CursorShape shape) +{ + graphic->set(shape); +} + +void QGraphicsSystemSoftwareCursor::setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) +{ + graphic->set(data, mask, width, height, hotX, hotY); +} + +void QGraphicsSystemSoftwareCursor::changeCursor(QCursor * widgetCursor, QWidget * widget) +{ + Q_UNUSED(widget); + Qt::CursorShape shape = widgetCursor->shape(); + + if (shape == Qt::BitmapCursor) { + // application supplied cursor + const QBitmap * map = widgetCursor->bitmap(); + const QBitmap * mask = widgetCursor->mask(); + QPoint spot = widgetCursor->hotSpot(); + setCursor(map->toImage().bits(), mask->toImage().bits(), map->width(), map->height(), spot.x(), spot.y()); + } else { + // system cursor + setCursor(shape); + } + currentRect = getCurrentRect(); + screen->setDirty(currentRect); +} + QGraphicsSystemFbScreen::QGraphicsSystemFbScreen() : cursor(0), mGeometry(), mDepth(16), mFormat(QImage::Format_RGB16), mScreenImage(0) { mScreenImage = new QImage(mGeometry.size(), mFormat); diff --git a/src/plugins/graphicssystems/fb_base/fb_base.h b/src/plugins/graphicssystems/fb_base/fb_base.h index 8e54f47..9abd5d0 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.h +++ b/src/plugins/graphicssystems/fb_base/fb_base.h @@ -15,6 +15,30 @@ class QPainter; class QGraphicsSystemFbWindowSurface; class QGraphicsSystemFbScreen; +class QGraphicsSystemSoftwareCursor : public QGraphicsSystemCursor +{ +public: + QGraphicsSystemSoftwareCursor(QGraphicsSystemScreen * scr); + + // output methods + QRect dirtyRect(); + virtual QRect drawCursor(QPainter & painter); + + // input methods + virtual void pointerEvent(const QMouseEvent & event); + virtual void changeCursor(QCursor * widgetCursor, QWidget * widget); + +protected: + QGraphicsSystemCursorImage * graphic; + +private: + void setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); + void setCursor(Qt::CursorShape shape); + QRect currentRect; // next place to draw the cursor + QRect prevRect; // last place the cursor was drawn + QRect getCurrentRect(); +}; + class QGraphicsSystemFbWindowSurface : public QWindowSurface { public: @@ -74,7 +98,7 @@ public: protected: QList windowStack; QRegion repaintRegion; - QGraphicsSystemCursor * cursor; + QGraphicsSystemSoftwareCursor * cursor; QTimer redrawTimer; protected slots: diff --git a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp index 2a0007b..f5ca6e7 100644 --- a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp +++ b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp @@ -807,7 +807,7 @@ QLinuxFbGraphicsSystemScreen::QLinuxFbGraphicsSystemScreen(uchar * d, int w, mFormat); mFbScreenImage = new QImage(data, mGeometry.width(), mGeometry.height(), bytesPerLine, mFormat); - cursor = new QGraphicsSystemCursor(this); + cursor = new QGraphicsSystemSoftwareCursor(this); } void QLinuxFbGraphicsSystemScreen::setGeometry(QRect rect) diff --git a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp index 450905c..bdcac37 100644 --- a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp @@ -72,14 +72,6 @@ public: ws->setCursor(cursor->shape()); } - - //#### remove this - void pointerEvent(const QMouseEvent & event) { - Q_UNUSED(event); -#if 0 - qDebug() << "pointerEvent" << event.globalPos(); -#endif - } }; diff --git a/src/plugins/graphicssystems/vnc/qvnccursor.cpp b/src/plugins/graphicssystems/vnc/qvnccursor.cpp index 55d1c61..fb214d8 100644 --- a/src/plugins/graphicssystems/vnc/qvnccursor.cpp +++ b/src/plugins/graphicssystems/vnc/qvnccursor.cpp @@ -54,13 +54,13 @@ QT_BEGIN_NAMESPACE QVNCCursor::QVNCCursor(QVNCServer * srvr, QVNCGraphicsSystemScreen *scr ) - :QGraphicsSystemCursor::QGraphicsSystemCursor(scr), useVncCursor(false), server(srvr) + :QGraphicsSystemSoftwareCursor(scr), useVncCursor(false), server(srvr) { } void QVNCCursor::changeCursor(QCursor * widgetCursor, QWidget * widget) { - QGraphicsSystemCursor::changeCursor(widgetCursor, widget); + QGraphicsSystemSoftwareCursor::changeCursor(widgetCursor, widget); if (useVncCursor) { server->setDirtyCursor(); } else { @@ -71,8 +71,7 @@ void QVNCCursor::changeCursor(QCursor * widgetCursor, QWidget * widget) void QVNCCursor::setCursorMode(bool vnc) { if (vnc) { - screen->setDirty(prevRect); - prevRect = QRect(); + screen->setDirty(dirtyRect()); server->setDirtyCursor(); } else { server->setDirtyCursor(); @@ -85,10 +84,7 @@ QRect QVNCCursor::drawCursor(QPainter & painter) if (useVncCursor) return QRect(); - if (currentRect.isNull()) - return QRect(); - - return QGraphicsSystemCursor::drawCursor(painter); + return QGraphicsSystemSoftwareCursor::drawCursor(painter); } void QVNCCursor::clearClientCursor() diff --git a/src/plugins/graphicssystems/vnc/qvnccursor.h b/src/plugins/graphicssystems/vnc/qvnccursor.h index a90b7e2..8ea0f45 100644 --- a/src/plugins/graphicssystems/vnc/qvnccursor.h +++ b/src/plugins/graphicssystems/vnc/qvnccursor.h @@ -41,7 +41,7 @@ #ifndef QVNCCURSOR_H #define QVNCCURSOR_H -#include "qgraphicssystemcursor.h" +#include "../fb_base/fb_base.h" #include #include #include @@ -51,13 +51,14 @@ QT_BEGIN_NAMESPACE class QVNCGraphicsSystemScreen; class QVNCServer; -class QVNCCursor : public QGraphicsSystemCursor { +class QVNCCursor : public QGraphicsSystemSoftwareCursor { public: QVNCCursor(QVNCServer *, QVNCGraphicsSystemScreen *); // input methods void setCursorMode(bool vnc); void changeCursor(QCursor * widgetCursor, QWidget * widget); + // output methods QRect drawCursor(QPainter &); -- cgit v0.12 From 55fc5c3bbb6c1f7d16f26459f66922af7961642d Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Thu, 26 Nov 2009 14:49:34 +0100 Subject: added some documentation for QGraphicsSystemCursor --- src/gui/painting/qgraphicssystemcursor.cpp | 44 +++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qgraphicssystemcursor.cpp b/src/gui/painting/qgraphicssystemcursor.cpp index 022dc64..3fc836d 100644 --- a/src/gui/painting/qgraphicssystemcursor.cpp +++ b/src/gui/painting/qgraphicssystemcursor.cpp @@ -39,7 +39,6 @@ ** ****************************************************************************/ #include "qgraphicssystemcursor.h" -//#include "qlighthousegraphicsscreen.h" #include #include @@ -52,6 +51,49 @@ QT_BEGIN_NAMESPACE QPointer QGraphicsSystemCursor::instance = 0; +/*! + \class QGraphicsSystemCursor + + \brief The QGraphicsSystemCursor class provides information about + pointer device events (movement, buttons), and requests to change + the currently displayed cursor. + + Note that QGraphicsSystemCursor does not include any graphics for + display. An application that sets a QCursor may provide its own + graphics. + + \sa QGraphicsSystemCursorImage +*/ + +/*! + \fn virtual void pointerEvent(const QMouseEvent & event) + + This method is called by Qt whenever a QMouseEvent is generated by the + underlying pointer input. \a event is a reference to the QMouseEvent in + question. A default do-nothing implementation is provided. + + \sa QApplicationPrivate::handleMouseEvent() +*/ + +/*! + \fn virtual void changeCursor(QCursor * widgetCursor, QWidget * widget) + + \brief This method is called by Qt whenever the cursor graphic should be changed. + + Implementation of this method is mandatory for a subclass of QGraphicsSystemCursor. + + \a widgetCursor is a pointer to the QCursor that should be displayed. + + \a widget is a pointer to the widget currently displayed at QCursor::pos(). Note + that this may be 0 if the current position is not occupied by a displayed widget. + + \sa QApplicationPrivate::handleMouseEvent(), QCursor::pos() +*/ + +/*! + Constructs a QGraphicsSystemCursor + +*/ QGraphicsSystemCursor::QGraphicsSystemCursor(QGraphicsSystemScreen *scr ) : screen(scr) { -- cgit v0.12 From de3fbd3316797e73a67fbd1a0f7191c66ab88233 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 26 Nov 2009 17:01:25 +0100 Subject: Implement setWindowTitle() on Lighthouse --- src/gui/kernel/qwidget_lite.cpp | 9 +++++++-- src/gui/painting/qwindowsurface_p.h | 1 + .../testlite/qwindowsurface_testlite.cpp | 4 ++++ .../graphicssystems/testlite/qwindowsurface_testlite.h | 1 + src/plugins/graphicssystems/testlite/x11util.cpp | 18 ++++++++++++++++++ src/plugins/graphicssystems/testlite/x11util.h | 2 ++ 6 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index 5a629c0..8601855 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -187,8 +187,13 @@ void QWidgetPrivate::updateCursor() const void QWidgetPrivate::setWindowTitle_sys(const QString &caption) { - Q_UNUSED(caption); - // XXX + Q_Q(QWidget); + if (!q->isWindow()) + return; + + if (QWindowSurface *surface = q->windowSurface()) + surface->setWindowTitle(caption); + } void QWidgetPrivate::setWindowIcon_sys(bool /*forceReset*/) diff --git a/src/gui/painting/qwindowsurface_p.h b/src/gui/painting/qwindowsurface_p.h index 5e95d80..1c0334c 100644 --- a/src/gui/painting/qwindowsurface_p.h +++ b/src/gui/painting/qwindowsurface_p.h @@ -95,6 +95,7 @@ public: virtual Qt::WindowFlags windowFlags() const; virtual WId winId() const; + virtual void setWindowTitle(const QString &) {} virtual void raise() { qWarning("This plugin does not support raise()"); } virtual void lower() { qWarning("This plugin does not support lower()"); } #endif diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp index 495b572..13dbae1 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp @@ -590,6 +590,10 @@ void QTestLiteWindowSurface::lower() XLowerWindow(mGraphicsSystem->xd->display, window); } +void QTestLiteWindowSurface::setWindowTitle(const QString &title) +{ + xw->setWindowTitle(title); +} void QTestLiteWindowSurface::setCursor(Qt::CursorShape shape) { diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h index cedd66c..43d1b23 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h @@ -81,6 +81,7 @@ public: WId winId() const; void raise(); void lower(); + void setWindowTitle(const QString &title); void setCursor(Qt::CursorShape shape); diff --git a/src/plugins/graphicssystems/testlite/x11util.cpp b/src/plugins/graphicssystems/testlite/x11util.cpp index e2fbd62..8c0b6c1 100644 --- a/src/plugins/graphicssystems/testlite/x11util.cpp +++ b/src/plugins/graphicssystems/testlite/x11util.cpp @@ -397,6 +397,24 @@ MyWindow::MyWindow(MyDisplay *display, int x, int y, int w, int h) wmProtocolsAtom, XA_ATOM, 32, PropModeAppend, (unsigned char *) &wmDeleteWindowAtom, 1); + + + setWindowTitle(QLatin1String("Qt Lighthouse")); + +} + + +void MyWindow::setWindowTitle(const QString &title) + +{ + QByteArray ba = title.toLatin1(); //We're not making a general solution here... + XTextProperty windowName; + windowName.value = (unsigned char *)ba.constData(); + windowName.encoding = XA_STRING; + windowName.format = 8; + windowName.nitems = ba.length(); + + XSetWMName(xd->display, window, &windowName); } MyWindow::~MyWindow() diff --git a/src/plugins/graphicssystems/testlite/x11util.h b/src/plugins/graphicssystems/testlite/x11util.h index e9d4c7b..fc88297 100644 --- a/src/plugins/graphicssystems/testlite/x11util.h +++ b/src/plugins/graphicssystems/testlite/x11util.h @@ -111,6 +111,8 @@ public: void setVisible(bool visible); void setCursorShape(int cshape); + void setWindowTitle(const QString &title); + public: //### int xpos, ypos; -- cgit v0.12 From b699cdad144e0a23f1dabf26c05fde2f4e3ec6f9 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Fri, 4 Dec 2009 13:37:02 +0100 Subject: caching of X11 cursors, with an expiration after 3 seconds This also contains a stub for Qt::BitmapCursor cursors. Conversion to the X11 bitmap format is missing. --- .../testlite/qgraphicssystem_testlite.cpp | 2 +- .../testlite/qwindowsurface_testlite.cpp | 4 +- .../testlite/qwindowsurface_testlite.h | 2 +- src/plugins/graphicssystems/testlite/x11util.cpp | 273 ++++++++++++++++----- src/plugins/graphicssystems/testlite/x11util.h | 61 ++++- 5 files changed, 282 insertions(+), 60 deletions(-) diff --git a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp index bdcac37..72d364a 100644 --- a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp @@ -70,7 +70,7 @@ public: if (!ws) return; - ws->setCursor(cursor->shape()); + ws->setCursor(cursor); } }; diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp index 13dbae1..fde54a1 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp @@ -595,8 +595,8 @@ void QTestLiteWindowSurface::setWindowTitle(const QString &title) xw->setWindowTitle(title); } -void QTestLiteWindowSurface::setCursor(Qt::CursorShape shape) +void QTestLiteWindowSurface::setCursor(QCursor *cursor) { - xw->setCursorShape(shape); + xw->setCursor(cursor); } QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h index 43d1b23..9f9f052 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h @@ -83,7 +83,7 @@ public: void lower(); void setWindowTitle(const QString &title); - void setCursor(Qt::CursorShape shape); + void setCursor(QCursor * cursor); private: QTestLiteGraphicsSystem *mGraphicsSystem; diff --git a/src/plugins/graphicssystems/testlite/x11util.cpp b/src/plugins/graphicssystems/testlite/x11util.cpp index 8c0b6c1..1a421e8 100644 --- a/src/plugins/graphicssystems/testlite/x11util.cpp +++ b/src/plugins/graphicssystems/testlite/x11util.cpp @@ -57,6 +57,10 @@ #include +#include +#include +#include +#include //### remove stuff we don't want from qt_x11_p.h #undef ATOM @@ -325,6 +329,7 @@ MyDisplay::MyDisplay() wmProtocolsAtom = XInternAtom (display, "WM_PROTOCOLS", False); wmDeleteWindowAtom = XInternAtom (display, "WM_DELETE_WINDOW", False); + cursors = new MyX11Cursors(display); } @@ -401,6 +406,7 @@ MyWindow::MyWindow(MyDisplay *display, int x, int y, int w, int h) setWindowTitle(QLatin1String("Qt Lighthouse")); + currentCursor = -1; } @@ -802,71 +808,228 @@ void MyWindow::setVisible(bool visible) XUnmapWindow(xd->display, window); } +MyX11Cursors::MyX11Cursors(Display * d) : firstExpired(0), lastExpired(0), display(d), removalDelay(3) +{ + connect(&timer, SIGNAL(timeout()), this, SLOT(timeout())); +} -void MyWindow::setCursorShape(int cshape) +void MyX11Cursors::insertNode(MyX11CursorNode * node) { - if (cshape < 0 || cshape > Qt::LastCursor) - return; + QDateTime now = QDateTime::currentDateTime(); + QDateTime timeout = now.addSecs(removalDelay); + node->setExpiration(timeout); + node->setPost(0); + if (lastExpired) { + lastExpired->setPost(node); + node->setAnte(lastExpired); + } + lastExpired = node; + if (!firstExpired) { + firstExpired = node; + node->setAnte(0); + int interval = removalDelay * 1000; + timer.setInterval(interval); + timer.start(); + } +} - static Cursor cursors[Qt::LastCursor+1] = {XNone}; +void MyX11Cursors::removeNode(MyX11CursorNode * node) +{ + MyX11CursorNode *pre = node->ante(); + MyX11CursorNode *post = node->post(); + if (pre) + pre->setPost(post); + if (post) + post->setAnte(pre); + if (node == lastExpired) + lastExpired = pre; + if (node == firstExpired) { + firstExpired = post; + if (!firstExpired) { + timer.stop(); + return; + } + int interval = QDateTime::currentDateTime().secsTo(firstExpired->expiration()) * 1000; + timer.stop(); + timer.setInterval(interval); + timer.start(); + } +} - Cursor cursor = cursors[cshape]; - if (!cursor) { - switch (cshape) { - case Qt::ArrowCursor: - cursor = XCreateFontCursor(xd->display, XC_left_ptr); - break; - case Qt::UpArrowCursor: - cursor = XCreateFontCursor(xd->display, XC_center_ptr); - break; - case Qt::CrossCursor: - cursor = XCreateFontCursor(xd->display, XC_crosshair); - break; - case Qt::WaitCursor: - cursor = XCreateFontCursor(xd->display, XC_watch); - break; - case Qt::IBeamCursor: - cursor = XCreateFontCursor(xd->display, XC_xterm); - break; - case Qt::SizeAllCursor: - cursor = XCreateFontCursor(xd->display, XC_fleur); - break; - case Qt::PointingHandCursor: - cursor = XCreateFontCursor(xd->display, XC_hand2); - break; - case Qt::SizeBDiagCursor: - cursor = XCreateFontCursor(xd->display, XC_top_right_corner); - break; - case Qt::SizeFDiagCursor: - cursor = XCreateFontCursor(xd->display, XC_bottom_right_corner); - break; - case Qt::SizeVerCursor: - case Qt::SplitVCursor: - cursor = XCreateFontCursor(xd->display, XC_sb_v_double_arrow); - break; - case Qt::SizeHorCursor: - case Qt::SplitHCursor: - cursor = XCreateFontCursor(xd->display, XC_sb_h_double_arrow); - break; - case Qt::WhatsThisCursor: - cursor = XCreateFontCursor(xd->display, XC_question_arrow); - break; - case Qt::ForbiddenCursor: - cursor = XCreateFontCursor(xd->display, XC_circle); - break; - case Qt::BusyCursor: - cursor = XCreateFontCursor(xd->display, XC_watch); - break; +void MyX11Cursors::incrementUseCount(int id) +{ + MyX11CursorNode * node = lookupMap.value(id); + Q_ASSERT(node); + if (!node->refCount) + removeNode(node); + node->refCount++; +} - default: //default cursor for all the rest - break; +void MyX11Cursors::decrementUseCount(int id) +{ + MyX11CursorNode * node = lookupMap.value(id); + Q_ASSERT(node); + node->refCount--; + if (!node->refCount) + insertNode(node); +} + +void MyX11Cursors::createNode(int id, Cursor c) +{ + MyX11CursorNode * node = new MyX11CursorNode(id, c); + lookupMap.insert(id, node); +} + +void MyX11Cursors::timeout() +{ + MyX11CursorNode * node; + node = firstExpired; + QDateTime now = QDateTime::currentDateTime(); + while (node && now.secsTo(node->expiration()) < 1) { + Cursor c = node->cursor(); + int id = node->id(); + lookupMap.take(id); + MyX11CursorNode * tmp = node; + node = node->post(); + delete tmp; + XFreeCursor(display, c); + } + firstExpired = node; + if (node == 0) { + timer.stop(); + lastExpired = 0; + } + else { + int interval = QDateTime::currentDateTime().secsTo(firstExpired->expiration()) * 1000; + timer.setInterval(interval); + timer.start(); + } +} + +Cursor MyX11Cursors::cursor(int id) +{ + MyX11CursorNode * node = lookupMap.value(id); + Q_ASSERT(node); + return node->cursor(); +} + +void MyWindow::setCursor(QCursor * cursor) +{ + int id = cursor->handle(); + if (id == currentCursor) + return; + Cursor c; + if (!xd->cursors->exists(id)) { + if (cursor->shape() == Qt::BitmapCursor) + c = createCursorBitmap(cursor); + else + c = createCursorShape(cursor->shape()); + if (!c) { + return; } - cursors[cshape] = cursor; + xd->cursors->createNode(id, c); + } else { + xd->cursors->incrementUseCount(id); + c = xd->cursors->cursor(id); } - XDefineCursor(xd->display, window, cursor); + + if (currentCursor != -1) + xd->cursors->decrementUseCount(currentCursor); + currentCursor = id; + + XDefineCursor(xd->display, window, c); XFlush(xd->display); } +Cursor MyWindow::createCursorBitmap(QCursor * cursor) +{ +/* + XColor bg, fg; + bg.red = 255 << 8; + bg.green = 255 << 8; + bg.blue = 255 << 8; + fg.red = 0; + fg.green = 0; + fg.blue = 0; + QPoint spot = cursor->hotSpot(); + Window rootwin = window; + + const QBitmap * map = cursor->bitmap(); + char * mapBits = reinterpret_cast(map->toImage().bits()); + const QBitmap * mask = cursor->mask(); + char * maskBits = reinterpret_cast(mask->toImage().bits()); + + Pixmap cp = XCreateBitmapFromData(xd->display, rootwin, mapBits, map->width(), map->height()); + Pixmap mp = XCreateBitmapFromData(xd->display, rootwin, maskBits, map->width(), map->height()); + Cursor c = XCreatePixmapCursor(xd->display, cp, mp, &fg, &bg, spot.x(), spot.y()); + XFreePixmap(xd->display, cp); + XFreePixmap(xd->display, mp); + + return c; +*/ + // correct pixmap cursor parsing not implemented yet + return createCursorShape(Qt::ArrowCursor); +} + +Cursor MyWindow::createCursorShape(int cshape) +{ + Cursor cursor = 0; + + if (cshape < 0 || cshape > Qt::LastCursor) + return 0; + + switch (cshape) { + case Qt::ArrowCursor: + cursor = XCreateFontCursor(xd->display, XC_left_ptr); + break; + case Qt::UpArrowCursor: + cursor = XCreateFontCursor(xd->display, XC_center_ptr); + break; + case Qt::CrossCursor: + cursor = XCreateFontCursor(xd->display, XC_crosshair); + break; + case Qt::WaitCursor: + cursor = XCreateFontCursor(xd->display, XC_watch); + break; + case Qt::IBeamCursor: + cursor = XCreateFontCursor(xd->display, XC_xterm); + break; + case Qt::SizeAllCursor: + cursor = XCreateFontCursor(xd->display, XC_fleur); + break; + case Qt::PointingHandCursor: + cursor = XCreateFontCursor(xd->display, XC_hand2); + break; + case Qt::SizeBDiagCursor: + cursor = XCreateFontCursor(xd->display, XC_top_right_corner); + break; + case Qt::SizeFDiagCursor: + cursor = XCreateFontCursor(xd->display, XC_bottom_right_corner); + break; + case Qt::SizeVerCursor: + case Qt::SplitVCursor: + cursor = XCreateFontCursor(xd->display, XC_sb_v_double_arrow); + break; + case Qt::SizeHorCursor: + case Qt::SplitHCursor: + cursor = XCreateFontCursor(xd->display, XC_sb_h_double_arrow); + break; + case Qt::WhatsThisCursor: + cursor = XCreateFontCursor(xd->display, XC_question_arrow); + break; + case Qt::ForbiddenCursor: + cursor = XCreateFontCursor(xd->display, XC_circle); + break; + case Qt::BusyCursor: + cursor = XCreateFontCursor(xd->display, XC_watch); + break; + + default: //default cursor for all the rest + break; + } + return cursor; +} + #if 0 diff --git a/src/plugins/graphicssystems/testlite/x11util.h b/src/plugins/graphicssystems/testlite/x11util.h index fc88297..2a73f3e 100644 --- a/src/plugins/graphicssystems/testlite/x11util.h +++ b/src/plugins/graphicssystems/testlite/x11util.h @@ -44,6 +44,8 @@ #include #include +#include +#include #include @@ -52,6 +54,7 @@ class MyWindow; +class MyX11Cursors; class MyDisplay : public QObject { @@ -77,6 +80,8 @@ public: //### int physicalHeight; QList windowList; + + MyX11Cursors * cursors; }; class QTestLiteWindowSurface; //### abstract callback interface, anyone? @@ -109,7 +114,9 @@ public: Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); void setVisible(bool visible); - void setCursorShape(int cshape); + void setCursor(QCursor * cursor); + Cursor createCursorShape(int cshape); + Cursor createCursorBitmap(QCursor * cursor); void setWindowTitle(const QString &title); @@ -123,10 +130,62 @@ public: //### GC gc; QTestLiteWindowSurface *windowSurface; + + int currentCursor; +}; + +class MyX11CursorNode +{ +public: + MyX11CursorNode(int id, Cursor c) { idValue = id; cursorValue = c; refCount = 1; } + QDateTime expiration() { return t; } + void setExpiration(QDateTime val) { t = val; } + MyX11CursorNode * ante() { return before; } + void setAnte(MyX11CursorNode *node) { before = node; } + MyX11CursorNode * post() { return after; } + void setPost(MyX11CursorNode *node) { after = node; } + Cursor cursor() { return cursorValue; } + int id() { return idValue; } + unsigned int refCount; + +private: + MyX11CursorNode *before; + MyX11CursorNode *after; + QDateTime t; + Cursor cursorValue; + int idValue; + + Display * display; }; +class MyX11Cursors : public QObject +{ + Q_OBJECT +public: + MyX11Cursors(Display * d); + ~MyX11Cursors() { timer.stop(); } + void incrementUseCount(int id); + void decrementUseCount(int id); + void createNode(int id, Cursor c); + bool exists(int id) { return lookupMap.contains(id); } + Cursor cursor(int id); +public slots: + void timeout(); +private: + void removeNode(MyX11CursorNode *node); + void insertNode(MyX11CursorNode *node); + // linked list of cursors currently not assigned to any window + MyX11CursorNode *firstExpired; + MyX11CursorNode *lastExpired; + QHash lookupMap; + QTimer timer; + + Display *display; + + int removalDelay; +}; #endif // MYX11UTIL_H -- cgit v0.12 From 3b82e91bcfb19f52ce4d030eff146852d9cde08f Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Fri, 4 Dec 2009 13:15:52 +0100 Subject: Add experimental OpenKODE support --- .../qws/linux-x86-openkode-g++/qmake.conf | 22 ++ .../qws/linux-x86-openkode-g++/qplatformdefs.h | 42 ++++ src/gui/egl/qegl.cpp | 2 +- src/plugins/graphicssystems/openkode/frag.glslf | 8 + src/plugins/graphicssystems/openkode/frag.h | 37 +++ src/plugins/graphicssystems/openkode/main.cpp | 71 ++++++ src/plugins/graphicssystems/openkode/openkode.pro | 14 ++ .../openkode/qgraphicssystem_openkode.cpp | 237 +++++++++++++++++++ .../openkode/qgraphicssystem_openkode.h | 95 ++++++++ .../openkode/qwindowsurface_openkode.cpp | 256 +++++++++++++++++++++ .../openkode/qwindowsurface_openkode.h | 78 +++++++ src/plugins/graphicssystems/openkode/vert.glslv | 14 ++ src/plugins/graphicssystems/openkode/vert.h | 63 +++++ 13 files changed, 938 insertions(+), 1 deletion(-) create mode 100644 mkspecs/unsupported/qws/linux-x86-openkode-g++/qmake.conf create mode 100644 mkspecs/unsupported/qws/linux-x86-openkode-g++/qplatformdefs.h create mode 100644 src/plugins/graphicssystems/openkode/frag.glslf create mode 100644 src/plugins/graphicssystems/openkode/frag.h create mode 100644 src/plugins/graphicssystems/openkode/main.cpp create mode 100644 src/plugins/graphicssystems/openkode/openkode.pro create mode 100644 src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.cpp create mode 100644 src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.h create mode 100644 src/plugins/graphicssystems/openkode/qwindowsurface_openkode.cpp create mode 100644 src/plugins/graphicssystems/openkode/qwindowsurface_openkode.h create mode 100644 src/plugins/graphicssystems/openkode/vert.glslv create mode 100644 src/plugins/graphicssystems/openkode/vert.h diff --git a/mkspecs/unsupported/qws/linux-x86-openkode-g++/qmake.conf b/mkspecs/unsupported/qws/linux-x86-openkode-g++/qmake.conf new file mode 100644 index 0000000..36ad503 --- /dev/null +++ b/mkspecs/unsupported/qws/linux-x86-openkode-g++/qmake.conf @@ -0,0 +1,22 @@ +# +# qmake configuration for building with linux-g++ +# + +include(../../../common/g++.conf) +include(../../../common/linux.conf) +include(../../../common/qws.conf) + +load(qt_config) + +# ### HACK - This should be a configure check +OPENKODE_DIR = $(OPENKODE_DIR) + +QMAKE_INCDIR_OPENGL_ES2 = $${OPENKODE_DIR}/include +QMAKE_LIBDIR_OPENGL_ES2 = $${OPENKODE_DIR}/lib-target +QMAKE_LIBS_OPENGL_ES2 = $${QMAKE_RPATH}/$${OPENKODE_DIR}/lib-target -lGLESv2_CM + +QMAKE_INCDIR_EGL = $$QMAKE_INCDIR_OPENGL_ES2 +QMAKE_LIBDIR_EGL = $$QMAKE_LIBDIR_OPENGL_ES2 +QMAKE_LIBS_EGL = $${QMAKE_RPATH}/$${OPENKODE_DIR}/lib-target -lEGL + +QMAKE_LIBS += $${QMAKE_RPATH}/$${OPENKODE_DIR}/lib-target diff --git a/mkspecs/unsupported/qws/linux-x86-openkode-g++/qplatformdefs.h b/mkspecs/unsupported/qws/linux-x86-openkode-g++/qplatformdefs.h new file mode 100644 index 0000000..86d84e8 --- /dev/null +++ b/mkspecs/unsupported/qws/linux-x86-openkode-g++/qplatformdefs.h @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "../../../linux-g++/qplatformdefs.h" diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index c0e4890..0f51846 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -188,7 +188,7 @@ bool QEglContext::createContext(QEglContext *shareContext, const QEglProperties } } if (ctx == EGL_NO_CONTEXT) { - ctx = eglCreateContext(dpy, cfg, 0, contextProps.properties()); + ctx = eglCreateContext(dpy, cfg, EGL_NO_CONTEXT, contextProps.properties()); if (ctx == EGL_NO_CONTEXT) { qWarning() << "QEglContext::createContext(): Unable to create EGL context:" << errorString(eglGetError()); return false; diff --git a/src/plugins/graphicssystems/openkode/frag.glslf b/src/plugins/graphicssystems/openkode/frag.glslf new file mode 100644 index 0000000..a593434 --- /dev/null +++ b/src/plugins/graphicssystems/openkode/frag.glslf @@ -0,0 +1,8 @@ +uniform sampler2D tex_samp; + +varying vec2 texcoord_var; + +void main() +{ + gl_FragColor = texture2D(tex_samp, texcoord_var); +} diff --git a/src/plugins/graphicssystems/openkode/frag.h b/src/plugins/graphicssystems/openkode/frag.h new file mode 100644 index 0000000..6575cb5 --- /dev/null +++ b/src/plugins/graphicssystems/openkode/frag.h @@ -0,0 +1,37 @@ +0x4e,0x56,0x75,0x63,0x01,0x00,0x00,0x00,0x09,0x00,0x06,0x00,0x06,0x00,0x50,0x00, +0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x50,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x40,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x27,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x50,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0xe8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x70,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x90,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x11,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xb0,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x12,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0xc0,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x23,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x2b,0x00,0x00,0x00,0x7a,0x00,0x00,0x00,0xd0,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x2c,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x68,0x69,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff, +0x00,0x00,0x00,0x80,0x04,0x00,0x00,0x90,0x00,0x02,0x01,0x82,0x04,0x02,0x02,0x82, +0x01,0x00,0x40,0xf6,0x85,0xc7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0x3a,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2a,0x00,0x06,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0x3b,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0x49,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x26,0x00,0x04,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x74,0x65,0x78,0x5f,0x73,0x61,0x6d,0x70,0x00,0x00,0x00,0x74,0x65,0x78,0x63, +0x6f,0x6f,0x72,0x64,0x5f,0x76,0x61,0x72,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 diff --git a/src/plugins/graphicssystems/openkode/main.cpp b/src/plugins/graphicssystems/openkode/main.cpp new file mode 100644 index 0000000..e9c1083 --- /dev/null +++ b/src/plugins/graphicssystems/openkode/main.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qgraphicssystem_openkode.h" + +QT_BEGIN_NAMESPACE + +class QOpenKODEGraphicsSystemPlugin : public QGraphicsSystemPlugin +{ +public: + QStringList keys() const; + QGraphicsSystem *create(const QString&); +}; + +QStringList QOpenKODEGraphicsSystemPlugin::keys() const +{ + QStringList list; + list << "OpenKODE"; + return list; +} + +QGraphicsSystem* QOpenKODEGraphicsSystemPlugin::create(const QString& system) +{ + if (system.toLower() == "openkode") + return new QOpenKODEGraphicsSystem; + + return 0; +} + +Q_EXPORT_PLUGIN2(openkode, QOpenKODEGraphicsSystemPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/openkode/openkode.pro b/src/plugins/graphicssystems/openkode/openkode.pro new file mode 100644 index 0000000..f8f0bcb --- /dev/null +++ b/src/plugins/graphicssystems/openkode/openkode.pro @@ -0,0 +1,14 @@ +TARGET = qopenkodegraphicssystem +include(../../qpluginbase.pri) + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems + +SOURCES = main.cpp qgraphicssystem_openkode.cpp qwindowsurface_openkode.cpp +HEADERS = qgraphicssystem_openkode.h qwindowsurface_openkode.h + +target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +INSTALLS += target + +# openkode specific stuff +INCLUDEPATH += $(OPENKODE_DIR)/include +LIBS += $${QMAKE_RPATH}/$(OPENKODE_DIR)/lib-target -L$(OPENKODE_DIR)/lib-target -lKD -lEGL -lGLESv2_CM diff --git a/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.cpp b/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.cpp new file mode 100644 index 0000000..51364e4 --- /dev/null +++ b/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.cpp @@ -0,0 +1,237 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgraphicssystem_openkode.h" +#include "qwindowsurface_openkode.h" +#include + +#include +#include + +#include +#include +#include + +#include "GLES2/gl2ext.h" + + +QT_BEGIN_NAMESPACE + +QOpenKODEGraphicsSystemScreen::QOpenKODEGraphicsSystemScreen() +{ + KDDesktopNV *kdDesktop = KD_NULL; + KDDisplayNV *kdDisplay = KD_NULL; + + qDebug() << "QOpenKODEGraphicsSystemScreen::QOpenKODEGraphicsSystemScreen()"; + + // Get the default desktop and display + kdDesktop = kdGetDesktopNV(KD_DEFAULT_DESKTOP_NV, KD_NULL); + if (!kdDesktop || kdDesktop == (void*)-1) { + qErrnoWarning(kdGetError(), "Could not obtain KDDesktopNV pointer"); + return; + } + + kdDisplay = kdGetDisplayNV(KD_DEFAULT_DISPLAY_NV, KD_NULL); + if (!kdDisplay || kdDisplay == (void*)-1) { + qErrnoWarning(kdGetError(), "Could not obtain KDDisplayNV pointer"); + kdReleaseDesktopNV(kdDesktop); + return; + } + + KDDisplayModeNV mode; + if (kdGetDisplayModeNV(kdDisplay, &mode)) { + qErrnoWarning(kdGetError(), "Could not get display mode"); + return; + } + + qDebug() << " - display mode " << mode.width << "x" << mode.height << " refresh " << mode.refresh; + + KDint desktopSize[] = { mode.width, mode.height }; + + if (kdSetDesktopPropertyivNV(kdDesktop, KD_DESKTOPPROPERTY_SIZE_NV, desktopSize)) { + qErrnoWarning(kdGetError(), "Could not set desktop size"); + return; + } + + // Once we've set up the desktop and display we don't need them anymore +// kdReleaseDisplayNV(kdDisplay); TODO!!! + kdReleaseDesktopNV(kdDesktop); + + const int defaultDpi = 72; + mGeometry = QRect(0, 0, mode.width, mode.height); + mPhysicalSize = QSize(mode.width * 25.4 / defaultDpi, mode.height * 25.4 / defaultDpi); + + mDepth = 24; + mFormat = QImage::Format_RGB888; + + if (!mContext.openDisplay(0)) { + qWarning("qEglContext: Unable to open display!"); + return; + } + + qDebug() << " - QEglContext::openDisplay OK"; + + QEglProperties properties; + properties.setPixelFormat(QImage::Format_RGB888); + properties.setValue(EGL_BUFFER_SIZE, EGL_DONT_CARE); + properties.setRenderableType(QEgl::OpenGL); + + if (!mContext.chooseConfig(properties, QEgl::BestPixelFormat)) { + qWarning("qEglContext: Unable to choose config!"); + return; + } + + qDebug() << " - QEglContext::openDisplay OK"; +} + +static GLuint NvKdTestLoadShaders(const char *vertex_shader_binary, + const char *fragment_shader_binary, + GLuint vertex_shader_binary_size, + GLuint fragment_shader_binary_size) +{ + GLuint prog; + GLuint vertShader; + GLuint fragShader; + + // Create the program + prog = glCreateProgram(); + + // Create the GL shader objects + vertShader = glCreateShader(GL_VERTEX_SHADER); + fragShader = glCreateShader(GL_FRAGMENT_SHADER); + + // Load the binary data into the shader objects + glShaderBinary(1, &vertShader, + GL_NVIDIA_PLATFORM_BINARY_NV, vertex_shader_binary, vertex_shader_binary_size); + glShaderBinary(1, &fragShader, + GL_NVIDIA_PLATFORM_BINARY_NV, fragment_shader_binary, fragment_shader_binary_size); + + // Attach the shaders to the program + glAttachShader(prog, vertShader); + glAttachShader(prog, fragShader); + + // Delete the shaders + glDeleteShader(vertShader); + glDeleteShader(fragShader); + + // Link and validate the shader program + glLinkProgram(prog); + glValidateProgram(prog); + + return prog; +} + +class QOpenKODEEventLoopHelper : public QThread +{ +public: + QOpenKODEEventLoopHelper(QSemaphore *m) + : eventMutex(m) + { + m->acquire(); + } + +protected: + void run() + { + qDebug() << "initializing KD"; + kdInitializeNV(); + qDebug() << "done initializing KD"; + eventMutex->release(); + + const KDEvent *event; + while ((event = kdWaitEvent(-1)) != 0) { + qDebug() << "!!! received event!"; + kdDefaultEvent(event); + } + + qDebug() << "exiting event loop"; + } + +private: + QSemaphore *eventMutex; +}; + +QOpenKODEGraphicsSystem::QOpenKODEGraphicsSystem() + : eventMutex(1) +{ + QOpenKODEEventLoopHelper *loop = new QOpenKODEEventLoopHelper(&eventMutex); + loop->start(); + eventMutex.acquire(); // block until initialization done + + mPrimaryScreen = new QOpenKODEGraphicsSystemScreen(); + + mScreens.append(mPrimaryScreen); + +} + +QPixmapData *QOpenKODEGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const +{ + return new QRasterPixmapData(type); +} + +QWindowSurface *QOpenKODEGraphicsSystem::createWindowSurface(QWidget *widget) const +{ + return new QOpenKODEWindowSurface(mPrimaryScreen, widget); +} + +GLuint QOpenKODEGraphicsSystem::blitterProgram() +{ + static GLuint shaderProgram = 0; + if (!shaderProgram) { + + const char vertShaderBinary[] = { +# include "vert.h" + }; + const char fragShaderBinary[] = { +# include "frag.h" + }; + + shaderProgram = NvKdTestLoadShaders(vertShaderBinary, fragShaderBinary, + sizeof(vertShaderBinary), sizeof(fragShaderBinary)); + + if (!shaderProgram) + qFatal("QOpenKodeGraphicsSystem(): Cannot load shaders!"); + } + return shaderProgram; +} + + +QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.h b/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.h new file mode 100644 index 0000000..972c42e --- /dev/null +++ b/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_OPENKODE_H +#define QGRAPHICSSYSTEM_OPENKODE_H + +#include + +#include +#include + +# include + +QT_BEGIN_NAMESPACE + +struct KDDesktopNV; + +class QOpenKODEGraphicsSystemScreen : public QGraphicsSystemScreen +{ +public: + QOpenKODEGraphicsSystemScreen(); + ~QOpenKODEGraphicsSystemScreen() {} + + QRect geometry() const { return mGeometry; } + int depth() const { return mDepth; } + QImage::Format format() const { return mFormat; } + QSize physicalSize() const { return mPhysicalSize; } + +public: + QRect mGeometry; + int mDepth; + QImage::Format mFormat; + QSize mPhysicalSize; + QEglContext mContext; +}; + +class QOpenKODEGraphicsSystem : public QGraphicsSystem +{ +public: + QOpenKODEGraphicsSystem(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QWindowSurface *createWindowSurface(QWidget *widget) const; + + QList screens() const { return mScreens; } + + static GLuint blitterProgram(); + +private: + QOpenKODEGraphicsSystemScreen *mPrimaryScreen; + QList mScreens; + QSemaphore eventMutex; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.cpp b/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.cpp new file mode 100644 index 0000000..33c76e4 --- /dev/null +++ b/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.cpp @@ -0,0 +1,256 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsurface_openkode.h" +#include "qgraphicssystem_openkode.h" +#include + +#include "KD/kd.h" +#include "KD/NV_display.h" + +QT_BEGIN_NAMESPACE + +QOpenKODEWindowSurface::QOpenKODEWindowSurface + (QOpenKODEGraphicsSystemScreen *screen, QWidget *window) + : QWindowSurface(window), + mScreen(screen) +{ + qDebug() << "QOpenKODEWindowSurface::QOpenKODEWindowSurface:" << window << window->width() << "x" << window->height() + << "pos" << window->x() << "x" << window->y(); + + if (!mContext.openDisplay(0)) { + qWarning("qEglContext: Unable to open display!"); + return; + } + + QEglProperties properties; + properties.setPixelFormat(QImage::Format_RGB888); + properties.setValue(EGL_BUFFER_SIZE, EGL_DONT_CARE); + properties.setRenderableType(QEgl::OpenGL); + + if (!mContext.chooseConfig(properties, QEgl::BestPixelFormat)) { + qWarning("qEglContext: Unable to choose config!"); + return; + } + + createWindow(window); +} + +void QOpenKODEWindowSurface::createWindow(QWidget *window) +{ + kdWindow = kdCreateWindow(mContext.display(), mContext.config(), KD_NULL); + + if (!kdWindow) { + qErrnoWarning(kdGetError(), "Error creating native window"); + return; + } + + const KDint windowSize[2] = { window->width(), window->height() }; + if (kdSetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) { + qErrnoWarning(kdGetError(), "Could not set native window size"); + return; + } + + const KDboolean windowExclusive[] = { false }; + if (kdSetWindowPropertybv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_EXCLUSIVE_NV, windowExclusive)) { + qErrnoWarning(kdGetError(), "Could not set exclusive bit"); + return; + } + + const KDint windowPos[2] = { window->x(), window->y() }; + if (kdSetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { + qErrnoWarning(kdGetError(), "Could not set native window position"); + return; + } + + EGLNativeWindowType nativeWindow; + + if (kdRealizeWindow(kdWindow, &nativeWindow)) { + qErrnoWarning(kdGetError(), "Could not realize native window"); + return; + } + + // Create an EGL window surface for the native window + EGLint windowAttrs[3] = { EGL_NONE }; + EGLSurface eglSurface = eglCreateWindowSurface(mContext.display(), + mContext.config(), + nativeWindow, + windowAttrs); + if (!eglSurface) { + qWarning("EGL couldn't create window surface: 0x%x", eglGetError()); + return; + } + + mContext.setSurface(eglSurface); + + if (!mContext.createContext()) { + qDebug() << "Unable to create context!"; + return; + } +} + +QOpenKODEWindowSurface::~QOpenKODEWindowSurface() +{ +} + +QPaintDevice *QOpenKODEWindowSurface::paintDevice() +{ + //qDebug() << "QOpenKODEWindowSurface::paintDevice"; + return &mImage; +} + +// ### TODO - this updates the entire toplevel, should only update the region +void QOpenKODEWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + if (!offset.isNull()) { + qWarning("Offset flushing not supported yet"); + return; + } + + if (!mContext.makeCurrent()) { + qWarning("EGL couldn't make context/surface current: 0x%x", eglGetError()); + return; + } + + QRect boundingRect = region.boundingRect(); + + int x, y, w, h; + QImage blitImage; + if (true || boundingRect == mImage.rect()) { // TODO - check optimization + blitImage = mImage; + x = y = 0; + w = mImage.width(); + h = mImage.height(); + } else { + blitImage = mImage.copy(boundingRect); + w = boundingRect.width(); + h = boundingRect.height(); + x = boundingRect.x(); + y = boundingRect.y(); + } + +// qDebug() << "flush" << widget << offset << region.boundingRect() << mImage.format() << blitImage.format(); + + GLuint shaderProgram = QOpenKODEGraphicsSystem::blitterProgram(); + + glUseProgram(shaderProgram); + + GLuint index = glGetUniformLocation(shaderProgram, "window"); + glUniform2f(index, GLfloat(mImage.width()), GLfloat(mImage.height())); + + // attributes + GLuint posId = glGetAttribLocation(shaderProgram, "pos_attr"); + GLuint texcoordId = glGetAttribLocation(shaderProgram, "texcoord_attr"); + + // sampler + index = glGetUniformLocation(shaderProgram, "tex_samp"); + + glUniform1i(index, 0); + + glDisable(GL_DEPTH_TEST); + glActiveTexture(GL_TEXTURE0); + + GLuint texId; + GLfloat coords[8] = {x, y, x, y + h, x + w, y + h, x + w, y }; + GLfloat texcoords[8] = { 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0 }; + + // Generate texture for checkered background + glPixelStorei(GL_UNPACK_ALIGNMENT, 4); + glGenTextures(1, &texId); + glBindTexture(GL_TEXTURE_2D, texId); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, blitImage.bits()); + + // Enable vertex attribute associated with vertex position + glEnableVertexAttribArray(posId); + glEnableVertexAttribArray(texcoordId); + + // Set the quad vertices + glVertexAttribPointer(posId, 2, GL_FLOAT, 0, 0, coords); + glVertexAttribPointer(texcoordId, 2, GL_FLOAT, 0, 0, texcoords); + + // Draw the quad + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + + // Cleanup + glDisableVertexAttribArray(posId); + glDisableVertexAttribArray(texcoordId); + + // Release all textures + glBindTexture(GL_TEXTURE_2D, 0); + if (texId) + glDeleteTextures(1, &texId); + + mContext.swapBuffers(); + mContext.doneCurrent(); +} + +void QOpenKODEWindowSurface::setGeometry(const QRect &rect) +{ + qDebug() << "QOpenKODEWindowSurface::setGeometry:" << rect; + QWindowSurface::setGeometry(rect); + if (mImage.size() != rect.size()) + mImage = QImage(rect.size(), mScreen->format()); + + mContext.destroySurface(); + kdDestroyWindow(kdWindow); + createWindow(window()); +} + +bool QOpenKODEWindowSurface::scroll(const QRegion &area, int dx, int dy) +{ + return QWindowSurface::scroll(area, dx, dy); +} + +void QOpenKODEWindowSurface::beginPaint(const QRegion ®ion) +{ + Q_UNUSED(region); +} + +void QOpenKODEWindowSurface::endPaint(const QRegion ®ion) +{ + Q_UNUSED(region); +} + +QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.h b/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.h new file mode 100644 index 0000000..1c70f55 --- /dev/null +++ b/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSURFACE_OPENKODE_H +#define QWINDOWSURFACE_OPENKODE_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QOpenKODEGraphicsSystemScreen; + +class QOpenKODEWindowSurface : public QWindowSurface +{ +public: + QOpenKODEWindowSurface + (QOpenKODEGraphicsSystemScreen *screen, QWidget *window); + ~QOpenKODEWindowSurface(); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void setGeometry(const QRect &rect); + bool scroll(const QRegion &area, int dx, int dy); + + void beginPaint(const QRegion ®ion); + void endPaint(const QRegion ®ion); + +private: + QOpenKODEGraphicsSystemScreen *mScreen; + QImage mImage; + struct KDWindow *kdWindow; + QEglContext mContext; + + void createWindow(QWidget *window); +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/graphicssystems/openkode/vert.glslv b/src/plugins/graphicssystems/openkode/vert.glslv new file mode 100644 index 0000000..57b5866 --- /dev/null +++ b/src/plugins/graphicssystems/openkode/vert.glslv @@ -0,0 +1,14 @@ +uniform vec2 window; // window size + +// Per-vertex attributes] +attribute vec2 pos_attr; +attribute vec2 texcoord_attr; + +// Output vertex color +varying vec2 texcoord_var; + +void main() +{ + gl_Position = vec4( (2.0 * pos_attr / window -1.0) * vec2(1.0, -1.0), 0.0, 1.0); + texcoord_var = texcoord_attr; +} diff --git a/src/plugins/graphicssystems/openkode/vert.h b/src/plugins/graphicssystems/openkode/vert.h new file mode 100644 index 0000000..bdf564d --- /dev/null +++ b/src/plugins/graphicssystems/openkode/vert.h @@ -0,0 +1,63 @@ +0x4e,0x56,0x75,0x63,0x01,0x00,0x00,0x00,0x0a,0x00,0x06,0x00,0x06,0x00,0x50,0x00, +0x01,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0xf0,0x03,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x60,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x24,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x70,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x26,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x90,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0xe8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x06,0x00,0x00,0x00,0x48,0x00,0x00,0x00,0xb0,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x28,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0x05,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x10,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x20,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x30,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x23,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x2b,0x00,0x00,0x00,0x39,0x01,0x00,0x00,0xb0,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x05,0x08,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x0f,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x01,0x02,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0x04,0x05,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x80,0x3f,0x00,0x00,0x00,0x40,0x00,0x00,0x80,0xbf,0x00,0x00,0x00,0x00, +0x05,0x00,0x00,0x10,0x80,0xc7,0x00,0x24,0x05,0x02,0x00,0x10,0x80,0xc7,0x00,0x24, +0x01,0x02,0x81,0xc0,0x80,0x07,0x60,0x00,0x05,0x02,0x00,0x90,0x80,0x07,0x00,0x00, +0x09,0x00,0x01,0xe1,0x80,0x87,0x40,0x00,0x05,0x00,0x00,0x10,0x80,0xc7,0x00,0x24, +0x01,0x00,0x81,0xc0,0x80,0x07,0x60,0x00,0x09,0x04,0x00,0xa0,0x80,0x47,0x00,0xe4, +0x05,0x02,0x00,0x90,0x80,0x07,0x00,0x00,0x05,0x04,0x00,0x10,0x88,0xc7,0x03,0x04, +0x01,0x00,0x01,0xe1,0x88,0x87,0x40,0x00,0x09,0xf8,0x00,0x10,0x88,0xc7,0x03,0x04, +0x0d,0x00,0x00,0x10,0x88,0xc7,0x40,0x24,0x11,0x04,0x00,0x10,0x88,0xc7,0x23,0x04, +0x15,0x06,0x00,0x10,0x89,0xc7,0x23,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xa0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xa1,0x03,0x00,0x00,0x00,0x00,0x00,0x00, +0xad,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x00,0x28,0x00,0x02,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00, +0xb6,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xb7,0x03,0x00,0x00,0x00,0x00,0x00,0x00, +0xbe,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x26,0x00,0x05,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xbf,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x03,0x00,0x00,0x00,0x00,0x00,0x00, +0xc9,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x26,0x00,0x01,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xca,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xcb,0x03,0x00,0x00,0x00,0x00,0x00,0x00, +0xd9,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x26,0x00,0x01,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xda,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xdb,0x03,0x00,0x00,0x00,0x00,0x00,0x00, +0xe8,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x26,0x00,0x02,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x50,0x4f,0x53, +0x49,0x54,0x49,0x4f,0x4e,0x00,0x00,0x77,0x69,0x6e,0x64,0x6f,0x77,0x00,0x00,0x00, +0x70,0x6f,0x73,0x5f,0x61,0x74,0x74,0x72,0x00,0x00,0x00,0x74,0x65,0x78,0x63,0x6f, +0x6f,0x72,0x64,0x5f,0x61,0x74,0x74,0x72,0x00,0x00,0x00,0x74,0x65,0x78,0x63,0x6f, +0x6f,0x72,0x64,0x5f,0x76,0x61,0x72,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 -- cgit v0.12 From 56c9fe5f9ba08f20885454fee7cbb488fd4968eb Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Fri, 4 Dec 2009 14:03:48 +0100 Subject: temporarily disable backingstore subsurfaces until they compile again with embedded-lite --- configure | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure b/configure index dae8910..4818560 100755 --- a/configure +++ b/configure @@ -6075,7 +6075,8 @@ fi if [ "$CFG_OPENGL" = "es1" ] || [ "$CFG_OPENGL" = "es1cl" ] || [ "$CFG_OPENGL" = "es2" ]; then if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then - QCONFIG_FLAGS="$QCONFIG_FLAGS Q_BACKINGSTORE_SUBSURFACES" +### TODO # QCONFIG_FLAGS="$QCONFIG_FLAGS Q_BACKINGSTORE_SUBSURFACES" + echo "### Q_BACKINGSTORE_SUBSURFACES disabled, re-enable once it compiles again" QCONFIG_FLAGS="$QCONFIG_FLAGS Q_USE_EGLWINDOWSURFACE" fi QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES" -- cgit v0.12 From 4190f781a81da9d2a2470d75fcf2cf2946504b34 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Fri, 4 Dec 2009 14:14:16 +0100 Subject: make sure that x11 is disabled when building embedded_lite --- src/opengl/opengl.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index b2474ed..0f752c1 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -10,7 +10,7 @@ unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui include(../qbase.pri) -!win32:!embedded:!mac:CONFIG += x11 +!win32:!embedded:!mac:!embedded_lite:CONFIG += x11 contains(QT_CONFIG, opengl):CONFIG += opengl contains(QT_CONFIG, opengles1):CONFIG += opengles1 contains(QT_CONFIG, opengles1cl):CONFIG += opengles1cl -- cgit v0.12 From 2447284a73dd8ce6268614d5709c5a1dcffbde3a Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Fri, 4 Dec 2009 14:14:41 +0100 Subject: compile with Q_WS_LITE --- src/opengl/qgl_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 8e472e5..2160f4f 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -336,7 +336,7 @@ public: static inline QGLExtensionFuncs& extensionFuncs(const QGLContext *ctx) { return ctx->d_ptr->group->extensionFuncs(); } #endif -#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) +#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) || defined(Q_WS_LITE) static QGLExtensionFuncs qt_extensionFuncs; static inline QGLExtensionFuncs& extensionFuncs(const QGLContext *) { return qt_extensionFuncs; } #endif -- cgit v0.12 From 52613f91fe4c8bb4faa93c50cc3fab2d8082fc30 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Fri, 4 Dec 2009 14:15:02 +0100 Subject: compile again after recent API changes --- src/gui/egl/qegl_lite.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/egl/qegl_lite.cpp b/src/gui/egl/qegl_lite.cpp index 40439c6..60b862b 100644 --- a/src/gui/egl/qegl_lite.cpp +++ b/src/gui/egl/qegl_lite.cpp @@ -52,11 +52,11 @@ QT_BEGIN_NAMESPACE -bool QEglContext::createSurface(QPaintDevice *device, const QEglProperties *properties) +EGLSurface QEglContext::createSurface(QPaintDevice *device, const QEglProperties *properties) { Q_UNUSED(device); Q_UNUSED(properties); - return false; + return 0; } EGLDisplay QEglContext::getDisplay(QPaintDevice *device) -- cgit v0.12 From 426334321319054fedf8993bba6482ce90a2c4ee Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Tue, 8 Dec 2009 11:54:00 +0100 Subject: fix application supplied image cursors --- src/gui/painting/qgraphicssystemcursor.cpp | 7 +++++++ src/gui/painting/qgraphicssystemcursor.h | 1 + src/plugins/graphicssystems/fb_base/fb_base.cpp | 9 ++++++--- src/plugins/graphicssystems/fb_base/fb_base.h | 1 + 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qgraphicssystemcursor.cpp b/src/gui/painting/qgraphicssystemcursor.cpp index 3fc836d..9a0e135 100644 --- a/src/gui/painting/qgraphicssystemcursor.cpp +++ b/src/gui/painting/qgraphicssystemcursor.cpp @@ -513,6 +513,13 @@ void QGraphicsSystemCursorImage::set(Qt::CursorShape id) hot = cursor->hot; } +void QGraphicsSystemCursorImage::set(const QImage * image, int hx, int hy) +{ + hot.setX(hx); + hot.setY(hy); + cursorImage = *image; +} + void QGraphicsSystemCursorImage::set(const uchar *data, const uchar *mask, int width, int height, int hx, int hy) { diff --git a/src/gui/painting/qgraphicssystemcursor.h b/src/gui/painting/qgraphicssystemcursor.h index 42727a8..0d57d52 100644 --- a/src/gui/painting/qgraphicssystemcursor.h +++ b/src/gui/painting/qgraphicssystemcursor.h @@ -58,6 +58,7 @@ public: QImage * image() { return &cursorImage; } QPoint hotspot() { return hot; } void set(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); + void set(const QImage * image, int hx, int hy); void set(Qt::CursorShape); private: static void createSystemCursor(int id); diff --git a/src/plugins/graphicssystems/fb_base/fb_base.cpp b/src/plugins/graphicssystems/fb_base/fb_base.cpp index 27cb8a4..f9ea97f 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.cpp +++ b/src/plugins/graphicssystems/fb_base/fb_base.cpp @@ -54,6 +54,11 @@ void QGraphicsSystemSoftwareCursor::setCursor(Qt::CursorShape shape) graphic->set(shape); } +void QGraphicsSystemSoftwareCursor::setCursor(const QImage * image, int hotx, int hoty) +{ + graphic->set(image, hotx, hoty); +} + void QGraphicsSystemSoftwareCursor::setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) { graphic->set(data, mask, width, height, hotX, hotY); @@ -66,10 +71,8 @@ void QGraphicsSystemSoftwareCursor::changeCursor(QCursor * widgetCursor, QWidget if (shape == Qt::BitmapCursor) { // application supplied cursor - const QBitmap * map = widgetCursor->bitmap(); - const QBitmap * mask = widgetCursor->mask(); QPoint spot = widgetCursor->hotSpot(); - setCursor(map->toImage().bits(), mask->toImage().bits(), map->width(), map->height(), spot.x(), spot.y()); + setCursor(&widgetCursor->pixmap().toImage(), spot.x(), spot.y()); } else { // system cursor setCursor(shape); diff --git a/src/plugins/graphicssystems/fb_base/fb_base.h b/src/plugins/graphicssystems/fb_base/fb_base.h index 9abd5d0..58f340d 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.h +++ b/src/plugins/graphicssystems/fb_base/fb_base.h @@ -34,6 +34,7 @@ protected: private: void setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); void setCursor(Qt::CursorShape shape); + void setCursor(const QImage * image, int hotx, int hoty); QRect currentRect; // next place to draw the cursor QRect prevRect; // last place the cursor was drawn QRect getCurrentRect(); -- cgit v0.12 From 698033071fe28f85f4e762f8347da4c2956b56ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 25 Nov 2009 14:40:16 +0100 Subject: Delete the surface --- src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp | 5 +++++ src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp index 05221ce..71be882 100644 --- a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp @@ -27,6 +27,11 @@ QDirectFbBlitter::QDirectFbBlitter(const QRect &rect, IDirectFBSurface *surface) } } +QDirectFbBlitter::~QDirectFbBlitter() +{ + delete m_surface; +} + void QDirectFbBlitter::fillRect(const QRectF &rect, const QColor &color) { m_surface->SetColor(m_surface, color.red(), color.green(), color.blue(), color.alpha()); diff --git a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h index 252bf80..c1fbc14 100644 --- a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h +++ b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h @@ -9,7 +9,7 @@ class QDirectFbBlitter : public QBlittable { public: QDirectFbBlitter(const QRect &rect, IDirectFBSurface *surface = 0); - virtual ~QDirectFbBlitter(){ } + virtual ~QDirectFbBlitter(); virtual void fillRect(const QRectF &rect, const QColor &color); virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect); -- cgit v0.12 From 6dc5eb70382fb7f1741142b6919e1754e365029c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 27 Nov 2009 10:07:40 +0100 Subject: We dont need a new pixmap here :) --- src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp index 3dcf5be..43bfd9b 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -105,13 +105,9 @@ void QDirectFbWindowSurface::setGeometry(const QRect &rect) if (result != DFB_OK) DirectFBError("QDirectFbWindowSurface::setGeometry() failed to retrieve new surface",result); - QPixmap *oldpixmap = m_pixmap; QDirectFbBlitter *blitter = new QDirectFbBlitter(rect, m_dfbSurface); pmdata->resize(rect.width(),rect.height()); pmdata->setBlittable(blitter); - m_pixmap = new QPixmap(pmdata); - delete oldpixmap; - } bool QDirectFbWindowSurface::scroll(const QRegion &area, int dx, int dy) -- cgit v0.12 From d8d65804ed67ff58fe8679d3a1831c9dfad3624a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 9 Dec 2009 09:41:08 +0100 Subject: Added basic mouseinput support for minimaldfb --- .../graphicssystems/minimaldfb/minimaldfb.pro | 6 +- .../minimaldfb/qblitter_directfb.cpp | 2 +- .../minimaldfb/qdirectfbconvenience.cpp | 232 +++++++++++++++++++++ .../minimaldfb/qdirectfbconvenience.h | 15 ++ .../graphicssystems/minimaldfb/qdirectfbinput.cpp | 104 +++++++++ .../graphicssystems/minimaldfb/qdirectfbinput.h | 49 +++++ .../minimaldfb/qgraphicssystem_minimaldfb.cpp | 7 +- .../minimaldfb/qgraphicssystem_minimaldfb.h | 7 +- .../minimaldfb/qwindowsurface_minimaldfb.cpp | 3 +- 9 files changed, 418 insertions(+), 7 deletions(-) create mode 100644 src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp create mode 100644 src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h diff --git a/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro b/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro index c3f20ff..8b20c45 100644 --- a/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro +++ b/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro @@ -11,10 +11,12 @@ SOURCES = main.cpp \ qgraphicssystem_minimaldfb.cpp \ qwindowsurface_minimaldfb.cpp \ qblitter_directfb.cpp \ - qdirectfbconvenience.cpp + qdirectfbconvenience.cpp \ + qdirectfbinput.cpp HEADERS = qgraphicssystem_minimaldfb.h \ qwindowsurface_minimaldfb.h \ qblitter_directfb.h \ - qdirectfbconvenience.h + qdirectfbconvenience.h \ + qdirectfbinput.h target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems INSTALLS += target diff --git a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp index 71be882..8d54c21 100644 --- a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp @@ -29,7 +29,7 @@ QDirectFbBlitter::QDirectFbBlitter(const QRect &rect, IDirectFBSurface *surface) QDirectFbBlitter::~QDirectFbBlitter() { - delete m_surface; + m_surface->Release(m_surface); } void QDirectFbBlitter::fillRect(const QRectF &rect, const QColor &color) diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp index d958482..f0293bd 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp @@ -41,3 +41,235 @@ QImage::Format QDirectFbConvenience::imageFormatFromSurface(IDirectFBSurface *su return QImage::Format_Invalid; } + +Qt::MouseButton QDirectFbConvenience::mouseButton(DFBInputDeviceButtonIdentifier identifier) +{ + switch (identifier){ + case DIBI_LEFT: + return Qt::LeftButton; + case DIBI_MIDDLE: + return Qt::MidButton; + case DIBI_RIGHT: + return Qt::RightButton; + default: + return Qt::NoButton; + } +} + +Qt::MouseButtons QDirectFbConvenience::mouseButtons(DFBInputDeviceButtonMask mask) +{ + Qt::MouseButtons buttons = Qt::NoButton; + + if (mask & DIBM_LEFT) { + buttons |= Qt::LeftButton; + } + if (mask & DIBM_MIDDLE) { + buttons |= Qt::MidButton; + } + if (mask & DIBM_RIGHT) { + buttons |= Qt::RightButton; + } + return buttons; +} + +QEvent::Type QDirectFbConvenience::eventType(DFBWindowEventType type) +{ + switch(type) { + case DWET_BUTTONDOWN: + return QEvent::MouseButtonPress; + case DWET_BUTTONUP: + return QEvent::MouseButtonRelease; + case DWET_MOTION: + return QEvent::MouseMove; + case DWET_WHEEL: + return QEvent::Wheel; + default: + return QEvent::None; + } +} +QDirectFbKeyMap *QDirectFbConvenience::dfbKeymap = 0; +QDirectFbKeyMap *QDirectFbConvenience::keyMap() +{ + if (!dfbKeymap) + dfbKeymap = new QDirectFbKeyMap(); + return dfbKeymap; +} + +QDirectFbKeyMap::QDirectFbKeyMap() +{ + insert(DIKS_BACKSPACE , Qt::Key_Backspace); + insert(DIKS_TAB , Qt::Key_Tab); + insert(DIKS_RETURN , Qt::Key_Return); + insert(DIKS_ESCAPE , Qt::Key_Escape); + insert(DIKS_DELETE , Qt::Key_Delete); + + insert(DIKS_CURSOR_LEFT , Qt::Key_Left); + insert(DIKS_CURSOR_RIGHT , Qt::Key_Right); + insert(DIKS_CURSOR_UP , Qt::Key_Up); + insert(DIKS_CURSOR_DOWN , Qt::Key_Down); + insert(DIKS_INSERT , Qt::Key_Insert); + insert(DIKS_HOME , Qt::Key_Home); + insert(DIKS_END , Qt::Key_End); + insert(DIKS_PAGE_UP , Qt::Key_PageUp); + insert(DIKS_PAGE_DOWN , Qt::Key_PageDown); + insert(DIKS_PRINT , Qt::Key_Print); + insert(DIKS_PAUSE , Qt::Key_Pause); + insert(DIKS_SELECT , Qt::Key_Select); + insert(DIKS_GOTO , Qt::Key_OpenUrl); + insert(DIKS_CLEAR , Qt::Key_Clear); + insert(DIKS_MENU , Qt::Key_Menu); + insert(DIKS_HELP , Qt::Key_Help); + + insert(DIKS_INTERNET , Qt::Key_HomePage); + insert(DIKS_MAIL , Qt::Key_LaunchMail); + insert(DIKS_FAVORITES , Qt::Key_Favorites); + + insert(DIKS_BACK , Qt::Key_Back); + insert(DIKS_FORWARD , Qt::Key_Forward); + insert(DIKS_VOLUME_UP , Qt::Key_VolumeUp); + insert(DIKS_VOLUME_DOWN , Qt::Key_VolumeDown); + insert(DIKS_MUTE , Qt::Key_VolumeMute); + insert(DIKS_PLAYPAUSE , Qt::Key_Pause); + insert(DIKS_PLAY , Qt::Key_MediaPlay); + insert(DIKS_STOP , Qt::Key_MediaStop); + insert(DIKS_RECORD , Qt::Key_MediaRecord); + insert(DIKS_PREVIOUS , Qt::Key_MediaPrevious); + insert(DIKS_NEXT , Qt::Key_MediaNext); + + insert(DIKS_F1 , Qt::Key_F1); + insert(DIKS_F2 , Qt::Key_F2); + insert(DIKS_F3 , Qt::Key_F3); + insert(DIKS_F4 , Qt::Key_F4); + insert(DIKS_F5 , Qt::Key_F5); + insert(DIKS_F6 , Qt::Key_F6); + insert(DIKS_F7 , Qt::Key_F7); + insert(DIKS_F8 , Qt::Key_F8); + insert(DIKS_F9 , Qt::Key_F9); + insert(DIKS_F10 , Qt::Key_F10); + insert(DIKS_F11 , Qt::Key_F11); + insert(DIKS_F12 , Qt::Key_F12); + + insert(DIKS_SHIFT , Qt::Key_Shift); + insert(DIKS_CONTROL , Qt::Key_Control); + insert(DIKS_ALT , Qt::Key_Alt); + insert(DIKS_ALTGR , Qt::Key_AltGr); + + insert(DIKS_META , Qt::Key_Meta); + insert(DIKS_SUPER , Qt::Key_Super_L); // ??? + insert(DIKS_HYPER , Qt::Key_Hyper_L); // ??? + + insert(DIKS_CAPS_LOCK , Qt::Key_CapsLock); + insert(DIKS_NUM_LOCK , Qt::Key_NumLock); + insert(DIKS_SCROLL_LOCK , Qt::Key_ScrollLock); + + insert(DIKS_DEAD_ABOVEDOT , Qt::Key_Dead_Abovedot); + insert(DIKS_DEAD_ABOVERING , Qt::Key_Dead_Abovering); + insert(DIKS_DEAD_ACUTE , Qt::Key_Dead_Acute); + insert(DIKS_DEAD_BREVE , Qt::Key_Dead_Breve); + insert(DIKS_DEAD_CARON , Qt::Key_Dead_Caron); + insert(DIKS_DEAD_CEDILLA , Qt::Key_Dead_Cedilla); + insert(DIKS_DEAD_CIRCUMFLEX , Qt::Key_Dead_Circumflex); + insert(DIKS_DEAD_DIAERESIS , Qt::Key_Dead_Diaeresis); + insert(DIKS_DEAD_DOUBLEACUTE , Qt::Key_Dead_Doubleacute); + insert(DIKS_DEAD_GRAVE , Qt::Key_Dead_Grave); + insert(DIKS_DEAD_IOTA , Qt::Key_Dead_Iota); + insert(DIKS_DEAD_MACRON , Qt::Key_Dead_Macron); + insert(DIKS_DEAD_OGONEK , Qt::Key_Dead_Ogonek); + insert(DIKS_DEAD_SEMIVOICED_SOUND , Qt::Key_Dead_Semivoiced_Sound); + insert(DIKS_DEAD_TILDE , Qt::Key_Dead_Tilde); + insert(DIKS_DEAD_VOICED_SOUND , Qt::Key_Dead_Voiced_Sound); + insert(DIKS_SPACE , Qt::Key_Space); + insert(DIKS_EXCLAMATION_MARK , Qt::Key_Exclam); + insert(DIKS_QUOTATION , Qt::Key_QuoteDbl); + insert(DIKS_NUMBER_SIGN , Qt::Key_NumberSign); + insert(DIKS_DOLLAR_SIGN , Qt::Key_Dollar); + insert(DIKS_PERCENT_SIGN , Qt::Key_Percent); + insert(DIKS_AMPERSAND , Qt::Key_Ampersand); + insert(DIKS_APOSTROPHE , Qt::Key_Apostrophe); + insert(DIKS_PARENTHESIS_LEFT , Qt::Key_ParenLeft); + insert(DIKS_PARENTHESIS_RIGHT , Qt::Key_ParenRight); + insert(DIKS_ASTERISK , Qt::Key_Asterisk); + insert(DIKS_PLUS_SIGN , Qt::Key_Plus); + insert(DIKS_COMMA , Qt::Key_Comma); + insert(DIKS_MINUS_SIGN , Qt::Key_Minus); + insert(DIKS_PERIOD , Qt::Key_Period); + insert(DIKS_SLASH , Qt::Key_Slash); + insert(DIKS_0 , Qt::Key_0); + insert(DIKS_1 , Qt::Key_1); + insert(DIKS_2 , Qt::Key_2); + insert(DIKS_3 , Qt::Key_3); + insert(DIKS_4 , Qt::Key_4); + insert(DIKS_5 , Qt::Key_5); + insert(DIKS_6 , Qt::Key_6); + insert(DIKS_7 , Qt::Key_7); + insert(DIKS_8 , Qt::Key_8); + insert(DIKS_9 , Qt::Key_9); + insert(DIKS_COLON , Qt::Key_Colon); + insert(DIKS_SEMICOLON , Qt::Key_Semicolon); + insert(DIKS_LESS_THAN_SIGN , Qt::Key_Less); + insert(DIKS_EQUALS_SIGN , Qt::Key_Equal); + insert(DIKS_GREATER_THAN_SIGN , Qt::Key_Greater); + insert(DIKS_QUESTION_MARK , Qt::Key_Question); + insert(DIKS_AT , Qt::Key_At); + insert(DIKS_CAPITAL_A , Qt::Key_A); + insert(DIKS_CAPITAL_B , Qt::Key_B); + insert(DIKS_CAPITAL_C , Qt::Key_C); + insert(DIKS_CAPITAL_D , Qt::Key_D); + insert(DIKS_CAPITAL_E , Qt::Key_E); + insert(DIKS_CAPITAL_F , Qt::Key_F); + insert(DIKS_CAPITAL_G , Qt::Key_G); + insert(DIKS_CAPITAL_H , Qt::Key_H); + insert(DIKS_CAPITAL_I , Qt::Key_I); + insert(DIKS_CAPITAL_J , Qt::Key_J); + insert(DIKS_CAPITAL_K , Qt::Key_K); + insert(DIKS_CAPITAL_L , Qt::Key_L); + insert(DIKS_CAPITAL_M , Qt::Key_M); + insert(DIKS_CAPITAL_N , Qt::Key_N); + insert(DIKS_CAPITAL_O , Qt::Key_O); + insert(DIKS_CAPITAL_P , Qt::Key_P); + insert(DIKS_CAPITAL_Q , Qt::Key_Q); + insert(DIKS_CAPITAL_R , Qt::Key_R); + insert(DIKS_CAPITAL_S , Qt::Key_S); + insert(DIKS_CAPITAL_T , Qt::Key_T); + insert(DIKS_CAPITAL_U , Qt::Key_U); + insert(DIKS_CAPITAL_V , Qt::Key_V); + insert(DIKS_CAPITAL_W , Qt::Key_W); + insert(DIKS_CAPITAL_X , Qt::Key_X); + insert(DIKS_CAPITAL_Y , Qt::Key_Y); + insert(DIKS_CAPITAL_Z , Qt::Key_Z); + insert(DIKS_SQUARE_BRACKET_LEFT , Qt::Key_BracketLeft); + insert(DIKS_BACKSLASH , Qt::Key_Backslash); + insert(DIKS_SQUARE_BRACKET_RIGHT , Qt::Key_BracketRight); + insert(DIKS_CIRCUMFLEX_ACCENT , Qt::Key_AsciiCircum); + insert(DIKS_UNDERSCORE , Qt::Key_Underscore); + insert(DIKS_SMALL_A , Qt::Key_A); + insert(DIKS_SMALL_B , Qt::Key_B); + insert(DIKS_SMALL_C , Qt::Key_C); + insert(DIKS_SMALL_D , Qt::Key_D); + insert(DIKS_SMALL_E , Qt::Key_E); + insert(DIKS_SMALL_F , Qt::Key_F); + insert(DIKS_SMALL_G , Qt::Key_G); + insert(DIKS_SMALL_H , Qt::Key_H); + insert(DIKS_SMALL_I , Qt::Key_I); + insert(DIKS_SMALL_J , Qt::Key_J); + insert(DIKS_SMALL_K , Qt::Key_K); + insert(DIKS_SMALL_L , Qt::Key_L); + insert(DIKS_SMALL_M , Qt::Key_M); + insert(DIKS_SMALL_N , Qt::Key_N); + insert(DIKS_SMALL_O , Qt::Key_O); + insert(DIKS_SMALL_P , Qt::Key_P); + insert(DIKS_SMALL_Q , Qt::Key_Q); + insert(DIKS_SMALL_R , Qt::Key_R); + insert(DIKS_SMALL_S , Qt::Key_S); + insert(DIKS_SMALL_T , Qt::Key_T); + insert(DIKS_SMALL_U , Qt::Key_U); + insert(DIKS_SMALL_V , Qt::Key_V); + insert(DIKS_SMALL_W , Qt::Key_W); + insert(DIKS_SMALL_X , Qt::Key_X); + insert(DIKS_SMALL_Y , Qt::Key_Y); + insert(DIKS_SMALL_Z , Qt::Key_Z); + insert(DIKS_CURLY_BRACKET_LEFT , Qt::Key_BraceLeft); + insert(DIKS_VERTICAL_BAR , Qt::Key_Bar); + insert(DIKS_CURLY_BRACKET_RIGHT , Qt::Key_BraceRight); + insert(DIKS_TILDE , Qt::Key_AsciiTilde); +} diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h index 7e426db..0ae1410 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h @@ -2,9 +2,18 @@ #define QDIRECTFBCONVENIENCE_H #include +#include +#include #include +class QDirectFbKeyMap: public QHash +{ +public: + QDirectFbKeyMap(); +}; + + class QDirectFbConvenience { public: @@ -12,10 +21,16 @@ public: //This is set by the graphicssystem constructor static IDirectFB *dfbInterface() { return dfb; } + static Qt::MouseButton mouseButton(DFBInputDeviceButtonIdentifier identifier); + static Qt::MouseButtons mouseButtons(DFBInputDeviceButtonMask mask); + static QEvent::Type eventType(DFBWindowEventType type); + + static QDirectFbKeyMap *keyMap(); private: static void setDfbInterface(IDirectFB *dfbInterface) {dfb = dfbInterface;} static IDirectFB *dfb; + static QDirectFbKeyMap *dfbKeymap; friend class QDirectFbGraphicsSystem; }; diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp new file mode 100644 index 0000000..4ba4ff8 --- /dev/null +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp @@ -0,0 +1,104 @@ +#include "qdirectfbinput.h" +#include "qdirectfbconvenience.h" + +#include +#include +#include +#include +#include + +#include + +InputSocketWaiter::InputSocketWaiter(IDirectFBEventBuffer *eventBuffer, QObject *parent) + : QThread(parent), eventBuffer(eventBuffer) + { + this->start(); + } + +void InputSocketWaiter::run() +{ + while (1) { + eventBuffer->WaitForEvent(eventBuffer); + emit newEvent(); + } +} + +QDirectFbInput::QDirectFbInput(QObject *parent) + : QObject(parent) +{ + DFBResult ok = DirectFBCreate(&dfbInterface); + if (ok != DFB_OK) + DirectFBError("Failed to initialise QDirectFBInput", ok); + + ok = dfbInterface->CreateEventBuffer(dfbInterface,&eventBuffer); + if (ok != DFB_OK) + DirectFBError("Failed to initialise eventbuffer", ok); + + dfbInterface->GetDisplayLayer(dfbInterface,DLID_PRIMARY, &dfbDisplayLayer); + + InputSocketWaiter *inputHandler = new InputSocketWaiter(eventBuffer,this); + connect(inputHandler,SIGNAL(newEvent()),this,SLOT(handleEvents())); +} + +void QDirectFbInput::addWindow(DFBWindowID id, QWidget *tlw) +{ + tlwMap.insert(id,tlw); + IDirectFBWindow *window; + dfbDisplayLayer->GetWindow(dfbDisplayLayer,id,&window); + +// window->DisableEvents(window,DWET_ALL); + window->EnableEvents(window,DFBWindowEventType(DWET_ALL)); + window->SetKeySelection(window,DWKS_ALL,NULL,0); + window->AttachEventBuffer(window,eventBuffer); +} + +void QDirectFbInput::handleEvents() +{ + DFBResult hasEvent = eventBuffer->HasEvent(eventBuffer); + while(hasEvent == DFB_OK){ + DFBEvent event; + DFBResult ok = eventBuffer->GetEvent(eventBuffer,&event); + if (ok != DFB_OK) + DirectFBError("Failed to get event",ok); + if (event.clazz == DFEC_WINDOW) { + switch (event.window.type) { + case DWET_BUTTONDOWN: + case DWET_BUTTONUP: +// case DWET_MOTION: + case DWET_WHEEL: + handleMouseEvents(event); + break; + case DWET_KEYDOWN: + qDebug() << "FOOOOBAR!"; + } + + } else + qDebug() << "WHAT!"; + + hasEvent = eventBuffer->HasEvent(eventBuffer); + } +} + +void QDirectFbInput::handleMouseEvents(const DFBEvent &event) +{ + QEvent::Type type = QDirectFbConvenience::eventType(event.window.type); + QPoint p(event.window.cx, event.window.cy); + QPoint globalPos = globalPoint(event); + Qt::MouseButton button = QDirectFbConvenience::mouseButton(event.window.button); + Qt::MouseButtons buttons = QDirectFbConvenience::mouseButtons(event.window.buttons); + + qDebug() << QDirectFbConvenience::keyMap()->value(event.window.key_symbol); + QMouseEvent mouseEvent(type,p,globalPos,button, buttons,(Qt::KeyboardModifiers)0); + QWidget *tlw = tlwMap.value(event.window.window_id); + QApplicationPrivate::handleMouseEvent(tlw,mouseEvent); +} + +inline QPoint QDirectFbInput::globalPoint(const DFBEvent &event) const +{ + IDirectFBWindow *window; + dfbDisplayLayer->GetWindow(dfbDisplayLayer,event.window.window_id,&window); + int x,y; + window->GetPosition(window,&x,&y); + return QPoint(event.window.cx +x, event.window.cy + y); +} + diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h new file mode 100644 index 0000000..529d51a --- /dev/null +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h @@ -0,0 +1,49 @@ +#ifndef QDIRECTFBINPUT_H +#define QDIRECTFBINPUT_H + +#include +#include +#include +#include +#include + +#include + +class InputSocketWaiter : public QThread +{ + Q_OBJECT +public: + InputSocketWaiter(IDirectFBEventBuffer *eventBuffer, QObject *parent); +protected: + void run(); +signals: + void newEvent(); +private: + IDirectFBEventBuffer *eventBuffer; +}; + +class QDirectFbInput : public QObject +{ + Q_OBJECT +public: + QDirectFbInput(QObject *parent = 0); + + void addWindow(DFBWindowID id, QWidget *tlw); + +public slots: + void handleEvents(); + +private: + + void handleMouseEvents(const DFBEvent & event); + IDirectFB *dfbInterface; + IDirectFBDisplayLayer *dfbDisplayLayer; + IDirectFBEventBuffer *eventBuffer; + + QHashtlwMap; + + inline QPoint globalPoint(const DFBEvent &event) const; + +}; + +#endif // QDIRECTFBINPUT_H diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp index 117e4b5..3f10aec 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp @@ -55,6 +55,7 @@ QT_BEGIN_NAMESPACE QDirectFbGraphicsSystemScreen::QDirectFbGraphicsSystemScreen(IDirectFB *dfb, int display) + :QGraphicsSystemScreen() , m_input(this) { DFBResult result = dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &m_layer); if (result != DFB_OK) { @@ -90,7 +91,7 @@ QDirectFbGraphicsSystemScreen::~QDirectFbGraphicsSystemScreen() { } -IDirectFBWindow *QDirectFbGraphicsSystemScreen::createWindow(const QRect &rect) +IDirectFBWindow *QDirectFbGraphicsSystemScreen::createWindow(const QRect &rect, QWidget *tlw) { IDirectFBWindow *window; @@ -110,6 +111,10 @@ IDirectFBWindow *QDirectFbGraphicsSystemScreen::createWindow(const QRect &rect) if (result != DFB_OK) { DirectFBError("QDirectFbGraphicsSystemScreen: failed to create window",result); } + + DFBWindowID id; + window->GetID(window, &id); + m_input.addWindow(id,tlw); return window; } diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h index 462e963..6068495 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h @@ -42,6 +42,8 @@ #ifndef QGRAPHICSSYSTEM_MINIMAL_H #define QGRAPHICSSYSTEM_MINIMAL_H +#include "qdirectfbinput.h" + #include #include @@ -58,7 +60,7 @@ public: QImage::Format format() const { return m_format; } QSize physicalSize() const { return m_physicalSize; } - IDirectFBWindow *createWindow(const QRect &); + IDirectFBWindow *createWindow(const QRect &,QWidget *tlw); public: QRect m_geometry; @@ -66,8 +68,11 @@ public: QImage::Format m_format; QSize m_physicalSize; + QDirectFbInput m_input; + IDirectFBScreen *m_screen; IDirectFBDisplayLayer *m_layer; + }; class QDirectFbGraphicsSystem : public QGraphicsSystem diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp index 43bfd9b..6c8b2b4 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -53,7 +53,7 @@ QDirectFbWindowSurface::QDirectFbWindowSurface : QWindowSurface(window), m_screen(screen), m_lock(false) { window->setWindowSurface(this); - m_dfbWindow = m_screen->createWindow(window->rect()); + m_dfbWindow = m_screen->createWindow(window->rect(),window); DFBResult result = m_dfbWindow->GetSurface(m_dfbWindow,&m_dfbSurface); if (result != DFB_OK) { DirectFBError("QDirectFbWindowSurface::QDirectFbWindowSurface: unable to get windows surface",result); @@ -66,7 +66,6 @@ QDirectFbWindowSurface::QDirectFbWindowSurface pmdata->setBlittable(blitter); m_pixmap = new QPixmap(pmdata); - } QDirectFbWindowSurface::~QDirectFbWindowSurface() -- cgit v0.12 From 932346c345d7759b0e9280434a0371c8e9d67b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 9 Dec 2009 11:02:15 +0100 Subject: Quick fix for bitmap type --- src/gui/image/qpixmap_blitter.cpp | 3 +-- src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp | 4 +--- .../graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp | 5 ++++- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index 35d6ddb..08b0c3c 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -103,8 +103,7 @@ void QBlittablePixmapData::fromImage(const QImage &image, resize(image.width(),image.height()); QImage *thisImg = blittable()->lock(); QPainter p(thisImg); - p.drawImage(0,0,image,flags); - + p.drawImage(blittable()->rect(),image,image.rect()); } QPaintEngine *QBlittablePixmapData::paintEngine() const diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp index 4ba4ff8..cb9b411 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp @@ -64,12 +64,10 @@ void QDirectFbInput::handleEvents() switch (event.window.type) { case DWET_BUTTONDOWN: case DWET_BUTTONUP: -// case DWET_MOTION: + case DWET_MOTION: case DWET_WHEEL: handleMouseEvents(event); break; - case DWET_KEYDOWN: - qDebug() << "FOOOOBAR!"; } } else diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp index 3f10aec..b4766f3 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp @@ -151,7 +151,10 @@ QDirectFbGraphicsSystem::QDirectFbGraphicsSystem() QPixmapData *QDirectFbGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const { - return new QBlittablePixmapData(type); + if (type == QPixmapData::BitmapType) + return new QRasterPixmapData(type); + else + return new QBlittablePixmapData(type); } QWindowSurface *QDirectFbGraphicsSystem::createWindowSurface(QWidget *widget) const -- cgit v0.12 From 53b0e8047e22930bd10a8f1d5ce573b6b190fbad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 9 Dec 2009 13:12:50 +0100 Subject: Fix stupid stride error in qblitter_directfb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit How many times am I going to make that mistake?"£$%"^ --- src/gui/image/qpixmap_blitter.cpp | 2 +- src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp | 2 +- .../graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index 08b0c3c..18761a9 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -103,7 +103,7 @@ void QBlittablePixmapData::fromImage(const QImage &image, resize(image.width(),image.height()); QImage *thisImg = blittable()->lock(); QPainter p(thisImg); - p.drawImage(blittable()->rect(),image,image.rect()); + p.drawImage(0,0,image,flags); } QPaintEngine *QBlittablePixmapData::paintEngine() const diff --git a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp index 8d54c21..3c58970 100644 --- a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp @@ -79,7 +79,7 @@ QImage *QDirectFbBlitter::doLock() QImage::Format format = QDirectFbConvenience::imageFormatFromSurface(m_surface); int w, h; m_surface->GetSize(m_surface,&w,&h); - m_image = QImage(static_cast(mem),w,h,format); + m_image = QImage(static_cast(mem),w,h,bpl,format); } else { DirectFBError("Failed to lock image", result); } diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp index b4766f3..b7aab7a 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp @@ -97,15 +97,14 @@ IDirectFBWindow *QDirectFbGraphicsSystemScreen::createWindow(const QRect &rect, DFBWindowDescription description; memset(&description,0,sizeof(DFBWindowDescription)); -// description.flags = DWDESC_SURFACE_CAPS; + description.flags = DFBWindowDescriptionFlags(DWDESC_WIDTH|DWDESC_HEIGHT|DWDESC_POSX|DWDESC_POSY|DWDESC_SURFACE_CAPS|DWDESC_OPTIONS|DWDESC_CAPS); description.width = rect.width(); description.height = rect.height(); description.posx = rect.x(); description.posy = rect.y(); -// description.flags |= DWDESC_OPTIONS; -// description.options = DWOP_GHOST|DWOP_ALPHACHANNEL; -// description.caps = (DFBWindowDescription) (DWCAPS_NODECORATION|DWCAPS_DOUBLEBUFFER); -// description.surface_caps = DSCAPS_PREMULTIPLIED; + description.options = DFBWindowOptions(DWOP_GHOST|DWOP_ALPHACHANNEL); + description.caps = DFBWindowCapabilities(DWCAPS_NODECORATION|DWCAPS_DOUBLEBUFFER); + description.surface_caps = DSCAPS_PREMULTIPLIED; DFBResult result = m_layer->CreateWindow(m_layer,&description,&window); if (result != DFB_OK) { -- cgit v0.12 From 2ed5e8dc4b72f7aea5bc42643d5efd6b0dc9ff4a Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 9 Dec 2009 14:14:59 +0100 Subject: application supplied bitmap cursors for the testlite backend --- src/plugins/graphicssystems/testlite/x11util.cpp | 33 +++++++++++++++++------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/src/plugins/graphicssystems/testlite/x11util.cpp b/src/plugins/graphicssystems/testlite/x11util.cpp index 1a421e8..cb08230 100644 --- a/src/plugins/graphicssystems/testlite/x11util.cpp +++ b/src/plugins/graphicssystems/testlite/x11util.cpp @@ -943,7 +943,6 @@ void MyWindow::setCursor(QCursor * cursor) Cursor MyWindow::createCursorBitmap(QCursor * cursor) { -/* XColor bg, fg; bg.red = 255 << 8; bg.green = 255 << 8; @@ -954,21 +953,35 @@ Cursor MyWindow::createCursorBitmap(QCursor * cursor) QPoint spot = cursor->hotSpot(); Window rootwin = window; - const QBitmap * map = cursor->bitmap(); - char * mapBits = reinterpret_cast(map->toImage().bits()); - const QBitmap * mask = cursor->mask(); - char * maskBits = reinterpret_cast(mask->toImage().bits()); + QImage mapImage = cursor->bitmap()->toImage().convertToFormat(QImage::Format_MonoLSB); + QImage maskImage = cursor->mask()->toImage().convertToFormat(QImage::Format_MonoLSB); - Pixmap cp = XCreateBitmapFromData(xd->display, rootwin, mapBits, map->width(), map->height()); - Pixmap mp = XCreateBitmapFromData(xd->display, rootwin, maskBits, map->width(), map->height()); + int width = cursor->bitmap()->width(); + int height = cursor->bitmap()->height(); + int bytesPerLine = mapImage.bytesPerLine(); + int destLineSize = width / 8; + if (width % 8) + destLineSize++; + + const uchar * map = mapImage.bits(); + const uchar * mask = maskImage.bits(); + + char * mapBits = new char[height * destLineSize]; + char * maskBits = new char[height * destLineSize]; + for (int i = 0; i < height; i++) { + memcpy(mapBits + (destLineSize * i),map + (bytesPerLine * i), destLineSize); + memcpy(maskBits + (destLineSize * i),mask + (bytesPerLine * i), destLineSize); + } + + Pixmap cp = XCreateBitmapFromData(xd->display, rootwin, mapBits, width, height); + Pixmap mp = XCreateBitmapFromData(xd->display, rootwin, maskBits, width, height); Cursor c = XCreatePixmapCursor(xd->display, cp, mp, &fg, &bg, spot.x(), spot.y()); XFreePixmap(xd->display, cp); XFreePixmap(xd->display, mp); + delete[] mapBits; + delete[] maskBits; return c; -*/ - // correct pixmap cursor parsing not implemented yet - return createCursorShape(Qt::ArrowCursor); } Cursor MyWindow::createCursorShape(int cshape) -- cgit v0.12 From 594427bcd0351350c2d2298d6b193bb1014b6bda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 9 Dec 2009 15:27:35 +0100 Subject: copy and paste error :( --- src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp | 2 +- src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp index cb9b411..695c985 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp @@ -46,7 +46,7 @@ void QDirectFbInput::addWindow(DFBWindowID id, QWidget *tlw) IDirectFBWindow *window; dfbDisplayLayer->GetWindow(dfbDisplayLayer,id,&window); -// window->DisableEvents(window,DWET_ALL); + window->DisableEvents(window,DWET_ALL); window->EnableEvents(window,DFBWindowEventType(DWET_ALL)); window->SetKeySelection(window,DWKS_ALL,NULL,0); window->AttachEventBuffer(window,eventBuffer); diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp index b7aab7a..0583364 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp @@ -102,8 +102,8 @@ IDirectFBWindow *QDirectFbGraphicsSystemScreen::createWindow(const QRect &rect, description.height = rect.height(); description.posx = rect.x(); description.posy = rect.y(); - description.options = DFBWindowOptions(DWOP_GHOST|DWOP_ALPHACHANNEL); - description.caps = DFBWindowCapabilities(DWCAPS_NODECORATION|DWCAPS_DOUBLEBUFFER); + description.options = DFBWindowOptions(DWOP_ALPHACHANNEL); + description.caps = DFBWindowCapabilities(DWCAPS_DOUBLEBUFFER); description.surface_caps = DSCAPS_PREMULTIPLIED; DFBResult result = m_layer->CreateWindow(m_layer,&description,&window); -- cgit v0.12 From a4c7e91befad73601c0ee6e194a5dfeb6cac61a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 10 Dec 2009 13:37:36 +0100 Subject: Added keypresses to minimaldfbinput --- .../graphicssystems/minimaldfb/qdirectfbconvenience.cpp | 4 ++++ src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp | 14 +++++++++++++- src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h | 3 ++- .../minimaldfb/qgraphicssystem_minimaldfb.cpp | 4 ++++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp index f0293bd..cd1f568 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp @@ -83,6 +83,10 @@ QEvent::Type QDirectFbConvenience::eventType(DFBWindowEventType type) return QEvent::MouseMove; case DWET_WHEEL: return QEvent::Wheel; + case DWET_KEYDOWN: + return QEvent::KeyPress; + case DWET_KEYUP: + return QEvent::KeyRelease; default: return QEvent::None; } diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp index 695c985..7c8d3c2 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp @@ -68,6 +68,9 @@ void QDirectFbInput::handleEvents() case DWET_WHEEL: handleMouseEvents(event); break; + case DWET_KEYDOWN: + case DWET_KEYUP: + handleKeyEvents(event); } } else @@ -85,12 +88,21 @@ void QDirectFbInput::handleMouseEvents(const DFBEvent &event) Qt::MouseButton button = QDirectFbConvenience::mouseButton(event.window.button); Qt::MouseButtons buttons = QDirectFbConvenience::mouseButtons(event.window.buttons); - qDebug() << QDirectFbConvenience::keyMap()->value(event.window.key_symbol); QMouseEvent mouseEvent(type,p,globalPos,button, buttons,(Qt::KeyboardModifiers)0); QWidget *tlw = tlwMap.value(event.window.window_id); QApplicationPrivate::handleMouseEvent(tlw,mouseEvent); } +void QDirectFbInput::handleKeyEvents(const DFBEvent &event) +{ + QEvent::Type type = QDirectFbConvenience::eventType(event.window.type); + Qt::Key key = QDirectFbConvenience::keyMap()->value(event.window.key_symbol); + + QKeyEvent keyEvent(type,key,0,QChar(event.window.key_symbol));//,"",true,0); + QWidget *tlw = tlwMap.value(event.window.window_id); + QApplicationPrivate::handleKeyEvent(tlw,&keyEvent); +} + inline QPoint QDirectFbInput::globalPoint(const DFBEvent &event) const { IDirectFBWindow *window; diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h index 529d51a..ddc2dbf 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h @@ -35,7 +35,8 @@ public slots: private: - void handleMouseEvents(const DFBEvent & event); + void handleMouseEvents(const DFBEvent &event); + void handleKeyEvents(const DFBEvent &event); IDirectFB *dfbInterface; IDirectFBDisplayLayer *dfbDisplayLayer; IDirectFBEventBuffer *eventBuffer; diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp index 0583364..fe3b1d8 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp @@ -62,6 +62,10 @@ QDirectFbGraphicsSystemScreen::QDirectFbGraphicsSystemScreen(IDirectFB *dfb, int DirectFBError("QDirectFbGraphicsSystemScreen " "Unable to get primary display layer!", result); } + DFBDisplayLayerConfig *displayLayerConfig; +// m_layer->GetConfiguration(m_layer,displayLayerConfig); +// displayLayerConfig->surface_caps = DFBSurfaceCapabilities(displayLayerConfig->surface_caps | DSCAPS_PREMULTIPLIED); +// m_layer->SetConfiguration(m_layer, displayLayerConfig); m_layer->SetCooperativeLevel(m_layer,DLSCL_SHARED); IDirectFBSurface *topLevelSurface; -- cgit v0.12 From 2a0229375424499b9d83dd3214595efdc624a8a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 11 Dec 2009 09:19:59 +0100 Subject: Minimaldfb: Added keyboard modifiers to keyevents and added double click to mouseevents --- .../minimaldfb/qdirectfbconvenience.cpp | 22 ++++++++++++++++ .../minimaldfb/qdirectfbconvenience.h | 1 + .../graphicssystems/minimaldfb/qdirectfbinput.cpp | 29 ++++++++++++++++++++-- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp index cd1f568..63ae289 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp @@ -72,6 +72,28 @@ Qt::MouseButtons QDirectFbConvenience::mouseButtons(DFBInputDeviceButtonMask mas return buttons; } +Qt::KeyboardModifiers QDirectFbConvenience::keyboardModifiers(DFBInputDeviceModifierMask mask) +{ + Qt::KeyboardModifiers modifiers = Qt::NoModifier; + + if (mask & DIMM_SHIFT) { + modifiers |= Qt::ShiftModifier; + } + if (mask & DIMM_ALT) { + modifiers |= Qt::AltModifier; + } + if (mask & DIMM_ALTGR) { + modifiers |= Qt::MetaModifier; + } + if (mask & DIMM_CONTROL) { + modifiers |= Qt::ControlModifier; + } + if (mask & DIMM_META) { + modifiers | Qt::MetaModifier; + } + return modifiers; +} + QEvent::Type QDirectFbConvenience::eventType(DFBWindowEventType type) { switch(type) { diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h index 0ae1410..2f5e10b 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h @@ -23,6 +23,7 @@ public: static IDirectFB *dfbInterface() { return dfb; } static Qt::MouseButton mouseButton(DFBInputDeviceButtonIdentifier identifier); static Qt::MouseButtons mouseButtons(DFBInputDeviceButtonMask mask); + static Qt::KeyboardModifiers keyboardModifiers(DFBInputDeviceModifierMask mask); static QEvent::Type eventType(DFBWindowEventType type); static QDirectFbKeyMap *keyMap(); diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp index 7c8d3c2..b6f0b65 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp @@ -71,6 +71,9 @@ void QDirectFbInput::handleEvents() case DWET_KEYDOWN: case DWET_KEYUP: handleKeyEvents(event); + break; + default: + break; } } else @@ -87,9 +90,30 @@ void QDirectFbInput::handleMouseEvents(const DFBEvent &event) QPoint globalPos = globalPoint(event); Qt::MouseButton button = QDirectFbConvenience::mouseButton(event.window.button); Qt::MouseButtons buttons = QDirectFbConvenience::mouseButtons(event.window.buttons); + QWidget *tlw = tlwMap.value(event.window.window_id); + if (event.window.type == DWET_BUTTONDOWN) { + static long prevTime = 0; + static QWidget *prevWindow; + static int prevX = -999; + static int prevY = -999; + long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000); + timestamp /= 1000; + + if (tlw == prevWindow && timestamp - prevTime < QApplication::doubleClickInterval() + && qAbs(event.window.cx - prevX) < 5 && qAbs(event.window.cy - prevY) < 5) { + type = QEvent::MouseButtonDblClick; + prevTime = timestamp - QApplication::doubleClickInterval(); //no double click next time + } else { + prevTime = timestamp; + } + prevWindow = tlw; + prevX = event.window.cx; + prevY = event.window.cy; + } + + //DFB doesn't give keyboardmodifiers on mouseevents QMouseEvent mouseEvent(type,p,globalPos,button, buttons,(Qt::KeyboardModifiers)0); - QWidget *tlw = tlwMap.value(event.window.window_id); QApplicationPrivate::handleMouseEvent(tlw,mouseEvent); } @@ -97,8 +121,9 @@ void QDirectFbInput::handleKeyEvents(const DFBEvent &event) { QEvent::Type type = QDirectFbConvenience::eventType(event.window.type); Qt::Key key = QDirectFbConvenience::keyMap()->value(event.window.key_symbol); + Qt::KeyboardModifiers modifiers = QDirectFbConvenience::keyboardModifiers(event.window.modifiers); - QKeyEvent keyEvent(type,key,0,QChar(event.window.key_symbol));//,"",true,0); + QKeyEvent keyEvent(type,key,modifiers,QChar(event.window.key_symbol)); QWidget *tlw = tlwMap.value(event.window.window_id); QApplicationPrivate::handleKeyEvent(tlw,&keyEvent); } -- cgit v0.12 From 0447b44246ff46eb273f95b6daf3e7f7de73ca6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 11 Dec 2009 09:57:48 +0100 Subject: Minimaldfb: wheelevent --- .../graphicssystems/minimaldfb/qdirectfbinput.cpp | 17 ++++++++++++++++- src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp index b6f0b65..744b5c0 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp @@ -65,9 +65,11 @@ void QDirectFbInput::handleEvents() case DWET_BUTTONDOWN: case DWET_BUTTONUP: case DWET_MOTION: - case DWET_WHEEL: handleMouseEvents(event); break; + case DWET_WHEEL: + handleWheelEvent(event); + break; case DWET_KEYDOWN: case DWET_KEYUP: handleKeyEvents(event); @@ -117,6 +119,19 @@ void QDirectFbInput::handleMouseEvents(const DFBEvent &event) QApplicationPrivate::handleMouseEvent(tlw,mouseEvent); } +void QDirectFbInput::handleWheelEvent(const DFBEvent &event) +{ + QPoint p(event.window.cx, event.window.cy); + QPoint globalPos = globalPoint(event); + Qt::MouseButton button = QDirectFbConvenience::mouseButton(event.window.button); + Qt::MouseButtons buttons = QDirectFbConvenience::mouseButtons(event.window.buttons); + QWidget *tlw = tlwMap.value(event.window.window_id); + + QWheelEvent wheelEvent(p,globalPos,event.window.step*120,buttons,Qt::NoModifier,Qt::Vertical); + QApplicationPrivate::handleWheelEvent(tlw,wheelEvent); + +} + void QDirectFbInput::handleKeyEvents(const DFBEvent &event) { QEvent::Type type = QDirectFbConvenience::eventType(event.window.type); diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h index ddc2dbf..3a70329 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h @@ -36,6 +36,7 @@ public slots: private: void handleMouseEvents(const DFBEvent &event); + void handleWheelEvent(const DFBEvent &event); void handleKeyEvents(const DFBEvent &event); IDirectFB *dfbInterface; IDirectFBDisplayLayer *dfbDisplayLayer; -- cgit v0.12 From b2aefe0ff51a2cdb4990eb9bc19cfb044193ed21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 16 Dec 2009 14:19:45 +0100 Subject: Some cleanup and fix popup and tooltip event propagation --- .../minimaldfb/qblitter_directfb.cpp | 6 +++- .../minimaldfb/qdirectfbconvenience.cpp | 9 +----- .../minimaldfb/qdirectfbconvenience.h | 2 +- .../graphicssystems/minimaldfb/qdirectfbinput.cpp | 3 -- .../minimaldfb/qgraphicssystem_minimaldfb.cpp | 21 ++++---------- .../minimaldfb/qgraphicssystem_minimaldfb.h | 1 - .../minimaldfb/qwindowsurface_minimaldfb.cpp | 32 ++++++++++++++++++++-- .../minimaldfb/qwindowsurface_minimaldfb.h | 4 ++- 8 files changed, 45 insertions(+), 33 deletions(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp index 3c58970..a995b0f 100644 --- a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp @@ -76,7 +76,11 @@ QImage *QDirectFbBlitter::doLock() int bpl; const DFBResult result = m_surface->Lock(m_surface, DFBSurfaceLockFlags(DSLF_WRITE|DSLF_READ), static_cast(&mem), &bpl); if (result == DFB_OK) { - QImage::Format format = QDirectFbConvenience::imageFormatFromSurface(m_surface); + DFBSurfacePixelFormat dfbFormat; + DFBSurfaceCapabilities dfbCaps; + m_surface->GetPixelFormat(m_surface,&dfbFormat); + m_surface->GetCapabilities(m_surface,&dfbCaps); + QImage::Format format = QDirectFbConvenience::imageFormatFromSurfaceFormat(dfbFormat, dfbCaps); int w, h; m_surface->GetSize(m_surface,&w,&h); m_image = QImage(static_cast(mem),w,h,bpl,format); diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp index 63ae289..2bd2f3b 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp @@ -2,11 +2,8 @@ IDirectFB *QDirectFbConvenience::dfb = 0; -QImage::Format QDirectFbConvenience::imageFormatFromSurface(IDirectFBSurface *surface) +QImage::Format QDirectFbConvenience::imageFormatFromSurfaceFormat(const DFBSurfacePixelFormat format, const DFBSurfaceCapabilities caps) { - DFBSurfacePixelFormat format; - surface->GetPixelFormat(surface, &format); - switch (format) { case DSPF_LUT8: return QImage::Format_Indexed8; @@ -28,10 +25,6 @@ QImage::Format QDirectFbConvenience::imageFormatFromSurface(IDirectFBSurface *su case DSPF_RGB32: return QImage::Format_RGB32; case DSPF_ARGB: { - DFBSurfaceCapabilities caps; - const DFBResult result = surface->GetCapabilities(surface, &caps); - Q_ASSERT(result == DFB_OK); - Q_UNUSED(result); return (caps & DSCAPS_PREMULTIPLIED ? QImage::Format_ARGB32_Premultiplied : QImage::Format_ARGB32); } diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h index 2f5e10b..9c65b1f 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h @@ -17,7 +17,7 @@ public: class QDirectFbConvenience { public: - static QImage::Format imageFormatFromSurface(IDirectFBSurface *surface); + static QImage::Format imageFormatFromSurfaceFormat(const DFBSurfacePixelFormat format, const DFBSurfaceCapabilities caps); //This is set by the graphicssystem constructor static IDirectFB *dfbInterface() { return dfb; } diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp index 744b5c0..38bc41c 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp @@ -46,9 +46,6 @@ void QDirectFbInput::addWindow(DFBWindowID id, QWidget *tlw) IDirectFBWindow *window; dfbDisplayLayer->GetWindow(dfbDisplayLayer,id,&window); - window->DisableEvents(window,DWET_ALL); - window->EnableEvents(window,DFBWindowEventType(DWET_ALL)); - window->SetKeySelection(window,DWKS_ALL,NULL,0); window->AttachEventBuffer(window,eventBuffer); } diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp index fe3b1d8..d9da01b 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp @@ -68,27 +68,16 @@ QDirectFbGraphicsSystemScreen::QDirectFbGraphicsSystemScreen(IDirectFB *dfb, int // m_layer->SetConfiguration(m_layer, displayLayerConfig); m_layer->SetCooperativeLevel(m_layer,DLSCL_SHARED); - IDirectFBSurface *topLevelSurface; - //This line gives a warning - m_layer->GetSurface(m_layer, &topLevelSurface); - m_format = QDirectFbConvenience::imageFormatFromSurface(topLevelSurface); - result = m_layer->GetScreen(m_layer,&m_screen); - if (result != DFB_OK) { - DirectFBError("QDirectFbGraphicsSystemScreen: Failed to get screen", result); - } - - int w(0),h(0); - - //Asking the screen for its size gives the desktop geometry on X11 - //Thats not something we want, so ask the topLevelSorface instead - topLevelSurface->GetSize(topLevelSurface,&w,&h); + DFBDisplayLayerConfig config; + m_layer->GetConfiguration(m_layer, &config); - m_geometry = QRect(0,0,w,h); + m_format = QDirectFbConvenience::imageFormatFromSurfaceFormat(config.pixelformat, config.surface_caps); + m_geometry = QRect(0,0,config.width,config.height); const int dpi = 72; const qreal inch = 25.4; m_depth = 32; - m_physicalSize = QSize(qRound(w * inch / dpi), qRound(h *inch / dpi)); + m_physicalSize = QSize(qRound(config.width * inch / dpi), qRound(config.height *inch / dpi)); } QDirectFbGraphicsSystemScreen::~QDirectFbGraphicsSystemScreen() diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h index 6068495..ff6a426 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h @@ -70,7 +70,6 @@ public: QDirectFbInput m_input; - IDirectFBScreen *m_screen; IDirectFBDisplayLayer *m_layer; }; diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp index 6c8b2b4..e0bd33e 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -42,6 +42,7 @@ #include "qwindowsurface_minimaldfb.h" #include "qgraphicssystem_minimaldfb.h" #include "qblitter_directfb.h" +#include "qdirectfbconvenience.h" #include #include @@ -50,7 +51,7 @@ QT_BEGIN_NAMESPACE QDirectFbWindowSurface::QDirectFbWindowSurface (QDirectFbGraphicsSystemScreen *screen, QWidget *window) - : QWindowSurface(window), m_screen(screen), m_lock(false) + : QWindowSurface(window), m_screen(screen) { window->setWindowSurface(this); m_dfbWindow = m_screen->createWindow(window->rect(),window); @@ -96,7 +97,6 @@ void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const void QDirectFbWindowSurface::setGeometry(const QRect &rect) { - m_dfbSurface->Release(m_dfbSurface); QWindowSurface::setGeometry(rect); m_dfbWindow->SetBounds(m_dfbWindow, rect.x(),rect.y(), rect.width(), rect.height()); @@ -124,4 +124,32 @@ void QDirectFbWindowSurface::endPaint(const QRegion ®ion) Q_UNUSED(region); } +void QDirectFbWindowSurface::setVisible(bool visible) +{ + if (visible) { + int x = this->geometry().x(); + int y = this->geometry().y(); + m_dfbWindow->MoveTo(m_dfbWindow,x,y); + } else { + IDirectFBDisplayLayer *displayLayer; + QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),DLID_PRIMARY,&displayLayer); + + DFBDisplayLayerConfig config; + displayLayer->GetConfiguration(displayLayer,&config); + m_dfbWindow->MoveTo(m_dfbWindow,config.width+1,config.height + 1); + } +} + +Qt::WindowFlags QDirectFbWindowSurface::setWindowFlags(Qt::WindowFlags type) +{ + if (type == Qt::Popup || type == Qt::ToolTip) + { + DFBWindowOptions options; + m_dfbWindow->GetOptions(m_dfbWindow,&options); + options = DFBWindowOptions(options | DWOP_GHOST); + m_dfbWindow->SetOptions(m_dfbWindow,options); + } + return type; +} + QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h index 98575ff..aeee049 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h @@ -66,13 +66,15 @@ public: void beginPaint(const QRegion ®ion); void endPaint(const QRegion ®ion); + void setVisible(bool visible); + Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); + private: void lockSurfaceToImage(); QDirectFbGraphicsSystemScreen *m_screen; QPixmap *m_pixmap; QBlittablePixmapData *pmdata; - bool m_lock; IDirectFBWindow *m_dfbWindow; IDirectFBSurface *m_dfbSurface; -- cgit v0.12 From 0e5b1ab9bce08a1c0927e13efdc6d24873d920ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 16 Dec 2009 17:22:15 +0100 Subject: typo in pro file --- src/gui/image/image.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index b232848..10a073b 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -23,7 +23,7 @@ HEADERS += \ image/qpictureformatplugin.h \ image/qpixmap.h \ image/qpixmap_raster_p.h \ - miage/qpixmap_blitter_p.h \ + image/qpixmap_blitter_p.h \ image/qpixmapcache.h \ image/qpixmapcache_p.h \ image/qpixmapdata_p.h \ -- cgit v0.12 From 2c64beebfe265a140263ec156a0c41f93005ba73 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Fri, 18 Dec 2009 13:21:51 +0100 Subject: queued dispatch of keyboard and mouse events Mouse and Key events can't be handed off directly to QApplicationPrivate:: andleMouseEvent() and QApplicationPrivate::handleKeyEvent() from methods that are called as the slot for a QAbstractSocket::readyRead() signal. Doing so can result in event starvation in the case of things like QMenu::exec() that have their own event loop. --- src/plugins/graphicssystems/vnc/qvncserver.cpp | 46 +++++++++++++++++++++++--- src/plugins/graphicssystems/vnc/qvncserver.h | 6 ++++ 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/src/plugins/graphicssystems/vnc/qvncserver.cpp b/src/plugins/graphicssystems/vnc/qvncserver.cpp index fcff255..c2fb676 100644 --- a/src/plugins/graphicssystems/vnc/qvncserver.cpp +++ b/src/plugins/graphicssystems/vnc/qvncserver.cpp @@ -389,6 +389,10 @@ void QVNCServer::init(uint port) qvnc_cursor = 0; #endif encoder = 0; + + eventTimer.setInterval(0); + eventTimer.setSingleShot(true); + connect(&eventTimer, SIGNAL(timeout()), this, SLOT(sendInputEvents())); } QVNCServer::~QVNCServer() @@ -819,6 +823,30 @@ static bool buttonChange(Qt::MouseButtons before, Qt::MouseButtons after, Qt::Mo return false; } +void QVNCServer::sendInputEvents() +{ + EventPair pair; + for (int i = 0 ; i < eventList.count(); i++) { + pair = eventList[i]; + switch(pair.first) { + case MouseEvent: { + QMouseEvent *me = static_cast(pair.second); + QApplicationPrivate::handleMouseEvent(0, *me); + delete me; + break; + } + case KeyboardEvent: { + QKeyEvent *ke = static_cast(pair.second); + QApplicationPrivate::handleKeyEvent(0, ke); + delete ke; + break; + } + } + } + eventList.clear(); + Q_ASSERT(eventList.count() == 0); +} + void QVNCServer::pointerEvent() { QRfbPointerEvent ev; @@ -834,8 +862,13 @@ void QVNCServer::pointerEvent() bool isPress; if (buttonChange(buttons, ev.buttons, &button, &isPress)) type = isPress ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; - QMouseEvent me(type, QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), button, ev.buttons, keymod); - QApplicationPrivate::handleMouseEvent(0, me); + QMouseEvent * me = new QMouseEvent(type, QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), button, ev.buttons, keymod); + EventPair pair; + pair.first = MouseEvent; + pair.second = me; + eventList.append(pair); + if (!eventTimer.isActive()) + eventTimer.start(); buttons = ev.buttons; handleMsg = false; } @@ -861,8 +894,13 @@ void QVNCServer::keyEvent() QString str; if (ev.unicode && ev.unicode != 0xffff) str = QString(ev.unicode); - QKeyEvent keyEvent(type, ev.keycode, keymod, str); - QApplicationPrivate::handleKeyEvent(0, &keyEvent); + QKeyEvent *keyEvent = new QKeyEvent(type, ev.keycode, keymod, str); + EventPair pair; + pair.first = KeyboardEvent; + pair.second = keyEvent; + eventList.append(pair); + if (!eventTimer.isActive()) + eventTimer.start(); } handleMsg = false; } diff --git a/src/plugins/graphicssystems/vnc/qvncserver.h b/src/plugins/graphicssystems/vnc/qvncserver.h index 79b2098..be84c3c 100644 --- a/src/plugins/graphicssystems/vnc/qvncserver.h +++ b/src/plugins/graphicssystems/vnc/qvncserver.h @@ -482,6 +482,7 @@ private slots: void readClient(); void checkUpdate(); void discardClient(); + void sendInputEvents(); private: void init(uint port); @@ -519,6 +520,11 @@ private: QRfbEncoder *encoder; QVNCCursor *cursor; + + enum EventType { MouseEvent, KeyboardEvent }; + QTimer eventTimer; + typedef QPair EventPair; + QList eventList; }; -- cgit v0.12 From a2e77bb355382d484a39fcd5ab62a9f0bbd556da Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Fri, 18 Dec 2009 14:31:48 +0100 Subject: revert queueing of VNC mouse and keyboard events --- src/plugins/graphicssystems/vnc/qvncserver.cpp | 46 +++----------------------- src/plugins/graphicssystems/vnc/qvncserver.h | 6 ---- 2 files changed, 4 insertions(+), 48 deletions(-) diff --git a/src/plugins/graphicssystems/vnc/qvncserver.cpp b/src/plugins/graphicssystems/vnc/qvncserver.cpp index c2fb676..fcff255 100644 --- a/src/plugins/graphicssystems/vnc/qvncserver.cpp +++ b/src/plugins/graphicssystems/vnc/qvncserver.cpp @@ -389,10 +389,6 @@ void QVNCServer::init(uint port) qvnc_cursor = 0; #endif encoder = 0; - - eventTimer.setInterval(0); - eventTimer.setSingleShot(true); - connect(&eventTimer, SIGNAL(timeout()), this, SLOT(sendInputEvents())); } QVNCServer::~QVNCServer() @@ -823,30 +819,6 @@ static bool buttonChange(Qt::MouseButtons before, Qt::MouseButtons after, Qt::Mo return false; } -void QVNCServer::sendInputEvents() -{ - EventPair pair; - for (int i = 0 ; i < eventList.count(); i++) { - pair = eventList[i]; - switch(pair.first) { - case MouseEvent: { - QMouseEvent *me = static_cast(pair.second); - QApplicationPrivate::handleMouseEvent(0, *me); - delete me; - break; - } - case KeyboardEvent: { - QKeyEvent *ke = static_cast(pair.second); - QApplicationPrivate::handleKeyEvent(0, ke); - delete ke; - break; - } - } - } - eventList.clear(); - Q_ASSERT(eventList.count() == 0); -} - void QVNCServer::pointerEvent() { QRfbPointerEvent ev; @@ -862,13 +834,8 @@ void QVNCServer::pointerEvent() bool isPress; if (buttonChange(buttons, ev.buttons, &button, &isPress)) type = isPress ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; - QMouseEvent * me = new QMouseEvent(type, QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), button, ev.buttons, keymod); - EventPair pair; - pair.first = MouseEvent; - pair.second = me; - eventList.append(pair); - if (!eventTimer.isActive()) - eventTimer.start(); + QMouseEvent me(type, QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), button, ev.buttons, keymod); + QApplicationPrivate::handleMouseEvent(0, me); buttons = ev.buttons; handleMsg = false; } @@ -894,13 +861,8 @@ void QVNCServer::keyEvent() QString str; if (ev.unicode && ev.unicode != 0xffff) str = QString(ev.unicode); - QKeyEvent *keyEvent = new QKeyEvent(type, ev.keycode, keymod, str); - EventPair pair; - pair.first = KeyboardEvent; - pair.second = keyEvent; - eventList.append(pair); - if (!eventTimer.isActive()) - eventTimer.start(); + QKeyEvent keyEvent(type, ev.keycode, keymod, str); + QApplicationPrivate::handleKeyEvent(0, &keyEvent); } handleMsg = false; } diff --git a/src/plugins/graphicssystems/vnc/qvncserver.h b/src/plugins/graphicssystems/vnc/qvncserver.h index be84c3c..79b2098 100644 --- a/src/plugins/graphicssystems/vnc/qvncserver.h +++ b/src/plugins/graphicssystems/vnc/qvncserver.h @@ -482,7 +482,6 @@ private slots: void readClient(); void checkUpdate(); void discardClient(); - void sendInputEvents(); private: void init(uint port); @@ -520,11 +519,6 @@ private: QRfbEncoder *encoder; QVNCCursor *cursor; - - enum EventType { MouseEvent, KeyboardEvent }; - QTimer eventTimer; - typedef QPair EventPair; - QList eventList; }; -- cgit v0.12 From d7667e96f2faa83ddb2d9465320fa30ba1891292 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Fri, 18 Dec 2009 15:25:22 +0100 Subject: queue VNC keyboard and mouse events for processing outside socket readyRead() Because QAbstractSocket::readyRead() isn't delivered recursively, code that has its own event loop (such as QMenu::exec()) doesn't receive mouse or keyboard events. This fixes that by queueing the event, with processing started by a 0 timer. --- src/plugins/graphicssystems/vnc/qvncserver.cpp | 45 +++++++++++++++++++++++--- src/plugins/graphicssystems/vnc/qvncserver.h | 6 ++++ 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/src/plugins/graphicssystems/vnc/qvncserver.cpp b/src/plugins/graphicssystems/vnc/qvncserver.cpp index fcff255..cbf6054 100644 --- a/src/plugins/graphicssystems/vnc/qvncserver.cpp +++ b/src/plugins/graphicssystems/vnc/qvncserver.cpp @@ -389,6 +389,10 @@ void QVNCServer::init(uint port) qvnc_cursor = 0; #endif encoder = 0; + + eventTimer.setInterval(0); + eventTimer.setSingleShot(true); + connect(&eventTimer, SIGNAL(timeout()), this, SLOT(sendInputEvents())); } QVNCServer::~QVNCServer() @@ -819,6 +823,29 @@ static bool buttonChange(Qt::MouseButtons before, Qt::MouseButtons after, Qt::Mo return false; } +void QVNCServer::sendInputEvents() +{ + EventPair pair; + QMouseEvent *me; + QKeyEvent *ke; + + while(!eventList.isEmpty()) { + pair = eventList.takeFirst(); + switch(pair.first) { + case MouseEvent: + me = static_cast(pair.second); + QApplicationPrivate::handleMouseEvent(0, *me); + delete me; + break; + case KeyboardEvent: + ke = static_cast(pair.second); + QApplicationPrivate::handleKeyEvent(0, ke); + delete ke; + break; + } + } +} + void QVNCServer::pointerEvent() { QRfbPointerEvent ev; @@ -834,8 +861,13 @@ void QVNCServer::pointerEvent() bool isPress; if (buttonChange(buttons, ev.buttons, &button, &isPress)) type = isPress ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; - QMouseEvent me(type, QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), button, ev.buttons, keymod); - QApplicationPrivate::handleMouseEvent(0, me); + QMouseEvent * me = new QMouseEvent(type, QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), button, ev.buttons, keymod); + EventPair pair; + pair.first = MouseEvent; + pair.second = me; + eventList.append(pair); + if (!eventTimer.isActive()) + eventTimer.start(); buttons = ev.buttons; handleMsg = false; } @@ -861,8 +893,13 @@ void QVNCServer::keyEvent() QString str; if (ev.unicode && ev.unicode != 0xffff) str = QString(ev.unicode); - QKeyEvent keyEvent(type, ev.keycode, keymod, str); - QApplicationPrivate::handleKeyEvent(0, &keyEvent); + QKeyEvent *keyEvent = new QKeyEvent(type, ev.keycode, keymod, str); + EventPair pair; + pair.first = KeyboardEvent; + pair.second = keyEvent; + eventList.append(pair); + if (!eventTimer.isActive()) + eventTimer.start(); } handleMsg = false; } diff --git a/src/plugins/graphicssystems/vnc/qvncserver.h b/src/plugins/graphicssystems/vnc/qvncserver.h index 79b2098..be84c3c 100644 --- a/src/plugins/graphicssystems/vnc/qvncserver.h +++ b/src/plugins/graphicssystems/vnc/qvncserver.h @@ -482,6 +482,7 @@ private slots: void readClient(); void checkUpdate(); void discardClient(); + void sendInputEvents(); private: void init(uint port); @@ -519,6 +520,11 @@ private: QRfbEncoder *encoder; QVNCCursor *cursor; + + enum EventType { MouseEvent, KeyboardEvent }; + QTimer eventTimer; + typedef QPair EventPair; + QList eventList; }; -- cgit v0.12 From 4194cfdc5bcc7513ce3d6b8515fb4ab7c5bfdb16 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 30 Dec 2009 13:35:13 +0100 Subject: implement window flag get and set methods for VNC and linuxfb --- src/plugins/graphicssystems/fb_base/fb_base.cpp | 11 +++++++++++ src/plugins/graphicssystems/fb_base/fb_base.h | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/src/plugins/graphicssystems/fb_base/fb_base.cpp b/src/plugins/graphicssystems/fb_base/fb_base.cpp index f9ea97f..bd8d407 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.cpp +++ b/src/plugins/graphicssystems/fb_base/fb_base.cpp @@ -283,3 +283,14 @@ void QGraphicsSystemFbWindowSurface::setVisible(bool visible) visibleFlag = visible; mScreen->setDirty(geometry()); } + +Qt::WindowFlags QGraphicsSystemFbWindowSurface::setWindowFlags(Qt::WindowFlags type) +{ + flags = type; + return flags; +} + +Qt::WindowFlags QGraphicsSystemFbWindowSurface::windowFlags() const +{ + return flags; +} diff --git a/src/plugins/graphicssystems/fb_base/fb_base.h b/src/plugins/graphicssystems/fb_base/fb_base.h index 58f340d..f21cd41 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.h +++ b/src/plugins/graphicssystems/fb_base/fb_base.h @@ -61,11 +61,15 @@ public: virtual void raise(); virtual void lower(); + virtual Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); + virtual Qt::WindowFlags windowFlags() const; + protected: QGraphicsSystemFbScreen *mScreen; QRect oldGeometry; QImage mImage; bool visibleFlag; + Qt::WindowFlags flags; }; class QGraphicsSystemFbScreen : public QGraphicsSystemScreen -- cgit v0.12 From 0647b24b35e17d3948220640192415337eb87215 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 16 Dec 2009 09:43:13 -0800 Subject: Use pkg-config/directfb-config to find cflags/libs --- .../graphicssystems/minimaldfb/minimaldfb.pro | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro b/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro index 8b20c45..6f50b4a 100644 --- a/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro +++ b/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro @@ -1,12 +1,21 @@ TARGET = qminimaldfb include(../../qpluginbase.pri) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems -QMAKE_CXXFLAGS += -I/usr/local/include/directfb -LIBS += -L/usr/local/lib \ - -ldirectfb \ - -lfusion \ - -ldirect \ - -lpthread + +system(pkg-config --exists directfb) { + DIRECTFB_CFLAGS = $$system(pkg-config --cflags directfb) + DIRECTFB_LIBS = $$system(pkg-config --libs directfb) +} else { + directfb_config = $$SYSTEM(which directfb-config) + !isEmpty(directfb_config) { + DIRECTFB_CFLAGS = $$system(directfb-config --cflags) + DIRECTFB_LIBS = $$system(directfb-config --libs) + } +} + +QMAKE_CXXFLAGS += $$DIRECTFB_CFLAGS +LIBS += $$DIRECTFB_LIBS + SOURCES = main.cpp \ qgraphicssystem_minimaldfb.cpp \ qwindowsurface_minimaldfb.cpp \ -- cgit v0.12 From 1ce74505a12ebfe187cfdc26bf50195e5ce27b86 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 16 Dec 2009 09:44:23 -0800 Subject: Fix includes Include , not directfb-config/pkg-config gives us the -I to installpath/include/directfb so this include breaks a properly configured DirectFB --- src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h | 2 +- src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h | 2 +- src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h index c1fbc14..73eb7fb 100644 --- a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h +++ b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h @@ -3,7 +3,7 @@ #include -#include +#include class QDirectFbBlitter : public QBlittable { diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h index 9c65b1f..525aa22 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h @@ -5,7 +5,7 @@ #include #include -#include +#include class QDirectFbKeyMap: public QHash { diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h index 3a70329..e5bfba0 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h @@ -7,7 +7,7 @@ #include #include -#include +#include class InputSocketWaiter : public QThread { -- cgit v0.12 From 9983638b6fbb2dceeef3eac6c31d9b52384beff6 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 16 Dec 2009 09:45:45 -0800 Subject: Compile with DirectFB < 1.1 --- .../graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp | 9 +++++++-- .../graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp index d9da01b..e0479a0 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp @@ -50,7 +50,6 @@ #include #include #include -#include QT_BEGIN_NAMESPACE @@ -90,12 +89,18 @@ IDirectFBWindow *QDirectFbGraphicsSystemScreen::createWindow(const QRect &rect, DFBWindowDescription description; memset(&description,0,sizeof(DFBWindowDescription)); - description.flags = DFBWindowDescriptionFlags(DWDESC_WIDTH|DWDESC_HEIGHT|DWDESC_POSX|DWDESC_POSY|DWDESC_SURFACE_CAPS|DWDESC_OPTIONS|DWDESC_CAPS); + description.flags = DFBWindowDescriptionFlags(DWDESC_WIDTH|DWDESC_HEIGHT|DWDESC_POSX|DWDESC_POSY|DWDESC_SURFACE_CAPS +#if DIRECTFB_MINOR_VERSION >= 1 + |DWDESC_OPTIONS +#endif + |DWDESC_CAPS); description.width = rect.width(); description.height = rect.height(); description.posx = rect.x(); description.posy = rect.y(); +#if DIRECTFB_MINOR_VERSION >= 1 description.options = DFBWindowOptions(DWOP_ALPHACHANNEL); +#endif description.caps = DFBWindowCapabilities(DWCAPS_DOUBLEBUFFER); description.surface_caps = DSCAPS_PREMULTIPLIED; diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h index ff6a426..2f29ab4 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h @@ -46,6 +46,7 @@ #include #include +#include QT_BEGIN_NAMESPACE -- cgit v0.12 From be4e111877aafec15cecbd7a356fb7e6dd076c61 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 16 Dec 2009 09:59:51 -0800 Subject: Initialize variables to 0 --- .../graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp index e0bd33e..53937b8 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -49,9 +49,9 @@ QT_BEGIN_NAMESPACE -QDirectFbWindowSurface::QDirectFbWindowSurface - (QDirectFbGraphicsSystemScreen *screen, QWidget *window) - : QWindowSurface(window), m_screen(screen) +QDirectFbWindowSurface::QDirectFbWindowSurface(QDirectFbGraphicsSystemScreen *screen, QWidget *window) + : QWindowSurface(window), m_screen(screen), m_pixmap(0), pmdata(0), + m_dfbWindow(0), m_dfbSurface(0) { window->setWindowSurface(this); m_dfbWindow = m_screen->createWindow(window->rect(),window); -- cgit v0.12 From 6911786e2275b41284b19c88dc9692e78a01a647 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 16 Dec 2009 10:00:33 -0800 Subject: Flip OnSync to avoid tearing --- src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp index 53937b8..4d35376 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -91,7 +91,7 @@ void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const for (int i = 0 ; i < rects.size(); i++) { const QRect rect = rects.at(i); DFBRegion dfbReg = { rect.x() + offset.x(),rect.y() + offset.y(),rect.right() + offset.x(),rect.bottom() + offset.y()}; - m_dfbSurface->Flip(m_dfbSurface,&dfbReg,DSFLIP_BLIT); + m_dfbSurface->Flip(m_dfbSurface, &dfbReg, DFBSurfaceFlipFlags(DSFLIP_BLIT|DSFLIP_ONSYNC)); } } -- cgit v0.12 From c8ed3a4499adae2c26e66a1e00bffa28cc649b5a Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 16 Dec 2009 10:01:22 -0800 Subject: Release surface before getting a new one --- src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp index 4d35376..4a055ac 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -100,6 +100,10 @@ void QDirectFbWindowSurface::setGeometry(const QRect &rect) QWindowSurface::setGeometry(rect); m_dfbWindow->SetBounds(m_dfbWindow, rect.x(),rect.y(), rect.width(), rect.height()); + if (m_dfbSurface) { + m_dfbSurface->Release(m_dfbSurface); + m_dfbSurface = 0; + } DFBResult result = m_dfbWindow->GetSurface(m_dfbWindow,&m_dfbSurface); if (result != DFB_OK) DirectFBError("QDirectFbWindowSurface::setGeometry() failed to retrieve new surface",result); -- cgit v0.12 From c4891eb3f74db6aebf10565d629b683204aa0166 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 16 Dec 2009 10:03:18 -0800 Subject: Clear and Flip surface when resizing/creating --- .../graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp index 4a055ac..fc2a1fe 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -59,6 +59,10 @@ QDirectFbWindowSurface::QDirectFbWindowSurface(QDirectFbGraphicsSystemScreen *sc if (result != DFB_OK) { DirectFBError("QDirectFbWindowSurface::QDirectFbWindowSurface: unable to get windows surface",result); } + if (m_dfbSurface) { + m_dfbSurface->Clear(m_dfbSurface, 0, 0, 0, 0); + m_dfbSurface->Flip(m_dfbSurface, 0, DSFLIP_ONSYNC); + } QDirectFbBlitter *blitter = new QDirectFbBlitter(window->rect(), m_dfbSurface); pmdata = new QBlittablePixmapData(QPixmapData::PixmapType); int width,height; @@ -105,9 +109,15 @@ void QDirectFbWindowSurface::setGeometry(const QRect &rect) m_dfbSurface = 0; } DFBResult result = m_dfbWindow->GetSurface(m_dfbWindow,&m_dfbSurface); + if (result != DFB_OK) DirectFBError("QDirectFbWindowSurface::setGeometry() failed to retrieve new surface",result); + if (m_dfbSurface) { + m_dfbSurface->Clear(m_dfbSurface, 0, 0, 0, 0); + m_dfbSurface->Flip(m_dfbSurface, 0, DSFLIP_ONSYNC); + } + QDirectFbBlitter *blitter = new QDirectFbBlitter(rect, m_dfbSurface); pmdata->resize(rect.width(),rect.height()); pmdata->setBlittable(blitter); -- cgit v0.12 From 0191180e2fe92a2b4f709ac4eb8a1065726906c4 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 16 Dec 2009 10:03:47 -0800 Subject: Fix setWindowFlags and implement raise()/lower() --- .../minimaldfb/qwindowsurface_minimaldfb.cpp | 24 ++++++++++++++++++---- .../minimaldfb/qwindowsurface_minimaldfb.h | 2 ++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp index fc2a1fe..913e01d 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -154,16 +154,32 @@ void QDirectFbWindowSurface::setVisible(bool visible) } } -Qt::WindowFlags QDirectFbWindowSurface::setWindowFlags(Qt::WindowFlags type) +Qt::WindowFlags QDirectFbWindowSurface::setWindowFlags(Qt::WindowFlags flags) { - if (type == Qt::Popup || type == Qt::ToolTip) - { + switch (flags & Qt::WindowType_Mask) { + case Qt::Popup: + case Qt::ToolTip: { DFBWindowOptions options; m_dfbWindow->GetOptions(m_dfbWindow,&options); options = DFBWindowOptions(options | DWOP_GHOST); m_dfbWindow->SetOptions(m_dfbWindow,options); + break; } + default: + break; } - return type; + + m_dfbWindow->SetStackingClass(m_dfbWindow, flags & Qt::WindowStaysOnTopHint ? DWSC_UPPER : DWSC_MIDDLE); + return flags; +} + +void QDirectFbWindowSurface::raise() +{ + m_dfbWindow->RaiseToTop(m_dfbWindow); +} + +void QDirectFbWindowSurface::lower() +{ + m_dfbWindow->LowerToBottom(m_dfbWindow); } QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h index aeee049..3c81287 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h @@ -69,6 +69,8 @@ public: void setVisible(bool visible); Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); + void raise(); + void lower(); private: void lockSurfaceToImage(); -- cgit v0.12 From 021c5f11c3a72a04f05b3a7b52ffd14e0fc6488c Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Wed, 16 Dec 2009 10:29:19 -0800 Subject: Fix mouse events. The window coordinate is passed in x and y, not cx, cy. --- src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp index 38bc41c..e470b9a 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp @@ -85,7 +85,7 @@ void QDirectFbInput::handleEvents() void QDirectFbInput::handleMouseEvents(const DFBEvent &event) { QEvent::Type type = QDirectFbConvenience::eventType(event.window.type); - QPoint p(event.window.cx, event.window.cy); + QPoint p(event.window.x, event.window.y); QPoint globalPos = globalPoint(event); Qt::MouseButton button = QDirectFbConvenience::mouseButton(event.window.button); Qt::MouseButtons buttons = QDirectFbConvenience::mouseButtons(event.window.buttons); -- cgit v0.12 From 781e8b00979f22de15a17510121be1ad20630c7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 17 Dec 2009 11:50:43 +0100 Subject: Adding serialnumber to qpixmap_blitter --- src/gui/image/qpixmap_blitter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index 18761a9..3b18ca9 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -21,6 +21,7 @@ QBlittable *QBlittablePixmapData::blittable() const if (!m_blittable) { QBlittablePixmapData *that = const_cast(this); that->m_blittable = QApplicationPrivate::graphicsSystem()->createBlittable(QRect(0,0,w,h)); + that->setSerialNumber(m_blittable->lock()->serialNumber()); } return m_blittable; -- cgit v0.12 From 5e4b2e2591bb1b5897b29c43fa35b0a60fd43d56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 5 Jan 2010 12:09:20 +0100 Subject: Make sure that premultiplied surfaces are used and clean up a bit. Also removed alot of unnecessary windowsurface code --- src/gui/image/qpixmap_blitter.cpp | 8 ++-- src/gui/painting/qpaintengine_blitter_p.h | 1 - .../minimaldfb/qblitter_directfb.cpp | 3 +- .../minimaldfb/qdirectfbconvenience.cpp | 6 +-- .../minimaldfb/qgraphicssystem_minimaldfb.cpp | 7 +--- .../minimaldfb/qwindowsurface_minimaldfb.cpp | 44 +++++++--------------- .../minimaldfb/qwindowsurface_minimaldfb.h | 2 +- 7 files changed, 24 insertions(+), 47 deletions(-) diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index 3b18ca9..3613211 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -29,15 +29,13 @@ QBlittable *QBlittablePixmapData::blittable() const void QBlittablePixmapData::setBlittable(QBlittable *blittable) { - if (m_blittable) - delete m_blittable; + delete m_blittable; + resize(blittable->rect().width(),blittable->rect().height()); m_blittable = blittable; } void QBlittablePixmapData::resize(int width, int height) { - delete m_blittable; - m_blittable = 0; delete m_engine; m_engine = 0; d = QApplicationPrivate::graphicsSystem()->screens().at(0)->depth(); @@ -78,7 +76,7 @@ int QBlittablePixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const void QBlittablePixmapData::fill(const QColor &color) { if (blittable()->capabilities() & QBlittable::SolidRectCapability) - blittable()->fillRect(m_blittable->rect(),color); + blittable()->fillRect(QRectF(0,0,w,h),color); else blittable()->lock()->fill(color.rgb()); } diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h index 6a5462e..7f67997 100644 --- a/src/gui/painting/qpaintengine_blitter_p.h +++ b/src/gui/painting/qpaintengine_blitter_p.h @@ -8,7 +8,6 @@ class QBlittablePrivate; class QBlitterPaintEnginePrivate; class QBlittablePixmapData; -// ### find name class Q_GUI_EXPORT QBlittable { Q_DECLARE_PRIVATE(QBlittable); diff --git a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp index a995b0f..06622a1 100644 --- a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp @@ -20,7 +20,8 @@ QDirectFbBlitter::QDirectFbBlitter(const QRect &rect, IDirectFBSurface *surface) DFBSurfaceDescription surfaceDesc; surfaceDesc.width = rect.width(); surfaceDesc.height = rect.height(); - surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT); + surfaceDesc.caps = DSCAPS_PREMULTIPLIED; + surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_CAPS); IDirectFB *dfb = QDirectFbConvenience::dfbInterface(); dfb->CreateSurface(dfb,&surfaceDesc, &m_surface); diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp index 2bd2f3b..4e2085d 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp @@ -25,9 +25,9 @@ QImage::Format QDirectFbConvenience::imageFormatFromSurfaceFormat(const DFBSurfa case DSPF_RGB32: return QImage::Format_RGB32; case DSPF_ARGB: { - return (caps & DSCAPS_PREMULTIPLIED - ? QImage::Format_ARGB32_Premultiplied - : QImage::Format_ARGB32); } + if (caps & DSCAPS_PREMULTIPLIED) + return QImage::Format_ARGB32_Premultiplied; + else return QImage::Format_ARGB32; } default: break; } diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp index e0479a0..9e5e8bb 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp @@ -61,13 +61,8 @@ QDirectFbGraphicsSystemScreen::QDirectFbGraphicsSystemScreen(IDirectFB *dfb, int DirectFBError("QDirectFbGraphicsSystemScreen " "Unable to get primary display layer!", result); } - DFBDisplayLayerConfig *displayLayerConfig; -// m_layer->GetConfiguration(m_layer,displayLayerConfig); -// displayLayerConfig->surface_caps = DFBSurfaceCapabilities(displayLayerConfig->surface_caps | DSCAPS_PREMULTIPLIED); -// m_layer->SetConfiguration(m_layer, displayLayerConfig); m_layer->SetCooperativeLevel(m_layer,DLSCL_SHARED); - DFBDisplayLayerConfig config; m_layer->GetConfiguration(m_layer, &config); @@ -101,7 +96,7 @@ IDirectFBWindow *QDirectFbGraphicsSystemScreen::createWindow(const QRect &rect, #if DIRECTFB_MINOR_VERSION >= 1 description.options = DFBWindowOptions(DWOP_ALPHACHANNEL); #endif - description.caps = DFBWindowCapabilities(DWCAPS_DOUBLEBUFFER); + description.caps = DFBWindowCapabilities(DWCAPS_DOUBLEBUFFER|DWCAPS_ALPHACHANNEL); description.surface_caps = DSCAPS_PREMULTIPLIED; DFBResult result = m_layer->CreateWindow(m_layer,&description,&window); diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp index 913e01d..f7229e9 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -47,30 +47,25 @@ #include +#include + QT_BEGIN_NAMESPACE QDirectFbWindowSurface::QDirectFbWindowSurface(QDirectFbGraphicsSystemScreen *screen, QWidget *window) - : QWindowSurface(window), m_screen(screen), m_pixmap(0), pmdata(0), + : QWindowSurface(window), m_screen(screen), m_pixmap(0), m_pmdata(0), m_dfbWindow(0), m_dfbSurface(0) { window->setWindowSurface(this); m_dfbWindow = m_screen->createWindow(window->rect(),window); - DFBResult result = m_dfbWindow->GetSurface(m_dfbWindow,&m_dfbSurface); - if (result != DFB_OK) { - DirectFBError("QDirectFbWindowSurface::QDirectFbWindowSurface: unable to get windows surface",result); - } - if (m_dfbSurface) { - m_dfbSurface->Clear(m_dfbSurface, 0, 0, 0, 0); - m_dfbSurface->Flip(m_dfbSurface, 0, DSFLIP_ONSYNC); - } + m_dfbWindow->GetSurface(m_dfbWindow,&m_dfbSurface); + qDebug () << "initial surface: " << m_dfbSurface; + QDirectFbBlitter *blitter = new QDirectFbBlitter(window->rect(), m_dfbSurface); - pmdata = new QBlittablePixmapData(QPixmapData::PixmapType); - int width,height; - m_dfbSurface->GetSize(m_dfbSurface, &width, &height); - pmdata->resize(width,height); - pmdata->setBlittable(blitter); + m_pmdata = new QBlittablePixmapData(QPixmapData::PixmapType); + m_pmdata->setBlittable(blitter); + m_pixmap = new QPixmap(m_pmdata); + - m_pixmap = new QPixmap(pmdata); } QDirectFbWindowSurface::~QDirectFbWindowSurface() @@ -104,23 +99,12 @@ void QDirectFbWindowSurface::setGeometry(const QRect &rect) QWindowSurface::setGeometry(rect); m_dfbWindow->SetBounds(m_dfbWindow, rect.x(),rect.y(), rect.width(), rect.height()); - if (m_dfbSurface) { - m_dfbSurface->Release(m_dfbSurface); - m_dfbSurface = 0; - } - DFBResult result = m_dfbWindow->GetSurface(m_dfbWindow,&m_dfbSurface); - if (result != DFB_OK) - DirectFBError("QDirectFbWindowSurface::setGeometry() failed to retrieve new surface",result); - - if (m_dfbSurface) { - m_dfbSurface->Clear(m_dfbSurface, 0, 0, 0, 0); - m_dfbSurface->Flip(m_dfbSurface, 0, DSFLIP_ONSYNC); - } + //Have to add 1 ref ass it will be removed by deleting the old blitter in setBlittable + m_dfbSurface->AddRef(m_dfbSurface); + QBlittable *blittabler = new QDirectFbBlitter(rect,m_dfbSurface); + m_pmdata->setBlittable(blittabler); - QDirectFbBlitter *blitter = new QDirectFbBlitter(rect, m_dfbSurface); - pmdata->resize(rect.width(),rect.height()); - pmdata->setBlittable(blitter); } bool QDirectFbWindowSurface::scroll(const QRegion &area, int dx, int dy) diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h index 3c81287..f74fb29 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h @@ -76,7 +76,7 @@ private: QDirectFbGraphicsSystemScreen *m_screen; QPixmap *m_pixmap; - QBlittablePixmapData *pmdata; + QBlittablePixmapData *m_pmdata; IDirectFBWindow *m_dfbWindow; IDirectFBSurface *m_dfbSurface; -- cgit v0.12 From e6c02f892651e69fc7f3a1991e115a7c315cc1de Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 30 Dec 2009 15:21:30 +0100 Subject: working on cursor changes - not at all functional currently --- .../graphicssystems/minimaldfb/minimaldfb.pro | 6 +- .../graphicssystems/minimaldfb/qdirectfbcursor.cpp | 73 ++++++++++++++++++++++ .../graphicssystems/minimaldfb/qdirectfbcursor.h | 22 +++++++ .../minimaldfb/qgraphicssystem_minimaldfb.cpp | 4 ++ .../minimaldfb/qgraphicssystem_minimaldfb.h | 5 ++ 5 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp create mode 100644 src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.h diff --git a/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro b/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro index 6f50b4a..f5d2406 100644 --- a/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro +++ b/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro @@ -21,11 +21,13 @@ SOURCES = main.cpp \ qwindowsurface_minimaldfb.cpp \ qblitter_directfb.cpp \ qdirectfbconvenience.cpp \ - qdirectfbinput.cpp + qdirectfbinput.cpp \ + qdirectfbcursor.cpp HEADERS = qgraphicssystem_minimaldfb.h \ qwindowsurface_minimaldfb.h \ qblitter_directfb.h \ qdirectfbconvenience.h \ - qdirectfbinput.h + qdirectfbinput.h \ + qdirectfbcursor.h target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems INSTALLS += target diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp new file mode 100644 index 0000000..9c6cc59 --- /dev/null +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp @@ -0,0 +1,73 @@ +#include "qdirectfbcursor.h" +#include "qblitter_directfb.h" +#include "qgraphicssystem_minimaldfb.h" +#include "qdirectfbconvenience.h" + +QDirectFBCursor::QDirectFBCursor(QGraphicsSystemScreen * screen) : + QGraphicsSystemCursor(screen), surface(0) +{ + QDirectFbGraphicsSystemScreen * s; + s = static_cast(screen); + m_layer = s->m_layer; + image = new QGraphicsSystemCursorImage(0, 0, 0, 0, 0, 0); +} + +void QDirectFBCursor::changeCursor(QCursor * cursor, QWidget * widget) +{ + qDebug() << "cursor change request:" << cursor << widget; + + if (cursor->shape() != Qt::BitmapCursor) { + image->set(cursor->shape()); + } else { + qDebug() << "non-shape cursor: not implemented yet"; + return; // not attempting to deal with application supplied cursors yet + } + + // create a window to show the cursor for debugging purposes + static IDirectFBWindow * window = 0; + static IDirectFBSurface * windowSurface; + qDebug() << "window is" << window; + if (!window) { + qDebug() << "creating cursor preview window"; + DFBWindowDescription description; + description.width = 32; + description.height = 32; + description.flags = DFBWindowDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT); + qDebug() << m_layer->CreateWindow(m_layer, &description,&window); + qDebug() << window->RaiseToTop(window); + qDebug() << window->MoveTo(window, 500, 500); + qDebug() << window->GetSurface(window, &windowSurface); + } + + QImage *i = image->image(); + QRect imageRect = i->rect(); + QPixmap map = QPixmap::fromImage(*i); + + if (surface) + surface->Release(surface); + DFBSurfaceDescription surfaceDesc; + surfaceDesc.width = map.width(); + surfaceDesc.height = map.height(); + surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT); + + IDirectFB *dfb = QDirectFbConvenience::dfbInterface(); + QDirectFbConvenience::dfbInterface()->CreateSurface(QDirectFbConvenience::dfbInterface(), &surfaceDesc, &surface); + + blitter = new QDirectFbBlitter(imageRect, windowSurface); // jeremy - should be surface + blitter->drawPixmap(imageRect, map, imageRect); + + + // + // blit to the window + // + //windowSurface->Blit(windowSurface, surface, NULL, 0, 0); + + DFBResult res = m_layer->SetCursorShape( m_layer, surface, cursor->hotSpot().x(), cursor->hotSpot().y()); + qDebug() << "setCursorShape result:"; + switch(res) { + case DFB_OK: qDebug() << "OK"; break; + case DFB_INVARG: qDebug() << "DFB_INVARG"; break; + case DFB_ACCESSDENIED: qDebug() << "DFB_ACCESSDENIED"; break; + default: qDebug() << "unknown error" << res; + } +} diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.h b/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.h new file mode 100644 index 0000000..064a336 --- /dev/null +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.h @@ -0,0 +1,22 @@ +#ifndef QDIRECTFBCURSOR_H +#define QDIRECTFBCURSOR_H + +#include +#include +class QDirectFbGraphicsSystemScreen; +class QDirectFbBlitter; + +class QDirectFBCursor : public QGraphicsSystemCursor +{ +public: + QDirectFBCursor(QGraphicsSystemScreen *screem); + void changeCursor(QCursor * cursor, QWidget * widget); + +private: + IDirectFBDisplayLayer * m_layer; + IDirectFBSurface * surface; + QGraphicsSystemCursorImage * image; + QDirectFbBlitter *blitter; +}; + +#endif // QDIRECTFBCURSOR_H diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp index 9e5e8bb..c767c7c 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp @@ -43,6 +43,7 @@ #include "qwindowsurface_minimaldfb.h" #include "qblitter_directfb.h" #include "qdirectfbconvenience.h" +#include "qdirectfbcursor.h" #include #include @@ -107,6 +108,9 @@ IDirectFBWindow *QDirectFbGraphicsSystemScreen::createWindow(const QRect &rect, DFBWindowID id; window->GetID(window, &id); m_input.addWindow(id,tlw); + + cursor = new QDirectFBCursor(this); + return window; } diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h index 2f29ab4..f6ce011 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE +class QDirectFBCursor; + class QDirectFbGraphicsSystemScreen : public QGraphicsSystemScreen { public: @@ -73,6 +75,9 @@ public: IDirectFBDisplayLayer *m_layer; +private: + QDirectFBCursor * cursor; + }; class QDirectFbGraphicsSystem : public QGraphicsSystem -- cgit v0.12 From a8898716b1bf8f2b01596677bf7f913709cea3cf Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Mon, 4 Jan 2010 18:18:16 +0100 Subject: cursors starting to work. something on screen, but the images are wrong additionally, there may be access control issues. blind setting/resetting appears to be the only option --- src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp index 9c6cc59..38c6c20 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp @@ -62,7 +62,13 @@ void QDirectFBCursor::changeCursor(QCursor * cursor, QWidget * widget) // //windowSurface->Blit(windowSurface, surface, NULL, 0, 0); - DFBResult res = m_layer->SetCursorShape( m_layer, surface, cursor->hotSpot().x(), cursor->hotSpot().y()); + int xSpot = cursor->hotSpot().x(); + int ySpot = cursor->hotSpot().y(); + // The SetCursorShape() call fails if the cooperative level is DLSCL_SHARED + // Question is, how can we determine the level, to reset is properly after? + m_layer->SetCooperativeLevel(m_layer, DLSCL_ADMINISTRATIVE); + DFBResult res = m_layer->SetCursorShape( m_layer, surface, xSpot, ySpot); + m_layer->SetCooperativeLevel(m_layer, DLSCL_SHARED); // This may be wrong. could be DFSCL_FULLSCREEN or DLSCL_ADMINISTRATIVE qDebug() << "setCursorShape result:"; switch(res) { case DFB_OK: qDebug() << "OK"; break; -- cgit v0.12 From 7d005e75c5000a568454c9f13112506ad2b1b1dc Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Tue, 5 Jan 2010 11:55:35 +0100 Subject: cleanup --- .../graphicssystems/minimaldfb/qdirectfbcursor.cpp | 45 ++++------------------ 1 file changed, 8 insertions(+), 37 deletions(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp index 38c6c20..24f64e6 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp @@ -14,29 +14,12 @@ QDirectFBCursor::QDirectFBCursor(QGraphicsSystemScreen * screen) : void QDirectFBCursor::changeCursor(QCursor * cursor, QWidget * widget) { - qDebug() << "cursor change request:" << cursor << widget; - + Q_UNUSED(widget); if (cursor->shape() != Qt::BitmapCursor) { image->set(cursor->shape()); } else { qDebug() << "non-shape cursor: not implemented yet"; - return; // not attempting to deal with application supplied cursors yet - } - - // create a window to show the cursor for debugging purposes - static IDirectFBWindow * window = 0; - static IDirectFBSurface * windowSurface; - qDebug() << "window is" << window; - if (!window) { - qDebug() << "creating cursor preview window"; - DFBWindowDescription description; - description.width = 32; - description.height = 32; - description.flags = DFBWindowDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT); - qDebug() << m_layer->CreateWindow(m_layer, &description,&window); - qDebug() << window->RaiseToTop(window); - qDebug() << window->MoveTo(window, 500, 500); - qDebug() << window->GetSurface(window, &windowSurface); + return; } QImage *i = image->image(); @@ -53,27 +36,15 @@ void QDirectFBCursor::changeCursor(QCursor * cursor, QWidget * widget) IDirectFB *dfb = QDirectFbConvenience::dfbInterface(); QDirectFbConvenience::dfbInterface()->CreateSurface(QDirectFbConvenience::dfbInterface(), &surfaceDesc, &surface); - blitter = new QDirectFbBlitter(imageRect, windowSurface); // jeremy - should be surface + blitter = new QDirectFbBlitter(imageRect, surface); blitter->drawPixmap(imageRect, map, imageRect); - - // - // blit to the window - // - //windowSurface->Blit(windowSurface, surface, NULL, 0, 0); - int xSpot = cursor->hotSpot().x(); int ySpot = cursor->hotSpot().y(); - // The SetCursorShape() call fails if the cooperative level is DLSCL_SHARED - // Question is, how can we determine the level, to reset is properly after? - m_layer->SetCooperativeLevel(m_layer, DLSCL_ADMINISTRATIVE); - DFBResult res = m_layer->SetCursorShape( m_layer, surface, xSpot, ySpot); - m_layer->SetCooperativeLevel(m_layer, DLSCL_SHARED); // This may be wrong. could be DFSCL_FULLSCREEN or DLSCL_ADMINISTRATIVE - qDebug() << "setCursorShape result:"; - switch(res) { - case DFB_OK: qDebug() << "OK"; break; - case DFB_INVARG: qDebug() << "DFB_INVARG"; break; - case DFB_ACCESSDENIED: qDebug() << "DFB_ACCESSDENIED"; break; - default: qDebug() << "unknown error" << res; + + if (m_layer->SetCooperativeLevel(m_layer, DLSCL_ADMINISTRATIVE) != DFB_OK) { + return; } + m_layer->SetCursorShape( m_layer, surface, xSpot, ySpot); + m_layer->SetCooperativeLevel(m_layer, DLSCL_SHARED); } -- cgit v0.12 From a50574975b408b1de58c9822a5b6c48a094e8013 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Tue, 5 Jan 2010 14:51:53 +0100 Subject: get cursor hotspot from the graphic --- src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp index 24f64e6..50c0622 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp @@ -39,8 +39,8 @@ void QDirectFBCursor::changeCursor(QCursor * cursor, QWidget * widget) blitter = new QDirectFbBlitter(imageRect, surface); blitter->drawPixmap(imageRect, map, imageRect); - int xSpot = cursor->hotSpot().x(); - int ySpot = cursor->hotSpot().y(); + int xSpot = image->hotspot().x(); + int ySpot = image->hotspot().y(); if (m_layer->SetCooperativeLevel(m_layer, DLSCL_ADMINISTRATIVE) != DFB_OK) { return; -- cgit v0.12 From b5a1c9ba094c07c22be2d0e9896dbbafdfca5930 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 6 Jan 2010 12:31:57 +0100 Subject: removed an unnecessary call to QDirectFbConvenience::dfbInterface() --- src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp index 50c0622..074fc5a 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp @@ -33,7 +33,6 @@ void QDirectFBCursor::changeCursor(QCursor * cursor, QWidget * widget) surfaceDesc.height = map.height(); surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT); - IDirectFB *dfb = QDirectFbConvenience::dfbInterface(); QDirectFbConvenience::dfbInterface()->CreateSurface(QDirectFbConvenience::dfbInterface(), &surfaceDesc, &surface); blitter = new QDirectFbBlitter(imageRect, surface); -- cgit v0.12 From 6d7f46dd995c45c3ac9b65e35a8cf2e4d8f9225b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 5 Jan 2010 16:20:51 +0100 Subject: Cleaned up a bit in the cursor code --- .../graphicssystems/minimaldfb/qblitter_directfb.h | 4 ++++ .../minimaldfb/qdirectfbconvenience.cpp | 14 ++++++++++++++ .../graphicssystems/minimaldfb/qdirectfbconvenience.h | 4 ++++ .../graphicssystems/minimaldfb/qdirectfbcursor.cpp | 18 ++++-------------- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h index 73eb7fb..8d24678 100644 --- a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h +++ b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h @@ -1,6 +1,8 @@ #ifndef QDIRECTFBBLITTER_H #define QDIRECTFBBLITTER_H +#include "qdirectfbconvenience.h" + #include #include @@ -20,6 +22,8 @@ protected: IDirectFBSurface *m_surface; QImage m_image; + + friend class QDirectFbConvenience; }; #endif // QDIRECTFBBLITTER_H diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp index 4e2085d..03fa18f 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp @@ -1,4 +1,7 @@ #include "qdirectfbconvenience.h" +#include "qblitter_directfb.h" + +#include IDirectFB *QDirectFbConvenience::dfb = 0; @@ -35,6 +38,17 @@ QImage::Format QDirectFbConvenience::imageFormatFromSurfaceFormat(const DFBSurfa } +IDirectFBSurface *QDirectFbConvenience::dfbSurfaceForPixmapData(QPixmapData *pixmapData) +{ + QBlittablePixmapData *blittablePmData = static_cast(pixmapData); + if (blittablePmData) { + QBlittable *blittable = blittablePmData->blittable(); + QDirectFbBlitter *dfbBlitter = static_cast(blittable); + return dfbBlitter->m_surface; + } + return 0; +} + Qt::MouseButton QDirectFbConvenience::mouseButton(DFBInputDeviceButtonIdentifier identifier) { switch (identifier){ diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h index 525aa22..81524dd 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h @@ -4,6 +4,7 @@ #include #include #include +#include #include @@ -21,6 +22,9 @@ public: //This is set by the graphicssystem constructor static IDirectFB *dfbInterface() { return dfb; } + + static IDirectFBSurface *dfbSurfaceForPixmapData(QPixmapData *); + static Qt::MouseButton mouseButton(DFBInputDeviceButtonIdentifier identifier); static Qt::MouseButtons mouseButtons(DFBInputDeviceButtonMask mask); static Qt::KeyboardModifiers keyboardModifiers(DFBInputDeviceModifierMask mask); diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp index 074fc5a..e737575 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp @@ -3,12 +3,12 @@ #include "qgraphicssystem_minimaldfb.h" #include "qdirectfbconvenience.h" +#include + QDirectFBCursor::QDirectFBCursor(QGraphicsSystemScreen * screen) : QGraphicsSystemCursor(screen), surface(0) { - QDirectFbGraphicsSystemScreen * s; - s = static_cast(screen); - m_layer = s->m_layer; + QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),DLID_PRIMARY, &m_layer); image = new QGraphicsSystemCursorImage(0, 0, 0, 0, 0, 0); } @@ -26,17 +26,7 @@ void QDirectFBCursor::changeCursor(QCursor * cursor, QWidget * widget) QRect imageRect = i->rect(); QPixmap map = QPixmap::fromImage(*i); - if (surface) - surface->Release(surface); - DFBSurfaceDescription surfaceDesc; - surfaceDesc.width = map.width(); - surfaceDesc.height = map.height(); - surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT); - - QDirectFbConvenience::dfbInterface()->CreateSurface(QDirectFbConvenience::dfbInterface(), &surfaceDesc, &surface); - - blitter = new QDirectFbBlitter(imageRect, surface); - blitter->drawPixmap(imageRect, map, imageRect); + IDirectFBSurface *surface = QDirectFbConvenience::dfbSurfaceForPixmapData(map.pixmapData()); int xSpot = image->hotspot().x(); int ySpot = image->hotspot().y(); -- cgit v0.12 From 743c1e4800ff6f6a7d0b8c5bd5ac6be9d5027255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 6 Jan 2010 10:55:52 +0100 Subject: Cleanup properly in minimaldfb input --- .../graphicssystems/minimaldfb/qdirectfbinput.cpp | 43 +++++++++++++++------- .../graphicssystems/minimaldfb/qdirectfbinput.h | 9 ++++- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp index e470b9a..de50229 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp @@ -10,34 +10,46 @@ #include InputSocketWaiter::InputSocketWaiter(IDirectFBEventBuffer *eventBuffer, QObject *parent) - : QThread(parent), eventBuffer(eventBuffer) - { - this->start(); - } + : QThread(parent), m_eventBuffer(eventBuffer),m_shouldStop(false) +{ + connect(qApp,SIGNAL(aboutToQuit()),SLOT(stop())); + this->start(); +} + +InputSocketWaiter::~InputSocketWaiter() +{ + m_shouldStop = true; + m_eventBuffer->WakeUp(m_eventBuffer); + m_mutex.lock(); +} void InputSocketWaiter::run() { + m_mutex.lock(); while (1) { - eventBuffer->WaitForEvent(eventBuffer); + m_eventBuffer->WaitForEvent(m_eventBuffer); + if (m_shouldStop) + break; emit newEvent(); } + m_mutex.unlock(); } QDirectFbInput::QDirectFbInput(QObject *parent) : QObject(parent) { - DFBResult ok = DirectFBCreate(&dfbInterface); - if (ok != DFB_OK) - DirectFBError("Failed to initialise QDirectFBInput", ok); + dfbInterface = QDirectFbConvenience::dfbInterface(); - ok = dfbInterface->CreateEventBuffer(dfbInterface,&eventBuffer); + DFBResult ok = dfbInterface->CreateEventBuffer(dfbInterface,&eventBuffer); if (ok != DFB_OK) DirectFBError("Failed to initialise eventbuffer", ok); dfbInterface->GetDisplayLayer(dfbInterface,DLID_PRIMARY, &dfbDisplayLayer); - InputSocketWaiter *inputHandler = new InputSocketWaiter(eventBuffer,this); - connect(inputHandler,SIGNAL(newEvent()),this,SLOT(handleEvents())); + m_inputHandler = new InputSocketWaiter(eventBuffer,this); + connect(m_inputHandler,SIGNAL(newEvent()),this,SLOT(handleEvents())); + + connect(qApp,SIGNAL(aboutToQuit()),SLOT(applicationEnd())); } void QDirectFbInput::addWindow(DFBWindowID id, QWidget *tlw) @@ -75,8 +87,7 @@ void QDirectFbInput::handleEvents() break; } - } else - qDebug() << "WHAT!"; + } hasEvent = eventBuffer->HasEvent(eventBuffer); } @@ -116,6 +127,12 @@ void QDirectFbInput::handleMouseEvents(const DFBEvent &event) QApplicationPrivate::handleMouseEvent(tlw,mouseEvent); } +void QDirectFbInput::applicationEnd() +{ + delete m_inputHandler; + m_inputHandler = 0; +} + void QDirectFbInput::handleWheelEvent(const DFBEvent &event) { QPoint p(event.window.cx, event.window.cy); diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h index e5bfba0..84439d9 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h @@ -2,6 +2,7 @@ #define QDIRECTFBINPUT_H #include +#include #include #include #include @@ -14,12 +15,15 @@ class InputSocketWaiter : public QThread Q_OBJECT public: InputSocketWaiter(IDirectFBEventBuffer *eventBuffer, QObject *parent); + virtual ~InputSocketWaiter(); protected: void run(); signals: void newEvent(); private: - IDirectFBEventBuffer *eventBuffer; + IDirectFBEventBuffer *m_eventBuffer; + bool m_shouldStop; + QMutex m_mutex; }; class QDirectFbInput : public QObject @@ -32,6 +36,7 @@ public: public slots: void handleEvents(); + void applicationEnd(); private: @@ -46,6 +51,8 @@ private: inline QPoint globalPoint(const DFBEvent &event) const; + InputSocketWaiter *m_inputHandler; + }; #endif // QDIRECTFBINPUT_H -- cgit v0.12 From c489e061817d0880ac3f1492d8decf749a502e6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 6 Jan 2010 14:41:53 +0100 Subject: fixed minimaldfb input when mouse events that did not get delivered and refactorede a bit stuff out. DirectFB handles the singelton pattern for the dfbInterface itself --- .../minimaldfb/qdirectfbconvenience.cpp | 22 +++++++++++++++++++++- .../minimaldfb/qdirectfbconvenience.h | 5 ++--- .../graphicssystems/minimaldfb/qdirectfbinput.cpp | 7 +++++++ .../minimaldfb/qgraphicssystem_minimaldfb.cpp | 16 +++------------- .../minimaldfb/qgraphicssystem_minimaldfb.h | 2 +- 5 files changed, 34 insertions(+), 18 deletions(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp index 03fa18f..25d6258 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp @@ -3,7 +3,27 @@ #include -IDirectFB *QDirectFbConvenience::dfb = 0; +IDirectFB *QDirectFbConvenience::dfbInterface() +{ + IDirectFB *dfb; + DFBResult result = DirectFBCreate(&dfb); + if (result != DFB_OK) { + DirectFBError("QDirectFBConvenience: error creating DirectFB interface",result); + return 0; + } + return dfb; +} + +IDirectFBDisplayLayer *QDirectFbConvenience::dfbDisplayLayer(int display) +{ + IDirectFBDisplayLayer *layer; + DFBResult result = QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),display,&layer); + if (result != DFB_OK) { + DirectFBError("QDirectFbConvenience: " + "Unable to get primary display layer!", result); + } + return layer; +} QImage::Format QDirectFbConvenience::imageFormatFromSurfaceFormat(const DFBSurfacePixelFormat format, const DFBSurfaceCapabilities caps) { diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h index 81524dd..c086828 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h @@ -21,7 +21,8 @@ public: static QImage::Format imageFormatFromSurfaceFormat(const DFBSurfacePixelFormat format, const DFBSurfaceCapabilities caps); //This is set by the graphicssystem constructor - static IDirectFB *dfbInterface() { return dfb; } + static IDirectFB *dfbInterface(); + static IDirectFBDisplayLayer *dfbDisplayLayer(int display = DLID_PRIMARY); static IDirectFBSurface *dfbSurfaceForPixmapData(QPixmapData *); @@ -33,8 +34,6 @@ public: static QDirectFbKeyMap *keyMap(); private: - static void setDfbInterface(IDirectFB *dfbInterface) {dfb = dfbInterface;} - static IDirectFB *dfb; static QDirectFbKeyMap *dfbKeymap; friend class QDirectFbGraphicsSystem; }; diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp index de50229..00c2310 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp @@ -102,6 +102,9 @@ void QDirectFbInput::handleMouseEvents(const DFBEvent &event) Qt::MouseButtons buttons = QDirectFbConvenience::mouseButtons(event.window.buttons); QWidget *tlw = tlwMap.value(event.window.window_id); + IDirectFBWindow *window; + QDirectFbConvenience::dfbDisplayLayer()->GetWindow(layer,event.window.window_id,&window); + if (event.window.type == DWET_BUTTONDOWN) { static long prevTime = 0; static QWidget *prevWindow; @@ -120,6 +123,10 @@ void QDirectFbInput::handleMouseEvents(const DFBEvent &event) prevWindow = tlw; prevX = event.window.cx; prevY = event.window.cy; + + window->GrabPointer(window); + } else if (event.window.type == DWET_BUTTONUP) { + window->UngrabPointer(window); } //DFB doesn't give keyboardmodifiers on mouseevents diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp index c767c7c..2d471e4 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp @@ -54,14 +54,10 @@ QT_BEGIN_NAMESPACE -QDirectFbGraphicsSystemScreen::QDirectFbGraphicsSystemScreen(IDirectFB *dfb, int display) +QDirectFbGraphicsSystemScreen::QDirectFbGraphicsSystemScreen(int display) :QGraphicsSystemScreen() , m_input(this) { - DFBResult result = dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &m_layer); - if (result != DFB_OK) { - DirectFBError("QDirectFbGraphicsSystemScreen " - "Unable to get primary display layer!", result); - } + IDirectFBDisplayLayer *m_layer = QDirectFbConvenience::dfbDisplayLayer(display); m_layer->SetCooperativeLevel(m_layer,DLSCL_SHARED); DFBDisplayLayerConfig config; @@ -134,14 +130,8 @@ QDirectFbGraphicsSystem::QDirectFbGraphicsSystem() } delete[] argv; - result = DirectFBCreate(&dfb); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreen: error creating DirectFB interface", - result); - } - QDirectFbConvenience::setDfbInterface(dfb); - mPrimaryScreen = new QDirectFbGraphicsSystemScreen(dfb,0); + mPrimaryScreen = new QDirectFbGraphicsSystemScreen(0); mScreens.append(mPrimaryScreen); } diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h index f6ce011..892bc58 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h @@ -55,7 +55,7 @@ class QDirectFBCursor; class QDirectFbGraphicsSystemScreen : public QGraphicsSystemScreen { public: - QDirectFbGraphicsSystemScreen(IDirectFB *dfb, int display); + QDirectFbGraphicsSystemScreen(int display); ~QDirectFbGraphicsSystemScreen(); QRect geometry() const { return m_geometry; } -- cgit v0.12 From 86bc22465a43496950bc0bf8901673ccd6c65fc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 6 Jan 2010 15:16:13 +0100 Subject: Added DirectFb scrolling to minimaldfb --- .../graphicssystems/minimaldfb/qdirectfbinput.cpp | 3 ++- .../minimaldfb/qgraphicssystem_minimaldfb.cpp | 2 +- .../minimaldfb/qwindowsurface_minimaldfb.cpp | 22 +++++++++++++++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp index 00c2310..b8f6dd9 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp @@ -102,8 +102,9 @@ void QDirectFbInput::handleMouseEvents(const DFBEvent &event) Qt::MouseButtons buttons = QDirectFbConvenience::mouseButtons(event.window.buttons); QWidget *tlw = tlwMap.value(event.window.window_id); + IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); IDirectFBWindow *window; - QDirectFbConvenience::dfbDisplayLayer()->GetWindow(layer,event.window.window_id,&window); + layer->GetWindow(layer,event.window.window_id,&window); if (event.window.type == DWET_BUTTONDOWN) { static long prevTime = 0; diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp index 2d471e4..8bba616 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE QDirectFbGraphicsSystemScreen::QDirectFbGraphicsSystemScreen(int display) :QGraphicsSystemScreen() , m_input(this) { - IDirectFBDisplayLayer *m_layer = QDirectFbConvenience::dfbDisplayLayer(display); + m_layer = QDirectFbConvenience::dfbDisplayLayer(display); m_layer->SetCooperativeLevel(m_layer,DLSCL_SHARED); DFBDisplayLayerConfig config; diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp index f7229e9..93ea44f 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -107,9 +107,29 @@ void QDirectFbWindowSurface::setGeometry(const QRect &rect) } +static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int dx, int dy) +{ + const DFBRectangle rect = { r.x(), r.y(), r.width(), r.height() }; + surface->Blit(surface, surface, &rect, r.x() + dx, r.y() + dy); + const DFBRegion region = { rect.x + dx, rect.y + dy, r.right() + dx, r.bottom() + dy }; + surface->Flip(surface, ®ion, DFBSurfaceFlipFlags(DSFLIP_BLIT)); +} + bool QDirectFbWindowSurface::scroll(const QRegion &area, int dx, int dy) { - return QWindowSurface::scroll(area, dx, dy); + if (!m_dfbSurface || area.isEmpty()) + return false; + m_dfbSurface->SetBlittingFlags(m_dfbSurface, DSBLIT_NOFX); + if (area.rectCount() == 1) { + scrollSurface(m_dfbSurface, area.boundingRect(), dx, dy); + } else { + const QVector rects = area.rects(); + const int n = rects.size(); + for (int i=0; i Date: Wed, 6 Jan 2010 16:05:42 +0100 Subject: Fix wheel event reporting with a null top level widget reported --- src/gui/kernel/qapplication_lite.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index a42bfd7..57f6d72 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -621,7 +621,7 @@ void QApplicationPrivate::handleWheelEvent(QWidget *tlw, QWheelEvent &ev) // QPoint localPoint = ev.pos(); QPoint globalPoint = ev.globalPos(); // bool trustLocalPoint = !!tlw; //is there something the local point can be local to? - QWidget *mouseWidget = tlw; + QWidget *mouseWidget; qt_last_x = globalPoint.x(); qt_last_y = globalPoint.y(); @@ -636,6 +636,8 @@ void QApplicationPrivate::handleWheelEvent(QWidget *tlw, QWheelEvent &ev) if (!mouseWindow) return; + mouseWidget = mouseWindow; + if (app_do_modal && !qt_try_modal(mouseWindow, &ev) ) { qDebug() << "modal blocked wheel event" << mouseWindow; return; -- cgit v0.12 From 769ec23cc32c43ce9d519b39ac8dad2a04b78403 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 6 Jan 2010 16:10:44 +0100 Subject: VNC mouse wheen support --- src/plugins/graphicssystems/vnc/qvncserver.cpp | 50 ++++++++++++++++++++------ src/plugins/graphicssystems/vnc/qvncserver.h | 8 ++++- 2 files changed, 46 insertions(+), 12 deletions(-) diff --git a/src/plugins/graphicssystems/vnc/qvncserver.cpp b/src/plugins/graphicssystems/vnc/qvncserver.cpp index cbf6054..9576d10 100644 --- a/src/plugins/graphicssystems/vnc/qvncserver.cpp +++ b/src/plugins/graphicssystems/vnc/qvncserver.cpp @@ -316,13 +316,23 @@ bool QRfbPointerEvent::read(QTcpSocket *s) char buttonMask; s->read(&buttonMask, 1); + buttons = Qt::NoButton; + wheelDirection = WheelNone; if (buttonMask & 1) buttons |= Qt::LeftButton; if (buttonMask & 2) buttons |= Qt::MidButton; if (buttonMask & 4) buttons |= Qt::RightButton; + if (buttonMask & 8) + wheelDirection = WheelUp; + if (buttonMask & 16) + wheelDirection = WheelDown; + if (buttonMask & 32) + wheelDirection = WheelLeft; + if (buttonMask & 64) + wheelDirection = WheelRight; quint16 tmp; s->read((char *)&tmp, 2); @@ -828,6 +838,7 @@ void QVNCServer::sendInputEvents() EventPair pair; QMouseEvent *me; QKeyEvent *ke; + QWheelEvent *we; while(!eventList.isEmpty()) { pair = eventList.takeFirst(); @@ -842,6 +853,11 @@ void QVNCServer::sendInputEvents() QApplicationPrivate::handleKeyEvent(0, ke); delete ke; break; + case WheelEvent: + we = static_cast(pair.second); + QApplicationPrivate::handleWheelEvent(0, *we); + delete we; + break; } } } @@ -854,21 +870,33 @@ void QVNCServer::pointerEvent() // QWSServer::sendMouseEvent(offset + QPoint(ev.x, ev.y), ev.buttons); - //qDebug() << "pointerEvent" << ev.x << ev.y << hex << ev.buttons; - - QEvent::Type type = QEvent::MouseMove; - Qt::MouseButton button = Qt::NoButton; - bool isPress; - if (buttonChange(buttons, ev.buttons, &button, &isPress)) - type = isPress ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; - QMouseEvent * me = new QMouseEvent(type, QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), button, ev.buttons, keymod); EventPair pair; - pair.first = MouseEvent; - pair.second = me; + //qDebug() << "pointerEvent" << ev.x << ev.y << hex << ev.buttons; + if (ev.wheelDirection == ev.WheelNone) { + QEvent::Type type = QEvent::MouseMove; + Qt::MouseButton button = Qt::NoButton; + bool isPress; + if (buttonChange(buttons, ev.buttons, &button, &isPress)) + type = isPress ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; + QMouseEvent * me = new QMouseEvent(type, QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), button, ev.buttons, keymod); + pair.first = MouseEvent; + pair.second = me; + buttons = ev.buttons; + } else { + // No buttons or motion reported at the same time as wheel events + Qt::Orientation orientation; + if (ev.wheelDirection == ev.WheelLeft || ev.wheelDirection == ev.WheelRight) + orientation = Qt::Horizontal; + else + orientation = Qt::Vertical; + int delta = 120 * ((ev.wheelDirection == ev.WheelLeft || ev.wheelDirection == ev.WheelUp) ? 1 : -1); + QWheelEvent *we = new QWheelEvent(QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), delta, buttons, keymod, orientation); + pair.first = WheelEvent; + pair.second = we; + } eventList.append(pair); if (!eventTimer.isActive()) eventTimer.start(); - buttons = ev.buttons; handleMsg = false; } } diff --git a/src/plugins/graphicssystems/vnc/qvncserver.h b/src/plugins/graphicssystems/vnc/qvncserver.h index be84c3c..7532cb4 100644 --- a/src/plugins/graphicssystems/vnc/qvncserver.h +++ b/src/plugins/graphicssystems/vnc/qvncserver.h @@ -228,6 +228,12 @@ public: bool read(QTcpSocket *s); Qt::MouseButtons buttons; + enum { WheelNone, + WheelUp, + WheelDown, + WheelLeft, + WheelRight + } wheelDirection; quint16 x; quint16 y; }; @@ -521,7 +527,7 @@ private: QRfbEncoder *encoder; QVNCCursor *cursor; - enum EventType { MouseEvent, KeyboardEvent }; + enum EventType { MouseEvent, KeyboardEvent, WheelEvent }; QTimer eventTimer; typedef QPair EventPair; QList eventList; -- cgit v0.12 From e0ec5613e73d16ad91d5c267393b08f9193b4f3c Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 6 Jan 2010 18:25:34 +0100 Subject: LinuxInputMouse wheel support --- src/plugins/generic/linuxinput/qlinuxinput.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/plugins/generic/linuxinput/qlinuxinput.cpp b/src/plugins/generic/linuxinput/qlinuxinput.cpp index 48084d0..308af6b 100644 --- a/src/plugins/generic/linuxinput/qlinuxinput.cpp +++ b/src/plugins/generic/linuxinput/qlinuxinput.cpp @@ -134,6 +134,16 @@ void QLinuxInputMouseHandler::readMouseData() m_x += data->value; } else if (data->code == REL_Y) { m_y += data->value; + } else if (data->code == ABS_WHEEL) { // vertical scroll + // data->value: 1 == up, -1 == down + int delta = 120 * data->value; + QWheelEvent we(QPoint(m_x, m_y), QPoint(m_x, m_y), delta, m_buttons, Qt::NoModifier, Qt::Vertical); + QApplicationPrivate::handleWheelEvent(0, we); + } else if (data->code == ABS_THROTTLE) { // horizontal scroll + // data->value: 1 == right, -1 == left + int delta = 120 * -data->value; + QWheelEvent we(QPoint(m_x, m_y), QPoint(m_x, m_y), delta, m_buttons, Qt::NoModifier, Qt::Horizontal); + QApplicationPrivate::handleWheelEvent(0, we); } else { unknown = true; } -- cgit v0.12 From 18c551144eeeff6a2e124fc427b2a6c973516c5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 7 Jan 2010 10:07:46 +0100 Subject: Added enter/leave event in minimaldfb --- .../graphicssystems/minimaldfb/qdirectfbinput.cpp | 18 ++++++++++++++++++ .../graphicssystems/minimaldfb/qdirectfbinput.h | 1 + .../minimaldfb/qgraphicssystem_minimaldfb.cpp | 6 ++---- .../minimaldfb/qwindowsurface_minimaldfb.cpp | 8 +++++++- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp index b8f6dd9..e704aa7 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp @@ -83,6 +83,9 @@ void QDirectFbInput::handleEvents() case DWET_KEYUP: handleKeyEvents(event); break; + case DWET_ENTER: + case DWET_LEAVE: + handleEnterLeaveEvents(event); default: break; } @@ -165,6 +168,21 @@ void QDirectFbInput::handleKeyEvents(const DFBEvent &event) QApplicationPrivate::handleKeyEvent(tlw,&keyEvent); } +void QDirectFbInput::handleEnterLeaveEvents(const DFBEvent &event) +{ + QWidget *tlw = tlwMap.value(event.window.window_id); + switch (event.window.type) { + case DWET_ENTER: + QApplicationPrivate::handleEnterEvent(tlw); + break; + case DWET_LEAVE: + QApplicationPrivate::handleLeaveEvent(tlw); + break; + default: + break; + } +} + inline QPoint QDirectFbInput::globalPoint(const DFBEvent &event) const { IDirectFBWindow *window; diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h index 84439d9..8f90019 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h @@ -43,6 +43,7 @@ private: void handleMouseEvents(const DFBEvent &event); void handleWheelEvent(const DFBEvent &event); void handleKeyEvents(const DFBEvent &event); + void handleEnterLeaveEvents(const DFBEvent &event); IDirectFB *dfbInterface; IDirectFBDisplayLayer *dfbDisplayLayer; IDirectFBEventBuffer *eventBuffer; diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp index 8bba616..aef7a3d 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp @@ -64,6 +64,7 @@ QDirectFbGraphicsSystemScreen::QDirectFbGraphicsSystemScreen(int display) m_layer->GetConfiguration(m_layer, &config); m_format = QDirectFbConvenience::imageFormatFromSurfaceFormat(config.pixelformat, config.surface_caps); + qDebug() << "GraphcisSystemScreen has format: " << m_format; m_geometry = QRect(0,0,config.width,config.height); const int dpi = 72; const qreal inch = 25.4; @@ -113,9 +114,6 @@ IDirectFBWindow *QDirectFbGraphicsSystemScreen::createWindow(const QRect &rect, QDirectFbGraphicsSystem::QDirectFbGraphicsSystem() { - IDirectFB *dfb; - DFBResult result = DFB_OK; - const QStringList args = QCoreApplication::arguments(); int argc = args.size(); char **argv = new char*[argc]; @@ -123,7 +121,7 @@ QDirectFbGraphicsSystem::QDirectFbGraphicsSystem() for (int i = 0; i < argc; ++i) argv[i] = qstrdup(args.at(i).toLocal8Bit().constData()); - result = DirectFBInit(&argc, &argv); + DFBResult result = DirectFBInit(&argc, &argv); if (result != DFB_OK) { DirectFBError("QDirectFBScreen: error initializing DirectFB", result); diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp index 93ea44f..c8e4f9d 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -58,7 +58,13 @@ QDirectFbWindowSurface::QDirectFbWindowSurface(QDirectFbGraphicsSystemScreen *sc window->setWindowSurface(this); m_dfbWindow = m_screen->createWindow(window->rect(),window); m_dfbWindow->GetSurface(m_dfbWindow,&m_dfbSurface); - qDebug () << "initial surface: " << m_dfbSurface; + + DFBSurfaceCapabilities caps; + m_dfbSurface->GetCapabilities(m_dfbSurface, &caps); + DFBSurfacePixelFormat format; + m_dfbSurface->GetPixelFormat(m_dfbSurface, &format); + qDebug() << "WindowSurface format " << QDirectFbConvenience::imageFormatFromSurfaceFormat(format,caps); + QDirectFbBlitter *blitter = new QDirectFbBlitter(window->rect(), m_dfbSurface); m_pmdata = new QBlittablePixmapData(QPixmapData::PixmapType); -- cgit v0.12 From 9096336c767670b4f68d507a5116da433ecb40b0 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 8 Jan 2010 14:46:49 +0100 Subject: Alpha channel fixes for QBlittablePixmapData MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Jørgen Lind --- src/gui/image/qpixmap_blitter.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index 3613211..6ab97c1 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -75,10 +75,10 @@ int QBlittablePixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const void QBlittablePixmapData::fill(const QColor &color) { - if (blittable()->capabilities() & QBlittable::SolidRectCapability) - blittable()->fillRect(QRectF(0,0,w,h),color); + if (color.alpha() == 255 && blittable()->capabilities() & QBlittable::SolidRectCapability) + blittable()->fillRect(QRectF(0,0,w,h),color); else - blittable()->lock()->fill(color.rgb()); + blittable()->lock()->fill(color.rgba()); } QImage *QBlittablePixmapData::buffer() @@ -102,6 +102,7 @@ void QBlittablePixmapData::fromImage(const QImage &image, resize(image.width(),image.height()); QImage *thisImg = blittable()->lock(); QPainter p(thisImg); + p.setCompositionMode(QPainter::CompositionMode_Source); p.drawImage(0,0,image,flags); } -- cgit v0.12 From a98fd80bf018e21fb1d0216bccf39de57da4950c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 8 Jan 2010 15:05:49 +0100 Subject: Make minimaldfb input more efficient Reviewed-by: Andy Nichols --- src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp | 15 +++++++++++---- src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h | 5 ++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp index e704aa7..1926367 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp @@ -12,7 +12,6 @@ InputSocketWaiter::InputSocketWaiter(IDirectFBEventBuffer *eventBuffer, QObject *parent) : QThread(parent), m_eventBuffer(eventBuffer),m_shouldStop(false) { - connect(qApp,SIGNAL(aboutToQuit()),SLOT(stop())); this->start(); } @@ -20,19 +19,26 @@ InputSocketWaiter::~InputSocketWaiter() { m_shouldStop = true; m_eventBuffer->WakeUp(m_eventBuffer); - m_mutex.lock(); + m_cleanupMutex.lock(); +} + +void InputSocketWaiter::continueWaitingForEvents() +{ + m_finishedProcessingEvents.wakeAll(); } void InputSocketWaiter::run() { - m_mutex.lock(); + m_cleanupMutex.lock(); while (1) { m_eventBuffer->WaitForEvent(m_eventBuffer); if (m_shouldStop) break; emit newEvent(); + QMutex waitForProcessingMutex; + m_finishedProcessingEvents.wait(&waitForProcessingMutex); } - m_mutex.unlock(); + m_cleanupMutex.unlock(); } QDirectFbInput::QDirectFbInput(QObject *parent) @@ -94,6 +100,7 @@ void QDirectFbInput::handleEvents() hasEvent = eventBuffer->HasEvent(eventBuffer); } + m_inputHandler->continueWaitingForEvents(); } void QDirectFbInput::handleMouseEvents(const DFBEvent &event) diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h index 8f90019..74ccee2 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -16,6 +17,7 @@ class InputSocketWaiter : public QThread public: InputSocketWaiter(IDirectFBEventBuffer *eventBuffer, QObject *parent); virtual ~InputSocketWaiter(); + void continueWaitingForEvents(); protected: void run(); signals: @@ -23,7 +25,8 @@ signals: private: IDirectFBEventBuffer *m_eventBuffer; bool m_shouldStop; - QMutex m_mutex; + QMutex m_cleanupMutex; + QWaitCondition m_finishedProcessingEvents; }; class QDirectFbInput : public QObject -- cgit v0.12 From 5dfcb52fb853ae7f28acc83e2be99f999e1bf31e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 8 Jan 2010 15:13:54 +0100 Subject: Make minimaldfb input more efficient copy paste error :( --- src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp index 1926367..17fdd10 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp @@ -36,6 +36,7 @@ void InputSocketWaiter::run() break; emit newEvent(); QMutex waitForProcessingMutex; + waitForProcessingMutex.lock(); m_finishedProcessingEvents.wait(&waitForProcessingMutex); } m_cleanupMutex.unlock(); -- cgit v0.12 From 721653914597ccdec7bbf94b58e6b6879dd53755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 11 Jan 2010 16:14:33 +0100 Subject: Added colordepth convenience function in minimaldfb and added pixelformat for default dfbblitters --- src/gui/image/qpixmap_blitter.cpp | 4 +++- src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp | 10 +++++++++- .../graphicssystems/minimaldfb/qdirectfbconvenience.cpp | 5 +++++ src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h | 2 ++ .../graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp | 2 ++ .../graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp | 2 ++ 6 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index 6ab97c1..b2bb674 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -29,13 +29,15 @@ QBlittable *QBlittablePixmapData::blittable() const void QBlittablePixmapData::setBlittable(QBlittable *blittable) { - delete m_blittable; resize(blittable->rect().width(),blittable->rect().height()); m_blittable = blittable; } void QBlittablePixmapData::resize(int width, int height) { + + delete m_blittable; + m_blittable = 0; delete m_engine; m_engine = 0; d = QApplicationPrivate::graphicsSystem()->screens().at(0)->depth(); diff --git a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp index 06622a1..23e3be6 100644 --- a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp @@ -18,13 +18,16 @@ QDirectFbBlitter::QDirectFbBlitter(const QRect &rect, IDirectFBSurface *surface) m_surface = surface; } else { DFBSurfaceDescription surfaceDesc; + memset(&surfaceDesc,0,sizeof(DFBSurfaceDescription)); surfaceDesc.width = rect.width(); surfaceDesc.height = rect.height(); surfaceDesc.caps = DSCAPS_PREMULTIPLIED; - surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_CAPS); + surfaceDesc.pixelformat = DSPF_ARGB; + surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT); IDirectFB *dfb = QDirectFbConvenience::dfbInterface(); dfb->CreateSurface(dfb,&surfaceDesc, &m_surface); + m_surface->Clear(m_surface,0,0,0,0); } } @@ -36,6 +39,10 @@ QDirectFbBlitter::~QDirectFbBlitter() void QDirectFbBlitter::fillRect(const QRectF &rect, const QColor &color) { m_surface->SetColor(m_surface, color.red(), color.green(), color.blue(), color.alpha()); +// When the blitter api supports non opaque blits, also remember to change +// qpixmap_blitter.cpp::fill +// DFBSurfaceDrawingFlags drawingFlags = color.alpha() ? DSDRAW_BLEND : DSDRAW_NOFX; +// m_surface->SetDrawingFlags(m_surface, drawingFlags); m_surface->SetDrawingFlags(m_surface, DSDRAW_NOFX); m_surface->FillRectangle(m_surface, rect.x(), rect.y(), rect.width(), rect.height()); @@ -49,6 +56,7 @@ void QDirectFbBlitter::drawPixmap(const QRectF &rect, const QPixmap &pixmap, con m_surface->SetColor(m_surface, 0xff, 0xff, 0xff, 255); QPixmapData *data = pixmap.pixmapData(); + Q_ASSERT(data->width() && data->height()); Q_ASSERT(data->classId() == QPixmapData::BlitterClass); QBlittablePixmapData *blitPm = static_cast(data); QDirectFbBlitter *dfbBlitter = static_cast(blitPm->blittable()); diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp index 25d6258..57d03fc 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp @@ -58,6 +58,11 @@ QImage::Format QDirectFbConvenience::imageFormatFromSurfaceFormat(const DFBSurfa } +int QDirectFbConvenience::colorDepthForSurface(const DFBSurfacePixelFormat format) +{ + return ((0x1f << 7) & format) >> 7; +} + IDirectFBSurface *QDirectFbConvenience::dfbSurfaceForPixmapData(QPixmapData *pixmapData) { QBlittablePixmapData *blittablePmData = static_cast(pixmapData); diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h index c086828..0b1a24f 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h @@ -19,6 +19,8 @@ class QDirectFbConvenience { public: static QImage::Format imageFormatFromSurfaceFormat(const DFBSurfacePixelFormat format, const DFBSurfaceCapabilities caps); + static bool pixelFomatHasAlpha(const DFBSurfacePixelFormat format) { return (1 << 16) & format; } + static int colorDepthForSurface(const DFBSurfacePixelFormat format); //This is set by the graphicssystem constructor static IDirectFB *dfbInterface(); diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp index aef7a3d..f1f2215 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp @@ -64,6 +64,8 @@ QDirectFbGraphicsSystemScreen::QDirectFbGraphicsSystemScreen(int display) m_layer->GetConfiguration(m_layer, &config); m_format = QDirectFbConvenience::imageFormatFromSurfaceFormat(config.pixelformat, config.surface_caps); + qDebug() << QDirectFbConvenience::pixelFomatHasAlpha(config.pixelformat); + qDebug() << QDirectFbConvenience::colorDepthForSurface(config.pixelformat); qDebug() << "GraphcisSystemScreen has format: " << m_format; m_geometry = QRect(0,0,config.width,config.height); const int dpi = 72; diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp index c8e4f9d..5f03b78 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -63,6 +63,8 @@ QDirectFbWindowSurface::QDirectFbWindowSurface(QDirectFbGraphicsSystemScreen *sc m_dfbSurface->GetCapabilities(m_dfbSurface, &caps); DFBSurfacePixelFormat format; m_dfbSurface->GetPixelFormat(m_dfbSurface, &format); + qDebug() << QDirectFbConvenience::pixelFomatHasAlpha(format); + qDebug() << QDirectFbConvenience::colorDepthForSurface(format); qDebug() << "WindowSurface format " << QDirectFbConvenience::imageFormatFromSurfaceFormat(format,caps); -- cgit v0.12 From 4bbbbbcd60d621af0a80926d29a87f061a50ff85 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Mon, 11 Jan 2010 16:36:57 +0100 Subject: application supplied pixmap cursors for minimaldfb --- .../graphicssystems/minimaldfb/qdirectfbcursor.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp index e737575..229a875 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp @@ -15,22 +15,25 @@ QDirectFBCursor::QDirectFBCursor(QGraphicsSystemScreen * screen) : void QDirectFBCursor::changeCursor(QCursor * cursor, QWidget * widget) { Q_UNUSED(widget); + int xSpot; + int ySpot; + QPixmap map; + if (cursor->shape() != Qt::BitmapCursor) { image->set(cursor->shape()); + xSpot = image->hotspot().x(); + ySpot = image->hotspot().y(); + QImage *i = image->image(); + map = QPixmap::fromImage(*i); } else { - qDebug() << "non-shape cursor: not implemented yet"; - return; + QPoint point = cursor->hotSpot(); + xSpot = point.x(); + ySpot = point.y(); + map = cursor->pixmap(); } - QImage *i = image->image(); - QRect imageRect = i->rect(); - QPixmap map = QPixmap::fromImage(*i); - IDirectFBSurface *surface = QDirectFbConvenience::dfbSurfaceForPixmapData(map.pixmapData()); - int xSpot = image->hotspot().x(); - int ySpot = image->hotspot().y(); - if (m_layer->SetCooperativeLevel(m_layer, DLSCL_ADMINISTRATIVE) != DFB_OK) { return; } -- cgit v0.12 From 645f29c727f33cc9f8b00b8efcb658a050ac6a26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 12 Jan 2010 14:38:18 +0100 Subject: Fix QBlittablePixmapData::fromImage --- src/gui/image/qpixmap_blitter.cpp | 25 ++++++++++++++++++---- .../minimaldfb/qblitter_directfb.cpp | 2 +- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index b2bb674..5ce7fc1 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -102,10 +102,27 @@ void QBlittablePixmapData::fromImage(const QImage &image, Qt::ImageConversionFlags flags) { resize(image.width(),image.height()); - QImage *thisImg = blittable()->lock(); - QPainter p(thisImg); - p.setCompositionMode(QPainter::CompositionMode_Source); - p.drawImage(0,0,image,flags); + QImage *thisImg = buffer(); + + QImage correctFormatPic = image; + if (correctFormatPic.format() != thisImg->format()) + correctFormatPic = correctFormatPic.convertToFormat(thisImg->format(), flags); + + //jl: This does not ALWAYS work as expected :( +// QPainter p(thisImg); +// p.setCompositionMode(QPainter::CompositionMode_Source); +// p.drawImage(0,0,image,flags); + + //So just copy strides by hand + uchar *mem = thisImg->bits(); + const uchar *bits = correctFormatPic.bits(); + int bytesCopied = 0; + while (bytesCopied < correctFormatPic.byteCount()) { + memcpy(mem,bits,correctFormatPic.bytesPerLine()); + mem += thisImg->bytesPerLine(); + bits += correctFormatPic.bytesPerLine(); + bytesCopied+=correctFormatPic.bytesPerLine(); + } } QPaintEngine *QBlittablePixmapData::paintEngine() const diff --git a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp index 23e3be6..3772131 100644 --- a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp @@ -23,7 +23,7 @@ QDirectFbBlitter::QDirectFbBlitter(const QRect &rect, IDirectFBSurface *surface) surfaceDesc.height = rect.height(); surfaceDesc.caps = DSCAPS_PREMULTIPLIED; surfaceDesc.pixelformat = DSPF_ARGB; - surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT); + surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_CAPS | DSDESC_PIXELFORMAT); IDirectFB *dfb = QDirectFbConvenience::dfbInterface(); dfb->CreateSurface(dfb,&surfaceDesc, &m_surface); -- cgit v0.12 From d01179752907fa441ca1ae6f6e7e7b351e2a60f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 14 Jan 2010 13:48:00 +0100 Subject: minimaldfb: Set the correct SetDstBlendFunction --- src/gui/painting/qpaintengine_blitter.cpp | 4 ++-- .../graphicssystems/minimaldfb/qblitter_directfb.cpp | 14 ++++++++------ .../minimaldfb/qwindowsurface_minimaldfb.cpp | 2 -- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index 7336dcc..a954294 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -302,7 +302,7 @@ void QBlitterPaintEngine::fill(const QVectorPath &path, const QBrush &brush) void QBlitterPaintEngine::fillRect(const QRectF &rect, const QColor &color) { Q_D(QBlitterPaintEngine); - if (d->capabillities->canBlitterFillRect() && color.alpha() == 255) { + if (d->capabillities->canBlitterFillRect() && color.alpha() == 0xff) { d->fillRect(rect, color); } else { d->lock(); @@ -319,7 +319,7 @@ void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) return; Q_D(QBlitterPaintEngine); if (qbrush_style(brush) == Qt::SolidPattern - && qbrush_color(brush).alpha() == 255 + && qbrush_color(brush).alpha() == 0xff && d->capabillities->canBlitterFillRect()) { d->fillRect(rect, qbrush_color(brush)); diff --git a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp index 3772131..c2e4b4f 100644 --- a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp @@ -50,11 +50,6 @@ void QDirectFbBlitter::fillRect(const QRectF &rect, const QColor &color) void QDirectFbBlitter::drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &srcRect) { - quint32 blittingFlags = pixmap.hasAlphaChannel() ? DSBLIT_BLEND_ALPHACHANNEL : DSBLIT_NOFX; - - m_surface->SetBlittingFlags(m_surface, DFBSurfaceBlittingFlags(blittingFlags)); - m_surface->SetColor(m_surface, 0xff, 0xff, 0xff, 255); - QPixmapData *data = pixmap.pixmapData(); Q_ASSERT(data->width() && data->height()); Q_ASSERT(data->classId() == QPixmapData::BlitterClass); @@ -62,6 +57,14 @@ void QDirectFbBlitter::drawPixmap(const QRectF &rect, const QPixmap &pixmap, con QDirectFbBlitter *dfbBlitter = static_cast(blitPm->blittable()); IDirectFBSurface *s = dfbBlitter->m_surface; + + quint32 blittingFlags = pixmap.hasAlpha()? DSBLIT_BLEND_ALPHACHANNEL : DSBLIT_NOFX; + + s->SetBlittingFlags(s, DFBSurfaceBlittingFlags(blittingFlags)); + m_surface->SetBlittingFlags(m_surface, DFBSurfaceBlittingFlags(blittingFlags)); + m_surface->SetPorterDuff(m_surface,DSPD_SRC_OVER); + m_surface->SetDstBlendFunction(m_surface,DSBF_INVSRCALPHA); + const DFBRectangle sRect = { srcRect.x(), srcRect.y(), rect.width(), rect.height() }; DFBResult result; @@ -73,7 +76,6 @@ void QDirectFbBlitter::drawPixmap(const QRectF &rect, const QPixmap &pixmap, con } if (result != DFB_OK) DirectFBError("QDirectFBBlitter::drawPixmap()", result); - } QImage *QDirectFbBlitter::doLock() diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp index 5f03b78..7f3e165 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -47,8 +47,6 @@ #include -#include - QT_BEGIN_NAMESPACE QDirectFbWindowSurface::QDirectFbWindowSurface(QDirectFbGraphicsSystemScreen *screen, QWidget *window) -- cgit v0.12 From 68153ffc1ee0dcd779a4f809b614b05550a2acf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 18 Jan 2010 10:45:56 +0100 Subject: Fixed QBlittablePixmapData::fill and a clipping error in the paintengine. Should prob. refactor engine state and clip calls. --- src/gui/image/qpixmap_blitter.cpp | 7 ++++--- src/gui/painting/qpaintengine_blitter.cpp | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index 5ce7fc1..175c234 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -77,9 +77,10 @@ int QBlittablePixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const void QBlittablePixmapData::fill(const QColor &color) { - if (color.alpha() == 255 && blittable()->capabilities() & QBlittable::SolidRectCapability) - blittable()->fillRect(QRectF(0,0,w,h),color); - else + if (color.alpha() == 255 && blittable()->capabilities() & QBlittable::SolidRectCapability) { + blittable()->unlock(); + blittable()->fillRect(QRectF(0,0,w,h),color); + }else blittable()->lock()->fill(color.rgba()); } diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index a954294..43206c8 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -174,12 +174,11 @@ public: } void fillRect(const QRectF &rect, const QColor &color) { -// lock(); QRectF targetRect = rect; if (hasXForm) { targetRect = state->matrix.mapRect(rect); } - QClipData *clipData = state->clip; + const QClipData *clipData = raster->d_func()->clip();; if (clipData) { if (clipData->hasRectClip) { unlock(); -- cgit v0.12 From 900e0b47c09ec9d4d12d7de077d01b45baa7497f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 19 Jan 2010 11:32:15 +0100 Subject: Make the blitterpaintengine not create a path but call the raster implementation instead (this is a workaround for the anti-pattern that the blitterpaintengine is) --- src/gui/painting/qpaintengine_blitter.cpp | 6 ++++++ src/gui/painting/qpaintengine_blitter_p.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index 43206c8..0f6b5cf 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -587,6 +587,12 @@ void QBlitterPaintEngine::drawTextItem(const QPointF &pos, const QTextItem &ti) #endif } +void QBlitterPaintEngine::drawEllipse(const QRectF &r) +{ + Q_D(QBlitterPaintEngine); + d->lock(); + d->raster->drawEllipse(r); +} void QBlitterPaintEngine::setState(QPainterState *s) { diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h index 7f67997..cebaf21 100644 --- a/src/gui/painting/qpaintengine_blitter_p.h +++ b/src/gui/painting/qpaintengine_blitter_p.h @@ -85,6 +85,8 @@ public: virtual void drawTextItem(const QPointF &pos, const QTextItem &ti); + virtual void drawEllipse(const QRectF &r); + virtual void setState(QPainterState *s); inline QPainterState *state() { return static_cast(QPaintEngine::state); } -- cgit v0.12 From 49e5181ea9da13439200720f51c8abbe4d8141c1 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 19 Jan 2010 16:28:22 +0100 Subject: Implement support for the MIT SHM extension (turned off by default). This should be significantly faster, since we are not sending the entire backing store over the wire for every paint event. It is turned off by default for now because we don't synchronize paint events. --- .../testlite/qwindowsurface_testlite.cpp | 7 +- src/plugins/graphicssystems/testlite/testlite.pro | 2 +- src/plugins/graphicssystems/testlite/x11util.cpp | 110 +++++++++++++++++++-- src/plugins/graphicssystems/testlite/x11util.h | 11 ++- 4 files changed, 118 insertions(+), 12 deletions(-) diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp index fde54a1..c0a0cc9 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp @@ -75,7 +75,7 @@ QTestLiteWindowSurface::~QTestLiteWindowSurface() QPaintDevice *QTestLiteWindowSurface::paintDevice() { - return &xw->img; + return xw->image(); } void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) @@ -92,13 +92,12 @@ void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const void QTestLiteWindowSurface::geometryChanged(const QRect &rect) { + bool resize = rect.size() != geometry().size(); QWindowSurface::setGeometry(rect); - if (xw->img.size() != rect.size()) { - xw->img = QImage(rect.size(), mScreen->format()); + if (resize) { window()->update(); //### this is the wrong place for this... } - } diff --git a/src/plugins/graphicssystems/testlite/testlite.pro b/src/plugins/graphicssystems/testlite/testlite.pro index af8a437..d483f45 100644 --- a/src/plugins/graphicssystems/testlite/testlite.pro +++ b/src/plugins/graphicssystems/testlite/testlite.pro @@ -10,7 +10,7 @@ HEADERS = qgraphicssystem_testlite.h qwindowsurface_testlite.h HEADERS += x11util.h SOURCES += x11util.cpp -LIBS += -lX11 +LIBS += -lX11 -lXext target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems diff --git a/src/plugins/graphicssystems/testlite/x11util.cpp b/src/plugins/graphicssystems/testlite/x11util.cpp index cb08230..f3b6dc2 100644 --- a/src/plugins/graphicssystems/testlite/x11util.cpp +++ b/src/plugins/graphicssystems/testlite/x11util.cpp @@ -57,6 +57,11 @@ #include +# include +# include +# include + + #include #include #include @@ -68,6 +73,10 @@ //#define MYX11_DEBUG +//MIT SHM disabled by default, since we haven't implemented ShmCompletion synchronization yet + +#define DONT_USE_MIT_SHM + static int (*original_x_errhandler)(Display *dpy, XErrorEvent *); static bool seen_badwindow; @@ -307,12 +316,15 @@ MyDisplay::MyDisplay() exit(1); } +#ifndef DONT_USE_MIT_SHM + Status MIT_SHM_extension_supported = XShmQueryExtension (display); + Q_ASSERT(MIT_SHM_extension_supported == True); +#endif original_x_errhandler = XSetErrorHandler(qt_x_errhandler); if (qgetenv("DO_X_SYNCHRONIZE").toInt()) XSynchronize(display, true); - screen = DefaultScreen(display); width = DisplayWidth(display, screen); height = DisplayHeight(display, screen); @@ -367,6 +379,16 @@ void MyDisplay::eventDispatcher() } } +struct MyShmImageInfo { + MyShmImageInfo(Display *xdisplay) : image(0), display(xdisplay) {} + ~MyShmImageInfo() { destroy(); } + + void destroy(); + + XShmSegmentInfo shminfo; + XImage *image; + Display *display; +}; MyWindow::MyWindow(MyDisplay *display, int x, int y, int w, int h) { @@ -407,6 +429,9 @@ MyWindow::MyWindow(MyDisplay *display, int x, int y, int w, int h) setWindowTitle(QLatin1String("Qt Lighthouse")); currentCursor = -1; + + image_info = 0; + } @@ -432,6 +457,8 @@ MyWindow::~MyWindow() XDestroyWindow(xd->display, window); xd->windowList.removeAll(this); + + delete image_info; } GC MyWindow::createGC() @@ -453,9 +480,14 @@ void MyWindow::closeEvent() void MyWindow::paintEvent() { Visual *visual = DefaultVisual(xd->display, xd->screen); - - if (!img.isNull()) { - QImage image = img.convertToFormat(QImage::Format_RGB32); +#ifdef MYX11_DEBUG + qDebug() << "MyWindow::paintEvent" << shm_img.size(); +#endif +#ifdef DONT_USE_MIT_SHM + // just convert the image every time... + if (!shm_img.isNull()) { + QImage image = shm_img; + //img.convertToFormat( XImage *xi = XCreateImage(xd->display, visual, 24, ZPixmap, 0, (char *) image.scanLine(0), image.width(), image.height(), 32, image.bytesPerLine()); @@ -468,6 +500,65 @@ void MyWindow::paintEvent() xi->data = 0; // QImage owns these bits XDestroyImage(xi); } +#else + // Use MIT_SHM + if (image_info->image) { + //qDebug() << "Here we go" << image_info->image->width << image_info->image->height; + int x = 0; + int y = 0; + // We should really set send_event to true, and then use the XShmCompletionEvent + // to synchronize painting + XShmPutImage (xd->display, window, gc, image_info->image, 0, 0, + x, y, image_info->image->width, image_info->image->height, + /*send_event*/ false); + + //### This makes output visible, probably not ideal from a performance point of view... + XFlush(xd->display); + } +#endif +} + +#ifndef DONT_USE_MIT_SHM +void MyShmImageInfo::destroy() +{ + XShmDetach (display, &shminfo); + XDestroyImage (image); + shmdt (shminfo.shmaddr); + shmctl (shminfo.shmid, IPC_RMID, 0); +} +#endif + +void MyWindow::resizeShmImage(int width, int height) +{ +#ifdef DONT_USE_MIT_SHM + shm_img = QImage(width, height, QImage::Format_RGB32); +#else + if (image_info) + image_info->destroy(); + else + image_info = new MyShmImageInfo(xd->display); + + Visual *visual = DefaultVisual(xd->display, xd->screen); + + + XImage *image = XShmCreateImage (xd->display, visual, 24, ZPixmap, 0, + &image_info->shminfo, width, height); + + + image_info->shminfo.shmid = shmget (IPC_PRIVATE, + image->bytes_per_line * image->height, IPC_CREAT|0777); + + image_info->shminfo.shmaddr = image->data = (char*)shmat (image_info->shminfo.shmid, 0, 0); + image_info->shminfo.readOnly = False; + + image_info->image = image; + + Status shm_attach_status = XShmAttach(xd->display, &image_info->shminfo); + + Q_ASSERT(shm_attach_status == True); + + shm_img = QImage( (uchar*) image->data, image->width, image->height, image->bytes_per_line, QImage::Format_RGB32 ); +#endif } void MyWindow::resizeEvent(XConfigureEvent *e) @@ -484,8 +575,11 @@ void MyWindow::resizeEvent(XConfigureEvent *e) height = e->height; #ifdef MYX11_DEBUG - qDebug() << hex << window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << "geometry" << xpos << ypos << width << height; + qDebug() << hex << window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << "geometry" << xpos << ypos << width << height << "img:" << shm_img.size(); #endif + if (shm_img.size() != QSize(width, height)) + resizeShmImage(width, height); + windowSurface->handleGeometryChange(xpos, ypos, width, height); } @@ -499,9 +593,13 @@ void MyWindow::setSize(int w, int h) void MyWindow::setGeometry(int x, int y, int w, int h) { #ifdef MYX11_DEBUG - qDebug() << "MyWindow::setGeometry" << hex << window << dec << x << y << w << h; + qDebug() << "MyWindow::setGeometry" << hex << window << dec << x << y << w << h << "img:" << shm_img.size(); #endif XMoveResizeWindow(xd->display, window, x, y, w, h); + + if (shm_img.size() != QSize(w, h)) { + resizeShmImage(w, h); + } } diff --git a/src/plugins/graphicssystems/testlite/x11util.h b/src/plugins/graphicssystems/testlite/x11util.h index 2a73f3e..08fd0ce 100644 --- a/src/plugins/graphicssystems/testlite/x11util.h +++ b/src/plugins/graphicssystems/testlite/x11util.h @@ -86,6 +86,8 @@ public: //### class QTestLiteWindowSurface; //### abstract callback interface, anyone? +struct MyShmImageInfo; + class MyWindow : public QObject { Q_OBJECT; @@ -120,11 +122,12 @@ public: void setWindowTitle(const QString &title); + QImage *image() { return &shm_img; } + public: //### int xpos, ypos; int width, height; - QImage img; Window window; MyDisplay *xd; GC gc; @@ -132,6 +135,12 @@ public: //### QTestLiteWindowSurface *windowSurface; int currentCursor; + +private: + void resizeShmImage(int width, int height); + + QImage shm_img; + MyShmImageInfo *image_info; }; class MyX11CursorNode -- cgit v0.12 From a8cf2de36dc570d2e73248d4cbe88ee3eb330dc0 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 19 Jan 2010 17:27:42 +0100 Subject: Enable MIT SHM and implement scrolling in the window surface Stealing a bit from the Qt X11 source code... --- .../testlite/qwindowsurface_testlite.cpp | 59 +++++++++++++++++++++- src/plugins/graphicssystems/testlite/x11util.cpp | 14 +++-- 2 files changed, 64 insertions(+), 9 deletions(-) diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp index c0a0cc9..0afbf2f 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp @@ -114,11 +114,68 @@ void QTestLiteWindowSurface::setGeometry(const QRect &rect) xw->setGeometry(rect.x(), rect.y(), rect.width(), rect.height()); } +//### scroll logic copied from QRasterWindowSurface, we should make better API for this + +void copied_qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset) +{ + // make sure we don't detach + uchar *mem = const_cast(const_cast(img).bits()); + + int lineskip = img.bytesPerLine(); + int depth = img.depth() >> 3; + + const QRect imageRect(0, 0, img.width(), img.height()); + const QRect r = rect & imageRect & imageRect.translated(-offset); + const QPoint p = rect.topLeft() + offset; + + if (r.isEmpty()) + return; + + const uchar *src; + uchar *dest; + + if (r.top() < p.y()) { + src = mem + r.bottom() * lineskip + r.left() * depth; + dest = mem + (p.y() + r.height() - 1) * lineskip + p.x() * depth; + lineskip = -lineskip; + } else { + src = mem + r.top() * lineskip + r.left() * depth; + dest = mem + p.y() * lineskip + p.x() * depth; + } + + const int w = r.width(); + int h = r.height(); + const int bytes = w * depth; + + // overlapping segments? + if (offset.y() == 0 && qAbs(offset.x()) < w) { + do { + ::memmove(dest, src, bytes); + dest += lineskip; + src += lineskip; + } while (--h); + } else { + do { + ::memcpy(dest, src, bytes); + dest += lineskip; + src += lineskip; + } while (--h); + } +} + bool QTestLiteWindowSurface::scroll(const QRegion &area, int dx, int dy) { - return QWindowSurface::scroll(area, dx, dy); + if (!xw->image() || xw->image()->isNull()) + return false; + + const QVector rects = area.rects(); + for (int i = 0; i < rects.size(); ++i) + copied_qt_scrollRectInImage(*xw->image(), rects.at(i), QPoint(dx, dy)); + + return true; } + void QTestLiteWindowSurface::beginPaint(const QRegion ®ion) { Q_UNUSED(region); diff --git a/src/plugins/graphicssystems/testlite/x11util.cpp b/src/plugins/graphicssystems/testlite/x11util.cpp index f3b6dc2..de2a6d9 100644 --- a/src/plugins/graphicssystems/testlite/x11util.cpp +++ b/src/plugins/graphicssystems/testlite/x11util.cpp @@ -73,9 +73,7 @@ //#define MYX11_DEBUG -//MIT SHM disabled by default, since we haven't implemented ShmCompletion synchronization yet - -#define DONT_USE_MIT_SHM +//#define DONT_USE_MIT_SHM static int (*original_x_errhandler)(Display *dpy, XErrorEvent *); static bool seen_badwindow; @@ -506,14 +504,14 @@ void MyWindow::paintEvent() //qDebug() << "Here we go" << image_info->image->width << image_info->image->height; int x = 0; int y = 0; - // We should really set send_event to true, and then use the XShmCompletionEvent - // to synchronize painting + + // We could set send_event to true, and then use the ShmCompletion to synchronize, + // but let's do like Qt/11 and just use XSync XShmPutImage (xd->display, window, gc, image_info->image, 0, 0, x, y, image_info->image->width, image_info->image->height, - /*send_event*/ false); + /*send_event*/ False); - //### This makes output visible, probably not ideal from a performance point of view... - XFlush(xd->display); + XSync(xd->display, False); } #endif } -- cgit v0.12 From 5628a07e554d220396548f6914c798da8a556585 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 22 Jan 2010 10:42:43 +0100 Subject: Implement grabWindow() --- .../testlite/qgraphicssystem_testlite.cpp | 4 +-- src/plugins/graphicssystems/testlite/x11util.cpp | 42 +++++++++++++++++++++- src/plugins/graphicssystems/testlite/x11util.h | 1 + 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp index 72d364a..ed8f883 100644 --- a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp @@ -112,8 +112,8 @@ QWindowSurface *QTestLiteGraphicsSystem::createWindowSurface(QWidget *widget) co QPixmap QTestLiteGraphicsSystem::grabWindow(WId window, int x, int y, int width, int height) const { - qDebug() << "grabWindow" << hex << window << dec<< x << y << width << height; - return QPixmap(); + QImage img = xd->grabWindow(window, x, y, width, height); + return QPixmap::fromImage(img); } diff --git a/src/plugins/graphicssystems/testlite/x11util.cpp b/src/plugins/graphicssystems/testlite/x11util.cpp index de2a6d9..7ad3ed5 100644 --- a/src/plugins/graphicssystems/testlite/x11util.cpp +++ b/src/plugins/graphicssystems/testlite/x11util.cpp @@ -377,6 +377,45 @@ void MyDisplay::eventDispatcher() } } + +QImage MyDisplay::grabWindow(Window window, int x, int y, int w, int h) +{ + if (w == 0 || h ==0) + return QImage(); + + //WinId 0 means the desktop widget + if (!window) + window = rootWindow(); + + XWindowAttributes window_attr; + if (!XGetWindowAttributes(display, window, &window_attr)) + return QImage(); + + if (w < 0) + w = window_attr.width - x; + if (h < 0) + h = window_attr.height - y; + + // Ideally, we should also limit ourselves to the screen area, but the Qt docs say + // that it's "unsafe" to go outside the screen, so we can ignore that problem. + + //We're definitely not optimizing for speed... + XImage *xi = XGetImage(display, window, x, y, w, h, AllPlanes, ZPixmap); + + if (!xi) + return QImage(); + + //taking a copy to make sure we have ownership -- not fast + QImage result = QImage( (uchar*) xi->data, xi->width, xi->height, xi->bytes_per_line, QImage::Format_RGB32 ).copy(); + + XDestroyImage(xi); + + return result; +} + + + + struct MyShmImageInfo { MyShmImageInfo(Display *xdisplay) : image(0), display(xdisplay) {} ~MyShmImageInfo() { destroy(); } @@ -477,13 +516,14 @@ void MyWindow::closeEvent() void MyWindow::paintEvent() { - Visual *visual = DefaultVisual(xd->display, xd->screen); #ifdef MYX11_DEBUG qDebug() << "MyWindow::paintEvent" << shm_img.size(); #endif #ifdef DONT_USE_MIT_SHM // just convert the image every time... if (!shm_img.isNull()) { + Visual *visual = DefaultVisual(xd->display, xd->screen); + QImage image = shm_img; //img.convertToFormat( XImage *xi = XCreateImage(xd->display, visual, 24, ZPixmap, diff --git a/src/plugins/graphicssystems/testlite/x11util.h b/src/plugins/graphicssystems/testlite/x11util.h index 08fd0ce..db87d92 100644 --- a/src/plugins/graphicssystems/testlite/x11util.h +++ b/src/plugins/graphicssystems/testlite/x11util.h @@ -68,6 +68,7 @@ public: unsigned long whitePixel() { return WhitePixel(display, screen); } bool handleEvent(XEvent *xe); + QImage grabWindow(Window w, int x, int y, int w, int h); public slots: void eventDispatcher(); -- cgit v0.12 From 05fefd9fcfb05d6ca6d60c1da2d8a1dca9b32874 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 22 Jan 2010 13:55:31 +0100 Subject: revert parts of 10392eef4fd4f9 We can't call QCOMPARE from within a nested function, because the return statement will just exit that function. VERIFY_COLOR can't be turned into a function this way. --- tests/auto/qwidget/tst_qwidget.cpp | 50 ++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index ee4e726..ea90ae3 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -5439,26 +5439,24 @@ public: QRegion r; }; -template -void verifyColor(R const& region, C const& color) -{ - const QRegion r = QRegion(region); - for (int i = 0; i < r.rects().size(); ++i) { - const QRect rect = r.rects().at(i); - for (int t = 0; t < 5; t++) { - const QPixmap pixmap = QPixmap::grabWindow(QDesktopWidget().winId(), - rect.left(), rect.top(), - rect.width(), rect.height()); - QCOMPARE(pixmap.size(), rect.size()); - QPixmap expectedPixmap(pixmap); /* ensure equal formats */ - expectedPixmap.fill(color); - if (pixmap.toImage().pixel(0,0) != QColor(color).rgb() && t < 4 ) - { QTest::qWait(200); continue; } - QCOMPARE(pixmap.toImage().pixel(0,0), QColor(color).rgb()); - QCOMPARE(pixmap, expectedPixmap); - break; - } - } +#define VERIFY_COLOR(region, color) { \ + const QRegion r = QRegion(region); \ + for (int i = 0; i < r.rects().size(); ++i) { \ + const QRect rect = r.rects().at(i); \ + for (int t = 0; t < 5; t++) { \ + const QPixmap pixmap = QPixmap::grabWindow(QDesktopWidget().winId(), \ + rect.left(), rect.top(), \ + rect.width(), rect.height()); \ + QCOMPARE(pixmap.size(), rect.size()); \ + QPixmap expectedPixmap(pixmap); /* ensure equal formats */ \ + expectedPixmap.fill(color); \ + if (pixmap.toImage().pixel(0,0) != QColor(color).rgb() && t < 4 ) \ + { QTest::qWait(200); continue; } \ + QCOMPARE(pixmap.toImage().pixel(0,0), QColor(color).rgb()); \ + QCOMPARE(pixmap, expectedPixmap); \ + break; \ + } \ + } \ } void tst_QWidget::moveChild_data() @@ -5499,9 +5497,9 @@ void tst_QWidget::moveChild() #endif QTRY_COMPARE(parent.r, QRegion(parent.rect()) - child.geometry()); QTRY_COMPARE(child.r, QRegion(child.rect())); - verifyColor(child.geometry().translated(tlwOffset), + VERIFY_COLOR(child.geometry().translated(tlwOffset), child.color); - verifyColor(QRegion(parent.geometry()) - child.geometry().translated(tlwOffset), + VERIFY_COLOR(QRegion(parent.geometry()) - child.geometry().translated(tlwOffset), parent.color); parent.reset(); child.reset(); @@ -5520,9 +5518,9 @@ void tst_QWidget::moveChild() // should be scrolled in backingstore QCOMPARE(child.r, QRegion()); #endif - verifyColor(child.geometry().translated(tlwOffset), + VERIFY_COLOR(child.geometry().translated(tlwOffset), child.color); - verifyColor(QRegion(parent.geometry()) - child.geometry().translated(tlwOffset), + VERIFY_COLOR(QRegion(parent.geometry()) - child.geometry().translated(tlwOffset), parent.color); } @@ -5553,8 +5551,8 @@ void tst_QWidget::showAndMoveChild() child.move(desktopDimensions.width()/2, desktopDimensions.height()/2); qApp->processEvents(); - verifyColor(child.geometry().translated(tlwOffset), Qt::blue); - verifyColor(QRegion(parent.geometry()) - child.geometry().translated(tlwOffset), Qt::red); + VERIFY_COLOR(child.geometry().translated(tlwOffset), Qt::blue); + VERIFY_COLOR(QRegion(parent.geometry()) - child.geometry().translated(tlwOffset), Qt::red); } void tst_QWidget::subtractOpaqueSiblings() -- cgit v0.12 From f0f1d8588892ba94301ecad2aa4495e9bfa364ae Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 25 Jan 2010 14:45:46 +0100 Subject: Handle RGB_32 format pixmaps correctly The alpha channel is undefined for RGB_32 --- tests/auto/qwidget/tst_qwidget.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index ea90ae3..9ed2d37 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -5450,9 +5450,12 @@ public: QCOMPARE(pixmap.size(), rect.size()); \ QPixmap expectedPixmap(pixmap); /* ensure equal formats */ \ expectedPixmap.fill(color); \ - if (pixmap.toImage().pixel(0,0) != QColor(color).rgb() && t < 4 ) \ + QImage image = pixmap.toImage(); \ + uint alphaCorrection = image.format() == QImage::Format_RGB32 ? 0xff000000 : 0; \ + uint firstPixel = image.pixel(0,0) | alphaCorrection; \ + if ( firstPixel != QColor(color).rgb() && t < 4 ) \ { QTest::qWait(200); continue; } \ - QCOMPARE(pixmap.toImage().pixel(0,0), QColor(color).rgb()); \ + QCOMPARE(firstPixel, QColor(color).rgb()); \ QCOMPARE(pixmap, expectedPixmap); \ break; \ } \ -- cgit v0.12 From 33a5ecd4908690d6a8366d8f7384ad1e8cf86f92 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Tue, 26 Jan 2010 14:52:09 +0100 Subject: queue user mouse, wheel, and keyboard input events For plugins: testlite, minimaldfb, vnc, LinuxInput[Mouse|Keyboard] --- src/gui/embedded/qkbd_qws.cpp | 3 +- src/gui/kernel/kernel.pri | 15 ++- src/gui/kernel/qapplication_lite.cpp | 133 +++++++++++++------ src/gui/kernel/qapplication_p.h | 74 ++++++++++- src/gui/kernel/qeventdispatcher_glib_lite.cpp | 138 ++++++++++++++++++++ src/gui/kernel/qeventdispatcher_glib_lite_p.h | 88 +++++++++++++ src/gui/kernel/qeventdispatcher_lite.cpp | 141 +++++++++++++++++++++ src/gui/kernel/qeventdispatcher_lite_p.h | 86 +++++++++++++ src/gui/kernel/qeventdispatcher_qws_p.h | 2 +- src/plugins/generic/linuxinput/qlinuxinput.cpp | 34 ++--- .../graphicssystems/minimaldfb/qdirectfbinput.cpp | 16 +-- .../testlite/qwindowsurface_testlite.cpp | 27 ++-- src/plugins/graphicssystems/testlite/x11util.h | 2 +- src/plugins/graphicssystems/vnc/qvncserver.cpp | 54 +------- src/plugins/graphicssystems/vnc/qvncserver.h | 5 - 15 files changed, 673 insertions(+), 145 deletions(-) create mode 100644 src/gui/kernel/qeventdispatcher_glib_lite.cpp create mode 100644 src/gui/kernel/qeventdispatcher_glib_lite_p.h create mode 100644 src/gui/kernel/qeventdispatcher_lite.cpp create mode 100644 src/gui/kernel/qeventdispatcher_lite_p.h diff --git a/src/gui/embedded/qkbd_qws.cpp b/src/gui/embedded/qkbd_qws.cpp index 233b6fa..97fb7a0 100644 --- a/src/gui/embedded/qkbd_qws.cpp +++ b/src/gui/embedded/qkbd_qws.cpp @@ -367,8 +367,7 @@ void QWSKeyboardHandler::processKeyEvent(int unicode, int keycode, Qt::KeyboardM QString str; if (unicode != 0xffff) str = QString(unicode); - QKeyEvent ke(type, keycode, modifiers, str); - QApplicationPrivate::handleKeyEvent(0, &ke); + QApplicationPrivate::handleKeyEvent(0, type, keycode, modifiers, str); #endif } diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 9fbdfc8..0c7231e 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -195,7 +195,8 @@ embedded { embedded_lite { HEADERS += \ kernel/qgenericpluginfactory_lite.h \ - kernel/qgenericplugin_lite.h + kernel/qgenericplugin_lite.h \ + kernel/qeventdispatcher_lite_p.h SOURCES += \ kernel/qapplication_lite.cpp \ @@ -207,7 +208,17 @@ embedded_lite { kernel/qgenericplugin_lite.cpp \ kernel/qkeymapper_qws.cpp \ kernel/qsound_lite.cpp \ - kernel/qwidget_lite.cpp + kernel/qwidget_lite.cpp \ + kernel/qeventdispatcher_lite.cpp + + contains(QT_CONFIG, glib) { + SOURCES += \ + kernel/qeventdispatcher_glib_lite.cpp + HEADERS += \ + kernel/qeventdispatcher_glib_lite_p.h + QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB + LIBS_PRIVATE +=$$QT_LIBS_GLIB + } } !embedded:!embedded_lite:!x11:mac { diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 57f6d72..4242ff7 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -43,9 +43,9 @@ #include "qcolormap.h" #include "qpixmapcache.h" #if !defined(QT_NO_GLIB) -#include "private/qeventdispatcher_glib_p.h" +#include "qeventdispatcher_glib_lite_p.h" #endif -#include "private/qeventdispatcher_unix_p.h" +#include "qeventdispatcher_lite_p.h" #ifndef QT_NO_CURSOR #include "private/qcursor_p.h" #endif @@ -75,6 +75,32 @@ int qt_last_x = 0; int qt_last_y = 0; QPointer qt_last_mouse_receiver = 0; +QList QApplicationPrivate::userEventQueue; +static Qt::KeyboardModifiers modifiers = Qt::NoModifier; +static Qt::MouseButtons buttons = Qt::NoButton; + +void QApplicationPrivate::processUserEvent(UserEvent *e) +{ + switch(e->type) { + case QEvent::MouseButtonDblClick: // if mouse event, calculate appropriate widget and local coordinates + case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + case QEvent::MouseMove: + QApplicationPrivate::processMouseEvent(static_cast(e)); + break; + case QEvent::Wheel: + QApplicationPrivate::processWheelEvent(static_cast(e)); + break; + case QEvent::KeyPress: + case QEvent::KeyRelease: + QApplicationPrivate::processKeyEvent(static_cast(e)); + break; + default: + qWarning() << "Unknown user input event type:" << e->type; + break; + } +} + QString QApplicationPrivate::appName() const { return QT_PREPEND_NAMESPACE(appName); @@ -85,13 +111,13 @@ void QApplicationPrivate::createEventDispatcher() Q_Q(QApplication); #if !defined(QT_NO_GLIB) if (qgetenv("QT_NO_GLIB").isEmpty() && QEventDispatcherGlib::versionSupported()) - eventDispatcher = new QEventDispatcherGlib(q); + eventDispatcher = new QLiteEventDispatcherGlib(q); else #endif - eventDispatcher = new QEventDispatcherUNIX(q); + eventDispatcher = new QEventDispatcherLite(q); } -static bool qt_try_modal(QWidget *widget, const QEvent *event) +static bool qt_try_modal(QWidget *widget, QEvent::Type type) { QWidget * top = 0; @@ -101,7 +127,7 @@ static bool qt_try_modal(QWidget *widget, const QEvent *event) bool block_event = false; bool paint_event = false; - switch (event->type()) { + switch (type) { #if 0 case QEvent::Focus: if (!static_cast(event)->simpleData.get_focus) @@ -520,22 +546,51 @@ void QApplicationPrivate::handleLeaveEvent(QWidget *tlw) qt_last_mouse_receiver = 0; } -void QApplicationPrivate::handleMouseEvent(QWidget *tlw, const QMouseEvent &ev) +void QApplicationPrivate::processMouseEvent(MouseEvent *e) { // qDebug() << "handleMouseEvent" << tlw << ev.pos() << ev.globalPos() << hex << ev.buttons(); - static QWidget *implicit_mouse_grabber=0; - QPointer cursor = QGraphicsSystemCursor::getInstance(); - if (cursor) - cursor->pointerEvent(ev); + QEvent::Type type; + // move first + Qt::MouseButtons stateChange = e->buttons ^ buttons; + if (e->globalPos != QPoint(qt_last_x, qt_last_y) && (stateChange != Qt::NoButton)) { + MouseEvent * newMouseEvent = new MouseEvent(e->tlw, e->localPos, e->globalPos, e->buttons); + userEventQueue.prepend(newMouseEvent); // just in case the move triggers a new event loop + stateChange = Qt::NoButton; + } - QPoint localPoint = ev.pos(); - QPoint globalPoint = ev.globalPos(); - QWidget *mouseWindow = tlw; + QPoint localPoint = e->localPos; + QPoint globalPoint = e->globalPos; + QWidget *mouseWindow = e->tlw; + + Qt::MouseButton button = Qt::NoButton; - qt_last_x = globalPoint.x(); - qt_last_y = globalPoint.y(); + + if (qt_last_x != globalPoint.x() || qt_last_y != globalPoint.y()) { + type = QEvent::MouseMove; + qt_last_x = globalPoint.x(); + qt_last_y = globalPoint.y(); + } + else { // check to see if a new button has been pressed/released + for (int check = Qt::LeftButton; + check <= Qt::XButton2; + check = check << 1) { + if (check & stateChange) { + button = Qt::MouseButton(check); + break; + } + } + if (button == Qt::NoButton) { + // Ignore mouse events that don't change the current state + return; + } + buttons = e->buttons; + if (button & e->buttons) + type = QEvent::MouseButtonPress; + else + type = QEvent::MouseButtonRelease; + } if (self->inPopupMode()) { //popup mouse handling is magical... @@ -544,11 +599,11 @@ void QApplicationPrivate::handleMouseEvent(QWidget *tlw, const QMouseEvent &ev) implicit_mouse_grabber = 0; //### how should popup mode and implicit mouse grab interact? - } else if (tlw && app_do_modal && !qt_try_modal(tlw, &ev) ) { + } else if (e->tlw && app_do_modal && !qt_try_modal(e->tlw, e->type) ) { //even if we're blocked by modality, we should deliver the mouse release event.. //### this code is not completely correct: multiple buttons can be pressed simultaneously - if (!(implicit_mouse_grabber && ev.buttons() == Qt::NoButton)) { - qDebug() << "modal blocked mouse event to" << tlw; + if (!(implicit_mouse_grabber && buttons == Qt::NoButton)) { + qDebug() << "modal blocked mouse event to" << e->tlw; return; } } @@ -561,7 +616,7 @@ void QApplicationPrivate::handleMouseEvent(QWidget *tlw, const QMouseEvent &ev) if (!mouseWindow && !implicit_mouse_grabber) mouseWindow = QApplication::desktop(); - if (mouseWindow && mouseWindow != tlw) { + if (mouseWindow && mouseWindow != e->tlw) { //we did not get a sensible localPoint from the window system, so let's calculate it localPoint = mouseWindow->mapFromGlobal(globalPoint); } @@ -576,7 +631,7 @@ void QApplicationPrivate::handleMouseEvent(QWidget *tlw, const QMouseEvent &ev) } //handle implicit mouse grab - if (ev.type() == QEvent::MouseButtonPress && !implicit_mouse_grabber) { + if (type == QEvent::MouseButtonPress && !implicit_mouse_grabber) { implicit_mouse_grabber = mouseWidget; Q_ASSERT(mouseWindow); @@ -584,7 +639,7 @@ void QApplicationPrivate::handleMouseEvent(QWidget *tlw, const QMouseEvent &ev) } else if (implicit_mouse_grabber) { mouseWidget = implicit_mouse_grabber; mouseWindow = mouseWidget->window(); - if (mouseWindow != tlw) + if (mouseWindow != e->tlw) localPoint = mouseWindow->mapFromGlobal(globalPoint); } @@ -593,7 +648,7 @@ void QApplicationPrivate::handleMouseEvent(QWidget *tlw, const QMouseEvent &ev) //localPoint is local to mouseWindow, but it needs to be local to mouseWidget localPoint = mouseWidget->mapFrom(mouseWindow, localPoint); - if (ev.buttons() == Qt::NoButton) { + if (buttons == Qt::NoButton) { //qDebug() << "resetting mouse grabber"; implicit_mouse_grabber = 0; } @@ -608,25 +663,29 @@ void QApplicationPrivate::handleMouseEvent(QWidget *tlw, const QMouseEvent &ev) // qDebug() << "sending mouse ev." << ev.type() << localPoint << globalPoint << ev.button() << ev.buttons() << mouseWidget << "mouse grabber" << implicit_mouse_grabber; - QMouseEvent e(ev.type(), localPoint, globalPoint, ev.button(), ev.buttons(), ev.modifiers()); - QApplication::sendSpontaneousEvent(mouseWidget, &e); + QMouseEvent ev(type, localPoint, globalPoint, button, buttons, modifiers); + + QPointer cursor = QGraphicsSystemCursor::getInstance(); + if (cursor) + cursor->pointerEvent(ev); + QApplication::sendSpontaneousEvent(mouseWidget, &ev); } //### there's a lot of duplicated logic here -- refactoring required! -void QApplicationPrivate::handleWheelEvent(QWidget *tlw, QWheelEvent &ev) +void QApplicationPrivate::processWheelEvent(WheelEvent *e) { // QPoint localPoint = ev.pos(); - QPoint globalPoint = ev.globalPos(); + QPoint globalPoint = e->globalPos; // bool trustLocalPoint = !!tlw; //is there something the local point can be local to? QWidget *mouseWidget; qt_last_x = globalPoint.x(); qt_last_y = globalPoint.y(); - QWidget *mouseWindow = tlw; + QWidget *mouseWindow = e->tlw; // find the tlw if we didn't get it from the plugin if (!mouseWindow) { @@ -638,7 +697,7 @@ void QApplicationPrivate::handleWheelEvent(QWidget *tlw, QWheelEvent &ev) mouseWidget = mouseWindow; - if (app_do_modal && !qt_try_modal(mouseWindow, &ev) ) { + if (app_do_modal && !qt_try_modal(mouseWindow, e->type) ) { qDebug() << "modal blocked wheel event" << mouseWindow; return; } @@ -649,16 +708,16 @@ void QApplicationPrivate::handleWheelEvent(QWidget *tlw, QWheelEvent &ev) p = mouseWidget->mapFromGlobal(globalPoint); } - QWheelEvent e(p, globalPoint, ev.delta(), ev.buttons(), ev.modifiers(), - ev.orientation()); - QApplication::sendSpontaneousEvent(mouseWidget, &e); + QWheelEvent ev(p, globalPoint, e->delta, buttons, modifiers, + e->orient); + QApplication::sendSpontaneousEvent(mouseWidget, &ev); } // Remember, Qt convention is: keyboard state is state *before* -void QApplicationPrivate::handleKeyEvent(QWidget *tlw, QKeyEvent *e) +void QApplicationPrivate::processKeyEvent(KeyEvent *e) { QWidget *focusW = 0; if (self->inPopupMode()) { @@ -668,7 +727,7 @@ void QApplicationPrivate::handleKeyEvent(QWidget *tlw, QKeyEvent *e) if (!focusW) focusW = QApplication::focusWidget(); if (!focusW) - focusW = tlw; + focusW = e->tlw; if (!focusW) focusW = QApplication::activeWindow(); @@ -676,10 +735,12 @@ void QApplicationPrivate::handleKeyEvent(QWidget *tlw, QKeyEvent *e) if (!focusW) return; - if (app_do_modal && !qt_try_modal(focusW, e)) + if (app_do_modal && !qt_try_modal(focusW, e->type)) return; - QApplication::sendSpontaneousEvent(focusW, e); + modifiers = e->modifiers; + QKeyEvent ev(e->type, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount); + QApplication::sendSpontaneousEvent(focusW, &ev); } diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index a93fd63..955a3fc 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -65,8 +65,9 @@ #include "QtCore/qhash.h" #include "QtCore/qpointer.h" #include "private/qcoreapplication_p.h" -#include "private/qshortcutmap_p.h" +#include "QtGui/private/qshortcutmap_p.h" #include +#include "QtCore/qpoint.h" #ifdef Q_WS_QWS #include "QtGui/qscreen_qws.h" #include @@ -564,11 +565,72 @@ public: #endif #ifdef Q_WS_LITE - static void handleMouseEvent(QWidget *tlw, const QMouseEvent &ev); - static void handleKeyEvent(QWidget *tlw, QKeyEvent *e); + + class UserEvent { + public: + UserEvent(QWidget *w) { tlw = w; } + QWidget * tlw; + QEvent::Type type; + }; + + class MouseEvent : public UserEvent { + public: + MouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b) + : UserEvent(w){ localPos = local; globalPos = global; buttons = b; type = QEvent::MouseMove; } + QPoint localPos; + QPoint globalPos; + Qt::MouseButtons buttons; + }; + + class WheelEvent : public UserEvent { + public: + WheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) + : UserEvent(w) { localPos = local; globalPos = global; delta = d; orient = o; type = QEvent::Wheel; } + int delta; + QPoint localPos; + QPoint globalPos; + Qt::Orientation orient; + }; + + class KeyEvent : public UserEvent { + public: + KeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) + :UserEvent(w){ type = t; key = k; unicode = text; repeat = autorep; repeatCount = count; modifiers = mods; } + int key; + QString unicode; + bool repeat; + ushort repeatCount; + Qt::KeyboardModifiers modifiers; + }; + + static void handleMouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b) { + MouseEvent * e = new MouseEvent(w, local, global, b); + queueUserEvent(e); + } + + static void handleKeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) { + KeyEvent * e = new KeyEvent(w, t, k, mods, text, autorep, count); + queueUserEvent(e); + } + + static void handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) { + WheelEvent *e = new WheelEvent(w, local, global, d, o); + queueUserEvent(e); + } + + static void queueUserEvent(UserEvent *ev) { userEventQueue.append(ev); } + static void processUserEvent(UserEvent *e); + static int userEventsQueued() { return userEventQueue.count(); } + static UserEvent * getUserEvent() { return userEventQueue.takeFirst(); } + + // could be private, should only be used by deliverUserEvents() + static void processMouseEvent(MouseEvent *e); + static void processKeyEvent(KeyEvent *e); + static void processWheelEvent(WheelEvent *e); + + // delivered directly by the plugin via spontaneous events static void handleGeometryChange(QWidget *tlw, const QRect &newRect); static void handleCloseEvent(QWidget *tlw); - static void handleWheelEvent(QWidget *tlw, QWheelEvent &e); static void handleEnterEvent(QWidget *tlw); static void handleLeaveEvent(QWidget *tlw); #endif @@ -587,6 +649,10 @@ private: static QHash scanCodeCache; #endif +#ifdef Q_WS_LITE + static QList userEventQueue; +#endif + static QApplicationPrivate *self; static void giveFocusAccordingToFocusPolicy(QWidget *w, diff --git a/src/gui/kernel/qeventdispatcher_glib_lite.cpp b/src/gui/kernel/qeventdispatcher_glib_lite.cpp new file mode 100644 index 0000000..b8d2a5b --- /dev/null +++ b/src/gui/kernel/qeventdispatcher_glib_lite.cpp @@ -0,0 +1,138 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qeventdispatcher_glib_lite_p.h" + +#include "qapplication.h" + +#include "qplatformdefs.h" +#include "qapplication.h" + +#include +#include "qapplication_p.h" + +#include + +QT_BEGIN_NAMESPACE + +struct GUserEventSource +{ + GSource source; + QLiteEventDispatcherGlib *q; +}; + +static gboolean userEventSourcePrepare(GSource *s, gint *timeout) +{ + Q_UNUSED(s) + Q_UNUSED(timeout) + + return QApplicationPrivate::userEventsQueued() > 0; +} + +static gboolean userEventSourceCheck(GSource *source) +{ + return userEventSourcePrepare(source, 0); +} + +static gboolean userEventSourceDispatch(GSource *s, GSourceFunc, gpointer) +{ + GUserEventSource * source = reinterpret_cast(s); + + int i = QApplicationPrivate::userEventsQueued(); + QApplicationPrivate::UserEvent * event; + while (i--) { + event = QApplicationPrivate::getUserEvent(); + + // send through event filter + if (source->q->filterEvent(event)) { + delete event; + continue; + } + QApplicationPrivate::processUserEvent(event); + delete event; + } + + return true; +} + + +static GSourceFuncs userEventSourceFuncs = { + userEventSourcePrepare, + userEventSourceCheck, + userEventSourceDispatch, + NULL, + NULL, + NULL +}; + +QLiteEventDispatcherGlibPrivate::QLiteEventDispatcherGlibPrivate(GMainContext *context) + : QEventDispatcherGlibPrivate(context) +{ + userEventSource = reinterpret_cast(g_source_new(&userEventSourceFuncs, + sizeof(GUserEventSource))); + userEventSource->q = 0; + g_source_set_can_recurse(&userEventSource->source, true); + g_source_attach(&userEventSource->source, mainContext); +} + + +QLiteEventDispatcherGlib::QLiteEventDispatcherGlib(QObject *parent) + : QEventDispatcherGlib(*new QLiteEventDispatcherGlibPrivate, parent) +{ + Q_D(QLiteEventDispatcherGlib); + d->userEventSource->q = this; +} + +QLiteEventDispatcherGlib::~QLiteEventDispatcherGlib() +{ + Q_D(QLiteEventDispatcherGlib); + + g_source_destroy(&d->userEventSource->source); + g_source_unref(&d->userEventSource->source); + d->userEventSource = 0; +} + +bool QLiteEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags) +{ + return QEventDispatcherGlib::processEvents(flags); +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qeventdispatcher_glib_lite_p.h b/src/gui/kernel/qeventdispatcher_glib_lite_p.h new file mode 100644 index 0000000..6ebdb25 --- /dev/null +++ b/src/gui/kernel/qeventdispatcher_glib_lite_p.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QLITEEVENTDISPATCHER_GLIB_P_H +#define QLITEEVENTDISPATCHER_GLIB_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of the QLibrary class. This header file may change from +// version to version without notice, or even be removed. +// +// We mean it. +// + +#include + +typedef struct _GMainContext GMainContext; + +QT_BEGIN_NAMESPACE +class QLiteEventDispatcherGlibPrivate; + +class QLiteEventDispatcherGlib : public QEventDispatcherGlib +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QLiteEventDispatcherGlib) + +public: + explicit QLiteEventDispatcherGlib(QObject *parent = 0); + ~QLiteEventDispatcherGlib(); + + bool processEvents(QEventLoop::ProcessEventsFlags flags); +}; + +struct GUserEventSource; + +class QLiteEventDispatcherGlibPrivate : public QEventDispatcherGlibPrivate +{ + Q_DECLARE_PUBLIC(QLiteEventDispatcherGlib) +public: + QLiteEventDispatcherGlibPrivate(GMainContext *context = 0); + GUserEventSource *userEventSource; +}; + + +QT_END_NAMESPACE + +#endif // QLITEEVENTDISPATCHER_GLIB_P_H diff --git a/src/gui/kernel/qeventdispatcher_lite.cpp b/src/gui/kernel/qeventdispatcher_lite.cpp new file mode 100644 index 0000000..39eef96 --- /dev/null +++ b/src/gui/kernel/qeventdispatcher_lite.cpp @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformdefs.h" +#include "qapplication.h" +#include "qeventdispatcher_lite_p.h" +#include "private/qeventdispatcher_unix_p.h" +#include "qapplication_p.h" +#ifndef QT_NO_THREAD +# include "qmutex.h" +#endif + +#include +QT_BEGIN_NAMESPACE + +QT_USE_NAMESPACE + +class QEventDispatcherLitePrivate : public QEventDispatcherUNIXPrivate +{ + Q_DECLARE_PUBLIC(QEventDispatcherLite) +public: + inline QEventDispatcherLitePrivate() + { } +}; + + +QEventDispatcherLite::QEventDispatcherLite(QObject *parent) + : QEventDispatcherUNIX(*new QEventDispatcherLitePrivate, parent) +{ } + +QEventDispatcherLite::~QEventDispatcherLite() +{ } + + + +//#define ZERO_FOR_THE_MOMENT + +bool QEventDispatcherLite::processEvents(QEventLoop::ProcessEventsFlags flags) +{ + Q_D(QEventDispatcherLite); + int nevents = 0; + + // handle gui and posted events + d->interrupt = false; + QApplication::sendPostedEvents(); + + while (!d->interrupt) { // also flushes output buffer ###can be optimized + QApplicationPrivate::UserEvent *event; + if (!(flags & QEventLoop::ExcludeUserInputEvents) + && QApplicationPrivate::userEventsQueued() > 0) { + // process a pending user input event + event = QApplicationPrivate::getUserEvent(); + } else { + break; + } + + if (filterEvent(event)) { + delete event; + continue; + } + nevents++; + + QApplicationPrivate::processUserEvent(event); + delete event; + } + + if (!d->interrupt) { + if (QEventDispatcherUNIX::processEvents(flags)) + return true; + } + return (nevents > 0); +} + +bool QEventDispatcherLite::hasPendingEvents() +{ + extern uint qGlobalPostedEventsCount(); // from qapplication.cpp + return qGlobalPostedEventsCount() || QApplicationPrivate::userEventsQueued();; +} + +void QEventDispatcherLite::startingUp() +{ + +} + +void QEventDispatcherLite::closingDown() +{ + +} + +void QEventDispatcherLite::flush() +{ + if(qApp) + qApp->sendPostedEvents(); +} + + +int QEventDispatcherLite::select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, + timeval *timeout) +{ + return QEventDispatcherUNIX::select(nfds, readfds, writefds, exceptfds, timeout); +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qeventdispatcher_lite_p.h b/src/gui/kernel/qeventdispatcher_lite_p.h new file mode 100644 index 0000000..c098e6c --- /dev/null +++ b/src/gui/kernel/qeventdispatcher_lite_p.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QEVENTDISPATCHER_LITE_P_H +#define QEVENTDISPATCHER_LITE_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 "private/qeventdispatcher_unix_p.h" + +QT_BEGIN_NAMESPACE + +class QEventDispatcherLitePrivate; + +class QEventDispatcherLite : public QEventDispatcherUNIX +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QEventDispatcherLite) + +public: + explicit QEventDispatcherLite(QObject *parent = 0); + ~QEventDispatcherLite(); + + bool processEvents(QEventLoop::ProcessEventsFlags flags); + bool hasPendingEvents(); + + void flush(); + + void startingUp(); + void closingDown(); + +protected: + int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, + timeval *timeout); +}; + +QT_END_NAMESPACE + +#endif // QEVENTDISPATCHER_LITE_P_H diff --git a/src/gui/kernel/qeventdispatcher_qws_p.h b/src/gui/kernel/qeventdispatcher_qws_p.h index 8d8d61c..5a2b016 100644 --- a/src/gui/kernel/qeventdispatcher_qws_p.h +++ b/src/gui/kernel/qeventdispatcher_qws_p.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE -class QEventDispatcherQWSPrivate; +class QEventDispatcherLitePrivate; class QEventDispatcherQWS : public QEventDispatcherUNIX { diff --git a/src/plugins/generic/linuxinput/qlinuxinput.cpp b/src/plugins/generic/linuxinput/qlinuxinput.cpp index 308af6b..363e91f 100644 --- a/src/plugins/generic/linuxinput/qlinuxinput.cpp +++ b/src/plugins/generic/linuxinput/qlinuxinput.cpp @@ -46,7 +46,6 @@ #include #include #include -#include #include #include @@ -100,6 +99,7 @@ void QLinuxInputMouseHandler::readMouseData() { struct ::input_event buffer[32]; int n = 0; + bool posChanged = false; forever { n = QT_READ(m_fd, reinterpret_cast(buffer) + n, sizeof(buffer) - n); @@ -122,28 +122,34 @@ void QLinuxInputMouseHandler::readMouseData() bool unknown = false; if (data->type == EV_ABS) { - if (data->code == ABS_X) { + if (data->code == ABS_X && m_x != data->value) { m_x = data->value; - } else if (data->code == ABS_Y) { + posChanged = true; + } else if (data->code == ABS_Y && m_y != data->value) { m_y = data->value; + posChanged = true; } else { unknown = true; } } else if (data->type == EV_REL) { if (data->code == REL_X) { m_x += data->value; + posChanged = true; } else if (data->code == REL_Y) { m_y += data->value; + posChanged = true; } else if (data->code == ABS_WHEEL) { // vertical scroll // data->value: 1 == up, -1 == down int delta = 120 * data->value; - QWheelEvent we(QPoint(m_x, m_y), QPoint(m_x, m_y), delta, m_buttons, Qt::NoModifier, Qt::Vertical); - QApplicationPrivate::handleWheelEvent(0, we); + QApplicationPrivate::handleWheelEvent(0, QPoint(m_x, m_y), + QPoint(m_x, m_y), + delta, Qt::Vertical); } else if (data->code == ABS_THROTTLE) { // horizontal scroll // data->value: 1 == right, -1 == left int delta = 120 * -data->value; - QWheelEvent we(QPoint(m_x, m_y), QPoint(m_x, m_y), delta, m_buttons, Qt::NoModifier, Qt::Horizontal); - QApplicationPrivate::handleWheelEvent(0, we); + QApplicationPrivate::handleWheelEvent(0, QPoint(m_x, m_y), + QPoint(m_x, m_y), + delta, Qt::Horizontal); } else { unknown = true; } @@ -161,17 +167,15 @@ void QLinuxInputMouseHandler::readMouseData() else m_buttons &= ~button; - Qt::KeyboardModifiers modifiers = Qt::NoModifier; //### - QMouseEvent m(data->value ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease, - QPoint(m_x, m_y), QPoint(m_x, m_y), button, m_buttons, modifiers); - QApplicationPrivate::handleMouseEvent(0, m); + QApplicationPrivate::handleMouseEvent(0, QPoint(m_x, m_y), + QPoint(m_x, m_y), m_buttons); } else if (data->type == EV_SYN && data->code == SYN_REPORT) { + if (!posChanged) + continue; + posChanged = false; QPoint pos(m_x, m_y); - Qt::KeyboardModifiers modifiers = Qt::NoModifier; //### - QMouseEvent m(QEvent::MouseMove, QPoint(m_x, m_y), QPoint(m_x, m_y), - Qt::NoButton, m_buttons, modifiers); - QApplicationPrivate::handleMouseEvent(0, m); + QApplicationPrivate::handleMouseEvent(0, pos, pos, m_buttons); // pos = m_handler->transform(pos); //m_handler->limitToScreen(pos); diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp index 17fdd10..8809536 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp @@ -109,7 +109,6 @@ void QDirectFbInput::handleMouseEvents(const DFBEvent &event) QEvent::Type type = QDirectFbConvenience::eventType(event.window.type); QPoint p(event.window.x, event.window.y); QPoint globalPos = globalPoint(event); - Qt::MouseButton button = QDirectFbConvenience::mouseButton(event.window.button); Qt::MouseButtons buttons = QDirectFbConvenience::mouseButtons(event.window.buttons); QWidget *tlw = tlwMap.value(event.window.window_id); @@ -141,9 +140,7 @@ void QDirectFbInput::handleMouseEvents(const DFBEvent &event) window->UngrabPointer(window); } - //DFB doesn't give keyboardmodifiers on mouseevents - QMouseEvent mouseEvent(type,p,globalPos,button, buttons,(Qt::KeyboardModifiers)0); - QApplicationPrivate::handleMouseEvent(tlw,mouseEvent); + QApplicationPrivate::handleMouseEvent(tlw, p, globalPos, buttons); } void QDirectFbInput::applicationEnd() @@ -156,13 +153,11 @@ void QDirectFbInput::handleWheelEvent(const DFBEvent &event) { QPoint p(event.window.cx, event.window.cy); QPoint globalPos = globalPoint(event); - Qt::MouseButton button = QDirectFbConvenience::mouseButton(event.window.button); - Qt::MouseButtons buttons = QDirectFbConvenience::mouseButtons(event.window.buttons); QWidget *tlw = tlwMap.value(event.window.window_id); - QWheelEvent wheelEvent(p,globalPos,event.window.step*120,buttons,Qt::NoModifier,Qt::Vertical); - QApplicationPrivate::handleWheelEvent(tlw,wheelEvent); - + QApplicationPrivate::handleWheelEvent(tlw, p, globalPos, + event.window.step*120, + Qt::Vertical); } void QDirectFbInput::handleKeyEvents(const DFBEvent &event) @@ -171,9 +166,8 @@ void QDirectFbInput::handleKeyEvents(const DFBEvent &event) Qt::Key key = QDirectFbConvenience::keyMap()->value(event.window.key_symbol); Qt::KeyboardModifiers modifiers = QDirectFbConvenience::keyboardModifiers(event.window.modifiers); - QKeyEvent keyEvent(type,key,modifiers,QChar(event.window.key_symbol)); QWidget *tlw = tlwMap.value(event.window.window_id); - QApplicationPrivate::handleKeyEvent(tlw,&keyEvent); + QApplicationPrivate::handleKeyEvent(tlw, type, key, modifiers, QChar(event.window.key_symbol)); } void QDirectFbInput::handleEnterLeaveEvents(const DFBEvent &event) diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp index 0afbf2f..26a7675 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp @@ -254,9 +254,10 @@ void QTestLiteWindowSurface::handleMouseEvent(QEvent::Type type, void *ev) bool hor = (((e->button == Button4 || e->button == Button5) && (modifiers & Qt::AltModifier)) || (e->button == 6 || e->button == 7)); - QWheelEvent we(QPoint(e->x, e->y), QPoint(e->x_root, e->y_root), delta, - buttons, modifiers, hor ? Qt::Horizontal : Qt::Vertical); - QApplicationPrivate::handleWheelEvent(window(),we); + QApplicationPrivate::handleWheelEvent(window(), + QPoint(e->x, e->y), + QPoint(e->x_root, e->y_root), + delta, hor ? Qt::Horizontal : Qt::Vertical); } return; } @@ -264,18 +265,12 @@ void QTestLiteWindowSurface::handleMouseEvent(QEvent::Type type, void *ev) } } - if (type == QEvent::MouseButtonPress && mousePoint != QPoint(e->x_root, e->y_root)) { - //we've missed a mouse move event somewhere (maybe because we - //haven't implemented mouse tracking yet); let's synthesize it. - QMouseEvent me(QEvent::MouseMove, QPoint(e->x, e->y), QPoint(e->x_root, e->y_root), - Qt::NoButton, buttons, modifiers); - QApplicationPrivate::handleMouseEvent(window(), me); - } - buttons ^= button; // X event uses state *before*, Qt uses state *after* - QMouseEvent me(type, QPoint(e->x, e->y), QPoint(e->x_root, e->y_root), button, buttons, modifiers); - QApplicationPrivate::handleMouseEvent(window(), me); + QApplicationPrivate::handleMouseEvent(window(), QPoint(e->x, e->y), + QPoint(e->x_root, e->y_root), + buttons); + mousePoint = QPoint(e->x_root, e->y_root); } @@ -587,14 +582,12 @@ void QTestLiteWindowSurface::handleKeyEvent(QEvent::Type type, void *ev) // qDebug() << "lookup: " << hex << keySym << qtcode << "mod" << modifiers; if (qtcode) { - QKeyEvent keyEvent(type, qtcode, modifiers); - QApplicationPrivate::handleKeyEvent(window(), &keyEvent); + QApplicationPrivate::handleKeyEvent(window(), type, qtcode, modifiers); } else if (chars[0]) { int qtcode = chars.toUpper()[0]; //Not exactly right... if (modifiers & Qt::ControlModifier && qtcode < ' ') qtcode = chars[0] + '@'; - QKeyEvent keyEvent(type, qtcode, modifiers, QString::fromLatin1(chars)); - QApplicationPrivate::handleKeyEvent(window(), &keyEvent); + QApplicationPrivate::handleKeyEvent(window(), type, qtcode, modifiers, QString::fromLatin1(chars)); } else { qWarning() << "unknown X keycode" << hex << e->keycode << keySym; } diff --git a/src/plugins/graphicssystems/testlite/x11util.h b/src/plugins/graphicssystems/testlite/x11util.h index db87d92..76e029d 100644 --- a/src/plugins/graphicssystems/testlite/x11util.h +++ b/src/plugins/graphicssystems/testlite/x11util.h @@ -68,7 +68,7 @@ public: unsigned long whitePixel() { return WhitePixel(display, screen); } bool handleEvent(XEvent *xe); - QImage grabWindow(Window w, int x, int y, int w, int h); + QImage grabWindow(Window window, int x, int y, int w, int h); public slots: void eventDispatcher(); diff --git a/src/plugins/graphicssystems/vnc/qvncserver.cpp b/src/plugins/graphicssystems/vnc/qvncserver.cpp index 9576d10..490ca02 100644 --- a/src/plugins/graphicssystems/vnc/qvncserver.cpp +++ b/src/plugins/graphicssystems/vnc/qvncserver.cpp @@ -399,10 +399,6 @@ void QVNCServer::init(uint port) qvnc_cursor = 0; #endif encoder = 0; - - eventTimer.setInterval(0); - eventTimer.setSingleShot(true); - connect(&eventTimer, SIGNAL(timeout()), this, SLOT(sendInputEvents())); } QVNCServer::~QVNCServer() @@ -833,35 +829,6 @@ static bool buttonChange(Qt::MouseButtons before, Qt::MouseButtons after, Qt::Mo return false; } -void QVNCServer::sendInputEvents() -{ - EventPair pair; - QMouseEvent *me; - QKeyEvent *ke; - QWheelEvent *we; - - while(!eventList.isEmpty()) { - pair = eventList.takeFirst(); - switch(pair.first) { - case MouseEvent: - me = static_cast(pair.second); - QApplicationPrivate::handleMouseEvent(0, *me); - delete me; - break; - case KeyboardEvent: - ke = static_cast(pair.second); - QApplicationPrivate::handleKeyEvent(0, ke); - delete ke; - break; - case WheelEvent: - we = static_cast(pair.second); - QApplicationPrivate::handleWheelEvent(0, *we); - delete we; - break; - } - } -} - void QVNCServer::pointerEvent() { QRfbPointerEvent ev; @@ -870,7 +837,6 @@ void QVNCServer::pointerEvent() // QWSServer::sendMouseEvent(offset + QPoint(ev.x, ev.y), ev.buttons); - EventPair pair; //qDebug() << "pointerEvent" << ev.x << ev.y << hex << ev.buttons; if (ev.wheelDirection == ev.WheelNone) { QEvent::Type type = QEvent::MouseMove; @@ -878,10 +844,7 @@ void QVNCServer::pointerEvent() bool isPress; if (buttonChange(buttons, ev.buttons, &button, &isPress)) type = isPress ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; - QMouseEvent * me = new QMouseEvent(type, QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), button, ev.buttons, keymod); - pair.first = MouseEvent; - pair.second = me; - buttons = ev.buttons; + QApplicationPrivate::handleMouseEvent(0, QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), ev.buttons); } else { // No buttons or motion reported at the same time as wheel events Qt::Orientation orientation; @@ -890,13 +853,8 @@ void QVNCServer::pointerEvent() else orientation = Qt::Vertical; int delta = 120 * ((ev.wheelDirection == ev.WheelLeft || ev.wheelDirection == ev.WheelUp) ? 1 : -1); - QWheelEvent *we = new QWheelEvent(QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), delta, buttons, keymod, orientation); - pair.first = WheelEvent; - pair.second = we; + QApplicationPrivate::handleWheelEvent(0, QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), delta, orientation); } - eventList.append(pair); - if (!eventTimer.isActive()) - eventTimer.start(); handleMsg = false; } } @@ -921,13 +879,7 @@ void QVNCServer::keyEvent() QString str; if (ev.unicode && ev.unicode != 0xffff) str = QString(ev.unicode); - QKeyEvent *keyEvent = new QKeyEvent(type, ev.keycode, keymod, str); - EventPair pair; - pair.first = KeyboardEvent; - pair.second = keyEvent; - eventList.append(pair); - if (!eventTimer.isActive()) - eventTimer.start(); + QApplicationPrivate::handleKeyEvent(0, type, ev.keycode, keymod, str); } handleMsg = false; } diff --git a/src/plugins/graphicssystems/vnc/qvncserver.h b/src/plugins/graphicssystems/vnc/qvncserver.h index 7532cb4..4fcdbae 100644 --- a/src/plugins/graphicssystems/vnc/qvncserver.h +++ b/src/plugins/graphicssystems/vnc/qvncserver.h @@ -526,11 +526,6 @@ private: QRfbEncoder *encoder; QVNCCursor *cursor; - - enum EventType { MouseEvent, KeyboardEvent, WheelEvent }; - QTimer eventTimer; - typedef QPair EventPair; - QList eventList; }; -- cgit v0.12 From 5bc4ed0c33bad23ce2988e74ae8e7f9a4e5a3250 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 27 Jan 2010 15:02:54 +0100 Subject: Fix QPixmap::fill autotest and cachekey autotest Also make sure it didn't failed with a QFATAL when drawing bitmaps and tried to make sure all surfaces er unlocked when opperations are being performed on them from the windowsurface. There are still test failuers :( --- src/gui/image/qpixmap_blitter.cpp | 35 ++++++++++++++++++++-- src/gui/painting/qpaintengine_blitter.cpp | 2 ++ .../minimaldfb/qblitter_directfb.cpp | 2 ++ .../minimaldfb/qdirectfbconvenience.cpp | 12 ++++---- .../minimaldfb/qgraphicssystem_minimaldfb.cpp | 2 ++ .../minimaldfb/qwindowsurface_minimaldfb.cpp | 7 +++-- .../minimaldfb/qwindowsurface_minimaldfb.h | 2 ++ 7 files changed, 52 insertions(+), 10 deletions(-) diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index 175c234..6e34fbd 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -5,9 +5,14 @@ #include #include +#include + +static int global_ser_no = 0; + QBlittablePixmapData::QBlittablePixmapData(QPixmapData::PixelType type) : QPixmapData(type,BlitterClass), m_engine(0), m_blittable(0) { + setSerialNumber(++global_ser_no); } QBlittablePixmapData::~QBlittablePixmapData() @@ -21,7 +26,6 @@ QBlittable *QBlittablePixmapData::blittable() const if (!m_blittable) { QBlittablePixmapData *that = const_cast(this); that->m_blittable = QApplicationPrivate::graphicsSystem()->createBlittable(QRect(0,0,w,h)); - that->setSerialNumber(m_blittable->lock()->serialNumber()); } return m_blittable; @@ -77,11 +81,36 @@ int QBlittablePixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const void QBlittablePixmapData::fill(const QColor &color) { + //jlind: todo: change when blittables can support non opaque fillRects if (color.alpha() == 255 && blittable()->capabilities() & QBlittable::SolidRectCapability) { blittable()->unlock(); blittable()->fillRect(QRectF(0,0,w,h),color); - }else - blittable()->lock()->fill(color.rgba()); + }else { + uint pixel; + switch (blittable()->lock()->format()) { + case QImage::Format_ARGB32_Premultiplied: + pixel = PREMUL(color.rgba()); + break; + case QImage::Format_ARGB8565_Premultiplied: + pixel = qargb8565(color.rgba()).rawValue(); + break; + case QImage::Format_ARGB8555_Premultiplied: + pixel = qargb8555(color.rgba()).rawValue(); + break; + case QImage::Format_ARGB6666_Premultiplied: + pixel = qargb6666(color.rgba()).rawValue(); + break; + case QImage::Format_ARGB4444_Premultiplied: + pixel = qargb4444(color.rgba()).rawValue(); + break; + default: + pixel = color.rgba(); + break; + } + //so premultiplied formats are supported and ARGB32 and RGB32 + blittable()->lock()->fill(pixel); + } + } QImage *QBlittablePixmapData::buffer() diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index 0f6b5cf..1a1d5e0 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -63,6 +63,8 @@ public: bool canBlitterDrawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) const { + if (pm.pixmapData()->classId() != QPixmapData::BlitterClass) + return false; if ((!drawPixmapState) || drawPixmapState & drawPixmapMask) { if (m_capabilities & (QBlittable::SourceOverPixmapCapability | QBlittable::SourceOverScaledPixmapCapability)) { diff --git a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp index c2e4b4f..ded57d3 100644 --- a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp @@ -33,6 +33,7 @@ QDirectFbBlitter::QDirectFbBlitter(const QRect &rect, IDirectFBSurface *surface) QDirectFbBlitter::~QDirectFbBlitter() { + unlock(); m_surface->Release(m_surface); } @@ -55,6 +56,7 @@ void QDirectFbBlitter::drawPixmap(const QRectF &rect, const QPixmap &pixmap, con Q_ASSERT(data->classId() == QPixmapData::BlitterClass); QBlittablePixmapData *blitPm = static_cast(data); QDirectFbBlitter *dfbBlitter = static_cast(blitPm->blittable()); + dfbBlitter->unlock(); IDirectFBSurface *s = dfbBlitter->m_surface; diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp index 57d03fc..8594c09 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp @@ -5,11 +5,13 @@ IDirectFB *QDirectFbConvenience::dfbInterface() { - IDirectFB *dfb; - DFBResult result = DirectFBCreate(&dfb); - if (result != DFB_OK) { - DirectFBError("QDirectFBConvenience: error creating DirectFB interface",result); - return 0; + static IDirectFB *dfb = 0; + if (!dfb) { + DFBResult result = DirectFBCreate(&dfb); + if (result != DFB_OK) { + DirectFBError("QDirectFBConvenience: error creating DirectFB interface",result); + return 0; + } } return dfb; } diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp index f1f2215..06ae800 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp @@ -130,6 +130,8 @@ QDirectFbGraphicsSystem::QDirectFbGraphicsSystem() } delete[] argv; + //init directfb + QDirectFbConvenience::dfbInterface(); mPrimaryScreen = new QDirectFbGraphicsSystemScreen(0); mScreens.append(mPrimaryScreen); diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp index 7f3e165..4be61df 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -66,7 +66,7 @@ QDirectFbWindowSurface::QDirectFbWindowSurface(QDirectFbGraphicsSystemScreen *sc qDebug() << "WindowSurface format " << QDirectFbConvenience::imageFormatFromSurfaceFormat(format,caps); - QDirectFbBlitter *blitter = new QDirectFbBlitter(window->rect(), m_dfbSurface); + blitter = new QDirectFbBlitter(window->rect(), m_dfbSurface); m_pmdata = new QBlittablePixmapData(QPixmapData::PixmapType); m_pmdata->setBlittable(blitter); m_pixmap = new QPixmap(m_pmdata); @@ -88,7 +88,7 @@ void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const Q_UNUSED(widget); Q_UNUSED(offset); - m_dfbSurface->Unlock(m_dfbSurface); + blitter->unlock(); const quint8 windowOpacity = quint8(widget->windowOpacity() * 0xff); m_dfbWindow->SetOpacity(m_dfbWindow,windowOpacity); @@ -102,6 +102,7 @@ void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const void QDirectFbWindowSurface::setGeometry(const QRect &rect) { + blitter->unlock(); QWindowSurface::setGeometry(rect); m_dfbWindow->SetBounds(m_dfbWindow, rect.x(),rect.y(), rect.width(), rect.height()); @@ -123,6 +124,7 @@ static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int bool QDirectFbWindowSurface::scroll(const QRegion &area, int dx, int dy) { + blitter->unlock(); if (!m_dfbSurface || area.isEmpty()) return false; m_dfbSurface->SetBlittingFlags(m_dfbSurface, DSBLIT_NOFX); @@ -150,6 +152,7 @@ void QDirectFbWindowSurface::endPaint(const QRegion ®ion) void QDirectFbWindowSurface::setVisible(bool visible) { + blitter->unlock(); if (visible) { int x = this->geometry().x(); int y = this->geometry().y(); diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h index f74fb29..088aeba 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h @@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE class QDirectFbGraphicsSystemScreen; +class QDirectFbBlitter; class QDirectFbWindowSurface : public QWindowSurface { @@ -80,6 +81,7 @@ private: IDirectFBWindow *m_dfbWindow; IDirectFBSurface *m_dfbSurface; + QDirectFbBlitter *blitter; }; QT_END_NAMESPACE -- cgit v0.12 From 8ef9ec9f2ca3e4c590330aec234a7bf1b4410252 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 27 Jan 2010 15:36:45 +0100 Subject: double click events --- src/gui/kernel/qapplication_lite.cpp | 26 +++++++++++++++++++++++--- src/gui/kernel/qapplication_p.h | 35 +++++++++++++++++++++++++---------- 2 files changed, 48 insertions(+), 13 deletions(-) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 4242ff7..42932ba 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -78,6 +78,12 @@ QPointer qt_last_mouse_receiver = 0; QList QApplicationPrivate::userEventQueue; static Qt::KeyboardModifiers modifiers = Qt::NoModifier; static Qt::MouseButtons buttons = Qt::NoButton; +static ulong mousePressTime; +static Qt::MouseButton mousePressButton = Qt::NoButton; +static int mousePressX; +static int mousePressY; +static int mouse_double_click_distance = 5; +QTime QApplicationPrivate::time; void QApplicationPrivate::processUserEvent(UserEvent *e) { @@ -555,7 +561,7 @@ void QApplicationPrivate::processMouseEvent(MouseEvent *e) // move first Qt::MouseButtons stateChange = e->buttons ^ buttons; if (e->globalPos != QPoint(qt_last_x, qt_last_y) && (stateChange != Qt::NoButton)) { - MouseEvent * newMouseEvent = new MouseEvent(e->tlw, e->localPos, e->globalPos, e->buttons); + MouseEvent * newMouseEvent = new MouseEvent(e->tlw, e->timestamp, e->localPos, e->globalPos, e->buttons); userEventQueue.prepend(newMouseEvent); // just in case the move triggers a new event loop stateChange = Qt::NoButton; } @@ -571,6 +577,9 @@ void QApplicationPrivate::processMouseEvent(MouseEvent *e) type = QEvent::MouseMove; qt_last_x = globalPoint.x(); qt_last_y = globalPoint.y(); + if (qAbs(globalPoint.x() - mousePressX) > mouse_double_click_distance|| + qAbs(globalPoint.y() - mousePressY) > mouse_double_click_distance) + mousePressButton = Qt::NoButton; } else { // check to see if a new button has been pressed/released for (int check = Qt::LeftButton; @@ -586,8 +595,19 @@ void QApplicationPrivate::processMouseEvent(MouseEvent *e) return; } buttons = e->buttons; - if (button & e->buttons) - type = QEvent::MouseButtonPress; + if (button & e->buttons) { + if ((e->timestamp - mousePressTime) < static_cast(QApplication::doubleClickInterval()) && button == mousePressButton) { + type = QEvent::MouseButtonDblClick; + mousePressButton = Qt::NoButton; + } + else { + type = QEvent::MouseButtonPress; + mousePressTime = e->timestamp; + mousePressButton = button; + mousePressX = qt_last_x; + mousePressY = qt_last_y; + } + } else type = QEvent::MouseButtonRelease; } diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 955a3fc..a2bded4 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -68,6 +68,7 @@ #include "QtGui/private/qshortcutmap_p.h" #include #include "QtCore/qpoint.h" +#include #ifdef Q_WS_QWS #include "QtGui/qscreen_qws.h" #include @@ -565,18 +566,20 @@ public: #endif #ifdef Q_WS_LITE + static QTime time; class UserEvent { public: - UserEvent(QWidget *w) { tlw = w; } + UserEvent(QWidget *w, QEvent::Type t, ulong time) { tlw = w; type = t; timestamp = time; } QWidget * tlw; QEvent::Type type; + unsigned long timestamp; }; class MouseEvent : public UserEvent { public: - MouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b) - : UserEvent(w){ localPos = local; globalPos = global; buttons = b; type = QEvent::MouseMove; } + MouseEvent(QWidget *w, ulong time, const QPoint & local, const QPoint & global, Qt::MouseButtons b) + : UserEvent(w, QEvent::MouseMove, time){ localPos = local; globalPos = global; buttons = b; } QPoint localPos; QPoint globalPos; Qt::MouseButtons buttons; @@ -584,8 +587,8 @@ public: class WheelEvent : public UserEvent { public: - WheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) - : UserEvent(w) { localPos = local; globalPos = global; delta = d; orient = o; type = QEvent::Wheel; } + WheelEvent(QWidget *w, ulong time, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) + : UserEvent(w, QEvent::Wheel, time) { localPos = local; globalPos = global; delta = d; orient = o; } int delta; QPoint localPos; QPoint globalPos; @@ -594,8 +597,8 @@ public: class KeyEvent : public UserEvent { public: - KeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) - :UserEvent(w){ type = t; key = k; unicode = text; repeat = autorep; repeatCount = count; modifiers = mods; } + KeyEvent(QWidget *w, QEvent::Type t, ulong time, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) + :UserEvent(w, t, time){ key = k; unicode = text; repeat = autorep; repeatCount = count; modifiers = mods; } int key; QString unicode; bool repeat; @@ -604,17 +607,29 @@ public: }; static void handleMouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b) { - MouseEvent * e = new MouseEvent(w, local, global, b); + handleMouseEvent(w, local, global, b, time.elapsed()); + } + + static void handleMouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b, ulong timestamp) { + MouseEvent * e = new MouseEvent(w, timestamp, local, global, b); queueUserEvent(e); } static void handleKeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) { - KeyEvent * e = new KeyEvent(w, t, k, mods, text, autorep, count); + handleKeyEvent(w, t, time.elapsed(), k, mods, text, autorep, count); + } + + static void handleKeyEvent(QWidget *w, QEvent::Type t, ulong timestamp, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) { + KeyEvent * e = new KeyEvent(w, t, timestamp, k, mods, text, autorep, count); queueUserEvent(e); } static void handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) { - WheelEvent *e = new WheelEvent(w, local, global, d, o); + handleWheelEvent(w, time.elapsed(), local, global, d, o); + } + + static void handleWheelEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) { + WheelEvent *e = new WheelEvent(w, timestamp, local, global, d, o); queueUserEvent(e); } -- cgit v0.12 From 00de571cfaba6eca36fea49a820b6af7111c450c Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 27 Jan 2010 16:41:37 +0100 Subject: make timestamp the second argument for QApplicationPrivate::handleMouseEvent() --- src/gui/kernel/qapplication_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index a2bded4..0741148 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -610,7 +610,7 @@ public: handleMouseEvent(w, local, global, b, time.elapsed()); } - static void handleMouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b, ulong timestamp) { + static void handleMouseEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b) { MouseEvent * e = new MouseEvent(w, timestamp, local, global, b); queueUserEvent(e); } -- cgit v0.12 From 5a14ca2ad6c601eeff4ed24085d10a7a57b9ebd9 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 27 Jan 2010 16:47:35 +0100 Subject: make timestamp the second argument ... part 2 --- src/gui/kernel/qapplication_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 0741148..75bc5bd 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -607,7 +607,7 @@ public: }; static void handleMouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b) { - handleMouseEvent(w, local, global, b, time.elapsed()); + handleMouseEvent(w, time.elapsed(), local, global, b); } static void handleMouseEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b) { -- cgit v0.12 From 03d4a4c11688e0338cad713c2b50aec4122824d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 28 Jan 2010 10:04:14 +0100 Subject: Minimaldfb: Make sure the right blitter is used in the windowsurface --- .../minimaldfb/qwindowsurface_minimaldfb.cpp | 19 +++++++++++-------- .../minimaldfb/qwindowsurface_minimaldfb.h | 2 -- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp index 4be61df..1cb33f7 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -66,7 +66,7 @@ QDirectFbWindowSurface::QDirectFbWindowSurface(QDirectFbGraphicsSystemScreen *sc qDebug() << "WindowSurface format " << QDirectFbConvenience::imageFormatFromSurfaceFormat(format,caps); - blitter = new QDirectFbBlitter(window->rect(), m_dfbSurface); + QDirectFbBlitter *blitter = new QDirectFbBlitter(window->rect(), m_dfbSurface); m_pmdata = new QBlittablePixmapData(QPixmapData::PixmapType); m_pmdata->setBlittable(blitter); m_pixmap = new QPixmap(m_pmdata); @@ -88,7 +88,8 @@ void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const Q_UNUSED(widget); Q_UNUSED(offset); - blitter->unlock(); + m_pmdata->blittable()->unlock(); + const quint8 windowOpacity = quint8(widget->windowOpacity() * 0xff); m_dfbWindow->SetOpacity(m_dfbWindow,windowOpacity); @@ -102,16 +103,16 @@ void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const void QDirectFbWindowSurface::setGeometry(const QRect &rect) { - blitter->unlock(); + m_pmdata->blittable()->unlock(); + QWindowSurface::setGeometry(rect); m_dfbWindow->SetBounds(m_dfbWindow, rect.x(),rect.y(), rect.width(), rect.height()); //Have to add 1 ref ass it will be removed by deleting the old blitter in setBlittable m_dfbSurface->AddRef(m_dfbSurface); - QBlittable *blittabler = new QDirectFbBlitter(rect,m_dfbSurface); - m_pmdata->setBlittable(blittabler); - + QDirectFbBlitter *blitter = new QDirectFbBlitter(rect,m_dfbSurface); + m_pmdata->setBlittable(blitter); } static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int dx, int dy) @@ -124,7 +125,8 @@ static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int bool QDirectFbWindowSurface::scroll(const QRegion &area, int dx, int dy) { - blitter->unlock(); + m_pmdata->blittable()->unlock(); + if (!m_dfbSurface || area.isEmpty()) return false; m_dfbSurface->SetBlittingFlags(m_dfbSurface, DSBLIT_NOFX); @@ -152,7 +154,8 @@ void QDirectFbWindowSurface::endPaint(const QRegion ®ion) void QDirectFbWindowSurface::setVisible(bool visible) { - blitter->unlock(); + m_pmdata->blittable()->unlock(); + if (visible) { int x = this->geometry().x(); int y = this->geometry().y(); diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h index 088aeba..f74fb29 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h @@ -50,7 +50,6 @@ QT_BEGIN_NAMESPACE class QDirectFbGraphicsSystemScreen; -class QDirectFbBlitter; class QDirectFbWindowSurface : public QWindowSurface { @@ -81,7 +80,6 @@ private: IDirectFBWindow *m_dfbWindow; IDirectFBSurface *m_dfbSurface; - QDirectFbBlitter *blitter; }; QT_END_NAMESPACE -- cgit v0.12 From 85e565c76d6a37d8231e8136d80d85e5fa0608ee Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Thu, 28 Jan 2010 11:23:46 +0100 Subject: glib event loop: check that an event is still available before fetching it --- src/gui/kernel/qeventdispatcher_glib_lite.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/kernel/qeventdispatcher_glib_lite.cpp b/src/gui/kernel/qeventdispatcher_glib_lite.cpp index b8d2a5b..6d80823 100644 --- a/src/gui/kernel/qeventdispatcher_glib_lite.cpp +++ b/src/gui/kernel/qeventdispatcher_glib_lite.cpp @@ -76,9 +76,8 @@ static gboolean userEventSourceDispatch(GSource *s, GSourceFunc, gpointer) { GUserEventSource * source = reinterpret_cast(s); - int i = QApplicationPrivate::userEventsQueued(); QApplicationPrivate::UserEvent * event; - while (i--) { + while (QApplicationPrivate::userEventsQueued()) { event = QApplicationPrivate::getUserEvent(); // send through event filter -- cgit v0.12 From 8733fcea9b9d9d587733613ee116549af0b5f8b5 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 28 Jan 2010 13:35:05 +0100 Subject: Don't crash when mouse grabber widget gets deleted --- src/gui/kernel/qapplication_lite.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 42932ba..efabf14 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -555,7 +555,7 @@ void QApplicationPrivate::handleLeaveEvent(QWidget *tlw) void QApplicationPrivate::processMouseEvent(MouseEvent *e) { // qDebug() << "handleMouseEvent" << tlw << ev.pos() << ev.globalPos() << hex << ev.buttons(); - static QWidget *implicit_mouse_grabber=0; + static QPointer implicit_mouse_grabber; QEvent::Type type; // move first -- cgit v0.12 From 77dadcc0824ba4c4900f6f3e3290772800ec1719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 28 Jan 2010 14:30:38 +0100 Subject: Minimaldfb: Making sure removing tlw doesn't cause crash --- .../graphicssystems/minimaldfb/qdirectfbinput.cpp | 25 ++++++++++- .../graphicssystems/minimaldfb/qdirectfbinput.h | 5 ++- .../minimaldfb/qgraphicssystem_minimaldfb.cpp | 48 ++-------------------- .../minimaldfb/qgraphicssystem_minimaldfb.h | 4 -- .../minimaldfb/qwindowsurface_minimaldfb.cpp | 43 ++++++++++++++----- .../minimaldfb/qwindowsurface_minimaldfb.h | 4 +- 6 files changed, 63 insertions(+), 66 deletions(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp index 8809536..8e288ba 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp @@ -42,8 +42,17 @@ void InputSocketWaiter::run() m_cleanupMutex.unlock(); } -QDirectFbInput::QDirectFbInput(QObject *parent) - : QObject(parent) +QDirectFbInput *QDirectFbInput::instance() +{ + static QDirectFbInput *input = 0; + if (!input) { + input = new QDirectFbInput(); + } + return input; +} + +QDirectFbInput::QDirectFbInput() + : QObject() { dfbInterface = QDirectFbConvenience::dfbInterface(); @@ -68,6 +77,18 @@ void QDirectFbInput::addWindow(DFBWindowID id, QWidget *tlw) window->AttachEventBuffer(window,eventBuffer); } +void QDirectFbInput::removeWindow(QWidget *tlw) +{ + DFBWindowID id = tlwMap.key(tlw,0); + if (id) { + IDirectFBWindow *window; + dfbDisplayLayer->GetWindow(dfbDisplayLayer,id, &window); + + window->DetachEventBuffer(window,eventBuffer); + tlwMap.remove(id); + } +} + void QDirectFbInput::handleEvents() { DFBResult hasEvent = eventBuffer->HasEvent(eventBuffer); diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h index 74ccee2..31aa082 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h @@ -33,15 +33,16 @@ class QDirectFbInput : public QObject { Q_OBJECT public: - QDirectFbInput(QObject *parent = 0); - + static QDirectFbInput *instance(); void addWindow(DFBWindowID id, QWidget *tlw); + void removeWindow(QWidget *tlw); public slots: void handleEvents(); void applicationEnd(); private: + QDirectFbInput(); void handleMouseEvents(const DFBEvent &event); void handleWheelEvent(const DFBEvent &event); diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp index 06ae800..4489e31 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp @@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE QDirectFbGraphicsSystemScreen::QDirectFbGraphicsSystemScreen(int display) - :QGraphicsSystemScreen() , m_input(this) + :QGraphicsSystemScreen() { m_layer = QDirectFbConvenience::dfbDisplayLayer(display); m_layer->SetCooperativeLevel(m_layer,DLSCL_SHARED); @@ -64,56 +64,19 @@ QDirectFbGraphicsSystemScreen::QDirectFbGraphicsSystemScreen(int display) m_layer->GetConfiguration(m_layer, &config); m_format = QDirectFbConvenience::imageFormatFromSurfaceFormat(config.pixelformat, config.surface_caps); - qDebug() << QDirectFbConvenience::pixelFomatHasAlpha(config.pixelformat); - qDebug() << QDirectFbConvenience::colorDepthForSurface(config.pixelformat); - qDebug() << "GraphcisSystemScreen has format: " << m_format; m_geometry = QRect(0,0,config.width,config.height); const int dpi = 72; const qreal inch = 25.4; m_depth = 32; m_physicalSize = QSize(qRound(config.width * inch / dpi), qRound(config.height *inch / dpi)); + + cursor = new QDirectFBCursor(this); } QDirectFbGraphicsSystemScreen::~QDirectFbGraphicsSystemScreen() { } -IDirectFBWindow *QDirectFbGraphicsSystemScreen::createWindow(const QRect &rect, QWidget *tlw) -{ - IDirectFBWindow *window; - - DFBWindowDescription description; - memset(&description,0,sizeof(DFBWindowDescription)); - description.flags = DFBWindowDescriptionFlags(DWDESC_WIDTH|DWDESC_HEIGHT|DWDESC_POSX|DWDESC_POSY|DWDESC_SURFACE_CAPS -#if DIRECTFB_MINOR_VERSION >= 1 - |DWDESC_OPTIONS -#endif - |DWDESC_CAPS); - description.width = rect.width(); - description.height = rect.height(); - description.posx = rect.x(); - description.posy = rect.y(); -#if DIRECTFB_MINOR_VERSION >= 1 - description.options = DFBWindowOptions(DWOP_ALPHACHANNEL); -#endif - description.caps = DFBWindowCapabilities(DWCAPS_DOUBLEBUFFER|DWCAPS_ALPHACHANNEL); - description.surface_caps = DSCAPS_PREMULTIPLIED; - - DFBResult result = m_layer->CreateWindow(m_layer,&description,&window); - if (result != DFB_OK) { - DirectFBError("QDirectFbGraphicsSystemScreen: failed to create window",result); - } - - DFBWindowID id; - window->GetID(window, &id); - m_input.addWindow(id,tlw); - - cursor = new QDirectFBCursor(this); - - return window; -} - - QDirectFbGraphicsSystem::QDirectFbGraphicsSystem() { const QStringList args = QCoreApplication::arguments(); @@ -130,9 +93,6 @@ QDirectFbGraphicsSystem::QDirectFbGraphicsSystem() } delete[] argv; - //init directfb - QDirectFbConvenience::dfbInterface(); - mPrimaryScreen = new QDirectFbGraphicsSystemScreen(0); mScreens.append(mPrimaryScreen); } @@ -147,7 +107,7 @@ QPixmapData *QDirectFbGraphicsSystem::createPixmapData(QPixmapData::PixelType ty QWindowSurface *QDirectFbGraphicsSystem::createWindowSurface(QWidget *widget) const { - return new QDirectFbWindowSurface (mPrimaryScreen, widget); + return new QDirectFbWindowSurface (widget); } QBlittable *QDirectFbGraphicsSystem::createBlittable(const QRect &rect) const diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h index 892bc58..b16153d 100644 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h +++ b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h @@ -63,16 +63,12 @@ public: QImage::Format format() const { return m_format; } QSize physicalSize() const { return m_physicalSize; } - IDirectFBWindow *createWindow(const QRect &,QWidget *tlw); - public: QRect m_geometry; int m_depth; QImage::Format m_format; QSize m_physicalSize; - QDirectFbInput m_input; - IDirectFBDisplayLayer *m_layer; private: diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp index 1cb33f7..9a424cd 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -49,23 +49,43 @@ QT_BEGIN_NAMESPACE -QDirectFbWindowSurface::QDirectFbWindowSurface(QDirectFbGraphicsSystemScreen *screen, QWidget *window) - : QWindowSurface(window), m_screen(screen), m_pixmap(0), m_pmdata(0), +QDirectFbWindowSurface::QDirectFbWindowSurface(QWidget *window) + : QWindowSurface(window), m_pixmap(0), m_pmdata(0), m_dfbWindow(0), m_dfbSurface(0) { window->setWindowSurface(this); - m_dfbWindow = m_screen->createWindow(window->rect(),window); - m_dfbWindow->GetSurface(m_dfbWindow,&m_dfbSurface); - DFBSurfaceCapabilities caps; - m_dfbSurface->GetCapabilities(m_dfbSurface, &caps); - DFBSurfacePixelFormat format; - m_dfbSurface->GetPixelFormat(m_dfbSurface, &format); - qDebug() << QDirectFbConvenience::pixelFomatHasAlpha(format); - qDebug() << QDirectFbConvenience::colorDepthForSurface(format); - qDebug() << "WindowSurface format " << QDirectFbConvenience::imageFormatFromSurfaceFormat(format,caps); + DFBWindowDescription description; + memset(&description,0,sizeof(DFBWindowDescription)); + description.flags = DFBWindowDescriptionFlags(DWDESC_WIDTH|DWDESC_HEIGHT|DWDESC_POSX|DWDESC_POSY|DWDESC_SURFACE_CAPS +#if DIRECTFB_MINOR_VERSION >= 1 + |DWDESC_OPTIONS +#endif + |DWDESC_CAPS); + description.width = window->rect().width(); + description.height = window->rect().height(); + description.posx = window->rect().x(); + description.posy = window->rect().y(); +#if DIRECTFB_MINOR_VERSION >= 1 + description.options = DFBWindowOptions(DWOP_ALPHACHANNEL); +#endif + description.caps = DFBWindowCapabilities(DWCAPS_DOUBLEBUFFER|DWCAPS_ALPHACHANNEL); + description.surface_caps = DSCAPS_PREMULTIPLIED; + + IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); + DFBResult result = layer->CreateWindow(layer,&description,&m_dfbWindow); + if (result != DFB_OK) { + DirectFBError("QDirectFbGraphicsSystemScreen: failed to create window",result); + } + + DFBWindowID id; + m_dfbWindow->GetID(m_dfbWindow, &id); + QDirectFbInput::instance()->addWindow(id,window); + + m_dfbWindow->GetSurface(m_dfbWindow,&m_dfbSurface); + QDirectFbBlitter *blitter = new QDirectFbBlitter(window->rect(), m_dfbSurface); m_pmdata = new QBlittablePixmapData(QPixmapData::PixmapType); m_pmdata->setBlittable(blitter); @@ -76,6 +96,7 @@ QDirectFbWindowSurface::QDirectFbWindowSurface(QDirectFbGraphicsSystemScreen *sc QDirectFbWindowSurface::~QDirectFbWindowSurface() { + QDirectFbInput::instance()->removeWindow(this->window()); } QPaintDevice *QDirectFbWindowSurface::paintDevice() diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h index f74fb29..f6d48c6 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h @@ -54,8 +54,7 @@ class QDirectFbGraphicsSystemScreen; class QDirectFbWindowSurface : public QWindowSurface { public: - QDirectFbWindowSurface - (QDirectFbGraphicsSystemScreen *screen, QWidget *window); + QDirectFbWindowSurface(QWidget *window); ~QDirectFbWindowSurface(); QPaintDevice *paintDevice(); @@ -74,7 +73,6 @@ public: private: void lockSurfaceToImage(); - QDirectFbGraphicsSystemScreen *m_screen; QPixmap *m_pixmap; QBlittablePixmapData *m_pmdata; -- cgit v0.12 From 112a81b92ed7a45c9d1ae461eb6aa61e0ca45e8f Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 28 Jan 2010 15:59:05 +0100 Subject: Fix keyboard modifier state. --- .../testlite/qwindowsurface_testlite.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp index 26a7675..cbb720e 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp @@ -562,6 +562,22 @@ static int lookupCode(unsigned int xkeycode) } +static Qt::KeyboardModifiers modifierFromKeyCode(int qtcode) +{ + switch (qtcode) { + case Qt::Key_Control: + return Qt::ControlModifier; + case Qt::Key_Alt: + return Qt::AltModifier; + case Qt::Key_Shift: + return Qt::ShiftModifier; + case Qt::Key_Meta: + return Qt::MetaModifier; + default: + return Qt::NoModifier; + } +} + void QTestLiteWindowSurface::handleKeyEvent(QEvent::Type type, void *ev) { XKeyEvent *e = static_cast(ev); @@ -581,6 +597,10 @@ void QTestLiteWindowSurface::handleKeyEvent(QEvent::Type type, void *ev) int qtcode = lookupCode(keySym); // qDebug() << "lookup: " << hex << keySym << qtcode << "mod" << modifiers; + //X11 specifies state *before*, Qt expects state *after* the event + + modifiers ^= modifierFromKeyCode(qtcode); + if (qtcode) { QApplicationPrivate::handleKeyEvent(window(), type, qtcode, modifiers); } else if (chars[0]) { -- cgit v0.12 From ceb4feb8f5c65aa15213bc01dbf1268f3bc7119e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 28 Jan 2010 17:36:51 +0100 Subject: Make tlw update when resizing --- src/gui/kernel/qwidget_lite.cpp | 2 ++ .../graphicssystems/testlite/qwindowsurface_testlite.cpp | 14 +------------- .../graphicssystems/testlite/qwindowsurface_testlite.h | 1 - 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index 8601855..3913708 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -507,6 +507,8 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) if (isResize) { QResizeEvent e(r.size(), olds); QApplication::sendEvent(q, &e); + if (q->isWindow()) + q->update(); } } else { // not visible if (isMove && q->pos() != oldPos) diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp index cbb720e..65407fd 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp @@ -90,24 +90,13 @@ void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const } -void QTestLiteWindowSurface::geometryChanged(const QRect &rect) -{ - bool resize = rect.size() != geometry().size(); - QWindowSurface::setGeometry(rect); - - if (resize) { - window()->update(); //### this is the wrong place for this... - } -} - - void QTestLiteWindowSurface::setGeometry(const QRect &rect) { QRect oldRect = geometry(); if (rect == oldRect) return; - QTestLiteWindowSurface::geometryChanged(rect); + QWindowSurface::setGeometry(rect); //if unchanged ### // xw->setSize(rect.width(), rect.height()); @@ -276,7 +265,6 @@ void QTestLiteWindowSurface::handleMouseEvent(QEvent::Type type, void *ev) void QTestLiteWindowSurface::handleGeometryChange(int x, int y, int w, int h) { - geometryChanged(QRect(x,y,w,h)); QApplicationPrivate::handleGeometryChange(window(), QRect(x,y,w,h)); } diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h index 9f9f052..0c4df1a 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h @@ -62,7 +62,6 @@ public: QPaintDevice *paintDevice(); void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); void setGeometry(const QRect &rect); - void geometryChanged(const QRect &rect); bool scroll(const QRegion &area, int dx, int dy); void beginPaint(const QRegion ®ion); -- cgit v0.12 From 990968b87ef6bee329ba23227b78bac0e58bdd02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 28 Jan 2010 17:38:18 +0100 Subject: minimaldfb: cleanup in dfb. Not using the DWET_DESTROY event yet in the input driver --- .../graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp index 9a424cd..422ed14 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -82,21 +82,18 @@ QDirectFbWindowSurface::QDirectFbWindowSurface(QWidget *window) m_dfbWindow->GetID(m_dfbWindow, &id); QDirectFbInput::instance()->addWindow(id,window); - - m_dfbWindow->GetSurface(m_dfbWindow,&m_dfbSurface); QDirectFbBlitter *blitter = new QDirectFbBlitter(window->rect(), m_dfbSurface); m_pmdata = new QBlittablePixmapData(QPixmapData::PixmapType); m_pmdata->setBlittable(blitter); m_pixmap = new QPixmap(m_pmdata); - - } QDirectFbWindowSurface::~QDirectFbWindowSurface() { QDirectFbInput::instance()->removeWindow(this->window()); + m_dfbWindow->Destroy(m_dfbWindow); } QPaintDevice *QDirectFbWindowSurface::paintDevice() @@ -106,9 +103,6 @@ QPaintDevice *QDirectFbWindowSurface::paintDevice() void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) { - Q_UNUSED(widget); - Q_UNUSED(offset); - m_pmdata->blittable()->unlock(); const quint8 windowOpacity = quint8(widget->windowOpacity() * 0xff); -- cgit v0.12 From edd4a524c19283674402a7f0611e391358a5cdb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 1 Feb 2010 12:28:36 +0100 Subject: Send events to popups --- src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp index 422ed14..d2b038c 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -188,7 +188,6 @@ void QDirectFbWindowSurface::setVisible(bool visible) Qt::WindowFlags QDirectFbWindowSurface::setWindowFlags(Qt::WindowFlags flags) { switch (flags & Qt::WindowType_Mask) { - case Qt::Popup: case Qt::ToolTip: { DFBWindowOptions options; m_dfbWindow->GetOptions(m_dfbWindow,&options); -- cgit v0.12 From 6fe259f696b5cc302bda6befcefe0a94e2676325 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 1 Feb 2010 11:38:03 +0100 Subject: QWeakPointer is the new QPointer --- src/gui/kernel/qapplication_lite.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index efabf14..8bbc756 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -555,7 +555,7 @@ void QApplicationPrivate::handleLeaveEvent(QWidget *tlw) void QApplicationPrivate::processMouseEvent(MouseEvent *e) { // qDebug() << "handleMouseEvent" << tlw << ev.pos() << ev.globalPos() << hex << ev.buttons(); - static QPointer implicit_mouse_grabber; + static QWeakPointer implicit_mouse_grabber; QEvent::Type type; // move first @@ -616,7 +616,7 @@ void QApplicationPrivate::processMouseEvent(MouseEvent *e) //popup mouse handling is magical... mouseWindow = qApp->activePopupWidget(); - implicit_mouse_grabber = 0; + implicit_mouse_grabber.clear(); //### how should popup mode and implicit mouse grab interact? } else if (e->tlw && app_do_modal && !qt_try_modal(e->tlw, e->type) ) { @@ -657,7 +657,7 @@ void QApplicationPrivate::processMouseEvent(MouseEvent *e) Q_ASSERT(mouseWindow); mouseWindow->activateWindow(); //focus } else if (implicit_mouse_grabber) { - mouseWidget = implicit_mouse_grabber; + mouseWidget = implicit_mouse_grabber.data(); mouseWindow = mouseWidget->window(); if (mouseWindow != e->tlw) localPoint = mouseWindow->mapFromGlobal(globalPoint); @@ -670,7 +670,7 @@ void QApplicationPrivate::processMouseEvent(MouseEvent *e) if (buttons == Qt::NoButton) { //qDebug() << "resetting mouse grabber"; - implicit_mouse_grabber = 0; + implicit_mouse_grabber.clear(); } if (mouseWidget != qt_last_mouse_receiver) { -- cgit v0.12 From f4588871d38d244c83e50354da66d145ae40be8f Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Mon, 1 Feb 2010 13:42:56 +0100 Subject: Change mouse, key, and wheel events to use a window id instead of a pointer to a QWidget --- src/gui/kernel/qapplication_lite.cpp | 29 ++++++++++++++------ src/gui/kernel/qapplication_p.h | 32 +++++++++++----------- .../graphicssystems/minimaldfb/qdirectfbinput.cpp | 18 +++++++----- .../testlite/qwindowsurface_testlite.cpp | 8 +++--- 4 files changed, 51 insertions(+), 36 deletions(-) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 8bbc756..39cc29f 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -561,14 +561,20 @@ void QApplicationPrivate::processMouseEvent(MouseEvent *e) // move first Qt::MouseButtons stateChange = e->buttons ^ buttons; if (e->globalPos != QPoint(qt_last_x, qt_last_y) && (stateChange != Qt::NoButton)) { - MouseEvent * newMouseEvent = new MouseEvent(e->tlw, e->timestamp, e->localPos, e->globalPos, e->buttons); + MouseEvent * newMouseEvent = new MouseEvent(e->id, e->timestamp, e->localPos, e->globalPos, e->buttons); userEventQueue.prepend(newMouseEvent); // just in case the move triggers a new event loop stateChange = Qt::NoButton; } + QWidget * tlw; + if (e->id) + tlw = QWidget::find(e->id); + else + tlw = 0; + QPoint localPoint = e->localPos; QPoint globalPoint = e->globalPos; - QWidget *mouseWindow = e->tlw; + QWidget *mouseWindow = tlw; Qt::MouseButton button = Qt::NoButton; @@ -619,11 +625,11 @@ void QApplicationPrivate::processMouseEvent(MouseEvent *e) implicit_mouse_grabber.clear(); //### how should popup mode and implicit mouse grab interact? - } else if (e->tlw && app_do_modal && !qt_try_modal(e->tlw, e->type) ) { + } else if (tlw && app_do_modal && !qt_try_modal(tlw, e->type) ) { //even if we're blocked by modality, we should deliver the mouse release event.. //### this code is not completely correct: multiple buttons can be pressed simultaneously if (!(implicit_mouse_grabber && buttons == Qt::NoButton)) { - qDebug() << "modal blocked mouse event to" << e->tlw; + qDebug() << "modal blocked mouse event to" << tlw; return; } } @@ -636,7 +642,7 @@ void QApplicationPrivate::processMouseEvent(MouseEvent *e) if (!mouseWindow && !implicit_mouse_grabber) mouseWindow = QApplication::desktop(); - if (mouseWindow && mouseWindow != e->tlw) { + if (mouseWindow && mouseWindow != tlw) { //we did not get a sensible localPoint from the window system, so let's calculate it localPoint = mouseWindow->mapFromGlobal(globalPoint); } @@ -659,7 +665,7 @@ void QApplicationPrivate::processMouseEvent(MouseEvent *e) } else if (implicit_mouse_grabber) { mouseWidget = implicit_mouse_grabber.data(); mouseWindow = mouseWidget->window(); - if (mouseWindow != e->tlw) + if (mouseWindow != tlw) localPoint = mouseWindow->mapFromGlobal(globalPoint); } @@ -705,7 +711,11 @@ void QApplicationPrivate::processWheelEvent(WheelEvent *e) qt_last_x = globalPoint.x(); qt_last_y = globalPoint.y(); - QWidget *mouseWindow = e->tlw; + QWidget *mouseWindow; + if (e->id) + mouseWindow = QWidget::find(e->id); + else + mouseWindow = 0; // find the tlw if we didn't get it from the plugin if (!mouseWindow) { @@ -746,8 +756,9 @@ void QApplicationPrivate::processKeyEvent(KeyEvent *e) } if (!focusW) focusW = QApplication::focusWidget(); - if (!focusW) - focusW = e->tlw; + if (!focusW && e->id) { + focusW = QWidget::find(e->id); + } if (!focusW) focusW = QApplication::activeWindow(); diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 75bc5bd..d07b83b 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -570,16 +570,16 @@ public: class UserEvent { public: - UserEvent(QWidget *w, QEvent::Type t, ulong time) { tlw = w; type = t; timestamp = time; } - QWidget * tlw; + UserEvent(WId w, ulong time, QEvent::Type t) { id = w; type = t; timestamp = time; } + WId id; QEvent::Type type; unsigned long timestamp; }; class MouseEvent : public UserEvent { public: - MouseEvent(QWidget *w, ulong time, const QPoint & local, const QPoint & global, Qt::MouseButtons b) - : UserEvent(w, QEvent::MouseMove, time){ localPos = local; globalPos = global; buttons = b; } + MouseEvent(WId w, ulong time, const QPoint & local, const QPoint & global, Qt::MouseButtons b) + : UserEvent(w, time, QEvent::MouseMove){ localPos = local; globalPos = global; buttons = b; } QPoint localPos; QPoint globalPos; Qt::MouseButtons buttons; @@ -587,8 +587,8 @@ public: class WheelEvent : public UserEvent { public: - WheelEvent(QWidget *w, ulong time, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) - : UserEvent(w, QEvent::Wheel, time) { localPos = local; globalPos = global; delta = d; orient = o; } + WheelEvent(WId w, ulong time, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) + : UserEvent(w, time, QEvent::Wheel) { localPos = local; globalPos = global; delta = d; orient = o; } int delta; QPoint localPos; QPoint globalPos; @@ -597,8 +597,8 @@ public: class KeyEvent : public UserEvent { public: - KeyEvent(QWidget *w, QEvent::Type t, ulong time, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) - :UserEvent(w, t, time){ key = k; unicode = text; repeat = autorep; repeatCount = count; modifiers = mods; } + KeyEvent(WId w, ulong time, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) + :UserEvent(w, time, t){ key = k; unicode = text; repeat = autorep; repeatCount = count; modifiers = mods; } int key; QString unicode; bool repeat; @@ -606,29 +606,29 @@ public: Qt::KeyboardModifiers modifiers; }; - static void handleMouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b) { + static void handleMouseEvent(WId w, const QPoint & local, const QPoint & global, Qt::MouseButtons b) { handleMouseEvent(w, time.elapsed(), local, global, b); } - static void handleMouseEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b) { + static void handleMouseEvent(WId w, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b) { MouseEvent * e = new MouseEvent(w, timestamp, local, global, b); queueUserEvent(e); } - static void handleKeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) { - handleKeyEvent(w, t, time.elapsed(), k, mods, text, autorep, count); + static void handleKeyEvent(WId w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) { + handleKeyEvent(w, time.elapsed(), t, k, mods, text, autorep, count); } - static void handleKeyEvent(QWidget *w, QEvent::Type t, ulong timestamp, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) { - KeyEvent * e = new KeyEvent(w, t, timestamp, k, mods, text, autorep, count); + static void handleKeyEvent(WId w, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) { + KeyEvent * e = new KeyEvent(w, timestamp, t, k, mods, text, autorep, count); queueUserEvent(e); } - static void handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) { + static void handleWheelEvent(WId w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) { handleWheelEvent(w, time.elapsed(), local, global, d, o); } - static void handleWheelEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) { + static void handleWheelEvent(WId w, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) { WheelEvent *e = new WheelEvent(w, timestamp, local, global, d, o); queueUserEvent(e); } diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp index 8e288ba..6229b46 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp @@ -137,13 +137,14 @@ void QDirectFbInput::handleMouseEvents(const DFBEvent &event) IDirectFBWindow *window; layer->GetWindow(layer,event.window.window_id,&window); + long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000); + timestamp /= 1000; + if (event.window.type == DWET_BUTTONDOWN) { static long prevTime = 0; static QWidget *prevWindow; static int prevX = -999; static int prevY = -999; - long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000); - timestamp /= 1000; if (tlw == prevWindow && timestamp - prevTime < QApplication::doubleClickInterval() && qAbs(event.window.cx - prevX) < 5 && qAbs(event.window.cy - prevY) < 5) { @@ -161,7 +162,7 @@ void QDirectFbInput::handleMouseEvents(const DFBEvent &event) window->UngrabPointer(window); } - QApplicationPrivate::handleMouseEvent(tlw, p, globalPos, buttons); + QApplicationPrivate::handleMouseEvent(event.window.window_id, timestamp, p, globalPos, buttons); } void QDirectFbInput::applicationEnd() @@ -174,9 +175,10 @@ void QDirectFbInput::handleWheelEvent(const DFBEvent &event) { QPoint p(event.window.cx, event.window.cy); QPoint globalPos = globalPoint(event); - QWidget *tlw = tlwMap.value(event.window.window_id); + long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000); + timestamp /= 1000; - QApplicationPrivate::handleWheelEvent(tlw, p, globalPos, + QApplicationPrivate::handleWheelEvent(event.window.window_id, timestamp, p, globalPos, event.window.step*120, Qt::Vertical); } @@ -187,8 +189,10 @@ void QDirectFbInput::handleKeyEvents(const DFBEvent &event) Qt::Key key = QDirectFbConvenience::keyMap()->value(event.window.key_symbol); Qt::KeyboardModifiers modifiers = QDirectFbConvenience::keyboardModifiers(event.window.modifiers); - QWidget *tlw = tlwMap.value(event.window.window_id); - QApplicationPrivate::handleKeyEvent(tlw, type, key, modifiers, QChar(event.window.key_symbol)); + long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000); + timestamp /= 1000; + + QApplicationPrivate::handleKeyEvent(event.window.window_id, timestamp, type, key, modifiers, QChar(event.window.key_symbol)); } void QDirectFbInput::handleEnterLeaveEvents(const DFBEvent &event) diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp index 65407fd..0d277b8 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp @@ -243,7 +243,7 @@ void QTestLiteWindowSurface::handleMouseEvent(QEvent::Type type, void *ev) bool hor = (((e->button == Button4 || e->button == Button5) && (modifiers & Qt::AltModifier)) || (e->button == 6 || e->button == 7)); - QApplicationPrivate::handleWheelEvent(window(), + QApplicationPrivate::handleWheelEvent(winId(), e->time, QPoint(e->x, e->y), QPoint(e->x_root, e->y_root), delta, hor ? Qt::Horizontal : Qt::Vertical); @@ -256,7 +256,7 @@ void QTestLiteWindowSurface::handleMouseEvent(QEvent::Type type, void *ev) buttons ^= button; // X event uses state *before*, Qt uses state *after* - QApplicationPrivate::handleMouseEvent(window(), QPoint(e->x, e->y), + QApplicationPrivate::handleMouseEvent(winId(), e->time, QPoint(e->x, e->y), QPoint(e->x_root, e->y_root), buttons); @@ -590,12 +590,12 @@ void QTestLiteWindowSurface::handleKeyEvent(QEvent::Type type, void *ev) modifiers ^= modifierFromKeyCode(qtcode); if (qtcode) { - QApplicationPrivate::handleKeyEvent(window(), type, qtcode, modifiers); + QApplicationPrivate::handleKeyEvent(winId(), e->time, type, qtcode, modifiers); } else if (chars[0]) { int qtcode = chars.toUpper()[0]; //Not exactly right... if (modifiers & Qt::ControlModifier && qtcode < ' ') qtcode = chars[0] + '@'; - QApplicationPrivate::handleKeyEvent(window(), type, qtcode, modifiers, QString::fromLatin1(chars)); + QApplicationPrivate::handleKeyEvent(winId(), e->time, type, qtcode, modifiers, QString::fromLatin1(chars)); } else { qWarning() << "unknown X keycode" << hex << e->keycode << keySym; } -- cgit v0.12 From 9f761b8d9af22796e7b20fee2a9a464e253cf267 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Mon, 1 Feb 2010 16:47:54 +0100 Subject: winId() support for minimaldfb --- .../graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp | 8 ++++++++ .../graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp index d2b038c..d51498f 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -212,4 +212,12 @@ void QDirectFbWindowSurface::lower() m_dfbWindow->LowerToBottom(m_dfbWindow); } +WId QDirectFbWindowSurface::winId() const +{ + DFBWindowID id; + m_dfbWindow->GetID(m_dfbWindow, &id); + return WId(id); +} + + QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h index f6d48c6..ca34cbf 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h @@ -70,6 +70,9 @@ public: void raise(); void lower(); + + WId winId() const; + private: void lockSurfaceToImage(); -- cgit v0.12 From 6a34243acbd6960502efefd1af4a560c245301da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 1 Feb 2010 18:30:43 +0100 Subject: minimaldfb: dont send all key presses with character --- src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp index 6229b46..cfe1807 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp @@ -192,7 +192,11 @@ void QDirectFbInput::handleKeyEvents(const DFBEvent &event) long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000); timestamp /= 1000; - QApplicationPrivate::handleKeyEvent(event.window.window_id, timestamp, type, key, modifiers, QChar(event.window.key_symbol)); + QChar character; + if (DFB_KEY_TYPE(event.window.key_symbol) == DIKT_UNICODE) + character = QChar(event.window.key_symbol); + + QApplicationPrivate::handleKeyEvent(event.window.window_id, timestamp, type, key, modifiers, character); } void QDirectFbInput::handleEnterLeaveEvents(const DFBEvent &event) -- cgit v0.12 From 99ce03ef6c33a670d86706a8a7d701ac25e2e2b5 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 8 Feb 2010 12:53:15 +0100 Subject: Get rid of black flickering on resize --- src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp | 1 + src/plugins/graphicssystems/testlite/x11util.cpp | 9 +++++++-- src/plugins/graphicssystems/testlite/x11util.h | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp index 0d277b8..d50a59e 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp @@ -86,6 +86,7 @@ void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const // qDebug() << "QTestLiteWindowSurface::flush:" << (long)this; + xw->painted = true; //there is content in the buffer xw->paintEvent(); } diff --git a/src/plugins/graphicssystems/testlite/x11util.cpp b/src/plugins/graphicssystems/testlite/x11util.cpp index 7ad3ed5..20d4241 100644 --- a/src/plugins/graphicssystems/testlite/x11util.cpp +++ b/src/plugins/graphicssystems/testlite/x11util.cpp @@ -468,7 +468,7 @@ MyWindow::MyWindow(MyDisplay *display, int x, int y, int w, int h) currentCursor = -1; image_info = 0; - + painted = false; } @@ -517,8 +517,11 @@ void MyWindow::closeEvent() void MyWindow::paintEvent() { #ifdef MYX11_DEBUG - qDebug() << "MyWindow::paintEvent" << shm_img.size(); + qDebug() << "MyWindow::paintEvent" << shm_img.size() << painted; #endif + if (!painted) + return; + #ifdef DONT_USE_MIT_SHM // just convert the image every time... if (!shm_img.isNull()) { @@ -596,6 +599,8 @@ void MyWindow::resizeShmImage(int width, int height) Q_ASSERT(shm_attach_status == True); shm_img = QImage( (uchar*) image->data, image->width, image->height, image->bytes_per_line, QImage::Format_RGB32 ); + + painted = false; #endif } diff --git a/src/plugins/graphicssystems/testlite/x11util.h b/src/plugins/graphicssystems/testlite/x11util.h index 76e029d..184c1ca 100644 --- a/src/plugins/graphicssystems/testlite/x11util.h +++ b/src/plugins/graphicssystems/testlite/x11util.h @@ -136,6 +136,7 @@ public: //### QTestLiteWindowSurface *windowSurface; int currentCursor; + bool painted; private: void resizeShmImage(int width, int height); -- cgit v0.12 From ece7ebb01c65ff0930881bff869b99c1f6889fa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 5 Feb 2010 12:45:09 +0100 Subject: Second attemt on rasteroverlay in blitterpaintengine --- src/gui/image/qpixmap_blitter.cpp | 106 ++++++++++++++++++++++++++++-- src/gui/image/qpixmap_blitter_p.h | 87 ++++++++++++++++++++++++ src/gui/painting/qpaintengine_blitter.cpp | 97 ++++++++++++--------------- src/gui/painting/qpaintengine_blitter_p.h | 10 ++- 4 files changed, 236 insertions(+), 64 deletions(-) diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index 6e34fbd..f82a67d 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -1,6 +1,7 @@ #include "qpixmap_blitter_p.h" #include +#include #include #include @@ -11,6 +12,9 @@ static int global_ser_no = 0; QBlittablePixmapData::QBlittablePixmapData(QPixmapData::PixelType type) : QPixmapData(type,BlitterClass), m_engine(0), m_blittable(0) +#ifdef QT_BLITTER_RASTEROVERLAY + ,m_rasterOverlay(0), m_unmergedCopy(0) +#endif //QT_BLITTER_RASTEROVERLAY { setSerialNumber(++global_ser_no); } @@ -19,6 +23,10 @@ QBlittablePixmapData::~QBlittablePixmapData() { delete m_blittable; delete m_engine; +#ifdef QT_BLITTER_RASTEROVERLAY + delete m_rasterOverlay; + delete m_unmergedCopy; +#endif //QT_BLITTER_RASTEROVERLAY } QBlittable *QBlittablePixmapData::blittable() const @@ -132,18 +140,13 @@ void QBlittablePixmapData::fromImage(const QImage &image, Qt::ImageConversionFlags flags) { resize(image.width(),image.height()); + markRasterOverlay(QRect(0,0,w,h)); QImage *thisImg = buffer(); QImage correctFormatPic = image; if (correctFormatPic.format() != thisImg->format()) correctFormatPic = correctFormatPic.convertToFormat(thisImg->format(), flags); - //jl: This does not ALWAYS work as expected :( -// QPainter p(thisImg); -// p.setCompositionMode(QPainter::CompositionMode_Source); -// p.drawImage(0,0,image,flags); - - //So just copy strides by hand uchar *mem = thisImg->bits(); const uchar *bits = correctFormatPic.bits(); int bytesCopied = 0; @@ -163,3 +166,94 @@ QPaintEngine *QBlittablePixmapData::paintEngine() const } return m_engine; } + +#ifdef QT_BLITTER_RASTEROVERLAY + +static bool showRasterOverlay = !qgetenv("QT_BLITTER_RASTEROVERLAY").isEmpty(); + +void QBlittablePixmapData::mergeOverlay() +{ + if (m_unmergedCopy || !showRasterOverlay) + return; + m_unmergedCopy = new QImage(buffer()->copy()); + QPainter p(buffer()); + p.setCompositionMode(QPainter::CompositionMode_SourceOver); + p.drawImage(0,0,*overlay()); + p.end(); +} + +void QBlittablePixmapData::unmergeOverlay() +{ + if (!m_unmergedCopy || !showRasterOverlay) + return; + QPainter p(buffer()); + p.setCompositionMode(QPainter::CompositionMode_Source); + p.drawImage(0,0,*m_unmergedCopy); + p.end(); + + delete m_unmergedCopy; + m_unmergedCopy = 0; +} + +QImage *QBlittablePixmapData::overlay() +{ + if (!m_rasterOverlay|| + m_rasterOverlay->size() != QSize(w,h)){ + m_rasterOverlay = new QImage(w,h,QImage::Format_ARGB32_Premultiplied); + m_rasterOverlay->fill(0x00000000); + uint color = (qrand() % 11)+7; + m_overlayColor = QColor(Qt::GlobalColor(color)); + m_overlayColor.setAlpha(0x88); + + } + return m_rasterOverlay; +} + +void QBlittablePixmapData::markRasterOverlayImpl(const QRectF &rect) +{ + if (!showRasterOverlay) + return; + QRectF transformationRect = clipAndTransformRect(rect); + if(!transformationRect.isEmpty()) { + QPainter p(overlay()); + p.setBrush(m_overlayColor); + p.setCompositionMode(QPainter::CompositionMode_Source); + p.fillRect(transformationRect,QBrush(m_overlayColor)); + } +} + +void QBlittablePixmapData::unmarkRasterOverlayImpl(const QRectF &rect) +{ + if (!showRasterOverlay) + return; + QRectF transformationRect = clipAndTransformRect(rect); + if (!transformationRect.isEmpty()) { + QPainter p(overlay()); + QColor color(0x00,0x00,0x00,0x00); + p.setBrush(color); + p.setCompositionMode(QPainter::CompositionMode_Source); + p.fillRect(transformationRect,QBrush(color)); + } +} + +QRectF QBlittablePixmapData::clipAndTransformRect(const QRectF &rect) const +{ + QRectF transformationRect = rect; + paintEngine(); + if (m_engine->state()) { + transformationRect = m_engine->state()->matrix.mapRect(rect); + const QClipData *clipData = m_engine->clip(); + if (clipData) { + if (clipData->hasRectClip) { + transformationRect &= clipData->clipRect; + } else if (clipData->hasRegionClip) { + const QVector rects = clipData->clipRegion.rects(); + for (int i = 0; i < rects.size(); i++) { + transformationRect &= rects.at(i); + } + } + } + } + return transformationRect; +} +#endif //QT_BLITTER_RASTEROVERLAY diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h index ca834dc..73f80a8 100644 --- a/src/gui/image/qpixmap_blitter_p.h +++ b/src/gui/image/qpixmap_blitter_p.h @@ -23,10 +23,97 @@ public: void fromImage(const QImage &image, Qt::ImageConversionFlags flags); QPaintEngine *paintEngine() const; + + void markRasterOverlay(const QRectF &); + void markRasterOverlay(const QPointF &, const QTextItem &); + void markRasterOverlay(const QVectorPath &); + void markRasterOverlay(const QRect *rects, int rectCount); + void markRasterOverlay(const QRectF *rects, int rectCount); + void unmarkRasterOverlay(const QRectF &); + +#ifdef QT_BLITTER_RASTEROVERLAY + void mergeOverlay(); + void unmergeOverlay(); + QImage *overlay(); + +#endif //QT_BLITTER_RASTEROVERLAY protected: QBlitterPaintEngine *m_engine; QBlittable *m_blittable; +#ifdef QT_BLITTER_RASTEROVERLAY + QImage *m_rasterOverlay; + QImage *m_unmergedCopy; + QColor m_overlayColor; + + void markRasterOverlayImpl(const QRectF &); + void unmarkRasterOverlayImpl(const QRectF &); + QRectF clipAndTransformRect(const QRectF &) const; +#endif //QT_BLITTER_RASTEROVERLAY + }; +inline void QBlittablePixmapData::markRasterOverlay(const QRectF &rect) +{ +#ifdef QT_BLITTER_RASTEROVERLAY + markRasterOverlayImpl(rect); +#else + Q_UNUSED(rect) +#endif +} + +inline void QBlittablePixmapData::markRasterOverlay(const QVectorPath &path) +{ +#ifdef QT_BLITTER_RASTEROVERLAY + markRasterOverlayImpl(path.convertToPainterPath().boundingRect()); +#else + Q_UNUSED(path) +#endif +} + +inline void QBlittablePixmapData::markRasterOverlay(const QPointF &pos, const QTextItem &ti) +{ +#ifdef QT_BLITTER_RASTEROVERLAY + QFontMetricsF fm(ti.font()); + QRectF rect = fm.tightBoundingRect(ti.text()); + rect.moveBottomLeft(pos); + markRasterOverlay(rect); +#else + Q_UNUSED(pos) + Q_UNUSED(ti) +#endif +} + +inline void QBlittablePixmapData::markRasterOverlay(const QRect *rects, int rectCount) +{ +#ifdef QT_BLITTER_RASTEROVERLAY + for (int i = 0; i < rectCount; i++) { + markRasterOverlay(rects[i]); + } +#else + Q_UNUSED(rects) + Q_UNUSED(rectCount) +#endif +} +inline void QBlittablePixmapData::markRasterOverlay(const QRectF *rects, int rectCount) +{ +#ifdef QT_BLITTER_RASTEROVERLAY + for (int i = 0; i < rectCount; i++) { + markRasterOverlay(rects[i]); + } +#else + Q_UNUSED(rects) + Q_UNUSED(rectCount) +#endif +} + +inline void QBlittablePixmapData::unmarkRasterOverlay(const QRectF &rect) +{ +#ifdef QT_BLITTER_RASTEROVERLAY + unmarkRasterOverlayImpl(rect); +#else + Q_UNUSED(rect) +#endif +} + #endif // QPIXMAP_BLITTER_P_H diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index 1a1d5e0..0e7c96a 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -19,12 +19,6 @@ #define STATE_CLIPSYS_COMPLEX 0x00010000 #define STATE_CLIP_COMPLEX 0x00020000 -//#define RASTEROVERLAY - -#ifdef RASTEROVERLAY -QColor rasterColor(255,0,0,100); -QBrush rasterBrush(rasterColor); -#endif static inline void updateStateBits(uint *state, uint mask, bool on) { @@ -107,9 +101,10 @@ public: updateStateBits(&fillRectMask, STATE_BRUSH_PATTERN, false); updateStateBits(&fillRectMask, STATE_BRUSH_ALPHA, false); - updateStateBits(&fillRectMask, STATE_PEN_ENABLED, false); + updateStateBits(&fillRectMask, STATE_PEN_ENABLED, true); - updateStateBits(&fillRectMask, STATE_ANTIALIASING, false); + //Sub-pixel aliasing should not be sent to the blitter + updateStateBits(&fillRectMask, STATE_ANTIALIASING, true); updateStateBits(&fillRectMask, STATE_ALPHA, false); updateStateBits(&fillRectMask, STATE_BLENDING_COMPLEX, false); @@ -152,30 +147,31 @@ class QBlitterPaintEnginePrivate : public QPaintEngineExPrivate public: QBlitterPaintEnginePrivate(QBlittablePixmapData *p) : QPaintEngineExPrivate(), + pmData(p), isBlitterLocked(false), hasXForm(false) { - blitter= p->blittable(); raster = new QRasterPaintEngine(p->buffer()); - capabillities = new CapabilitiesToStateMask(blitter->capabilities()); + capabillities = new CapabilitiesToStateMask(pmData->blittable()->capabilities()); } inline void lock() { if (!isBlitterLocked) { - raster->d_func()->rasterBuffer->prepare(blitter->lock()); + raster->d_func()->rasterBuffer->prepare(pmData->blittable()->lock()); isBlitterLocked = true; } } inline void unlock() { if (isBlitterLocked) { - blitter->unlock(); + pmData->blittable()->unlock(); isBlitterLocked = false; } } void fillRect(const QRectF &rect, const QColor &color) { + pmData->unmarkRasterOverlay(rect); QRectF targetRect = rect; if (hasXForm) { targetRect = state->matrix.mapRect(rect); @@ -184,14 +180,14 @@ public: if (clipData) { if (clipData->hasRectClip) { unlock(); - blitter->fillRect(targetRect & clipData->clipRect, color); + pmData->blittable()->fillRect(targetRect & clipData->clipRect, color); } else if (clipData->hasRegionClip) { QVector rects = clipData->clipRegion.rects(); for ( int i = 0; i < rects.size(); i++ ) { QRect intersectRect = rects.at(i).intersected(targetRect.toRect()); if (!intersectRect.isEmpty()) { unlock(); - blitter->fillRect(intersectRect,color); + pmData->blittable()->fillRect(intersectRect,color); } } } @@ -200,11 +196,11 @@ public: && targetRect.width() <= raster->paintDevice()->width() && targetRect.height() <= raster->paintDevice()->height()) { unlock(); - blitter->fillRect(targetRect,color); + pmData->blittable()->fillRect(targetRect,color); } else { QRectF deviceRect(0,0,raster->paintDevice()->width(), raster->paintDevice()->height()); unlock(); - blitter->fillRect(deviceRect&targetRect,color); + pmData->blittable()->fillRect(deviceRect&targetRect,color); } } } @@ -222,7 +218,8 @@ public: qreal deltaRight = target.right() - intersectedRect.right(); source.adjust(-deltaLeft,-deltaTop,deltaRight,deltaBottom); } - blitter->drawPixmap(intersectedRect, pm, source); + pmData->unmarkRasterOverlay(intersectedRect); + pmData->blittable()->drawPixmap(intersectedRect, pm, source); } void updateClip() { @@ -235,11 +232,10 @@ public: raster->d_func()->systemStateChanged(); } - QPixmap pixmap; QRasterPaintEngine *raster; QRasterPaintEngineState *state; - QBlittable *blitter; + QBlittablePixmapData *pmData; bool isBlitterLocked; CapabilitiesToStateMask *capabillities; @@ -268,8 +264,11 @@ bool QBlitterPaintEngine::begin(QPaintDevice *pdev) d->raster->setSystemRect(systemRect()); d->raster->setSystemClip(systemClip()); - + setActive(true); bool ok = d->raster->begin(pdev); +#ifdef QT_BLITTER_RASTEROVERLAY + d->pmData->unmergeOverlay(); +#endif return ok; } @@ -280,6 +279,10 @@ bool QBlitterPaintEngine::end() d->raster->setPaintDevice(0); d->raster->setActive(false); + setActive(false); +#ifdef QT_BLITTER_RASTEROVERLAY + d->pmData->mergeOverlay(); +#endif return d->raster->end(); } @@ -287,16 +290,13 @@ bool QBlitterPaintEngine::end() void QBlitterPaintEngine::fill(const QVectorPath &path, const QBrush &brush) { Q_D(QBlitterPaintEngine); - if (path.shape() == QVectorPath::RectangleHint) { QRectF rect(((QPointF *) path.points())[0], ((QPointF *) path.points())[2]); fillRect(rect, brush); } else { d->lock(); + d->pmData->markRasterOverlay(path); d->raster->fill(path, brush); -#ifdef RASTEROVERLAY - d->raster->fill(path,rasterBrush); -#endif } } @@ -307,10 +307,8 @@ void QBlitterPaintEngine::fillRect(const QRectF &rect, const QColor &color) d->fillRect(rect, color); } else { d->lock(); + d->pmData->markRasterOverlay(rect); d->raster->fillRect(rect, color); -#ifdef RASTEROVERLAY - d->raster->fillRect(rect,rasterColor); -#endif } } @@ -354,7 +352,7 @@ void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) int tmpSrcX = srcX + (targetRect.x() - x); int tmpSrcY = srcY + (targetRect.y() - y); QRect srcRect(tmpSrcX,tmpSrcY,targetRect.width(),targetRect.height()); - d->blitter->drawPixmap(targetRect,pm,srcRect); + d->pmData->blittable()->drawPixmap(targetRect,pm,srcRect); } } else if (clipData->hasRegionClip) { QVector clipRects = clipData->clipRegion.rects(); @@ -368,9 +366,9 @@ void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) int tmpSrcX = srcX + (targetRect.x() - x); int tmpSrcY = srcY + (targetRect.y() - y); QRect srcRect(tmpSrcX,tmpSrcY,targetRect.width(),targetRect.height()); - d->blitter->drawPixmap(targetRect,pm,srcRect); + d->pmData->blittable()->drawPixmap(targetRect,pm,srcRect); } - } else Q_ASSERT(false);//should never happen + } x+=blitWidth; if (x>=transformedRect.right()) { x = transformedRect.x(); @@ -382,13 +380,10 @@ void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) } else srcX = 0; } - } else { d->lock(); + d->pmData->markRasterOverlay(rect); d->raster->fillRect(rect, brush); -#ifdef RASTEROVERLAY - d->raster->fillRect(rect,rasterBrush); -#endif } } @@ -397,10 +392,8 @@ void QBlitterPaintEngine::stroke(const QVectorPath &path, const QPen &pen) { Q_D(QBlitterPaintEngine); d->lock(); + d->pmData->markRasterOverlay(path.convertToPainterPath().boundingRect()); d->raster->stroke(path, pen); -#ifdef RASTEROVERLAY - d->raster->stroke(path,QPen(rasterColor)); -#endif } void QBlitterPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) @@ -509,10 +502,8 @@ void QBlitterPaintEngine::drawRects(const QRect *rects, int rectCount) d->fillRect(rects[i], qbrush_color(d->state->brush)); } } else { + d->pmData->markRasterOverlay(rects,rectCount); QPaintEngineEx::drawRects(rects, rectCount); -#ifdef RASTEROVERLAY - d->raster->drawRects(rects,rectCount); -#endif } } @@ -524,10 +515,8 @@ void QBlitterPaintEngine::drawRects(const QRectF *rects, int rectCount) d->fillRect(rects[i], qbrush_color(d->state->brush)); } } else { + d->pmData->markRasterOverlay(rects,rectCount); QPaintEngineEx::drawRects(rects, rectCount); -#ifdef RASTEROVERLAY - d->raster->drawRects(rects,rectCount); -#endif } } @@ -557,10 +546,8 @@ void QBlitterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const Q } }else { d->lock(); + d->pmData->markRasterOverlay(r); d->raster->drawPixmap(r, pm, sr); -#ifdef RASTEROVERLAY - d->raster->fillRect(r,rasterColor); -#endif } } @@ -569,10 +556,8 @@ void QBlitterPaintEngine::drawImage(const QRectF &r, const QImage &pm, const QRe { Q_D(QBlitterPaintEngine); d->lock(); + d->pmData->markRasterOverlay(r); d->raster->drawImage(r, pm, sr, flags); -#ifdef RASTEROVERLAY - d->raster->fillRect(r,rasterColor); -#endif } @@ -581,18 +566,14 @@ void QBlitterPaintEngine::drawTextItem(const QPointF &pos, const QTextItem &ti) Q_D(QBlitterPaintEngine); d->lock(); d->raster->drawTextItem(pos, ti); -#ifdef RASTEROVERLAY - QFontMetricsF fm(ti.font()); - QRectF rect = fm.tightBoundingRect(ti.text()); - rect.moveBottomLeft(pos); - d->raster->fillRect(rect, rasterColor); -#endif + d->pmData->markRasterOverlay(pos,ti); } void QBlitterPaintEngine::drawEllipse(const QRectF &r) { Q_D(QBlitterPaintEngine); d->lock(); + d->pmData->markRasterOverlay(r); d->raster->drawEllipse(r); } @@ -616,6 +597,12 @@ void QBlitterPaintEngine::setState(QPainterState *s) d->updateClip(); } +inline QRasterPaintEngine *QBlitterPaintEngine::raster() const +{ + Q_D(const QBlitterPaintEngine); + return d->raster; +} + class QBlittablePrivate { public: diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h index cebaf21..2d9add9 100644 --- a/src/gui/painting/qpaintengine_blitter_p.h +++ b/src/gui/painting/qpaintengine_blitter_p.h @@ -2,8 +2,8 @@ #define QPAINTENGINE_BLITTER_P_H #include "private/qpaintengineex_p.h" +#include "private/qpaintengine_raster_p.h" -class QRasterPaintEngine; class QBlittablePrivate; class QBlitterPaintEnginePrivate; class QBlittablePixmapData; @@ -89,8 +89,12 @@ public: virtual void setState(QPainterState *s); - inline QPainterState *state() { return static_cast(QPaintEngine::state); } - inline const QPainterState *state() const { return static_cast(QPaintEngine::state); } + inline QPainterState *state() { return raster()->state(); } + inline const QPainterState *state() const { const QPainterState *state = raster()->state(); return state;} + inline const QClipData *clip(){return raster()->d_func()->clip();} + +private: + QRasterPaintEngine *raster() const; }; -- cgit v0.12 From b34f8552e08639cbaa8a3ce4551ae3b738764d25 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Tue, 9 Feb 2010 14:46:42 +0100 Subject: winId() for vnc and linuxfb --- src/plugins/graphicssystems/fb_base/fb_base.cpp | 3 +++ src/plugins/graphicssystems/fb_base/fb_base.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/plugins/graphicssystems/fb_base/fb_base.cpp b/src/plugins/graphicssystems/fb_base/fb_base.cpp index bd8d407..eeaa220 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.cpp +++ b/src/plugins/graphicssystems/fb_base/fb_base.cpp @@ -221,7 +221,10 @@ QGraphicsSystemFbWindowSurface::QGraphicsSystemFbWindowSurface(QGraphicsSystemFb mScreen(screen), visibleFlag(false) { + static QAtomicInt winIdGenerator(1); + mImage = QImage(window->size(), mScreen->format()); + windowId = winIdGenerator.fetchAndAddRelaxed(1); } QGraphicsSystemFbWindowSurface::~QGraphicsSystemFbWindowSurface() diff --git a/src/plugins/graphicssystems/fb_base/fb_base.h b/src/plugins/graphicssystems/fb_base/fb_base.h index f21cd41..c46a99d 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.h +++ b/src/plugins/graphicssystems/fb_base/fb_base.h @@ -64,12 +64,15 @@ public: virtual Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); virtual Qt::WindowFlags windowFlags() const; + WId winId() const { return windowId; } protected: QGraphicsSystemFbScreen *mScreen; QRect oldGeometry; QImage mImage; bool visibleFlag; Qt::WindowFlags flags; + + WId windowId; }; class QGraphicsSystemFbScreen : public QGraphicsSystemScreen -- cgit v0.12 From 5fbf7ba9657527a0cc5d732fa90ce4055ddb5eb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 9 Feb 2010 16:23:36 +0100 Subject: Fix release build-error in qpaintengine_blitter.cpp --- src/gui/painting/qpaintengine_blitter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index 0e7c96a..04d3d5a 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -392,7 +392,7 @@ void QBlitterPaintEngine::stroke(const QVectorPath &path, const QPen &pen) { Q_D(QBlitterPaintEngine); d->lock(); - d->pmData->markRasterOverlay(path.convertToPainterPath().boundingRect()); + d->pmData->markRasterOverlay(path); d->raster->stroke(path, pen); } -- cgit v0.12 From 5e2b09a3dfd09e6bd85754e181a0b9026145a9d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 9 Feb 2010 17:24:50 +0100 Subject: Minimaldfb: fixed include error --- src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp index cfe1807..c3b5522 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp @@ -7,7 +7,7 @@ #include #include -#include +#include InputSocketWaiter::InputSocketWaiter(IDirectFBEventBuffer *eventBuffer, QObject *parent) : QThread(parent), m_eventBuffer(eventBuffer),m_shouldStop(false) -- cgit v0.12 From e2ea7ff8e1e7795a34981c17daa5bcff90786653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 10 Feb 2010 10:46:13 +0100 Subject: Added basic fps calculation in qbackingstore --- src/gui/painting/qbackingstore.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index e1f47b5..cb0ff55 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -98,6 +98,21 @@ static inline void qt_flush(QWidget *widget, const QRegion ®ion, QWindowSurfa QWidgetBackingStore::showYellowThing(widget, region, flushUpdate * 10, false); #endif + //The performance hit by doing this should be negligible. However, be aware that + //using this FPS when you have > 1 windowsurface can give you inaccurate FPS + static bool fpsDebug = qgetenv("QT_DEBUG_FPS").toInt(); + if (fpsDebug) { + static QTime time = QTime::currentTime(); + static int frames = 0; + + frames++; + + if(time.elapsed() > 5000) { + double fps = double(frames * 1000) /time.restart(); + fprintf(stderr,"FPS: %.1f\n",fps); + frames = 0; + } + } if (widget != tlw) windowSurface->flush(widget, region, tlwOffset + widget->mapTo(tlw, QPoint())); else -- cgit v0.12 From 175605f736ce76a9c0296aa607a6a82ea6675542 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 8 Feb 2010 12:56:46 +0100 Subject: Don't resize back buffer for every window resize; only do it when we're painting --- .../testlite/qwindowsurface_testlite.cpp | 3 ++- src/plugins/graphicssystems/testlite/x11util.cpp | 22 ++++++++++++++-------- src/plugins/graphicssystems/testlite/x11util.h | 2 ++ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp index d50a59e..e159106 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp @@ -86,7 +86,6 @@ void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const // qDebug() << "QTestLiteWindowSurface::flush:" << (long)this; - xw->painted = true; //there is content in the buffer xw->paintEvent(); } @@ -169,11 +168,13 @@ bool QTestLiteWindowSurface::scroll(const QRegion &area, int dx, int dy) void QTestLiteWindowSurface::beginPaint(const QRegion ®ion) { Q_UNUSED(region); + xw->resizeBuffer(geometry().size()); } void QTestLiteWindowSurface::endPaint(const QRegion ®ion) { Q_UNUSED(region); + xw->painted = true; //there is content in the buffer } diff --git a/src/plugins/graphicssystems/testlite/x11util.cpp b/src/plugins/graphicssystems/testlite/x11util.cpp index 20d4241..6d2966f 100644 --- a/src/plugins/graphicssystems/testlite/x11util.cpp +++ b/src/plugins/graphicssystems/testlite/x11util.cpp @@ -599,11 +599,23 @@ void MyWindow::resizeShmImage(int width, int height) Q_ASSERT(shm_attach_status == True); shm_img = QImage( (uchar*) image->data, image->width, image->height, image->bytes_per_line, QImage::Format_RGB32 ); - - painted = false; #endif + painted = false; +} + + +void MyWindow::resizeBuffer(QSize s) +{ + if (shm_img.size() != s) + resizeShmImage(s.width(), s.height()); } +QSize MyWindow::bufferSize() const +{ + return shm_img.size(); +} + + void MyWindow::resizeEvent(XConfigureEvent *e) { @@ -620,8 +632,6 @@ void MyWindow::resizeEvent(XConfigureEvent *e) #ifdef MYX11_DEBUG qDebug() << hex << window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << "geometry" << xpos << ypos << width << height << "img:" << shm_img.size(); #endif - if (shm_img.size() != QSize(width, height)) - resizeShmImage(width, height); windowSurface->handleGeometryChange(xpos, ypos, width, height); } @@ -639,10 +649,6 @@ void MyWindow::setGeometry(int x, int y, int w, int h) qDebug() << "MyWindow::setGeometry" << hex << window << dec << x << y << w << h << "img:" << shm_img.size(); #endif XMoveResizeWindow(xd->display, window, x, y, w, h); - - if (shm_img.size() != QSize(w, h)) { - resizeShmImage(w, h); - } } diff --git a/src/plugins/graphicssystems/testlite/x11util.h b/src/plugins/graphicssystems/testlite/x11util.h index 184c1ca..79e7461 100644 --- a/src/plugins/graphicssystems/testlite/x11util.h +++ b/src/plugins/graphicssystems/testlite/x11util.h @@ -137,6 +137,8 @@ public: //### int currentCursor; bool painted; + void resizeBuffer(QSize); + QSize bufferSize() const; private: void resizeShmImage(int width, int height); -- cgit v0.12 From 5dcacb00fd68e6cc2bf3e6a467b603f387cb1a60 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 10 Feb 2010 16:31:13 +0100 Subject: Move user event handling into QWindowSystemInterface class This currently includes mouse, wheel, keyboard, enter, leave, geometry, and close events. Windowing system plugins should limit themselves to the QWindowSystemInterface::handle*Event() methods, as the other methods will likely become private. --- src/gui/embedded/qkbd_qws.cpp | 4 +- src/gui/kernel/kernel.pri | 6 +- src/gui/kernel/qapplication_lite.cpp | 71 +++--------- src/gui/kernel/qapplication_p.h | 104 +++-------------- src/gui/kernel/qeventdispatcher_glib_lite.cpp | 8 +- src/gui/kernel/qeventdispatcher_lite.cpp | 9 +- src/gui/kernel/qwindowsysteminterface.cpp | 112 ++++++++++++++++++ src/gui/kernel/qwindowsysteminterface.h | 129 +++++++++++++++++++++ src/plugins/generic/linuxinput/qlinuxinput.cpp | 10 +- src/plugins/graphicssystems/fb_base/fb_base.cpp | 4 +- .../graphicssystems/minimaldfb/qdirectfbinput.cpp | 42 ++----- .../testlite/qwindowsurface_testlite.cpp | 18 +-- src/plugins/graphicssystems/vnc/qvncserver.cpp | 8 +- 13 files changed, 318 insertions(+), 207 deletions(-) create mode 100644 src/gui/kernel/qwindowsysteminterface.cpp create mode 100644 src/gui/kernel/qwindowsysteminterface.h diff --git a/src/gui/embedded/qkbd_qws.cpp b/src/gui/embedded/qkbd_qws.cpp index 97fb7a0..c4dd6bd 100644 --- a/src/gui/embedded/qkbd_qws.cpp +++ b/src/gui/embedded/qkbd_qws.cpp @@ -54,7 +54,7 @@ #endif #ifdef Q_WS_LITE -#include +#include #include #endif @@ -367,7 +367,7 @@ void QWSKeyboardHandler::processKeyEvent(int unicode, int keycode, Qt::KeyboardM QString str; if (unicode != 0xffff) str = QString(unicode); - QApplicationPrivate::handleKeyEvent(0, type, keycode, modifiers, str); + QWindowSystemInterface::handleKeyEvent(0, type, keycode, modifiers, str); #endif } diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index c32b84f..51167d4 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -201,7 +201,8 @@ embedded_lite { HEADERS += \ kernel/qgenericpluginfactory_lite.h \ kernel/qgenericplugin_lite.h \ - kernel/qeventdispatcher_lite_p.h + kernel/qeventdispatcher_lite_p.h \ + kernel/qwindowsysteminterface.h \ SOURCES += \ kernel/qapplication_lite.cpp \ @@ -214,7 +215,8 @@ embedded_lite { kernel/qkeymapper_qws.cpp \ kernel/qsound_lite.cpp \ kernel/qwidget_lite.cpp \ - kernel/qeventdispatcher_lite.cpp + kernel/qeventdispatcher_lite.cpp \ + kernel/qwindowsysteminterface.cpp contains(QT_CONFIG, glib) { SOURCES += \ diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 39cc29f..6142e15 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -59,9 +59,11 @@ #include "private/qgraphicssystem_p.h" #include "qgraphicssystemcursor.h" #include +#include QT_BEGIN_NAMESPACE +QList userEventQueue; static QString appName; static const char *appFont = 0; // application font @@ -75,7 +77,6 @@ int qt_last_x = 0; int qt_last_y = 0; QPointer qt_last_mouse_receiver = 0; -QList QApplicationPrivate::userEventQueue; static Qt::KeyboardModifiers modifiers = Qt::NoModifier; static Qt::MouseButtons buttons = Qt::NoButton; static ulong mousePressTime; @@ -83,23 +84,22 @@ static Qt::MouseButton mousePressButton = Qt::NoButton; static int mousePressX; static int mousePressY; static int mouse_double_click_distance = 5; -QTime QApplicationPrivate::time; -void QApplicationPrivate::processUserEvent(UserEvent *e) +void QApplicationPrivate::processUserEvent(QWindowSystemInterface::UserEvent *e) { switch(e->type) { case QEvent::MouseButtonDblClick: // if mouse event, calculate appropriate widget and local coordinates case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: case QEvent::MouseMove: - QApplicationPrivate::processMouseEvent(static_cast(e)); + QApplicationPrivate::processMouseEvent(static_cast(e)); break; case QEvent::Wheel: - QApplicationPrivate::processWheelEvent(static_cast(e)); + QApplicationPrivate::processWheelEvent(static_cast(e)); break; case QEvent::KeyPress: case QEvent::KeyRelease: - QApplicationPrivate::processKeyEvent(static_cast(e)); + QApplicationPrivate::processKeyEvent(static_cast(e)); break; default: qWarning() << "Unknown user input event type:" << e->type; @@ -524,35 +524,7 @@ void QApplication::setMainWidget(QWidget *mainWidget) } #endif - -//------------------------------------------------------------ -// -// Callback functions for plugins: -// - -/*! - -\a tlw == 0 means that \a ev is in global coords only - - -*/ - - -void QApplicationPrivate::handleEnterEvent(QWidget *tlw) -{ - dispatchEnterLeave(tlw, 0); - qt_last_mouse_receiver = tlw; -} - -void QApplicationPrivate::handleLeaveEvent(QWidget *tlw) -{ - dispatchEnterLeave(0, qt_last_mouse_receiver); - if (!tlw->isAncestorOf(qt_last_mouse_receiver)) //(???) this should not happen - dispatchEnterLeave(0, tlw); - qt_last_mouse_receiver = 0; -} - -void QApplicationPrivate::processMouseEvent(MouseEvent *e) +void QApplicationPrivate::processMouseEvent(QWindowSystemInterface::MouseEvent *e) { // qDebug() << "handleMouseEvent" << tlw << ev.pos() << ev.globalPos() << hex << ev.buttons(); static QWeakPointer implicit_mouse_grabber; @@ -561,16 +533,12 @@ void QApplicationPrivate::processMouseEvent(MouseEvent *e) // move first Qt::MouseButtons stateChange = e->buttons ^ buttons; if (e->globalPos != QPoint(qt_last_x, qt_last_y) && (stateChange != Qt::NoButton)) { - MouseEvent * newMouseEvent = new MouseEvent(e->id, e->timestamp, e->localPos, e->globalPos, e->buttons); + QWindowSystemInterface::MouseEvent * newMouseEvent = new QWindowSystemInterface::MouseEvent(e->widget.data(), e->timestamp, e->localPos, e->globalPos, e->buttons); userEventQueue.prepend(newMouseEvent); // just in case the move triggers a new event loop stateChange = Qt::NoButton; } - QWidget * tlw; - if (e->id) - tlw = QWidget::find(e->id); - else - tlw = 0; + QWidget * tlw = e->widget.data(); QPoint localPoint = e->localPos; QPoint globalPoint = e->globalPos; @@ -701,7 +669,7 @@ void QApplicationPrivate::processMouseEvent(MouseEvent *e) //### there's a lot of duplicated logic here -- refactoring required! -void QApplicationPrivate::processWheelEvent(WheelEvent *e) +void QApplicationPrivate::processWheelEvent(QWindowSystemInterface::WheelEvent *e) { // QPoint localPoint = ev.pos(); QPoint globalPoint = e->globalPos; @@ -711,11 +679,7 @@ void QApplicationPrivate::processWheelEvent(WheelEvent *e) qt_last_x = globalPoint.x(); qt_last_y = globalPoint.y(); - QWidget *mouseWindow; - if (e->id) - mouseWindow = QWidget::find(e->id); - else - mouseWindow = 0; + QWidget *mouseWindow = e->widget.data(); // find the tlw if we didn't get it from the plugin if (!mouseWindow) { @@ -747,7 +711,7 @@ void QApplicationPrivate::processWheelEvent(WheelEvent *e) // Remember, Qt convention is: keyboard state is state *before* -void QApplicationPrivate::processKeyEvent(KeyEvent *e) +void QApplicationPrivate::processKeyEvent(QWindowSystemInterface::KeyEvent *e) { QWidget *focusW = 0; if (self->inPopupMode()) { @@ -756,8 +720,8 @@ void QApplicationPrivate::processKeyEvent(KeyEvent *e) } if (!focusW) focusW = QApplication::focusWidget(); - if (!focusW && e->id) { - focusW = QWidget::find(e->id); + if (!focusW) { + focusW = e->widget.data(); } if (!focusW) focusW = QApplication::activeWindow(); @@ -774,8 +738,7 @@ void QApplicationPrivate::processKeyEvent(KeyEvent *e) QApplication::sendSpontaneousEvent(focusW, &ev); } - -void QApplicationPrivate::handleGeometryChange(QWidget *tlw, const QRect &newRect) +void QApplicationPrivate::processGeometryChange(QWidget *tlw, const QRect &newRect) { QRect cr(tlw->geometry()); @@ -794,11 +757,9 @@ void QApplicationPrivate::handleGeometryChange(QWidget *tlw, const QRect &newRec } } - -void QApplicationPrivate::handleCloseEvent(QWidget *tlw) +void QApplicationPrivate::processCloseEvent(QWidget *tlw) { tlw->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent); } - QT_END_NAMESPACE diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index f6e91f7..273e9ea 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -76,6 +76,9 @@ #ifdef Q_OS_SYMBIAN #include #endif +#ifdef Q_WS_LITE +#include +#endif QT_BEGIN_NAMESPACE @@ -462,6 +465,18 @@ public: static bool qt_mac_apply_settings(); #endif +#ifdef Q_WS_LITE + static void processMouseEvent(QWindowSystemInterface::MouseEvent *e); + static void processKeyEvent(QWindowSystemInterface::KeyEvent *e); + static void processWheelEvent(QWindowSystemInterface::WheelEvent *e); + + static void processCloseEvent(QWidget *tlw); + static void processGeometryChange(QWidget *tlw, const QRect &newRect); + + static void processUserEvent(QWindowSystemInterface::UserEvent *e); + +#endif + #ifdef Q_WS_QWS QPointer last_manager; QWSServerCleaner qwsServerCleaner; @@ -565,91 +580,6 @@ public: void _q_readRX71MultiTouchEvents(); #endif -#ifdef Q_WS_LITE - static QTime time; - - class UserEvent { - public: - UserEvent(WId w, ulong time, QEvent::Type t) { id = w; type = t; timestamp = time; } - WId id; - QEvent::Type type; - unsigned long timestamp; - }; - - class MouseEvent : public UserEvent { - public: - MouseEvent(WId w, ulong time, const QPoint & local, const QPoint & global, Qt::MouseButtons b) - : UserEvent(w, time, QEvent::MouseMove){ localPos = local; globalPos = global; buttons = b; } - QPoint localPos; - QPoint globalPos; - Qt::MouseButtons buttons; - }; - - class WheelEvent : public UserEvent { - public: - WheelEvent(WId w, ulong time, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) - : UserEvent(w, time, QEvent::Wheel) { localPos = local; globalPos = global; delta = d; orient = o; } - int delta; - QPoint localPos; - QPoint globalPos; - Qt::Orientation orient; - }; - - class KeyEvent : public UserEvent { - public: - KeyEvent(WId w, ulong time, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) - :UserEvent(w, time, t){ key = k; unicode = text; repeat = autorep; repeatCount = count; modifiers = mods; } - int key; - QString unicode; - bool repeat; - ushort repeatCount; - Qt::KeyboardModifiers modifiers; - }; - - static void handleMouseEvent(WId w, const QPoint & local, const QPoint & global, Qt::MouseButtons b) { - handleMouseEvent(w, time.elapsed(), local, global, b); - } - - static void handleMouseEvent(WId w, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b) { - MouseEvent * e = new MouseEvent(w, timestamp, local, global, b); - queueUserEvent(e); - } - - static void handleKeyEvent(WId w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) { - handleKeyEvent(w, time.elapsed(), t, k, mods, text, autorep, count); - } - - static void handleKeyEvent(WId w, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) { - KeyEvent * e = new KeyEvent(w, timestamp, t, k, mods, text, autorep, count); - queueUserEvent(e); - } - - static void handleWheelEvent(WId w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) { - handleWheelEvent(w, time.elapsed(), local, global, d, o); - } - - static void handleWheelEvent(WId w, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) { - WheelEvent *e = new WheelEvent(w, timestamp, local, global, d, o); - queueUserEvent(e); - } - - static void queueUserEvent(UserEvent *ev) { userEventQueue.append(ev); } - static void processUserEvent(UserEvent *e); - static int userEventsQueued() { return userEventQueue.count(); } - static UserEvent * getUserEvent() { return userEventQueue.takeFirst(); } - - // could be private, should only be used by deliverUserEvents() - static void processMouseEvent(MouseEvent *e); - static void processKeyEvent(KeyEvent *e); - static void processWheelEvent(WheelEvent *e); - - // delivered directly by the plugin via spontaneous events - static void handleGeometryChange(QWidget *tlw, const QRect &newRect); - static void handleCloseEvent(QWidget *tlw); - static void handleEnterEvent(QWidget *tlw); - static void handleLeaveEvent(QWidget *tlw); -#endif - #if defined(Q_WS_S60) int maxTouchPressure; QList appAllTouchPoints; @@ -664,10 +594,6 @@ private: static QHash scanCodeCache; #endif -#ifdef Q_WS_LITE - static QList userEventQueue; -#endif - static QApplicationPrivate *self; static void giveFocusAccordingToFocusPolicy(QWidget *w, diff --git a/src/gui/kernel/qeventdispatcher_glib_lite.cpp b/src/gui/kernel/qeventdispatcher_glib_lite.cpp index 6d80823..757bb00 100644 --- a/src/gui/kernel/qeventdispatcher_glib_lite.cpp +++ b/src/gui/kernel/qeventdispatcher_glib_lite.cpp @@ -64,7 +64,7 @@ static gboolean userEventSourcePrepare(GSource *s, gint *timeout) Q_UNUSED(s) Q_UNUSED(timeout) - return QApplicationPrivate::userEventsQueued() > 0; + return QWindowSystemInterface::userEventsQueued() > 0; } static gboolean userEventSourceCheck(GSource *source) @@ -76,9 +76,9 @@ static gboolean userEventSourceDispatch(GSource *s, GSourceFunc, gpointer) { GUserEventSource * source = reinterpret_cast(s); - QApplicationPrivate::UserEvent * event; - while (QApplicationPrivate::userEventsQueued()) { - event = QApplicationPrivate::getUserEvent(); + QWindowSystemInterface::UserEvent * event; + while (QWindowSystemInterface::userEventsQueued()) { + event = QWindowSystemInterface::getUserEvent(); // send through event filter if (source->q->filterEvent(event)) { diff --git a/src/gui/kernel/qeventdispatcher_lite.cpp b/src/gui/kernel/qeventdispatcher_lite.cpp index 39eef96..bd177cb 100644 --- a/src/gui/kernel/qeventdispatcher_lite.cpp +++ b/src/gui/kernel/qeventdispatcher_lite.cpp @@ -47,6 +47,7 @@ #ifndef QT_NO_THREAD # include "qmutex.h" #endif +#include #include QT_BEGIN_NAMESPACE @@ -83,11 +84,11 @@ bool QEventDispatcherLite::processEvents(QEventLoop::ProcessEventsFlags flags) QApplication::sendPostedEvents(); while (!d->interrupt) { // also flushes output buffer ###can be optimized - QApplicationPrivate::UserEvent *event; + QWindowSystemInterface::UserEvent *event; if (!(flags & QEventLoop::ExcludeUserInputEvents) - && QApplicationPrivate::userEventsQueued() > 0) { + && QWindowSystemInterface::userEventsQueued() > 0) { // process a pending user input event - event = QApplicationPrivate::getUserEvent(); + event = QWindowSystemInterface::getUserEvent(); } else { break; } @@ -112,7 +113,7 @@ bool QEventDispatcherLite::processEvents(QEventLoop::ProcessEventsFlags flags) bool QEventDispatcherLite::hasPendingEvents() { extern uint qGlobalPostedEventsCount(); // from qapplication.cpp - return qGlobalPostedEventsCount() || QApplicationPrivate::userEventsQueued();; + return qGlobalPostedEventsCount() || QWindowSystemInterface::userEventsQueued();; } void QEventDispatcherLite::startingUp() diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp new file mode 100644 index 0000000..e051533 --- /dev/null +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "qwindowsysteminterface.h" +#include "qapplication_p.h" + +QT_BEGIN_NAMESPACE + + +QTime QWindowSystemInterface::eventTime; + +//------------------------------------------------------------ +// +// Callback functions for plugins: +// + +QList QWindowSystemInterface::userEventQueue; + +extern QPointer qt_last_mouse_receiver; +/*! + +\a tlw == 0 means that \a ev is in global coords only + + +*/ + + +void QWindowSystemInterface::handleEnterEvent(QWidget *tlw) +{ + if (tlw) { + QApplicationPrivate::dispatchEnterLeave(tlw, 0); + qt_last_mouse_receiver = tlw; + } +} + +void QWindowSystemInterface::handleLeaveEvent(QWidget *tlw) +{ + QApplicationPrivate::dispatchEnterLeave(0, qt_last_mouse_receiver); + if (tlw && !tlw->isAncestorOf(qt_last_mouse_receiver)) //(???) this should not happen + QApplicationPrivate::dispatchEnterLeave(0, tlw); + qt_last_mouse_receiver = 0; +} + +void QWindowSystemInterface::handleGeometryChange(QWidget *tlw, const QRect &newRect) +{ + if (tlw) + QApplicationPrivate::processGeometryChange(tlw, newRect); +} + + +void QWindowSystemInterface::handleCloseEvent(QWidget *tlw) +{ + if (tlw) + QApplicationPrivate::processCloseEvent(tlw); +} + +void QWindowSystemInterface::handleMouseEvent(QWidget *tlw, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b) +{ + MouseEvent * e = new MouseEvent(tlw, timestamp, local, global, b); + queueUserEvent(e); +} + +void QWindowSystemInterface::handleKeyEvent(QWidget *tlw, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count) +{ + KeyEvent * e = new KeyEvent(tlw, timestamp, t, k, mods, text, autorep, count); + queueUserEvent(e); +} + +void QWindowSystemInterface::handleWheelEvent(QWidget *tlw, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) +{ + WheelEvent *e = new WheelEvent(tlw, timestamp, local, global, d, o); + queueUserEvent(e); +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h new file mode 100644 index 0000000..caeacd3 --- /dev/null +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QWINDOWSYSTEMINTERFACE_H +#define QWINDOWSYSTEMINTERFACE_H + +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE +class Q_GUI_EXPORT QWindowSystemInterface +{ +public: + class UserEvent { + public: + UserEvent(QWidget * w, ulong time, QEvent::Type t) + { widget = QWeakPointer::QWeakPointer(w); type = t; timestamp = time; } + QWeakPointer widget; + QEvent::Type type; + unsigned long timestamp; + }; + + class MouseEvent : public UserEvent { + public: + MouseEvent(QWidget * w, ulong time, const QPoint & local, const QPoint & global, Qt::MouseButtons b) + : UserEvent(w, time, QEvent::MouseMove){ localPos = local; globalPos = global; buttons = b; } + QPoint localPos; + QPoint globalPos; + Qt::MouseButtons buttons; + }; + + class WheelEvent : public UserEvent { + public: + WheelEvent(QWidget *w, ulong time, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) + : UserEvent(w, time, QEvent::Wheel) { localPos = local; globalPos = global; delta = d; orient = o; } + int delta; + QPoint localPos; + QPoint globalPos; + Qt::Orientation orient; + }; + + class KeyEvent : public UserEvent { + public: + KeyEvent(QWidget *w, ulong time, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) + :UserEvent(w, time, t){ key = k; unicode = text; repeat = autorep; repeatCount = count; modifiers = mods; } + int key; + QString unicode; + bool repeat; + ushort repeatCount; + Qt::KeyboardModifiers modifiers; + }; + + static QTime eventTime; + + static int userEventsQueued() { return userEventQueue.count(); } + static UserEvent * getUserEvent() { return userEventQueue.takeFirst(); } + static void queueUserEvent(UserEvent *ev) { userEventQueue.append(ev); } + + +public: + static QList userEventQueue; + + static void handleMouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b) { + handleMouseEvent(w, eventTime.elapsed(), local, global, b); + } + + static void handleMouseEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b); + + static void handleKeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) { + handleKeyEvent(w, eventTime.elapsed(), t, k, mods, text, autorep, count); + } + + static void handleKeyEvent(QWidget *w, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); + + static void handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) { + handleWheelEvent(w, eventTime.elapsed(), local, global, d, o); + } + + static void handleWheelEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o); + + // delivered directly by the plugin via spontaneous events + static void handleGeometryChange(QWidget *w, const QRect &newRect); + static void handleCloseEvent(QWidget *w); + static void handleEnterEvent(QWidget *w); + static void handleLeaveEvent(QWidget *w); +}; + +QT_END_NAMESPACE +#endif // QWINDOWSYSTEMINTERFACE_H diff --git a/src/plugins/generic/linuxinput/qlinuxinput.cpp b/src/plugins/generic/linuxinput/qlinuxinput.cpp index 363e91f..32137ee 100644 --- a/src/plugins/generic/linuxinput/qlinuxinput.cpp +++ b/src/plugins/generic/linuxinput/qlinuxinput.cpp @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include @@ -141,13 +141,13 @@ void QLinuxInputMouseHandler::readMouseData() } else if (data->code == ABS_WHEEL) { // vertical scroll // data->value: 1 == up, -1 == down int delta = 120 * data->value; - QApplicationPrivate::handleWheelEvent(0, QPoint(m_x, m_y), + QWindowSystemInterface::handleWheelEvent(0, QPoint(m_x, m_y), QPoint(m_x, m_y), delta, Qt::Vertical); } else if (data->code == ABS_THROTTLE) { // horizontal scroll // data->value: 1 == right, -1 == left int delta = 120 * -data->value; - QApplicationPrivate::handleWheelEvent(0, QPoint(m_x, m_y), + QWindowSystemInterface::handleWheelEvent(0, QPoint(m_x, m_y), QPoint(m_x, m_y), delta, Qt::Horizontal); } else { @@ -167,7 +167,7 @@ void QLinuxInputMouseHandler::readMouseData() else m_buttons &= ~button; - QApplicationPrivate::handleMouseEvent(0, QPoint(m_x, m_y), + QWindowSystemInterface::handleMouseEvent(0, QPoint(m_x, m_y), QPoint(m_x, m_y), m_buttons); } else if (data->type == EV_SYN && data->code == SYN_REPORT) { if (!posChanged) @@ -175,7 +175,7 @@ void QLinuxInputMouseHandler::readMouseData() posChanged = false; QPoint pos(m_x, m_y); - QApplicationPrivate::handleMouseEvent(0, pos, pos, m_buttons); + QWindowSystemInterface::handleMouseEvent(0, pos, pos, m_buttons); // pos = m_handler->transform(pos); //m_handler->limitToScreen(pos); diff --git a/src/plugins/graphicssystems/fb_base/fb_base.cpp b/src/plugins/graphicssystems/fb_base/fb_base.cpp index eeaa220..6567e95 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.cpp +++ b/src/plugins/graphicssystems/fb_base/fb_base.cpp @@ -1,10 +1,10 @@ #include "fb_base.h" #include -#include #include #include #include +#include QGraphicsSystemSoftwareCursor::QGraphicsSystemSoftwareCursor(QGraphicsSystemScreen *scr) : QGraphicsSystemCursor(scr), currentRect(QRect()), prevRect(QRect()) @@ -261,7 +261,7 @@ void QGraphicsSystemFbWindowSurface::setGeometry(const QRect &rect) if (mImage.size() != rect.size()) mImage = QImage(rect.size(), mScreen->format()); - QApplicationPrivate::handleGeometryChange(this->window(), rect); + QWindowSystemInterface::handleGeometryChange(window(), rect); QWindowSurface::setGeometry(rect); } diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp index c3b5522..74a38a4 100644 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp @@ -3,9 +3,10 @@ #include #include -#include +#include #include #include +#include #include @@ -65,7 +66,7 @@ QDirectFbInput::QDirectFbInput() m_inputHandler = new InputSocketWaiter(eventBuffer,this); connect(m_inputHandler,SIGNAL(newEvent()),this,SLOT(handleEvents())); - connect(qApp,SIGNAL(aboutToQuit()),SLOT(applicationEnd())); + connect(QApplication::instance(),SIGNAL(aboutToQuit()),SLOT(applicationEnd())); } void QDirectFbInput::addWindow(DFBWindowID id, QWidget *tlw) @@ -127,42 +128,23 @@ void QDirectFbInput::handleEvents() void QDirectFbInput::handleMouseEvents(const DFBEvent &event) { - QEvent::Type type = QDirectFbConvenience::eventType(event.window.type); QPoint p(event.window.x, event.window.y); QPoint globalPos = globalPoint(event); Qt::MouseButtons buttons = QDirectFbConvenience::mouseButtons(event.window.buttons); - QWidget *tlw = tlwMap.value(event.window.window_id); IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); IDirectFBWindow *window; layer->GetWindow(layer,event.window.window_id,&window); long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000); - timestamp /= 1000; if (event.window.type == DWET_BUTTONDOWN) { - static long prevTime = 0; - static QWidget *prevWindow; - static int prevX = -999; - static int prevY = -999; - - if (tlw == prevWindow && timestamp - prevTime < QApplication::doubleClickInterval() - && qAbs(event.window.cx - prevX) < 5 && qAbs(event.window.cy - prevY) < 5) { - type = QEvent::MouseButtonDblClick; - prevTime = timestamp - QApplication::doubleClickInterval(); //no double click next time - } else { - prevTime = timestamp; - } - prevWindow = tlw; - prevX = event.window.cx; - prevY = event.window.cy; - window->GrabPointer(window); } else if (event.window.type == DWET_BUTTONUP) { window->UngrabPointer(window); } - - QApplicationPrivate::handleMouseEvent(event.window.window_id, timestamp, p, globalPos, buttons); + QWidget *tlw = tlwMap.value(event.window.window_id); + QWindowSystemInterface::handleMouseEvent(tlw, timestamp, p, globalPos, buttons); } void QDirectFbInput::applicationEnd() @@ -176,9 +158,8 @@ void QDirectFbInput::handleWheelEvent(const DFBEvent &event) QPoint p(event.window.cx, event.window.cy); QPoint globalPos = globalPoint(event); long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000); - timestamp /= 1000; - - QApplicationPrivate::handleWheelEvent(event.window.window_id, timestamp, p, globalPos, + QWidget *tlw = tlwMap.value(event.window.window_id); + QWindowSystemInterface::handleWheelEvent(tlw, timestamp, p, globalPos, event.window.step*120, Qt::Vertical); } @@ -190,13 +171,12 @@ void QDirectFbInput::handleKeyEvents(const DFBEvent &event) Qt::KeyboardModifiers modifiers = QDirectFbConvenience::keyboardModifiers(event.window.modifiers); long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000); - timestamp /= 1000; QChar character; if (DFB_KEY_TYPE(event.window.key_symbol) == DIKT_UNICODE) character = QChar(event.window.key_symbol); - - QApplicationPrivate::handleKeyEvent(event.window.window_id, timestamp, type, key, modifiers, character); + QWidget *tlw = tlwMap.value(event.window.window_id); + QWindowSystemInterface::handleKeyEvent(tlw, timestamp, type, key, modifiers, character); } void QDirectFbInput::handleEnterLeaveEvents(const DFBEvent &event) @@ -204,10 +184,10 @@ void QDirectFbInput::handleEnterLeaveEvents(const DFBEvent &event) QWidget *tlw = tlwMap.value(event.window.window_id); switch (event.window.type) { case DWET_ENTER: - QApplicationPrivate::handleEnterEvent(tlw); + QWindowSystemInterface::handleEnterEvent(tlw); break; case DWET_LEAVE: - QApplicationPrivate::handleLeaveEvent(tlw); + QWindowSystemInterface::handleLeaveEvent(tlw); break; default: break; diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp index e159106..c54f6eb 100644 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp @@ -43,7 +43,7 @@ #include "qgraphicssystem_testlite.h" #include -#include +#include #include "x11util.h" @@ -245,7 +245,7 @@ void QTestLiteWindowSurface::handleMouseEvent(QEvent::Type type, void *ev) bool hor = (((e->button == Button4 || e->button == Button5) && (modifiers & Qt::AltModifier)) || (e->button == 6 || e->button == 7)); - QApplicationPrivate::handleWheelEvent(winId(), e->time, + QWindowSystemInterface::handleWheelEvent(window(), e->time, QPoint(e->x, e->y), QPoint(e->x_root, e->y_root), delta, hor ? Qt::Horizontal : Qt::Vertical); @@ -258,7 +258,7 @@ void QTestLiteWindowSurface::handleMouseEvent(QEvent::Type type, void *ev) buttons ^= button; // X event uses state *before*, Qt uses state *after* - QApplicationPrivate::handleMouseEvent(winId(), e->time, QPoint(e->x, e->y), + QWindowSystemInterface::handleMouseEvent(window(), e->time, QPoint(e->x, e->y), QPoint(e->x_root, e->y_root), buttons); @@ -267,24 +267,24 @@ void QTestLiteWindowSurface::handleMouseEvent(QEvent::Type type, void *ev) void QTestLiteWindowSurface::handleGeometryChange(int x, int y, int w, int h) { - QApplicationPrivate::handleGeometryChange(window(), QRect(x,y,w,h)); + QWindowSystemInterface::handleGeometryChange(window(), QRect(x,y,w,h)); } void QTestLiteWindowSurface::handleCloseEvent() { - QApplicationPrivate::handleCloseEvent(window()); + QWindowSystemInterface::handleCloseEvent(window()); } void QTestLiteWindowSurface::handleEnterEvent() { - QApplicationPrivate::handleEnterEvent(window()); + QWindowSystemInterface::handleEnterEvent(window()); } void QTestLiteWindowSurface::handleLeaveEvent() { - QApplicationPrivate::handleLeaveEvent(window()); + QWindowSystemInterface::handleLeaveEvent(window()); } @@ -592,12 +592,12 @@ void QTestLiteWindowSurface::handleKeyEvent(QEvent::Type type, void *ev) modifiers ^= modifierFromKeyCode(qtcode); if (qtcode) { - QApplicationPrivate::handleKeyEvent(winId(), e->time, type, qtcode, modifiers); + QWindowSystemInterface::handleKeyEvent(window(), e->time, type, qtcode, modifiers); } else if (chars[0]) { int qtcode = chars.toUpper()[0]; //Not exactly right... if (modifiers & Qt::ControlModifier && qtcode < ' ') qtcode = chars[0] + '@'; - QApplicationPrivate::handleKeyEvent(winId(), e->time, type, qtcode, modifiers, QString::fromLatin1(chars)); + QWindowSystemInterface::handleKeyEvent(window(), e->time, type, qtcode, modifiers, QString::fromLatin1(chars)); } else { qWarning() << "unknown X keycode" << hex << e->keycode << keySym; } diff --git a/src/plugins/graphicssystems/vnc/qvncserver.cpp b/src/plugins/graphicssystems/vnc/qvncserver.cpp index 490ca02..ea576d4 100644 --- a/src/plugins/graphicssystems/vnc/qvncserver.cpp +++ b/src/plugins/graphicssystems/vnc/qvncserver.cpp @@ -48,7 +48,7 @@ #include #include -#include +#include #include @@ -844,7 +844,7 @@ void QVNCServer::pointerEvent() bool isPress; if (buttonChange(buttons, ev.buttons, &button, &isPress)) type = isPress ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; - QApplicationPrivate::handleMouseEvent(0, QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), ev.buttons); + QWindowSystemInterface::handleMouseEvent(0, QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), ev.buttons); } else { // No buttons or motion reported at the same time as wheel events Qt::Orientation orientation; @@ -853,7 +853,7 @@ void QVNCServer::pointerEvent() else orientation = Qt::Vertical; int delta = 120 * ((ev.wheelDirection == ev.WheelLeft || ev.wheelDirection == ev.WheelUp) ? 1 : -1); - QApplicationPrivate::handleWheelEvent(0, QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), delta, orientation); + QWindowSystemInterface::handleWheelEvent(0, QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), delta, orientation); } handleMsg = false; } @@ -879,7 +879,7 @@ void QVNCServer::keyEvent() QString str; if (ev.unicode && ev.unicode != 0xffff) str = QString(ev.unicode); - QApplicationPrivate::handleKeyEvent(0, type, ev.keycode, keymod, str); + QWindowSystemInterface::handleKeyEvent(0, type, ev.keycode, keymod, str); } handleMsg = false; } -- cgit v0.12 From e4ba2795e8650a2aeb27b20ddf6d386509247e41 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Fri, 12 Feb 2010 16:31:30 +0100 Subject: move methods that shouldn't be used by plugins out of QWindowSystemInterface --- src/gui/kernel/qapplication_lite.cpp | 3 +- src/gui/kernel/qeventdispatcher_glib_lite.cpp | 6 +-- src/gui/kernel/qeventdispatcher_lite.cpp | 6 +-- src/gui/kernel/qwindowsysteminterface.cpp | 8 ++-- src/gui/kernel/qwindowsysteminterface.h | 62 ++++++++++++++------------- 5 files changed, 44 insertions(+), 41 deletions(-) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 6142e15..5ca6717 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -63,7 +63,6 @@ QT_BEGIN_NAMESPACE -QList userEventQueue; static QString appName; static const char *appFont = 0; // application font @@ -534,7 +533,7 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterface::MouseEvent * Qt::MouseButtons stateChange = e->buttons ^ buttons; if (e->globalPos != QPoint(qt_last_x, qt_last_y) && (stateChange != Qt::NoButton)) { QWindowSystemInterface::MouseEvent * newMouseEvent = new QWindowSystemInterface::MouseEvent(e->widget.data(), e->timestamp, e->localPos, e->globalPos, e->buttons); - userEventQueue.prepend(newMouseEvent); // just in case the move triggers a new event loop + QWindowSystemInterfacePrivate::userEventQueue.prepend(newMouseEvent); // just in case the move triggers a new event loop stateChange = Qt::NoButton; } diff --git a/src/gui/kernel/qeventdispatcher_glib_lite.cpp b/src/gui/kernel/qeventdispatcher_glib_lite.cpp index 757bb00..0cfea8a 100644 --- a/src/gui/kernel/qeventdispatcher_glib_lite.cpp +++ b/src/gui/kernel/qeventdispatcher_glib_lite.cpp @@ -64,7 +64,7 @@ static gboolean userEventSourcePrepare(GSource *s, gint *timeout) Q_UNUSED(s) Q_UNUSED(timeout) - return QWindowSystemInterface::userEventsQueued() > 0; + return QWindowSystemInterfacePrivate::userEventsQueued() > 0; } static gboolean userEventSourceCheck(GSource *source) @@ -77,8 +77,8 @@ static gboolean userEventSourceDispatch(GSource *s, GSourceFunc, gpointer) GUserEventSource * source = reinterpret_cast(s); QWindowSystemInterface::UserEvent * event; - while (QWindowSystemInterface::userEventsQueued()) { - event = QWindowSystemInterface::getUserEvent(); + while (QWindowSystemInterfacePrivate::userEventsQueued()) { + event = QWindowSystemInterfacePrivate::getUserEvent(); // send through event filter if (source->q->filterEvent(event)) { diff --git a/src/gui/kernel/qeventdispatcher_lite.cpp b/src/gui/kernel/qeventdispatcher_lite.cpp index bd177cb..d500ad6 100644 --- a/src/gui/kernel/qeventdispatcher_lite.cpp +++ b/src/gui/kernel/qeventdispatcher_lite.cpp @@ -86,9 +86,9 @@ bool QEventDispatcherLite::processEvents(QEventLoop::ProcessEventsFlags flags) while (!d->interrupt) { // also flushes output buffer ###can be optimized QWindowSystemInterface::UserEvent *event; if (!(flags & QEventLoop::ExcludeUserInputEvents) - && QWindowSystemInterface::userEventsQueued() > 0) { + && QWindowSystemInterfacePrivate::userEventsQueued() > 0) { // process a pending user input event - event = QWindowSystemInterface::getUserEvent(); + event = QWindowSystemInterfacePrivate::getUserEvent(); } else { break; } @@ -113,7 +113,7 @@ bool QEventDispatcherLite::processEvents(QEventLoop::ProcessEventsFlags flags) bool QEventDispatcherLite::hasPendingEvents() { extern uint qGlobalPostedEventsCount(); // from qapplication.cpp - return qGlobalPostedEventsCount() || QWindowSystemInterface::userEventsQueued();; + return qGlobalPostedEventsCount() || QWindowSystemInterfacePrivate::userEventsQueued();; } void QEventDispatcherLite::startingUp() diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index e051533..d7b5eef 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -51,7 +51,7 @@ QTime QWindowSystemInterface::eventTime; // Callback functions for plugins: // -QList QWindowSystemInterface::userEventQueue; +QList QWindowSystemInterfacePrivate::userEventQueue; extern QPointer qt_last_mouse_receiver; /*! @@ -94,19 +94,19 @@ void QWindowSystemInterface::handleCloseEvent(QWidget *tlw) void QWindowSystemInterface::handleMouseEvent(QWidget *tlw, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b) { MouseEvent * e = new MouseEvent(tlw, timestamp, local, global, b); - queueUserEvent(e); + QWindowSystemInterfacePrivate::queueUserEvent(e); } void QWindowSystemInterface::handleKeyEvent(QWidget *tlw, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count) { KeyEvent * e = new KeyEvent(tlw, timestamp, t, k, mods, text, autorep, count); - queueUserEvent(e); + QWindowSystemInterfacePrivate::queueUserEvent(e); } void QWindowSystemInterface::handleWheelEvent(QWidget *tlw, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) { WheelEvent *e = new WheelEvent(tlw, timestamp, local, global, d, o); - queueUserEvent(e); + QWindowSystemInterfacePrivate::queueUserEvent(e); } QT_END_NAMESPACE diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index caeacd3..fee7e75 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -48,9 +48,35 @@ #include QT_BEGIN_NAMESPACE + class Q_GUI_EXPORT QWindowSystemInterface { public: + static void handleMouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b) { + handleMouseEvent(w, eventTime.elapsed(), local, global, b); + } + + static void handleMouseEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b); + + static void handleKeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) { + handleKeyEvent(w, eventTime.elapsed(), t, k, mods, text, autorep, count); + } + + static void handleKeyEvent(QWidget *w, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); + + static void handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) { + handleWheelEvent(w, eventTime.elapsed(), local, global, d, o); + } + + static void handleWheelEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o); + + // delivered directly by the plugin via spontaneous events + static void handleGeometryChange(QWidget *w, const QRect &newRect); + static void handleCloseEvent(QWidget *w); + static void handleEnterEvent(QWidget *w); + static void handleLeaveEvent(QWidget *w); + + class UserEvent { public: UserEvent(QWidget * w, ulong time, QEvent::Type t) @@ -90,40 +116,18 @@ public: Qt::KeyboardModifiers modifiers; }; +private: static QTime eventTime; - static int userEventsQueued() { return userEventQueue.count(); } - static UserEvent * getUserEvent() { return userEventQueue.takeFirst(); } - static void queueUserEvent(UserEvent *ev) { userEventQueue.append(ev); } - +}; +class QWindowSystemInterfacePrivate { public: - static QList userEventQueue; - - static void handleMouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b) { - handleMouseEvent(w, eventTime.elapsed(), local, global, b); - } - - static void handleMouseEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b); - - static void handleKeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) { - handleKeyEvent(w, eventTime.elapsed(), t, k, mods, text, autorep, count); - } - - static void handleKeyEvent(QWidget *w, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); + static QList userEventQueue; - static void handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) { - handleWheelEvent(w, eventTime.elapsed(), local, global, d, o); - } - - static void handleWheelEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o); - - // delivered directly by the plugin via spontaneous events - static void handleGeometryChange(QWidget *w, const QRect &newRect); - static void handleCloseEvent(QWidget *w); - static void handleEnterEvent(QWidget *w); - static void handleLeaveEvent(QWidget *w); + static int userEventsQueued() { return userEventQueue.count(); } + static QWindowSystemInterface::UserEvent * getUserEvent() { return userEventQueue.takeFirst(); } + static void queueUserEvent(QWindowSystemInterface::UserEvent *ev) { userEventQueue.append(ev); } }; - QT_END_NAMESPACE #endif // QWINDOWSYSTEMINTERFACE_H -- cgit v0.12 From 939a869b5856d05e8340e64edb66b1f07ba609cd Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Fri, 12 Feb 2010 16:32:20 +0100 Subject: make qvfb plugin compile - QApplicationPrivate -> QWindowSystemInterface --- src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.cpp | 10 ++++------ src/plugins/graphicssystems/qvfb/qwindowsurface_qvfb.cpp | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.cpp b/src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.cpp index 77942c9..19058a6 100644 --- a/src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.cpp +++ b/src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.cpp @@ -59,7 +59,8 @@ #include #include -#include +#include +#include QT_BEGIN_NAMESPACE @@ -147,8 +148,7 @@ void QVFbGraphicsSystemScreenKeyboardHandler::readKeyboardData() // qDebug() << "readKeyboardData" << type << hex << kd->keycode << kd->modifiers << text; - QKeyEvent ke(type, kd->keycode, kd->modifiers, text, kd->repeat, int(text.length())); - QApplicationPrivate::handleKeyEvent(0, &ke); + QWindowSystemInterface::handleKeyEvent(0, type, kd->keycode, kd->modifiers, text, kd->repeat, int(text.length())); idx += sizeof(QVFbKeyData); } @@ -237,9 +237,7 @@ void QVFbGraphicsSystemScreenMouseHandler::readMouseData() if (button) { type = (button & bstate) ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; } - QMouseEvent me(type, mousePos, mousePos, - Qt::MouseButton(button), Qt::MouseButtons(bstate), Qt::NoModifier); - QApplicationPrivate::handleMouseEvent(0, me); + QWindowSystemInterface::handleMouseEvent(0, mousePos, mousePos, Qt::MouseButtons(bstate)); // qDebug() << "readMouseData" << mousePos << button << bstate << oldButtonState << type; diff --git a/src/plugins/graphicssystems/qvfb/qwindowsurface_qvfb.cpp b/src/plugins/graphicssystems/qvfb/qwindowsurface_qvfb.cpp index c49f082..0aafe28 100644 --- a/src/plugins/graphicssystems/qvfb/qwindowsurface_qvfb.cpp +++ b/src/plugins/graphicssystems/qvfb/qwindowsurface_qvfb.cpp @@ -81,7 +81,7 @@ void QVFbWindowSurface::setGeometry(const QRect &) // any size you like as long as it's full-screen... QRect rect(mScreen->availableGeometry()); - QApplicationPrivate::handleGeometryChange(this->window(), rect); + QWindowSystemInterface::handleGeometryChange(this->window(), rect); QWindowSurface::setGeometry(rect); } -- cgit v0.12 From 53b0fc5d7fc7ad431cf91e41a75a9f6b740c830e Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 17 Feb 2010 11:34:30 +0100 Subject: added some documentation --- src/gui/painting/qgraphicssystemcursor.cpp | 76 +++++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qgraphicssystemcursor.cpp b/src/gui/painting/qgraphicssystemcursor.cpp index 9a0e135..f8d24b1 100644 --- a/src/gui/painting/qgraphicssystemcursor.cpp +++ b/src/gui/painting/qgraphicssystemcursor.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -495,6 +495,17 @@ void QGraphicsSystemCursorImage::createSystemCursor(int id) } } +/*! + \fn void set(Qt::CursorShape id) + + \brief Calling this method sets the cursor image to the specified shape + + \a id is one of the defined Qt::CursorShape values. + + If id is invalid, Qt::BitmapCursor, or unknown by the implementation, + Qt::ArrowCursor is used instead. +*/ + void QGraphicsSystemCursorImage::set(Qt::CursorShape id) { QGraphicsSystemCursorImage *cursor = 0; @@ -513,6 +524,18 @@ void QGraphicsSystemCursorImage::set(Qt::CursorShape id) hot = cursor->hot; } +/*! + \fn void set(const QImage * image, int hx, int hy) + + \brief Set the cursor image to the specified QImage, with the hotsport at (hx, hy) + + \a image A pointer to a QImage + + \a hx The x coordinate of the cursor's hotspot + + \a hy the y coordinate of the cursor's hotspot +*/ + void QGraphicsSystemCursorImage::set(const QImage * image, int hx, int hy) { hot.setX(hx); @@ -520,6 +543,24 @@ void QGraphicsSystemCursorImage::set(const QImage * image, int hx, int hy) cursorImage = *image; } +/*! + \fn set(const uchar *data, const uchar *mask, int width, int height, int hx, int hy) + + \brief set the cursor image to the graphic represented by the combination of data, mask, + width, and height + + \a data The pixel data of the graphic + + \a mask Mask data for the graphic. pixels in data with a corresponding mask bit of 0 are not drawn + + \a width The width of the graphic in pixels + + \a height The height of the graphic in pixels + + \a hx The X hotspot of the cursor graphic + + \a hy The Y hotspot of the cursor graphic +*/ void QGraphicsSystemCursorImage::set(const uchar *data, const uchar *mask, int width, int height, int hx, int hy) { @@ -577,4 +618,37 @@ void QGraphicsSystemCursorImage::set(const uchar *data, const uchar *mask, } +/*! + \fn QGraphicsSystemCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) + + \brief set the cursor image to the graphic represented by the combination of data, mask, + width, and height + + \a data The pixel data of the graphic + + \a mask Mask data for the graphic. pixels in data with a corresponding mask bit of 0 are not drawn + + \a width The width of the graphic in pixels + + \a height The height of the graphic in pixels + + \a hotX The X hotspot of the cursor graphic + + \a hotY The Y hotspot of the cursor graphic + + \sa set +*/ + +/*! + \fn QImage *image() + + \brief Return the cursor graphic as a pointer to a QImage +*/ + +/*! + \fn QPoint hotspot + + \brief Return the cursor's hotspot +*/ + QT_END_NAMESPACE -- cgit v0.12 From 196e1484c22f6347061fa433987a86d90e178a55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 22 Feb 2010 14:13:35 +0100 Subject: Minimaldfb: try to make pixelformat of window the same as the layer --- src/gui/image/qpixmap_blitter.cpp | 5 +++++ src/gui/image/qpixmap_blitter_p.h | 2 ++ src/gui/kernel/qeventdispatcher_qws_p.h | 2 +- src/gui/painting/qpaintengine_blitter.cpp | 4 ++++ src/gui/painting/qpaintengine_blitter_p.h | 3 +++ .../graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp | 10 +++++++++- 6 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index f82a67d..a22bd8f 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -8,6 +8,7 @@ #include +#ifndef QT_NO_BLITTABLE static int global_ser_no = 0; QBlittablePixmapData::QBlittablePixmapData(QPixmapData::PixelType type) @@ -52,7 +53,9 @@ void QBlittablePixmapData::resize(int width, int height) m_blittable = 0; delete m_engine; m_engine = 0; +#ifdef Q_WS_LITE d = QApplicationPrivate::graphicsSystem()->screens().at(0)->depth(); +#endif w = width; h = height; is_null = (w <= 0 || h <= 0); @@ -257,3 +260,5 @@ QRectF QBlittablePixmapData::clipAndTransformRect(const QRectF &rect) const return transformationRect; } #endif //QT_BLITTER_RASTEROVERLAY + +#endif //QT_NO_BLITTABLE diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h index 73f80a8..1d85cd3 100644 --- a/src/gui/image/qpixmap_blitter_p.h +++ b/src/gui/image/qpixmap_blitter_p.h @@ -4,6 +4,7 @@ #include #include +#ifndef QT_NO_BLITTABLE class Q_GUI_EXPORT QBlittablePixmapData : public QPixmapData { // Q_DECLARE_PRIVATE(QBlittablePixmapData); @@ -116,4 +117,5 @@ inline void QBlittablePixmapData::unmarkRasterOverlay(const QRectF &rect) #endif } +#endif // QT_NO_BLITTABLE #endif // QPIXMAP_BLITTER_P_H diff --git a/src/gui/kernel/qeventdispatcher_qws_p.h b/src/gui/kernel/qeventdispatcher_qws_p.h index 5a2b016..8d8d61c 100644 --- a/src/gui/kernel/qeventdispatcher_qws_p.h +++ b/src/gui/kernel/qeventdispatcher_qws_p.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE -class QEventDispatcherLitePrivate; +class QEventDispatcherQWSPrivate; class QEventDispatcherQWS : public QEventDispatcherUNIX { diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index 04d3d5a..af76926 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -4,6 +4,8 @@ #include "private/qapplication_p.h" #include "private/qpixmap_blitter_p.h" +#ifndef QT_NO_BLITTABLE + #define STATE_XFORM_SCALE 0x00000001 #define STATE_XFORM_COMPLEX 0x00000002 @@ -658,3 +660,5 @@ void QBlittable::unlock() d->locked = false; } } + +#endif //QT_NO_BLITTABLE diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h index 2d9add9..ecc29ba 100644 --- a/src/gui/painting/qpaintengine_blitter_p.h +++ b/src/gui/painting/qpaintengine_blitter_p.h @@ -4,6 +4,8 @@ #include "private/qpaintengineex_p.h" #include "private/qpaintengine_raster_p.h" +#ifndef QT_NO_BLITTABLE + class QBlittablePrivate; class QBlitterPaintEnginePrivate; class QBlittablePixmapData; @@ -98,4 +100,5 @@ private: }; +#endif //QT_NO_BLITTABLE #endif // QPAINTENGINE_BLITTER_P_H diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp index d51498f..07a9b8a 100644 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp +++ b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -55,6 +55,10 @@ QDirectFbWindowSurface::QDirectFbWindowSurface(QWidget *window) { window->setWindowSurface(this); + IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); + DFBDisplayLayerConfig layerConfig; + layer->GetConfiguration(layer,&layerConfig); + DFBWindowDescription description; memset(&description,0,sizeof(DFBWindowDescription)); description.flags = DFBWindowDescriptionFlags(DWDESC_WIDTH|DWDESC_HEIGHT|DWDESC_POSX|DWDESC_POSY|DWDESC_SURFACE_CAPS @@ -66,13 +70,17 @@ QDirectFbWindowSurface::QDirectFbWindowSurface(QWidget *window) description.height = window->rect().height(); description.posx = window->rect().x(); description.posy = window->rect().y(); + + if (layerConfig.surface_caps & DSCAPS_PREMULTIPLIED) + description.surface_caps = DSCAPS_PREMULTIPLIED; + description.pixelformat = layerConfig.pixelformat; + #if DIRECTFB_MINOR_VERSION >= 1 description.options = DFBWindowOptions(DWOP_ALPHACHANNEL); #endif description.caps = DFBWindowCapabilities(DWCAPS_DOUBLEBUFFER|DWCAPS_ALPHACHANNEL); description.surface_caps = DSCAPS_PREMULTIPLIED; - IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); DFBResult result = layer->CreateWindow(layer,&description,&m_dfbWindow); if (result != DFB_OK) { DirectFBError("QDirectFbGraphicsSystemScreen: failed to create window",result); -- cgit v0.12 From cf7fe6c1c7bd1189d37b603b38a7fc7feb4b5f41 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 1 Mar 2010 14:18:05 +0100 Subject: Compile after QStaticText introduction --- src/gui/painting/qpaintengine_blitter.cpp | 12 ++++++++++++ src/gui/painting/qpaintengine_blitter_p.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index af76926..1032852 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -571,6 +571,18 @@ void QBlitterPaintEngine::drawTextItem(const QPointF &pos, const QTextItem &ti) d->pmData->markRasterOverlay(pos,ti); } +void QBlitterPaintEngine::drawStaticTextItem(QStaticTextItem *sti) +{ + Q_D(QBlitterPaintEngine); + d->lock(); + d->raster->drawStaticTextItem(sti); + +//#### d->pmData->markRasterOverlay(sti); + qWarning("not implemented: markRasterOverlay for QStaticTextItem"); + +} + + void QBlitterPaintEngine::drawEllipse(const QRectF &r) { Q_D(QBlitterPaintEngine); diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h index ecc29ba..1a2ad9e 100644 --- a/src/gui/painting/qpaintengine_blitter_p.h +++ b/src/gui/painting/qpaintengine_blitter_p.h @@ -86,6 +86,7 @@ public: virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags); virtual void drawTextItem(const QPointF &pos, const QTextItem &ti); + virtual void drawStaticTextItem(QStaticTextItem *); virtual void drawEllipse(const QRectF &r); -- cgit v0.12 From 19231680666727a07270c44153aeb4a68d67de47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 5 Mar 2010 16:23:03 +0100 Subject: install fonts for lighthouse --- src/qt_install.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt_install.pri b/src/qt_install.pri index f906e92..3cea79c 100644 --- a/src/qt_install.pri +++ b/src/qt_install.pri @@ -38,7 +38,7 @@ qt_install_headers { } } -embedded:equals(TARGET, QtGui) { +embedded|embedded_lite: equals(TARGET, QtGui) { # install fonts for embedded INSTALLS += fonts fonts.path = $$[QT_INSTALL_LIBS]/fonts -- cgit v0.12 From 3eb3527db4cfe86ab51506636376d1b59878f42a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 8 Mar 2010 14:26:44 +0100 Subject: QGraphcissystemCursor is now in a file with a _ in it So that syncqt does not generate an entry for it in QtGui --- src/gui/kernel/qapplication_lite.cpp | 2 +- src/gui/kernel/qwidget_lite.cpp | 2 +- src/gui/painting/painting.pri | 4 +- src/gui/painting/qgraphicssystemcursor.cpp | 654 --------------------- src/gui/painting/qgraphicssystemcursor.h | 87 --- src/gui/painting/qgraphicssystemcursor_lite.cpp | 654 +++++++++++++++++++++ src/gui/painting/qgraphicssystemcursor_lite.h | 87 +++ src/plugins/graphicssystems/fb_base/fb_base.cpp | 2 +- src/plugins/graphicssystems/fb_base/fb_base.h | 2 +- .../testlite/qgraphicssystem_testlite.cpp | 2 +- 10 files changed, 748 insertions(+), 748 deletions(-) delete mode 100644 src/gui/painting/qgraphicssystemcursor.cpp delete mode 100644 src/gui/painting/qgraphicssystemcursor.h create mode 100644 src/gui/painting/qgraphicssystemcursor_lite.cpp create mode 100644 src/gui/painting/qgraphicssystemcursor_lite.h diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 5ca6717..5d7ab5a 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -57,7 +57,7 @@ #include #include "private/qgraphicssystem_p.h" -#include "qgraphicssystemcursor.h" +#include #include #include diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index 3913708..bcbcd82 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -48,7 +48,7 @@ #include "private/qapplication_p.h" #include "qdesktopwidget.h" -#include "qgraphicssystemcursor.h" +#include QT_BEGIN_NAMESPACE static QGraphicsSystemScreen *qt_screenForWidget(const QWidget *w); diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 8fea4e6..8e7bba7 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -183,9 +183,9 @@ embedded_lite { SOURCES += \ painting/qcolormap_lite.cpp \ painting/qpaintdevice_lite.cpp \ - painting/qgraphicssystemcursor.cpp + painting/qgraphicssystemcursor_lite.cpp HEADERS += \ - painting/qgraphicssystemcursor.h + painting/qgraphicssystemcursor_lite.h } symbian { diff --git a/src/gui/painting/qgraphicssystemcursor.cpp b/src/gui/painting/qgraphicssystemcursor.cpp deleted file mode 100644 index f8d24b1..0000000 --- a/src/gui/painting/qgraphicssystemcursor.cpp +++ /dev/null @@ -1,654 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qgraphicssystemcursor.h" - -#include -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -QPointer QGraphicsSystemCursor::instance = 0; - -/*! - \class QGraphicsSystemCursor - - \brief The QGraphicsSystemCursor class provides information about - pointer device events (movement, buttons), and requests to change - the currently displayed cursor. - - Note that QGraphicsSystemCursor does not include any graphics for - display. An application that sets a QCursor may provide its own - graphics. - - \sa QGraphicsSystemCursorImage -*/ - -/*! - \fn virtual void pointerEvent(const QMouseEvent & event) - - This method is called by Qt whenever a QMouseEvent is generated by the - underlying pointer input. \a event is a reference to the QMouseEvent in - question. A default do-nothing implementation is provided. - - \sa QApplicationPrivate::handleMouseEvent() -*/ - -/*! - \fn virtual void changeCursor(QCursor * widgetCursor, QWidget * widget) - - \brief This method is called by Qt whenever the cursor graphic should be changed. - - Implementation of this method is mandatory for a subclass of QGraphicsSystemCursor. - - \a widgetCursor is a pointer to the QCursor that should be displayed. - - \a widget is a pointer to the widget currently displayed at QCursor::pos(). Note - that this may be 0 if the current position is not occupied by a displayed widget. - - \sa QApplicationPrivate::handleMouseEvent(), QCursor::pos() -*/ - -/*! - Constructs a QGraphicsSystemCursor - -*/ -QGraphicsSystemCursor::QGraphicsSystemCursor(QGraphicsSystemScreen *scr ) - : screen(scr) -{ - instance = this; -} - -// End of display and pointer event handling code -// Beginning of built-in cursor graphics -// from src/gui/embedded/QGraphicsSystemCursorImage_qws.cpp - -static QGraphicsSystemCursorImage *systemCursorTable[Qt::LastCursor+1]; -static bool systemCursorTableInit = false; - -// 16 x 16 -static const uchar cur_arrow_bits[] = { - 0x07, 0x00, 0x39, 0x00, 0xc1, 0x01, 0x02, 0x0e, 0x02, 0x10, 0x02, 0x08, - 0x04, 0x04, 0x04, 0x02, 0x04, 0x04, 0x88, 0x08, 0x48, 0x11, 0x28, 0x22, - 0x10, 0x44, 0x00, 0x28, 0x00, 0x10, 0x00, 0x00 }; -static const uchar mcur_arrow_bits[] = { - 0x07, 0x00, 0x3f, 0x00, 0xff, 0x01, 0xfe, 0x0f, 0xfe, 0x1f, 0xfe, 0x0f, - 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x07, 0xf8, 0x0f, 0x78, 0x1f, 0x38, 0x3e, - 0x10, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00, 0x00 }; - -static const unsigned char cur_up_arrow_bits[] = { - 0x80, 0x00, 0x40, 0x01, 0x40, 0x01, 0x20, 0x02, 0x20, 0x02, 0x10, 0x04, - 0x10, 0x04, 0x08, 0x08, 0x78, 0x0f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, - 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01}; -static const unsigned char mcur_up_arrow_bits[] = { - 0x80, 0x00, 0xc0, 0x01, 0xc0, 0x01, 0xe0, 0x03, 0xe0, 0x03, 0xf0, 0x07, - 0xf0, 0x07, 0xf8, 0x0f, 0xf8, 0x0f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, - 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01}; - -static const unsigned char cur_cross_bits[] = { - 0xc0, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, - 0x7f, 0x7f, 0x01, 0x40, 0x7f, 0x7f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, - 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01, 0x00, 0x00}; -static const unsigned char mcur_cross_bits[] = { - 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, - 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, - 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0x00, 0x00}; - -static const uchar cur_ibeam_bits[] = { - 0x00, 0x00, 0xe0, 0x03, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, - 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, - 0x80, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00 }; -static const uchar mcur_ibeam_bits[] = { - 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, - 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, - 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0x00, 0x00 }; - -static const uchar cur_ver_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, - 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f, - 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00 }; -static const uchar mcur_ver_bits[] = { - 0x00, 0x00, 0x80, 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0xf8, 0x3f, - 0xfc, 0x7f, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xfc, 0x7f, 0xf8, 0x3f, - 0xf0, 0x1f, 0xe0, 0x0f, 0xc0, 0x07, 0x80, 0x03 }; - -static const uchar cur_hor_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x30, 0x18, - 0x38, 0x38, 0xfc, 0x7f, 0xfc, 0x7f, 0x38, 0x38, 0x30, 0x18, 0x20, 0x08, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar mcur_hor_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x40, 0x04, 0x60, 0x0c, 0x70, 0x1c, 0x78, 0x3c, - 0xfc, 0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfc, 0x7f, 0x78, 0x3c, - 0x70, 0x1c, 0x60, 0x0c, 0x40, 0x04, 0x00, 0x00 }; -static const uchar cur_bdiag_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x3e, 0x00, 0x3c, 0x00, 0x3e, - 0x00, 0x37, 0x88, 0x23, 0xd8, 0x01, 0xf8, 0x00, 0x78, 0x00, 0xf8, 0x00, - 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar mcur_bdiag_bits[] = { - 0x00, 0x00, 0xc0, 0x7f, 0x80, 0x7f, 0x00, 0x7f, 0x00, 0x7e, 0x04, 0x7f, - 0x8c, 0x7f, 0xdc, 0x77, 0xfc, 0x63, 0xfc, 0x41, 0xfc, 0x00, 0xfc, 0x01, - 0xfc, 0x03, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00 }; -static const uchar cur_fdiag_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0xf8, 0x00, 0x78, 0x00, - 0xf8, 0x00, 0xd8, 0x01, 0x88, 0x23, 0x00, 0x37, 0x00, 0x3e, 0x00, 0x3c, - 0x00, 0x3e, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00 }; -static const uchar mcur_fdiag_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x01, 0xfc, 0x00, - 0xfc, 0x41, 0xfc, 0x63, 0xdc, 0x77, 0x8c, 0x7f, 0x04, 0x7f, 0x00, 0x7e, - 0x00, 0x7f, 0x80, 0x7f, 0xc0, 0x7f, 0x00, 0x00 }; -static const uchar cur_blank_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -// 20 x 20 -static const uchar forbidden_bits[] = { - 0x00,0x00,0x00,0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xf0,0x00,0x38,0xc0,0x01, - 0x7c,0x80,0x03,0xec,0x00,0x03,0xce,0x01,0x07,0x86,0x03,0x06,0x06,0x07,0x06, - 0x06,0x0e,0x06,0x06,0x1c,0x06,0x0e,0x38,0x07,0x0c,0x70,0x03,0x1c,0xe0,0x03, - 0x38,0xc0,0x01,0xf0,0xe0,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00,0x00,0x00,0x00 }; - -static const uchar forbiddenm_bits[] = { - 0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xff,0x00,0xf8,0xff,0x01,0xfc,0xf0,0x03, - 0xfe,0xc0,0x07,0xfe,0x81,0x07,0xff,0x83,0x0f,0xcf,0x07,0x0f,0x8f,0x0f,0x0f, - 0x0f,0x1f,0x0f,0x0f,0x3e,0x0f,0x1f,0xfc,0x0f,0x1e,0xf8,0x07,0x3e,0xf0,0x07, - 0xfc,0xe0,0x03,0xf8,0xff,0x01,0xf0,0xff,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00}; - -// 32 x 32 -static const uchar wait_data_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, - 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x08, 0x20, 0x00, - 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, - 0x00, 0x50, 0x15, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x40, 0x05, 0x00, - 0x00, 0x80, 0x02, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x20, 0x08, 0x00, - 0x00, 0x10, 0x10, 0x00, 0x00, 0x08, 0x21, 0x00, 0x00, 0x88, 0x22, 0x00, - 0x00, 0x48, 0x25, 0x00, 0x00, 0xa8, 0x2a, 0x00, 0x00, 0xfc, 0x7f, 0x00, - 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar wait_mask_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, - 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xf8, 0x3f, 0x00, - 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, - 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xc0, 0x07, 0x00, - 0x00, 0x80, 0x03, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0xe0, 0x0f, 0x00, - 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, - 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, - 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -static const uchar hsplit_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, - 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, - 0x00, 0x41, 0x82, 0x00, 0x80, 0x41, 0x82, 0x01, 0xc0, 0x7f, 0xfe, 0x03, - 0x80, 0x41, 0x82, 0x01, 0x00, 0x41, 0x82, 0x00, 0x00, 0x40, 0x02, 0x00, - 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, - 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar hsplitm_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, - 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe3, 0xc7, 0x00, - 0x80, 0xe3, 0xc7, 0x01, 0xc0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x07, - 0xc0, 0xff, 0xff, 0x03, 0x80, 0xe3, 0xc7, 0x01, 0x00, 0xe3, 0xc7, 0x00, - 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, - 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar vsplit_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar vsplitm_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, - 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, - 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, - 0x80, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, - 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar phand_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, - 0x7e, 0x04, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x70, 0x08, 0x00, 0x00, - 0x08, 0x08, 0x00, 0x00, 0x70, 0x14, 0x00, 0x00, 0x08, 0x22, 0x00, 0x00, - 0x30, 0x41, 0x00, 0x00, 0xc0, 0x20, 0x00, 0x00, 0x40, 0x12, 0x00, 0x00, - 0x80, 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar phandm_bits[] = { - 0xfe, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, - 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, - 0xfc, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, - 0xf8, 0xff, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, - 0xc0, 0x1f, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, - 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -static const uchar size_all_data_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x80, 0x81, 0xc0, 0x00, - 0xc0, 0xff, 0xff, 0x01, 0x80, 0x81, 0xc0, 0x00, 0x00, 0x81, 0x40, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar size_all_mask_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, - 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc2, 0x21, 0x00, - 0x00, 0xc3, 0x61, 0x00, 0x80, 0xc3, 0xe1, 0x00, 0xc0, 0xff, 0xff, 0x01, - 0xe0, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0x01, 0x80, 0xc3, 0xe1, 0x00, - 0x00, 0xc3, 0x61, 0x00, 0x00, 0xc2, 0x21, 0x00, 0x00, 0xc0, 0x01, 0x00, - 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0xe0, 0x03, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -static const uchar whatsthis_bits[] = { - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0xf0, 0x07, 0x00, - 0x09, 0x18, 0x0e, 0x00, 0x11, 0x1c, 0x0e, 0x00, 0x21, 0x1c, 0x0e, 0x00, - 0x41, 0x1c, 0x0e, 0x00, 0x81, 0x1c, 0x0e, 0x00, 0x01, 0x01, 0x07, 0x00, - 0x01, 0x82, 0x03, 0x00, 0xc1, 0xc7, 0x01, 0x00, 0x49, 0xc0, 0x01, 0x00, - 0x95, 0xc0, 0x01, 0x00, 0x93, 0xc0, 0x01, 0x00, 0x21, 0x01, 0x00, 0x00, - 0x20, 0xc1, 0x01, 0x00, 0x40, 0xc2, 0x01, 0x00, 0x40, 0x02, 0x00, 0x00, - 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -static const uchar whatsthism_bits[] = { - 0x01, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x07, 0x00, 0x07, 0xf8, 0x0f, 0x00, - 0x0f, 0xfc, 0x1f, 0x00, 0x1f, 0x3e, 0x1f, 0x00, 0x3f, 0x3e, 0x1f, 0x00, - 0x7f, 0x3e, 0x1f, 0x00, 0xff, 0x3e, 0x1f, 0x00, 0xff, 0x9d, 0x0f, 0x00, - 0xff, 0xc3, 0x07, 0x00, 0xff, 0xe7, 0x03, 0x00, 0x7f, 0xe0, 0x03, 0x00, - 0xf7, 0xe0, 0x03, 0x00, 0xf3, 0xe0, 0x03, 0x00, 0xe1, 0xe1, 0x03, 0x00, - 0xe0, 0xe1, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, - 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; - -static const uchar busy_bits[] = { - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, - 0x41, 0xe0, 0xff, 0x00, 0x81, 0x20, 0x80, 0x00, 0x01, 0xe1, 0xff, 0x00, - 0x01, 0x42, 0x40, 0x00, 0xc1, 0x47, 0x40, 0x00, 0x49, 0x40, 0x55, 0x00, - 0x95, 0x80, 0x2a, 0x00, 0x93, 0x00, 0x15, 0x00, 0x21, 0x01, 0x0a, 0x00, - 0x20, 0x01, 0x11, 0x00, 0x40, 0x82, 0x20, 0x00, 0x40, 0x42, 0x44, 0x00, - 0x80, 0x41, 0x4a, 0x00, 0x00, 0x40, 0x55, 0x00, 0x00, 0xe0, 0xff, 0x00, - 0x00, 0x20, 0x80, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -static const uchar busym_bits[] = { - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, - 0x7f, 0xe0, 0xff, 0x00, 0xff, 0xe0, 0xff, 0x00, 0xff, 0xe1, 0xff, 0x00, - 0xff, 0xc3, 0x7f, 0x00, 0xff, 0xc7, 0x7f, 0x00, 0x7f, 0xc0, 0x7f, 0x00, - 0xf7, 0x80, 0x3f, 0x00, 0xf3, 0x00, 0x1f, 0x00, 0xe1, 0x01, 0x0e, 0x00, - 0xe0, 0x01, 0x1f, 0x00, 0xc0, 0x83, 0x3f, 0x00, 0xc0, 0xc3, 0x7f, 0x00, - 0x80, 0xc1, 0x7f, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0xe0, 0xff, 0x00, - 0x00, 0xe0, 0xff, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -// 16 x 16 -static const uchar openhand_bits[] = { - 0x80,0x01,0x58,0x0e,0x64,0x12,0x64,0x52,0x48,0xb2,0x48,0x92, - 0x16,0x90,0x19,0x80,0x11,0x40,0x02,0x40,0x04,0x40,0x04,0x20, - 0x08,0x20,0x10,0x10,0x20,0x10,0x00,0x00}; -static const uchar openhandm_bits[] = { - 0x80,0x01,0xd8,0x0f,0xfc,0x1f,0xfc,0x5f,0xf8,0xff,0xf8,0xff, - 0xfe,0xff,0xff,0xff,0xff,0x7f,0xfe,0x7f,0xfc,0x7f,0xfc,0x3f, - 0xf8,0x3f,0xf0,0x1f,0xe0,0x1f,0x00,0x00}; -static const uchar closedhand_bits[] = { - 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0x48,0x32,0x08,0x50, - 0x10,0x40,0x18,0x40,0x04,0x40,0x04,0x20,0x08,0x20,0x10,0x10, - 0x20,0x10,0x20,0x10,0x00,0x00,0x00,0x00}; -static const uchar closedhandm_bits[] = { - 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0xf8,0x3f,0xf8,0x7f, - 0xf0,0x7f,0xf8,0x7f,0xfc,0x7f,0xfc,0x3f,0xf8,0x3f,0xf0,0x1f, - 0xe0,0x1f,0xe0,0x1f,0x00,0x00,0x00,0x00}; - -void QGraphicsSystemCursorImage::createSystemCursor(int id) -{ - if (!systemCursorTableInit) { - for (int i = 0; i <= Qt::LastCursor; i++) - systemCursorTable[i] = 0; - systemCursorTableInit = true; - } - switch (id) { - // 16x16 cursors - case Qt::ArrowCursor: - systemCursorTable[Qt::ArrowCursor] = - new QGraphicsSystemCursorImage(cur_arrow_bits, mcur_arrow_bits, 16, 16, 0, 0); - break; - - case Qt::UpArrowCursor: - systemCursorTable[Qt::UpArrowCursor] = - new QGraphicsSystemCursorImage(cur_up_arrow_bits, mcur_up_arrow_bits, 16, 16, 7, 0); - break; - - case Qt::CrossCursor: - systemCursorTable[Qt::CrossCursor] = - new QGraphicsSystemCursorImage(cur_cross_bits, mcur_cross_bits, 16, 16, 7, 7); - break; - - case Qt::IBeamCursor: - systemCursorTable[Qt::IBeamCursor] = - new QGraphicsSystemCursorImage(cur_ibeam_bits, mcur_ibeam_bits, 16, 16, 7, 7); - break; - - case Qt::SizeVerCursor: - systemCursorTable[Qt::SizeVerCursor] = - new QGraphicsSystemCursorImage(cur_ver_bits, mcur_ver_bits, 16, 16, 7, 7); - break; - - case Qt::SizeHorCursor: - systemCursorTable[Qt::SizeHorCursor] = - new QGraphicsSystemCursorImage(cur_hor_bits, mcur_hor_bits, 16, 16, 7, 7); - break; - - case Qt::SizeBDiagCursor: - systemCursorTable[Qt::SizeBDiagCursor] = - new QGraphicsSystemCursorImage(cur_bdiag_bits, mcur_bdiag_bits, 16, 16, 7, 7); - break; - - case Qt::SizeFDiagCursor: - systemCursorTable[Qt::SizeFDiagCursor] = - new QGraphicsSystemCursorImage(cur_fdiag_bits, mcur_fdiag_bits, 16, 16, 7, 7); - break; - - case Qt::BlankCursor: - systemCursorTable[Qt::BlankCursor] = - new QGraphicsSystemCursorImage(0, 0, 0, 0, 0, 0); - break; - - // 20x20 cursors - case Qt::ForbiddenCursor: - systemCursorTable[Qt::ForbiddenCursor] = - new QGraphicsSystemCursorImage(forbidden_bits, forbiddenm_bits, 20, 20, 10, 10); - break; - - // 32x32 cursors - case Qt::WaitCursor: - systemCursorTable[Qt::WaitCursor] = - new QGraphicsSystemCursorImage(wait_data_bits, wait_mask_bits, 32, 32, 15, 15); - break; - - case Qt::SplitVCursor: - systemCursorTable[Qt::SplitVCursor] = - new QGraphicsSystemCursorImage(vsplit_bits, vsplitm_bits, 32, 32, 15, 15); - break; - - case Qt::SplitHCursor: - systemCursorTable[Qt::SplitHCursor] = - new QGraphicsSystemCursorImage(hsplit_bits, hsplitm_bits, 32, 32, 15, 15); - break; - - case Qt::SizeAllCursor: - systemCursorTable[Qt::SizeAllCursor] = - new QGraphicsSystemCursorImage(size_all_data_bits, size_all_mask_bits, 32, 32, 15, 15); - break; - - case Qt::PointingHandCursor: - systemCursorTable[Qt::PointingHandCursor] = - new QGraphicsSystemCursorImage(phand_bits, phandm_bits, 32, 32, 0, 0); - break; - - case Qt::WhatsThisCursor: - systemCursorTable[Qt::WhatsThisCursor] = - new QGraphicsSystemCursorImage(whatsthis_bits, whatsthism_bits, 32, 32, 0, 0); - break; - case Qt::BusyCursor: - systemCursorTable[Qt::BusyCursor] = - new QGraphicsSystemCursorImage(busy_bits, busym_bits, 32, 32, 0, 0); - break; - - case Qt::OpenHandCursor: - systemCursorTable[Qt::OpenHandCursor] = - new QGraphicsSystemCursorImage(openhand_bits, openhandm_bits, 16, 16, 8, 8); - break; - case Qt::ClosedHandCursor: - systemCursorTable[Qt::ClosedHandCursor] = - new QGraphicsSystemCursorImage(closedhand_bits, closedhandm_bits, 16, 16, 8, 8); - break; - default: - qWarning("Unknown system cursor %d", id); - } -} - -/*! - \fn void set(Qt::CursorShape id) - - \brief Calling this method sets the cursor image to the specified shape - - \a id is one of the defined Qt::CursorShape values. - - If id is invalid, Qt::BitmapCursor, or unknown by the implementation, - Qt::ArrowCursor is used instead. -*/ - -void QGraphicsSystemCursorImage::set(Qt::CursorShape id) -{ - QGraphicsSystemCursorImage *cursor = 0; - if (id >= 0 && id <= Qt::LastCursor) { - if (!systemCursorTable[id]) - createSystemCursor(id); - cursor = systemCursorTable[id]; - } - - if (cursor == 0) { - if (!systemCursorTable[Qt::ArrowCursor]) - createSystemCursor(Qt::ArrowCursor); - cursor = systemCursorTable[Qt::ArrowCursor]; - } - cursorImage = cursor->cursorImage; - hot = cursor->hot; -} - -/*! - \fn void set(const QImage * image, int hx, int hy) - - \brief Set the cursor image to the specified QImage, with the hotsport at (hx, hy) - - \a image A pointer to a QImage - - \a hx The x coordinate of the cursor's hotspot - - \a hy the y coordinate of the cursor's hotspot -*/ - -void QGraphicsSystemCursorImage::set(const QImage * image, int hx, int hy) -{ - hot.setX(hx); - hot.setY(hy); - cursorImage = *image; -} - -/*! - \fn set(const uchar *data, const uchar *mask, int width, int height, int hx, int hy) - - \brief set the cursor image to the graphic represented by the combination of data, mask, - width, and height - - \a data The pixel data of the graphic - - \a mask Mask data for the graphic. pixels in data with a corresponding mask bit of 0 are not drawn - - \a width The width of the graphic in pixels - - \a height The height of the graphic in pixels - - \a hx The X hotspot of the cursor graphic - - \a hy The Y hotspot of the cursor graphic -*/ -void QGraphicsSystemCursorImage::set(const uchar *data, const uchar *mask, - int width, int height, int hx, int hy) -{ - hot.setX(hx); - hot.setY(hy); - - cursorImage = QImage(width,height, QImage::Format_Indexed8); - - if (!width || !height || !data || !mask || cursorImage.isNull()) - return; - - cursorImage.setNumColors(3); - cursorImage.setColor(0, 0xff000000); - cursorImage.setColor(1, 0xffffffff); - cursorImage.setColor(2, 0x00000000); - - int bytesPerLine = (width + 7) / 8; - int p = 0; - int d, m; - - int x = -1, w = 0; - - uchar *cursor_data = cursorImage.bits(); - int bpl = cursorImage.bytesPerLine(); - for (int i = 0; i < height; i++) - { - for (int j = 0; j < bytesPerLine; j++, data++, mask++) - { - for (int b = 0; b < 8 && j*8+b < width; b++) - { - d = *data & (1 << b); - m = *mask & (1 << b); - if (d && m) p = 0; - else if (!d && m) p = 1; - else p = 2; - cursor_data[j*8+b] = p; - - // calc region - if (x < 0 && m) - x = j*8+b; - else if (x >= 0 && !m) { - x = -1; - w = 0; - } - if (m) - w++; - } - } - if (x >= 0) { - x = -1; - w = 0; - } - cursor_data += bpl; - } - -} - -/*! - \fn QGraphicsSystemCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) - - \brief set the cursor image to the graphic represented by the combination of data, mask, - width, and height - - \a data The pixel data of the graphic - - \a mask Mask data for the graphic. pixels in data with a corresponding mask bit of 0 are not drawn - - \a width The width of the graphic in pixels - - \a height The height of the graphic in pixels - - \a hotX The X hotspot of the cursor graphic - - \a hotY The Y hotspot of the cursor graphic - - \sa set -*/ - -/*! - \fn QImage *image() - - \brief Return the cursor graphic as a pointer to a QImage -*/ - -/*! - \fn QPoint hotspot - - \brief Return the cursor's hotspot -*/ - -QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystemcursor.h b/src/gui/painting/qgraphicssystemcursor.h deleted file mode 100644 index 0d57d52..0000000 --- a/src/gui/painting/qgraphicssystemcursor.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QGRAPHICSSYSTEMCURSOR_H -#define QGRAPHICSSYSTEMCURSOR_H - -#include -#include -#include -#include -#include -#include "qgraphicssystem_p.h" - -QT_BEGIN_NAMESPACE - -// Cursor graphics management -class Q_GUI_EXPORT QGraphicsSystemCursorImage { -public: - QGraphicsSystemCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) - { set(data, mask, width, height, hotX, hotY); } - QImage * image() { return &cursorImage; } - QPoint hotspot() { return hot; } - void set(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); - void set(const QImage * image, int hx, int hy); - void set(Qt::CursorShape); -private: - static void createSystemCursor(int id); - QImage cursorImage; - QPoint hot; -}; - -class Q_GUI_EXPORT QGraphicsSystemCursor : public QObject { -public: - QGraphicsSystemCursor(QGraphicsSystemScreen *); - - // input methods - virtual void pointerEvent(const QMouseEvent & event) { Q_UNUSED(event); } - virtual void changeCursor(QCursor * widgetCursor, QWidget * widget) = 0; - - static QPointer getInstance() { return instance; } - -protected: - static QPointer instance; // limit 1 cursor at a time - - QGraphicsSystemScreen * screen; // Where to request an update -}; - -QT_END_NAMESPACE - -#endif // QGRAPHICSSYSTEMCURSOR_H diff --git a/src/gui/painting/qgraphicssystemcursor_lite.cpp b/src/gui/painting/qgraphicssystemcursor_lite.cpp new file mode 100644 index 0000000..76b7d97 --- /dev/null +++ b/src/gui/painting/qgraphicssystemcursor_lite.cpp @@ -0,0 +1,654 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "qgraphicssystemcursor_lite.h" + +#include +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +QPointer QGraphicsSystemCursor::instance = 0; + +/*! + \class QGraphicsSystemCursor + + \brief The QGraphicsSystemCursor class provides information about + pointer device events (movement, buttons), and requests to change + the currently displayed cursor. + + Note that QGraphicsSystemCursor does not include any graphics for + display. An application that sets a QCursor may provide its own + graphics. + + \sa QGraphicsSystemCursorImage +*/ + +/*! + \fn virtual void pointerEvent(const QMouseEvent & event) + + This method is called by Qt whenever a QMouseEvent is generated by the + underlying pointer input. \a event is a reference to the QMouseEvent in + question. A default do-nothing implementation is provided. + + \sa QApplicationPrivate::handleMouseEvent() +*/ + +/*! + \fn virtual void changeCursor(QCursor * widgetCursor, QWidget * widget) + + \brief This method is called by Qt whenever the cursor graphic should be changed. + + Implementation of this method is mandatory for a subclass of QGraphicsSystemCursor. + + \a widgetCursor is a pointer to the QCursor that should be displayed. + + \a widget is a pointer to the widget currently displayed at QCursor::pos(). Note + that this may be 0 if the current position is not occupied by a displayed widget. + + \sa QApplicationPrivate::handleMouseEvent(), QCursor::pos() +*/ + +/*! + Constructs a QGraphicsSystemCursor + +*/ +QGraphicsSystemCursor::QGraphicsSystemCursor(QGraphicsSystemScreen *scr ) + : screen(scr) +{ + instance = this; +} + +// End of display and pointer event handling code +// Beginning of built-in cursor graphics +// from src/gui/embedded/QGraphicsSystemCursorImage_qws.cpp + +static QGraphicsSystemCursorImage *systemCursorTable[Qt::LastCursor+1]; +static bool systemCursorTableInit = false; + +// 16 x 16 +static const uchar cur_arrow_bits[] = { + 0x07, 0x00, 0x39, 0x00, 0xc1, 0x01, 0x02, 0x0e, 0x02, 0x10, 0x02, 0x08, + 0x04, 0x04, 0x04, 0x02, 0x04, 0x04, 0x88, 0x08, 0x48, 0x11, 0x28, 0x22, + 0x10, 0x44, 0x00, 0x28, 0x00, 0x10, 0x00, 0x00 }; +static const uchar mcur_arrow_bits[] = { + 0x07, 0x00, 0x3f, 0x00, 0xff, 0x01, 0xfe, 0x0f, 0xfe, 0x1f, 0xfe, 0x0f, + 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x07, 0xf8, 0x0f, 0x78, 0x1f, 0x38, 0x3e, + 0x10, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00, 0x00 }; + +static const unsigned char cur_up_arrow_bits[] = { + 0x80, 0x00, 0x40, 0x01, 0x40, 0x01, 0x20, 0x02, 0x20, 0x02, 0x10, 0x04, + 0x10, 0x04, 0x08, 0x08, 0x78, 0x0f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, + 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01}; +static const unsigned char mcur_up_arrow_bits[] = { + 0x80, 0x00, 0xc0, 0x01, 0xc0, 0x01, 0xe0, 0x03, 0xe0, 0x03, 0xf0, 0x07, + 0xf0, 0x07, 0xf8, 0x0f, 0xf8, 0x0f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01}; + +static const unsigned char cur_cross_bits[] = { + 0xc0, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, + 0x7f, 0x7f, 0x01, 0x40, 0x7f, 0x7f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, + 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01, 0x00, 0x00}; +static const unsigned char mcur_cross_bits[] = { + 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0x00, 0x00}; + +static const uchar cur_ibeam_bits[] = { + 0x00, 0x00, 0xe0, 0x03, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, + 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, + 0x80, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00 }; +static const uchar mcur_ibeam_bits[] = { + 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0x00, 0x00 }; + +static const uchar cur_ver_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f, + 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00 }; +static const uchar mcur_ver_bits[] = { + 0x00, 0x00, 0x80, 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0xf8, 0x3f, + 0xfc, 0x7f, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xfc, 0x7f, 0xf8, 0x3f, + 0xf0, 0x1f, 0xe0, 0x0f, 0xc0, 0x07, 0x80, 0x03 }; + +static const uchar cur_hor_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x30, 0x18, + 0x38, 0x38, 0xfc, 0x7f, 0xfc, 0x7f, 0x38, 0x38, 0x30, 0x18, 0x20, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar mcur_hor_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x40, 0x04, 0x60, 0x0c, 0x70, 0x1c, 0x78, 0x3c, + 0xfc, 0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfc, 0x7f, 0x78, 0x3c, + 0x70, 0x1c, 0x60, 0x0c, 0x40, 0x04, 0x00, 0x00 }; +static const uchar cur_bdiag_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x3e, 0x00, 0x3c, 0x00, 0x3e, + 0x00, 0x37, 0x88, 0x23, 0xd8, 0x01, 0xf8, 0x00, 0x78, 0x00, 0xf8, 0x00, + 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar mcur_bdiag_bits[] = { + 0x00, 0x00, 0xc0, 0x7f, 0x80, 0x7f, 0x00, 0x7f, 0x00, 0x7e, 0x04, 0x7f, + 0x8c, 0x7f, 0xdc, 0x77, 0xfc, 0x63, 0xfc, 0x41, 0xfc, 0x00, 0xfc, 0x01, + 0xfc, 0x03, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00 }; +static const uchar cur_fdiag_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0xf8, 0x00, 0x78, 0x00, + 0xf8, 0x00, 0xd8, 0x01, 0x88, 0x23, 0x00, 0x37, 0x00, 0x3e, 0x00, 0x3c, + 0x00, 0x3e, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00 }; +static const uchar mcur_fdiag_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x01, 0xfc, 0x00, + 0xfc, 0x41, 0xfc, 0x63, 0xdc, 0x77, 0x8c, 0x7f, 0x04, 0x7f, 0x00, 0x7e, + 0x00, 0x7f, 0x80, 0x7f, 0xc0, 0x7f, 0x00, 0x00 }; +static const uchar cur_blank_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +// 20 x 20 +static const uchar forbidden_bits[] = { + 0x00,0x00,0x00,0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xf0,0x00,0x38,0xc0,0x01, + 0x7c,0x80,0x03,0xec,0x00,0x03,0xce,0x01,0x07,0x86,0x03,0x06,0x06,0x07,0x06, + 0x06,0x0e,0x06,0x06,0x1c,0x06,0x0e,0x38,0x07,0x0c,0x70,0x03,0x1c,0xe0,0x03, + 0x38,0xc0,0x01,0xf0,0xe0,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00,0x00,0x00,0x00 }; + +static const uchar forbiddenm_bits[] = { + 0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xff,0x00,0xf8,0xff,0x01,0xfc,0xf0,0x03, + 0xfe,0xc0,0x07,0xfe,0x81,0x07,0xff,0x83,0x0f,0xcf,0x07,0x0f,0x8f,0x0f,0x0f, + 0x0f,0x1f,0x0f,0x0f,0x3e,0x0f,0x1f,0xfc,0x0f,0x1e,0xf8,0x07,0x3e,0xf0,0x07, + 0xfc,0xe0,0x03,0xf8,0xff,0x01,0xf0,0xff,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00}; + +// 32 x 32 +static const uchar wait_data_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, + 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x08, 0x20, 0x00, + 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, + 0x00, 0x50, 0x15, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x40, 0x05, 0x00, + 0x00, 0x80, 0x02, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x20, 0x08, 0x00, + 0x00, 0x10, 0x10, 0x00, 0x00, 0x08, 0x21, 0x00, 0x00, 0x88, 0x22, 0x00, + 0x00, 0x48, 0x25, 0x00, 0x00, 0xa8, 0x2a, 0x00, 0x00, 0xfc, 0x7f, 0x00, + 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar wait_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, + 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xf8, 0x3f, 0x00, + 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, + 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xc0, 0x07, 0x00, + 0x00, 0x80, 0x03, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0xe0, 0x0f, 0x00, + 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, + 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, + 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +static const uchar hsplit_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x41, 0x82, 0x00, 0x80, 0x41, 0x82, 0x01, 0xc0, 0x7f, 0xfe, 0x03, + 0x80, 0x41, 0x82, 0x01, 0x00, 0x41, 0x82, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar hsplitm_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, + 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe3, 0xc7, 0x00, + 0x80, 0xe3, 0xc7, 0x01, 0xc0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x07, + 0xc0, 0xff, 0xff, 0x03, 0x80, 0xe3, 0xc7, 0x01, 0x00, 0xe3, 0xc7, 0x00, + 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, + 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar vsplit_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar vsplitm_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, + 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, + 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, + 0x80, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, + 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar phand_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, + 0x7e, 0x04, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x70, 0x08, 0x00, 0x00, + 0x08, 0x08, 0x00, 0x00, 0x70, 0x14, 0x00, 0x00, 0x08, 0x22, 0x00, 0x00, + 0x30, 0x41, 0x00, 0x00, 0xc0, 0x20, 0x00, 0x00, 0x40, 0x12, 0x00, 0x00, + 0x80, 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar phandm_bits[] = { + 0xfe, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, + 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, + 0xfc, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, + 0xf8, 0xff, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, + 0xc0, 0x1f, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +static const uchar size_all_data_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x80, 0x81, 0xc0, 0x00, + 0xc0, 0xff, 0xff, 0x01, 0x80, 0x81, 0xc0, 0x00, 0x00, 0x81, 0x40, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar size_all_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, + 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc2, 0x21, 0x00, + 0x00, 0xc3, 0x61, 0x00, 0x80, 0xc3, 0xe1, 0x00, 0xc0, 0xff, 0xff, 0x01, + 0xe0, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0x01, 0x80, 0xc3, 0xe1, 0x00, + 0x00, 0xc3, 0x61, 0x00, 0x00, 0xc2, 0x21, 0x00, 0x00, 0xc0, 0x01, 0x00, + 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +static const uchar whatsthis_bits[] = { + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0xf0, 0x07, 0x00, + 0x09, 0x18, 0x0e, 0x00, 0x11, 0x1c, 0x0e, 0x00, 0x21, 0x1c, 0x0e, 0x00, + 0x41, 0x1c, 0x0e, 0x00, 0x81, 0x1c, 0x0e, 0x00, 0x01, 0x01, 0x07, 0x00, + 0x01, 0x82, 0x03, 0x00, 0xc1, 0xc7, 0x01, 0x00, 0x49, 0xc0, 0x01, 0x00, + 0x95, 0xc0, 0x01, 0x00, 0x93, 0xc0, 0x01, 0x00, 0x21, 0x01, 0x00, 0x00, + 0x20, 0xc1, 0x01, 0x00, 0x40, 0xc2, 0x01, 0x00, 0x40, 0x02, 0x00, 0x00, + 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; +static const uchar whatsthism_bits[] = { + 0x01, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x07, 0x00, 0x07, 0xf8, 0x0f, 0x00, + 0x0f, 0xfc, 0x1f, 0x00, 0x1f, 0x3e, 0x1f, 0x00, 0x3f, 0x3e, 0x1f, 0x00, + 0x7f, 0x3e, 0x1f, 0x00, 0xff, 0x3e, 0x1f, 0x00, 0xff, 0x9d, 0x0f, 0x00, + 0xff, 0xc3, 0x07, 0x00, 0xff, 0xe7, 0x03, 0x00, 0x7f, 0xe0, 0x03, 0x00, + 0xf7, 0xe0, 0x03, 0x00, 0xf3, 0xe0, 0x03, 0x00, 0xe1, 0xe1, 0x03, 0x00, + 0xe0, 0xe1, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, + 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; + +static const uchar busy_bits[] = { + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, + 0x41, 0xe0, 0xff, 0x00, 0x81, 0x20, 0x80, 0x00, 0x01, 0xe1, 0xff, 0x00, + 0x01, 0x42, 0x40, 0x00, 0xc1, 0x47, 0x40, 0x00, 0x49, 0x40, 0x55, 0x00, + 0x95, 0x80, 0x2a, 0x00, 0x93, 0x00, 0x15, 0x00, 0x21, 0x01, 0x0a, 0x00, + 0x20, 0x01, 0x11, 0x00, 0x40, 0x82, 0x20, 0x00, 0x40, 0x42, 0x44, 0x00, + 0x80, 0x41, 0x4a, 0x00, 0x00, 0x40, 0x55, 0x00, 0x00, 0xe0, 0xff, 0x00, + 0x00, 0x20, 0x80, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +static const uchar busym_bits[] = { + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, + 0x7f, 0xe0, 0xff, 0x00, 0xff, 0xe0, 0xff, 0x00, 0xff, 0xe1, 0xff, 0x00, + 0xff, 0xc3, 0x7f, 0x00, 0xff, 0xc7, 0x7f, 0x00, 0x7f, 0xc0, 0x7f, 0x00, + 0xf7, 0x80, 0x3f, 0x00, 0xf3, 0x00, 0x1f, 0x00, 0xe1, 0x01, 0x0e, 0x00, + 0xe0, 0x01, 0x1f, 0x00, 0xc0, 0x83, 0x3f, 0x00, 0xc0, 0xc3, 0x7f, 0x00, + 0x80, 0xc1, 0x7f, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0xe0, 0xff, 0x00, + 0x00, 0xe0, 0xff, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +// 16 x 16 +static const uchar openhand_bits[] = { + 0x80,0x01,0x58,0x0e,0x64,0x12,0x64,0x52,0x48,0xb2,0x48,0x92, + 0x16,0x90,0x19,0x80,0x11,0x40,0x02,0x40,0x04,0x40,0x04,0x20, + 0x08,0x20,0x10,0x10,0x20,0x10,0x00,0x00}; +static const uchar openhandm_bits[] = { + 0x80,0x01,0xd8,0x0f,0xfc,0x1f,0xfc,0x5f,0xf8,0xff,0xf8,0xff, + 0xfe,0xff,0xff,0xff,0xff,0x7f,0xfe,0x7f,0xfc,0x7f,0xfc,0x3f, + 0xf8,0x3f,0xf0,0x1f,0xe0,0x1f,0x00,0x00}; +static const uchar closedhand_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0x48,0x32,0x08,0x50, + 0x10,0x40,0x18,0x40,0x04,0x40,0x04,0x20,0x08,0x20,0x10,0x10, + 0x20,0x10,0x20,0x10,0x00,0x00,0x00,0x00}; +static const uchar closedhandm_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0xf8,0x3f,0xf8,0x7f, + 0xf0,0x7f,0xf8,0x7f,0xfc,0x7f,0xfc,0x3f,0xf8,0x3f,0xf0,0x1f, + 0xe0,0x1f,0xe0,0x1f,0x00,0x00,0x00,0x00}; + +void QGraphicsSystemCursorImage::createSystemCursor(int id) +{ + if (!systemCursorTableInit) { + for (int i = 0; i <= Qt::LastCursor; i++) + systemCursorTable[i] = 0; + systemCursorTableInit = true; + } + switch (id) { + // 16x16 cursors + case Qt::ArrowCursor: + systemCursorTable[Qt::ArrowCursor] = + new QGraphicsSystemCursorImage(cur_arrow_bits, mcur_arrow_bits, 16, 16, 0, 0); + break; + + case Qt::UpArrowCursor: + systemCursorTable[Qt::UpArrowCursor] = + new QGraphicsSystemCursorImage(cur_up_arrow_bits, mcur_up_arrow_bits, 16, 16, 7, 0); + break; + + case Qt::CrossCursor: + systemCursorTable[Qt::CrossCursor] = + new QGraphicsSystemCursorImage(cur_cross_bits, mcur_cross_bits, 16, 16, 7, 7); + break; + + case Qt::IBeamCursor: + systemCursorTable[Qt::IBeamCursor] = + new QGraphicsSystemCursorImage(cur_ibeam_bits, mcur_ibeam_bits, 16, 16, 7, 7); + break; + + case Qt::SizeVerCursor: + systemCursorTable[Qt::SizeVerCursor] = + new QGraphicsSystemCursorImage(cur_ver_bits, mcur_ver_bits, 16, 16, 7, 7); + break; + + case Qt::SizeHorCursor: + systemCursorTable[Qt::SizeHorCursor] = + new QGraphicsSystemCursorImage(cur_hor_bits, mcur_hor_bits, 16, 16, 7, 7); + break; + + case Qt::SizeBDiagCursor: + systemCursorTable[Qt::SizeBDiagCursor] = + new QGraphicsSystemCursorImage(cur_bdiag_bits, mcur_bdiag_bits, 16, 16, 7, 7); + break; + + case Qt::SizeFDiagCursor: + systemCursorTable[Qt::SizeFDiagCursor] = + new QGraphicsSystemCursorImage(cur_fdiag_bits, mcur_fdiag_bits, 16, 16, 7, 7); + break; + + case Qt::BlankCursor: + systemCursorTable[Qt::BlankCursor] = + new QGraphicsSystemCursorImage(0, 0, 0, 0, 0, 0); + break; + + // 20x20 cursors + case Qt::ForbiddenCursor: + systemCursorTable[Qt::ForbiddenCursor] = + new QGraphicsSystemCursorImage(forbidden_bits, forbiddenm_bits, 20, 20, 10, 10); + break; + + // 32x32 cursors + case Qt::WaitCursor: + systemCursorTable[Qt::WaitCursor] = + new QGraphicsSystemCursorImage(wait_data_bits, wait_mask_bits, 32, 32, 15, 15); + break; + + case Qt::SplitVCursor: + systemCursorTable[Qt::SplitVCursor] = + new QGraphicsSystemCursorImage(vsplit_bits, vsplitm_bits, 32, 32, 15, 15); + break; + + case Qt::SplitHCursor: + systemCursorTable[Qt::SplitHCursor] = + new QGraphicsSystemCursorImage(hsplit_bits, hsplitm_bits, 32, 32, 15, 15); + break; + + case Qt::SizeAllCursor: + systemCursorTable[Qt::SizeAllCursor] = + new QGraphicsSystemCursorImage(size_all_data_bits, size_all_mask_bits, 32, 32, 15, 15); + break; + + case Qt::PointingHandCursor: + systemCursorTable[Qt::PointingHandCursor] = + new QGraphicsSystemCursorImage(phand_bits, phandm_bits, 32, 32, 0, 0); + break; + + case Qt::WhatsThisCursor: + systemCursorTable[Qt::WhatsThisCursor] = + new QGraphicsSystemCursorImage(whatsthis_bits, whatsthism_bits, 32, 32, 0, 0); + break; + case Qt::BusyCursor: + systemCursorTable[Qt::BusyCursor] = + new QGraphicsSystemCursorImage(busy_bits, busym_bits, 32, 32, 0, 0); + break; + + case Qt::OpenHandCursor: + systemCursorTable[Qt::OpenHandCursor] = + new QGraphicsSystemCursorImage(openhand_bits, openhandm_bits, 16, 16, 8, 8); + break; + case Qt::ClosedHandCursor: + systemCursorTable[Qt::ClosedHandCursor] = + new QGraphicsSystemCursorImage(closedhand_bits, closedhandm_bits, 16, 16, 8, 8); + break; + default: + qWarning("Unknown system cursor %d", id); + } +} + +/*! + \fn void set(Qt::CursorShape id) + + \brief Calling this method sets the cursor image to the specified shape + + \a id is one of the defined Qt::CursorShape values. + + If id is invalid, Qt::BitmapCursor, or unknown by the implementation, + Qt::ArrowCursor is used instead. +*/ + +void QGraphicsSystemCursorImage::set(Qt::CursorShape id) +{ + QGraphicsSystemCursorImage *cursor = 0; + if (id >= 0 && id <= Qt::LastCursor) { + if (!systemCursorTable[id]) + createSystemCursor(id); + cursor = systemCursorTable[id]; + } + + if (cursor == 0) { + if (!systemCursorTable[Qt::ArrowCursor]) + createSystemCursor(Qt::ArrowCursor); + cursor = systemCursorTable[Qt::ArrowCursor]; + } + cursorImage = cursor->cursorImage; + hot = cursor->hot; +} + +/*! + \fn void set(const QImage * image, int hx, int hy) + + \brief Set the cursor image to the specified QImage, with the hotsport at (hx, hy) + + \a image A pointer to a QImage + + \a hx The x coordinate of the cursor's hotspot + + \a hy the y coordinate of the cursor's hotspot +*/ + +void QGraphicsSystemCursorImage::set(const QImage * image, int hx, int hy) +{ + hot.setX(hx); + hot.setY(hy); + cursorImage = *image; +} + +/*! + \fn set(const uchar *data, const uchar *mask, int width, int height, int hx, int hy) + + \brief set the cursor image to the graphic represented by the combination of data, mask, + width, and height + + \a data The pixel data of the graphic + + \a mask Mask data for the graphic. pixels in data with a corresponding mask bit of 0 are not drawn + + \a width The width of the graphic in pixels + + \a height The height of the graphic in pixels + + \a hx The X hotspot of the cursor graphic + + \a hy The Y hotspot of the cursor graphic +*/ +void QGraphicsSystemCursorImage::set(const uchar *data, const uchar *mask, + int width, int height, int hx, int hy) +{ + hot.setX(hx); + hot.setY(hy); + + cursorImage = QImage(width,height, QImage::Format_Indexed8); + + if (!width || !height || !data || !mask || cursorImage.isNull()) + return; + + cursorImage.setNumColors(3); + cursorImage.setColor(0, 0xff000000); + cursorImage.setColor(1, 0xffffffff); + cursorImage.setColor(2, 0x00000000); + + int bytesPerLine = (width + 7) / 8; + int p = 0; + int d, m; + + int x = -1, w = 0; + + uchar *cursor_data = cursorImage.bits(); + int bpl = cursorImage.bytesPerLine(); + for (int i = 0; i < height; i++) + { + for (int j = 0; j < bytesPerLine; j++, data++, mask++) + { + for (int b = 0; b < 8 && j*8+b < width; b++) + { + d = *data & (1 << b); + m = *mask & (1 << b); + if (d && m) p = 0; + else if (!d && m) p = 1; + else p = 2; + cursor_data[j*8+b] = p; + + // calc region + if (x < 0 && m) + x = j*8+b; + else if (x >= 0 && !m) { + x = -1; + w = 0; + } + if (m) + w++; + } + } + if (x >= 0) { + x = -1; + w = 0; + } + cursor_data += bpl; + } + +} + +/*! + \fn QGraphicsSystemCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) + + \brief set the cursor image to the graphic represented by the combination of data, mask, + width, and height + + \a data The pixel data of the graphic + + \a mask Mask data for the graphic. pixels in data with a corresponding mask bit of 0 are not drawn + + \a width The width of the graphic in pixels + + \a height The height of the graphic in pixels + + \a hotX The X hotspot of the cursor graphic + + \a hotY The Y hotspot of the cursor graphic + + \sa set +*/ + +/*! + \fn QImage *image() + + \brief Return the cursor graphic as a pointer to a QImage +*/ + +/*! + \fn QPoint hotspot + + \brief Return the cursor's hotspot +*/ + +QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystemcursor_lite.h b/src/gui/painting/qgraphicssystemcursor_lite.h new file mode 100644 index 0000000..0d57d52 --- /dev/null +++ b/src/gui/painting/qgraphicssystemcursor_lite.h @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QGRAPHICSSYSTEMCURSOR_H +#define QGRAPHICSSYSTEMCURSOR_H + +#include +#include +#include +#include +#include +#include "qgraphicssystem_p.h" + +QT_BEGIN_NAMESPACE + +// Cursor graphics management +class Q_GUI_EXPORT QGraphicsSystemCursorImage { +public: + QGraphicsSystemCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) + { set(data, mask, width, height, hotX, hotY); } + QImage * image() { return &cursorImage; } + QPoint hotspot() { return hot; } + void set(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); + void set(const QImage * image, int hx, int hy); + void set(Qt::CursorShape); +private: + static void createSystemCursor(int id); + QImage cursorImage; + QPoint hot; +}; + +class Q_GUI_EXPORT QGraphicsSystemCursor : public QObject { +public: + QGraphicsSystemCursor(QGraphicsSystemScreen *); + + // input methods + virtual void pointerEvent(const QMouseEvent & event) { Q_UNUSED(event); } + virtual void changeCursor(QCursor * widgetCursor, QWidget * widget) = 0; + + static QPointer getInstance() { return instance; } + +protected: + static QPointer instance; // limit 1 cursor at a time + + QGraphicsSystemScreen * screen; // Where to request an update +}; + +QT_END_NAMESPACE + +#endif // QGRAPHICSSYSTEMCURSOR_H diff --git a/src/plugins/graphicssystems/fb_base/fb_base.cpp b/src/plugins/graphicssystems/fb_base/fb_base.cpp index 6567e95..da7ddb8 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.cpp +++ b/src/plugins/graphicssystems/fb_base/fb_base.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include QGraphicsSystemSoftwareCursor::QGraphicsSystemSoftwareCursor(QGraphicsSystemScreen *scr) diff --git a/src/plugins/graphicssystems/fb_base/fb_base.h b/src/plugins/graphicssystems/fb_base/fb_base.h index c46a99d..8b130d2 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.h +++ b/src/plugins/graphicssystems/fb_base/fb_base.h @@ -6,7 +6,7 @@ #include #include #include -#include +#include class QMouseEvent; class QSize; diff --git a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp index ed8f883..92e0ebc 100644 --- a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp +++ b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp @@ -44,7 +44,7 @@ #include #include -#include +#include #include "x11util.h" -- cgit v0.12 From e6b9bc4c4269be040c947a464acf2b5c65ba38cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 8 Mar 2010 16:55:29 +0100 Subject: Minimaldfb: cleanup how to compile Add variables DIRECTFB_LIBS and DIRECTFB_INCLUDEPATH to your mkspec --- src/plugins/graphicssystems/minimaldfb/minimaldfb.pro | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro b/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro index f5d2406..b6c2ea8 100644 --- a/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro +++ b/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro @@ -2,18 +2,14 @@ TARGET = qminimaldfb include(../../qpluginbase.pri) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems -system(pkg-config --exists directfb) { - DIRECTFB_CFLAGS = $$system(pkg-config --cflags directfb) - DIRECTFB_LIBS = $$system(pkg-config --libs directfb) -} else { - directfb_config = $$SYSTEM(which directfb-config) - !isEmpty(directfb_config) { - DIRECTFB_CFLAGS = $$system(directfb-config --cflags) - DIRECTFB_LIBS = $$system(directfb-config --libs) - } +isEmpty(DIRECTFB_LIBS) { + DIRECTFB_LIBS = -ldirectfb -lfusion -ldirect -lpthread +} +isEmpty(DIRECTFB_INCLUDEPATH) { + DIRECTFB_INCLUDEPATH = /usr/include/directfb } -QMAKE_CXXFLAGS += $$DIRECTFB_CFLAGS +INCLUDEPATH += $$DIRECTFB_INCLUDEPATH LIBS += $$DIRECTFB_LIBS SOURCES = main.cpp \ -- cgit v0.12 From b9f8c1491550fe671d1809481ad7f70737034a3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 8 Mar 2010 16:57:54 +0100 Subject: LinuxFb: call initDevice So you turn off the cursor blinking and remove redundant forward class declaration --- src/plugins/graphicssystems/fb_base/fb_base.h | 1 - src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/graphicssystems/fb_base/fb_base.h b/src/plugins/graphicssystems/fb_base/fb_base.h index 8b130d2..91b6d12 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.h +++ b/src/plugins/graphicssystems/fb_base/fb_base.h @@ -12,7 +12,6 @@ class QMouseEvent; class QSize; class QPainter; -class QGraphicsSystemFbWindowSurface; class QGraphicsSystemFbScreen; class QGraphicsSystemSoftwareCursor : public QGraphicsSystemCursor diff --git a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp index f5ca6e7..a373ba8 100644 --- a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp +++ b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp @@ -164,6 +164,7 @@ QLinuxFbGraphicsSystem::QLinuxFbGraphicsSystem() if (!connect(displaySpec)) qFatal("QLinuxFbGraphicsSystem: could not initialize screen"); + initDevice(); // Create a QImage directly on the screen's framebuffer. // This is the blit target for copying windows to the screen. -- cgit v0.12 From cf841986a5941047a37548c83810c96bcd600539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 11 Mar 2010 14:41:28 +0100 Subject: Make QNativeImage use the screen format --- src/gui/image/qnativeimage.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp index 8446387..3420778 100644 --- a/src/gui/image/qnativeimage.cpp +++ b/src/gui/image/qnativeimage.cpp @@ -45,6 +45,9 @@ #include "private/qpaintengine_raster_p.h" +#include "private/qapplication_p.h" +#include "private/qgraphicssystem_p.h" + #if defined(Q_WS_X11) && !defined(QT_NO_MITSHM) #include #include @@ -284,7 +287,11 @@ QNativeImage::~QNativeImage() QImage::Format QNativeImage::systemFormat() { +#ifdef Q_WS_LITE + return QApplicationPrivate::graphicsSystem()->screens().at(0)->format(); +#else return QImage::Format_RGB32; +#endif } #endif // platforms -- cgit v0.12 From a029628b5e626f4213031427aec0f62ffbef4cab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 15 Mar 2010 15:12:37 +0100 Subject: Add blendfunctions for "all" depths on all platforms and not only QWS --- src/gui/painting/qdrawhelper.cpp | 90 ++++++++++++++++++++-------------------- src/gui/painting/qdrawhelper_p.h | 2 - 2 files changed, 45 insertions(+), 47 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 581b538..fd1ac00 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -4676,7 +4676,7 @@ void QT_FASTCALL blendUntransformed(int count, const QSpan *spans, void *userDat static void blend_untransformed_rgb888(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_24) +#if defined(QT_QWS_DEPTH_24) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_RGB888) @@ -4689,7 +4689,7 @@ static void blend_untransformed_rgb888(int count, const QSpan *spans, static void blend_untransformed_argb6666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) +#if defined(QT_QWS_DEPTH_18) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -4704,7 +4704,7 @@ static void blend_untransformed_argb6666(int count, const QSpan *spans, static void blend_untransformed_rgb666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) +#if defined(QT_QWS_DEPTH_18) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -4719,7 +4719,7 @@ static void blend_untransformed_rgb666(int count, const QSpan *spans, static void blend_untransformed_argb8565(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_16) +#if defined(QT_QWS_DEPTH_16) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -4734,7 +4734,7 @@ static void blend_untransformed_argb8565(int count, const QSpan *spans, static void blend_untransformed_rgb565(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_16) +#if defined(QT_QWS_DEPTH_16) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -4749,7 +4749,7 @@ static void blend_untransformed_rgb565(int count, const QSpan *spans, static void blend_untransformed_argb8555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) +#if defined(QT_QWS_DEPTH_15) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -4764,7 +4764,7 @@ static void blend_untransformed_argb8555(int count, const QSpan *spans, static void blend_untransformed_rgb555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) +#if defined(QT_QWS_DEPTH_15) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -4779,7 +4779,7 @@ static void blend_untransformed_rgb555(int count, const QSpan *spans, static void blend_untransformed_argb4444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) +#if defined(QT_QWS_DEPTH_12) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -4794,7 +4794,7 @@ static void blend_untransformed_argb4444(int count, const QSpan *spans, static void blend_untransformed_rgb444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) +#if defined(QT_QWS_DEPTH_12) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -5018,7 +5018,7 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTiled(int count, const QSpan *spans, void * static void blend_tiled_rgb888(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_24) +#if defined(QT_QWS_DEPTH_24) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_RGB888) @@ -5030,7 +5030,7 @@ static void blend_tiled_rgb888(int count, const QSpan *spans, void *userData) static void blend_tiled_argb6666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) +#if defined(QT_QWS_DEPTH_18) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -5044,7 +5044,7 @@ static void blend_tiled_argb6666(int count, const QSpan *spans, void *userData) static void blend_tiled_rgb666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) +#if defined(QT_QWS_DEPTH_18) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -5058,7 +5058,7 @@ static void blend_tiled_rgb666(int count, const QSpan *spans, void *userData) static void blend_tiled_argb8565(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_16) +#if defined(QT_QWS_DEPTH_16) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -5072,7 +5072,7 @@ static void blend_tiled_argb8565(int count, const QSpan *spans, void *userData) static void blend_tiled_rgb565(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_16) +#if defined(QT_QWS_DEPTH_16) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -5086,7 +5086,7 @@ static void blend_tiled_rgb565(int count, const QSpan *spans, void *userData) static void blend_tiled_argb8555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) +#if defined(QT_QWS_DEPTH_15) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -5100,7 +5100,7 @@ static void blend_tiled_argb8555(int count, const QSpan *spans, void *userData) static void blend_tiled_rgb555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) +#if defined(QT_QWS_DEPTH_15) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -5114,7 +5114,7 @@ static void blend_tiled_rgb555(int count, const QSpan *spans, void *userData) static void blend_tiled_argb4444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) +#if defined(QT_QWS_DEPTH_12) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -5128,7 +5128,7 @@ static void blend_tiled_argb4444(int count, const QSpan *spans, void *userData) static void blend_tiled_rgb444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) +#if defined(QT_QWS_DEPTH_12) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -5522,7 +5522,7 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTransformedBilinear(int count, const QSpan static void blend_transformed_bilinear_rgb888(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_24) +#if defined(QT_QWS_DEPTH_24) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_RGB888) @@ -5534,7 +5534,7 @@ static void blend_transformed_bilinear_rgb888(int count, const QSpan *spans, voi static void blend_transformed_bilinear_argb6666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) +#if defined(QT_QWS_DEPTH_18) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -5548,7 +5548,7 @@ static void blend_transformed_bilinear_argb6666(int count, const QSpan *spans, v static void blend_transformed_bilinear_rgb666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) +#if defined(QT_QWS_DEPTH_18) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -5562,7 +5562,7 @@ static void blend_transformed_bilinear_rgb666(int count, const QSpan *spans, voi static void blend_transformed_bilinear_argb8565(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_16) +#if defined(QT_QWS_DEPTH_16) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -5577,7 +5577,7 @@ static void blend_transformed_bilinear_argb8565(int count, const QSpan *spans, v static void blend_transformed_bilinear_rgb565(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_16) +#if defined(QT_QWS_DEPTH_16) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_RGB16) @@ -5591,7 +5591,7 @@ static void blend_transformed_bilinear_rgb565(int count, const QSpan *spans, static void blend_transformed_bilinear_argb8555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) +#if defined(QT_QWS_DEPTH_15) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -5605,7 +5605,7 @@ static void blend_transformed_bilinear_argb8555(int count, const QSpan *spans, v static void blend_transformed_bilinear_rgb555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) +#if defined(QT_QWS_DEPTH_15) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -5619,7 +5619,7 @@ static void blend_transformed_bilinear_rgb555(int count, const QSpan *spans, voi static void blend_transformed_bilinear_argb4444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) +#if defined(QT_QWS_DEPTH_12) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -5633,7 +5633,7 @@ static void blend_transformed_bilinear_argb4444(int count, const QSpan *spans, v static void blend_transformed_bilinear_rgb444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) +#if defined(QT_QWS_DEPTH_12) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -6106,7 +6106,7 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTransformed(int count, const QSpan *spans, static void blend_transformed_rgb888(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_24) +#if defined(QT_QWS_DEPTH_24) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_RGB888) @@ -6119,7 +6119,7 @@ static void blend_transformed_rgb888(int count, const QSpan *spans, static void blend_transformed_argb6666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) +#if defined(QT_QWS_DEPTH_18) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -6134,7 +6134,7 @@ static void blend_transformed_argb6666(int count, const QSpan *spans, static void blend_transformed_rgb666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) +#if defined(QT_QWS_DEPTH_18) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -6149,7 +6149,7 @@ static void blend_transformed_rgb666(int count, const QSpan *spans, static void blend_transformed_argb8565(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_16) +#if defined(QT_QWS_DEPTH_16) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -6164,7 +6164,7 @@ static void blend_transformed_argb8565(int count, const QSpan *spans, static void blend_transformed_rgb565(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_16) +#if defined(QT_QWS_DEPTH_16) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -6179,7 +6179,7 @@ static void blend_transformed_rgb565(int count, const QSpan *spans, static void blend_transformed_argb8555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) +#if defined(QT_QWS_DEPTH_15) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -6194,7 +6194,7 @@ static void blend_transformed_argb8555(int count, const QSpan *spans, static void blend_transformed_rgb555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) +#if defined(QT_QWS_DEPTH_15) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -6209,7 +6209,7 @@ static void blend_transformed_rgb555(int count, const QSpan *spans, static void blend_transformed_argb4444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) +#if defined(QT_QWS_DEPTH_12) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -6224,7 +6224,7 @@ static void blend_transformed_argb4444(int count, const QSpan *spans, static void blend_transformed_rgb444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) +#if defined(QT_QWS_DEPTH_12) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -6519,7 +6519,7 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTransformedTiled(int count, const QSpan *sp static void blend_transformed_tiled_rgb888(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_24) +#if defined(QT_QWS_DEPTH_24) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_RGB888) @@ -6532,7 +6532,7 @@ static void blend_transformed_tiled_rgb888(int count, const QSpan *spans, static void blend_transformed_tiled_argb6666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) +#if defined(QT_QWS_DEPTH_18) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -6547,7 +6547,7 @@ static void blend_transformed_tiled_argb6666(int count, const QSpan *spans, static void blend_transformed_tiled_rgb666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) +#if defined(QT_QWS_DEPTH_18) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -6562,7 +6562,7 @@ static void blend_transformed_tiled_rgb666(int count, const QSpan *spans, static void blend_transformed_tiled_argb8565(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_16) +#if defined(QT_QWS_DEPTH_16) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -6577,7 +6577,7 @@ static void blend_transformed_tiled_argb8565(int count, const QSpan *spans, static void blend_transformed_tiled_rgb565(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_16) +#if defined(QT_QWS_DEPTH_16) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -6592,7 +6592,7 @@ static void blend_transformed_tiled_rgb565(int count, const QSpan *spans, static void blend_transformed_tiled_argb8555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) +#if defined(QT_QWS_DEPTH_15) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -6607,7 +6607,7 @@ static void blend_transformed_tiled_argb8555(int count, const QSpan *spans, static void blend_transformed_tiled_rgb555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) +#if defined(QT_QWS_DEPTH_15) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -6622,7 +6622,7 @@ static void blend_transformed_tiled_rgb555(int count, const QSpan *spans, static void blend_transformed_tiled_argb4444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) +#if defined(QT_QWS_DEPTH_12) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -6637,7 +6637,7 @@ static void blend_transformed_tiled_argb4444(int count, const QSpan *spans, static void blend_transformed_tiled_rgb444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) +#if defined(QT_QWS_DEPTH_12) || !defined(Q_WS_QWS) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index f5b17ea..a582793 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -1618,9 +1618,7 @@ QT_TRIVIAL_MEMCONVERT_IMPL(qrgb888) QT_TRIVIAL_MEMCONVERT_IMPL(qargb6666) QT_TRIVIAL_MEMCONVERT_IMPL(qrgb666) QT_TRIVIAL_MEMCONVERT_IMPL(quint16) -#ifdef Q_WS_QWS QT_TRIVIAL_MEMCONVERT_IMPL(qrgb565) -#endif QT_TRIVIAL_MEMCONVERT_IMPL(qargb8565) QT_TRIVIAL_MEMCONVERT_IMPL(qargb8555) QT_TRIVIAL_MEMCONVERT_IMPL(qrgb555) -- cgit v0.12 From fd3688cc931b7ea69027fa98847901c8212cf3da Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 16 Mar 2010 10:56:50 +0100 Subject: Don't use the QWS install target for Lighthouse MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Jørgen Lind --- configure | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 337c59a..461a6d9 100755 --- a/configure +++ b/configure @@ -3196,7 +3196,11 @@ if [ -z "$QT_INSTALL_PREFIX" ]; then if [ "$CFG_DEV" = "yes" ]; then QT_INSTALL_PREFIX="$outpath" # In Development, we use sandboxed builds by default elif [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then - QT_INSTALL_PREFIX="/usr/local/Trolltech/QtEmbedded-${QT_VERSION}" + if [ "$PLATFORM_EMBLITE" = "yes" ]; then + QT_INSTALL_PREFIX="/usr/local/Trolltech/QtLighthouse-${QT_VERSION}" + else + QT_INSTALL_PREFIX="/usr/local/Trolltech/QtEmbedded-${QT_VERSION}" + fi if [ "$PLATFORM" != "$XPLATFORM" ]; then QT_INSTALL_PREFIX="${QT_INSTALL_PREFIX}-${CFG_ARCH}" fi -- cgit v0.12 From 349d2dd29cd6f4c90c1890e3f56850883f5ac07d Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 18 Mar 2010 14:23:04 +0100 Subject: Revert "Add blendfunctions for "all" depths on all platforms" Details: It turns out that the original code is more accurate and in most cases faster as well. This reverts commit a029628b5e626f4213031427aec0f62ffbef4cab. --- src/gui/painting/qdrawhelper.cpp | 90 ++++++++++++++++++++-------------------- src/gui/painting/qdrawhelper_p.h | 2 + 2 files changed, 47 insertions(+), 45 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index fd1ac00..581b538 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -4676,7 +4676,7 @@ void QT_FASTCALL blendUntransformed(int count, const QSpan *spans, void *userDat static void blend_untransformed_rgb888(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_24) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_24) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_RGB888) @@ -4689,7 +4689,7 @@ static void blend_untransformed_rgb888(int count, const QSpan *spans, static void blend_untransformed_argb6666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_18) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -4704,7 +4704,7 @@ static void blend_untransformed_argb6666(int count, const QSpan *spans, static void blend_untransformed_rgb666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_18) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -4719,7 +4719,7 @@ static void blend_untransformed_rgb666(int count, const QSpan *spans, static void blend_untransformed_argb8565(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_16) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -4734,7 +4734,7 @@ static void blend_untransformed_argb8565(int count, const QSpan *spans, static void blend_untransformed_rgb565(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_16) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -4749,7 +4749,7 @@ static void blend_untransformed_rgb565(int count, const QSpan *spans, static void blend_untransformed_argb8555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_15) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -4764,7 +4764,7 @@ static void blend_untransformed_argb8555(int count, const QSpan *spans, static void blend_untransformed_rgb555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_15) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -4779,7 +4779,7 @@ static void blend_untransformed_rgb555(int count, const QSpan *spans, static void blend_untransformed_argb4444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_12) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -4794,7 +4794,7 @@ static void blend_untransformed_argb4444(int count, const QSpan *spans, static void blend_untransformed_rgb444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_12) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -5018,7 +5018,7 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTiled(int count, const QSpan *spans, void * static void blend_tiled_rgb888(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_24) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_24) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_RGB888) @@ -5030,7 +5030,7 @@ static void blend_tiled_rgb888(int count, const QSpan *spans, void *userData) static void blend_tiled_argb6666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_18) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -5044,7 +5044,7 @@ static void blend_tiled_argb6666(int count, const QSpan *spans, void *userData) static void blend_tiled_rgb666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_18) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -5058,7 +5058,7 @@ static void blend_tiled_rgb666(int count, const QSpan *spans, void *userData) static void blend_tiled_argb8565(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_16) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -5072,7 +5072,7 @@ static void blend_tiled_argb8565(int count, const QSpan *spans, void *userData) static void blend_tiled_rgb565(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_16) || !defined(Q_WS_QWS) +#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -5086,7 +5086,7 @@ static void blend_tiled_rgb565(int count, const QSpan *spans, void *userData) static void blend_tiled_argb8555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_15) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -5100,7 +5100,7 @@ static void blend_tiled_argb8555(int count, const QSpan *spans, void *userData) static void blend_tiled_rgb555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_15) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -5114,7 +5114,7 @@ static void blend_tiled_rgb555(int count, const QSpan *spans, void *userData) static void blend_tiled_argb4444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_12) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -5128,7 +5128,7 @@ static void blend_tiled_argb4444(int count, const QSpan *spans, void *userData) static void blend_tiled_rgb444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_12) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -5522,7 +5522,7 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTransformedBilinear(int count, const QSpan static void blend_transformed_bilinear_rgb888(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_24) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_24) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_RGB888) @@ -5534,7 +5534,7 @@ static void blend_transformed_bilinear_rgb888(int count, const QSpan *spans, voi static void blend_transformed_bilinear_argb6666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_18) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -5548,7 +5548,7 @@ static void blend_transformed_bilinear_argb6666(int count, const QSpan *spans, v static void blend_transformed_bilinear_rgb666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_18) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -5562,7 +5562,7 @@ static void blend_transformed_bilinear_rgb666(int count, const QSpan *spans, voi static void blend_transformed_bilinear_argb8565(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_16) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -5577,7 +5577,7 @@ static void blend_transformed_bilinear_argb8565(int count, const QSpan *spans, v static void blend_transformed_bilinear_rgb565(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_16) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_RGB16) @@ -5591,7 +5591,7 @@ static void blend_transformed_bilinear_rgb565(int count, const QSpan *spans, static void blend_transformed_bilinear_argb8555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_15) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -5605,7 +5605,7 @@ static void blend_transformed_bilinear_argb8555(int count, const QSpan *spans, v static void blend_transformed_bilinear_rgb555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_15) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -5619,7 +5619,7 @@ static void blend_transformed_bilinear_rgb555(int count, const QSpan *spans, voi static void blend_transformed_bilinear_argb4444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_12) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -5633,7 +5633,7 @@ static void blend_transformed_bilinear_argb4444(int count, const QSpan *spans, v static void blend_transformed_bilinear_rgb444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_12) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -6106,7 +6106,7 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTransformed(int count, const QSpan *spans, static void blend_transformed_rgb888(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_24) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_24) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_RGB888) @@ -6119,7 +6119,7 @@ static void blend_transformed_rgb888(int count, const QSpan *spans, static void blend_transformed_argb6666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_18) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -6134,7 +6134,7 @@ static void blend_transformed_argb6666(int count, const QSpan *spans, static void blend_transformed_rgb666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_18) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -6149,7 +6149,7 @@ static void blend_transformed_rgb666(int count, const QSpan *spans, static void blend_transformed_argb8565(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_16) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -6164,7 +6164,7 @@ static void blend_transformed_argb8565(int count, const QSpan *spans, static void blend_transformed_rgb565(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_16) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -6179,7 +6179,7 @@ static void blend_transformed_rgb565(int count, const QSpan *spans, static void blend_transformed_argb8555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_15) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -6194,7 +6194,7 @@ static void blend_transformed_argb8555(int count, const QSpan *spans, static void blend_transformed_rgb555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_15) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -6209,7 +6209,7 @@ static void blend_transformed_rgb555(int count, const QSpan *spans, static void blend_transformed_argb4444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_12) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -6224,7 +6224,7 @@ static void blend_transformed_argb4444(int count, const QSpan *spans, static void blend_transformed_rgb444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_12) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -6519,7 +6519,7 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTransformedTiled(int count, const QSpan *sp static void blend_transformed_tiled_rgb888(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_24) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_24) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_RGB888) @@ -6532,7 +6532,7 @@ static void blend_transformed_tiled_rgb888(int count, const QSpan *spans, static void blend_transformed_tiled_argb6666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_18) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -6547,7 +6547,7 @@ static void blend_transformed_tiled_argb6666(int count, const QSpan *spans, static void blend_transformed_tiled_rgb666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_18) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -6562,7 +6562,7 @@ static void blend_transformed_tiled_rgb666(int count, const QSpan *spans, static void blend_transformed_tiled_argb8565(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_16) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -6577,7 +6577,7 @@ static void blend_transformed_tiled_argb8565(int count, const QSpan *spans, static void blend_transformed_tiled_rgb565(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_16) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -6592,7 +6592,7 @@ static void blend_transformed_tiled_rgb565(int count, const QSpan *spans, static void blend_transformed_tiled_argb8555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_15) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -6607,7 +6607,7 @@ static void blend_transformed_tiled_argb8555(int count, const QSpan *spans, static void blend_transformed_tiled_rgb555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_15) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -6622,7 +6622,7 @@ static void blend_transformed_tiled_rgb555(int count, const QSpan *spans, static void blend_transformed_tiled_argb4444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_12) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -6637,7 +6637,7 @@ static void blend_transformed_tiled_argb4444(int count, const QSpan *spans, static void blend_transformed_tiled_rgb444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) || !defined(Q_WS_QWS) +#if defined(QT_QWS_DEPTH_12) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index a582793..f5b17ea 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -1618,7 +1618,9 @@ QT_TRIVIAL_MEMCONVERT_IMPL(qrgb888) QT_TRIVIAL_MEMCONVERT_IMPL(qargb6666) QT_TRIVIAL_MEMCONVERT_IMPL(qrgb666) QT_TRIVIAL_MEMCONVERT_IMPL(quint16) +#ifdef Q_WS_QWS QT_TRIVIAL_MEMCONVERT_IMPL(qrgb565) +#endif QT_TRIVIAL_MEMCONVERT_IMPL(qargb8565) QT_TRIVIAL_MEMCONVERT_IMPL(qargb8555) QT_TRIVIAL_MEMCONVERT_IMPL(qrgb555) -- cgit v0.12 From 1bbe84eb729b9b692910720cbf0805c9e485bad0 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 24 Mar 2010 15:50:41 +0100 Subject: don't draw changes under opaque windows --- src/plugins/graphicssystems/fb_base/fb_base.cpp | 106 +++++++++++++++++---- src/plugins/graphicssystems/fb_base/fb_base.h | 12 ++- .../linuxfb/qgraphicssystem_linuxfb.cpp | 16 +++- .../linuxfb/qgraphicssystem_linuxfb.h | 2 + 4 files changed, 114 insertions(+), 22 deletions(-) diff --git a/src/plugins/graphicssystems/fb_base/fb_base.cpp b/src/plugins/graphicssystems/fb_base/fb_base.cpp index da7ddb8..c1ce817 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.cpp +++ b/src/plugins/graphicssystems/fb_base/fb_base.cpp @@ -81,7 +81,7 @@ void QGraphicsSystemSoftwareCursor::changeCursor(QCursor * widgetCursor, QWidget screen->setDirty(currentRect); } -QGraphicsSystemFbScreen::QGraphicsSystemFbScreen() : cursor(0), mGeometry(), mDepth(16), mFormat(QImage::Format_RGB16), mScreenImage(0) +QGraphicsSystemFbScreen::QGraphicsSystemFbScreen() : cursor(0), mGeometry(), mDepth(16), mFormat(QImage::Format_RGB16), mScreenImage(0), compositePainter(0), isUpToDate(false) { mScreenImage = new QImage(mGeometry.size(), mFormat); redrawTimer.setSingleShot(true); @@ -94,6 +94,9 @@ void QGraphicsSystemFbScreen::setGeometry(QRect rect) delete mScreenImage; mGeometry = rect; mScreenImage = new QImage(mGeometry.size(), mFormat); + delete compositePainter; + compositePainter = 0; + invalidateRectCache(); } void QGraphicsSystemFbScreen::setDepth(int depth) @@ -111,10 +114,13 @@ void QGraphicsSystemFbScreen::setFormat(QImage::Format format) mFormat = format; delete mScreenImage; mScreenImage = new QImage(mGeometry.size(), mFormat); + delete compositePainter; + compositePainter = 0; } QGraphicsSystemFbScreen::~QGraphicsSystemFbScreen() { + delete compositePainter; delete mScreenImage; } @@ -126,6 +132,31 @@ void QGraphicsSystemFbScreen::setDirty(const QRect &rect) } } +void QGraphicsSystemFbScreen::generateRects() +{ + cachedRects.clear(); + QRegion remainingScreen(mGeometry); + + for (int i = 0; i < windowStack.length(); i++) { + if (remainingScreen.isEmpty()) + break; + if (!windowStack[i]->window()->testAttribute(Qt::WA_TranslucentBackground)) { + remainingScreen -= windowStack[i]->geometry(); + QRegion windowRegion(windowStack[i]->geometry()); + windowRegion -= remainingScreen; + foreach(QRect rect, windowRegion.rects()) { + cachedRects += QPair(rect, i); + } + } + } + foreach (QRect rect, remainingScreen.rects()) + cachedRects += QPair(rect, -1); + isUpToDate = true; + return; +} + + + QRegion QGraphicsSystemFbScreen::doRedraw() { QRegion touchedRegion; @@ -134,32 +165,65 @@ QRegion QGraphicsSystemFbScreen::doRedraw() if (repaintRegion.isEmpty()) return touchedRegion; - QPainter compositePainter(mScreenImage); QVector rects = repaintRegion.rects(); + if (!isUpToDate) + generateRects(); + + if (!compositePainter) + compositePainter = new QPainter(mScreenImage); for (int rectIndex = 0; rectIndex < repaintRegion.numRects(); rectIndex++) { - QRect rect = rects[rectIndex]; - // Blank the affected area, just in case there's nothing to display - compositePainter.fillRect(rect, Qt::black); - for (int i = windowStack.length() - 1; i >= 0; i--) { - if (!windowStack[i]->visible()) - continue; - if (windowStack[i]->window()->isMinimized()) - continue; - QRect windowRect = windowStack[i]->geometry(); - QRect intersect = windowRect.intersected(rect); - QRect windowIntersect = intersect.translated(-windowRect.left(), - -windowRect.top()); - if (intersect.isNull()) + QRegion rectRegion = rects[rectIndex]; + + for(int i = 0; i < cachedRects.length(); i++) { + QRect screenSubRect = cachedRects[i].first; + int layer = cachedRects[i].second; + QRegion intersect = rectRegion.intersected(screenSubRect); + + if (intersect.isEmpty()) continue; - compositePainter.drawImage(intersect, windowStack[i]->image(), - windowIntersect); + + rectRegion -= intersect; + + // we only expect one rectangle, but defensive coding... + foreach (QRect rect, intersect.rects()) { + bool firstLayer = true; + if (layer == -1) { + compositePainter->setCompositionMode(QPainter::CompositionMode_Source); + compositePainter->fillRect(rect, Qt::black); + compositePainter->setCompositionMode(QPainter::CompositionMode_SourceOver); + firstLayer = false; + layer = windowStack.size() - 1; + } + + for (int layerIndex = layer; layerIndex != -1; layerIndex--) { + if (!windowStack[layerIndex]->visible()) + continue; + if (windowStack[layerIndex]->window()->isMinimized()) + continue; + QRect windowRect = windowStack[layerIndex]->geometry(); + QRect windowIntersect = rect.translated(-windowRect.left(), + -windowRect.top()); + if (firstLayer) + compositePainter->setCompositionMode(QPainter::CompositionMode_Source); + compositePainter->drawImage(rect, windowStack[layerIndex]->image(), + windowIntersect); + if (firstLayer) { + compositePainter->setCompositionMode(QPainter::CompositionMode_SourceOver); + firstLayer = false; + } + } + } } + if (!rectRegion.isEmpty()) + qWarning() << "non-empty region!" << rectRegion; + // Everything on screen should be mapped to a sub-rectangle + // unless it's off the screen... } QRect cursorRect; if (cursor) { - cursorRect = cursor->drawCursor(compositePainter); + cursorRect = cursor->drawCursor(*compositePainter); touchedRegion += cursorRect; } touchedRegion += repaintRegion; @@ -171,6 +235,7 @@ QRegion QGraphicsSystemFbScreen::doRedraw() void QGraphicsSystemFbScreen::removeWindowSurface(QGraphicsSystemFbWindowSurface * surface) { windowStack.removeOne(surface); + invalidateRectCache(); setDirty(surface->geometry()); } @@ -186,6 +251,7 @@ void QGraphicsSystemFbScreen::raise(QWindowSurface * surface) if (index <= 0) return; windowStack.move(index, 0); + invalidateRectCache(); setDirty(s->geometry()); } @@ -201,6 +267,7 @@ void QGraphicsSystemFbScreen::lower(QWindowSurface * surface) if (index == -1 || index == (windowStack.size() - 1)) return; windowStack.move(index, windowStack.size() - 1); + invalidateRectCache(); setDirty(s->geometry()); } @@ -261,6 +328,7 @@ void QGraphicsSystemFbWindowSurface::setGeometry(const QRect &rect) if (mImage.size() != rect.size()) mImage = QImage(rect.size(), mScreen->format()); + mScreen->invalidateRectCache(); QWindowSystemInterface::handleGeometryChange(window(), rect); QWindowSurface::setGeometry(rect); @@ -284,12 +352,14 @@ void QGraphicsSystemFbWindowSurface::endPaint(const QRegion ®ion) void QGraphicsSystemFbWindowSurface::setVisible(bool visible) { visibleFlag = visible; + mScreen->invalidateRectCache(); mScreen->setDirty(geometry()); } Qt::WindowFlags QGraphicsSystemFbWindowSurface::setWindowFlags(Qt::WindowFlags type) { flags = type; + mScreen->invalidateRectCache(); return flags; } diff --git a/src/plugins/graphicssystems/fb_base/fb_base.h b/src/plugins/graphicssystems/fb_base/fb_base.h index 91b6d12..7f9b005 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.h +++ b/src/plugins/graphicssystems/fb_base/fb_base.h @@ -94,7 +94,8 @@ public: virtual void setDirty(const QRect &rect); virtual void removeWindowSurface(QGraphicsSystemFbWindowSurface * surface); - virtual void addWindowSurface(QGraphicsSystemFbWindowSurface * surface) { windowStack.prepend(surface); } + virtual void addWindowSurface(QGraphicsSystemFbWindowSurface * surface) { + windowStack.prepend(surface); invalidateRectCache(); } virtual void raise(QWindowSurface * surface); virtual void lower(QWindowSurface * surface); virtual QWidget * topLevelAt(const QPoint & p) const; @@ -117,6 +118,15 @@ protected: QImage::Format mFormat; QSize mPhysicalSize; QImage *mScreenImage; + +private: + QPainter * compositePainter; + void generateRects(); + QList > cachedRects; + + void invalidateRectCache() { isUpToDate = false; } + friend class QGraphicsSystemFbWindowSurface; + bool isUpToDate; }; #endif // QLIGHTHOUSEGRAPHICSSCREEN_H diff --git a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp index a373ba8..21a5da3 100644 --- a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp +++ b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp @@ -797,7 +797,7 @@ QWindowSurface *QLinuxFbGraphicsSystem::createWindowSurface(QWidget *widget) con } QLinuxFbGraphicsSystemScreen::QLinuxFbGraphicsSystemScreen(uchar * d, int w, - int h, int lstep, QImage::Format screenFormat) + int h, int lstep, QImage::Format screenFormat) : compositePainter(0) { data = d; mGeometry = QRect(0,0,w,h); @@ -817,6 +817,9 @@ void QLinuxFbGraphicsSystemScreen::setGeometry(QRect rect) delete mFbScreenImage; mFbScreenImage = new QImage(data, mGeometry.width(), mGeometry.height(), bytesPerLine, mFormat); + delete compositePainter; + compositePainter = 0; + delete mScreenImage; mScreenImage = new QImage(mGeometry.width(), mGeometry.height(), mFormat); @@ -828,6 +831,9 @@ void QLinuxFbGraphicsSystemScreen::setFormat(QImage::Format format) delete mFbScreenImage; mFbScreenImage = new QImage(data, mGeometry.width(), mGeometry.height(), bytesPerLine, mFormat); + delete compositePainter; + compositePainter = 0; + delete mScreenImage; mScreenImage = new QImage(mGeometry.width(), mGeometry.height(), mFormat); @@ -838,10 +844,14 @@ QRegion QLinuxFbGraphicsSystemScreen::doRedraw() QRegion touched; touched = QGraphicsSystemFbScreen::doRedraw(); - QPainter compositePainter(mFbScreenImage); + if (!compositePainter) { + compositePainter = new QPainter(mFbScreenImage); + compositePainter->setCompositionMode(QPainter::CompositionMode_Source); + } + QVector rects = touched.rects(); for (int i = 0; i < rects.size(); i++) - compositePainter.drawImage(rects[i], *mScreenImage, rects[i]); + compositePainter->drawImage(rects[i], *mScreenImage, rects[i]); return touched; } QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.h b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.h index f85718a..cc8ce7e 100644 --- a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.h +++ b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.h @@ -61,6 +61,8 @@ private: QImage * mFbScreenImage; uchar * data; int bytesPerLine; + + QPainter *compositePainter; }; class QLinuxFbGraphicsSystemPrivate; -- cgit v0.12 From 2c38550ddb064215f827f856110128f2bb4fd631 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Thu, 25 Mar 2010 15:00:44 +0100 Subject: don't set composition mode to source when painting the bottow layer Doing so kills performance on the painting benchmark --- src/plugins/graphicssystems/fb_base/fb_base.cpp | 5 ----- src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp | 1 - 2 files changed, 6 deletions(-) diff --git a/src/plugins/graphicssystems/fb_base/fb_base.cpp b/src/plugins/graphicssystems/fb_base/fb_base.cpp index c1ce817..d30746a 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.cpp +++ b/src/plugins/graphicssystems/fb_base/fb_base.cpp @@ -189,9 +189,7 @@ QRegion QGraphicsSystemFbScreen::doRedraw() foreach (QRect rect, intersect.rects()) { bool firstLayer = true; if (layer == -1) { - compositePainter->setCompositionMode(QPainter::CompositionMode_Source); compositePainter->fillRect(rect, Qt::black); - compositePainter->setCompositionMode(QPainter::CompositionMode_SourceOver); firstLayer = false; layer = windowStack.size() - 1; } @@ -204,12 +202,9 @@ QRegion QGraphicsSystemFbScreen::doRedraw() QRect windowRect = windowStack[layerIndex]->geometry(); QRect windowIntersect = rect.translated(-windowRect.left(), -windowRect.top()); - if (firstLayer) - compositePainter->setCompositionMode(QPainter::CompositionMode_Source); compositePainter->drawImage(rect, windowStack[layerIndex]->image(), windowIntersect); if (firstLayer) { - compositePainter->setCompositionMode(QPainter::CompositionMode_SourceOver); firstLayer = false; } } diff --git a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp index 21a5da3..44960bb 100644 --- a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp +++ b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp @@ -846,7 +846,6 @@ QRegion QLinuxFbGraphicsSystemScreen::doRedraw() if (!compositePainter) { compositePainter = new QPainter(mFbScreenImage); - compositePainter->setCompositionMode(QPainter::CompositionMode_Source); } QVector rects = touched.rects(); -- cgit v0.12 From 9e12625b31e1d95f023fe67deb50e8bf97903994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 29 Mar 2010 09:37:55 +0200 Subject: Compile fix the openkode graphicssystem Does not work well yet though :( --- src/gui/egl/qegl_lite.cpp | 23 ++++++---- src/plugins/graphicssystems/openkode/openkode.pro | 2 +- .../openkode/qgraphicssystem_openkode.cpp | 13 +++--- .../openkode/qgraphicssystem_openkode.h | 2 +- .../openkode/qwindowsurface_openkode.cpp | 51 +++++++++++++--------- .../openkode/qwindowsurface_openkode.h | 3 +- 6 files changed, 55 insertions(+), 39 deletions(-) diff --git a/src/gui/egl/qegl_lite.cpp b/src/gui/egl/qegl_lite.cpp index 60b862b..2bbf22b 100644 --- a/src/gui/egl/qegl_lite.cpp +++ b/src/gui/egl/qegl_lite.cpp @@ -42,7 +42,7 @@ #include #include #include -#include "qegl_p.h" +#include "qeglcontext_p.h" #if !defined(QT_NO_EGL) @@ -52,19 +52,26 @@ QT_BEGIN_NAMESPACE -EGLSurface QEglContext::createSurface(QPaintDevice *device, const QEglProperties *properties) +EGLNativeDisplayType QEgl::nativeDisplay() { - Q_UNUSED(device); - Q_UNUSED(properties); - return 0; + return EGLNativeDisplayType(EGL_DEFAULT_DISPLAY); +} + +EGLNativeWindowType QEgl::nativeWindow(QWidget* widget) +{ + return (EGLNativeWindowType)(widget->winId()); } -EGLDisplay QEglContext::getDisplay(QPaintDevice *device) +EGLNativePixmapType QEgl::nativePixmap(QPixmap* pixmap) { - Q_UNUSED(device); - return eglGetDisplay(EGLNativeDisplayType(EGL_DEFAULT_DISPLAY)); + return 0; } +//EGLDisplay QEglContext::display() +//{ +// return eglGetDisplay(EGLNativeDisplayType(EGL_DEFAULT_DISPLAY)); +//} + static QGraphicsSystemScreen *screenForDevice(QPaintDevice *device) { QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); diff --git a/src/plugins/graphicssystems/openkode/openkode.pro b/src/plugins/graphicssystems/openkode/openkode.pro index f8f0bcb..055048d 100644 --- a/src/plugins/graphicssystems/openkode/openkode.pro +++ b/src/plugins/graphicssystems/openkode/openkode.pro @@ -11,4 +11,4 @@ INSTALLS += target # openkode specific stuff INCLUDEPATH += $(OPENKODE_DIR)/include -LIBS += $${QMAKE_RPATH}/$(OPENKODE_DIR)/lib-target -L$(OPENKODE_DIR)/lib-target -lKD -lEGL -lGLESv2_CM +LIBS += $${QMAKE_RPATH}/$(OPENKODE_DIR)/lib-target -L$(OPENKODE_DIR)/lib-target -lKD -lEGL -lGLESv2 diff --git a/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.cpp b/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.cpp index 51364e4..7a07776 100644 --- a/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.cpp +++ b/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.cpp @@ -92,7 +92,7 @@ QOpenKODEGraphicsSystemScreen::QOpenKODEGraphicsSystemScreen() } // Once we've set up the desktop and display we don't need them anymore -// kdReleaseDisplayNV(kdDisplay); TODO!!! + kdReleaseDisplayNV(kdDisplay); kdReleaseDesktopNV(kdDesktop); const int defaultDpi = 72; @@ -102,12 +102,6 @@ QOpenKODEGraphicsSystemScreen::QOpenKODEGraphicsSystemScreen() mDepth = 24; mFormat = QImage::Format_RGB888; - if (!mContext.openDisplay(0)) { - qWarning("qEglContext: Unable to open display!"); - return; - } - - qDebug() << " - QEglContext::openDisplay OK"; QEglProperties properties; properties.setPixelFormat(QImage::Format_RGB888); @@ -119,6 +113,11 @@ QOpenKODEGraphicsSystemScreen::QOpenKODEGraphicsSystemScreen() return; } + if (!mContext.display()) { + qWarning("qEglContext: Unable to open display!"); + return; + } + qDebug() << " - QEglContext::openDisplay OK"; } diff --git a/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.h b/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.h index 972c42e..7d73ae0 100644 --- a/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.h +++ b/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.h @@ -45,7 +45,7 @@ #include #include -#include +#include # include diff --git a/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.cpp b/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.cpp index 33c76e4..b3f3965 100644 --- a/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.cpp +++ b/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.cpp @@ -51,12 +51,13 @@ QT_BEGIN_NAMESPACE QOpenKODEWindowSurface::QOpenKODEWindowSurface (QOpenKODEGraphicsSystemScreen *screen, QWidget *window) : QWindowSurface(window), - mScreen(screen) + mScreen(screen), + mSurface(0) { qDebug() << "QOpenKODEWindowSurface::QOpenKODEWindowSurface:" << window << window->width() << "x" << window->height() << "pos" << window->x() << "x" << window->y(); - if (!mContext.openDisplay(0)) { + if (!mContext.display()) { qWarning("qEglContext: Unable to open display!"); return; } @@ -76,6 +77,7 @@ QOpenKODEWindowSurface::QOpenKODEWindowSurface void QOpenKODEWindowSurface::createWindow(QWidget *window) { + qDebug() << "createWindow"; kdWindow = kdCreateWindow(mContext.display(), mContext.config(), KD_NULL); if (!kdWindow) { @@ -89,17 +91,17 @@ void QOpenKODEWindowSurface::createWindow(QWidget *window) return; } - const KDboolean windowExclusive[] = { false }; - if (kdSetWindowPropertybv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_EXCLUSIVE_NV, windowExclusive)) { - qErrnoWarning(kdGetError(), "Could not set exclusive bit"); - return; - } + //const KDboolean windowExclusive[] = { false }; + //if (kdSetWindowPropertybv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_EXCLUSIVE_NV, windowExclusive)) { + // qErrnoWarning(kdGetError(), "Could not set exclusive bit"); + // //return; + //} - const KDint windowPos[2] = { window->x(), window->y() }; - if (kdSetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { - qErrnoWarning(kdGetError(), "Could not set native window position"); - return; - } + //const KDint windowPos[2] = { window->x(), window->y() }; + //if (kdSetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { + // qErrnoWarning(kdGetError(), "Could not set native window position"); + // //return; + //} EGLNativeWindowType nativeWindow; @@ -107,24 +109,29 @@ void QOpenKODEWindowSurface::createWindow(QWidget *window) qErrnoWarning(kdGetError(), "Could not realize native window"); return; } + qDebug() << "kdRealizeWindow" << nativeWindow; // Create an EGL window surface for the native window EGLint windowAttrs[3] = { EGL_NONE }; - EGLSurface eglSurface = eglCreateWindowSurface(mContext.display(), + qDebug() << "doing createwindowsurface"; + *mSurface = eglCreateWindowSurface(mContext.display(), mContext.config(), nativeWindow, windowAttrs); - if (!eglSurface) { + qDebug() << "create windowsurface"; + if (!mSurface) { qWarning("EGL couldn't create window surface: 0x%x", eglGetError()); return; } - mContext.setSurface(eglSurface); - + qDebug() << "making context"; if (!mContext.createContext()) { qDebug() << "Unable to create context!"; return; } + + qDebug() << "about to make current"; + mContext.makeCurrent(mSurface); } QOpenKODEWindowSurface::~QOpenKODEWindowSurface() @@ -133,19 +140,20 @@ QOpenKODEWindowSurface::~QOpenKODEWindowSurface() QPaintDevice *QOpenKODEWindowSurface::paintDevice() { - //qDebug() << "QOpenKODEWindowSurface::paintDevice"; + qDebug() << "QOpenKODEWindowSurface::paintDevice"; return &mImage; } // ### TODO - this updates the entire toplevel, should only update the region -void QOpenKODEWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +void QOpenKODEWindowSurface::flush(QWidget *, const QRegion ®ion, const QPoint &offset) { + qDebug() << "in flush"; if (!offset.isNull()) { qWarning("Offset flushing not supported yet"); return; } - if (!mContext.makeCurrent()) { + if (!mContext.makeCurrent(mSurface)) { qWarning("EGL couldn't make context/surface current: 0x%x", eglGetError()); return; } @@ -222,8 +230,8 @@ void QOpenKODEWindowSurface::flush(QWidget *widget, const QRegion ®ion, const if (texId) glDeleteTextures(1, &texId); - mContext.swapBuffers(); mContext.doneCurrent(); + mContext.swapBuffers(mSurface); } void QOpenKODEWindowSurface::setGeometry(const QRect &rect) @@ -233,9 +241,10 @@ void QOpenKODEWindowSurface::setGeometry(const QRect &rect) if (mImage.size() != rect.size()) mImage = QImage(rect.size(), mScreen->format()); - mContext.destroySurface(); + mContext.destroySurface(mSurface); kdDestroyWindow(kdWindow); createWindow(window()); + qDebug() << "set geometry workded"; } bool QOpenKODEWindowSurface::scroll(const QRegion &area, int dx, int dy) diff --git a/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.h b/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.h index 1c70f55..bee94a5 100644 --- a/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.h +++ b/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.h @@ -43,7 +43,7 @@ #define QWINDOWSURFACE_OPENKODE_H #include -#include +#include QT_BEGIN_NAMESPACE @@ -68,6 +68,7 @@ private: QOpenKODEGraphicsSystemScreen *mScreen; QImage mImage; struct KDWindow *kdWindow; + EGLSurface *mSurface; QEglContext mContext; void createWindow(QWidget *window); -- cgit v0.12 From a5e1442d8960d3a9f363a8101d02e6fae804b6f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 29 Mar 2010 10:06:52 +0200 Subject: Make sure the blitter api works with Raster GS(x11 and win) and QWS --- src/gui/image/qpixmap_blitter.cpp | 9 ++- src/gui/image/qpixmap_blitter_p.h | 3 + src/gui/painting/painting.pri | 10 ++- src/gui/painting/qblittable.cpp | 64 +++++++++++++++++ src/gui/painting/qblittable_p.h | 48 +++++++++++++ src/gui/painting/qgraphicssystem_p.h | 4 +- src/gui/painting/qpaintengine_blitter.cpp | 61 ++-------------- src/gui/painting/qpaintengine_blitter_p.h | 40 ++--------- .../painting/qwindowsurface_rasterblittable.cpp | 26 +++++++ .../painting/qwindowsurface_rasterblittable_p.h | 21 ++++++ .../gfxdrivers/blittableqvfb/blittableqvfb.pro | 28 ++++++++ src/plugins/gfxdrivers/blittableqvfb/main.cpp | 81 ++++++++++++++++++++++ .../gfxdrivers/blittableqvfb/qblittable_image.h | 48 +++++++++++++ .../blittableqvfb/qgraphicssystem_blittableqvfb.h | 47 +++++++++++++ .../blittableqvfb/qscreen_blittableqvfb.h | 14 ++++ .../blittableqvfb/qwindowsurface_qwsblittable.cpp | 0 .../blittableqvfb/qwindowsurface_qwsblittable.h | 36 ++++++++++ .../graphicssystems/blittable/blittable.pro | 12 ++++ src/plugins/graphicssystems/blittable/main.cpp | 73 +++++++++++++++++++ .../graphicssystems/blittable/qblittable_image.h | 48 +++++++++++++ .../blittable/qgraphicssystem_blittable.h | 47 +++++++++++++ 21 files changed, 623 insertions(+), 97 deletions(-) create mode 100644 src/gui/painting/qblittable.cpp create mode 100644 src/gui/painting/qblittable_p.h create mode 100644 src/gui/painting/qwindowsurface_rasterblittable.cpp create mode 100644 src/gui/painting/qwindowsurface_rasterblittable_p.h create mode 100644 src/plugins/gfxdrivers/blittableqvfb/blittableqvfb.pro create mode 100644 src/plugins/gfxdrivers/blittableqvfb/main.cpp create mode 100644 src/plugins/gfxdrivers/blittableqvfb/qblittable_image.h create mode 100644 src/plugins/gfxdrivers/blittableqvfb/qgraphicssystem_blittableqvfb.h create mode 100644 src/plugins/gfxdrivers/blittableqvfb/qscreen_blittableqvfb.h create mode 100644 src/plugins/gfxdrivers/blittableqvfb/qwindowsurface_qwsblittable.cpp create mode 100644 src/plugins/gfxdrivers/blittableqvfb/qwindowsurface_qwsblittable.h create mode 100644 src/plugins/graphicssystems/blittable/blittable.pro create mode 100644 src/plugins/graphicssystems/blittable/main.cpp create mode 100644 src/plugins/graphicssystems/blittable/qblittable_image.h create mode 100644 src/plugins/graphicssystems/blittable/qgraphicssystem_blittable.h diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index a22bd8f..6dcf7c7 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -5,10 +5,13 @@ #include #include +#include #include #ifndef QT_NO_BLITTABLE +QT_BEGIN_NAMESPACE + static int global_ser_no = 0; QBlittablePixmapData::QBlittablePixmapData(QPixmapData::PixelType type) @@ -34,7 +37,7 @@ QBlittable *QBlittablePixmapData::blittable() const { if (!m_blittable) { QBlittablePixmapData *that = const_cast(this); - that->m_blittable = QApplicationPrivate::graphicsSystem()->createBlittable(QRect(0,0,w,h)); + that->m_blittable = QApplicationPrivate::graphicsSystem()->createBlittable(QSize(w,h)); } return m_blittable; @@ -42,7 +45,7 @@ QBlittable *QBlittablePixmapData::blittable() const void QBlittablePixmapData::setBlittable(QBlittable *blittable) { - resize(blittable->rect().width(),blittable->rect().height()); + resize(blittable->size().width(),blittable->size().height()); m_blittable = blittable; } @@ -259,6 +262,8 @@ QRectF QBlittablePixmapData::clipAndTransformRect(const QRectF &rect) const } return transformationRect; } + +QT_END_NAMESPACE #endif //QT_BLITTER_RASTEROVERLAY #endif //QT_NO_BLITTABLE diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h index 1d85cd3..b9f7630 100644 --- a/src/gui/image/qpixmap_blitter_p.h +++ b/src/gui/image/qpixmap_blitter_p.h @@ -5,6 +5,8 @@ #include #ifndef QT_NO_BLITTABLE +QT_BEGIN_NAMESPACE + class Q_GUI_EXPORT QBlittablePixmapData : public QPixmapData { // Q_DECLARE_PRIVATE(QBlittablePixmapData); @@ -117,5 +119,6 @@ inline void QBlittablePixmapData::unmarkRasterOverlay(const QRectF &rect) #endif } +QT_END_NAMESPACE #endif // QT_NO_BLITTABLE #endif // QPIXMAP_BLITTER_P_H diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 8e7bba7..a3fe2e1 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -89,12 +89,16 @@ SOURCES += \ painting/qpaintengine_raster.cpp \ painting/qdrawhelper.cpp \ painting/qimagescale.cpp \ - painting/qgrayraster.c + painting/qgrayraster.c \ + painting/qpaintengine_blitter.cpp \ + painting/qblittable.cpp \ HEADERS += \ painting/qpaintengine_raster_p.h \ painting/qrasterdefs_p.h \ - painting/qgrayraster_p.h + painting/qgrayraster_p.h \ + painting/qpaintengine_blitter_p.h \ + painting/qblittable_p.h \ win32 { HEADERS += painting/qprintengine_win_p.h @@ -121,12 +125,14 @@ embedded { painting/qgraphicssystemfactory_p.h \ painting/qgraphicssystemplugin_p.h \ painting/qwindowsurface_raster_p.h \ + painting/qwindowsurface_rasterblittable_p.h \ SOURCES += \ painting/qgraphicssystem_raster.cpp \ painting/qgraphicssystemfactory.cpp \ painting/qgraphicssystemplugin.cpp \ painting/qwindowsurface_raster.cpp \ + painting/qwindowsurface_rasterblittable.cpp \ } unix:x11 { diff --git a/src/gui/painting/qblittable.cpp b/src/gui/painting/qblittable.cpp new file mode 100644 index 0000000..0b2bd64 --- /dev/null +++ b/src/gui/painting/qblittable.cpp @@ -0,0 +1,64 @@ +#include "qblittable_p.h" + +#ifndef QT_NO_BLITTABLE +QT_BEGIN_NAMESPACE + +class QBlittablePrivate +{ +public: + QBlittablePrivate(const QSize &size, QBlittable::Capabilities caps) + : caps(caps), m_size(size), locked(false), cachedImg(0) + {} + QBlittable::Capabilities caps; + QSize m_size; + bool locked; + QImage *cachedImg; +}; + + +QBlittable::QBlittable(const QSize &size, Capabilities caps) + : d_ptr(new QBlittablePrivate(size,caps)) +{ +} + +QBlittable::~QBlittable() +{ + delete d_ptr; +} + + +QBlittable::Capabilities QBlittable::capabilities() const +{ + Q_D(const QBlittable); + return d->caps; +} + +QSize QBlittable::size() const +{ + Q_D(const QBlittable); + return d->m_size; +} + +QImage *QBlittable::lock() +{ + Q_D(QBlittable); + if (!d->locked) { + d->cachedImg = doLock(); + d->locked = true; + } + + return d->cachedImg; +} + +void QBlittable::unlock() +{ + Q_D(QBlittable); + if (d->locked) { + doUnlock(); + d->locked = false; + } +} + +QT_END_NAMESPACE +#endif //QT_NO_BLITTABLE + diff --git a/src/gui/painting/qblittable_p.h b/src/gui/painting/qblittable_p.h new file mode 100644 index 0000000..98caab7d --- /dev/null +++ b/src/gui/painting/qblittable_p.h @@ -0,0 +1,48 @@ +#ifndef QBLITTABLE_P_H +#define QBLITTABLE_P_H + +#include + +#ifndef QT_NO_BLITTABLE +QT_BEGIN_NAMESPACE + +class QImage; +class QBlittablePrivate; + +class Q_GUI_EXPORT QBlittable +{ + Q_DECLARE_PRIVATE(QBlittable); +public: + enum Capability { + + SolidRectCapability = 0x0001, + SourcePixmapCapability = 0x0002, + SourceOverPixmapCapability = 0x0004, + SourceOverScaledPixmapCapability = 0x0008, + + // Internal ones + OutlineCapability = 0x0001000, + }; + Q_DECLARE_FLAGS (Capabilities, Capability); + + QBlittable(const QSize &size, Capabilities caps); + virtual ~QBlittable(); + + Capabilities capabilities() const; + QSize size() const; + + virtual void fillRect(const QRectF &rect, const QColor &color) = 0; + virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect) = 0; + + QImage *lock(); + void unlock(); + +protected: + virtual QImage *doLock() = 0; + virtual void doUnlock() = 0; + QBlittablePrivate *d_ptr; +}; + +QT_END_NAMESPACE +#endif //QT_NO_BLITTABLE +#endif //QBLITTABLE_P_H diff --git a/src/gui/painting/qgraphicssystem_p.h b/src/gui/painting/qgraphicssystem_p.h index 8e35f9f..03b0f48 100644 --- a/src/gui/painting/qgraphicssystem_p.h +++ b/src/gui/painting/qgraphicssystem_p.h @@ -62,6 +62,7 @@ QT_BEGIN_NAMESPACE class QPixmapFilter; +class QBlittable; #ifdef Q_WS_LITE class Q_GUI_EXPORT QGraphicsSystemScreen : public QObject @@ -86,7 +87,7 @@ class Q_GUI_EXPORT QGraphicsSystem public: virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0; virtual QWindowSurface *createWindowSurface(QWidget *widget) const = 0; - virtual QBlittable *createBlittable(const QRect &) const { return 0; } + virtual QBlittable *createBlittable(const QSize &) const { return 0; } virtual ~QGraphicsSystem() = 0; @@ -94,6 +95,7 @@ public: virtual QList screens() const; virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const; #endif + //### Remove this & change qpixmap.cpp & qbitmap.cpp once every platform is gaurenteed // to have a graphics system. static QPixmapData *createDefaultPixmapData(QPixmapData::PixelType type); diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index 1032852..0b74a4d 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -1,10 +1,13 @@ #include "private/qpaintengine_blitter_p.h" + +#include "private/qblittable_p.h" #include "private/qpaintengine_raster_p.h" #include "private/qpainter_p.h" #include "private/qapplication_p.h" #include "private/qpixmap_blitter_p.h" #ifndef QT_NO_BLITTABLE +QT_BEGIN_NAMESPACE #define STATE_XFORM_SCALE 0x00000001 #define STATE_XFORM_COMPLEX 0x00000002 @@ -617,60 +620,6 @@ inline QRasterPaintEngine *QBlitterPaintEngine::raster() const return d->raster; } -class QBlittablePrivate -{ -public: - QBlittablePrivate(const QRect &rect, QBlittable::Capabilities caps) - : caps(caps), m_rect(rect), locked(false), cachedImg(0) - {} - QBlittable::Capabilities caps; - QRect m_rect; - bool locked; - QImage *cachedImg; -}; - - -QBlittable::QBlittable(const QRect &rect, Capabilities caps) - : d_ptr(new QBlittablePrivate(rect,caps)) -{ -} - -QBlittable::~QBlittable() -{ - delete d_ptr; -} - - -QBlittable::Capabilities QBlittable::capabilities() const -{ - Q_D(const QBlittable); - return d->caps; -} - -QRect QBlittable::rect() const -{ - Q_D(const QBlittable); - return d->m_rect; -} - -QImage *QBlittable::lock() -{ - Q_D(QBlittable); - if (!d->locked) { - d->cachedImg = doLock(); - d->locked = true; - } - - return d->cachedImg; -} - -void QBlittable::unlock() -{ - Q_D(QBlittable); - if (d->locked) { - doUnlock(); - d->locked = false; - } -} - +QT_END_NAMESPACE #endif //QT_NO_BLITTABLE + diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h index 1a2ad9e..d436993 100644 --- a/src/gui/painting/qpaintengine_blitter_p.h +++ b/src/gui/painting/qpaintengine_blitter_p.h @@ -5,45 +5,11 @@ #include "private/qpaintengine_raster_p.h" #ifndef QT_NO_BLITTABLE +QT_BEGIN_NAMESPACE -class QBlittablePrivate; class QBlitterPaintEnginePrivate; class QBlittablePixmapData; - -class Q_GUI_EXPORT QBlittable -{ - Q_DECLARE_PRIVATE(QBlittable); -public: - enum Capability { - - SolidRectCapability = 0x0001, - SourcePixmapCapability = 0x0002, - SourceOverPixmapCapability = 0x0004, - SourceOverScaledPixmapCapability = 0x0008, - - // Internal ones - OutlineCapability = 0x0001000, - }; - Q_DECLARE_FLAGS (Capabilities, Capability); - - QBlittable(const QRect &rect, Capabilities caps); - virtual ~QBlittable(); - - Capabilities capabilities() const; - QRect rect() const; - - virtual void fillRect(const QRectF &rect, const QColor &color) = 0; - virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect) = 0; - - QImage *lock(); - void unlock(); - -protected: - virtual QImage *doLock() = 0; - virtual void doUnlock() = 0; - QBlittablePrivate *d_ptr; -}; - +class QBlittable; class Q_GUI_EXPORT QBlitterPaintEngine : public QPaintEngineEx { @@ -101,5 +67,7 @@ private: }; +QT_END_NAMESPACE #endif //QT_NO_BLITTABLE #endif // QPAINTENGINE_BLITTER_P_H + diff --git a/src/gui/painting/qwindowsurface_rasterblittable.cpp b/src/gui/painting/qwindowsurface_rasterblittable.cpp new file mode 100644 index 0000000..56a79ba --- /dev/null +++ b/src/gui/painting/qwindowsurface_rasterblittable.cpp @@ -0,0 +1,26 @@ +#include "qwindowsurface_rasterblittable_p.h" + +#include +#include + +QRasterBlittableWindowSurface::QRasterBlittableWindowSurface(QWidget *widget) + : QRasterWindowSurface(widget), + m_currentImage(0), + m_blittable(0), + m_pmData(new QBlittablePixmapData(QPixmapData::PixmapType)), + m_pixmap(new QPixmap(m_pmData)) +{ +} + +QPaintDevice *QRasterBlittableWindowSurface::paintDevice() +{ + QPaintDevice *device = QRasterWindowSurface::paintDevice(); + if (m_currentImage != device) { + if (device->devType() == QInternal::Image) { + m_currentImage = static_cast(device); + m_blittable = createBlittable(m_currentImage); + m_pmData->setBlittable(m_blittable); + } + } + return m_pixmap; +} diff --git a/src/gui/painting/qwindowsurface_rasterblittable_p.h b/src/gui/painting/qwindowsurface_rasterblittable_p.h new file mode 100644 index 0000000..1e697c7 --- /dev/null +++ b/src/gui/painting/qwindowsurface_rasterblittable_p.h @@ -0,0 +1,21 @@ +#include +#include + +class QBlittable; +class QBlittablePixmapData; + +class Q_GUI_EXPORT QRasterBlittableWindowSurface : public QRasterWindowSurface +{ +public: + QRasterBlittableWindowSurface(QWidget *widget); + + virtual QBlittable *createBlittable(QImage *rasterSurface) = 0; + + QPaintDevice *paintDevice(); + +private: + QImage *m_currentImage; + QBlittable *m_blittable; + QBlittablePixmapData *m_pmData; + QPixmap *m_pixmap; +}; diff --git a/src/plugins/gfxdrivers/blittableqvfb/blittableqvfb.pro b/src/plugins/gfxdrivers/blittableqvfb/blittableqvfb.pro new file mode 100644 index 0000000..d6a2018 --- /dev/null +++ b/src/plugins/gfxdrivers/blittableqvfb/blittableqvfb.pro @@ -0,0 +1,28 @@ +TARGET = qscreenblittablevfb +include(../../qpluginbase.pri) + +DEFINES += QT_QWS_QVFB QT_QWS_MOUSE_QVFB QT_QWS_KBD_QVFB + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/gfxdrivers + +HEADERS = qgraphicssystem_blittableqvfb.h \ + qscreen_blittableqvfb.h \ + qwindowsurface_qwsblittable.h \ + qblittable_image.h + +SOURCES = main.cpp \ + qwindowsurface_qwsblittable.cpp + +#include qvfb sources +HEADERS += \ + $$QT_SOURCE_TREE/src/gui/embedded/qscreenvfb_qws.h \ + $$QT_SOURCE_TREE/src/gui/embedded/qkbdvfb_qws.h \ + $$QT_SOURCE_TREE/src/gui/embedded/qmousevfb_qws.h + +SOURCES += \ + $$QT_SOURCE_TREE/src/gui/embedded/qscreenvfb_qws.cpp \ + $$QT_SOURCE_TREE/src/gui/embedded/qkbdvfb_qws.cpp \ + $$QT_SOURCE_TREE/src/gui/embedded/qmousevfb_qws.cpp + +target.path += $$[QT_INSTALL_PLUGINS]/gfxdrivers +INSTALLS += target diff --git a/src/plugins/gfxdrivers/blittableqvfb/main.cpp b/src/plugins/gfxdrivers/blittableqvfb/main.cpp new file mode 100644 index 0000000..b6d2603 --- /dev/null +++ b/src/plugins/gfxdrivers/blittableqvfb/main.cpp @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include "qscreen_blittableqvfb.h" + +#ifndef QT_NO_LIBRARY +QT_BEGIN_NAMESPACE + +class ScreenBlittableVfbDriver : public QScreenDriverPlugin +{ +public: + ScreenBlittableVfbDriver(); + + QStringList keys() const; + QScreen *create(const QString&, int displayId); +}; + +ScreenBlittableVfbDriver::ScreenBlittableVfbDriver() +: QScreenDriverPlugin() +{ +} + +QStringList ScreenBlittableVfbDriver::keys() const +{ + QStringList list; + list << "BlittableQVFb"; + return list; +} + +QScreen* ScreenBlittableVfbDriver::create(const QString& driver, int displayId) +{ + if (driver.toLower() == "blittableqvfb") + return new QBlittableVFbScreen(displayId); + + return 0; +} + +Q_EXPORT_PLUGIN2(qscreenblittablevfb, ScreenBlittableVfbDriver) + +QT_END_NAMESPACE +#endif //QT_NO_LIBRARY diff --git a/src/plugins/gfxdrivers/blittableqvfb/qblittable_image.h b/src/plugins/gfxdrivers/blittableqvfb/qblittable_image.h new file mode 100644 index 0000000..3f8dc69 --- /dev/null +++ b/src/plugins/gfxdrivers/blittableqvfb/qblittable_image.h @@ -0,0 +1,48 @@ +#include + +#include + + +class QImageBlittable : public QBlittable +{ +public: + QImageBlittable(QImage *image, bool deleteImage) + : QBlittable(image->size(), QBlittable::Capabilities(QBlittable::SolidRectCapability + |QBlittable::SourcePixmapCapability + |QBlittable::SourceOverPixmapCapability + |QBlittable::SourceOverScaledPixmapCapability)), + m_image(image), m_deleteImage(deleteImage) + { + + } + + ~QImageBlittable() { + if (m_deleteImage) + delete m_image; + } + + void fillRect(const QRectF &rect, const QColor &color) + { + QPainter p(lock()); + p.fillRect(rect,color); + } + void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &source) + { + //here it is possible to do a pixmap.pixmapData()->buffer() + //but is like this to show how to get the the blitter + QPixmapData *data = pixmap.pixmapData(); + Q_ASSERT(data->width() && data->height()); + Q_ASSERT(data->classId() == QPixmapData::BlitterClass); + QBlittablePixmapData *blittableData = static_cast(data); + + QPainter p(lock()); + p.drawImage(rect, *blittableData->blittable()->lock(),source); + } + +protected: + QImage *doLock() { return m_image; } + void doUnlock() { } +private: + QImage *m_image; + bool m_deleteImage; +}; diff --git a/src/plugins/gfxdrivers/blittableqvfb/qgraphicssystem_blittableqvfb.h b/src/plugins/gfxdrivers/blittableqvfb/qgraphicssystem_blittableqvfb.h new file mode 100644 index 0000000..89940d0 --- /dev/null +++ b/src/plugins/gfxdrivers/blittableqvfb/qgraphicssystem_blittableqvfb.h @@ -0,0 +1,47 @@ +#include +#include +#include +#include + +#include "qwindowsurface_qwsblittable.h" +#include "qblittable_image.h" +#include + +class QBlittableVFbGraphicsSystem : public QGraphicsSystem +{ +public: + QPixmapData *createPixmapData(QPixmapData::PixelType type) const + { + if (type == QPixmapData::PixmapType) { + return new QBlittablePixmapData(type); + } else { + return new QRasterPixmapData(type); + } + } + + QWindowSurface *createWindowSurface(QWidget *widget) const + { + if (QApplication::type() == QApplication::GuiServer) + return new QWSBlittableMemSurface(widget); + else + return QScreen::instance()->createSurface(widget); + } + + QBlittable *createBlittable(const QSize &size) const + { + QImage *image = new QImage(size,QImage::Format_ARGB32); + return new QImageBlittable(image,true); + } + + static QGraphicsSystem *instance() + { + static QGraphicsSystem *system = 0; + if (!system) { + system = new QBlittableVFbGraphicsSystem; + } + return system; + } + +private: + QBlittableVFbGraphicsSystem() { } +}; diff --git a/src/plugins/gfxdrivers/blittableqvfb/qscreen_blittableqvfb.h b/src/plugins/gfxdrivers/blittableqvfb/qscreen_blittableqvfb.h new file mode 100644 index 0000000..645aeec --- /dev/null +++ b/src/plugins/gfxdrivers/blittableqvfb/qscreen_blittableqvfb.h @@ -0,0 +1,14 @@ +#include +#include "qgraphicssystem_blittableqvfb.h" + +class QBlittableVFbScreen : public QVFbScreen +{ +public: + explicit QBlittableVFbScreen(int display_id) + : QVFbScreen(display_id) + { + setGraphicsSystem(QBlittableVFbGraphicsSystem::instance()); + + } + +}; diff --git a/src/plugins/gfxdrivers/blittableqvfb/qwindowsurface_qwsblittable.cpp b/src/plugins/gfxdrivers/blittableqvfb/qwindowsurface_qwsblittable.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/plugins/gfxdrivers/blittableqvfb/qwindowsurface_qwsblittable.h b/src/plugins/gfxdrivers/blittableqvfb/qwindowsurface_qwsblittable.h new file mode 100644 index 0000000..b955322 --- /dev/null +++ b/src/plugins/gfxdrivers/blittableqvfb/qwindowsurface_qwsblittable.h @@ -0,0 +1,36 @@ +#include "qblittable_image.h" + +#include +#include + +class QBlittablePixmapData; + +class Q_GUI_EXPORT QWSBlittableMemSurface : public QWSLocalMemSurface +{ +public: + QWSBlittableMemSurface( QWidget *window ) + : QWSLocalMemSurface(window), + m_currentPaintDevice(0), + pmData(new QBlittablePixmapData(QPixmapData::PixmapType)), + pm(pmData) + { + } + + QPaintDevice *paintDevice() + { + if (QWSLocalMemSurface::paintDevice() != m_currentPaintDevice) { + QPaintDevice *device = QWSLocalMemSurface::paintDevice(); + if (device->devType() == QInternal::Image) { + img = *static_cast(device); + pmData->setBlittable(new QImageBlittable(&img,false)); + } + } + return ± + } + +private: + QPaintDevice *m_currentPaintDevice; + QBlittablePixmapData *pmData; + QPixmap pm; +}; + diff --git a/src/plugins/graphicssystems/blittable/blittable.pro b/src/plugins/graphicssystems/blittable/blittable.pro new file mode 100644 index 0000000..596e92f --- /dev/null +++ b/src/plugins/graphicssystems/blittable/blittable.pro @@ -0,0 +1,12 @@ +TARGET = qblittablegraphicssystem +include(../../qpluginbase.pri) + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems + +SOURCES = main.cpp +HEADERS = qblittable_image.h \ + qgraphicssystem_blittable.h \ + qwindowsurface_imageblittable.h + +target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +INSTALLS += target diff --git a/src/plugins/graphicssystems/blittable/main.cpp b/src/plugins/graphicssystems/blittable/main.cpp new file mode 100644 index 0000000..06c3189 --- /dev/null +++ b/src/plugins/graphicssystems/blittable/main.cpp @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include "qgraphicssystem_blittable.h" + +QT_BEGIN_NAMESPACE + +class QBlittableGraphicsSystemPlugin : public QGraphicsSystemPlugin +{ +public: + QStringList keys() const; + QGraphicsSystem *create(const QString&); +}; + +QStringList QBlittableGraphicsSystemPlugin::keys() const +{ + QStringList list; + list << QLatin1String("Blittable"); + return list; +} + +QGraphicsSystem* QBlittableGraphicsSystemPlugin::create(const QString& system) +{ + if (system.toLower() == QLatin1String("blittable")) { + return new QBlittableGraphicsSystem; + } + + return 0; +} + +Q_EXPORT_PLUGIN2(blittable, QBlittableGraphicsSystemPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/blittable/qblittable_image.h b/src/plugins/graphicssystems/blittable/qblittable_image.h new file mode 100644 index 0000000..8ca86b7 --- /dev/null +++ b/src/plugins/graphicssystems/blittable/qblittable_image.h @@ -0,0 +1,48 @@ +#include + +#include + + +class QImageBlittable : public QBlittable +{ +public: + QImageBlittable(QImage *image, bool deleteImage) + : QBlittable(image->size(), QBlittable::Capabilities(QBlittable::SolidRectCapability + |QBlittable::SourcePixmapCapability + |QBlittable::SourceOverPixmapCapability + |QBlittable::SourceOverScaledPixmapCapability)), + m_image(image), m_deleteImage(deleteImage) + { + + } + + ~QImageBlittable() { + if (m_deleteImage) + delete m_image; + } + + void fillRect(const QRectF &rect, const QColor &color) + { + QPainter p(lock()); + p.fillRect(rect,color); + } + void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &source) + { + //here it is possible to do a pixmap.pixmapData()->buffer() + //but is like this to show how to get the the blitter + QPixmapData *data = pixmap.pixmapData(); + Q_ASSERT(data->width() && data->height()); + Q_ASSERT(data->classId() == QPixmapData::BlitterClass); + QBlittablePixmapData *blittableData = static_cast(data); + + QPainter p(lock()); + p.drawImage(rect, *blittableData->blittable()->lock(),source); + } + +protected: + QImage *doLock() { return m_image; } + void doUnlock() { } +private: + QImage *m_image; + bool m_deleteImage; +}; diff --git a/src/plugins/graphicssystems/blittable/qgraphicssystem_blittable.h b/src/plugins/graphicssystems/blittable/qgraphicssystem_blittable.h new file mode 100644 index 0000000..b42021e --- /dev/null +++ b/src/plugins/graphicssystems/blittable/qgraphicssystem_blittable.h @@ -0,0 +1,47 @@ +#include +#include +#include +#include +#include + +#include "qblittable_image.h" + +class QImageBlittableWindowSurface : public QRasterBlittableWindowSurface +{ +public: + QImageBlittableWindowSurface(QWidget *widget) + : QRasterBlittableWindowSurface(widget) + {} + + QBlittable *createBlittable(QImage *rasterSurface) + { + return new QImageBlittable(rasterSurface,false); + } + +}; + +class QBlittableGraphicsSystem : public QGraphicsSystem +{ +public: + ~QBlittableGraphicsSystem() { } + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const + { + if (type == QPixmapData::PixmapType) + return new QBlittablePixmapData(type); + else + return new QRasterPixmapData(type); + } + + QWindowSurface *createWindowSurface(QWidget *widget) const + { + return new QImageBlittableWindowSurface(widget); + } + + QBlittable *createBlittable(const QSize &size) const + { + QImage *image = new QImage(size, QImage::Format_ARGB32_Premultiplied); + return new QImageBlittable(image,true); + } +}; + -- cgit v0.12 From a31270b5fc88460d6923ac1f2b5b6e90da59c9c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 29 Mar 2010 13:21:47 +0200 Subject: Compile fix from merging blitter examples. --- src/gui/painting/painting.pri | 2 -- src/plugins/graphicssystems/blittable/qblittable_image.h | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index a3fe2e1..3273cb3 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -17,7 +17,6 @@ HEADERS += \ painting/qpaintengine_p.h \ painting/qpaintengine_alpha_p.h \ painting/qpaintengine_preview_p.h \ - painting/qpaintengine_blitter_p.h \ painting/qpaintengineex_p.h \ painting/qpainter.h \ painting/qpainter_p.h \ @@ -64,7 +63,6 @@ SOURCES += \ painting/qpaintengine.cpp \ painting/qpaintengine_alpha.cpp \ painting/qpaintengine_preview.cpp \ - painting/qpaintengine_blitter.cpp \ painting/qpaintengineex.cpp \ painting/qpainter.cpp \ painting/qpainterpath.cpp \ diff --git a/src/plugins/graphicssystems/blittable/qblittable_image.h b/src/plugins/graphicssystems/blittable/qblittable_image.h index 8ca86b7..3f8dc69 100644 --- a/src/plugins/graphicssystems/blittable/qblittable_image.h +++ b/src/plugins/graphicssystems/blittable/qblittable_image.h @@ -1,6 +1,6 @@ #include -#include +#include class QImageBlittable : public QBlittable -- cgit v0.12 From a93f6b21f636df4840f86099c76d287afb978001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 31 Mar 2010 09:41:39 +0200 Subject: Refactoring GraphicsSystem to QPlatformIntegration QPlatformIntegration is the "main" integration class which needs to be subclassed. This is done so that we don't pollute GraphicsSystem with functionality that really does not belong there. In lighthouse applications needs now to be started with -platform some_platform --- src/gui/image/qnativeimage.cpp | 2 +- src/gui/image/qpixmap_blitter.cpp | 2 +- src/gui/image/qpixmap_lite.cpp | 2 +- src/gui/kernel/kernel.pri | 10 +- src/gui/kernel/qapplication.cpp | 12 +- src/gui/kernel/qapplication_lite.cpp | 36 +- src/gui/kernel/qapplication_p.h | 15 +- src/gui/kernel/qdesktopwidget_lite.cpp | 24 +- src/gui/kernel/qplatformintegration_lite.cpp | 18 + src/gui/kernel/qplatformintegration_lite.h | 73 + .../kernel/qplatformintegrationfactory_lite.cpp | 88 + .../kernel/qplatformintegrationfactory_lite_p.h | 78 + src/gui/kernel/qplatformintegrationplugin_lite.cpp | 55 + src/gui/kernel/qplatformintegrationplugin_lite.h | 92 + src/gui/kernel/qplatformscreen_lite.cpp | 15 + src/gui/kernel/qplatformscreen_lite.h | 31 + src/gui/kernel/qwidget_lite.cpp | 14 +- src/gui/kernel/qwindowsysteminterface.h | 16 +- src/gui/painting/painting.pri | 6 +- src/gui/painting/qcolormap_lite.cpp | 8 +- src/gui/painting/qgraphicssystem.cpp | 54 +- src/gui/painting/qgraphicssystem_lite.cpp | 62 + src/gui/painting/qgraphicssystem_lite_p.h | 70 + src/gui/painting/qgraphicssystem_p.h | 27 +- src/gui/painting/qgraphicssystemcursor_lite.cpp | 2 +- src/gui/painting/qgraphicssystemcursor_lite.h | 5 +- .../graphicssystems/blittable/blittable.pro | 3 +- .../blittable/qgraphicssystem_blittable.h | 6 + src/plugins/graphicssystems/fb_base/fb_base.cpp | 364 ---- src/plugins/graphicssystems/fb_base/fb_base.h | 132 -- src/plugins/graphicssystems/fb_base/fb_base.pri | 2 - src/plugins/graphicssystems/fb_base/fb_base.pro | 23 - src/plugins/graphicssystems/graphicssystems.pro | 8 - src/plugins/graphicssystems/linuxfb/linuxfb.pro | 12 - src/plugins/graphicssystems/linuxfb/main.cpp | 71 - .../linuxfb/qgraphicssystem_linuxfb.cpp | 856 --------- .../linuxfb/qgraphicssystem_linuxfb.h | 128 -- src/plugins/graphicssystems/minimal/main.cpp | 71 - src/plugins/graphicssystems/minimal/minimal.pro | 10 - .../minimal/qgraphicssystem_minimal.cpp | 70 - .../minimal/qgraphicssystem_minimal.h | 85 - .../minimal/qwindowsurface_minimal.cpp | 101 - .../minimal/qwindowsurface_minimal.h | 73 - src/plugins/graphicssystems/minimaldfb/main.cpp | 71 - .../graphicssystems/minimaldfb/minimaldfb.pro | 29 - .../minimaldfb/qblitter_directfb.cpp | 110 -- .../graphicssystems/minimaldfb/qblitter_directfb.h | 29 - .../minimaldfb/qdirectfbconvenience.cpp | 335 ---- .../minimaldfb/qdirectfbconvenience.h | 43 - .../graphicssystems/minimaldfb/qdirectfbcursor.cpp | 42 - .../graphicssystems/minimaldfb/qdirectfbcursor.h | 22 - .../graphicssystems/minimaldfb/qdirectfbinput.cpp | 205 --- .../graphicssystems/minimaldfb/qdirectfbinput.h | 63 - .../minimaldfb/qgraphicssystem_minimaldfb.cpp | 118 -- .../minimaldfb/qgraphicssystem_minimaldfb.h | 99 - .../minimaldfb/qwindowsurface_minimaldfb.cpp | 231 --- .../minimaldfb/qwindowsurface_minimaldfb.h | 88 - src/plugins/graphicssystems/openkode/frag.glslf | 8 - src/plugins/graphicssystems/openkode/frag.h | 37 - src/plugins/graphicssystems/openkode/main.cpp | 71 - src/plugins/graphicssystems/openkode/openkode.pro | 14 - .../openkode/qgraphicssystem_openkode.cpp | 236 --- .../openkode/qgraphicssystem_openkode.h | 95 - .../openkode/qwindowsurface_openkode.cpp | 265 --- .../openkode/qwindowsurface_openkode.h | 79 - src/plugins/graphicssystems/openkode/vert.glslv | 14 - src/plugins/graphicssystems/openkode/vert.h | 63 - src/plugins/graphicssystems/openvglite/main.cpp | 71 - .../graphicssystems/openvglite/openvglite.pro | 12 - .../openvglite/qgraphicssystem_vglite.cpp | 193 -- .../openvglite/qgraphicssystem_vglite.h | 93 - .../openvglite/qwindowsurface_vglite.cpp | 131 -- .../openvglite/qwindowsurface_vglite.h | 91 - src/plugins/graphicssystems/qvfb/main.cpp | 72 - .../graphicssystems/qvfb/qgraphicssystem_qvfb.cpp | 434 ----- .../graphicssystems/qvfb/qgraphicssystem_qvfb.h | 95 - src/plugins/graphicssystems/qvfb/qvfb.pro | 12 - .../graphicssystems/qvfb/qwindowsurface_qvfb.cpp | 104 -- .../graphicssystems/qvfb/qwindowsurface_qvfb.h | 74 - src/plugins/graphicssystems/testlite/main.cpp | 71 - .../testlite/qgraphicssystem_testlite.cpp | 121 -- .../testlite/qgraphicssystem_testlite.h | 91 - .../testlite/qwindowsurface_testlite.cpp | 661 ------- .../testlite/qwindowsurface_testlite.h | 96 - src/plugins/graphicssystems/testlite/testlite.pro | 17 - src/plugins/graphicssystems/testlite/x11util.cpp | 1215 ------------ src/plugins/graphicssystems/testlite/x11util.h | 204 --- src/plugins/graphicssystems/vnc/main.cpp | 72 - .../graphicssystems/vnc/qgraphicssystem_vnc.cpp | 115 -- .../graphicssystems/vnc/qgraphicssystem_vnc.h | 97 - src/plugins/graphicssystems/vnc/qvnccursor.cpp | 156 -- src/plugins/graphicssystems/vnc/qvnccursor.h | 76 - src/plugins/graphicssystems/vnc/qvncserver.cpp | 1935 -------------------- src/plugins/graphicssystems/vnc/qvncserver.h | 534 ------ src/plugins/graphicssystems/vnc/vnc.pro | 19 - src/plugins/platforms/fb_base/fb_base.cpp | 364 ++++ src/plugins/platforms/fb_base/fb_base.h | 132 ++ src/plugins/platforms/fb_base/fb_base.pri | 2 + src/plugins/platforms/fb_base/fb_base.pro | 23 + src/plugins/platforms/linuxfb/linuxfb.pro | 12 + src/plugins/platforms/linuxfb/main.cpp | 71 + .../platforms/linuxfb/qgraphicssystem_linuxfb.cpp | 856 +++++++++ .../platforms/linuxfb/qgraphicssystem_linuxfb.h | 128 ++ src/plugins/platforms/minimal/main.cpp | 71 + src/plugins/platforms/minimal/minimal.pro | 13 + .../minimal/qplatformintegration_minimal.cpp | 25 + .../minimal/qplatformintegration_minimal.h | 85 + .../platforms/minimal/qwindowsurface_minimal.cpp | 85 + .../platforms/minimal/qwindowsurface_minimal.h | 65 + src/plugins/platforms/minimaldfb/main.cpp | 71 + src/plugins/platforms/minimaldfb/minimaldfb.pro | 29 + .../platforms/minimaldfb/qblitter_directfb.cpp | 110 ++ .../platforms/minimaldfb/qblitter_directfb.h | 29 + .../platforms/minimaldfb/qdirectfbconvenience.cpp | 335 ++++ .../platforms/minimaldfb/qdirectfbconvenience.h | 43 + .../platforms/minimaldfb/qdirectfbcursor.cpp | 42 + src/plugins/platforms/minimaldfb/qdirectfbcursor.h | 22 + .../platforms/minimaldfb/qdirectfbinput.cpp | 205 +++ src/plugins/platforms/minimaldfb/qdirectfbinput.h | 63 + .../minimaldfb/qgraphicssystem_minimaldfb.cpp | 118 ++ .../minimaldfb/qgraphicssystem_minimaldfb.h | 99 + .../minimaldfb/qwindowsurface_minimaldfb.cpp | 231 +++ .../minimaldfb/qwindowsurface_minimaldfb.h | 88 + src/plugins/platforms/openkode/frag.glslf | 8 + src/plugins/platforms/openkode/frag.h | 37 + src/plugins/platforms/openkode/main.cpp | 71 + src/plugins/platforms/openkode/openkode.pro | 14 + .../openkode/qgraphicssystem_openkode.cpp | 236 +++ .../platforms/openkode/qgraphicssystem_openkode.h | 95 + .../platforms/openkode/qwindowsurface_openkode.cpp | 265 +++ .../platforms/openkode/qwindowsurface_openkode.h | 79 + src/plugins/platforms/openkode/vert.glslv | 14 + src/plugins/platforms/openkode/vert.h | 63 + src/plugins/platforms/openvglite/main.cpp | 71 + src/plugins/platforms/openvglite/openvglite.pro | 12 + .../openvglite/qgraphicssystem_vglite.cpp | 193 ++ .../platforms/openvglite/qgraphicssystem_vglite.h | 93 + .../platforms/openvglite/qwindowsurface_vglite.cpp | 131 ++ .../platforms/openvglite/qwindowsurface_vglite.h | 91 + src/plugins/platforms/platforms.pro | 14 + src/plugins/platforms/qvfb/main.cpp | 72 + .../platforms/qvfb/qgraphicssystem_qvfb.cpp | 434 +++++ src/plugins/platforms/qvfb/qgraphicssystem_qvfb.h | 95 + src/plugins/platforms/qvfb/qvfb.pro | 12 + src/plugins/platforms/qvfb/qwindowsurface_qvfb.cpp | 104 ++ src/plugins/platforms/qvfb/qwindowsurface_qvfb.h | 74 + src/plugins/platforms/testlite/main.cpp | 71 + .../testlite/qgraphicssystem_testlite.cpp | 121 ++ .../platforms/testlite/qgraphicssystem_testlite.h | 91 + .../platforms/testlite/qwindowsurface_testlite.cpp | 661 +++++++ .../platforms/testlite/qwindowsurface_testlite.h | 96 + src/plugins/platforms/testlite/testlite.pro | 17 + src/plugins/platforms/testlite/x11util.cpp | 1215 ++++++++++++ src/plugins/platforms/testlite/x11util.h | 204 +++ src/plugins/platforms/vnc/main.cpp | 72 + src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp | 115 ++ src/plugins/platforms/vnc/qgraphicssystem_vnc.h | 97 + src/plugins/platforms/vnc/qvnccursor.cpp | 156 ++ src/plugins/platforms/vnc/qvnccursor.h | 76 + src/plugins/platforms/vnc/qvncserver.cpp | 1935 ++++++++++++++++++++ src/plugins/platforms/vnc/qvncserver.h | 534 ++++++ src/plugins/platforms/vnc/vnc.pro | 19 + 162 files changed, 11867 insertions(+), 11369 deletions(-) create mode 100644 src/gui/kernel/qplatformintegration_lite.cpp create mode 100644 src/gui/kernel/qplatformintegration_lite.h create mode 100644 src/gui/kernel/qplatformintegrationfactory_lite.cpp create mode 100644 src/gui/kernel/qplatformintegrationfactory_lite_p.h create mode 100644 src/gui/kernel/qplatformintegrationplugin_lite.cpp create mode 100644 src/gui/kernel/qplatformintegrationplugin_lite.h create mode 100644 src/gui/kernel/qplatformscreen_lite.cpp create mode 100644 src/gui/kernel/qplatformscreen_lite.h create mode 100644 src/gui/painting/qgraphicssystem_lite.cpp create mode 100644 src/gui/painting/qgraphicssystem_lite_p.h delete mode 100644 src/plugins/graphicssystems/fb_base/fb_base.cpp delete mode 100644 src/plugins/graphicssystems/fb_base/fb_base.h delete mode 100644 src/plugins/graphicssystems/fb_base/fb_base.pri delete mode 100644 src/plugins/graphicssystems/fb_base/fb_base.pro delete mode 100644 src/plugins/graphicssystems/linuxfb/linuxfb.pro delete mode 100644 src/plugins/graphicssystems/linuxfb/main.cpp delete mode 100644 src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp delete mode 100644 src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.h delete mode 100644 src/plugins/graphicssystems/minimal/main.cpp delete mode 100644 src/plugins/graphicssystems/minimal/minimal.pro delete mode 100644 src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.cpp delete mode 100644 src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.h delete mode 100644 src/plugins/graphicssystems/minimal/qwindowsurface_minimal.cpp delete mode 100644 src/plugins/graphicssystems/minimal/qwindowsurface_minimal.h delete mode 100644 src/plugins/graphicssystems/minimaldfb/main.cpp delete mode 100644 src/plugins/graphicssystems/minimaldfb/minimaldfb.pro delete mode 100644 src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp delete mode 100644 src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h delete mode 100644 src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp delete mode 100644 src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h delete mode 100644 src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp delete mode 100644 src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.h delete mode 100644 src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp delete mode 100644 src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h delete mode 100644 src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp delete mode 100644 src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h delete mode 100644 src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp delete mode 100644 src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h delete mode 100644 src/plugins/graphicssystems/openkode/frag.glslf delete mode 100644 src/plugins/graphicssystems/openkode/frag.h delete mode 100644 src/plugins/graphicssystems/openkode/main.cpp delete mode 100644 src/plugins/graphicssystems/openkode/openkode.pro delete mode 100644 src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.cpp delete mode 100644 src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.h delete mode 100644 src/plugins/graphicssystems/openkode/qwindowsurface_openkode.cpp delete mode 100644 src/plugins/graphicssystems/openkode/qwindowsurface_openkode.h delete mode 100644 src/plugins/graphicssystems/openkode/vert.glslv delete mode 100644 src/plugins/graphicssystems/openkode/vert.h delete mode 100644 src/plugins/graphicssystems/openvglite/main.cpp delete mode 100644 src/plugins/graphicssystems/openvglite/openvglite.pro delete mode 100644 src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.cpp delete mode 100644 src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.h delete mode 100644 src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.cpp delete mode 100644 src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.h delete mode 100644 src/plugins/graphicssystems/qvfb/main.cpp delete mode 100644 src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.cpp delete mode 100644 src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.h delete mode 100644 src/plugins/graphicssystems/qvfb/qvfb.pro delete mode 100644 src/plugins/graphicssystems/qvfb/qwindowsurface_qvfb.cpp delete mode 100644 src/plugins/graphicssystems/qvfb/qwindowsurface_qvfb.h delete mode 100644 src/plugins/graphicssystems/testlite/main.cpp delete mode 100644 src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp delete mode 100644 src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.h delete mode 100644 src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp delete mode 100644 src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h delete mode 100644 src/plugins/graphicssystems/testlite/testlite.pro delete mode 100644 src/plugins/graphicssystems/testlite/x11util.cpp delete mode 100644 src/plugins/graphicssystems/testlite/x11util.h delete mode 100644 src/plugins/graphicssystems/vnc/main.cpp delete mode 100644 src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp delete mode 100644 src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h delete mode 100644 src/plugins/graphicssystems/vnc/qvnccursor.cpp delete mode 100644 src/plugins/graphicssystems/vnc/qvnccursor.h delete mode 100644 src/plugins/graphicssystems/vnc/qvncserver.cpp delete mode 100644 src/plugins/graphicssystems/vnc/qvncserver.h delete mode 100644 src/plugins/graphicssystems/vnc/vnc.pro create mode 100644 src/plugins/platforms/fb_base/fb_base.cpp create mode 100644 src/plugins/platforms/fb_base/fb_base.h create mode 100644 src/plugins/platforms/fb_base/fb_base.pri create mode 100644 src/plugins/platforms/fb_base/fb_base.pro create mode 100644 src/plugins/platforms/linuxfb/linuxfb.pro create mode 100644 src/plugins/platforms/linuxfb/main.cpp create mode 100644 src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp create mode 100644 src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h create mode 100644 src/plugins/platforms/minimal/main.cpp create mode 100644 src/plugins/platforms/minimal/minimal.pro create mode 100644 src/plugins/platforms/minimal/qplatformintegration_minimal.cpp create mode 100644 src/plugins/platforms/minimal/qplatformintegration_minimal.h create mode 100644 src/plugins/platforms/minimal/qwindowsurface_minimal.cpp create mode 100644 src/plugins/platforms/minimal/qwindowsurface_minimal.h create mode 100644 src/plugins/platforms/minimaldfb/main.cpp create mode 100644 src/plugins/platforms/minimaldfb/minimaldfb.pro create mode 100644 src/plugins/platforms/minimaldfb/qblitter_directfb.cpp create mode 100644 src/plugins/platforms/minimaldfb/qblitter_directfb.h create mode 100644 src/plugins/platforms/minimaldfb/qdirectfbconvenience.cpp create mode 100644 src/plugins/platforms/minimaldfb/qdirectfbconvenience.h create mode 100644 src/plugins/platforms/minimaldfb/qdirectfbcursor.cpp create mode 100644 src/plugins/platforms/minimaldfb/qdirectfbcursor.h create mode 100644 src/plugins/platforms/minimaldfb/qdirectfbinput.cpp create mode 100644 src/plugins/platforms/minimaldfb/qdirectfbinput.h create mode 100644 src/plugins/platforms/minimaldfb/qgraphicssystem_minimaldfb.cpp create mode 100644 src/plugins/platforms/minimaldfb/qgraphicssystem_minimaldfb.h create mode 100644 src/plugins/platforms/minimaldfb/qwindowsurface_minimaldfb.cpp create mode 100644 src/plugins/platforms/minimaldfb/qwindowsurface_minimaldfb.h create mode 100644 src/plugins/platforms/openkode/frag.glslf create mode 100644 src/plugins/platforms/openkode/frag.h create mode 100644 src/plugins/platforms/openkode/main.cpp create mode 100644 src/plugins/platforms/openkode/openkode.pro create mode 100644 src/plugins/platforms/openkode/qgraphicssystem_openkode.cpp create mode 100644 src/plugins/platforms/openkode/qgraphicssystem_openkode.h create mode 100644 src/plugins/platforms/openkode/qwindowsurface_openkode.cpp create mode 100644 src/plugins/platforms/openkode/qwindowsurface_openkode.h create mode 100644 src/plugins/platforms/openkode/vert.glslv create mode 100644 src/plugins/platforms/openkode/vert.h create mode 100644 src/plugins/platforms/openvglite/main.cpp create mode 100644 src/plugins/platforms/openvglite/openvglite.pro create mode 100644 src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp create mode 100644 src/plugins/platforms/openvglite/qgraphicssystem_vglite.h create mode 100644 src/plugins/platforms/openvglite/qwindowsurface_vglite.cpp create mode 100644 src/plugins/platforms/openvglite/qwindowsurface_vglite.h create mode 100644 src/plugins/platforms/platforms.pro create mode 100644 src/plugins/platforms/qvfb/main.cpp create mode 100644 src/plugins/platforms/qvfb/qgraphicssystem_qvfb.cpp create mode 100644 src/plugins/platforms/qvfb/qgraphicssystem_qvfb.h create mode 100644 src/plugins/platforms/qvfb/qvfb.pro create mode 100644 src/plugins/platforms/qvfb/qwindowsurface_qvfb.cpp create mode 100644 src/plugins/platforms/qvfb/qwindowsurface_qvfb.h create mode 100644 src/plugins/platforms/testlite/main.cpp create mode 100644 src/plugins/platforms/testlite/qgraphicssystem_testlite.cpp create mode 100644 src/plugins/platforms/testlite/qgraphicssystem_testlite.h create mode 100644 src/plugins/platforms/testlite/qwindowsurface_testlite.cpp create mode 100644 src/plugins/platforms/testlite/qwindowsurface_testlite.h create mode 100644 src/plugins/platforms/testlite/testlite.pro create mode 100644 src/plugins/platforms/testlite/x11util.cpp create mode 100644 src/plugins/platforms/testlite/x11util.h create mode 100644 src/plugins/platforms/vnc/main.cpp create mode 100644 src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp create mode 100644 src/plugins/platforms/vnc/qgraphicssystem_vnc.h create mode 100644 src/plugins/platforms/vnc/qvnccursor.cpp create mode 100644 src/plugins/platforms/vnc/qvnccursor.h create mode 100644 src/plugins/platforms/vnc/qvncserver.cpp create mode 100644 src/plugins/platforms/vnc/qvncserver.h create mode 100644 src/plugins/platforms/vnc/vnc.pro diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp index 3420778..d4cbdc6 100644 --- a/src/gui/image/qnativeimage.cpp +++ b/src/gui/image/qnativeimage.cpp @@ -288,7 +288,7 @@ QNativeImage::~QNativeImage() QImage::Format QNativeImage::systemFormat() { #ifdef Q_WS_LITE - return QApplicationPrivate::graphicsSystem()->screens().at(0)->format(); + return QApplicationPrivate::platformIntegration()->screens().at(0)->format(); #else return QImage::Format_RGB32; #endif diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index 6dcf7c7..38a2f81 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -57,7 +57,7 @@ void QBlittablePixmapData::resize(int width, int height) delete m_engine; m_engine = 0; #ifdef Q_WS_LITE - d = QApplicationPrivate::graphicsSystem()->screens().at(0)->depth(); + d = QApplicationPrivate::platformIntegration()->screens().at(0)->depth(); #endif w = width; h = height; diff --git a/src/gui/image/qpixmap_lite.cpp b/src/gui/image/qpixmap_lite.cpp index d263855..61be216 100644 --- a/src/gui/image/qpixmap_lite.cpp +++ b/src/gui/image/qpixmap_lite.cpp @@ -45,5 +45,5 @@ QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) { - return QApplicationPrivate::graphicsSystem()->grabWindow(window, x, y, w, h); + return QApplicationPrivate::platformIntegration()->grabWindow(window, x, y, w, h); } diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 96892d2..cf5ec92 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -203,6 +203,10 @@ embedded_lite { kernel/qgenericplugin_lite.h \ kernel/qeventdispatcher_lite_p.h \ kernel/qwindowsysteminterface.h \ + kernel/qplatformintegration_lite.h \ + kernel/qplatformscreen_lite.h \ + kernel/qplatformintegrationfactory_lite_p.h \ + kernel/qplatformintegrationplugin_lite.h \ SOURCES += \ kernel/qapplication_lite.cpp \ @@ -216,7 +220,11 @@ embedded_lite { kernel/qsound_lite.cpp \ kernel/qwidget_lite.cpp \ kernel/qeventdispatcher_lite.cpp \ - kernel/qwindowsysteminterface.cpp + kernel/qwindowsysteminterface.cpp \ + kernel/qplatformintegration_lite.cpp \ + kernel/qplatformscreen_lite.cpp \ + kernel/qplatformintegrationfactory_lite.cpp \ + kernel/qplatformintegrationplugin_lite.cpp contains(QT_CONFIG, glib) { SOURCES += \ diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 4782d7c..a188276 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -441,6 +441,9 @@ QPalette *QApplicationPrivate::sys_pal = 0; // default system palette QPalette *QApplicationPrivate::set_pal = 0; // default palette set by programmer QGraphicsSystem *QApplicationPrivate::graphics_system = 0; // default graphics system +#if defined(Q_WS_LITE) +QPlatformIntegration *QApplicationPrivate::platform_integration = 0; +#endif QString QApplicationPrivate::graphics_system_name; // graphics system id - for delayed initialization Q_GLOBAL_STATIC(QMutex, applicationFontMutex) @@ -771,7 +774,6 @@ void QApplicationPrivate::construct( ) { initResources(); - graphics_system_name = QLatin1String(qgetenv("QT_DEFAULT_GRAPHICS_SYSTEM")); qt_is_gui_used = (qt_appType != QApplication::Tty); @@ -939,10 +941,12 @@ void QApplicationPrivate::initialize() // Set up which span functions should be used in raster engine... qInitDrawhelperAsm(); -#if !defined(Q_WS_X11) && !defined(Q_WS_QWS) +#if !defined(Q_WS_X11) && !defined(Q_WS_QWS) && !defined(Q_WS_LITE) // initialize the graphics system - on X11 this is initialized inside // qt_init() in qapplication_x11.cpp because of several reasons. // On QWS, the graphics system is set by the QScreen plugin. + // For lighthouse it will be initialized to QLiteGraphicsSystem + // when the platformIntegration plugin is instansiated in qt_init( graphics_system = QGraphicsSystemFactory::create(graphics_system_name); #endif #ifndef QT_NO_WHEELEVENT @@ -1561,7 +1565,11 @@ QStyle* QApplication::setStyle(const QString& style) void QApplication::setGraphicsSystem(const QString &system) { +#if !defined(Q_WS_LITE) QApplicationPrivate::graphics_system_name = system; +#else + Q_UNUSED(system) +#endif } /*! diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 5d7ab5a..c8d65ff 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -53,13 +53,15 @@ #include "private/qwidget_p.h" #include "qgenericpluginfactory_lite.h" +#include "qplatformintegrationfactory_lite_p.h" #include #include -#include "private/qgraphicssystem_p.h" +#include #include #include #include +#include QT_BEGIN_NAMESPACE @@ -386,10 +388,9 @@ void QApplication::restoreOverrideCursor() QWidget *QApplication::topLevelAt(const QPoint &pos) { - QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); - if (!gs) - return 0; - QGraphicsSystemScreen *screen = gs->screens().first(); + QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); + + QPlatformScreen *screen = pi->screens().first(); if (!screen) return 0; QWidget *w = screen->topLevelAt(pos); @@ -404,6 +405,23 @@ void QApplication::alert(QWidget *, int) { } +static void init_platform(const QString &name) +{ + QApplicationPrivate::platform_integration = QPlatformIntegrationFactory::create(name); + QApplicationPrivate::graphics_system = new QLiteGraphicsSystem; + if (!QApplicationPrivate::platform_integration) { + QStringList keys = QPlatformIntegrationFactory::keys(); + QString fatalMessage = + QString::fromLatin1("Failed to load platform plugin \"%1\". Available platforms are: \n").arg(name); + foreach(QString key, keys) { + fatalMessage.append(key + QString::fromLatin1("\n")); + } + qFatal("%s", fatalMessage.toLocal8Bit().constData()); + + } + +} + static void init_plugins(const QList pluginList) { for (int i = 0; i < pluginList.count(); ++i) { @@ -447,6 +465,7 @@ void qt_init(QApplicationPrivate *priv, int type) } QList pluginList; + QString platformName = qgetenv("QT_LITE_PLATFORM"); // Get command line params @@ -460,6 +479,9 @@ void qt_init(QApplicationPrivate *priv, int type) if (arg == "-fn" || arg == "-font") { if (++i < argc) appFont = argv[i]; + } else if (arg == "-platform") { + if (++i < argc) + platformName = argv[i]; } else if (arg == "-plugin") { if (++i < argc) pluginList << argv[i]; @@ -473,9 +495,6 @@ void qt_init(QApplicationPrivate *priv, int type) priv->argc = j; } - - - #if 0 QByteArray pluginEnv = qgetenv("QT_LITE_PLUGINS"); if (!pluginEnv.isEmpty()) { @@ -483,6 +502,7 @@ void qt_init(QApplicationPrivate *priv, int type) } #endif + init_platform(platformName); init_plugins(pluginList); QColormap::initialize(); diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 2cf5fce..d0ab0c4 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -78,6 +78,7 @@ #endif #ifdef Q_WS_LITE #include +#include "QtGui/qplatformintegration_lite.h" #endif QT_BEGIN_NAMESPACE @@ -312,10 +313,15 @@ public: static QString desktopStyleKey(); static QGraphicsSystem *graphicsSystem() -#if !defined(Q_WS_QWS) - { return graphics_system; } -#else +#if defined(Q_WS_QWS) { return QScreen::instance()->graphicsSystem(); } +#else + { return graphics_system; } +#endif + +#if defined(Q_WS_LITE) + static QPlatformIntegration *platformIntegration() + { return platform_integration; } #endif void createEventDispatcher(); @@ -417,6 +423,9 @@ public: static QPalette *set_pal; static QGraphicsSystem *graphics_system; static QString graphics_system_name; +#if defined(Q_WS_LITE) + static QPlatformIntegration *platform_integration; +#endif private: static QFont *app_font; // private for a reason! Always use QApplication::font() instead! diff --git a/src/gui/kernel/qdesktopwidget_lite.cpp b/src/gui/kernel/qdesktopwidget_lite.cpp index a3535fb..b077d57 100644 --- a/src/gui/kernel/qdesktopwidget_lite.cpp +++ b/src/gui/kernel/qdesktopwidget_lite.cpp @@ -69,10 +69,8 @@ int QDesktopWidget::primaryScreen() const int QDesktopWidget::numScreens() const { - QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); - if (!gs) - return 0; - return qMax(gs->screens().size(), 1); + QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); + return qMax(pi->screens().size(), 1); } QWidget *QDesktopWidget::screen(int) @@ -82,10 +80,8 @@ QWidget *QDesktopWidget::screen(int) const QRect QDesktopWidget::availableGeometry(int screenNo) const { - QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); - if (!gs) - return QRect(); - QList screens = gs->screens(); + QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); + QList screens = pi->screens(); if (screenNo == -1) screenNo = 0; if (screenNo < 0 || screenNo >= screens.size()) @@ -96,10 +92,8 @@ const QRect QDesktopWidget::availableGeometry(int screenNo) const const QRect QDesktopWidget::screenGeometry(int screenNo) const { - QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); - if (!gs) - return QRect(); - QList screens = gs->screens(); + QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); + QList screens = pi->screens(); if (screenNo == -1) screenNo = 0; if (screenNo < 0 || screenNo >= screens.size()) @@ -122,10 +116,8 @@ int QDesktopWidget::screenNumber(const QWidget *w) const int QDesktopWidget::screenNumber(const QPoint &p) const { - QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); - if (!gs) - return -1; - QList screens = gs->screens(); + QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); + QList screens = pi->screens(); for (int i = 0; i < screens.size(); ++i) if (screens[i]->geometry().contains(p)) diff --git a/src/gui/kernel/qplatformintegration_lite.cpp b/src/gui/kernel/qplatformintegration_lite.cpp new file mode 100644 index 0000000..0e28fc6 --- /dev/null +++ b/src/gui/kernel/qplatformintegration_lite.cpp @@ -0,0 +1,18 @@ +#include "qplatformintegration_lite.h" + +QT_BEGIN_NAMESPACE + +QBlittable *QPlatformIntegration::createBlittable(const QSize &) const +{ return 0; } + +QPixmap QPlatformIntegration::grabWindow(WId window, int x, int y, int width, int height) const +{ + Q_UNUSED(window); + Q_UNUSED(x); + Q_UNUSED(y); + Q_UNUSED(width); + Q_UNUSED(height); + return QPixmap(); +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformintegration_lite.h b/src/gui/kernel/qplatformintegration_lite.h new file mode 100644 index 0000000..543b7bc --- /dev/null +++ b/src/gui/kernel/qplatformintegration_lite.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMINTEGRATION_H +#define QPLATFORMINTEGRATION_H + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class Q_GUI_EXPORT QPlatformIntegration +{ +public: + virtual ~QPlatformIntegration() { }; + +// GraphicsSystem functions + virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0; + virtual QWindowSurface *createWindowSurface(QWidget *widget) const = 0; + virtual QBlittable *createBlittable(const QSize &size) const; + +// Window System functions + virtual QList screens() const = 0; + virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPLATFORMINTEGRATION_H diff --git a/src/gui/kernel/qplatformintegrationfactory_lite.cpp b/src/gui/kernel/qplatformintegrationfactory_lite.cpp new file mode 100644 index 0000000..7f650e9 --- /dev/null +++ b/src/gui/kernel/qplatformintegrationfactory_lite.cpp @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformintegrationfactory_lite_p.h" +#include +#include "private/qfactoryloader_p.h" +#include "qmutex.h" + +#include "qapplication.h" +#include "qdebug.h" + +QT_BEGIN_NAMESPACE + +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, + (QPlatformIntegrationFactoryInterface_iid, QLatin1String("/platforms"), Qt::CaseInsensitive)) +#endif + +QPlatformIntegration *QPlatformIntegrationFactory::create(const QString& key) +{ + QPlatformIntegration *ret = 0; + QString platform = key.toLower(); + + qDebug() << loader()->keys(); +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) + if (QPlatformIntegrationFactoryInterface *factory = qobject_cast(loader()->instance(platform))) + ret = factory->create(platform); +#endif + + return ret; +} + +/*! + Returns the list of valid keys, i.e. the keys this factory can + create styles for. + + \sa create() +*/ +QStringList QPlatformIntegrationFactory::keys() +{ +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) + QStringList list = loader()->keys(); +#else + QStringList list; +#endif + return list; +} + +QT_END_NAMESPACE + diff --git a/src/gui/kernel/qplatformintegrationfactory_lite_p.h b/src/gui/kernel/qplatformintegrationfactory_lite_p.h new file mode 100644 index 0000000..ba02d2c --- /dev/null +++ b/src/gui/kernel/qplatformintegrationfactory_lite_p.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMINTEGRATIONFACTORY_H +#define QPLATFORMINTEGRATIONFACTORY_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 + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QPlatformIntegration; + +class QPlatformIntegrationFactory +{ +public: + static QStringList keys(); + static QPlatformIntegration *create(const QString&); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPLATFORMINTEGRATIONFACTORY_H + diff --git a/src/gui/kernel/qplatformintegrationplugin_lite.cpp b/src/gui/kernel/qplatformintegrationplugin_lite.cpp new file mode 100644 index 0000000..cb1ed83 --- /dev/null +++ b/src/gui/kernel/qplatformintegrationplugin_lite.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformintegrationplugin_lite.h" + +QT_BEGIN_NAMESPACE + +QPlatformIntegrationPlugin::QPlatformIntegrationPlugin(QObject *parent) + : QObject(parent) +{ +} + +QPlatformIntegrationPlugin::~QPlatformIntegrationPlugin() +{ +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformintegrationplugin_lite.h b/src/gui/kernel/qplatformintegrationplugin_lite.h new file mode 100644 index 0000000..0e116f2 --- /dev/null +++ b/src/gui/kernel/qplatformintegrationplugin_lite.h @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMINTEGRATIONPLUGIN_H +#define QPLATFORMINTEGRATIONPLUGIN_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 +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QPlatformIntegration; + +struct QPlatformIntegrationFactoryInterface : public QFactoryInterface +{ + virtual QPlatformIntegration *create(const QString &key) = 0; +}; + +#define QPlatformIntegrationFactoryInterface_iid "com.nokia.Qt.QPlatformIntegrationFactoryInterface" + +Q_DECLARE_INTERFACE(QPlatformIntegrationFactoryInterface, QPlatformIntegrationFactoryInterface_iid) + +class Q_GUI_EXPORT QPlatformIntegrationPlugin : public QObject, public QPlatformIntegrationFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QPlatformIntegrationFactoryInterface:QFactoryInterface) +public: + explicit QPlatformIntegrationPlugin(QObject *parent = 0); + ~QPlatformIntegrationPlugin(); + + virtual QStringList keys() const = 0; + virtual QPlatformIntegration *create(const QString &key) = 0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPLATFORMINTEGRATIONPLUGIN_H diff --git a/src/gui/kernel/qplatformscreen_lite.cpp b/src/gui/kernel/qplatformscreen_lite.cpp new file mode 100644 index 0000000..f2ea2f8 --- /dev/null +++ b/src/gui/kernel/qplatformscreen_lite.cpp @@ -0,0 +1,15 @@ +#include "qplatformscreen_lite.h" + +QWidget *QPlatformScreen::topLevelAt(const QPoint & pos) const +{ + QWidgetList list = QApplication::topLevelWidgets(); + for (int i = list.size()-1; i >= 0; --i) { + QWidget *w = list[i]; + //### mask is ignored + if (w != QApplication::desktop() && w->isVisible() && w->geometry().contains(pos)) + return w; + } + + return 0; +} + diff --git a/src/gui/kernel/qplatformscreen_lite.h b/src/gui/kernel/qplatformscreen_lite.h new file mode 100644 index 0000000..ef90dee --- /dev/null +++ b/src/gui/kernel/qplatformscreen_lite.h @@ -0,0 +1,31 @@ +#ifndef QPLATFORMSCREEN_H +#define QPLATFORMSCREEN_H + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class Q_GUI_EXPORT QPlatformScreen +{ +public: + virtual ~QPlatformScreen() { } + + virtual QRect geometry() const = 0; + virtual QRect availableGeometry() const {return geometry();}; + virtual int depth() const = 0; + virtual QImage::Format format() const = 0; + virtual QSize physicalSize() const = 0; + virtual void setDirty(const QRect &) {} + virtual QWidget *topLevelAt(const QPoint &point) const; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPLATFORMSCREEN_H diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index bcbcd82..add5592 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -51,7 +51,7 @@ #include QT_BEGIN_NAMESPACE -static QGraphicsSystemScreen *qt_screenForWidget(const QWidget *w); +static QPlatformScreen *qt_screenForWidget(const QWidget *w); void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool /*destroyOldWindow*/) { @@ -535,7 +535,7 @@ void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r) scrollRect(r, dx, dy); } -static QGraphicsSystemScreen *qt_screenForWidget(const QWidget *w) +static QPlatformScreen *qt_screenForWidget(const QWidget *w) { if (!w) return 0; @@ -544,12 +544,8 @@ static QGraphicsSystemScreen *qt_screenForWidget(const QWidget *w) frame.moveTopLeft(w->mapToGlobal(QPoint(0, 0))); const QPoint p = (frame.topLeft() + frame.bottomRight()) / 2; - QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); - if (!gs) { - qWarning("qt_screenForWidget: no graphics system"); - return 0; - } - QList screens = gs->screens(); + QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); + QList screens = pi->screens(); for (int i = 0; i < screens.size(); ++i) { if (screens[i]->geometry().contains(p)) @@ -569,7 +565,7 @@ int QWidget::metric(PaintDeviceMetric m) const { Q_D(const QWidget); - QGraphicsSystemScreen *screen = qt_screenForWidget(this); + QPlatformScreen *screen = qt_screenForWidget(this); if (!screen) { if (m == PdmDpiX || m == PdmDpiY) return 72; diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index fee7e75..70b2830 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -41,14 +41,18 @@ #ifndef QWINDOWSYSTEMINTERFACE_H #define QWINDOWSYSTEMINTERFACE_H -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include + +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Gui) + class Q_GUI_EXPORT QWindowSystemInterface { public: @@ -129,5 +133,7 @@ public: static QWindowSystemInterface::UserEvent * getUserEvent() { return userEventQueue.takeFirst(); } static void queueUserEvent(QWindowSystemInterface::UserEvent *ev) { userEventQueue.append(ev); } }; + QT_END_NAMESPACE +QT_END_HEADER #endif // QWINDOWSYSTEMINTERFACE_H diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 3273cb3..c4e8f7a 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -187,9 +187,11 @@ embedded_lite { SOURCES += \ painting/qcolormap_lite.cpp \ painting/qpaintdevice_lite.cpp \ - painting/qgraphicssystemcursor_lite.cpp + painting/qgraphicssystemcursor_lite.cpp \ + painting/qgraphicssystem_lite.cpp HEADERS += \ - painting/qgraphicssystemcursor_lite.h + painting/qgraphicssystemcursor_lite.h \ + painting/qgraphicssystem_lite_p.h } symbian { diff --git a/src/gui/painting/qcolormap_lite.cpp b/src/gui/painting/qcolormap_lite.cpp index 1c1e9cf..1f4fea8 100644 --- a/src/gui/painting/qcolormap_lite.cpp +++ b/src/gui/painting/qcolormap_lite.cpp @@ -67,12 +67,8 @@ void QColormap::initialize() { screenMap = new QColormapPrivate; - QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); - if (!gs) - return; - QList screens = gs->screens(); - if (screens.isEmpty()) - return; + QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); + QList screens = pi->screens(); screenMap->depth = screens[0]->depth(); if (screenMap->depth < 8) { diff --git a/src/gui/painting/qgraphicssystem.cpp b/src/gui/painting/qgraphicssystem.cpp index ebc504b..c9866ae 100644 --- a/src/gui/painting/qgraphicssystem.cpp +++ b/src/gui/painting/qgraphicssystem.cpp @@ -51,9 +51,7 @@ # include #endif #ifdef Q_WS_LITE -# include -# include -# include +# include #endif #ifdef Q_WS_S60 # include @@ -65,6 +63,9 @@ QGraphicsSystem::~QGraphicsSystem() { } +QBlittable *QGraphicsSystem::createBlittable(const QSize &) const +{ return 0; } + QPixmapData *QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixelType type) { #ifdef Q_WS_QWS @@ -77,7 +78,7 @@ QPixmapData *QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixelType typ #elif defined(Q_WS_MAC) return new QMacPixmapData(type); #elif defined(Q_WS_LITE) - return new QRasterPixmapData(type); + return QApplicationPrivate::platformIntegration()->createPixmapData(type); #elif defined(Q_WS_S60) return new QS60PixmapData(type); #elif !defined(Q_WS_QWS) @@ -86,49 +87,4 @@ QPixmapData *QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixelType typ return 0; } -#ifdef Q_WS_LITE -QWidget *QGraphicsSystemScreen::topLevelAt(const QPoint & pos) const -{ - QWidgetList list = QApplication::topLevelWidgets(); - for (int i = list.size()-1; i >= 0; --i) { - QWidget *w = list[i]; - //### mask is ignored - if (w != QApplication::desktop() && w->isVisible() && w->geometry().contains(pos)) - return w; - } - - return 0; -} - -QList QGraphicsSystem::screens() const -{ - return QList(); -} - -QPixmap QGraphicsSystem::grabWindow(WId window, int x, int y, int width, int height) const -{ - Q_UNUSED(window); - Q_UNUSED(x); - Q_UNUSED(y); - Q_UNUSED(width); - Q_UNUSED(height); - return QPixmap(); -} - - -QGraphicsSystemScreen::QGraphicsSystemScreen(QObject *parent) - : QObject(parent) -{} - -QGraphicsSystemScreen::~QGraphicsSystemScreen() -{ -} - -QRect QGraphicsSystemScreen::availableGeometry() const -{ - return geometry(); -} - -#endif //Q_WS_LITE - QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystem_lite.cpp b/src/gui/painting/qgraphicssystem_lite.cpp new file mode 100644 index 0000000..42e7238 --- /dev/null +++ b/src/gui/painting/qgraphicssystem_lite.cpp @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgraphicssystem_lite_p.h" +#include + +QT_BEGIN_NAMESPACE + +QPixmapData *QLiteGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const +{ + return QApplicationPrivate::platformIntegration()->createPixmapData(type); +} + +QWindowSurface *QLiteGraphicsSystem::createWindowSurface(QWidget *widget) const +{ + return QApplicationPrivate::platformIntegration()->createWindowSurface(widget); +} + +QBlittable *QLiteGraphicsSystem::createBlittable(const QSize &size) const +{ + return QApplicationPrivate::platformIntegration()->createBlittable(size); +} + +QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystem_lite_p.h b/src/gui/painting/qgraphicssystem_lite_p.h new file mode 100644 index 0000000..e29fa83 --- /dev/null +++ b/src/gui/painting/qgraphicssystem_lite_p.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_MAC_P_H +#define QGRAPHICSSYSTEM_MAC_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "private/qgraphicssystem_p.h" + +QT_BEGIN_NAMESPACE + +class Q_GUI_EXPORT QLiteGraphicsSystem : public QGraphicsSystem +{ +public: + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QWindowSurface *createWindowSurface(QWidget *widget) const; + QBlittable *createBlittable(const QSize &size) const; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/gui/painting/qgraphicssystem_p.h b/src/gui/painting/qgraphicssystem_p.h index 03b0f48..e1e15e0 100644 --- a/src/gui/painting/qgraphicssystem_p.h +++ b/src/gui/painting/qgraphicssystem_p.h @@ -64,37 +64,14 @@ QT_BEGIN_NAMESPACE class QPixmapFilter; class QBlittable; -#ifdef Q_WS_LITE -class Q_GUI_EXPORT QGraphicsSystemScreen : public QObject -{ - Q_OBJECT -public: - QGraphicsSystemScreen(QObject *parent = 0); - virtual ~QGraphicsSystemScreen(); - - virtual QRect geometry() const = 0; - virtual QRect availableGeometry() const; - virtual int depth() const = 0; - virtual QImage::Format format() const = 0; - virtual QSize physicalSize() const = 0; - virtual void setDirty(const QRect &) {} - virtual QWidget *topLevelAt(const QPoint &point) const; -}; -#endif // Q_WS_LITE - class Q_GUI_EXPORT QGraphicsSystem { public: virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0; virtual QWindowSurface *createWindowSurface(QWidget *widget) const = 0; - virtual QBlittable *createBlittable(const QSize &) const { return 0; } - - virtual ~QGraphicsSystem() = 0; + virtual QBlittable *createBlittable(const QSize &size) const; -#ifdef Q_WS_LITE - virtual QList screens() const; - virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const; -#endif + virtual ~QGraphicsSystem(); //### Remove this & change qpixmap.cpp & qbitmap.cpp once every platform is gaurenteed // to have a graphics system. diff --git a/src/gui/painting/qgraphicssystemcursor_lite.cpp b/src/gui/painting/qgraphicssystemcursor_lite.cpp index 76b7d97..fdb026c 100644 --- a/src/gui/painting/qgraphicssystemcursor_lite.cpp +++ b/src/gui/painting/qgraphicssystemcursor_lite.cpp @@ -94,7 +94,7 @@ QPointer QGraphicsSystemCursor::instance = 0; Constructs a QGraphicsSystemCursor */ -QGraphicsSystemCursor::QGraphicsSystemCursor(QGraphicsSystemScreen *scr ) +QGraphicsSystemCursor::QGraphicsSystemCursor(QPlatformScreen *scr ) : screen(scr) { instance = this; diff --git a/src/gui/painting/qgraphicssystemcursor_lite.h b/src/gui/painting/qgraphicssystemcursor_lite.h index 0d57d52..5288b83 100644 --- a/src/gui/painting/qgraphicssystemcursor_lite.h +++ b/src/gui/painting/qgraphicssystemcursor_lite.h @@ -47,6 +47,7 @@ #include #include #include "qgraphicssystem_p.h" +#include QT_BEGIN_NAMESPACE @@ -68,7 +69,7 @@ private: class Q_GUI_EXPORT QGraphicsSystemCursor : public QObject { public: - QGraphicsSystemCursor(QGraphicsSystemScreen *); + QGraphicsSystemCursor(QPlatformScreen *); // input methods virtual void pointerEvent(const QMouseEvent & event) { Q_UNUSED(event); } @@ -79,7 +80,7 @@ public: protected: static QPointer instance; // limit 1 cursor at a time - QGraphicsSystemScreen * screen; // Where to request an update + QPlatformScreen* screen; // Where to request an update }; QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/blittable/blittable.pro b/src/plugins/graphicssystems/blittable/blittable.pro index 596e92f..34c4165 100644 --- a/src/plugins/graphicssystems/blittable/blittable.pro +++ b/src/plugins/graphicssystems/blittable/blittable.pro @@ -5,8 +5,7 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems SOURCES = main.cpp HEADERS = qblittable_image.h \ - qgraphicssystem_blittable.h \ - qwindowsurface_imageblittable.h + qgraphicssystem_blittable.h target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems INSTALLS += target diff --git a/src/plugins/graphicssystems/blittable/qgraphicssystem_blittable.h b/src/plugins/graphicssystems/blittable/qgraphicssystem_blittable.h index b42021e..d45907f 100644 --- a/src/plugins/graphicssystems/blittable/qgraphicssystem_blittable.h +++ b/src/plugins/graphicssystems/blittable/qgraphicssystem_blittable.h @@ -43,5 +43,11 @@ public: QImage *image = new QImage(size, QImage::Format_ARGB32_Premultiplied); return new QImageBlittable(image,true); } + + QList screens() + { return m_screens; } + + QList m_screens; }; + diff --git a/src/plugins/graphicssystems/fb_base/fb_base.cpp b/src/plugins/graphicssystems/fb_base/fb_base.cpp deleted file mode 100644 index d30746a..0000000 --- a/src/plugins/graphicssystems/fb_base/fb_base.cpp +++ /dev/null @@ -1,364 +0,0 @@ -#include "fb_base.h" - -#include -#include -#include -#include -#include - -QGraphicsSystemSoftwareCursor::QGraphicsSystemSoftwareCursor(QGraphicsSystemScreen *scr) - : QGraphicsSystemCursor(scr), currentRect(QRect()), prevRect(QRect()) -{ - graphic = new QGraphicsSystemCursorImage(0, 0, 0, 0, 0, 0); - setCursor(Qt::ArrowCursor); -} - -QRect QGraphicsSystemSoftwareCursor::getCurrentRect() -{ - QRect rect = graphic->image()->rect().translated(-graphic->hotspot().x(), - -graphic->hotspot().y()); - rect.translate(QCursor::pos()); - return rect; -} - - -void QGraphicsSystemSoftwareCursor::pointerEvent(const QMouseEvent & e) -{ - Q_UNUSED(e); - currentRect = getCurrentRect(); - screen->setDirty(currentRect); -} - -QRect QGraphicsSystemSoftwareCursor::drawCursor(QPainter & painter) -{ - if (currentRect.isNull()) - return QRect(); - - prevRect = currentRect; - painter.drawImage(prevRect, *graphic->image()); - return prevRect; -} - -QRect QGraphicsSystemSoftwareCursor::dirtyRect() -{ - if (!prevRect.isNull()) { - QRect rect = prevRect; - prevRect = QRect(); - return rect; - } - return QRect(); -} - -void QGraphicsSystemSoftwareCursor::setCursor(Qt::CursorShape shape) -{ - graphic->set(shape); -} - -void QGraphicsSystemSoftwareCursor::setCursor(const QImage * image, int hotx, int hoty) -{ - graphic->set(image, hotx, hoty); -} - -void QGraphicsSystemSoftwareCursor::setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) -{ - graphic->set(data, mask, width, height, hotX, hotY); -} - -void QGraphicsSystemSoftwareCursor::changeCursor(QCursor * widgetCursor, QWidget * widget) -{ - Q_UNUSED(widget); - Qt::CursorShape shape = widgetCursor->shape(); - - if (shape == Qt::BitmapCursor) { - // application supplied cursor - QPoint spot = widgetCursor->hotSpot(); - setCursor(&widgetCursor->pixmap().toImage(), spot.x(), spot.y()); - } else { - // system cursor - setCursor(shape); - } - currentRect = getCurrentRect(); - screen->setDirty(currentRect); -} - -QGraphicsSystemFbScreen::QGraphicsSystemFbScreen() : cursor(0), mGeometry(), mDepth(16), mFormat(QImage::Format_RGB16), mScreenImage(0), compositePainter(0), isUpToDate(false) -{ - mScreenImage = new QImage(mGeometry.size(), mFormat); - redrawTimer.setSingleShot(true); - redrawTimer.setInterval(0); - QObject::connect(&redrawTimer, SIGNAL(timeout()), this, SLOT(doRedraw())); -} - -void QGraphicsSystemFbScreen::setGeometry(QRect rect) -{ - delete mScreenImage; - mGeometry = rect; - mScreenImage = new QImage(mGeometry.size(), mFormat); - delete compositePainter; - compositePainter = 0; - invalidateRectCache(); -} - -void QGraphicsSystemFbScreen::setDepth(int depth) -{ - mDepth = depth; -} - -void QGraphicsSystemFbScreen::setPhysicalSize(QSize size) -{ - mPhysicalSize = size; -} - -void QGraphicsSystemFbScreen::setFormat(QImage::Format format) -{ - mFormat = format; - delete mScreenImage; - mScreenImage = new QImage(mGeometry.size(), mFormat); - delete compositePainter; - compositePainter = 0; -} - -QGraphicsSystemFbScreen::~QGraphicsSystemFbScreen() -{ - delete compositePainter; - delete mScreenImage; -} - -void QGraphicsSystemFbScreen::setDirty(const QRect &rect) -{ - repaintRegion += rect; - if (!redrawTimer.isActive()) { - redrawTimer.start(); - } -} - -void QGraphicsSystemFbScreen::generateRects() -{ - cachedRects.clear(); - QRegion remainingScreen(mGeometry); - - for (int i = 0; i < windowStack.length(); i++) { - if (remainingScreen.isEmpty()) - break; - if (!windowStack[i]->window()->testAttribute(Qt::WA_TranslucentBackground)) { - remainingScreen -= windowStack[i]->geometry(); - QRegion windowRegion(windowStack[i]->geometry()); - windowRegion -= remainingScreen; - foreach(QRect rect, windowRegion.rects()) { - cachedRects += QPair(rect, i); - } - } - } - foreach (QRect rect, remainingScreen.rects()) - cachedRects += QPair(rect, -1); - isUpToDate = true; - return; -} - - - -QRegion QGraphicsSystemFbScreen::doRedraw() -{ - QRegion touchedRegion; - if (cursor) - repaintRegion += cursor->dirtyRect(); - if (repaintRegion.isEmpty()) - return touchedRegion; - - QVector rects = repaintRegion.rects(); - - if (!isUpToDate) - generateRects(); - - if (!compositePainter) - compositePainter = new QPainter(mScreenImage); - for (int rectIndex = 0; rectIndex < repaintRegion.numRects(); rectIndex++) { - QRegion rectRegion = rects[rectIndex]; - - for(int i = 0; i < cachedRects.length(); i++) { - QRect screenSubRect = cachedRects[i].first; - int layer = cachedRects[i].second; - QRegion intersect = rectRegion.intersected(screenSubRect); - - if (intersect.isEmpty()) - continue; - - rectRegion -= intersect; - - // we only expect one rectangle, but defensive coding... - foreach (QRect rect, intersect.rects()) { - bool firstLayer = true; - if (layer == -1) { - compositePainter->fillRect(rect, Qt::black); - firstLayer = false; - layer = windowStack.size() - 1; - } - - for (int layerIndex = layer; layerIndex != -1; layerIndex--) { - if (!windowStack[layerIndex]->visible()) - continue; - if (windowStack[layerIndex]->window()->isMinimized()) - continue; - QRect windowRect = windowStack[layerIndex]->geometry(); - QRect windowIntersect = rect.translated(-windowRect.left(), - -windowRect.top()); - compositePainter->drawImage(rect, windowStack[layerIndex]->image(), - windowIntersect); - if (firstLayer) { - firstLayer = false; - } - } - } - } - if (!rectRegion.isEmpty()) - qWarning() << "non-empty region!" << rectRegion; - // Everything on screen should be mapped to a sub-rectangle - // unless it's off the screen... - } - - QRect cursorRect; - if (cursor) { - cursorRect = cursor->drawCursor(*compositePainter); - touchedRegion += cursorRect; - } - touchedRegion += repaintRegion; - repaintRegion = QRegion(); - - return touchedRegion; -} - -void QGraphicsSystemFbScreen::removeWindowSurface(QGraphicsSystemFbWindowSurface * surface) -{ - windowStack.removeOne(surface); - invalidateRectCache(); - setDirty(surface->geometry()); -} - -void QGraphicsSystemFbWindowSurface::raise() -{ - mScreen->raise(this); -} - -void QGraphicsSystemFbScreen::raise(QWindowSurface * surface) -{ - QGraphicsSystemFbWindowSurface *s = static_cast(surface); - int index = windowStack.indexOf(s); - if (index <= 0) - return; - windowStack.move(index, 0); - invalidateRectCache(); - setDirty(s->geometry()); -} - -void QGraphicsSystemFbWindowSurface::lower() -{ - mScreen->lower(this); -} - -void QGraphicsSystemFbScreen::lower(QWindowSurface * surface) -{ - QGraphicsSystemFbWindowSurface *s = static_cast(surface); - int index = windowStack.indexOf(s); - if (index == -1 || index == (windowStack.size() - 1)) - return; - windowStack.move(index, windowStack.size() - 1); - invalidateRectCache(); - setDirty(s->geometry()); -} - -QWidget * QGraphicsSystemFbScreen::topLevelAt(const QPoint & p) const -{ - for(int i = 0; i < windowStack.size(); i++) { - if (windowStack[i]->geometry().contains(p, false) && - windowStack[i]->visible() && - !windowStack[i]->window()->isMinimized()) { - return windowStack[i]->window(); - } - } - return 0; -} - -QGraphicsSystemFbWindowSurface::QGraphicsSystemFbWindowSurface(QGraphicsSystemFbScreen *screen, QWidget *window) - : QWindowSurface(window), - mScreen(screen), - visibleFlag(false) -{ - static QAtomicInt winIdGenerator(1); - - mImage = QImage(window->size(), mScreen->format()); - windowId = winIdGenerator.fetchAndAddRelaxed(1); -} - -QGraphicsSystemFbWindowSurface::~QGraphicsSystemFbWindowSurface() -{ - mScreen->removeWindowSurface(this); -} - -void QGraphicsSystemFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) -{ - Q_UNUSED(widget); - Q_UNUSED(offset); - - QRect currentGeometry = geometry(); - // If this is a move, redraw the previous location - if (oldGeometry != currentGeometry) { - mScreen->setDirty(oldGeometry); - oldGeometry = currentGeometry; - } - - QRect dirtyClient = region.boundingRect(); - QRect dirtyRegion(currentGeometry.left() + dirtyClient.left(), - currentGeometry.top() + dirtyClient.top(), - dirtyClient.width(), - dirtyClient.height()); - mScreen->setDirty(dirtyRegion); -} - -void QGraphicsSystemFbWindowSurface::setGeometry(const QRect &rect) -{ - // store previous geometry for screen update - oldGeometry = geometry(); - - // change the widget's QImage if this is a resize - if (mImage.size() != rect.size()) - mImage = QImage(rect.size(), mScreen->format()); - - mScreen->invalidateRectCache(); - QWindowSystemInterface::handleGeometryChange(window(), rect); - - QWindowSurface::setGeometry(rect); -} - -bool QGraphicsSystemFbWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - return QWindowSurface::scroll(area, dx, dy); -} - -void QGraphicsSystemFbWindowSurface::beginPaint(const QRegion ®ion) -{ - Q_UNUSED(region); -} - -void QGraphicsSystemFbWindowSurface::endPaint(const QRegion ®ion) -{ - Q_UNUSED(region); -} - -void QGraphicsSystemFbWindowSurface::setVisible(bool visible) -{ - visibleFlag = visible; - mScreen->invalidateRectCache(); - mScreen->setDirty(geometry()); -} - -Qt::WindowFlags QGraphicsSystemFbWindowSurface::setWindowFlags(Qt::WindowFlags type) -{ - flags = type; - mScreen->invalidateRectCache(); - return flags; -} - -Qt::WindowFlags QGraphicsSystemFbWindowSurface::windowFlags() const -{ - return flags; -} diff --git a/src/plugins/graphicssystems/fb_base/fb_base.h b/src/plugins/graphicssystems/fb_base/fb_base.h deleted file mode 100644 index 7f9b005..0000000 --- a/src/plugins/graphicssystems/fb_base/fb_base.h +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef QLIGHTHOUSEGRAPHICSSCREEN_H -#define QLIGHTHOUSEGRAPHICSSCREEN_H - -#include -#include -#include -#include -#include -#include - -class QMouseEvent; -class QSize; -class QPainter; - -class QGraphicsSystemFbScreen; - -class QGraphicsSystemSoftwareCursor : public QGraphicsSystemCursor -{ -public: - QGraphicsSystemSoftwareCursor(QGraphicsSystemScreen * scr); - - // output methods - QRect dirtyRect(); - virtual QRect drawCursor(QPainter & painter); - - // input methods - virtual void pointerEvent(const QMouseEvent & event); - virtual void changeCursor(QCursor * widgetCursor, QWidget * widget); - -protected: - QGraphicsSystemCursorImage * graphic; - -private: - void setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); - void setCursor(Qt::CursorShape shape); - void setCursor(const QImage * image, int hotx, int hoty); - QRect currentRect; // next place to draw the cursor - QRect prevRect; // last place the cursor was drawn - QRect getCurrentRect(); -}; - -class QGraphicsSystemFbWindowSurface : public QWindowSurface -{ -public: - QGraphicsSystemFbWindowSurface(QGraphicsSystemFbScreen *screen, QWidget *window); - ~QGraphicsSystemFbWindowSurface(); - - virtual QPaintDevice *paintDevice() { return &mImage; } - virtual void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - virtual bool scroll(const QRegion &area, int dx, int dy); - - virtual void beginPaint(const QRegion ®ion); - virtual void endPaint(const QRegion ®ion); - virtual void setVisible(bool visible); - virtual bool visible() { return visibleFlag; } - - const QImage image() { return mImage; } - void setGeometry(const QRect &rect); - - virtual void raise(); - virtual void lower(); - - virtual Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); - virtual Qt::WindowFlags windowFlags() const; - - WId winId() const { return windowId; } -protected: - QGraphicsSystemFbScreen *mScreen; - QRect oldGeometry; - QImage mImage; - bool visibleFlag; - Qt::WindowFlags flags; - - WId windowId; -}; - -class QGraphicsSystemFbScreen : public QGraphicsSystemScreen -{ - Q_OBJECT -public: - QGraphicsSystemFbScreen(); - ~QGraphicsSystemFbScreen(); - - virtual QRect geometry() const { return mGeometry; } - virtual int depth() const { return mDepth; } - virtual QImage::Format format() const { return mFormat; } - virtual QSize physicalSize() const { return mPhysicalSize; } - - virtual void setGeometry(QRect rect); - virtual void setDepth(int depth); - virtual void setFormat(QImage::Format format); - virtual void setPhysicalSize(QSize size); - - virtual void setDirty(const QRect &rect); - - virtual void removeWindowSurface(QGraphicsSystemFbWindowSurface * surface); - virtual void addWindowSurface(QGraphicsSystemFbWindowSurface * surface) { - windowStack.prepend(surface); invalidateRectCache(); } - virtual void raise(QWindowSurface * surface); - virtual void lower(QWindowSurface * surface); - virtual QWidget * topLevelAt(const QPoint & p) const; - - QImage * image() const { return mScreenImage; } - QPaintDevice * paintDevice() const { return mScreenImage; } - -protected: - QList windowStack; - QRegion repaintRegion; - QGraphicsSystemSoftwareCursor * cursor; - QTimer redrawTimer; - -protected slots: - virtual QRegion doRedraw(); - -protected: - QRect mGeometry; - int mDepth; - QImage::Format mFormat; - QSize mPhysicalSize; - QImage *mScreenImage; - -private: - QPainter * compositePainter; - void generateRects(); - QList > cachedRects; - - void invalidateRectCache() { isUpToDate = false; } - friend class QGraphicsSystemFbWindowSurface; - bool isUpToDate; -}; - -#endif // QLIGHTHOUSEGRAPHICSSCREEN_H diff --git a/src/plugins/graphicssystems/fb_base/fb_base.pri b/src/plugins/graphicssystems/fb_base/fb_base.pri deleted file mode 100644 index 41bd87f..0000000 --- a/src/plugins/graphicssystems/fb_base/fb_base.pri +++ /dev/null @@ -1,2 +0,0 @@ -SOURCES += ../fb_base/fb_base.cpp -HEADERS += ../fb_base/fb_base.h diff --git a/src/plugins/graphicssystems/fb_base/fb_base.pro b/src/plugins/graphicssystems/fb_base/fb_base.pro deleted file mode 100644 index e08c0c5..0000000 --- a/src/plugins/graphicssystems/fb_base/fb_base.pro +++ /dev/null @@ -1,23 +0,0 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2009-11-05T13:22:31 -# -#------------------------------------------------- - -#QT -= core gui -TARGET = fb_base -#include(../../qpluginbase.pri) - -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems - -TEMPLATE = lib - -#DEFINES += STATIC_LIBRARY -CONFIG += staticlib - -SOURCES += fb_base.cpp - -HEADERS += fb_base.h - -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems -INSTALLS += target diff --git a/src/plugins/graphicssystems/graphicssystems.pro b/src/plugins/graphicssystems/graphicssystems.pro index a5116d0..c00c9ff 100644 --- a/src/plugins/graphicssystems/graphicssystems.pro +++ b/src/plugins/graphicssystems/graphicssystems.pro @@ -13,11 +13,3 @@ contains(QT_CONFIG, shivavg) { # Only works under X11 at present !win32:!embedded:!mac:SUBDIRS += shivavg } - -embedded_lite: { - SUBDIRS += minimal -} - -embedded_lite:x11 { - SUBDIRS += linuxfb -} diff --git a/src/plugins/graphicssystems/linuxfb/linuxfb.pro b/src/plugins/graphicssystems/linuxfb/linuxfb.pro deleted file mode 100644 index 031b843..0000000 --- a/src/plugins/graphicssystems/linuxfb/linuxfb.pro +++ /dev/null @@ -1,12 +0,0 @@ -TARGET = qlinuxfbgraphicssystem -include(../../qpluginbase.pri) - -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems - -SOURCES = main.cpp qgraphicssystem_linuxfb.cpp -HEADERS = qgraphicssystem_linuxfb.h - -include(../fb_base/fb_base.pri) - -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems -INSTALLS += target diff --git a/src/plugins/graphicssystems/linuxfb/main.cpp b/src/plugins/graphicssystems/linuxfb/main.cpp deleted file mode 100644 index 4d03fe5..0000000 --- a/src/plugins/graphicssystems/linuxfb/main.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "qgraphicssystem_linuxfb.h" - -QT_BEGIN_NAMESPACE - -class QLinuxFbGraphicsSystemPlugin : public QGraphicsSystemPlugin -{ -public: - QStringList keys() const; - QGraphicsSystem *create(const QString&); -}; - -QStringList QLinuxFbGraphicsSystemPlugin::keys() const -{ - QStringList list; - list << "LinuxFb"; - return list; -} - -QGraphicsSystem* QLinuxFbGraphicsSystemPlugin::create(const QString& system) -{ - if (system.toLower() == "linuxfb") - return new QLinuxFbGraphicsSystem; - - return 0; -} - -Q_EXPORT_PLUGIN2(linuxfb, QLinuxFbGraphicsSystemPlugin) - -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp deleted file mode 100644 index 44960bb..0000000 --- a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.cpp +++ /dev/null @@ -1,856 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgraphicssystem_linuxfb.h" -#include "../fb_base/fb_base.h" -#include -#include // overrides QT_OPEN -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if !defined(Q_OS_DARWIN) && !defined(Q_OS_FREEBSD) -#include - -#ifdef __i386__ -#include -#endif -#endif - -QT_BEGIN_NAMESPACE - -class QLinuxFbGraphicsSystemPrivate -{ -public: - QLinuxFbGraphicsSystemPrivate(); - ~QLinuxFbGraphicsSystemPrivate(); - - void openTty(); - void closeTty(); - - int fd; - int startupw; - int startuph; - int startupd; - bool blank; - - bool doGraphicsMode; -#ifdef QT_QWS_DEPTH_GENERIC - bool doGenericColors; -#endif - int ttyfd; - long oldKdMode; - QString ttyDevice; - QString displaySpec; -}; - -QLinuxFbGraphicsSystemPrivate::QLinuxFbGraphicsSystemPrivate() - : fd(-1), blank(true), doGraphicsMode(true), -#ifdef QT_QWS_DEPTH_GENERIC - doGenericColors(false), -#endif - ttyfd(-1), oldKdMode(KD_TEXT) -{ -} - -QLinuxFbGraphicsSystemPrivate::~QLinuxFbGraphicsSystemPrivate() -{ - closeTty(); -} - -void QLinuxFbGraphicsSystemPrivate::openTty() -{ - const char *const devs[] = {"/dev/tty0", "/dev/tty", "/dev/console", 0}; - - if (ttyDevice.isEmpty()) { - for (const char * const *dev = devs; *dev; ++dev) { - ttyfd = QT_OPEN(*dev, O_RDWR); - if (ttyfd != -1) - break; - } - } else { - ttyfd = QT_OPEN(ttyDevice.toAscii().constData(), O_RDWR); - } - - if (ttyfd == -1) - return; - - if (doGraphicsMode) { - ioctl(ttyfd, KDGETMODE, &oldKdMode); - if (oldKdMode != KD_GRAPHICS) { - int ret = ioctl(ttyfd, KDSETMODE, KD_GRAPHICS); - if (ret == -1) - doGraphicsMode = false; - } - } - - // No blankin' screen, no blinkin' cursor!, no cursor! - const char termctl[] = "\033[9;0]\033[?33l\033[?25l\033[?1c"; - QT_WRITE(ttyfd, termctl, sizeof(termctl)); -} - -void QLinuxFbGraphicsSystemPrivate::closeTty() -{ - if (ttyfd == -1) - return; - - if (doGraphicsMode) - ioctl(ttyfd, KDSETMODE, oldKdMode); - - // Blankin' screen, blinkin' cursor! - const char termctl[] = "\033[9;15]\033[?33h\033[?25h\033[?0c"; - QT_WRITE(ttyfd, termctl, sizeof(termctl)); - - QT_CLOSE(ttyfd); - ttyfd = -1; -} - -QLinuxFbGraphicsSystem::QLinuxFbGraphicsSystem() -{ - d_ptr = new QLinuxFbGraphicsSystemPrivate(); - - // XXX - QString displaySpec = QString::fromLatin1(qgetenv("QWS_DISPLAY")); - - if (!connect(displaySpec)) - qFatal("QLinuxFbGraphicsSystem: could not initialize screen"); - initDevice(); - - // Create a QImage directly on the screen's framebuffer. - // This is the blit target for copying windows to the screen. - mPrimaryScreen = new QLinuxFbGraphicsSystemScreen(data, w, h, lstep, - screenFormat); - mPrimaryScreen->setPhysicalSize(QSize(physWidth, physHeight)); - - mScreens.append(mPrimaryScreen); -} - -QLinuxFbGraphicsSystem::~QLinuxFbGraphicsSystem() -{ - delete mPrimaryScreen; - delete d_ptr; -} - -bool QLinuxFbGraphicsSystem::connect(const QString &displaySpec) -{ - const QStringList args = displaySpec.split(QLatin1Char(':')); - - if (args.contains(QLatin1String("nographicsmodeswitch"))) - d_ptr->doGraphicsMode = false; - -#ifdef QT_QWS_DEPTH_GENERIC - if (args.contains(QLatin1String("genericcolors"))) - d_ptr->doGenericColors = true; -#endif - - QRegExp ttyRegExp(QLatin1String("tty=(.*)")); - if (args.indexOf(ttyRegExp) != -1) - d_ptr->ttyDevice = ttyRegExp.cap(1); - -#if 0 -#if Q_BYTE_ORDER == Q_BIG_ENDIAN -#ifndef QT_QWS_FRAMEBUFFER_LITTLE_ENDIAN - if (args.contains(QLatin1String("littleendian"))) -#endif - QScreen::setFrameBufferLittleEndian(true); -#endif -#endif - - // Check for explicitly specified device - const int len = 8; // "/dev/fbx" - int m = displaySpec.indexOf(QLatin1String("/dev/fb")); - - QString dev; - if (m > 0) - dev = displaySpec.mid(m, len); - else - dev = QLatin1String("/dev/fb0"); - - if (access(dev.toLatin1().constData(), R_OK|W_OK) == 0) - d_ptr->fd = QT_OPEN(dev.toLatin1().constData(), O_RDWR); - if (d_ptr->fd == -1) { - if (access(dev.toLatin1().constData(), R_OK) == 0) - d_ptr->fd = QT_OPEN(dev.toLatin1().constData(), O_RDONLY); - if (d_ptr->fd == 1) { - qWarning("Error opening framebuffer device %s", qPrintable(dev)); - return false; - } - } - - fb_fix_screeninfo finfo; - fb_var_screeninfo vinfo; - //####################### - // Shut up Valgrind - memset(&vinfo, 0, sizeof(vinfo)); - memset(&finfo, 0, sizeof(finfo)); - //####################### - - /* Get fixed screen information */ - if (d_ptr->fd != -1 && ioctl(d_ptr->fd, FBIOGET_FSCREENINFO, &finfo)) { - perror("QLinuxFbGraphicsSystem::connect"); - qWarning("Error reading fixed information"); - return false; - } - - if (finfo.type == FB_TYPE_VGA_PLANES) { - qWarning("VGA16 video mode not supported"); - return false; - } - - /* Get variable screen information */ - if (d_ptr->fd != -1 && ioctl(d_ptr->fd, FBIOGET_VSCREENINFO, &vinfo)) { - perror("QLinuxFbGraphicsSystem::connect"); - qWarning("Error reading variable information"); - return false; - } - - grayscale = vinfo.grayscale; - d = vinfo.bits_per_pixel; - if (d == 24) { - d = vinfo.red.length + vinfo.green.length + vinfo.blue.length; - if (d <= 0) - d = 24; // reset if color component lengths are not reported - } else if (d == 16) { - d = vinfo.red.length + vinfo.green.length + vinfo.blue.length; - if (d <= 0) - d = 16; - } - lstep = finfo.line_length; - - int xoff = vinfo.xoffset; - int yoff = vinfo.yoffset; - const char* qwssize; - if((qwssize=::getenv("QWS_SIZE")) && sscanf(qwssize,"%dx%d",&w,&h)==2) { - if (d_ptr->fd != -1) { - if ((uint)w > vinfo.xres) w = vinfo.xres; - if ((uint)h > vinfo.yres) h = vinfo.yres; - } - dw=w; - dh=h; - int xxoff, yyoff; - if (sscanf(qwssize, "%*dx%*d+%d+%d", &xxoff, &yyoff) == 2) { - if (xxoff < 0 || xxoff + w > (int)(vinfo.xres)) - xxoff = vinfo.xres - w; - if (yyoff < 0 || yyoff + h > (int)(vinfo.yres)) - yyoff = vinfo.yres - h; - xoff += xxoff; - yoff += yyoff; - } else { - xoff += (vinfo.xres - w)/2; - yoff += (vinfo.yres - h)/2; - } - } else { - dw=w=vinfo.xres; - dh=h=vinfo.yres; - } - - if (w == 0 || h == 0) { - qWarning("QLinuxFbGraphicsSystem::connect(): Unable to find screen geometry, " - "will use 320x240."); - dw = w = 320; - dh = h = 240; - } - - setPixelFormat(vinfo); - - // Handle display physical size spec. - QStringList displayArgs = displaySpec.split(QLatin1Char(':')); - QRegExp mmWidthRx(QLatin1String("mmWidth=?(\\d+)")); - int dimIdxW = displayArgs.indexOf(mmWidthRx); - QRegExp mmHeightRx(QLatin1String("mmHeight=?(\\d+)")); - int dimIdxH = displayArgs.indexOf(mmHeightRx); - if (dimIdxW >= 0) { - mmWidthRx.exactMatch(displayArgs.at(dimIdxW)); - physWidth = mmWidthRx.cap(1).toInt(); - if (dimIdxH < 0) - physHeight = dh*physWidth/dw; - } - if (dimIdxH >= 0) { - mmHeightRx.exactMatch(displayArgs.at(dimIdxH)); - physHeight = mmHeightRx.cap(1).toInt(); - if (dimIdxW < 0) - physWidth = dw*physHeight/dh; - } - if (dimIdxW < 0 && dimIdxH < 0) { - if (vinfo.width != 0 && vinfo.height != 0 - && vinfo.width != UINT_MAX && vinfo.height != UINT_MAX) { - physWidth = vinfo.width; - physHeight = vinfo.height; - } else { - const int dpi = 72; - physWidth = qRound(dw * 25.4 / dpi); - physHeight = qRound(dh * 25.4 / dpi); - } - } - - dataoffset = yoff * lstep + xoff * d / 8; - //qDebug("Using %dx%dx%d screen",w,h,d); - - /* Figure out the size of the screen in bytes */ - size = h * lstep; - - mapsize = finfo.smem_len; - - data = (unsigned char *)-1; - if (d_ptr->fd != -1) - data = (unsigned char *)mmap(0, mapsize, PROT_READ | PROT_WRITE, - MAP_SHARED, d_ptr->fd, 0); - - if ((long)data == -1) { - perror("QLinuxFbGraphicsSystem::connect"); - qWarning("Error: failed to map framebuffer device to memory."); - return false; - } else { - data += dataoffset; - } - -#if 0 - canaccel = useOffscreen(); - if(canaccel) - setupOffScreen(); -#endif - canaccel = false; - - // Now read in palette - if((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4)) { - screencols= (vinfo.bits_per_pixel==8) ? 256 : 16; - int loopc; - fb_cmap startcmap; - startcmap.start=0; - startcmap.len=screencols; - startcmap.red=(unsigned short int *) - malloc(sizeof(unsigned short int)*screencols); - startcmap.green=(unsigned short int *) - malloc(sizeof(unsigned short int)*screencols); - startcmap.blue=(unsigned short int *) - malloc(sizeof(unsigned short int)*screencols); - startcmap.transp=(unsigned short int *) - malloc(sizeof(unsigned short int)*screencols); - if (d_ptr->fd == -1 || ioctl(d_ptr->fd, FBIOGETCMAP, &startcmap)) { - perror("QLinuxFbGraphicsSystem::connect"); - qWarning("Error reading palette from framebuffer, using default palette"); - createPalette(startcmap, vinfo, finfo); - } - int bits_used = 0; - for(loopc=0;loopc> 8, - startcmap.green[loopc] >> 8, - startcmap.blue[loopc] >> 8); - bits_used |= startcmap.red[loopc] - | startcmap.green[loopc] - | startcmap.blue[loopc]; - } - // WORKAROUND: Some framebuffer drivers only return 8 bit - // color values, so we need to not bit shift them.. - if ((bits_used & 0x00ff) && !(bits_used & 0xff00)) { - for(loopc=0;loopcopenTty(); - - // Grab current mode so we can reset it - fb_var_screeninfo vinfo; - fb_fix_screeninfo finfo; - //####################### - // Shut up Valgrind - memset(&vinfo, 0, sizeof(vinfo)); - memset(&finfo, 0, sizeof(finfo)); - //####################### - - if (ioctl(d_ptr->fd, FBIOGET_VSCREENINFO, &vinfo)) { - perror("QLinuxFbScreen::initDevice"); - qFatal("Error reading variable information in card init"); - return false; - } - -#ifdef DEBUG_VINFO - qDebug("Greyscale %d",vinfo.grayscale); - qDebug("Nonstd %d",vinfo.nonstd); - qDebug("Red %d %d %d",vinfo.red.offset,vinfo.red.length, - vinfo.red.msb_right); - qDebug("Green %d %d %d",vinfo.green.offset,vinfo.green.length, - vinfo.green.msb_right); - qDebug("Blue %d %d %d",vinfo.blue.offset,vinfo.blue.length, - vinfo.blue.msb_right); - qDebug("Transparent %d %d %d",vinfo.transp.offset,vinfo.transp.length, - vinfo.transp.msb_right); -#endif - - d_ptr->startupw=vinfo.xres; - d_ptr->startuph=vinfo.yres; - d_ptr->startupd=vinfo.bits_per_pixel; - grayscale = vinfo.grayscale; - - if (ioctl(d_ptr->fd, FBIOGET_FSCREENINFO, &finfo)) { - perror("QLinuxFbScreen::initDevice"); - qCritical("Error reading fixed information in card init"); - // It's not an /error/ as such, though definitely a bad sign - // so we return true - return true; - } - -#ifdef __i386__ - // Now init mtrr - if(!::getenv("QWS_NOMTRR")) { - int mfd=QT_OPEN("/proc/mtrr",O_WRONLY,0); - // MTRR entry goes away when file is closed - i.e. - // hopefully when QWS is killed - if(mfd != -1) { - mtrr_sentry sentry; - sentry.base=(unsigned long int)finfo.smem_start; - //qDebug("Physical framebuffer address %p",(void*)finfo.smem_start); - // Size needs to be in 4k chunks, but that's not always - // what we get thanks to graphics card registers. Write combining - // these is Not Good, so we write combine what we can - // (which is not much - 4 megs on an 8 meg card, it seems) - unsigned int size=finfo.smem_len; - size=size >> 22; - size=size << 22; - sentry.size=size; - sentry.type=MTRR_TYPE_WRCOMB; - if(ioctl(mfd,MTRRIOC_ADD_ENTRY,&sentry)==-1) { - //printf("Couldn't add mtrr entry for %lx %lx, %s\n", - //sentry.base,sentry.size,strerror(errno)); - } - } - - // Should we close mfd here? - //QT_CLOSE(mfd); - } -#endif - if ((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4) || (finfo.visual==FB_VISUAL_DIRECTCOLOR)) - { - fb_cmap cmap; - createPalette(cmap, vinfo, finfo); - if (ioctl(d_ptr->fd, FBIOPUTCMAP, &cmap)) { - perror("QLinuxFbScreen::initDevice"); - qWarning("Error writing palette to framebuffer"); - } - free(cmap.red); - free(cmap.green); - free(cmap.blue); - free(cmap.transp); - } - -#if 0 - if (canaccel) { - *entryp=0; - *lowest = mapsize; - insert_entry(*entryp, *lowest, *lowest); // dummy entry to mark start - } - - shared->fifocount = 0; - shared->buffer_offset = 0xffffffff; // 0 would be a sensible offset (screen) - shared->linestep = 0; - shared->cliptop = 0xffffffff; - shared->clipleft = 0xffffffff; - shared->clipright = 0xffffffff; - shared->clipbottom = 0xffffffff; - shared->rop = 0xffffffff; -#endif - -#ifdef QT_QWS_DEPTH_GENERIC - if (pixelFormat() == QImage::Format_Invalid && screencols == 0 - && d_ptr->doGenericColors) - { - qt_set_generic_blit(this, vinfo.bits_per_pixel, - vinfo.red.length, vinfo.green.length, - vinfo.blue.length, vinfo.transp.length, - vinfo.red.offset, vinfo.green.offset, - vinfo.blue.offset, vinfo.transp.offset); - } -#endif - -#if 0 -#ifndef QT_NO_QWS_CURSOR - QScreenCursor::initSoftwareCursor(); -#endif -#endif - blank(false); - - return true; -} - -void QLinuxFbGraphicsSystem::setPixelFormat(struct fb_var_screeninfo info) -{ - const fb_bitfield rgba[4] = { info.red, info.green, - info.blue, info.transp }; - - QImage::Format format = QImage::Format_Invalid; - - switch (d) { - case 32: { - const fb_bitfield argb8888[4] = {{16, 8, 0}, {8, 8, 0}, - {0, 8, 0}, {24, 8, 0}}; - const fb_bitfield abgr8888[4] = {{0, 8, 0}, {8, 8, 0}, - {16, 8, 0}, {24, 8, 0}}; - if (memcmp(rgba, argb8888, 4 * sizeof(fb_bitfield)) == 0) { - format = QImage::Format_ARGB32; - } else if (memcmp(rgba, argb8888, 3 * sizeof(fb_bitfield)) == 0) { - format = QImage::Format_RGB32; - } else if (memcmp(rgba, abgr8888, 3 * sizeof(fb_bitfield)) == 0) { - format = QImage::Format_RGB32; - pixeltype = BGRPixel; - } - break; - } - case 24: { - const fb_bitfield rgb888[4] = {{16, 8, 0}, {8, 8, 0}, - {0, 8, 0}, {0, 0, 0}}; - const fb_bitfield bgr888[4] = {{0, 8, 0}, {8, 8, 0}, - {16, 8, 0}, {0, 0, 0}}; - if (memcmp(rgba, rgb888, 3 * sizeof(fb_bitfield)) == 0) { - format = QImage::Format_RGB888; - } else if (memcmp(rgba, bgr888, 3 * sizeof(fb_bitfield)) == 0) { - format = QImage::Format_RGB888; - pixeltype = BGRPixel; - } - break; - } - case 18: { - const fb_bitfield rgb666[4] = {{12, 6, 0}, {6, 6, 0}, - {0, 6, 0}, {0, 0, 0}}; - if (memcmp(rgba, rgb666, 3 * sizeof(fb_bitfield)) == 0) - format = QImage::Format_RGB666; - break; - } - case 16: { - const fb_bitfield rgb565[4] = {{11, 5, 0}, {5, 6, 0}, - {0, 5, 0}, {0, 0, 0}}; - const fb_bitfield bgr565[4] = {{0, 5, 0}, {5, 6, 0}, - {11, 5, 0}, {0, 0, 0}}; - if (memcmp(rgba, rgb565, 3 * sizeof(fb_bitfield)) == 0) { - format = QImage::Format_RGB16; - } else if (memcmp(rgba, bgr565, 3 * sizeof(fb_bitfield)) == 0) { - format = QImage::Format_RGB16; - pixeltype = BGRPixel; - } - break; - } - case 15: { - const fb_bitfield rgb1555[4] = {{10, 5, 0}, {5, 5, 0}, - {0, 5, 0}, {15, 1, 0}}; - const fb_bitfield bgr1555[4] = {{0, 5, 0}, {5, 5, 0}, - {10, 5, 0}, {15, 1, 0}}; - if (memcmp(rgba, rgb1555, 3 * sizeof(fb_bitfield)) == 0) { - format = QImage::Format_RGB555; - } else if (memcmp(rgba, bgr1555, 3 * sizeof(fb_bitfield)) == 0) { - format = QImage::Format_RGB555; - pixeltype = BGRPixel; - } - break; - } - case 12: { - const fb_bitfield rgb444[4] = {{8, 4, 0}, {4, 4, 0}, - {0, 4, 0}, {0, 0, 0}}; - if (memcmp(rgba, rgb444, 3 * sizeof(fb_bitfield)) == 0) - format = QImage::Format_RGB444; - break; - } - case 8: - break; - case 1: - format = QImage::Format_Mono; //###: LSB??? - break; - default: - break; - } - - screenFormat = format; -} - -void QLinuxFbGraphicsSystem::createPalette(fb_cmap &cmap, fb_var_screeninfo &vinfo, fb_fix_screeninfo &finfo) -{ - if((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4)) { - screencols= (vinfo.bits_per_pixel==8) ? 256 : 16; - cmap.start=0; - cmap.len=screencols; - cmap.red=(unsigned short int *) - malloc(sizeof(unsigned short int)*screencols); - cmap.green=(unsigned short int *) - malloc(sizeof(unsigned short int)*screencols); - cmap.blue=(unsigned short int *) - malloc(sizeof(unsigned short int)*screencols); - cmap.transp=(unsigned short int *) - malloc(sizeof(unsigned short int)*screencols); - - if (screencols==16) { - if (finfo.type == FB_TYPE_PACKED_PIXELS) { - // We'll setup a grayscale cmap for 4bpp linear - int val = 0; - for (int idx = 0; idx < 16; ++idx, val += 17) { - cmap.red[idx] = (val<<8)|val; - cmap.green[idx] = (val<<8)|val; - cmap.blue[idx] = (val<<8)|val; - screenclut[idx]=qRgb(val, val, val); - } - } else { - // Default 16 colour palette - // Green is now trolltech green so certain images look nicer - // black d_gray l_gray white red green blue cyan magenta yellow - unsigned char reds[16] = { 0x00, 0x7F, 0xBF, 0xFF, 0xFF, 0xA2, 0x00, 0xFF, 0xFF, 0x00, 0x7F, 0x7F, 0x00, 0x00, 0x00, 0x82 }; - unsigned char greens[16] = { 0x00, 0x7F, 0xBF, 0xFF, 0x00, 0xC5, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F }; - unsigned char blues[16] = { 0x00, 0x7F, 0xBF, 0xFF, 0x00, 0x11, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0x7F, 0x7F, 0x7F, 0x00, 0x00 }; - - for (int idx = 0; idx < 16; ++idx) { - cmap.red[idx] = ((reds[idx]) << 8)|reds[idx]; - cmap.green[idx] = ((greens[idx]) << 8)|greens[idx]; - cmap.blue[idx] = ((blues[idx]) << 8)|blues[idx]; - cmap.transp[idx] = 0; - screenclut[idx]=qRgb(reds[idx], greens[idx], blues[idx]); - } - } - } else { - if (grayscale) { - // Build grayscale palette - int i; - for(i=0;iblank == on) - return; - -#if defined(QT_QWS_IPAQ) - if (on) - system("apm -suspend"); -#else - if (d_ptr->fd == -1) - return; -// Some old kernel versions don't have this. These defines should go -// away eventually -#if defined(FBIOBLANK) -#if defined(VESA_POWERDOWN) && defined(VESA_NO_BLANKING) - ioctl(d_ptr->fd, FBIOBLANK, on ? VESA_POWERDOWN : VESA_NO_BLANKING); -#else - ioctl(d_ptr->fd, FBIOBLANK, on ? 1 : 0); -#endif -#endif -#endif - - d_ptr->blank = on; -} - -QPixmapData *QLinuxFbGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const -{ - return new QRasterPixmapData(type); -} - -QWindowSurface *QLinuxFbGraphicsSystem::createWindowSurface(QWidget *widget) const -{ - if (widget->windowType() == Qt::Desktop) - return 0; // Don't create an explicit window surface for the destkop. - QGraphicsSystemFbWindowSurface * surface = - new QGraphicsSystemFbWindowSurface(mPrimaryScreen, widget); - mPrimaryScreen->addWindowSurface(surface); - return surface; -} - -QLinuxFbGraphicsSystemScreen::QLinuxFbGraphicsSystemScreen(uchar * d, int w, - int h, int lstep, QImage::Format screenFormat) : compositePainter(0) -{ - data = d; - mGeometry = QRect(0,0,w,h); - bytesPerLine = lstep; - mFormat = screenFormat; - mDepth = 16; - mScreenImage = new QImage(mGeometry.width(), mGeometry.height(), - mFormat); - mFbScreenImage = new QImage(data, mGeometry.width(), mGeometry.height(), - bytesPerLine, mFormat); - cursor = new QGraphicsSystemSoftwareCursor(this); -} - -void QLinuxFbGraphicsSystemScreen::setGeometry(QRect rect) -{ - mGeometry = rect; - delete mFbScreenImage; - mFbScreenImage = new QImage(data, mGeometry.width(), mGeometry.height(), - bytesPerLine, mFormat); - delete compositePainter; - compositePainter = 0; - - delete mScreenImage; - mScreenImage = new QImage(mGeometry.width(), mGeometry.height(), - mFormat); -} - -void QLinuxFbGraphicsSystemScreen::setFormat(QImage::Format format) -{ - mFormat = format; - delete mFbScreenImage; - mFbScreenImage = new QImage(data, mGeometry.width(), mGeometry.height(), - bytesPerLine, mFormat); - delete compositePainter; - compositePainter = 0; - - delete mScreenImage; - mScreenImage = new QImage(mGeometry.width(), mGeometry.height(), - mFormat); -} - -QRegion QLinuxFbGraphicsSystemScreen::doRedraw() -{ - QRegion touched; - touched = QGraphicsSystemFbScreen::doRedraw(); - - if (!compositePainter) { - compositePainter = new QPainter(mFbScreenImage); - } - - QVector rects = touched.rects(); - for (int i = 0; i < rects.size(); i++) - compositePainter->drawImage(rects[i], *mScreenImage, rects[i]); - return touched; -} -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.h b/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.h deleted file mode 100644 index cc8ce7e..0000000 --- a/src/plugins/graphicssystems/linuxfb/qgraphicssystem_linuxfb.h +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSYSTEM_LINUXFB_H -#define QGRAPHICSSYSTEM_LINUXFB_H - -#include -#include "../fb_base/fb_base.h" - -QT_BEGIN_NAMESPACE - -class QLinuxFbGraphicsSystemScreen : public QGraphicsSystemFbScreen -{ -public: - QLinuxFbGraphicsSystemScreen(uchar * d, int w, int h, int lstep, QImage::Format screenFormat); - void setGeometry(QRect rect); - void setFormat(QImage::Format format); - -public slots: - QRegion doRedraw(); - -private: - QImage * mFbScreenImage; - uchar * data; - int bytesPerLine; - - QPainter *compositePainter; -}; - -class QLinuxFbGraphicsSystemPrivate; -struct fb_cmap; -struct fb_var_screeninfo; -struct fb_fix_screeninfo; - -class QLinuxFbGraphicsSystem : public QGraphicsSystem -{ -public: - QLinuxFbGraphicsSystem(); - ~QLinuxFbGraphicsSystem(); - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; - - QList screens() const { return mScreens; } - -private: - QLinuxFbGraphicsSystemScreen *mPrimaryScreen; - QList mScreens; - QLinuxFbGraphicsSystemPrivate *d_ptr; - - enum PixelType { NormalPixel, BGRPixel }; - - QRgb screenclut[256]; - int screencols; - - uchar * data; - - QImage::Format screenFormat; - int w; - int lstep; - int h; - int d; - PixelType pixeltype; - bool grayscale; - - int dw; - int dh; - - int size; // Screen size - int mapsize; // Total mapped memory - - int displayId; - - int physWidth; - int physHeight; - - bool canaccel; - int dataoffset; - int cacheStart; - - bool connect(const QString &displaySpec); - bool initDevice(); - void setPixelFormat(struct fb_var_screeninfo); - void createPalette(fb_cmap &cmap, fb_var_screeninfo &vinfo, fb_fix_screeninfo &finfo); - void blank(bool on); -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/graphicssystems/minimal/main.cpp b/src/plugins/graphicssystems/minimal/main.cpp deleted file mode 100644 index 2e9d80e..0000000 --- a/src/plugins/graphicssystems/minimal/main.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "qgraphicssystem_minimal.h" - -QT_BEGIN_NAMESPACE - -class QMinimalGraphicsSystemPlugin : public QGraphicsSystemPlugin -{ -public: - QStringList keys() const; - QGraphicsSystem *create(const QString&); -}; - -QStringList QMinimalGraphicsSystemPlugin::keys() const -{ - QStringList list; - list << "Minimal"; - return list; -} - -QGraphicsSystem* QMinimalGraphicsSystemPlugin::create(const QString& system) -{ - if (system.toLower() == "minimal") - return new QMinimalGraphicsSystem; - - return 0; -} - -Q_EXPORT_PLUGIN2(minimal, QMinimalGraphicsSystemPlugin) - -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/minimal/minimal.pro b/src/plugins/graphicssystems/minimal/minimal.pro deleted file mode 100644 index 11604dd..0000000 --- a/src/plugins/graphicssystems/minimal/minimal.pro +++ /dev/null @@ -1,10 +0,0 @@ -TARGET = qminimalgraphicssystem -include(../../qpluginbase.pri) - -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems - -SOURCES = main.cpp qgraphicssystem_minimal.cpp qwindowsurface_minimal.cpp -HEADERS = qgraphicssystem_minimal.h qwindowsurface_minimal.h - -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems -INSTALLS += target diff --git a/src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.cpp b/src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.cpp deleted file mode 100644 index 78aff06..0000000 --- a/src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgraphicssystem_minimal.h" -#include "qwindowsurface_minimal.h" -#include - -QT_BEGIN_NAMESPACE - -QMinimalGraphicsSystem::QMinimalGraphicsSystem() -{ - mPrimaryScreen = new QMinimalGraphicsSystemScreen(); - - mPrimaryScreen->mGeometry = QRect(0, 0, 240, 320); - mPrimaryScreen->mDepth = 16; - mPrimaryScreen->mFormat = QImage::Format_RGB16; - mPrimaryScreen->mPhysicalSize = QSize(40, 54); - - mScreens.append(mPrimaryScreen); -} - -QPixmapData *QMinimalGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const -{ - return new QRasterPixmapData(type); -} - -QWindowSurface *QMinimalGraphicsSystem::createWindowSurface(QWidget *widget) const -{ - return new QMinimalWindowSurface(mPrimaryScreen, widget); -} - -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.h b/src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.h deleted file mode 100644 index 5bf230f..0000000 --- a/src/plugins/graphicssystems/minimal/qgraphicssystem_minimal.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSYSTEM_MINIMAL_H -#define QGRAPHICSSYSTEM_MINIMAL_H - -#include - -QT_BEGIN_NAMESPACE - -class QMinimalGraphicsSystemScreen : public QGraphicsSystemScreen -{ -public: - QMinimalGraphicsSystemScreen() - : mDepth(16), mFormat(QImage::Format_RGB16) {} - ~QMinimalGraphicsSystemScreen() {} - - QRect geometry() const { return mGeometry; } - int depth() const { return mDepth; } - QImage::Format format() const { return mFormat; } - QSize physicalSize() const { return mPhysicalSize; } - -public: - QRect mGeometry; - int mDepth; - QImage::Format mFormat; - QSize mPhysicalSize; -}; - -class QMinimalGraphicsSystem : public QGraphicsSystem -{ -public: - QMinimalGraphicsSystem(); - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; - - QList screens() const { return mScreens; } - -private: - QMinimalGraphicsSystemScreen *mPrimaryScreen; - QList mScreens; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/graphicssystems/minimal/qwindowsurface_minimal.cpp b/src/plugins/graphicssystems/minimal/qwindowsurface_minimal.cpp deleted file mode 100644 index a87e690..0000000 --- a/src/plugins/graphicssystems/minimal/qwindowsurface_minimal.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwindowsurface_minimal.h" -#include "qgraphicssystem_minimal.h" -#include - -QT_BEGIN_NAMESPACE - -QMinimalWindowSurface::QMinimalWindowSurface - (QMinimalGraphicsSystemScreen *screen, QWidget *window) - : QWindowSurface(window), - mScreen(screen) -{ - //qDebug() << "QMinimalWindowSurface::QMinimalWindowSurface:" << (long)this; -} - -QMinimalWindowSurface::~QMinimalWindowSurface() -{ -} - -QPaintDevice *QMinimalWindowSurface::paintDevice() -{ - //qDebug() << "QMinimalWindowSurface::paintDevice"; - return &mImage; -} - -void QMinimalWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) -{ - Q_UNUSED(widget); - Q_UNUSED(region); - Q_UNUSED(offset); - - static int c = 0; - QString filename = QString("output%1.png").arg(c++, 4, 10, QLatin1Char('0')); - qDebug() << "QMinimalWindowSurface::flush() saving contents to" << filename.toLocal8Bit().constData(); - mImage.save(filename); -} - -void QMinimalWindowSurface::setGeometry(const QRect &rect) -{ - //qDebug() << "QMinimalWindowSurface::setGeometry:" << (long)this << rect; - QWindowSurface::setGeometry(rect); - if (mImage.size() != rect.size()) - mImage = QImage(rect.size(), mScreen->format()); -} - -bool QMinimalWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - return QWindowSurface::scroll(area, dx, dy); -} - -void QMinimalWindowSurface::beginPaint(const QRegion ®ion) -{ - Q_UNUSED(region); -} - -void QMinimalWindowSurface::endPaint(const QRegion ®ion) -{ - Q_UNUSED(region); -} - -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/minimal/qwindowsurface_minimal.h b/src/plugins/graphicssystems/minimal/qwindowsurface_minimal.h deleted file mode 100644 index c7593e7..0000000 --- a/src/plugins/graphicssystems/minimal/qwindowsurface_minimal.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_MINIMAL_H -#define QWINDOWSURFACE_MINIMAL_H - -#include - -QT_BEGIN_NAMESPACE - -class QMinimalGraphicsSystemScreen; - -class QMinimalWindowSurface : public QWindowSurface -{ -public: - QMinimalWindowSurface - (QMinimalGraphicsSystemScreen *screen, QWidget *window); - ~QMinimalWindowSurface(); - - QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void setGeometry(const QRect &rect); - bool scroll(const QRegion &area, int dx, int dy); - - void beginPaint(const QRegion ®ion); - void endPaint(const QRegion ®ion); - -private: - QMinimalGraphicsSystemScreen *mScreen; - QImage mImage; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/graphicssystems/minimaldfb/main.cpp b/src/plugins/graphicssystems/minimaldfb/main.cpp deleted file mode 100644 index fe9407c..0000000 --- a/src/plugins/graphicssystems/minimaldfb/main.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "qgraphicssystem_minimaldfb.h" - -QT_BEGIN_NAMESPACE - -class QDirectFbGraphicsSystemPlugin : public QGraphicsSystemPlugin -{ -public: - QStringList keys() const; - QGraphicsSystem *create(const QString&); -}; - -QStringList QDirectFbGraphicsSystemPlugin::keys() const -{ - QStringList list; - list << "MinimalDfb"; - return list; -} - -QGraphicsSystem* QDirectFbGraphicsSystemPlugin::create(const QString& system) -{ - if (system.toLower() == "minimaldfb") - return new QDirectFbGraphicsSystem; - - return 0; -} - -Q_EXPORT_PLUGIN2(directfb, QDirectFbGraphicsSystemPlugin) - -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro b/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro deleted file mode 100644 index b6c2ea8..0000000 --- a/src/plugins/graphicssystems/minimaldfb/minimaldfb.pro +++ /dev/null @@ -1,29 +0,0 @@ -TARGET = qminimaldfb -include(../../qpluginbase.pri) -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems - -isEmpty(DIRECTFB_LIBS) { - DIRECTFB_LIBS = -ldirectfb -lfusion -ldirect -lpthread -} -isEmpty(DIRECTFB_INCLUDEPATH) { - DIRECTFB_INCLUDEPATH = /usr/include/directfb -} - -INCLUDEPATH += $$DIRECTFB_INCLUDEPATH -LIBS += $$DIRECTFB_LIBS - -SOURCES = main.cpp \ - qgraphicssystem_minimaldfb.cpp \ - qwindowsurface_minimaldfb.cpp \ - qblitter_directfb.cpp \ - qdirectfbconvenience.cpp \ - qdirectfbinput.cpp \ - qdirectfbcursor.cpp -HEADERS = qgraphicssystem_minimaldfb.h \ - qwindowsurface_minimaldfb.h \ - qblitter_directfb.h \ - qdirectfbconvenience.h \ - qdirectfbinput.h \ - qdirectfbcursor.h -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems -INSTALLS += target diff --git a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp deleted file mode 100644 index ded57d3..0000000 --- a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#include "qblitter_directfb.h" -#include "qgraphicssystem_minimaldfb.h" -#include "qdirectfbconvenience.h" - -#include - -#include - -#include - -QDirectFbBlitter::QDirectFbBlitter(const QRect &rect, IDirectFBSurface *surface) - : QBlittable(rect, QBlittable::Capabilities(QBlittable::SolidRectCapability - |QBlittable::SourcePixmapCapability - |QBlittable::SourceOverPixmapCapability - |QBlittable::SourceOverScaledPixmapCapability)) -{ - if (surface) { - m_surface = surface; - } else { - DFBSurfaceDescription surfaceDesc; - memset(&surfaceDesc,0,sizeof(DFBSurfaceDescription)); - surfaceDesc.width = rect.width(); - surfaceDesc.height = rect.height(); - surfaceDesc.caps = DSCAPS_PREMULTIPLIED; - surfaceDesc.pixelformat = DSPF_ARGB; - surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_CAPS | DSDESC_PIXELFORMAT); - - IDirectFB *dfb = QDirectFbConvenience::dfbInterface(); - dfb->CreateSurface(dfb,&surfaceDesc, &m_surface); - m_surface->Clear(m_surface,0,0,0,0); - } -} - -QDirectFbBlitter::~QDirectFbBlitter() -{ - unlock(); - m_surface->Release(m_surface); -} - -void QDirectFbBlitter::fillRect(const QRectF &rect, const QColor &color) -{ - m_surface->SetColor(m_surface, color.red(), color.green(), color.blue(), color.alpha()); -// When the blitter api supports non opaque blits, also remember to change -// qpixmap_blitter.cpp::fill -// DFBSurfaceDrawingFlags drawingFlags = color.alpha() ? DSDRAW_BLEND : DSDRAW_NOFX; -// m_surface->SetDrawingFlags(m_surface, drawingFlags); - m_surface->SetDrawingFlags(m_surface, DSDRAW_NOFX); - m_surface->FillRectangle(m_surface, rect.x(), rect.y(), - rect.width(), rect.height()); -} - -void QDirectFbBlitter::drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &srcRect) -{ - QPixmapData *data = pixmap.pixmapData(); - Q_ASSERT(data->width() && data->height()); - Q_ASSERT(data->classId() == QPixmapData::BlitterClass); - QBlittablePixmapData *blitPm = static_cast(data); - QDirectFbBlitter *dfbBlitter = static_cast(blitPm->blittable()); - dfbBlitter->unlock(); - - IDirectFBSurface *s = dfbBlitter->m_surface; - - quint32 blittingFlags = pixmap.hasAlpha()? DSBLIT_BLEND_ALPHACHANNEL : DSBLIT_NOFX; - - s->SetBlittingFlags(s, DFBSurfaceBlittingFlags(blittingFlags)); - m_surface->SetBlittingFlags(m_surface, DFBSurfaceBlittingFlags(blittingFlags)); - m_surface->SetPorterDuff(m_surface,DSPD_SRC_OVER); - m_surface->SetDstBlendFunction(m_surface,DSBF_INVSRCALPHA); - - const DFBRectangle sRect = { srcRect.x(), srcRect.y(), rect.width(), rect.height() }; - - DFBResult result; - if (rect.width() == srcRect.width() && rect.height() == srcRect.height()) - result = m_surface->Blit(m_surface, s, &sRect, rect.x(), rect.y()); - else { - const DFBRectangle dRect = { rect.x(), rect.y(), rect.width(), rect.height() }; - result = m_surface->StretchBlit(m_surface, s, &sRect, &dRect); - } - if (result != DFB_OK) - DirectFBError("QDirectFBBlitter::drawPixmap()", result); -} - -QImage *QDirectFbBlitter::doLock() -{ - Q_ASSERT(m_surface); - Q_ASSERT(rect().isValid()); - - void *mem; - int bpl; - const DFBResult result = m_surface->Lock(m_surface, DFBSurfaceLockFlags(DSLF_WRITE|DSLF_READ), static_cast(&mem), &bpl); - if (result == DFB_OK) { - DFBSurfacePixelFormat dfbFormat; - DFBSurfaceCapabilities dfbCaps; - m_surface->GetPixelFormat(m_surface,&dfbFormat); - m_surface->GetCapabilities(m_surface,&dfbCaps); - QImage::Format format = QDirectFbConvenience::imageFormatFromSurfaceFormat(dfbFormat, dfbCaps); - int w, h; - m_surface->GetSize(m_surface,&w,&h); - m_image = QImage(static_cast(mem),w,h,bpl,format); - } else { - DirectFBError("Failed to lock image", result); - } - - return &m_image; -} - -void QDirectFbBlitter::doUnlock() -{ - m_surface->Unlock(m_surface); -} diff --git a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h b/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h deleted file mode 100644 index 8d24678..0000000 --- a/src/plugins/graphicssystems/minimaldfb/qblitter_directfb.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef QDIRECTFBBLITTER_H -#define QDIRECTFBBLITTER_H - -#include "qdirectfbconvenience.h" - -#include - -#include - -class QDirectFbBlitter : public QBlittable -{ -public: - QDirectFbBlitter(const QRect &rect, IDirectFBSurface *surface = 0); - virtual ~QDirectFbBlitter(); - - virtual void fillRect(const QRectF &rect, const QColor &color); - virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect); - -protected: - virtual QImage *doLock(); - virtual void doUnlock(); - - IDirectFBSurface *m_surface; - QImage m_image; - - friend class QDirectFbConvenience; -}; - -#endif // QDIRECTFBBLITTER_H diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp deleted file mode 100644 index 8594c09..0000000 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.cpp +++ /dev/null @@ -1,335 +0,0 @@ -#include "qdirectfbconvenience.h" -#include "qblitter_directfb.h" - -#include - -IDirectFB *QDirectFbConvenience::dfbInterface() -{ - static IDirectFB *dfb = 0; - if (!dfb) { - DFBResult result = DirectFBCreate(&dfb); - if (result != DFB_OK) { - DirectFBError("QDirectFBConvenience: error creating DirectFB interface",result); - return 0; - } - } - return dfb; -} - -IDirectFBDisplayLayer *QDirectFbConvenience::dfbDisplayLayer(int display) -{ - IDirectFBDisplayLayer *layer; - DFBResult result = QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),display,&layer); - if (result != DFB_OK) { - DirectFBError("QDirectFbConvenience: " - "Unable to get primary display layer!", result); - } - return layer; -} - -QImage::Format QDirectFbConvenience::imageFormatFromSurfaceFormat(const DFBSurfacePixelFormat format, const DFBSurfaceCapabilities caps) -{ - switch (format) { - case DSPF_LUT8: - return QImage::Format_Indexed8; - case DSPF_RGB24: - return QImage::Format_RGB888; - case DSPF_ARGB4444: - return QImage::Format_ARGB4444_Premultiplied; - case DSPF_RGB444: - return QImage::Format_RGB444; - case DSPF_RGB555: - case DSPF_ARGB1555: - return QImage::Format_RGB555; - case DSPF_RGB16: - return QImage::Format_RGB16; - case DSPF_ARGB6666: - return QImage::Format_ARGB6666_Premultiplied; - case DSPF_RGB18: - return QImage::Format_RGB666; - case DSPF_RGB32: - return QImage::Format_RGB32; - case DSPF_ARGB: { - if (caps & DSCAPS_PREMULTIPLIED) - return QImage::Format_ARGB32_Premultiplied; - else return QImage::Format_ARGB32; } - default: - break; - } - return QImage::Format_Invalid; - -} - -int QDirectFbConvenience::colorDepthForSurface(const DFBSurfacePixelFormat format) -{ - return ((0x1f << 7) & format) >> 7; -} - -IDirectFBSurface *QDirectFbConvenience::dfbSurfaceForPixmapData(QPixmapData *pixmapData) -{ - QBlittablePixmapData *blittablePmData = static_cast(pixmapData); - if (blittablePmData) { - QBlittable *blittable = blittablePmData->blittable(); - QDirectFbBlitter *dfbBlitter = static_cast(blittable); - return dfbBlitter->m_surface; - } - return 0; -} - -Qt::MouseButton QDirectFbConvenience::mouseButton(DFBInputDeviceButtonIdentifier identifier) -{ - switch (identifier){ - case DIBI_LEFT: - return Qt::LeftButton; - case DIBI_MIDDLE: - return Qt::MidButton; - case DIBI_RIGHT: - return Qt::RightButton; - default: - return Qt::NoButton; - } -} - -Qt::MouseButtons QDirectFbConvenience::mouseButtons(DFBInputDeviceButtonMask mask) -{ - Qt::MouseButtons buttons = Qt::NoButton; - - if (mask & DIBM_LEFT) { - buttons |= Qt::LeftButton; - } - if (mask & DIBM_MIDDLE) { - buttons |= Qt::MidButton; - } - if (mask & DIBM_RIGHT) { - buttons |= Qt::RightButton; - } - return buttons; -} - -Qt::KeyboardModifiers QDirectFbConvenience::keyboardModifiers(DFBInputDeviceModifierMask mask) -{ - Qt::KeyboardModifiers modifiers = Qt::NoModifier; - - if (mask & DIMM_SHIFT) { - modifiers |= Qt::ShiftModifier; - } - if (mask & DIMM_ALT) { - modifiers |= Qt::AltModifier; - } - if (mask & DIMM_ALTGR) { - modifiers |= Qt::MetaModifier; - } - if (mask & DIMM_CONTROL) { - modifiers |= Qt::ControlModifier; - } - if (mask & DIMM_META) { - modifiers | Qt::MetaModifier; - } - return modifiers; -} - -QEvent::Type QDirectFbConvenience::eventType(DFBWindowEventType type) -{ - switch(type) { - case DWET_BUTTONDOWN: - return QEvent::MouseButtonPress; - case DWET_BUTTONUP: - return QEvent::MouseButtonRelease; - case DWET_MOTION: - return QEvent::MouseMove; - case DWET_WHEEL: - return QEvent::Wheel; - case DWET_KEYDOWN: - return QEvent::KeyPress; - case DWET_KEYUP: - return QEvent::KeyRelease; - default: - return QEvent::None; - } -} -QDirectFbKeyMap *QDirectFbConvenience::dfbKeymap = 0; -QDirectFbKeyMap *QDirectFbConvenience::keyMap() -{ - if (!dfbKeymap) - dfbKeymap = new QDirectFbKeyMap(); - return dfbKeymap; -} - -QDirectFbKeyMap::QDirectFbKeyMap() -{ - insert(DIKS_BACKSPACE , Qt::Key_Backspace); - insert(DIKS_TAB , Qt::Key_Tab); - insert(DIKS_RETURN , Qt::Key_Return); - insert(DIKS_ESCAPE , Qt::Key_Escape); - insert(DIKS_DELETE , Qt::Key_Delete); - - insert(DIKS_CURSOR_LEFT , Qt::Key_Left); - insert(DIKS_CURSOR_RIGHT , Qt::Key_Right); - insert(DIKS_CURSOR_UP , Qt::Key_Up); - insert(DIKS_CURSOR_DOWN , Qt::Key_Down); - insert(DIKS_INSERT , Qt::Key_Insert); - insert(DIKS_HOME , Qt::Key_Home); - insert(DIKS_END , Qt::Key_End); - insert(DIKS_PAGE_UP , Qt::Key_PageUp); - insert(DIKS_PAGE_DOWN , Qt::Key_PageDown); - insert(DIKS_PRINT , Qt::Key_Print); - insert(DIKS_PAUSE , Qt::Key_Pause); - insert(DIKS_SELECT , Qt::Key_Select); - insert(DIKS_GOTO , Qt::Key_OpenUrl); - insert(DIKS_CLEAR , Qt::Key_Clear); - insert(DIKS_MENU , Qt::Key_Menu); - insert(DIKS_HELP , Qt::Key_Help); - - insert(DIKS_INTERNET , Qt::Key_HomePage); - insert(DIKS_MAIL , Qt::Key_LaunchMail); - insert(DIKS_FAVORITES , Qt::Key_Favorites); - - insert(DIKS_BACK , Qt::Key_Back); - insert(DIKS_FORWARD , Qt::Key_Forward); - insert(DIKS_VOLUME_UP , Qt::Key_VolumeUp); - insert(DIKS_VOLUME_DOWN , Qt::Key_VolumeDown); - insert(DIKS_MUTE , Qt::Key_VolumeMute); - insert(DIKS_PLAYPAUSE , Qt::Key_Pause); - insert(DIKS_PLAY , Qt::Key_MediaPlay); - insert(DIKS_STOP , Qt::Key_MediaStop); - insert(DIKS_RECORD , Qt::Key_MediaRecord); - insert(DIKS_PREVIOUS , Qt::Key_MediaPrevious); - insert(DIKS_NEXT , Qt::Key_MediaNext); - - insert(DIKS_F1 , Qt::Key_F1); - insert(DIKS_F2 , Qt::Key_F2); - insert(DIKS_F3 , Qt::Key_F3); - insert(DIKS_F4 , Qt::Key_F4); - insert(DIKS_F5 , Qt::Key_F5); - insert(DIKS_F6 , Qt::Key_F6); - insert(DIKS_F7 , Qt::Key_F7); - insert(DIKS_F8 , Qt::Key_F8); - insert(DIKS_F9 , Qt::Key_F9); - insert(DIKS_F10 , Qt::Key_F10); - insert(DIKS_F11 , Qt::Key_F11); - insert(DIKS_F12 , Qt::Key_F12); - - insert(DIKS_SHIFT , Qt::Key_Shift); - insert(DIKS_CONTROL , Qt::Key_Control); - insert(DIKS_ALT , Qt::Key_Alt); - insert(DIKS_ALTGR , Qt::Key_AltGr); - - insert(DIKS_META , Qt::Key_Meta); - insert(DIKS_SUPER , Qt::Key_Super_L); // ??? - insert(DIKS_HYPER , Qt::Key_Hyper_L); // ??? - - insert(DIKS_CAPS_LOCK , Qt::Key_CapsLock); - insert(DIKS_NUM_LOCK , Qt::Key_NumLock); - insert(DIKS_SCROLL_LOCK , Qt::Key_ScrollLock); - - insert(DIKS_DEAD_ABOVEDOT , Qt::Key_Dead_Abovedot); - insert(DIKS_DEAD_ABOVERING , Qt::Key_Dead_Abovering); - insert(DIKS_DEAD_ACUTE , Qt::Key_Dead_Acute); - insert(DIKS_DEAD_BREVE , Qt::Key_Dead_Breve); - insert(DIKS_DEAD_CARON , Qt::Key_Dead_Caron); - insert(DIKS_DEAD_CEDILLA , Qt::Key_Dead_Cedilla); - insert(DIKS_DEAD_CIRCUMFLEX , Qt::Key_Dead_Circumflex); - insert(DIKS_DEAD_DIAERESIS , Qt::Key_Dead_Diaeresis); - insert(DIKS_DEAD_DOUBLEACUTE , Qt::Key_Dead_Doubleacute); - insert(DIKS_DEAD_GRAVE , Qt::Key_Dead_Grave); - insert(DIKS_DEAD_IOTA , Qt::Key_Dead_Iota); - insert(DIKS_DEAD_MACRON , Qt::Key_Dead_Macron); - insert(DIKS_DEAD_OGONEK , Qt::Key_Dead_Ogonek); - insert(DIKS_DEAD_SEMIVOICED_SOUND , Qt::Key_Dead_Semivoiced_Sound); - insert(DIKS_DEAD_TILDE , Qt::Key_Dead_Tilde); - insert(DIKS_DEAD_VOICED_SOUND , Qt::Key_Dead_Voiced_Sound); - insert(DIKS_SPACE , Qt::Key_Space); - insert(DIKS_EXCLAMATION_MARK , Qt::Key_Exclam); - insert(DIKS_QUOTATION , Qt::Key_QuoteDbl); - insert(DIKS_NUMBER_SIGN , Qt::Key_NumberSign); - insert(DIKS_DOLLAR_SIGN , Qt::Key_Dollar); - insert(DIKS_PERCENT_SIGN , Qt::Key_Percent); - insert(DIKS_AMPERSAND , Qt::Key_Ampersand); - insert(DIKS_APOSTROPHE , Qt::Key_Apostrophe); - insert(DIKS_PARENTHESIS_LEFT , Qt::Key_ParenLeft); - insert(DIKS_PARENTHESIS_RIGHT , Qt::Key_ParenRight); - insert(DIKS_ASTERISK , Qt::Key_Asterisk); - insert(DIKS_PLUS_SIGN , Qt::Key_Plus); - insert(DIKS_COMMA , Qt::Key_Comma); - insert(DIKS_MINUS_SIGN , Qt::Key_Minus); - insert(DIKS_PERIOD , Qt::Key_Period); - insert(DIKS_SLASH , Qt::Key_Slash); - insert(DIKS_0 , Qt::Key_0); - insert(DIKS_1 , Qt::Key_1); - insert(DIKS_2 , Qt::Key_2); - insert(DIKS_3 , Qt::Key_3); - insert(DIKS_4 , Qt::Key_4); - insert(DIKS_5 , Qt::Key_5); - insert(DIKS_6 , Qt::Key_6); - insert(DIKS_7 , Qt::Key_7); - insert(DIKS_8 , Qt::Key_8); - insert(DIKS_9 , Qt::Key_9); - insert(DIKS_COLON , Qt::Key_Colon); - insert(DIKS_SEMICOLON , Qt::Key_Semicolon); - insert(DIKS_LESS_THAN_SIGN , Qt::Key_Less); - insert(DIKS_EQUALS_SIGN , Qt::Key_Equal); - insert(DIKS_GREATER_THAN_SIGN , Qt::Key_Greater); - insert(DIKS_QUESTION_MARK , Qt::Key_Question); - insert(DIKS_AT , Qt::Key_At); - insert(DIKS_CAPITAL_A , Qt::Key_A); - insert(DIKS_CAPITAL_B , Qt::Key_B); - insert(DIKS_CAPITAL_C , Qt::Key_C); - insert(DIKS_CAPITAL_D , Qt::Key_D); - insert(DIKS_CAPITAL_E , Qt::Key_E); - insert(DIKS_CAPITAL_F , Qt::Key_F); - insert(DIKS_CAPITAL_G , Qt::Key_G); - insert(DIKS_CAPITAL_H , Qt::Key_H); - insert(DIKS_CAPITAL_I , Qt::Key_I); - insert(DIKS_CAPITAL_J , Qt::Key_J); - insert(DIKS_CAPITAL_K , Qt::Key_K); - insert(DIKS_CAPITAL_L , Qt::Key_L); - insert(DIKS_CAPITAL_M , Qt::Key_M); - insert(DIKS_CAPITAL_N , Qt::Key_N); - insert(DIKS_CAPITAL_O , Qt::Key_O); - insert(DIKS_CAPITAL_P , Qt::Key_P); - insert(DIKS_CAPITAL_Q , Qt::Key_Q); - insert(DIKS_CAPITAL_R , Qt::Key_R); - insert(DIKS_CAPITAL_S , Qt::Key_S); - insert(DIKS_CAPITAL_T , Qt::Key_T); - insert(DIKS_CAPITAL_U , Qt::Key_U); - insert(DIKS_CAPITAL_V , Qt::Key_V); - insert(DIKS_CAPITAL_W , Qt::Key_W); - insert(DIKS_CAPITAL_X , Qt::Key_X); - insert(DIKS_CAPITAL_Y , Qt::Key_Y); - insert(DIKS_CAPITAL_Z , Qt::Key_Z); - insert(DIKS_SQUARE_BRACKET_LEFT , Qt::Key_BracketLeft); - insert(DIKS_BACKSLASH , Qt::Key_Backslash); - insert(DIKS_SQUARE_BRACKET_RIGHT , Qt::Key_BracketRight); - insert(DIKS_CIRCUMFLEX_ACCENT , Qt::Key_AsciiCircum); - insert(DIKS_UNDERSCORE , Qt::Key_Underscore); - insert(DIKS_SMALL_A , Qt::Key_A); - insert(DIKS_SMALL_B , Qt::Key_B); - insert(DIKS_SMALL_C , Qt::Key_C); - insert(DIKS_SMALL_D , Qt::Key_D); - insert(DIKS_SMALL_E , Qt::Key_E); - insert(DIKS_SMALL_F , Qt::Key_F); - insert(DIKS_SMALL_G , Qt::Key_G); - insert(DIKS_SMALL_H , Qt::Key_H); - insert(DIKS_SMALL_I , Qt::Key_I); - insert(DIKS_SMALL_J , Qt::Key_J); - insert(DIKS_SMALL_K , Qt::Key_K); - insert(DIKS_SMALL_L , Qt::Key_L); - insert(DIKS_SMALL_M , Qt::Key_M); - insert(DIKS_SMALL_N , Qt::Key_N); - insert(DIKS_SMALL_O , Qt::Key_O); - insert(DIKS_SMALL_P , Qt::Key_P); - insert(DIKS_SMALL_Q , Qt::Key_Q); - insert(DIKS_SMALL_R , Qt::Key_R); - insert(DIKS_SMALL_S , Qt::Key_S); - insert(DIKS_SMALL_T , Qt::Key_T); - insert(DIKS_SMALL_U , Qt::Key_U); - insert(DIKS_SMALL_V , Qt::Key_V); - insert(DIKS_SMALL_W , Qt::Key_W); - insert(DIKS_SMALL_X , Qt::Key_X); - insert(DIKS_SMALL_Y , Qt::Key_Y); - insert(DIKS_SMALL_Z , Qt::Key_Z); - insert(DIKS_CURLY_BRACKET_LEFT , Qt::Key_BraceLeft); - insert(DIKS_VERTICAL_BAR , Qt::Key_Bar); - insert(DIKS_CURLY_BRACKET_RIGHT , Qt::Key_BraceRight); - insert(DIKS_TILDE , Qt::Key_AsciiTilde); -} diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h b/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h deleted file mode 100644 index 0b1a24f..0000000 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbconvenience.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef QDIRECTFBCONVENIENCE_H -#define QDIRECTFBCONVENIENCE_H - -#include -#include -#include -#include - -#include - -class QDirectFbKeyMap: public QHash -{ -public: - QDirectFbKeyMap(); -}; - - -class QDirectFbConvenience -{ -public: - static QImage::Format imageFormatFromSurfaceFormat(const DFBSurfacePixelFormat format, const DFBSurfaceCapabilities caps); - static bool pixelFomatHasAlpha(const DFBSurfacePixelFormat format) { return (1 << 16) & format; } - static int colorDepthForSurface(const DFBSurfacePixelFormat format); - - //This is set by the graphicssystem constructor - static IDirectFB *dfbInterface(); - static IDirectFBDisplayLayer *dfbDisplayLayer(int display = DLID_PRIMARY); - - static IDirectFBSurface *dfbSurfaceForPixmapData(QPixmapData *); - - static Qt::MouseButton mouseButton(DFBInputDeviceButtonIdentifier identifier); - static Qt::MouseButtons mouseButtons(DFBInputDeviceButtonMask mask); - static Qt::KeyboardModifiers keyboardModifiers(DFBInputDeviceModifierMask mask); - static QEvent::Type eventType(DFBWindowEventType type); - - static QDirectFbKeyMap *keyMap(); - -private: - static QDirectFbKeyMap *dfbKeymap; - friend class QDirectFbGraphicsSystem; -}; - -#endif // QDIRECTFBCONVENIENCE_H diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp deleted file mode 100644 index 229a875..0000000 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "qdirectfbcursor.h" -#include "qblitter_directfb.h" -#include "qgraphicssystem_minimaldfb.h" -#include "qdirectfbconvenience.h" - -#include - -QDirectFBCursor::QDirectFBCursor(QGraphicsSystemScreen * screen) : - QGraphicsSystemCursor(screen), surface(0) -{ - QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),DLID_PRIMARY, &m_layer); - image = new QGraphicsSystemCursorImage(0, 0, 0, 0, 0, 0); -} - -void QDirectFBCursor::changeCursor(QCursor * cursor, QWidget * widget) -{ - Q_UNUSED(widget); - int xSpot; - int ySpot; - QPixmap map; - - if (cursor->shape() != Qt::BitmapCursor) { - image->set(cursor->shape()); - xSpot = image->hotspot().x(); - ySpot = image->hotspot().y(); - QImage *i = image->image(); - map = QPixmap::fromImage(*i); - } else { - QPoint point = cursor->hotSpot(); - xSpot = point.x(); - ySpot = point.y(); - map = cursor->pixmap(); - } - - IDirectFBSurface *surface = QDirectFbConvenience::dfbSurfaceForPixmapData(map.pixmapData()); - - if (m_layer->SetCooperativeLevel(m_layer, DLSCL_ADMINISTRATIVE) != DFB_OK) { - return; - } - m_layer->SetCursorShape( m_layer, surface, xSpot, ySpot); - m_layer->SetCooperativeLevel(m_layer, DLSCL_SHARED); -} diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.h b/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.h deleted file mode 100644 index 064a336..0000000 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbcursor.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef QDIRECTFBCURSOR_H -#define QDIRECTFBCURSOR_H - -#include -#include -class QDirectFbGraphicsSystemScreen; -class QDirectFbBlitter; - -class QDirectFBCursor : public QGraphicsSystemCursor -{ -public: - QDirectFBCursor(QGraphicsSystemScreen *screem); - void changeCursor(QCursor * cursor, QWidget * widget); - -private: - IDirectFBDisplayLayer * m_layer; - IDirectFBSurface * surface; - QGraphicsSystemCursorImage * image; - QDirectFbBlitter *blitter; -}; - -#endif // QDIRECTFBCURSOR_H diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp deleted file mode 100644 index 74a38a4..0000000 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.cpp +++ /dev/null @@ -1,205 +0,0 @@ -#include "qdirectfbinput.h" -#include "qdirectfbconvenience.h" - -#include -#include -#include -#include -#include -#include - -#include - -InputSocketWaiter::InputSocketWaiter(IDirectFBEventBuffer *eventBuffer, QObject *parent) - : QThread(parent), m_eventBuffer(eventBuffer),m_shouldStop(false) -{ - this->start(); -} - -InputSocketWaiter::~InputSocketWaiter() -{ - m_shouldStop = true; - m_eventBuffer->WakeUp(m_eventBuffer); - m_cleanupMutex.lock(); -} - -void InputSocketWaiter::continueWaitingForEvents() -{ - m_finishedProcessingEvents.wakeAll(); -} - -void InputSocketWaiter::run() -{ - m_cleanupMutex.lock(); - while (1) { - m_eventBuffer->WaitForEvent(m_eventBuffer); - if (m_shouldStop) - break; - emit newEvent(); - QMutex waitForProcessingMutex; - waitForProcessingMutex.lock(); - m_finishedProcessingEvents.wait(&waitForProcessingMutex); - } - m_cleanupMutex.unlock(); -} - -QDirectFbInput *QDirectFbInput::instance() -{ - static QDirectFbInput *input = 0; - if (!input) { - input = new QDirectFbInput(); - } - return input; -} - -QDirectFbInput::QDirectFbInput() - : QObject() -{ - dfbInterface = QDirectFbConvenience::dfbInterface(); - - DFBResult ok = dfbInterface->CreateEventBuffer(dfbInterface,&eventBuffer); - if (ok != DFB_OK) - DirectFBError("Failed to initialise eventbuffer", ok); - - dfbInterface->GetDisplayLayer(dfbInterface,DLID_PRIMARY, &dfbDisplayLayer); - - m_inputHandler = new InputSocketWaiter(eventBuffer,this); - connect(m_inputHandler,SIGNAL(newEvent()),this,SLOT(handleEvents())); - - connect(QApplication::instance(),SIGNAL(aboutToQuit()),SLOT(applicationEnd())); -} - -void QDirectFbInput::addWindow(DFBWindowID id, QWidget *tlw) -{ - tlwMap.insert(id,tlw); - IDirectFBWindow *window; - dfbDisplayLayer->GetWindow(dfbDisplayLayer,id,&window); - - window->AttachEventBuffer(window,eventBuffer); -} - -void QDirectFbInput::removeWindow(QWidget *tlw) -{ - DFBWindowID id = tlwMap.key(tlw,0); - if (id) { - IDirectFBWindow *window; - dfbDisplayLayer->GetWindow(dfbDisplayLayer,id, &window); - - window->DetachEventBuffer(window,eventBuffer); - tlwMap.remove(id); - } -} - -void QDirectFbInput::handleEvents() -{ - DFBResult hasEvent = eventBuffer->HasEvent(eventBuffer); - while(hasEvent == DFB_OK){ - DFBEvent event; - DFBResult ok = eventBuffer->GetEvent(eventBuffer,&event); - if (ok != DFB_OK) - DirectFBError("Failed to get event",ok); - if (event.clazz == DFEC_WINDOW) { - switch (event.window.type) { - case DWET_BUTTONDOWN: - case DWET_BUTTONUP: - case DWET_MOTION: - handleMouseEvents(event); - break; - case DWET_WHEEL: - handleWheelEvent(event); - break; - case DWET_KEYDOWN: - case DWET_KEYUP: - handleKeyEvents(event); - break; - case DWET_ENTER: - case DWET_LEAVE: - handleEnterLeaveEvents(event); - default: - break; - } - - } - - hasEvent = eventBuffer->HasEvent(eventBuffer); - } - m_inputHandler->continueWaitingForEvents(); -} - -void QDirectFbInput::handleMouseEvents(const DFBEvent &event) -{ - QPoint p(event.window.x, event.window.y); - QPoint globalPos = globalPoint(event); - Qt::MouseButtons buttons = QDirectFbConvenience::mouseButtons(event.window.buttons); - - IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); - IDirectFBWindow *window; - layer->GetWindow(layer,event.window.window_id,&window); - - long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000); - - if (event.window.type == DWET_BUTTONDOWN) { - window->GrabPointer(window); - } else if (event.window.type == DWET_BUTTONUP) { - window->UngrabPointer(window); - } - QWidget *tlw = tlwMap.value(event.window.window_id); - QWindowSystemInterface::handleMouseEvent(tlw, timestamp, p, globalPos, buttons); -} - -void QDirectFbInput::applicationEnd() -{ - delete m_inputHandler; - m_inputHandler = 0; -} - -void QDirectFbInput::handleWheelEvent(const DFBEvent &event) -{ - QPoint p(event.window.cx, event.window.cy); - QPoint globalPos = globalPoint(event); - long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000); - QWidget *tlw = tlwMap.value(event.window.window_id); - QWindowSystemInterface::handleWheelEvent(tlw, timestamp, p, globalPos, - event.window.step*120, - Qt::Vertical); -} - -void QDirectFbInput::handleKeyEvents(const DFBEvent &event) -{ - QEvent::Type type = QDirectFbConvenience::eventType(event.window.type); - Qt::Key key = QDirectFbConvenience::keyMap()->value(event.window.key_symbol); - Qt::KeyboardModifiers modifiers = QDirectFbConvenience::keyboardModifiers(event.window.modifiers); - - long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000); - - QChar character; - if (DFB_KEY_TYPE(event.window.key_symbol) == DIKT_UNICODE) - character = QChar(event.window.key_symbol); - QWidget *tlw = tlwMap.value(event.window.window_id); - QWindowSystemInterface::handleKeyEvent(tlw, timestamp, type, key, modifiers, character); -} - -void QDirectFbInput::handleEnterLeaveEvents(const DFBEvent &event) -{ - QWidget *tlw = tlwMap.value(event.window.window_id); - switch (event.window.type) { - case DWET_ENTER: - QWindowSystemInterface::handleEnterEvent(tlw); - break; - case DWET_LEAVE: - QWindowSystemInterface::handleLeaveEvent(tlw); - break; - default: - break; - } -} - -inline QPoint QDirectFbInput::globalPoint(const DFBEvent &event) const -{ - IDirectFBWindow *window; - dfbDisplayLayer->GetWindow(dfbDisplayLayer,event.window.window_id,&window); - int x,y; - window->GetPosition(window,&x,&y); - return QPoint(event.window.cx +x, event.window.cy + y); -} - diff --git a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h b/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h deleted file mode 100644 index 31aa082..0000000 --- a/src/plugins/graphicssystems/minimaldfb/qdirectfbinput.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef QDIRECTFBINPUT_H -#define QDIRECTFBINPUT_H - -#include -#include -#include -#include -#include -#include -#include - -#include - -class InputSocketWaiter : public QThread -{ - Q_OBJECT -public: - InputSocketWaiter(IDirectFBEventBuffer *eventBuffer, QObject *parent); - virtual ~InputSocketWaiter(); - void continueWaitingForEvents(); -protected: - void run(); -signals: - void newEvent(); -private: - IDirectFBEventBuffer *m_eventBuffer; - bool m_shouldStop; - QMutex m_cleanupMutex; - QWaitCondition m_finishedProcessingEvents; -}; - -class QDirectFbInput : public QObject -{ - Q_OBJECT -public: - static QDirectFbInput *instance(); - void addWindow(DFBWindowID id, QWidget *tlw); - void removeWindow(QWidget *tlw); - -public slots: - void handleEvents(); - void applicationEnd(); - -private: - QDirectFbInput(); - - void handleMouseEvents(const DFBEvent &event); - void handleWheelEvent(const DFBEvent &event); - void handleKeyEvents(const DFBEvent &event); - void handleEnterLeaveEvents(const DFBEvent &event); - IDirectFB *dfbInterface; - IDirectFBDisplayLayer *dfbDisplayLayer; - IDirectFBEventBuffer *eventBuffer; - - QHashtlwMap; - - inline QPoint globalPoint(const DFBEvent &event) const; - - InputSocketWaiter *m_inputHandler; - -}; - -#endif // QDIRECTFBINPUT_H diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp deleted file mode 100644 index 4489e31..0000000 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgraphicssystem_minimaldfb.h" -#include "qwindowsurface_minimaldfb.h" -#include "qblitter_directfb.h" -#include "qdirectfbconvenience.h" -#include "qdirectfbcursor.h" - -#include -#include - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -QDirectFbGraphicsSystemScreen::QDirectFbGraphicsSystemScreen(int display) - :QGraphicsSystemScreen() -{ - m_layer = QDirectFbConvenience::dfbDisplayLayer(display); - m_layer->SetCooperativeLevel(m_layer,DLSCL_SHARED); - - DFBDisplayLayerConfig config; - m_layer->GetConfiguration(m_layer, &config); - - m_format = QDirectFbConvenience::imageFormatFromSurfaceFormat(config.pixelformat, config.surface_caps); - m_geometry = QRect(0,0,config.width,config.height); - const int dpi = 72; - const qreal inch = 25.4; - m_depth = 32; - m_physicalSize = QSize(qRound(config.width * inch / dpi), qRound(config.height *inch / dpi)); - - cursor = new QDirectFBCursor(this); -} - -QDirectFbGraphicsSystemScreen::~QDirectFbGraphicsSystemScreen() -{ -} - -QDirectFbGraphicsSystem::QDirectFbGraphicsSystem() -{ - const QStringList args = QCoreApplication::arguments(); - int argc = args.size(); - char **argv = new char*[argc]; - - for (int i = 0; i < argc; ++i) - argv[i] = qstrdup(args.at(i).toLocal8Bit().constData()); - - DFBResult result = DirectFBInit(&argc, &argv); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreen: error initializing DirectFB", - result); - } - delete[] argv; - - mPrimaryScreen = new QDirectFbGraphicsSystemScreen(0); - mScreens.append(mPrimaryScreen); -} - -QPixmapData *QDirectFbGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const -{ - if (type == QPixmapData::BitmapType) - return new QRasterPixmapData(type); - else - return new QBlittablePixmapData(type); -} - -QWindowSurface *QDirectFbGraphicsSystem::createWindowSurface(QWidget *widget) const -{ - return new QDirectFbWindowSurface (widget); -} - -QBlittable *QDirectFbGraphicsSystem::createBlittable(const QRect &rect) const -{ - return new QDirectFbBlitter(rect); -} - -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h b/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h deleted file mode 100644 index b16153d..0000000 --- a/src/plugins/graphicssystems/minimaldfb/qgraphicssystem_minimaldfb.h +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSYSTEM_MINIMAL_H -#define QGRAPHICSSYSTEM_MINIMAL_H - -#include "qdirectfbinput.h" - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QDirectFBCursor; - -class QDirectFbGraphicsSystemScreen : public QGraphicsSystemScreen -{ -public: - QDirectFbGraphicsSystemScreen(int display); - ~QDirectFbGraphicsSystemScreen(); - - QRect geometry() const { return m_geometry; } - int depth() const { return m_depth; } - QImage::Format format() const { return m_format; } - QSize physicalSize() const { return m_physicalSize; } - -public: - QRect m_geometry; - int m_depth; - QImage::Format m_format; - QSize m_physicalSize; - - IDirectFBDisplayLayer *m_layer; - -private: - QDirectFBCursor * cursor; - -}; - -class QDirectFbGraphicsSystem : public QGraphicsSystem -{ -public: - QDirectFbGraphicsSystem(); - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; - QBlittable *createBlittable(const QRect &rect) const; - - QList screens() const { return mScreens; } - - - -private: - QDirectFbGraphicsSystemScreen *mPrimaryScreen; - QList mScreens; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp deleted file mode 100644 index 07a9b8a..0000000 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.cpp +++ /dev/null @@ -1,231 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwindowsurface_minimaldfb.h" -#include "qgraphicssystem_minimaldfb.h" -#include "qblitter_directfb.h" -#include "qdirectfbconvenience.h" -#include - -#include - -QT_BEGIN_NAMESPACE - -QDirectFbWindowSurface::QDirectFbWindowSurface(QWidget *window) - : QWindowSurface(window), m_pixmap(0), m_pmdata(0), - m_dfbWindow(0), m_dfbSurface(0) -{ - window->setWindowSurface(this); - - IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); - DFBDisplayLayerConfig layerConfig; - layer->GetConfiguration(layer,&layerConfig); - - DFBWindowDescription description; - memset(&description,0,sizeof(DFBWindowDescription)); - description.flags = DFBWindowDescriptionFlags(DWDESC_WIDTH|DWDESC_HEIGHT|DWDESC_POSX|DWDESC_POSY|DWDESC_SURFACE_CAPS -#if DIRECTFB_MINOR_VERSION >= 1 - |DWDESC_OPTIONS -#endif - |DWDESC_CAPS); - description.width = window->rect().width(); - description.height = window->rect().height(); - description.posx = window->rect().x(); - description.posy = window->rect().y(); - - if (layerConfig.surface_caps & DSCAPS_PREMULTIPLIED) - description.surface_caps = DSCAPS_PREMULTIPLIED; - description.pixelformat = layerConfig.pixelformat; - -#if DIRECTFB_MINOR_VERSION >= 1 - description.options = DFBWindowOptions(DWOP_ALPHACHANNEL); -#endif - description.caps = DFBWindowCapabilities(DWCAPS_DOUBLEBUFFER|DWCAPS_ALPHACHANNEL); - description.surface_caps = DSCAPS_PREMULTIPLIED; - - DFBResult result = layer->CreateWindow(layer,&description,&m_dfbWindow); - if (result != DFB_OK) { - DirectFBError("QDirectFbGraphicsSystemScreen: failed to create window",result); - } - - DFBWindowID id; - m_dfbWindow->GetID(m_dfbWindow, &id); - QDirectFbInput::instance()->addWindow(id,window); - - m_dfbWindow->GetSurface(m_dfbWindow,&m_dfbSurface); - - QDirectFbBlitter *blitter = new QDirectFbBlitter(window->rect(), m_dfbSurface); - m_pmdata = new QBlittablePixmapData(QPixmapData::PixmapType); - m_pmdata->setBlittable(blitter); - m_pixmap = new QPixmap(m_pmdata); -} - -QDirectFbWindowSurface::~QDirectFbWindowSurface() -{ - QDirectFbInput::instance()->removeWindow(this->window()); - m_dfbWindow->Destroy(m_dfbWindow); -} - -QPaintDevice *QDirectFbWindowSurface::paintDevice() -{ - return m_pixmap; -} - -void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) -{ - m_pmdata->blittable()->unlock(); - - const quint8 windowOpacity = quint8(widget->windowOpacity() * 0xff); - m_dfbWindow->SetOpacity(m_dfbWindow,windowOpacity); - - QVector rects = region.rects(); - for (int i = 0 ; i < rects.size(); i++) { - const QRect rect = rects.at(i); - DFBRegion dfbReg = { rect.x() + offset.x(),rect.y() + offset.y(),rect.right() + offset.x(),rect.bottom() + offset.y()}; - m_dfbSurface->Flip(m_dfbSurface, &dfbReg, DFBSurfaceFlipFlags(DSFLIP_BLIT|DSFLIP_ONSYNC)); - } -} - -void QDirectFbWindowSurface::setGeometry(const QRect &rect) -{ - m_pmdata->blittable()->unlock(); - - QWindowSurface::setGeometry(rect); - m_dfbWindow->SetBounds(m_dfbWindow, rect.x(),rect.y(), - rect.width(), rect.height()); - - //Have to add 1 ref ass it will be removed by deleting the old blitter in setBlittable - m_dfbSurface->AddRef(m_dfbSurface); - QDirectFbBlitter *blitter = new QDirectFbBlitter(rect,m_dfbSurface); - m_pmdata->setBlittable(blitter); -} - -static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int dx, int dy) -{ - const DFBRectangle rect = { r.x(), r.y(), r.width(), r.height() }; - surface->Blit(surface, surface, &rect, r.x() + dx, r.y() + dy); - const DFBRegion region = { rect.x + dx, rect.y + dy, r.right() + dx, r.bottom() + dy }; - surface->Flip(surface, ®ion, DFBSurfaceFlipFlags(DSFLIP_BLIT)); -} - -bool QDirectFbWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - m_pmdata->blittable()->unlock(); - - if (!m_dfbSurface || area.isEmpty()) - return false; - m_dfbSurface->SetBlittingFlags(m_dfbSurface, DSBLIT_NOFX); - if (area.rectCount() == 1) { - scrollSurface(m_dfbSurface, area.boundingRect(), dx, dy); - } else { - const QVector rects = area.rects(); - const int n = rects.size(); - for (int i=0; iblittable()->unlock(); - - if (visible) { - int x = this->geometry().x(); - int y = this->geometry().y(); - m_dfbWindow->MoveTo(m_dfbWindow,x,y); - } else { - IDirectFBDisplayLayer *displayLayer; - QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),DLID_PRIMARY,&displayLayer); - - DFBDisplayLayerConfig config; - displayLayer->GetConfiguration(displayLayer,&config); - m_dfbWindow->MoveTo(m_dfbWindow,config.width+1,config.height + 1); - } -} - -Qt::WindowFlags QDirectFbWindowSurface::setWindowFlags(Qt::WindowFlags flags) -{ - switch (flags & Qt::WindowType_Mask) { - case Qt::ToolTip: { - DFBWindowOptions options; - m_dfbWindow->GetOptions(m_dfbWindow,&options); - options = DFBWindowOptions(options | DWOP_GHOST); - m_dfbWindow->SetOptions(m_dfbWindow,options); - break; } - default: - break; - } - - m_dfbWindow->SetStackingClass(m_dfbWindow, flags & Qt::WindowStaysOnTopHint ? DWSC_UPPER : DWSC_MIDDLE); - return flags; -} - -void QDirectFbWindowSurface::raise() -{ - m_dfbWindow->RaiseToTop(m_dfbWindow); -} - -void QDirectFbWindowSurface::lower() -{ - m_dfbWindow->LowerToBottom(m_dfbWindow); -} - -WId QDirectFbWindowSurface::winId() const -{ - DFBWindowID id; - m_dfbWindow->GetID(m_dfbWindow, &id); - return WId(id); -} - - -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h b/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h deleted file mode 100644 index ca34cbf..0000000 --- a/src/plugins/graphicssystems/minimaldfb/qwindowsurface_minimaldfb.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_MINIMAL_H -#define QWINDOWSURFACE_MINIMAL_H - -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -class QDirectFbGraphicsSystemScreen; - -class QDirectFbWindowSurface : public QWindowSurface -{ -public: - QDirectFbWindowSurface(QWidget *window); - ~QDirectFbWindowSurface(); - - QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void setGeometry(const QRect &rect); - bool scroll(const QRegion &area, int dx, int dy); - - void beginPaint(const QRegion ®ion); - void endPaint(const QRegion ®ion); - - void setVisible(bool visible); - Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); - - void raise(); - void lower(); - - WId winId() const; - -private: - void lockSurfaceToImage(); - - QPixmap *m_pixmap; - QBlittablePixmapData *m_pmdata; - - IDirectFBWindow *m_dfbWindow; - IDirectFBSurface *m_dfbSurface; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/graphicssystems/openkode/frag.glslf b/src/plugins/graphicssystems/openkode/frag.glslf deleted file mode 100644 index a593434..0000000 --- a/src/plugins/graphicssystems/openkode/frag.glslf +++ /dev/null @@ -1,8 +0,0 @@ -uniform sampler2D tex_samp; - -varying vec2 texcoord_var; - -void main() -{ - gl_FragColor = texture2D(tex_samp, texcoord_var); -} diff --git a/src/plugins/graphicssystems/openkode/frag.h b/src/plugins/graphicssystems/openkode/frag.h deleted file mode 100644 index 6575cb5..0000000 --- a/src/plugins/graphicssystems/openkode/frag.h +++ /dev/null @@ -1,37 +0,0 @@ -0x4e,0x56,0x75,0x63,0x01,0x00,0x00,0x00,0x09,0x00,0x06,0x00,0x06,0x00,0x50,0x00, -0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x50,0x02,0x00,0x00,0x00,0x00,0x00,0x00, -0x03,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x40,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x27,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x50,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0xe8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x70,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x01,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x90,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x11,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xb0,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x12,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0xc0,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x23,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x2b,0x00,0x00,0x00,0x7a,0x00,0x00,0x00,0xd0,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x2c,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x03,0x68,0x69,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff, -0x00,0x00,0x00,0x80,0x04,0x00,0x00,0x90,0x00,0x02,0x01,0x82,0x04,0x02,0x02,0x82, -0x01,0x00,0x40,0xf6,0x85,0xc7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x30,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x02,0x00,0x00,0x00,0x00,0x00,0x00, -0x3a,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2a,0x00,0x06,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0x3b,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x02,0x00,0x00,0x00,0x00,0x00,0x00, -0x49,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x26,0x00,0x04,0x00,0x00,0x00, -0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0x00,0x74,0x65,0x78,0x5f,0x73,0x61,0x6d,0x70,0x00,0x00,0x00,0x74,0x65,0x78,0x63, -0x6f,0x6f,0x72,0x64,0x5f,0x76,0x61,0x72,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 diff --git a/src/plugins/graphicssystems/openkode/main.cpp b/src/plugins/graphicssystems/openkode/main.cpp deleted file mode 100644 index e9c1083..0000000 --- a/src/plugins/graphicssystems/openkode/main.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins 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 http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "qgraphicssystem_openkode.h" - -QT_BEGIN_NAMESPACE - -class QOpenKODEGraphicsSystemPlugin : public QGraphicsSystemPlugin -{ -public: - QStringList keys() const; - QGraphicsSystem *create(const QString&); -}; - -QStringList QOpenKODEGraphicsSystemPlugin::keys() const -{ - QStringList list; - list << "OpenKODE"; - return list; -} - -QGraphicsSystem* QOpenKODEGraphicsSystemPlugin::create(const QString& system) -{ - if (system.toLower() == "openkode") - return new QOpenKODEGraphicsSystem; - - return 0; -} - -Q_EXPORT_PLUGIN2(openkode, QOpenKODEGraphicsSystemPlugin) - -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/openkode/openkode.pro b/src/plugins/graphicssystems/openkode/openkode.pro deleted file mode 100644 index 055048d..0000000 --- a/src/plugins/graphicssystems/openkode/openkode.pro +++ /dev/null @@ -1,14 +0,0 @@ -TARGET = qopenkodegraphicssystem -include(../../qpluginbase.pri) - -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems - -SOURCES = main.cpp qgraphicssystem_openkode.cpp qwindowsurface_openkode.cpp -HEADERS = qgraphicssystem_openkode.h qwindowsurface_openkode.h - -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems -INSTALLS += target - -# openkode specific stuff -INCLUDEPATH += $(OPENKODE_DIR)/include -LIBS += $${QMAKE_RPATH}/$(OPENKODE_DIR)/lib-target -L$(OPENKODE_DIR)/lib-target -lKD -lEGL -lGLESv2 diff --git a/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.cpp b/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.cpp deleted file mode 100644 index 7a07776..0000000 --- a/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins 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 http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgraphicssystem_openkode.h" -#include "qwindowsurface_openkode.h" -#include - -#include -#include - -#include -#include -#include - -#include "GLES2/gl2ext.h" - - -QT_BEGIN_NAMESPACE - -QOpenKODEGraphicsSystemScreen::QOpenKODEGraphicsSystemScreen() -{ - KDDesktopNV *kdDesktop = KD_NULL; - KDDisplayNV *kdDisplay = KD_NULL; - - qDebug() << "QOpenKODEGraphicsSystemScreen::QOpenKODEGraphicsSystemScreen()"; - - // Get the default desktop and display - kdDesktop = kdGetDesktopNV(KD_DEFAULT_DESKTOP_NV, KD_NULL); - if (!kdDesktop || kdDesktop == (void*)-1) { - qErrnoWarning(kdGetError(), "Could not obtain KDDesktopNV pointer"); - return; - } - - kdDisplay = kdGetDisplayNV(KD_DEFAULT_DISPLAY_NV, KD_NULL); - if (!kdDisplay || kdDisplay == (void*)-1) { - qErrnoWarning(kdGetError(), "Could not obtain KDDisplayNV pointer"); - kdReleaseDesktopNV(kdDesktop); - return; - } - - KDDisplayModeNV mode; - if (kdGetDisplayModeNV(kdDisplay, &mode)) { - qErrnoWarning(kdGetError(), "Could not get display mode"); - return; - } - - qDebug() << " - display mode " << mode.width << "x" << mode.height << " refresh " << mode.refresh; - - KDint desktopSize[] = { mode.width, mode.height }; - - if (kdSetDesktopPropertyivNV(kdDesktop, KD_DESKTOPPROPERTY_SIZE_NV, desktopSize)) { - qErrnoWarning(kdGetError(), "Could not set desktop size"); - return; - } - - // Once we've set up the desktop and display we don't need them anymore - kdReleaseDisplayNV(kdDisplay); - kdReleaseDesktopNV(kdDesktop); - - const int defaultDpi = 72; - mGeometry = QRect(0, 0, mode.width, mode.height); - mPhysicalSize = QSize(mode.width * 25.4 / defaultDpi, mode.height * 25.4 / defaultDpi); - - mDepth = 24; - mFormat = QImage::Format_RGB888; - - - QEglProperties properties; - properties.setPixelFormat(QImage::Format_RGB888); - properties.setValue(EGL_BUFFER_SIZE, EGL_DONT_CARE); - properties.setRenderableType(QEgl::OpenGL); - - if (!mContext.chooseConfig(properties, QEgl::BestPixelFormat)) { - qWarning("qEglContext: Unable to choose config!"); - return; - } - - if (!mContext.display()) { - qWarning("qEglContext: Unable to open display!"); - return; - } - - qDebug() << " - QEglContext::openDisplay OK"; -} - -static GLuint NvKdTestLoadShaders(const char *vertex_shader_binary, - const char *fragment_shader_binary, - GLuint vertex_shader_binary_size, - GLuint fragment_shader_binary_size) -{ - GLuint prog; - GLuint vertShader; - GLuint fragShader; - - // Create the program - prog = glCreateProgram(); - - // Create the GL shader objects - vertShader = glCreateShader(GL_VERTEX_SHADER); - fragShader = glCreateShader(GL_FRAGMENT_SHADER); - - // Load the binary data into the shader objects - glShaderBinary(1, &vertShader, - GL_NVIDIA_PLATFORM_BINARY_NV, vertex_shader_binary, vertex_shader_binary_size); - glShaderBinary(1, &fragShader, - GL_NVIDIA_PLATFORM_BINARY_NV, fragment_shader_binary, fragment_shader_binary_size); - - // Attach the shaders to the program - glAttachShader(prog, vertShader); - glAttachShader(prog, fragShader); - - // Delete the shaders - glDeleteShader(vertShader); - glDeleteShader(fragShader); - - // Link and validate the shader program - glLinkProgram(prog); - glValidateProgram(prog); - - return prog; -} - -class QOpenKODEEventLoopHelper : public QThread -{ -public: - QOpenKODEEventLoopHelper(QSemaphore *m) - : eventMutex(m) - { - m->acquire(); - } - -protected: - void run() - { - qDebug() << "initializing KD"; - kdInitializeNV(); - qDebug() << "done initializing KD"; - eventMutex->release(); - - const KDEvent *event; - while ((event = kdWaitEvent(-1)) != 0) { - qDebug() << "!!! received event!"; - kdDefaultEvent(event); - } - - qDebug() << "exiting event loop"; - } - -private: - QSemaphore *eventMutex; -}; - -QOpenKODEGraphicsSystem::QOpenKODEGraphicsSystem() - : eventMutex(1) -{ - QOpenKODEEventLoopHelper *loop = new QOpenKODEEventLoopHelper(&eventMutex); - loop->start(); - eventMutex.acquire(); // block until initialization done - - mPrimaryScreen = new QOpenKODEGraphicsSystemScreen(); - - mScreens.append(mPrimaryScreen); - -} - -QPixmapData *QOpenKODEGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const -{ - return new QRasterPixmapData(type); -} - -QWindowSurface *QOpenKODEGraphicsSystem::createWindowSurface(QWidget *widget) const -{ - return new QOpenKODEWindowSurface(mPrimaryScreen, widget); -} - -GLuint QOpenKODEGraphicsSystem::blitterProgram() -{ - static GLuint shaderProgram = 0; - if (!shaderProgram) { - - const char vertShaderBinary[] = { -# include "vert.h" - }; - const char fragShaderBinary[] = { -# include "frag.h" - }; - - shaderProgram = NvKdTestLoadShaders(vertShaderBinary, fragShaderBinary, - sizeof(vertShaderBinary), sizeof(fragShaderBinary)); - - if (!shaderProgram) - qFatal("QOpenKodeGraphicsSystem(): Cannot load shaders!"); - } - return shaderProgram; -} - - -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.h b/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.h deleted file mode 100644 index 7d73ae0..0000000 --- a/src/plugins/graphicssystems/openkode/qgraphicssystem_openkode.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins 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 http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSYSTEM_OPENKODE_H -#define QGRAPHICSSYSTEM_OPENKODE_H - -#include - -#include -#include - -# include - -QT_BEGIN_NAMESPACE - -struct KDDesktopNV; - -class QOpenKODEGraphicsSystemScreen : public QGraphicsSystemScreen -{ -public: - QOpenKODEGraphicsSystemScreen(); - ~QOpenKODEGraphicsSystemScreen() {} - - QRect geometry() const { return mGeometry; } - int depth() const { return mDepth; } - QImage::Format format() const { return mFormat; } - QSize physicalSize() const { return mPhysicalSize; } - -public: - QRect mGeometry; - int mDepth; - QImage::Format mFormat; - QSize mPhysicalSize; - QEglContext mContext; -}; - -class QOpenKODEGraphicsSystem : public QGraphicsSystem -{ -public: - QOpenKODEGraphicsSystem(); - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; - - QList screens() const { return mScreens; } - - static GLuint blitterProgram(); - -private: - QOpenKODEGraphicsSystemScreen *mPrimaryScreen; - QList mScreens; - QSemaphore eventMutex; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.cpp b/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.cpp deleted file mode 100644 index b3f3965..0000000 --- a/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.cpp +++ /dev/null @@ -1,265 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG 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 http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwindowsurface_openkode.h" -#include "qgraphicssystem_openkode.h" -#include - -#include "KD/kd.h" -#include "KD/NV_display.h" - -QT_BEGIN_NAMESPACE - -QOpenKODEWindowSurface::QOpenKODEWindowSurface - (QOpenKODEGraphicsSystemScreen *screen, QWidget *window) - : QWindowSurface(window), - mScreen(screen), - mSurface(0) -{ - qDebug() << "QOpenKODEWindowSurface::QOpenKODEWindowSurface:" << window << window->width() << "x" << window->height() - << "pos" << window->x() << "x" << window->y(); - - if (!mContext.display()) { - qWarning("qEglContext: Unable to open display!"); - return; - } - - QEglProperties properties; - properties.setPixelFormat(QImage::Format_RGB888); - properties.setValue(EGL_BUFFER_SIZE, EGL_DONT_CARE); - properties.setRenderableType(QEgl::OpenGL); - - if (!mContext.chooseConfig(properties, QEgl::BestPixelFormat)) { - qWarning("qEglContext: Unable to choose config!"); - return; - } - - createWindow(window); -} - -void QOpenKODEWindowSurface::createWindow(QWidget *window) -{ - qDebug() << "createWindow"; - kdWindow = kdCreateWindow(mContext.display(), mContext.config(), KD_NULL); - - if (!kdWindow) { - qErrnoWarning(kdGetError(), "Error creating native window"); - return; - } - - const KDint windowSize[2] = { window->width(), window->height() }; - if (kdSetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) { - qErrnoWarning(kdGetError(), "Could not set native window size"); - return; - } - - //const KDboolean windowExclusive[] = { false }; - //if (kdSetWindowPropertybv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_EXCLUSIVE_NV, windowExclusive)) { - // qErrnoWarning(kdGetError(), "Could not set exclusive bit"); - // //return; - //} - - //const KDint windowPos[2] = { window->x(), window->y() }; - //if (kdSetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { - // qErrnoWarning(kdGetError(), "Could not set native window position"); - // //return; - //} - - EGLNativeWindowType nativeWindow; - - if (kdRealizeWindow(kdWindow, &nativeWindow)) { - qErrnoWarning(kdGetError(), "Could not realize native window"); - return; - } - qDebug() << "kdRealizeWindow" << nativeWindow; - - // Create an EGL window surface for the native window - EGLint windowAttrs[3] = { EGL_NONE }; - qDebug() << "doing createwindowsurface"; - *mSurface = eglCreateWindowSurface(mContext.display(), - mContext.config(), - nativeWindow, - windowAttrs); - qDebug() << "create windowsurface"; - if (!mSurface) { - qWarning("EGL couldn't create window surface: 0x%x", eglGetError()); - return; - } - - qDebug() << "making context"; - if (!mContext.createContext()) { - qDebug() << "Unable to create context!"; - return; - } - - qDebug() << "about to make current"; - mContext.makeCurrent(mSurface); -} - -QOpenKODEWindowSurface::~QOpenKODEWindowSurface() -{ -} - -QPaintDevice *QOpenKODEWindowSurface::paintDevice() -{ - qDebug() << "QOpenKODEWindowSurface::paintDevice"; - return &mImage; -} - -// ### TODO - this updates the entire toplevel, should only update the region -void QOpenKODEWindowSurface::flush(QWidget *, const QRegion ®ion, const QPoint &offset) -{ - qDebug() << "in flush"; - if (!offset.isNull()) { - qWarning("Offset flushing not supported yet"); - return; - } - - if (!mContext.makeCurrent(mSurface)) { - qWarning("EGL couldn't make context/surface current: 0x%x", eglGetError()); - return; - } - - QRect boundingRect = region.boundingRect(); - - int x, y, w, h; - QImage blitImage; - if (true || boundingRect == mImage.rect()) { // TODO - check optimization - blitImage = mImage; - x = y = 0; - w = mImage.width(); - h = mImage.height(); - } else { - blitImage = mImage.copy(boundingRect); - w = boundingRect.width(); - h = boundingRect.height(); - x = boundingRect.x(); - y = boundingRect.y(); - } - -// qDebug() << "flush" << widget << offset << region.boundingRect() << mImage.format() << blitImage.format(); - - GLuint shaderProgram = QOpenKODEGraphicsSystem::blitterProgram(); - - glUseProgram(shaderProgram); - - GLuint index = glGetUniformLocation(shaderProgram, "window"); - glUniform2f(index, GLfloat(mImage.width()), GLfloat(mImage.height())); - - // attributes - GLuint posId = glGetAttribLocation(shaderProgram, "pos_attr"); - GLuint texcoordId = glGetAttribLocation(shaderProgram, "texcoord_attr"); - - // sampler - index = glGetUniformLocation(shaderProgram, "tex_samp"); - - glUniform1i(index, 0); - - glDisable(GL_DEPTH_TEST); - glActiveTexture(GL_TEXTURE0); - - GLuint texId; - GLfloat coords[8] = {x, y, x, y + h, x + w, y + h, x + w, y }; - GLfloat texcoords[8] = { 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0 }; - - // Generate texture for checkered background - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - glGenTextures(1, &texId); - glBindTexture(GL_TEXTURE_2D, texId); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, blitImage.bits()); - - // Enable vertex attribute associated with vertex position - glEnableVertexAttribArray(posId); - glEnableVertexAttribArray(texcoordId); - - // Set the quad vertices - glVertexAttribPointer(posId, 2, GL_FLOAT, 0, 0, coords); - glVertexAttribPointer(texcoordId, 2, GL_FLOAT, 0, 0, texcoords); - - // Draw the quad - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - - // Cleanup - glDisableVertexAttribArray(posId); - glDisableVertexAttribArray(texcoordId); - - // Release all textures - glBindTexture(GL_TEXTURE_2D, 0); - if (texId) - glDeleteTextures(1, &texId); - - mContext.doneCurrent(); - mContext.swapBuffers(mSurface); -} - -void QOpenKODEWindowSurface::setGeometry(const QRect &rect) -{ - qDebug() << "QOpenKODEWindowSurface::setGeometry:" << rect; - QWindowSurface::setGeometry(rect); - if (mImage.size() != rect.size()) - mImage = QImage(rect.size(), mScreen->format()); - - mContext.destroySurface(mSurface); - kdDestroyWindow(kdWindow); - createWindow(window()); - qDebug() << "set geometry workded"; -} - -bool QOpenKODEWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - return QWindowSurface::scroll(area, dx, dy); -} - -void QOpenKODEWindowSurface::beginPaint(const QRegion ®ion) -{ - Q_UNUSED(region); -} - -void QOpenKODEWindowSurface::endPaint(const QRegion ®ion) -{ - Q_UNUSED(region); -} - -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.h b/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.h deleted file mode 100644 index bee94a5..0000000 --- a/src/plugins/graphicssystems/openkode/qwindowsurface_openkode.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG 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 http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_OPENKODE_H -#define QWINDOWSURFACE_OPENKODE_H - -#include -#include - -QT_BEGIN_NAMESPACE - -class QOpenKODEGraphicsSystemScreen; - -class QOpenKODEWindowSurface : public QWindowSurface -{ -public: - QOpenKODEWindowSurface - (QOpenKODEGraphicsSystemScreen *screen, QWidget *window); - ~QOpenKODEWindowSurface(); - - QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void setGeometry(const QRect &rect); - bool scroll(const QRegion &area, int dx, int dy); - - void beginPaint(const QRegion ®ion); - void endPaint(const QRegion ®ion); - -private: - QOpenKODEGraphicsSystemScreen *mScreen; - QImage mImage; - struct KDWindow *kdWindow; - EGLSurface *mSurface; - QEglContext mContext; - - void createWindow(QWidget *window); -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/graphicssystems/openkode/vert.glslv b/src/plugins/graphicssystems/openkode/vert.glslv deleted file mode 100644 index 57b5866..0000000 --- a/src/plugins/graphicssystems/openkode/vert.glslv +++ /dev/null @@ -1,14 +0,0 @@ -uniform vec2 window; // window size - -// Per-vertex attributes] -attribute vec2 pos_attr; -attribute vec2 texcoord_attr; - -// Output vertex color -varying vec2 texcoord_var; - -void main() -{ - gl_Position = vec4( (2.0 * pos_attr / window -1.0) * vec2(1.0, -1.0), 0.0, 1.0); - texcoord_var = texcoord_attr; -} diff --git a/src/plugins/graphicssystems/openkode/vert.h b/src/plugins/graphicssystems/openkode/vert.h deleted file mode 100644 index bdf564d..0000000 --- a/src/plugins/graphicssystems/openkode/vert.h +++ /dev/null @@ -1,63 +0,0 @@ -0x4e,0x56,0x75,0x63,0x01,0x00,0x00,0x00,0x0a,0x00,0x06,0x00,0x06,0x00,0x50,0x00, -0x01,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0xf0,0x03,0x00,0x00,0x00,0x00,0x00,0x00, -0x03,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x60,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x24,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x70,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x26,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x90,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0xe8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x06,0x00,0x00,0x00,0x48,0x00,0x00,0x00,0xb0,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x28,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00, -0x05,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x10,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x20,0x02,0x00,0x00,0x00,0x00,0x00,0x00, -0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x01,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x30,0x02,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x23,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x2b,0x00,0x00,0x00,0x39,0x01,0x00,0x00,0xb0,0x02,0x00,0x00,0x00,0x00,0x00,0x00, -0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x30,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x04,0x05,0x08,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x0f,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x01,0x02,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0xff,0xff,0xff,0xff,0x04,0x05,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x80,0x3f,0x00,0x00,0x00,0x40,0x00,0x00,0x80,0xbf,0x00,0x00,0x00,0x00, -0x05,0x00,0x00,0x10,0x80,0xc7,0x00,0x24,0x05,0x02,0x00,0x10,0x80,0xc7,0x00,0x24, -0x01,0x02,0x81,0xc0,0x80,0x07,0x60,0x00,0x05,0x02,0x00,0x90,0x80,0x07,0x00,0x00, -0x09,0x00,0x01,0xe1,0x80,0x87,0x40,0x00,0x05,0x00,0x00,0x10,0x80,0xc7,0x00,0x24, -0x01,0x00,0x81,0xc0,0x80,0x07,0x60,0x00,0x09,0x04,0x00,0xa0,0x80,0x47,0x00,0xe4, -0x05,0x02,0x00,0x90,0x80,0x07,0x00,0x00,0x05,0x04,0x00,0x10,0x88,0xc7,0x03,0x04, -0x01,0x00,0x01,0xe1,0x88,0x87,0x40,0x00,0x09,0xf8,0x00,0x10,0x88,0xc7,0x03,0x04, -0x0d,0x00,0x00,0x10,0x88,0xc7,0x40,0x24,0x11,0x04,0x00,0x10,0x88,0xc7,0x23,0x04, -0x15,0x06,0x00,0x10,0x89,0xc7,0x23,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0xa0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xa1,0x03,0x00,0x00,0x00,0x00,0x00,0x00, -0xad,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x00,0x28,0x00,0x02,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00, -0xb6,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xb7,0x03,0x00,0x00,0x00,0x00,0x00,0x00, -0xbe,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x26,0x00,0x05,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0xbf,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x03,0x00,0x00,0x00,0x00,0x00,0x00, -0xc9,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x26,0x00,0x01,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0xca,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xcb,0x03,0x00,0x00,0x00,0x00,0x00,0x00, -0xd9,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x26,0x00,0x01,0x00,0x00,0x00, -0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0xda,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xdb,0x03,0x00,0x00,0x00,0x00,0x00,0x00, -0xe8,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x26,0x00,0x02,0x00,0x00,0x00, -0x04,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0x00,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x50,0x4f,0x53, -0x49,0x54,0x49,0x4f,0x4e,0x00,0x00,0x77,0x69,0x6e,0x64,0x6f,0x77,0x00,0x00,0x00, -0x70,0x6f,0x73,0x5f,0x61,0x74,0x74,0x72,0x00,0x00,0x00,0x74,0x65,0x78,0x63,0x6f, -0x6f,0x72,0x64,0x5f,0x61,0x74,0x74,0x72,0x00,0x00,0x00,0x74,0x65,0x78,0x63,0x6f, -0x6f,0x72,0x64,0x5f,0x76,0x61,0x72,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 diff --git a/src/plugins/graphicssystems/openvglite/main.cpp b/src/plugins/graphicssystems/openvglite/main.cpp deleted file mode 100644 index dc0b4a8..0000000 --- a/src/plugins/graphicssystems/openvglite/main.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "qgraphicssystem_vglite.h" - -QT_BEGIN_NAMESPACE - -class QVGGraphicsSystemPlugin : public QGraphicsSystemPlugin -{ -public: - QStringList keys() const; - QGraphicsSystem *create(const QString&); -}; - -QStringList QVGGraphicsSystemPlugin::keys() const -{ - QStringList list; - list << "OpenVG"; - return list; -} - -QGraphicsSystem* QVGGraphicsSystemPlugin::create(const QString& system) -{ - if (system.toLower() == "openvg") - return new QVGLiteGraphicsSystem; - - return 0; -} - -Q_EXPORT_PLUGIN2(openvg, QVGGraphicsSystemPlugin) - -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/openvglite/openvglite.pro b/src/plugins/graphicssystems/openvglite/openvglite.pro deleted file mode 100644 index 9d7860a..0000000 --- a/src/plugins/graphicssystems/openvglite/openvglite.pro +++ /dev/null @@ -1,12 +0,0 @@ -TARGET = qvglitegraphicssystem -include(../../qpluginbase.pri) - -QT += openvg - -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems - -SOURCES = main.cpp qgraphicssystem_vglite.cpp qwindowsurface_vglite.cpp -HEADERS = qgraphicssystem_vglite.h qwindowsurface_vglite.h - -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems -INSTALLS += target diff --git a/src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.cpp b/src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.cpp deleted file mode 100644 index 41b2303..0000000 --- a/src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.cpp +++ /dev/null @@ -1,193 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgraphicssystem_vglite.h" -#include "qwindowsurface_vglite.h" -#include -#include -#include -#ifdef OPENVG_USBHP_INIT -extern "C" { -#include -}; -#endif - -QT_BEGIN_NAMESPACE - -QVGLiteGraphicsSystem::QVGLiteGraphicsSystem() - : w(0), h(0), d(0), dw(0), dh(0), physWidth(0), physHeight(0), - surface(0), context(0), rootWindow(0), - screenFormat(QImage::Format_RGB16), preservedSwap(false) -{ -#ifdef OPENVG_USBHP_INIT - initLibrary(); -#endif - - // The graphics system is also the screen definition. - mScreens.append(this); - - QString displaySpec = QString::fromLatin1(qgetenv("QWS_DISPLAY")); - QStringList displayArgs = displaySpec.split(QLatin1Char(':')); - - // Initialize EGL and create the global EGL context. - context = qt_vg_create_context(0); - if (!context) { - qFatal("QVGLiteGraphicsSystem: could not initialize EGL"); - return; - } - - // Get the root window handle to use. Default to zero. - QRegExp winidRx(QLatin1String("winid=?(\\d+)")); - int winidIdx = displayArgs.indexOf(winidRx); - int handle = 0; - if (winidIdx >= 0) { - winidRx.exactMatch(displayArgs.at(winidIdx)); - handle = winidRx.cap(1).toInt(); - } - - // Create a full-screen window based on the native handle. - // If the context is premultiplied, the window should be too. - QEglProperties props; -#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT - EGLint surfaceType = 0; - if (context->configAttrib(EGL_SURFACE_TYPE, &surfaceType) && - (surfaceType & EGL_VG_ALPHA_FORMAT_PRE_BIT) != 0) - props.setValue(EGL_VG_ALPHA_FORMAT, EGL_VG_ALPHA_FORMAT_PRE); -#endif - rootWindow = eglCreateWindowSurface - (context->display(), context->config(), - (EGLNativeWindowType)handle, props.properties()); - if (rootWindow == EGL_NO_SURFACE) { - delete context; - context = 0; - qFatal("QVGLiteGraphicsSystem: could not create full-screen window"); - return; - } - - // Try to turn on preserved swap behaviour on the root window. - // This will allow us to optimize compositing to focus on just - // the screen region that has changed. Otherwise we must - // re-composite the entire screen every frame. -#if !defined(QVG_NO_PRESERVED_SWAP) - eglGetError(); // Clear error state first. - eglSurfaceAttrib(context->display(), rootWindow, - EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); - preservedSwap = (eglGetError() == EGL_SUCCESS); -#else - preservedSwap = false; -#endif - - // Fetch the root window properties. - eglQuerySurface(context->display(), rootWindow, EGL_WIDTH, &w); - eglQuerySurface(context->display(), rootWindow, EGL_HEIGHT, &h); - screenFormat = qt_vg_config_to_image_format(context); - switch (screenFormat) { - case QImage::Format_ARGB32_Premultiplied: - case QImage::Format_ARGB32: - case QImage::Format_RGB32: - default: - d = 32; - break; - case QImage::Format_RGB16: - case QImage::Format_ARGB4444_Premultiplied: - d = 16; - break; - } - dw = w; - dh = h; - qDebug("screen size: %dx%dx%d", w, h, d); - - // Handle display physical size spec. From qscreenlinuxfb_qws.cpp. - QRegExp mmWidthRx(QLatin1String("mmWidth=?(\\d+)")); - int dimIdxW = displayArgs.indexOf(mmWidthRx); - QRegExp mmHeightRx(QLatin1String("mmHeight=?(\\d+)")); - int dimIdxH = displayArgs.indexOf(mmHeightRx); - if (dimIdxW >= 0) { - mmWidthRx.exactMatch(displayArgs.at(dimIdxW)); - physWidth = mmWidthRx.cap(1).toInt(); - if (dimIdxH < 0) - physHeight = dh*physWidth/dw; - } - if (dimIdxH >= 0) { - mmHeightRx.exactMatch(displayArgs.at(dimIdxH)); - physHeight = mmHeightRx.cap(1).toInt(); - if (dimIdxW < 0) - physWidth = dw*physHeight/dh; - } - if (dimIdxW < 0 && dimIdxH < 0) { - const int dpi = 72; - physWidth = qRound(dw * 25.4 / dpi); - physHeight = qRound(dh * 25.4 / dpi); - } -} - -QVGLiteGraphicsSystem::~QVGLiteGraphicsSystem() -{ -} - -QPixmapData *QVGLiteGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const -{ -#if !defined(QVGLite_NO_SINGLE_CONTEXT) && !defined(QVGLite_NO_PIXMAP_DATA) - // Pixmaps can use QVGLitePixmapData; bitmaps must use raster. - if (type == QPixmapData::PixmapType) - return new QVGPixmapData(type); - else - return new QRasterPixmapData(type); -#else - return new QRasterPixmapData(type); -#endif -} - -QWindowSurface *QVGLiteGraphicsSystem::createWindowSurface(QWidget *widget) const -{ - if (widget->windowType() == Qt::Desktop) - return 0; // Don't create an explicit window surface for the destkop. - if (surface) { - qWarning() << "QVGLiteGraphicsSystem: only one window surface " - "is supported at a time"; - return 0; - } - surface = new QVGLiteWindowSurface - (const_cast(this), widget); - return surface; -} - -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.h b/src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.h deleted file mode 100644 index 512793d..0000000 --- a/src/plugins/graphicssystems/openvglite/qgraphicssystem_vglite.h +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSYSTEM_VGLITE_H -#define QGRAPHICSSYSTEM_VGLITE_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QVGLiteWindowSurface; - -class QVGLiteGraphicsSystem : public QGraphicsSystem, - public QGraphicsSystemScreen -{ -public: - QVGLiteGraphicsSystem(); - ~QVGLiteGraphicsSystem(); - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; - QList screens() const { return mScreens; } - - QRect geometry() const { return QRect(0, 0, w, h); } - int depth() const { return d; } - QImage::Format format() const { return screenFormat; } - QSize physicalSize() const { return QSize(physWidth, physHeight); } - -private: - friend class QVGLiteWindowSurface; - - int w; - int h; - int d; - - int dw; - int dh; - - int physWidth; - int physHeight; - - mutable QVGLiteWindowSurface *surface; - QEglContext *context; - EGLSurface rootWindow; - QImage::Format screenFormat; - bool preservedSwap; - - QList mScreens; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.cpp b/src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.cpp deleted file mode 100644 index c73e35a..0000000 --- a/src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwindowsurface_vglite.h" -#include "qgraphicssystem_vglite.h" -#include -#include -#include - -QT_BEGIN_NAMESPACE - -QVGLiteWindowSurface::QVGLiteWindowSurface - (QVGLiteGraphicsSystem *gs, QWidget *window) - : QWindowSurface(window), graphicsSystem(gs), - isPaintingActive(false), engine(0) -{ -} - -QVGLiteWindowSurface::~QVGLiteWindowSurface() -{ - graphicsSystem->surface = 0; - if (engine) - qt_vg_destroy_paint_engine(engine); -} - -QPaintDevice *QVGLiteWindowSurface::paintDevice() -{ - qt_vg_make_current(graphicsSystem->context, graphicsSystem->rootWindow); - isPaintingActive = true; - // TODO: clear the parts of the back buffer that are not - // covered by the window surface to black. - return this; -} - -void QVGLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) -{ - Q_UNUSED(widget); - Q_UNUSED(region); - Q_UNUSED(offset); - QEglContext *context = graphicsSystem->context; - if (context) { - if (!isPaintingActive) - qt_vg_make_current(context, graphicsSystem->rootWindow); - context->swapBuffers(); - qt_vg_done_current(context); - context->setSurface(EGL_NO_SURFACE); - isPaintingActive = false; - } -} - -void QVGLiteWindowSurface::setGeometry(const QRect &rect) -{ - QWindowSurface::setGeometry(rect); -} - -bool QVGLiteWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - return QWindowSurface::scroll(area, dx, dy); -} - -void QVGLiteWindowSurface::beginPaint(const QRegion ®ion) -{ - Q_UNUSED(region); -} - -void QVGLiteWindowSurface::endPaint(const QRegion ®ion) -{ - Q_UNUSED(region); -} - -QPaintEngine *QVGLiteWindowSurface::paintEngine() const -{ - if (!engine) - engine = qt_vg_create_paint_engine(); - return engine; -} - -// We need to get access to QWidget::metric() from QVGLiteWindowSurface::metric, -// but it is not a friend of QWidget. To get around this, we create a -// fake QX11PaintEngine class, which is a friend. -class QX11PaintEngine -{ -public: - static int metric(const QWidget *widget, QPaintDevice::PaintDeviceMetric met) - { - return widget->metric(met); - } -}; - -int QVGLiteWindowSurface::metric(PaintDeviceMetric met) const -{ - return QX11PaintEngine::metric(window(), met); -} diff --git a/src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.h b/src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.h deleted file mode 100644 index 59faba8..0000000 --- a/src/plugins/graphicssystems/openvglite/qwindowsurface_vglite.h +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_VGLITE_H -#define QWINDOWSURFACE_VGLITE_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 -#include - -QT_BEGIN_NAMESPACE - -class QVGLiteGraphicsSystem; -class QVGPaintEngine; - -class Q_OPENVG_EXPORT QVGLiteWindowSurface : public QWindowSurface, public QPaintDevice -{ -public: - QVGLiteWindowSurface(QVGLiteGraphicsSystem *gs, QWidget *window); - ~QVGLiteWindowSurface(); - - QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void setGeometry(const QRect &rect); - bool scroll(const QRegion &area, int dx, int dy); - - void beginPaint(const QRegion ®ion); - void endPaint(const QRegion ®ion); - - QPaintEngine *paintEngine() const; - -protected: - int metric(PaintDeviceMetric metric) const; - -private: - QVGLiteGraphicsSystem *graphicsSystem; - bool isPaintingActive; - mutable QVGPaintEngine *engine; -}; - -QT_END_NAMESPACE - -#endif // QWINDOWSURFACE_VGLITE_H diff --git a/src/plugins/graphicssystems/qvfb/main.cpp b/src/plugins/graphicssystems/qvfb/main.cpp deleted file mode 100644 index b28dde8..0000000 --- a/src/plugins/graphicssystems/qvfb/main.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "qgraphicssystem_qvfb.h" -#include - -QT_BEGIN_NAMESPACE - -class QVFbGraphicsSystemPlugin : public QGraphicsSystemPlugin -{ -public: - QStringList keys() const; - QGraphicsSystem *create(const QString&); -}; - -QStringList QVFbGraphicsSystemPlugin::keys() const -{ - QStringList list; - list << "QVFb"; - return list; -} - -QGraphicsSystem* QVFbGraphicsSystemPlugin::create(const QString& system) -{ - if (system.toLower() == "qvfb") - return new QVFbGraphicsSystem; - - return 0; -} - -Q_EXPORT_PLUGIN2(qvfb, QVFbGraphicsSystemPlugin) - -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.cpp b/src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.cpp deleted file mode 100644 index 19058a6..0000000 --- a/src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.cpp +++ /dev/null @@ -1,434 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include // overrides QT_OPEN - -#include -#include - -#include "qgraphicssystem_qvfb.h" -#include "qwindowsurface_qvfb.h" -#include -#include -#include - -#include -#include -#include - -QT_BEGIN_NAMESPACE - - -class QVFbGraphicsSystemScreenKeyboardHandler : public QObject -{ - Q_OBJECT -public: - QVFbGraphicsSystemScreenKeyboardHandler(); - ~QVFbGraphicsSystemScreenKeyboardHandler(); - -private slots: - void readKeyboardData(); - -private: - int kbdFD; - int kbdIdx; - int kbdBufferLen; - unsigned char *kbdBuffer; - QSocketNotifier *keyNotifier; -}; - -QVFbGraphicsSystemScreenKeyboardHandler::QVFbGraphicsSystemScreenKeyboardHandler() -{ - int displayId = 0; //TODO displayId - const QString keyboardDev = QT_VFB_KEYBOARD_PIPE(displayId); - - - kbdFD = -1; - kbdIdx = 0; - kbdBufferLen = sizeof(QVFbKeyData) * 5; - kbdBuffer = new unsigned char [kbdBufferLen]; - - kbdFD = QT_OPEN(keyboardDev.toLatin1().constData(), O_RDWR | O_NDELAY); - - if (kbdFD == -1) { - perror("QVFbGraphicsSystemScreenKeyboardHandler"); - qWarning("QVFbGraphicsSystemScreenKeyboardHandler: Unable to open device %s", - qPrintable(keyboardDev)); - return; - } - - // Clear pending input - char buf[2]; - while (QT_READ(kbdFD, buf, 1) > 0) { } - - keyNotifier = new QSocketNotifier(kbdFD, QSocketNotifier::Read, this); - connect(keyNotifier, SIGNAL(activated(int)),this, SLOT(readKeyboardData())); - -} - -QVFbGraphicsSystemScreenKeyboardHandler::~QVFbGraphicsSystemScreenKeyboardHandler() -{ - if (kbdFD >= 0) - QT_CLOSE(kbdFD); - delete [] kbdBuffer; -} - - -void QVFbGraphicsSystemScreenKeyboardHandler::readKeyboardData() -{ - int n; - do { - n = QT_READ(kbdFD, kbdBuffer+kbdIdx, kbdBufferLen - kbdIdx); - if (n > 0) - kbdIdx += n; - } while (n > 0); - - int idx = 0; - while (kbdIdx - idx >= (int)sizeof(QVFbKeyData)) { - QVFbKeyData *kd = (QVFbKeyData *)(kbdBuffer + idx); - if (kd->unicode == 0 && kd->keycode == 0 && kd->modifiers == 0 && kd->press) { - // magic exit key - qWarning("Instructed to quit by Virtual Keyboard"); - qApp->quit(); - } - - //QWSServer::processKeyEvent(kd->unicode ? kd->unicode : 0xffff, kd->keycode, kd->modifiers, kd->press, kd->repeat); - - QEvent::Type type = kd->press ? QEvent::KeyPress : QEvent::KeyRelease; - - QString text; - if (kd->unicode && kd->unicode != 0xffff) - text += QChar(kd->unicode); - -// qDebug() << "readKeyboardData" << type << hex << kd->keycode << kd->modifiers << text; - - QWindowSystemInterface::handleKeyEvent(0, type, kd->keycode, kd->modifiers, text, kd->repeat, int(text.length())); - idx += sizeof(QVFbKeyData); - } - - int surplus = kbdIdx - idx; - for (int i = 0; i < surplus; i++) - kbdBuffer[i] = kbdBuffer[idx+i]; - kbdIdx = surplus; -} - - - - -class QVFbGraphicsSystemScreenMouseHandler : public QObject -{ - Q_OBJECT -public: - QVFbGraphicsSystemScreenMouseHandler(); - ~QVFbGraphicsSystemScreenMouseHandler(); - -private slots: - void readMouseData(); - -private: - int mouseFD; - int mouseIdx; - enum {mouseBufSize = 128}; - uchar mouseBuf[mouseBufSize]; - QSocketNotifier *mouseNotifier; - - int oldButtonState; -}; - -QVFbGraphicsSystemScreenMouseHandler::QVFbGraphicsSystemScreenMouseHandler() -{ - int displayId = 0; //TODO: displayId - QString mouseDev = QT_VFB_MOUSE_PIPE(displayId); - - mouseFD = QT_OPEN(mouseDev.toLatin1().constData(), O_RDWR | O_NDELAY); - - if (mouseFD == -1) { - perror("QVFbMouseHandler::QVFbMouseHandler"); - qWarning("QVFbMouseHander: Unable to open device %s", - qPrintable(mouseDev)); - return; - } - - // Clear pending input - char buf[2]; - while (QT_READ(mouseFD, buf, 1) > 0) { } - - mouseIdx = 0; - oldButtonState = 0; - mouseNotifier = new QSocketNotifier(mouseFD, QSocketNotifier::Read, this); - connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData())); -} - - -QVFbGraphicsSystemScreenMouseHandler::~QVFbGraphicsSystemScreenMouseHandler() -{ - if (mouseFD >= 0) - QT_CLOSE(mouseFD); -} - -void QVFbGraphicsSystemScreenMouseHandler::readMouseData() -{ - int n; - do { - n = QT_READ(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx); - if (n > 0) - mouseIdx += n; - } while (n > 0); - - int idx = 0; - static const int packetsize = sizeof(QPoint) + 2*sizeof(int); - while (mouseIdx-idx >= packetsize) { - uchar *mb = mouseBuf+idx; - QPoint mousePos = *reinterpret_cast(mb); - mb += sizeof(QPoint); - int bstate = *reinterpret_cast(mb); - mb += sizeof(int); - int wheel = *reinterpret_cast(mb); - - int button = bstate ^ oldButtonState; - QEvent::Type type = QEvent::MouseMove; - - if (button) { - type = (button & bstate) ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; - } - QWindowSystemInterface::handleMouseEvent(0, mousePos, mousePos, Qt::MouseButtons(bstate)); - -// qDebug() << "readMouseData" << mousePos << button << bstate << oldButtonState << type; - - oldButtonState = bstate; - - idx += packetsize; - } - - int surplus = mouseIdx - idx; - for (int i = 0; i < surplus; i++) - mouseBuf[i] = mouseBuf[idx+i]; - mouseIdx = surplus; - -} - - -class QVFbGraphicsSystemScreenPrivate -{ -public: - QVFbGraphicsSystemScreenPrivate(QVFbGraphicsSystemScreen *) - : shmrgn(0), hdr(0), data(0), mouseHandler(0), keyboardHandler(0) - { - connect(0); //for now we only handle one screen - } - - ~QVFbGraphicsSystemScreenPrivate() { disconnect(); } - void setDirty(const QRect &r); - - bool connect(int displayId); - void disconnect(); - - QImage *screenImage() { return &img; } - QSize screenSize() { return img.size(); } - - int depth() const { return img.depth(); } - QImage::Format format() const { return img.format(); } - -private: - unsigned char *shmrgn; - QVFbHeader *hdr; - uchar *data; - QVFbGraphicsSystemScreenMouseHandler *mouseHandler; - QVFbGraphicsSystemScreenKeyboardHandler *keyboardHandler; - - - QImage img; -}; - - -void QVFbGraphicsSystemScreenPrivate::setDirty(const QRect &r) -{ - hdr->dirty = true; - hdr->update = hdr->update.united(r); -} - - -bool QVFbGraphicsSystemScreenPrivate::connect(int displayId) -{ - - key_t key = ftok(QT_VFB_MOUSE_PIPE(displayId).toLatin1(), 'b'); - - if (key == -1) - return false; - - - int shmId = shmget(key, 0, 0); - if (shmId != -1) - shmrgn = (unsigned char *)shmat(shmId, 0, 0); - else - return false; - - if ((long)shmrgn == -1 || shmrgn == 0) { - qDebug("No shmrgn %ld", (long)shmrgn); - return false; - } - - hdr = (QVFbHeader *)shmrgn; - data = shmrgn + hdr->dataoffset; - - int w = hdr->width; - int h = hdr->height; - int d = hdr->depth; - int lstep = hdr->linestep; - - QImage::Format format = QImage::Format_Invalid; - if (d == 32) - format = QImage::Format_ARGB32_Premultiplied; - else if (d == 16) - format = QImage::Format_RGB16; - - - if (format == QImage::Format_Invalid) { - img = QImage(); - return false; - } - - img = QImage(data, w, h, lstep, format); - - qDebug("connected %dx%d %d bpp", w, h, d); - - - mouseHandler = new QVFbGraphicsSystemScreenMouseHandler; - keyboardHandler = new QVFbGraphicsSystemScreenKeyboardHandler; - return true; -} - -void QVFbGraphicsSystemScreenPrivate::disconnect() -{ - if ((long)shmrgn != -1 && shmrgn) { - shmdt((char*)shmrgn); - shmrgn = 0; - } - delete mouseHandler; - mouseHandler = 0; - delete keyboardHandler; - keyboardHandler = 0; -} - - -QVFbGraphicsSystemScreen::QVFbGraphicsSystemScreen() -{ - d_ptr = new QVFbGraphicsSystemScreenPrivate(this); -} - - -QVFbGraphicsSystemScreen::~QVFbGraphicsSystemScreen() -{ - delete d_ptr; -} - -void QVFbGraphicsSystemScreen::setDirty(const QRect &rect) -{ - d_ptr->setDirty(rect); -} - - - -QRect QVFbGraphicsSystemScreen::geometry() const { - return QRect(QPoint(), d_ptr->screenSize()); -} - - -int QVFbGraphicsSystemScreen::depth() const -{ - return d_ptr->depth(); -} - -QImage::Format QVFbGraphicsSystemScreen::format() const -{ - return d_ptr->format(); -} - -QSize QVFbGraphicsSystemScreen::physicalSize() const { - return (d_ptr->screenSize()*254)/720; -} - -#if 0 -int QVFbGraphicsSystemScreen::linestep() const { - return d_ptr->screenImage() ? d_ptr->screenImage()->bytesPerLine() : 0; -} - -uchar *QVFbGraphicsSystemScreen::base() const { - return d_ptr->screenImage() ? d_ptr->screenImage()->bits() : 0; -} -#endif - -QImage *QVFbGraphicsSystemScreen::screenImage() -{ - return d_ptr->screenImage(); -} - -QVFbGraphicsSystem::QVFbGraphicsSystem() -{ - mPrimaryScreen = new QVFbGraphicsSystemScreen(); - - mScreens.append(mPrimaryScreen); -} - -QPixmapData *QVFbGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const -{ - return new QRasterPixmapData(type); -} - -QWindowSurface *QVFbGraphicsSystem::createWindowSurface(QWidget *widget) const -{ - if (widget->windowType() == Qt::Desktop) - return 0; // Don't create an explicit window surface for the destkop. - return new QVFbWindowSurface - (const_cast(this), mPrimaryScreen, widget); -} - -QT_END_NAMESPACE - -#include "qgraphicssystem_qvfb.moc" diff --git a/src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.h b/src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.h deleted file mode 100644 index b31869c..0000000 --- a/src/plugins/graphicssystems/qvfb/qgraphicssystem_qvfb.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSYSTEM_QVFB_H -#define QGRAPHICSSYSTEM_QVFB_H - -#include - -QT_BEGIN_NAMESPACE - - -class QVFbGraphicsSystemScreenPrivate; - -class QVFbGraphicsSystemScreen : public QGraphicsSystemScreen -{ -public: - QVFbGraphicsSystemScreen(); - ~QVFbGraphicsSystemScreen(); - - QRect geometry() const; - int depth() const; - QImage::Format format() const; - QSize physicalSize() const; - - QImage *screenImage(); - - void setDirty(const QRect &rect); - -public: - - QVFbGraphicsSystemScreenPrivate *d_ptr; -}; - -class QVFbGraphicsSystemPrivate; - - -class QVFbGraphicsSystem : public QGraphicsSystem -{ -public: - QVFbGraphicsSystem(); - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; - - QList screens() const { return mScreens; } - -private: - QVFbGraphicsSystemScreen *mPrimaryScreen; - QList mScreens; -}; - - - -QT_END_NAMESPACE - - -#endif diff --git a/src/plugins/graphicssystems/qvfb/qvfb.pro b/src/plugins/graphicssystems/qvfb/qvfb.pro deleted file mode 100644 index b321725..0000000 --- a/src/plugins/graphicssystems/qvfb/qvfb.pro +++ /dev/null @@ -1,12 +0,0 @@ -TARGET = qvfbgraphicssystem -include(../../qpluginbase.pri) - -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems - - - -SOURCES = main.cpp qgraphicssystem_qvfb.cpp qwindowsurface_qvfb.cpp -HEADERS = qgraphicssystem_qvfb.h qwindowsurface_qvfb.h - -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems -INSTALLS += target diff --git a/src/plugins/graphicssystems/qvfb/qwindowsurface_qvfb.cpp b/src/plugins/graphicssystems/qvfb/qwindowsurface_qvfb.cpp deleted file mode 100644 index 0aafe28..0000000 --- a/src/plugins/graphicssystems/qvfb/qwindowsurface_qvfb.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include "qwindowsurface_qvfb.h" -#include "qgraphicssystem_qvfb.h" -#include -#include -#include - -QT_BEGIN_NAMESPACE - -QVFbWindowSurface::QVFbWindowSurface(QVFbGraphicsSystem *graphicsSystem, - QVFbGraphicsSystemScreen *screen, QWidget *window) - : QWindowSurface(window), - mScreen(screen) -{ -} - -QVFbWindowSurface::~QVFbWindowSurface() -{ -} - -QPaintDevice *QVFbWindowSurface::paintDevice() -{ - return mScreen->screenImage(); -} - -void QVFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) -{ - Q_UNUSED(widget); - Q_UNUSED(offset); - - QRect rect = geometry(); - QPoint topLeft = rect.topLeft(); - - mScreen->setDirty(region.boundingRect()); -} - -void QVFbWindowSurface::setGeometry(const QRect &) -{ - -// any size you like as long as it's full-screen... - - QRect rect(mScreen->availableGeometry()); - QWindowSystemInterface::handleGeometryChange(this->window(), rect); - - QWindowSurface::setGeometry(rect); -} - -bool QVFbWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - return QWindowSurface::scroll(area, dx, dy); -} - -void QVFbWindowSurface::beginPaint(const QRegion ®ion) -{ - Q_UNUSED(region); -} - -void QVFbWindowSurface::endPaint(const QRegion ®ion) -{ - Q_UNUSED(region); -} - -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/qvfb/qwindowsurface_qvfb.h b/src/plugins/graphicssystems/qvfb/qwindowsurface_qvfb.h deleted file mode 100644 index 1971caa..0000000 --- a/src/plugins/graphicssystems/qvfb/qwindowsurface_qvfb.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_QVFB_H -#define QWINDOWSURFACE_QVFB_H - -#include - -QT_BEGIN_NAMESPACE - -class QVFbGraphicsSystem; -class QVFbGraphicsSystemScreen; - -class QVFbWindowSurface : public QWindowSurface -{ -public: - QVFbWindowSurface(QVFbGraphicsSystem *graphicsSystem, - QVFbGraphicsSystemScreen *screen, QWidget *window); - ~QVFbWindowSurface(); - - QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void setGeometry(const QRect &rect); - bool scroll(const QRegion &area, int dx, int dy); - - void beginPaint(const QRegion ®ion); - void endPaint(const QRegion ®ion); - -private: - QVFbGraphicsSystem *mGraphicsSystem; - QVFbGraphicsSystemScreen *mScreen; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/graphicssystems/testlite/main.cpp b/src/plugins/graphicssystems/testlite/main.cpp deleted file mode 100644 index 28caea7..0000000 --- a/src/plugins/graphicssystems/testlite/main.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "qgraphicssystem_testlite.h" - -QT_BEGIN_NAMESPACE - -class QTestLiteGraphicsSystemPlugin : public QGraphicsSystemPlugin -{ -public: - QStringList keys() const; - QGraphicsSystem *create(const QString&); -}; - -QStringList QTestLiteGraphicsSystemPlugin::keys() const -{ - QStringList list; - list << "TestLite"; - return list; -} - -QGraphicsSystem* QTestLiteGraphicsSystemPlugin::create(const QString& system) -{ - if (system.toLower() == "testlite") - return new QTestLiteGraphicsSystem; - - return 0; -} - -Q_EXPORT_PLUGIN2(testlite, QTestLiteGraphicsSystemPlugin) - -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp deleted file mode 100644 index 92e0ebc..0000000 --- a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgraphicssystem_testlite.h" -#include "qwindowsurface_testlite.h" -#include -#include - -#include - - -#include "x11util.h" - -QT_BEGIN_NAMESPACE - -class MyCursor : QGraphicsSystemCursor -{ -public: - MyCursor(QGraphicsSystemScreen *screen) : QGraphicsSystemCursor(screen) {} - - void changeCursor(QCursor * cursor, QWidget * widget) { - QTestLiteWindowSurface *ws = 0; - if (widget) { - QWidget *window = widget->window(); - ws = static_cast(window->windowSurface()); - } else { - // No X11 cursor control when there is no widget under the cursor - return; - } - - //qDebug() << "changeCursor" << widget << ws; - if (!ws) - return; - - ws->setCursor(cursor); - } -}; - - -QTestLiteGraphicsSystem::QTestLiteGraphicsSystem() -{ - - xd = new MyDisplay; - - mPrimaryScreen = new QTestLiteGraphicsSystemScreen(); - - mPrimaryScreen->mGeometry = QRect - (0, 0, xd->width, xd->height); - mPrimaryScreen->mDepth = 32; - mPrimaryScreen->mFormat = QImage::Format_RGB32; - mPrimaryScreen->mPhysicalSize = - QSize(xd->physicalWidth, xd->physicalHeight); - - mScreens.append(mPrimaryScreen); - - - (void)new MyCursor(mPrimaryScreen); - -} - -QPixmapData *QTestLiteGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const -{ - return new QRasterPixmapData(type); -} - -QWindowSurface *QTestLiteGraphicsSystem::createWindowSurface(QWidget *widget) const -{ - if (widget->windowType() == Qt::Desktop) - return 0; // Don't create an explicit window surface for the destkop. - return new QTestLiteWindowSurface - (const_cast(this), mPrimaryScreen, widget); -} - - -QPixmap QTestLiteGraphicsSystem::grabWindow(WId window, int x, int y, int width, int height) const -{ - QImage img = xd->grabWindow(window, x, y, width, height); - return QPixmap::fromImage(img); -} - - - -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.h b/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.h deleted file mode 100644 index b2cd496..0000000 --- a/src/plugins/graphicssystems/testlite/qgraphicssystem_testlite.h +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSYSTEM_TESTLITE_H -#define QGRAPHICSSYSTEM_TESTLITE_H - -#include - -QT_BEGIN_NAMESPACE - -class MyDisplay; - -class QTestLiteGraphicsSystemScreen : public QGraphicsSystemScreen -{ -public: - QTestLiteGraphicsSystemScreen() - : mDepth(16), mFormat(QImage::Format_RGB16) {} - ~QTestLiteGraphicsSystemScreen() {} - - QRect geometry() const { return mGeometry; } - int depth() const { return mDepth; } - QImage::Format format() const { return mFormat; } - QSize physicalSize() const { return mPhysicalSize; } - -public: - QRect mGeometry; - int mDepth; - QImage::Format mFormat; - QSize mPhysicalSize; -}; - -class QTestLiteGraphicsSystem : public QGraphicsSystem -{ -public: - QTestLiteGraphicsSystem(); - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; - - QPixmap grabWindow(WId window, int x, int y, int width, int height) const; - - QList screens() const { return mScreens; } - - MyDisplay *xd; - -private: - QTestLiteGraphicsSystemScreen *mPrimaryScreen; - QList mScreens; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp deleted file mode 100644 index c54f6eb..0000000 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.cpp +++ /dev/null @@ -1,661 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwindowsurface_testlite.h" -#include "qgraphicssystem_testlite.h" - -#include -#include - -#include "x11util.h" - -QT_BEGIN_NAMESPACE - -QTestLiteWindowSurface::QTestLiteWindowSurface - (QTestLiteGraphicsSystem *graphicsSystem, - QTestLiteGraphicsSystemScreen *screen, QWidget *window) - : QWindowSurface(window), - mGraphicsSystem(graphicsSystem), - mScreen(screen), - xw(0) -{ - - - xw = new MyWindow(graphicsSystem->xd, 0,0,300,300); - xw->windowSurface = this; - -// qDebug() << "QTestLiteWindowSurface::QTestLiteWindowSurface:" << xw->window; - - setWindowFlags(window->windowFlags()); //##### This should not be the plugin's responsibility -} - -QTestLiteWindowSurface::~QTestLiteWindowSurface() -{ -// qDebug() << "~QTestLiteWindowSurface" << xw->window; - delete xw; -} - -QPaintDevice *QTestLiteWindowSurface::paintDevice() -{ - return xw->image(); -} - -void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) -{ - Q_UNUSED(widget); - Q_UNUSED(region); - Q_UNUSED(offset); - - // qDebug() << "QTestLiteWindowSurface::flush:" << (long)this; - - xw->paintEvent(); -} - - -void QTestLiteWindowSurface::setGeometry(const QRect &rect) -{ - QRect oldRect = geometry(); - if (rect == oldRect) - return; - - QWindowSurface::setGeometry(rect); - - //if unchanged ### -// xw->setSize(rect.width(), rect.height()); - xw->setGeometry(rect.x(), rect.y(), rect.width(), rect.height()); -} - -//### scroll logic copied from QRasterWindowSurface, we should make better API for this - -void copied_qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset) -{ - // make sure we don't detach - uchar *mem = const_cast(const_cast(img).bits()); - - int lineskip = img.bytesPerLine(); - int depth = img.depth() >> 3; - - const QRect imageRect(0, 0, img.width(), img.height()); - const QRect r = rect & imageRect & imageRect.translated(-offset); - const QPoint p = rect.topLeft() + offset; - - if (r.isEmpty()) - return; - - const uchar *src; - uchar *dest; - - if (r.top() < p.y()) { - src = mem + r.bottom() * lineskip + r.left() * depth; - dest = mem + (p.y() + r.height() - 1) * lineskip + p.x() * depth; - lineskip = -lineskip; - } else { - src = mem + r.top() * lineskip + r.left() * depth; - dest = mem + p.y() * lineskip + p.x() * depth; - } - - const int w = r.width(); - int h = r.height(); - const int bytes = w * depth; - - // overlapping segments? - if (offset.y() == 0 && qAbs(offset.x()) < w) { - do { - ::memmove(dest, src, bytes); - dest += lineskip; - src += lineskip; - } while (--h); - } else { - do { - ::memcpy(dest, src, bytes); - dest += lineskip; - src += lineskip; - } while (--h); - } -} - -bool QTestLiteWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - if (!xw->image() || xw->image()->isNull()) - return false; - - const QVector rects = area.rects(); - for (int i = 0; i < rects.size(); ++i) - copied_qt_scrollRectInImage(*xw->image(), rects.at(i), QPoint(dx, dy)); - - return true; -} - - -void QTestLiteWindowSurface::beginPaint(const QRegion ®ion) -{ - Q_UNUSED(region); - xw->resizeBuffer(geometry().size()); -} - -void QTestLiteWindowSurface::endPaint(const QRegion ®ion) -{ - Q_UNUSED(region); - xw->painted = true; //there is content in the buffer -} - - - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Mouse event stuff - - - - -static Qt::MouseButtons translateMouseButtons(int s) -{ - Qt::MouseButtons ret = 0; - if (s & Button1Mask) - ret |= Qt::LeftButton; - if (s & Button2Mask) - ret |= Qt::MidButton; - if (s & Button3Mask) - ret |= Qt::RightButton; - return ret; -} - - -static Qt::KeyboardModifiers translateModifiers(int s) -{ - const uchar qt_alt_mask = Mod1Mask; - const uchar qt_meta_mask = Mod4Mask; - - - Qt::KeyboardModifiers ret = 0; - if (s & ShiftMask) - ret |= Qt::ShiftModifier; - if (s & ControlMask) - ret |= Qt::ControlModifier; - if (s & qt_alt_mask) - ret |= Qt::AltModifier; - if (s & qt_meta_mask) - ret |= Qt::MetaModifier; -#if 0 - if (s & qt_mode_switch_mask) - ret |= Qt::GroupSwitchModifier; -#endif - return ret; -} - -void QTestLiteWindowSurface::handleMouseEvent(QEvent::Type type, void *ev) -{ - static QPoint mousePoint; - - XButtonEvent *e = static_cast(ev); - - Qt::MouseButton button = Qt::NoButton; - Qt::MouseButtons buttons = translateMouseButtons(e->state); - Qt::KeyboardModifiers modifiers = translateModifiers(e->state); - if (type != QEvent::MouseMove) { - switch (e->button) { - case Button1: button = Qt::LeftButton; break; - case Button2: button = Qt::MidButton; break; - case Button3: button = Qt::RightButton; break; - case Button4: - case Button5: - case 6: - case 7: { - //mouse wheel - if (type == QEvent::MouseButtonPress) { - //logic borrowed from qapplication_x11.cpp - int delta = 120 * ((e->button == Button4 || e->button == 6) ? 1 : -1); - bool hor = (((e->button == Button4 || e->button == Button5) - && (modifiers & Qt::AltModifier)) - || (e->button == 6 || e->button == 7)); - QWindowSystemInterface::handleWheelEvent(window(), e->time, - QPoint(e->x, e->y), - QPoint(e->x_root, e->y_root), - delta, hor ? Qt::Horizontal : Qt::Vertical); - } - return; - } - default: break; - } - } - - buttons ^= button; // X event uses state *before*, Qt uses state *after* - - QWindowSystemInterface::handleMouseEvent(window(), e->time, QPoint(e->x, e->y), - QPoint(e->x_root, e->y_root), - buttons); - - mousePoint = QPoint(e->x_root, e->y_root); -} - -void QTestLiteWindowSurface::handleGeometryChange(int x, int y, int w, int h) -{ - QWindowSystemInterface::handleGeometryChange(window(), QRect(x,y,w,h)); -} - - -void QTestLiteWindowSurface::handleCloseEvent() -{ - QWindowSystemInterface::handleCloseEvent(window()); -} - - -void QTestLiteWindowSurface::handleEnterEvent() -{ - QWindowSystemInterface::handleEnterEvent(window()); -} - -void QTestLiteWindowSurface::handleLeaveEvent() -{ - QWindowSystemInterface::handleLeaveEvent(window()); -} - - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Key event stuff -- not pretty either -// -// What we want to do is to port Robert's keytable code properly - - - - - - - -// keyboard mapping table -static const unsigned int keyTbl[] = { - - // misc keys - - XK_Escape, Qt::Key_Escape, - XK_Tab, Qt::Key_Tab, - XK_ISO_Left_Tab, Qt::Key_Backtab, - XK_BackSpace, Qt::Key_Backspace, - XK_Return, Qt::Key_Return, - XK_Insert, Qt::Key_Insert, - XK_Delete, Qt::Key_Delete, - XK_Clear, Qt::Key_Delete, - XK_Pause, Qt::Key_Pause, - XK_Print, Qt::Key_Print, - 0x1005FF60, Qt::Key_SysReq, // hardcoded Sun SysReq - 0x1007ff00, Qt::Key_SysReq, // hardcoded X386 SysReq - - // cursor movement - - XK_Home, Qt::Key_Home, - XK_End, Qt::Key_End, - XK_Left, Qt::Key_Left, - XK_Up, Qt::Key_Up, - XK_Right, Qt::Key_Right, - XK_Down, Qt::Key_Down, - XK_Prior, Qt::Key_PageUp, - XK_Next, Qt::Key_PageDown, - - // modifiers - - XK_Shift_L, Qt::Key_Shift, - XK_Shift_R, Qt::Key_Shift, - XK_Shift_Lock, Qt::Key_Shift, - XK_Control_L, Qt::Key_Control, - XK_Control_R, Qt::Key_Control, - XK_Meta_L, Qt::Key_Meta, - XK_Meta_R, Qt::Key_Meta, - XK_Alt_L, Qt::Key_Alt, - XK_Alt_R, Qt::Key_Alt, - XK_Caps_Lock, Qt::Key_CapsLock, - XK_Num_Lock, Qt::Key_NumLock, - XK_Scroll_Lock, Qt::Key_ScrollLock, - XK_Super_L, Qt::Key_Super_L, - XK_Super_R, Qt::Key_Super_R, - XK_Menu, Qt::Key_Menu, - XK_Hyper_L, Qt::Key_Hyper_L, - XK_Hyper_R, Qt::Key_Hyper_R, - XK_Help, Qt::Key_Help, - 0x1000FF74, Qt::Key_Backtab, // hardcoded HP backtab - 0x1005FF10, Qt::Key_F11, // hardcoded Sun F36 (labeled F11) - 0x1005FF11, Qt::Key_F12, // hardcoded Sun F37 (labeled F12) - - // numeric and function keypad keys - - XK_KP_Space, Qt::Key_Space, - XK_KP_Tab, Qt::Key_Tab, - XK_KP_Enter, Qt::Key_Enter, - //XK_KP_F1, Qt::Key_F1, - //XK_KP_F2, Qt::Key_F2, - //XK_KP_F3, Qt::Key_F3, - //XK_KP_F4, Qt::Key_F4, - XK_KP_Home, Qt::Key_Home, - XK_KP_Left, Qt::Key_Left, - XK_KP_Up, Qt::Key_Up, - XK_KP_Right, Qt::Key_Right, - XK_KP_Down, Qt::Key_Down, - XK_KP_Prior, Qt::Key_PageUp, - XK_KP_Next, Qt::Key_PageDown, - XK_KP_End, Qt::Key_End, - XK_KP_Begin, Qt::Key_Clear, - XK_KP_Insert, Qt::Key_Insert, - XK_KP_Delete, Qt::Key_Delete, - XK_KP_Equal, Qt::Key_Equal, - XK_KP_Multiply, Qt::Key_Asterisk, - XK_KP_Add, Qt::Key_Plus, - XK_KP_Separator, Qt::Key_Comma, - XK_KP_Subtract, Qt::Key_Minus, - XK_KP_Decimal, Qt::Key_Period, - XK_KP_Divide, Qt::Key_Slash, - - // International input method support keys - - // International & multi-key character composition - XK_ISO_Level3_Shift, Qt::Key_AltGr, - XK_Multi_key, Qt::Key_Multi_key, - XK_Codeinput, Qt::Key_Codeinput, - XK_SingleCandidate, Qt::Key_SingleCandidate, - XK_MultipleCandidate, Qt::Key_MultipleCandidate, - XK_PreviousCandidate, Qt::Key_PreviousCandidate, - - // Misc Functions - XK_Mode_switch, Qt::Key_Mode_switch, - XK_script_switch, Qt::Key_Mode_switch, - - // Japanese keyboard support - XK_Kanji, Qt::Key_Kanji, - XK_Muhenkan, Qt::Key_Muhenkan, - //XK_Henkan_Mode, Qt::Key_Henkan_Mode, - XK_Henkan_Mode, Qt::Key_Henkan, - XK_Henkan, Qt::Key_Henkan, - XK_Romaji, Qt::Key_Romaji, - XK_Hiragana, Qt::Key_Hiragana, - XK_Katakana, Qt::Key_Katakana, - XK_Hiragana_Katakana, Qt::Key_Hiragana_Katakana, - XK_Zenkaku, Qt::Key_Zenkaku, - XK_Hankaku, Qt::Key_Hankaku, - XK_Zenkaku_Hankaku, Qt::Key_Zenkaku_Hankaku, - XK_Touroku, Qt::Key_Touroku, - XK_Massyo, Qt::Key_Massyo, - XK_Kana_Lock, Qt::Key_Kana_Lock, - XK_Kana_Shift, Qt::Key_Kana_Shift, - XK_Eisu_Shift, Qt::Key_Eisu_Shift, - XK_Eisu_toggle, Qt::Key_Eisu_toggle, - //XK_Kanji_Bangou, Qt::Key_Kanji_Bangou, - //XK_Zen_Koho, Qt::Key_Zen_Koho, - //XK_Mae_Koho, Qt::Key_Mae_Koho, - XK_Kanji_Bangou, Qt::Key_Codeinput, - XK_Zen_Koho, Qt::Key_MultipleCandidate, - XK_Mae_Koho, Qt::Key_PreviousCandidate, - -#ifdef XK_KOREAN - // Korean keyboard support - XK_Hangul, Qt::Key_Hangul, - XK_Hangul_Start, Qt::Key_Hangul_Start, - XK_Hangul_End, Qt::Key_Hangul_End, - XK_Hangul_Hanja, Qt::Key_Hangul_Hanja, - XK_Hangul_Jamo, Qt::Key_Hangul_Jamo, - XK_Hangul_Romaja, Qt::Key_Hangul_Romaja, - //XK_Hangul_Codeinput, Qt::Key_Hangul_Codeinput, - XK_Hangul_Codeinput, Qt::Key_Codeinput, - XK_Hangul_Jeonja, Qt::Key_Hangul_Jeonja, - XK_Hangul_Banja, Qt::Key_Hangul_Banja, - XK_Hangul_PreHanja, Qt::Key_Hangul_PreHanja, - XK_Hangul_PostHanja, Qt::Key_Hangul_PostHanja, - //XK_Hangul_SingleCandidate,Qt::Key_Hangul_SingleCandidate, - //XK_Hangul_MultipleCandidate,Qt::Key_Hangul_MultipleCandidate, - //XK_Hangul_PreviousCandidate,Qt::Key_Hangul_PreviousCandidate, - XK_Hangul_SingleCandidate, Qt::Key_SingleCandidate, - XK_Hangul_MultipleCandidate,Qt::Key_MultipleCandidate, - XK_Hangul_PreviousCandidate,Qt::Key_PreviousCandidate, - XK_Hangul_Special, Qt::Key_Hangul_Special, - //XK_Hangul_switch, Qt::Key_Hangul_switch, - XK_Hangul_switch, Qt::Key_Mode_switch, -#endif // XK_KOREAN - - // dead keys - XK_dead_grave, Qt::Key_Dead_Grave, - XK_dead_acute, Qt::Key_Dead_Acute, - XK_dead_circumflex, Qt::Key_Dead_Circumflex, - XK_dead_tilde, Qt::Key_Dead_Tilde, - XK_dead_macron, Qt::Key_Dead_Macron, - XK_dead_breve, Qt::Key_Dead_Breve, - XK_dead_abovedot, Qt::Key_Dead_Abovedot, - XK_dead_diaeresis, Qt::Key_Dead_Diaeresis, - XK_dead_abovering, Qt::Key_Dead_Abovering, - XK_dead_doubleacute, Qt::Key_Dead_Doubleacute, - XK_dead_caron, Qt::Key_Dead_Caron, - XK_dead_cedilla, Qt::Key_Dead_Cedilla, - XK_dead_ogonek, Qt::Key_Dead_Ogonek, - XK_dead_iota, Qt::Key_Dead_Iota, - XK_dead_voiced_sound, Qt::Key_Dead_Voiced_Sound, - XK_dead_semivoiced_sound, Qt::Key_Dead_Semivoiced_Sound, - XK_dead_belowdot, Qt::Key_Dead_Belowdot, - XK_dead_hook, Qt::Key_Dead_Hook, - XK_dead_horn, Qt::Key_Dead_Horn, - -#if 0 - // Special multimedia keys - // currently only tested with MS internet keyboard - - // browsing keys - XF86XK_Back, Qt::Key_Back, - XF86XK_Forward, Qt::Key_Forward, - XF86XK_Stop, Qt::Key_Stop, - XF86XK_Refresh, Qt::Key_Refresh, - XF86XK_Favorites, Qt::Key_Favorites, - XF86XK_AudioMedia, Qt::Key_LaunchMedia, - XF86XK_OpenURL, Qt::Key_OpenUrl, - XF86XK_HomePage, Qt::Key_HomePage, - XF86XK_Search, Qt::Key_Search, - - // media keys - XF86XK_AudioLowerVolume, Qt::Key_VolumeDown, - XF86XK_AudioMute, Qt::Key_VolumeMute, - XF86XK_AudioRaiseVolume, Qt::Key_VolumeUp, - XF86XK_AudioPlay, Qt::Key_MediaPlay, - XF86XK_AudioStop, Qt::Key_MediaStop, - XF86XK_AudioPrev, Qt::Key_MediaPrevious, - XF86XK_AudioNext, Qt::Key_MediaNext, - XF86XK_AudioRecord, Qt::Key_MediaRecord, - - // launch keys - XF86XK_Mail, Qt::Key_LaunchMail, - XF86XK_MyComputer, Qt::Key_Launch0, - XF86XK_Calculator, Qt::Key_Launch1, - XF86XK_Standby, Qt::Key_Standby, - - XF86XK_Launch0, Qt::Key_Launch2, - XF86XK_Launch1, Qt::Key_Launch3, - XF86XK_Launch2, Qt::Key_Launch4, - XF86XK_Launch3, Qt::Key_Launch5, - XF86XK_Launch4, Qt::Key_Launch6, - XF86XK_Launch5, Qt::Key_Launch7, - XF86XK_Launch6, Qt::Key_Launch8, - XF86XK_Launch7, Qt::Key_Launch9, - XF86XK_Launch8, Qt::Key_LaunchA, - XF86XK_Launch9, Qt::Key_LaunchB, - XF86XK_LaunchA, Qt::Key_LaunchC, - XF86XK_LaunchB, Qt::Key_LaunchD, - XF86XK_LaunchC, Qt::Key_LaunchE, - XF86XK_LaunchD, Qt::Key_LaunchF, -#endif - -#if 0 - // Qtopia keys - QTOPIAXK_Select, Qt::Key_Select, - QTOPIAXK_Yes, Qt::Key_Yes, - QTOPIAXK_No, Qt::Key_No, - QTOPIAXK_Cancel, Qt::Key_Cancel, - QTOPIAXK_Printer, Qt::Key_Printer, - QTOPIAXK_Execute, Qt::Key_Execute, - QTOPIAXK_Sleep, Qt::Key_Sleep, - QTOPIAXK_Play, Qt::Key_Play, - QTOPIAXK_Zoom, Qt::Key_Zoom, - QTOPIAXK_Context1, Qt::Key_Context1, - QTOPIAXK_Context2, Qt::Key_Context2, - QTOPIAXK_Context3, Qt::Key_Context3, - QTOPIAXK_Context4, Qt::Key_Context4, - QTOPIAXK_Call, Qt::Key_Call, - QTOPIAXK_Hangup, Qt::Key_Hangup, - QTOPIAXK_Flip, Qt::Key_Flip, -#endif - 0, 0 -}; - - -static int lookupCode(unsigned int xkeycode) -{ - if (xkeycode >= XK_F1 && xkeycode <= XK_F35) - return Qt::Key_F1 + (int(xkeycode) - XK_F1); - - const unsigned int *p = keyTbl; - while (*p) { - if (*p == xkeycode) - return *++p; - p += 2; - } - - return 0; -} - - -static Qt::KeyboardModifiers modifierFromKeyCode(int qtcode) -{ - switch (qtcode) { - case Qt::Key_Control: - return Qt::ControlModifier; - case Qt::Key_Alt: - return Qt::AltModifier; - case Qt::Key_Shift: - return Qt::ShiftModifier; - case Qt::Key_Meta: - return Qt::MetaModifier; - default: - return Qt::NoModifier; - } -} - -void QTestLiteWindowSurface::handleKeyEvent(QEvent::Type type, void *ev) -{ - XKeyEvent *e = static_cast(ev); - - KeySym keySym; - QByteArray chars; - chars.resize(513); - - int count = XLookupString(e, chars.data(), chars.size(), &keySym, 0); - -// qDebug() << "QTLWS::handleKeyEvent" << count << hex << "XKeysym:" << keySym; -// if (count) -// qDebug() << hex << int(chars[0]) << "String:" << chars; - - Qt::KeyboardModifiers modifiers = translateModifiers(e->state); - - int qtcode = lookupCode(keySym); -// qDebug() << "lookup: " << hex << keySym << qtcode << "mod" << modifiers; - - //X11 specifies state *before*, Qt expects state *after* the event - - modifiers ^= modifierFromKeyCode(qtcode); - - if (qtcode) { - QWindowSystemInterface::handleKeyEvent(window(), e->time, type, qtcode, modifiers); - } else if (chars[0]) { - int qtcode = chars.toUpper()[0]; //Not exactly right... - if (modifiers & Qt::ControlModifier && qtcode < ' ') - qtcode = chars[0] + '@'; - QWindowSystemInterface::handleKeyEvent(window(), e->time, type, qtcode, modifiers, QString::fromLatin1(chars)); - } else { - qWarning() << "unknown X keycode" << hex << e->keycode << keySym; - } -} - - - -Qt::WindowFlags QTestLiteWindowSurface::setWindowFlags(Qt::WindowFlags flags) -{ - Q_ASSERT(flags & Qt::Window); - - window_flags = flags; - - xw->setWindowFlags(flags); - - return window_flags; - -} - -Qt::WindowFlags QTestLiteWindowSurface::windowFlags() const -{ - return window_flags; -} - -void QTestLiteWindowSurface::setVisible(bool visible) -{ - //qDebug() << "QTestLiteWindowSurface::setVisible" << visible << xw->window; - xw->setVisible(visible); -} - - -WId QTestLiteWindowSurface::winId() const -{ - if (xw) - return (WId) xw->window; - else - return WId(0); -} - -void QTestLiteWindowSurface::raise() -{ - WId window = winId(); - XRaiseWindow(mGraphicsSystem->xd->display, window); -} - -void QTestLiteWindowSurface::lower() -{ - WId window = winId(); - XLowerWindow(mGraphicsSystem->xd->display, window); -} - -void QTestLiteWindowSurface::setWindowTitle(const QString &title) -{ - xw->setWindowTitle(title); -} - -void QTestLiteWindowSurface::setCursor(QCursor *cursor) -{ - xw->setCursor(cursor); -} -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h b/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h deleted file mode 100644 index 0c4df1a..0000000 --- a/src/plugins/graphicssystems/testlite/qwindowsurface_testlite.h +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_TESTLITE_H -#define QWINDOWSURFACE_TESTLITE_H - -#include -#include - -QT_BEGIN_NAMESPACE - -class MyWindow; -class QTestLiteGraphicsSystem; -class QTestLiteGraphicsSystemScreen; - -class QTestLiteWindowSurface : public QWindowSurface -{ -public: - QTestLiteWindowSurface - (QTestLiteGraphicsSystem *graphicsSystem, - QTestLiteGraphicsSystemScreen *screen, QWidget *window); - ~QTestLiteWindowSurface(); - - QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void setGeometry(const QRect &rect); - bool scroll(const QRegion &area, int dx, int dy); - - void beginPaint(const QRegion ®ion); - void endPaint(const QRegion ®ion); - - void handleMouseEvent(QEvent::Type, void *); //forwarding X types is apparently impossible :( - void handleKeyEvent(QEvent::Type, void *); - void handleGeometryChange(int x, int y, int w, int h); - void handleCloseEvent(); - void handleEnterEvent(); - void handleLeaveEvent(); - - Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); - Qt::WindowFlags windowFlags() const; - void setVisible(bool visible); - WId winId() const; - void raise(); - void lower(); - void setWindowTitle(const QString &title); - - void setCursor(QCursor * cursor); - -private: - QTestLiteGraphicsSystem *mGraphicsSystem; - QTestLiteGraphicsSystemScreen *mScreen; - Qt::WindowFlags window_flags; - MyWindow *xw; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/graphicssystems/testlite/testlite.pro b/src/plugins/graphicssystems/testlite/testlite.pro deleted file mode 100644 index d483f45..0000000 --- a/src/plugins/graphicssystems/testlite/testlite.pro +++ /dev/null @@ -1,17 +0,0 @@ -TARGET = qtestlitegraphicssystem -include(../../qpluginbase.pri) - -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems - -SOURCES = main.cpp qgraphicssystem_testlite.cpp qwindowsurface_testlite.cpp -HEADERS = qgraphicssystem_testlite.h qwindowsurface_testlite.h - - -HEADERS += x11util.h -SOURCES += x11util.cpp - -LIBS += -lX11 -lXext - - -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems -INSTALLS += target diff --git a/src/plugins/graphicssystems/testlite/x11util.cpp b/src/plugins/graphicssystems/testlite/x11util.cpp deleted file mode 100644 index 6d2966f..0000000 --- a/src/plugins/graphicssystems/testlite/x11util.cpp +++ /dev/null @@ -1,1215 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -#include -#include -#include - -#include "x11util.h" -#include "qwindowsurface_testlite.h" - -#include -#include - - -#include - -#include - -# include -# include -# include - - -#include -#include -#include -#include - -//### remove stuff we don't want from qt_x11_p.h -#undef ATOM -#undef X11 - -//#define MYX11_DEBUG - -//#define DONT_USE_MIT_SHM - -static int (*original_x_errhandler)(Display *dpy, XErrorEvent *); -static bool seen_badwindow; - - -static Atom wmProtocolsAtom; -static Atom wmDeleteWindowAtom; - -//### copied from qapplication_x11.cpp - -static int qt_x_errhandler(Display *dpy, XErrorEvent *err) -{ - -qDebug() << "qt_x_errhandler" << err->error_code; - - switch (err->error_code) { - case BadAtom: -#if 0 - if (err->request_code == 20 /* X_GetProperty */ - && (err->resourceid == XA_RESOURCE_MANAGER - || err->resourceid == XA_RGB_DEFAULT_MAP - || err->resourceid == ATOM(_NET_SUPPORTED) - || err->resourceid == ATOM(_NET_SUPPORTING_WM_CHECK) - || err->resourceid == ATOM(KDE_FULL_SESSION) - || err->resourceid == ATOM(KWIN_RUNNING) - || err->resourceid == ATOM(XdndProxy) - || err->resourceid == ATOM(XdndAware)) - - - ) { - // Perhaps we're running under SECURITY reduction? :/ - return 0; - } -#endif - qDebug() << "BadAtom"; - break; - - case BadWindow: - if (err->request_code == 2 /* X_ChangeWindowAttributes */ - || err->request_code == 38 /* X_QueryPointer */) { - for (int i = 0; i < ScreenCount(dpy); ++i) { - if (err->resourceid == RootWindow(dpy, i)) { - // Perhaps we're running under SECURITY reduction? :/ - return 0; - } - } - } - seen_badwindow = true; - if (err->request_code == 25 /* X_SendEvent */) { - for (int i = 0; i < ScreenCount(dpy); ++i) { - if (err->resourceid == RootWindow(dpy, i)) { - // Perhaps we're running under SECURITY reduction? :/ - return 0; - } - } -#if 0 - if (X11->xdndHandleBadwindow()) { - qDebug("xdndHandleBadwindow returned true"); - return 0; - } -#endif - } -#if 0 - if (X11->ignore_badwindow) - return 0; -#endif - break; - - case BadMatch: - if (err->request_code == 42 /* X_SetInputFocus */) - return 0; - break; - - default: -#if 0 //!defined(QT_NO_XINPUT) - if (err->request_code == X11->xinput_major - && err->error_code == (X11->xinput_errorbase + XI_BadDevice) - && err->minor_code == 3 /* X_OpenDevice */) { - return 0; - } -#endif - break; - } - - char errstr[256]; - XGetErrorText( dpy, err->error_code, errstr, 256 ); - char buffer[256]; - char request_str[256]; - qsnprintf(buffer, 256, "%d", err->request_code); - XGetErrorDatabaseText(dpy, "XRequest", buffer, "", request_str, 256); - if (err->request_code < 128) { - // X error for a normal protocol request - qWarning( "X Error: %s %d\n" - " Major opcode: %d (%s)\n" - " Resource id: 0x%lx", - errstr, err->error_code, - err->request_code, - request_str, - err->resourceid ); - } else { - // X error for an extension request - const char *extensionName = 0; -#if 0 - if (err->request_code == X11->xrender_major) - extensionName = "RENDER"; - else if (err->request_code == X11->xrandr_major) - extensionName = "RANDR"; - else if (err->request_code == X11->xinput_major) - extensionName = "XInputExtension"; - else if (err->request_code == X11->mitshm_major) - extensionName = "MIT-SHM"; -#endif - char minor_str[256]; - if (extensionName) { - qsnprintf(buffer, 256, "%s.%d", extensionName, err->minor_code); - XGetErrorDatabaseText(dpy, "XRequest", buffer, "", minor_str, 256); - } else { - extensionName = "Uknown extension"; - qsnprintf(minor_str, 256, "Unknown request"); - } - qWarning( "X Error: %s %d\n" - " Extension: %d (%s)\n" - " Minor opcode: %d (%s)\n" - " Resource id: 0x%lx", - errstr, err->error_code, - err->request_code, - extensionName, - err->minor_code, - minor_str, - err->resourceid ); - } - - // ### we really should distinguish between severe, non-severe and - // ### application specific errors - - return 0; -} - - - - - - - - - -bool MyDisplay::handleEvent(XEvent *xe) -{ - //qDebug() << "handleEvent" << xe->xany.type << xe->xany.window; - int quit = false; - MyWindow *xw = 0; - foreach (MyWindow *w, windowList) { - if (w->window == xe->xany.window) { - xw = w; - break; - } - } - if (!xw) { -#ifdef MYX11_DEBUG - qWarning() << "Unknown window" << hex << xe->xany.window << "received event" << xe->type; -#endif - return quit; - } - - switch (xe->type) { - - case ClientMessage: - if (xe->xclient.format == 32 && xe->xclient.message_type == wmProtocolsAtom) { - Atom a = xe->xclient.data.l[0]; - if (a == wmDeleteWindowAtom) - xw->closeEvent(); -#ifdef MYX11_DEBUG - qDebug() << "ClientMessage WM_PROTOCOLS" << a; -#endif - } -#ifdef MYX11_DEBUG - else - qDebug() << "ClientMessage" << xe->xclient.format << xe->xclient.message_type; -#endif - break; - - case Expose: - if (xw) - if (xe->xexpose.count == 0) - xw->paintEvent(); - break; - case ConfigureNotify: - if (xw) - xw->resizeEvent(&xe->xconfigure); - break; - - case ButtonPress: - xw->mousePressEvent(&xe->xbutton); - break; - - case ButtonRelease: - xw->mouseReleaseEvent(&xe->xbutton); - break; - - case MotionNotify: - xw->mouseMoveEvent(&xe->xbutton); - break; - - case XKeyPress: - xw->keyPressEvent(&xe->xkey); - break; - - case XKeyRelease: - xw->keyReleaseEvent(&xe->xkey); - break; - - case EnterNotify: - xw->enterEvent(&xe->xcrossing); - break; - - case LeaveNotify: - xw->leaveEvent(&xe->xcrossing); - break; - - default: -#ifdef MYX11_DEBUG - qDebug() << hex << xe->xany.window << "Other X event" << xe->type; -#endif - break; - } - return quit; -}; - - - -MyDisplay::MyDisplay() -{ - char *display_name = getenv("DISPLAY"); - display = XOpenDisplay(display_name); - if (!display) { - fprintf(stderr, "Cannot connect to X server: %s\n", - display_name); - exit(1); - } - -#ifndef DONT_USE_MIT_SHM - Status MIT_SHM_extension_supported = XShmQueryExtension (display); - Q_ASSERT(MIT_SHM_extension_supported == True); -#endif - original_x_errhandler = XSetErrorHandler(qt_x_errhandler); - - if (qgetenv("DO_X_SYNCHRONIZE").toInt()) - XSynchronize(display, true); - - screen = DefaultScreen(display); - width = DisplayWidth(display, screen); - height = DisplayHeight(display, screen); - physicalWidth = DisplayWidthMM(display, screen); - physicalHeight = DisplayHeightMM(display, screen); - - int xSocketNumber = XConnectionNumber(display); -#ifdef MYX11_DEBUG - qDebug() << "X socket:"<< xSocketNumber; -#endif - QSocketNotifier *sock = new QSocketNotifier(xSocketNumber, QSocketNotifier::Read, this); - connect(sock, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); - - wmProtocolsAtom = XInternAtom (display, "WM_PROTOCOLS", False); - wmDeleteWindowAtom = XInternAtom (display, "WM_DELETE_WINDOW", False); - - cursors = new MyX11Cursors(display); -} - - -MyDisplay::~MyDisplay() -{ - XCloseDisplay(display); -} - - -void MyDisplay::eventDispatcher() -{ -// qDebug() << "eventDispatcher"; - - - ulong marker = XNextRequest(display); -// int i = 0; - while (XPending(display)) { - XEvent event; - XNextEvent(display, &event); - /* done = */ - handleEvent(&event); - - if (event.xany.serial >= marker) { -#ifdef MYX11_DEBUG - qDebug() << "potential livelock averted"; -#endif -#if 0 - if (XEventsQueued(display, QueuedAfterFlush)) { - qDebug() << " with events queued"; - QTimer::singleShot(0, this, SLOT(eventDispatcher())); - } -#endif - break; - } - } -} - - -QImage MyDisplay::grabWindow(Window window, int x, int y, int w, int h) -{ - if (w == 0 || h ==0) - return QImage(); - - //WinId 0 means the desktop widget - if (!window) - window = rootWindow(); - - XWindowAttributes window_attr; - if (!XGetWindowAttributes(display, window, &window_attr)) - return QImage(); - - if (w < 0) - w = window_attr.width - x; - if (h < 0) - h = window_attr.height - y; - - // Ideally, we should also limit ourselves to the screen area, but the Qt docs say - // that it's "unsafe" to go outside the screen, so we can ignore that problem. - - //We're definitely not optimizing for speed... - XImage *xi = XGetImage(display, window, x, y, w, h, AllPlanes, ZPixmap); - - if (!xi) - return QImage(); - - //taking a copy to make sure we have ownership -- not fast - QImage result = QImage( (uchar*) xi->data, xi->width, xi->height, xi->bytes_per_line, QImage::Format_RGB32 ).copy(); - - XDestroyImage(xi); - - return result; -} - - - - -struct MyShmImageInfo { - MyShmImageInfo(Display *xdisplay) : image(0), display(xdisplay) {} - ~MyShmImageInfo() { destroy(); } - - void destroy(); - - XShmSegmentInfo shminfo; - XImage *image; - Display *display; -}; - -MyWindow::MyWindow(MyDisplay *display, int x, int y, int w, int h) -{ - xd = display; - - xd->windowList.append(this); - - window = XCreateSimpleWindow(xd->display, xd->rootWindow(), - x, y, w, h, 0 /*border_width*/, - xd->blackPixel(), xd->whitePixel()); - - -#ifdef MYX11_DEBUG - qDebug() << "MyWindow::MyWindow" << hex << window; -#endif - - - width = -1; - height = -1; - xpos = -1; - ypos = -1; - - XSetWindowBackgroundPixmap(xd->display, window, XNone); - - XSelectInput(xd->display, window, ExposureMask | KeyPressMask | KeyReleaseMask | - EnterWindowMask | LeaveWindowMask | FocusChangeMask | - PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | - StructureNotifyMask); - - gc = createGC(); - - XChangeProperty (xd->display, window, - wmProtocolsAtom, - XA_ATOM, 32, PropModeAppend, - (unsigned char *) &wmDeleteWindowAtom, 1); - - - setWindowTitle(QLatin1String("Qt Lighthouse")); - - currentCursor = -1; - - image_info = 0; - painted = false; -} - - -void MyWindow::setWindowTitle(const QString &title) - -{ - QByteArray ba = title.toLatin1(); //We're not making a general solution here... - XTextProperty windowName; - windowName.value = (unsigned char *)ba.constData(); - windowName.encoding = XA_STRING; - windowName.format = 8; - windowName.nitems = ba.length(); - - XSetWMName(xd->display, window, &windowName); -} - -MyWindow::~MyWindow() -{ -#ifdef MYX11_DEBUG - qDebug() << "~MyWindow" << hex << window; -#endif - XFreeGC(xd->display, gc); - XDestroyWindow(xd->display, window); - - xd->windowList.removeAll(this); - - delete image_info; -} - -GC MyWindow::createGC() -{ - GC gc; - - gc = XCreateGC(xd->display, window, 0, 0); - if (gc < 0) { - qWarning("MyWindow::createGC() could not create GC"); - } - return gc; -} - -void MyWindow::closeEvent() -{ - windowSurface->handleCloseEvent(); -} - -void MyWindow::paintEvent() -{ -#ifdef MYX11_DEBUG - qDebug() << "MyWindow::paintEvent" << shm_img.size() << painted; -#endif - if (!painted) - return; - -#ifdef DONT_USE_MIT_SHM - // just convert the image every time... - if (!shm_img.isNull()) { - Visual *visual = DefaultVisual(xd->display, xd->screen); - - QImage image = shm_img; - //img.convertToFormat( - XImage *xi = XCreateImage(xd->display, visual, 24, ZPixmap, - 0, (char *) image.scanLine(0), image.width(), image.height(), - 32, image.bytesPerLine()); - - int x = 0; - int y = 0; - - /*int r =*/ XPutImage(xd->display, window, gc, xi, 0, 0, x, y, image.width(), image.height()); - - xi->data = 0; // QImage owns these bits - XDestroyImage(xi); - } -#else - // Use MIT_SHM - if (image_info->image) { - //qDebug() << "Here we go" << image_info->image->width << image_info->image->height; - int x = 0; - int y = 0; - - // We could set send_event to true, and then use the ShmCompletion to synchronize, - // but let's do like Qt/11 and just use XSync - XShmPutImage (xd->display, window, gc, image_info->image, 0, 0, - x, y, image_info->image->width, image_info->image->height, - /*send_event*/ False); - - XSync(xd->display, False); - } -#endif -} - -#ifndef DONT_USE_MIT_SHM -void MyShmImageInfo::destroy() -{ - XShmDetach (display, &shminfo); - XDestroyImage (image); - shmdt (shminfo.shmaddr); - shmctl (shminfo.shmid, IPC_RMID, 0); -} -#endif - -void MyWindow::resizeShmImage(int width, int height) -{ -#ifdef DONT_USE_MIT_SHM - shm_img = QImage(width, height, QImage::Format_RGB32); -#else - if (image_info) - image_info->destroy(); - else - image_info = new MyShmImageInfo(xd->display); - - Visual *visual = DefaultVisual(xd->display, xd->screen); - - - XImage *image = XShmCreateImage (xd->display, visual, 24, ZPixmap, 0, - &image_info->shminfo, width, height); - - - image_info->shminfo.shmid = shmget (IPC_PRIVATE, - image->bytes_per_line * image->height, IPC_CREAT|0777); - - image_info->shminfo.shmaddr = image->data = (char*)shmat (image_info->shminfo.shmid, 0, 0); - image_info->shminfo.readOnly = False; - - image_info->image = image; - - Status shm_attach_status = XShmAttach(xd->display, &image_info->shminfo); - - Q_ASSERT(shm_attach_status == True); - - shm_img = QImage( (uchar*) image->data, image->width, image->height, image->bytes_per_line, QImage::Format_RGB32 ); -#endif - painted = false; -} - - -void MyWindow::resizeBuffer(QSize s) -{ - if (shm_img.size() != s) - resizeShmImage(s.width(), s.height()); -} - -QSize MyWindow::bufferSize() const -{ - return shm_img.size(); -} - - -void MyWindow::resizeEvent(XConfigureEvent *e) -{ - - if ((e->width != width || e->height != height) && e->x == 0 && e->y == 0) { - //qDebug() << "resize with bogus pos" << e->x << e->y << e->width << e->height << "window"<< hex << window; - } else { - //qDebug() << "geometry change" << e->x << e->y << e->width << e->height << "window"<< hex << window; - xpos = e->x; - ypos = e->y; - } - width = e->width; - height = e->height; - -#ifdef MYX11_DEBUG - qDebug() << hex << window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << "geometry" << xpos << ypos << width << height << "img:" << shm_img.size(); -#endif - - windowSurface->handleGeometryChange(xpos, ypos, width, height); -} - -#if 0 -void MyWindow::setSize(int w, int h) -{ - XResizeWindow(xd->display, window, w, h); -} -#endif - -void MyWindow::setGeometry(int x, int y, int w, int h) -{ -#ifdef MYX11_DEBUG - qDebug() << "MyWindow::setGeometry" << hex << window << dec << x << y << w << h << "img:" << shm_img.size(); -#endif - XMoveResizeWindow(xd->display, window, x, y, w, h); -} - - -void MyWindow::enterEvent(XCrossingEvent *) -{ -#ifdef MYX11_DEBUG - qDebug() << "MyWindow::enterEvent" << hex << window; -#endif - windowSurface->handleEnterEvent(); -} - -void MyWindow::leaveEvent(XCrossingEvent *) -{ -#ifdef MYX11_DEBUG - qDebug() << "MyWindow::enterEvent" << hex << window; -#endif - windowSurface->handleLeaveEvent(); -} - -void MyWindow::mousePressEvent(XButtonEvent *e) -{ - static long prevTime = 0; - static Window prevWindow; - static int prevX = -999; - static int prevY = -999; - - QEvent::Type type = QEvent::MouseButtonPress; - - if (e->window == prevWindow && long(e->time) - prevTime < QApplication::doubleClickInterval() - && qAbs(e->x - prevX) < 5 && qAbs(e->y - prevY) < 5) { - type = QEvent::MouseButtonDblClick; - prevTime = e->time - QApplication::doubleClickInterval(); //no double click next time - } else { - prevTime = e->time; - } - prevWindow = e->window; - prevX = e->x; - prevY = e->y; - - windowSurface->handleMouseEvent(type, e); -} - -void MyWindow::mouseReleaseEvent(XButtonEvent *e) -{ - windowSurface->handleMouseEvent(QEvent::MouseButtonRelease, e); -} - -void MyWindow::mouseMoveEvent(XButtonEvent *e) -{ - windowSurface->handleMouseEvent(QEvent::MouseMove, e); -} - -#ifdef KeyPress -#undef KeyPress -#endif - -void MyWindow::keyPressEvent(XKeyEvent *e) -{ - windowSurface->handleKeyEvent(QEvent::KeyPress, e); -} - -#ifdef KeyRelease -#undef KeyRelease -#endif - -void MyWindow::keyReleaseEvent(XKeyEvent *e) -{ - windowSurface->handleKeyEvent(QEvent::KeyRelease, e); -} - - -// WindowFlag stuff, lots of copied code from qwidget_x11.cpp... - -//We're hacking here... - - -// MWM support -struct QtMWMHints { - ulong flags, functions, decorations; - long input_mode; - ulong status; -}; - -enum { - MWM_HINTS_FUNCTIONS = (1L << 0), - - MWM_FUNC_ALL = (1L << 0), - MWM_FUNC_RESIZE = (1L << 1), - MWM_FUNC_MOVE = (1L << 2), - MWM_FUNC_MINIMIZE = (1L << 3), - MWM_FUNC_MAXIMIZE = (1L << 4), - MWM_FUNC_CLOSE = (1L << 5), - - MWM_HINTS_DECORATIONS = (1L << 1), - - MWM_DECOR_ALL = (1L << 0), - MWM_DECOR_BORDER = (1L << 1), - MWM_DECOR_RESIZEH = (1L << 2), - MWM_DECOR_TITLE = (1L << 3), - MWM_DECOR_MENU = (1L << 4), - MWM_DECOR_MINIMIZE = (1L << 5), - MWM_DECOR_MAXIMIZE = (1L << 6), - - MWM_HINTS_INPUT_MODE = (1L << 2), - - MWM_INPUT_MODELESS = 0L, - MWM_INPUT_PRIMARY_APPLICATION_MODAL = 1L, - MWM_INPUT_FULL_APPLICATION_MODAL = 3L -}; - -static Atom mwm_hint_atom = XNone; - -static QtMWMHints GetMWMHints(Display *display, Window window) -{ - QtMWMHints mwmhints; - - Atom type; - int format; - ulong nitems, bytesLeft; - uchar *data = 0; - if ((XGetWindowProperty(display, window, mwm_hint_atom, 0, 5, false, - mwm_hint_atom, &type, &format, &nitems, &bytesLeft, - &data) == Success) - && (type == mwm_hint_atom - && format == 32 - && nitems >= 5)) { - mwmhints = *(reinterpret_cast(data)); - } else { - mwmhints.flags = 0L; - mwmhints.functions = MWM_FUNC_ALL; - mwmhints.decorations = MWM_DECOR_ALL; - mwmhints.input_mode = 0L; - mwmhints.status = 0L; - } - - if (data) - XFree(data); - - return mwmhints; -} - -static void SetMWMHints(Display *display, Window window, const QtMWMHints &mwmhints) -{ - if (mwmhints.flags != 0l) { - XChangeProperty(display, window, mwm_hint_atom, mwm_hint_atom, 32, - PropModeReplace, (unsigned char *) &mwmhints, 5); - } else { - XDeleteProperty(display, window, mwm_hint_atom); - } -} - -// Returns true if we should set WM_TRANSIENT_FOR on \a w -static inline bool isTransient(const QWidget *w) -{ - return ((w->windowType() == Qt::Dialog - || w->windowType() == Qt::Sheet - || w->windowType() == Qt::Tool - || w->windowType() == Qt::SplashScreen - || w->windowType() == Qt::ToolTip - || w->windowType() == Qt::Drawer - || w->windowType() == Qt::Popup) - && !w->testAttribute(Qt::WA_X11BypassTransientForHint)); -} - - - -Qt::WindowFlags MyWindow::setWindowFlags(Qt::WindowFlags flags) -{ - - if (mwm_hint_atom == XNone) { - mwm_hint_atom = XInternAtom(xd->display, "_MOTIF_WM_HINTS\0", False); - } - -#ifdef MYX11_DEBUG - qDebug() << "MyWindow::setWindowFlags" << hex << window << "flags" << flags; -#endif - Qt::WindowType type = static_cast(int(flags & Qt::WindowType_Mask)); - - if (type == Qt::ToolTip) - flags |= Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint; - if (type == Qt::Popup) - flags |= Qt::X11BypassWindowManagerHint; - - bool topLevel = (flags & Qt::Window); - bool popup = (type == Qt::Popup); - bool dialog = (type == Qt::Dialog - || type == Qt::Sheet); - bool desktop = (type == Qt::Desktop); - bool tool = (type == Qt::Tool || type == Qt::SplashScreen - || type == Qt::ToolTip || type == Qt::Drawer); - - bool tooltip = (type == Qt::ToolTip); - - XSetWindowAttributes wsa; - - QtMWMHints mwmhints; - mwmhints.flags = 0L; - mwmhints.functions = 0L; - mwmhints.decorations = 0; - mwmhints.input_mode = 0L; - mwmhints.status = 0L; - - - ulong wsa_mask = 0; - if (type != Qt::SplashScreen) { // && customize) { - mwmhints.flags |= MWM_HINTS_DECORATIONS; - - bool customize = flags & Qt::CustomizeWindowHint; - if (!(flags & Qt::FramelessWindowHint) && !(customize && !(flags & Qt::WindowTitleHint))) { - mwmhints.decorations |= MWM_DECOR_BORDER; - mwmhints.decorations |= MWM_DECOR_RESIZEH; - - if (flags & Qt::WindowTitleHint) - mwmhints.decorations |= MWM_DECOR_TITLE; - - if (flags & Qt::WindowSystemMenuHint) - mwmhints.decorations |= MWM_DECOR_MENU; - - if (flags & Qt::WindowMinimizeButtonHint) { - mwmhints.decorations |= MWM_DECOR_MINIMIZE; - mwmhints.functions |= MWM_FUNC_MINIMIZE; - } - - if (flags & Qt::WindowMaximizeButtonHint) { - mwmhints.decorations |= MWM_DECOR_MAXIMIZE; - mwmhints.functions |= MWM_FUNC_MAXIMIZE; - } - - if (flags & Qt::WindowCloseButtonHint) - mwmhints.functions |= MWM_FUNC_CLOSE; - } - } else { - // if type == Qt::SplashScreen - mwmhints.decorations = MWM_DECOR_ALL; - } - - if (tool) { - wsa.save_under = True; - wsa_mask |= CWSaveUnder; - } - - if (flags & Qt::X11BypassWindowManagerHint) { - wsa.override_redirect = True; - wsa_mask |= CWOverrideRedirect; - } -#if 0 - if (wsa_mask && initializeWindow) { - Q_ASSERT(id); - XChangeWindowAttributes(dpy, id, wsa_mask, &wsa); - } -#endif - if (mwmhints.functions != 0) { - mwmhints.flags |= MWM_HINTS_FUNCTIONS; - mwmhints.functions |= MWM_FUNC_MOVE | MWM_FUNC_RESIZE; - } else { - mwmhints.functions = MWM_FUNC_ALL; - } - - if (!(flags & Qt::FramelessWindowHint) - && flags & Qt::CustomizeWindowHint - && flags & Qt::WindowTitleHint - && !(flags & - (Qt::WindowMinimizeButtonHint - | Qt::WindowMaximizeButtonHint - | Qt::WindowCloseButtonHint))) { - // a special case - only the titlebar without any button - mwmhints.flags = MWM_HINTS_FUNCTIONS; - mwmhints.functions = MWM_FUNC_MOVE | MWM_FUNC_RESIZE; - mwmhints.decorations = 0; - } - - SetMWMHints(xd->display, window, mwmhints); - -//##### only if initializeWindow??? - - if (popup || tooltip) { // popup widget -#ifdef MYX11_DEBUG - qDebug() << "Doing XChangeWindowAttributes for popup" << wsa.override_redirect; -#endif - // set EWMH window types - // setNetWmWindowTypes(); - - wsa.override_redirect = True; - wsa.save_under = True; - XChangeWindowAttributes(xd->display, window, CWOverrideRedirect | CWSaveUnder, - &wsa); - } else { -#ifdef MYX11_DEBUG - qDebug() << "Doing XChangeWindowAttributes for non-popup"; -#endif - } - - return flags; -} - -void MyWindow::setVisible(bool visible) -{ -#ifdef MYX11_DEBUG - qDebug() << "MyWindow::setVisible" << visible << hex << window; -#endif - if (visible) - XMapWindow(xd->display, window); - else - XUnmapWindow(xd->display, window); -} - -MyX11Cursors::MyX11Cursors(Display * d) : firstExpired(0), lastExpired(0), display(d), removalDelay(3) -{ - connect(&timer, SIGNAL(timeout()), this, SLOT(timeout())); -} - -void MyX11Cursors::insertNode(MyX11CursorNode * node) -{ - QDateTime now = QDateTime::currentDateTime(); - QDateTime timeout = now.addSecs(removalDelay); - node->setExpiration(timeout); - node->setPost(0); - if (lastExpired) { - lastExpired->setPost(node); - node->setAnte(lastExpired); - } - lastExpired = node; - if (!firstExpired) { - firstExpired = node; - node->setAnte(0); - int interval = removalDelay * 1000; - timer.setInterval(interval); - timer.start(); - } -} - -void MyX11Cursors::removeNode(MyX11CursorNode * node) -{ - MyX11CursorNode *pre = node->ante(); - MyX11CursorNode *post = node->post(); - if (pre) - pre->setPost(post); - if (post) - post->setAnte(pre); - if (node == lastExpired) - lastExpired = pre; - if (node == firstExpired) { - firstExpired = post; - if (!firstExpired) { - timer.stop(); - return; - } - int interval = QDateTime::currentDateTime().secsTo(firstExpired->expiration()) * 1000; - timer.stop(); - timer.setInterval(interval); - timer.start(); - } -} - -void MyX11Cursors::incrementUseCount(int id) -{ - MyX11CursorNode * node = lookupMap.value(id); - Q_ASSERT(node); - if (!node->refCount) - removeNode(node); - node->refCount++; -} - -void MyX11Cursors::decrementUseCount(int id) -{ - MyX11CursorNode * node = lookupMap.value(id); - Q_ASSERT(node); - node->refCount--; - if (!node->refCount) - insertNode(node); -} - -void MyX11Cursors::createNode(int id, Cursor c) -{ - MyX11CursorNode * node = new MyX11CursorNode(id, c); - lookupMap.insert(id, node); -} - -void MyX11Cursors::timeout() -{ - MyX11CursorNode * node; - node = firstExpired; - QDateTime now = QDateTime::currentDateTime(); - while (node && now.secsTo(node->expiration()) < 1) { - Cursor c = node->cursor(); - int id = node->id(); - lookupMap.take(id); - MyX11CursorNode * tmp = node; - node = node->post(); - delete tmp; - XFreeCursor(display, c); - } - firstExpired = node; - if (node == 0) { - timer.stop(); - lastExpired = 0; - } - else { - int interval = QDateTime::currentDateTime().secsTo(firstExpired->expiration()) * 1000; - timer.setInterval(interval); - timer.start(); - } -} - -Cursor MyX11Cursors::cursor(int id) -{ - MyX11CursorNode * node = lookupMap.value(id); - Q_ASSERT(node); - return node->cursor(); -} - -void MyWindow::setCursor(QCursor * cursor) -{ - int id = cursor->handle(); - if (id == currentCursor) - return; - Cursor c; - if (!xd->cursors->exists(id)) { - if (cursor->shape() == Qt::BitmapCursor) - c = createCursorBitmap(cursor); - else - c = createCursorShape(cursor->shape()); - if (!c) { - return; - } - xd->cursors->createNode(id, c); - } else { - xd->cursors->incrementUseCount(id); - c = xd->cursors->cursor(id); - } - - if (currentCursor != -1) - xd->cursors->decrementUseCount(currentCursor); - currentCursor = id; - - XDefineCursor(xd->display, window, c); - XFlush(xd->display); -} - -Cursor MyWindow::createCursorBitmap(QCursor * cursor) -{ - XColor bg, fg; - bg.red = 255 << 8; - bg.green = 255 << 8; - bg.blue = 255 << 8; - fg.red = 0; - fg.green = 0; - fg.blue = 0; - QPoint spot = cursor->hotSpot(); - Window rootwin = window; - - QImage mapImage = cursor->bitmap()->toImage().convertToFormat(QImage::Format_MonoLSB); - QImage maskImage = cursor->mask()->toImage().convertToFormat(QImage::Format_MonoLSB); - - int width = cursor->bitmap()->width(); - int height = cursor->bitmap()->height(); - int bytesPerLine = mapImage.bytesPerLine(); - int destLineSize = width / 8; - if (width % 8) - destLineSize++; - - const uchar * map = mapImage.bits(); - const uchar * mask = maskImage.bits(); - - char * mapBits = new char[height * destLineSize]; - char * maskBits = new char[height * destLineSize]; - for (int i = 0; i < height; i++) { - memcpy(mapBits + (destLineSize * i),map + (bytesPerLine * i), destLineSize); - memcpy(maskBits + (destLineSize * i),mask + (bytesPerLine * i), destLineSize); - } - - Pixmap cp = XCreateBitmapFromData(xd->display, rootwin, mapBits, width, height); - Pixmap mp = XCreateBitmapFromData(xd->display, rootwin, maskBits, width, height); - Cursor c = XCreatePixmapCursor(xd->display, cp, mp, &fg, &bg, spot.x(), spot.y()); - XFreePixmap(xd->display, cp); - XFreePixmap(xd->display, mp); - delete[] mapBits; - delete[] maskBits; - - return c; -} - -Cursor MyWindow::createCursorShape(int cshape) -{ - Cursor cursor = 0; - - if (cshape < 0 || cshape > Qt::LastCursor) - return 0; - - switch (cshape) { - case Qt::ArrowCursor: - cursor = XCreateFontCursor(xd->display, XC_left_ptr); - break; - case Qt::UpArrowCursor: - cursor = XCreateFontCursor(xd->display, XC_center_ptr); - break; - case Qt::CrossCursor: - cursor = XCreateFontCursor(xd->display, XC_crosshair); - break; - case Qt::WaitCursor: - cursor = XCreateFontCursor(xd->display, XC_watch); - break; - case Qt::IBeamCursor: - cursor = XCreateFontCursor(xd->display, XC_xterm); - break; - case Qt::SizeAllCursor: - cursor = XCreateFontCursor(xd->display, XC_fleur); - break; - case Qt::PointingHandCursor: - cursor = XCreateFontCursor(xd->display, XC_hand2); - break; - case Qt::SizeBDiagCursor: - cursor = XCreateFontCursor(xd->display, XC_top_right_corner); - break; - case Qt::SizeFDiagCursor: - cursor = XCreateFontCursor(xd->display, XC_bottom_right_corner); - break; - case Qt::SizeVerCursor: - case Qt::SplitVCursor: - cursor = XCreateFontCursor(xd->display, XC_sb_v_double_arrow); - break; - case Qt::SizeHorCursor: - case Qt::SplitHCursor: - cursor = XCreateFontCursor(xd->display, XC_sb_h_double_arrow); - break; - case Qt::WhatsThisCursor: - cursor = XCreateFontCursor(xd->display, XC_question_arrow); - break; - case Qt::ForbiddenCursor: - cursor = XCreateFontCursor(xd->display, XC_circle); - break; - case Qt::BusyCursor: - cursor = XCreateFontCursor(xd->display, XC_watch); - break; - - default: //default cursor for all the rest - break; - } - return cursor; -} - - -#if 0 - - - switch (cshape) { // map Q cursor to X cursor - case Qt::BlankCursor: - XColor bg, fg; - bg.red = 255 << 8; - bg.green = 255 << 8; - bg.blue = 255 << 8; - fg.red = 0; - fg.green = 0; - fg.blue = 0; - pm = XCreateBitmapFromData(dpy, rootwin, cur_blank_bits, 16, 16); - pmm = XCreateBitmapFromData(dpy, rootwin, cur_blank_bits, 16, 16); - hcurs = XCreatePixmapCursor(dpy, pm, pmm, &fg, &bg, 8, 8); - return; - break; - default: - qWarning("QCursor::update: Invalid cursor shape %d", cshape); - return; - } -#endif diff --git a/src/plugins/graphicssystems/testlite/x11util.h b/src/plugins/graphicssystems/testlite/x11util.h deleted file mode 100644 index 79e7461..0000000 --- a/src/plugins/graphicssystems/testlite/x11util.h +++ /dev/null @@ -1,204 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MYX11UTIL_H -#define MYX11UTIL_H - -#include -#include -#include -#include - -#include - -#include -#include - - -class MyWindow; -class MyX11Cursors; - -class MyDisplay : public QObject -{ - Q_OBJECT; -public: - MyDisplay(); - ~MyDisplay(); - - Window rootWindow() { return RootWindow(display, screen); } - unsigned long blackPixel() { return BlackPixel(display, screen); } - unsigned long whitePixel() { return WhitePixel(display, screen); } - - bool handleEvent(XEvent *xe); - QImage grabWindow(Window window, int x, int y, int w, int h); - -public slots: - void eventDispatcher(); - -public: //### - Display * display; - int screen; - int width, height; - int physicalWidth; - int physicalHeight; - - QList windowList; - - MyX11Cursors * cursors; -}; - -class QTestLiteWindowSurface; //### abstract callback interface, anyone? - -struct MyShmImageInfo; - -class MyWindow : public QObject -{ - Q_OBJECT; -public: - MyWindow(MyDisplay *xd, int x, int y, int w, int h); - ~MyWindow(); - - - void mousePressEvent(XButtonEvent*); - void mouseReleaseEvent(XButtonEvent*); - void mouseMoveEvent(XButtonEvent*); - - void keyPressEvent(XKeyEvent*); - void keyReleaseEvent(XKeyEvent*); - - void enterEvent(XCrossingEvent*); - void leaveEvent(XCrossingEvent*); - - void closeEvent(); - void paintEvent(); - void resizeEvent(XConfigureEvent *configure_event); -// void setSize(int w, int h); - void setGeometry(int x, int y, int w, int h); - - GC createGC(); - - Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); - void setVisible(bool visible); - void setCursor(QCursor * cursor); - Cursor createCursorShape(int cshape); - Cursor createCursorBitmap(QCursor * cursor); - - void setWindowTitle(const QString &title); - - QImage *image() { return &shm_img; } - -public: //### - - int xpos, ypos; - int width, height; - Window window; - MyDisplay *xd; - GC gc; - - QTestLiteWindowSurface *windowSurface; - - int currentCursor; - bool painted; - void resizeBuffer(QSize); - QSize bufferSize() const; - -private: - void resizeShmImage(int width, int height); - - QImage shm_img; - MyShmImageInfo *image_info; -}; - -class MyX11CursorNode -{ -public: - MyX11CursorNode(int id, Cursor c) { idValue = id; cursorValue = c; refCount = 1; } - QDateTime expiration() { return t; } - void setExpiration(QDateTime val) { t = val; } - MyX11CursorNode * ante() { return before; } - void setAnte(MyX11CursorNode *node) { before = node; } - MyX11CursorNode * post() { return after; } - void setPost(MyX11CursorNode *node) { after = node; } - Cursor cursor() { return cursorValue; } - int id() { return idValue; } - unsigned int refCount; - -private: - MyX11CursorNode *before; - MyX11CursorNode *after; - QDateTime t; - Cursor cursorValue; - int idValue; - - Display * display; -}; - -class MyX11Cursors : public QObject -{ - Q_OBJECT -public: - MyX11Cursors(Display * d); - ~MyX11Cursors() { timer.stop(); } - void incrementUseCount(int id); - void decrementUseCount(int id); - void createNode(int id, Cursor c); - bool exists(int id) { return lookupMap.contains(id); } - Cursor cursor(int id); -public slots: - void timeout(); - -private: - void removeNode(MyX11CursorNode *node); - void insertNode(MyX11CursorNode *node); - - // linked list of cursors currently not assigned to any window - MyX11CursorNode *firstExpired; - MyX11CursorNode *lastExpired; - - QHash lookupMap; - QTimer timer; - - Display *display; - - int removalDelay; -}; - -#endif // MYX11UTIL_H diff --git a/src/plugins/graphicssystems/vnc/main.cpp b/src/plugins/graphicssystems/vnc/main.cpp deleted file mode 100644 index f10748a..0000000 --- a/src/plugins/graphicssystems/vnc/main.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "qgraphicssystem_vnc.h" -#include - -QT_BEGIN_NAMESPACE - -class QVNCGraphicsSystemPlugin : public QGraphicsSystemPlugin -{ -public: - QStringList keys() const; - QGraphicsSystem *create(const QString&); -}; - -QStringList QVNCGraphicsSystemPlugin::keys() const -{ - QStringList list; - list << "VNC"; - return list; -} - -QGraphicsSystem* QVNCGraphicsSystemPlugin::create(const QString& system) -{ - if (system.toLower() == "vnc") - return new QVNCGraphicsSystem; - - return 0; -} - -Q_EXPORT_PLUGIN2(vnc, QVNCGraphicsSystemPlugin) - -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp deleted file mode 100644 index 7815f24..0000000 --- a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgraphicssystem_vnc.h" -#include "../fb_base/fb_base.h" -#include -#include -#include - -#include -#include - -#include - - -QVNCGraphicsSystemScreen::QVNCGraphicsSystemScreen() - : QGraphicsSystemFbScreen::QGraphicsSystemFbScreen() -{ - int w = 800; - int h = 600; - int ew, eh; - const char *str; - if ((str=::getenv("QT_VNC_SIZE")) && sscanf(str,"%dx%d",&ew,&eh)==2) { - w = ew; - h = eh; - } - - setGeometry(QRect(0,0,w, h)); - setDepth(32); - setFormat(QImage::Format_RGB32); - setPhysicalSize((geometry().size()*254)/720); - - - d_ptr = new QVNCGraphicsSystemScreenPrivate(this); - - cursor = new QVNCCursor(d_ptr->vncServer, this); - d_ptr->vncServer->setCursor(static_cast(cursor)); -} - -QVNCDirtyMap *QVNCGraphicsSystemScreen::dirtyMap() -{ - return d_ptr->dirty; -} - -QRegion QVNCGraphicsSystemScreen::doRedraw() -{ - QRegion touched; - touched = QGraphicsSystemFbScreen::doRedraw(); - - QVector rects = touched.rects(); - for (int i = 0; i < rects.size(); i++) - d_ptr->setDirty(rects[i]); - return touched; -} - - -QVNCGraphicsSystem::QVNCGraphicsSystem() -{ - mPrimaryScreen = new QVNCGraphicsSystemScreen(); - - mScreens.append(mPrimaryScreen); -} - -QPixmapData *QVNCGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const -{ - return new QRasterPixmapData(type); -} - -QWindowSurface *QVNCGraphicsSystem::createWindowSurface(QWidget *widget) const -{ - if (widget->windowType() == Qt::Desktop) - return 0; // Don't create an explicit window surface for the destkop. - QGraphicsSystemFbWindowSurface * surface; - surface = new QGraphicsSystemFbWindowSurface(mPrimaryScreen, widget); - mPrimaryScreen->addWindowSurface(surface); - return surface; -} diff --git a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h b/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h deleted file mode 100644 index b3349b7..0000000 --- a/src/plugins/graphicssystems/vnc/qgraphicssystem_vnc.h +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSYSTEM_VNC_H -#define QGRAPHICSSYSTEM_VNC_H - -#include -#include "qvnccursor.h" -#include "../fb_base/fb_base.h" - -QT_BEGIN_NAMESPACE - -class QVNCServer; -class QVNCDirtyMap; - -class QVNCGraphicsSystemScreenPrivate; - -class QVNCGraphicsSystemScreen : public QGraphicsSystemFbScreen -{ -public: - QVNCGraphicsSystemScreen(); - - int linestep() const { return image() ? image()->bytesPerLine() : 0; } - uchar *base() const { return image() ? image()->bits() : 0; } - QVNCDirtyMap *dirtyMap(); - -public: - QVNCGraphicsSystemScreenPrivate *d_ptr; - -private: - QVNCServer *server; - QRegion doRedraw(); -}; - -class QVNCGraphicsSystemPrivate; - - -class QVNCGraphicsSystem : public QGraphicsSystem -{ -public: - QVNCGraphicsSystem(); - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; - - QList screens() const { return mScreens; } - - -private: - QVNCGraphicsSystemScreen *mPrimaryScreen; - QList mScreens; -}; - - - -QT_END_NAMESPACE - -#endif //QGRAPHICSSYSTEM_VNC_H - diff --git a/src/plugins/graphicssystems/vnc/qvnccursor.cpp b/src/plugins/graphicssystems/vnc/qvnccursor.cpp deleted file mode 100644 index fb214d8..0000000 --- a/src/plugins/graphicssystems/vnc/qvnccursor.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include - -#include - -#include "qvnccursor.h" -#include "qvncserver.h" -#include "qgraphicssystem_vnc.h" - -QT_BEGIN_NAMESPACE - -QVNCCursor::QVNCCursor(QVNCServer * srvr, QVNCGraphicsSystemScreen *scr ) - :QGraphicsSystemSoftwareCursor(scr), useVncCursor(false), server(srvr) -{ -} - -void QVNCCursor::changeCursor(QCursor * widgetCursor, QWidget * widget) -{ - QGraphicsSystemSoftwareCursor::changeCursor(widgetCursor, widget); - if (useVncCursor) { - server->setDirtyCursor(); - } else { - screen->setDirty(QRect(0,0,1,1)); - } -} - -void QVNCCursor::setCursorMode(bool vnc) -{ - if (vnc) { - screen->setDirty(dirtyRect()); - server->setDirtyCursor(); - } else { - server->setDirtyCursor(); - } - useVncCursor = vnc; -} - -QRect QVNCCursor::drawCursor(QPainter & painter) -{ - if (useVncCursor) - return QRect(); - - return QGraphicsSystemSoftwareCursor::drawCursor(painter); -} - -void QVNCCursor::clearClientCursor() -{ - QTcpSocket *socket = server->clientSocket(); - if (!socket) { - return; - } - // FramebufferUpdate header - { - const quint16 tmp[6] = { htons(0), - htons(1), - htons(0), htons(0), - htons(0), - htons(0) }; - socket->write((char*)tmp, sizeof(tmp)); - - const quint32 encoding = htonl(-239); - socket->write((char*)(&encoding), sizeof(encoding)); - } -} - -void QVNCCursor::sendClientCursor() -{ - if (useVncCursor == false) { - clearClientCursor(); - return; - } - QImage *image = graphic->image(); - if (image->isNull()) - return; - QTcpSocket *socket = server->clientSocket(); - if (!socket) { - return; - } - // FramebufferUpdate header - { - const quint16 tmp[6] = { htons(0), - htons(1), - htons(graphic->hotspot().x()), htons(graphic->hotspot().y()), - htons(image->width()), - htons(image->height()) }; - socket->write((char*)tmp, sizeof(tmp)); - - const quint32 encoding = htonl(-239); - socket->write((char*)(&encoding), sizeof(encoding)); - } - - // write pixels - //Q_ASSERT(cursor->hasAlphaChannel()); - const QImage img = image->convertToFormat(QImage::Format_RGB32); - const int n = server->clientBytesPerPixel() * img.width(); - char *buffer = new char[n]; - for (int i = 0; i < img.height(); ++i) { - server->convertPixels(buffer, (const char*)img.scanLine(i), img.width()); - socket->write(buffer, n); - } - delete[] buffer; - - // write mask - const QImage bitmap = image->createAlphaMask().convertToFormat(QImage::Format_Mono); - Q_ASSERT(bitmap.depth() == 1); - Q_ASSERT(bitmap.size() == img.size()); - const int width = (bitmap.width() + 7) / 8; - for (int i = 0; i < bitmap.height(); ++i) - socket->write((const char*)bitmap.scanLine(i), width); -} - -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/vnc/qvnccursor.h b/src/plugins/graphicssystems/vnc/qvnccursor.h deleted file mode 100644 index 8ea0f45..0000000 --- a/src/plugins/graphicssystems/vnc/qvnccursor.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QVNCCURSOR_H -#define QVNCCURSOR_H - -#include "../fb_base/fb_base.h" -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QVNCGraphicsSystemScreen; -class QVNCServer; - -class QVNCCursor : public QGraphicsSystemSoftwareCursor { -public: - QVNCCursor(QVNCServer *, QVNCGraphicsSystemScreen *); - - // input methods - void setCursorMode(bool vnc); - void changeCursor(QCursor * widgetCursor, QWidget * widget); - - // output methods - QRect drawCursor(QPainter &); - - // VNC client communication - void sendClientCursor(); - void clearClientCursor(); -private: - bool useVncCursor; // VNC or local - - QVNCServer * server; // VNC server to get events from -}; - -QT_END_NAMESPACE - -#endif // QVNCCURSOR_H diff --git a/src/plugins/graphicssystems/vnc/qvncserver.cpp b/src/plugins/graphicssystems/vnc/qvncserver.cpp deleted file mode 100644 index ea576d4..0000000 --- a/src/plugins/graphicssystems/vnc/qvncserver.cpp +++ /dev/null @@ -1,1935 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qvncserver.h" - -#include -#include -#include -#include -#include - -#include -#include - -#include - -#include - -#include - - -#define QT_QWS_VNC_DEBUG -#define QT_NO_QWS_CURSOR //### - - -QT_BEGIN_NAMESPACE - - - -//copied from qscreen_qws.h -#ifndef QT_QWS_DEPTH16_RGB -#define QT_QWS_DEPTH16_RGB 565 -#endif -static const int qt_rbits = (QT_QWS_DEPTH16_RGB/100); -static const int qt_gbits = (QT_QWS_DEPTH16_RGB/10%10); -static const int qt_bbits = (QT_QWS_DEPTH16_RGB%10); -static const int qt_red_shift = qt_bbits+qt_gbits-(8-qt_rbits); -static const int qt_green_shift = qt_bbits-(8-qt_gbits); -static const int qt_neg_blue_shift = 8-qt_bbits; -static const int qt_blue_mask = (1<> qt_red_shift | r >> qt_red_rounding_shift; - const int tg = g >> qt_green_shift | g >> qt_green_rounding_shift; - const int tb = b << qt_neg_blue_shift | b >> qt_blue_rounding_shift; - - return qRgb(tr,tg,tb); -} - - - -//=========================================================================== - -static const struct { - int keysym; - int keycode; -} keyMap[] = { - { 0xff08, Qt::Key_Backspace }, - { 0xff09, Qt::Key_Tab }, - { 0xff0d, Qt::Key_Return }, - { 0xff1b, Qt::Key_Escape }, - { 0xff63, Qt::Key_Insert }, - { 0xffff, Qt::Key_Delete }, - { 0xff50, Qt::Key_Home }, - { 0xff57, Qt::Key_End }, - { 0xff55, Qt::Key_PageUp }, - { 0xff56, Qt::Key_PageDown }, - { 0xff51, Qt::Key_Left }, - { 0xff52, Qt::Key_Up }, - { 0xff53, Qt::Key_Right }, - { 0xff54, Qt::Key_Down }, - { 0xffbe, Qt::Key_F1 }, - { 0xffbf, Qt::Key_F2 }, - { 0xffc0, Qt::Key_F3 }, - { 0xffc1, Qt::Key_F4 }, - { 0xffc2, Qt::Key_F5 }, - { 0xffc3, Qt::Key_F6 }, - { 0xffc4, Qt::Key_F7 }, - { 0xffc5, Qt::Key_F8 }, - { 0xffc6, Qt::Key_F9 }, - { 0xffc7, Qt::Key_F10 }, - { 0xffc8, Qt::Key_F11 }, - { 0xffc9, Qt::Key_F12 }, - { 0xffe1, Qt::Key_Shift }, - { 0xffe2, Qt::Key_Shift }, - { 0xffe3, Qt::Key_Control }, - { 0xffe4, Qt::Key_Control }, - { 0xffe7, Qt::Key_Meta }, - { 0xffe8, Qt::Key_Meta }, - { 0xffe9, Qt::Key_Alt }, - { 0xffea, Qt::Key_Alt }, - { 0, 0 } -}; - -void QRfbRect::read(QTcpSocket *s) -{ - quint16 buf[4]; - s->read((char*)buf, 8); - x = ntohs(buf[0]); - y = ntohs(buf[1]); - w = ntohs(buf[2]); - h = ntohs(buf[3]); -} - -void QRfbRect::write(QTcpSocket *s) const -{ - quint16 buf[4]; - buf[0] = htons(x); - buf[1] = htons(y); - buf[2] = htons(w); - buf[3] = htons(h); - s->write((char*)buf, 8); -} - -void QRfbPixelFormat::read(QTcpSocket *s) -{ - char buf[16]; - s->read(buf, 16); - bitsPerPixel = buf[0]; - depth = buf[1]; - bigEndian = buf[2]; - trueColor = buf[3]; - - quint16 a = ntohs(*(quint16 *)(buf + 4)); - redBits = 0; - while (a) { a >>= 1; redBits++; } - - a = ntohs(*(quint16 *)(buf + 6)); - greenBits = 0; - while (a) { a >>= 1; greenBits++; } - - a = ntohs(*(quint16 *)(buf + 8)); - blueBits = 0; - while (a) { a >>= 1; blueBits++; } - - redShift = buf[10]; - greenShift = buf[11]; - blueShift = buf[12]; -} - -void QRfbPixelFormat::write(QTcpSocket *s) -{ - char buf[16]; - buf[0] = bitsPerPixel; - buf[1] = depth; - buf[2] = bigEndian; - buf[3] = trueColor; - - quint16 a = 0; - for (int i = 0; i < redBits; i++) a = (a << 1) | 1; - *(quint16 *)(buf + 4) = htons(a); - - a = 0; - for (int i = 0; i < greenBits; i++) a = (a << 1) | 1; - *(quint16 *)(buf + 6) = htons(a); - - a = 0; - for (int i = 0; i < blueBits; i++) a = (a << 1) | 1; - *(quint16 *)(buf + 8) = htons(a); - - buf[10] = redShift; - buf[11] = greenShift; - buf[12] = blueShift; - s->write(buf, 16); -} - - -void QRfbServerInit::setName(const char *n) -{ - delete[] name; - name = new char [strlen(n) + 1]; - strcpy(name, n); -} - -void QRfbServerInit::read(QTcpSocket *s) -{ - s->read((char *)&width, 2); - width = ntohs(width); - s->read((char *)&height, 2); - height = ntohs(height); - format.read(s); - - quint32 len; - s->read((char *)&len, 4); - len = ntohl(len); - - name = new char [len + 1]; - s->read(name, len); - name[len] = '\0'; -} - -void QRfbServerInit::write(QTcpSocket *s) -{ - quint16 t = htons(width); - s->write((char *)&t, 2); - t = htons(height); - s->write((char *)&t, 2); - format.write(s); - quint32 len = strlen(name); - len = htonl(len); - s->write((char *)&len, 4); - s->write(name, strlen(name)); -} - -bool QRfbSetEncodings::read(QTcpSocket *s) -{ - if (s->bytesAvailable() < 3) - return false; - - char tmp; - s->read(&tmp, 1); // padding - s->read((char *)&count, 2); - count = ntohs(count); - - return true; -} - -bool QRfbFrameBufferUpdateRequest::read(QTcpSocket *s) -{ - if (s->bytesAvailable() < 9) - return false; - - s->read(&incremental, 1); - rect.read(s); - - return true; -} - -bool QRfbKeyEvent::read(QTcpSocket *s) -{ - if (s->bytesAvailable() < 7) - return false; - - s->read(&down, 1); - quint16 tmp; - s->read((char *)&tmp, 2); // padding - - quint32 key; - s->read((char *)&key, 4); - key = ntohl(key); - - unicode = 0; - keycode = 0; - int i = 0; - while (keyMap[i].keysym && !keycode) { - if (keyMap[i].keysym == (int)key) - keycode = keyMap[i].keycode; - i++; - } - if (!keycode) { - if (key <= 0xff) { - unicode = key; - if (key >= 'a' && key <= 'z') - keycode = Qt::Key_A + key - 'a'; - else if (key >= ' ' && key <= '~') - keycode = Qt::Key_Space + key - ' '; - } - } - - return true; -} - -bool QRfbPointerEvent::read(QTcpSocket *s) -{ - if (s->bytesAvailable() < 5) - return false; - - char buttonMask; - s->read(&buttonMask, 1); - - buttons = Qt::NoButton; - wheelDirection = WheelNone; - if (buttonMask & 1) - buttons |= Qt::LeftButton; - if (buttonMask & 2) - buttons |= Qt::MidButton; - if (buttonMask & 4) - buttons |= Qt::RightButton; - if (buttonMask & 8) - wheelDirection = WheelUp; - if (buttonMask & 16) - wheelDirection = WheelDown; - if (buttonMask & 32) - wheelDirection = WheelLeft; - if (buttonMask & 64) - wheelDirection = WheelRight; - - quint16 tmp; - s->read((char *)&tmp, 2); - x = ntohs(tmp); - s->read((char *)&tmp, 2); - y = ntohs(tmp); - - return true; -} - -bool QRfbClientCutText::read(QTcpSocket *s) -{ - if (s->bytesAvailable() < 7) - return false; - - char tmp[3]; - s->read(tmp, 3); // padding - s->read((char *)&length, 4); - length = ntohl(length); - - return true; -} - -//=========================================================================== - -QVNCServer::QVNCServer(QVNCGraphicsSystemScreen *screen) - : qvnc_screen(screen), cursor(0) -{ - init(5900); -} - -QVNCServer::QVNCServer(QVNCGraphicsSystemScreen *screen, int id) - : qvnc_screen(screen), cursor(0) -{ - init(5900 + id); -} - -void QVNCServer::init(uint port) -{ - qDebug() << "QVNCServer::init" << port; - - handleMsg = false; - client = 0; - encodingsPending = 0; - cutTextPending = 0; - keymod = 0; - state = Unconnected; - dirtyCursor = false; - - refreshRate = 25; - timer = new QTimer(this); - timer->setSingleShot(true); - connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate())); - - serverSocket = new QTcpServer(this); - if (!serverSocket->listen(QHostAddress::Any, port)) - qDebug() << "QVNCServer could not connect:" << serverSocket->errorString(); - else - qDebug("QVNCServer created on port %d", port); - - connect(serverSocket, SIGNAL(newConnection()), this, SLOT(newConnection())); - -#ifndef QT_NO_QWS_CURSOR - qvnc_cursor = 0; -#endif - encoder = 0; -} - -QVNCServer::~QVNCServer() -{ - delete encoder; - encoder = 0; - delete client; - client = 0; -#ifndef QT_NO_QWS_CURSOR - delete qvnc_cursor; - qvnc_cursor = 0; -#endif -} - -void QVNCServer::setDirty() -{ - if (state == Connected && !timer->isActive() && - ((dirtyMap()->numDirty > 0) || dirtyCursor)) { - timer->start(); - } -} - -void QVNCServer::newConnection() -{ - if (client) - delete client; - - client = serverSocket->nextPendingConnection(); - connect(client,SIGNAL(readyRead()),this,SLOT(readClient())); - connect(client,SIGNAL(disconnected()),this,SLOT(discardClient())); - handleMsg = false; - encodingsPending = 0; - cutTextPending = 0; - supportHextile = false; - wantUpdate = false; - - timer->start(1000 / refreshRate); - dirtyMap()->reset(); - - // send protocol version - const char *proto = "RFB 003.003\n"; - client->write(proto, 12); - state = Protocol; - -// if (!qvnc_screen->screen()) -// QWSServer::instance()->enablePainting(true); -} - -void QVNCServer::readClient() -{ - switch (state) { - case Protocol: - if (client->bytesAvailable() >= 12) { - char proto[13]; - client->read(proto, 12); - proto[12] = '\0'; - qDebug("Client protocol version %s", proto); - // No authentication - quint32 auth = htonl(1); - client->write((char *) &auth, sizeof(auth)); - state = Init; - } - break; - - case Init: - if (client->bytesAvailable() >= 1) { - quint8 shared; - client->read((char *) &shared, 1); - - // Server Init msg - QRfbServerInit sim; - QRfbPixelFormat &format = sim.format; - switch (qvnc_screen->depth()) { - case 32: - format.bitsPerPixel = 32; - format.depth = 32; - format.bigEndian = 0; - format.trueColor = true; - format.redBits = 8; - format.greenBits = 8; - format.blueBits = 8; - format.redShift = 16; - format.greenShift = 8; - format.blueShift = 0; - break; - - case 24: - format.bitsPerPixel = 24; - format.depth = 24; - format.bigEndian = 0; - format.trueColor = true; - format.redBits = 8; - format.greenBits = 8; - format.blueBits = 8; - format.redShift = 16; - format.greenShift = 8; - format.blueShift = 0; - break; - - case 18: - format.bitsPerPixel = 24; - format.depth = 18; - format.bigEndian = 0; - format.trueColor = true; - format.redBits = 6; - format.greenBits = 6; - format.blueBits = 6; - format.redShift = 12; - format.greenShift = 6; - format.blueShift = 0; - break; - - case 16: - format.bitsPerPixel = 16; - format.depth = 16; - format.bigEndian = 0; - format.trueColor = true; - format.redBits = 5; - format.greenBits = 6; - format.blueBits = 5; - format.redShift = 11; - format.greenShift = 5; - format.blueShift = 0; - break; - - case 15: - format.bitsPerPixel = 16; - format.depth = 15; - format.bigEndian = 0; - format.trueColor = true; - format.redBits = 5; - format.greenBits = 5; - format.blueBits = 5; - format.redShift = 10; - format.greenShift = 5; - format.blueShift = 0; - break; - - case 12: - format.bitsPerPixel = 16; - format.depth = 12; - format.bigEndian = 0; - format.trueColor = true; - format.redBits = 4; - format.greenBits = 4; - format.blueBits = 4; - format.redShift = 8; - format.greenShift = 4; - format.blueShift = 0; - break; - - case 8: - case 4: - format.bitsPerPixel = 8; - format.depth = 8; - format.bigEndian = 0; - format.trueColor = false; - format.redBits = 0; - format.greenBits = 0; - format.blueBits = 0; - format.redShift = 0; - format.greenShift = 0; - format.blueShift = 0; - break; - - default: - qDebug("QVNC cannot drive depth %d", qvnc_screen->depth()); - discardClient(); - return; - } - sim.width = qvnc_screen->geometry().width(); - sim.height = qvnc_screen->geometry().height(); - sim.setName("Qt for Embedded Linux VNC Server"); - sim.write(client); - state = Connected; - } - break; - - case Connected: - do { - if (!handleMsg) { - client->read((char *)&msgType, 1); - handleMsg = true; - } - if (handleMsg) { - switch (msgType ) { - case SetPixelFormat: - setPixelFormat(); - break; - case FixColourMapEntries: - qDebug("Not supported: FixColourMapEntries"); - handleMsg = false; - break; - case SetEncodings: - setEncodings(); - break; - case FramebufferUpdateRequest: - frameBufferUpdateRequest(); - break; - case KeyEvent: - keyEvent(); - break; - case PointerEvent: - pointerEvent(); - break; - case ClientCutText: - clientCutText(); - break; - default: - qDebug("Unknown message type: %d", (int)msgType); - handleMsg = false; - } - } - } while (!handleMsg && client->bytesAvailable()); - break; - default: - break; - } -} - -#if 0//Q_BYTE_ORDER == Q_BIG_ENDIAN -bool QVNCGraphicsSystemScreen::swapBytes() const -{ - if (depth() != 16) - return false; - - if (screen()) - return screen()->frameBufferLittleEndian(); - return frameBufferLittleEndian(); -} -#endif - -void QVNCServer::setPixelFormat() -{ - if (client->bytesAvailable() >= 19) { - char buf[3]; - client->read(buf, 3); // just padding - pixelFormat.read(client); -#ifdef QT_QWS_VNC_DEBUG - qDebug("Want format: %d %d %d %d %d %d %d %d %d %d", - int(pixelFormat.bitsPerPixel), - int(pixelFormat.depth), - int(pixelFormat.bigEndian), - int(pixelFormat.trueColor), - int(pixelFormat.redBits), - int(pixelFormat.greenBits), - int(pixelFormat.blueBits), - int(pixelFormat.redShift), - int(pixelFormat.greenShift), - int(pixelFormat.blueShift)); -#endif - if (!pixelFormat.trueColor) { - qDebug("Can only handle true color clients"); - discardClient(); - } - handleMsg = false; - sameEndian = (QSysInfo::ByteOrder == QSysInfo::BigEndian) == !!pixelFormat.bigEndian; - needConversion = pixelConversionNeeded(); -#if Q_BYTE_ORDER == Q_BIG_ENDIAN - swapBytes = qvnc_screen->swapBytes(); -#endif - } -} - -void QVNCServer::setEncodings() -{ - QRfbSetEncodings enc; - - if (!encodingsPending && enc.read(client)) { - encodingsPending = enc.count; - if (!encodingsPending) - handleMsg = false; - } - - if (encoder) { - delete encoder; - encoder = 0; - } - - enum Encodings { - Raw = 0, - CopyRect = 1, - RRE = 2, - CoRRE = 4, - Hextile = 5, - ZRLE = 16, - Cursor = -239, - DesktopSize = -223 - }; - - supportCursor = false; - - if (encodingsPending && (unsigned)client->bytesAvailable() >= - encodingsPending * sizeof(quint32)) { - for (int i = 0; i < encodingsPending; ++i) { - qint32 enc; - client->read((char *)&enc, sizeof(qint32)); - enc = ntohl(enc); -#ifdef QT_QWS_VNC_DEBUG - qDebug("QVNCServer::setEncodings: %d", enc); -#endif - switch (enc) { - case Raw: - if (!encoder) { - encoder = new QRfbRawEncoder(this); -#ifdef QT_QWS_VNC_DEBUG - qDebug("QVNCServer::setEncodings: using raw"); -#endif - } - break; - case CopyRect: - supportCopyRect = true; - break; - case RRE: - supportRRE = true; - break; - case CoRRE: - supportCoRRE = true; - break; - case Hextile: - supportHextile = true; - if (encoder) - break; - switch (qvnc_screen->depth()) { -#ifdef QT_QWS_DEPTH_8 - case 8: - encoder = new QRfbHextileEncoder(this); - break; -#endif -#ifdef QT_QWS_DEPTH_12 - case 12: - encoder = new QRfbHextileEncoder(this); - break; -#endif -#ifdef QT_QWS_DEPTH_15 - case 15: - encoder = new QRfbHextileEncoder(this); - break; -#endif -#ifdef QT_QWS_DEPTH_16 - case 16: - encoder = new QRfbHextileEncoder(this); - break; -#endif -#ifdef QT_QWS_DEPTH_18 - case 18: - encoder = new QRfbHextileEncoder(this); - break; -#endif -#ifdef QT_QWS_DEPTH_24 - case 24: - encoder = new QRfbHextileEncoder(this); - break; -#endif -#ifdef QT_QWS_DEPTH_32 - case 32: - encoder = new QRfbHextileEncoder(this); - break; -#endif - default: - break; - } -#ifdef QT_QWS_VNC_DEBUG - qDebug("QVNCServer::setEncodings: using hextile"); -#endif - break; - case ZRLE: - supportZRLE = true; - break; - case Cursor: - supportCursor = true; -#ifndef QT_NO_QWS_CURSOR - if (!qvnc_screen->screen() || qt_screencursor->isAccelerated()) { - delete qvnc_cursor; - qvnc_cursor = new QVNCClientCursor(this); - } -#endif - break; - case DesktopSize: - supportDesktopSize = true; - break; - default: - break; - } - } - handleMsg = false; - encodingsPending = 0; - } - - if (!encoder) { - encoder = new QRfbRawEncoder(this); -#ifdef QT_QWS_VNC_DEBUG - qDebug("QVNCServer::setEncodings: fallback using raw"); -#endif - } - - if (cursor) - cursor->setCursorMode(supportCursor); -} - -void QVNCServer::frameBufferUpdateRequest() -{ - QRfbFrameBufferUpdateRequest ev; - - if (ev.read(client)) { - if (!ev.incremental) { - QRect r(ev.rect.x, ev.rect.y, ev.rect.w, ev.rect.h); -////### r.translate(qvnc_screen->offset()); - qvnc_screen->d_ptr->setDirty(r, true); - } - wantUpdate = true; - checkUpdate(); - handleMsg = false; - } -} - -static bool buttonChange(Qt::MouseButtons before, Qt::MouseButtons after, Qt::MouseButton *button, bool *isPress) -{ - if (before == after) - return false; - for (int b = Qt::LeftButton; b <= Qt::MidButton; b<<=1) { - if ((before & b) != (after & b)) { - *button = static_cast(b); - *isPress = (after & b); - return true; - } - } - return false; -} - -void QVNCServer::pointerEvent() -{ - QRfbPointerEvent ev; - if (ev.read(client)) { -// const QPoint offset = qvnc_screen->offset(); -// QWSServer::sendMouseEvent(offset + QPoint(ev.x, ev.y), ev.buttons); - - - //qDebug() << "pointerEvent" << ev.x << ev.y << hex << ev.buttons; - if (ev.wheelDirection == ev.WheelNone) { - QEvent::Type type = QEvent::MouseMove; - Qt::MouseButton button = Qt::NoButton; - bool isPress; - if (buttonChange(buttons, ev.buttons, &button, &isPress)) - type = isPress ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; - QWindowSystemInterface::handleMouseEvent(0, QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), ev.buttons); - } else { - // No buttons or motion reported at the same time as wheel events - Qt::Orientation orientation; - if (ev.wheelDirection == ev.WheelLeft || ev.wheelDirection == ev.WheelRight) - orientation = Qt::Horizontal; - else - orientation = Qt::Vertical; - int delta = 120 * ((ev.wheelDirection == ev.WheelLeft || ev.wheelDirection == ev.WheelUp) ? 1 : -1); - QWindowSystemInterface::handleWheelEvent(0, QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), delta, orientation); - } - handleMsg = false; - } -} - -void QVNCServer::keyEvent() -{ - QRfbKeyEvent ev; - - if (ev.read(client)) { - if (ev.keycode == Qt::Key_Shift) - keymod = ev.down ? keymod | Qt::ShiftModifier : - keymod & ~Qt::ShiftModifier; - else if (ev.keycode == Qt::Key_Control) - keymod = ev.down ? keymod | Qt::ControlModifier : - keymod & ~Qt::ControlModifier; - else if (ev.keycode == Qt::Key_Alt) - keymod = ev.down ? keymod | Qt::AltModifier : - keymod & ~Qt::AltModifier; - if (ev.unicode || ev.keycode) { -// qDebug() << "keyEvent" << hex << ev.unicode << ev.keycode << keymod << ev.down; - QEvent::Type type = ev.down ? QEvent::KeyPress : QEvent::KeyRelease; - QString str; - if (ev.unicode && ev.unicode != 0xffff) - str = QString(ev.unicode); - QWindowSystemInterface::handleKeyEvent(0, type, ev.keycode, keymod, str); - } - handleMsg = false; - } -} - -void QVNCServer::clientCutText() -{ - QRfbClientCutText ev; - - if (ev.read(client)) { - cutTextPending = ev.length; - if (!cutTextPending) - handleMsg = false; - } - - if (cutTextPending && client->bytesAvailable() >= cutTextPending) { - char *text = new char [cutTextPending+1]; - client->read(text, cutTextPending); - delete [] text; - cutTextPending = 0; - handleMsg = false; - } -} - -// stride in bytes -template -bool QRfbSingleColorHextile::read(const uchar *data, - int width, int height, int stride) -{ - const int depth = encoder->server->screen()->depth(); - if (width % (depth / 8)) // hw: should rather fallback to simple loop - return false; - - static int alwaysFalse = qgetenv("QT_VNC_NOCHECKFILL").toInt(); - if (alwaysFalse) - return false; - - switch (depth) { - case 4: { - const quint8 *data8 = reinterpret_cast(data); - if ((data8[0] & 0xf) != (data8[0] >> 4)) - return false; - width /= 2; - } // fallthrough - case 8: { - const quint8 *data8 = reinterpret_cast(data); - if (data8[0] != data8[1]) - return false; - width /= 2; - } // fallthrough - case 12: - case 15: - case 16: { - const quint16 *data16 = reinterpret_cast(data); - if (data16[0] != data16[1]) - return false; - width /= 2; - } // fallthrough - case 18: - case 24: - case 32: { - const quint32 *data32 = reinterpret_cast(data); - const quint32 first = data32[0]; - const int linestep = (stride / sizeof(quint32)) - width; - for (int y = 0; y < height; ++y) { - for (int x = 0; x < width; ++x) { - if (*(data32++) != first) - return false; - } - data32 += linestep; - } - break; - } - default: - return false; - } - - SRC color = reinterpret_cast(data)[0]; - encoder->newBg |= (color != encoder->bg); - encoder->bg = color; - return true; -} - -template -void QRfbSingleColorHextile::write(QTcpSocket *socket) const -{ - if (true || encoder->newBg) { - const int bpp = encoder->server->clientBytesPerPixel(); - const int padding = 3; - QVarLengthArray buffer(padding + 1 + bpp); - buffer[padding] = 2; // BackgroundSpecified - encoder->server->convertPixels(buffer.data() + padding + 1, - reinterpret_cast(&encoder->bg), - 1); - socket->write(buffer.data() + padding, bpp + 1); -// encoder->newBg = false; - } else { - char subenc = 0; - socket->write(&subenc, 1); - } -} - -template -bool QRfbDualColorHextile::read(const uchar *data, - int width, int height, int stride) -{ - const SRC *ptr = reinterpret_cast(data); - const int linestep = (stride / sizeof(SRC)) - width; - - SRC c1; - SRC c2 = 0; - int n1 = 0; - int n2 = 0; - int x = 0; - int y = 0; - - c1 = *ptr; - - // find second color - while (y < height) { - while (x < width) { - if (*ptr == c1) { - ++n1; - } else { - c2 = *ptr; - goto found_second_color; - } - ++ptr; - ++x; - } - x = 0; - ptr += linestep; - ++y; - } - -found_second_color: - // finish counting - while (y < height) { - while (x < width) { - if (*ptr == c1) { - ++n1; - } else if (*ptr == c2) { - ++n2; - } else { - return false; - } - ++ptr; - ++x; - } - x = 0; - ptr += linestep; - ++y; - } - - if (n2 > n1) { - const quint32 tmpC = c1; - c1 = c2; - c2 = tmpC; - } - - encoder->newBg |= (c1 != encoder->bg); - encoder->newFg |= (c2 != encoder->fg); - - encoder->bg = c1; - encoder->fg = c2; - - // create map - bool inRect = false; - numRects = 0; - ptr = reinterpret_cast(data); - for (y = 0; y < height; ++y) { - for (x = 0; x < width; ++x) { - if (inRect && *ptr == encoder->bg) { - // rect finished - setWidth(x - lastx()); - next(); - inRect = false; - } else if (!inRect && *ptr == encoder->fg) { - // rect start - setX(x); - setY(y); - setHeight(1); - inRect = true; - } - ++ptr; - } - if (inRect) { - // finish rect - setWidth(width - lastx()); - next(); - inRect = false; - } - ptr += linestep; - } - - return true; -} - -template -void QRfbDualColorHextile::write(QTcpSocket *socket) const -{ - const int bpp = encoder->server->clientBytesPerPixel(); - const int padding = 3; - QVarLengthArray buffer(padding + 2 * bpp + sizeof(char) + sizeof(numRects)); - char &subenc = buffer[padding]; - int n = padding + sizeof(subenc); - - subenc = 0x8; // AnySubrects - - if (encoder->newBg) { - subenc |= 0x2; // Background - encoder->server->convertPixels(buffer.data() + n, (char*)&encoder->bg, 1); - n += bpp; -// encoder->newBg = false; - } - - if (encoder->newFg) { - subenc |= 0x4; // Foreground - encoder->server->convertPixels(buffer.data() + n, (char*)&encoder->fg, 1); - n += bpp; -// encoder->newFg = false; - } - buffer[n] = numRects; - n += sizeof(numRects); - - socket->write(buffer.data() + padding, n - padding); - socket->write((char*)rects, numRects * sizeof(Rect)); -} - -template -void QRfbDualColorHextile::next() -{ - for (int r = numRects - 1; r >= 0; --r) { - if (recty(r) == lasty()) - continue; - if (recty(r) < lasty() - 1) // only search previous scanline - break; - if (rectx(r) == lastx() && width(r) == width(numRects)) { - ++rects[r].wh; - return; - } - } - ++numRects; -} - -template -inline void QRfbMultiColorHextile::setColor(SRC color) -{ - encoder->server->convertPixels(reinterpret_cast(rect(numRects)), - (const char*)&color, 1); -} - -template -inline bool QRfbMultiColorHextile::beginRect() -{ - if ((rects.size() + bpp + 2) > maxRectsSize) - return false; - rects.resize(rects.size() + bpp + 2); - return true; -} - -template -inline void QRfbMultiColorHextile::endRect() -{ - setHeight(numRects, 1); - ++numRects; -} - -template -bool QRfbMultiColorHextile::read(const uchar *data, - int width, int height, int stride) -{ - const SRC *ptr = reinterpret_cast(data); - const int linestep = (stride / sizeof(SRC)) - width; - - bpp = encoder->server->clientBytesPerPixel(); - - if (encoder->newBg) - encoder->bg = ptr[0]; - - const SRC bg = encoder->bg; - SRC color = bg; - bool inRect = false; - - numRects = 0; - rects.clear(); - - for (int y = 0; y < height; ++y) { - for (int x = 0; x < width; ++x) { - if (inRect && *ptr != color) { // end rect - setWidth(numRects, x - rectx(numRects)); - endRect(); - inRect = false; - } - - if (!inRect && *ptr != bg) { // begin rect - if (!beginRect()) - return false; - inRect = true; - color = *ptr; - setColor(color); - setX(numRects, x); - setY(numRects, y); - } - ++ptr; - } - if (inRect) { // end rect - setWidth(numRects, width - rectx(numRects)); - endRect(); - inRect = false; - } - ptr += linestep; - } - - return true; -} - -template -void QRfbMultiColorHextile::write(QTcpSocket *socket) const -{ - const int padding = 3; - QVarLengthArray buffer(bpp + padding + sizeof(quint8) + sizeof(numRects)); - - quint8 &subenc = buffer[padding]; - int n = padding + sizeof(quint8); - - subenc = 8 | 16; // AnySubrects | SubrectsColoured - - if (encoder->newBg) { - subenc |= 0x2; // Background - encoder->server->convertPixels(reinterpret_cast(buffer.data() + n), - reinterpret_cast(&encoder->bg), - 1); - n += bpp; -// encoder->newBg = false; - } - - buffer[n] = numRects; - n += sizeof(numRects); - - socket->write(reinterpret_cast(buffer.data() + padding), - n - padding); - socket->write(reinterpret_cast(rects.constData()), - rects.size()); -} - -bool QVNCServer::pixelConversionNeeded() const -{ - if (!sameEndian) - return true; - -#if Q_BYTE_ORDER == Q_BIG_ENDIAN - if (qvnc_screen->swapBytes()) - return true; -#endif - - const int screendepth = qvnc_screen->depth(); - if (screendepth != pixelFormat.bitsPerPixel) - return true; - - switch (screendepth) { - case 32: - case 24: - return false; - case 18: - return (pixelFormat.redBits == 6 - && pixelFormat.greenBits == 6 - && pixelFormat.blueBits == 6); - case 16: - return (pixelFormat.redBits == 5 - && pixelFormat.greenBits == 6 - && pixelFormat.blueBits == 5); - case 15: - return (pixelFormat.redBits == 5 - && pixelFormat.greenBits == 5 - && pixelFormat.blueBits == 5); - case 12: - return (pixelFormat.redBits == 4 - && pixelFormat.greenBits == 4 - && pixelFormat.blueBits == 4); - } - return true; -} - -// count: number of pixels -void QVNCServer::convertPixels(char *dst, const char *src, int count) const -{ - const int screendepth = qvnc_screen->depth(); - const bool isBgr = false; //### qvnc_screen->pixelType() == QScreen::BGRPixel; - - // cutoffs -#if Q_BYTE_ORDER == Q_BIG_ENDIAN - if (!swapBytes) -#endif - if (sameEndian) { - if (screendepth == pixelFormat.bitsPerPixel) { // memcpy cutoffs - - switch (screendepth) { - case 32: - memcpy(dst, src, count * sizeof(quint32)); - return; - case 16: - if (pixelFormat.redBits == 5 - && pixelFormat.greenBits == 6 - && pixelFormat.blueBits == 5) - { - memcpy(dst, src, count * sizeof(quint16)); - return; - } - } - } else if (screendepth == 16 && pixelFormat.bitsPerPixel == 32) { -#if defined(__i386__) // Currently fails on ARM if dst is not 4 byte aligned - const quint32 *src32 = reinterpret_cast(src); - quint32 *dst32 = reinterpret_cast(dst); - int count32 = count * sizeof(quint16) / sizeof(quint32); - while (count32--) { - const quint32 s = *src32++; - quint32 result1; - quint32 result2; - - // red - result1 = ((s & 0xf8000000) | ((s & 0xe0000000) >> 5)) >> 8; - result2 = ((s & 0x0000f800) | ((s & 0x0000e000) >> 5)) << 8; - - // green - result1 |= ((s & 0x07e00000) | ((s & 0x06000000) >> 6)) >> 11; - result2 |= ((s & 0x000007e0) | ((s & 0x00000600) >> 6)) << 5; - - // blue - result1 |= ((s & 0x001f0000) | ((s & 0x001c0000) >> 5)) >> 13; - result2 |= ((s & 0x0000001f) | ((s & 0x0000001c) >> 5)) << 3; - - *dst32++ = result2; - *dst32++ = result1; - } - if (count & 0x1) { - const quint16 *src16 = reinterpret_cast(src); - dst32[count - 1] = qt_conv16ToRgb(src16[count - 1]); - } - return; -#endif - } - } - - const int bytesPerPixel = (pixelFormat.bitsPerPixel + 7) / 8; - -// nibble = 0; - - for (int i = 0; i < count; ++i) { - int r, g, b; - - switch (screendepth) { -#if 0 - case 4: { - if (!nibble) { - r = ((*src) & 0x0f) << 4; - } else { - r = (*src) & 0xf0; - src++; - } - nibble = !nibble; - g = b = r; - break; - } -#endif -#if 0 - case 8: { - QRgb rgb = qvnc_screen->clut()[int(*src)]; - r = qRed(rgb); - g = qGreen(rgb); - b = qBlue(rgb); - src++; - break; - } -#endif -#ifdef QT_QWS_DEPTH_12 - case 12: { - quint32 p = quint32(*reinterpret_cast(src)); - r = qRed(p); - g = qGreen(p); - b = qBlue(p); - src += sizeof(qrgb444); - break; - } -#endif -#ifdef QT_QWS_DEPTH_15 - case 15: { - quint32 p = quint32(*reinterpret_cast(src)); - r = qRed(p); - g = qGreen(p); - b = qBlue(p); - src += sizeof(qrgb555); - break; - } -#endif - case 16: { - quint16 p = *reinterpret_cast(src); -#if Q_BYTE_ORDER == Q_BIG_ENDIAN - if (swapBytes) - p = ((p & 0xff) << 8) | ((p & 0xff00) >> 8); -#endif - r = (p >> 11) & 0x1f; - g = (p >> 5) & 0x3f; - b = p & 0x1f; - r <<= 3; - g <<= 2; - b <<= 3; - src += sizeof(quint16); - break; - } -#ifdef QT_QWS_DEPTH_18 - case 18: { - quint32 p = quint32(*reinterpret_cast(src)); - r = qRed(p); - g = qGreen(p); - b = qBlue(p); - src += sizeof(qrgb666); - break; - } -#endif -#ifdef QT_QWS_DEPTH_24 - case 24: { - quint32 p = quint32(*reinterpret_cast(src)); - r = qRed(p); - g = qGreen(p); - b = qBlue(p); - src += sizeof(qrgb888); - break; - } -#endif - case 32: { - quint32 p = *reinterpret_cast(src); - r = (p >> 16) & 0xff; - g = (p >> 8) & 0xff; - b = p & 0xff; - src += sizeof(quint32); - break; - } - default: { - r = g = b = 0; - qDebug("QVNCServer: don't support %dbpp display", screendepth); - return; - } - } - -#if Q_BYTE_ORDER == Q_BIG_ENDIAN - if (swapBytes ^ isBgr) -#else - if (isBgr) -#endif - qSwap(r, b); - - r >>= (8 - pixelFormat.redBits); - g >>= (8 - pixelFormat.greenBits); - b >>= (8 - pixelFormat.blueBits); - - int pixel = (r << pixelFormat.redShift) | - (g << pixelFormat.greenShift) | - (b << pixelFormat.blueShift); - - if (sameEndian || pixelFormat.bitsPerPixel == 8) { - memcpy(dst, &pixel, bytesPerPixel); // XXX: do a simple for-loop instead? - dst += bytesPerPixel; - continue; - } - - - if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { - switch (pixelFormat.bitsPerPixel) { - case 16: - pixel = (((pixel & 0x0000ff00) << 8) | - ((pixel & 0x000000ff) << 24)); - break; - case 32: - pixel = (((pixel & 0xff000000) >> 24) | - ((pixel & 0x00ff0000) >> 8) | - ((pixel & 0x0000ff00) << 8) | - ((pixel & 0x000000ff) << 24)); - break; - default: - qDebug("Cannot handle %d bpp client", pixelFormat.bitsPerPixel); - } - } else { // QSysInfo::ByteOrder == QSysInfo::LittleEndian - switch (pixelFormat.bitsPerPixel) { - case 16: - pixel = (((pixel & 0xff000000) >> 8) | - ((pixel & 0x00ff0000) << 8)); - break; - case 32: - pixel = (((pixel & 0xff000000) >> 24) | - ((pixel & 0x00ff0000) >> 8) | - ((pixel & 0x0000ff00) << 8) | - ((pixel & 0x000000ff) << 24)); - break; - default: - qDebug("Cannot handle %d bpp client", - pixelFormat.bitsPerPixel); - break; - } - } - memcpy(dst, &pixel, bytesPerPixel); // XXX: simple for-loop instead? - dst += bytesPerPixel; - } -} - -#ifndef QT_NO_QWS_CURSOR -static void blendCursor(QImage &image, const QRect &imageRect) -{ - const QRect cursorRect = qt_screencursor->boundingRect(); - const QRect intersection = (cursorRect & imageRect); - const QRect destRect = intersection.translated(-imageRect.topLeft()); - const QRect srcRect = intersection.translated(-cursorRect.topLeft()); - - QPainter painter(&image); - painter.drawImage(destRect, qt_screencursor->image(), srcRect); - painter.end(); -} -#endif // QT_NO_QWS_CURSOR - -QVNCDirtyMap::QVNCDirtyMap(QVNCGraphicsSystemScreen *s) - : bytesPerPixel(0), numDirty(0), screen(s) -{ - bytesPerPixel = (screen->depth() + 7) / 8; - QSize screenSize = screen->geometry().size(); - bufferWidth = screenSize.width(); - bufferHeight = screenSize.height(); - bufferStride = bufferWidth * bytesPerPixel; - buffer = new uchar[bufferHeight * bufferStride]; - - mapWidth = (bufferWidth + MAP_TILE_SIZE - 1) / MAP_TILE_SIZE; - mapHeight = (bufferHeight + MAP_TILE_SIZE - 1) / MAP_TILE_SIZE; - numTiles = mapWidth * mapHeight; - map = new uchar[numTiles]; -} - -QVNCDirtyMap::~QVNCDirtyMap() -{ - delete[] map; - delete[] buffer; -} - -void QVNCDirtyMap::reset() -{ - memset(map, 1, numTiles); - memset(buffer, 0, bufferHeight * bufferStride); - numDirty = numTiles; -} - -inline bool QVNCDirtyMap::dirty(int x, int y) const -{ - return map[y * mapWidth + x]; -} - -inline void QVNCDirtyMap::setClean(int x, int y) -{ - map[y * mapWidth + x] = 0; - --numDirty; -} - -template -void QVNCDirtyMapOptimized::setDirty(int tileX, int tileY, bool force) -{ - static bool alwaysForce = qgetenv("QT_VNC_NO_COMPAREBUFFER").toInt(); - if (alwaysForce) - force = true; - - bool changed = false; - - if (!force) { - const int lstep = screen->linestep(); - const int startX = tileX * MAP_TILE_SIZE; - const int startY = tileY * MAP_TILE_SIZE; - const uchar *scrn = screen->base() - + startY * lstep + startX * bytesPerPixel; - uchar *old = buffer + startY * bufferStride + startX * sizeof(T); - - const int tileHeight = (startY + MAP_TILE_SIZE > bufferHeight ? - bufferHeight - startY : MAP_TILE_SIZE); - const int tileWidth = (startX + MAP_TILE_SIZE > bufferWidth ? - bufferWidth - startX : MAP_TILE_SIZE); - const bool doInlines = (tileWidth == MAP_TILE_SIZE); - - int y = tileHeight; - - if (doInlines) { // hw: memcmp/memcpy is inlined when using constants - while (y) { - if (memcmp(old, scrn, sizeof(T) * MAP_TILE_SIZE)) { - changed = true; - break; - } - scrn += lstep; - old += bufferStride; - --y; - } - - while (y) { - memcpy(old, scrn, sizeof(T) * MAP_TILE_SIZE); - scrn += lstep; - old += bufferStride; - --y; - } - } else { - while (y) { - if (memcmp(old, scrn, sizeof(T) * tileWidth)) { - changed = true; - break; - } - scrn += lstep; - old += bufferStride; - --y; - } - - while (y) { - memcpy(old, scrn, sizeof(T) * tileWidth); - scrn += lstep; - old += bufferStride; - --y; - } - } - } - - const int mapIndex = tileY * mapWidth + tileX; - if ((force || changed) && !map[mapIndex]) { - map[mapIndex] = 1; - ++numDirty; - } -} - -template -QRfbHextileEncoder::QRfbHextileEncoder(QVNCServer *s) - : QRfbEncoder(s), - singleColorHextile(this), dualColorHextile(this), multiColorHextile(this) -{ -} - -/* - \internal - Send dirty rects using hextile encoding. -*/ -template -void QRfbHextileEncoder::write() -{ -// QWSDisplay::grab(true); - - QVNCDirtyMap *map = server->dirtyMap(); - QTcpSocket *socket = server->clientSocket(); - - const quint32 encoding = htonl(5); // hextile encoding - const int bytesPerPixel = server->clientBytesPerPixel(); - - { - const char tmp[2] = { 0, 0 }; // msg type, padding - socket->write(tmp, sizeof(tmp)); - } - { - const quint16 count = htons(map->numDirty); - socket->write((char *)&count, sizeof(count)); - } - - if (map->numDirty <= 0) { -// QWSDisplay::ungrab(); - return; - } - - newBg = true; - newFg = true; - - const QImage screenImage = server->screenImage(); - QRfbRect rect(0, 0, MAP_TILE_SIZE, MAP_TILE_SIZE); - - QSize screenSize = server->screen()->geometry().size(); - - for (int y = 0; y < map->mapHeight; ++y) { - if (rect.y + MAP_TILE_SIZE > screenSize.height()) - rect.h = screenSize.height() - rect.y; - rect.w = MAP_TILE_SIZE; - for (int x = 0; x < map->mapWidth; ++x) { - if (!map->dirty(x, y)) - continue; - map->setClean(x, y); - - rect.x = x * MAP_TILE_SIZE; - if (rect.x + MAP_TILE_SIZE > screenSize.width()) //###deviceWidth ??? - rect.w = screenSize.width() - rect.x; - rect.write(socket); - - socket->write((char *)&encoding, sizeof(encoding)); - - const uchar *screendata = screenImage.scanLine(rect.y) - + rect.x * screenImage.depth() / 8; - int linestep = screenImage.bytesPerLine(); - -#ifndef QT_NO_QWS_CURSOR - // hardware cursors must be blended with the screen memory - const bool doBlendCursor = qt_screencursor - && !server->hasClientCursor() - && qt_screencursor->isAccelerated(); - QImage tileImage; - if (doBlendCursor) { - const QRect tileRect(rect.x, rect.y, rect.w, rect.h); - const QRect cursorRect = qt_screencursor->boundingRect() - .translated(-server->screen()->offset()); - if (tileRect.intersects(cursorRect)) { - tileImage = screenImage.copy(tileRect); - blendCursor(tileImage, - tileRect.translated(server->screen()->offset())); - screendata = tileImage.bits(); - linestep = tileImage.bytesPerLine(); - } - } -#endif // QT_NO_QWS_CURSOR - - if (singleColorHextile.read(screendata, rect.w, rect.h, linestep)) { - singleColorHextile.write(socket); - } else if (dualColorHextile.read(screendata, rect.w, rect.h, linestep)) { - dualColorHextile.write(socket); - } else if (multiColorHextile.read(screendata, rect.w, rect.h, linestep)) { - multiColorHextile.write(socket); - } else if (server->doPixelConversion()) { - const int bufferSize = rect.w * rect.h * bytesPerPixel + 1; - const int padding = sizeof(quint32) - sizeof(char); - buffer.resize(bufferSize + padding); - - buffer[padding] = 1; // Raw subencoding - - // convert pixels - char *b = buffer.data() + padding + 1; - const int bstep = rect.w * bytesPerPixel; - for (int i = 0; i < rect.h; ++i) { - server->convertPixels(b, (const char*)screendata, rect.w); - screendata += linestep; - b += bstep; - } - socket->write(buffer.constData() + padding, bufferSize); - } else { - quint8 subenc = 1; // Raw subencoding - socket->write((char *)&subenc, 1); - - // send pixels - for (int i = 0; i < rect.h; ++i) { - socket->write((const char*)screendata, - rect.w * bytesPerPixel); - screendata += linestep; - } - } - } - if (socket->state() == QAbstractSocket::UnconnectedState) - break; - rect.y += MAP_TILE_SIZE; - } - socket->flush(); - Q_ASSERT(map->numDirty == 0); - -// QWSDisplay::ungrab(); -} - -void QRfbRawEncoder::write() -{ -// QWSDisplay::grab(false); - - QVNCDirtyMap *map = server->dirtyMap(); - QTcpSocket *socket = server->clientSocket(); - - const int bytesPerPixel = server->clientBytesPerPixel(); - QSize screenSize = server->screen()->geometry().size(); - - // create a region from the dirty rects and send the region's merged rects. - QRegion rgn; - if (map) { - for (int y = 0; y < map->mapHeight; ++y) { - for (int x = 0; x < map->mapWidth; ++x) { - if (!map->dirty(x, y)) - continue; - rgn += QRect(x * MAP_TILE_SIZE, y * MAP_TILE_SIZE, - MAP_TILE_SIZE, MAP_TILE_SIZE); - map->setClean(x, y); - } - } - - rgn &= QRect(0, 0, screenSize.width(), - screenSize.height()); - } - const QVector rects = rgn.rects(); - - { - const char tmp[2] = { 0, 0 }; // msg type, padding - socket->write(tmp, sizeof(tmp)); - } - - { - const quint16 count = htons(rects.size()); - socket->write((char *)&count, sizeof(count)); - } - - if (rects.size() <= 0) { -// QWSDisplay::ungrab(); - return; - } - - const QImage *screenImage = server->screenImage(); - - for (int i = 0; i < rects.size(); ++i) { - const QRect tileRect = rects.at(i); - const QRfbRect rect(tileRect.x(), tileRect.y(), - tileRect.width(), tileRect.height()); - rect.write(socket); - - const quint32 encoding = htonl(0); // raw encoding - socket->write((char *)&encoding, sizeof(encoding)); - - int linestep = screenImage->bytesPerLine(); - const uchar *screendata = screenImage->scanLine(rect.y) - + rect.x * screenImage->depth() / 8; - -#ifndef QT_NO_QWS_CURSOR - // hardware cursors must be blended with the screen memory - const bool doBlendCursor = qt_screencursor - && !server->hasClientCursor() - && qt_screencursor->isAccelerated(); - QImage tileImage; - if (doBlendCursor) { - const QRect cursorRect = qt_screencursor->boundingRect() - .translated(-server->screen()->offset()); - if (tileRect.intersects(cursorRect)) { - tileImage = screenImage->copy(tileRect); - blendCursor(tileImage, - tileRect.translated(server->screen()->offset())); - screendata = tileImage.bits(); - linestep = tileImage.bytesPerLine(); - } - } -#endif // QT_NO_QWS_CURSOR - - if (server->doPixelConversion()) { - const int bufferSize = rect.w * rect.h * bytesPerPixel; - if (bufferSize > buffer.size()) - buffer.resize(bufferSize); - - // convert pixels - char *b = buffer.data(); - const int bstep = rect.w * bytesPerPixel; - for (int i = 0; i < rect.h; ++i) { - server->convertPixels(b, (const char*)screendata, rect.w); - screendata += linestep; - b += bstep; - } - socket->write(buffer.constData(), bufferSize); - } else { - for (int i = 0; i < rect.h; ++i) { - socket->write((const char*)screendata, rect.w * bytesPerPixel); - screendata += linestep; - } - } - if (socket->state() == QAbstractSocket::UnconnectedState) - break; - } - socket->flush(); - -// QWSDisplay::ungrab(); -} - -inline QImage *QVNCServer::screenImage() const -{ - return qvnc_screen->image(); -} - -void QVNCServer::checkUpdate() -{ - if (!wantUpdate) - return; - - if (dirtyCursor) { -#ifndef QT_NO_QWS_CURSOR - Q_ASSERT(qvnc_cursor); - qvnc_cursor->write(); -#endif - cursor->sendClientCursor(); - dirtyCursor = false; - wantUpdate = false; - return; - } - - if (dirtyMap()->numDirty > 0) { - if (encoder) - encoder->write(); - wantUpdate = false; - } -} - -void QVNCServer::discardClient() -{ - timer->stop(); - state = Unconnected; - delete encoder; - encoder = 0; -#ifndef QT_NO_QWS_CURSOR - delete qvnc_cursor; - qvnc_cursor = 0; -#endif -// if (!qvnc_screen->screen()) -// QWSServer::instance()->enablePainting(false); -} - - - -QVNCGraphicsSystemScreenPrivate::QVNCGraphicsSystemScreenPrivate(QVNCGraphicsSystemScreen *parent) - : dpiX(72), dpiY(72), doOnScreenSurface(false), refreshRate(25), - vncServer(0), q_ptr(parent) -{ -#if 0//ndef QT_NO_QWS_SIGNALHANDLER - QWSSignalHandler::instance()->addObject(this); -#endif - - vncServer = new QVNCServer(q_ptr); - vncServer->setRefreshRate(refreshRate); - - - Q_ASSERT(q_ptr->depth() == 32); - - dirty = new QVNCDirtyMapOptimized(q_ptr); -} - -QVNCGraphicsSystemScreenPrivate::~QVNCGraphicsSystemScreenPrivate() -{ -} - - -void QVNCGraphicsSystemScreenPrivate::setDirty(const QRect& rect, bool force) -{ - if (rect.isEmpty()) - return; - -// if (q_ptr->screen()) -// q_ptr->screen()->setDirty(rect); - - if (!vncServer || !vncServer->isConnected()) { -// qDebug() << "QVNCGraphicsSystemScreenPrivate::setDirty() - Not connected"; - return; - } - const QRect r = rect; // .translated(-q_ptr->offset()); - const int x1 = r.x() / MAP_TILE_SIZE; - int y = r.y() / MAP_TILE_SIZE; - for (; (y <= r.bottom() / MAP_TILE_SIZE) && y < dirty->mapHeight; y++) - for (int x = x1; (x <= r.right() / MAP_TILE_SIZE) && x < dirty->mapWidth; x++) - dirty->setDirty(x, y, force); - - vncServer->setDirty(); -} - - - - -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/vnc/qvncserver.h b/src/plugins/graphicssystems/vnc/qvncserver.h deleted file mode 100644 index 4fcdbae..0000000 --- a/src/plugins/graphicssystems/vnc/qvncserver.h +++ /dev/null @@ -1,534 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSCREENVNC_P_H -#define QSCREENVNC_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of the QLibrary class. This header file may change from version to version -// without notice, or even be removed. -// -// We mean it. -// - -#include "qgraphicssystem_vnc.h" -#include "qvnccursor.h" -#define QT_NO_QWS_CURSOR - -#ifndef QT_NO_QWS_VNC - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QVNCServer; - -#ifndef QT_NO_QWS_CURSOR -class QVNCCursor : public QProxyScreenCursor -{ -public: - QVNCCursor(QVNCGraphicsSystemScreen *s); - ~QVNCCursor(); - - void hide(); - void show(); - void set(const QImage &image, int hotx, int hoty); - void move(int x, int y); - -private: - void setDirty(const QRect &r) const; - QVNCGraphicsSystemScreen *screen; -}; - -class QVNCClientCursor : public QProxyScreenCursor -{ -public: - QVNCClientCursor(QVNCServer *s); - ~QVNCClientCursor(); - - void set(const QImage &image, int hotx, int hoty); - void write() const; - -private: - QVNCServer *server; -}; -#endif // QT_NO_QWS_CURSOR - -#define MAP_TILE_SIZE 16 -#define MAP_WIDTH 1280 / MAP_TILE_SIZE -#define MAP_HEIGHT 1024 / MAP_TILE_SIZE - -class QVNCDirtyMap -{ -public: - QVNCDirtyMap(QVNCGraphicsSystemScreen *screen); - virtual ~QVNCDirtyMap(); - - void reset(); - bool dirty(int x, int y) const; - virtual void setDirty(int x, int y, bool force = false) = 0; - void setClean(int x, int y); - - int bytesPerPixel; - - int numDirty; - int mapWidth; - int mapHeight; - -protected: - uchar *map; - QVNCGraphicsSystemScreen *screen; - uchar *buffer; - int bufferWidth; - int bufferHeight; - int bufferStride; - int numTiles; -}; - -template -class QVNCDirtyMapOptimized : public QVNCDirtyMap -{ -public: - QVNCDirtyMapOptimized(QVNCGraphicsSystemScreen *screen) : QVNCDirtyMap(screen) {} - ~QVNCDirtyMapOptimized() {} - - void setDirty(int x, int y, bool force = false); -}; - -class QRfbRect -{ -public: - QRfbRect() {} - QRfbRect(quint16 _x, quint16 _y, quint16 _w, quint16 _h) { - x = _x; y = _y; w = _w; h = _h; - } - - void read(QTcpSocket *s); - void write(QTcpSocket *s) const; - - quint16 x; - quint16 y; - quint16 w; - quint16 h; -}; - -class QRfbPixelFormat -{ -public: - static int size() { return 16; } - - void read(QTcpSocket *s); - void write(QTcpSocket *s); - - int bitsPerPixel; - int depth; - bool bigEndian; - bool trueColor; - int redBits; - int greenBits; - int blueBits; - int redShift; - int greenShift; - int blueShift; -}; - -class QRfbServerInit -{ -public: - QRfbServerInit() { name = 0; } - ~QRfbServerInit() { delete[] name; } - - int size() const { return QRfbPixelFormat::size() + 8 + strlen(name); } - void setName(const char *n); - - void read(QTcpSocket *s); - void write(QTcpSocket *s); - - quint16 width; - quint16 height; - QRfbPixelFormat format; - char *name; -}; - -class QRfbSetEncodings -{ -public: - bool read(QTcpSocket *s); - - quint16 count; -}; - -class QRfbFrameBufferUpdateRequest -{ -public: - bool read(QTcpSocket *s); - - char incremental; - QRfbRect rect; -}; - -class QRfbKeyEvent -{ -public: - bool read(QTcpSocket *s); - - char down; - int keycode; - int unicode; -}; - -class QRfbPointerEvent -{ -public: - bool read(QTcpSocket *s); - - Qt::MouseButtons buttons; - enum { WheelNone, - WheelUp, - WheelDown, - WheelLeft, - WheelRight - } wheelDirection; - quint16 x; - quint16 y; -}; - -class QRfbClientCutText -{ -public: - bool read(QTcpSocket *s); - - quint32 length; -}; - -class QVNCGraphicsSystemScreenPrivate : public QObject -{ -public: - QVNCGraphicsSystemScreenPrivate(QVNCGraphicsSystemScreen *parent); - ~QVNCGraphicsSystemScreenPrivate(); - - void setDirty(const QRect &rect, bool force = false); - void configure(); - - qreal dpiX; - qreal dpiY; - bool doOnScreenSurface; - QVNCDirtyMap *dirty; - int refreshRate; - QVNCServer *vncServer; - -#if !defined(QT_NO_QWS_MULTIPROCESS) && !defined(QT_NO_SHAREDMEMORY) - QSharedMemory shm; -#endif - - QVNCGraphicsSystemScreen *q_ptr; -}; - -class QRfbEncoder -{ -public: - QRfbEncoder(QVNCServer *s) : server(s) {} - virtual ~QRfbEncoder() {} - - virtual void write() = 0; - -protected: - QVNCServer *server; -}; - -class QRfbRawEncoder : public QRfbEncoder -{ -public: - QRfbRawEncoder(QVNCServer *s) : QRfbEncoder(s) {} - - void write(); - -private: - QByteArray buffer; -}; - -template class QRfbHextileEncoder; - -template -class QRfbSingleColorHextile -{ -public: - QRfbSingleColorHextile(QRfbHextileEncoder *e) : encoder(e) {} - bool read(const uchar *data, int width, int height, int stride); - void write(QTcpSocket *socket) const; - -private: - QRfbHextileEncoder *encoder; -}; - -template -class QRfbDualColorHextile -{ -public: - QRfbDualColorHextile(QRfbHextileEncoder *e) : encoder(e) {} - bool read(const uchar *data, int width, int height, int stride); - void write(QTcpSocket *socket) const; - -private: - struct Rect { - quint8 xy; - quint8 wh; - } Q_PACKED rects[8 * 16]; - - quint8 numRects; - QRfbHextileEncoder *encoder; - -private: - inline int lastx() const { return rectx(numRects); } - inline int lasty() const { return recty(numRects); } - inline int rectx(int r) const { return rects[r].xy >> 4; } - inline int recty(int r) const { return rects[r].xy & 0x0f; } - inline int width(int r) const { return (rects[r].wh >> 4) + 1; } - inline int height(int r) const { return (rects[r].wh & 0x0f) + 1; } - - inline void setX(int r, int x) { - rects[r].xy = (x << 4) | (rects[r].xy & 0x0f); - } - inline void setY(int r, int y) { - rects[r].xy = (rects[r].xy & 0xf0) | y; - } - inline void setWidth(int r, int width) { - rects[r].wh = ((width - 1) << 4) | (rects[r].wh & 0x0f); - } - inline void setHeight(int r, int height) { - rects[r].wh = (rects[r].wh & 0xf0) | (height - 1); - } - - inline void setWidth(int width) { setWidth(numRects, width); } - inline void setHeight(int height) { setHeight(numRects, height); } - inline void setX(int x) { setX(numRects, x); } - inline void setY(int y) { setY(numRects, y); } - void next(); -}; - -template -class QRfbMultiColorHextile -{ -public: - QRfbMultiColorHextile(QRfbHextileEncoder *e) : encoder(e) {} - bool read(const uchar *data, int width, int height, int stride); - void write(QTcpSocket *socket) const; - -private: - inline quint8* rect(int r) { - return rects.data() + r * (bpp + 2); - } - inline const quint8* rect(int r) const { - return rects.constData() + r * (bpp + 2); - } - inline void setX(int r, int x) { - quint8 *ptr = rect(r) + bpp; - *ptr = (x << 4) | (*ptr & 0x0f); - } - inline void setY(int r, int y) { - quint8 *ptr = rect(r) + bpp; - *ptr = (*ptr & 0xf0) | y; - } - void setColor(SRC color); - inline int rectx(int r) const { - const quint8 *ptr = rect(r) + bpp; - return *ptr >> 4; - } - inline int recty(int r) const { - const quint8 *ptr = rect(r) + bpp; - return *ptr & 0x0f; - } - inline void setWidth(int r, int width) { - quint8 *ptr = rect(r) + bpp + 1; - *ptr = ((width - 1) << 4) | (*ptr & 0x0f); - } - inline void setHeight(int r, int height) { - quint8 *ptr = rect(r) + bpp + 1; - *ptr = (*ptr & 0xf0) | (height - 1); - } - - bool beginRect(); - void endRect(); - - static const int maxRectsSize = 16 * 16; - QVarLengthArray rects; - - quint8 bpp; - quint8 numRects; - QRfbHextileEncoder *encoder; -}; - -template -class QRfbHextileEncoder : public QRfbEncoder -{ -public: - QRfbHextileEncoder(QVNCServer *s); - void write(); - -private: - enum SubEncoding { - Raw = 1, - BackgroundSpecified = 2, - ForegroundSpecified = 4, - AnySubrects = 8, - SubrectsColoured = 16 - }; - - QByteArray buffer; - QRfbSingleColorHextile singleColorHextile; - QRfbDualColorHextile dualColorHextile; - QRfbMultiColorHextile multiColorHextile; - - SRC bg; - SRC fg; - bool newBg; - bool newFg; - - friend class QRfbSingleColorHextile; - friend class QRfbDualColorHextile; - friend class QRfbMultiColorHextile; -}; - -class QVNCServer : public QObject -{ - Q_OBJECT -public: - QVNCServer(QVNCGraphicsSystemScreen *screen); - QVNCServer(QVNCGraphicsSystemScreen *screen, int id); - ~QVNCServer(); - - void setDirty(); - void setDirtyCursor() { dirtyCursor = true; setDirty(); } - inline bool isConnected() const { return state == Connected; } - inline void setRefreshRate(int rate) { refreshRate = rate; } - - enum ClientMsg { SetPixelFormat = 0, - FixColourMapEntries = 1, - SetEncodings = 2, - FramebufferUpdateRequest = 3, - KeyEvent = 4, - PointerEvent = 5, - ClientCutText = 6 }; - - enum ServerMsg { FramebufferUpdate = 0, - SetColourMapEntries = 1 }; - - void convertPixels(char *dst, const char *src, int count) const; - - inline int clientBytesPerPixel() const { - return pixelFormat.bitsPerPixel / 8; - } - - inline QVNCGraphicsSystemScreen* screen() const { return qvnc_screen; } - inline QVNCDirtyMap* dirtyMap() const { return qvnc_screen->dirtyMap(); } - inline QTcpSocket* clientSocket() const { return client; } - QImage *screenImage() const; - inline bool doPixelConversion() const { return needConversion; } -#ifndef QT_NO_QWS_CURSOR - inline bool hasClientCursor() const { return qvnc_cursor != 0; } -#endif - - void setCursor(QVNCCursor * c) { cursor = c; } -private: - void setPixelFormat(); - void setEncodings(); - void frameBufferUpdateRequest(); - void pointerEvent(); - void keyEvent(); - void clientCutText(); - bool pixelConversionNeeded() const; - -private slots: - void newConnection(); - void readClient(); - void checkUpdate(); - void discardClient(); - void sendInputEvents(); - -private: - void init(uint port); - enum ClientState { Unconnected, Protocol, Init, Connected }; - QTimer *timer; - QTcpServer *serverSocket; - QTcpSocket *client; - ClientState state; - quint8 msgType; - bool handleMsg; - QRfbPixelFormat pixelFormat; - Qt::KeyboardModifiers keymod; - Qt::MouseButtons buttons; - int encodingsPending; - int cutTextPending; - uint supportCopyRect : 1; - uint supportRRE : 1; - uint supportCoRRE : 1; - uint supportHextile : 1; - uint supportZRLE : 1; - uint supportCursor : 1; - uint supportDesktopSize : 1; - bool wantUpdate; - bool sameEndian; - bool needConversion; -#if Q_BYTE_ORDER == Q_BIG_ENDIAN - bool swapBytes; -#endif - bool dirtyCursor; - int refreshRate; - QVNCGraphicsSystemScreen *qvnc_screen; -#ifndef QT_NO_QWS_CURSOR - QVNCClientCursor *qvnc_cursor; -#endif - - QRfbEncoder *encoder; - QVNCCursor *cursor; -}; - - -QT_END_NAMESPACE -#endif // QT_NO_QWS_VNC -#endif // QSCREENVNC_P_H diff --git a/src/plugins/graphicssystems/vnc/vnc.pro b/src/plugins/graphicssystems/vnc/vnc.pro deleted file mode 100644 index 0b73b5b..0000000 --- a/src/plugins/graphicssystems/vnc/vnc.pro +++ /dev/null @@ -1,19 +0,0 @@ -TARGET = qvncgraphicssystem -include(../../qpluginbase.pri) - -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems - -SOURCES = main.cpp qgraphicssystem_vnc.cpp -HEADERS = qgraphicssystem_vnc.h - -HEADERS += qvncserver.h -SOURCES += qvncserver.cpp - -HEADERS += qvnccursor.h -SOURCES += qvnccursor.cpp - -include(../fb_base/fb_base.pri) - -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems - -INSTALLS += target diff --git a/src/plugins/platforms/fb_base/fb_base.cpp b/src/plugins/platforms/fb_base/fb_base.cpp new file mode 100644 index 0000000..d30746a --- /dev/null +++ b/src/plugins/platforms/fb_base/fb_base.cpp @@ -0,0 +1,364 @@ +#include "fb_base.h" + +#include +#include +#include +#include +#include + +QGraphicsSystemSoftwareCursor::QGraphicsSystemSoftwareCursor(QGraphicsSystemScreen *scr) + : QGraphicsSystemCursor(scr), currentRect(QRect()), prevRect(QRect()) +{ + graphic = new QGraphicsSystemCursorImage(0, 0, 0, 0, 0, 0); + setCursor(Qt::ArrowCursor); +} + +QRect QGraphicsSystemSoftwareCursor::getCurrentRect() +{ + QRect rect = graphic->image()->rect().translated(-graphic->hotspot().x(), + -graphic->hotspot().y()); + rect.translate(QCursor::pos()); + return rect; +} + + +void QGraphicsSystemSoftwareCursor::pointerEvent(const QMouseEvent & e) +{ + Q_UNUSED(e); + currentRect = getCurrentRect(); + screen->setDirty(currentRect); +} + +QRect QGraphicsSystemSoftwareCursor::drawCursor(QPainter & painter) +{ + if (currentRect.isNull()) + return QRect(); + + prevRect = currentRect; + painter.drawImage(prevRect, *graphic->image()); + return prevRect; +} + +QRect QGraphicsSystemSoftwareCursor::dirtyRect() +{ + if (!prevRect.isNull()) { + QRect rect = prevRect; + prevRect = QRect(); + return rect; + } + return QRect(); +} + +void QGraphicsSystemSoftwareCursor::setCursor(Qt::CursorShape shape) +{ + graphic->set(shape); +} + +void QGraphicsSystemSoftwareCursor::setCursor(const QImage * image, int hotx, int hoty) +{ + graphic->set(image, hotx, hoty); +} + +void QGraphicsSystemSoftwareCursor::setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) +{ + graphic->set(data, mask, width, height, hotX, hotY); +} + +void QGraphicsSystemSoftwareCursor::changeCursor(QCursor * widgetCursor, QWidget * widget) +{ + Q_UNUSED(widget); + Qt::CursorShape shape = widgetCursor->shape(); + + if (shape == Qt::BitmapCursor) { + // application supplied cursor + QPoint spot = widgetCursor->hotSpot(); + setCursor(&widgetCursor->pixmap().toImage(), spot.x(), spot.y()); + } else { + // system cursor + setCursor(shape); + } + currentRect = getCurrentRect(); + screen->setDirty(currentRect); +} + +QGraphicsSystemFbScreen::QGraphicsSystemFbScreen() : cursor(0), mGeometry(), mDepth(16), mFormat(QImage::Format_RGB16), mScreenImage(0), compositePainter(0), isUpToDate(false) +{ + mScreenImage = new QImage(mGeometry.size(), mFormat); + redrawTimer.setSingleShot(true); + redrawTimer.setInterval(0); + QObject::connect(&redrawTimer, SIGNAL(timeout()), this, SLOT(doRedraw())); +} + +void QGraphicsSystemFbScreen::setGeometry(QRect rect) +{ + delete mScreenImage; + mGeometry = rect; + mScreenImage = new QImage(mGeometry.size(), mFormat); + delete compositePainter; + compositePainter = 0; + invalidateRectCache(); +} + +void QGraphicsSystemFbScreen::setDepth(int depth) +{ + mDepth = depth; +} + +void QGraphicsSystemFbScreen::setPhysicalSize(QSize size) +{ + mPhysicalSize = size; +} + +void QGraphicsSystemFbScreen::setFormat(QImage::Format format) +{ + mFormat = format; + delete mScreenImage; + mScreenImage = new QImage(mGeometry.size(), mFormat); + delete compositePainter; + compositePainter = 0; +} + +QGraphicsSystemFbScreen::~QGraphicsSystemFbScreen() +{ + delete compositePainter; + delete mScreenImage; +} + +void QGraphicsSystemFbScreen::setDirty(const QRect &rect) +{ + repaintRegion += rect; + if (!redrawTimer.isActive()) { + redrawTimer.start(); + } +} + +void QGraphicsSystemFbScreen::generateRects() +{ + cachedRects.clear(); + QRegion remainingScreen(mGeometry); + + for (int i = 0; i < windowStack.length(); i++) { + if (remainingScreen.isEmpty()) + break; + if (!windowStack[i]->window()->testAttribute(Qt::WA_TranslucentBackground)) { + remainingScreen -= windowStack[i]->geometry(); + QRegion windowRegion(windowStack[i]->geometry()); + windowRegion -= remainingScreen; + foreach(QRect rect, windowRegion.rects()) { + cachedRects += QPair(rect, i); + } + } + } + foreach (QRect rect, remainingScreen.rects()) + cachedRects += QPair(rect, -1); + isUpToDate = true; + return; +} + + + +QRegion QGraphicsSystemFbScreen::doRedraw() +{ + QRegion touchedRegion; + if (cursor) + repaintRegion += cursor->dirtyRect(); + if (repaintRegion.isEmpty()) + return touchedRegion; + + QVector rects = repaintRegion.rects(); + + if (!isUpToDate) + generateRects(); + + if (!compositePainter) + compositePainter = new QPainter(mScreenImage); + for (int rectIndex = 0; rectIndex < repaintRegion.numRects(); rectIndex++) { + QRegion rectRegion = rects[rectIndex]; + + for(int i = 0; i < cachedRects.length(); i++) { + QRect screenSubRect = cachedRects[i].first; + int layer = cachedRects[i].second; + QRegion intersect = rectRegion.intersected(screenSubRect); + + if (intersect.isEmpty()) + continue; + + rectRegion -= intersect; + + // we only expect one rectangle, but defensive coding... + foreach (QRect rect, intersect.rects()) { + bool firstLayer = true; + if (layer == -1) { + compositePainter->fillRect(rect, Qt::black); + firstLayer = false; + layer = windowStack.size() - 1; + } + + for (int layerIndex = layer; layerIndex != -1; layerIndex--) { + if (!windowStack[layerIndex]->visible()) + continue; + if (windowStack[layerIndex]->window()->isMinimized()) + continue; + QRect windowRect = windowStack[layerIndex]->geometry(); + QRect windowIntersect = rect.translated(-windowRect.left(), + -windowRect.top()); + compositePainter->drawImage(rect, windowStack[layerIndex]->image(), + windowIntersect); + if (firstLayer) { + firstLayer = false; + } + } + } + } + if (!rectRegion.isEmpty()) + qWarning() << "non-empty region!" << rectRegion; + // Everything on screen should be mapped to a sub-rectangle + // unless it's off the screen... + } + + QRect cursorRect; + if (cursor) { + cursorRect = cursor->drawCursor(*compositePainter); + touchedRegion += cursorRect; + } + touchedRegion += repaintRegion; + repaintRegion = QRegion(); + + return touchedRegion; +} + +void QGraphicsSystemFbScreen::removeWindowSurface(QGraphicsSystemFbWindowSurface * surface) +{ + windowStack.removeOne(surface); + invalidateRectCache(); + setDirty(surface->geometry()); +} + +void QGraphicsSystemFbWindowSurface::raise() +{ + mScreen->raise(this); +} + +void QGraphicsSystemFbScreen::raise(QWindowSurface * surface) +{ + QGraphicsSystemFbWindowSurface *s = static_cast(surface); + int index = windowStack.indexOf(s); + if (index <= 0) + return; + windowStack.move(index, 0); + invalidateRectCache(); + setDirty(s->geometry()); +} + +void QGraphicsSystemFbWindowSurface::lower() +{ + mScreen->lower(this); +} + +void QGraphicsSystemFbScreen::lower(QWindowSurface * surface) +{ + QGraphicsSystemFbWindowSurface *s = static_cast(surface); + int index = windowStack.indexOf(s); + if (index == -1 || index == (windowStack.size() - 1)) + return; + windowStack.move(index, windowStack.size() - 1); + invalidateRectCache(); + setDirty(s->geometry()); +} + +QWidget * QGraphicsSystemFbScreen::topLevelAt(const QPoint & p) const +{ + for(int i = 0; i < windowStack.size(); i++) { + if (windowStack[i]->geometry().contains(p, false) && + windowStack[i]->visible() && + !windowStack[i]->window()->isMinimized()) { + return windowStack[i]->window(); + } + } + return 0; +} + +QGraphicsSystemFbWindowSurface::QGraphicsSystemFbWindowSurface(QGraphicsSystemFbScreen *screen, QWidget *window) + : QWindowSurface(window), + mScreen(screen), + visibleFlag(false) +{ + static QAtomicInt winIdGenerator(1); + + mImage = QImage(window->size(), mScreen->format()); + windowId = winIdGenerator.fetchAndAddRelaxed(1); +} + +QGraphicsSystemFbWindowSurface::~QGraphicsSystemFbWindowSurface() +{ + mScreen->removeWindowSurface(this); +} + +void QGraphicsSystemFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + Q_UNUSED(offset); + + QRect currentGeometry = geometry(); + // If this is a move, redraw the previous location + if (oldGeometry != currentGeometry) { + mScreen->setDirty(oldGeometry); + oldGeometry = currentGeometry; + } + + QRect dirtyClient = region.boundingRect(); + QRect dirtyRegion(currentGeometry.left() + dirtyClient.left(), + currentGeometry.top() + dirtyClient.top(), + dirtyClient.width(), + dirtyClient.height()); + mScreen->setDirty(dirtyRegion); +} + +void QGraphicsSystemFbWindowSurface::setGeometry(const QRect &rect) +{ + // store previous geometry for screen update + oldGeometry = geometry(); + + // change the widget's QImage if this is a resize + if (mImage.size() != rect.size()) + mImage = QImage(rect.size(), mScreen->format()); + + mScreen->invalidateRectCache(); + QWindowSystemInterface::handleGeometryChange(window(), rect); + + QWindowSurface::setGeometry(rect); +} + +bool QGraphicsSystemFbWindowSurface::scroll(const QRegion &area, int dx, int dy) +{ + return QWindowSurface::scroll(area, dx, dy); +} + +void QGraphicsSystemFbWindowSurface::beginPaint(const QRegion ®ion) +{ + Q_UNUSED(region); +} + +void QGraphicsSystemFbWindowSurface::endPaint(const QRegion ®ion) +{ + Q_UNUSED(region); +} + +void QGraphicsSystemFbWindowSurface::setVisible(bool visible) +{ + visibleFlag = visible; + mScreen->invalidateRectCache(); + mScreen->setDirty(geometry()); +} + +Qt::WindowFlags QGraphicsSystemFbWindowSurface::setWindowFlags(Qt::WindowFlags type) +{ + flags = type; + mScreen->invalidateRectCache(); + return flags; +} + +Qt::WindowFlags QGraphicsSystemFbWindowSurface::windowFlags() const +{ + return flags; +} diff --git a/src/plugins/platforms/fb_base/fb_base.h b/src/plugins/platforms/fb_base/fb_base.h new file mode 100644 index 0000000..7f9b005 --- /dev/null +++ b/src/plugins/platforms/fb_base/fb_base.h @@ -0,0 +1,132 @@ +#ifndef QLIGHTHOUSEGRAPHICSSCREEN_H +#define QLIGHTHOUSEGRAPHICSSCREEN_H + +#include +#include +#include +#include +#include +#include + +class QMouseEvent; +class QSize; +class QPainter; + +class QGraphicsSystemFbScreen; + +class QGraphicsSystemSoftwareCursor : public QGraphicsSystemCursor +{ +public: + QGraphicsSystemSoftwareCursor(QGraphicsSystemScreen * scr); + + // output methods + QRect dirtyRect(); + virtual QRect drawCursor(QPainter & painter); + + // input methods + virtual void pointerEvent(const QMouseEvent & event); + virtual void changeCursor(QCursor * widgetCursor, QWidget * widget); + +protected: + QGraphicsSystemCursorImage * graphic; + +private: + void setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); + void setCursor(Qt::CursorShape shape); + void setCursor(const QImage * image, int hotx, int hoty); + QRect currentRect; // next place to draw the cursor + QRect prevRect; // last place the cursor was drawn + QRect getCurrentRect(); +}; + +class QGraphicsSystemFbWindowSurface : public QWindowSurface +{ +public: + QGraphicsSystemFbWindowSurface(QGraphicsSystemFbScreen *screen, QWidget *window); + ~QGraphicsSystemFbWindowSurface(); + + virtual QPaintDevice *paintDevice() { return &mImage; } + virtual void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + virtual bool scroll(const QRegion &area, int dx, int dy); + + virtual void beginPaint(const QRegion ®ion); + virtual void endPaint(const QRegion ®ion); + virtual void setVisible(bool visible); + virtual bool visible() { return visibleFlag; } + + const QImage image() { return mImage; } + void setGeometry(const QRect &rect); + + virtual void raise(); + virtual void lower(); + + virtual Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); + virtual Qt::WindowFlags windowFlags() const; + + WId winId() const { return windowId; } +protected: + QGraphicsSystemFbScreen *mScreen; + QRect oldGeometry; + QImage mImage; + bool visibleFlag; + Qt::WindowFlags flags; + + WId windowId; +}; + +class QGraphicsSystemFbScreen : public QGraphicsSystemScreen +{ + Q_OBJECT +public: + QGraphicsSystemFbScreen(); + ~QGraphicsSystemFbScreen(); + + virtual QRect geometry() const { return mGeometry; } + virtual int depth() const { return mDepth; } + virtual QImage::Format format() const { return mFormat; } + virtual QSize physicalSize() const { return mPhysicalSize; } + + virtual void setGeometry(QRect rect); + virtual void setDepth(int depth); + virtual void setFormat(QImage::Format format); + virtual void setPhysicalSize(QSize size); + + virtual void setDirty(const QRect &rect); + + virtual void removeWindowSurface(QGraphicsSystemFbWindowSurface * surface); + virtual void addWindowSurface(QGraphicsSystemFbWindowSurface * surface) { + windowStack.prepend(surface); invalidateRectCache(); } + virtual void raise(QWindowSurface * surface); + virtual void lower(QWindowSurface * surface); + virtual QWidget * topLevelAt(const QPoint & p) const; + + QImage * image() const { return mScreenImage; } + QPaintDevice * paintDevice() const { return mScreenImage; } + +protected: + QList windowStack; + QRegion repaintRegion; + QGraphicsSystemSoftwareCursor * cursor; + QTimer redrawTimer; + +protected slots: + virtual QRegion doRedraw(); + +protected: + QRect mGeometry; + int mDepth; + QImage::Format mFormat; + QSize mPhysicalSize; + QImage *mScreenImage; + +private: + QPainter * compositePainter; + void generateRects(); + QList > cachedRects; + + void invalidateRectCache() { isUpToDate = false; } + friend class QGraphicsSystemFbWindowSurface; + bool isUpToDate; +}; + +#endif // QLIGHTHOUSEGRAPHICSSCREEN_H diff --git a/src/plugins/platforms/fb_base/fb_base.pri b/src/plugins/platforms/fb_base/fb_base.pri new file mode 100644 index 0000000..41bd87f --- /dev/null +++ b/src/plugins/platforms/fb_base/fb_base.pri @@ -0,0 +1,2 @@ +SOURCES += ../fb_base/fb_base.cpp +HEADERS += ../fb_base/fb_base.h diff --git a/src/plugins/platforms/fb_base/fb_base.pro b/src/plugins/platforms/fb_base/fb_base.pro new file mode 100644 index 0000000..e08c0c5 --- /dev/null +++ b/src/plugins/platforms/fb_base/fb_base.pro @@ -0,0 +1,23 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2009-11-05T13:22:31 +# +#------------------------------------------------- + +#QT -= core gui +TARGET = fb_base +#include(../../qpluginbase.pri) + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems + +TEMPLATE = lib + +#DEFINES += STATIC_LIBRARY +CONFIG += staticlib + +SOURCES += fb_base.cpp + +HEADERS += fb_base.h + +target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +INSTALLS += target diff --git a/src/plugins/platforms/linuxfb/linuxfb.pro b/src/plugins/platforms/linuxfb/linuxfb.pro new file mode 100644 index 0000000..031b843 --- /dev/null +++ b/src/plugins/platforms/linuxfb/linuxfb.pro @@ -0,0 +1,12 @@ +TARGET = qlinuxfbgraphicssystem +include(../../qpluginbase.pri) + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems + +SOURCES = main.cpp qgraphicssystem_linuxfb.cpp +HEADERS = qgraphicssystem_linuxfb.h + +include(../fb_base/fb_base.pri) + +target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +INSTALLS += target diff --git a/src/plugins/platforms/linuxfb/main.cpp b/src/plugins/platforms/linuxfb/main.cpp new file mode 100644 index 0000000..4d03fe5 --- /dev/null +++ b/src/plugins/platforms/linuxfb/main.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qgraphicssystem_linuxfb.h" + +QT_BEGIN_NAMESPACE + +class QLinuxFbGraphicsSystemPlugin : public QGraphicsSystemPlugin +{ +public: + QStringList keys() const; + QGraphicsSystem *create(const QString&); +}; + +QStringList QLinuxFbGraphicsSystemPlugin::keys() const +{ + QStringList list; + list << "LinuxFb"; + return list; +} + +QGraphicsSystem* QLinuxFbGraphicsSystemPlugin::create(const QString& system) +{ + if (system.toLower() == "linuxfb") + return new QLinuxFbGraphicsSystem; + + return 0; +} + +Q_EXPORT_PLUGIN2(linuxfb, QLinuxFbGraphicsSystemPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp new file mode 100644 index 0000000..44960bb --- /dev/null +++ b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp @@ -0,0 +1,856 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgraphicssystem_linuxfb.h" +#include "../fb_base/fb_base.h" +#include +#include // overrides QT_OPEN +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if !defined(Q_OS_DARWIN) && !defined(Q_OS_FREEBSD) +#include + +#ifdef __i386__ +#include +#endif +#endif + +QT_BEGIN_NAMESPACE + +class QLinuxFbGraphicsSystemPrivate +{ +public: + QLinuxFbGraphicsSystemPrivate(); + ~QLinuxFbGraphicsSystemPrivate(); + + void openTty(); + void closeTty(); + + int fd; + int startupw; + int startuph; + int startupd; + bool blank; + + bool doGraphicsMode; +#ifdef QT_QWS_DEPTH_GENERIC + bool doGenericColors; +#endif + int ttyfd; + long oldKdMode; + QString ttyDevice; + QString displaySpec; +}; + +QLinuxFbGraphicsSystemPrivate::QLinuxFbGraphicsSystemPrivate() + : fd(-1), blank(true), doGraphicsMode(true), +#ifdef QT_QWS_DEPTH_GENERIC + doGenericColors(false), +#endif + ttyfd(-1), oldKdMode(KD_TEXT) +{ +} + +QLinuxFbGraphicsSystemPrivate::~QLinuxFbGraphicsSystemPrivate() +{ + closeTty(); +} + +void QLinuxFbGraphicsSystemPrivate::openTty() +{ + const char *const devs[] = {"/dev/tty0", "/dev/tty", "/dev/console", 0}; + + if (ttyDevice.isEmpty()) { + for (const char * const *dev = devs; *dev; ++dev) { + ttyfd = QT_OPEN(*dev, O_RDWR); + if (ttyfd != -1) + break; + } + } else { + ttyfd = QT_OPEN(ttyDevice.toAscii().constData(), O_RDWR); + } + + if (ttyfd == -1) + return; + + if (doGraphicsMode) { + ioctl(ttyfd, KDGETMODE, &oldKdMode); + if (oldKdMode != KD_GRAPHICS) { + int ret = ioctl(ttyfd, KDSETMODE, KD_GRAPHICS); + if (ret == -1) + doGraphicsMode = false; + } + } + + // No blankin' screen, no blinkin' cursor!, no cursor! + const char termctl[] = "\033[9;0]\033[?33l\033[?25l\033[?1c"; + QT_WRITE(ttyfd, termctl, sizeof(termctl)); +} + +void QLinuxFbGraphicsSystemPrivate::closeTty() +{ + if (ttyfd == -1) + return; + + if (doGraphicsMode) + ioctl(ttyfd, KDSETMODE, oldKdMode); + + // Blankin' screen, blinkin' cursor! + const char termctl[] = "\033[9;15]\033[?33h\033[?25h\033[?0c"; + QT_WRITE(ttyfd, termctl, sizeof(termctl)); + + QT_CLOSE(ttyfd); + ttyfd = -1; +} + +QLinuxFbGraphicsSystem::QLinuxFbGraphicsSystem() +{ + d_ptr = new QLinuxFbGraphicsSystemPrivate(); + + // XXX + QString displaySpec = QString::fromLatin1(qgetenv("QWS_DISPLAY")); + + if (!connect(displaySpec)) + qFatal("QLinuxFbGraphicsSystem: could not initialize screen"); + initDevice(); + + // Create a QImage directly on the screen's framebuffer. + // This is the blit target for copying windows to the screen. + mPrimaryScreen = new QLinuxFbGraphicsSystemScreen(data, w, h, lstep, + screenFormat); + mPrimaryScreen->setPhysicalSize(QSize(physWidth, physHeight)); + + mScreens.append(mPrimaryScreen); +} + +QLinuxFbGraphicsSystem::~QLinuxFbGraphicsSystem() +{ + delete mPrimaryScreen; + delete d_ptr; +} + +bool QLinuxFbGraphicsSystem::connect(const QString &displaySpec) +{ + const QStringList args = displaySpec.split(QLatin1Char(':')); + + if (args.contains(QLatin1String("nographicsmodeswitch"))) + d_ptr->doGraphicsMode = false; + +#ifdef QT_QWS_DEPTH_GENERIC + if (args.contains(QLatin1String("genericcolors"))) + d_ptr->doGenericColors = true; +#endif + + QRegExp ttyRegExp(QLatin1String("tty=(.*)")); + if (args.indexOf(ttyRegExp) != -1) + d_ptr->ttyDevice = ttyRegExp.cap(1); + +#if 0 +#if Q_BYTE_ORDER == Q_BIG_ENDIAN +#ifndef QT_QWS_FRAMEBUFFER_LITTLE_ENDIAN + if (args.contains(QLatin1String("littleendian"))) +#endif + QScreen::setFrameBufferLittleEndian(true); +#endif +#endif + + // Check for explicitly specified device + const int len = 8; // "/dev/fbx" + int m = displaySpec.indexOf(QLatin1String("/dev/fb")); + + QString dev; + if (m > 0) + dev = displaySpec.mid(m, len); + else + dev = QLatin1String("/dev/fb0"); + + if (access(dev.toLatin1().constData(), R_OK|W_OK) == 0) + d_ptr->fd = QT_OPEN(dev.toLatin1().constData(), O_RDWR); + if (d_ptr->fd == -1) { + if (access(dev.toLatin1().constData(), R_OK) == 0) + d_ptr->fd = QT_OPEN(dev.toLatin1().constData(), O_RDONLY); + if (d_ptr->fd == 1) { + qWarning("Error opening framebuffer device %s", qPrintable(dev)); + return false; + } + } + + fb_fix_screeninfo finfo; + fb_var_screeninfo vinfo; + //####################### + // Shut up Valgrind + memset(&vinfo, 0, sizeof(vinfo)); + memset(&finfo, 0, sizeof(finfo)); + //####################### + + /* Get fixed screen information */ + if (d_ptr->fd != -1 && ioctl(d_ptr->fd, FBIOGET_FSCREENINFO, &finfo)) { + perror("QLinuxFbGraphicsSystem::connect"); + qWarning("Error reading fixed information"); + return false; + } + + if (finfo.type == FB_TYPE_VGA_PLANES) { + qWarning("VGA16 video mode not supported"); + return false; + } + + /* Get variable screen information */ + if (d_ptr->fd != -1 && ioctl(d_ptr->fd, FBIOGET_VSCREENINFO, &vinfo)) { + perror("QLinuxFbGraphicsSystem::connect"); + qWarning("Error reading variable information"); + return false; + } + + grayscale = vinfo.grayscale; + d = vinfo.bits_per_pixel; + if (d == 24) { + d = vinfo.red.length + vinfo.green.length + vinfo.blue.length; + if (d <= 0) + d = 24; // reset if color component lengths are not reported + } else if (d == 16) { + d = vinfo.red.length + vinfo.green.length + vinfo.blue.length; + if (d <= 0) + d = 16; + } + lstep = finfo.line_length; + + int xoff = vinfo.xoffset; + int yoff = vinfo.yoffset; + const char* qwssize; + if((qwssize=::getenv("QWS_SIZE")) && sscanf(qwssize,"%dx%d",&w,&h)==2) { + if (d_ptr->fd != -1) { + if ((uint)w > vinfo.xres) w = vinfo.xres; + if ((uint)h > vinfo.yres) h = vinfo.yres; + } + dw=w; + dh=h; + int xxoff, yyoff; + if (sscanf(qwssize, "%*dx%*d+%d+%d", &xxoff, &yyoff) == 2) { + if (xxoff < 0 || xxoff + w > (int)(vinfo.xres)) + xxoff = vinfo.xres - w; + if (yyoff < 0 || yyoff + h > (int)(vinfo.yres)) + yyoff = vinfo.yres - h; + xoff += xxoff; + yoff += yyoff; + } else { + xoff += (vinfo.xres - w)/2; + yoff += (vinfo.yres - h)/2; + } + } else { + dw=w=vinfo.xres; + dh=h=vinfo.yres; + } + + if (w == 0 || h == 0) { + qWarning("QLinuxFbGraphicsSystem::connect(): Unable to find screen geometry, " + "will use 320x240."); + dw = w = 320; + dh = h = 240; + } + + setPixelFormat(vinfo); + + // Handle display physical size spec. + QStringList displayArgs = displaySpec.split(QLatin1Char(':')); + QRegExp mmWidthRx(QLatin1String("mmWidth=?(\\d+)")); + int dimIdxW = displayArgs.indexOf(mmWidthRx); + QRegExp mmHeightRx(QLatin1String("mmHeight=?(\\d+)")); + int dimIdxH = displayArgs.indexOf(mmHeightRx); + if (dimIdxW >= 0) { + mmWidthRx.exactMatch(displayArgs.at(dimIdxW)); + physWidth = mmWidthRx.cap(1).toInt(); + if (dimIdxH < 0) + physHeight = dh*physWidth/dw; + } + if (dimIdxH >= 0) { + mmHeightRx.exactMatch(displayArgs.at(dimIdxH)); + physHeight = mmHeightRx.cap(1).toInt(); + if (dimIdxW < 0) + physWidth = dw*physHeight/dh; + } + if (dimIdxW < 0 && dimIdxH < 0) { + if (vinfo.width != 0 && vinfo.height != 0 + && vinfo.width != UINT_MAX && vinfo.height != UINT_MAX) { + physWidth = vinfo.width; + physHeight = vinfo.height; + } else { + const int dpi = 72; + physWidth = qRound(dw * 25.4 / dpi); + physHeight = qRound(dh * 25.4 / dpi); + } + } + + dataoffset = yoff * lstep + xoff * d / 8; + //qDebug("Using %dx%dx%d screen",w,h,d); + + /* Figure out the size of the screen in bytes */ + size = h * lstep; + + mapsize = finfo.smem_len; + + data = (unsigned char *)-1; + if (d_ptr->fd != -1) + data = (unsigned char *)mmap(0, mapsize, PROT_READ | PROT_WRITE, + MAP_SHARED, d_ptr->fd, 0); + + if ((long)data == -1) { + perror("QLinuxFbGraphicsSystem::connect"); + qWarning("Error: failed to map framebuffer device to memory."); + return false; + } else { + data += dataoffset; + } + +#if 0 + canaccel = useOffscreen(); + if(canaccel) + setupOffScreen(); +#endif + canaccel = false; + + // Now read in palette + if((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4)) { + screencols= (vinfo.bits_per_pixel==8) ? 256 : 16; + int loopc; + fb_cmap startcmap; + startcmap.start=0; + startcmap.len=screencols; + startcmap.red=(unsigned short int *) + malloc(sizeof(unsigned short int)*screencols); + startcmap.green=(unsigned short int *) + malloc(sizeof(unsigned short int)*screencols); + startcmap.blue=(unsigned short int *) + malloc(sizeof(unsigned short int)*screencols); + startcmap.transp=(unsigned short int *) + malloc(sizeof(unsigned short int)*screencols); + if (d_ptr->fd == -1 || ioctl(d_ptr->fd, FBIOGETCMAP, &startcmap)) { + perror("QLinuxFbGraphicsSystem::connect"); + qWarning("Error reading palette from framebuffer, using default palette"); + createPalette(startcmap, vinfo, finfo); + } + int bits_used = 0; + for(loopc=0;loopc> 8, + startcmap.green[loopc] >> 8, + startcmap.blue[loopc] >> 8); + bits_used |= startcmap.red[loopc] + | startcmap.green[loopc] + | startcmap.blue[loopc]; + } + // WORKAROUND: Some framebuffer drivers only return 8 bit + // color values, so we need to not bit shift them.. + if ((bits_used & 0x00ff) && !(bits_used & 0xff00)) { + for(loopc=0;loopcopenTty(); + + // Grab current mode so we can reset it + fb_var_screeninfo vinfo; + fb_fix_screeninfo finfo; + //####################### + // Shut up Valgrind + memset(&vinfo, 0, sizeof(vinfo)); + memset(&finfo, 0, sizeof(finfo)); + //####################### + + if (ioctl(d_ptr->fd, FBIOGET_VSCREENINFO, &vinfo)) { + perror("QLinuxFbScreen::initDevice"); + qFatal("Error reading variable information in card init"); + return false; + } + +#ifdef DEBUG_VINFO + qDebug("Greyscale %d",vinfo.grayscale); + qDebug("Nonstd %d",vinfo.nonstd); + qDebug("Red %d %d %d",vinfo.red.offset,vinfo.red.length, + vinfo.red.msb_right); + qDebug("Green %d %d %d",vinfo.green.offset,vinfo.green.length, + vinfo.green.msb_right); + qDebug("Blue %d %d %d",vinfo.blue.offset,vinfo.blue.length, + vinfo.blue.msb_right); + qDebug("Transparent %d %d %d",vinfo.transp.offset,vinfo.transp.length, + vinfo.transp.msb_right); +#endif + + d_ptr->startupw=vinfo.xres; + d_ptr->startuph=vinfo.yres; + d_ptr->startupd=vinfo.bits_per_pixel; + grayscale = vinfo.grayscale; + + if (ioctl(d_ptr->fd, FBIOGET_FSCREENINFO, &finfo)) { + perror("QLinuxFbScreen::initDevice"); + qCritical("Error reading fixed information in card init"); + // It's not an /error/ as such, though definitely a bad sign + // so we return true + return true; + } + +#ifdef __i386__ + // Now init mtrr + if(!::getenv("QWS_NOMTRR")) { + int mfd=QT_OPEN("/proc/mtrr",O_WRONLY,0); + // MTRR entry goes away when file is closed - i.e. + // hopefully when QWS is killed + if(mfd != -1) { + mtrr_sentry sentry; + sentry.base=(unsigned long int)finfo.smem_start; + //qDebug("Physical framebuffer address %p",(void*)finfo.smem_start); + // Size needs to be in 4k chunks, but that's not always + // what we get thanks to graphics card registers. Write combining + // these is Not Good, so we write combine what we can + // (which is not much - 4 megs on an 8 meg card, it seems) + unsigned int size=finfo.smem_len; + size=size >> 22; + size=size << 22; + sentry.size=size; + sentry.type=MTRR_TYPE_WRCOMB; + if(ioctl(mfd,MTRRIOC_ADD_ENTRY,&sentry)==-1) { + //printf("Couldn't add mtrr entry for %lx %lx, %s\n", + //sentry.base,sentry.size,strerror(errno)); + } + } + + // Should we close mfd here? + //QT_CLOSE(mfd); + } +#endif + if ((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4) || (finfo.visual==FB_VISUAL_DIRECTCOLOR)) + { + fb_cmap cmap; + createPalette(cmap, vinfo, finfo); + if (ioctl(d_ptr->fd, FBIOPUTCMAP, &cmap)) { + perror("QLinuxFbScreen::initDevice"); + qWarning("Error writing palette to framebuffer"); + } + free(cmap.red); + free(cmap.green); + free(cmap.blue); + free(cmap.transp); + } + +#if 0 + if (canaccel) { + *entryp=0; + *lowest = mapsize; + insert_entry(*entryp, *lowest, *lowest); // dummy entry to mark start + } + + shared->fifocount = 0; + shared->buffer_offset = 0xffffffff; // 0 would be a sensible offset (screen) + shared->linestep = 0; + shared->cliptop = 0xffffffff; + shared->clipleft = 0xffffffff; + shared->clipright = 0xffffffff; + shared->clipbottom = 0xffffffff; + shared->rop = 0xffffffff; +#endif + +#ifdef QT_QWS_DEPTH_GENERIC + if (pixelFormat() == QImage::Format_Invalid && screencols == 0 + && d_ptr->doGenericColors) + { + qt_set_generic_blit(this, vinfo.bits_per_pixel, + vinfo.red.length, vinfo.green.length, + vinfo.blue.length, vinfo.transp.length, + vinfo.red.offset, vinfo.green.offset, + vinfo.blue.offset, vinfo.transp.offset); + } +#endif + +#if 0 +#ifndef QT_NO_QWS_CURSOR + QScreenCursor::initSoftwareCursor(); +#endif +#endif + blank(false); + + return true; +} + +void QLinuxFbGraphicsSystem::setPixelFormat(struct fb_var_screeninfo info) +{ + const fb_bitfield rgba[4] = { info.red, info.green, + info.blue, info.transp }; + + QImage::Format format = QImage::Format_Invalid; + + switch (d) { + case 32: { + const fb_bitfield argb8888[4] = {{16, 8, 0}, {8, 8, 0}, + {0, 8, 0}, {24, 8, 0}}; + const fb_bitfield abgr8888[4] = {{0, 8, 0}, {8, 8, 0}, + {16, 8, 0}, {24, 8, 0}}; + if (memcmp(rgba, argb8888, 4 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_ARGB32; + } else if (memcmp(rgba, argb8888, 3 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_RGB32; + } else if (memcmp(rgba, abgr8888, 3 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_RGB32; + pixeltype = BGRPixel; + } + break; + } + case 24: { + const fb_bitfield rgb888[4] = {{16, 8, 0}, {8, 8, 0}, + {0, 8, 0}, {0, 0, 0}}; + const fb_bitfield bgr888[4] = {{0, 8, 0}, {8, 8, 0}, + {16, 8, 0}, {0, 0, 0}}; + if (memcmp(rgba, rgb888, 3 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_RGB888; + } else if (memcmp(rgba, bgr888, 3 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_RGB888; + pixeltype = BGRPixel; + } + break; + } + case 18: { + const fb_bitfield rgb666[4] = {{12, 6, 0}, {6, 6, 0}, + {0, 6, 0}, {0, 0, 0}}; + if (memcmp(rgba, rgb666, 3 * sizeof(fb_bitfield)) == 0) + format = QImage::Format_RGB666; + break; + } + case 16: { + const fb_bitfield rgb565[4] = {{11, 5, 0}, {5, 6, 0}, + {0, 5, 0}, {0, 0, 0}}; + const fb_bitfield bgr565[4] = {{0, 5, 0}, {5, 6, 0}, + {11, 5, 0}, {0, 0, 0}}; + if (memcmp(rgba, rgb565, 3 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_RGB16; + } else if (memcmp(rgba, bgr565, 3 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_RGB16; + pixeltype = BGRPixel; + } + break; + } + case 15: { + const fb_bitfield rgb1555[4] = {{10, 5, 0}, {5, 5, 0}, + {0, 5, 0}, {15, 1, 0}}; + const fb_bitfield bgr1555[4] = {{0, 5, 0}, {5, 5, 0}, + {10, 5, 0}, {15, 1, 0}}; + if (memcmp(rgba, rgb1555, 3 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_RGB555; + } else if (memcmp(rgba, bgr1555, 3 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_RGB555; + pixeltype = BGRPixel; + } + break; + } + case 12: { + const fb_bitfield rgb444[4] = {{8, 4, 0}, {4, 4, 0}, + {0, 4, 0}, {0, 0, 0}}; + if (memcmp(rgba, rgb444, 3 * sizeof(fb_bitfield)) == 0) + format = QImage::Format_RGB444; + break; + } + case 8: + break; + case 1: + format = QImage::Format_Mono; //###: LSB??? + break; + default: + break; + } + + screenFormat = format; +} + +void QLinuxFbGraphicsSystem::createPalette(fb_cmap &cmap, fb_var_screeninfo &vinfo, fb_fix_screeninfo &finfo) +{ + if((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4)) { + screencols= (vinfo.bits_per_pixel==8) ? 256 : 16; + cmap.start=0; + cmap.len=screencols; + cmap.red=(unsigned short int *) + malloc(sizeof(unsigned short int)*screencols); + cmap.green=(unsigned short int *) + malloc(sizeof(unsigned short int)*screencols); + cmap.blue=(unsigned short int *) + malloc(sizeof(unsigned short int)*screencols); + cmap.transp=(unsigned short int *) + malloc(sizeof(unsigned short int)*screencols); + + if (screencols==16) { + if (finfo.type == FB_TYPE_PACKED_PIXELS) { + // We'll setup a grayscale cmap for 4bpp linear + int val = 0; + for (int idx = 0; idx < 16; ++idx, val += 17) { + cmap.red[idx] = (val<<8)|val; + cmap.green[idx] = (val<<8)|val; + cmap.blue[idx] = (val<<8)|val; + screenclut[idx]=qRgb(val, val, val); + } + } else { + // Default 16 colour palette + // Green is now trolltech green so certain images look nicer + // black d_gray l_gray white red green blue cyan magenta yellow + unsigned char reds[16] = { 0x00, 0x7F, 0xBF, 0xFF, 0xFF, 0xA2, 0x00, 0xFF, 0xFF, 0x00, 0x7F, 0x7F, 0x00, 0x00, 0x00, 0x82 }; + unsigned char greens[16] = { 0x00, 0x7F, 0xBF, 0xFF, 0x00, 0xC5, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F }; + unsigned char blues[16] = { 0x00, 0x7F, 0xBF, 0xFF, 0x00, 0x11, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0x7F, 0x7F, 0x7F, 0x00, 0x00 }; + + for (int idx = 0; idx < 16; ++idx) { + cmap.red[idx] = ((reds[idx]) << 8)|reds[idx]; + cmap.green[idx] = ((greens[idx]) << 8)|greens[idx]; + cmap.blue[idx] = ((blues[idx]) << 8)|blues[idx]; + cmap.transp[idx] = 0; + screenclut[idx]=qRgb(reds[idx], greens[idx], blues[idx]); + } + } + } else { + if (grayscale) { + // Build grayscale palette + int i; + for(i=0;iblank == on) + return; + +#if defined(QT_QWS_IPAQ) + if (on) + system("apm -suspend"); +#else + if (d_ptr->fd == -1) + return; +// Some old kernel versions don't have this. These defines should go +// away eventually +#if defined(FBIOBLANK) +#if defined(VESA_POWERDOWN) && defined(VESA_NO_BLANKING) + ioctl(d_ptr->fd, FBIOBLANK, on ? VESA_POWERDOWN : VESA_NO_BLANKING); +#else + ioctl(d_ptr->fd, FBIOBLANK, on ? 1 : 0); +#endif +#endif +#endif + + d_ptr->blank = on; +} + +QPixmapData *QLinuxFbGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const +{ + return new QRasterPixmapData(type); +} + +QWindowSurface *QLinuxFbGraphicsSystem::createWindowSurface(QWidget *widget) const +{ + if (widget->windowType() == Qt::Desktop) + return 0; // Don't create an explicit window surface for the destkop. + QGraphicsSystemFbWindowSurface * surface = + new QGraphicsSystemFbWindowSurface(mPrimaryScreen, widget); + mPrimaryScreen->addWindowSurface(surface); + return surface; +} + +QLinuxFbGraphicsSystemScreen::QLinuxFbGraphicsSystemScreen(uchar * d, int w, + int h, int lstep, QImage::Format screenFormat) : compositePainter(0) +{ + data = d; + mGeometry = QRect(0,0,w,h); + bytesPerLine = lstep; + mFormat = screenFormat; + mDepth = 16; + mScreenImage = new QImage(mGeometry.width(), mGeometry.height(), + mFormat); + mFbScreenImage = new QImage(data, mGeometry.width(), mGeometry.height(), + bytesPerLine, mFormat); + cursor = new QGraphicsSystemSoftwareCursor(this); +} + +void QLinuxFbGraphicsSystemScreen::setGeometry(QRect rect) +{ + mGeometry = rect; + delete mFbScreenImage; + mFbScreenImage = new QImage(data, mGeometry.width(), mGeometry.height(), + bytesPerLine, mFormat); + delete compositePainter; + compositePainter = 0; + + delete mScreenImage; + mScreenImage = new QImage(mGeometry.width(), mGeometry.height(), + mFormat); +} + +void QLinuxFbGraphicsSystemScreen::setFormat(QImage::Format format) +{ + mFormat = format; + delete mFbScreenImage; + mFbScreenImage = new QImage(data, mGeometry.width(), mGeometry.height(), + bytesPerLine, mFormat); + delete compositePainter; + compositePainter = 0; + + delete mScreenImage; + mScreenImage = new QImage(mGeometry.width(), mGeometry.height(), + mFormat); +} + +QRegion QLinuxFbGraphicsSystemScreen::doRedraw() +{ + QRegion touched; + touched = QGraphicsSystemFbScreen::doRedraw(); + + if (!compositePainter) { + compositePainter = new QPainter(mFbScreenImage); + } + + QVector rects = touched.rects(); + for (int i = 0; i < rects.size(); i++) + compositePainter->drawImage(rects[i], *mScreenImage, rects[i]); + return touched; +} +QT_END_NAMESPACE diff --git a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h new file mode 100644 index 0000000..cc8ce7e --- /dev/null +++ b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_LINUXFB_H +#define QGRAPHICSSYSTEM_LINUXFB_H + +#include +#include "../fb_base/fb_base.h" + +QT_BEGIN_NAMESPACE + +class QLinuxFbGraphicsSystemScreen : public QGraphicsSystemFbScreen +{ +public: + QLinuxFbGraphicsSystemScreen(uchar * d, int w, int h, int lstep, QImage::Format screenFormat); + void setGeometry(QRect rect); + void setFormat(QImage::Format format); + +public slots: + QRegion doRedraw(); + +private: + QImage * mFbScreenImage; + uchar * data; + int bytesPerLine; + + QPainter *compositePainter; +}; + +class QLinuxFbGraphicsSystemPrivate; +struct fb_cmap; +struct fb_var_screeninfo; +struct fb_fix_screeninfo; + +class QLinuxFbGraphicsSystem : public QGraphicsSystem +{ +public: + QLinuxFbGraphicsSystem(); + ~QLinuxFbGraphicsSystem(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QWindowSurface *createWindowSurface(QWidget *widget) const; + + QList screens() const { return mScreens; } + +private: + QLinuxFbGraphicsSystemScreen *mPrimaryScreen; + QList mScreens; + QLinuxFbGraphicsSystemPrivate *d_ptr; + + enum PixelType { NormalPixel, BGRPixel }; + + QRgb screenclut[256]; + int screencols; + + uchar * data; + + QImage::Format screenFormat; + int w; + int lstep; + int h; + int d; + PixelType pixeltype; + bool grayscale; + + int dw; + int dh; + + int size; // Screen size + int mapsize; // Total mapped memory + + int displayId; + + int physWidth; + int physHeight; + + bool canaccel; + int dataoffset; + int cacheStart; + + bool connect(const QString &displaySpec); + bool initDevice(); + void setPixelFormat(struct fb_var_screeninfo); + void createPalette(fb_cmap &cmap, fb_var_screeninfo &vinfo, fb_fix_screeninfo &finfo); + void blank(bool on); +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/minimal/main.cpp b/src/plugins/platforms/minimal/main.cpp new file mode 100644 index 0000000..44c274b --- /dev/null +++ b/src/plugins/platforms/minimal/main.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qplatformintegration_minimal.h" + +QT_BEGIN_NAMESPACE + +class QMinimalIntegrationPlugin : public QPlatformIntegrationPlugin +{ +public: + QStringList keys() const; + QPlatformIntegration *create(const QString&); +}; + +QStringList QMinimalIntegrationPlugin::keys() const +{ + QStringList list; + list << "Minimal"; + return list; +} + +QPlatformIntegration *QMinimalIntegrationPlugin::create(const QString& system) +{ + if (system.toLower() == "minimal") + return new QMinimalIntegration; + + return 0; +} + +Q_EXPORT_PLUGIN2(minimal, QMinimalIntegrationPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/minimal/minimal.pro b/src/plugins/platforms/minimal/minimal.pro new file mode 100644 index 0000000..567b551 --- /dev/null +++ b/src/plugins/platforms/minimal/minimal.pro @@ -0,0 +1,13 @@ +TARGET = qminimalgraphicssystem +include(../../qpluginbase.pri) + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms + +SOURCES = main.cpp \ + qplatformintegration_minimal.cpp \ + qwindowsurface_minimal.cpp +HEADERS = qplatformintegration_minimal.h \ + qwindowsurface_minimal.h + +target.path += $$[QT_INSTALL_PLUGINS]/platforms +INSTALLS += target diff --git a/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp b/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp new file mode 100644 index 0000000..693e0c3 --- /dev/null +++ b/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp @@ -0,0 +1,25 @@ +#include "qplatformintegration_minimal.h" +#include "qwindowsurface_minimal.h" + +#include + +QMinimalIntegration::QMinimalIntegration() +{ + QMinimalScreen *mPrimaryScreen = new QMinimalScreen(); + + mPrimaryScreen->mGeometry = QRect(0, 0, 240, 320); + mPrimaryScreen->mDepth = 16; + mPrimaryScreen->mFormat = QImage::Format_RGB16; + mPrimaryScreen->mPhysicalSize = QSize(40, 54); + + mScreens.append(mPrimaryScreen); +} + +QPixmapData *QMinimalIntegration::createPixmapData(QPixmapData::PixelType type) const +{ + return new QRasterPixmapData(type); +} +QWindowSurface *QMinimalIntegration::createWindowSurface(QWidget *widget) const +{ + return new QMinimalWindowSurface(widget); +} diff --git a/src/plugins/platforms/minimal/qplatformintegration_minimal.h b/src/plugins/platforms/minimal/qplatformintegration_minimal.h new file mode 100644 index 0000000..d4eb78b --- /dev/null +++ b/src/plugins/platforms/minimal/qplatformintegration_minimal.h @@ -0,0 +1,85 @@ + +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMINTEGRATION_MINIMAL_H +#define QPLATFORMINTEGRATION_MINIMAL_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QMinimalScreen : public QPlatformScreen +{ +public: + QMinimalScreen() + : mDepth(16), mFormat(QImage::Format_RGB16) {} + + QRect geometry() const { return mGeometry; } + int depth() const { return mDepth; } + QImage::Format format() const { return mFormat; } + QSize physicalSize() const { return mPhysicalSize; } + +public: + QRect mGeometry; + int mDepth; + QImage::Format mFormat; + QSize mPhysicalSize; +}; + +class QMinimalIntegration : public QPlatformIntegration +{ +public: + QMinimalIntegration(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QWindowSurface *createWindowSurface(QWidget *widget) const; + + QList screens() const { return mScreens; } + +private: + QList mScreens; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/minimal/qwindowsurface_minimal.cpp b/src/plugins/platforms/minimal/qwindowsurface_minimal.cpp new file mode 100644 index 0000000..0b2bdd2 --- /dev/null +++ b/src/plugins/platforms/minimal/qwindowsurface_minimal.cpp @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsurface_minimal.h" +#include +#include + +QT_BEGIN_NAMESPACE + +QMinimalWindowSurface::QMinimalWindowSurface(QWidget *window) + : QWindowSurface(window) +{ + //qDebug() << "QMinimalWindowSurface::QMinimalWindowSurface:" << (long)this; +} + +QMinimalWindowSurface::~QMinimalWindowSurface() +{ +} + +QPaintDevice *QMinimalWindowSurface::paintDevice() +{ + //qDebug() << "QMinimalWindowSurface::paintDevice"; + return &mImage; +} + +void QMinimalWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + Q_UNUSED(region); + Q_UNUSED(offset); + + static int c = 0; + QString filename = QString("output%1.png").arg(c++, 4, 10, QLatin1Char('0')); + qDebug() << "QMinimalWindowSurface::flush() saving contents to" << filename.toLocal8Bit().constData(); + mImage.save(filename); +} + +void QMinimalWindowSurface::setGeometry(const QRect &rect) +{ + //qDebug() << "QMinimalWindowSurface::setGeometry:" << (long)this << rect; + QWindowSurface::setGeometry(rect); + QImage::Format format = QApplicationPrivate::platformIntegration()->screens().first()->format(); + if (mImage.size() != rect.size()) + mImage = QImage(rect.size(), format); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/minimal/qwindowsurface_minimal.h b/src/plugins/platforms/minimal/qwindowsurface_minimal.h new file mode 100644 index 0000000..959a731 --- /dev/null +++ b/src/plugins/platforms/minimal/qwindowsurface_minimal.h @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSURFACE_MINIMAL_H +#define QWINDOWSURFACE_MINIMAL_H + +#include + +QT_BEGIN_NAMESPACE + +class QMinimalWindowSurface : public QWindowSurface +{ +public: + QMinimalWindowSurface(QWidget *window); + ~QMinimalWindowSurface(); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void setGeometry(const QRect &rect); + +private: + QImage mImage; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/minimaldfb/main.cpp b/src/plugins/platforms/minimaldfb/main.cpp new file mode 100644 index 0000000..fe9407c --- /dev/null +++ b/src/plugins/platforms/minimaldfb/main.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qgraphicssystem_minimaldfb.h" + +QT_BEGIN_NAMESPACE + +class QDirectFbGraphicsSystemPlugin : public QGraphicsSystemPlugin +{ +public: + QStringList keys() const; + QGraphicsSystem *create(const QString&); +}; + +QStringList QDirectFbGraphicsSystemPlugin::keys() const +{ + QStringList list; + list << "MinimalDfb"; + return list; +} + +QGraphicsSystem* QDirectFbGraphicsSystemPlugin::create(const QString& system) +{ + if (system.toLower() == "minimaldfb") + return new QDirectFbGraphicsSystem; + + return 0; +} + +Q_EXPORT_PLUGIN2(directfb, QDirectFbGraphicsSystemPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/minimaldfb/minimaldfb.pro b/src/plugins/platforms/minimaldfb/minimaldfb.pro new file mode 100644 index 0000000..b6c2ea8 --- /dev/null +++ b/src/plugins/platforms/minimaldfb/minimaldfb.pro @@ -0,0 +1,29 @@ +TARGET = qminimaldfb +include(../../qpluginbase.pri) +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems + +isEmpty(DIRECTFB_LIBS) { + DIRECTFB_LIBS = -ldirectfb -lfusion -ldirect -lpthread +} +isEmpty(DIRECTFB_INCLUDEPATH) { + DIRECTFB_INCLUDEPATH = /usr/include/directfb +} + +INCLUDEPATH += $$DIRECTFB_INCLUDEPATH +LIBS += $$DIRECTFB_LIBS + +SOURCES = main.cpp \ + qgraphicssystem_minimaldfb.cpp \ + qwindowsurface_minimaldfb.cpp \ + qblitter_directfb.cpp \ + qdirectfbconvenience.cpp \ + qdirectfbinput.cpp \ + qdirectfbcursor.cpp +HEADERS = qgraphicssystem_minimaldfb.h \ + qwindowsurface_minimaldfb.h \ + qblitter_directfb.h \ + qdirectfbconvenience.h \ + qdirectfbinput.h \ + qdirectfbcursor.h +target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +INSTALLS += target diff --git a/src/plugins/platforms/minimaldfb/qblitter_directfb.cpp b/src/plugins/platforms/minimaldfb/qblitter_directfb.cpp new file mode 100644 index 0000000..070c563 --- /dev/null +++ b/src/plugins/platforms/minimaldfb/qblitter_directfb.cpp @@ -0,0 +1,110 @@ +#include "qblitter_directfb.h" +#include "qgraphicssystem_minimaldfb.h" +#include "qdirectfbconvenience.h" + +#include + +#include + +#include + +QDirectFbBlitter::QDirectFbBlitter(const QSize &rect, IDirectFBSurface *surface) + : QBlittable(rect, QBlittable::Capabilities(QBlittable::SolidRectCapability + |QBlittable::SourcePixmapCapability + |QBlittable::SourceOverPixmapCapability + |QBlittable::SourceOverScaledPixmapCapability)) +{ + if (surface) { + m_surface = surface; + } else { + DFBSurfaceDescription surfaceDesc; + memset(&surfaceDesc,0,sizeof(DFBSurfaceDescription)); + surfaceDesc.width = rect.width(); + surfaceDesc.height = rect.height(); + surfaceDesc.caps = DSCAPS_PREMULTIPLIED; + surfaceDesc.pixelformat = DSPF_ARGB; + surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_CAPS | DSDESC_PIXELFORMAT); + + IDirectFB *dfb = QDirectFbConvenience::dfbInterface(); + dfb->CreateSurface(dfb,&surfaceDesc, &m_surface); + m_surface->Clear(m_surface,0,0,0,0); + } +} + +QDirectFbBlitter::~QDirectFbBlitter() +{ + unlock(); + m_surface->Release(m_surface); +} + +void QDirectFbBlitter::fillRect(const QRectF &rect, const QColor &color) +{ + m_surface->SetColor(m_surface, color.red(), color.green(), color.blue(), color.alpha()); +// When the blitter api supports non opaque blits, also remember to change +// qpixmap_blitter.cpp::fill +// DFBSurfaceDrawingFlags drawingFlags = color.alpha() ? DSDRAW_BLEND : DSDRAW_NOFX; +// m_surface->SetDrawingFlags(m_surface, drawingFlags); + m_surface->SetDrawingFlags(m_surface, DSDRAW_NOFX); + m_surface->FillRectangle(m_surface, rect.x(), rect.y(), + rect.width(), rect.height()); +} + +void QDirectFbBlitter::drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &srcRect) +{ + QPixmapData *data = pixmap.pixmapData(); + Q_ASSERT(data->width() && data->height()); + Q_ASSERT(data->classId() == QPixmapData::BlitterClass); + QBlittablePixmapData *blitPm = static_cast(data); + QDirectFbBlitter *dfbBlitter = static_cast(blitPm->blittable()); + dfbBlitter->unlock(); + + IDirectFBSurface *s = dfbBlitter->m_surface; + + quint32 blittingFlags = pixmap.hasAlpha()? DSBLIT_BLEND_ALPHACHANNEL : DSBLIT_NOFX; + + s->SetBlittingFlags(s, DFBSurfaceBlittingFlags(blittingFlags)); + m_surface->SetBlittingFlags(m_surface, DFBSurfaceBlittingFlags(blittingFlags)); + m_surface->SetPorterDuff(m_surface,DSPD_SRC_OVER); + m_surface->SetDstBlendFunction(m_surface,DSBF_INVSRCALPHA); + + const DFBRectangle sRect = { srcRect.x(), srcRect.y(), rect.width(), rect.height() }; + + DFBResult result; + if (rect.width() == srcRect.width() && rect.height() == srcRect.height()) + result = m_surface->Blit(m_surface, s, &sRect, rect.x(), rect.y()); + else { + const DFBRectangle dRect = { rect.x(), rect.y(), rect.width(), rect.height() }; + result = m_surface->StretchBlit(m_surface, s, &sRect, &dRect); + } + if (result != DFB_OK) + DirectFBError("QDirectFBBlitter::drawPixmap()", result); +} + +QImage *QDirectFbBlitter::doLock() +{ + Q_ASSERT(m_surface); + Q_ASSERT(size().isValid()); + + void *mem; + int bpl; + const DFBResult result = m_surface->Lock(m_surface, DFBSurfaceLockFlags(DSLF_WRITE|DSLF_READ), static_cast(&mem), &bpl); + if (result == DFB_OK) { + DFBSurfacePixelFormat dfbFormat; + DFBSurfaceCapabilities dfbCaps; + m_surface->GetPixelFormat(m_surface,&dfbFormat); + m_surface->GetCapabilities(m_surface,&dfbCaps); + QImage::Format format = QDirectFbConvenience::imageFormatFromSurfaceFormat(dfbFormat, dfbCaps); + int w, h; + m_surface->GetSize(m_surface,&w,&h); + m_image = QImage(static_cast(mem),w,h,bpl,format); + } else { + DirectFBError("Failed to lock image", result); + } + + return &m_image; +} + +void QDirectFbBlitter::doUnlock() +{ + m_surface->Unlock(m_surface); +} diff --git a/src/plugins/platforms/minimaldfb/qblitter_directfb.h b/src/plugins/platforms/minimaldfb/qblitter_directfb.h new file mode 100644 index 0000000..85a303a --- /dev/null +++ b/src/plugins/platforms/minimaldfb/qblitter_directfb.h @@ -0,0 +1,29 @@ +#ifndef QDIRECTFBBLITTER_H +#define QDIRECTFBBLITTER_H + +#include "qdirectfbconvenience.h" + +#include + +#include + +class QDirectFbBlitter : public QBlittable +{ +public: + QDirectFbBlitter(const QSize &size, IDirectFBSurface *surface = 0); + virtual ~QDirectFbBlitter(); + + virtual void fillRect(const QRectF &rect, const QColor &color); + virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect); + +protected: + virtual QImage *doLock(); + virtual void doUnlock(); + + IDirectFBSurface *m_surface; + QImage m_image; + + friend class QDirectFbConvenience; +}; + +#endif // QDIRECTFBBLITTER_H diff --git a/src/plugins/platforms/minimaldfb/qdirectfbconvenience.cpp b/src/plugins/platforms/minimaldfb/qdirectfbconvenience.cpp new file mode 100644 index 0000000..8594c09 --- /dev/null +++ b/src/plugins/platforms/minimaldfb/qdirectfbconvenience.cpp @@ -0,0 +1,335 @@ +#include "qdirectfbconvenience.h" +#include "qblitter_directfb.h" + +#include + +IDirectFB *QDirectFbConvenience::dfbInterface() +{ + static IDirectFB *dfb = 0; + if (!dfb) { + DFBResult result = DirectFBCreate(&dfb); + if (result != DFB_OK) { + DirectFBError("QDirectFBConvenience: error creating DirectFB interface",result); + return 0; + } + } + return dfb; +} + +IDirectFBDisplayLayer *QDirectFbConvenience::dfbDisplayLayer(int display) +{ + IDirectFBDisplayLayer *layer; + DFBResult result = QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),display,&layer); + if (result != DFB_OK) { + DirectFBError("QDirectFbConvenience: " + "Unable to get primary display layer!", result); + } + return layer; +} + +QImage::Format QDirectFbConvenience::imageFormatFromSurfaceFormat(const DFBSurfacePixelFormat format, const DFBSurfaceCapabilities caps) +{ + switch (format) { + case DSPF_LUT8: + return QImage::Format_Indexed8; + case DSPF_RGB24: + return QImage::Format_RGB888; + case DSPF_ARGB4444: + return QImage::Format_ARGB4444_Premultiplied; + case DSPF_RGB444: + return QImage::Format_RGB444; + case DSPF_RGB555: + case DSPF_ARGB1555: + return QImage::Format_RGB555; + case DSPF_RGB16: + return QImage::Format_RGB16; + case DSPF_ARGB6666: + return QImage::Format_ARGB6666_Premultiplied; + case DSPF_RGB18: + return QImage::Format_RGB666; + case DSPF_RGB32: + return QImage::Format_RGB32; + case DSPF_ARGB: { + if (caps & DSCAPS_PREMULTIPLIED) + return QImage::Format_ARGB32_Premultiplied; + else return QImage::Format_ARGB32; } + default: + break; + } + return QImage::Format_Invalid; + +} + +int QDirectFbConvenience::colorDepthForSurface(const DFBSurfacePixelFormat format) +{ + return ((0x1f << 7) & format) >> 7; +} + +IDirectFBSurface *QDirectFbConvenience::dfbSurfaceForPixmapData(QPixmapData *pixmapData) +{ + QBlittablePixmapData *blittablePmData = static_cast(pixmapData); + if (blittablePmData) { + QBlittable *blittable = blittablePmData->blittable(); + QDirectFbBlitter *dfbBlitter = static_cast(blittable); + return dfbBlitter->m_surface; + } + return 0; +} + +Qt::MouseButton QDirectFbConvenience::mouseButton(DFBInputDeviceButtonIdentifier identifier) +{ + switch (identifier){ + case DIBI_LEFT: + return Qt::LeftButton; + case DIBI_MIDDLE: + return Qt::MidButton; + case DIBI_RIGHT: + return Qt::RightButton; + default: + return Qt::NoButton; + } +} + +Qt::MouseButtons QDirectFbConvenience::mouseButtons(DFBInputDeviceButtonMask mask) +{ + Qt::MouseButtons buttons = Qt::NoButton; + + if (mask & DIBM_LEFT) { + buttons |= Qt::LeftButton; + } + if (mask & DIBM_MIDDLE) { + buttons |= Qt::MidButton; + } + if (mask & DIBM_RIGHT) { + buttons |= Qt::RightButton; + } + return buttons; +} + +Qt::KeyboardModifiers QDirectFbConvenience::keyboardModifiers(DFBInputDeviceModifierMask mask) +{ + Qt::KeyboardModifiers modifiers = Qt::NoModifier; + + if (mask & DIMM_SHIFT) { + modifiers |= Qt::ShiftModifier; + } + if (mask & DIMM_ALT) { + modifiers |= Qt::AltModifier; + } + if (mask & DIMM_ALTGR) { + modifiers |= Qt::MetaModifier; + } + if (mask & DIMM_CONTROL) { + modifiers |= Qt::ControlModifier; + } + if (mask & DIMM_META) { + modifiers | Qt::MetaModifier; + } + return modifiers; +} + +QEvent::Type QDirectFbConvenience::eventType(DFBWindowEventType type) +{ + switch(type) { + case DWET_BUTTONDOWN: + return QEvent::MouseButtonPress; + case DWET_BUTTONUP: + return QEvent::MouseButtonRelease; + case DWET_MOTION: + return QEvent::MouseMove; + case DWET_WHEEL: + return QEvent::Wheel; + case DWET_KEYDOWN: + return QEvent::KeyPress; + case DWET_KEYUP: + return QEvent::KeyRelease; + default: + return QEvent::None; + } +} +QDirectFbKeyMap *QDirectFbConvenience::dfbKeymap = 0; +QDirectFbKeyMap *QDirectFbConvenience::keyMap() +{ + if (!dfbKeymap) + dfbKeymap = new QDirectFbKeyMap(); + return dfbKeymap; +} + +QDirectFbKeyMap::QDirectFbKeyMap() +{ + insert(DIKS_BACKSPACE , Qt::Key_Backspace); + insert(DIKS_TAB , Qt::Key_Tab); + insert(DIKS_RETURN , Qt::Key_Return); + insert(DIKS_ESCAPE , Qt::Key_Escape); + insert(DIKS_DELETE , Qt::Key_Delete); + + insert(DIKS_CURSOR_LEFT , Qt::Key_Left); + insert(DIKS_CURSOR_RIGHT , Qt::Key_Right); + insert(DIKS_CURSOR_UP , Qt::Key_Up); + insert(DIKS_CURSOR_DOWN , Qt::Key_Down); + insert(DIKS_INSERT , Qt::Key_Insert); + insert(DIKS_HOME , Qt::Key_Home); + insert(DIKS_END , Qt::Key_End); + insert(DIKS_PAGE_UP , Qt::Key_PageUp); + insert(DIKS_PAGE_DOWN , Qt::Key_PageDown); + insert(DIKS_PRINT , Qt::Key_Print); + insert(DIKS_PAUSE , Qt::Key_Pause); + insert(DIKS_SELECT , Qt::Key_Select); + insert(DIKS_GOTO , Qt::Key_OpenUrl); + insert(DIKS_CLEAR , Qt::Key_Clear); + insert(DIKS_MENU , Qt::Key_Menu); + insert(DIKS_HELP , Qt::Key_Help); + + insert(DIKS_INTERNET , Qt::Key_HomePage); + insert(DIKS_MAIL , Qt::Key_LaunchMail); + insert(DIKS_FAVORITES , Qt::Key_Favorites); + + insert(DIKS_BACK , Qt::Key_Back); + insert(DIKS_FORWARD , Qt::Key_Forward); + insert(DIKS_VOLUME_UP , Qt::Key_VolumeUp); + insert(DIKS_VOLUME_DOWN , Qt::Key_VolumeDown); + insert(DIKS_MUTE , Qt::Key_VolumeMute); + insert(DIKS_PLAYPAUSE , Qt::Key_Pause); + insert(DIKS_PLAY , Qt::Key_MediaPlay); + insert(DIKS_STOP , Qt::Key_MediaStop); + insert(DIKS_RECORD , Qt::Key_MediaRecord); + insert(DIKS_PREVIOUS , Qt::Key_MediaPrevious); + insert(DIKS_NEXT , Qt::Key_MediaNext); + + insert(DIKS_F1 , Qt::Key_F1); + insert(DIKS_F2 , Qt::Key_F2); + insert(DIKS_F3 , Qt::Key_F3); + insert(DIKS_F4 , Qt::Key_F4); + insert(DIKS_F5 , Qt::Key_F5); + insert(DIKS_F6 , Qt::Key_F6); + insert(DIKS_F7 , Qt::Key_F7); + insert(DIKS_F8 , Qt::Key_F8); + insert(DIKS_F9 , Qt::Key_F9); + insert(DIKS_F10 , Qt::Key_F10); + insert(DIKS_F11 , Qt::Key_F11); + insert(DIKS_F12 , Qt::Key_F12); + + insert(DIKS_SHIFT , Qt::Key_Shift); + insert(DIKS_CONTROL , Qt::Key_Control); + insert(DIKS_ALT , Qt::Key_Alt); + insert(DIKS_ALTGR , Qt::Key_AltGr); + + insert(DIKS_META , Qt::Key_Meta); + insert(DIKS_SUPER , Qt::Key_Super_L); // ??? + insert(DIKS_HYPER , Qt::Key_Hyper_L); // ??? + + insert(DIKS_CAPS_LOCK , Qt::Key_CapsLock); + insert(DIKS_NUM_LOCK , Qt::Key_NumLock); + insert(DIKS_SCROLL_LOCK , Qt::Key_ScrollLock); + + insert(DIKS_DEAD_ABOVEDOT , Qt::Key_Dead_Abovedot); + insert(DIKS_DEAD_ABOVERING , Qt::Key_Dead_Abovering); + insert(DIKS_DEAD_ACUTE , Qt::Key_Dead_Acute); + insert(DIKS_DEAD_BREVE , Qt::Key_Dead_Breve); + insert(DIKS_DEAD_CARON , Qt::Key_Dead_Caron); + insert(DIKS_DEAD_CEDILLA , Qt::Key_Dead_Cedilla); + insert(DIKS_DEAD_CIRCUMFLEX , Qt::Key_Dead_Circumflex); + insert(DIKS_DEAD_DIAERESIS , Qt::Key_Dead_Diaeresis); + insert(DIKS_DEAD_DOUBLEACUTE , Qt::Key_Dead_Doubleacute); + insert(DIKS_DEAD_GRAVE , Qt::Key_Dead_Grave); + insert(DIKS_DEAD_IOTA , Qt::Key_Dead_Iota); + insert(DIKS_DEAD_MACRON , Qt::Key_Dead_Macron); + insert(DIKS_DEAD_OGONEK , Qt::Key_Dead_Ogonek); + insert(DIKS_DEAD_SEMIVOICED_SOUND , Qt::Key_Dead_Semivoiced_Sound); + insert(DIKS_DEAD_TILDE , Qt::Key_Dead_Tilde); + insert(DIKS_DEAD_VOICED_SOUND , Qt::Key_Dead_Voiced_Sound); + insert(DIKS_SPACE , Qt::Key_Space); + insert(DIKS_EXCLAMATION_MARK , Qt::Key_Exclam); + insert(DIKS_QUOTATION , Qt::Key_QuoteDbl); + insert(DIKS_NUMBER_SIGN , Qt::Key_NumberSign); + insert(DIKS_DOLLAR_SIGN , Qt::Key_Dollar); + insert(DIKS_PERCENT_SIGN , Qt::Key_Percent); + insert(DIKS_AMPERSAND , Qt::Key_Ampersand); + insert(DIKS_APOSTROPHE , Qt::Key_Apostrophe); + insert(DIKS_PARENTHESIS_LEFT , Qt::Key_ParenLeft); + insert(DIKS_PARENTHESIS_RIGHT , Qt::Key_ParenRight); + insert(DIKS_ASTERISK , Qt::Key_Asterisk); + insert(DIKS_PLUS_SIGN , Qt::Key_Plus); + insert(DIKS_COMMA , Qt::Key_Comma); + insert(DIKS_MINUS_SIGN , Qt::Key_Minus); + insert(DIKS_PERIOD , Qt::Key_Period); + insert(DIKS_SLASH , Qt::Key_Slash); + insert(DIKS_0 , Qt::Key_0); + insert(DIKS_1 , Qt::Key_1); + insert(DIKS_2 , Qt::Key_2); + insert(DIKS_3 , Qt::Key_3); + insert(DIKS_4 , Qt::Key_4); + insert(DIKS_5 , Qt::Key_5); + insert(DIKS_6 , Qt::Key_6); + insert(DIKS_7 , Qt::Key_7); + insert(DIKS_8 , Qt::Key_8); + insert(DIKS_9 , Qt::Key_9); + insert(DIKS_COLON , Qt::Key_Colon); + insert(DIKS_SEMICOLON , Qt::Key_Semicolon); + insert(DIKS_LESS_THAN_SIGN , Qt::Key_Less); + insert(DIKS_EQUALS_SIGN , Qt::Key_Equal); + insert(DIKS_GREATER_THAN_SIGN , Qt::Key_Greater); + insert(DIKS_QUESTION_MARK , Qt::Key_Question); + insert(DIKS_AT , Qt::Key_At); + insert(DIKS_CAPITAL_A , Qt::Key_A); + insert(DIKS_CAPITAL_B , Qt::Key_B); + insert(DIKS_CAPITAL_C , Qt::Key_C); + insert(DIKS_CAPITAL_D , Qt::Key_D); + insert(DIKS_CAPITAL_E , Qt::Key_E); + insert(DIKS_CAPITAL_F , Qt::Key_F); + insert(DIKS_CAPITAL_G , Qt::Key_G); + insert(DIKS_CAPITAL_H , Qt::Key_H); + insert(DIKS_CAPITAL_I , Qt::Key_I); + insert(DIKS_CAPITAL_J , Qt::Key_J); + insert(DIKS_CAPITAL_K , Qt::Key_K); + insert(DIKS_CAPITAL_L , Qt::Key_L); + insert(DIKS_CAPITAL_M , Qt::Key_M); + insert(DIKS_CAPITAL_N , Qt::Key_N); + insert(DIKS_CAPITAL_O , Qt::Key_O); + insert(DIKS_CAPITAL_P , Qt::Key_P); + insert(DIKS_CAPITAL_Q , Qt::Key_Q); + insert(DIKS_CAPITAL_R , Qt::Key_R); + insert(DIKS_CAPITAL_S , Qt::Key_S); + insert(DIKS_CAPITAL_T , Qt::Key_T); + insert(DIKS_CAPITAL_U , Qt::Key_U); + insert(DIKS_CAPITAL_V , Qt::Key_V); + insert(DIKS_CAPITAL_W , Qt::Key_W); + insert(DIKS_CAPITAL_X , Qt::Key_X); + insert(DIKS_CAPITAL_Y , Qt::Key_Y); + insert(DIKS_CAPITAL_Z , Qt::Key_Z); + insert(DIKS_SQUARE_BRACKET_LEFT , Qt::Key_BracketLeft); + insert(DIKS_BACKSLASH , Qt::Key_Backslash); + insert(DIKS_SQUARE_BRACKET_RIGHT , Qt::Key_BracketRight); + insert(DIKS_CIRCUMFLEX_ACCENT , Qt::Key_AsciiCircum); + insert(DIKS_UNDERSCORE , Qt::Key_Underscore); + insert(DIKS_SMALL_A , Qt::Key_A); + insert(DIKS_SMALL_B , Qt::Key_B); + insert(DIKS_SMALL_C , Qt::Key_C); + insert(DIKS_SMALL_D , Qt::Key_D); + insert(DIKS_SMALL_E , Qt::Key_E); + insert(DIKS_SMALL_F , Qt::Key_F); + insert(DIKS_SMALL_G , Qt::Key_G); + insert(DIKS_SMALL_H , Qt::Key_H); + insert(DIKS_SMALL_I , Qt::Key_I); + insert(DIKS_SMALL_J , Qt::Key_J); + insert(DIKS_SMALL_K , Qt::Key_K); + insert(DIKS_SMALL_L , Qt::Key_L); + insert(DIKS_SMALL_M , Qt::Key_M); + insert(DIKS_SMALL_N , Qt::Key_N); + insert(DIKS_SMALL_O , Qt::Key_O); + insert(DIKS_SMALL_P , Qt::Key_P); + insert(DIKS_SMALL_Q , Qt::Key_Q); + insert(DIKS_SMALL_R , Qt::Key_R); + insert(DIKS_SMALL_S , Qt::Key_S); + insert(DIKS_SMALL_T , Qt::Key_T); + insert(DIKS_SMALL_U , Qt::Key_U); + insert(DIKS_SMALL_V , Qt::Key_V); + insert(DIKS_SMALL_W , Qt::Key_W); + insert(DIKS_SMALL_X , Qt::Key_X); + insert(DIKS_SMALL_Y , Qt::Key_Y); + insert(DIKS_SMALL_Z , Qt::Key_Z); + insert(DIKS_CURLY_BRACKET_LEFT , Qt::Key_BraceLeft); + insert(DIKS_VERTICAL_BAR , Qt::Key_Bar); + insert(DIKS_CURLY_BRACKET_RIGHT , Qt::Key_BraceRight); + insert(DIKS_TILDE , Qt::Key_AsciiTilde); +} diff --git a/src/plugins/platforms/minimaldfb/qdirectfbconvenience.h b/src/plugins/platforms/minimaldfb/qdirectfbconvenience.h new file mode 100644 index 0000000..0b1a24f --- /dev/null +++ b/src/plugins/platforms/minimaldfb/qdirectfbconvenience.h @@ -0,0 +1,43 @@ +#ifndef QDIRECTFBCONVENIENCE_H +#define QDIRECTFBCONVENIENCE_H + +#include +#include +#include +#include + +#include + +class QDirectFbKeyMap: public QHash +{ +public: + QDirectFbKeyMap(); +}; + + +class QDirectFbConvenience +{ +public: + static QImage::Format imageFormatFromSurfaceFormat(const DFBSurfacePixelFormat format, const DFBSurfaceCapabilities caps); + static bool pixelFomatHasAlpha(const DFBSurfacePixelFormat format) { return (1 << 16) & format; } + static int colorDepthForSurface(const DFBSurfacePixelFormat format); + + //This is set by the graphicssystem constructor + static IDirectFB *dfbInterface(); + static IDirectFBDisplayLayer *dfbDisplayLayer(int display = DLID_PRIMARY); + + static IDirectFBSurface *dfbSurfaceForPixmapData(QPixmapData *); + + static Qt::MouseButton mouseButton(DFBInputDeviceButtonIdentifier identifier); + static Qt::MouseButtons mouseButtons(DFBInputDeviceButtonMask mask); + static Qt::KeyboardModifiers keyboardModifiers(DFBInputDeviceModifierMask mask); + static QEvent::Type eventType(DFBWindowEventType type); + + static QDirectFbKeyMap *keyMap(); + +private: + static QDirectFbKeyMap *dfbKeymap; + friend class QDirectFbGraphicsSystem; +}; + +#endif // QDIRECTFBCONVENIENCE_H diff --git a/src/plugins/platforms/minimaldfb/qdirectfbcursor.cpp b/src/plugins/platforms/minimaldfb/qdirectfbcursor.cpp new file mode 100644 index 0000000..229a875 --- /dev/null +++ b/src/plugins/platforms/minimaldfb/qdirectfbcursor.cpp @@ -0,0 +1,42 @@ +#include "qdirectfbcursor.h" +#include "qblitter_directfb.h" +#include "qgraphicssystem_minimaldfb.h" +#include "qdirectfbconvenience.h" + +#include + +QDirectFBCursor::QDirectFBCursor(QGraphicsSystemScreen * screen) : + QGraphicsSystemCursor(screen), surface(0) +{ + QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),DLID_PRIMARY, &m_layer); + image = new QGraphicsSystemCursorImage(0, 0, 0, 0, 0, 0); +} + +void QDirectFBCursor::changeCursor(QCursor * cursor, QWidget * widget) +{ + Q_UNUSED(widget); + int xSpot; + int ySpot; + QPixmap map; + + if (cursor->shape() != Qt::BitmapCursor) { + image->set(cursor->shape()); + xSpot = image->hotspot().x(); + ySpot = image->hotspot().y(); + QImage *i = image->image(); + map = QPixmap::fromImage(*i); + } else { + QPoint point = cursor->hotSpot(); + xSpot = point.x(); + ySpot = point.y(); + map = cursor->pixmap(); + } + + IDirectFBSurface *surface = QDirectFbConvenience::dfbSurfaceForPixmapData(map.pixmapData()); + + if (m_layer->SetCooperativeLevel(m_layer, DLSCL_ADMINISTRATIVE) != DFB_OK) { + return; + } + m_layer->SetCursorShape( m_layer, surface, xSpot, ySpot); + m_layer->SetCooperativeLevel(m_layer, DLSCL_SHARED); +} diff --git a/src/plugins/platforms/minimaldfb/qdirectfbcursor.h b/src/plugins/platforms/minimaldfb/qdirectfbcursor.h new file mode 100644 index 0000000..064a336 --- /dev/null +++ b/src/plugins/platforms/minimaldfb/qdirectfbcursor.h @@ -0,0 +1,22 @@ +#ifndef QDIRECTFBCURSOR_H +#define QDIRECTFBCURSOR_H + +#include +#include +class QDirectFbGraphicsSystemScreen; +class QDirectFbBlitter; + +class QDirectFBCursor : public QGraphicsSystemCursor +{ +public: + QDirectFBCursor(QGraphicsSystemScreen *screem); + void changeCursor(QCursor * cursor, QWidget * widget); + +private: + IDirectFBDisplayLayer * m_layer; + IDirectFBSurface * surface; + QGraphicsSystemCursorImage * image; + QDirectFbBlitter *blitter; +}; + +#endif // QDIRECTFBCURSOR_H diff --git a/src/plugins/platforms/minimaldfb/qdirectfbinput.cpp b/src/plugins/platforms/minimaldfb/qdirectfbinput.cpp new file mode 100644 index 0000000..74a38a4 --- /dev/null +++ b/src/plugins/platforms/minimaldfb/qdirectfbinput.cpp @@ -0,0 +1,205 @@ +#include "qdirectfbinput.h" +#include "qdirectfbconvenience.h" + +#include +#include +#include +#include +#include +#include + +#include + +InputSocketWaiter::InputSocketWaiter(IDirectFBEventBuffer *eventBuffer, QObject *parent) + : QThread(parent), m_eventBuffer(eventBuffer),m_shouldStop(false) +{ + this->start(); +} + +InputSocketWaiter::~InputSocketWaiter() +{ + m_shouldStop = true; + m_eventBuffer->WakeUp(m_eventBuffer); + m_cleanupMutex.lock(); +} + +void InputSocketWaiter::continueWaitingForEvents() +{ + m_finishedProcessingEvents.wakeAll(); +} + +void InputSocketWaiter::run() +{ + m_cleanupMutex.lock(); + while (1) { + m_eventBuffer->WaitForEvent(m_eventBuffer); + if (m_shouldStop) + break; + emit newEvent(); + QMutex waitForProcessingMutex; + waitForProcessingMutex.lock(); + m_finishedProcessingEvents.wait(&waitForProcessingMutex); + } + m_cleanupMutex.unlock(); +} + +QDirectFbInput *QDirectFbInput::instance() +{ + static QDirectFbInput *input = 0; + if (!input) { + input = new QDirectFbInput(); + } + return input; +} + +QDirectFbInput::QDirectFbInput() + : QObject() +{ + dfbInterface = QDirectFbConvenience::dfbInterface(); + + DFBResult ok = dfbInterface->CreateEventBuffer(dfbInterface,&eventBuffer); + if (ok != DFB_OK) + DirectFBError("Failed to initialise eventbuffer", ok); + + dfbInterface->GetDisplayLayer(dfbInterface,DLID_PRIMARY, &dfbDisplayLayer); + + m_inputHandler = new InputSocketWaiter(eventBuffer,this); + connect(m_inputHandler,SIGNAL(newEvent()),this,SLOT(handleEvents())); + + connect(QApplication::instance(),SIGNAL(aboutToQuit()),SLOT(applicationEnd())); +} + +void QDirectFbInput::addWindow(DFBWindowID id, QWidget *tlw) +{ + tlwMap.insert(id,tlw); + IDirectFBWindow *window; + dfbDisplayLayer->GetWindow(dfbDisplayLayer,id,&window); + + window->AttachEventBuffer(window,eventBuffer); +} + +void QDirectFbInput::removeWindow(QWidget *tlw) +{ + DFBWindowID id = tlwMap.key(tlw,0); + if (id) { + IDirectFBWindow *window; + dfbDisplayLayer->GetWindow(dfbDisplayLayer,id, &window); + + window->DetachEventBuffer(window,eventBuffer); + tlwMap.remove(id); + } +} + +void QDirectFbInput::handleEvents() +{ + DFBResult hasEvent = eventBuffer->HasEvent(eventBuffer); + while(hasEvent == DFB_OK){ + DFBEvent event; + DFBResult ok = eventBuffer->GetEvent(eventBuffer,&event); + if (ok != DFB_OK) + DirectFBError("Failed to get event",ok); + if (event.clazz == DFEC_WINDOW) { + switch (event.window.type) { + case DWET_BUTTONDOWN: + case DWET_BUTTONUP: + case DWET_MOTION: + handleMouseEvents(event); + break; + case DWET_WHEEL: + handleWheelEvent(event); + break; + case DWET_KEYDOWN: + case DWET_KEYUP: + handleKeyEvents(event); + break; + case DWET_ENTER: + case DWET_LEAVE: + handleEnterLeaveEvents(event); + default: + break; + } + + } + + hasEvent = eventBuffer->HasEvent(eventBuffer); + } + m_inputHandler->continueWaitingForEvents(); +} + +void QDirectFbInput::handleMouseEvents(const DFBEvent &event) +{ + QPoint p(event.window.x, event.window.y); + QPoint globalPos = globalPoint(event); + Qt::MouseButtons buttons = QDirectFbConvenience::mouseButtons(event.window.buttons); + + IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); + IDirectFBWindow *window; + layer->GetWindow(layer,event.window.window_id,&window); + + long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000); + + if (event.window.type == DWET_BUTTONDOWN) { + window->GrabPointer(window); + } else if (event.window.type == DWET_BUTTONUP) { + window->UngrabPointer(window); + } + QWidget *tlw = tlwMap.value(event.window.window_id); + QWindowSystemInterface::handleMouseEvent(tlw, timestamp, p, globalPos, buttons); +} + +void QDirectFbInput::applicationEnd() +{ + delete m_inputHandler; + m_inputHandler = 0; +} + +void QDirectFbInput::handleWheelEvent(const DFBEvent &event) +{ + QPoint p(event.window.cx, event.window.cy); + QPoint globalPos = globalPoint(event); + long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000); + QWidget *tlw = tlwMap.value(event.window.window_id); + QWindowSystemInterface::handleWheelEvent(tlw, timestamp, p, globalPos, + event.window.step*120, + Qt::Vertical); +} + +void QDirectFbInput::handleKeyEvents(const DFBEvent &event) +{ + QEvent::Type type = QDirectFbConvenience::eventType(event.window.type); + Qt::Key key = QDirectFbConvenience::keyMap()->value(event.window.key_symbol); + Qt::KeyboardModifiers modifiers = QDirectFbConvenience::keyboardModifiers(event.window.modifiers); + + long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000); + + QChar character; + if (DFB_KEY_TYPE(event.window.key_symbol) == DIKT_UNICODE) + character = QChar(event.window.key_symbol); + QWidget *tlw = tlwMap.value(event.window.window_id); + QWindowSystemInterface::handleKeyEvent(tlw, timestamp, type, key, modifiers, character); +} + +void QDirectFbInput::handleEnterLeaveEvents(const DFBEvent &event) +{ + QWidget *tlw = tlwMap.value(event.window.window_id); + switch (event.window.type) { + case DWET_ENTER: + QWindowSystemInterface::handleEnterEvent(tlw); + break; + case DWET_LEAVE: + QWindowSystemInterface::handleLeaveEvent(tlw); + break; + default: + break; + } +} + +inline QPoint QDirectFbInput::globalPoint(const DFBEvent &event) const +{ + IDirectFBWindow *window; + dfbDisplayLayer->GetWindow(dfbDisplayLayer,event.window.window_id,&window); + int x,y; + window->GetPosition(window,&x,&y); + return QPoint(event.window.cx +x, event.window.cy + y); +} + diff --git a/src/plugins/platforms/minimaldfb/qdirectfbinput.h b/src/plugins/platforms/minimaldfb/qdirectfbinput.h new file mode 100644 index 0000000..31aa082 --- /dev/null +++ b/src/plugins/platforms/minimaldfb/qdirectfbinput.h @@ -0,0 +1,63 @@ +#ifndef QDIRECTFBINPUT_H +#define QDIRECTFBINPUT_H + +#include +#include +#include +#include +#include +#include +#include + +#include + +class InputSocketWaiter : public QThread +{ + Q_OBJECT +public: + InputSocketWaiter(IDirectFBEventBuffer *eventBuffer, QObject *parent); + virtual ~InputSocketWaiter(); + void continueWaitingForEvents(); +protected: + void run(); +signals: + void newEvent(); +private: + IDirectFBEventBuffer *m_eventBuffer; + bool m_shouldStop; + QMutex m_cleanupMutex; + QWaitCondition m_finishedProcessingEvents; +}; + +class QDirectFbInput : public QObject +{ + Q_OBJECT +public: + static QDirectFbInput *instance(); + void addWindow(DFBWindowID id, QWidget *tlw); + void removeWindow(QWidget *tlw); + +public slots: + void handleEvents(); + void applicationEnd(); + +private: + QDirectFbInput(); + + void handleMouseEvents(const DFBEvent &event); + void handleWheelEvent(const DFBEvent &event); + void handleKeyEvents(const DFBEvent &event); + void handleEnterLeaveEvents(const DFBEvent &event); + IDirectFB *dfbInterface; + IDirectFBDisplayLayer *dfbDisplayLayer; + IDirectFBEventBuffer *eventBuffer; + + QHashtlwMap; + + inline QPoint globalPoint(const DFBEvent &event) const; + + InputSocketWaiter *m_inputHandler; + +}; + +#endif // QDIRECTFBINPUT_H diff --git a/src/plugins/platforms/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/platforms/minimaldfb/qgraphicssystem_minimaldfb.cpp new file mode 100644 index 0000000..212f3a9 --- /dev/null +++ b/src/plugins/platforms/minimaldfb/qgraphicssystem_minimaldfb.cpp @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgraphicssystem_minimaldfb.h" +#include "qwindowsurface_minimaldfb.h" +#include "qblitter_directfb.h" +#include "qdirectfbconvenience.h" +#include "qdirectfbcursor.h" + +#include +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +QDirectFbGraphicsSystemScreen::QDirectFbGraphicsSystemScreen(int display) + :QGraphicsSystemScreen() +{ + m_layer = QDirectFbConvenience::dfbDisplayLayer(display); + m_layer->SetCooperativeLevel(m_layer,DLSCL_SHARED); + + DFBDisplayLayerConfig config; + m_layer->GetConfiguration(m_layer, &config); + + m_format = QDirectFbConvenience::imageFormatFromSurfaceFormat(config.pixelformat, config.surface_caps); + m_geometry = QRect(0,0,config.width,config.height); + const int dpi = 72; + const qreal inch = 25.4; + m_depth = 32; + m_physicalSize = QSize(qRound(config.width * inch / dpi), qRound(config.height *inch / dpi)); + + cursor = new QDirectFBCursor(this); +} + +QDirectFbGraphicsSystemScreen::~QDirectFbGraphicsSystemScreen() +{ +} + +QDirectFbGraphicsSystem::QDirectFbGraphicsSystem() +{ + const QStringList args = QCoreApplication::arguments(); + int argc = args.size(); + char **argv = new char*[argc]; + + for (int i = 0; i < argc; ++i) + argv[i] = qstrdup(args.at(i).toLocal8Bit().constData()); + + DFBResult result = DirectFBInit(&argc, &argv); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreen: error initializing DirectFB", + result); + } + delete[] argv; + + mPrimaryScreen = new QDirectFbGraphicsSystemScreen(0); + mScreens.append(mPrimaryScreen); +} + +QPixmapData *QDirectFbGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const +{ + if (type == QPixmapData::BitmapType) + return new QRasterPixmapData(type); + else + return new QBlittablePixmapData(type); +} + +QWindowSurface *QDirectFbGraphicsSystem::createWindowSurface(QWidget *widget) const +{ + return new QDirectFbWindowSurface (widget); +} + +QBlittable *QDirectFbGraphicsSystem::createBlittable(const QSize &size) const +{ + return new QDirectFbBlitter(size); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/minimaldfb/qgraphicssystem_minimaldfb.h b/src/plugins/platforms/minimaldfb/qgraphicssystem_minimaldfb.h new file mode 100644 index 0000000..27bddfb --- /dev/null +++ b/src/plugins/platforms/minimaldfb/qgraphicssystem_minimaldfb.h @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_MINIMAL_H +#define QGRAPHICSSYSTEM_MINIMAL_H + +#include "qdirectfbinput.h" + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QDirectFBCursor; + +class QDirectFbGraphicsSystemScreen : public QGraphicsSystemScreen +{ +public: + QDirectFbGraphicsSystemScreen(int display); + ~QDirectFbGraphicsSystemScreen(); + + QRect geometry() const { return m_geometry; } + int depth() const { return m_depth; } + QImage::Format format() const { return m_format; } + QSize physicalSize() const { return m_physicalSize; } + +public: + QRect m_geometry; + int m_depth; + QImage::Format m_format; + QSize m_physicalSize; + + IDirectFBDisplayLayer *m_layer; + +private: + QDirectFBCursor * cursor; + +}; + +class QDirectFbGraphicsSystem : public QGraphicsSystem +{ +public: + QDirectFbGraphicsSystem(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QWindowSurface *createWindowSurface(QWidget *widget) const; + QBlittable *createBlittable(const QSize &size) const; + + QList screens() const { return mScreens; } + + + +private: + QDirectFbGraphicsSystemScreen *mPrimaryScreen; + QList mScreens; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/platforms/minimaldfb/qwindowsurface_minimaldfb.cpp new file mode 100644 index 0000000..68d5aa0 --- /dev/null +++ b/src/plugins/platforms/minimaldfb/qwindowsurface_minimaldfb.cpp @@ -0,0 +1,231 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsurface_minimaldfb.h" +#include "qgraphicssystem_minimaldfb.h" +#include "qblitter_directfb.h" +#include "qdirectfbconvenience.h" +#include + +#include + +QT_BEGIN_NAMESPACE + +QDirectFbWindowSurface::QDirectFbWindowSurface(QWidget *window) + : QWindowSurface(window), m_pixmap(0), m_pmdata(0), + m_dfbWindow(0), m_dfbSurface(0) +{ + window->setWindowSurface(this); + + IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); + DFBDisplayLayerConfig layerConfig; + layer->GetConfiguration(layer,&layerConfig); + + DFBWindowDescription description; + memset(&description,0,sizeof(DFBWindowDescription)); + description.flags = DFBWindowDescriptionFlags(DWDESC_WIDTH|DWDESC_HEIGHT|DWDESC_POSX|DWDESC_POSY|DWDESC_SURFACE_CAPS +#if DIRECTFB_MINOR_VERSION >= 1 + |DWDESC_OPTIONS +#endif + |DWDESC_CAPS); + description.width = window->rect().width(); + description.height = window->rect().height(); + description.posx = window->rect().x(); + description.posy = window->rect().y(); + + if (layerConfig.surface_caps & DSCAPS_PREMULTIPLIED) + description.surface_caps = DSCAPS_PREMULTIPLIED; + description.pixelformat = layerConfig.pixelformat; + +#if DIRECTFB_MINOR_VERSION >= 1 + description.options = DFBWindowOptions(DWOP_ALPHACHANNEL); +#endif + description.caps = DFBWindowCapabilities(DWCAPS_DOUBLEBUFFER|DWCAPS_ALPHACHANNEL); + description.surface_caps = DSCAPS_PREMULTIPLIED; + + DFBResult result = layer->CreateWindow(layer,&description,&m_dfbWindow); + if (result != DFB_OK) { + DirectFBError("QDirectFbGraphicsSystemScreen: failed to create window",result); + } + + DFBWindowID id; + m_dfbWindow->GetID(m_dfbWindow, &id); + QDirectFbInput::instance()->addWindow(id,window); + + m_dfbWindow->GetSurface(m_dfbWindow,&m_dfbSurface); + + QDirectFbBlitter *blitter = new QDirectFbBlitter(window->rect().size(), m_dfbSurface); + m_pmdata = new QBlittablePixmapData(QPixmapData::PixmapType); + m_pmdata->setBlittable(blitter); + m_pixmap = new QPixmap(m_pmdata); +} + +QDirectFbWindowSurface::~QDirectFbWindowSurface() +{ + QDirectFbInput::instance()->removeWindow(this->window()); + m_dfbWindow->Destroy(m_dfbWindow); +} + +QPaintDevice *QDirectFbWindowSurface::paintDevice() +{ + return m_pixmap; +} + +void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + m_pmdata->blittable()->unlock(); + + const quint8 windowOpacity = quint8(widget->windowOpacity() * 0xff); + m_dfbWindow->SetOpacity(m_dfbWindow,windowOpacity); + + QVector rects = region.rects(); + for (int i = 0 ; i < rects.size(); i++) { + const QRect rect = rects.at(i); + DFBRegion dfbReg = { rect.x() + offset.x(),rect.y() + offset.y(),rect.right() + offset.x(),rect.bottom() + offset.y()}; + m_dfbSurface->Flip(m_dfbSurface, &dfbReg, DFBSurfaceFlipFlags(DSFLIP_BLIT|DSFLIP_ONSYNC)); + } +} + +void QDirectFbWindowSurface::setGeometry(const QRect &rect) +{ + m_pmdata->blittable()->unlock(); + + QWindowSurface::setGeometry(rect); + m_dfbWindow->SetBounds(m_dfbWindow, rect.x(),rect.y(), + rect.width(), rect.height()); + + //Have to add 1 ref ass it will be removed by deleting the old blitter in setBlittable + m_dfbSurface->AddRef(m_dfbSurface); + QDirectFbBlitter *blitter = new QDirectFbBlitter(rect.size(),m_dfbSurface); + m_pmdata->setBlittable(blitter); +} + +static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int dx, int dy) +{ + const DFBRectangle rect = { r.x(), r.y(), r.width(), r.height() }; + surface->Blit(surface, surface, &rect, r.x() + dx, r.y() + dy); + const DFBRegion region = { rect.x + dx, rect.y + dy, r.right() + dx, r.bottom() + dy }; + surface->Flip(surface, ®ion, DFBSurfaceFlipFlags(DSFLIP_BLIT)); +} + +bool QDirectFbWindowSurface::scroll(const QRegion &area, int dx, int dy) +{ + m_pmdata->blittable()->unlock(); + + if (!m_dfbSurface || area.isEmpty()) + return false; + m_dfbSurface->SetBlittingFlags(m_dfbSurface, DSBLIT_NOFX); + if (area.rectCount() == 1) { + scrollSurface(m_dfbSurface, area.boundingRect(), dx, dy); + } else { + const QVector rects = area.rects(); + const int n = rects.size(); + for (int i=0; iblittable()->unlock(); + + if (visible) { + int x = this->geometry().x(); + int y = this->geometry().y(); + m_dfbWindow->MoveTo(m_dfbWindow,x,y); + } else { + IDirectFBDisplayLayer *displayLayer; + QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),DLID_PRIMARY,&displayLayer); + + DFBDisplayLayerConfig config; + displayLayer->GetConfiguration(displayLayer,&config); + m_dfbWindow->MoveTo(m_dfbWindow,config.width+1,config.height + 1); + } +} + +Qt::WindowFlags QDirectFbWindowSurface::setWindowFlags(Qt::WindowFlags flags) +{ + switch (flags & Qt::WindowType_Mask) { + case Qt::ToolTip: { + DFBWindowOptions options; + m_dfbWindow->GetOptions(m_dfbWindow,&options); + options = DFBWindowOptions(options | DWOP_GHOST); + m_dfbWindow->SetOptions(m_dfbWindow,options); + break; } + default: + break; + } + + m_dfbWindow->SetStackingClass(m_dfbWindow, flags & Qt::WindowStaysOnTopHint ? DWSC_UPPER : DWSC_MIDDLE); + return flags; +} + +void QDirectFbWindowSurface::raise() +{ + m_dfbWindow->RaiseToTop(m_dfbWindow); +} + +void QDirectFbWindowSurface::lower() +{ + m_dfbWindow->LowerToBottom(m_dfbWindow); +} + +WId QDirectFbWindowSurface::winId() const +{ + DFBWindowID id; + m_dfbWindow->GetID(m_dfbWindow, &id); + return WId(id); +} + + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/minimaldfb/qwindowsurface_minimaldfb.h b/src/plugins/platforms/minimaldfb/qwindowsurface_minimaldfb.h new file mode 100644 index 0000000..ca34cbf --- /dev/null +++ b/src/plugins/platforms/minimaldfb/qwindowsurface_minimaldfb.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSURFACE_MINIMAL_H +#define QWINDOWSURFACE_MINIMAL_H + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QDirectFbGraphicsSystemScreen; + +class QDirectFbWindowSurface : public QWindowSurface +{ +public: + QDirectFbWindowSurface(QWidget *window); + ~QDirectFbWindowSurface(); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void setGeometry(const QRect &rect); + bool scroll(const QRegion &area, int dx, int dy); + + void beginPaint(const QRegion ®ion); + void endPaint(const QRegion ®ion); + + void setVisible(bool visible); + Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); + + void raise(); + void lower(); + + WId winId() const; + +private: + void lockSurfaceToImage(); + + QPixmap *m_pixmap; + QBlittablePixmapData *m_pmdata; + + IDirectFBWindow *m_dfbWindow; + IDirectFBSurface *m_dfbSurface; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/openkode/frag.glslf b/src/plugins/platforms/openkode/frag.glslf new file mode 100644 index 0000000..a593434 --- /dev/null +++ b/src/plugins/platforms/openkode/frag.glslf @@ -0,0 +1,8 @@ +uniform sampler2D tex_samp; + +varying vec2 texcoord_var; + +void main() +{ + gl_FragColor = texture2D(tex_samp, texcoord_var); +} diff --git a/src/plugins/platforms/openkode/frag.h b/src/plugins/platforms/openkode/frag.h new file mode 100644 index 0000000..6575cb5 --- /dev/null +++ b/src/plugins/platforms/openkode/frag.h @@ -0,0 +1,37 @@ +0x4e,0x56,0x75,0x63,0x01,0x00,0x00,0x00,0x09,0x00,0x06,0x00,0x06,0x00,0x50,0x00, +0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x50,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x40,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x27,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x50,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0xe8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x70,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x90,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x11,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xb0,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x12,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0xc0,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x23,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x2b,0x00,0x00,0x00,0x7a,0x00,0x00,0x00,0xd0,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x2c,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x68,0x69,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff, +0x00,0x00,0x00,0x80,0x04,0x00,0x00,0x90,0x00,0x02,0x01,0x82,0x04,0x02,0x02,0x82, +0x01,0x00,0x40,0xf6,0x85,0xc7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0x3a,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2a,0x00,0x06,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0x3b,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0x49,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x26,0x00,0x04,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x74,0x65,0x78,0x5f,0x73,0x61,0x6d,0x70,0x00,0x00,0x00,0x74,0x65,0x78,0x63, +0x6f,0x6f,0x72,0x64,0x5f,0x76,0x61,0x72,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 diff --git a/src/plugins/platforms/openkode/main.cpp b/src/plugins/platforms/openkode/main.cpp new file mode 100644 index 0000000..e9c1083 --- /dev/null +++ b/src/plugins/platforms/openkode/main.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qgraphicssystem_openkode.h" + +QT_BEGIN_NAMESPACE + +class QOpenKODEGraphicsSystemPlugin : public QGraphicsSystemPlugin +{ +public: + QStringList keys() const; + QGraphicsSystem *create(const QString&); +}; + +QStringList QOpenKODEGraphicsSystemPlugin::keys() const +{ + QStringList list; + list << "OpenKODE"; + return list; +} + +QGraphicsSystem* QOpenKODEGraphicsSystemPlugin::create(const QString& system) +{ + if (system.toLower() == "openkode") + return new QOpenKODEGraphicsSystem; + + return 0; +} + +Q_EXPORT_PLUGIN2(openkode, QOpenKODEGraphicsSystemPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/openkode/openkode.pro b/src/plugins/platforms/openkode/openkode.pro new file mode 100644 index 0000000..055048d --- /dev/null +++ b/src/plugins/platforms/openkode/openkode.pro @@ -0,0 +1,14 @@ +TARGET = qopenkodegraphicssystem +include(../../qpluginbase.pri) + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems + +SOURCES = main.cpp qgraphicssystem_openkode.cpp qwindowsurface_openkode.cpp +HEADERS = qgraphicssystem_openkode.h qwindowsurface_openkode.h + +target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +INSTALLS += target + +# openkode specific stuff +INCLUDEPATH += $(OPENKODE_DIR)/include +LIBS += $${QMAKE_RPATH}/$(OPENKODE_DIR)/lib-target -L$(OPENKODE_DIR)/lib-target -lKD -lEGL -lGLESv2 diff --git a/src/plugins/platforms/openkode/qgraphicssystem_openkode.cpp b/src/plugins/platforms/openkode/qgraphicssystem_openkode.cpp new file mode 100644 index 0000000..7a07776 --- /dev/null +++ b/src/plugins/platforms/openkode/qgraphicssystem_openkode.cpp @@ -0,0 +1,236 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgraphicssystem_openkode.h" +#include "qwindowsurface_openkode.h" +#include + +#include +#include + +#include +#include +#include + +#include "GLES2/gl2ext.h" + + +QT_BEGIN_NAMESPACE + +QOpenKODEGraphicsSystemScreen::QOpenKODEGraphicsSystemScreen() +{ + KDDesktopNV *kdDesktop = KD_NULL; + KDDisplayNV *kdDisplay = KD_NULL; + + qDebug() << "QOpenKODEGraphicsSystemScreen::QOpenKODEGraphicsSystemScreen()"; + + // Get the default desktop and display + kdDesktop = kdGetDesktopNV(KD_DEFAULT_DESKTOP_NV, KD_NULL); + if (!kdDesktop || kdDesktop == (void*)-1) { + qErrnoWarning(kdGetError(), "Could not obtain KDDesktopNV pointer"); + return; + } + + kdDisplay = kdGetDisplayNV(KD_DEFAULT_DISPLAY_NV, KD_NULL); + if (!kdDisplay || kdDisplay == (void*)-1) { + qErrnoWarning(kdGetError(), "Could not obtain KDDisplayNV pointer"); + kdReleaseDesktopNV(kdDesktop); + return; + } + + KDDisplayModeNV mode; + if (kdGetDisplayModeNV(kdDisplay, &mode)) { + qErrnoWarning(kdGetError(), "Could not get display mode"); + return; + } + + qDebug() << " - display mode " << mode.width << "x" << mode.height << " refresh " << mode.refresh; + + KDint desktopSize[] = { mode.width, mode.height }; + + if (kdSetDesktopPropertyivNV(kdDesktop, KD_DESKTOPPROPERTY_SIZE_NV, desktopSize)) { + qErrnoWarning(kdGetError(), "Could not set desktop size"); + return; + } + + // Once we've set up the desktop and display we don't need them anymore + kdReleaseDisplayNV(kdDisplay); + kdReleaseDesktopNV(kdDesktop); + + const int defaultDpi = 72; + mGeometry = QRect(0, 0, mode.width, mode.height); + mPhysicalSize = QSize(mode.width * 25.4 / defaultDpi, mode.height * 25.4 / defaultDpi); + + mDepth = 24; + mFormat = QImage::Format_RGB888; + + + QEglProperties properties; + properties.setPixelFormat(QImage::Format_RGB888); + properties.setValue(EGL_BUFFER_SIZE, EGL_DONT_CARE); + properties.setRenderableType(QEgl::OpenGL); + + if (!mContext.chooseConfig(properties, QEgl::BestPixelFormat)) { + qWarning("qEglContext: Unable to choose config!"); + return; + } + + if (!mContext.display()) { + qWarning("qEglContext: Unable to open display!"); + return; + } + + qDebug() << " - QEglContext::openDisplay OK"; +} + +static GLuint NvKdTestLoadShaders(const char *vertex_shader_binary, + const char *fragment_shader_binary, + GLuint vertex_shader_binary_size, + GLuint fragment_shader_binary_size) +{ + GLuint prog; + GLuint vertShader; + GLuint fragShader; + + // Create the program + prog = glCreateProgram(); + + // Create the GL shader objects + vertShader = glCreateShader(GL_VERTEX_SHADER); + fragShader = glCreateShader(GL_FRAGMENT_SHADER); + + // Load the binary data into the shader objects + glShaderBinary(1, &vertShader, + GL_NVIDIA_PLATFORM_BINARY_NV, vertex_shader_binary, vertex_shader_binary_size); + glShaderBinary(1, &fragShader, + GL_NVIDIA_PLATFORM_BINARY_NV, fragment_shader_binary, fragment_shader_binary_size); + + // Attach the shaders to the program + glAttachShader(prog, vertShader); + glAttachShader(prog, fragShader); + + // Delete the shaders + glDeleteShader(vertShader); + glDeleteShader(fragShader); + + // Link and validate the shader program + glLinkProgram(prog); + glValidateProgram(prog); + + return prog; +} + +class QOpenKODEEventLoopHelper : public QThread +{ +public: + QOpenKODEEventLoopHelper(QSemaphore *m) + : eventMutex(m) + { + m->acquire(); + } + +protected: + void run() + { + qDebug() << "initializing KD"; + kdInitializeNV(); + qDebug() << "done initializing KD"; + eventMutex->release(); + + const KDEvent *event; + while ((event = kdWaitEvent(-1)) != 0) { + qDebug() << "!!! received event!"; + kdDefaultEvent(event); + } + + qDebug() << "exiting event loop"; + } + +private: + QSemaphore *eventMutex; +}; + +QOpenKODEGraphicsSystem::QOpenKODEGraphicsSystem() + : eventMutex(1) +{ + QOpenKODEEventLoopHelper *loop = new QOpenKODEEventLoopHelper(&eventMutex); + loop->start(); + eventMutex.acquire(); // block until initialization done + + mPrimaryScreen = new QOpenKODEGraphicsSystemScreen(); + + mScreens.append(mPrimaryScreen); + +} + +QPixmapData *QOpenKODEGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const +{ + return new QRasterPixmapData(type); +} + +QWindowSurface *QOpenKODEGraphicsSystem::createWindowSurface(QWidget *widget) const +{ + return new QOpenKODEWindowSurface(mPrimaryScreen, widget); +} + +GLuint QOpenKODEGraphicsSystem::blitterProgram() +{ + static GLuint shaderProgram = 0; + if (!shaderProgram) { + + const char vertShaderBinary[] = { +# include "vert.h" + }; + const char fragShaderBinary[] = { +# include "frag.h" + }; + + shaderProgram = NvKdTestLoadShaders(vertShaderBinary, fragShaderBinary, + sizeof(vertShaderBinary), sizeof(fragShaderBinary)); + + if (!shaderProgram) + qFatal("QOpenKodeGraphicsSystem(): Cannot load shaders!"); + } + return shaderProgram; +} + + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/openkode/qgraphicssystem_openkode.h b/src/plugins/platforms/openkode/qgraphicssystem_openkode.h new file mode 100644 index 0000000..7d73ae0 --- /dev/null +++ b/src/plugins/platforms/openkode/qgraphicssystem_openkode.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_OPENKODE_H +#define QGRAPHICSSYSTEM_OPENKODE_H + +#include + +#include +#include + +# include + +QT_BEGIN_NAMESPACE + +struct KDDesktopNV; + +class QOpenKODEGraphicsSystemScreen : public QGraphicsSystemScreen +{ +public: + QOpenKODEGraphicsSystemScreen(); + ~QOpenKODEGraphicsSystemScreen() {} + + QRect geometry() const { return mGeometry; } + int depth() const { return mDepth; } + QImage::Format format() const { return mFormat; } + QSize physicalSize() const { return mPhysicalSize; } + +public: + QRect mGeometry; + int mDepth; + QImage::Format mFormat; + QSize mPhysicalSize; + QEglContext mContext; +}; + +class QOpenKODEGraphicsSystem : public QGraphicsSystem +{ +public: + QOpenKODEGraphicsSystem(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QWindowSurface *createWindowSurface(QWidget *widget) const; + + QList screens() const { return mScreens; } + + static GLuint blitterProgram(); + +private: + QOpenKODEGraphicsSystemScreen *mPrimaryScreen; + QList mScreens; + QSemaphore eventMutex; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/openkode/qwindowsurface_openkode.cpp b/src/plugins/platforms/openkode/qwindowsurface_openkode.cpp new file mode 100644 index 0000000..b3f3965 --- /dev/null +++ b/src/plugins/platforms/openkode/qwindowsurface_openkode.cpp @@ -0,0 +1,265 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsurface_openkode.h" +#include "qgraphicssystem_openkode.h" +#include + +#include "KD/kd.h" +#include "KD/NV_display.h" + +QT_BEGIN_NAMESPACE + +QOpenKODEWindowSurface::QOpenKODEWindowSurface + (QOpenKODEGraphicsSystemScreen *screen, QWidget *window) + : QWindowSurface(window), + mScreen(screen), + mSurface(0) +{ + qDebug() << "QOpenKODEWindowSurface::QOpenKODEWindowSurface:" << window << window->width() << "x" << window->height() + << "pos" << window->x() << "x" << window->y(); + + if (!mContext.display()) { + qWarning("qEglContext: Unable to open display!"); + return; + } + + QEglProperties properties; + properties.setPixelFormat(QImage::Format_RGB888); + properties.setValue(EGL_BUFFER_SIZE, EGL_DONT_CARE); + properties.setRenderableType(QEgl::OpenGL); + + if (!mContext.chooseConfig(properties, QEgl::BestPixelFormat)) { + qWarning("qEglContext: Unable to choose config!"); + return; + } + + createWindow(window); +} + +void QOpenKODEWindowSurface::createWindow(QWidget *window) +{ + qDebug() << "createWindow"; + kdWindow = kdCreateWindow(mContext.display(), mContext.config(), KD_NULL); + + if (!kdWindow) { + qErrnoWarning(kdGetError(), "Error creating native window"); + return; + } + + const KDint windowSize[2] = { window->width(), window->height() }; + if (kdSetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) { + qErrnoWarning(kdGetError(), "Could not set native window size"); + return; + } + + //const KDboolean windowExclusive[] = { false }; + //if (kdSetWindowPropertybv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_EXCLUSIVE_NV, windowExclusive)) { + // qErrnoWarning(kdGetError(), "Could not set exclusive bit"); + // //return; + //} + + //const KDint windowPos[2] = { window->x(), window->y() }; + //if (kdSetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { + // qErrnoWarning(kdGetError(), "Could not set native window position"); + // //return; + //} + + EGLNativeWindowType nativeWindow; + + if (kdRealizeWindow(kdWindow, &nativeWindow)) { + qErrnoWarning(kdGetError(), "Could not realize native window"); + return; + } + qDebug() << "kdRealizeWindow" << nativeWindow; + + // Create an EGL window surface for the native window + EGLint windowAttrs[3] = { EGL_NONE }; + qDebug() << "doing createwindowsurface"; + *mSurface = eglCreateWindowSurface(mContext.display(), + mContext.config(), + nativeWindow, + windowAttrs); + qDebug() << "create windowsurface"; + if (!mSurface) { + qWarning("EGL couldn't create window surface: 0x%x", eglGetError()); + return; + } + + qDebug() << "making context"; + if (!mContext.createContext()) { + qDebug() << "Unable to create context!"; + return; + } + + qDebug() << "about to make current"; + mContext.makeCurrent(mSurface); +} + +QOpenKODEWindowSurface::~QOpenKODEWindowSurface() +{ +} + +QPaintDevice *QOpenKODEWindowSurface::paintDevice() +{ + qDebug() << "QOpenKODEWindowSurface::paintDevice"; + return &mImage; +} + +// ### TODO - this updates the entire toplevel, should only update the region +void QOpenKODEWindowSurface::flush(QWidget *, const QRegion ®ion, const QPoint &offset) +{ + qDebug() << "in flush"; + if (!offset.isNull()) { + qWarning("Offset flushing not supported yet"); + return; + } + + if (!mContext.makeCurrent(mSurface)) { + qWarning("EGL couldn't make context/surface current: 0x%x", eglGetError()); + return; + } + + QRect boundingRect = region.boundingRect(); + + int x, y, w, h; + QImage blitImage; + if (true || boundingRect == mImage.rect()) { // TODO - check optimization + blitImage = mImage; + x = y = 0; + w = mImage.width(); + h = mImage.height(); + } else { + blitImage = mImage.copy(boundingRect); + w = boundingRect.width(); + h = boundingRect.height(); + x = boundingRect.x(); + y = boundingRect.y(); + } + +// qDebug() << "flush" << widget << offset << region.boundingRect() << mImage.format() << blitImage.format(); + + GLuint shaderProgram = QOpenKODEGraphicsSystem::blitterProgram(); + + glUseProgram(shaderProgram); + + GLuint index = glGetUniformLocation(shaderProgram, "window"); + glUniform2f(index, GLfloat(mImage.width()), GLfloat(mImage.height())); + + // attributes + GLuint posId = glGetAttribLocation(shaderProgram, "pos_attr"); + GLuint texcoordId = glGetAttribLocation(shaderProgram, "texcoord_attr"); + + // sampler + index = glGetUniformLocation(shaderProgram, "tex_samp"); + + glUniform1i(index, 0); + + glDisable(GL_DEPTH_TEST); + glActiveTexture(GL_TEXTURE0); + + GLuint texId; + GLfloat coords[8] = {x, y, x, y + h, x + w, y + h, x + w, y }; + GLfloat texcoords[8] = { 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0 }; + + // Generate texture for checkered background + glPixelStorei(GL_UNPACK_ALIGNMENT, 4); + glGenTextures(1, &texId); + glBindTexture(GL_TEXTURE_2D, texId); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, blitImage.bits()); + + // Enable vertex attribute associated with vertex position + glEnableVertexAttribArray(posId); + glEnableVertexAttribArray(texcoordId); + + // Set the quad vertices + glVertexAttribPointer(posId, 2, GL_FLOAT, 0, 0, coords); + glVertexAttribPointer(texcoordId, 2, GL_FLOAT, 0, 0, texcoords); + + // Draw the quad + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + + // Cleanup + glDisableVertexAttribArray(posId); + glDisableVertexAttribArray(texcoordId); + + // Release all textures + glBindTexture(GL_TEXTURE_2D, 0); + if (texId) + glDeleteTextures(1, &texId); + + mContext.doneCurrent(); + mContext.swapBuffers(mSurface); +} + +void QOpenKODEWindowSurface::setGeometry(const QRect &rect) +{ + qDebug() << "QOpenKODEWindowSurface::setGeometry:" << rect; + QWindowSurface::setGeometry(rect); + if (mImage.size() != rect.size()) + mImage = QImage(rect.size(), mScreen->format()); + + mContext.destroySurface(mSurface); + kdDestroyWindow(kdWindow); + createWindow(window()); + qDebug() << "set geometry workded"; +} + +bool QOpenKODEWindowSurface::scroll(const QRegion &area, int dx, int dy) +{ + return QWindowSurface::scroll(area, dx, dy); +} + +void QOpenKODEWindowSurface::beginPaint(const QRegion ®ion) +{ + Q_UNUSED(region); +} + +void QOpenKODEWindowSurface::endPaint(const QRegion ®ion) +{ + Q_UNUSED(region); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/openkode/qwindowsurface_openkode.h b/src/plugins/platforms/openkode/qwindowsurface_openkode.h new file mode 100644 index 0000000..bee94a5 --- /dev/null +++ b/src/plugins/platforms/openkode/qwindowsurface_openkode.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSURFACE_OPENKODE_H +#define QWINDOWSURFACE_OPENKODE_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QOpenKODEGraphicsSystemScreen; + +class QOpenKODEWindowSurface : public QWindowSurface +{ +public: + QOpenKODEWindowSurface + (QOpenKODEGraphicsSystemScreen *screen, QWidget *window); + ~QOpenKODEWindowSurface(); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void setGeometry(const QRect &rect); + bool scroll(const QRegion &area, int dx, int dy); + + void beginPaint(const QRegion ®ion); + void endPaint(const QRegion ®ion); + +private: + QOpenKODEGraphicsSystemScreen *mScreen; + QImage mImage; + struct KDWindow *kdWindow; + EGLSurface *mSurface; + QEglContext mContext; + + void createWindow(QWidget *window); +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/openkode/vert.glslv b/src/plugins/platforms/openkode/vert.glslv new file mode 100644 index 0000000..57b5866 --- /dev/null +++ b/src/plugins/platforms/openkode/vert.glslv @@ -0,0 +1,14 @@ +uniform vec2 window; // window size + +// Per-vertex attributes] +attribute vec2 pos_attr; +attribute vec2 texcoord_attr; + +// Output vertex color +varying vec2 texcoord_var; + +void main() +{ + gl_Position = vec4( (2.0 * pos_attr / window -1.0) * vec2(1.0, -1.0), 0.0, 1.0); + texcoord_var = texcoord_attr; +} diff --git a/src/plugins/platforms/openkode/vert.h b/src/plugins/platforms/openkode/vert.h new file mode 100644 index 0000000..bdf564d --- /dev/null +++ b/src/plugins/platforms/openkode/vert.h @@ -0,0 +1,63 @@ +0x4e,0x56,0x75,0x63,0x01,0x00,0x00,0x00,0x0a,0x00,0x06,0x00,0x06,0x00,0x50,0x00, +0x01,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0xf0,0x03,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x60,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x24,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x70,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x26,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x90,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0xe8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x06,0x00,0x00,0x00,0x48,0x00,0x00,0x00,0xb0,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x28,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0x05,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x10,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x20,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x30,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x23,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x2b,0x00,0x00,0x00,0x39,0x01,0x00,0x00,0xb0,0x02,0x00,0x00,0x00,0x00,0x00,0x00, +0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x30,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x04,0x05,0x08,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x0f,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x01,0x02,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0x04,0x05,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x80,0x3f,0x00,0x00,0x00,0x40,0x00,0x00,0x80,0xbf,0x00,0x00,0x00,0x00, +0x05,0x00,0x00,0x10,0x80,0xc7,0x00,0x24,0x05,0x02,0x00,0x10,0x80,0xc7,0x00,0x24, +0x01,0x02,0x81,0xc0,0x80,0x07,0x60,0x00,0x05,0x02,0x00,0x90,0x80,0x07,0x00,0x00, +0x09,0x00,0x01,0xe1,0x80,0x87,0x40,0x00,0x05,0x00,0x00,0x10,0x80,0xc7,0x00,0x24, +0x01,0x00,0x81,0xc0,0x80,0x07,0x60,0x00,0x09,0x04,0x00,0xa0,0x80,0x47,0x00,0xe4, +0x05,0x02,0x00,0x90,0x80,0x07,0x00,0x00,0x05,0x04,0x00,0x10,0x88,0xc7,0x03,0x04, +0x01,0x00,0x01,0xe1,0x88,0x87,0x40,0x00,0x09,0xf8,0x00,0x10,0x88,0xc7,0x03,0x04, +0x0d,0x00,0x00,0x10,0x88,0xc7,0x40,0x24,0x11,0x04,0x00,0x10,0x88,0xc7,0x23,0x04, +0x15,0x06,0x00,0x10,0x89,0xc7,0x23,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xa0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xa1,0x03,0x00,0x00,0x00,0x00,0x00,0x00, +0xad,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x00,0x28,0x00,0x02,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00, +0xb6,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xb7,0x03,0x00,0x00,0x00,0x00,0x00,0x00, +0xbe,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x26,0x00,0x05,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xbf,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x03,0x00,0x00,0x00,0x00,0x00,0x00, +0xc9,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x26,0x00,0x01,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xca,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xcb,0x03,0x00,0x00,0x00,0x00,0x00,0x00, +0xd9,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x26,0x00,0x01,0x00,0x00,0x00, +0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xda,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xdb,0x03,0x00,0x00,0x00,0x00,0x00,0x00, +0xe8,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x26,0x00,0x02,0x00,0x00,0x00, +0x04,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0x00,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x50,0x4f,0x53, +0x49,0x54,0x49,0x4f,0x4e,0x00,0x00,0x77,0x69,0x6e,0x64,0x6f,0x77,0x00,0x00,0x00, +0x70,0x6f,0x73,0x5f,0x61,0x74,0x74,0x72,0x00,0x00,0x00,0x74,0x65,0x78,0x63,0x6f, +0x6f,0x72,0x64,0x5f,0x61,0x74,0x74,0x72,0x00,0x00,0x00,0x74,0x65,0x78,0x63,0x6f, +0x6f,0x72,0x64,0x5f,0x76,0x61,0x72,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 diff --git a/src/plugins/platforms/openvglite/main.cpp b/src/plugins/platforms/openvglite/main.cpp new file mode 100644 index 0000000..dc0b4a8 --- /dev/null +++ b/src/plugins/platforms/openvglite/main.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qgraphicssystem_vglite.h" + +QT_BEGIN_NAMESPACE + +class QVGGraphicsSystemPlugin : public QGraphicsSystemPlugin +{ +public: + QStringList keys() const; + QGraphicsSystem *create(const QString&); +}; + +QStringList QVGGraphicsSystemPlugin::keys() const +{ + QStringList list; + list << "OpenVG"; + return list; +} + +QGraphicsSystem* QVGGraphicsSystemPlugin::create(const QString& system) +{ + if (system.toLower() == "openvg") + return new QVGLiteGraphicsSystem; + + return 0; +} + +Q_EXPORT_PLUGIN2(openvg, QVGGraphicsSystemPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/openvglite/openvglite.pro b/src/plugins/platforms/openvglite/openvglite.pro new file mode 100644 index 0000000..9d7860a --- /dev/null +++ b/src/plugins/platforms/openvglite/openvglite.pro @@ -0,0 +1,12 @@ +TARGET = qvglitegraphicssystem +include(../../qpluginbase.pri) + +QT += openvg + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems + +SOURCES = main.cpp qgraphicssystem_vglite.cpp qwindowsurface_vglite.cpp +HEADERS = qgraphicssystem_vglite.h qwindowsurface_vglite.h + +target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +INSTALLS += target diff --git a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp new file mode 100644 index 0000000..41b2303 --- /dev/null +++ b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp @@ -0,0 +1,193 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgraphicssystem_vglite.h" +#include "qwindowsurface_vglite.h" +#include +#include +#include +#ifdef OPENVG_USBHP_INIT +extern "C" { +#include +}; +#endif + +QT_BEGIN_NAMESPACE + +QVGLiteGraphicsSystem::QVGLiteGraphicsSystem() + : w(0), h(0), d(0), dw(0), dh(0), physWidth(0), physHeight(0), + surface(0), context(0), rootWindow(0), + screenFormat(QImage::Format_RGB16), preservedSwap(false) +{ +#ifdef OPENVG_USBHP_INIT + initLibrary(); +#endif + + // The graphics system is also the screen definition. + mScreens.append(this); + + QString displaySpec = QString::fromLatin1(qgetenv("QWS_DISPLAY")); + QStringList displayArgs = displaySpec.split(QLatin1Char(':')); + + // Initialize EGL and create the global EGL context. + context = qt_vg_create_context(0); + if (!context) { + qFatal("QVGLiteGraphicsSystem: could not initialize EGL"); + return; + } + + // Get the root window handle to use. Default to zero. + QRegExp winidRx(QLatin1String("winid=?(\\d+)")); + int winidIdx = displayArgs.indexOf(winidRx); + int handle = 0; + if (winidIdx >= 0) { + winidRx.exactMatch(displayArgs.at(winidIdx)); + handle = winidRx.cap(1).toInt(); + } + + // Create a full-screen window based on the native handle. + // If the context is premultiplied, the window should be too. + QEglProperties props; +#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT + EGLint surfaceType = 0; + if (context->configAttrib(EGL_SURFACE_TYPE, &surfaceType) && + (surfaceType & EGL_VG_ALPHA_FORMAT_PRE_BIT) != 0) + props.setValue(EGL_VG_ALPHA_FORMAT, EGL_VG_ALPHA_FORMAT_PRE); +#endif + rootWindow = eglCreateWindowSurface + (context->display(), context->config(), + (EGLNativeWindowType)handle, props.properties()); + if (rootWindow == EGL_NO_SURFACE) { + delete context; + context = 0; + qFatal("QVGLiteGraphicsSystem: could not create full-screen window"); + return; + } + + // Try to turn on preserved swap behaviour on the root window. + // This will allow us to optimize compositing to focus on just + // the screen region that has changed. Otherwise we must + // re-composite the entire screen every frame. +#if !defined(QVG_NO_PRESERVED_SWAP) + eglGetError(); // Clear error state first. + eglSurfaceAttrib(context->display(), rootWindow, + EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); + preservedSwap = (eglGetError() == EGL_SUCCESS); +#else + preservedSwap = false; +#endif + + // Fetch the root window properties. + eglQuerySurface(context->display(), rootWindow, EGL_WIDTH, &w); + eglQuerySurface(context->display(), rootWindow, EGL_HEIGHT, &h); + screenFormat = qt_vg_config_to_image_format(context); + switch (screenFormat) { + case QImage::Format_ARGB32_Premultiplied: + case QImage::Format_ARGB32: + case QImage::Format_RGB32: + default: + d = 32; + break; + case QImage::Format_RGB16: + case QImage::Format_ARGB4444_Premultiplied: + d = 16; + break; + } + dw = w; + dh = h; + qDebug("screen size: %dx%dx%d", w, h, d); + + // Handle display physical size spec. From qscreenlinuxfb_qws.cpp. + QRegExp mmWidthRx(QLatin1String("mmWidth=?(\\d+)")); + int dimIdxW = displayArgs.indexOf(mmWidthRx); + QRegExp mmHeightRx(QLatin1String("mmHeight=?(\\d+)")); + int dimIdxH = displayArgs.indexOf(mmHeightRx); + if (dimIdxW >= 0) { + mmWidthRx.exactMatch(displayArgs.at(dimIdxW)); + physWidth = mmWidthRx.cap(1).toInt(); + if (dimIdxH < 0) + physHeight = dh*physWidth/dw; + } + if (dimIdxH >= 0) { + mmHeightRx.exactMatch(displayArgs.at(dimIdxH)); + physHeight = mmHeightRx.cap(1).toInt(); + if (dimIdxW < 0) + physWidth = dw*physHeight/dh; + } + if (dimIdxW < 0 && dimIdxH < 0) { + const int dpi = 72; + physWidth = qRound(dw * 25.4 / dpi); + physHeight = qRound(dh * 25.4 / dpi); + } +} + +QVGLiteGraphicsSystem::~QVGLiteGraphicsSystem() +{ +} + +QPixmapData *QVGLiteGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const +{ +#if !defined(QVGLite_NO_SINGLE_CONTEXT) && !defined(QVGLite_NO_PIXMAP_DATA) + // Pixmaps can use QVGLitePixmapData; bitmaps must use raster. + if (type == QPixmapData::PixmapType) + return new QVGPixmapData(type); + else + return new QRasterPixmapData(type); +#else + return new QRasterPixmapData(type); +#endif +} + +QWindowSurface *QVGLiteGraphicsSystem::createWindowSurface(QWidget *widget) const +{ + if (widget->windowType() == Qt::Desktop) + return 0; // Don't create an explicit window surface for the destkop. + if (surface) { + qWarning() << "QVGLiteGraphicsSystem: only one window surface " + "is supported at a time"; + return 0; + } + surface = new QVGLiteWindowSurface + (const_cast(this), widget); + return surface; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h new file mode 100644 index 0000000..512793d --- /dev/null +++ b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_VGLITE_H +#define QGRAPHICSSYSTEM_VGLITE_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QVGLiteWindowSurface; + +class QVGLiteGraphicsSystem : public QGraphicsSystem, + public QGraphicsSystemScreen +{ +public: + QVGLiteGraphicsSystem(); + ~QVGLiteGraphicsSystem(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QWindowSurface *createWindowSurface(QWidget *widget) const; + QList screens() const { return mScreens; } + + QRect geometry() const { return QRect(0, 0, w, h); } + int depth() const { return d; } + QImage::Format format() const { return screenFormat; } + QSize physicalSize() const { return QSize(physWidth, physHeight); } + +private: + friend class QVGLiteWindowSurface; + + int w; + int h; + int d; + + int dw; + int dh; + + int physWidth; + int physHeight; + + mutable QVGLiteWindowSurface *surface; + QEglContext *context; + EGLSurface rootWindow; + QImage::Format screenFormat; + bool preservedSwap; + + QList mScreens; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/openvglite/qwindowsurface_vglite.cpp b/src/plugins/platforms/openvglite/qwindowsurface_vglite.cpp new file mode 100644 index 0000000..c73e35a --- /dev/null +++ b/src/plugins/platforms/openvglite/qwindowsurface_vglite.cpp @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsurface_vglite.h" +#include "qgraphicssystem_vglite.h" +#include +#include +#include + +QT_BEGIN_NAMESPACE + +QVGLiteWindowSurface::QVGLiteWindowSurface + (QVGLiteGraphicsSystem *gs, QWidget *window) + : QWindowSurface(window), graphicsSystem(gs), + isPaintingActive(false), engine(0) +{ +} + +QVGLiteWindowSurface::~QVGLiteWindowSurface() +{ + graphicsSystem->surface = 0; + if (engine) + qt_vg_destroy_paint_engine(engine); +} + +QPaintDevice *QVGLiteWindowSurface::paintDevice() +{ + qt_vg_make_current(graphicsSystem->context, graphicsSystem->rootWindow); + isPaintingActive = true; + // TODO: clear the parts of the back buffer that are not + // covered by the window surface to black. + return this; +} + +void QVGLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + Q_UNUSED(region); + Q_UNUSED(offset); + QEglContext *context = graphicsSystem->context; + if (context) { + if (!isPaintingActive) + qt_vg_make_current(context, graphicsSystem->rootWindow); + context->swapBuffers(); + qt_vg_done_current(context); + context->setSurface(EGL_NO_SURFACE); + isPaintingActive = false; + } +} + +void QVGLiteWindowSurface::setGeometry(const QRect &rect) +{ + QWindowSurface::setGeometry(rect); +} + +bool QVGLiteWindowSurface::scroll(const QRegion &area, int dx, int dy) +{ + return QWindowSurface::scroll(area, dx, dy); +} + +void QVGLiteWindowSurface::beginPaint(const QRegion ®ion) +{ + Q_UNUSED(region); +} + +void QVGLiteWindowSurface::endPaint(const QRegion ®ion) +{ + Q_UNUSED(region); +} + +QPaintEngine *QVGLiteWindowSurface::paintEngine() const +{ + if (!engine) + engine = qt_vg_create_paint_engine(); + return engine; +} + +// We need to get access to QWidget::metric() from QVGLiteWindowSurface::metric, +// but it is not a friend of QWidget. To get around this, we create a +// fake QX11PaintEngine class, which is a friend. +class QX11PaintEngine +{ +public: + static int metric(const QWidget *widget, QPaintDevice::PaintDeviceMetric met) + { + return widget->metric(met); + } +}; + +int QVGLiteWindowSurface::metric(PaintDeviceMetric met) const +{ + return QX11PaintEngine::metric(window(), met); +} diff --git a/src/plugins/platforms/openvglite/qwindowsurface_vglite.h b/src/plugins/platforms/openvglite/qwindowsurface_vglite.h new file mode 100644 index 0000000..59faba8 --- /dev/null +++ b/src/plugins/platforms/openvglite/qwindowsurface_vglite.h @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSURFACE_VGLITE_H +#define QWINDOWSURFACE_VGLITE_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 +#include + +QT_BEGIN_NAMESPACE + +class QVGLiteGraphicsSystem; +class QVGPaintEngine; + +class Q_OPENVG_EXPORT QVGLiteWindowSurface : public QWindowSurface, public QPaintDevice +{ +public: + QVGLiteWindowSurface(QVGLiteGraphicsSystem *gs, QWidget *window); + ~QVGLiteWindowSurface(); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void setGeometry(const QRect &rect); + bool scroll(const QRegion &area, int dx, int dy); + + void beginPaint(const QRegion ®ion); + void endPaint(const QRegion ®ion); + + QPaintEngine *paintEngine() const; + +protected: + int metric(PaintDeviceMetric metric) const; + +private: + QVGLiteGraphicsSystem *graphicsSystem; + bool isPaintingActive; + mutable QVGPaintEngine *engine; +}; + +QT_END_NAMESPACE + +#endif // QWINDOWSURFACE_VGLITE_H diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro new file mode 100644 index 0000000..9688443 --- /dev/null +++ b/src/plugins/platforms/platforms.pro @@ -0,0 +1,14 @@ +TEMPLATE = subdirs +contains(QT_CONFIG, openvg):contains(QT_CONFIG, egl) { + embedded_lite { + SUBDIRS += openvglite + } +} + +embedded_lite { + SUBDIRS += minimal +} + +embedded_lite:x11 { + SUBDIRS += testlite +} diff --git a/src/plugins/platforms/qvfb/main.cpp b/src/plugins/platforms/qvfb/main.cpp new file mode 100644 index 0000000..b28dde8 --- /dev/null +++ b/src/plugins/platforms/qvfb/main.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qgraphicssystem_qvfb.h" +#include + +QT_BEGIN_NAMESPACE + +class QVFbGraphicsSystemPlugin : public QGraphicsSystemPlugin +{ +public: + QStringList keys() const; + QGraphicsSystem *create(const QString&); +}; + +QStringList QVFbGraphicsSystemPlugin::keys() const +{ + QStringList list; + list << "QVFb"; + return list; +} + +QGraphicsSystem* QVFbGraphicsSystemPlugin::create(const QString& system) +{ + if (system.toLower() == "qvfb") + return new QVFbGraphicsSystem; + + return 0; +} + +Q_EXPORT_PLUGIN2(qvfb, QVFbGraphicsSystemPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/qvfb/qgraphicssystem_qvfb.cpp b/src/plugins/platforms/qvfb/qgraphicssystem_qvfb.cpp new file mode 100644 index 0000000..19058a6 --- /dev/null +++ b/src/plugins/platforms/qvfb/qgraphicssystem_qvfb.cpp @@ -0,0 +1,434 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include // overrides QT_OPEN + +#include +#include + +#include "qgraphicssystem_qvfb.h" +#include "qwindowsurface_qvfb.h" +#include +#include +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + + +class QVFbGraphicsSystemScreenKeyboardHandler : public QObject +{ + Q_OBJECT +public: + QVFbGraphicsSystemScreenKeyboardHandler(); + ~QVFbGraphicsSystemScreenKeyboardHandler(); + +private slots: + void readKeyboardData(); + +private: + int kbdFD; + int kbdIdx; + int kbdBufferLen; + unsigned char *kbdBuffer; + QSocketNotifier *keyNotifier; +}; + +QVFbGraphicsSystemScreenKeyboardHandler::QVFbGraphicsSystemScreenKeyboardHandler() +{ + int displayId = 0; //TODO displayId + const QString keyboardDev = QT_VFB_KEYBOARD_PIPE(displayId); + + + kbdFD = -1; + kbdIdx = 0; + kbdBufferLen = sizeof(QVFbKeyData) * 5; + kbdBuffer = new unsigned char [kbdBufferLen]; + + kbdFD = QT_OPEN(keyboardDev.toLatin1().constData(), O_RDWR | O_NDELAY); + + if (kbdFD == -1) { + perror("QVFbGraphicsSystemScreenKeyboardHandler"); + qWarning("QVFbGraphicsSystemScreenKeyboardHandler: Unable to open device %s", + qPrintable(keyboardDev)); + return; + } + + // Clear pending input + char buf[2]; + while (QT_READ(kbdFD, buf, 1) > 0) { } + + keyNotifier = new QSocketNotifier(kbdFD, QSocketNotifier::Read, this); + connect(keyNotifier, SIGNAL(activated(int)),this, SLOT(readKeyboardData())); + +} + +QVFbGraphicsSystemScreenKeyboardHandler::~QVFbGraphicsSystemScreenKeyboardHandler() +{ + if (kbdFD >= 0) + QT_CLOSE(kbdFD); + delete [] kbdBuffer; +} + + +void QVFbGraphicsSystemScreenKeyboardHandler::readKeyboardData() +{ + int n; + do { + n = QT_READ(kbdFD, kbdBuffer+kbdIdx, kbdBufferLen - kbdIdx); + if (n > 0) + kbdIdx += n; + } while (n > 0); + + int idx = 0; + while (kbdIdx - idx >= (int)sizeof(QVFbKeyData)) { + QVFbKeyData *kd = (QVFbKeyData *)(kbdBuffer + idx); + if (kd->unicode == 0 && kd->keycode == 0 && kd->modifiers == 0 && kd->press) { + // magic exit key + qWarning("Instructed to quit by Virtual Keyboard"); + qApp->quit(); + } + + //QWSServer::processKeyEvent(kd->unicode ? kd->unicode : 0xffff, kd->keycode, kd->modifiers, kd->press, kd->repeat); + + QEvent::Type type = kd->press ? QEvent::KeyPress : QEvent::KeyRelease; + + QString text; + if (kd->unicode && kd->unicode != 0xffff) + text += QChar(kd->unicode); + +// qDebug() << "readKeyboardData" << type << hex << kd->keycode << kd->modifiers << text; + + QWindowSystemInterface::handleKeyEvent(0, type, kd->keycode, kd->modifiers, text, kd->repeat, int(text.length())); + idx += sizeof(QVFbKeyData); + } + + int surplus = kbdIdx - idx; + for (int i = 0; i < surplus; i++) + kbdBuffer[i] = kbdBuffer[idx+i]; + kbdIdx = surplus; +} + + + + +class QVFbGraphicsSystemScreenMouseHandler : public QObject +{ + Q_OBJECT +public: + QVFbGraphicsSystemScreenMouseHandler(); + ~QVFbGraphicsSystemScreenMouseHandler(); + +private slots: + void readMouseData(); + +private: + int mouseFD; + int mouseIdx; + enum {mouseBufSize = 128}; + uchar mouseBuf[mouseBufSize]; + QSocketNotifier *mouseNotifier; + + int oldButtonState; +}; + +QVFbGraphicsSystemScreenMouseHandler::QVFbGraphicsSystemScreenMouseHandler() +{ + int displayId = 0; //TODO: displayId + QString mouseDev = QT_VFB_MOUSE_PIPE(displayId); + + mouseFD = QT_OPEN(mouseDev.toLatin1().constData(), O_RDWR | O_NDELAY); + + if (mouseFD == -1) { + perror("QVFbMouseHandler::QVFbMouseHandler"); + qWarning("QVFbMouseHander: Unable to open device %s", + qPrintable(mouseDev)); + return; + } + + // Clear pending input + char buf[2]; + while (QT_READ(mouseFD, buf, 1) > 0) { } + + mouseIdx = 0; + oldButtonState = 0; + mouseNotifier = new QSocketNotifier(mouseFD, QSocketNotifier::Read, this); + connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData())); +} + + +QVFbGraphicsSystemScreenMouseHandler::~QVFbGraphicsSystemScreenMouseHandler() +{ + if (mouseFD >= 0) + QT_CLOSE(mouseFD); +} + +void QVFbGraphicsSystemScreenMouseHandler::readMouseData() +{ + int n; + do { + n = QT_READ(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx); + if (n > 0) + mouseIdx += n; + } while (n > 0); + + int idx = 0; + static const int packetsize = sizeof(QPoint) + 2*sizeof(int); + while (mouseIdx-idx >= packetsize) { + uchar *mb = mouseBuf+idx; + QPoint mousePos = *reinterpret_cast(mb); + mb += sizeof(QPoint); + int bstate = *reinterpret_cast(mb); + mb += sizeof(int); + int wheel = *reinterpret_cast(mb); + + int button = bstate ^ oldButtonState; + QEvent::Type type = QEvent::MouseMove; + + if (button) { + type = (button & bstate) ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; + } + QWindowSystemInterface::handleMouseEvent(0, mousePos, mousePos, Qt::MouseButtons(bstate)); + +// qDebug() << "readMouseData" << mousePos << button << bstate << oldButtonState << type; + + oldButtonState = bstate; + + idx += packetsize; + } + + int surplus = mouseIdx - idx; + for (int i = 0; i < surplus; i++) + mouseBuf[i] = mouseBuf[idx+i]; + mouseIdx = surplus; + +} + + +class QVFbGraphicsSystemScreenPrivate +{ +public: + QVFbGraphicsSystemScreenPrivate(QVFbGraphicsSystemScreen *) + : shmrgn(0), hdr(0), data(0), mouseHandler(0), keyboardHandler(0) + { + connect(0); //for now we only handle one screen + } + + ~QVFbGraphicsSystemScreenPrivate() { disconnect(); } + void setDirty(const QRect &r); + + bool connect(int displayId); + void disconnect(); + + QImage *screenImage() { return &img; } + QSize screenSize() { return img.size(); } + + int depth() const { return img.depth(); } + QImage::Format format() const { return img.format(); } + +private: + unsigned char *shmrgn; + QVFbHeader *hdr; + uchar *data; + QVFbGraphicsSystemScreenMouseHandler *mouseHandler; + QVFbGraphicsSystemScreenKeyboardHandler *keyboardHandler; + + + QImage img; +}; + + +void QVFbGraphicsSystemScreenPrivate::setDirty(const QRect &r) +{ + hdr->dirty = true; + hdr->update = hdr->update.united(r); +} + + +bool QVFbGraphicsSystemScreenPrivate::connect(int displayId) +{ + + key_t key = ftok(QT_VFB_MOUSE_PIPE(displayId).toLatin1(), 'b'); + + if (key == -1) + return false; + + + int shmId = shmget(key, 0, 0); + if (shmId != -1) + shmrgn = (unsigned char *)shmat(shmId, 0, 0); + else + return false; + + if ((long)shmrgn == -1 || shmrgn == 0) { + qDebug("No shmrgn %ld", (long)shmrgn); + return false; + } + + hdr = (QVFbHeader *)shmrgn; + data = shmrgn + hdr->dataoffset; + + int w = hdr->width; + int h = hdr->height; + int d = hdr->depth; + int lstep = hdr->linestep; + + QImage::Format format = QImage::Format_Invalid; + if (d == 32) + format = QImage::Format_ARGB32_Premultiplied; + else if (d == 16) + format = QImage::Format_RGB16; + + + if (format == QImage::Format_Invalid) { + img = QImage(); + return false; + } + + img = QImage(data, w, h, lstep, format); + + qDebug("connected %dx%d %d bpp", w, h, d); + + + mouseHandler = new QVFbGraphicsSystemScreenMouseHandler; + keyboardHandler = new QVFbGraphicsSystemScreenKeyboardHandler; + return true; +} + +void QVFbGraphicsSystemScreenPrivate::disconnect() +{ + if ((long)shmrgn != -1 && shmrgn) { + shmdt((char*)shmrgn); + shmrgn = 0; + } + delete mouseHandler; + mouseHandler = 0; + delete keyboardHandler; + keyboardHandler = 0; +} + + +QVFbGraphicsSystemScreen::QVFbGraphicsSystemScreen() +{ + d_ptr = new QVFbGraphicsSystemScreenPrivate(this); +} + + +QVFbGraphicsSystemScreen::~QVFbGraphicsSystemScreen() +{ + delete d_ptr; +} + +void QVFbGraphicsSystemScreen::setDirty(const QRect &rect) +{ + d_ptr->setDirty(rect); +} + + + +QRect QVFbGraphicsSystemScreen::geometry() const { + return QRect(QPoint(), d_ptr->screenSize()); +} + + +int QVFbGraphicsSystemScreen::depth() const +{ + return d_ptr->depth(); +} + +QImage::Format QVFbGraphicsSystemScreen::format() const +{ + return d_ptr->format(); +} + +QSize QVFbGraphicsSystemScreen::physicalSize() const { + return (d_ptr->screenSize()*254)/720; +} + +#if 0 +int QVFbGraphicsSystemScreen::linestep() const { + return d_ptr->screenImage() ? d_ptr->screenImage()->bytesPerLine() : 0; +} + +uchar *QVFbGraphicsSystemScreen::base() const { + return d_ptr->screenImage() ? d_ptr->screenImage()->bits() : 0; +} +#endif + +QImage *QVFbGraphicsSystemScreen::screenImage() +{ + return d_ptr->screenImage(); +} + +QVFbGraphicsSystem::QVFbGraphicsSystem() +{ + mPrimaryScreen = new QVFbGraphicsSystemScreen(); + + mScreens.append(mPrimaryScreen); +} + +QPixmapData *QVFbGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const +{ + return new QRasterPixmapData(type); +} + +QWindowSurface *QVFbGraphicsSystem::createWindowSurface(QWidget *widget) const +{ + if (widget->windowType() == Qt::Desktop) + return 0; // Don't create an explicit window surface for the destkop. + return new QVFbWindowSurface + (const_cast(this), mPrimaryScreen, widget); +} + +QT_END_NAMESPACE + +#include "qgraphicssystem_qvfb.moc" diff --git a/src/plugins/platforms/qvfb/qgraphicssystem_qvfb.h b/src/plugins/platforms/qvfb/qgraphicssystem_qvfb.h new file mode 100644 index 0000000..b31869c --- /dev/null +++ b/src/plugins/platforms/qvfb/qgraphicssystem_qvfb.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_QVFB_H +#define QGRAPHICSSYSTEM_QVFB_H + +#include + +QT_BEGIN_NAMESPACE + + +class QVFbGraphicsSystemScreenPrivate; + +class QVFbGraphicsSystemScreen : public QGraphicsSystemScreen +{ +public: + QVFbGraphicsSystemScreen(); + ~QVFbGraphicsSystemScreen(); + + QRect geometry() const; + int depth() const; + QImage::Format format() const; + QSize physicalSize() const; + + QImage *screenImage(); + + void setDirty(const QRect &rect); + +public: + + QVFbGraphicsSystemScreenPrivate *d_ptr; +}; + +class QVFbGraphicsSystemPrivate; + + +class QVFbGraphicsSystem : public QGraphicsSystem +{ +public: + QVFbGraphicsSystem(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QWindowSurface *createWindowSurface(QWidget *widget) const; + + QList screens() const { return mScreens; } + +private: + QVFbGraphicsSystemScreen *mPrimaryScreen; + QList mScreens; +}; + + + +QT_END_NAMESPACE + + +#endif diff --git a/src/plugins/platforms/qvfb/qvfb.pro b/src/plugins/platforms/qvfb/qvfb.pro new file mode 100644 index 0000000..b321725 --- /dev/null +++ b/src/plugins/platforms/qvfb/qvfb.pro @@ -0,0 +1,12 @@ +TARGET = qvfbgraphicssystem +include(../../qpluginbase.pri) + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems + + + +SOURCES = main.cpp qgraphicssystem_qvfb.cpp qwindowsurface_qvfb.cpp +HEADERS = qgraphicssystem_qvfb.h qwindowsurface_qvfb.h + +target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +INSTALLS += target diff --git a/src/plugins/platforms/qvfb/qwindowsurface_qvfb.cpp b/src/plugins/platforms/qvfb/qwindowsurface_qvfb.cpp new file mode 100644 index 0000000..0aafe28 --- /dev/null +++ b/src/plugins/platforms/qvfb/qwindowsurface_qvfb.cpp @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include "qwindowsurface_qvfb.h" +#include "qgraphicssystem_qvfb.h" +#include +#include +#include + +QT_BEGIN_NAMESPACE + +QVFbWindowSurface::QVFbWindowSurface(QVFbGraphicsSystem *graphicsSystem, + QVFbGraphicsSystemScreen *screen, QWidget *window) + : QWindowSurface(window), + mScreen(screen) +{ +} + +QVFbWindowSurface::~QVFbWindowSurface() +{ +} + +QPaintDevice *QVFbWindowSurface::paintDevice() +{ + return mScreen->screenImage(); +} + +void QVFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + Q_UNUSED(offset); + + QRect rect = geometry(); + QPoint topLeft = rect.topLeft(); + + mScreen->setDirty(region.boundingRect()); +} + +void QVFbWindowSurface::setGeometry(const QRect &) +{ + +// any size you like as long as it's full-screen... + + QRect rect(mScreen->availableGeometry()); + QWindowSystemInterface::handleGeometryChange(this->window(), rect); + + QWindowSurface::setGeometry(rect); +} + +bool QVFbWindowSurface::scroll(const QRegion &area, int dx, int dy) +{ + return QWindowSurface::scroll(area, dx, dy); +} + +void QVFbWindowSurface::beginPaint(const QRegion ®ion) +{ + Q_UNUSED(region); +} + +void QVFbWindowSurface::endPaint(const QRegion ®ion) +{ + Q_UNUSED(region); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/qvfb/qwindowsurface_qvfb.h b/src/plugins/platforms/qvfb/qwindowsurface_qvfb.h new file mode 100644 index 0000000..1971caa --- /dev/null +++ b/src/plugins/platforms/qvfb/qwindowsurface_qvfb.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSURFACE_QVFB_H +#define QWINDOWSURFACE_QVFB_H + +#include + +QT_BEGIN_NAMESPACE + +class QVFbGraphicsSystem; +class QVFbGraphicsSystemScreen; + +class QVFbWindowSurface : public QWindowSurface +{ +public: + QVFbWindowSurface(QVFbGraphicsSystem *graphicsSystem, + QVFbGraphicsSystemScreen *screen, QWidget *window); + ~QVFbWindowSurface(); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void setGeometry(const QRect &rect); + bool scroll(const QRegion &area, int dx, int dy); + + void beginPaint(const QRegion ®ion); + void endPaint(const QRegion ®ion); + +private: + QVFbGraphicsSystem *mGraphicsSystem; + QVFbGraphicsSystemScreen *mScreen; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/testlite/main.cpp b/src/plugins/platforms/testlite/main.cpp new file mode 100644 index 0000000..28caea7 --- /dev/null +++ b/src/plugins/platforms/testlite/main.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qgraphicssystem_testlite.h" + +QT_BEGIN_NAMESPACE + +class QTestLiteGraphicsSystemPlugin : public QGraphicsSystemPlugin +{ +public: + QStringList keys() const; + QGraphicsSystem *create(const QString&); +}; + +QStringList QTestLiteGraphicsSystemPlugin::keys() const +{ + QStringList list; + list << "TestLite"; + return list; +} + +QGraphicsSystem* QTestLiteGraphicsSystemPlugin::create(const QString& system) +{ + if (system.toLower() == "testlite") + return new QTestLiteGraphicsSystem; + + return 0; +} + +Q_EXPORT_PLUGIN2(testlite, QTestLiteGraphicsSystemPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qgraphicssystem_testlite.cpp b/src/plugins/platforms/testlite/qgraphicssystem_testlite.cpp new file mode 100644 index 0000000..92e0ebc --- /dev/null +++ b/src/plugins/platforms/testlite/qgraphicssystem_testlite.cpp @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgraphicssystem_testlite.h" +#include "qwindowsurface_testlite.h" +#include +#include + +#include + + +#include "x11util.h" + +QT_BEGIN_NAMESPACE + +class MyCursor : QGraphicsSystemCursor +{ +public: + MyCursor(QGraphicsSystemScreen *screen) : QGraphicsSystemCursor(screen) {} + + void changeCursor(QCursor * cursor, QWidget * widget) { + QTestLiteWindowSurface *ws = 0; + if (widget) { + QWidget *window = widget->window(); + ws = static_cast(window->windowSurface()); + } else { + // No X11 cursor control when there is no widget under the cursor + return; + } + + //qDebug() << "changeCursor" << widget << ws; + if (!ws) + return; + + ws->setCursor(cursor); + } +}; + + +QTestLiteGraphicsSystem::QTestLiteGraphicsSystem() +{ + + xd = new MyDisplay; + + mPrimaryScreen = new QTestLiteGraphicsSystemScreen(); + + mPrimaryScreen->mGeometry = QRect + (0, 0, xd->width, xd->height); + mPrimaryScreen->mDepth = 32; + mPrimaryScreen->mFormat = QImage::Format_RGB32; + mPrimaryScreen->mPhysicalSize = + QSize(xd->physicalWidth, xd->physicalHeight); + + mScreens.append(mPrimaryScreen); + + + (void)new MyCursor(mPrimaryScreen); + +} + +QPixmapData *QTestLiteGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const +{ + return new QRasterPixmapData(type); +} + +QWindowSurface *QTestLiteGraphicsSystem::createWindowSurface(QWidget *widget) const +{ + if (widget->windowType() == Qt::Desktop) + return 0; // Don't create an explicit window surface for the destkop. + return new QTestLiteWindowSurface + (const_cast(this), mPrimaryScreen, widget); +} + + +QPixmap QTestLiteGraphicsSystem::grabWindow(WId window, int x, int y, int width, int height) const +{ + QImage img = xd->grabWindow(window, x, y, width, height); + return QPixmap::fromImage(img); +} + + + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qgraphicssystem_testlite.h b/src/plugins/platforms/testlite/qgraphicssystem_testlite.h new file mode 100644 index 0000000..b2cd496 --- /dev/null +++ b/src/plugins/platforms/testlite/qgraphicssystem_testlite.h @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_TESTLITE_H +#define QGRAPHICSSYSTEM_TESTLITE_H + +#include + +QT_BEGIN_NAMESPACE + +class MyDisplay; + +class QTestLiteGraphicsSystemScreen : public QGraphicsSystemScreen +{ +public: + QTestLiteGraphicsSystemScreen() + : mDepth(16), mFormat(QImage::Format_RGB16) {} + ~QTestLiteGraphicsSystemScreen() {} + + QRect geometry() const { return mGeometry; } + int depth() const { return mDepth; } + QImage::Format format() const { return mFormat; } + QSize physicalSize() const { return mPhysicalSize; } + +public: + QRect mGeometry; + int mDepth; + QImage::Format mFormat; + QSize mPhysicalSize; +}; + +class QTestLiteGraphicsSystem : public QGraphicsSystem +{ +public: + QTestLiteGraphicsSystem(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QWindowSurface *createWindowSurface(QWidget *widget) const; + + QPixmap grabWindow(WId window, int x, int y, int width, int height) const; + + QList screens() const { return mScreens; } + + MyDisplay *xd; + +private: + QTestLiteGraphicsSystemScreen *mPrimaryScreen; + QList mScreens; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp b/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp new file mode 100644 index 0000000..c54f6eb --- /dev/null +++ b/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp @@ -0,0 +1,661 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsurface_testlite.h" +#include "qgraphicssystem_testlite.h" + +#include +#include + +#include "x11util.h" + +QT_BEGIN_NAMESPACE + +QTestLiteWindowSurface::QTestLiteWindowSurface + (QTestLiteGraphicsSystem *graphicsSystem, + QTestLiteGraphicsSystemScreen *screen, QWidget *window) + : QWindowSurface(window), + mGraphicsSystem(graphicsSystem), + mScreen(screen), + xw(0) +{ + + + xw = new MyWindow(graphicsSystem->xd, 0,0,300,300); + xw->windowSurface = this; + +// qDebug() << "QTestLiteWindowSurface::QTestLiteWindowSurface:" << xw->window; + + setWindowFlags(window->windowFlags()); //##### This should not be the plugin's responsibility +} + +QTestLiteWindowSurface::~QTestLiteWindowSurface() +{ +// qDebug() << "~QTestLiteWindowSurface" << xw->window; + delete xw; +} + +QPaintDevice *QTestLiteWindowSurface::paintDevice() +{ + return xw->image(); +} + +void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + Q_UNUSED(region); + Q_UNUSED(offset); + + // qDebug() << "QTestLiteWindowSurface::flush:" << (long)this; + + xw->paintEvent(); +} + + +void QTestLiteWindowSurface::setGeometry(const QRect &rect) +{ + QRect oldRect = geometry(); + if (rect == oldRect) + return; + + QWindowSurface::setGeometry(rect); + + //if unchanged ### +// xw->setSize(rect.width(), rect.height()); + xw->setGeometry(rect.x(), rect.y(), rect.width(), rect.height()); +} + +//### scroll logic copied from QRasterWindowSurface, we should make better API for this + +void copied_qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset) +{ + // make sure we don't detach + uchar *mem = const_cast(const_cast(img).bits()); + + int lineskip = img.bytesPerLine(); + int depth = img.depth() >> 3; + + const QRect imageRect(0, 0, img.width(), img.height()); + const QRect r = rect & imageRect & imageRect.translated(-offset); + const QPoint p = rect.topLeft() + offset; + + if (r.isEmpty()) + return; + + const uchar *src; + uchar *dest; + + if (r.top() < p.y()) { + src = mem + r.bottom() * lineskip + r.left() * depth; + dest = mem + (p.y() + r.height() - 1) * lineskip + p.x() * depth; + lineskip = -lineskip; + } else { + src = mem + r.top() * lineskip + r.left() * depth; + dest = mem + p.y() * lineskip + p.x() * depth; + } + + const int w = r.width(); + int h = r.height(); + const int bytes = w * depth; + + // overlapping segments? + if (offset.y() == 0 && qAbs(offset.x()) < w) { + do { + ::memmove(dest, src, bytes); + dest += lineskip; + src += lineskip; + } while (--h); + } else { + do { + ::memcpy(dest, src, bytes); + dest += lineskip; + src += lineskip; + } while (--h); + } +} + +bool QTestLiteWindowSurface::scroll(const QRegion &area, int dx, int dy) +{ + if (!xw->image() || xw->image()->isNull()) + return false; + + const QVector rects = area.rects(); + for (int i = 0; i < rects.size(); ++i) + copied_qt_scrollRectInImage(*xw->image(), rects.at(i), QPoint(dx, dy)); + + return true; +} + + +void QTestLiteWindowSurface::beginPaint(const QRegion ®ion) +{ + Q_UNUSED(region); + xw->resizeBuffer(geometry().size()); +} + +void QTestLiteWindowSurface::endPaint(const QRegion ®ion) +{ + Q_UNUSED(region); + xw->painted = true; //there is content in the buffer +} + + + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Mouse event stuff + + + + +static Qt::MouseButtons translateMouseButtons(int s) +{ + Qt::MouseButtons ret = 0; + if (s & Button1Mask) + ret |= Qt::LeftButton; + if (s & Button2Mask) + ret |= Qt::MidButton; + if (s & Button3Mask) + ret |= Qt::RightButton; + return ret; +} + + +static Qt::KeyboardModifiers translateModifiers(int s) +{ + const uchar qt_alt_mask = Mod1Mask; + const uchar qt_meta_mask = Mod4Mask; + + + Qt::KeyboardModifiers ret = 0; + if (s & ShiftMask) + ret |= Qt::ShiftModifier; + if (s & ControlMask) + ret |= Qt::ControlModifier; + if (s & qt_alt_mask) + ret |= Qt::AltModifier; + if (s & qt_meta_mask) + ret |= Qt::MetaModifier; +#if 0 + if (s & qt_mode_switch_mask) + ret |= Qt::GroupSwitchModifier; +#endif + return ret; +} + +void QTestLiteWindowSurface::handleMouseEvent(QEvent::Type type, void *ev) +{ + static QPoint mousePoint; + + XButtonEvent *e = static_cast(ev); + + Qt::MouseButton button = Qt::NoButton; + Qt::MouseButtons buttons = translateMouseButtons(e->state); + Qt::KeyboardModifiers modifiers = translateModifiers(e->state); + if (type != QEvent::MouseMove) { + switch (e->button) { + case Button1: button = Qt::LeftButton; break; + case Button2: button = Qt::MidButton; break; + case Button3: button = Qt::RightButton; break; + case Button4: + case Button5: + case 6: + case 7: { + //mouse wheel + if (type == QEvent::MouseButtonPress) { + //logic borrowed from qapplication_x11.cpp + int delta = 120 * ((e->button == Button4 || e->button == 6) ? 1 : -1); + bool hor = (((e->button == Button4 || e->button == Button5) + && (modifiers & Qt::AltModifier)) + || (e->button == 6 || e->button == 7)); + QWindowSystemInterface::handleWheelEvent(window(), e->time, + QPoint(e->x, e->y), + QPoint(e->x_root, e->y_root), + delta, hor ? Qt::Horizontal : Qt::Vertical); + } + return; + } + default: break; + } + } + + buttons ^= button; // X event uses state *before*, Qt uses state *after* + + QWindowSystemInterface::handleMouseEvent(window(), e->time, QPoint(e->x, e->y), + QPoint(e->x_root, e->y_root), + buttons); + + mousePoint = QPoint(e->x_root, e->y_root); +} + +void QTestLiteWindowSurface::handleGeometryChange(int x, int y, int w, int h) +{ + QWindowSystemInterface::handleGeometryChange(window(), QRect(x,y,w,h)); +} + + +void QTestLiteWindowSurface::handleCloseEvent() +{ + QWindowSystemInterface::handleCloseEvent(window()); +} + + +void QTestLiteWindowSurface::handleEnterEvent() +{ + QWindowSystemInterface::handleEnterEvent(window()); +} + +void QTestLiteWindowSurface::handleLeaveEvent() +{ + QWindowSystemInterface::handleLeaveEvent(window()); +} + + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Key event stuff -- not pretty either +// +// What we want to do is to port Robert's keytable code properly + + + + + + + +// keyboard mapping table +static const unsigned int keyTbl[] = { + + // misc keys + + XK_Escape, Qt::Key_Escape, + XK_Tab, Qt::Key_Tab, + XK_ISO_Left_Tab, Qt::Key_Backtab, + XK_BackSpace, Qt::Key_Backspace, + XK_Return, Qt::Key_Return, + XK_Insert, Qt::Key_Insert, + XK_Delete, Qt::Key_Delete, + XK_Clear, Qt::Key_Delete, + XK_Pause, Qt::Key_Pause, + XK_Print, Qt::Key_Print, + 0x1005FF60, Qt::Key_SysReq, // hardcoded Sun SysReq + 0x1007ff00, Qt::Key_SysReq, // hardcoded X386 SysReq + + // cursor movement + + XK_Home, Qt::Key_Home, + XK_End, Qt::Key_End, + XK_Left, Qt::Key_Left, + XK_Up, Qt::Key_Up, + XK_Right, Qt::Key_Right, + XK_Down, Qt::Key_Down, + XK_Prior, Qt::Key_PageUp, + XK_Next, Qt::Key_PageDown, + + // modifiers + + XK_Shift_L, Qt::Key_Shift, + XK_Shift_R, Qt::Key_Shift, + XK_Shift_Lock, Qt::Key_Shift, + XK_Control_L, Qt::Key_Control, + XK_Control_R, Qt::Key_Control, + XK_Meta_L, Qt::Key_Meta, + XK_Meta_R, Qt::Key_Meta, + XK_Alt_L, Qt::Key_Alt, + XK_Alt_R, Qt::Key_Alt, + XK_Caps_Lock, Qt::Key_CapsLock, + XK_Num_Lock, Qt::Key_NumLock, + XK_Scroll_Lock, Qt::Key_ScrollLock, + XK_Super_L, Qt::Key_Super_L, + XK_Super_R, Qt::Key_Super_R, + XK_Menu, Qt::Key_Menu, + XK_Hyper_L, Qt::Key_Hyper_L, + XK_Hyper_R, Qt::Key_Hyper_R, + XK_Help, Qt::Key_Help, + 0x1000FF74, Qt::Key_Backtab, // hardcoded HP backtab + 0x1005FF10, Qt::Key_F11, // hardcoded Sun F36 (labeled F11) + 0x1005FF11, Qt::Key_F12, // hardcoded Sun F37 (labeled F12) + + // numeric and function keypad keys + + XK_KP_Space, Qt::Key_Space, + XK_KP_Tab, Qt::Key_Tab, + XK_KP_Enter, Qt::Key_Enter, + //XK_KP_F1, Qt::Key_F1, + //XK_KP_F2, Qt::Key_F2, + //XK_KP_F3, Qt::Key_F3, + //XK_KP_F4, Qt::Key_F4, + XK_KP_Home, Qt::Key_Home, + XK_KP_Left, Qt::Key_Left, + XK_KP_Up, Qt::Key_Up, + XK_KP_Right, Qt::Key_Right, + XK_KP_Down, Qt::Key_Down, + XK_KP_Prior, Qt::Key_PageUp, + XK_KP_Next, Qt::Key_PageDown, + XK_KP_End, Qt::Key_End, + XK_KP_Begin, Qt::Key_Clear, + XK_KP_Insert, Qt::Key_Insert, + XK_KP_Delete, Qt::Key_Delete, + XK_KP_Equal, Qt::Key_Equal, + XK_KP_Multiply, Qt::Key_Asterisk, + XK_KP_Add, Qt::Key_Plus, + XK_KP_Separator, Qt::Key_Comma, + XK_KP_Subtract, Qt::Key_Minus, + XK_KP_Decimal, Qt::Key_Period, + XK_KP_Divide, Qt::Key_Slash, + + // International input method support keys + + // International & multi-key character composition + XK_ISO_Level3_Shift, Qt::Key_AltGr, + XK_Multi_key, Qt::Key_Multi_key, + XK_Codeinput, Qt::Key_Codeinput, + XK_SingleCandidate, Qt::Key_SingleCandidate, + XK_MultipleCandidate, Qt::Key_MultipleCandidate, + XK_PreviousCandidate, Qt::Key_PreviousCandidate, + + // Misc Functions + XK_Mode_switch, Qt::Key_Mode_switch, + XK_script_switch, Qt::Key_Mode_switch, + + // Japanese keyboard support + XK_Kanji, Qt::Key_Kanji, + XK_Muhenkan, Qt::Key_Muhenkan, + //XK_Henkan_Mode, Qt::Key_Henkan_Mode, + XK_Henkan_Mode, Qt::Key_Henkan, + XK_Henkan, Qt::Key_Henkan, + XK_Romaji, Qt::Key_Romaji, + XK_Hiragana, Qt::Key_Hiragana, + XK_Katakana, Qt::Key_Katakana, + XK_Hiragana_Katakana, Qt::Key_Hiragana_Katakana, + XK_Zenkaku, Qt::Key_Zenkaku, + XK_Hankaku, Qt::Key_Hankaku, + XK_Zenkaku_Hankaku, Qt::Key_Zenkaku_Hankaku, + XK_Touroku, Qt::Key_Touroku, + XK_Massyo, Qt::Key_Massyo, + XK_Kana_Lock, Qt::Key_Kana_Lock, + XK_Kana_Shift, Qt::Key_Kana_Shift, + XK_Eisu_Shift, Qt::Key_Eisu_Shift, + XK_Eisu_toggle, Qt::Key_Eisu_toggle, + //XK_Kanji_Bangou, Qt::Key_Kanji_Bangou, + //XK_Zen_Koho, Qt::Key_Zen_Koho, + //XK_Mae_Koho, Qt::Key_Mae_Koho, + XK_Kanji_Bangou, Qt::Key_Codeinput, + XK_Zen_Koho, Qt::Key_MultipleCandidate, + XK_Mae_Koho, Qt::Key_PreviousCandidate, + +#ifdef XK_KOREAN + // Korean keyboard support + XK_Hangul, Qt::Key_Hangul, + XK_Hangul_Start, Qt::Key_Hangul_Start, + XK_Hangul_End, Qt::Key_Hangul_End, + XK_Hangul_Hanja, Qt::Key_Hangul_Hanja, + XK_Hangul_Jamo, Qt::Key_Hangul_Jamo, + XK_Hangul_Romaja, Qt::Key_Hangul_Romaja, + //XK_Hangul_Codeinput, Qt::Key_Hangul_Codeinput, + XK_Hangul_Codeinput, Qt::Key_Codeinput, + XK_Hangul_Jeonja, Qt::Key_Hangul_Jeonja, + XK_Hangul_Banja, Qt::Key_Hangul_Banja, + XK_Hangul_PreHanja, Qt::Key_Hangul_PreHanja, + XK_Hangul_PostHanja, Qt::Key_Hangul_PostHanja, + //XK_Hangul_SingleCandidate,Qt::Key_Hangul_SingleCandidate, + //XK_Hangul_MultipleCandidate,Qt::Key_Hangul_MultipleCandidate, + //XK_Hangul_PreviousCandidate,Qt::Key_Hangul_PreviousCandidate, + XK_Hangul_SingleCandidate, Qt::Key_SingleCandidate, + XK_Hangul_MultipleCandidate,Qt::Key_MultipleCandidate, + XK_Hangul_PreviousCandidate,Qt::Key_PreviousCandidate, + XK_Hangul_Special, Qt::Key_Hangul_Special, + //XK_Hangul_switch, Qt::Key_Hangul_switch, + XK_Hangul_switch, Qt::Key_Mode_switch, +#endif // XK_KOREAN + + // dead keys + XK_dead_grave, Qt::Key_Dead_Grave, + XK_dead_acute, Qt::Key_Dead_Acute, + XK_dead_circumflex, Qt::Key_Dead_Circumflex, + XK_dead_tilde, Qt::Key_Dead_Tilde, + XK_dead_macron, Qt::Key_Dead_Macron, + XK_dead_breve, Qt::Key_Dead_Breve, + XK_dead_abovedot, Qt::Key_Dead_Abovedot, + XK_dead_diaeresis, Qt::Key_Dead_Diaeresis, + XK_dead_abovering, Qt::Key_Dead_Abovering, + XK_dead_doubleacute, Qt::Key_Dead_Doubleacute, + XK_dead_caron, Qt::Key_Dead_Caron, + XK_dead_cedilla, Qt::Key_Dead_Cedilla, + XK_dead_ogonek, Qt::Key_Dead_Ogonek, + XK_dead_iota, Qt::Key_Dead_Iota, + XK_dead_voiced_sound, Qt::Key_Dead_Voiced_Sound, + XK_dead_semivoiced_sound, Qt::Key_Dead_Semivoiced_Sound, + XK_dead_belowdot, Qt::Key_Dead_Belowdot, + XK_dead_hook, Qt::Key_Dead_Hook, + XK_dead_horn, Qt::Key_Dead_Horn, + +#if 0 + // Special multimedia keys + // currently only tested with MS internet keyboard + + // browsing keys + XF86XK_Back, Qt::Key_Back, + XF86XK_Forward, Qt::Key_Forward, + XF86XK_Stop, Qt::Key_Stop, + XF86XK_Refresh, Qt::Key_Refresh, + XF86XK_Favorites, Qt::Key_Favorites, + XF86XK_AudioMedia, Qt::Key_LaunchMedia, + XF86XK_OpenURL, Qt::Key_OpenUrl, + XF86XK_HomePage, Qt::Key_HomePage, + XF86XK_Search, Qt::Key_Search, + + // media keys + XF86XK_AudioLowerVolume, Qt::Key_VolumeDown, + XF86XK_AudioMute, Qt::Key_VolumeMute, + XF86XK_AudioRaiseVolume, Qt::Key_VolumeUp, + XF86XK_AudioPlay, Qt::Key_MediaPlay, + XF86XK_AudioStop, Qt::Key_MediaStop, + XF86XK_AudioPrev, Qt::Key_MediaPrevious, + XF86XK_AudioNext, Qt::Key_MediaNext, + XF86XK_AudioRecord, Qt::Key_MediaRecord, + + // launch keys + XF86XK_Mail, Qt::Key_LaunchMail, + XF86XK_MyComputer, Qt::Key_Launch0, + XF86XK_Calculator, Qt::Key_Launch1, + XF86XK_Standby, Qt::Key_Standby, + + XF86XK_Launch0, Qt::Key_Launch2, + XF86XK_Launch1, Qt::Key_Launch3, + XF86XK_Launch2, Qt::Key_Launch4, + XF86XK_Launch3, Qt::Key_Launch5, + XF86XK_Launch4, Qt::Key_Launch6, + XF86XK_Launch5, Qt::Key_Launch7, + XF86XK_Launch6, Qt::Key_Launch8, + XF86XK_Launch7, Qt::Key_Launch9, + XF86XK_Launch8, Qt::Key_LaunchA, + XF86XK_Launch9, Qt::Key_LaunchB, + XF86XK_LaunchA, Qt::Key_LaunchC, + XF86XK_LaunchB, Qt::Key_LaunchD, + XF86XK_LaunchC, Qt::Key_LaunchE, + XF86XK_LaunchD, Qt::Key_LaunchF, +#endif + +#if 0 + // Qtopia keys + QTOPIAXK_Select, Qt::Key_Select, + QTOPIAXK_Yes, Qt::Key_Yes, + QTOPIAXK_No, Qt::Key_No, + QTOPIAXK_Cancel, Qt::Key_Cancel, + QTOPIAXK_Printer, Qt::Key_Printer, + QTOPIAXK_Execute, Qt::Key_Execute, + QTOPIAXK_Sleep, Qt::Key_Sleep, + QTOPIAXK_Play, Qt::Key_Play, + QTOPIAXK_Zoom, Qt::Key_Zoom, + QTOPIAXK_Context1, Qt::Key_Context1, + QTOPIAXK_Context2, Qt::Key_Context2, + QTOPIAXK_Context3, Qt::Key_Context3, + QTOPIAXK_Context4, Qt::Key_Context4, + QTOPIAXK_Call, Qt::Key_Call, + QTOPIAXK_Hangup, Qt::Key_Hangup, + QTOPIAXK_Flip, Qt::Key_Flip, +#endif + 0, 0 +}; + + +static int lookupCode(unsigned int xkeycode) +{ + if (xkeycode >= XK_F1 && xkeycode <= XK_F35) + return Qt::Key_F1 + (int(xkeycode) - XK_F1); + + const unsigned int *p = keyTbl; + while (*p) { + if (*p == xkeycode) + return *++p; + p += 2; + } + + return 0; +} + + +static Qt::KeyboardModifiers modifierFromKeyCode(int qtcode) +{ + switch (qtcode) { + case Qt::Key_Control: + return Qt::ControlModifier; + case Qt::Key_Alt: + return Qt::AltModifier; + case Qt::Key_Shift: + return Qt::ShiftModifier; + case Qt::Key_Meta: + return Qt::MetaModifier; + default: + return Qt::NoModifier; + } +} + +void QTestLiteWindowSurface::handleKeyEvent(QEvent::Type type, void *ev) +{ + XKeyEvent *e = static_cast(ev); + + KeySym keySym; + QByteArray chars; + chars.resize(513); + + int count = XLookupString(e, chars.data(), chars.size(), &keySym, 0); + +// qDebug() << "QTLWS::handleKeyEvent" << count << hex << "XKeysym:" << keySym; +// if (count) +// qDebug() << hex << int(chars[0]) << "String:" << chars; + + Qt::KeyboardModifiers modifiers = translateModifiers(e->state); + + int qtcode = lookupCode(keySym); +// qDebug() << "lookup: " << hex << keySym << qtcode << "mod" << modifiers; + + //X11 specifies state *before*, Qt expects state *after* the event + + modifiers ^= modifierFromKeyCode(qtcode); + + if (qtcode) { + QWindowSystemInterface::handleKeyEvent(window(), e->time, type, qtcode, modifiers); + } else if (chars[0]) { + int qtcode = chars.toUpper()[0]; //Not exactly right... + if (modifiers & Qt::ControlModifier && qtcode < ' ') + qtcode = chars[0] + '@'; + QWindowSystemInterface::handleKeyEvent(window(), e->time, type, qtcode, modifiers, QString::fromLatin1(chars)); + } else { + qWarning() << "unknown X keycode" << hex << e->keycode << keySym; + } +} + + + +Qt::WindowFlags QTestLiteWindowSurface::setWindowFlags(Qt::WindowFlags flags) +{ + Q_ASSERT(flags & Qt::Window); + + window_flags = flags; + + xw->setWindowFlags(flags); + + return window_flags; + +} + +Qt::WindowFlags QTestLiteWindowSurface::windowFlags() const +{ + return window_flags; +} + +void QTestLiteWindowSurface::setVisible(bool visible) +{ + //qDebug() << "QTestLiteWindowSurface::setVisible" << visible << xw->window; + xw->setVisible(visible); +} + + +WId QTestLiteWindowSurface::winId() const +{ + if (xw) + return (WId) xw->window; + else + return WId(0); +} + +void QTestLiteWindowSurface::raise() +{ + WId window = winId(); + XRaiseWindow(mGraphicsSystem->xd->display, window); +} + +void QTestLiteWindowSurface::lower() +{ + WId window = winId(); + XLowerWindow(mGraphicsSystem->xd->display, window); +} + +void QTestLiteWindowSurface::setWindowTitle(const QString &title) +{ + xw->setWindowTitle(title); +} + +void QTestLiteWindowSurface::setCursor(QCursor *cursor) +{ + xw->setCursor(cursor); +} +QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qwindowsurface_testlite.h b/src/plugins/platforms/testlite/qwindowsurface_testlite.h new file mode 100644 index 0000000..0c4df1a --- /dev/null +++ b/src/plugins/platforms/testlite/qwindowsurface_testlite.h @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSURFACE_TESTLITE_H +#define QWINDOWSURFACE_TESTLITE_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class MyWindow; +class QTestLiteGraphicsSystem; +class QTestLiteGraphicsSystemScreen; + +class QTestLiteWindowSurface : public QWindowSurface +{ +public: + QTestLiteWindowSurface + (QTestLiteGraphicsSystem *graphicsSystem, + QTestLiteGraphicsSystemScreen *screen, QWidget *window); + ~QTestLiteWindowSurface(); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void setGeometry(const QRect &rect); + bool scroll(const QRegion &area, int dx, int dy); + + void beginPaint(const QRegion ®ion); + void endPaint(const QRegion ®ion); + + void handleMouseEvent(QEvent::Type, void *); //forwarding X types is apparently impossible :( + void handleKeyEvent(QEvent::Type, void *); + void handleGeometryChange(int x, int y, int w, int h); + void handleCloseEvent(); + void handleEnterEvent(); + void handleLeaveEvent(); + + Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); + Qt::WindowFlags windowFlags() const; + void setVisible(bool visible); + WId winId() const; + void raise(); + void lower(); + void setWindowTitle(const QString &title); + + void setCursor(QCursor * cursor); + +private: + QTestLiteGraphicsSystem *mGraphicsSystem; + QTestLiteGraphicsSystemScreen *mScreen; + Qt::WindowFlags window_flags; + MyWindow *xw; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/testlite/testlite.pro b/src/plugins/platforms/testlite/testlite.pro new file mode 100644 index 0000000..d483f45 --- /dev/null +++ b/src/plugins/platforms/testlite/testlite.pro @@ -0,0 +1,17 @@ +TARGET = qtestlitegraphicssystem +include(../../qpluginbase.pri) + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems + +SOURCES = main.cpp qgraphicssystem_testlite.cpp qwindowsurface_testlite.cpp +HEADERS = qgraphicssystem_testlite.h qwindowsurface_testlite.h + + +HEADERS += x11util.h +SOURCES += x11util.cpp + +LIBS += -lX11 -lXext + + +target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +INSTALLS += target diff --git a/src/plugins/platforms/testlite/x11util.cpp b/src/plugins/platforms/testlite/x11util.cpp new file mode 100644 index 0000000..6d2966f --- /dev/null +++ b/src/plugins/platforms/testlite/x11util.cpp @@ -0,0 +1,1215 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include +#include +#include + +#include "x11util.h" +#include "qwindowsurface_testlite.h" + +#include +#include + + +#include + +#include + +# include +# include +# include + + +#include +#include +#include +#include + +//### remove stuff we don't want from qt_x11_p.h +#undef ATOM +#undef X11 + +//#define MYX11_DEBUG + +//#define DONT_USE_MIT_SHM + +static int (*original_x_errhandler)(Display *dpy, XErrorEvent *); +static bool seen_badwindow; + + +static Atom wmProtocolsAtom; +static Atom wmDeleteWindowAtom; + +//### copied from qapplication_x11.cpp + +static int qt_x_errhandler(Display *dpy, XErrorEvent *err) +{ + +qDebug() << "qt_x_errhandler" << err->error_code; + + switch (err->error_code) { + case BadAtom: +#if 0 + if (err->request_code == 20 /* X_GetProperty */ + && (err->resourceid == XA_RESOURCE_MANAGER + || err->resourceid == XA_RGB_DEFAULT_MAP + || err->resourceid == ATOM(_NET_SUPPORTED) + || err->resourceid == ATOM(_NET_SUPPORTING_WM_CHECK) + || err->resourceid == ATOM(KDE_FULL_SESSION) + || err->resourceid == ATOM(KWIN_RUNNING) + || err->resourceid == ATOM(XdndProxy) + || err->resourceid == ATOM(XdndAware)) + + + ) { + // Perhaps we're running under SECURITY reduction? :/ + return 0; + } +#endif + qDebug() << "BadAtom"; + break; + + case BadWindow: + if (err->request_code == 2 /* X_ChangeWindowAttributes */ + || err->request_code == 38 /* X_QueryPointer */) { + for (int i = 0; i < ScreenCount(dpy); ++i) { + if (err->resourceid == RootWindow(dpy, i)) { + // Perhaps we're running under SECURITY reduction? :/ + return 0; + } + } + } + seen_badwindow = true; + if (err->request_code == 25 /* X_SendEvent */) { + for (int i = 0; i < ScreenCount(dpy); ++i) { + if (err->resourceid == RootWindow(dpy, i)) { + // Perhaps we're running under SECURITY reduction? :/ + return 0; + } + } +#if 0 + if (X11->xdndHandleBadwindow()) { + qDebug("xdndHandleBadwindow returned true"); + return 0; + } +#endif + } +#if 0 + if (X11->ignore_badwindow) + return 0; +#endif + break; + + case BadMatch: + if (err->request_code == 42 /* X_SetInputFocus */) + return 0; + break; + + default: +#if 0 //!defined(QT_NO_XINPUT) + if (err->request_code == X11->xinput_major + && err->error_code == (X11->xinput_errorbase + XI_BadDevice) + && err->minor_code == 3 /* X_OpenDevice */) { + return 0; + } +#endif + break; + } + + char errstr[256]; + XGetErrorText( dpy, err->error_code, errstr, 256 ); + char buffer[256]; + char request_str[256]; + qsnprintf(buffer, 256, "%d", err->request_code); + XGetErrorDatabaseText(dpy, "XRequest", buffer, "", request_str, 256); + if (err->request_code < 128) { + // X error for a normal protocol request + qWarning( "X Error: %s %d\n" + " Major opcode: %d (%s)\n" + " Resource id: 0x%lx", + errstr, err->error_code, + err->request_code, + request_str, + err->resourceid ); + } else { + // X error for an extension request + const char *extensionName = 0; +#if 0 + if (err->request_code == X11->xrender_major) + extensionName = "RENDER"; + else if (err->request_code == X11->xrandr_major) + extensionName = "RANDR"; + else if (err->request_code == X11->xinput_major) + extensionName = "XInputExtension"; + else if (err->request_code == X11->mitshm_major) + extensionName = "MIT-SHM"; +#endif + char minor_str[256]; + if (extensionName) { + qsnprintf(buffer, 256, "%s.%d", extensionName, err->minor_code); + XGetErrorDatabaseText(dpy, "XRequest", buffer, "", minor_str, 256); + } else { + extensionName = "Uknown extension"; + qsnprintf(minor_str, 256, "Unknown request"); + } + qWarning( "X Error: %s %d\n" + " Extension: %d (%s)\n" + " Minor opcode: %d (%s)\n" + " Resource id: 0x%lx", + errstr, err->error_code, + err->request_code, + extensionName, + err->minor_code, + minor_str, + err->resourceid ); + } + + // ### we really should distinguish between severe, non-severe and + // ### application specific errors + + return 0; +} + + + + + + + + + +bool MyDisplay::handleEvent(XEvent *xe) +{ + //qDebug() << "handleEvent" << xe->xany.type << xe->xany.window; + int quit = false; + MyWindow *xw = 0; + foreach (MyWindow *w, windowList) { + if (w->window == xe->xany.window) { + xw = w; + break; + } + } + if (!xw) { +#ifdef MYX11_DEBUG + qWarning() << "Unknown window" << hex << xe->xany.window << "received event" << xe->type; +#endif + return quit; + } + + switch (xe->type) { + + case ClientMessage: + if (xe->xclient.format == 32 && xe->xclient.message_type == wmProtocolsAtom) { + Atom a = xe->xclient.data.l[0]; + if (a == wmDeleteWindowAtom) + xw->closeEvent(); +#ifdef MYX11_DEBUG + qDebug() << "ClientMessage WM_PROTOCOLS" << a; +#endif + } +#ifdef MYX11_DEBUG + else + qDebug() << "ClientMessage" << xe->xclient.format << xe->xclient.message_type; +#endif + break; + + case Expose: + if (xw) + if (xe->xexpose.count == 0) + xw->paintEvent(); + break; + case ConfigureNotify: + if (xw) + xw->resizeEvent(&xe->xconfigure); + break; + + case ButtonPress: + xw->mousePressEvent(&xe->xbutton); + break; + + case ButtonRelease: + xw->mouseReleaseEvent(&xe->xbutton); + break; + + case MotionNotify: + xw->mouseMoveEvent(&xe->xbutton); + break; + + case XKeyPress: + xw->keyPressEvent(&xe->xkey); + break; + + case XKeyRelease: + xw->keyReleaseEvent(&xe->xkey); + break; + + case EnterNotify: + xw->enterEvent(&xe->xcrossing); + break; + + case LeaveNotify: + xw->leaveEvent(&xe->xcrossing); + break; + + default: +#ifdef MYX11_DEBUG + qDebug() << hex << xe->xany.window << "Other X event" << xe->type; +#endif + break; + } + return quit; +}; + + + +MyDisplay::MyDisplay() +{ + char *display_name = getenv("DISPLAY"); + display = XOpenDisplay(display_name); + if (!display) { + fprintf(stderr, "Cannot connect to X server: %s\n", + display_name); + exit(1); + } + +#ifndef DONT_USE_MIT_SHM + Status MIT_SHM_extension_supported = XShmQueryExtension (display); + Q_ASSERT(MIT_SHM_extension_supported == True); +#endif + original_x_errhandler = XSetErrorHandler(qt_x_errhandler); + + if (qgetenv("DO_X_SYNCHRONIZE").toInt()) + XSynchronize(display, true); + + screen = DefaultScreen(display); + width = DisplayWidth(display, screen); + height = DisplayHeight(display, screen); + physicalWidth = DisplayWidthMM(display, screen); + physicalHeight = DisplayHeightMM(display, screen); + + int xSocketNumber = XConnectionNumber(display); +#ifdef MYX11_DEBUG + qDebug() << "X socket:"<< xSocketNumber; +#endif + QSocketNotifier *sock = new QSocketNotifier(xSocketNumber, QSocketNotifier::Read, this); + connect(sock, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); + + wmProtocolsAtom = XInternAtom (display, "WM_PROTOCOLS", False); + wmDeleteWindowAtom = XInternAtom (display, "WM_DELETE_WINDOW", False); + + cursors = new MyX11Cursors(display); +} + + +MyDisplay::~MyDisplay() +{ + XCloseDisplay(display); +} + + +void MyDisplay::eventDispatcher() +{ +// qDebug() << "eventDispatcher"; + + + ulong marker = XNextRequest(display); +// int i = 0; + while (XPending(display)) { + XEvent event; + XNextEvent(display, &event); + /* done = */ + handleEvent(&event); + + if (event.xany.serial >= marker) { +#ifdef MYX11_DEBUG + qDebug() << "potential livelock averted"; +#endif +#if 0 + if (XEventsQueued(display, QueuedAfterFlush)) { + qDebug() << " with events queued"; + QTimer::singleShot(0, this, SLOT(eventDispatcher())); + } +#endif + break; + } + } +} + + +QImage MyDisplay::grabWindow(Window window, int x, int y, int w, int h) +{ + if (w == 0 || h ==0) + return QImage(); + + //WinId 0 means the desktop widget + if (!window) + window = rootWindow(); + + XWindowAttributes window_attr; + if (!XGetWindowAttributes(display, window, &window_attr)) + return QImage(); + + if (w < 0) + w = window_attr.width - x; + if (h < 0) + h = window_attr.height - y; + + // Ideally, we should also limit ourselves to the screen area, but the Qt docs say + // that it's "unsafe" to go outside the screen, so we can ignore that problem. + + //We're definitely not optimizing for speed... + XImage *xi = XGetImage(display, window, x, y, w, h, AllPlanes, ZPixmap); + + if (!xi) + return QImage(); + + //taking a copy to make sure we have ownership -- not fast + QImage result = QImage( (uchar*) xi->data, xi->width, xi->height, xi->bytes_per_line, QImage::Format_RGB32 ).copy(); + + XDestroyImage(xi); + + return result; +} + + + + +struct MyShmImageInfo { + MyShmImageInfo(Display *xdisplay) : image(0), display(xdisplay) {} + ~MyShmImageInfo() { destroy(); } + + void destroy(); + + XShmSegmentInfo shminfo; + XImage *image; + Display *display; +}; + +MyWindow::MyWindow(MyDisplay *display, int x, int y, int w, int h) +{ + xd = display; + + xd->windowList.append(this); + + window = XCreateSimpleWindow(xd->display, xd->rootWindow(), + x, y, w, h, 0 /*border_width*/, + xd->blackPixel(), xd->whitePixel()); + + +#ifdef MYX11_DEBUG + qDebug() << "MyWindow::MyWindow" << hex << window; +#endif + + + width = -1; + height = -1; + xpos = -1; + ypos = -1; + + XSetWindowBackgroundPixmap(xd->display, window, XNone); + + XSelectInput(xd->display, window, ExposureMask | KeyPressMask | KeyReleaseMask | + EnterWindowMask | LeaveWindowMask | FocusChangeMask | + PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | + StructureNotifyMask); + + gc = createGC(); + + XChangeProperty (xd->display, window, + wmProtocolsAtom, + XA_ATOM, 32, PropModeAppend, + (unsigned char *) &wmDeleteWindowAtom, 1); + + + setWindowTitle(QLatin1String("Qt Lighthouse")); + + currentCursor = -1; + + image_info = 0; + painted = false; +} + + +void MyWindow::setWindowTitle(const QString &title) + +{ + QByteArray ba = title.toLatin1(); //We're not making a general solution here... + XTextProperty windowName; + windowName.value = (unsigned char *)ba.constData(); + windowName.encoding = XA_STRING; + windowName.format = 8; + windowName.nitems = ba.length(); + + XSetWMName(xd->display, window, &windowName); +} + +MyWindow::~MyWindow() +{ +#ifdef MYX11_DEBUG + qDebug() << "~MyWindow" << hex << window; +#endif + XFreeGC(xd->display, gc); + XDestroyWindow(xd->display, window); + + xd->windowList.removeAll(this); + + delete image_info; +} + +GC MyWindow::createGC() +{ + GC gc; + + gc = XCreateGC(xd->display, window, 0, 0); + if (gc < 0) { + qWarning("MyWindow::createGC() could not create GC"); + } + return gc; +} + +void MyWindow::closeEvent() +{ + windowSurface->handleCloseEvent(); +} + +void MyWindow::paintEvent() +{ +#ifdef MYX11_DEBUG + qDebug() << "MyWindow::paintEvent" << shm_img.size() << painted; +#endif + if (!painted) + return; + +#ifdef DONT_USE_MIT_SHM + // just convert the image every time... + if (!shm_img.isNull()) { + Visual *visual = DefaultVisual(xd->display, xd->screen); + + QImage image = shm_img; + //img.convertToFormat( + XImage *xi = XCreateImage(xd->display, visual, 24, ZPixmap, + 0, (char *) image.scanLine(0), image.width(), image.height(), + 32, image.bytesPerLine()); + + int x = 0; + int y = 0; + + /*int r =*/ XPutImage(xd->display, window, gc, xi, 0, 0, x, y, image.width(), image.height()); + + xi->data = 0; // QImage owns these bits + XDestroyImage(xi); + } +#else + // Use MIT_SHM + if (image_info->image) { + //qDebug() << "Here we go" << image_info->image->width << image_info->image->height; + int x = 0; + int y = 0; + + // We could set send_event to true, and then use the ShmCompletion to synchronize, + // but let's do like Qt/11 and just use XSync + XShmPutImage (xd->display, window, gc, image_info->image, 0, 0, + x, y, image_info->image->width, image_info->image->height, + /*send_event*/ False); + + XSync(xd->display, False); + } +#endif +} + +#ifndef DONT_USE_MIT_SHM +void MyShmImageInfo::destroy() +{ + XShmDetach (display, &shminfo); + XDestroyImage (image); + shmdt (shminfo.shmaddr); + shmctl (shminfo.shmid, IPC_RMID, 0); +} +#endif + +void MyWindow::resizeShmImage(int width, int height) +{ +#ifdef DONT_USE_MIT_SHM + shm_img = QImage(width, height, QImage::Format_RGB32); +#else + if (image_info) + image_info->destroy(); + else + image_info = new MyShmImageInfo(xd->display); + + Visual *visual = DefaultVisual(xd->display, xd->screen); + + + XImage *image = XShmCreateImage (xd->display, visual, 24, ZPixmap, 0, + &image_info->shminfo, width, height); + + + image_info->shminfo.shmid = shmget (IPC_PRIVATE, + image->bytes_per_line * image->height, IPC_CREAT|0777); + + image_info->shminfo.shmaddr = image->data = (char*)shmat (image_info->shminfo.shmid, 0, 0); + image_info->shminfo.readOnly = False; + + image_info->image = image; + + Status shm_attach_status = XShmAttach(xd->display, &image_info->shminfo); + + Q_ASSERT(shm_attach_status == True); + + shm_img = QImage( (uchar*) image->data, image->width, image->height, image->bytes_per_line, QImage::Format_RGB32 ); +#endif + painted = false; +} + + +void MyWindow::resizeBuffer(QSize s) +{ + if (shm_img.size() != s) + resizeShmImage(s.width(), s.height()); +} + +QSize MyWindow::bufferSize() const +{ + return shm_img.size(); +} + + +void MyWindow::resizeEvent(XConfigureEvent *e) +{ + + if ((e->width != width || e->height != height) && e->x == 0 && e->y == 0) { + //qDebug() << "resize with bogus pos" << e->x << e->y << e->width << e->height << "window"<< hex << window; + } else { + //qDebug() << "geometry change" << e->x << e->y << e->width << e->height << "window"<< hex << window; + xpos = e->x; + ypos = e->y; + } + width = e->width; + height = e->height; + +#ifdef MYX11_DEBUG + qDebug() << hex << window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << "geometry" << xpos << ypos << width << height << "img:" << shm_img.size(); +#endif + + windowSurface->handleGeometryChange(xpos, ypos, width, height); +} + +#if 0 +void MyWindow::setSize(int w, int h) +{ + XResizeWindow(xd->display, window, w, h); +} +#endif + +void MyWindow::setGeometry(int x, int y, int w, int h) +{ +#ifdef MYX11_DEBUG + qDebug() << "MyWindow::setGeometry" << hex << window << dec << x << y << w << h << "img:" << shm_img.size(); +#endif + XMoveResizeWindow(xd->display, window, x, y, w, h); +} + + +void MyWindow::enterEvent(XCrossingEvent *) +{ +#ifdef MYX11_DEBUG + qDebug() << "MyWindow::enterEvent" << hex << window; +#endif + windowSurface->handleEnterEvent(); +} + +void MyWindow::leaveEvent(XCrossingEvent *) +{ +#ifdef MYX11_DEBUG + qDebug() << "MyWindow::enterEvent" << hex << window; +#endif + windowSurface->handleLeaveEvent(); +} + +void MyWindow::mousePressEvent(XButtonEvent *e) +{ + static long prevTime = 0; + static Window prevWindow; + static int prevX = -999; + static int prevY = -999; + + QEvent::Type type = QEvent::MouseButtonPress; + + if (e->window == prevWindow && long(e->time) - prevTime < QApplication::doubleClickInterval() + && qAbs(e->x - prevX) < 5 && qAbs(e->y - prevY) < 5) { + type = QEvent::MouseButtonDblClick; + prevTime = e->time - QApplication::doubleClickInterval(); //no double click next time + } else { + prevTime = e->time; + } + prevWindow = e->window; + prevX = e->x; + prevY = e->y; + + windowSurface->handleMouseEvent(type, e); +} + +void MyWindow::mouseReleaseEvent(XButtonEvent *e) +{ + windowSurface->handleMouseEvent(QEvent::MouseButtonRelease, e); +} + +void MyWindow::mouseMoveEvent(XButtonEvent *e) +{ + windowSurface->handleMouseEvent(QEvent::MouseMove, e); +} + +#ifdef KeyPress +#undef KeyPress +#endif + +void MyWindow::keyPressEvent(XKeyEvent *e) +{ + windowSurface->handleKeyEvent(QEvent::KeyPress, e); +} + +#ifdef KeyRelease +#undef KeyRelease +#endif + +void MyWindow::keyReleaseEvent(XKeyEvent *e) +{ + windowSurface->handleKeyEvent(QEvent::KeyRelease, e); +} + + +// WindowFlag stuff, lots of copied code from qwidget_x11.cpp... + +//We're hacking here... + + +// MWM support +struct QtMWMHints { + ulong flags, functions, decorations; + long input_mode; + ulong status; +}; + +enum { + MWM_HINTS_FUNCTIONS = (1L << 0), + + MWM_FUNC_ALL = (1L << 0), + MWM_FUNC_RESIZE = (1L << 1), + MWM_FUNC_MOVE = (1L << 2), + MWM_FUNC_MINIMIZE = (1L << 3), + MWM_FUNC_MAXIMIZE = (1L << 4), + MWM_FUNC_CLOSE = (1L << 5), + + MWM_HINTS_DECORATIONS = (1L << 1), + + MWM_DECOR_ALL = (1L << 0), + MWM_DECOR_BORDER = (1L << 1), + MWM_DECOR_RESIZEH = (1L << 2), + MWM_DECOR_TITLE = (1L << 3), + MWM_DECOR_MENU = (1L << 4), + MWM_DECOR_MINIMIZE = (1L << 5), + MWM_DECOR_MAXIMIZE = (1L << 6), + + MWM_HINTS_INPUT_MODE = (1L << 2), + + MWM_INPUT_MODELESS = 0L, + MWM_INPUT_PRIMARY_APPLICATION_MODAL = 1L, + MWM_INPUT_FULL_APPLICATION_MODAL = 3L +}; + +static Atom mwm_hint_atom = XNone; + +static QtMWMHints GetMWMHints(Display *display, Window window) +{ + QtMWMHints mwmhints; + + Atom type; + int format; + ulong nitems, bytesLeft; + uchar *data = 0; + if ((XGetWindowProperty(display, window, mwm_hint_atom, 0, 5, false, + mwm_hint_atom, &type, &format, &nitems, &bytesLeft, + &data) == Success) + && (type == mwm_hint_atom + && format == 32 + && nitems >= 5)) { + mwmhints = *(reinterpret_cast(data)); + } else { + mwmhints.flags = 0L; + mwmhints.functions = MWM_FUNC_ALL; + mwmhints.decorations = MWM_DECOR_ALL; + mwmhints.input_mode = 0L; + mwmhints.status = 0L; + } + + if (data) + XFree(data); + + return mwmhints; +} + +static void SetMWMHints(Display *display, Window window, const QtMWMHints &mwmhints) +{ + if (mwmhints.flags != 0l) { + XChangeProperty(display, window, mwm_hint_atom, mwm_hint_atom, 32, + PropModeReplace, (unsigned char *) &mwmhints, 5); + } else { + XDeleteProperty(display, window, mwm_hint_atom); + } +} + +// Returns true if we should set WM_TRANSIENT_FOR on \a w +static inline bool isTransient(const QWidget *w) +{ + return ((w->windowType() == Qt::Dialog + || w->windowType() == Qt::Sheet + || w->windowType() == Qt::Tool + || w->windowType() == Qt::SplashScreen + || w->windowType() == Qt::ToolTip + || w->windowType() == Qt::Drawer + || w->windowType() == Qt::Popup) + && !w->testAttribute(Qt::WA_X11BypassTransientForHint)); +} + + + +Qt::WindowFlags MyWindow::setWindowFlags(Qt::WindowFlags flags) +{ + + if (mwm_hint_atom == XNone) { + mwm_hint_atom = XInternAtom(xd->display, "_MOTIF_WM_HINTS\0", False); + } + +#ifdef MYX11_DEBUG + qDebug() << "MyWindow::setWindowFlags" << hex << window << "flags" << flags; +#endif + Qt::WindowType type = static_cast(int(flags & Qt::WindowType_Mask)); + + if (type == Qt::ToolTip) + flags |= Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint; + if (type == Qt::Popup) + flags |= Qt::X11BypassWindowManagerHint; + + bool topLevel = (flags & Qt::Window); + bool popup = (type == Qt::Popup); + bool dialog = (type == Qt::Dialog + || type == Qt::Sheet); + bool desktop = (type == Qt::Desktop); + bool tool = (type == Qt::Tool || type == Qt::SplashScreen + || type == Qt::ToolTip || type == Qt::Drawer); + + bool tooltip = (type == Qt::ToolTip); + + XSetWindowAttributes wsa; + + QtMWMHints mwmhints; + mwmhints.flags = 0L; + mwmhints.functions = 0L; + mwmhints.decorations = 0; + mwmhints.input_mode = 0L; + mwmhints.status = 0L; + + + ulong wsa_mask = 0; + if (type != Qt::SplashScreen) { // && customize) { + mwmhints.flags |= MWM_HINTS_DECORATIONS; + + bool customize = flags & Qt::CustomizeWindowHint; + if (!(flags & Qt::FramelessWindowHint) && !(customize && !(flags & Qt::WindowTitleHint))) { + mwmhints.decorations |= MWM_DECOR_BORDER; + mwmhints.decorations |= MWM_DECOR_RESIZEH; + + if (flags & Qt::WindowTitleHint) + mwmhints.decorations |= MWM_DECOR_TITLE; + + if (flags & Qt::WindowSystemMenuHint) + mwmhints.decorations |= MWM_DECOR_MENU; + + if (flags & Qt::WindowMinimizeButtonHint) { + mwmhints.decorations |= MWM_DECOR_MINIMIZE; + mwmhints.functions |= MWM_FUNC_MINIMIZE; + } + + if (flags & Qt::WindowMaximizeButtonHint) { + mwmhints.decorations |= MWM_DECOR_MAXIMIZE; + mwmhints.functions |= MWM_FUNC_MAXIMIZE; + } + + if (flags & Qt::WindowCloseButtonHint) + mwmhints.functions |= MWM_FUNC_CLOSE; + } + } else { + // if type == Qt::SplashScreen + mwmhints.decorations = MWM_DECOR_ALL; + } + + if (tool) { + wsa.save_under = True; + wsa_mask |= CWSaveUnder; + } + + if (flags & Qt::X11BypassWindowManagerHint) { + wsa.override_redirect = True; + wsa_mask |= CWOverrideRedirect; + } +#if 0 + if (wsa_mask && initializeWindow) { + Q_ASSERT(id); + XChangeWindowAttributes(dpy, id, wsa_mask, &wsa); + } +#endif + if (mwmhints.functions != 0) { + mwmhints.flags |= MWM_HINTS_FUNCTIONS; + mwmhints.functions |= MWM_FUNC_MOVE | MWM_FUNC_RESIZE; + } else { + mwmhints.functions = MWM_FUNC_ALL; + } + + if (!(flags & Qt::FramelessWindowHint) + && flags & Qt::CustomizeWindowHint + && flags & Qt::WindowTitleHint + && !(flags & + (Qt::WindowMinimizeButtonHint + | Qt::WindowMaximizeButtonHint + | Qt::WindowCloseButtonHint))) { + // a special case - only the titlebar without any button + mwmhints.flags = MWM_HINTS_FUNCTIONS; + mwmhints.functions = MWM_FUNC_MOVE | MWM_FUNC_RESIZE; + mwmhints.decorations = 0; + } + + SetMWMHints(xd->display, window, mwmhints); + +//##### only if initializeWindow??? + + if (popup || tooltip) { // popup widget +#ifdef MYX11_DEBUG + qDebug() << "Doing XChangeWindowAttributes for popup" << wsa.override_redirect; +#endif + // set EWMH window types + // setNetWmWindowTypes(); + + wsa.override_redirect = True; + wsa.save_under = True; + XChangeWindowAttributes(xd->display, window, CWOverrideRedirect | CWSaveUnder, + &wsa); + } else { +#ifdef MYX11_DEBUG + qDebug() << "Doing XChangeWindowAttributes for non-popup"; +#endif + } + + return flags; +} + +void MyWindow::setVisible(bool visible) +{ +#ifdef MYX11_DEBUG + qDebug() << "MyWindow::setVisible" << visible << hex << window; +#endif + if (visible) + XMapWindow(xd->display, window); + else + XUnmapWindow(xd->display, window); +} + +MyX11Cursors::MyX11Cursors(Display * d) : firstExpired(0), lastExpired(0), display(d), removalDelay(3) +{ + connect(&timer, SIGNAL(timeout()), this, SLOT(timeout())); +} + +void MyX11Cursors::insertNode(MyX11CursorNode * node) +{ + QDateTime now = QDateTime::currentDateTime(); + QDateTime timeout = now.addSecs(removalDelay); + node->setExpiration(timeout); + node->setPost(0); + if (lastExpired) { + lastExpired->setPost(node); + node->setAnte(lastExpired); + } + lastExpired = node; + if (!firstExpired) { + firstExpired = node; + node->setAnte(0); + int interval = removalDelay * 1000; + timer.setInterval(interval); + timer.start(); + } +} + +void MyX11Cursors::removeNode(MyX11CursorNode * node) +{ + MyX11CursorNode *pre = node->ante(); + MyX11CursorNode *post = node->post(); + if (pre) + pre->setPost(post); + if (post) + post->setAnte(pre); + if (node == lastExpired) + lastExpired = pre; + if (node == firstExpired) { + firstExpired = post; + if (!firstExpired) { + timer.stop(); + return; + } + int interval = QDateTime::currentDateTime().secsTo(firstExpired->expiration()) * 1000; + timer.stop(); + timer.setInterval(interval); + timer.start(); + } +} + +void MyX11Cursors::incrementUseCount(int id) +{ + MyX11CursorNode * node = lookupMap.value(id); + Q_ASSERT(node); + if (!node->refCount) + removeNode(node); + node->refCount++; +} + +void MyX11Cursors::decrementUseCount(int id) +{ + MyX11CursorNode * node = lookupMap.value(id); + Q_ASSERT(node); + node->refCount--; + if (!node->refCount) + insertNode(node); +} + +void MyX11Cursors::createNode(int id, Cursor c) +{ + MyX11CursorNode * node = new MyX11CursorNode(id, c); + lookupMap.insert(id, node); +} + +void MyX11Cursors::timeout() +{ + MyX11CursorNode * node; + node = firstExpired; + QDateTime now = QDateTime::currentDateTime(); + while (node && now.secsTo(node->expiration()) < 1) { + Cursor c = node->cursor(); + int id = node->id(); + lookupMap.take(id); + MyX11CursorNode * tmp = node; + node = node->post(); + delete tmp; + XFreeCursor(display, c); + } + firstExpired = node; + if (node == 0) { + timer.stop(); + lastExpired = 0; + } + else { + int interval = QDateTime::currentDateTime().secsTo(firstExpired->expiration()) * 1000; + timer.setInterval(interval); + timer.start(); + } +} + +Cursor MyX11Cursors::cursor(int id) +{ + MyX11CursorNode * node = lookupMap.value(id); + Q_ASSERT(node); + return node->cursor(); +} + +void MyWindow::setCursor(QCursor * cursor) +{ + int id = cursor->handle(); + if (id == currentCursor) + return; + Cursor c; + if (!xd->cursors->exists(id)) { + if (cursor->shape() == Qt::BitmapCursor) + c = createCursorBitmap(cursor); + else + c = createCursorShape(cursor->shape()); + if (!c) { + return; + } + xd->cursors->createNode(id, c); + } else { + xd->cursors->incrementUseCount(id); + c = xd->cursors->cursor(id); + } + + if (currentCursor != -1) + xd->cursors->decrementUseCount(currentCursor); + currentCursor = id; + + XDefineCursor(xd->display, window, c); + XFlush(xd->display); +} + +Cursor MyWindow::createCursorBitmap(QCursor * cursor) +{ + XColor bg, fg; + bg.red = 255 << 8; + bg.green = 255 << 8; + bg.blue = 255 << 8; + fg.red = 0; + fg.green = 0; + fg.blue = 0; + QPoint spot = cursor->hotSpot(); + Window rootwin = window; + + QImage mapImage = cursor->bitmap()->toImage().convertToFormat(QImage::Format_MonoLSB); + QImage maskImage = cursor->mask()->toImage().convertToFormat(QImage::Format_MonoLSB); + + int width = cursor->bitmap()->width(); + int height = cursor->bitmap()->height(); + int bytesPerLine = mapImage.bytesPerLine(); + int destLineSize = width / 8; + if (width % 8) + destLineSize++; + + const uchar * map = mapImage.bits(); + const uchar * mask = maskImage.bits(); + + char * mapBits = new char[height * destLineSize]; + char * maskBits = new char[height * destLineSize]; + for (int i = 0; i < height; i++) { + memcpy(mapBits + (destLineSize * i),map + (bytesPerLine * i), destLineSize); + memcpy(maskBits + (destLineSize * i),mask + (bytesPerLine * i), destLineSize); + } + + Pixmap cp = XCreateBitmapFromData(xd->display, rootwin, mapBits, width, height); + Pixmap mp = XCreateBitmapFromData(xd->display, rootwin, maskBits, width, height); + Cursor c = XCreatePixmapCursor(xd->display, cp, mp, &fg, &bg, spot.x(), spot.y()); + XFreePixmap(xd->display, cp); + XFreePixmap(xd->display, mp); + delete[] mapBits; + delete[] maskBits; + + return c; +} + +Cursor MyWindow::createCursorShape(int cshape) +{ + Cursor cursor = 0; + + if (cshape < 0 || cshape > Qt::LastCursor) + return 0; + + switch (cshape) { + case Qt::ArrowCursor: + cursor = XCreateFontCursor(xd->display, XC_left_ptr); + break; + case Qt::UpArrowCursor: + cursor = XCreateFontCursor(xd->display, XC_center_ptr); + break; + case Qt::CrossCursor: + cursor = XCreateFontCursor(xd->display, XC_crosshair); + break; + case Qt::WaitCursor: + cursor = XCreateFontCursor(xd->display, XC_watch); + break; + case Qt::IBeamCursor: + cursor = XCreateFontCursor(xd->display, XC_xterm); + break; + case Qt::SizeAllCursor: + cursor = XCreateFontCursor(xd->display, XC_fleur); + break; + case Qt::PointingHandCursor: + cursor = XCreateFontCursor(xd->display, XC_hand2); + break; + case Qt::SizeBDiagCursor: + cursor = XCreateFontCursor(xd->display, XC_top_right_corner); + break; + case Qt::SizeFDiagCursor: + cursor = XCreateFontCursor(xd->display, XC_bottom_right_corner); + break; + case Qt::SizeVerCursor: + case Qt::SplitVCursor: + cursor = XCreateFontCursor(xd->display, XC_sb_v_double_arrow); + break; + case Qt::SizeHorCursor: + case Qt::SplitHCursor: + cursor = XCreateFontCursor(xd->display, XC_sb_h_double_arrow); + break; + case Qt::WhatsThisCursor: + cursor = XCreateFontCursor(xd->display, XC_question_arrow); + break; + case Qt::ForbiddenCursor: + cursor = XCreateFontCursor(xd->display, XC_circle); + break; + case Qt::BusyCursor: + cursor = XCreateFontCursor(xd->display, XC_watch); + break; + + default: //default cursor for all the rest + break; + } + return cursor; +} + + +#if 0 + + + switch (cshape) { // map Q cursor to X cursor + case Qt::BlankCursor: + XColor bg, fg; + bg.red = 255 << 8; + bg.green = 255 << 8; + bg.blue = 255 << 8; + fg.red = 0; + fg.green = 0; + fg.blue = 0; + pm = XCreateBitmapFromData(dpy, rootwin, cur_blank_bits, 16, 16); + pmm = XCreateBitmapFromData(dpy, rootwin, cur_blank_bits, 16, 16); + hcurs = XCreatePixmapCursor(dpy, pm, pmm, &fg, &bg, 8, 8); + return; + break; + default: + qWarning("QCursor::update: Invalid cursor shape %d", cshape); + return; + } +#endif diff --git a/src/plugins/platforms/testlite/x11util.h b/src/plugins/platforms/testlite/x11util.h new file mode 100644 index 0000000..79e7461 --- /dev/null +++ b/src/plugins/platforms/testlite/x11util.h @@ -0,0 +1,204 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MYX11UTIL_H +#define MYX11UTIL_H + +#include +#include +#include +#include + +#include + +#include +#include + + +class MyWindow; +class MyX11Cursors; + +class MyDisplay : public QObject +{ + Q_OBJECT; +public: + MyDisplay(); + ~MyDisplay(); + + Window rootWindow() { return RootWindow(display, screen); } + unsigned long blackPixel() { return BlackPixel(display, screen); } + unsigned long whitePixel() { return WhitePixel(display, screen); } + + bool handleEvent(XEvent *xe); + QImage grabWindow(Window window, int x, int y, int w, int h); + +public slots: + void eventDispatcher(); + +public: //### + Display * display; + int screen; + int width, height; + int physicalWidth; + int physicalHeight; + + QList windowList; + + MyX11Cursors * cursors; +}; + +class QTestLiteWindowSurface; //### abstract callback interface, anyone? + +struct MyShmImageInfo; + +class MyWindow : public QObject +{ + Q_OBJECT; +public: + MyWindow(MyDisplay *xd, int x, int y, int w, int h); + ~MyWindow(); + + + void mousePressEvent(XButtonEvent*); + void mouseReleaseEvent(XButtonEvent*); + void mouseMoveEvent(XButtonEvent*); + + void keyPressEvent(XKeyEvent*); + void keyReleaseEvent(XKeyEvent*); + + void enterEvent(XCrossingEvent*); + void leaveEvent(XCrossingEvent*); + + void closeEvent(); + void paintEvent(); + void resizeEvent(XConfigureEvent *configure_event); +// void setSize(int w, int h); + void setGeometry(int x, int y, int w, int h); + + GC createGC(); + + Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); + void setVisible(bool visible); + void setCursor(QCursor * cursor); + Cursor createCursorShape(int cshape); + Cursor createCursorBitmap(QCursor * cursor); + + void setWindowTitle(const QString &title); + + QImage *image() { return &shm_img; } + +public: //### + + int xpos, ypos; + int width, height; + Window window; + MyDisplay *xd; + GC gc; + + QTestLiteWindowSurface *windowSurface; + + int currentCursor; + bool painted; + void resizeBuffer(QSize); + QSize bufferSize() const; + +private: + void resizeShmImage(int width, int height); + + QImage shm_img; + MyShmImageInfo *image_info; +}; + +class MyX11CursorNode +{ +public: + MyX11CursorNode(int id, Cursor c) { idValue = id; cursorValue = c; refCount = 1; } + QDateTime expiration() { return t; } + void setExpiration(QDateTime val) { t = val; } + MyX11CursorNode * ante() { return before; } + void setAnte(MyX11CursorNode *node) { before = node; } + MyX11CursorNode * post() { return after; } + void setPost(MyX11CursorNode *node) { after = node; } + Cursor cursor() { return cursorValue; } + int id() { return idValue; } + unsigned int refCount; + +private: + MyX11CursorNode *before; + MyX11CursorNode *after; + QDateTime t; + Cursor cursorValue; + int idValue; + + Display * display; +}; + +class MyX11Cursors : public QObject +{ + Q_OBJECT +public: + MyX11Cursors(Display * d); + ~MyX11Cursors() { timer.stop(); } + void incrementUseCount(int id); + void decrementUseCount(int id); + void createNode(int id, Cursor c); + bool exists(int id) { return lookupMap.contains(id); } + Cursor cursor(int id); +public slots: + void timeout(); + +private: + void removeNode(MyX11CursorNode *node); + void insertNode(MyX11CursorNode *node); + + // linked list of cursors currently not assigned to any window + MyX11CursorNode *firstExpired; + MyX11CursorNode *lastExpired; + + QHash lookupMap; + QTimer timer; + + Display *display; + + int removalDelay; +}; + +#endif // MYX11UTIL_H diff --git a/src/plugins/platforms/vnc/main.cpp b/src/plugins/platforms/vnc/main.cpp new file mode 100644 index 0000000..f10748a --- /dev/null +++ b/src/plugins/platforms/vnc/main.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qgraphicssystem_vnc.h" +#include + +QT_BEGIN_NAMESPACE + +class QVNCGraphicsSystemPlugin : public QGraphicsSystemPlugin +{ +public: + QStringList keys() const; + QGraphicsSystem *create(const QString&); +}; + +QStringList QVNCGraphicsSystemPlugin::keys() const +{ + QStringList list; + list << "VNC"; + return list; +} + +QGraphicsSystem* QVNCGraphicsSystemPlugin::create(const QString& system) +{ + if (system.toLower() == "vnc") + return new QVNCGraphicsSystem; + + return 0; +} + +Q_EXPORT_PLUGIN2(vnc, QVNCGraphicsSystemPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp b/src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp new file mode 100644 index 0000000..7815f24 --- /dev/null +++ b/src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgraphicssystem_vnc.h" +#include "../fb_base/fb_base.h" +#include +#include +#include + +#include +#include + +#include + + +QVNCGraphicsSystemScreen::QVNCGraphicsSystemScreen() + : QGraphicsSystemFbScreen::QGraphicsSystemFbScreen() +{ + int w = 800; + int h = 600; + int ew, eh; + const char *str; + if ((str=::getenv("QT_VNC_SIZE")) && sscanf(str,"%dx%d",&ew,&eh)==2) { + w = ew; + h = eh; + } + + setGeometry(QRect(0,0,w, h)); + setDepth(32); + setFormat(QImage::Format_RGB32); + setPhysicalSize((geometry().size()*254)/720); + + + d_ptr = new QVNCGraphicsSystemScreenPrivate(this); + + cursor = new QVNCCursor(d_ptr->vncServer, this); + d_ptr->vncServer->setCursor(static_cast(cursor)); +} + +QVNCDirtyMap *QVNCGraphicsSystemScreen::dirtyMap() +{ + return d_ptr->dirty; +} + +QRegion QVNCGraphicsSystemScreen::doRedraw() +{ + QRegion touched; + touched = QGraphicsSystemFbScreen::doRedraw(); + + QVector rects = touched.rects(); + for (int i = 0; i < rects.size(); i++) + d_ptr->setDirty(rects[i]); + return touched; +} + + +QVNCGraphicsSystem::QVNCGraphicsSystem() +{ + mPrimaryScreen = new QVNCGraphicsSystemScreen(); + + mScreens.append(mPrimaryScreen); +} + +QPixmapData *QVNCGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const +{ + return new QRasterPixmapData(type); +} + +QWindowSurface *QVNCGraphicsSystem::createWindowSurface(QWidget *widget) const +{ + if (widget->windowType() == Qt::Desktop) + return 0; // Don't create an explicit window surface for the destkop. + QGraphicsSystemFbWindowSurface * surface; + surface = new QGraphicsSystemFbWindowSurface(mPrimaryScreen, widget); + mPrimaryScreen->addWindowSurface(surface); + return surface; +} diff --git a/src/plugins/platforms/vnc/qgraphicssystem_vnc.h b/src/plugins/platforms/vnc/qgraphicssystem_vnc.h new file mode 100644 index 0000000..b3349b7 --- /dev/null +++ b/src/plugins/platforms/vnc/qgraphicssystem_vnc.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_VNC_H +#define QGRAPHICSSYSTEM_VNC_H + +#include +#include "qvnccursor.h" +#include "../fb_base/fb_base.h" + +QT_BEGIN_NAMESPACE + +class QVNCServer; +class QVNCDirtyMap; + +class QVNCGraphicsSystemScreenPrivate; + +class QVNCGraphicsSystemScreen : public QGraphicsSystemFbScreen +{ +public: + QVNCGraphicsSystemScreen(); + + int linestep() const { return image() ? image()->bytesPerLine() : 0; } + uchar *base() const { return image() ? image()->bits() : 0; } + QVNCDirtyMap *dirtyMap(); + +public: + QVNCGraphicsSystemScreenPrivate *d_ptr; + +private: + QVNCServer *server; + QRegion doRedraw(); +}; + +class QVNCGraphicsSystemPrivate; + + +class QVNCGraphicsSystem : public QGraphicsSystem +{ +public: + QVNCGraphicsSystem(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QWindowSurface *createWindowSurface(QWidget *widget) const; + + QList screens() const { return mScreens; } + + +private: + QVNCGraphicsSystemScreen *mPrimaryScreen; + QList mScreens; +}; + + + +QT_END_NAMESPACE + +#endif //QGRAPHICSSYSTEM_VNC_H + diff --git a/src/plugins/platforms/vnc/qvnccursor.cpp b/src/plugins/platforms/vnc/qvnccursor.cpp new file mode 100644 index 0000000..fb214d8 --- /dev/null +++ b/src/plugins/platforms/vnc/qvnccursor.cpp @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include + +#include + +#include "qvnccursor.h" +#include "qvncserver.h" +#include "qgraphicssystem_vnc.h" + +QT_BEGIN_NAMESPACE + +QVNCCursor::QVNCCursor(QVNCServer * srvr, QVNCGraphicsSystemScreen *scr ) + :QGraphicsSystemSoftwareCursor(scr), useVncCursor(false), server(srvr) +{ +} + +void QVNCCursor::changeCursor(QCursor * widgetCursor, QWidget * widget) +{ + QGraphicsSystemSoftwareCursor::changeCursor(widgetCursor, widget); + if (useVncCursor) { + server->setDirtyCursor(); + } else { + screen->setDirty(QRect(0,0,1,1)); + } +} + +void QVNCCursor::setCursorMode(bool vnc) +{ + if (vnc) { + screen->setDirty(dirtyRect()); + server->setDirtyCursor(); + } else { + server->setDirtyCursor(); + } + useVncCursor = vnc; +} + +QRect QVNCCursor::drawCursor(QPainter & painter) +{ + if (useVncCursor) + return QRect(); + + return QGraphicsSystemSoftwareCursor::drawCursor(painter); +} + +void QVNCCursor::clearClientCursor() +{ + QTcpSocket *socket = server->clientSocket(); + if (!socket) { + return; + } + // FramebufferUpdate header + { + const quint16 tmp[6] = { htons(0), + htons(1), + htons(0), htons(0), + htons(0), + htons(0) }; + socket->write((char*)tmp, sizeof(tmp)); + + const quint32 encoding = htonl(-239); + socket->write((char*)(&encoding), sizeof(encoding)); + } +} + +void QVNCCursor::sendClientCursor() +{ + if (useVncCursor == false) { + clearClientCursor(); + return; + } + QImage *image = graphic->image(); + if (image->isNull()) + return; + QTcpSocket *socket = server->clientSocket(); + if (!socket) { + return; + } + // FramebufferUpdate header + { + const quint16 tmp[6] = { htons(0), + htons(1), + htons(graphic->hotspot().x()), htons(graphic->hotspot().y()), + htons(image->width()), + htons(image->height()) }; + socket->write((char*)tmp, sizeof(tmp)); + + const quint32 encoding = htonl(-239); + socket->write((char*)(&encoding), sizeof(encoding)); + } + + // write pixels + //Q_ASSERT(cursor->hasAlphaChannel()); + const QImage img = image->convertToFormat(QImage::Format_RGB32); + const int n = server->clientBytesPerPixel() * img.width(); + char *buffer = new char[n]; + for (int i = 0; i < img.height(); ++i) { + server->convertPixels(buffer, (const char*)img.scanLine(i), img.width()); + socket->write(buffer, n); + } + delete[] buffer; + + // write mask + const QImage bitmap = image->createAlphaMask().convertToFormat(QImage::Format_Mono); + Q_ASSERT(bitmap.depth() == 1); + Q_ASSERT(bitmap.size() == img.size()); + const int width = (bitmap.width() + 7) / 8; + for (int i = 0; i < bitmap.height(); ++i) + socket->write((const char*)bitmap.scanLine(i), width); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/vnc/qvnccursor.h b/src/plugins/platforms/vnc/qvnccursor.h new file mode 100644 index 0000000..8ea0f45 --- /dev/null +++ b/src/plugins/platforms/vnc/qvnccursor.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QVNCCURSOR_H +#define QVNCCURSOR_H + +#include "../fb_base/fb_base.h" +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QVNCGraphicsSystemScreen; +class QVNCServer; + +class QVNCCursor : public QGraphicsSystemSoftwareCursor { +public: + QVNCCursor(QVNCServer *, QVNCGraphicsSystemScreen *); + + // input methods + void setCursorMode(bool vnc); + void changeCursor(QCursor * widgetCursor, QWidget * widget); + + // output methods + QRect drawCursor(QPainter &); + + // VNC client communication + void sendClientCursor(); + void clearClientCursor(); +private: + bool useVncCursor; // VNC or local + + QVNCServer * server; // VNC server to get events from +}; + +QT_END_NAMESPACE + +#endif // QVNCCURSOR_H diff --git a/src/plugins/platforms/vnc/qvncserver.cpp b/src/plugins/platforms/vnc/qvncserver.cpp new file mode 100644 index 0000000..ea576d4 --- /dev/null +++ b/src/plugins/platforms/vnc/qvncserver.cpp @@ -0,0 +1,1935 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qvncserver.h" + +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include + +#include + + +#define QT_QWS_VNC_DEBUG +#define QT_NO_QWS_CURSOR //### + + +QT_BEGIN_NAMESPACE + + + +//copied from qscreen_qws.h +#ifndef QT_QWS_DEPTH16_RGB +#define QT_QWS_DEPTH16_RGB 565 +#endif +static const int qt_rbits = (QT_QWS_DEPTH16_RGB/100); +static const int qt_gbits = (QT_QWS_DEPTH16_RGB/10%10); +static const int qt_bbits = (QT_QWS_DEPTH16_RGB%10); +static const int qt_red_shift = qt_bbits+qt_gbits-(8-qt_rbits); +static const int qt_green_shift = qt_bbits-(8-qt_gbits); +static const int qt_neg_blue_shift = 8-qt_bbits; +static const int qt_blue_mask = (1<> qt_red_shift | r >> qt_red_rounding_shift; + const int tg = g >> qt_green_shift | g >> qt_green_rounding_shift; + const int tb = b << qt_neg_blue_shift | b >> qt_blue_rounding_shift; + + return qRgb(tr,tg,tb); +} + + + +//=========================================================================== + +static const struct { + int keysym; + int keycode; +} keyMap[] = { + { 0xff08, Qt::Key_Backspace }, + { 0xff09, Qt::Key_Tab }, + { 0xff0d, Qt::Key_Return }, + { 0xff1b, Qt::Key_Escape }, + { 0xff63, Qt::Key_Insert }, + { 0xffff, Qt::Key_Delete }, + { 0xff50, Qt::Key_Home }, + { 0xff57, Qt::Key_End }, + { 0xff55, Qt::Key_PageUp }, + { 0xff56, Qt::Key_PageDown }, + { 0xff51, Qt::Key_Left }, + { 0xff52, Qt::Key_Up }, + { 0xff53, Qt::Key_Right }, + { 0xff54, Qt::Key_Down }, + { 0xffbe, Qt::Key_F1 }, + { 0xffbf, Qt::Key_F2 }, + { 0xffc0, Qt::Key_F3 }, + { 0xffc1, Qt::Key_F4 }, + { 0xffc2, Qt::Key_F5 }, + { 0xffc3, Qt::Key_F6 }, + { 0xffc4, Qt::Key_F7 }, + { 0xffc5, Qt::Key_F8 }, + { 0xffc6, Qt::Key_F9 }, + { 0xffc7, Qt::Key_F10 }, + { 0xffc8, Qt::Key_F11 }, + { 0xffc9, Qt::Key_F12 }, + { 0xffe1, Qt::Key_Shift }, + { 0xffe2, Qt::Key_Shift }, + { 0xffe3, Qt::Key_Control }, + { 0xffe4, Qt::Key_Control }, + { 0xffe7, Qt::Key_Meta }, + { 0xffe8, Qt::Key_Meta }, + { 0xffe9, Qt::Key_Alt }, + { 0xffea, Qt::Key_Alt }, + { 0, 0 } +}; + +void QRfbRect::read(QTcpSocket *s) +{ + quint16 buf[4]; + s->read((char*)buf, 8); + x = ntohs(buf[0]); + y = ntohs(buf[1]); + w = ntohs(buf[2]); + h = ntohs(buf[3]); +} + +void QRfbRect::write(QTcpSocket *s) const +{ + quint16 buf[4]; + buf[0] = htons(x); + buf[1] = htons(y); + buf[2] = htons(w); + buf[3] = htons(h); + s->write((char*)buf, 8); +} + +void QRfbPixelFormat::read(QTcpSocket *s) +{ + char buf[16]; + s->read(buf, 16); + bitsPerPixel = buf[0]; + depth = buf[1]; + bigEndian = buf[2]; + trueColor = buf[3]; + + quint16 a = ntohs(*(quint16 *)(buf + 4)); + redBits = 0; + while (a) { a >>= 1; redBits++; } + + a = ntohs(*(quint16 *)(buf + 6)); + greenBits = 0; + while (a) { a >>= 1; greenBits++; } + + a = ntohs(*(quint16 *)(buf + 8)); + blueBits = 0; + while (a) { a >>= 1; blueBits++; } + + redShift = buf[10]; + greenShift = buf[11]; + blueShift = buf[12]; +} + +void QRfbPixelFormat::write(QTcpSocket *s) +{ + char buf[16]; + buf[0] = bitsPerPixel; + buf[1] = depth; + buf[2] = bigEndian; + buf[3] = trueColor; + + quint16 a = 0; + for (int i = 0; i < redBits; i++) a = (a << 1) | 1; + *(quint16 *)(buf + 4) = htons(a); + + a = 0; + for (int i = 0; i < greenBits; i++) a = (a << 1) | 1; + *(quint16 *)(buf + 6) = htons(a); + + a = 0; + for (int i = 0; i < blueBits; i++) a = (a << 1) | 1; + *(quint16 *)(buf + 8) = htons(a); + + buf[10] = redShift; + buf[11] = greenShift; + buf[12] = blueShift; + s->write(buf, 16); +} + + +void QRfbServerInit::setName(const char *n) +{ + delete[] name; + name = new char [strlen(n) + 1]; + strcpy(name, n); +} + +void QRfbServerInit::read(QTcpSocket *s) +{ + s->read((char *)&width, 2); + width = ntohs(width); + s->read((char *)&height, 2); + height = ntohs(height); + format.read(s); + + quint32 len; + s->read((char *)&len, 4); + len = ntohl(len); + + name = new char [len + 1]; + s->read(name, len); + name[len] = '\0'; +} + +void QRfbServerInit::write(QTcpSocket *s) +{ + quint16 t = htons(width); + s->write((char *)&t, 2); + t = htons(height); + s->write((char *)&t, 2); + format.write(s); + quint32 len = strlen(name); + len = htonl(len); + s->write((char *)&len, 4); + s->write(name, strlen(name)); +} + +bool QRfbSetEncodings::read(QTcpSocket *s) +{ + if (s->bytesAvailable() < 3) + return false; + + char tmp; + s->read(&tmp, 1); // padding + s->read((char *)&count, 2); + count = ntohs(count); + + return true; +} + +bool QRfbFrameBufferUpdateRequest::read(QTcpSocket *s) +{ + if (s->bytesAvailable() < 9) + return false; + + s->read(&incremental, 1); + rect.read(s); + + return true; +} + +bool QRfbKeyEvent::read(QTcpSocket *s) +{ + if (s->bytesAvailable() < 7) + return false; + + s->read(&down, 1); + quint16 tmp; + s->read((char *)&tmp, 2); // padding + + quint32 key; + s->read((char *)&key, 4); + key = ntohl(key); + + unicode = 0; + keycode = 0; + int i = 0; + while (keyMap[i].keysym && !keycode) { + if (keyMap[i].keysym == (int)key) + keycode = keyMap[i].keycode; + i++; + } + if (!keycode) { + if (key <= 0xff) { + unicode = key; + if (key >= 'a' && key <= 'z') + keycode = Qt::Key_A + key - 'a'; + else if (key >= ' ' && key <= '~') + keycode = Qt::Key_Space + key - ' '; + } + } + + return true; +} + +bool QRfbPointerEvent::read(QTcpSocket *s) +{ + if (s->bytesAvailable() < 5) + return false; + + char buttonMask; + s->read(&buttonMask, 1); + + buttons = Qt::NoButton; + wheelDirection = WheelNone; + if (buttonMask & 1) + buttons |= Qt::LeftButton; + if (buttonMask & 2) + buttons |= Qt::MidButton; + if (buttonMask & 4) + buttons |= Qt::RightButton; + if (buttonMask & 8) + wheelDirection = WheelUp; + if (buttonMask & 16) + wheelDirection = WheelDown; + if (buttonMask & 32) + wheelDirection = WheelLeft; + if (buttonMask & 64) + wheelDirection = WheelRight; + + quint16 tmp; + s->read((char *)&tmp, 2); + x = ntohs(tmp); + s->read((char *)&tmp, 2); + y = ntohs(tmp); + + return true; +} + +bool QRfbClientCutText::read(QTcpSocket *s) +{ + if (s->bytesAvailable() < 7) + return false; + + char tmp[3]; + s->read(tmp, 3); // padding + s->read((char *)&length, 4); + length = ntohl(length); + + return true; +} + +//=========================================================================== + +QVNCServer::QVNCServer(QVNCGraphicsSystemScreen *screen) + : qvnc_screen(screen), cursor(0) +{ + init(5900); +} + +QVNCServer::QVNCServer(QVNCGraphicsSystemScreen *screen, int id) + : qvnc_screen(screen), cursor(0) +{ + init(5900 + id); +} + +void QVNCServer::init(uint port) +{ + qDebug() << "QVNCServer::init" << port; + + handleMsg = false; + client = 0; + encodingsPending = 0; + cutTextPending = 0; + keymod = 0; + state = Unconnected; + dirtyCursor = false; + + refreshRate = 25; + timer = new QTimer(this); + timer->setSingleShot(true); + connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate())); + + serverSocket = new QTcpServer(this); + if (!serverSocket->listen(QHostAddress::Any, port)) + qDebug() << "QVNCServer could not connect:" << serverSocket->errorString(); + else + qDebug("QVNCServer created on port %d", port); + + connect(serverSocket, SIGNAL(newConnection()), this, SLOT(newConnection())); + +#ifndef QT_NO_QWS_CURSOR + qvnc_cursor = 0; +#endif + encoder = 0; +} + +QVNCServer::~QVNCServer() +{ + delete encoder; + encoder = 0; + delete client; + client = 0; +#ifndef QT_NO_QWS_CURSOR + delete qvnc_cursor; + qvnc_cursor = 0; +#endif +} + +void QVNCServer::setDirty() +{ + if (state == Connected && !timer->isActive() && + ((dirtyMap()->numDirty > 0) || dirtyCursor)) { + timer->start(); + } +} + +void QVNCServer::newConnection() +{ + if (client) + delete client; + + client = serverSocket->nextPendingConnection(); + connect(client,SIGNAL(readyRead()),this,SLOT(readClient())); + connect(client,SIGNAL(disconnected()),this,SLOT(discardClient())); + handleMsg = false; + encodingsPending = 0; + cutTextPending = 0; + supportHextile = false; + wantUpdate = false; + + timer->start(1000 / refreshRate); + dirtyMap()->reset(); + + // send protocol version + const char *proto = "RFB 003.003\n"; + client->write(proto, 12); + state = Protocol; + +// if (!qvnc_screen->screen()) +// QWSServer::instance()->enablePainting(true); +} + +void QVNCServer::readClient() +{ + switch (state) { + case Protocol: + if (client->bytesAvailable() >= 12) { + char proto[13]; + client->read(proto, 12); + proto[12] = '\0'; + qDebug("Client protocol version %s", proto); + // No authentication + quint32 auth = htonl(1); + client->write((char *) &auth, sizeof(auth)); + state = Init; + } + break; + + case Init: + if (client->bytesAvailable() >= 1) { + quint8 shared; + client->read((char *) &shared, 1); + + // Server Init msg + QRfbServerInit sim; + QRfbPixelFormat &format = sim.format; + switch (qvnc_screen->depth()) { + case 32: + format.bitsPerPixel = 32; + format.depth = 32; + format.bigEndian = 0; + format.trueColor = true; + format.redBits = 8; + format.greenBits = 8; + format.blueBits = 8; + format.redShift = 16; + format.greenShift = 8; + format.blueShift = 0; + break; + + case 24: + format.bitsPerPixel = 24; + format.depth = 24; + format.bigEndian = 0; + format.trueColor = true; + format.redBits = 8; + format.greenBits = 8; + format.blueBits = 8; + format.redShift = 16; + format.greenShift = 8; + format.blueShift = 0; + break; + + case 18: + format.bitsPerPixel = 24; + format.depth = 18; + format.bigEndian = 0; + format.trueColor = true; + format.redBits = 6; + format.greenBits = 6; + format.blueBits = 6; + format.redShift = 12; + format.greenShift = 6; + format.blueShift = 0; + break; + + case 16: + format.bitsPerPixel = 16; + format.depth = 16; + format.bigEndian = 0; + format.trueColor = true; + format.redBits = 5; + format.greenBits = 6; + format.blueBits = 5; + format.redShift = 11; + format.greenShift = 5; + format.blueShift = 0; + break; + + case 15: + format.bitsPerPixel = 16; + format.depth = 15; + format.bigEndian = 0; + format.trueColor = true; + format.redBits = 5; + format.greenBits = 5; + format.blueBits = 5; + format.redShift = 10; + format.greenShift = 5; + format.blueShift = 0; + break; + + case 12: + format.bitsPerPixel = 16; + format.depth = 12; + format.bigEndian = 0; + format.trueColor = true; + format.redBits = 4; + format.greenBits = 4; + format.blueBits = 4; + format.redShift = 8; + format.greenShift = 4; + format.blueShift = 0; + break; + + case 8: + case 4: + format.bitsPerPixel = 8; + format.depth = 8; + format.bigEndian = 0; + format.trueColor = false; + format.redBits = 0; + format.greenBits = 0; + format.blueBits = 0; + format.redShift = 0; + format.greenShift = 0; + format.blueShift = 0; + break; + + default: + qDebug("QVNC cannot drive depth %d", qvnc_screen->depth()); + discardClient(); + return; + } + sim.width = qvnc_screen->geometry().width(); + sim.height = qvnc_screen->geometry().height(); + sim.setName("Qt for Embedded Linux VNC Server"); + sim.write(client); + state = Connected; + } + break; + + case Connected: + do { + if (!handleMsg) { + client->read((char *)&msgType, 1); + handleMsg = true; + } + if (handleMsg) { + switch (msgType ) { + case SetPixelFormat: + setPixelFormat(); + break; + case FixColourMapEntries: + qDebug("Not supported: FixColourMapEntries"); + handleMsg = false; + break; + case SetEncodings: + setEncodings(); + break; + case FramebufferUpdateRequest: + frameBufferUpdateRequest(); + break; + case KeyEvent: + keyEvent(); + break; + case PointerEvent: + pointerEvent(); + break; + case ClientCutText: + clientCutText(); + break; + default: + qDebug("Unknown message type: %d", (int)msgType); + handleMsg = false; + } + } + } while (!handleMsg && client->bytesAvailable()); + break; + default: + break; + } +} + +#if 0//Q_BYTE_ORDER == Q_BIG_ENDIAN +bool QVNCGraphicsSystemScreen::swapBytes() const +{ + if (depth() != 16) + return false; + + if (screen()) + return screen()->frameBufferLittleEndian(); + return frameBufferLittleEndian(); +} +#endif + +void QVNCServer::setPixelFormat() +{ + if (client->bytesAvailable() >= 19) { + char buf[3]; + client->read(buf, 3); // just padding + pixelFormat.read(client); +#ifdef QT_QWS_VNC_DEBUG + qDebug("Want format: %d %d %d %d %d %d %d %d %d %d", + int(pixelFormat.bitsPerPixel), + int(pixelFormat.depth), + int(pixelFormat.bigEndian), + int(pixelFormat.trueColor), + int(pixelFormat.redBits), + int(pixelFormat.greenBits), + int(pixelFormat.blueBits), + int(pixelFormat.redShift), + int(pixelFormat.greenShift), + int(pixelFormat.blueShift)); +#endif + if (!pixelFormat.trueColor) { + qDebug("Can only handle true color clients"); + discardClient(); + } + handleMsg = false; + sameEndian = (QSysInfo::ByteOrder == QSysInfo::BigEndian) == !!pixelFormat.bigEndian; + needConversion = pixelConversionNeeded(); +#if Q_BYTE_ORDER == Q_BIG_ENDIAN + swapBytes = qvnc_screen->swapBytes(); +#endif + } +} + +void QVNCServer::setEncodings() +{ + QRfbSetEncodings enc; + + if (!encodingsPending && enc.read(client)) { + encodingsPending = enc.count; + if (!encodingsPending) + handleMsg = false; + } + + if (encoder) { + delete encoder; + encoder = 0; + } + + enum Encodings { + Raw = 0, + CopyRect = 1, + RRE = 2, + CoRRE = 4, + Hextile = 5, + ZRLE = 16, + Cursor = -239, + DesktopSize = -223 + }; + + supportCursor = false; + + if (encodingsPending && (unsigned)client->bytesAvailable() >= + encodingsPending * sizeof(quint32)) { + for (int i = 0; i < encodingsPending; ++i) { + qint32 enc; + client->read((char *)&enc, sizeof(qint32)); + enc = ntohl(enc); +#ifdef QT_QWS_VNC_DEBUG + qDebug("QVNCServer::setEncodings: %d", enc); +#endif + switch (enc) { + case Raw: + if (!encoder) { + encoder = new QRfbRawEncoder(this); +#ifdef QT_QWS_VNC_DEBUG + qDebug("QVNCServer::setEncodings: using raw"); +#endif + } + break; + case CopyRect: + supportCopyRect = true; + break; + case RRE: + supportRRE = true; + break; + case CoRRE: + supportCoRRE = true; + break; + case Hextile: + supportHextile = true; + if (encoder) + break; + switch (qvnc_screen->depth()) { +#ifdef QT_QWS_DEPTH_8 + case 8: + encoder = new QRfbHextileEncoder(this); + break; +#endif +#ifdef QT_QWS_DEPTH_12 + case 12: + encoder = new QRfbHextileEncoder(this); + break; +#endif +#ifdef QT_QWS_DEPTH_15 + case 15: + encoder = new QRfbHextileEncoder(this); + break; +#endif +#ifdef QT_QWS_DEPTH_16 + case 16: + encoder = new QRfbHextileEncoder(this); + break; +#endif +#ifdef QT_QWS_DEPTH_18 + case 18: + encoder = new QRfbHextileEncoder(this); + break; +#endif +#ifdef QT_QWS_DEPTH_24 + case 24: + encoder = new QRfbHextileEncoder(this); + break; +#endif +#ifdef QT_QWS_DEPTH_32 + case 32: + encoder = new QRfbHextileEncoder(this); + break; +#endif + default: + break; + } +#ifdef QT_QWS_VNC_DEBUG + qDebug("QVNCServer::setEncodings: using hextile"); +#endif + break; + case ZRLE: + supportZRLE = true; + break; + case Cursor: + supportCursor = true; +#ifndef QT_NO_QWS_CURSOR + if (!qvnc_screen->screen() || qt_screencursor->isAccelerated()) { + delete qvnc_cursor; + qvnc_cursor = new QVNCClientCursor(this); + } +#endif + break; + case DesktopSize: + supportDesktopSize = true; + break; + default: + break; + } + } + handleMsg = false; + encodingsPending = 0; + } + + if (!encoder) { + encoder = new QRfbRawEncoder(this); +#ifdef QT_QWS_VNC_DEBUG + qDebug("QVNCServer::setEncodings: fallback using raw"); +#endif + } + + if (cursor) + cursor->setCursorMode(supportCursor); +} + +void QVNCServer::frameBufferUpdateRequest() +{ + QRfbFrameBufferUpdateRequest ev; + + if (ev.read(client)) { + if (!ev.incremental) { + QRect r(ev.rect.x, ev.rect.y, ev.rect.w, ev.rect.h); +////### r.translate(qvnc_screen->offset()); + qvnc_screen->d_ptr->setDirty(r, true); + } + wantUpdate = true; + checkUpdate(); + handleMsg = false; + } +} + +static bool buttonChange(Qt::MouseButtons before, Qt::MouseButtons after, Qt::MouseButton *button, bool *isPress) +{ + if (before == after) + return false; + for (int b = Qt::LeftButton; b <= Qt::MidButton; b<<=1) { + if ((before & b) != (after & b)) { + *button = static_cast(b); + *isPress = (after & b); + return true; + } + } + return false; +} + +void QVNCServer::pointerEvent() +{ + QRfbPointerEvent ev; + if (ev.read(client)) { +// const QPoint offset = qvnc_screen->offset(); +// QWSServer::sendMouseEvent(offset + QPoint(ev.x, ev.y), ev.buttons); + + + //qDebug() << "pointerEvent" << ev.x << ev.y << hex << ev.buttons; + if (ev.wheelDirection == ev.WheelNone) { + QEvent::Type type = QEvent::MouseMove; + Qt::MouseButton button = Qt::NoButton; + bool isPress; + if (buttonChange(buttons, ev.buttons, &button, &isPress)) + type = isPress ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; + QWindowSystemInterface::handleMouseEvent(0, QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), ev.buttons); + } else { + // No buttons or motion reported at the same time as wheel events + Qt::Orientation orientation; + if (ev.wheelDirection == ev.WheelLeft || ev.wheelDirection == ev.WheelRight) + orientation = Qt::Horizontal; + else + orientation = Qt::Vertical; + int delta = 120 * ((ev.wheelDirection == ev.WheelLeft || ev.wheelDirection == ev.WheelUp) ? 1 : -1); + QWindowSystemInterface::handleWheelEvent(0, QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), delta, orientation); + } + handleMsg = false; + } +} + +void QVNCServer::keyEvent() +{ + QRfbKeyEvent ev; + + if (ev.read(client)) { + if (ev.keycode == Qt::Key_Shift) + keymod = ev.down ? keymod | Qt::ShiftModifier : + keymod & ~Qt::ShiftModifier; + else if (ev.keycode == Qt::Key_Control) + keymod = ev.down ? keymod | Qt::ControlModifier : + keymod & ~Qt::ControlModifier; + else if (ev.keycode == Qt::Key_Alt) + keymod = ev.down ? keymod | Qt::AltModifier : + keymod & ~Qt::AltModifier; + if (ev.unicode || ev.keycode) { +// qDebug() << "keyEvent" << hex << ev.unicode << ev.keycode << keymod << ev.down; + QEvent::Type type = ev.down ? QEvent::KeyPress : QEvent::KeyRelease; + QString str; + if (ev.unicode && ev.unicode != 0xffff) + str = QString(ev.unicode); + QWindowSystemInterface::handleKeyEvent(0, type, ev.keycode, keymod, str); + } + handleMsg = false; + } +} + +void QVNCServer::clientCutText() +{ + QRfbClientCutText ev; + + if (ev.read(client)) { + cutTextPending = ev.length; + if (!cutTextPending) + handleMsg = false; + } + + if (cutTextPending && client->bytesAvailable() >= cutTextPending) { + char *text = new char [cutTextPending+1]; + client->read(text, cutTextPending); + delete [] text; + cutTextPending = 0; + handleMsg = false; + } +} + +// stride in bytes +template +bool QRfbSingleColorHextile::read(const uchar *data, + int width, int height, int stride) +{ + const int depth = encoder->server->screen()->depth(); + if (width % (depth / 8)) // hw: should rather fallback to simple loop + return false; + + static int alwaysFalse = qgetenv("QT_VNC_NOCHECKFILL").toInt(); + if (alwaysFalse) + return false; + + switch (depth) { + case 4: { + const quint8 *data8 = reinterpret_cast(data); + if ((data8[0] & 0xf) != (data8[0] >> 4)) + return false; + width /= 2; + } // fallthrough + case 8: { + const quint8 *data8 = reinterpret_cast(data); + if (data8[0] != data8[1]) + return false; + width /= 2; + } // fallthrough + case 12: + case 15: + case 16: { + const quint16 *data16 = reinterpret_cast(data); + if (data16[0] != data16[1]) + return false; + width /= 2; + } // fallthrough + case 18: + case 24: + case 32: { + const quint32 *data32 = reinterpret_cast(data); + const quint32 first = data32[0]; + const int linestep = (stride / sizeof(quint32)) - width; + for (int y = 0; y < height; ++y) { + for (int x = 0; x < width; ++x) { + if (*(data32++) != first) + return false; + } + data32 += linestep; + } + break; + } + default: + return false; + } + + SRC color = reinterpret_cast(data)[0]; + encoder->newBg |= (color != encoder->bg); + encoder->bg = color; + return true; +} + +template +void QRfbSingleColorHextile::write(QTcpSocket *socket) const +{ + if (true || encoder->newBg) { + const int bpp = encoder->server->clientBytesPerPixel(); + const int padding = 3; + QVarLengthArray buffer(padding + 1 + bpp); + buffer[padding] = 2; // BackgroundSpecified + encoder->server->convertPixels(buffer.data() + padding + 1, + reinterpret_cast(&encoder->bg), + 1); + socket->write(buffer.data() + padding, bpp + 1); +// encoder->newBg = false; + } else { + char subenc = 0; + socket->write(&subenc, 1); + } +} + +template +bool QRfbDualColorHextile::read(const uchar *data, + int width, int height, int stride) +{ + const SRC *ptr = reinterpret_cast(data); + const int linestep = (stride / sizeof(SRC)) - width; + + SRC c1; + SRC c2 = 0; + int n1 = 0; + int n2 = 0; + int x = 0; + int y = 0; + + c1 = *ptr; + + // find second color + while (y < height) { + while (x < width) { + if (*ptr == c1) { + ++n1; + } else { + c2 = *ptr; + goto found_second_color; + } + ++ptr; + ++x; + } + x = 0; + ptr += linestep; + ++y; + } + +found_second_color: + // finish counting + while (y < height) { + while (x < width) { + if (*ptr == c1) { + ++n1; + } else if (*ptr == c2) { + ++n2; + } else { + return false; + } + ++ptr; + ++x; + } + x = 0; + ptr += linestep; + ++y; + } + + if (n2 > n1) { + const quint32 tmpC = c1; + c1 = c2; + c2 = tmpC; + } + + encoder->newBg |= (c1 != encoder->bg); + encoder->newFg |= (c2 != encoder->fg); + + encoder->bg = c1; + encoder->fg = c2; + + // create map + bool inRect = false; + numRects = 0; + ptr = reinterpret_cast(data); + for (y = 0; y < height; ++y) { + for (x = 0; x < width; ++x) { + if (inRect && *ptr == encoder->bg) { + // rect finished + setWidth(x - lastx()); + next(); + inRect = false; + } else if (!inRect && *ptr == encoder->fg) { + // rect start + setX(x); + setY(y); + setHeight(1); + inRect = true; + } + ++ptr; + } + if (inRect) { + // finish rect + setWidth(width - lastx()); + next(); + inRect = false; + } + ptr += linestep; + } + + return true; +} + +template +void QRfbDualColorHextile::write(QTcpSocket *socket) const +{ + const int bpp = encoder->server->clientBytesPerPixel(); + const int padding = 3; + QVarLengthArray buffer(padding + 2 * bpp + sizeof(char) + sizeof(numRects)); + char &subenc = buffer[padding]; + int n = padding + sizeof(subenc); + + subenc = 0x8; // AnySubrects + + if (encoder->newBg) { + subenc |= 0x2; // Background + encoder->server->convertPixels(buffer.data() + n, (char*)&encoder->bg, 1); + n += bpp; +// encoder->newBg = false; + } + + if (encoder->newFg) { + subenc |= 0x4; // Foreground + encoder->server->convertPixels(buffer.data() + n, (char*)&encoder->fg, 1); + n += bpp; +// encoder->newFg = false; + } + buffer[n] = numRects; + n += sizeof(numRects); + + socket->write(buffer.data() + padding, n - padding); + socket->write((char*)rects, numRects * sizeof(Rect)); +} + +template +void QRfbDualColorHextile::next() +{ + for (int r = numRects - 1; r >= 0; --r) { + if (recty(r) == lasty()) + continue; + if (recty(r) < lasty() - 1) // only search previous scanline + break; + if (rectx(r) == lastx() && width(r) == width(numRects)) { + ++rects[r].wh; + return; + } + } + ++numRects; +} + +template +inline void QRfbMultiColorHextile::setColor(SRC color) +{ + encoder->server->convertPixels(reinterpret_cast(rect(numRects)), + (const char*)&color, 1); +} + +template +inline bool QRfbMultiColorHextile::beginRect() +{ + if ((rects.size() + bpp + 2) > maxRectsSize) + return false; + rects.resize(rects.size() + bpp + 2); + return true; +} + +template +inline void QRfbMultiColorHextile::endRect() +{ + setHeight(numRects, 1); + ++numRects; +} + +template +bool QRfbMultiColorHextile::read(const uchar *data, + int width, int height, int stride) +{ + const SRC *ptr = reinterpret_cast(data); + const int linestep = (stride / sizeof(SRC)) - width; + + bpp = encoder->server->clientBytesPerPixel(); + + if (encoder->newBg) + encoder->bg = ptr[0]; + + const SRC bg = encoder->bg; + SRC color = bg; + bool inRect = false; + + numRects = 0; + rects.clear(); + + for (int y = 0; y < height; ++y) { + for (int x = 0; x < width; ++x) { + if (inRect && *ptr != color) { // end rect + setWidth(numRects, x - rectx(numRects)); + endRect(); + inRect = false; + } + + if (!inRect && *ptr != bg) { // begin rect + if (!beginRect()) + return false; + inRect = true; + color = *ptr; + setColor(color); + setX(numRects, x); + setY(numRects, y); + } + ++ptr; + } + if (inRect) { // end rect + setWidth(numRects, width - rectx(numRects)); + endRect(); + inRect = false; + } + ptr += linestep; + } + + return true; +} + +template +void QRfbMultiColorHextile::write(QTcpSocket *socket) const +{ + const int padding = 3; + QVarLengthArray buffer(bpp + padding + sizeof(quint8) + sizeof(numRects)); + + quint8 &subenc = buffer[padding]; + int n = padding + sizeof(quint8); + + subenc = 8 | 16; // AnySubrects | SubrectsColoured + + if (encoder->newBg) { + subenc |= 0x2; // Background + encoder->server->convertPixels(reinterpret_cast(buffer.data() + n), + reinterpret_cast(&encoder->bg), + 1); + n += bpp; +// encoder->newBg = false; + } + + buffer[n] = numRects; + n += sizeof(numRects); + + socket->write(reinterpret_cast(buffer.data() + padding), + n - padding); + socket->write(reinterpret_cast(rects.constData()), + rects.size()); +} + +bool QVNCServer::pixelConversionNeeded() const +{ + if (!sameEndian) + return true; + +#if Q_BYTE_ORDER == Q_BIG_ENDIAN + if (qvnc_screen->swapBytes()) + return true; +#endif + + const int screendepth = qvnc_screen->depth(); + if (screendepth != pixelFormat.bitsPerPixel) + return true; + + switch (screendepth) { + case 32: + case 24: + return false; + case 18: + return (pixelFormat.redBits == 6 + && pixelFormat.greenBits == 6 + && pixelFormat.blueBits == 6); + case 16: + return (pixelFormat.redBits == 5 + && pixelFormat.greenBits == 6 + && pixelFormat.blueBits == 5); + case 15: + return (pixelFormat.redBits == 5 + && pixelFormat.greenBits == 5 + && pixelFormat.blueBits == 5); + case 12: + return (pixelFormat.redBits == 4 + && pixelFormat.greenBits == 4 + && pixelFormat.blueBits == 4); + } + return true; +} + +// count: number of pixels +void QVNCServer::convertPixels(char *dst, const char *src, int count) const +{ + const int screendepth = qvnc_screen->depth(); + const bool isBgr = false; //### qvnc_screen->pixelType() == QScreen::BGRPixel; + + // cutoffs +#if Q_BYTE_ORDER == Q_BIG_ENDIAN + if (!swapBytes) +#endif + if (sameEndian) { + if (screendepth == pixelFormat.bitsPerPixel) { // memcpy cutoffs + + switch (screendepth) { + case 32: + memcpy(dst, src, count * sizeof(quint32)); + return; + case 16: + if (pixelFormat.redBits == 5 + && pixelFormat.greenBits == 6 + && pixelFormat.blueBits == 5) + { + memcpy(dst, src, count * sizeof(quint16)); + return; + } + } + } else if (screendepth == 16 && pixelFormat.bitsPerPixel == 32) { +#if defined(__i386__) // Currently fails on ARM if dst is not 4 byte aligned + const quint32 *src32 = reinterpret_cast(src); + quint32 *dst32 = reinterpret_cast(dst); + int count32 = count * sizeof(quint16) / sizeof(quint32); + while (count32--) { + const quint32 s = *src32++; + quint32 result1; + quint32 result2; + + // red + result1 = ((s & 0xf8000000) | ((s & 0xe0000000) >> 5)) >> 8; + result2 = ((s & 0x0000f800) | ((s & 0x0000e000) >> 5)) << 8; + + // green + result1 |= ((s & 0x07e00000) | ((s & 0x06000000) >> 6)) >> 11; + result2 |= ((s & 0x000007e0) | ((s & 0x00000600) >> 6)) << 5; + + // blue + result1 |= ((s & 0x001f0000) | ((s & 0x001c0000) >> 5)) >> 13; + result2 |= ((s & 0x0000001f) | ((s & 0x0000001c) >> 5)) << 3; + + *dst32++ = result2; + *dst32++ = result1; + } + if (count & 0x1) { + const quint16 *src16 = reinterpret_cast(src); + dst32[count - 1] = qt_conv16ToRgb(src16[count - 1]); + } + return; +#endif + } + } + + const int bytesPerPixel = (pixelFormat.bitsPerPixel + 7) / 8; + +// nibble = 0; + + for (int i = 0; i < count; ++i) { + int r, g, b; + + switch (screendepth) { +#if 0 + case 4: { + if (!nibble) { + r = ((*src) & 0x0f) << 4; + } else { + r = (*src) & 0xf0; + src++; + } + nibble = !nibble; + g = b = r; + break; + } +#endif +#if 0 + case 8: { + QRgb rgb = qvnc_screen->clut()[int(*src)]; + r = qRed(rgb); + g = qGreen(rgb); + b = qBlue(rgb); + src++; + break; + } +#endif +#ifdef QT_QWS_DEPTH_12 + case 12: { + quint32 p = quint32(*reinterpret_cast(src)); + r = qRed(p); + g = qGreen(p); + b = qBlue(p); + src += sizeof(qrgb444); + break; + } +#endif +#ifdef QT_QWS_DEPTH_15 + case 15: { + quint32 p = quint32(*reinterpret_cast(src)); + r = qRed(p); + g = qGreen(p); + b = qBlue(p); + src += sizeof(qrgb555); + break; + } +#endif + case 16: { + quint16 p = *reinterpret_cast(src); +#if Q_BYTE_ORDER == Q_BIG_ENDIAN + if (swapBytes) + p = ((p & 0xff) << 8) | ((p & 0xff00) >> 8); +#endif + r = (p >> 11) & 0x1f; + g = (p >> 5) & 0x3f; + b = p & 0x1f; + r <<= 3; + g <<= 2; + b <<= 3; + src += sizeof(quint16); + break; + } +#ifdef QT_QWS_DEPTH_18 + case 18: { + quint32 p = quint32(*reinterpret_cast(src)); + r = qRed(p); + g = qGreen(p); + b = qBlue(p); + src += sizeof(qrgb666); + break; + } +#endif +#ifdef QT_QWS_DEPTH_24 + case 24: { + quint32 p = quint32(*reinterpret_cast(src)); + r = qRed(p); + g = qGreen(p); + b = qBlue(p); + src += sizeof(qrgb888); + break; + } +#endif + case 32: { + quint32 p = *reinterpret_cast(src); + r = (p >> 16) & 0xff; + g = (p >> 8) & 0xff; + b = p & 0xff; + src += sizeof(quint32); + break; + } + default: { + r = g = b = 0; + qDebug("QVNCServer: don't support %dbpp display", screendepth); + return; + } + } + +#if Q_BYTE_ORDER == Q_BIG_ENDIAN + if (swapBytes ^ isBgr) +#else + if (isBgr) +#endif + qSwap(r, b); + + r >>= (8 - pixelFormat.redBits); + g >>= (8 - pixelFormat.greenBits); + b >>= (8 - pixelFormat.blueBits); + + int pixel = (r << pixelFormat.redShift) | + (g << pixelFormat.greenShift) | + (b << pixelFormat.blueShift); + + if (sameEndian || pixelFormat.bitsPerPixel == 8) { + memcpy(dst, &pixel, bytesPerPixel); // XXX: do a simple for-loop instead? + dst += bytesPerPixel; + continue; + } + + + if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { + switch (pixelFormat.bitsPerPixel) { + case 16: + pixel = (((pixel & 0x0000ff00) << 8) | + ((pixel & 0x000000ff) << 24)); + break; + case 32: + pixel = (((pixel & 0xff000000) >> 24) | + ((pixel & 0x00ff0000) >> 8) | + ((pixel & 0x0000ff00) << 8) | + ((pixel & 0x000000ff) << 24)); + break; + default: + qDebug("Cannot handle %d bpp client", pixelFormat.bitsPerPixel); + } + } else { // QSysInfo::ByteOrder == QSysInfo::LittleEndian + switch (pixelFormat.bitsPerPixel) { + case 16: + pixel = (((pixel & 0xff000000) >> 8) | + ((pixel & 0x00ff0000) << 8)); + break; + case 32: + pixel = (((pixel & 0xff000000) >> 24) | + ((pixel & 0x00ff0000) >> 8) | + ((pixel & 0x0000ff00) << 8) | + ((pixel & 0x000000ff) << 24)); + break; + default: + qDebug("Cannot handle %d bpp client", + pixelFormat.bitsPerPixel); + break; + } + } + memcpy(dst, &pixel, bytesPerPixel); // XXX: simple for-loop instead? + dst += bytesPerPixel; + } +} + +#ifndef QT_NO_QWS_CURSOR +static void blendCursor(QImage &image, const QRect &imageRect) +{ + const QRect cursorRect = qt_screencursor->boundingRect(); + const QRect intersection = (cursorRect & imageRect); + const QRect destRect = intersection.translated(-imageRect.topLeft()); + const QRect srcRect = intersection.translated(-cursorRect.topLeft()); + + QPainter painter(&image); + painter.drawImage(destRect, qt_screencursor->image(), srcRect); + painter.end(); +} +#endif // QT_NO_QWS_CURSOR + +QVNCDirtyMap::QVNCDirtyMap(QVNCGraphicsSystemScreen *s) + : bytesPerPixel(0), numDirty(0), screen(s) +{ + bytesPerPixel = (screen->depth() + 7) / 8; + QSize screenSize = screen->geometry().size(); + bufferWidth = screenSize.width(); + bufferHeight = screenSize.height(); + bufferStride = bufferWidth * bytesPerPixel; + buffer = new uchar[bufferHeight * bufferStride]; + + mapWidth = (bufferWidth + MAP_TILE_SIZE - 1) / MAP_TILE_SIZE; + mapHeight = (bufferHeight + MAP_TILE_SIZE - 1) / MAP_TILE_SIZE; + numTiles = mapWidth * mapHeight; + map = new uchar[numTiles]; +} + +QVNCDirtyMap::~QVNCDirtyMap() +{ + delete[] map; + delete[] buffer; +} + +void QVNCDirtyMap::reset() +{ + memset(map, 1, numTiles); + memset(buffer, 0, bufferHeight * bufferStride); + numDirty = numTiles; +} + +inline bool QVNCDirtyMap::dirty(int x, int y) const +{ + return map[y * mapWidth + x]; +} + +inline void QVNCDirtyMap::setClean(int x, int y) +{ + map[y * mapWidth + x] = 0; + --numDirty; +} + +template +void QVNCDirtyMapOptimized::setDirty(int tileX, int tileY, bool force) +{ + static bool alwaysForce = qgetenv("QT_VNC_NO_COMPAREBUFFER").toInt(); + if (alwaysForce) + force = true; + + bool changed = false; + + if (!force) { + const int lstep = screen->linestep(); + const int startX = tileX * MAP_TILE_SIZE; + const int startY = tileY * MAP_TILE_SIZE; + const uchar *scrn = screen->base() + + startY * lstep + startX * bytesPerPixel; + uchar *old = buffer + startY * bufferStride + startX * sizeof(T); + + const int tileHeight = (startY + MAP_TILE_SIZE > bufferHeight ? + bufferHeight - startY : MAP_TILE_SIZE); + const int tileWidth = (startX + MAP_TILE_SIZE > bufferWidth ? + bufferWidth - startX : MAP_TILE_SIZE); + const bool doInlines = (tileWidth == MAP_TILE_SIZE); + + int y = tileHeight; + + if (doInlines) { // hw: memcmp/memcpy is inlined when using constants + while (y) { + if (memcmp(old, scrn, sizeof(T) * MAP_TILE_SIZE)) { + changed = true; + break; + } + scrn += lstep; + old += bufferStride; + --y; + } + + while (y) { + memcpy(old, scrn, sizeof(T) * MAP_TILE_SIZE); + scrn += lstep; + old += bufferStride; + --y; + } + } else { + while (y) { + if (memcmp(old, scrn, sizeof(T) * tileWidth)) { + changed = true; + break; + } + scrn += lstep; + old += bufferStride; + --y; + } + + while (y) { + memcpy(old, scrn, sizeof(T) * tileWidth); + scrn += lstep; + old += bufferStride; + --y; + } + } + } + + const int mapIndex = tileY * mapWidth + tileX; + if ((force || changed) && !map[mapIndex]) { + map[mapIndex] = 1; + ++numDirty; + } +} + +template +QRfbHextileEncoder::QRfbHextileEncoder(QVNCServer *s) + : QRfbEncoder(s), + singleColorHextile(this), dualColorHextile(this), multiColorHextile(this) +{ +} + +/* + \internal + Send dirty rects using hextile encoding. +*/ +template +void QRfbHextileEncoder::write() +{ +// QWSDisplay::grab(true); + + QVNCDirtyMap *map = server->dirtyMap(); + QTcpSocket *socket = server->clientSocket(); + + const quint32 encoding = htonl(5); // hextile encoding + const int bytesPerPixel = server->clientBytesPerPixel(); + + { + const char tmp[2] = { 0, 0 }; // msg type, padding + socket->write(tmp, sizeof(tmp)); + } + { + const quint16 count = htons(map->numDirty); + socket->write((char *)&count, sizeof(count)); + } + + if (map->numDirty <= 0) { +// QWSDisplay::ungrab(); + return; + } + + newBg = true; + newFg = true; + + const QImage screenImage = server->screenImage(); + QRfbRect rect(0, 0, MAP_TILE_SIZE, MAP_TILE_SIZE); + + QSize screenSize = server->screen()->geometry().size(); + + for (int y = 0; y < map->mapHeight; ++y) { + if (rect.y + MAP_TILE_SIZE > screenSize.height()) + rect.h = screenSize.height() - rect.y; + rect.w = MAP_TILE_SIZE; + for (int x = 0; x < map->mapWidth; ++x) { + if (!map->dirty(x, y)) + continue; + map->setClean(x, y); + + rect.x = x * MAP_TILE_SIZE; + if (rect.x + MAP_TILE_SIZE > screenSize.width()) //###deviceWidth ??? + rect.w = screenSize.width() - rect.x; + rect.write(socket); + + socket->write((char *)&encoding, sizeof(encoding)); + + const uchar *screendata = screenImage.scanLine(rect.y) + + rect.x * screenImage.depth() / 8; + int linestep = screenImage.bytesPerLine(); + +#ifndef QT_NO_QWS_CURSOR + // hardware cursors must be blended with the screen memory + const bool doBlendCursor = qt_screencursor + && !server->hasClientCursor() + && qt_screencursor->isAccelerated(); + QImage tileImage; + if (doBlendCursor) { + const QRect tileRect(rect.x, rect.y, rect.w, rect.h); + const QRect cursorRect = qt_screencursor->boundingRect() + .translated(-server->screen()->offset()); + if (tileRect.intersects(cursorRect)) { + tileImage = screenImage.copy(tileRect); + blendCursor(tileImage, + tileRect.translated(server->screen()->offset())); + screendata = tileImage.bits(); + linestep = tileImage.bytesPerLine(); + } + } +#endif // QT_NO_QWS_CURSOR + + if (singleColorHextile.read(screendata, rect.w, rect.h, linestep)) { + singleColorHextile.write(socket); + } else if (dualColorHextile.read(screendata, rect.w, rect.h, linestep)) { + dualColorHextile.write(socket); + } else if (multiColorHextile.read(screendata, rect.w, rect.h, linestep)) { + multiColorHextile.write(socket); + } else if (server->doPixelConversion()) { + const int bufferSize = rect.w * rect.h * bytesPerPixel + 1; + const int padding = sizeof(quint32) - sizeof(char); + buffer.resize(bufferSize + padding); + + buffer[padding] = 1; // Raw subencoding + + // convert pixels + char *b = buffer.data() + padding + 1; + const int bstep = rect.w * bytesPerPixel; + for (int i = 0; i < rect.h; ++i) { + server->convertPixels(b, (const char*)screendata, rect.w); + screendata += linestep; + b += bstep; + } + socket->write(buffer.constData() + padding, bufferSize); + } else { + quint8 subenc = 1; // Raw subencoding + socket->write((char *)&subenc, 1); + + // send pixels + for (int i = 0; i < rect.h; ++i) { + socket->write((const char*)screendata, + rect.w * bytesPerPixel); + screendata += linestep; + } + } + } + if (socket->state() == QAbstractSocket::UnconnectedState) + break; + rect.y += MAP_TILE_SIZE; + } + socket->flush(); + Q_ASSERT(map->numDirty == 0); + +// QWSDisplay::ungrab(); +} + +void QRfbRawEncoder::write() +{ +// QWSDisplay::grab(false); + + QVNCDirtyMap *map = server->dirtyMap(); + QTcpSocket *socket = server->clientSocket(); + + const int bytesPerPixel = server->clientBytesPerPixel(); + QSize screenSize = server->screen()->geometry().size(); + + // create a region from the dirty rects and send the region's merged rects. + QRegion rgn; + if (map) { + for (int y = 0; y < map->mapHeight; ++y) { + for (int x = 0; x < map->mapWidth; ++x) { + if (!map->dirty(x, y)) + continue; + rgn += QRect(x * MAP_TILE_SIZE, y * MAP_TILE_SIZE, + MAP_TILE_SIZE, MAP_TILE_SIZE); + map->setClean(x, y); + } + } + + rgn &= QRect(0, 0, screenSize.width(), + screenSize.height()); + } + const QVector rects = rgn.rects(); + + { + const char tmp[2] = { 0, 0 }; // msg type, padding + socket->write(tmp, sizeof(tmp)); + } + + { + const quint16 count = htons(rects.size()); + socket->write((char *)&count, sizeof(count)); + } + + if (rects.size() <= 0) { +// QWSDisplay::ungrab(); + return; + } + + const QImage *screenImage = server->screenImage(); + + for (int i = 0; i < rects.size(); ++i) { + const QRect tileRect = rects.at(i); + const QRfbRect rect(tileRect.x(), tileRect.y(), + tileRect.width(), tileRect.height()); + rect.write(socket); + + const quint32 encoding = htonl(0); // raw encoding + socket->write((char *)&encoding, sizeof(encoding)); + + int linestep = screenImage->bytesPerLine(); + const uchar *screendata = screenImage->scanLine(rect.y) + + rect.x * screenImage->depth() / 8; + +#ifndef QT_NO_QWS_CURSOR + // hardware cursors must be blended with the screen memory + const bool doBlendCursor = qt_screencursor + && !server->hasClientCursor() + && qt_screencursor->isAccelerated(); + QImage tileImage; + if (doBlendCursor) { + const QRect cursorRect = qt_screencursor->boundingRect() + .translated(-server->screen()->offset()); + if (tileRect.intersects(cursorRect)) { + tileImage = screenImage->copy(tileRect); + blendCursor(tileImage, + tileRect.translated(server->screen()->offset())); + screendata = tileImage.bits(); + linestep = tileImage.bytesPerLine(); + } + } +#endif // QT_NO_QWS_CURSOR + + if (server->doPixelConversion()) { + const int bufferSize = rect.w * rect.h * bytesPerPixel; + if (bufferSize > buffer.size()) + buffer.resize(bufferSize); + + // convert pixels + char *b = buffer.data(); + const int bstep = rect.w * bytesPerPixel; + for (int i = 0; i < rect.h; ++i) { + server->convertPixels(b, (const char*)screendata, rect.w); + screendata += linestep; + b += bstep; + } + socket->write(buffer.constData(), bufferSize); + } else { + for (int i = 0; i < rect.h; ++i) { + socket->write((const char*)screendata, rect.w * bytesPerPixel); + screendata += linestep; + } + } + if (socket->state() == QAbstractSocket::UnconnectedState) + break; + } + socket->flush(); + +// QWSDisplay::ungrab(); +} + +inline QImage *QVNCServer::screenImage() const +{ + return qvnc_screen->image(); +} + +void QVNCServer::checkUpdate() +{ + if (!wantUpdate) + return; + + if (dirtyCursor) { +#ifndef QT_NO_QWS_CURSOR + Q_ASSERT(qvnc_cursor); + qvnc_cursor->write(); +#endif + cursor->sendClientCursor(); + dirtyCursor = false; + wantUpdate = false; + return; + } + + if (dirtyMap()->numDirty > 0) { + if (encoder) + encoder->write(); + wantUpdate = false; + } +} + +void QVNCServer::discardClient() +{ + timer->stop(); + state = Unconnected; + delete encoder; + encoder = 0; +#ifndef QT_NO_QWS_CURSOR + delete qvnc_cursor; + qvnc_cursor = 0; +#endif +// if (!qvnc_screen->screen()) +// QWSServer::instance()->enablePainting(false); +} + + + +QVNCGraphicsSystemScreenPrivate::QVNCGraphicsSystemScreenPrivate(QVNCGraphicsSystemScreen *parent) + : dpiX(72), dpiY(72), doOnScreenSurface(false), refreshRate(25), + vncServer(0), q_ptr(parent) +{ +#if 0//ndef QT_NO_QWS_SIGNALHANDLER + QWSSignalHandler::instance()->addObject(this); +#endif + + vncServer = new QVNCServer(q_ptr); + vncServer->setRefreshRate(refreshRate); + + + Q_ASSERT(q_ptr->depth() == 32); + + dirty = new QVNCDirtyMapOptimized(q_ptr); +} + +QVNCGraphicsSystemScreenPrivate::~QVNCGraphicsSystemScreenPrivate() +{ +} + + +void QVNCGraphicsSystemScreenPrivate::setDirty(const QRect& rect, bool force) +{ + if (rect.isEmpty()) + return; + +// if (q_ptr->screen()) +// q_ptr->screen()->setDirty(rect); + + if (!vncServer || !vncServer->isConnected()) { +// qDebug() << "QVNCGraphicsSystemScreenPrivate::setDirty() - Not connected"; + return; + } + const QRect r = rect; // .translated(-q_ptr->offset()); + const int x1 = r.x() / MAP_TILE_SIZE; + int y = r.y() / MAP_TILE_SIZE; + for (; (y <= r.bottom() / MAP_TILE_SIZE) && y < dirty->mapHeight; y++) + for (int x = x1; (x <= r.right() / MAP_TILE_SIZE) && x < dirty->mapWidth; x++) + dirty->setDirty(x, y, force); + + vncServer->setDirty(); +} + + + + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/vnc/qvncserver.h b/src/plugins/platforms/vnc/qvncserver.h new file mode 100644 index 0000000..4fcdbae --- /dev/null +++ b/src/plugins/platforms/vnc/qvncserver.h @@ -0,0 +1,534 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCREENVNC_P_H +#define QSCREENVNC_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of the QLibrary class. This header file may change from version to version +// without notice, or even be removed. +// +// We mean it. +// + +#include "qgraphicssystem_vnc.h" +#include "qvnccursor.h" +#define QT_NO_QWS_CURSOR + +#ifndef QT_NO_QWS_VNC + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QVNCServer; + +#ifndef QT_NO_QWS_CURSOR +class QVNCCursor : public QProxyScreenCursor +{ +public: + QVNCCursor(QVNCGraphicsSystemScreen *s); + ~QVNCCursor(); + + void hide(); + void show(); + void set(const QImage &image, int hotx, int hoty); + void move(int x, int y); + +private: + void setDirty(const QRect &r) const; + QVNCGraphicsSystemScreen *screen; +}; + +class QVNCClientCursor : public QProxyScreenCursor +{ +public: + QVNCClientCursor(QVNCServer *s); + ~QVNCClientCursor(); + + void set(const QImage &image, int hotx, int hoty); + void write() const; + +private: + QVNCServer *server; +}; +#endif // QT_NO_QWS_CURSOR + +#define MAP_TILE_SIZE 16 +#define MAP_WIDTH 1280 / MAP_TILE_SIZE +#define MAP_HEIGHT 1024 / MAP_TILE_SIZE + +class QVNCDirtyMap +{ +public: + QVNCDirtyMap(QVNCGraphicsSystemScreen *screen); + virtual ~QVNCDirtyMap(); + + void reset(); + bool dirty(int x, int y) const; + virtual void setDirty(int x, int y, bool force = false) = 0; + void setClean(int x, int y); + + int bytesPerPixel; + + int numDirty; + int mapWidth; + int mapHeight; + +protected: + uchar *map; + QVNCGraphicsSystemScreen *screen; + uchar *buffer; + int bufferWidth; + int bufferHeight; + int bufferStride; + int numTiles; +}; + +template +class QVNCDirtyMapOptimized : public QVNCDirtyMap +{ +public: + QVNCDirtyMapOptimized(QVNCGraphicsSystemScreen *screen) : QVNCDirtyMap(screen) {} + ~QVNCDirtyMapOptimized() {} + + void setDirty(int x, int y, bool force = false); +}; + +class QRfbRect +{ +public: + QRfbRect() {} + QRfbRect(quint16 _x, quint16 _y, quint16 _w, quint16 _h) { + x = _x; y = _y; w = _w; h = _h; + } + + void read(QTcpSocket *s); + void write(QTcpSocket *s) const; + + quint16 x; + quint16 y; + quint16 w; + quint16 h; +}; + +class QRfbPixelFormat +{ +public: + static int size() { return 16; } + + void read(QTcpSocket *s); + void write(QTcpSocket *s); + + int bitsPerPixel; + int depth; + bool bigEndian; + bool trueColor; + int redBits; + int greenBits; + int blueBits; + int redShift; + int greenShift; + int blueShift; +}; + +class QRfbServerInit +{ +public: + QRfbServerInit() { name = 0; } + ~QRfbServerInit() { delete[] name; } + + int size() const { return QRfbPixelFormat::size() + 8 + strlen(name); } + void setName(const char *n); + + void read(QTcpSocket *s); + void write(QTcpSocket *s); + + quint16 width; + quint16 height; + QRfbPixelFormat format; + char *name; +}; + +class QRfbSetEncodings +{ +public: + bool read(QTcpSocket *s); + + quint16 count; +}; + +class QRfbFrameBufferUpdateRequest +{ +public: + bool read(QTcpSocket *s); + + char incremental; + QRfbRect rect; +}; + +class QRfbKeyEvent +{ +public: + bool read(QTcpSocket *s); + + char down; + int keycode; + int unicode; +}; + +class QRfbPointerEvent +{ +public: + bool read(QTcpSocket *s); + + Qt::MouseButtons buttons; + enum { WheelNone, + WheelUp, + WheelDown, + WheelLeft, + WheelRight + } wheelDirection; + quint16 x; + quint16 y; +}; + +class QRfbClientCutText +{ +public: + bool read(QTcpSocket *s); + + quint32 length; +}; + +class QVNCGraphicsSystemScreenPrivate : public QObject +{ +public: + QVNCGraphicsSystemScreenPrivate(QVNCGraphicsSystemScreen *parent); + ~QVNCGraphicsSystemScreenPrivate(); + + void setDirty(const QRect &rect, bool force = false); + void configure(); + + qreal dpiX; + qreal dpiY; + bool doOnScreenSurface; + QVNCDirtyMap *dirty; + int refreshRate; + QVNCServer *vncServer; + +#if !defined(QT_NO_QWS_MULTIPROCESS) && !defined(QT_NO_SHAREDMEMORY) + QSharedMemory shm; +#endif + + QVNCGraphicsSystemScreen *q_ptr; +}; + +class QRfbEncoder +{ +public: + QRfbEncoder(QVNCServer *s) : server(s) {} + virtual ~QRfbEncoder() {} + + virtual void write() = 0; + +protected: + QVNCServer *server; +}; + +class QRfbRawEncoder : public QRfbEncoder +{ +public: + QRfbRawEncoder(QVNCServer *s) : QRfbEncoder(s) {} + + void write(); + +private: + QByteArray buffer; +}; + +template class QRfbHextileEncoder; + +template +class QRfbSingleColorHextile +{ +public: + QRfbSingleColorHextile(QRfbHextileEncoder *e) : encoder(e) {} + bool read(const uchar *data, int width, int height, int stride); + void write(QTcpSocket *socket) const; + +private: + QRfbHextileEncoder *encoder; +}; + +template +class QRfbDualColorHextile +{ +public: + QRfbDualColorHextile(QRfbHextileEncoder *e) : encoder(e) {} + bool read(const uchar *data, int width, int height, int stride); + void write(QTcpSocket *socket) const; + +private: + struct Rect { + quint8 xy; + quint8 wh; + } Q_PACKED rects[8 * 16]; + + quint8 numRects; + QRfbHextileEncoder *encoder; + +private: + inline int lastx() const { return rectx(numRects); } + inline int lasty() const { return recty(numRects); } + inline int rectx(int r) const { return rects[r].xy >> 4; } + inline int recty(int r) const { return rects[r].xy & 0x0f; } + inline int width(int r) const { return (rects[r].wh >> 4) + 1; } + inline int height(int r) const { return (rects[r].wh & 0x0f) + 1; } + + inline void setX(int r, int x) { + rects[r].xy = (x << 4) | (rects[r].xy & 0x0f); + } + inline void setY(int r, int y) { + rects[r].xy = (rects[r].xy & 0xf0) | y; + } + inline void setWidth(int r, int width) { + rects[r].wh = ((width - 1) << 4) | (rects[r].wh & 0x0f); + } + inline void setHeight(int r, int height) { + rects[r].wh = (rects[r].wh & 0xf0) | (height - 1); + } + + inline void setWidth(int width) { setWidth(numRects, width); } + inline void setHeight(int height) { setHeight(numRects, height); } + inline void setX(int x) { setX(numRects, x); } + inline void setY(int y) { setY(numRects, y); } + void next(); +}; + +template +class QRfbMultiColorHextile +{ +public: + QRfbMultiColorHextile(QRfbHextileEncoder *e) : encoder(e) {} + bool read(const uchar *data, int width, int height, int stride); + void write(QTcpSocket *socket) const; + +private: + inline quint8* rect(int r) { + return rects.data() + r * (bpp + 2); + } + inline const quint8* rect(int r) const { + return rects.constData() + r * (bpp + 2); + } + inline void setX(int r, int x) { + quint8 *ptr = rect(r) + bpp; + *ptr = (x << 4) | (*ptr & 0x0f); + } + inline void setY(int r, int y) { + quint8 *ptr = rect(r) + bpp; + *ptr = (*ptr & 0xf0) | y; + } + void setColor(SRC color); + inline int rectx(int r) const { + const quint8 *ptr = rect(r) + bpp; + return *ptr >> 4; + } + inline int recty(int r) const { + const quint8 *ptr = rect(r) + bpp; + return *ptr & 0x0f; + } + inline void setWidth(int r, int width) { + quint8 *ptr = rect(r) + bpp + 1; + *ptr = ((width - 1) << 4) | (*ptr & 0x0f); + } + inline void setHeight(int r, int height) { + quint8 *ptr = rect(r) + bpp + 1; + *ptr = (*ptr & 0xf0) | (height - 1); + } + + bool beginRect(); + void endRect(); + + static const int maxRectsSize = 16 * 16; + QVarLengthArray rects; + + quint8 bpp; + quint8 numRects; + QRfbHextileEncoder *encoder; +}; + +template +class QRfbHextileEncoder : public QRfbEncoder +{ +public: + QRfbHextileEncoder(QVNCServer *s); + void write(); + +private: + enum SubEncoding { + Raw = 1, + BackgroundSpecified = 2, + ForegroundSpecified = 4, + AnySubrects = 8, + SubrectsColoured = 16 + }; + + QByteArray buffer; + QRfbSingleColorHextile singleColorHextile; + QRfbDualColorHextile dualColorHextile; + QRfbMultiColorHextile multiColorHextile; + + SRC bg; + SRC fg; + bool newBg; + bool newFg; + + friend class QRfbSingleColorHextile; + friend class QRfbDualColorHextile; + friend class QRfbMultiColorHextile; +}; + +class QVNCServer : public QObject +{ + Q_OBJECT +public: + QVNCServer(QVNCGraphicsSystemScreen *screen); + QVNCServer(QVNCGraphicsSystemScreen *screen, int id); + ~QVNCServer(); + + void setDirty(); + void setDirtyCursor() { dirtyCursor = true; setDirty(); } + inline bool isConnected() const { return state == Connected; } + inline void setRefreshRate(int rate) { refreshRate = rate; } + + enum ClientMsg { SetPixelFormat = 0, + FixColourMapEntries = 1, + SetEncodings = 2, + FramebufferUpdateRequest = 3, + KeyEvent = 4, + PointerEvent = 5, + ClientCutText = 6 }; + + enum ServerMsg { FramebufferUpdate = 0, + SetColourMapEntries = 1 }; + + void convertPixels(char *dst, const char *src, int count) const; + + inline int clientBytesPerPixel() const { + return pixelFormat.bitsPerPixel / 8; + } + + inline QVNCGraphicsSystemScreen* screen() const { return qvnc_screen; } + inline QVNCDirtyMap* dirtyMap() const { return qvnc_screen->dirtyMap(); } + inline QTcpSocket* clientSocket() const { return client; } + QImage *screenImage() const; + inline bool doPixelConversion() const { return needConversion; } +#ifndef QT_NO_QWS_CURSOR + inline bool hasClientCursor() const { return qvnc_cursor != 0; } +#endif + + void setCursor(QVNCCursor * c) { cursor = c; } +private: + void setPixelFormat(); + void setEncodings(); + void frameBufferUpdateRequest(); + void pointerEvent(); + void keyEvent(); + void clientCutText(); + bool pixelConversionNeeded() const; + +private slots: + void newConnection(); + void readClient(); + void checkUpdate(); + void discardClient(); + void sendInputEvents(); + +private: + void init(uint port); + enum ClientState { Unconnected, Protocol, Init, Connected }; + QTimer *timer; + QTcpServer *serverSocket; + QTcpSocket *client; + ClientState state; + quint8 msgType; + bool handleMsg; + QRfbPixelFormat pixelFormat; + Qt::KeyboardModifiers keymod; + Qt::MouseButtons buttons; + int encodingsPending; + int cutTextPending; + uint supportCopyRect : 1; + uint supportRRE : 1; + uint supportCoRRE : 1; + uint supportHextile : 1; + uint supportZRLE : 1; + uint supportCursor : 1; + uint supportDesktopSize : 1; + bool wantUpdate; + bool sameEndian; + bool needConversion; +#if Q_BYTE_ORDER == Q_BIG_ENDIAN + bool swapBytes; +#endif + bool dirtyCursor; + int refreshRate; + QVNCGraphicsSystemScreen *qvnc_screen; +#ifndef QT_NO_QWS_CURSOR + QVNCClientCursor *qvnc_cursor; +#endif + + QRfbEncoder *encoder; + QVNCCursor *cursor; +}; + + +QT_END_NAMESPACE +#endif // QT_NO_QWS_VNC +#endif // QSCREENVNC_P_H diff --git a/src/plugins/platforms/vnc/vnc.pro b/src/plugins/platforms/vnc/vnc.pro new file mode 100644 index 0000000..0b73b5b --- /dev/null +++ b/src/plugins/platforms/vnc/vnc.pro @@ -0,0 +1,19 @@ +TARGET = qvncgraphicssystem +include(../../qpluginbase.pri) + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems + +SOURCES = main.cpp qgraphicssystem_vnc.cpp +HEADERS = qgraphicssystem_vnc.h + +HEADERS += qvncserver.h +SOURCES += qvncserver.cpp + +HEADERS += qvnccursor.h +SOURCES += qvnccursor.cpp + +include(../fb_base/fb_base.pri) + +target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems + +INSTALLS += target -- cgit v0.12 From bf36f88b92fa95704f117124c15ef896f553939c Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 31 Mar 2010 12:16:07 +0200 Subject: Compile fix --- src/gui/kernel/qplatformintegration_lite.cpp | 41 ++++++++++++++++++++++++++ src/gui/kernel/qplatformscreen_lite.cpp | 43 ++++++++++++++++++++++++++++ src/gui/kernel/qplatformscreen_lite.h | 41 ++++++++++++++++++++++++++ src/gui/painting/qblittable_p.h | 1 + 4 files changed, 126 insertions(+) diff --git a/src/gui/kernel/qplatformintegration_lite.cpp b/src/gui/kernel/qplatformintegration_lite.cpp index 0e28fc6..f9adc14 100644 --- a/src/gui/kernel/qplatformintegration_lite.cpp +++ b/src/gui/kernel/qplatformintegration_lite.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "qplatformintegration_lite.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatformscreen_lite.cpp b/src/gui/kernel/qplatformscreen_lite.cpp index f2ea2f8..4492463 100644 --- a/src/gui/kernel/qplatformscreen_lite.cpp +++ b/src/gui/kernel/qplatformscreen_lite.cpp @@ -1,4 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "qplatformscreen_lite.h" +#include +#include QWidget *QPlatformScreen::topLevelAt(const QPoint & pos) const { diff --git a/src/gui/kernel/qplatformscreen_lite.h b/src/gui/kernel/qplatformscreen_lite.h index ef90dee..da0e26b 100644 --- a/src/gui/kernel/qplatformscreen_lite.h +++ b/src/gui/kernel/qplatformscreen_lite.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef QPLATFORMSCREEN_H #define QPLATFORMSCREEN_H diff --git a/src/gui/painting/qblittable_p.h b/src/gui/painting/qblittable_p.h index 98caab7d..645f37e 100644 --- a/src/gui/painting/qblittable_p.h +++ b/src/gui/painting/qblittable_p.h @@ -2,6 +2,7 @@ #define QBLITTABLE_P_H #include +#include #ifndef QT_NO_BLITTABLE QT_BEGIN_NAMESPACE -- cgit v0.12 From 22b7de20fdc0f11d943f235227f59608a88992c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 31 Mar 2010 12:19:59 +0200 Subject: Make directfb plugin work with QPlatformIntegration --- src/plugins/platforms/directfb/directfb.pro | 29 ++ src/plugins/platforms/directfb/main.cpp | 71 +++++ .../platforms/directfb/qblitter_directfb.cpp | 109 +++++++ src/plugins/platforms/directfb/qblitter_directfb.h | 29 ++ .../platforms/directfb/qdirectfbconvenience.cpp | 335 +++++++++++++++++++++ .../platforms/directfb/qdirectfbconvenience.h | 43 +++ src/plugins/platforms/directfb/qdirectfbcursor.cpp | 42 +++ src/plugins/platforms/directfb/qdirectfbcursor.h | 22 ++ src/plugins/platforms/directfb/qdirectfbinput.cpp | 205 +++++++++++++ src/plugins/platforms/directfb/qdirectfbinput.h | 63 ++++ .../directfb/qplatformintegration_directfb.cpp | 118 ++++++++ .../directfb/qplatformintegration_directfb.h | 98 ++++++ .../platforms/directfb/qwindowsurface_directfb.cpp | 231 ++++++++++++++ .../platforms/directfb/qwindowsurface_directfb.h | 88 ++++++ src/plugins/platforms/minimaldfb/main.cpp | 71 ----- src/plugins/platforms/minimaldfb/minimaldfb.pro | 29 -- .../platforms/minimaldfb/qblitter_directfb.cpp | 110 ------- .../platforms/minimaldfb/qblitter_directfb.h | 29 -- .../platforms/minimaldfb/qdirectfbconvenience.cpp | 335 --------------------- .../platforms/minimaldfb/qdirectfbconvenience.h | 43 --- .../platforms/minimaldfb/qdirectfbcursor.cpp | 42 --- src/plugins/platforms/minimaldfb/qdirectfbcursor.h | 22 -- .../platforms/minimaldfb/qdirectfbinput.cpp | 205 ------------- src/plugins/platforms/minimaldfb/qdirectfbinput.h | 63 ---- .../minimaldfb/qgraphicssystem_minimaldfb.cpp | 118 -------- .../minimaldfb/qgraphicssystem_minimaldfb.h | 99 ------ .../minimaldfb/qwindowsurface_minimaldfb.cpp | 231 -------------- .../minimaldfb/qwindowsurface_minimaldfb.h | 88 ------ 28 files changed, 1483 insertions(+), 1485 deletions(-) create mode 100644 src/plugins/platforms/directfb/directfb.pro create mode 100644 src/plugins/platforms/directfb/main.cpp create mode 100644 src/plugins/platforms/directfb/qblitter_directfb.cpp create mode 100644 src/plugins/platforms/directfb/qblitter_directfb.h create mode 100644 src/plugins/platforms/directfb/qdirectfbconvenience.cpp create mode 100644 src/plugins/platforms/directfb/qdirectfbconvenience.h create mode 100644 src/plugins/platforms/directfb/qdirectfbcursor.cpp create mode 100644 src/plugins/platforms/directfb/qdirectfbcursor.h create mode 100644 src/plugins/platforms/directfb/qdirectfbinput.cpp create mode 100644 src/plugins/platforms/directfb/qdirectfbinput.h create mode 100644 src/plugins/platforms/directfb/qplatformintegration_directfb.cpp create mode 100644 src/plugins/platforms/directfb/qplatformintegration_directfb.h create mode 100644 src/plugins/platforms/directfb/qwindowsurface_directfb.cpp create mode 100644 src/plugins/platforms/directfb/qwindowsurface_directfb.h delete mode 100644 src/plugins/platforms/minimaldfb/main.cpp delete mode 100644 src/plugins/platforms/minimaldfb/minimaldfb.pro delete mode 100644 src/plugins/platforms/minimaldfb/qblitter_directfb.cpp delete mode 100644 src/plugins/platforms/minimaldfb/qblitter_directfb.h delete mode 100644 src/plugins/platforms/minimaldfb/qdirectfbconvenience.cpp delete mode 100644 src/plugins/platforms/minimaldfb/qdirectfbconvenience.h delete mode 100644 src/plugins/platforms/minimaldfb/qdirectfbcursor.cpp delete mode 100644 src/plugins/platforms/minimaldfb/qdirectfbcursor.h delete mode 100644 src/plugins/platforms/minimaldfb/qdirectfbinput.cpp delete mode 100644 src/plugins/platforms/minimaldfb/qdirectfbinput.h delete mode 100644 src/plugins/platforms/minimaldfb/qgraphicssystem_minimaldfb.cpp delete mode 100644 src/plugins/platforms/minimaldfb/qgraphicssystem_minimaldfb.h delete mode 100644 src/plugins/platforms/minimaldfb/qwindowsurface_minimaldfb.cpp delete mode 100644 src/plugins/platforms/minimaldfb/qwindowsurface_minimaldfb.h diff --git a/src/plugins/platforms/directfb/directfb.pro b/src/plugins/platforms/directfb/directfb.pro new file mode 100644 index 0000000..f8fccaa --- /dev/null +++ b/src/plugins/platforms/directfb/directfb.pro @@ -0,0 +1,29 @@ +TARGET = qdirectfb +include(../../qpluginbase.pri) +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms + +isEmpty(DIRECTFB_LIBS) { + DIRECTFB_LIBS = -ldirectfb -lfusion -ldirect -lpthread +} +isEmpty(DIRECTFB_INCLUDEPATH) { + DIRECTFB_INCLUDEPATH = /usr/include/directfb +} + +INCLUDEPATH += $$DIRECTFB_INCLUDEPATH +LIBS += $$DIRECTFB_LIBS + +SOURCES = main.cpp \ + qplatformintegration_directfb.cpp \ + qwindowsurface_directfb.cpp \ + qblitter_directfb.cpp \ + qdirectfbconvenience.cpp \ + qdirectfbinput.cpp \ + qdirectfbcursor.cpp +HEADERS = qplatformintegration_directfb.h \ + qwindowsurface_directfb.h \ + qblitter_directfb.h \ + qdirectfbconvenience.h \ + qdirectfbinput.h \ + qdirectfbcursor.h +target.path += $$[QT_INSTALL_PLUGINS]/platforms +INSTALLS += target diff --git a/src/plugins/platforms/directfb/main.cpp b/src/plugins/platforms/directfb/main.cpp new file mode 100644 index 0000000..1f0f081 --- /dev/null +++ b/src/plugins/platforms/directfb/main.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qplatformintegration_directfb.h" + +QT_BEGIN_NAMESPACE + +class QDirectFbIntegrationPlugin : public QPlatformIntegrationPlugin +{ +public: + QStringList keys() const; + QPlatformIntegration *create(const QString&); +}; + +QStringList QDirectFbIntegrationPlugin::keys() const +{ + QStringList list; + list << "directfb"; + return list; +} + +QPlatformIntegration * QDirectFbIntegrationPlugin::create(const QString& system) +{ + if (system.toLower() == "directfb") + return new QDirectFbIntegration; + + return 0; +} + +Q_EXPORT_PLUGIN2(directfb, QDirectFbIntegrationPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qblitter_directfb.cpp b/src/plugins/platforms/directfb/qblitter_directfb.cpp new file mode 100644 index 0000000..08dee0a --- /dev/null +++ b/src/plugins/platforms/directfb/qblitter_directfb.cpp @@ -0,0 +1,109 @@ +#include "qblitter_directfb.h" +#include "qdirectfbconvenience.h" + +#include + +#include + +#include + +QDirectFbBlitter::QDirectFbBlitter(const QSize &rect, IDirectFBSurface *surface) + : QBlittable(rect, QBlittable::Capabilities(QBlittable::SolidRectCapability + |QBlittable::SourcePixmapCapability + |QBlittable::SourceOverPixmapCapability + |QBlittable::SourceOverScaledPixmapCapability)) +{ + if (surface) { + m_surface = surface; + } else { + DFBSurfaceDescription surfaceDesc; + memset(&surfaceDesc,0,sizeof(DFBSurfaceDescription)); + surfaceDesc.width = rect.width(); + surfaceDesc.height = rect.height(); + surfaceDesc.caps = DSCAPS_PREMULTIPLIED; + surfaceDesc.pixelformat = DSPF_ARGB; + surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_CAPS | DSDESC_PIXELFORMAT); + + IDirectFB *dfb = QDirectFbConvenience::dfbInterface(); + dfb->CreateSurface(dfb,&surfaceDesc, &m_surface); + m_surface->Clear(m_surface,0,0,0,0); + } +} + +QDirectFbBlitter::~QDirectFbBlitter() +{ + unlock(); + m_surface->Release(m_surface); +} + +void QDirectFbBlitter::fillRect(const QRectF &rect, const QColor &color) +{ + m_surface->SetColor(m_surface, color.red(), color.green(), color.blue(), color.alpha()); +// When the blitter api supports non opaque blits, also remember to change +// qpixmap_blitter.cpp::fill +// DFBSurfaceDrawingFlags drawingFlags = color.alpha() ? DSDRAW_BLEND : DSDRAW_NOFX; +// m_surface->SetDrawingFlags(m_surface, drawingFlags); + m_surface->SetDrawingFlags(m_surface, DSDRAW_NOFX); + m_surface->FillRectangle(m_surface, rect.x(), rect.y(), + rect.width(), rect.height()); +} + +void QDirectFbBlitter::drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &srcRect) +{ + QPixmapData *data = pixmap.pixmapData(); + Q_ASSERT(data->width() && data->height()); + Q_ASSERT(data->classId() == QPixmapData::BlitterClass); + QBlittablePixmapData *blitPm = static_cast(data); + QDirectFbBlitter *dfbBlitter = static_cast(blitPm->blittable()); + dfbBlitter->unlock(); + + IDirectFBSurface *s = dfbBlitter->m_surface; + + quint32 blittingFlags = pixmap.hasAlpha()? DSBLIT_BLEND_ALPHACHANNEL : DSBLIT_NOFX; + + s->SetBlittingFlags(s, DFBSurfaceBlittingFlags(blittingFlags)); + m_surface->SetBlittingFlags(m_surface, DFBSurfaceBlittingFlags(blittingFlags)); + m_surface->SetPorterDuff(m_surface,DSPD_SRC_OVER); + m_surface->SetDstBlendFunction(m_surface,DSBF_INVSRCALPHA); + + const DFBRectangle sRect = { srcRect.x(), srcRect.y(), rect.width(), rect.height() }; + + DFBResult result; + if (rect.width() == srcRect.width() && rect.height() == srcRect.height()) + result = m_surface->Blit(m_surface, s, &sRect, rect.x(), rect.y()); + else { + const DFBRectangle dRect = { rect.x(), rect.y(), rect.width(), rect.height() }; + result = m_surface->StretchBlit(m_surface, s, &sRect, &dRect); + } + if (result != DFB_OK) + DirectFBError("QDirectFBBlitter::drawPixmap()", result); +} + +QImage *QDirectFbBlitter::doLock() +{ + Q_ASSERT(m_surface); + Q_ASSERT(size().isValid()); + + void *mem; + int bpl; + const DFBResult result = m_surface->Lock(m_surface, DFBSurfaceLockFlags(DSLF_WRITE|DSLF_READ), static_cast(&mem), &bpl); + if (result == DFB_OK) { + DFBSurfacePixelFormat dfbFormat; + DFBSurfaceCapabilities dfbCaps; + m_surface->GetPixelFormat(m_surface,&dfbFormat); + m_surface->GetCapabilities(m_surface,&dfbCaps); + QImage::Format format = QDirectFbConvenience::imageFormatFromSurfaceFormat(dfbFormat, dfbCaps); + int w, h; + m_surface->GetSize(m_surface,&w,&h); + m_image = QImage(static_cast(mem),w,h,bpl,format); + } else { + DirectFBError("Failed to lock image", result); + } + + return &m_image; +} + +void QDirectFbBlitter::doUnlock() +{ + m_surface->Unlock(m_surface); +} diff --git a/src/plugins/platforms/directfb/qblitter_directfb.h b/src/plugins/platforms/directfb/qblitter_directfb.h new file mode 100644 index 0000000..85a303a --- /dev/null +++ b/src/plugins/platforms/directfb/qblitter_directfb.h @@ -0,0 +1,29 @@ +#ifndef QDIRECTFBBLITTER_H +#define QDIRECTFBBLITTER_H + +#include "qdirectfbconvenience.h" + +#include + +#include + +class QDirectFbBlitter : public QBlittable +{ +public: + QDirectFbBlitter(const QSize &size, IDirectFBSurface *surface = 0); + virtual ~QDirectFbBlitter(); + + virtual void fillRect(const QRectF &rect, const QColor &color); + virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect); + +protected: + virtual QImage *doLock(); + virtual void doUnlock(); + + IDirectFBSurface *m_surface; + QImage m_image; + + friend class QDirectFbConvenience; +}; + +#endif // QDIRECTFBBLITTER_H diff --git a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp new file mode 100644 index 0000000..8594c09 --- /dev/null +++ b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp @@ -0,0 +1,335 @@ +#include "qdirectfbconvenience.h" +#include "qblitter_directfb.h" + +#include + +IDirectFB *QDirectFbConvenience::dfbInterface() +{ + static IDirectFB *dfb = 0; + if (!dfb) { + DFBResult result = DirectFBCreate(&dfb); + if (result != DFB_OK) { + DirectFBError("QDirectFBConvenience: error creating DirectFB interface",result); + return 0; + } + } + return dfb; +} + +IDirectFBDisplayLayer *QDirectFbConvenience::dfbDisplayLayer(int display) +{ + IDirectFBDisplayLayer *layer; + DFBResult result = QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),display,&layer); + if (result != DFB_OK) { + DirectFBError("QDirectFbConvenience: " + "Unable to get primary display layer!", result); + } + return layer; +} + +QImage::Format QDirectFbConvenience::imageFormatFromSurfaceFormat(const DFBSurfacePixelFormat format, const DFBSurfaceCapabilities caps) +{ + switch (format) { + case DSPF_LUT8: + return QImage::Format_Indexed8; + case DSPF_RGB24: + return QImage::Format_RGB888; + case DSPF_ARGB4444: + return QImage::Format_ARGB4444_Premultiplied; + case DSPF_RGB444: + return QImage::Format_RGB444; + case DSPF_RGB555: + case DSPF_ARGB1555: + return QImage::Format_RGB555; + case DSPF_RGB16: + return QImage::Format_RGB16; + case DSPF_ARGB6666: + return QImage::Format_ARGB6666_Premultiplied; + case DSPF_RGB18: + return QImage::Format_RGB666; + case DSPF_RGB32: + return QImage::Format_RGB32; + case DSPF_ARGB: { + if (caps & DSCAPS_PREMULTIPLIED) + return QImage::Format_ARGB32_Premultiplied; + else return QImage::Format_ARGB32; } + default: + break; + } + return QImage::Format_Invalid; + +} + +int QDirectFbConvenience::colorDepthForSurface(const DFBSurfacePixelFormat format) +{ + return ((0x1f << 7) & format) >> 7; +} + +IDirectFBSurface *QDirectFbConvenience::dfbSurfaceForPixmapData(QPixmapData *pixmapData) +{ + QBlittablePixmapData *blittablePmData = static_cast(pixmapData); + if (blittablePmData) { + QBlittable *blittable = blittablePmData->blittable(); + QDirectFbBlitter *dfbBlitter = static_cast(blittable); + return dfbBlitter->m_surface; + } + return 0; +} + +Qt::MouseButton QDirectFbConvenience::mouseButton(DFBInputDeviceButtonIdentifier identifier) +{ + switch (identifier){ + case DIBI_LEFT: + return Qt::LeftButton; + case DIBI_MIDDLE: + return Qt::MidButton; + case DIBI_RIGHT: + return Qt::RightButton; + default: + return Qt::NoButton; + } +} + +Qt::MouseButtons QDirectFbConvenience::mouseButtons(DFBInputDeviceButtonMask mask) +{ + Qt::MouseButtons buttons = Qt::NoButton; + + if (mask & DIBM_LEFT) { + buttons |= Qt::LeftButton; + } + if (mask & DIBM_MIDDLE) { + buttons |= Qt::MidButton; + } + if (mask & DIBM_RIGHT) { + buttons |= Qt::RightButton; + } + return buttons; +} + +Qt::KeyboardModifiers QDirectFbConvenience::keyboardModifiers(DFBInputDeviceModifierMask mask) +{ + Qt::KeyboardModifiers modifiers = Qt::NoModifier; + + if (mask & DIMM_SHIFT) { + modifiers |= Qt::ShiftModifier; + } + if (mask & DIMM_ALT) { + modifiers |= Qt::AltModifier; + } + if (mask & DIMM_ALTGR) { + modifiers |= Qt::MetaModifier; + } + if (mask & DIMM_CONTROL) { + modifiers |= Qt::ControlModifier; + } + if (mask & DIMM_META) { + modifiers | Qt::MetaModifier; + } + return modifiers; +} + +QEvent::Type QDirectFbConvenience::eventType(DFBWindowEventType type) +{ + switch(type) { + case DWET_BUTTONDOWN: + return QEvent::MouseButtonPress; + case DWET_BUTTONUP: + return QEvent::MouseButtonRelease; + case DWET_MOTION: + return QEvent::MouseMove; + case DWET_WHEEL: + return QEvent::Wheel; + case DWET_KEYDOWN: + return QEvent::KeyPress; + case DWET_KEYUP: + return QEvent::KeyRelease; + default: + return QEvent::None; + } +} +QDirectFbKeyMap *QDirectFbConvenience::dfbKeymap = 0; +QDirectFbKeyMap *QDirectFbConvenience::keyMap() +{ + if (!dfbKeymap) + dfbKeymap = new QDirectFbKeyMap(); + return dfbKeymap; +} + +QDirectFbKeyMap::QDirectFbKeyMap() +{ + insert(DIKS_BACKSPACE , Qt::Key_Backspace); + insert(DIKS_TAB , Qt::Key_Tab); + insert(DIKS_RETURN , Qt::Key_Return); + insert(DIKS_ESCAPE , Qt::Key_Escape); + insert(DIKS_DELETE , Qt::Key_Delete); + + insert(DIKS_CURSOR_LEFT , Qt::Key_Left); + insert(DIKS_CURSOR_RIGHT , Qt::Key_Right); + insert(DIKS_CURSOR_UP , Qt::Key_Up); + insert(DIKS_CURSOR_DOWN , Qt::Key_Down); + insert(DIKS_INSERT , Qt::Key_Insert); + insert(DIKS_HOME , Qt::Key_Home); + insert(DIKS_END , Qt::Key_End); + insert(DIKS_PAGE_UP , Qt::Key_PageUp); + insert(DIKS_PAGE_DOWN , Qt::Key_PageDown); + insert(DIKS_PRINT , Qt::Key_Print); + insert(DIKS_PAUSE , Qt::Key_Pause); + insert(DIKS_SELECT , Qt::Key_Select); + insert(DIKS_GOTO , Qt::Key_OpenUrl); + insert(DIKS_CLEAR , Qt::Key_Clear); + insert(DIKS_MENU , Qt::Key_Menu); + insert(DIKS_HELP , Qt::Key_Help); + + insert(DIKS_INTERNET , Qt::Key_HomePage); + insert(DIKS_MAIL , Qt::Key_LaunchMail); + insert(DIKS_FAVORITES , Qt::Key_Favorites); + + insert(DIKS_BACK , Qt::Key_Back); + insert(DIKS_FORWARD , Qt::Key_Forward); + insert(DIKS_VOLUME_UP , Qt::Key_VolumeUp); + insert(DIKS_VOLUME_DOWN , Qt::Key_VolumeDown); + insert(DIKS_MUTE , Qt::Key_VolumeMute); + insert(DIKS_PLAYPAUSE , Qt::Key_Pause); + insert(DIKS_PLAY , Qt::Key_MediaPlay); + insert(DIKS_STOP , Qt::Key_MediaStop); + insert(DIKS_RECORD , Qt::Key_MediaRecord); + insert(DIKS_PREVIOUS , Qt::Key_MediaPrevious); + insert(DIKS_NEXT , Qt::Key_MediaNext); + + insert(DIKS_F1 , Qt::Key_F1); + insert(DIKS_F2 , Qt::Key_F2); + insert(DIKS_F3 , Qt::Key_F3); + insert(DIKS_F4 , Qt::Key_F4); + insert(DIKS_F5 , Qt::Key_F5); + insert(DIKS_F6 , Qt::Key_F6); + insert(DIKS_F7 , Qt::Key_F7); + insert(DIKS_F8 , Qt::Key_F8); + insert(DIKS_F9 , Qt::Key_F9); + insert(DIKS_F10 , Qt::Key_F10); + insert(DIKS_F11 , Qt::Key_F11); + insert(DIKS_F12 , Qt::Key_F12); + + insert(DIKS_SHIFT , Qt::Key_Shift); + insert(DIKS_CONTROL , Qt::Key_Control); + insert(DIKS_ALT , Qt::Key_Alt); + insert(DIKS_ALTGR , Qt::Key_AltGr); + + insert(DIKS_META , Qt::Key_Meta); + insert(DIKS_SUPER , Qt::Key_Super_L); // ??? + insert(DIKS_HYPER , Qt::Key_Hyper_L); // ??? + + insert(DIKS_CAPS_LOCK , Qt::Key_CapsLock); + insert(DIKS_NUM_LOCK , Qt::Key_NumLock); + insert(DIKS_SCROLL_LOCK , Qt::Key_ScrollLock); + + insert(DIKS_DEAD_ABOVEDOT , Qt::Key_Dead_Abovedot); + insert(DIKS_DEAD_ABOVERING , Qt::Key_Dead_Abovering); + insert(DIKS_DEAD_ACUTE , Qt::Key_Dead_Acute); + insert(DIKS_DEAD_BREVE , Qt::Key_Dead_Breve); + insert(DIKS_DEAD_CARON , Qt::Key_Dead_Caron); + insert(DIKS_DEAD_CEDILLA , Qt::Key_Dead_Cedilla); + insert(DIKS_DEAD_CIRCUMFLEX , Qt::Key_Dead_Circumflex); + insert(DIKS_DEAD_DIAERESIS , Qt::Key_Dead_Diaeresis); + insert(DIKS_DEAD_DOUBLEACUTE , Qt::Key_Dead_Doubleacute); + insert(DIKS_DEAD_GRAVE , Qt::Key_Dead_Grave); + insert(DIKS_DEAD_IOTA , Qt::Key_Dead_Iota); + insert(DIKS_DEAD_MACRON , Qt::Key_Dead_Macron); + insert(DIKS_DEAD_OGONEK , Qt::Key_Dead_Ogonek); + insert(DIKS_DEAD_SEMIVOICED_SOUND , Qt::Key_Dead_Semivoiced_Sound); + insert(DIKS_DEAD_TILDE , Qt::Key_Dead_Tilde); + insert(DIKS_DEAD_VOICED_SOUND , Qt::Key_Dead_Voiced_Sound); + insert(DIKS_SPACE , Qt::Key_Space); + insert(DIKS_EXCLAMATION_MARK , Qt::Key_Exclam); + insert(DIKS_QUOTATION , Qt::Key_QuoteDbl); + insert(DIKS_NUMBER_SIGN , Qt::Key_NumberSign); + insert(DIKS_DOLLAR_SIGN , Qt::Key_Dollar); + insert(DIKS_PERCENT_SIGN , Qt::Key_Percent); + insert(DIKS_AMPERSAND , Qt::Key_Ampersand); + insert(DIKS_APOSTROPHE , Qt::Key_Apostrophe); + insert(DIKS_PARENTHESIS_LEFT , Qt::Key_ParenLeft); + insert(DIKS_PARENTHESIS_RIGHT , Qt::Key_ParenRight); + insert(DIKS_ASTERISK , Qt::Key_Asterisk); + insert(DIKS_PLUS_SIGN , Qt::Key_Plus); + insert(DIKS_COMMA , Qt::Key_Comma); + insert(DIKS_MINUS_SIGN , Qt::Key_Minus); + insert(DIKS_PERIOD , Qt::Key_Period); + insert(DIKS_SLASH , Qt::Key_Slash); + insert(DIKS_0 , Qt::Key_0); + insert(DIKS_1 , Qt::Key_1); + insert(DIKS_2 , Qt::Key_2); + insert(DIKS_3 , Qt::Key_3); + insert(DIKS_4 , Qt::Key_4); + insert(DIKS_5 , Qt::Key_5); + insert(DIKS_6 , Qt::Key_6); + insert(DIKS_7 , Qt::Key_7); + insert(DIKS_8 , Qt::Key_8); + insert(DIKS_9 , Qt::Key_9); + insert(DIKS_COLON , Qt::Key_Colon); + insert(DIKS_SEMICOLON , Qt::Key_Semicolon); + insert(DIKS_LESS_THAN_SIGN , Qt::Key_Less); + insert(DIKS_EQUALS_SIGN , Qt::Key_Equal); + insert(DIKS_GREATER_THAN_SIGN , Qt::Key_Greater); + insert(DIKS_QUESTION_MARK , Qt::Key_Question); + insert(DIKS_AT , Qt::Key_At); + insert(DIKS_CAPITAL_A , Qt::Key_A); + insert(DIKS_CAPITAL_B , Qt::Key_B); + insert(DIKS_CAPITAL_C , Qt::Key_C); + insert(DIKS_CAPITAL_D , Qt::Key_D); + insert(DIKS_CAPITAL_E , Qt::Key_E); + insert(DIKS_CAPITAL_F , Qt::Key_F); + insert(DIKS_CAPITAL_G , Qt::Key_G); + insert(DIKS_CAPITAL_H , Qt::Key_H); + insert(DIKS_CAPITAL_I , Qt::Key_I); + insert(DIKS_CAPITAL_J , Qt::Key_J); + insert(DIKS_CAPITAL_K , Qt::Key_K); + insert(DIKS_CAPITAL_L , Qt::Key_L); + insert(DIKS_CAPITAL_M , Qt::Key_M); + insert(DIKS_CAPITAL_N , Qt::Key_N); + insert(DIKS_CAPITAL_O , Qt::Key_O); + insert(DIKS_CAPITAL_P , Qt::Key_P); + insert(DIKS_CAPITAL_Q , Qt::Key_Q); + insert(DIKS_CAPITAL_R , Qt::Key_R); + insert(DIKS_CAPITAL_S , Qt::Key_S); + insert(DIKS_CAPITAL_T , Qt::Key_T); + insert(DIKS_CAPITAL_U , Qt::Key_U); + insert(DIKS_CAPITAL_V , Qt::Key_V); + insert(DIKS_CAPITAL_W , Qt::Key_W); + insert(DIKS_CAPITAL_X , Qt::Key_X); + insert(DIKS_CAPITAL_Y , Qt::Key_Y); + insert(DIKS_CAPITAL_Z , Qt::Key_Z); + insert(DIKS_SQUARE_BRACKET_LEFT , Qt::Key_BracketLeft); + insert(DIKS_BACKSLASH , Qt::Key_Backslash); + insert(DIKS_SQUARE_BRACKET_RIGHT , Qt::Key_BracketRight); + insert(DIKS_CIRCUMFLEX_ACCENT , Qt::Key_AsciiCircum); + insert(DIKS_UNDERSCORE , Qt::Key_Underscore); + insert(DIKS_SMALL_A , Qt::Key_A); + insert(DIKS_SMALL_B , Qt::Key_B); + insert(DIKS_SMALL_C , Qt::Key_C); + insert(DIKS_SMALL_D , Qt::Key_D); + insert(DIKS_SMALL_E , Qt::Key_E); + insert(DIKS_SMALL_F , Qt::Key_F); + insert(DIKS_SMALL_G , Qt::Key_G); + insert(DIKS_SMALL_H , Qt::Key_H); + insert(DIKS_SMALL_I , Qt::Key_I); + insert(DIKS_SMALL_J , Qt::Key_J); + insert(DIKS_SMALL_K , Qt::Key_K); + insert(DIKS_SMALL_L , Qt::Key_L); + insert(DIKS_SMALL_M , Qt::Key_M); + insert(DIKS_SMALL_N , Qt::Key_N); + insert(DIKS_SMALL_O , Qt::Key_O); + insert(DIKS_SMALL_P , Qt::Key_P); + insert(DIKS_SMALL_Q , Qt::Key_Q); + insert(DIKS_SMALL_R , Qt::Key_R); + insert(DIKS_SMALL_S , Qt::Key_S); + insert(DIKS_SMALL_T , Qt::Key_T); + insert(DIKS_SMALL_U , Qt::Key_U); + insert(DIKS_SMALL_V , Qt::Key_V); + insert(DIKS_SMALL_W , Qt::Key_W); + insert(DIKS_SMALL_X , Qt::Key_X); + insert(DIKS_SMALL_Y , Qt::Key_Y); + insert(DIKS_SMALL_Z , Qt::Key_Z); + insert(DIKS_CURLY_BRACKET_LEFT , Qt::Key_BraceLeft); + insert(DIKS_VERTICAL_BAR , Qt::Key_Bar); + insert(DIKS_CURLY_BRACKET_RIGHT , Qt::Key_BraceRight); + insert(DIKS_TILDE , Qt::Key_AsciiTilde); +} diff --git a/src/plugins/platforms/directfb/qdirectfbconvenience.h b/src/plugins/platforms/directfb/qdirectfbconvenience.h new file mode 100644 index 0000000..ab5b3de --- /dev/null +++ b/src/plugins/platforms/directfb/qdirectfbconvenience.h @@ -0,0 +1,43 @@ +#ifndef QDIRECTFBCONVENIENCE_H +#define QDIRECTFBCONVENIENCE_H + +#include +#include +#include +#include + +#include + +class QDirectFbKeyMap: public QHash +{ +public: + QDirectFbKeyMap(); +}; + + +class QDirectFbConvenience +{ +public: + static QImage::Format imageFormatFromSurfaceFormat(const DFBSurfacePixelFormat format, const DFBSurfaceCapabilities caps); + static bool pixelFomatHasAlpha(const DFBSurfacePixelFormat format) { return (1 << 16) & format; } + static int colorDepthForSurface(const DFBSurfacePixelFormat format); + + //This is set by the graphicssystem constructor + static IDirectFB *dfbInterface(); + static IDirectFBDisplayLayer *dfbDisplayLayer(int display = DLID_PRIMARY); + + static IDirectFBSurface *dfbSurfaceForPixmapData(QPixmapData *); + + static Qt::MouseButton mouseButton(DFBInputDeviceButtonIdentifier identifier); + static Qt::MouseButtons mouseButtons(DFBInputDeviceButtonMask mask); + static Qt::KeyboardModifiers keyboardModifiers(DFBInputDeviceModifierMask mask); + static QEvent::Type eventType(DFBWindowEventType type); + + static QDirectFbKeyMap *keyMap(); + +private: + static QDirectFbKeyMap *dfbKeymap; + friend class QDirectFbIntegration; +}; + +#endif // QDIRECTFBCONVENIENCE_H diff --git a/src/plugins/platforms/directfb/qdirectfbcursor.cpp b/src/plugins/platforms/directfb/qdirectfbcursor.cpp new file mode 100644 index 0000000..bb7088f --- /dev/null +++ b/src/plugins/platforms/directfb/qdirectfbcursor.cpp @@ -0,0 +1,42 @@ +#include "qdirectfbcursor.h" +#include "qblitter_directfb.h" +#include "qplatformintegration_directfb.h" +#include "qdirectfbconvenience.h" + +#include + +QDirectFBCursor::QDirectFBCursor(QPlatformScreen* screen) : + QGraphicsSystemCursor(screen), surface(0) +{ + QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),DLID_PRIMARY, &m_layer); + image = new QGraphicsSystemCursorImage(0, 0, 0, 0, 0, 0); +} + +void QDirectFBCursor::changeCursor(QCursor * cursor, QWidget * widget) +{ + Q_UNUSED(widget); + int xSpot; + int ySpot; + QPixmap map; + + if (cursor->shape() != Qt::BitmapCursor) { + image->set(cursor->shape()); + xSpot = image->hotspot().x(); + ySpot = image->hotspot().y(); + QImage *i = image->image(); + map = QPixmap::fromImage(*i); + } else { + QPoint point = cursor->hotSpot(); + xSpot = point.x(); + ySpot = point.y(); + map = cursor->pixmap(); + } + + IDirectFBSurface *surface = QDirectFbConvenience::dfbSurfaceForPixmapData(map.pixmapData()); + + if (m_layer->SetCooperativeLevel(m_layer, DLSCL_ADMINISTRATIVE) != DFB_OK) { + return; + } + m_layer->SetCursorShape( m_layer, surface, xSpot, ySpot); + m_layer->SetCooperativeLevel(m_layer, DLSCL_SHARED); +} diff --git a/src/plugins/platforms/directfb/qdirectfbcursor.h b/src/plugins/platforms/directfb/qdirectfbcursor.h new file mode 100644 index 0000000..1566e7c --- /dev/null +++ b/src/plugins/platforms/directfb/qdirectfbcursor.h @@ -0,0 +1,22 @@ +#ifndef QDIRECTFBCURSOR_H +#define QDIRECTFBCURSOR_H + +#include +#include +class QDirectFbScreen; +class QDirectFbBlitter; + +class QDirectFBCursor : public QGraphicsSystemCursor +{ +public: + QDirectFBCursor(QPlatformScreen *screem); + void changeCursor(QCursor * cursor, QWidget * widget); + +private: + IDirectFBDisplayLayer * m_layer; + IDirectFBSurface * surface; + QGraphicsSystemCursorImage * image; + QDirectFbBlitter *blitter; +}; + +#endif // QDIRECTFBCURSOR_H diff --git a/src/plugins/platforms/directfb/qdirectfbinput.cpp b/src/plugins/platforms/directfb/qdirectfbinput.cpp new file mode 100644 index 0000000..74a38a4 --- /dev/null +++ b/src/plugins/platforms/directfb/qdirectfbinput.cpp @@ -0,0 +1,205 @@ +#include "qdirectfbinput.h" +#include "qdirectfbconvenience.h" + +#include +#include +#include +#include +#include +#include + +#include + +InputSocketWaiter::InputSocketWaiter(IDirectFBEventBuffer *eventBuffer, QObject *parent) + : QThread(parent), m_eventBuffer(eventBuffer),m_shouldStop(false) +{ + this->start(); +} + +InputSocketWaiter::~InputSocketWaiter() +{ + m_shouldStop = true; + m_eventBuffer->WakeUp(m_eventBuffer); + m_cleanupMutex.lock(); +} + +void InputSocketWaiter::continueWaitingForEvents() +{ + m_finishedProcessingEvents.wakeAll(); +} + +void InputSocketWaiter::run() +{ + m_cleanupMutex.lock(); + while (1) { + m_eventBuffer->WaitForEvent(m_eventBuffer); + if (m_shouldStop) + break; + emit newEvent(); + QMutex waitForProcessingMutex; + waitForProcessingMutex.lock(); + m_finishedProcessingEvents.wait(&waitForProcessingMutex); + } + m_cleanupMutex.unlock(); +} + +QDirectFbInput *QDirectFbInput::instance() +{ + static QDirectFbInput *input = 0; + if (!input) { + input = new QDirectFbInput(); + } + return input; +} + +QDirectFbInput::QDirectFbInput() + : QObject() +{ + dfbInterface = QDirectFbConvenience::dfbInterface(); + + DFBResult ok = dfbInterface->CreateEventBuffer(dfbInterface,&eventBuffer); + if (ok != DFB_OK) + DirectFBError("Failed to initialise eventbuffer", ok); + + dfbInterface->GetDisplayLayer(dfbInterface,DLID_PRIMARY, &dfbDisplayLayer); + + m_inputHandler = new InputSocketWaiter(eventBuffer,this); + connect(m_inputHandler,SIGNAL(newEvent()),this,SLOT(handleEvents())); + + connect(QApplication::instance(),SIGNAL(aboutToQuit()),SLOT(applicationEnd())); +} + +void QDirectFbInput::addWindow(DFBWindowID id, QWidget *tlw) +{ + tlwMap.insert(id,tlw); + IDirectFBWindow *window; + dfbDisplayLayer->GetWindow(dfbDisplayLayer,id,&window); + + window->AttachEventBuffer(window,eventBuffer); +} + +void QDirectFbInput::removeWindow(QWidget *tlw) +{ + DFBWindowID id = tlwMap.key(tlw,0); + if (id) { + IDirectFBWindow *window; + dfbDisplayLayer->GetWindow(dfbDisplayLayer,id, &window); + + window->DetachEventBuffer(window,eventBuffer); + tlwMap.remove(id); + } +} + +void QDirectFbInput::handleEvents() +{ + DFBResult hasEvent = eventBuffer->HasEvent(eventBuffer); + while(hasEvent == DFB_OK){ + DFBEvent event; + DFBResult ok = eventBuffer->GetEvent(eventBuffer,&event); + if (ok != DFB_OK) + DirectFBError("Failed to get event",ok); + if (event.clazz == DFEC_WINDOW) { + switch (event.window.type) { + case DWET_BUTTONDOWN: + case DWET_BUTTONUP: + case DWET_MOTION: + handleMouseEvents(event); + break; + case DWET_WHEEL: + handleWheelEvent(event); + break; + case DWET_KEYDOWN: + case DWET_KEYUP: + handleKeyEvents(event); + break; + case DWET_ENTER: + case DWET_LEAVE: + handleEnterLeaveEvents(event); + default: + break; + } + + } + + hasEvent = eventBuffer->HasEvent(eventBuffer); + } + m_inputHandler->continueWaitingForEvents(); +} + +void QDirectFbInput::handleMouseEvents(const DFBEvent &event) +{ + QPoint p(event.window.x, event.window.y); + QPoint globalPos = globalPoint(event); + Qt::MouseButtons buttons = QDirectFbConvenience::mouseButtons(event.window.buttons); + + IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); + IDirectFBWindow *window; + layer->GetWindow(layer,event.window.window_id,&window); + + long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000); + + if (event.window.type == DWET_BUTTONDOWN) { + window->GrabPointer(window); + } else if (event.window.type == DWET_BUTTONUP) { + window->UngrabPointer(window); + } + QWidget *tlw = tlwMap.value(event.window.window_id); + QWindowSystemInterface::handleMouseEvent(tlw, timestamp, p, globalPos, buttons); +} + +void QDirectFbInput::applicationEnd() +{ + delete m_inputHandler; + m_inputHandler = 0; +} + +void QDirectFbInput::handleWheelEvent(const DFBEvent &event) +{ + QPoint p(event.window.cx, event.window.cy); + QPoint globalPos = globalPoint(event); + long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000); + QWidget *tlw = tlwMap.value(event.window.window_id); + QWindowSystemInterface::handleWheelEvent(tlw, timestamp, p, globalPos, + event.window.step*120, + Qt::Vertical); +} + +void QDirectFbInput::handleKeyEvents(const DFBEvent &event) +{ + QEvent::Type type = QDirectFbConvenience::eventType(event.window.type); + Qt::Key key = QDirectFbConvenience::keyMap()->value(event.window.key_symbol); + Qt::KeyboardModifiers modifiers = QDirectFbConvenience::keyboardModifiers(event.window.modifiers); + + long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000); + + QChar character; + if (DFB_KEY_TYPE(event.window.key_symbol) == DIKT_UNICODE) + character = QChar(event.window.key_symbol); + QWidget *tlw = tlwMap.value(event.window.window_id); + QWindowSystemInterface::handleKeyEvent(tlw, timestamp, type, key, modifiers, character); +} + +void QDirectFbInput::handleEnterLeaveEvents(const DFBEvent &event) +{ + QWidget *tlw = tlwMap.value(event.window.window_id); + switch (event.window.type) { + case DWET_ENTER: + QWindowSystemInterface::handleEnterEvent(tlw); + break; + case DWET_LEAVE: + QWindowSystemInterface::handleLeaveEvent(tlw); + break; + default: + break; + } +} + +inline QPoint QDirectFbInput::globalPoint(const DFBEvent &event) const +{ + IDirectFBWindow *window; + dfbDisplayLayer->GetWindow(dfbDisplayLayer,event.window.window_id,&window); + int x,y; + window->GetPosition(window,&x,&y); + return QPoint(event.window.cx +x, event.window.cy + y); +} + diff --git a/src/plugins/platforms/directfb/qdirectfbinput.h b/src/plugins/platforms/directfb/qdirectfbinput.h new file mode 100644 index 0000000..31aa082 --- /dev/null +++ b/src/plugins/platforms/directfb/qdirectfbinput.h @@ -0,0 +1,63 @@ +#ifndef QDIRECTFBINPUT_H +#define QDIRECTFBINPUT_H + +#include +#include +#include +#include +#include +#include +#include + +#include + +class InputSocketWaiter : public QThread +{ + Q_OBJECT +public: + InputSocketWaiter(IDirectFBEventBuffer *eventBuffer, QObject *parent); + virtual ~InputSocketWaiter(); + void continueWaitingForEvents(); +protected: + void run(); +signals: + void newEvent(); +private: + IDirectFBEventBuffer *m_eventBuffer; + bool m_shouldStop; + QMutex m_cleanupMutex; + QWaitCondition m_finishedProcessingEvents; +}; + +class QDirectFbInput : public QObject +{ + Q_OBJECT +public: + static QDirectFbInput *instance(); + void addWindow(DFBWindowID id, QWidget *tlw); + void removeWindow(QWidget *tlw); + +public slots: + void handleEvents(); + void applicationEnd(); + +private: + QDirectFbInput(); + + void handleMouseEvents(const DFBEvent &event); + void handleWheelEvent(const DFBEvent &event); + void handleKeyEvents(const DFBEvent &event); + void handleEnterLeaveEvents(const DFBEvent &event); + IDirectFB *dfbInterface; + IDirectFBDisplayLayer *dfbDisplayLayer; + IDirectFBEventBuffer *eventBuffer; + + QHashtlwMap; + + inline QPoint globalPoint(const DFBEvent &event) const; + + InputSocketWaiter *m_inputHandler; + +}; + +#endif // QDIRECTFBINPUT_H diff --git a/src/plugins/platforms/directfb/qplatformintegration_directfb.cpp b/src/plugins/platforms/directfb/qplatformintegration_directfb.cpp new file mode 100644 index 0000000..c70bb64 --- /dev/null +++ b/src/plugins/platforms/directfb/qplatformintegration_directfb.cpp @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformintegration_directfb.h" +#include "qwindowsurface_directfb.h" +#include "qblitter_directfb.h" +#include "qdirectfbconvenience.h" +#include "qdirectfbcursor.h" + +#include +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +QDirectFbScreen::QDirectFbScreen(int display) + :QPlatformScreen() +{ + m_layer = QDirectFbConvenience::dfbDisplayLayer(display); + m_layer->SetCooperativeLevel(m_layer,DLSCL_SHARED); + + DFBDisplayLayerConfig config; + m_layer->GetConfiguration(m_layer, &config); + + m_format = QDirectFbConvenience::imageFormatFromSurfaceFormat(config.pixelformat, config.surface_caps); + m_geometry = QRect(0,0,config.width,config.height); + const int dpi = 72; + const qreal inch = 25.4; + m_depth = 32; + m_physicalSize = QSize(qRound(config.width * inch / dpi), qRound(config.height *inch / dpi)); + + cursor = new QDirectFBCursor(this); +} + +QDirectFbScreen::~QDirectFbScreen() +{ +} + +QDirectFbIntegration::QDirectFbIntegration() +{ + const QStringList args = QCoreApplication::arguments(); + int argc = args.size(); + char **argv = new char*[argc]; + + for (int i = 0; i < argc; ++i) + argv[i] = qstrdup(args.at(i).toLocal8Bit().constData()); + + DFBResult result = DirectFBInit(&argc, &argv); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreen: error initializing DirectFB", + result); + } + delete[] argv; + + QDirectFbScreen *primaryScreen = new QDirectFbScreen(0); + mScreens.append(primaryScreen); +} + +QPixmapData *QDirectFbIntegration::createPixmapData(QPixmapData::PixelType type) const +{ + if (type == QPixmapData::BitmapType) + return new QRasterPixmapData(type); + else + return new QBlittablePixmapData(type); +} + +QWindowSurface *QDirectFbIntegration::createWindowSurface(QWidget *widget) const +{ + return new QDirectFbWindowSurface (widget); +} + +QBlittable *QDirectFbIntegration::createBlittable(const QSize &size) const +{ + return new QDirectFbBlitter(size); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qplatformintegration_directfb.h b/src/plugins/platforms/directfb/qplatformintegration_directfb.h new file mode 100644 index 0000000..f74a81d --- /dev/null +++ b/src/plugins/platforms/directfb/qplatformintegration_directfb.h @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMINTEGRATION_DIRECTFB_H +#define QPLATFORMINTEGRATION_DIRECTFB_H + +#include "qdirectfbinput.h" + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QDirectFBCursor; + +class QDirectFbScreen : public QPlatformScreen +{ +public: + QDirectFbScreen(int display); + ~QDirectFbScreen(); + + QRect geometry() const { return m_geometry; } + int depth() const { return m_depth; } + QImage::Format format() const { return m_format; } + QSize physicalSize() const { return m_physicalSize; } + +public: + QRect m_geometry; + int m_depth; + QImage::Format m_format; + QSize m_physicalSize; + + IDirectFBDisplayLayer *m_layer; + +private: + QDirectFBCursor * cursor; + +}; + +class QDirectFbIntegration : public QPlatformIntegration +{ +public: + QDirectFbIntegration(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QWindowSurface *createWindowSurface(QWidget *widget) const; + QBlittable *createBlittable(const QSize &size) const; + + QList screens() const { return mScreens; } + + + +private: + QList mScreens; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/directfb/qwindowsurface_directfb.cpp b/src/plugins/platforms/directfb/qwindowsurface_directfb.cpp new file mode 100644 index 0000000..afe34b7 --- /dev/null +++ b/src/plugins/platforms/directfb/qwindowsurface_directfb.cpp @@ -0,0 +1,231 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsurface_directfb.h" +#include "qplatformintegration_directfb.h" +#include "qblitter_directfb.h" +#include "qdirectfbconvenience.h" +#include + +#include + +QT_BEGIN_NAMESPACE + +QDirectFbWindowSurface::QDirectFbWindowSurface(QWidget *window) + : QWindowSurface(window), m_pixmap(0), m_pmdata(0), + m_dfbWindow(0), m_dfbSurface(0) +{ + window->setWindowSurface(this); + + IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); + DFBDisplayLayerConfig layerConfig; + layer->GetConfiguration(layer,&layerConfig); + + DFBWindowDescription description; + memset(&description,0,sizeof(DFBWindowDescription)); + description.flags = DFBWindowDescriptionFlags(DWDESC_WIDTH|DWDESC_HEIGHT|DWDESC_POSX|DWDESC_POSY|DWDESC_SURFACE_CAPS +#if DIRECTFB_MINOR_VERSION >= 1 + |DWDESC_OPTIONS +#endif + |DWDESC_CAPS); + description.width = window->rect().width(); + description.height = window->rect().height(); + description.posx = window->rect().x(); + description.posy = window->rect().y(); + + if (layerConfig.surface_caps & DSCAPS_PREMULTIPLIED) + description.surface_caps = DSCAPS_PREMULTIPLIED; + description.pixelformat = layerConfig.pixelformat; + +#if DIRECTFB_MINOR_VERSION >= 1 + description.options = DFBWindowOptions(DWOP_ALPHACHANNEL); +#endif + description.caps = DFBWindowCapabilities(DWCAPS_DOUBLEBUFFER|DWCAPS_ALPHACHANNEL); + description.surface_caps = DSCAPS_PREMULTIPLIED; + + DFBResult result = layer->CreateWindow(layer,&description,&m_dfbWindow); + if (result != DFB_OK) { + DirectFBError("QDirectFbGraphicsSystemScreen: failed to create window",result); + } + + DFBWindowID id; + m_dfbWindow->GetID(m_dfbWindow, &id); + QDirectFbInput::instance()->addWindow(id,window); + + m_dfbWindow->GetSurface(m_dfbWindow,&m_dfbSurface); + + QDirectFbBlitter *blitter = new QDirectFbBlitter(window->rect().size(), m_dfbSurface); + m_pmdata = new QBlittablePixmapData(QPixmapData::PixmapType); + m_pmdata->setBlittable(blitter); + m_pixmap = new QPixmap(m_pmdata); +} + +QDirectFbWindowSurface::~QDirectFbWindowSurface() +{ + QDirectFbInput::instance()->removeWindow(this->window()); + m_dfbWindow->Destroy(m_dfbWindow); +} + +QPaintDevice *QDirectFbWindowSurface::paintDevice() +{ + return m_pixmap; +} + +void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + m_pmdata->blittable()->unlock(); + + const quint8 windowOpacity = quint8(widget->windowOpacity() * 0xff); + m_dfbWindow->SetOpacity(m_dfbWindow,windowOpacity); + + QVector rects = region.rects(); + for (int i = 0 ; i < rects.size(); i++) { + const QRect rect = rects.at(i); + DFBRegion dfbReg = { rect.x() + offset.x(),rect.y() + offset.y(),rect.right() + offset.x(),rect.bottom() + offset.y()}; + m_dfbSurface->Flip(m_dfbSurface, &dfbReg, DFBSurfaceFlipFlags(DSFLIP_BLIT|DSFLIP_ONSYNC)); + } +} + +void QDirectFbWindowSurface::setGeometry(const QRect &rect) +{ + m_pmdata->blittable()->unlock(); + + QWindowSurface::setGeometry(rect); + m_dfbWindow->SetBounds(m_dfbWindow, rect.x(),rect.y(), + rect.width(), rect.height()); + + //Have to add 1 ref ass it will be removed by deleting the old blitter in setBlittable + m_dfbSurface->AddRef(m_dfbSurface); + QDirectFbBlitter *blitter = new QDirectFbBlitter(rect.size(),m_dfbSurface); + m_pmdata->setBlittable(blitter); +} + +static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int dx, int dy) +{ + const DFBRectangle rect = { r.x(), r.y(), r.width(), r.height() }; + surface->Blit(surface, surface, &rect, r.x() + dx, r.y() + dy); + const DFBRegion region = { rect.x + dx, rect.y + dy, r.right() + dx, r.bottom() + dy }; + surface->Flip(surface, ®ion, DFBSurfaceFlipFlags(DSFLIP_BLIT)); +} + +bool QDirectFbWindowSurface::scroll(const QRegion &area, int dx, int dy) +{ + m_pmdata->blittable()->unlock(); + + if (!m_dfbSurface || area.isEmpty()) + return false; + m_dfbSurface->SetBlittingFlags(m_dfbSurface, DSBLIT_NOFX); + if (area.rectCount() == 1) { + scrollSurface(m_dfbSurface, area.boundingRect(), dx, dy); + } else { + const QVector rects = area.rects(); + const int n = rects.size(); + for (int i=0; iblittable()->unlock(); + + if (visible) { + int x = this->geometry().x(); + int y = this->geometry().y(); + m_dfbWindow->MoveTo(m_dfbWindow,x,y); + } else { + IDirectFBDisplayLayer *displayLayer; + QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),DLID_PRIMARY,&displayLayer); + + DFBDisplayLayerConfig config; + displayLayer->GetConfiguration(displayLayer,&config); + m_dfbWindow->MoveTo(m_dfbWindow,config.width+1,config.height + 1); + } +} + +Qt::WindowFlags QDirectFbWindowSurface::setWindowFlags(Qt::WindowFlags flags) +{ + switch (flags & Qt::WindowType_Mask) { + case Qt::ToolTip: { + DFBWindowOptions options; + m_dfbWindow->GetOptions(m_dfbWindow,&options); + options = DFBWindowOptions(options | DWOP_GHOST); + m_dfbWindow->SetOptions(m_dfbWindow,options); + break; } + default: + break; + } + + m_dfbWindow->SetStackingClass(m_dfbWindow, flags & Qt::WindowStaysOnTopHint ? DWSC_UPPER : DWSC_MIDDLE); + return flags; +} + +void QDirectFbWindowSurface::raise() +{ + m_dfbWindow->RaiseToTop(m_dfbWindow); +} + +void QDirectFbWindowSurface::lower() +{ + m_dfbWindow->LowerToBottom(m_dfbWindow); +} + +WId QDirectFbWindowSurface::winId() const +{ + DFBWindowID id; + m_dfbWindow->GetID(m_dfbWindow, &id); + return WId(id); +} + + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qwindowsurface_directfb.h b/src/plugins/platforms/directfb/qwindowsurface_directfb.h new file mode 100644 index 0000000..2f31513 --- /dev/null +++ b/src/plugins/platforms/directfb/qwindowsurface_directfb.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSURFACE_DIRECTFB_H +#define QWINDOWSURFACE_DIRECTFB_H + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QDirectFbGraphicsSystemScreen; + +class QDirectFbWindowSurface : public QWindowSurface +{ +public: + QDirectFbWindowSurface(QWidget *window); + ~QDirectFbWindowSurface(); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void setGeometry(const QRect &rect); + bool scroll(const QRegion &area, int dx, int dy); + + void beginPaint(const QRegion ®ion); + void endPaint(const QRegion ®ion); + + void setVisible(bool visible); + Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); + + void raise(); + void lower(); + + WId winId() const; + +private: + void lockSurfaceToImage(); + + QPixmap *m_pixmap; + QBlittablePixmapData *m_pmdata; + + IDirectFBWindow *m_dfbWindow; + IDirectFBSurface *m_dfbSurface; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/minimaldfb/main.cpp b/src/plugins/platforms/minimaldfb/main.cpp deleted file mode 100644 index fe9407c..0000000 --- a/src/plugins/platforms/minimaldfb/main.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "qgraphicssystem_minimaldfb.h" - -QT_BEGIN_NAMESPACE - -class QDirectFbGraphicsSystemPlugin : public QGraphicsSystemPlugin -{ -public: - QStringList keys() const; - QGraphicsSystem *create(const QString&); -}; - -QStringList QDirectFbGraphicsSystemPlugin::keys() const -{ - QStringList list; - list << "MinimalDfb"; - return list; -} - -QGraphicsSystem* QDirectFbGraphicsSystemPlugin::create(const QString& system) -{ - if (system.toLower() == "minimaldfb") - return new QDirectFbGraphicsSystem; - - return 0; -} - -Q_EXPORT_PLUGIN2(directfb, QDirectFbGraphicsSystemPlugin) - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/minimaldfb/minimaldfb.pro b/src/plugins/platforms/minimaldfb/minimaldfb.pro deleted file mode 100644 index b6c2ea8..0000000 --- a/src/plugins/platforms/minimaldfb/minimaldfb.pro +++ /dev/null @@ -1,29 +0,0 @@ -TARGET = qminimaldfb -include(../../qpluginbase.pri) -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems - -isEmpty(DIRECTFB_LIBS) { - DIRECTFB_LIBS = -ldirectfb -lfusion -ldirect -lpthread -} -isEmpty(DIRECTFB_INCLUDEPATH) { - DIRECTFB_INCLUDEPATH = /usr/include/directfb -} - -INCLUDEPATH += $$DIRECTFB_INCLUDEPATH -LIBS += $$DIRECTFB_LIBS - -SOURCES = main.cpp \ - qgraphicssystem_minimaldfb.cpp \ - qwindowsurface_minimaldfb.cpp \ - qblitter_directfb.cpp \ - qdirectfbconvenience.cpp \ - qdirectfbinput.cpp \ - qdirectfbcursor.cpp -HEADERS = qgraphicssystem_minimaldfb.h \ - qwindowsurface_minimaldfb.h \ - qblitter_directfb.h \ - qdirectfbconvenience.h \ - qdirectfbinput.h \ - qdirectfbcursor.h -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems -INSTALLS += target diff --git a/src/plugins/platforms/minimaldfb/qblitter_directfb.cpp b/src/plugins/platforms/minimaldfb/qblitter_directfb.cpp deleted file mode 100644 index 070c563..0000000 --- a/src/plugins/platforms/minimaldfb/qblitter_directfb.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#include "qblitter_directfb.h" -#include "qgraphicssystem_minimaldfb.h" -#include "qdirectfbconvenience.h" - -#include - -#include - -#include - -QDirectFbBlitter::QDirectFbBlitter(const QSize &rect, IDirectFBSurface *surface) - : QBlittable(rect, QBlittable::Capabilities(QBlittable::SolidRectCapability - |QBlittable::SourcePixmapCapability - |QBlittable::SourceOverPixmapCapability - |QBlittable::SourceOverScaledPixmapCapability)) -{ - if (surface) { - m_surface = surface; - } else { - DFBSurfaceDescription surfaceDesc; - memset(&surfaceDesc,0,sizeof(DFBSurfaceDescription)); - surfaceDesc.width = rect.width(); - surfaceDesc.height = rect.height(); - surfaceDesc.caps = DSCAPS_PREMULTIPLIED; - surfaceDesc.pixelformat = DSPF_ARGB; - surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_CAPS | DSDESC_PIXELFORMAT); - - IDirectFB *dfb = QDirectFbConvenience::dfbInterface(); - dfb->CreateSurface(dfb,&surfaceDesc, &m_surface); - m_surface->Clear(m_surface,0,0,0,0); - } -} - -QDirectFbBlitter::~QDirectFbBlitter() -{ - unlock(); - m_surface->Release(m_surface); -} - -void QDirectFbBlitter::fillRect(const QRectF &rect, const QColor &color) -{ - m_surface->SetColor(m_surface, color.red(), color.green(), color.blue(), color.alpha()); -// When the blitter api supports non opaque blits, also remember to change -// qpixmap_blitter.cpp::fill -// DFBSurfaceDrawingFlags drawingFlags = color.alpha() ? DSDRAW_BLEND : DSDRAW_NOFX; -// m_surface->SetDrawingFlags(m_surface, drawingFlags); - m_surface->SetDrawingFlags(m_surface, DSDRAW_NOFX); - m_surface->FillRectangle(m_surface, rect.x(), rect.y(), - rect.width(), rect.height()); -} - -void QDirectFbBlitter::drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &srcRect) -{ - QPixmapData *data = pixmap.pixmapData(); - Q_ASSERT(data->width() && data->height()); - Q_ASSERT(data->classId() == QPixmapData::BlitterClass); - QBlittablePixmapData *blitPm = static_cast(data); - QDirectFbBlitter *dfbBlitter = static_cast(blitPm->blittable()); - dfbBlitter->unlock(); - - IDirectFBSurface *s = dfbBlitter->m_surface; - - quint32 blittingFlags = pixmap.hasAlpha()? DSBLIT_BLEND_ALPHACHANNEL : DSBLIT_NOFX; - - s->SetBlittingFlags(s, DFBSurfaceBlittingFlags(blittingFlags)); - m_surface->SetBlittingFlags(m_surface, DFBSurfaceBlittingFlags(blittingFlags)); - m_surface->SetPorterDuff(m_surface,DSPD_SRC_OVER); - m_surface->SetDstBlendFunction(m_surface,DSBF_INVSRCALPHA); - - const DFBRectangle sRect = { srcRect.x(), srcRect.y(), rect.width(), rect.height() }; - - DFBResult result; - if (rect.width() == srcRect.width() && rect.height() == srcRect.height()) - result = m_surface->Blit(m_surface, s, &sRect, rect.x(), rect.y()); - else { - const DFBRectangle dRect = { rect.x(), rect.y(), rect.width(), rect.height() }; - result = m_surface->StretchBlit(m_surface, s, &sRect, &dRect); - } - if (result != DFB_OK) - DirectFBError("QDirectFBBlitter::drawPixmap()", result); -} - -QImage *QDirectFbBlitter::doLock() -{ - Q_ASSERT(m_surface); - Q_ASSERT(size().isValid()); - - void *mem; - int bpl; - const DFBResult result = m_surface->Lock(m_surface, DFBSurfaceLockFlags(DSLF_WRITE|DSLF_READ), static_cast(&mem), &bpl); - if (result == DFB_OK) { - DFBSurfacePixelFormat dfbFormat; - DFBSurfaceCapabilities dfbCaps; - m_surface->GetPixelFormat(m_surface,&dfbFormat); - m_surface->GetCapabilities(m_surface,&dfbCaps); - QImage::Format format = QDirectFbConvenience::imageFormatFromSurfaceFormat(dfbFormat, dfbCaps); - int w, h; - m_surface->GetSize(m_surface,&w,&h); - m_image = QImage(static_cast(mem),w,h,bpl,format); - } else { - DirectFBError("Failed to lock image", result); - } - - return &m_image; -} - -void QDirectFbBlitter::doUnlock() -{ - m_surface->Unlock(m_surface); -} diff --git a/src/plugins/platforms/minimaldfb/qblitter_directfb.h b/src/plugins/platforms/minimaldfb/qblitter_directfb.h deleted file mode 100644 index 85a303a..0000000 --- a/src/plugins/platforms/minimaldfb/qblitter_directfb.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef QDIRECTFBBLITTER_H -#define QDIRECTFBBLITTER_H - -#include "qdirectfbconvenience.h" - -#include - -#include - -class QDirectFbBlitter : public QBlittable -{ -public: - QDirectFbBlitter(const QSize &size, IDirectFBSurface *surface = 0); - virtual ~QDirectFbBlitter(); - - virtual void fillRect(const QRectF &rect, const QColor &color); - virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect); - -protected: - virtual QImage *doLock(); - virtual void doUnlock(); - - IDirectFBSurface *m_surface; - QImage m_image; - - friend class QDirectFbConvenience; -}; - -#endif // QDIRECTFBBLITTER_H diff --git a/src/plugins/platforms/minimaldfb/qdirectfbconvenience.cpp b/src/plugins/platforms/minimaldfb/qdirectfbconvenience.cpp deleted file mode 100644 index 8594c09..0000000 --- a/src/plugins/platforms/minimaldfb/qdirectfbconvenience.cpp +++ /dev/null @@ -1,335 +0,0 @@ -#include "qdirectfbconvenience.h" -#include "qblitter_directfb.h" - -#include - -IDirectFB *QDirectFbConvenience::dfbInterface() -{ - static IDirectFB *dfb = 0; - if (!dfb) { - DFBResult result = DirectFBCreate(&dfb); - if (result != DFB_OK) { - DirectFBError("QDirectFBConvenience: error creating DirectFB interface",result); - return 0; - } - } - return dfb; -} - -IDirectFBDisplayLayer *QDirectFbConvenience::dfbDisplayLayer(int display) -{ - IDirectFBDisplayLayer *layer; - DFBResult result = QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),display,&layer); - if (result != DFB_OK) { - DirectFBError("QDirectFbConvenience: " - "Unable to get primary display layer!", result); - } - return layer; -} - -QImage::Format QDirectFbConvenience::imageFormatFromSurfaceFormat(const DFBSurfacePixelFormat format, const DFBSurfaceCapabilities caps) -{ - switch (format) { - case DSPF_LUT8: - return QImage::Format_Indexed8; - case DSPF_RGB24: - return QImage::Format_RGB888; - case DSPF_ARGB4444: - return QImage::Format_ARGB4444_Premultiplied; - case DSPF_RGB444: - return QImage::Format_RGB444; - case DSPF_RGB555: - case DSPF_ARGB1555: - return QImage::Format_RGB555; - case DSPF_RGB16: - return QImage::Format_RGB16; - case DSPF_ARGB6666: - return QImage::Format_ARGB6666_Premultiplied; - case DSPF_RGB18: - return QImage::Format_RGB666; - case DSPF_RGB32: - return QImage::Format_RGB32; - case DSPF_ARGB: { - if (caps & DSCAPS_PREMULTIPLIED) - return QImage::Format_ARGB32_Premultiplied; - else return QImage::Format_ARGB32; } - default: - break; - } - return QImage::Format_Invalid; - -} - -int QDirectFbConvenience::colorDepthForSurface(const DFBSurfacePixelFormat format) -{ - return ((0x1f << 7) & format) >> 7; -} - -IDirectFBSurface *QDirectFbConvenience::dfbSurfaceForPixmapData(QPixmapData *pixmapData) -{ - QBlittablePixmapData *blittablePmData = static_cast(pixmapData); - if (blittablePmData) { - QBlittable *blittable = blittablePmData->blittable(); - QDirectFbBlitter *dfbBlitter = static_cast(blittable); - return dfbBlitter->m_surface; - } - return 0; -} - -Qt::MouseButton QDirectFbConvenience::mouseButton(DFBInputDeviceButtonIdentifier identifier) -{ - switch (identifier){ - case DIBI_LEFT: - return Qt::LeftButton; - case DIBI_MIDDLE: - return Qt::MidButton; - case DIBI_RIGHT: - return Qt::RightButton; - default: - return Qt::NoButton; - } -} - -Qt::MouseButtons QDirectFbConvenience::mouseButtons(DFBInputDeviceButtonMask mask) -{ - Qt::MouseButtons buttons = Qt::NoButton; - - if (mask & DIBM_LEFT) { - buttons |= Qt::LeftButton; - } - if (mask & DIBM_MIDDLE) { - buttons |= Qt::MidButton; - } - if (mask & DIBM_RIGHT) { - buttons |= Qt::RightButton; - } - return buttons; -} - -Qt::KeyboardModifiers QDirectFbConvenience::keyboardModifiers(DFBInputDeviceModifierMask mask) -{ - Qt::KeyboardModifiers modifiers = Qt::NoModifier; - - if (mask & DIMM_SHIFT) { - modifiers |= Qt::ShiftModifier; - } - if (mask & DIMM_ALT) { - modifiers |= Qt::AltModifier; - } - if (mask & DIMM_ALTGR) { - modifiers |= Qt::MetaModifier; - } - if (mask & DIMM_CONTROL) { - modifiers |= Qt::ControlModifier; - } - if (mask & DIMM_META) { - modifiers | Qt::MetaModifier; - } - return modifiers; -} - -QEvent::Type QDirectFbConvenience::eventType(DFBWindowEventType type) -{ - switch(type) { - case DWET_BUTTONDOWN: - return QEvent::MouseButtonPress; - case DWET_BUTTONUP: - return QEvent::MouseButtonRelease; - case DWET_MOTION: - return QEvent::MouseMove; - case DWET_WHEEL: - return QEvent::Wheel; - case DWET_KEYDOWN: - return QEvent::KeyPress; - case DWET_KEYUP: - return QEvent::KeyRelease; - default: - return QEvent::None; - } -} -QDirectFbKeyMap *QDirectFbConvenience::dfbKeymap = 0; -QDirectFbKeyMap *QDirectFbConvenience::keyMap() -{ - if (!dfbKeymap) - dfbKeymap = new QDirectFbKeyMap(); - return dfbKeymap; -} - -QDirectFbKeyMap::QDirectFbKeyMap() -{ - insert(DIKS_BACKSPACE , Qt::Key_Backspace); - insert(DIKS_TAB , Qt::Key_Tab); - insert(DIKS_RETURN , Qt::Key_Return); - insert(DIKS_ESCAPE , Qt::Key_Escape); - insert(DIKS_DELETE , Qt::Key_Delete); - - insert(DIKS_CURSOR_LEFT , Qt::Key_Left); - insert(DIKS_CURSOR_RIGHT , Qt::Key_Right); - insert(DIKS_CURSOR_UP , Qt::Key_Up); - insert(DIKS_CURSOR_DOWN , Qt::Key_Down); - insert(DIKS_INSERT , Qt::Key_Insert); - insert(DIKS_HOME , Qt::Key_Home); - insert(DIKS_END , Qt::Key_End); - insert(DIKS_PAGE_UP , Qt::Key_PageUp); - insert(DIKS_PAGE_DOWN , Qt::Key_PageDown); - insert(DIKS_PRINT , Qt::Key_Print); - insert(DIKS_PAUSE , Qt::Key_Pause); - insert(DIKS_SELECT , Qt::Key_Select); - insert(DIKS_GOTO , Qt::Key_OpenUrl); - insert(DIKS_CLEAR , Qt::Key_Clear); - insert(DIKS_MENU , Qt::Key_Menu); - insert(DIKS_HELP , Qt::Key_Help); - - insert(DIKS_INTERNET , Qt::Key_HomePage); - insert(DIKS_MAIL , Qt::Key_LaunchMail); - insert(DIKS_FAVORITES , Qt::Key_Favorites); - - insert(DIKS_BACK , Qt::Key_Back); - insert(DIKS_FORWARD , Qt::Key_Forward); - insert(DIKS_VOLUME_UP , Qt::Key_VolumeUp); - insert(DIKS_VOLUME_DOWN , Qt::Key_VolumeDown); - insert(DIKS_MUTE , Qt::Key_VolumeMute); - insert(DIKS_PLAYPAUSE , Qt::Key_Pause); - insert(DIKS_PLAY , Qt::Key_MediaPlay); - insert(DIKS_STOP , Qt::Key_MediaStop); - insert(DIKS_RECORD , Qt::Key_MediaRecord); - insert(DIKS_PREVIOUS , Qt::Key_MediaPrevious); - insert(DIKS_NEXT , Qt::Key_MediaNext); - - insert(DIKS_F1 , Qt::Key_F1); - insert(DIKS_F2 , Qt::Key_F2); - insert(DIKS_F3 , Qt::Key_F3); - insert(DIKS_F4 , Qt::Key_F4); - insert(DIKS_F5 , Qt::Key_F5); - insert(DIKS_F6 , Qt::Key_F6); - insert(DIKS_F7 , Qt::Key_F7); - insert(DIKS_F8 , Qt::Key_F8); - insert(DIKS_F9 , Qt::Key_F9); - insert(DIKS_F10 , Qt::Key_F10); - insert(DIKS_F11 , Qt::Key_F11); - insert(DIKS_F12 , Qt::Key_F12); - - insert(DIKS_SHIFT , Qt::Key_Shift); - insert(DIKS_CONTROL , Qt::Key_Control); - insert(DIKS_ALT , Qt::Key_Alt); - insert(DIKS_ALTGR , Qt::Key_AltGr); - - insert(DIKS_META , Qt::Key_Meta); - insert(DIKS_SUPER , Qt::Key_Super_L); // ??? - insert(DIKS_HYPER , Qt::Key_Hyper_L); // ??? - - insert(DIKS_CAPS_LOCK , Qt::Key_CapsLock); - insert(DIKS_NUM_LOCK , Qt::Key_NumLock); - insert(DIKS_SCROLL_LOCK , Qt::Key_ScrollLock); - - insert(DIKS_DEAD_ABOVEDOT , Qt::Key_Dead_Abovedot); - insert(DIKS_DEAD_ABOVERING , Qt::Key_Dead_Abovering); - insert(DIKS_DEAD_ACUTE , Qt::Key_Dead_Acute); - insert(DIKS_DEAD_BREVE , Qt::Key_Dead_Breve); - insert(DIKS_DEAD_CARON , Qt::Key_Dead_Caron); - insert(DIKS_DEAD_CEDILLA , Qt::Key_Dead_Cedilla); - insert(DIKS_DEAD_CIRCUMFLEX , Qt::Key_Dead_Circumflex); - insert(DIKS_DEAD_DIAERESIS , Qt::Key_Dead_Diaeresis); - insert(DIKS_DEAD_DOUBLEACUTE , Qt::Key_Dead_Doubleacute); - insert(DIKS_DEAD_GRAVE , Qt::Key_Dead_Grave); - insert(DIKS_DEAD_IOTA , Qt::Key_Dead_Iota); - insert(DIKS_DEAD_MACRON , Qt::Key_Dead_Macron); - insert(DIKS_DEAD_OGONEK , Qt::Key_Dead_Ogonek); - insert(DIKS_DEAD_SEMIVOICED_SOUND , Qt::Key_Dead_Semivoiced_Sound); - insert(DIKS_DEAD_TILDE , Qt::Key_Dead_Tilde); - insert(DIKS_DEAD_VOICED_SOUND , Qt::Key_Dead_Voiced_Sound); - insert(DIKS_SPACE , Qt::Key_Space); - insert(DIKS_EXCLAMATION_MARK , Qt::Key_Exclam); - insert(DIKS_QUOTATION , Qt::Key_QuoteDbl); - insert(DIKS_NUMBER_SIGN , Qt::Key_NumberSign); - insert(DIKS_DOLLAR_SIGN , Qt::Key_Dollar); - insert(DIKS_PERCENT_SIGN , Qt::Key_Percent); - insert(DIKS_AMPERSAND , Qt::Key_Ampersand); - insert(DIKS_APOSTROPHE , Qt::Key_Apostrophe); - insert(DIKS_PARENTHESIS_LEFT , Qt::Key_ParenLeft); - insert(DIKS_PARENTHESIS_RIGHT , Qt::Key_ParenRight); - insert(DIKS_ASTERISK , Qt::Key_Asterisk); - insert(DIKS_PLUS_SIGN , Qt::Key_Plus); - insert(DIKS_COMMA , Qt::Key_Comma); - insert(DIKS_MINUS_SIGN , Qt::Key_Minus); - insert(DIKS_PERIOD , Qt::Key_Period); - insert(DIKS_SLASH , Qt::Key_Slash); - insert(DIKS_0 , Qt::Key_0); - insert(DIKS_1 , Qt::Key_1); - insert(DIKS_2 , Qt::Key_2); - insert(DIKS_3 , Qt::Key_3); - insert(DIKS_4 , Qt::Key_4); - insert(DIKS_5 , Qt::Key_5); - insert(DIKS_6 , Qt::Key_6); - insert(DIKS_7 , Qt::Key_7); - insert(DIKS_8 , Qt::Key_8); - insert(DIKS_9 , Qt::Key_9); - insert(DIKS_COLON , Qt::Key_Colon); - insert(DIKS_SEMICOLON , Qt::Key_Semicolon); - insert(DIKS_LESS_THAN_SIGN , Qt::Key_Less); - insert(DIKS_EQUALS_SIGN , Qt::Key_Equal); - insert(DIKS_GREATER_THAN_SIGN , Qt::Key_Greater); - insert(DIKS_QUESTION_MARK , Qt::Key_Question); - insert(DIKS_AT , Qt::Key_At); - insert(DIKS_CAPITAL_A , Qt::Key_A); - insert(DIKS_CAPITAL_B , Qt::Key_B); - insert(DIKS_CAPITAL_C , Qt::Key_C); - insert(DIKS_CAPITAL_D , Qt::Key_D); - insert(DIKS_CAPITAL_E , Qt::Key_E); - insert(DIKS_CAPITAL_F , Qt::Key_F); - insert(DIKS_CAPITAL_G , Qt::Key_G); - insert(DIKS_CAPITAL_H , Qt::Key_H); - insert(DIKS_CAPITAL_I , Qt::Key_I); - insert(DIKS_CAPITAL_J , Qt::Key_J); - insert(DIKS_CAPITAL_K , Qt::Key_K); - insert(DIKS_CAPITAL_L , Qt::Key_L); - insert(DIKS_CAPITAL_M , Qt::Key_M); - insert(DIKS_CAPITAL_N , Qt::Key_N); - insert(DIKS_CAPITAL_O , Qt::Key_O); - insert(DIKS_CAPITAL_P , Qt::Key_P); - insert(DIKS_CAPITAL_Q , Qt::Key_Q); - insert(DIKS_CAPITAL_R , Qt::Key_R); - insert(DIKS_CAPITAL_S , Qt::Key_S); - insert(DIKS_CAPITAL_T , Qt::Key_T); - insert(DIKS_CAPITAL_U , Qt::Key_U); - insert(DIKS_CAPITAL_V , Qt::Key_V); - insert(DIKS_CAPITAL_W , Qt::Key_W); - insert(DIKS_CAPITAL_X , Qt::Key_X); - insert(DIKS_CAPITAL_Y , Qt::Key_Y); - insert(DIKS_CAPITAL_Z , Qt::Key_Z); - insert(DIKS_SQUARE_BRACKET_LEFT , Qt::Key_BracketLeft); - insert(DIKS_BACKSLASH , Qt::Key_Backslash); - insert(DIKS_SQUARE_BRACKET_RIGHT , Qt::Key_BracketRight); - insert(DIKS_CIRCUMFLEX_ACCENT , Qt::Key_AsciiCircum); - insert(DIKS_UNDERSCORE , Qt::Key_Underscore); - insert(DIKS_SMALL_A , Qt::Key_A); - insert(DIKS_SMALL_B , Qt::Key_B); - insert(DIKS_SMALL_C , Qt::Key_C); - insert(DIKS_SMALL_D , Qt::Key_D); - insert(DIKS_SMALL_E , Qt::Key_E); - insert(DIKS_SMALL_F , Qt::Key_F); - insert(DIKS_SMALL_G , Qt::Key_G); - insert(DIKS_SMALL_H , Qt::Key_H); - insert(DIKS_SMALL_I , Qt::Key_I); - insert(DIKS_SMALL_J , Qt::Key_J); - insert(DIKS_SMALL_K , Qt::Key_K); - insert(DIKS_SMALL_L , Qt::Key_L); - insert(DIKS_SMALL_M , Qt::Key_M); - insert(DIKS_SMALL_N , Qt::Key_N); - insert(DIKS_SMALL_O , Qt::Key_O); - insert(DIKS_SMALL_P , Qt::Key_P); - insert(DIKS_SMALL_Q , Qt::Key_Q); - insert(DIKS_SMALL_R , Qt::Key_R); - insert(DIKS_SMALL_S , Qt::Key_S); - insert(DIKS_SMALL_T , Qt::Key_T); - insert(DIKS_SMALL_U , Qt::Key_U); - insert(DIKS_SMALL_V , Qt::Key_V); - insert(DIKS_SMALL_W , Qt::Key_W); - insert(DIKS_SMALL_X , Qt::Key_X); - insert(DIKS_SMALL_Y , Qt::Key_Y); - insert(DIKS_SMALL_Z , Qt::Key_Z); - insert(DIKS_CURLY_BRACKET_LEFT , Qt::Key_BraceLeft); - insert(DIKS_VERTICAL_BAR , Qt::Key_Bar); - insert(DIKS_CURLY_BRACKET_RIGHT , Qt::Key_BraceRight); - insert(DIKS_TILDE , Qt::Key_AsciiTilde); -} diff --git a/src/plugins/platforms/minimaldfb/qdirectfbconvenience.h b/src/plugins/platforms/minimaldfb/qdirectfbconvenience.h deleted file mode 100644 index 0b1a24f..0000000 --- a/src/plugins/platforms/minimaldfb/qdirectfbconvenience.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef QDIRECTFBCONVENIENCE_H -#define QDIRECTFBCONVENIENCE_H - -#include -#include -#include -#include - -#include - -class QDirectFbKeyMap: public QHash -{ -public: - QDirectFbKeyMap(); -}; - - -class QDirectFbConvenience -{ -public: - static QImage::Format imageFormatFromSurfaceFormat(const DFBSurfacePixelFormat format, const DFBSurfaceCapabilities caps); - static bool pixelFomatHasAlpha(const DFBSurfacePixelFormat format) { return (1 << 16) & format; } - static int colorDepthForSurface(const DFBSurfacePixelFormat format); - - //This is set by the graphicssystem constructor - static IDirectFB *dfbInterface(); - static IDirectFBDisplayLayer *dfbDisplayLayer(int display = DLID_PRIMARY); - - static IDirectFBSurface *dfbSurfaceForPixmapData(QPixmapData *); - - static Qt::MouseButton mouseButton(DFBInputDeviceButtonIdentifier identifier); - static Qt::MouseButtons mouseButtons(DFBInputDeviceButtonMask mask); - static Qt::KeyboardModifiers keyboardModifiers(DFBInputDeviceModifierMask mask); - static QEvent::Type eventType(DFBWindowEventType type); - - static QDirectFbKeyMap *keyMap(); - -private: - static QDirectFbKeyMap *dfbKeymap; - friend class QDirectFbGraphicsSystem; -}; - -#endif // QDIRECTFBCONVENIENCE_H diff --git a/src/plugins/platforms/minimaldfb/qdirectfbcursor.cpp b/src/plugins/platforms/minimaldfb/qdirectfbcursor.cpp deleted file mode 100644 index 229a875..0000000 --- a/src/plugins/platforms/minimaldfb/qdirectfbcursor.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "qdirectfbcursor.h" -#include "qblitter_directfb.h" -#include "qgraphicssystem_minimaldfb.h" -#include "qdirectfbconvenience.h" - -#include - -QDirectFBCursor::QDirectFBCursor(QGraphicsSystemScreen * screen) : - QGraphicsSystemCursor(screen), surface(0) -{ - QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),DLID_PRIMARY, &m_layer); - image = new QGraphicsSystemCursorImage(0, 0, 0, 0, 0, 0); -} - -void QDirectFBCursor::changeCursor(QCursor * cursor, QWidget * widget) -{ - Q_UNUSED(widget); - int xSpot; - int ySpot; - QPixmap map; - - if (cursor->shape() != Qt::BitmapCursor) { - image->set(cursor->shape()); - xSpot = image->hotspot().x(); - ySpot = image->hotspot().y(); - QImage *i = image->image(); - map = QPixmap::fromImage(*i); - } else { - QPoint point = cursor->hotSpot(); - xSpot = point.x(); - ySpot = point.y(); - map = cursor->pixmap(); - } - - IDirectFBSurface *surface = QDirectFbConvenience::dfbSurfaceForPixmapData(map.pixmapData()); - - if (m_layer->SetCooperativeLevel(m_layer, DLSCL_ADMINISTRATIVE) != DFB_OK) { - return; - } - m_layer->SetCursorShape( m_layer, surface, xSpot, ySpot); - m_layer->SetCooperativeLevel(m_layer, DLSCL_SHARED); -} diff --git a/src/plugins/platforms/minimaldfb/qdirectfbcursor.h b/src/plugins/platforms/minimaldfb/qdirectfbcursor.h deleted file mode 100644 index 064a336..0000000 --- a/src/plugins/platforms/minimaldfb/qdirectfbcursor.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef QDIRECTFBCURSOR_H -#define QDIRECTFBCURSOR_H - -#include -#include -class QDirectFbGraphicsSystemScreen; -class QDirectFbBlitter; - -class QDirectFBCursor : public QGraphicsSystemCursor -{ -public: - QDirectFBCursor(QGraphicsSystemScreen *screem); - void changeCursor(QCursor * cursor, QWidget * widget); - -private: - IDirectFBDisplayLayer * m_layer; - IDirectFBSurface * surface; - QGraphicsSystemCursorImage * image; - QDirectFbBlitter *blitter; -}; - -#endif // QDIRECTFBCURSOR_H diff --git a/src/plugins/platforms/minimaldfb/qdirectfbinput.cpp b/src/plugins/platforms/minimaldfb/qdirectfbinput.cpp deleted file mode 100644 index 74a38a4..0000000 --- a/src/plugins/platforms/minimaldfb/qdirectfbinput.cpp +++ /dev/null @@ -1,205 +0,0 @@ -#include "qdirectfbinput.h" -#include "qdirectfbconvenience.h" - -#include -#include -#include -#include -#include -#include - -#include - -InputSocketWaiter::InputSocketWaiter(IDirectFBEventBuffer *eventBuffer, QObject *parent) - : QThread(parent), m_eventBuffer(eventBuffer),m_shouldStop(false) -{ - this->start(); -} - -InputSocketWaiter::~InputSocketWaiter() -{ - m_shouldStop = true; - m_eventBuffer->WakeUp(m_eventBuffer); - m_cleanupMutex.lock(); -} - -void InputSocketWaiter::continueWaitingForEvents() -{ - m_finishedProcessingEvents.wakeAll(); -} - -void InputSocketWaiter::run() -{ - m_cleanupMutex.lock(); - while (1) { - m_eventBuffer->WaitForEvent(m_eventBuffer); - if (m_shouldStop) - break; - emit newEvent(); - QMutex waitForProcessingMutex; - waitForProcessingMutex.lock(); - m_finishedProcessingEvents.wait(&waitForProcessingMutex); - } - m_cleanupMutex.unlock(); -} - -QDirectFbInput *QDirectFbInput::instance() -{ - static QDirectFbInput *input = 0; - if (!input) { - input = new QDirectFbInput(); - } - return input; -} - -QDirectFbInput::QDirectFbInput() - : QObject() -{ - dfbInterface = QDirectFbConvenience::dfbInterface(); - - DFBResult ok = dfbInterface->CreateEventBuffer(dfbInterface,&eventBuffer); - if (ok != DFB_OK) - DirectFBError("Failed to initialise eventbuffer", ok); - - dfbInterface->GetDisplayLayer(dfbInterface,DLID_PRIMARY, &dfbDisplayLayer); - - m_inputHandler = new InputSocketWaiter(eventBuffer,this); - connect(m_inputHandler,SIGNAL(newEvent()),this,SLOT(handleEvents())); - - connect(QApplication::instance(),SIGNAL(aboutToQuit()),SLOT(applicationEnd())); -} - -void QDirectFbInput::addWindow(DFBWindowID id, QWidget *tlw) -{ - tlwMap.insert(id,tlw); - IDirectFBWindow *window; - dfbDisplayLayer->GetWindow(dfbDisplayLayer,id,&window); - - window->AttachEventBuffer(window,eventBuffer); -} - -void QDirectFbInput::removeWindow(QWidget *tlw) -{ - DFBWindowID id = tlwMap.key(tlw,0); - if (id) { - IDirectFBWindow *window; - dfbDisplayLayer->GetWindow(dfbDisplayLayer,id, &window); - - window->DetachEventBuffer(window,eventBuffer); - tlwMap.remove(id); - } -} - -void QDirectFbInput::handleEvents() -{ - DFBResult hasEvent = eventBuffer->HasEvent(eventBuffer); - while(hasEvent == DFB_OK){ - DFBEvent event; - DFBResult ok = eventBuffer->GetEvent(eventBuffer,&event); - if (ok != DFB_OK) - DirectFBError("Failed to get event",ok); - if (event.clazz == DFEC_WINDOW) { - switch (event.window.type) { - case DWET_BUTTONDOWN: - case DWET_BUTTONUP: - case DWET_MOTION: - handleMouseEvents(event); - break; - case DWET_WHEEL: - handleWheelEvent(event); - break; - case DWET_KEYDOWN: - case DWET_KEYUP: - handleKeyEvents(event); - break; - case DWET_ENTER: - case DWET_LEAVE: - handleEnterLeaveEvents(event); - default: - break; - } - - } - - hasEvent = eventBuffer->HasEvent(eventBuffer); - } - m_inputHandler->continueWaitingForEvents(); -} - -void QDirectFbInput::handleMouseEvents(const DFBEvent &event) -{ - QPoint p(event.window.x, event.window.y); - QPoint globalPos = globalPoint(event); - Qt::MouseButtons buttons = QDirectFbConvenience::mouseButtons(event.window.buttons); - - IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); - IDirectFBWindow *window; - layer->GetWindow(layer,event.window.window_id,&window); - - long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000); - - if (event.window.type == DWET_BUTTONDOWN) { - window->GrabPointer(window); - } else if (event.window.type == DWET_BUTTONUP) { - window->UngrabPointer(window); - } - QWidget *tlw = tlwMap.value(event.window.window_id); - QWindowSystemInterface::handleMouseEvent(tlw, timestamp, p, globalPos, buttons); -} - -void QDirectFbInput::applicationEnd() -{ - delete m_inputHandler; - m_inputHandler = 0; -} - -void QDirectFbInput::handleWheelEvent(const DFBEvent &event) -{ - QPoint p(event.window.cx, event.window.cy); - QPoint globalPos = globalPoint(event); - long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000); - QWidget *tlw = tlwMap.value(event.window.window_id); - QWindowSystemInterface::handleWheelEvent(tlw, timestamp, p, globalPos, - event.window.step*120, - Qt::Vertical); -} - -void QDirectFbInput::handleKeyEvents(const DFBEvent &event) -{ - QEvent::Type type = QDirectFbConvenience::eventType(event.window.type); - Qt::Key key = QDirectFbConvenience::keyMap()->value(event.window.key_symbol); - Qt::KeyboardModifiers modifiers = QDirectFbConvenience::keyboardModifiers(event.window.modifiers); - - long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000); - - QChar character; - if (DFB_KEY_TYPE(event.window.key_symbol) == DIKT_UNICODE) - character = QChar(event.window.key_symbol); - QWidget *tlw = tlwMap.value(event.window.window_id); - QWindowSystemInterface::handleKeyEvent(tlw, timestamp, type, key, modifiers, character); -} - -void QDirectFbInput::handleEnterLeaveEvents(const DFBEvent &event) -{ - QWidget *tlw = tlwMap.value(event.window.window_id); - switch (event.window.type) { - case DWET_ENTER: - QWindowSystemInterface::handleEnterEvent(tlw); - break; - case DWET_LEAVE: - QWindowSystemInterface::handleLeaveEvent(tlw); - break; - default: - break; - } -} - -inline QPoint QDirectFbInput::globalPoint(const DFBEvent &event) const -{ - IDirectFBWindow *window; - dfbDisplayLayer->GetWindow(dfbDisplayLayer,event.window.window_id,&window); - int x,y; - window->GetPosition(window,&x,&y); - return QPoint(event.window.cx +x, event.window.cy + y); -} - diff --git a/src/plugins/platforms/minimaldfb/qdirectfbinput.h b/src/plugins/platforms/minimaldfb/qdirectfbinput.h deleted file mode 100644 index 31aa082..0000000 --- a/src/plugins/platforms/minimaldfb/qdirectfbinput.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef QDIRECTFBINPUT_H -#define QDIRECTFBINPUT_H - -#include -#include -#include -#include -#include -#include -#include - -#include - -class InputSocketWaiter : public QThread -{ - Q_OBJECT -public: - InputSocketWaiter(IDirectFBEventBuffer *eventBuffer, QObject *parent); - virtual ~InputSocketWaiter(); - void continueWaitingForEvents(); -protected: - void run(); -signals: - void newEvent(); -private: - IDirectFBEventBuffer *m_eventBuffer; - bool m_shouldStop; - QMutex m_cleanupMutex; - QWaitCondition m_finishedProcessingEvents; -}; - -class QDirectFbInput : public QObject -{ - Q_OBJECT -public: - static QDirectFbInput *instance(); - void addWindow(DFBWindowID id, QWidget *tlw); - void removeWindow(QWidget *tlw); - -public slots: - void handleEvents(); - void applicationEnd(); - -private: - QDirectFbInput(); - - void handleMouseEvents(const DFBEvent &event); - void handleWheelEvent(const DFBEvent &event); - void handleKeyEvents(const DFBEvent &event); - void handleEnterLeaveEvents(const DFBEvent &event); - IDirectFB *dfbInterface; - IDirectFBDisplayLayer *dfbDisplayLayer; - IDirectFBEventBuffer *eventBuffer; - - QHashtlwMap; - - inline QPoint globalPoint(const DFBEvent &event) const; - - InputSocketWaiter *m_inputHandler; - -}; - -#endif // QDIRECTFBINPUT_H diff --git a/src/plugins/platforms/minimaldfb/qgraphicssystem_minimaldfb.cpp b/src/plugins/platforms/minimaldfb/qgraphicssystem_minimaldfb.cpp deleted file mode 100644 index 212f3a9..0000000 --- a/src/plugins/platforms/minimaldfb/qgraphicssystem_minimaldfb.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgraphicssystem_minimaldfb.h" -#include "qwindowsurface_minimaldfb.h" -#include "qblitter_directfb.h" -#include "qdirectfbconvenience.h" -#include "qdirectfbcursor.h" - -#include -#include - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -QDirectFbGraphicsSystemScreen::QDirectFbGraphicsSystemScreen(int display) - :QGraphicsSystemScreen() -{ - m_layer = QDirectFbConvenience::dfbDisplayLayer(display); - m_layer->SetCooperativeLevel(m_layer,DLSCL_SHARED); - - DFBDisplayLayerConfig config; - m_layer->GetConfiguration(m_layer, &config); - - m_format = QDirectFbConvenience::imageFormatFromSurfaceFormat(config.pixelformat, config.surface_caps); - m_geometry = QRect(0,0,config.width,config.height); - const int dpi = 72; - const qreal inch = 25.4; - m_depth = 32; - m_physicalSize = QSize(qRound(config.width * inch / dpi), qRound(config.height *inch / dpi)); - - cursor = new QDirectFBCursor(this); -} - -QDirectFbGraphicsSystemScreen::~QDirectFbGraphicsSystemScreen() -{ -} - -QDirectFbGraphicsSystem::QDirectFbGraphicsSystem() -{ - const QStringList args = QCoreApplication::arguments(); - int argc = args.size(); - char **argv = new char*[argc]; - - for (int i = 0; i < argc; ++i) - argv[i] = qstrdup(args.at(i).toLocal8Bit().constData()); - - DFBResult result = DirectFBInit(&argc, &argv); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreen: error initializing DirectFB", - result); - } - delete[] argv; - - mPrimaryScreen = new QDirectFbGraphicsSystemScreen(0); - mScreens.append(mPrimaryScreen); -} - -QPixmapData *QDirectFbGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const -{ - if (type == QPixmapData::BitmapType) - return new QRasterPixmapData(type); - else - return new QBlittablePixmapData(type); -} - -QWindowSurface *QDirectFbGraphicsSystem::createWindowSurface(QWidget *widget) const -{ - return new QDirectFbWindowSurface (widget); -} - -QBlittable *QDirectFbGraphicsSystem::createBlittable(const QSize &size) const -{ - return new QDirectFbBlitter(size); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/minimaldfb/qgraphicssystem_minimaldfb.h b/src/plugins/platforms/minimaldfb/qgraphicssystem_minimaldfb.h deleted file mode 100644 index 27bddfb..0000000 --- a/src/plugins/platforms/minimaldfb/qgraphicssystem_minimaldfb.h +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSYSTEM_MINIMAL_H -#define QGRAPHICSSYSTEM_MINIMAL_H - -#include "qdirectfbinput.h" - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QDirectFBCursor; - -class QDirectFbGraphicsSystemScreen : public QGraphicsSystemScreen -{ -public: - QDirectFbGraphicsSystemScreen(int display); - ~QDirectFbGraphicsSystemScreen(); - - QRect geometry() const { return m_geometry; } - int depth() const { return m_depth; } - QImage::Format format() const { return m_format; } - QSize physicalSize() const { return m_physicalSize; } - -public: - QRect m_geometry; - int m_depth; - QImage::Format m_format; - QSize m_physicalSize; - - IDirectFBDisplayLayer *m_layer; - -private: - QDirectFBCursor * cursor; - -}; - -class QDirectFbGraphicsSystem : public QGraphicsSystem -{ -public: - QDirectFbGraphicsSystem(); - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; - QBlittable *createBlittable(const QSize &size) const; - - QList screens() const { return mScreens; } - - - -private: - QDirectFbGraphicsSystemScreen *mPrimaryScreen; - QList mScreens; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/minimaldfb/qwindowsurface_minimaldfb.cpp b/src/plugins/platforms/minimaldfb/qwindowsurface_minimaldfb.cpp deleted file mode 100644 index 68d5aa0..0000000 --- a/src/plugins/platforms/minimaldfb/qwindowsurface_minimaldfb.cpp +++ /dev/null @@ -1,231 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwindowsurface_minimaldfb.h" -#include "qgraphicssystem_minimaldfb.h" -#include "qblitter_directfb.h" -#include "qdirectfbconvenience.h" -#include - -#include - -QT_BEGIN_NAMESPACE - -QDirectFbWindowSurface::QDirectFbWindowSurface(QWidget *window) - : QWindowSurface(window), m_pixmap(0), m_pmdata(0), - m_dfbWindow(0), m_dfbSurface(0) -{ - window->setWindowSurface(this); - - IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); - DFBDisplayLayerConfig layerConfig; - layer->GetConfiguration(layer,&layerConfig); - - DFBWindowDescription description; - memset(&description,0,sizeof(DFBWindowDescription)); - description.flags = DFBWindowDescriptionFlags(DWDESC_WIDTH|DWDESC_HEIGHT|DWDESC_POSX|DWDESC_POSY|DWDESC_SURFACE_CAPS -#if DIRECTFB_MINOR_VERSION >= 1 - |DWDESC_OPTIONS -#endif - |DWDESC_CAPS); - description.width = window->rect().width(); - description.height = window->rect().height(); - description.posx = window->rect().x(); - description.posy = window->rect().y(); - - if (layerConfig.surface_caps & DSCAPS_PREMULTIPLIED) - description.surface_caps = DSCAPS_PREMULTIPLIED; - description.pixelformat = layerConfig.pixelformat; - -#if DIRECTFB_MINOR_VERSION >= 1 - description.options = DFBWindowOptions(DWOP_ALPHACHANNEL); -#endif - description.caps = DFBWindowCapabilities(DWCAPS_DOUBLEBUFFER|DWCAPS_ALPHACHANNEL); - description.surface_caps = DSCAPS_PREMULTIPLIED; - - DFBResult result = layer->CreateWindow(layer,&description,&m_dfbWindow); - if (result != DFB_OK) { - DirectFBError("QDirectFbGraphicsSystemScreen: failed to create window",result); - } - - DFBWindowID id; - m_dfbWindow->GetID(m_dfbWindow, &id); - QDirectFbInput::instance()->addWindow(id,window); - - m_dfbWindow->GetSurface(m_dfbWindow,&m_dfbSurface); - - QDirectFbBlitter *blitter = new QDirectFbBlitter(window->rect().size(), m_dfbSurface); - m_pmdata = new QBlittablePixmapData(QPixmapData::PixmapType); - m_pmdata->setBlittable(blitter); - m_pixmap = new QPixmap(m_pmdata); -} - -QDirectFbWindowSurface::~QDirectFbWindowSurface() -{ - QDirectFbInput::instance()->removeWindow(this->window()); - m_dfbWindow->Destroy(m_dfbWindow); -} - -QPaintDevice *QDirectFbWindowSurface::paintDevice() -{ - return m_pixmap; -} - -void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) -{ - m_pmdata->blittable()->unlock(); - - const quint8 windowOpacity = quint8(widget->windowOpacity() * 0xff); - m_dfbWindow->SetOpacity(m_dfbWindow,windowOpacity); - - QVector rects = region.rects(); - for (int i = 0 ; i < rects.size(); i++) { - const QRect rect = rects.at(i); - DFBRegion dfbReg = { rect.x() + offset.x(),rect.y() + offset.y(),rect.right() + offset.x(),rect.bottom() + offset.y()}; - m_dfbSurface->Flip(m_dfbSurface, &dfbReg, DFBSurfaceFlipFlags(DSFLIP_BLIT|DSFLIP_ONSYNC)); - } -} - -void QDirectFbWindowSurface::setGeometry(const QRect &rect) -{ - m_pmdata->blittable()->unlock(); - - QWindowSurface::setGeometry(rect); - m_dfbWindow->SetBounds(m_dfbWindow, rect.x(),rect.y(), - rect.width(), rect.height()); - - //Have to add 1 ref ass it will be removed by deleting the old blitter in setBlittable - m_dfbSurface->AddRef(m_dfbSurface); - QDirectFbBlitter *blitter = new QDirectFbBlitter(rect.size(),m_dfbSurface); - m_pmdata->setBlittable(blitter); -} - -static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int dx, int dy) -{ - const DFBRectangle rect = { r.x(), r.y(), r.width(), r.height() }; - surface->Blit(surface, surface, &rect, r.x() + dx, r.y() + dy); - const DFBRegion region = { rect.x + dx, rect.y + dy, r.right() + dx, r.bottom() + dy }; - surface->Flip(surface, ®ion, DFBSurfaceFlipFlags(DSFLIP_BLIT)); -} - -bool QDirectFbWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - m_pmdata->blittable()->unlock(); - - if (!m_dfbSurface || area.isEmpty()) - return false; - m_dfbSurface->SetBlittingFlags(m_dfbSurface, DSBLIT_NOFX); - if (area.rectCount() == 1) { - scrollSurface(m_dfbSurface, area.boundingRect(), dx, dy); - } else { - const QVector rects = area.rects(); - const int n = rects.size(); - for (int i=0; iblittable()->unlock(); - - if (visible) { - int x = this->geometry().x(); - int y = this->geometry().y(); - m_dfbWindow->MoveTo(m_dfbWindow,x,y); - } else { - IDirectFBDisplayLayer *displayLayer; - QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),DLID_PRIMARY,&displayLayer); - - DFBDisplayLayerConfig config; - displayLayer->GetConfiguration(displayLayer,&config); - m_dfbWindow->MoveTo(m_dfbWindow,config.width+1,config.height + 1); - } -} - -Qt::WindowFlags QDirectFbWindowSurface::setWindowFlags(Qt::WindowFlags flags) -{ - switch (flags & Qt::WindowType_Mask) { - case Qt::ToolTip: { - DFBWindowOptions options; - m_dfbWindow->GetOptions(m_dfbWindow,&options); - options = DFBWindowOptions(options | DWOP_GHOST); - m_dfbWindow->SetOptions(m_dfbWindow,options); - break; } - default: - break; - } - - m_dfbWindow->SetStackingClass(m_dfbWindow, flags & Qt::WindowStaysOnTopHint ? DWSC_UPPER : DWSC_MIDDLE); - return flags; -} - -void QDirectFbWindowSurface::raise() -{ - m_dfbWindow->RaiseToTop(m_dfbWindow); -} - -void QDirectFbWindowSurface::lower() -{ - m_dfbWindow->LowerToBottom(m_dfbWindow); -} - -WId QDirectFbWindowSurface::winId() const -{ - DFBWindowID id; - m_dfbWindow->GetID(m_dfbWindow, &id); - return WId(id); -} - - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/minimaldfb/qwindowsurface_minimaldfb.h b/src/plugins/platforms/minimaldfb/qwindowsurface_minimaldfb.h deleted file mode 100644 index ca34cbf..0000000 --- a/src/plugins/platforms/minimaldfb/qwindowsurface_minimaldfb.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_MINIMAL_H -#define QWINDOWSURFACE_MINIMAL_H - -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -class QDirectFbGraphicsSystemScreen; - -class QDirectFbWindowSurface : public QWindowSurface -{ -public: - QDirectFbWindowSurface(QWidget *window); - ~QDirectFbWindowSurface(); - - QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void setGeometry(const QRect &rect); - bool scroll(const QRegion &area, int dx, int dy); - - void beginPaint(const QRegion ®ion); - void endPaint(const QRegion ®ion); - - void setVisible(bool visible); - Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); - - void raise(); - void lower(); - - WId winId() const; - -private: - void lockSurfaceToImage(); - - QPixmap *m_pixmap; - QBlittablePixmapData *m_pmdata; - - IDirectFBWindow *m_dfbWindow; - IDirectFBSurface *m_dfbSurface; -}; - -QT_END_NAMESPACE - -#endif -- cgit v0.12 From 7cb41f111706542da7e5391c99720acee6d2ac43 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Wed, 31 Mar 2010 12:32:15 +0200 Subject: Stub out QtOpenGL on Lighthouse & get it compiling --- config.tests/unix/opengldesktop/opengldesktop.cpp | 52 +++++ config.tests/unix/opengldesktop/opengldesktop.pro | 9 + configure | 77 +++++++- mkspecs/common/qws.conf | 4 - src/opengl/opengl.pro | 12 ++ src/opengl/qgl.cpp | 2 +- src/opengl/qgl_lite.cpp | 227 ++++++++++++++++++++++ src/opengl/qglpixelbuffer_p.h | 5 + src/opengl/qglpixelbuffer_stub.cpp | 84 ++++++++ 9 files changed, 457 insertions(+), 15 deletions(-) create mode 100644 config.tests/unix/opengldesktop/opengldesktop.cpp create mode 100644 config.tests/unix/opengldesktop/opengldesktop.pro create mode 100644 src/opengl/qgl_lite.cpp create mode 100644 src/opengl/qglpixelbuffer_stub.cpp diff --git a/config.tests/unix/opengldesktop/opengldesktop.cpp b/config.tests/unix/opengldesktop/opengldesktop.cpp new file mode 100644 index 0000000..969767c --- /dev/null +++ b/config.tests/unix/opengldesktop/opengldesktop.cpp @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +int main(int, char **) +{ + glBegin(GL_TRIANGLES); + glVertex2f(20.0f, 10.0f); + glVertex2f(10.0f, 30.0f); + glVertex2f(20.0f, 50.0f); + glEnd(); + return 0; +} diff --git a/config.tests/unix/opengldesktop/opengldesktop.pro b/config.tests/unix/opengldesktop/opengldesktop.pro new file mode 100644 index 0000000..ac70ca3 --- /dev/null +++ b/config.tests/unix/opengldesktop/opengldesktop.pro @@ -0,0 +1,9 @@ +SOURCES = opengldesktop.cpp +INCLUDEPATH += $$QMAKE_INCDIR_OPENGL + +for(p, QMAKE_LIBDIR_OPENGL) { + exists($$p):LIBS += -L$$p +} + +CONFIG -= qt +LIBS += $$QMAKE_LIBS_OPENGL diff --git a/configure b/configure index b27d6dd..ffaa498 100755 --- a/configure +++ b/configure @@ -5560,14 +5560,68 @@ if [ "$PLATFORM_MAC" = "yes" ]; then fi fi + +if [ "$PLATFORM_EMBLITE" = "yes" ]; then + # auto-detect OpenGL support (es1 = OpenGL ES 1.x Common, es2 = OpenGL ES 2.x) + if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengldesktop "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then + CFG_OPENGL=desktop + elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS; then + CFG_OPENGL=es2 + elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS; then + CFG_OPENGL=es1 + else + if [ "$CFG_OPENGL" = "yes" ]; then + echo "All the OpenGL functionality tests failed!" + echo " You might need to modify the include and library search paths by editing" + echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in" + echo " ${XQMAKESPEC}." + exit 1 + fi + CFG_OPENGL=no + fi + elif [ "$CFG_OPENGL" = "es1" ]; then + # OpenGL ES 1.x + "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS + if [ $? != "0" ]; then + echo "The OpenGL ES 1.x functionality test failed!" + echo " You might need to modify the include and library search paths by editing" + echo " QMAKE_INCDIR_OPENGL_ES1, QMAKE_LIBDIR_OPENGL_ES1 and QMAKE_LIBS_OPENGL_ES1 in" + echo " ${XQMAKESPEC}." + exit 1 + fi + elif [ "$CFG_OPENGL" = "es2" ]; then + #OpenGL ES 2.x + "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS + if [ $? != "0" ]; then + echo "The OpenGL ES 2.0 functionality test failed!" + echo " You might need to modify the include and library search paths by editing" + echo " QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in" + echo " ${XQMAKESPEC}." + exit 1 + fi + elif [ "$CFG_OPENGL" = "desktop" ]; then + # Desktop OpenGL support + "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengldesktop "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS + if [ $? != "0" ]; then + echo "The OpenGL functionality test failed!" + echo " You might need to modify the include and library search paths by editing" + echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in" + echo " ${XQMAKESPEC}." + exit 1 + fi + fi +fi + + # QWS -if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then +if [ "$PLATFORM_QWS" = "yes" ]; then # auto-detect OpenGL support (es1 = OpenGL ES 1.x Common, es2 = OpenGL ES 2.x) if [ "$CFG_OPENGL" = "yes" ]; then if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS; then CFG_OPENGL=es2 - elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS; then + elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS; then CFG_OPENGL=es1 else echo "All the OpenGL ES functionality tests failed!" @@ -5578,22 +5632,22 @@ if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then fi elif [ "$CFG_OPENGL" = "es1" ]; then # OpenGL ES 1.x - "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS + "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS if [ $? != "0" ]; then - echo "The OpenGL ES 1.x functionality test failed!" + echo "The OpenGL ES 1.x functionality test failed!" echo " You might need to modify the include and library search paths by editing" - echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in" - echo " ${XQMAKESPEC}." + echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in" + echo " ${XQMAKESPEC}." exit 1 fi elif [ "$CFG_OPENGL" = "es2" ]; then #OpenGL ES 2.x - "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS + "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS if [ $? != "0" ]; then - echo "The OpenGL ES 2.0 functionality test failed!" + echo "The OpenGL ES 2.0 functionality test failed!" echo " You might need to modify the include and library search paths by editing" - echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in" - echo " ${XQMAKESPEC}." + echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in" + echo " ${XQMAKESPEC}." exit 1 fi elif [ "$CFG_OPENGL" = "desktop" ]; then @@ -5601,6 +5655,9 @@ if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then echo "Desktop OpenGL support is not avaliable on Qt for Embedded Linux" exit 1 fi +fi + +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then # screen drivers for screen in ${CFG_GFX_ON} ${CFG_GFX_PLUGIN}; do diff --git a/mkspecs/common/qws.conf b/mkspecs/common/qws.conf index 96341a7..2e8ae2c 100644 --- a/mkspecs/common/qws.conf +++ b/mkspecs/common/qws.conf @@ -12,9 +12,5 @@ QMAKE_INCREMENTAL_STYLE = sublib # modifications to linux.conf QMAKE_INCDIR_X11 = QMAKE_LIBDIR_X11 = -QMAKE_INCDIR_OPENGL = -QMAKE_LIBDIR_OPENGL = QMAKE_LIBS_X11 = QMAKE_LIBS_X11SM = -QMAKE_LIBS_OPENGL = -QMAKE_LIBS_OPENGL_QT = diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index c111a8e..60d4b17 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -76,6 +76,18 @@ SOURCES += qgl.cpp \ } +embedded_lite { + SOURCES += qgl_lite.cpp + + # If we have EGL, use the EGL implementation of QGLPixelBuffer, otherwise we just provide + # a stubbed out one. PBuffers aren't too interesting anyway. + contains(QT_CONFIG, egl) { + SOURCES += qglpixelbuffer_egl.cpp + } else { + SOURCES += qglpixelbuffer_stub.cpp + } +} + x11 { contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2) { SOURCES += qgl_x11egl.cpp \ diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index e0030ad..7fcf390 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -95,7 +95,7 @@ QT_BEGIN_NAMESPACE -#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) +#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) || defined(Q_WS_LITE) QGLExtensionFuncs QGLContextPrivate::qt_extensionFuncs; #endif diff --git a/src/opengl/qgl_lite.cpp b/src/opengl/qgl_lite.cpp new file mode 100644 index 0000000..40417b1 --- /dev/null +++ b/src/opengl/qgl_lite.cpp @@ -0,0 +1,227 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenGL module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgl.h" +#include "qgl_p.h" + +#include "qmap.h" +#include "qapplication.h" +#include "qcolormap.h" +#include "qdesktopwidget.h" +#include "qpixmap.h" +#include "qhash.h" +#include "qlibrary.h" +#include "qdebug.h" +#include + +QT_BEGIN_NAMESPACE + +bool QGLFormat::hasOpenGL() +{ + return true; // IMPLEMENT ME PROPERLY! +} + + + +bool QGLContext::chooseContext(const QGLContext* shareContext) +{ + // IMPLEMENT ME + return false; +} + + +void QGLContext::reset() +{ + Q_D(QGLContext); + if (!d->valid) + return; + d->cleanup(); + doneCurrent(); + + // IMPLEMENT ME + + d->crWin = false; + d->sharing = false; + d->valid = false; + d->transpColor = QColor(); + d->initDone = false; + QGLContextGroup::removeShare(this); +} + + +void QGLContext::makeCurrent() +{ + // IMPLEMENT ME +} + +void QGLContext::doneCurrent() +{ + // IMPLEMENT ME +} + + +void QGLContext::swapBuffers() const +{ + // IMPLEMENT ME +} + +void *QGLContext::getProcAddress(const QString &proc) const +{ + // IMPLEMENT ME +} + +void QGLWidgetPrivate::init(QGLContext *context, const QGLWidget *shareWidget) +{ + // IMPLEMENT ME +} + + +void QGLWidget::setContext(QGLContext *context, + const QGLContext* shareContext, + bool deleteOldContext) +{ + // IMPLEMENT ME +} + + + + + + + +bool QGLFormat::hasOpenGLOverlays() +{ + return false; +} + +QColor QGLContext::overlayTransparentColor() const +{ + return QColor(); // Invalid color +} + +uint QGLContext::colorIndex(const QColor& c) const +{ + return 0; +} + +void QGLContext::generateFontDisplayLists(const QFont & fnt, int listBase) +{ + Q_UNUSED(fnt); + Q_UNUSED(listBase); +} + +/* + QGLTemporaryContext implementation +*/ +class QGLTemporaryContextPrivate +{ +public: + QGLWidget *widget; +}; + +QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) + : d(new QGLTemporaryContextPrivate) +{ + d->widget = new QGLWidget; + d->widget->makeCurrent(); +} + +QGLTemporaryContext::~QGLTemporaryContext() +{ + delete d->widget; +} + + +bool QGLWidgetPrivate::renderCxPm(QPixmap* pm) +{ + return false; +} + +/*! \internal + Free up any allocated colormaps. This fn is only called for + top-level widgets. +*/ +void QGLWidgetPrivate::cleanupColormaps() +{ +} + +void QGLWidget::setMouseTracking(bool enable) +{ + Q_UNUSED(enable); +} + +void QGLWidget::resizeEvent(QResizeEvent *) +{ + Q_D(QGLWidget); + if (!isValid()) + return; + makeCurrent(); + if (!d->glcx->initialized()) + glInit(); + resizeGL(width(), height()); +} + +const QGLContext* QGLWidget::overlayContext() const +{ + return 0; +} + +void QGLWidget::makeOverlayCurrent() +{ +} + + +void QGLWidget::updateOverlayGL() +{ +} + +const QGLColormap & QGLWidget::colormap() const +{ + Q_D(const QGLWidget); + return d->cmap; +} + +void QGLWidget::setColormap(const QGLColormap & c) +{ + Q_UNUSED(c); +} + +QT_END_NAMESPACE diff --git a/src/opengl/qglpixelbuffer_p.h b/src/opengl/qglpixelbuffer_p.h index c85dc5a..bff35f5 100644 --- a/src/opengl/qglpixelbuffer_p.h +++ b/src/opengl/qglpixelbuffer_p.h @@ -200,6 +200,11 @@ public: QEglContext *ctx; int textureFormat; #endif +#if defined(Q_WS_LITE) + // Stubs + int pbuf; + int ctx; +#endif }; QT_END_NAMESPACE diff --git a/src/opengl/qglpixelbuffer_stub.cpp b/src/opengl/qglpixelbuffer_stub.cpp new file mode 100644 index 0000000..2caef6b --- /dev/null +++ b/src/opengl/qglpixelbuffer_stub.cpp @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenGL module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qglpixelbuffer.h" +#include "qglpixelbuffer_p.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidget *shareWidget) +{ + Q_UNUSED(size); + Q_UNUSED(f); + Q_UNUSED(shareWidget); + return false; +} + +bool QGLPixelBufferPrivate::cleanup() +{ + return false; +} + +bool QGLPixelBuffer::bindToDynamicTexture(GLuint texture_id) +{ + Q_UNUSED(texture_id); + return false; +} + +void QGLPixelBuffer::releaseFromDynamicTexture() +{ +} + +GLuint QGLPixelBuffer::generateDynamicTexture() const +{ + return 0; +} + +bool QGLPixelBuffer::hasOpenGLPbuffers() +{ + return false; +} + +QT_END_NAMESPACE -- cgit v0.12 From c1cb9ed008ab489f209d0a628d41d62d75a5bab2 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 31 Mar 2010 13:15:09 +0200 Subject: Port "testlite" to the new plugin API --- src/plugins/platforms/testlite/main.cpp | 16 +-- .../testlite/qgraphicssystem_testlite.cpp | 121 --------------------- .../platforms/testlite/qgraphicssystem_testlite.h | 91 ---------------- .../testlite/qplatformintegration_testlite.cpp | 121 +++++++++++++++++++++ .../testlite/qplatformintegration_testlite.h | 92 ++++++++++++++++ .../platforms/testlite/qwindowsurface_testlite.cpp | 14 +-- .../platforms/testlite/qwindowsurface_testlite.h | 12 +- src/plugins/platforms/testlite/testlite.pro | 6 +- 8 files changed, 237 insertions(+), 236 deletions(-) delete mode 100644 src/plugins/platforms/testlite/qgraphicssystem_testlite.cpp delete mode 100644 src/plugins/platforms/testlite/qgraphicssystem_testlite.h create mode 100644 src/plugins/platforms/testlite/qplatformintegration_testlite.cpp create mode 100644 src/plugins/platforms/testlite/qplatformintegration_testlite.h diff --git a/src/plugins/platforms/testlite/main.cpp b/src/plugins/platforms/testlite/main.cpp index 28caea7..c1759ef 100644 --- a/src/plugins/platforms/testlite/main.cpp +++ b/src/plugins/platforms/testlite/main.cpp @@ -39,33 +39,33 @@ ** ****************************************************************************/ -#include -#include "qgraphicssystem_testlite.h" +#include +#include "qplatformintegration_testlite.h" QT_BEGIN_NAMESPACE -class QTestLiteGraphicsSystemPlugin : public QGraphicsSystemPlugin +class QTestLiteIntegrationPlugin : public QPlatformIntegrationPlugin { public: QStringList keys() const; - QGraphicsSystem *create(const QString&); + QPlatformIntegration *create(const QString&); }; -QStringList QTestLiteGraphicsSystemPlugin::keys() const +QStringList QTestLiteIntegrationPlugin::keys() const { QStringList list; list << "TestLite"; return list; } -QGraphicsSystem* QTestLiteGraphicsSystemPlugin::create(const QString& system) +QPlatformIntegration* QTestLiteIntegrationPlugin::create(const QString& system) { if (system.toLower() == "testlite") - return new QTestLiteGraphicsSystem; + return new QTestLiteIntegration; return 0; } -Q_EXPORT_PLUGIN2(testlite, QTestLiteGraphicsSystemPlugin) +Q_EXPORT_PLUGIN2(testlite, QTestLiteIntegrationPlugin) QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qgraphicssystem_testlite.cpp b/src/plugins/platforms/testlite/qgraphicssystem_testlite.cpp deleted file mode 100644 index 92e0ebc..0000000 --- a/src/plugins/platforms/testlite/qgraphicssystem_testlite.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgraphicssystem_testlite.h" -#include "qwindowsurface_testlite.h" -#include -#include - -#include - - -#include "x11util.h" - -QT_BEGIN_NAMESPACE - -class MyCursor : QGraphicsSystemCursor -{ -public: - MyCursor(QGraphicsSystemScreen *screen) : QGraphicsSystemCursor(screen) {} - - void changeCursor(QCursor * cursor, QWidget * widget) { - QTestLiteWindowSurface *ws = 0; - if (widget) { - QWidget *window = widget->window(); - ws = static_cast(window->windowSurface()); - } else { - // No X11 cursor control when there is no widget under the cursor - return; - } - - //qDebug() << "changeCursor" << widget << ws; - if (!ws) - return; - - ws->setCursor(cursor); - } -}; - - -QTestLiteGraphicsSystem::QTestLiteGraphicsSystem() -{ - - xd = new MyDisplay; - - mPrimaryScreen = new QTestLiteGraphicsSystemScreen(); - - mPrimaryScreen->mGeometry = QRect - (0, 0, xd->width, xd->height); - mPrimaryScreen->mDepth = 32; - mPrimaryScreen->mFormat = QImage::Format_RGB32; - mPrimaryScreen->mPhysicalSize = - QSize(xd->physicalWidth, xd->physicalHeight); - - mScreens.append(mPrimaryScreen); - - - (void)new MyCursor(mPrimaryScreen); - -} - -QPixmapData *QTestLiteGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const -{ - return new QRasterPixmapData(type); -} - -QWindowSurface *QTestLiteGraphicsSystem::createWindowSurface(QWidget *widget) const -{ - if (widget->windowType() == Qt::Desktop) - return 0; // Don't create an explicit window surface for the destkop. - return new QTestLiteWindowSurface - (const_cast(this), mPrimaryScreen, widget); -} - - -QPixmap QTestLiteGraphicsSystem::grabWindow(WId window, int x, int y, int width, int height) const -{ - QImage img = xd->grabWindow(window, x, y, width, height); - return QPixmap::fromImage(img); -} - - - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qgraphicssystem_testlite.h b/src/plugins/platforms/testlite/qgraphicssystem_testlite.h deleted file mode 100644 index b2cd496..0000000 --- a/src/plugins/platforms/testlite/qgraphicssystem_testlite.h +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSYSTEM_TESTLITE_H -#define QGRAPHICSSYSTEM_TESTLITE_H - -#include - -QT_BEGIN_NAMESPACE - -class MyDisplay; - -class QTestLiteGraphicsSystemScreen : public QGraphicsSystemScreen -{ -public: - QTestLiteGraphicsSystemScreen() - : mDepth(16), mFormat(QImage::Format_RGB16) {} - ~QTestLiteGraphicsSystemScreen() {} - - QRect geometry() const { return mGeometry; } - int depth() const { return mDepth; } - QImage::Format format() const { return mFormat; } - QSize physicalSize() const { return mPhysicalSize; } - -public: - QRect mGeometry; - int mDepth; - QImage::Format mFormat; - QSize mPhysicalSize; -}; - -class QTestLiteGraphicsSystem : public QGraphicsSystem -{ -public: - QTestLiteGraphicsSystem(); - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; - - QPixmap grabWindow(WId window, int x, int y, int width, int height) const; - - QList screens() const { return mScreens; } - - MyDisplay *xd; - -private: - QTestLiteGraphicsSystemScreen *mPrimaryScreen; - QList mScreens; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp b/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp new file mode 100644 index 0000000..6811e2e --- /dev/null +++ b/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformintegration_testlite.h" +#include "qwindowsurface_testlite.h" +#include +#include + +#include + + +#include "x11util.h" + +QT_BEGIN_NAMESPACE + +class MyCursor : QGraphicsSystemCursor +{ +public: + MyCursor(QPlatformScreen *screen) : QGraphicsSystemCursor(screen) {} + + void changeCursor(QCursor * cursor, QWidget * widget) { + QTestLiteWindowSurface *ws = 0; + if (widget) { + QWidget *window = widget->window(); + ws = static_cast(window->windowSurface()); + } else { + // No X11 cursor control when there is no widget under the cursor + return; + } + + //qDebug() << "changeCursor" << widget << ws; + if (!ws) + return; + + ws->setCursor(cursor); + } +}; + + +QTestLiteIntegration::QTestLiteIntegration() +{ + + xd = new MyDisplay; + + mPrimaryScreen = new QTestLiteScreen(); + + mPrimaryScreen->mGeometry = QRect + (0, 0, xd->width, xd->height); + mPrimaryScreen->mDepth = 32; + mPrimaryScreen->mFormat = QImage::Format_RGB32; + mPrimaryScreen->mPhysicalSize = + QSize(xd->physicalWidth, xd->physicalHeight); + + mScreens.append(mPrimaryScreen); + + + (void)new MyCursor(mPrimaryScreen); + +} + +QPixmapData *QTestLiteIntegration::createPixmapData(QPixmapData::PixelType type) const +{ + return new QRasterPixmapData(type); +} + +QWindowSurface *QTestLiteIntegration::createWindowSurface(QWidget *widget) const +{ + if (widget->windowType() == Qt::Desktop) + return 0; // Don't create an explicit window surface for the destkop. + return new QTestLiteWindowSurface + (const_cast(this), mPrimaryScreen, widget); +} + + +QPixmap QTestLiteIntegration::grabWindow(WId window, int x, int y, int width, int height) const +{ + QImage img = xd->grabWindow(window, x, y, width, height); + return QPixmap::fromImage(img); +} + + + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qplatformintegration_testlite.h b/src/plugins/platforms/testlite/qplatformintegration_testlite.h new file mode 100644 index 0000000..c540c48 --- /dev/null +++ b/src/plugins/platforms/testlite/qplatformintegration_testlite.h @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_TESTLITE_H +#define QGRAPHICSSYSTEM_TESTLITE_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class MyDisplay; + +class QTestLiteScreen : public QPlatformScreen +{ +public: + QTestLiteScreen() + : mDepth(16), mFormat(QImage::Format_RGB16) {} + ~QTestLiteScreen() {} + + QRect geometry() const { return mGeometry; } + int depth() const { return mDepth; } + QImage::Format format() const { return mFormat; } + QSize physicalSize() const { return mPhysicalSize; } + +public: + QRect mGeometry; + int mDepth; + QImage::Format mFormat; + QSize mPhysicalSize; +}; + +class QTestLiteIntegration : public QPlatformIntegration +{ +public: + QTestLiteIntegration(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QWindowSurface *createWindowSurface(QWidget *widget) const; + + QPixmap grabWindow(WId window, int x, int y, int width, int height) const; + + QList screens() const { return mScreens; } + + MyDisplay *xd; + +private: + QTestLiteScreen *mPrimaryScreen; + QList mScreens; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp b/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp index c54f6eb..e2574f9 100644 --- a/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qwindowsurface_testlite.h" -#include "qgraphicssystem_testlite.h" +#include "qplatformintegration_testlite.h" #include #include @@ -50,16 +50,16 @@ QT_BEGIN_NAMESPACE QTestLiteWindowSurface::QTestLiteWindowSurface - (QTestLiteGraphicsSystem *graphicsSystem, - QTestLiteGraphicsSystemScreen *screen, QWidget *window) + (QTestLiteIntegration *platformIntegration, + QTestLiteScreen *screen, QWidget *window) : QWindowSurface(window), - mGraphicsSystem(graphicsSystem), + mPlatformIntegration(platformIntegration), mScreen(screen), xw(0) { - xw = new MyWindow(graphicsSystem->xd, 0,0,300,300); + xw = new MyWindow(platformIntegration->xd, 0,0,300,300); xw->windowSurface = this; // qDebug() << "QTestLiteWindowSurface::QTestLiteWindowSurface:" << xw->window; @@ -640,13 +640,13 @@ WId QTestLiteWindowSurface::winId() const void QTestLiteWindowSurface::raise() { WId window = winId(); - XRaiseWindow(mGraphicsSystem->xd->display, window); + XRaiseWindow(mPlatformIntegration->xd->display, window); } void QTestLiteWindowSurface::lower() { WId window = winId(); - XLowerWindow(mGraphicsSystem->xd->display, window); + XLowerWindow(mPlatformIntegration->xd->display, window); } void QTestLiteWindowSurface::setWindowTitle(const QString &title) diff --git a/src/plugins/platforms/testlite/qwindowsurface_testlite.h b/src/plugins/platforms/testlite/qwindowsurface_testlite.h index 0c4df1a..ffd2d3a 100644 --- a/src/plugins/platforms/testlite/qwindowsurface_testlite.h +++ b/src/plugins/platforms/testlite/qwindowsurface_testlite.h @@ -48,15 +48,15 @@ QT_BEGIN_NAMESPACE class MyWindow; -class QTestLiteGraphicsSystem; -class QTestLiteGraphicsSystemScreen; +class QTestLiteIntegration; +class QTestLiteScreen; class QTestLiteWindowSurface : public QWindowSurface { public: QTestLiteWindowSurface - (QTestLiteGraphicsSystem *graphicsSystem, - QTestLiteGraphicsSystemScreen *screen, QWidget *window); + (QTestLiteIntegration *platformIntegration, + QTestLiteScreen *screen, QWidget *window); ~QTestLiteWindowSurface(); QPaintDevice *paintDevice(); @@ -85,8 +85,8 @@ public: void setCursor(QCursor * cursor); private: - QTestLiteGraphicsSystem *mGraphicsSystem; - QTestLiteGraphicsSystemScreen *mScreen; + QTestLiteIntegration *mPlatformIntegration; + QTestLiteScreen *mScreen; Qt::WindowFlags window_flags; MyWindow *xw; }; diff --git a/src/plugins/platforms/testlite/testlite.pro b/src/plugins/platforms/testlite/testlite.pro index d483f45..442dd68 100644 --- a/src/plugins/platforms/testlite/testlite.pro +++ b/src/plugins/platforms/testlite/testlite.pro @@ -1,10 +1,10 @@ TARGET = qtestlitegraphicssystem include(../../qpluginbase.pri) -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms -SOURCES = main.cpp qgraphicssystem_testlite.cpp qwindowsurface_testlite.cpp -HEADERS = qgraphicssystem_testlite.h qwindowsurface_testlite.h +SOURCES = main.cpp qplatformintegration_testlite.cpp qwindowsurface_testlite.cpp +HEADERS = qplatformintegration_testlite.h qwindowsurface_testlite.h HEADERS += x11util.h -- cgit v0.12 From fcec5d444f1e37e7b53ab503fa46b4d7f7d90b41 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 6 Apr 2010 14:45:51 +0200 Subject: Introduce QPlatformGLContext to enable QtOpenGL in Lighthouse This patch basically takes the stubbed-out code and makes it call into the new abstract base class. --- src/gui/kernel/qplatformintegration_lite.cpp | 12 ++++ src/gui/kernel/qplatformintegration_lite.h | 10 ++++ src/opengl/opengl.pro | 1 + src/opengl/qgl.cpp | 4 +- src/opengl/qgl_lite.cpp | 85 ++++++++++++++++++---------- src/opengl/qgl_p.h | 8 ++- src/opengl/qplatformglcontext_lite.h | 70 +++++++++++++++++++++++ 7 files changed, 158 insertions(+), 32 deletions(-) create mode 100644 src/opengl/qplatformglcontext_lite.h diff --git a/src/gui/kernel/qplatformintegration_lite.cpp b/src/gui/kernel/qplatformintegration_lite.cpp index f9adc14..71beded 100644 --- a/src/gui/kernel/qplatformintegration_lite.cpp +++ b/src/gui/kernel/qplatformintegration_lite.cpp @@ -56,4 +56,16 @@ QPixmap QPlatformIntegration::grabWindow(WId window, int x, int y, int width, in return QPixmap(); } +#ifndef QT_NO_OPENGL +bool QPlatformIntegration::hasOpenGL() const +{ + return false; +} + +QPlatformGLContext * QPlatformIntegration::createGLContext() +{ + return 0; +} +#endif + QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformintegration_lite.h b/src/gui/kernel/qplatformintegration_lite.h index 543b7bc..9125bd1 100644 --- a/src/gui/kernel/qplatformintegration_lite.h +++ b/src/gui/kernel/qplatformintegration_lite.h @@ -51,6 +51,10 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) +#ifndef QT_NO_OPENGL +class QPlatformGLContext; +#endif + class Q_GUI_EXPORT QPlatformIntegration { public: @@ -64,6 +68,12 @@ public: // Window System functions virtual QList screens() const = 0; virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const; + +// OpenGL Integration functions +#ifndef QT_NO_OPENGL + virtual bool hasOpenGL() const; + virtual QPlatformGLContext * createGLContext(); +#endif }; QT_END_NAMESPACE diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index 60d4b17..cebb677 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -78,6 +78,7 @@ SOURCES += qgl.cpp \ embedded_lite { SOURCES += qgl_lite.cpp + HEADERS += qplatformglcontext_lite.h # If we have EGL, use the EGL implementation of QGLPixelBuffer, otherwise we just provide # a stubbed out one. PBuffers aren't too interesting anyway. diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 7fcf390..1e522d6 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1582,7 +1582,9 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format) # endif vi = 0; #endif -#if defined(QT_OPENGL_ES) +#if defined(Q_WS_LITE) + platformContext = 0; +#elif defined(QT_OPENGL_ES) ownsEglContext = false; eglContext = 0; eglSurface = EGL_NO_SURFACE; diff --git a/src/opengl/qgl_lite.cpp b/src/opengl/qgl_lite.cpp index 40417b1..a1d9bb8 100644 --- a/src/opengl/qgl_lite.cpp +++ b/src/opengl/qgl_lite.cpp @@ -39,35 +39,33 @@ ** ****************************************************************************/ +#include +#include +#include + +#include + #include "qgl.h" #include "qgl_p.h" +#include "qplatformglcontext_lite.h" -#include "qmap.h" -#include "qapplication.h" -#include "qcolormap.h" -#include "qdesktopwidget.h" -#include "qpixmap.h" -#include "qhash.h" -#include "qlibrary.h" -#include "qdebug.h" -#include QT_BEGIN_NAMESPACE bool QGLFormat::hasOpenGL() { - return true; // IMPLEMENT ME PROPERLY! + return QApplicationPrivate::platformIntegration()->hasOpenGL(); } - - bool QGLContext::chooseContext(const QGLContext* shareContext) { - // IMPLEMENT ME + Q_D(QGLContext); + d->platformContext = QApplicationPrivate::platformIntegration()->createGLContext(); + d->platformContext->create(d->paintDevice, d->glFormat, shareContext ? shareContext->d_func()->platformContext : 0); + return false; } - void QGLContext::reset() { Q_D(QGLContext); @@ -76,7 +74,10 @@ void QGLContext::reset() d->cleanup(); doneCurrent(); - // IMPLEMENT ME + if (d->platformContext) { + delete d->platformContext; + d->platformContext = 0; + } d->crWin = false; d->sharing = false; @@ -86,46 +87,70 @@ void QGLContext::reset() QGLContextGroup::removeShare(this); } - void QGLContext::makeCurrent() { - // IMPLEMENT ME + Q_D(QGLContext); + d->platformContext->makeCurrent(); } void QGLContext::doneCurrent() { - // IMPLEMENT ME + Q_D(QGLContext); + d->platformContext->doneCurrent(); } - void QGLContext::swapBuffers() const { - // IMPLEMENT ME -} - -void *QGLContext::getProcAddress(const QString &proc) const -{ - // IMPLEMENT ME + Q_D(const QGLContext); + d->platformContext->swapBuffers(); } -void QGLWidgetPrivate::init(QGLContext *context, const QGLWidget *shareWidget) +void *QGLContext::getProcAddress(const QString &procName) const { - // IMPLEMENT ME + Q_D(const QGLContext); + return d->platformContext->getProcAddress(procName); } - void QGLWidget::setContext(QGLContext *context, const QGLContext* shareContext, bool deleteOldContext) { - // IMPLEMENT ME -} + Q_D(QGLWidget); + if (context == 0) { + qWarning("QGLWidget::setContext: Cannot set null context"); + return; + } + if (!context->deviceIsPixmap() && context->device() != this) { + qWarning("QGLWidget::setContext: Context must refer to this widget"); + return; + } + if (d->glcx) + d->glcx->doneCurrent(); + QGLContext* oldcx = d->glcx; + d->glcx = context; + // If the application has set WA_TranslucentBackground and not explicitly set + // the alpha buffer size to zero, modify the format so it have an alpha channel + QGLFormat& fmt = d->glcx->d_func()->glFormat; + if (testAttribute(Qt::WA_TranslucentBackground) && fmt.alphaBufferSize() == -1) + fmt.setAlphaBufferSize(1); + + bool success = false; + if (!d->glcx->isValid()) + success = !d->glcx->create(shareContext ? shareContext : oldcx); + + if (deleteOldContext) + delete oldcx; +} +void QGLWidgetPrivate::init(QGLContext *context, const QGLWidget *shareWidget) +{ + initContext(context, shareWidget); +} bool QGLFormat::hasOpenGLOverlays() { diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index a4d5cb7..f53b3e2 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -68,6 +68,10 @@ #include #endif +#if defined(Q_WS_LITE) +#include +#endif + QT_BEGIN_NAMESPACE class QGLContext; @@ -344,7 +348,9 @@ public: HBITMAP hbitmap; HDC hbitmap_hdc; #endif -#if defined(QT_OPENGL_ES) +#if defined(Q_WS_LITE) + QPlatformGLContext *platformContext; +#elif defined(QT_OPENGL_ES) bool ownsEglContext; QEglContext *eglContext; EGLSurface eglSurface; diff --git a/src/opengl/qplatformglcontext_lite.h b/src/opengl/qplatformglcontext_lite.h new file mode 100644 index 0000000..19a2074 --- /dev/null +++ b/src/opengl/qplatformglcontext_lite.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenGL module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORM_GL_CONTEXT_H +#define QPLATFORM_GL_CONTEXT_H + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QPlatformGLContext +{ +public: + QPlatformGLContext(); + virtual ~QPlatformGLContext(); + + virtual bool create(QPaintDevice* device, const QGLFormat& format, QPlatformGLContext* shareContext) = 0; + + virtual void makeCurrent() = 0; + virtual void doneCurrent() = 0; + virtual void swapBuffers() = 0; + virtual void* getProcAddress(const QString& procName) = 0; + +}; + + +QT_END_NAMESPACE + +QT_END_HEADER + + +#endif // QPLATFORM_GL_INTEGRATION_P_H -- cgit v0.12 From c13076a30e5ae3d0f6795261ad00ca1eb73ad0b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 7 Apr 2010 16:13:19 +0200 Subject: Added QPlatformWindow --- src/gui/kernel/kernel.pri | 4 +- src/gui/kernel/qplatformintegration_lite.h | 2 +- src/gui/kernel/qplatformwindow_lite.cpp | 72 +++++++++++++++++++ src/gui/kernel/qplatformwindow_lite.h | 79 +++++++++++++++++++++ src/gui/kernel/qwidget.cpp | 38 ++++++++++ src/gui/kernel/qwidget.h | 6 ++ src/gui/kernel/qwidget_lite.cpp | 82 +++++++++++----------- src/gui/kernel/qwidget_p.h | 5 ++ src/gui/painting/painting.pri | 2 +- src/gui/painting/qbackingstore.cpp | 16 ++++- src/gui/painting/qgraphicssystem_lite.cpp | 3 +- src/gui/painting/qwindowsurface.cpp | 53 +++++--------- src/gui/painting/qwindowsurface_p.h | 16 ++--- .../minimal/qplatformintegration_minimal.cpp | 7 +- .../minimal/qplatformintegration_minimal.h | 2 +- .../platforms/minimal/qwindowsurface_minimal.cpp | 8 +-- .../platforms/minimal/qwindowsurface_minimal.h | 4 +- src/plugins/plugins.pro | 2 +- 18 files changed, 298 insertions(+), 103 deletions(-) create mode 100644 src/gui/kernel/qplatformwindow_lite.cpp create mode 100644 src/gui/kernel/qplatformwindow_lite.h diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index cf5ec92..049637f 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -207,6 +207,7 @@ embedded_lite { kernel/qplatformscreen_lite.h \ kernel/qplatformintegrationfactory_lite_p.h \ kernel/qplatformintegrationplugin_lite.h \ + kernel/qplatformwindow_lite.h SOURCES += \ kernel/qapplication_lite.cpp \ @@ -224,7 +225,8 @@ embedded_lite { kernel/qplatformintegration_lite.cpp \ kernel/qplatformscreen_lite.cpp \ kernel/qplatformintegrationfactory_lite.cpp \ - kernel/qplatformintegrationplugin_lite.cpp + kernel/qplatformintegrationplugin_lite.cpp \ + kernel/qplatformwindow_lite.cpp contains(QT_CONFIG, glib) { SOURCES += \ diff --git a/src/gui/kernel/qplatformintegration_lite.h b/src/gui/kernel/qplatformintegration_lite.h index 9125bd1..389dcfb 100644 --- a/src/gui/kernel/qplatformintegration_lite.h +++ b/src/gui/kernel/qplatformintegration_lite.h @@ -62,7 +62,7 @@ public: // GraphicsSystem functions virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0; - virtual QWindowSurface *createWindowSurface(QWidget *widget) const = 0; + virtual void createWindowAndSurface(QPlatformWindow **window, QWindowSurface **surface, QWidget *widget, WId winId = 0) const = 0; virtual QBlittable *createBlittable(const QSize &size) const; // Window System functions diff --git a/src/gui/kernel/qplatformwindow_lite.cpp b/src/gui/kernel/qplatformwindow_lite.cpp new file mode 100644 index 0000000..ff1bf48 --- /dev/null +++ b/src/gui/kernel/qplatformwindow_lite.cpp @@ -0,0 +1,72 @@ +#include "qplatformwindow_lite.h" + +#include + +class QPlatformWindowPrivate +{ + QWidget *tlw; + QRect rect; + friend class QPlatformWindow; +}; + +QPlatformWindow::QPlatformWindow(QWidget *tlw) + : d_ptr(new QPlatformWindowPrivate) +{ + Q_D(QPlatformWindow); + d->tlw = tlw; + tlw->setPlatformWindow(this); +} + +QPlatformWindow::~QPlatformWindow() +{ +} + +QWidget *QPlatformWindow::widget() const +{ + Q_D(const QPlatformWindow); + return d->tlw; +} + +void QPlatformWindow::setGeometry(const QRect &rect) +{ + Q_D(QPlatformWindow); + d->rect = rect; +} + +QRect QPlatformWindow::geometry() const +{ + Q_D(const QPlatformWindow); + return d->rect; +} + +/*! +Reimplemented in subclasses to show the surface if \a visible is \c true, and hide it if \a visible is \c false. +*/ +void QPlatformWindow::setVisible(bool visible) +{ + Q_UNUSED(visible); +} +/*! +Requests setting the window flags of this surface to \a type. Returns the actual flags set. +*/ +Qt::WindowFlags QPlatformWindow::setWindowFlags(Qt::WindowFlags flags) +{ + Q_UNUSED(flags); + return Qt::Window; +} + +/*! + Returns the effective window flags for this surface. +*/ +Qt::WindowFlags QPlatformWindow::windowFlags() const +{ + return Qt::Window; +} + +WId QPlatformWindow::winId() const { return WId(0); } + +void QPlatformWindow::setWindowTitle(const QString &) {} + +void QPlatformWindow::raise() { qWarning("This plugin does not support raise()"); } + +void QPlatformWindow::lower() { qWarning("This plugin does not support lower()"); } diff --git a/src/gui/kernel/qplatformwindow_lite.h b/src/gui/kernel/qplatformwindow_lite.h new file mode 100644 index 0000000..3fa97b5 --- /dev/null +++ b/src/gui/kernel/qplatformwindow_lite.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QPLATFORMWINDOW_H +#define QPLATFORMWINDOW_H + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +#include + +class QPlatformWindowPrivate; + +class Q_GUI_EXPORT QPlatformWindow +{ + Q_DECLARE_PRIVATE(QPlatformWindow); +public: + QPlatformWindow(QWidget *tlw); + virtual ~QPlatformWindow(); + + QWidget *widget() const; + virtual void setGeometry(const QRect &rect); + virtual QRect geometry() const; + + virtual void setVisible(bool visible); + virtual Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); + virtual Qt::WindowFlags windowFlags() const; + virtual WId winId() const; + + virtual void setWindowTitle(const QString &); + virtual void raise(); + virtual void lower(); + +protected: + QScopedPointer d_ptr; +}; + +QT_END_NAMESPACE + +QT_END_HEADER +#endif //QPLATFORMWINDOW_H diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 3ca7591..4bcec93 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -11836,6 +11836,44 @@ QWindowSurface *QWidget::windowSurface() const return bs ? bs->windowSurface : 0; } +/*! + \preliminary + + Sets the window to be the \a window specified. + The QWidget takes ownership of the \a surface. +*/ +void QWidget::setPlatformWindow(QPlatformWindow *window) +{ +#ifndef Q_BACKINGSTORE_SUBSURFACES + if (!isTopLevel()) + return; +#endif + + Q_D(QWidget); + + QTLWExtra *topData = d->topData(); + if (topData->platformWindow == window) + return; + + delete topData->platformWindow; + topData->platformWindow = window; +} + +/*! + \preliminary + + Returns the QPlatformWindow this widget will be drawn into. +*/ +QPlatformWindow *QWidget::platformWindow() const +{ + Q_D(const QWidget); + QTLWExtra *extra = d->maybeTopData(); + if (extra && extra->platformWindow) + return extra->platformWindow; + + return 0; +} + void QWidgetPrivate::getLayoutItemMargins(int *left, int *top, int *right, int *bottom) const { if (left) diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index e12148b..7dff703 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -94,6 +94,7 @@ class QHideEvent; class QInputContext; class QIcon; class QWindowSurface; +class QPlatformWindow; class QLocale; class QGraphicsProxyWidget; class QGraphicsEffect; @@ -625,6 +626,11 @@ public: void setWindowSurface(QWindowSurface *surface); QWindowSurface *windowSurface() const; +#if defined(Q_WS_LITE) + void setPlatformWindow(QPlatformWindow *window); + QPlatformWindow *platformWindow() const; +#endif + Q_SIGNALS: void customContextMenuRequested(const QPoint &pos); diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index add5592..7915d7f 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -39,26 +39,28 @@ ** ****************************************************************************/ -#include "qwidget.h" -#include "qevent.h" -#include "qapplication.h" -#include "private/qbackingstore_p.h" -#include "private/qwidget_p.h" -#include "private/qgraphicssystem_p.h" -#include "private/qapplication_p.h" -#include "qdesktopwidget.h" - -#include +#include "QtGui/qwidget.h" +#include "QtGui/qevent.h" +#include "QtGui/qapplication.h" +#include "QtGui/private/qbackingstore_p.h" +#include "QtGui/private/qwidget_p.h" +#include "QtGui/private/qgraphicssystem_p.h" +#include "QtGui/private/qapplication_p.h" +#include "QtGui/qdesktopwidget.h" +#include "QtGui/qplatformwindow_lite.h" + +#include QT_BEGIN_NAMESPACE static QPlatformScreen *qt_screenForWidget(const QWidget *w); -void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool /*destroyOldWindow*/) +void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyOldWindow) { Q_Q(QWidget); Q_UNUSED(window); Q_UNUSED(initializeWindow); + Q_UNUSED(destroyOldWindow); // XXX Qt::WindowFlags flags = data.window_flags; @@ -67,15 +69,16 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool /*destro return; // we only care about real toplevels QWindowSurface *surface = q->windowSurface(); + QPlatformWindow *platformWindow = q->platformWindow(); - if (!surface) - surface = createDefaultWindowSurface(); - + if (!surface) { + QApplicationPrivate::platformIntegration()->createWindowAndSurface(&platformWindow,&surface,q); + } Q_ASSERT(surface); - data.window_flags = surface->setWindowFlags(data.window_flags); + data.window_flags = q->platformWindow()->setWindowFlags(data.window_flags); - setWinId(surface->winId()); + setWinId(q->platformWindow()->winId()); // qDebug() << "create_sys" << q << q->internalWinId(); } @@ -119,8 +122,8 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) if (f & Qt::Window) { //qDebug() << "setParent_sys" << q << newparent << hex << f; - if (QWindowSurface *surface = q->windowSurface()) - data.window_flags = surface->setWindowFlags(data.window_flags); + if (QPlatformWindow *window = q->platformWindow()) + data.window_flags = window->setWindowFlags(data.window_flags); } // XXX Reparenting child to toplevel or vice versa ### if ((f&Qt::Window) && !(oldFlags&Qt::Window)) { @@ -191,8 +194,8 @@ void QWidgetPrivate::setWindowTitle_sys(const QString &caption) if (!q->isWindow()) return; - if (QWindowSurface *surface = q->windowSurface()) - surface->setWindowTitle(caption); + if (QPlatformWindow *window = q->platformWindow()) + window->setWindowTitle(caption); } @@ -299,9 +302,14 @@ void QWidgetPrivate::show_sys() if (QWindowSurface *surface = q->windowSurface()) { const QRect geomRect = q->geometry(); - if (surface->geometry() != geomRect) - surface->setGeometry(geomRect); - surface->setVisible(true); + const QRect windowRect = q->platformWindow()->geometry(); + if (windowRect != geomRect) { + q->platformWindow()->setGeometry(geomRect); + if (windowRect.size() != geomRect.size()) { + surface->resize(geomRect.size()); + } + } + q->platformWindow()->setVisible(true); } if (q->windowType() != Qt::Popup && q->windowType() != Qt::ToolTip && !(q->windowFlags() & Qt::X11BypassWindowManagerHint)) @@ -320,8 +328,8 @@ void QWidgetPrivate::hide_sys() } return; } - if (QWindowSurface *surface = q->windowSurface()) { - surface->setVisible(false); + if (QPlatformWindow *window = q->platformWindow()) { + window->setVisible(false); } //### we don't yet have proper focus event handling @@ -427,8 +435,7 @@ void QWidgetPrivate::raise_sys() { Q_Q(QWidget); if (q->isWindow()) { - QWindowSurface *surface = q->windowSurface(); - surface->raise(); + q->platformWindow()->raise(); } } @@ -437,8 +444,7 @@ void QWidgetPrivate::lower_sys() Q_Q(QWidget); if (q->isWindow()) { Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); - QWindowSurface *surface = q->windowSurface(); - surface->lower(); + q->platformWindow()->lower(); } else if (QWidget *p = q->parentWidget()) { setDirtyOpaqueRegion(); p->d_func()->invalidateBuffer(effectiveRectFor(q->geometry())); @@ -491,8 +497,11 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) if (q->isWindow()) { const QWidgetBackingStore *bs = maybeBackingStore(); - if (bs->windowSurface) - bs->windowSurface->setGeometry(q->frameGeometry()); + if (bs->windowSurface) { + q->platformWindow()->setGeometry(q->frameGeometry()); + if (isResize) + bs->windowSurface->resize(r.size()); + } } else { if (isMove && !isResize) moveRect(QRect(oldPos, olds), x - oldPos.x(), y - oldPos.y()); @@ -653,16 +662,7 @@ QPaintEngine *QWidget::paintEngine() const QWindowSurface *QWidgetPrivate::createDefaultWindowSurface_sys() { - Q_Q(QWidget); - if (q->windowType() == Qt::Desktop) - return 0; - q->ensurePolished(); - - QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); - if (!gs) - return 0; - - return gs->createWindowSurface(q); + qFatal("CreateDefaultWindowSurface_sys should not be used on lighthouse"); } void QWidgetPrivate::setModal_sys() diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 0f34ae0..4ca493e 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -102,6 +102,9 @@ class QWSManager; #if defined(Q_WS_MAC) class QCoreGraphicsPaintEnginePrivate; #endif +#if defined(Q_WS_LITE) +class QPlatformWindow; +#endif class QPaintEngine; class QPixmap; class QWidgetBackingStore; @@ -176,6 +179,8 @@ struct QTLWExtra { #endif #elif defined(Q_OS_SYMBIAN) uint inExpose : 1; // Prevents drawing recursion +#elif defined(Q_WS_LITE) + QPlatformWindow *platformWindow; #endif }; diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index c4e8f7a..972bac2 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -117,7 +117,7 @@ embedded { SOURCES += \ painting/qgraphicssystem_qws.cpp \ -} else { +} else: if(!embedded_lite) { HEADERS += \ painting/qgraphicssystem_raster_p.h \ painting/qgraphicssystemfactory_p.h \ diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index f2cd7e6..30c042e 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -286,7 +286,11 @@ bool QWidgetBackingStore::bltRect(const QRect &rect, int dx, int dy, QWidget *wi void QWidgetBackingStore::releaseBuffer() { if (windowSurface) +#if defined(Q_WS_LITE) + windowSurface->resize(QSize()); +#else windowSurface->setGeometry(QRect()); +#endif #ifdef Q_BACKINGSTORE_SUBSURFACES for (int i = 0; i < subSurfaces.size(); ++i) subSurfaces.at(i)->setGeometry(QRect()); @@ -415,6 +419,7 @@ void QWidgetBackingStore::endPaint(const QRegion &cleaned, QWindowSurface *windo QRegion QWidgetBackingStore::dirtyRegion(QWidget *widget) const { const bool widgetDirty = widget && widget != tlw; +#if !defined(Q_WS_LITE) const QRect tlwRect(topLevelRect()); const QRect surfaceGeometry(windowSurface->geometry()); if (surfaceGeometry != tlwRect && surfaceGeometry.size() != tlwRect.size()) { @@ -426,6 +431,7 @@ QRegion QWidgetBackingStore::dirtyRegion(QWidget *widget) const } return QRect(QPoint(), tlwRect.size()); } +#endif // Calculate the region that needs repaint. QRegion r(dirty); @@ -467,7 +473,11 @@ QRegion QWidgetBackingStore::dirtyRegion(QWidget *widget) const QRegion QWidgetBackingStore::staticContents(QWidget *parent, const QRect &withinClipRect) const { if (!parent && tlw->testAttribute(Qt::WA_StaticContents)) { +#if defined(Q_WS_LITE) + const QSize surfaceGeometry(windowSurface->size()); +#else const QRect surfaceGeometry(windowSurface->geometry()); +#endif QRect surfaceRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height()); if (!withinClipRect.isEmpty()) surfaceRect &= withinClipRect; @@ -1144,11 +1154,12 @@ void QWidgetBackingStore::sync() return; } - const bool inTopLevelResize = tlwExtra->inTopLevelResize; const bool updatesDisabled = !tlw->updatesEnabled(); + bool repaintAllWidgets = false; +#if !defined(Q_WS_LITE) + const bool inTopLevelResize = tlwExtra->inTopLevelResize; const QRect tlwRect(topLevelRect()); const QRect surfaceGeometry(windowSurface->geometry()); - bool repaintAllWidgets = false; if (inTopLevelResize || surfaceGeometry != tlwRect) { if ((inTopLevelResize || surfaceGeometry.size() != tlwRect.size()) && !updatesDisabled) { @@ -1171,6 +1182,7 @@ void QWidgetBackingStore::sync() } windowSurface->setGeometry(tlwRect); } +#endif if (updatesDisabled) return; diff --git a/src/gui/painting/qgraphicssystem_lite.cpp b/src/gui/painting/qgraphicssystem_lite.cpp index 42e7238..a62abbb 100644 --- a/src/gui/painting/qgraphicssystem_lite.cpp +++ b/src/gui/painting/qgraphicssystem_lite.cpp @@ -51,7 +51,8 @@ QPixmapData *QLiteGraphicsSystem::createPixmapData(QPixmapData::PixelType type) QWindowSurface *QLiteGraphicsSystem::createWindowSurface(QWidget *widget) const { - return QApplicationPrivate::platformIntegration()->createWindowSurface(widget); + qFatal("should not use QLiteGraphicsSystem::createWindowSurface"); + return 0; } QBlittable *QLiteGraphicsSystem::createBlittable(const QSize &size) const diff --git a/src/gui/painting/qwindowsurface.cpp b/src/gui/painting/qwindowsurface.cpp index 34c2936..20594c4 100644 --- a/src/gui/painting/qwindowsurface.cpp +++ b/src/gui/painting/qwindowsurface.cpp @@ -52,7 +52,11 @@ public: QWindowSurfacePrivate(QWidget *w) : window(w), staticContentsSupport(false) {} QWidget *window; +#if !defined(Q_WS_LITE) QRect geometry; +#else + QSize size; +#endif //Q_WS_LITE QRegion staticContents; QList bufferImages; bool staticContentsSupport; @@ -144,6 +148,7 @@ void QWindowSurface::endPaint(const QRegion &) d_ptr->bufferImages.clear(); } +#if !defined(Q_WS_LITE) /*! Sets the currently allocated area to be the given \a rect. @@ -164,6 +169,17 @@ QRect QWindowSurface::geometry() const { return d_ptr->geometry; } +#else +void QWindowSurface::resize(const QSize &size) +{ + d_ptr->size = size; +} + +QSize QWindowSurface::size() const +{ + return d_ptr->size; +} +#endif //Q_WS_LITE /*! Scrolls the given \a area \a dx pixels to the right and \a dy @@ -349,41 +365,4 @@ void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset) } } - -#ifdef Q_WS_LITE -/*! -Requests setting the window flags of this surface to \a type. Returns the actual flags set. -*/ -Qt::WindowFlags QWindowSurface::setWindowFlags(Qt::WindowFlags type) -{ - Q_UNUSED(type); - qDebug() << "QWindowSurface::setWindowFlags" << hex << type; - return Qt::Window; -} - -/*! - Returns the effective window flags for this surface. -*/ -Qt::WindowFlags QWindowSurface::windowFlags() const -{ - return Qt::Window; -} - -/*! -Reimplemented in subclasses to show the surface if \a visible is \c true, and hide it if \a visible is \c false. -*/ - -void QWindowSurface::setVisible(bool visible) -{ - Q_UNUSED(visible); -} - - -WId QWindowSurface::winId() const -{ - return WId(0); -} - -#endif - QT_END_NAMESPACE diff --git a/src/gui/painting/qwindowsurface_p.h b/src/gui/painting/qwindowsurface_p.h index 5930704..3a14b0f 100644 --- a/src/gui/painting/qwindowsurface_p.h +++ b/src/gui/painting/qwindowsurface_p.h @@ -63,6 +63,7 @@ class QRect; class QPoint; class QImage; class QWindowSurfacePrivate; +class QPlatformWindow; class Q_GUI_EXPORT QWindowSurface { @@ -75,8 +76,13 @@ public: virtual QPaintDevice *paintDevice() = 0; virtual void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) = 0; +#if !defined(Q_WS_LITE) virtual void setGeometry(const QRect &rect); QRect geometry() const; +#else + virtual void resize(const QSize &size); + QSize size() const; +#endif virtual bool scroll(const QRegion &area, int dx, int dy); @@ -89,16 +95,6 @@ public: virtual QPoint offset(const QWidget *widget) const; inline QRect rect(const QWidget *widget) const; -#ifdef Q_WS_LITE - virtual void setVisible(bool visible); - virtual Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); - virtual Qt::WindowFlags windowFlags() const; - virtual WId winId() const; - - virtual void setWindowTitle(const QString &) {} - virtual void raise() { qWarning("This plugin does not support raise()"); } - virtual void lower() { qWarning("This plugin does not support lower()"); } -#endif bool hasStaticContentsSupport() const; void setStaticContents(const QRegion ®ion); diff --git a/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp b/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp index 693e0c3..2f03127 100644 --- a/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp +++ b/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp @@ -2,6 +2,7 @@ #include "qwindowsurface_minimal.h" #include +#include QMinimalIntegration::QMinimalIntegration() { @@ -19,7 +20,9 @@ QPixmapData *QMinimalIntegration::createPixmapData(QPixmapData::PixelType type) { return new QRasterPixmapData(type); } -QWindowSurface *QMinimalIntegration::createWindowSurface(QWidget *widget) const +void QMinimalIntegration::createWindowAndSurface(QPlatformWindow**window, QWindowSurface**surface, QWidget *widget, WId winId) const { - return new QMinimalWindowSurface(widget); + qDebug() << "createWindow"; + *surface = new QMinimalWindowSurface(widget); + *window = new QPlatformWindow(widget); } diff --git a/src/plugins/platforms/minimal/qplatformintegration_minimal.h b/src/plugins/platforms/minimal/qplatformintegration_minimal.h index d4eb78b..127c573 100644 --- a/src/plugins/platforms/minimal/qplatformintegration_minimal.h +++ b/src/plugins/platforms/minimal/qplatformintegration_minimal.h @@ -72,7 +72,7 @@ public: QMinimalIntegration(); QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; + void createWindowAndSurface(QPlatformWindow**window, QWindowSurface**surface, QWidget *widget, WId winId) const; QList screens() const { return mScreens; } diff --git a/src/plugins/platforms/minimal/qwindowsurface_minimal.cpp b/src/plugins/platforms/minimal/qwindowsurface_minimal.cpp index 0b2bdd2..2f8b1f0 100644 --- a/src/plugins/platforms/minimal/qwindowsurface_minimal.cpp +++ b/src/plugins/platforms/minimal/qwindowsurface_minimal.cpp @@ -73,13 +73,13 @@ void QMinimalWindowSurface::flush(QWidget *widget, const QRegion ®ion, const mImage.save(filename); } -void QMinimalWindowSurface::setGeometry(const QRect &rect) +void QMinimalWindowSurface::resize(const QSize &size) { //qDebug() << "QMinimalWindowSurface::setGeometry:" << (long)this << rect; - QWindowSurface::setGeometry(rect); + QWindowSurface::resize(size); QImage::Format format = QApplicationPrivate::platformIntegration()->screens().first()->format(); - if (mImage.size() != rect.size()) - mImage = QImage(rect.size(), format); + if (mImage.size() != size) + mImage = QImage(size, format); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/minimal/qwindowsurface_minimal.h b/src/plugins/platforms/minimal/qwindowsurface_minimal.h index 959a731..96f989d 100644 --- a/src/plugins/platforms/minimal/qwindowsurface_minimal.h +++ b/src/plugins/platforms/minimal/qwindowsurface_minimal.h @@ -44,6 +44,8 @@ #include +#include + QT_BEGIN_NAMESPACE class QMinimalWindowSurface : public QWindowSurface @@ -54,7 +56,7 @@ public: QPaintDevice *paintDevice(); void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void setGeometry(const QRect &rect); + void resize(const QSize &size); private: QImage mImage; diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 730fdc5..73ab3e9 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -6,7 +6,7 @@ unix:!symbian { } else { SUBDIRS *= codecs } -!embedded:SUBDIRS *= graphicssystems +!embedded:!embedded-lite:SUBDIRS *= graphicssystems embedded:SUBDIRS *= gfxdrivers decorations mousedrivers kbddrivers !win32:!embedded:!mac:!symbian:SUBDIRS *= inputmethods symbian:SUBDIRS += s60 -- cgit v0.12 From a914500cbccc4569d7f681eaa0f9453413fc988c Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Thu, 8 Apr 2010 08:35:49 +0200 Subject: Fixup QPlatformGLContext --- src/opengl/qgl_lite.cpp | 15 +++++++++++++-- src/opengl/qplatformglcontext_lite.h | 4 +++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/opengl/qgl_lite.cpp b/src/opengl/qgl_lite.cpp index a1d9bb8..db1077d 100644 --- a/src/opengl/qgl_lite.cpp +++ b/src/opengl/qgl_lite.cpp @@ -52,6 +52,15 @@ QT_BEGIN_NAMESPACE +QPlatformGLContext::QPlatformGLContext() +{ +} + +QPlatformGLContext::~QPlatformGLContext() +{ +} + + bool QGLFormat::hasOpenGL() { return QApplicationPrivate::platformIntegration()->hasOpenGL(); @@ -61,9 +70,9 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) { Q_D(QGLContext); d->platformContext = QApplicationPrivate::platformIntegration()->createGLContext(); - d->platformContext->create(d->paintDevice, d->glFormat, shareContext ? shareContext->d_func()->platformContext : 0); + d->valid = d->platformContext->create(d->paintDevice, d->glFormat, shareContext ? shareContext->d_func()->platformContext : 0); - return false; + return d->valid; } void QGLContext::reset() @@ -91,12 +100,14 @@ void QGLContext::makeCurrent() { Q_D(QGLContext); d->platformContext->makeCurrent(); + QGLContextPrivate::setCurrentContext(this); } void QGLContext::doneCurrent() { Q_D(QGLContext); d->platformContext->doneCurrent(); + QGLContextPrivate::setCurrentContext(0); } void QGLContext::swapBuffers() const diff --git a/src/opengl/qplatformglcontext_lite.h b/src/opengl/qplatformglcontext_lite.h index 19a2074..10c05f6 100644 --- a/src/opengl/qplatformglcontext_lite.h +++ b/src/opengl/qplatformglcontext_lite.h @@ -42,11 +42,13 @@ #ifndef QPLATFORM_GL_CONTEXT_H #define QPLATFORM_GL_CONTEXT_H +#include + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QPlatformGLContext +class Q_OPENGL_EXPORT QPlatformGLContext { public: QPlatformGLContext(); -- cgit v0.12 From 0e342cd341f8d71b41de89340cbbf455694becc9 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Thu, 8 Apr 2010 08:36:49 +0200 Subject: Implement OpenGL support for testlite plugin using GLX Note: Doesn't actually work yet. ;-) --- src/plugins/platforms/testlite/qglxglcontext.cpp | 148 +++++++++++++++++++++ src/plugins/platforms/testlite/qglxglcontext.h | 73 ++++++++++ .../testlite/qplatformintegration_testlite.cpp | 18 ++- .../testlite/qplatformintegration_testlite.h | 5 + src/plugins/platforms/testlite/testlite.pro | 5 + 5 files changed, 248 insertions(+), 1 deletion(-) create mode 100644 src/plugins/platforms/testlite/qglxglcontext.cpp create mode 100644 src/plugins/platforms/testlite/qglxglcontext.h diff --git a/src/plugins/platforms/testlite/qglxglcontext.cpp b/src/plugins/platforms/testlite/qglxglcontext.cpp new file mode 100644 index 0000000..0739567 --- /dev/null +++ b/src/plugins/platforms/testlite/qglxglcontext.cpp @@ -0,0 +1,148 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "x11util.h" +#include "qglxglcontext.h" +#include + +#include + +#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) +#include +#endif + + +QT_BEGIN_NAMESPACE + +QGLXGLContext::QGLXGLContext(Display *xdpy) + : QPlatformGLContext() + , m_display(xdpy) + , m_context(0) + , m_widget(0) +{ +} + +QGLXGLContext::~QGLXGLContext() +{ + if (m_context) + glXDestroyContext(m_display, m_context); +} + +bool QGLXGLContext::create(QPaintDevice* device, const QGLFormat& format, QPlatformGLContext* shareContext) +{ + if (device->devType() != QInternal::Widget) { + qWarning("Creating a GL context is only supported on QWidgets"); + return false; + } + + m_widget = static_cast(device); + if (!m_widget->isTopLevel()) { + qWarning("Creating a GL context is only supported on top-level QWidgets"); + return false; + } + + // Get the XVisualInfo for the window: +// XWindowAttributes windowAttribs; +// XGetWindowAttributes(m_display, m_widget->winId(), &windowAttribs); + XVisualInfo visualInfoTemplate; + visualInfoTemplate.visualid = 33; //XVisualIDFromVisual(windowAttribs.visual); + XVisualInfo *visualInfo; + int matchingCount = 0; + visualInfo = XGetVisualInfo(m_display, VisualIDMask, &visualInfoTemplate, &matchingCount); + + qDebug("Creating a GLX context for visual ID %d", visualInfoTemplate.visualid); + + m_context = glXCreateContext(m_display, visualInfo, 0, True); + + return true; +} + +void QGLXGLContext::makeCurrent() +{ + Window win = m_widget->winId(); + qDebug("QGLXGLContext::makeCurrent(window=0x%x, ctx=0x%x)", win, m_context); + + glXMakeCurrent(m_display, win, m_context); +} + +void QGLXGLContext::doneCurrent() +{ + glXMakeCurrent(m_display, 0, 0); +} + +void QGLXGLContext::swapBuffers() +{ + glXSwapBuffers(m_display, m_widget->winId()); +} + +void* QGLXGLContext::getProcAddress(const QString& procName) +{ + typedef void *(*qt_glXGetProcAddressARB)(const GLubyte *); + static qt_glXGetProcAddressARB glXGetProcAddressARB = 0; + static bool resolved = false; + + if (resolved && !glXGetProcAddressARB) + return 0; + if (!glXGetProcAddressARB) { + QList glxExt = QByteArray(glXGetClientString(m_display, GLX_EXTENSIONS)).split(' '); + if (glxExt.contains("GLX_ARB_get_proc_address")) { +#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) + void *handle = dlopen(NULL, RTLD_LAZY); + if (handle) { + glXGetProcAddressARB = (qt_glXGetProcAddressARB) dlsym(handle, "glXGetProcAddressARB"); + dlclose(handle); + } + if (!glXGetProcAddressARB) +#endif + { + extern const QString qt_gl_library_name(); + QLibrary lib(qt_gl_library_name()); + glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB"); + } + } + resolved = true; + } + if (!glXGetProcAddressARB) + return 0; + return glXGetProcAddressARB(reinterpret_cast(procName.toLatin1().data())); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qglxglcontext.h b/src/plugins/platforms/testlite/qglxglcontext.h new file mode 100644 index 0000000..54e5c2f --- /dev/null +++ b/src/plugins/platforms/testlite/qglxglcontext.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q_GLX_CONTEXT_H +#define Q_GLX_CONTEXT_H + +#include +#include "x11util.h" +#include + +QT_BEGIN_NAMESPACE + +class QGLXGLContext : public QPlatformGLContext +{ +public: + QGLXGLContext(Display* xdpy); + ~QGLXGLContext(); + + bool create(QPaintDevice* device, const QGLFormat& format, QPlatformGLContext* shareContext); + + void makeCurrent(); + void doneCurrent(); + void swapBuffers(); + void* getProcAddress(const QString& procName); + +private: + Display *m_display; + GLXContext m_context; + QWidget *m_widget; +}; + + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp b/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp index 6811e2e..6776e0c 100644 --- a/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp +++ b/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp @@ -46,9 +46,13 @@ #include - #include "x11util.h" +#ifndef QT_NO_OPENGL +#include +#include "qglxglcontext.h" +#endif + QT_BEGIN_NAMESPACE class MyCursor : QGraphicsSystemCursor @@ -116,6 +120,18 @@ QPixmap QTestLiteIntegration::grabWindow(WId window, int x, int y, int width, in return QPixmap::fromImage(img); } +#ifndef QT_NO_OPENGL +bool QTestLiteIntegration::hasOpenGL() const +{ + return glXQueryExtension(xd->display, 0, 0) != 0; +} + +QPlatformGLContext * QTestLiteIntegration::createGLContext() +{ + return new QGLXGLContext(xd->display); +} + +#endif // QT_NO_OPENGL QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qplatformintegration_testlite.h b/src/plugins/platforms/testlite/qplatformintegration_testlite.h index c540c48..8dbbc50 100644 --- a/src/plugins/platforms/testlite/qplatformintegration_testlite.h +++ b/src/plugins/platforms/testlite/qplatformintegration_testlite.h @@ -80,6 +80,11 @@ public: QList screens() const { return mScreens; } +#ifndef QT_NO_OPENGL + bool hasOpenGL() const; + QPlatformGLContext * createGLContext(); +#endif + MyDisplay *xd; private: diff --git a/src/plugins/platforms/testlite/testlite.pro b/src/plugins/platforms/testlite/testlite.pro index 442dd68..5f7eb2a 100644 --- a/src/plugins/platforms/testlite/testlite.pro +++ b/src/plugins/platforms/testlite/testlite.pro @@ -12,6 +12,11 @@ SOURCES += x11util.cpp LIBS += -lX11 -lXext +contains(QT_CONFIG, opengl) { + QT += opengl + HEADERS += qglxglcontext.h + SOURCES += qglxglcontext.cpp +} target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems INSTALLS += target -- cgit v0.12 From d6cf18d036df1ecead4c8471944880c7f9a414f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 8 Apr 2010 09:58:08 +0200 Subject: QPlatformWindow refactoring and ported the directfb plugin to use QPlatformWindow --- src/gui/kernel/qplatformintegration_lite.h | 3 +- src/gui/kernel/qplatformwindow_lite.cpp | 6 + src/gui/kernel/qplatformwindow_lite.h | 12 +- src/gui/kernel/qwidget.cpp | 6 + src/gui/kernel/qwidget_lite.cpp | 15 +- src/plugins/platforms/directfb/qdirectfbinput.cpp | 13 +- src/plugins/platforms/directfb/qdirectfbinput.h | 4 +- src/plugins/platforms/directfb/qdirectfbwindow.cpp | 157 +++++++++++++++++++++ src/plugins/platforms/directfb/qdirectfbwindow.h | 73 ++++++++++ .../directfb/qplatformintegration_directfb.cpp | 11 +- .../directfb/qplatformintegration_directfb.h | 3 +- .../platforms/directfb/qwindowsurface_directfb.cpp | 114 ++------------- .../platforms/directfb/qwindowsurface_directfb.h | 15 +- src/plugins/platforms/minimal/minimal.pro | 2 +- .../minimal/qplatformintegration_minimal.cpp | 14 +- .../minimal/qplatformintegration_minimal.h | 3 +- 16 files changed, 309 insertions(+), 142 deletions(-) create mode 100644 src/plugins/platforms/directfb/qdirectfbwindow.cpp create mode 100644 src/plugins/platforms/directfb/qdirectfbwindow.h diff --git a/src/gui/kernel/qplatformintegration_lite.h b/src/gui/kernel/qplatformintegration_lite.h index 389dcfb..b13260e 100644 --- a/src/gui/kernel/qplatformintegration_lite.h +++ b/src/gui/kernel/qplatformintegration_lite.h @@ -62,7 +62,8 @@ public: // GraphicsSystem functions virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0; - virtual void createWindowAndSurface(QPlatformWindow **window, QWindowSurface **surface, QWidget *widget, WId winId = 0) const = 0; + virtual QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const = 0; + virtual QWindowSurface *createWindowSurfaceForWindow(QWidget *widget, WId winId) const = 0; virtual QBlittable *createBlittable(const QSize &size) const; // Window System functions diff --git a/src/gui/kernel/qplatformwindow_lite.cpp b/src/gui/kernel/qplatformwindow_lite.cpp index ff1bf48..c8a3ed5 100644 --- a/src/gui/kernel/qplatformwindow_lite.cpp +++ b/src/gui/kernel/qplatformwindow_lite.cpp @@ -70,3 +70,9 @@ void QPlatformWindow::setWindowTitle(const QString &) {} void QPlatformWindow::raise() { qWarning("This plugin does not support raise()"); } void QPlatformWindow::lower() { qWarning("This plugin does not support lower()"); } + +void QPlatformWindow::setOpacity(qreal level) +{ + Q_UNUSED(level); + qWarning("This plugin does not support setting window opacity"); +} diff --git a/src/gui/kernel/qplatformwindow_lite.h b/src/gui/kernel/qplatformwindow_lite.h index 3fa97b5..8771cfe 100644 --- a/src/gui/kernel/qplatformwindow_lite.h +++ b/src/gui/kernel/qplatformwindow_lite.h @@ -41,13 +41,18 @@ #ifndef QPLATFORMWINDOW_H #define QPLATFORMWINDOW_H -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE #include +#include +#include +#include class QPlatformWindowPrivate; +class QWidget; + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE class Q_GUI_EXPORT QPlatformWindow { @@ -69,6 +74,7 @@ public: virtual void raise(); virtual void lower(); + virtual void setOpacity(qreal level); protected: QScopedPointer d_ptr; }; diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 4bcec93..7eaf03c 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -74,6 +74,9 @@ # include "qpaintengine.h" // for PorterDuff # include "private/qwindowsurface_qws_p.h" #endif +#if defined(Q_WS_LITE) +#include "qplatformwindow_lite.h" +#endif #include "qpainter.h" #include "qtooltip.h" #include "qwhatsthis.h" @@ -1574,6 +1577,9 @@ void QWidgetPrivate::createTLExtra() static int count = 0; qDebug() << "tlextra" << ++count; #endif +#if defined(Q_WS_LITE) + x->platformWindow = 0; +#endif } } diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index 7915d7f..cf93c5e 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -71,8 +71,13 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO QWindowSurface *surface = q->windowSurface(); QPlatformWindow *platformWindow = q->platformWindow(); + if (!platformWindow) { + platformWindow = QApplicationPrivate::platformIntegration()->createPlatformWindow(q); + } + Q_ASSERT(platformWindow); + if (!surface) { - QApplicationPrivate::platformIntegration()->createWindowAndSurface(&platformWindow,&surface,q); + surface = QApplicationPrivate::platformIntegration()->createWindowSurfaceForWindow(q,platformWindow->winId()); } Q_ASSERT(surface); @@ -102,8 +107,7 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) { Q_Q(QWidget); - - QWidget *oldParent = q->parentWidget(); +// QWidget *oldParent = q->parentWidget(); Qt::WindowFlags oldFlags = data.window_flags; if (parent != newparent) { QObjectPrivate::setParent_helper(newparent); //### why does this have to be done in the _sys function??? @@ -643,8 +647,8 @@ void QWidgetPrivate::updateFrameStrut() void QWidgetPrivate::setWindowOpacity_sys(qreal level) { - Q_UNUSED(level); - // XXX + Q_Q(QWidget); + q->platformWindow()->setOpacity(level); } void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect) @@ -663,6 +667,7 @@ QPaintEngine *QWidget::paintEngine() const QWindowSurface *QWidgetPrivate::createDefaultWindowSurface_sys() { qFatal("CreateDefaultWindowSurface_sys should not be used on lighthouse"); + return 0; } void QWidgetPrivate::setModal_sys() diff --git a/src/plugins/platforms/directfb/qdirectfbinput.cpp b/src/plugins/platforms/directfb/qdirectfbinput.cpp index 74a38a4..90c3348 100644 --- a/src/plugins/platforms/directfb/qdirectfbinput.cpp +++ b/src/plugins/platforms/directfb/qdirectfbinput.cpp @@ -78,16 +78,13 @@ void QDirectFbInput::addWindow(DFBWindowID id, QWidget *tlw) window->AttachEventBuffer(window,eventBuffer); } -void QDirectFbInput::removeWindow(QWidget *tlw) +void QDirectFbInput::removeWindow(WId wId) { - DFBWindowID id = tlwMap.key(tlw,0); - if (id) { - IDirectFBWindow *window; - dfbDisplayLayer->GetWindow(dfbDisplayLayer,id, &window); + IDirectFBWindow *window; + dfbDisplayLayer->GetWindow(dfbDisplayLayer,wId, &window); - window->DetachEventBuffer(window,eventBuffer); - tlwMap.remove(id); - } + window->DetachEventBuffer(window,eventBuffer); + tlwMap.remove(wId); } void QDirectFbInput::handleEvents() diff --git a/src/plugins/platforms/directfb/qdirectfbinput.h b/src/plugins/platforms/directfb/qdirectfbinput.h index 31aa082..016e7f1 100644 --- a/src/plugins/platforms/directfb/qdirectfbinput.h +++ b/src/plugins/platforms/directfb/qdirectfbinput.h @@ -9,6 +9,8 @@ #include #include +#include + #include class InputSocketWaiter : public QThread @@ -35,7 +37,7 @@ class QDirectFbInput : public QObject public: static QDirectFbInput *instance(); void addWindow(DFBWindowID id, QWidget *tlw); - void removeWindow(QWidget *tlw); + void removeWindow(WId wId); public slots: void handleEvents(); diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.cpp b/src/plugins/platforms/directfb/qdirectfbwindow.cpp new file mode 100644 index 0000000..d88953e --- /dev/null +++ b/src/plugins/platforms/directfb/qdirectfbwindow.cpp @@ -0,0 +1,157 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "qdirectfbwindow.h" +#include "qdirectfbinput.h" + +#include + +#include + +QDirectFbWindow::QDirectFbWindow(QWidget *tlw) + : QPlatformWindow(tlw) +{ + IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); + DFBDisplayLayerConfig layerConfig; + layer->GetConfiguration(layer,&layerConfig); + + DFBWindowDescription description; + memset(&description,0,sizeof(DFBWindowDescription)); + description.flags = DFBWindowDescriptionFlags(DWDESC_WIDTH|DWDESC_HEIGHT|DWDESC_POSX|DWDESC_POSY|DWDESC_SURFACE_CAPS +#if DIRECTFB_MINOR_VERSION >= 1 + |DWDESC_OPTIONS +#endif + |DWDESC_CAPS); + description.width = tlw->rect().width(); + description.height = tlw->rect().height(); + description.posx = tlw->rect().x(); + description.posy = tlw->rect().y(); + + if (layerConfig.surface_caps & DSCAPS_PREMULTIPLIED) + description.surface_caps = DSCAPS_PREMULTIPLIED; + description.pixelformat = layerConfig.pixelformat; + +#if DIRECTFB_MINOR_VERSION >= 1 + description.options = DFBWindowOptions(DWOP_ALPHACHANNEL); +#endif + description.caps = DFBWindowCapabilities(DWCAPS_DOUBLEBUFFER|DWCAPS_ALPHACHANNEL); + description.surface_caps = DSCAPS_PREMULTIPLIED; + + DFBResult result = layer->CreateWindow(layer,&description,&m_dfbWindow); + if (result != DFB_OK) { + DirectFBError("QDirectFbGraphicsSystemScreen: failed to create window",result); + } + + m_dfbWindow->SetOpacity(m_dfbWindow,0xff); + + DFBWindowID id; + m_dfbWindow->GetID(m_dfbWindow, &id); + QDirectFbInput::instance()->addWindow(id,tlw); +} + +QDirectFbWindow::~QDirectFbWindow() +{ + QDirectFbInput::instance()->removeWindow(winId()); + m_dfbWindow->Destroy(m_dfbWindow); +} + +void QDirectFbWindow::setGeometry(const QRect &rect) +{ + QPlatformWindow::setGeometry(rect); + m_dfbWindow->SetBounds(m_dfbWindow, rect.x(),rect.y(), + rect.width(), rect.height()); + +} + +void QDirectFbWindow::setOpacity(qreal level) +{ + const quint8 windowOpacity = quint8(level * 0xff); + m_dfbWindow->SetOpacity(m_dfbWindow,windowOpacity); +} + +void QDirectFbWindow::setVisible(bool visible) +{ + if (visible) { + int x = geometry().x(); + int y = geometry().y(); + m_dfbWindow->MoveTo(m_dfbWindow,x,y); + } else { + IDirectFBDisplayLayer *displayLayer; + QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),DLID_PRIMARY,&displayLayer); + + DFBDisplayLayerConfig config; + displayLayer->GetConfiguration(displayLayer,&config); + m_dfbWindow->MoveTo(m_dfbWindow,config.width+1,config.height + 1); + } +} + +Qt::WindowFlags QDirectFbWindow::setWindowFlags(Qt::WindowFlags flags) +{ + switch (flags & Qt::WindowType_Mask) { + case Qt::ToolTip: { + DFBWindowOptions options; + m_dfbWindow->GetOptions(m_dfbWindow,&options); + options = DFBWindowOptions(options | DWOP_GHOST); + m_dfbWindow->SetOptions(m_dfbWindow,options); + break; } + default: + break; + } + + m_dfbWindow->SetStackingClass(m_dfbWindow, flags & Qt::WindowStaysOnTopHint ? DWSC_UPPER : DWSC_MIDDLE); + return flags; +} + +void QDirectFbWindow::raise() +{ + m_dfbWindow->RaiseToTop(m_dfbWindow); +} + +void QDirectFbWindow::lower() +{ + m_dfbWindow->LowerToBottom(m_dfbWindow); +} + +WId QDirectFbWindow::winId() const +{ + DFBWindowID id; + m_dfbWindow->GetID(m_dfbWindow, &id); + return WId(id); +} diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.h b/src/plugins/platforms/directfb/qdirectfbwindow.h new file mode 100644 index 0000000..d5fd408 --- /dev/null +++ b/src/plugins/platforms/directfb/qdirectfbwindow.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDIRECTFBWINDOW_H +#define QDIRECTFBWINDOW_H + +#include + +#include "qdirectfbconvenience.h" + +QT_BEGIN_NAMESPACE + +class QDirectFbWindow : public QPlatformWindow +{ +public: + QDirectFbWindow(QWidget *tlw); + ~QDirectFbWindow(); + + void setGeometry(const QRect &rect); + void setOpacity(qreal level); + + void setVisible(bool visible); + + Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); + void raise(); + void lower(); + WId winId() const; + +private: + IDirectFBWindow *m_dfbWindow; +}; + +QT_END_NAMESPACE + +#endif // QDIRECTFBWINDOW_H diff --git a/src/plugins/platforms/directfb/qplatformintegration_directfb.cpp b/src/plugins/platforms/directfb/qplatformintegration_directfb.cpp index c70bb64..5f428ef 100644 --- a/src/plugins/platforms/directfb/qplatformintegration_directfb.cpp +++ b/src/plugins/platforms/directfb/qplatformintegration_directfb.cpp @@ -44,6 +44,7 @@ #include "qblitter_directfb.h" #include "qdirectfbconvenience.h" #include "qdirectfbcursor.h" +#include "qdirectfbwindow.h" #include #include @@ -105,9 +106,15 @@ QPixmapData *QDirectFbIntegration::createPixmapData(QPixmapData::PixelType type) return new QBlittablePixmapData(type); } -QWindowSurface *QDirectFbIntegration::createWindowSurface(QWidget *widget) const +QPlatformWindow *QDirectFbIntegration::createPlatformWindow(QWidget *widget, WId winId) const { - return new QDirectFbWindowSurface (widget); + Q_UNUSED(winId); + return new QDirectFbWindow(widget); +} + +QWindowSurface *QDirectFbIntegration::createWindowSurfaceForWindow(QWidget *widget, WId winId) const +{ + return new QDirectFbWindowSurface(widget,winId); } QBlittable *QDirectFbIntegration::createBlittable(const QSize &size) const diff --git a/src/plugins/platforms/directfb/qplatformintegration_directfb.h b/src/plugins/platforms/directfb/qplatformintegration_directfb.h index f74a81d..a8489c0 100644 --- a/src/plugins/platforms/directfb/qplatformintegration_directfb.h +++ b/src/plugins/platforms/directfb/qplatformintegration_directfb.h @@ -82,7 +82,8 @@ public: QDirectFbIntegration(); QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; + QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; + QWindowSurface *createWindowSurfaceForWindow(QWidget *widget, WId winId) const; QBlittable *createBlittable(const QSize &size) const; QList screens() const { return mScreens; } diff --git a/src/plugins/platforms/directfb/qwindowsurface_directfb.cpp b/src/plugins/platforms/directfb/qwindowsurface_directfb.cpp index afe34b7..e978cae 100644 --- a/src/plugins/platforms/directfb/qwindowsurface_directfb.cpp +++ b/src/plugins/platforms/directfb/qwindowsurface_directfb.cpp @@ -49,49 +49,19 @@ QT_BEGIN_NAMESPACE -QDirectFbWindowSurface::QDirectFbWindowSurface(QWidget *window) - : QWindowSurface(window), m_pixmap(0), m_pmdata(0), - m_dfbWindow(0), m_dfbSurface(0) +QDirectFbWindowSurface::QDirectFbWindowSurface(QWidget *window, WId wId) + : QWindowSurface(window), m_pixmap(0), m_pmdata(0), m_dfbSurface(0) { - window->setWindowSurface(this); IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); - DFBDisplayLayerConfig layerConfig; - layer->GetConfiguration(layer,&layerConfig); - - DFBWindowDescription description; - memset(&description,0,sizeof(DFBWindowDescription)); - description.flags = DFBWindowDescriptionFlags(DWDESC_WIDTH|DWDESC_HEIGHT|DWDESC_POSX|DWDESC_POSY|DWDESC_SURFACE_CAPS -#if DIRECTFB_MINOR_VERSION >= 1 - |DWDESC_OPTIONS -#endif - |DWDESC_CAPS); - description.width = window->rect().width(); - description.height = window->rect().height(); - description.posx = window->rect().x(); - description.posy = window->rect().y(); - - if (layerConfig.surface_caps & DSCAPS_PREMULTIPLIED) - description.surface_caps = DSCAPS_PREMULTIPLIED; - description.pixelformat = layerConfig.pixelformat; - -#if DIRECTFB_MINOR_VERSION >= 1 - description.options = DFBWindowOptions(DWOP_ALPHACHANNEL); -#endif - description.caps = DFBWindowCapabilities(DWCAPS_DOUBLEBUFFER|DWCAPS_ALPHACHANNEL); - description.surface_caps = DSCAPS_PREMULTIPLIED; - - DFBResult result = layer->CreateWindow(layer,&description,&m_dfbWindow); - if (result != DFB_OK) { - DirectFBError("QDirectFbGraphicsSystemScreen: failed to create window",result); - } - DFBWindowID id; - m_dfbWindow->GetID(m_dfbWindow, &id); - QDirectFbInput::instance()->addWindow(id,window); + DFBWindowID id(wId); + IDirectFBWindow *dfbWindow; - m_dfbWindow->GetSurface(m_dfbWindow,&m_dfbSurface); + layer->GetWindow(layer,id,&dfbWindow); + dfbWindow->GetSurface(dfbWindow,&m_dfbSurface); +//WRONGSIZE QDirectFbBlitter *blitter = new QDirectFbBlitter(window->rect().size(), m_dfbSurface); m_pmdata = new QBlittablePixmapData(QPixmapData::PixmapType); m_pmdata->setBlittable(blitter); @@ -100,8 +70,7 @@ QDirectFbWindowSurface::QDirectFbWindowSurface(QWidget *window) QDirectFbWindowSurface::~QDirectFbWindowSurface() { - QDirectFbInput::instance()->removeWindow(this->window()); - m_dfbWindow->Destroy(m_dfbWindow); + } QPaintDevice *QDirectFbWindowSurface::paintDevice() @@ -111,11 +80,9 @@ QPaintDevice *QDirectFbWindowSurface::paintDevice() void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) { + Q_UNUSED(widget); m_pmdata->blittable()->unlock(); - const quint8 windowOpacity = quint8(widget->windowOpacity() * 0xff); - m_dfbWindow->SetOpacity(m_dfbWindow,windowOpacity); - QVector rects = region.rects(); for (int i = 0 ; i < rects.size(); i++) { const QRect rect = rects.at(i); @@ -124,17 +91,13 @@ void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const } } -void QDirectFbWindowSurface::setGeometry(const QRect &rect) +void QDirectFbWindowSurface::resize(const QSize &size) { - m_pmdata->blittable()->unlock(); - - QWindowSurface::setGeometry(rect); - m_dfbWindow->SetBounds(m_dfbWindow, rect.x(),rect.y(), - rect.width(), rect.height()); + QWindowSurface::resize(size); //Have to add 1 ref ass it will be removed by deleting the old blitter in setBlittable m_dfbSurface->AddRef(m_dfbSurface); - QDirectFbBlitter *blitter = new QDirectFbBlitter(rect.size(),m_dfbSurface); + QDirectFbBlitter *blitter = new QDirectFbBlitter(size,m_dfbSurface); m_pmdata->setBlittable(blitter); } @@ -175,57 +138,4 @@ void QDirectFbWindowSurface::endPaint(const QRegion ®ion) Q_UNUSED(region); } -void QDirectFbWindowSurface::setVisible(bool visible) -{ - m_pmdata->blittable()->unlock(); - - if (visible) { - int x = this->geometry().x(); - int y = this->geometry().y(); - m_dfbWindow->MoveTo(m_dfbWindow,x,y); - } else { - IDirectFBDisplayLayer *displayLayer; - QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),DLID_PRIMARY,&displayLayer); - - DFBDisplayLayerConfig config; - displayLayer->GetConfiguration(displayLayer,&config); - m_dfbWindow->MoveTo(m_dfbWindow,config.width+1,config.height + 1); - } -} - -Qt::WindowFlags QDirectFbWindowSurface::setWindowFlags(Qt::WindowFlags flags) -{ - switch (flags & Qt::WindowType_Mask) { - case Qt::ToolTip: { - DFBWindowOptions options; - m_dfbWindow->GetOptions(m_dfbWindow,&options); - options = DFBWindowOptions(options | DWOP_GHOST); - m_dfbWindow->SetOptions(m_dfbWindow,options); - break; } - default: - break; - } - - m_dfbWindow->SetStackingClass(m_dfbWindow, flags & Qt::WindowStaysOnTopHint ? DWSC_UPPER : DWSC_MIDDLE); - return flags; -} - -void QDirectFbWindowSurface::raise() -{ - m_dfbWindow->RaiseToTop(m_dfbWindow); -} - -void QDirectFbWindowSurface::lower() -{ - m_dfbWindow->LowerToBottom(m_dfbWindow); -} - -WId QDirectFbWindowSurface::winId() const -{ - DFBWindowID id; - m_dfbWindow->GetID(m_dfbWindow, &id); - return WId(id); -} - - QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qwindowsurface_directfb.h b/src/plugins/platforms/directfb/qwindowsurface_directfb.h index 2f31513..d48f534 100644 --- a/src/plugins/platforms/directfb/qwindowsurface_directfb.h +++ b/src/plugins/platforms/directfb/qwindowsurface_directfb.h @@ -49,37 +49,26 @@ QT_BEGIN_NAMESPACE -class QDirectFbGraphicsSystemScreen; - class QDirectFbWindowSurface : public QWindowSurface { public: - QDirectFbWindowSurface(QWidget *window); + QDirectFbWindowSurface(QWidget *window, WId wid); ~QDirectFbWindowSurface(); QPaintDevice *paintDevice(); void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void setGeometry(const QRect &rect); + void resize (const QSize &size); bool scroll(const QRegion &area, int dx, int dy); void beginPaint(const QRegion ®ion); void endPaint(const QRegion ®ion); - void setVisible(bool visible); - Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); - - void raise(); - void lower(); - - WId winId() const; - private: void lockSurfaceToImage(); QPixmap *m_pixmap; QBlittablePixmapData *m_pmdata; - IDirectFBWindow *m_dfbWindow; IDirectFBSurface *m_dfbSurface; }; diff --git a/src/plugins/platforms/minimal/minimal.pro b/src/plugins/platforms/minimal/minimal.pro index 567b551..6c97f07 100644 --- a/src/plugins/platforms/minimal/minimal.pro +++ b/src/plugins/platforms/minimal/minimal.pro @@ -1,4 +1,4 @@ -TARGET = qminimalgraphicssystem +TARGET = qminimal include(../../qpluginbase.pri) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms diff --git a/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp b/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp index 2f03127..404ffbc 100644 --- a/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp +++ b/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp @@ -20,9 +20,15 @@ QPixmapData *QMinimalIntegration::createPixmapData(QPixmapData::PixelType type) { return new QRasterPixmapData(type); } -void QMinimalIntegration::createWindowAndSurface(QPlatformWindow**window, QWindowSurface**surface, QWidget *widget, WId winId) const + +QPlatformWindow *QMinimalIntegration::createPlatformWindow(QWidget *widget, WId winId) const +{ + Q_UNUSED(winId); + return new QPlatformWindow(widget); +} + +QWindowSurface *QMinimalIntegration::createWindowSurfaceForWindow(QWidget *widget, WId winId) const { - qDebug() << "createWindow"; - *surface = new QMinimalWindowSurface(widget); - *window = new QPlatformWindow(widget); + Q_UNUSED(winId); + return new QMinimalWindowSurface(widget); } diff --git a/src/plugins/platforms/minimal/qplatformintegration_minimal.h b/src/plugins/platforms/minimal/qplatformintegration_minimal.h index 127c573..2e8a8cf 100644 --- a/src/plugins/platforms/minimal/qplatformintegration_minimal.h +++ b/src/plugins/platforms/minimal/qplatformintegration_minimal.h @@ -72,7 +72,8 @@ public: QMinimalIntegration(); QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - void createWindowAndSurface(QPlatformWindow**window, QWindowSurface**surface, QWidget *widget, WId winId) const; + QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; + QWindowSurface *createWindowSurfaceForWindow(QWidget *widget, WId winId) const; QList screens() const { return mScreens; } -- cgit v0.12 From 7b3f1a992e25739a8a28cf0470ba58fd31a46e7b Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Thu, 8 Apr 2010 12:29:07 +0200 Subject: Rename qglplatformintegration_lite.h & add QGLWidget surface --- src/gui/kernel/qplatformintegration_lite.cpp | 5 ++ src/gui/kernel/qplatformintegration_lite.h | 5 +- src/opengl/opengl.pro | 2 +- src/opengl/qgl_lite.cpp | 10 +++- src/opengl/qgl_p.h | 2 +- src/opengl/qglplatformintegration_lite.h | 83 ++++++++++++++++++++++++++ src/opengl/qplatformglcontext_lite.h | 72 ---------------------- src/plugins/platforms/testlite/qglxglcontext.h | 2 +- 8 files changed, 104 insertions(+), 77 deletions(-) create mode 100644 src/opengl/qglplatformintegration_lite.h delete mode 100644 src/opengl/qplatformglcontext_lite.h diff --git a/src/gui/kernel/qplatformintegration_lite.cpp b/src/gui/kernel/qplatformintegration_lite.cpp index 71beded..3fa874c 100644 --- a/src/gui/kernel/qplatformintegration_lite.cpp +++ b/src/gui/kernel/qplatformintegration_lite.cpp @@ -66,6 +66,11 @@ QPlatformGLContext * QPlatformIntegration::createGLContext() { return 0; } + +QPlatformGLWidgetSurface * QPlatformIntegration::createGLWidgetSurface(QGLWidget*) +{ + return 0; +} #endif QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformintegration_lite.h b/src/gui/kernel/qplatformintegration_lite.h index 9125bd1..2018c70 100644 --- a/src/gui/kernel/qplatformintegration_lite.h +++ b/src/gui/kernel/qplatformintegration_lite.h @@ -53,6 +53,8 @@ QT_MODULE(Gui) #ifndef QT_NO_OPENGL class QPlatformGLContext; +class QPlatformGLWidgetSurface; +class QGLWidget; #endif class Q_GUI_EXPORT QPlatformIntegration @@ -72,7 +74,8 @@ public: // OpenGL Integration functions #ifndef QT_NO_OPENGL virtual bool hasOpenGL() const; - virtual QPlatformGLContext * createGLContext(); + virtual QPlatformGLContext * createGLContext(); + virtual QPlatformGLWidgetSurface * createGLWidgetSurface(QGLWidget*); #endif }; diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index cebb677..42608e3 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -78,7 +78,7 @@ SOURCES += qgl.cpp \ embedded_lite { SOURCES += qgl_lite.cpp - HEADERS += qplatformglcontext_lite.h + HEADERS += qglplatformintegration_lite.h # If we have EGL, use the EGL implementation of QGLPixelBuffer, otherwise we just provide # a stubbed out one. PBuffers aren't too interesting anyway. diff --git a/src/opengl/qgl_lite.cpp b/src/opengl/qgl_lite.cpp index db1077d..a46593e 100644 --- a/src/opengl/qgl_lite.cpp +++ b/src/opengl/qgl_lite.cpp @@ -47,7 +47,7 @@ #include "qgl.h" #include "qgl_p.h" -#include "qplatformglcontext_lite.h" +#include "qglplatformintegration_lite.h" QT_BEGIN_NAMESPACE @@ -60,6 +60,14 @@ QPlatformGLContext::~QPlatformGLContext() { } +QPlatformGLWidgetSurface::QPlatformGLWidgetSurface(QGLWidget*) +{ +} + +QPlatformGLWidgetSurface::~QPlatformGLWidgetSurface() +{ +} + bool QGLFormat::hasOpenGL() { diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index f53b3e2..6405a54 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -69,7 +69,7 @@ #endif #if defined(Q_WS_LITE) -#include +#include #endif QT_BEGIN_NAMESPACE diff --git a/src/opengl/qglplatformintegration_lite.h b/src/opengl/qglplatformintegration_lite.h new file mode 100644 index 0000000..d5bae45 --- /dev/null +++ b/src/opengl/qglplatformintegration_lite.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenGL module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORM_GL_CONTEXT_H +#define QPLATFORM_GL_CONTEXT_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class Q_OPENGL_EXPORT QPlatformGLContext +{ +public: + QPlatformGLContext(); + virtual ~QPlatformGLContext(); + + virtual bool create(QPaintDevice* device, const QGLFormat& format, QPlatformGLContext* shareContext) = 0; + + virtual void makeCurrent() = 0; + virtual void doneCurrent() = 0; + virtual void swapBuffers() = 0; + virtual void* getProcAddress(const QString& procName) = 0; + +}; + +// QGLPlatformWidgetSurface does _not_ inherit from QWindowSurface +// - The backing store may be totally unaware of it's existance. +class QPlatformGLWidgetSurface +{ +public: + QPlatformGLWidgetSurface(QGLWidget*); + virtual ~QPlatformGLWidgetSurface(); + + virtual void setGeometry(const QRect&) = 0; +}; + + +QT_END_NAMESPACE + +QT_END_HEADER + + +#endif // QPLATFORM_GL_INTEGRATION_P_H diff --git a/src/opengl/qplatformglcontext_lite.h b/src/opengl/qplatformglcontext_lite.h deleted file mode 100644 index 10c05f6..0000000 --- a/src/opengl/qplatformglcontext_lite.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPLATFORM_GL_CONTEXT_H -#define QPLATFORM_GL_CONTEXT_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class Q_OPENGL_EXPORT QPlatformGLContext -{ -public: - QPlatformGLContext(); - virtual ~QPlatformGLContext(); - - virtual bool create(QPaintDevice* device, const QGLFormat& format, QPlatformGLContext* shareContext) = 0; - - virtual void makeCurrent() = 0; - virtual void doneCurrent() = 0; - virtual void swapBuffers() = 0; - virtual void* getProcAddress(const QString& procName) = 0; - -}; - - -QT_END_NAMESPACE - -QT_END_HEADER - - -#endif // QPLATFORM_GL_INTEGRATION_P_H diff --git a/src/plugins/platforms/testlite/qglxglcontext.h b/src/plugins/platforms/testlite/qglxglcontext.h index 54e5c2f..ff8fe85 100644 --- a/src/plugins/platforms/testlite/qglxglcontext.h +++ b/src/plugins/platforms/testlite/qglxglcontext.h @@ -42,7 +42,7 @@ #ifndef Q_GLX_CONTEXT_H #define Q_GLX_CONTEXT_H -#include +#include #include "x11util.h" #include -- cgit v0.12 From 6e41376f73cc54efd2e82df8b7bdd5797438e6c5 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 8 Apr 2010 15:02:17 +0200 Subject: Compile on Lighthouse after the windowsurface API change. --- src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp b/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp index 6bf9d6b..695050e 100644 --- a/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp +++ b/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp @@ -98,7 +98,11 @@ QPaintDevice *QTraceWindowSurface::paintDevice() { if (!buffer) { buffer = new QPaintBuffer; +#ifdef Q_WS_LITE + buffer->setBoundingRect(QRect(QPoint(), size())); +#else buffer->setBoundingRect(geometry()); +#endif } return buffer; } -- cgit v0.12 From c3be673a149201d15cd8a7ca0a5047a7e24331fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 8 Apr 2010 14:57:36 +0200 Subject: Add the DirectFbWindow to the pro file --- src/plugins/platforms/directfb/directfb.pro | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/directfb/directfb.pro b/src/plugins/platforms/directfb/directfb.pro index f8fccaa..ec5f0f1 100644 --- a/src/plugins/platforms/directfb/directfb.pro +++ b/src/plugins/platforms/directfb/directfb.pro @@ -18,12 +18,14 @@ SOURCES = main.cpp \ qblitter_directfb.cpp \ qdirectfbconvenience.cpp \ qdirectfbinput.cpp \ - qdirectfbcursor.cpp + qdirectfbcursor.cpp \ + qdirectfbwindow.cpp HEADERS = qplatformintegration_directfb.h \ qwindowsurface_directfb.h \ qblitter_directfb.h \ qdirectfbconvenience.h \ qdirectfbinput.h \ - qdirectfbcursor.h + qdirectfbcursor.h \ + qdirectfbwindow.h target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target -- cgit v0.12 From b773920624a3420fb01071fe75c304a03051cfd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 8 Apr 2010 15:02:51 +0200 Subject: Fix "bug" in plugins.pro Dont build graphicssystems for lighthouse anymore --- src/plugins/plugins.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 73ab3e9..0e9a14c 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -6,7 +6,7 @@ unix:!symbian { } else { SUBDIRS *= codecs } -!embedded:!embedded-lite:SUBDIRS *= graphicssystems +!embedded:!embedded_lite:SUBDIRS *= graphicssystems embedded:SUBDIRS *= gfxdrivers decorations mousedrivers kbddrivers !win32:!embedded:!mac:!symbian:SUBDIRS *= inputmethods symbian:SUBDIRS += s60 -- cgit v0.12 From d64b2ad5417fec750cd3f31364fb216e61acb8cf Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Thu, 8 Apr 2010 16:06:33 +0200 Subject: Make a top-level QGLWidget work once, 50% of the time --- src/opengl/qgl.cpp | 6 +++++- src/opengl/qgl_lite.cpp | 12 +++++++++--- src/plugins/platforms/testlite/qglxglcontext.cpp | 8 +++++--- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 1e522d6..6c6f6d9 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1361,6 +1361,10 @@ QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags() } } +#ifdef Q_WS_LITE + hasOpenGL(); // ### I have no idea why this is needed here, but it makes things work for testlite +#endif + QString versionString(QLatin1String(reinterpret_cast(glGetString(GL_VERSION)))); OpenGLVersionFlags versionFlags = qOpenGLVersionFlagsFromString(versionString); if (currentCtx) { @@ -3907,7 +3911,7 @@ void QGLWidget::resizeOverlayGL(int, int) /*! \fn bool QGLWidget::event(QEvent *e) \reimp */ -#if !defined(Q_OS_WINCE) && !defined(Q_WS_QWS) +#if !defined(Q_OS_WINCE) && !defined(Q_WS_QWS) && !defined(Q_WS_LITE) bool QGLWidget::event(QEvent *e) { Q_D(QGLWidget); diff --git a/src/opengl/qgl_lite.cpp b/src/opengl/qgl_lite.cpp index a46593e..2a70545 100644 --- a/src/opengl/qgl_lite.cpp +++ b/src/opengl/qgl_lite.cpp @@ -232,17 +232,23 @@ void QGLWidget::setMouseTracking(bool enable) Q_UNUSED(enable); } +bool QGLWidget::event(QEvent *e) +{ + QWidget::event(e); +} + void QGLWidget::resizeEvent(QResizeEvent *) { Q_D(QGLWidget); if (!isValid()) return; makeCurrent(); - if (!d->glcx->initialized()) - glInit(); - resizeGL(width(), height()); +// if (!d->glcx->initialized()) +// glInit(); +// resizeGL(width(), height()); } + const QGLContext* QGLWidget::overlayContext() const { return 0; diff --git a/src/plugins/platforms/testlite/qglxglcontext.cpp b/src/plugins/platforms/testlite/qglxglcontext.cpp index 0739567..6fdbb56 100644 --- a/src/plugins/platforms/testlite/qglxglcontext.cpp +++ b/src/plugins/platforms/testlite/qglxglcontext.cpp @@ -62,8 +62,10 @@ QGLXGLContext::QGLXGLContext(Display *xdpy) QGLXGLContext::~QGLXGLContext() { - if (m_context) + if (m_context) { + qDebug("Destroying GLX context 0x%x", m_context); glXDestroyContext(m_display, m_context); + } } bool QGLXGLContext::create(QPaintDevice* device, const QGLFormat& format, QPlatformGLContext* shareContext) @@ -88,10 +90,10 @@ bool QGLXGLContext::create(QPaintDevice* device, const QGLFormat& format, QPlatf int matchingCount = 0; visualInfo = XGetVisualInfo(m_display, VisualIDMask, &visualInfoTemplate, &matchingCount); - qDebug("Creating a GLX context for visual ID %d", visualInfoTemplate.visualid); - m_context = glXCreateContext(m_display, visualInfo, 0, True); + qDebug("Created GLX context 0x%x for visual ID %d", m_context, visualInfoTemplate.visualid); + return true; } -- cgit v0.12 From 6362d2a751294242296dd1bf06f24cf5961a9561 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Thu, 8 Apr 2010 17:05:08 +0200 Subject: port VNC plugin to platform api name change --- src/gui/kernel/qplatformscreen_lite.h | 3 +- src/plugins/platforms/fb_base/fb_base.cpp | 56 +++++++++++------------ src/plugins/platforms/fb_base/fb_base.h | 30 ++++++------ src/plugins/platforms/vnc/main.cpp | 14 +++--- src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp | 24 +++++----- src/plugins/platforms/vnc/qgraphicssystem_vnc.h | 22 ++++----- src/plugins/platforms/vnc/qvnccursor.cpp | 2 +- src/plugins/platforms/vnc/qvnccursor.h | 4 +- src/plugins/platforms/vnc/qvncserver.cpp | 16 +++---- src/plugins/platforms/vnc/qvncserver.h | 26 +++++------ src/plugins/platforms/vnc/vnc.pro | 4 +- 11 files changed, 101 insertions(+), 100 deletions(-) diff --git a/src/gui/kernel/qplatformscreen_lite.h b/src/gui/kernel/qplatformscreen_lite.h index da0e26b..abdf362 100644 --- a/src/gui/kernel/qplatformscreen_lite.h +++ b/src/gui/kernel/qplatformscreen_lite.h @@ -44,6 +44,7 @@ #include #include +#include QT_BEGIN_HEADER @@ -51,7 +52,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -class Q_GUI_EXPORT QPlatformScreen +class Q_GUI_EXPORT QPlatformScreen : public QObject { public: virtual ~QPlatformScreen() { } diff --git a/src/plugins/platforms/fb_base/fb_base.cpp b/src/plugins/platforms/fb_base/fb_base.cpp index d30746a..a2a6609 100644 --- a/src/plugins/platforms/fb_base/fb_base.cpp +++ b/src/plugins/platforms/fb_base/fb_base.cpp @@ -6,7 +6,7 @@ #include #include -QGraphicsSystemSoftwareCursor::QGraphicsSystemSoftwareCursor(QGraphicsSystemScreen *scr) +QGraphicsSystemSoftwareCursor::QGraphicsSystemSoftwareCursor(QPlatformScreen *scr) : QGraphicsSystemCursor(scr), currentRect(QRect()), prevRect(QRect()) { graphic = new QGraphicsSystemCursorImage(0, 0, 0, 0, 0, 0); @@ -81,7 +81,7 @@ void QGraphicsSystemSoftwareCursor::changeCursor(QCursor * widgetCursor, QWidget screen->setDirty(currentRect); } -QGraphicsSystemFbScreen::QGraphicsSystemFbScreen() : cursor(0), mGeometry(), mDepth(16), mFormat(QImage::Format_RGB16), mScreenImage(0), compositePainter(0), isUpToDate(false) +QFbPlatformScreen::QFbPlatformScreen() : cursor(0), mGeometry(), mDepth(16), mFormat(QImage::Format_RGB16), mScreenImage(0), compositePainter(0), isUpToDate(false) { mScreenImage = new QImage(mGeometry.size(), mFormat); redrawTimer.setSingleShot(true); @@ -89,7 +89,7 @@ QGraphicsSystemFbScreen::QGraphicsSystemFbScreen() : cursor(0), mGeometry(), mDe QObject::connect(&redrawTimer, SIGNAL(timeout()), this, SLOT(doRedraw())); } -void QGraphicsSystemFbScreen::setGeometry(QRect rect) +void QFbPlatformScreen::setGeometry(QRect rect) { delete mScreenImage; mGeometry = rect; @@ -99,17 +99,17 @@ void QGraphicsSystemFbScreen::setGeometry(QRect rect) invalidateRectCache(); } -void QGraphicsSystemFbScreen::setDepth(int depth) +void QFbPlatformScreen::setDepth(int depth) { mDepth = depth; } -void QGraphicsSystemFbScreen::setPhysicalSize(QSize size) +void QFbPlatformScreen::setPhysicalSize(QSize size) { mPhysicalSize = size; } -void QGraphicsSystemFbScreen::setFormat(QImage::Format format) +void QFbPlatformScreen::setFormat(QImage::Format format) { mFormat = format; delete mScreenImage; @@ -118,13 +118,13 @@ void QGraphicsSystemFbScreen::setFormat(QImage::Format format) compositePainter = 0; } -QGraphicsSystemFbScreen::~QGraphicsSystemFbScreen() +QFbPlatformScreen::~QFbPlatformScreen() { delete compositePainter; delete mScreenImage; } -void QGraphicsSystemFbScreen::setDirty(const QRect &rect) +void QFbPlatformScreen::setDirty(const QRect &rect) { repaintRegion += rect; if (!redrawTimer.isActive()) { @@ -132,7 +132,7 @@ void QGraphicsSystemFbScreen::setDirty(const QRect &rect) } } -void QGraphicsSystemFbScreen::generateRects() +void QFbPlatformScreen::generateRects() { cachedRects.clear(); QRegion remainingScreen(mGeometry); @@ -157,7 +157,7 @@ void QGraphicsSystemFbScreen::generateRects() -QRegion QGraphicsSystemFbScreen::doRedraw() +QRegion QFbPlatformScreen::doRedraw() { QRegion touchedRegion; if (cursor) @@ -227,21 +227,21 @@ QRegion QGraphicsSystemFbScreen::doRedraw() return touchedRegion; } -void QGraphicsSystemFbScreen::removeWindowSurface(QGraphicsSystemFbWindowSurface * surface) +void QFbPlatformScreen::removeWindowSurface(QFbWindowSurface * surface) { windowStack.removeOne(surface); invalidateRectCache(); setDirty(surface->geometry()); } -void QGraphicsSystemFbWindowSurface::raise() +void QFbWindowSurface::raise() { mScreen->raise(this); } -void QGraphicsSystemFbScreen::raise(QWindowSurface * surface) +void QFbPlatformScreen::raise(QWindowSurface * surface) { - QGraphicsSystemFbWindowSurface *s = static_cast(surface); + QFbWindowSurface *s = static_cast(surface); int index = windowStack.indexOf(s); if (index <= 0) return; @@ -250,14 +250,14 @@ void QGraphicsSystemFbScreen::raise(QWindowSurface * surface) setDirty(s->geometry()); } -void QGraphicsSystemFbWindowSurface::lower() +void QFbWindowSurface::lower() { mScreen->lower(this); } -void QGraphicsSystemFbScreen::lower(QWindowSurface * surface) +void QFbPlatformScreen::lower(QWindowSurface * surface) { - QGraphicsSystemFbWindowSurface *s = static_cast(surface); + QFbWindowSurface *s = static_cast(surface); int index = windowStack.indexOf(s); if (index == -1 || index == (windowStack.size() - 1)) return; @@ -266,7 +266,7 @@ void QGraphicsSystemFbScreen::lower(QWindowSurface * surface) setDirty(s->geometry()); } -QWidget * QGraphicsSystemFbScreen::topLevelAt(const QPoint & p) const +QWidget * QFbPlatformScreen::topLevelAt(const QPoint & p) const { for(int i = 0; i < windowStack.size(); i++) { if (windowStack[i]->geometry().contains(p, false) && @@ -278,7 +278,7 @@ QWidget * QGraphicsSystemFbScreen::topLevelAt(const QPoint & p) const return 0; } -QGraphicsSystemFbWindowSurface::QGraphicsSystemFbWindowSurface(QGraphicsSystemFbScreen *screen, QWidget *window) +QFbWindowSurface::QFbWindowSurface(QFbPlatformScreen *screen, QWidget *window) : QWindowSurface(window), mScreen(screen), visibleFlag(false) @@ -289,12 +289,12 @@ QGraphicsSystemFbWindowSurface::QGraphicsSystemFbWindowSurface(QGraphicsSystemFb windowId = winIdGenerator.fetchAndAddRelaxed(1); } -QGraphicsSystemFbWindowSurface::~QGraphicsSystemFbWindowSurface() +QFbWindowSurface::~QFbWindowSurface() { mScreen->removeWindowSurface(this); } -void QGraphicsSystemFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +void QFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) { Q_UNUSED(widget); Q_UNUSED(offset); @@ -314,7 +314,7 @@ void QGraphicsSystemFbWindowSurface::flush(QWidget *widget, const QRegion ®io mScreen->setDirty(dirtyRegion); } -void QGraphicsSystemFbWindowSurface::setGeometry(const QRect &rect) +void QFbWindowSurface::setGeometry(const QRect &rect) { // store previous geometry for screen update oldGeometry = geometry(); @@ -329,36 +329,36 @@ void QGraphicsSystemFbWindowSurface::setGeometry(const QRect &rect) QWindowSurface::setGeometry(rect); } -bool QGraphicsSystemFbWindowSurface::scroll(const QRegion &area, int dx, int dy) +bool QFbWindowSurface::scroll(const QRegion &area, int dx, int dy) { return QWindowSurface::scroll(area, dx, dy); } -void QGraphicsSystemFbWindowSurface::beginPaint(const QRegion ®ion) +void QFbWindowSurface::beginPaint(const QRegion ®ion) { Q_UNUSED(region); } -void QGraphicsSystemFbWindowSurface::endPaint(const QRegion ®ion) +void QFbWindowSurface::endPaint(const QRegion ®ion) { Q_UNUSED(region); } -void QGraphicsSystemFbWindowSurface::setVisible(bool visible) +void QFbWindowSurface::setVisible(bool visible) { visibleFlag = visible; mScreen->invalidateRectCache(); mScreen->setDirty(geometry()); } -Qt::WindowFlags QGraphicsSystemFbWindowSurface::setWindowFlags(Qt::WindowFlags type) +Qt::WindowFlags QFbWindowSurface::setWindowFlags(Qt::WindowFlags type) { flags = type; mScreen->invalidateRectCache(); return flags; } -Qt::WindowFlags QGraphicsSystemFbWindowSurface::windowFlags() const +Qt::WindowFlags QFbWindowSurface::windowFlags() const { return flags; } diff --git a/src/plugins/platforms/fb_base/fb_base.h b/src/plugins/platforms/fb_base/fb_base.h index 7f9b005..fef769c 100644 --- a/src/plugins/platforms/fb_base/fb_base.h +++ b/src/plugins/platforms/fb_base/fb_base.h @@ -1,23 +1,23 @@ #ifndef QLIGHTHOUSEGRAPHICSSCREEN_H #define QLIGHTHOUSEGRAPHICSSCREEN_H -#include +#include #include #include #include #include -#include +#include class QMouseEvent; class QSize; class QPainter; -class QGraphicsSystemFbScreen; +class QFbPlatformScreen; class QGraphicsSystemSoftwareCursor : public QGraphicsSystemCursor { public: - QGraphicsSystemSoftwareCursor(QGraphicsSystemScreen * scr); + QGraphicsSystemSoftwareCursor(QPlatformScreen * scr); // output methods QRect dirtyRect(); @@ -39,11 +39,11 @@ private: QRect getCurrentRect(); }; -class QGraphicsSystemFbWindowSurface : public QWindowSurface +class QFbWindowSurface : public QWindowSurface { public: - QGraphicsSystemFbWindowSurface(QGraphicsSystemFbScreen *screen, QWidget *window); - ~QGraphicsSystemFbWindowSurface(); + QFbWindowSurface(QFbPlatformScreen *screen, QWidget *window); + ~QFbWindowSurface(); virtual QPaintDevice *paintDevice() { return &mImage; } virtual void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); @@ -65,7 +65,7 @@ public: WId winId() const { return windowId; } protected: - QGraphicsSystemFbScreen *mScreen; + QFbPlatformScreen *mScreen; QRect oldGeometry; QImage mImage; bool visibleFlag; @@ -74,12 +74,12 @@ protected: WId windowId; }; -class QGraphicsSystemFbScreen : public QGraphicsSystemScreen +class QFbPlatformScreen : public QPlatformScreen { Q_OBJECT public: - QGraphicsSystemFbScreen(); - ~QGraphicsSystemFbScreen(); + QFbPlatformScreen(); + ~QFbPlatformScreen(); virtual QRect geometry() const { return mGeometry; } virtual int depth() const { return mDepth; } @@ -93,8 +93,8 @@ public: virtual void setDirty(const QRect &rect); - virtual void removeWindowSurface(QGraphicsSystemFbWindowSurface * surface); - virtual void addWindowSurface(QGraphicsSystemFbWindowSurface * surface) { + virtual void removeWindowSurface(QFbWindowSurface * surface); + virtual void addWindowSurface(QFbWindowSurface * surface) { windowStack.prepend(surface); invalidateRectCache(); } virtual void raise(QWindowSurface * surface); virtual void lower(QWindowSurface * surface); @@ -104,7 +104,7 @@ public: QPaintDevice * paintDevice() const { return mScreenImage; } protected: - QList windowStack; + QList windowStack; QRegion repaintRegion; QGraphicsSystemSoftwareCursor * cursor; QTimer redrawTimer; @@ -125,7 +125,7 @@ private: QList > cachedRects; void invalidateRectCache() { isUpToDate = false; } - friend class QGraphicsSystemFbWindowSurface; + friend class QFbWindowSurface; bool isUpToDate; }; diff --git a/src/plugins/platforms/vnc/main.cpp b/src/plugins/platforms/vnc/main.cpp index f10748a..baaca3e 100644 --- a/src/plugins/platforms/vnc/main.cpp +++ b/src/plugins/platforms/vnc/main.cpp @@ -39,34 +39,34 @@ ** ****************************************************************************/ -#include +#include #include "qgraphicssystem_vnc.h" #include QT_BEGIN_NAMESPACE -class QVNCGraphicsSystemPlugin : public QGraphicsSystemPlugin +class QVNCPlatformIntegrationPlugin : public QPlatformIntegrationPlugin { public: QStringList keys() const; - QGraphicsSystem *create(const QString&); + QPlatformIntegration *create(const QString&); }; -QStringList QVNCGraphicsSystemPlugin::keys() const +QStringList QVNCPlatformIntegrationPlugin::keys() const { QStringList list; list << "VNC"; return list; } -QGraphicsSystem* QVNCGraphicsSystemPlugin::create(const QString& system) +QPlatformIntegration* QVNCPlatformIntegrationPlugin::create(const QString& system) { if (system.toLower() == "vnc") - return new QVNCGraphicsSystem; + return new QVNCPlatformIntegration; return 0; } -Q_EXPORT_PLUGIN2(vnc, QVNCGraphicsSystemPlugin) +Q_EXPORT_PLUGIN2(vnc, QVNCPlatformIntegrationPlugin) QT_END_NAMESPACE diff --git a/src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp b/src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp index 7815f24..85f1b73 100644 --- a/src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp +++ b/src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp @@ -51,8 +51,8 @@ #include -QVNCGraphicsSystemScreen::QVNCGraphicsSystemScreen() - : QGraphicsSystemFbScreen::QGraphicsSystemFbScreen() +QVNCPlatformScreen::QVNCPlatformScreen() + : QFbPlatformScreen::QFbPlatformScreen() { int w = 800; int h = 600; @@ -69,21 +69,21 @@ QVNCGraphicsSystemScreen::QVNCGraphicsSystemScreen() setPhysicalSize((geometry().size()*254)/720); - d_ptr = new QVNCGraphicsSystemScreenPrivate(this); + d_ptr = new QVNCPlatformScreenPrivate(this); cursor = new QVNCCursor(d_ptr->vncServer, this); d_ptr->vncServer->setCursor(static_cast(cursor)); } -QVNCDirtyMap *QVNCGraphicsSystemScreen::dirtyMap() +QVNCDirtyMap *QVNCPlatformScreen::dirtyMap() { return d_ptr->dirty; } -QRegion QVNCGraphicsSystemScreen::doRedraw() +QRegion QVNCPlatformScreen::doRedraw() { QRegion touched; - touched = QGraphicsSystemFbScreen::doRedraw(); + touched = QFbPlatformScreen::doRedraw(); QVector rects = touched.rects(); for (int i = 0; i < rects.size(); i++) @@ -92,24 +92,24 @@ QRegion QVNCGraphicsSystemScreen::doRedraw() } -QVNCGraphicsSystem::QVNCGraphicsSystem() +QVNCPlatformIntegration::QVNCPlatformIntegration() { - mPrimaryScreen = new QVNCGraphicsSystemScreen(); + mPrimaryScreen = new QVNCPlatformScreen(); mScreens.append(mPrimaryScreen); } -QPixmapData *QVNCGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const +QPixmapData *QVNCPlatformIntegration::createPixmapData(QPixmapData::PixelType type) const { return new QRasterPixmapData(type); } -QWindowSurface *QVNCGraphicsSystem::createWindowSurface(QWidget *widget) const +QWindowSurface *QVNCPlatformIntegration::createWindowSurface(QWidget *widget) const { if (widget->windowType() == Qt::Desktop) return 0; // Don't create an explicit window surface for the destkop. - QGraphicsSystemFbWindowSurface * surface; - surface = new QGraphicsSystemFbWindowSurface(mPrimaryScreen, widget); + QFbWindowSurface * surface; + surface = new QFbWindowSurface(mPrimaryScreen, widget); mPrimaryScreen->addWindowSurface(surface); return surface; } diff --git a/src/plugins/platforms/vnc/qgraphicssystem_vnc.h b/src/plugins/platforms/vnc/qgraphicssystem_vnc.h index b3349b7..731d3e9 100644 --- a/src/plugins/platforms/vnc/qgraphicssystem_vnc.h +++ b/src/plugins/platforms/vnc/qgraphicssystem_vnc.h @@ -42,51 +42,51 @@ #ifndef QGRAPHICSSYSTEM_VNC_H #define QGRAPHICSSYSTEM_VNC_H -#include #include "qvnccursor.h" #include "../fb_base/fb_base.h" +#include QT_BEGIN_NAMESPACE class QVNCServer; class QVNCDirtyMap; -class QVNCGraphicsSystemScreenPrivate; +class QVNCPlatformScreenPrivate; -class QVNCGraphicsSystemScreen : public QGraphicsSystemFbScreen +class QVNCPlatformScreen : public QFbPlatformScreen { public: - QVNCGraphicsSystemScreen(); + QVNCPlatformScreen(); int linestep() const { return image() ? image()->bytesPerLine() : 0; } uchar *base() const { return image() ? image()->bits() : 0; } QVNCDirtyMap *dirtyMap(); public: - QVNCGraphicsSystemScreenPrivate *d_ptr; + QVNCPlatformScreenPrivate *d_ptr; private: QVNCServer *server; QRegion doRedraw(); }; -class QVNCGraphicsSystemPrivate; +class QVNCPlatformIntegrationPrivate; -class QVNCGraphicsSystem : public QGraphicsSystem +class QVNCPlatformIntegration : public QPlatformIntegration { public: - QVNCGraphicsSystem(); + QVNCPlatformIntegration(); QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QWindowSurface *createWindowSurface(QWidget *widget) const; - QList screens() const { return mScreens; } + QList screens() const { return mScreens; } private: - QVNCGraphicsSystemScreen *mPrimaryScreen; - QList mScreens; + QVNCPlatformScreen *mPrimaryScreen; + QList mScreens; }; diff --git a/src/plugins/platforms/vnc/qvnccursor.cpp b/src/plugins/platforms/vnc/qvnccursor.cpp index fb214d8..5f9fbb6 100644 --- a/src/plugins/platforms/vnc/qvnccursor.cpp +++ b/src/plugins/platforms/vnc/qvnccursor.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE -QVNCCursor::QVNCCursor(QVNCServer * srvr, QVNCGraphicsSystemScreen *scr ) +QVNCCursor::QVNCCursor(QVNCServer * srvr, QVNCPlatformScreen *scr ) :QGraphicsSystemSoftwareCursor(scr), useVncCursor(false), server(srvr) { } diff --git a/src/plugins/platforms/vnc/qvnccursor.h b/src/plugins/platforms/vnc/qvnccursor.h index 8ea0f45..0e4d7ca 100644 --- a/src/plugins/platforms/vnc/qvnccursor.h +++ b/src/plugins/platforms/vnc/qvnccursor.h @@ -48,12 +48,12 @@ QT_BEGIN_NAMESPACE -class QVNCGraphicsSystemScreen; +class QVNCPlatformScreen; class QVNCServer; class QVNCCursor : public QGraphicsSystemSoftwareCursor { public: - QVNCCursor(QVNCServer *, QVNCGraphicsSystemScreen *); + QVNCCursor(QVNCServer *, QVNCPlatformScreen *); // input methods void setCursorMode(bool vnc); diff --git a/src/plugins/platforms/vnc/qvncserver.cpp b/src/plugins/platforms/vnc/qvncserver.cpp index ea576d4..ce08082 100644 --- a/src/plugins/platforms/vnc/qvncserver.cpp +++ b/src/plugins/platforms/vnc/qvncserver.cpp @@ -358,13 +358,13 @@ bool QRfbClientCutText::read(QTcpSocket *s) //=========================================================================== -QVNCServer::QVNCServer(QVNCGraphicsSystemScreen *screen) +QVNCServer::QVNCServer(QVNCPlatformScreen *screen) : qvnc_screen(screen), cursor(0) { init(5900); } -QVNCServer::QVNCServer(QVNCGraphicsSystemScreen *screen, int id) +QVNCServer::QVNCServer(QVNCPlatformScreen *screen, int id) : qvnc_screen(screen), cursor(0) { init(5900 + id); @@ -620,7 +620,7 @@ void QVNCServer::readClient() } #if 0//Q_BYTE_ORDER == Q_BIG_ENDIAN -bool QVNCGraphicsSystemScreen::swapBytes() const +bool QVNCScreen::swapBytes() const { if (depth() != 16) return false; @@ -1499,7 +1499,7 @@ static void blendCursor(QImage &image, const QRect &imageRect) } #endif // QT_NO_QWS_CURSOR -QVNCDirtyMap::QVNCDirtyMap(QVNCGraphicsSystemScreen *s) +QVNCDirtyMap::QVNCDirtyMap(QVNCPlatformScreen *s) : bytesPerPixel(0), numDirty(0), screen(s) { bytesPerPixel = (screen->depth() + 7) / 8; @@ -1885,7 +1885,7 @@ void QVNCServer::discardClient() -QVNCGraphicsSystemScreenPrivate::QVNCGraphicsSystemScreenPrivate(QVNCGraphicsSystemScreen *parent) +QVNCPlatformScreenPrivate::QVNCPlatformScreenPrivate(QVNCPlatformScreen *parent) : dpiX(72), dpiY(72), doOnScreenSurface(false), refreshRate(25), vncServer(0), q_ptr(parent) { @@ -1902,12 +1902,12 @@ QVNCGraphicsSystemScreenPrivate::QVNCGraphicsSystemScreenPrivate(QVNCGraphicsSys dirty = new QVNCDirtyMapOptimized(q_ptr); } -QVNCGraphicsSystemScreenPrivate::~QVNCGraphicsSystemScreenPrivate() +QVNCPlatformScreenPrivate::~QVNCPlatformScreenPrivate() { } -void QVNCGraphicsSystemScreenPrivate::setDirty(const QRect& rect, bool force) +void QVNCPlatformScreenPrivate::setDirty(const QRect& rect, bool force) { if (rect.isEmpty()) return; @@ -1916,7 +1916,7 @@ void QVNCGraphicsSystemScreenPrivate::setDirty(const QRect& rect, bool force) // q_ptr->screen()->setDirty(rect); if (!vncServer || !vncServer->isConnected()) { -// qDebug() << "QVNCGraphicsSystemScreenPrivate::setDirty() - Not connected"; +// qDebug() << "QVNCScreenPrivate::setDirty() - Not connected"; return; } const QRect r = rect; // .translated(-q_ptr->offset()); diff --git a/src/plugins/platforms/vnc/qvncserver.h b/src/plugins/platforms/vnc/qvncserver.h index 4fcdbae..6830ddd 100644 --- a/src/plugins/platforms/vnc/qvncserver.h +++ b/src/plugins/platforms/vnc/qvncserver.h @@ -72,7 +72,7 @@ class QVNCServer; class QVNCCursor : public QProxyScreenCursor { public: - QVNCCursor(QVNCGraphicsSystemScreen *s); + QVNCCursor(QVNCScreen *s); ~QVNCCursor(); void hide(); @@ -82,7 +82,7 @@ public: private: void setDirty(const QRect &r) const; - QVNCGraphicsSystemScreen *screen; + QVNCScreen *screen; }; class QVNCClientCursor : public QProxyScreenCursor @@ -106,7 +106,7 @@ private: class QVNCDirtyMap { public: - QVNCDirtyMap(QVNCGraphicsSystemScreen *screen); + QVNCDirtyMap(QVNCPlatformScreen *screen); virtual ~QVNCDirtyMap(); void reset(); @@ -122,7 +122,7 @@ public: protected: uchar *map; - QVNCGraphicsSystemScreen *screen; + QVNCPlatformScreen *screen; uchar *buffer; int bufferWidth; int bufferHeight; @@ -134,7 +134,7 @@ template class QVNCDirtyMapOptimized : public QVNCDirtyMap { public: - QVNCDirtyMapOptimized(QVNCGraphicsSystemScreen *screen) : QVNCDirtyMap(screen) {} + QVNCDirtyMapOptimized(QVNCPlatformScreen *screen) : QVNCDirtyMap(screen) {} ~QVNCDirtyMapOptimized() {} void setDirty(int x, int y, bool force = false); @@ -246,11 +246,11 @@ public: quint32 length; }; -class QVNCGraphicsSystemScreenPrivate : public QObject +class QVNCPlatformScreenPrivate : public QObject { public: - QVNCGraphicsSystemScreenPrivate(QVNCGraphicsSystemScreen *parent); - ~QVNCGraphicsSystemScreenPrivate(); + QVNCPlatformScreenPrivate(QVNCPlatformScreen *parent); + ~QVNCPlatformScreenPrivate(); void setDirty(const QRect &rect, bool force = false); void configure(); @@ -266,7 +266,7 @@ public: QSharedMemory shm; #endif - QVNCGraphicsSystemScreen *q_ptr; + QVNCPlatformScreen *q_ptr; }; class QRfbEncoder @@ -438,8 +438,8 @@ class QVNCServer : public QObject { Q_OBJECT public: - QVNCServer(QVNCGraphicsSystemScreen *screen); - QVNCServer(QVNCGraphicsSystemScreen *screen, int id); + QVNCServer(QVNCPlatformScreen *screen); + QVNCServer(QVNCPlatformScreen *screen, int id); ~QVNCServer(); void setDirty(); @@ -464,7 +464,7 @@ public: return pixelFormat.bitsPerPixel / 8; } - inline QVNCGraphicsSystemScreen* screen() const { return qvnc_screen; } + inline QVNCPlatformScreen* screen() const { return qvnc_screen; } inline QVNCDirtyMap* dirtyMap() const { return qvnc_screen->dirtyMap(); } inline QTcpSocket* clientSocket() const { return client; } QImage *screenImage() const; @@ -519,7 +519,7 @@ private: #endif bool dirtyCursor; int refreshRate; - QVNCGraphicsSystemScreen *qvnc_screen; + QVNCPlatformScreen *qvnc_screen; #ifndef QT_NO_QWS_CURSOR QVNCClientCursor *qvnc_cursor; #endif diff --git a/src/plugins/platforms/vnc/vnc.pro b/src/plugins/platforms/vnc/vnc.pro index 0b73b5b..b1da572 100644 --- a/src/plugins/platforms/vnc/vnc.pro +++ b/src/plugins/platforms/vnc/vnc.pro @@ -1,7 +1,7 @@ TARGET = qvncgraphicssystem include(../../qpluginbase.pri) -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms SOURCES = main.cpp qgraphicssystem_vnc.cpp HEADERS = qgraphicssystem_vnc.h @@ -14,6 +14,6 @@ SOURCES += qvnccursor.cpp include(../fb_base/fb_base.pri) -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target -- cgit v0.12 From 473d152acc9fe0d04167406c0926363c3eddd16c Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 9 Apr 2010 10:25:06 +0200 Subject: Compile after the QPlatformWindow change ...but it doesn't *quite* work yet. --- .../testlite/qplatformintegration_testlite.cpp | 17 +++- .../testlite/qplatformintegration_testlite.h | 3 +- .../platforms/testlite/qwindowsurface_testlite.cpp | 109 ++++++++++++++------- .../platforms/testlite/qwindowsurface_testlite.h | 24 ++++- src/plugins/platforms/testlite/x11util.cpp | 18 ++-- src/plugins/platforms/testlite/x11util.h | 4 +- 6 files changed, 119 insertions(+), 56 deletions(-) diff --git a/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp b/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp index 6811e2e..3e73821 100644 --- a/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp +++ b/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp @@ -57,20 +57,20 @@ public: MyCursor(QPlatformScreen *screen) : QGraphicsSystemCursor(screen) {} void changeCursor(QCursor * cursor, QWidget * widget) { - QTestLiteWindowSurface *ws = 0; + QTestLiteWindow *w = 0; if (widget) { QWidget *window = widget->window(); - ws = static_cast(window->windowSurface()); + w = static_cast(window->platformWindow()); } else { // No X11 cursor control when there is no widget under the cursor return; } //qDebug() << "changeCursor" << widget << ws; - if (!ws) + if (!w) return; - ws->setCursor(cursor); + w->setCursor(cursor); } }; @@ -101,7 +101,7 @@ QPixmapData *QTestLiteIntegration::createPixmapData(QPixmapData::PixelType type) return new QRasterPixmapData(type); } -QWindowSurface *QTestLiteIntegration::createWindowSurface(QWidget *widget) const +QWindowSurface *QTestLiteIntegration::createWindowSurfaceForWindow(QWidget *widget, WId) const { if (widget->windowType() == Qt::Desktop) return 0; // Don't create an explicit window surface for the destkop. @@ -110,6 +110,13 @@ QWindowSurface *QTestLiteIntegration::createWindowSurface(QWidget *widget) const } +QPlatformWindow *QTestLiteIntegration::createPlatformWindow(QWidget *widget, WId winId) const +{ + return new QTestLiteWindow(const_cast(this), mPrimaryScreen, widget); +} + + + QPixmap QTestLiteIntegration::grabWindow(WId window, int x, int y, int width, int height) const { QImage img = xd->grabWindow(window, x, y, width, height); diff --git a/src/plugins/platforms/testlite/qplatformintegration_testlite.h b/src/plugins/platforms/testlite/qplatformintegration_testlite.h index c540c48..bd27d89 100644 --- a/src/plugins/platforms/testlite/qplatformintegration_testlite.h +++ b/src/plugins/platforms/testlite/qplatformintegration_testlite.h @@ -74,7 +74,8 @@ public: QTestLiteIntegration(); QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; + QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; + QWindowSurface *createWindowSurfaceForWindow(QWidget *widget, WId winId) const; QPixmap grabWindow(WId window, int x, int y, int width, int height) const; diff --git a/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp b/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp index e2574f9..801491c 100644 --- a/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp @@ -58,19 +58,16 @@ QTestLiteWindowSurface::QTestLiteWindowSurface xw(0) { - - xw = new MyWindow(platformIntegration->xd, 0,0,300,300); - xw->windowSurface = this; + xw = static_cast(window->platformWindow())->xw; +// xw = new MyWindow(platformIntegration->xd, 0,0,300,300); // qDebug() << "QTestLiteWindowSurface::QTestLiteWindowSurface:" << xw->window; - setWindowFlags(window->windowFlags()); //##### This should not be the plugin's responsibility } QTestLiteWindowSurface::~QTestLiteWindowSurface() { // qDebug() << "~QTestLiteWindowSurface" << xw->window; - delete xw; } QPaintDevice *QTestLiteWindowSurface::paintDevice() @@ -90,18 +87,18 @@ void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const } -void QTestLiteWindowSurface::setGeometry(const QRect &rect) -{ - QRect oldRect = geometry(); - if (rect == oldRect) - return; +// void QTestLiteWindowSurface::resize(const QSize &s) +// { +// if (s == size()) +// return; - QWindowSurface::setGeometry(rect); +// QWindowSurface::resize(size); - //if unchanged ### -// xw->setSize(rect.width(), rect.height()); - xw->setGeometry(rect.x(), rect.y(), rect.width(), rect.height()); -} +// //if unchanged ### +// // xw->setSize(rect.width(), rect.height()); + + +// } //### scroll logic copied from QRasterWindowSurface, we should make better API for this @@ -168,7 +165,8 @@ bool QTestLiteWindowSurface::scroll(const QRegion &area, int dx, int dy) void QTestLiteWindowSurface::beginPaint(const QRegion ®ion) { Q_UNUSED(region); - xw->resizeBuffer(geometry().size()); + qDebug() << "QTestLiteWindowSurface::beginPaint" << size(); + xw->resizeBuffer(size()); } void QTestLiteWindowSurface::endPaint(const QRegion ®ion) @@ -178,6 +176,29 @@ void QTestLiteWindowSurface::endPaint(const QRegion ®ion) } +/************************************************************************** +** QTestLiteWindow +**************************************************************************/ + +QTestLiteWindow::QTestLiteWindow(QTestLiteIntegration *platformIntegration, + QTestLiteScreen */*screen*/, QWidget *window) + :QPlatformWindow(window) +{ + xw = new MyWindow(platformIntegration->xd, 0,0,300,300); + setWindowFlags(window->windowFlags()); //##### This should not be the plugin's responsibility + + xw->windowTL = this; +} + + +QTestLiteWindow::~QTestLiteWindow() +{ + delete xw; +} + + + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Mouse event stuff @@ -220,7 +241,7 @@ static Qt::KeyboardModifiers translateModifiers(int s) return ret; } -void QTestLiteWindowSurface::handleMouseEvent(QEvent::Type type, void *ev) +void QTestLiteWindow::handleMouseEvent(QEvent::Type type, void *ev) { static QPoint mousePoint; @@ -245,7 +266,7 @@ void QTestLiteWindowSurface::handleMouseEvent(QEvent::Type type, void *ev) bool hor = (((e->button == Button4 || e->button == Button5) && (modifiers & Qt::AltModifier)) || (e->button == 6 || e->button == 7)); - QWindowSystemInterface::handleWheelEvent(window(), e->time, + QWindowSystemInterface::handleWheelEvent(widget(), e->time, QPoint(e->x, e->y), QPoint(e->x_root, e->y_root), delta, hor ? Qt::Horizontal : Qt::Vertical); @@ -258,33 +279,33 @@ void QTestLiteWindowSurface::handleMouseEvent(QEvent::Type type, void *ev) buttons ^= button; // X event uses state *before*, Qt uses state *after* - QWindowSystemInterface::handleMouseEvent(window(), e->time, QPoint(e->x, e->y), + QWindowSystemInterface::handleMouseEvent(widget(), e->time, QPoint(e->x, e->y), QPoint(e->x_root, e->y_root), buttons); mousePoint = QPoint(e->x_root, e->y_root); } -void QTestLiteWindowSurface::handleGeometryChange(int x, int y, int w, int h) +void QTestLiteWindow::handleGeometryChange(int x, int y, int w, int h) { - QWindowSystemInterface::handleGeometryChange(window(), QRect(x,y,w,h)); + QWindowSystemInterface::handleGeometryChange(widget(), QRect(x,y,w,h)); } -void QTestLiteWindowSurface::handleCloseEvent() +void QTestLiteWindow::handleCloseEvent() { - QWindowSystemInterface::handleCloseEvent(window()); + QWindowSystemInterface::handleCloseEvent(widget()); } -void QTestLiteWindowSurface::handleEnterEvent() +void QTestLiteWindow::handleEnterEvent() { - QWindowSystemInterface::handleEnterEvent(window()); + QWindowSystemInterface::handleEnterEvent(widget()); } -void QTestLiteWindowSurface::handleLeaveEvent() +void QTestLiteWindow::handleLeaveEvent() { - QWindowSystemInterface::handleLeaveEvent(window()); + QWindowSystemInterface::handleLeaveEvent(widget()); } @@ -568,7 +589,7 @@ static Qt::KeyboardModifiers modifierFromKeyCode(int qtcode) } } -void QTestLiteWindowSurface::handleKeyEvent(QEvent::Type type, void *ev) +void QTestLiteWindow::handleKeyEvent(QEvent::Type type, void *ev) { XKeyEvent *e = static_cast(ev); @@ -592,12 +613,12 @@ void QTestLiteWindowSurface::handleKeyEvent(QEvent::Type type, void *ev) modifiers ^= modifierFromKeyCode(qtcode); if (qtcode) { - QWindowSystemInterface::handleKeyEvent(window(), e->time, type, qtcode, modifiers); + QWindowSystemInterface::handleKeyEvent(widget(), e->time, type, qtcode, modifiers); } else if (chars[0]) { int qtcode = chars.toUpper()[0]; //Not exactly right... if (modifiers & Qt::ControlModifier && qtcode < ' ') qtcode = chars[0] + '@'; - QWindowSystemInterface::handleKeyEvent(window(), e->time, type, qtcode, modifiers, QString::fromLatin1(chars)); + QWindowSystemInterface::handleKeyEvent(widget(), e->time, type, qtcode, modifiers, QString::fromLatin1(chars)); } else { qWarning() << "unknown X keycode" << hex << e->keycode << keySym; } @@ -605,7 +626,19 @@ void QTestLiteWindowSurface::handleKeyEvent(QEvent::Type type, void *ev) -Qt::WindowFlags QTestLiteWindowSurface::setWindowFlags(Qt::WindowFlags flags) +void QTestLiteWindow::setGeometry(const QRect &rect) +{ + QRect oldRect = geometry(); + if (rect == oldRect) + return; + + //if unchanged ### + xw->setGeometry(rect.x(), rect.y(), rect.width(), rect.height()); +} + + + +Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) { Q_ASSERT(flags & Qt::Window); @@ -617,19 +650,19 @@ Qt::WindowFlags QTestLiteWindowSurface::setWindowFlags(Qt::WindowFlags flags) } -Qt::WindowFlags QTestLiteWindowSurface::windowFlags() const +Qt::WindowFlags QTestLiteWindow::windowFlags() const { return window_flags; } -void QTestLiteWindowSurface::setVisible(bool visible) +void QTestLiteWindow::setVisible(bool visible) { //qDebug() << "QTestLiteWindowSurface::setVisible" << visible << xw->window; xw->setVisible(visible); } -WId QTestLiteWindowSurface::winId() const +WId QTestLiteWindow::winId() const { if (xw) return (WId) xw->window; @@ -637,24 +670,24 @@ WId QTestLiteWindowSurface::winId() const return WId(0); } -void QTestLiteWindowSurface::raise() +void QTestLiteWindow::raise() { WId window = winId(); XRaiseWindow(mPlatformIntegration->xd->display, window); } -void QTestLiteWindowSurface::lower() +void QTestLiteWindow::lower() { WId window = winId(); XLowerWindow(mPlatformIntegration->xd->display, window); } -void QTestLiteWindowSurface::setWindowTitle(const QString &title) +void QTestLiteWindow::setWindowTitle(const QString &title) { xw->setWindowTitle(title); } -void QTestLiteWindowSurface::setCursor(QCursor *cursor) +void QTestLiteWindow::setCursor(QCursor *cursor) { xw->setCursor(cursor); } diff --git a/src/plugins/platforms/testlite/qwindowsurface_testlite.h b/src/plugins/platforms/testlite/qwindowsurface_testlite.h index ffd2d3a..d713cc2 100644 --- a/src/plugins/platforms/testlite/qwindowsurface_testlite.h +++ b/src/plugins/platforms/testlite/qwindowsurface_testlite.h @@ -43,6 +43,7 @@ #define QWINDOWSURFACE_TESTLITE_H #include +#include #include QT_BEGIN_NAMESPACE @@ -61,12 +62,28 @@ public: QPaintDevice *paintDevice(); void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void setGeometry(const QRect &rect); +// void resize(const QSize &size); bool scroll(const QRegion &area, int dx, int dy); void beginPaint(const QRegion ®ion); void endPaint(const QRegion ®ion); +private: + QTestLiteIntegration *mPlatformIntegration; + QTestLiteScreen *mScreen; + Qt::WindowFlags window_flags; + MyWindow *xw; +}; + + +class QTestLiteWindow : public QPlatformWindow +{ +public: + QTestLiteWindow(QTestLiteIntegration *platformIntegration, + QTestLiteScreen *screen, QWidget *window); + ~QTestLiteWindow(); + + void handleMouseEvent(QEvent::Type, void *); //forwarding X types is apparently impossible :( void handleKeyEvent(QEvent::Type, void *); void handleGeometryChange(int x, int y, int w, int h); @@ -74,6 +91,8 @@ public: void handleEnterEvent(); void handleLeaveEvent(); + void setGeometry(const QRect &rect); + Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); Qt::WindowFlags windowFlags() const; void setVisible(bool visible); @@ -89,8 +108,11 @@ private: QTestLiteScreen *mScreen; Qt::WindowFlags window_flags; MyWindow *xw; + + friend class QTestLiteWindowSurface; //### needs refactoring }; + QT_END_NAMESPACE #endif diff --git a/src/plugins/platforms/testlite/x11util.cpp b/src/plugins/platforms/testlite/x11util.cpp index 6d2966f..a869347 100644 --- a/src/plugins/platforms/testlite/x11util.cpp +++ b/src/plugins/platforms/testlite/x11util.cpp @@ -511,7 +511,7 @@ GC MyWindow::createGC() void MyWindow::closeEvent() { - windowSurface->handleCloseEvent(); + windowTL->handleCloseEvent(); } void MyWindow::paintEvent() @@ -633,7 +633,7 @@ void MyWindow::resizeEvent(XConfigureEvent *e) qDebug() << hex << window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << "geometry" << xpos << ypos << width << height << "img:" << shm_img.size(); #endif - windowSurface->handleGeometryChange(xpos, ypos, width, height); + windowTL->handleGeometryChange(xpos, ypos, width, height); } #if 0 @@ -657,7 +657,7 @@ void MyWindow::enterEvent(XCrossingEvent *) #ifdef MYX11_DEBUG qDebug() << "MyWindow::enterEvent" << hex << window; #endif - windowSurface->handleEnterEvent(); + windowTL->handleEnterEvent(); } void MyWindow::leaveEvent(XCrossingEvent *) @@ -665,7 +665,7 @@ void MyWindow::leaveEvent(XCrossingEvent *) #ifdef MYX11_DEBUG qDebug() << "MyWindow::enterEvent" << hex << window; #endif - windowSurface->handleLeaveEvent(); + windowTL->handleLeaveEvent(); } void MyWindow::mousePressEvent(XButtonEvent *e) @@ -688,17 +688,17 @@ void MyWindow::mousePressEvent(XButtonEvent *e) prevX = e->x; prevY = e->y; - windowSurface->handleMouseEvent(type, e); + windowTL->handleMouseEvent(type, e); } void MyWindow::mouseReleaseEvent(XButtonEvent *e) { - windowSurface->handleMouseEvent(QEvent::MouseButtonRelease, e); + windowTL->handleMouseEvent(QEvent::MouseButtonRelease, e); } void MyWindow::mouseMoveEvent(XButtonEvent *e) { - windowSurface->handleMouseEvent(QEvent::MouseMove, e); + windowTL->handleMouseEvent(QEvent::MouseMove, e); } #ifdef KeyPress @@ -707,7 +707,7 @@ void MyWindow::mouseMoveEvent(XButtonEvent *e) void MyWindow::keyPressEvent(XKeyEvent *e) { - windowSurface->handleKeyEvent(QEvent::KeyPress, e); + windowTL->handleKeyEvent(QEvent::KeyPress, e); } #ifdef KeyRelease @@ -716,7 +716,7 @@ void MyWindow::keyPressEvent(XKeyEvent *e) void MyWindow::keyReleaseEvent(XKeyEvent *e) { - windowSurface->handleKeyEvent(QEvent::KeyRelease, e); + windowTL->handleKeyEvent(QEvent::KeyRelease, e); } diff --git a/src/plugins/platforms/testlite/x11util.h b/src/plugins/platforms/testlite/x11util.h index 79e7461..b28d1e8 100644 --- a/src/plugins/platforms/testlite/x11util.h +++ b/src/plugins/platforms/testlite/x11util.h @@ -85,7 +85,7 @@ public: //### MyX11Cursors * cursors; }; -class QTestLiteWindowSurface; //### abstract callback interface, anyone? +class QTestLiteWindow; //### abstract callback interface, anyone? struct MyShmImageInfo; @@ -133,7 +133,7 @@ public: //### MyDisplay *xd; GC gc; - QTestLiteWindowSurface *windowSurface; + QTestLiteWindow *windowTL; int currentCursor; bool painted; -- cgit v0.12 From 662eab575f3678364fbd3f317624fdd840e03c3c Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Fri, 9 Apr 2010 10:25:59 +0200 Subject: port linuxfb to platform api name change --- src/plugins/platforms/linuxfb/linuxfb.pro | 4 +- src/plugins/platforms/linuxfb/main.cpp | 14 +++--- .../platforms/linuxfb/qgraphicssystem_linuxfb.cpp | 52 +++++++++++----------- .../platforms/linuxfb/qgraphicssystem_linuxfb.h | 22 ++++----- 4 files changed, 45 insertions(+), 47 deletions(-) diff --git a/src/plugins/platforms/linuxfb/linuxfb.pro b/src/plugins/platforms/linuxfb/linuxfb.pro index 031b843..2633a10 100644 --- a/src/plugins/platforms/linuxfb/linuxfb.pro +++ b/src/plugins/platforms/linuxfb/linuxfb.pro @@ -1,12 +1,12 @@ TARGET = qlinuxfbgraphicssystem include(../../qpluginbase.pri) -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms SOURCES = main.cpp qgraphicssystem_linuxfb.cpp HEADERS = qgraphicssystem_linuxfb.h include(../fb_base/fb_base.pri) -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target diff --git a/src/plugins/platforms/linuxfb/main.cpp b/src/plugins/platforms/linuxfb/main.cpp index 4d03fe5..4f7684b 100644 --- a/src/plugins/platforms/linuxfb/main.cpp +++ b/src/plugins/platforms/linuxfb/main.cpp @@ -39,33 +39,33 @@ ** ****************************************************************************/ -#include +#include #include "qgraphicssystem_linuxfb.h" QT_BEGIN_NAMESPACE -class QLinuxFbGraphicsSystemPlugin : public QGraphicsSystemPlugin +class QLinuxFbIntegrationPlugin : public QPlatformIntegrationPlugin { public: QStringList keys() const; - QGraphicsSystem *create(const QString&); + QPlatformIntegration *create(const QString&); }; -QStringList QLinuxFbGraphicsSystemPlugin::keys() const +QStringList QLinuxFbIntegrationPlugin::keys() const { QStringList list; list << "LinuxFb"; return list; } -QGraphicsSystem* QLinuxFbGraphicsSystemPlugin::create(const QString& system) +QPlatformIntegration* QLinuxFbIntegrationPlugin::create(const QString& system) { if (system.toLower() == "linuxfb") - return new QLinuxFbGraphicsSystem; + return new QLinuxFbIntegration; return 0; } -Q_EXPORT_PLUGIN2(linuxfb, QLinuxFbGraphicsSystemPlugin) +Q_EXPORT_PLUGIN2(linuxfb, QLinuxFbIntegrationPlugin) QT_END_NAMESPACE diff --git a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp index 44960bb..6310062 100644 --- a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp +++ b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp @@ -69,11 +69,11 @@ QT_BEGIN_NAMESPACE -class QLinuxFbGraphicsSystemPrivate +class QLinuxFbPrivate { public: - QLinuxFbGraphicsSystemPrivate(); - ~QLinuxFbGraphicsSystemPrivate(); + QLinuxFbPrivate(); + ~QLinuxFbPrivate(); void openTty(); void closeTty(); @@ -94,7 +94,7 @@ public: QString displaySpec; }; -QLinuxFbGraphicsSystemPrivate::QLinuxFbGraphicsSystemPrivate() +QLinuxFbPrivate::QLinuxFbPrivate() : fd(-1), blank(true), doGraphicsMode(true), #ifdef QT_QWS_DEPTH_GENERIC doGenericColors(false), @@ -103,12 +103,12 @@ QLinuxFbGraphicsSystemPrivate::QLinuxFbGraphicsSystemPrivate() { } -QLinuxFbGraphicsSystemPrivate::~QLinuxFbGraphicsSystemPrivate() +QLinuxFbPrivate::~QLinuxFbPrivate() { closeTty(); } -void QLinuxFbGraphicsSystemPrivate::openTty() +void QLinuxFbPrivate::openTty() { const char *const devs[] = {"/dev/tty0", "/dev/tty", "/dev/console", 0}; @@ -139,7 +139,7 @@ void QLinuxFbGraphicsSystemPrivate::openTty() QT_WRITE(ttyfd, termctl, sizeof(termctl)); } -void QLinuxFbGraphicsSystemPrivate::closeTty() +void QLinuxFbPrivate::closeTty() { if (ttyfd == -1) return; @@ -155,9 +155,9 @@ void QLinuxFbGraphicsSystemPrivate::closeTty() ttyfd = -1; } -QLinuxFbGraphicsSystem::QLinuxFbGraphicsSystem() +QLinuxFbIntegration::QLinuxFbIntegration() { - d_ptr = new QLinuxFbGraphicsSystemPrivate(); + d_ptr = new QLinuxFbPrivate(); // XXX QString displaySpec = QString::fromLatin1(qgetenv("QWS_DISPLAY")); @@ -168,20 +168,18 @@ QLinuxFbGraphicsSystem::QLinuxFbGraphicsSystem() // Create a QImage directly on the screen's framebuffer. // This is the blit target for copying windows to the screen. - mPrimaryScreen = new QLinuxFbGraphicsSystemScreen(data, w, h, lstep, - screenFormat); + mPrimaryScreen = new QLinuxFbScreen(data, w, h, lstep, screenFormat); mPrimaryScreen->setPhysicalSize(QSize(physWidth, physHeight)); - mScreens.append(mPrimaryScreen); } -QLinuxFbGraphicsSystem::~QLinuxFbGraphicsSystem() +QLinuxFbIntegration::~QLinuxFbIntegration() { delete mPrimaryScreen; delete d_ptr; } -bool QLinuxFbGraphicsSystem::connect(const QString &displaySpec) +bool QLinuxFbIntegration::connect(const QString &displaySpec) { const QStringList args = displaySpec.split(QLatin1Char(':')); @@ -411,7 +409,7 @@ bool QLinuxFbGraphicsSystem::connect(const QString &displaySpec) return true; } -bool QLinuxFbGraphicsSystem::initDevice() +bool QLinuxFbIntegration::initDevice() { d_ptr->openTty(); @@ -538,7 +536,7 @@ bool QLinuxFbGraphicsSystem::initDevice() return true; } -void QLinuxFbGraphicsSystem::setPixelFormat(struct fb_var_screeninfo info) +void QLinuxFbIntegration::setPixelFormat(struct fb_var_screeninfo info) { const fb_bitfield rgba[4] = { info.red, info.green, info.blue, info.transp }; @@ -626,7 +624,7 @@ void QLinuxFbGraphicsSystem::setPixelFormat(struct fb_var_screeninfo info) screenFormat = format; } -void QLinuxFbGraphicsSystem::createPalette(fb_cmap &cmap, fb_var_screeninfo &vinfo, fb_fix_screeninfo &finfo) +void QLinuxFbIntegration::createPalette(fb_cmap &cmap, fb_var_screeninfo &vinfo, fb_fix_screeninfo &finfo) { if((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4)) { screencols= (vinfo.bits_per_pixel==8) ? 256 : 16; @@ -756,7 +754,7 @@ void QLinuxFbGraphicsSystem::createPalette(fb_cmap &cmap, fb_var_screeninfo &vin } } -void QLinuxFbGraphicsSystem::blank(bool on) +void QLinuxFbIntegration::blank(bool on) { if (d_ptr->blank == on) return; @@ -781,22 +779,22 @@ void QLinuxFbGraphicsSystem::blank(bool on) d_ptr->blank = on; } -QPixmapData *QLinuxFbGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const +QPixmapData *QLinuxFbIntegration::createPixmapData(QPixmapData::PixelType type) const { return new QRasterPixmapData(type); } -QWindowSurface *QLinuxFbGraphicsSystem::createWindowSurface(QWidget *widget) const +QWindowSurface *QLinuxFbIntegration::createWindowSurface(QWidget *widget) const { if (widget->windowType() == Qt::Desktop) return 0; // Don't create an explicit window surface for the destkop. - QGraphicsSystemFbWindowSurface * surface = - new QGraphicsSystemFbWindowSurface(mPrimaryScreen, widget); + QFbWindowSurface * surface = + new QFbWindowSurface(mPrimaryScreen, widget); mPrimaryScreen->addWindowSurface(surface); return surface; } -QLinuxFbGraphicsSystemScreen::QLinuxFbGraphicsSystemScreen(uchar * d, int w, +QLinuxFbScreen::QLinuxFbScreen(uchar * d, int w, int h, int lstep, QImage::Format screenFormat) : compositePainter(0) { data = d; @@ -811,7 +809,7 @@ QLinuxFbGraphicsSystemScreen::QLinuxFbGraphicsSystemScreen(uchar * d, int w, cursor = new QGraphicsSystemSoftwareCursor(this); } -void QLinuxFbGraphicsSystemScreen::setGeometry(QRect rect) +void QLinuxFbScreen::setGeometry(QRect rect) { mGeometry = rect; delete mFbScreenImage; @@ -825,7 +823,7 @@ void QLinuxFbGraphicsSystemScreen::setGeometry(QRect rect) mFormat); } -void QLinuxFbGraphicsSystemScreen::setFormat(QImage::Format format) +void QLinuxFbScreen::setFormat(QImage::Format format) { mFormat = format; delete mFbScreenImage; @@ -839,10 +837,10 @@ void QLinuxFbGraphicsSystemScreen::setFormat(QImage::Format format) mFormat); } -QRegion QLinuxFbGraphicsSystemScreen::doRedraw() +QRegion QLinuxFbScreen::doRedraw() { QRegion touched; - touched = QGraphicsSystemFbScreen::doRedraw(); + touched = QFbPlatformScreen::doRedraw(); if (!compositePainter) { compositePainter = new QPainter(mFbScreenImage); diff --git a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h index cc8ce7e..bb4c920 100644 --- a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h +++ b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h @@ -42,15 +42,15 @@ #ifndef QGRAPHICSSYSTEM_LINUXFB_H #define QGRAPHICSSYSTEM_LINUXFB_H -#include +#include #include "../fb_base/fb_base.h" QT_BEGIN_NAMESPACE -class QLinuxFbGraphicsSystemScreen : public QGraphicsSystemFbScreen +class QLinuxFbScreen : public QFbPlatformScreen { public: - QLinuxFbGraphicsSystemScreen(uchar * d, int w, int h, int lstep, QImage::Format screenFormat); + QLinuxFbScreen(uchar * d, int w, int h, int lstep, QImage::Format screenFormat); void setGeometry(QRect rect); void setFormat(QImage::Format format); @@ -65,26 +65,26 @@ private: QPainter *compositePainter; }; -class QLinuxFbGraphicsSystemPrivate; +class QLinuxFbPrivate; struct fb_cmap; struct fb_var_screeninfo; struct fb_fix_screeninfo; -class QLinuxFbGraphicsSystem : public QGraphicsSystem +class QLinuxFbIntegration : public QPlatformIntegration { public: - QLinuxFbGraphicsSystem(); - ~QLinuxFbGraphicsSystem(); + QLinuxFbIntegration(); + ~QLinuxFbIntegration(); QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QWindowSurface *createWindowSurface(QWidget *widget) const; - QList screens() const { return mScreens; } + QList screens() const { return mScreens; } private: - QLinuxFbGraphicsSystemScreen *mPrimaryScreen; - QList mScreens; - QLinuxFbGraphicsSystemPrivate *d_ptr; + QLinuxFbScreen *mPrimaryScreen; + QList mScreens; + QLinuxFbPrivate *d_ptr; enum PixelType { NormalPixel, BGRPixel }; -- cgit v0.12 From 9020859ae8cf450a8f32608d54adfde089128355 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 9 Apr 2010 12:53:32 +0200 Subject: This seems to fix the resize issues --- src/gui/kernel/qapplication_lite.cpp | 1 + src/gui/painting/qbackingstore.cpp | 19 ++++++++++++++----- .../platforms/testlite/qwindowsurface_testlite.cpp | 1 - 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index c8d65ff..87fa933 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -767,6 +767,7 @@ void QApplicationPrivate::processGeometryChange(QWidget *tlw, const QRect &newRe if (isResize) { QResizeEvent e(tlw->data->crect.size(), cr.size()); QApplication::sendSpontaneousEvent(tlw, &e); + tlw->update(); } if (isMove) { diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index 30c042e..cc16fd0 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -419,9 +419,12 @@ void QWidgetBackingStore::endPaint(const QRegion &cleaned, QWindowSurface *windo QRegion QWidgetBackingStore::dirtyRegion(QWidget *widget) const { const bool widgetDirty = widget && widget != tlw; -#if !defined(Q_WS_LITE) const QRect tlwRect(topLevelRect()); +#if defined(Q_WS_LITE) + const QRect surfaceGeometry(tlwRect.topLeft(), windowSurface->size()); +#else const QRect surfaceGeometry(windowSurface->geometry()); +#endif if (surfaceGeometry != tlwRect && surfaceGeometry.size() != tlwRect.size()) { if (widgetDirty) { const QRect dirtyTlwRect = QRect(QPoint(), tlwRect.size()); @@ -431,7 +434,6 @@ QRegion QWidgetBackingStore::dirtyRegion(QWidget *widget) const } return QRect(QPoint(), tlwRect.size()); } -#endif // Calculate the region that needs repaint. QRegion r(dirty); @@ -1156,11 +1158,14 @@ void QWidgetBackingStore::sync() const bool updatesDisabled = !tlw->updatesEnabled(); bool repaintAllWidgets = false; -#if !defined(Q_WS_LITE) + const bool inTopLevelResize = tlwExtra->inTopLevelResize; const QRect tlwRect(topLevelRect()); +#ifdef Q_WS_LITE + const QRect surfaceGeometry(tlwRect.topLeft(), windowSurface->size()); +#else const QRect surfaceGeometry(windowSurface->geometry()); - +#endif if (inTopLevelResize || surfaceGeometry != tlwRect) { if ((inTopLevelResize || surfaceGeometry.size() != tlwRect.size()) && !updatesDisabled) { if (hasStaticContents()) { @@ -1180,9 +1185,13 @@ void QWidgetBackingStore::sync() repaintAllWidgets = true; } } +#ifdef Q_WS_LITE + windowSurface->resize(tlwRect.size()); +#else windowSurface->setGeometry(tlwRect); - } #endif + } + if (updatesDisabled) return; diff --git a/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp b/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp index 801491c..81fa247 100644 --- a/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp @@ -165,7 +165,6 @@ bool QTestLiteWindowSurface::scroll(const QRegion &area, int dx, int dy) void QTestLiteWindowSurface::beginPaint(const QRegion ®ion) { Q_UNUSED(region); - qDebug() << "QTestLiteWindowSurface::beginPaint" << size(); xw->resizeBuffer(size()); } -- cgit v0.12 From 6dd82100e43749e3bd43b127587aa16a0bc4bbac Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 9 Apr 2010 17:25:22 +0200 Subject: Refactoring TestLite The x11util classes stopped being generic a long time ago. Now that we have a clean separation between surface and window in the API, it makes sense to have the platform-specific logic in the derived classes, instead of having an extra level of indirection. --- .../testlite/qplatformintegration_testlite.cpp | 9 +- src/plugins/platforms/testlite/qtestlitewindow.cpp | 1558 ++++++++++++++++++++ src/plugins/platforms/testlite/qtestlitewindow.h | 157 ++ .../platforms/testlite/qwindowsurface_testlite.cpp | 671 ++------- .../platforms/testlite/qwindowsurface_testlite.h | 54 +- src/plugins/platforms/testlite/testlite.pro | 8 +- src/plugins/platforms/testlite/x11util.cpp | 1215 --------------- src/plugins/platforms/testlite/x11util.h | 204 --- 8 files changed, 1860 insertions(+), 2016 deletions(-) create mode 100644 src/plugins/platforms/testlite/qtestlitewindow.cpp create mode 100644 src/plugins/platforms/testlite/qtestlitewindow.h delete mode 100644 src/plugins/platforms/testlite/x11util.cpp delete mode 100644 src/plugins/platforms/testlite/x11util.h diff --git a/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp b/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp index 3e73821..f9b3135 100644 --- a/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp +++ b/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp @@ -39,6 +39,8 @@ ** ****************************************************************************/ + + #include "qplatformintegration_testlite.h" #include "qwindowsurface_testlite.h" #include @@ -47,7 +49,7 @@ #include -#include "x11util.h" +#include "qtestlitewindow.h" QT_BEGIN_NAMESPACE @@ -105,12 +107,11 @@ QWindowSurface *QTestLiteIntegration::createWindowSurfaceForWindow(QWidget *widg { if (widget->windowType() == Qt::Desktop) return 0; // Don't create an explicit window surface for the destkop. - return new QTestLiteWindowSurface - (const_cast(this), mPrimaryScreen, widget); + return new QTestLiteWindowSurface(mPrimaryScreen, widget); } -QPlatformWindow *QTestLiteIntegration::createPlatformWindow(QWidget *widget, WId winId) const +QPlatformWindow *QTestLiteIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const { return new QTestLiteWindow(const_cast(this), mPrimaryScreen, widget); } diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp new file mode 100644 index 0000000..db3904f --- /dev/null +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -0,0 +1,1558 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsurface_testlite.h" +#include "qplatformintegration_testlite.h" +#include + +#include "qtestlitewindow.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + + +#include + +#include + + + +//### remove stuff we don't want from qt_x11_p.h +#undef ATOM +#undef X11 + +QT_BEGIN_NAMESPACE + +static int (*original_x_errhandler)(Display *dpy, XErrorEvent *); +static bool seen_badwindow; + + +static Atom wmProtocolsAtom; +static Atom wmDeleteWindowAtom; + + + +class MyX11CursorNode +{ +public: + MyX11CursorNode(int id, Cursor c) { idValue = id; cursorValue = c; refCount = 1; } + QDateTime expiration() { return t; } + void setExpiration(QDateTime val) { t = val; } + MyX11CursorNode * ante() { return before; } + void setAnte(MyX11CursorNode *node) { before = node; } + MyX11CursorNode * post() { return after; } + void setPost(MyX11CursorNode *node) { after = node; } + Cursor cursor() { return cursorValue; } + int id() { return idValue; } + unsigned int refCount; + +private: + MyX11CursorNode *before; + MyX11CursorNode *after; + QDateTime t; + Cursor cursorValue; + int idValue; + + Display * display; +}; + + + + + +class MyX11Cursors : public QObject +{ + Q_OBJECT +public: + MyX11Cursors(Display * d); + ~MyX11Cursors() { timer.stop(); } + void incrementUseCount(int id); + void decrementUseCount(int id); + void createNode(int id, Cursor c); + bool exists(int id) { return lookupMap.contains(id); } + Cursor cursor(int id); +public slots: + void timeout(); + +private: + void removeNode(MyX11CursorNode *node); + void insertNode(MyX11CursorNode *node); + + // linked list of cursors currently not assigned to any window + MyX11CursorNode *firstExpired; + MyX11CursorNode *lastExpired; + + QHash lookupMap; + QTimer timer; + + Display *display; + + int removalDelay; +}; + + + + + +QTestLiteWindow::QTestLiteWindow(QTestLiteIntegration *platformIntegration, + QTestLiteScreen */*screen*/, QWidget *window) + :QPlatformWindow(window) +{ + xd = platformIntegration->xd; + xd->windowList.append(this); + { + int x = 0; + int y = 0; + int w = 300; + int h = 300; //### + + x_window = XCreateSimpleWindow(xd->display, xd->rootWindow(), + x, y, w, h, 0 /*border_width*/, + xd->blackPixel(), xd->whitePixel()); + + } + + width = -1; + height = -1; + xpos = -1; + ypos = -1; + + XSetWindowBackgroundPixmap(xd->display, x_window, XNone); + + XSelectInput(xd->display, x_window, ExposureMask | KeyPressMask | KeyReleaseMask | + EnterWindowMask | LeaveWindowMask | FocusChangeMask | + PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | + StructureNotifyMask); + + gc = createGC(); + + XChangeProperty (xd->display, x_window, + wmProtocolsAtom, + XA_ATOM, 32, PropModeAppend, + (unsigned char *) &wmDeleteWindowAtom, 1); + + + setWindowTitle(QLatin1String("Qt Lighthouse")); + + currentCursor = -1; + windowSurface = 0; + + setWindowFlags(window->windowFlags()); //##### This should not be the plugin's responsibility + + //xw->windowTL = this; +} + + +QTestLiteWindow::~QTestLiteWindow() +{ +#ifdef MYX11_DEBUG + qDebug() << "~QTestLiteWindow" << hex << x_window; +#endif + XFreeGC(xd->display, gc); + XDestroyWindow(xd->display, x_window); + + xd->windowList.removeAll(this); +} + + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Mouse event stuff + + + + +static Qt::MouseButtons translateMouseButtons(int s) +{ + Qt::MouseButtons ret = 0; + if (s & Button1Mask) + ret |= Qt::LeftButton; + if (s & Button2Mask) + ret |= Qt::MidButton; + if (s & Button3Mask) + ret |= Qt::RightButton; + return ret; +} + + +static Qt::KeyboardModifiers translateModifiers(int s) +{ + const uchar qt_alt_mask = Mod1Mask; + const uchar qt_meta_mask = Mod4Mask; + + + Qt::KeyboardModifiers ret = 0; + if (s & ShiftMask) + ret |= Qt::ShiftModifier; + if (s & ControlMask) + ret |= Qt::ControlModifier; + if (s & qt_alt_mask) + ret |= Qt::AltModifier; + if (s & qt_meta_mask) + ret |= Qt::MetaModifier; +#if 0 + if (s & qt_mode_switch_mask) + ret |= Qt::GroupSwitchModifier; +#endif + return ret; +} + +void QTestLiteWindow::handleMouseEvent(QEvent::Type type, XButtonEvent *e) +{ + static QPoint mousePoint; + + Qt::MouseButton button = Qt::NoButton; + Qt::MouseButtons buttons = translateMouseButtons(e->state); + Qt::KeyboardModifiers modifiers = translateModifiers(e->state); + if (type != QEvent::MouseMove) { + switch (e->button) { + case Button1: button = Qt::LeftButton; break; + case Button2: button = Qt::MidButton; break; + case Button3: button = Qt::RightButton; break; + case Button4: + case Button5: + case 6: + case 7: { + //mouse wheel + if (type == QEvent::MouseButtonPress) { + //logic borrowed from qapplication_x11.cpp + int delta = 120 * ((e->button == Button4 || e->button == 6) ? 1 : -1); + bool hor = (((e->button == Button4 || e->button == Button5) + && (modifiers & Qt::AltModifier)) + || (e->button == 6 || e->button == 7)); + QWindowSystemInterface::handleWheelEvent(widget(), e->time, + QPoint(e->x, e->y), + QPoint(e->x_root, e->y_root), + delta, hor ? Qt::Horizontal : Qt::Vertical); + } + return; + } + default: break; + } + } + + buttons ^= button; // X event uses state *before*, Qt uses state *after* + + QWindowSystemInterface::handleMouseEvent(widget(), e->time, QPoint(e->x, e->y), + QPoint(e->x_root, e->y_root), + buttons); + + mousePoint = QPoint(e->x_root, e->y_root); +} + +void QTestLiteWindow::handleCloseEvent() +{ + QWindowSystemInterface::handleCloseEvent(widget()); +} + + +void QTestLiteWindow::handleEnterEvent() +{ + QWindowSystemInterface::handleEnterEvent(widget()); +} + +void QTestLiteWindow::handleLeaveEvent() +{ + QWindowSystemInterface::handleLeaveEvent(widget()); +} + + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Key event stuff -- not pretty either +// +// What we want to do is to port Robert's keytable code properly + +// keyboard mapping table +static const unsigned int keyTbl[] = { + + // misc keys + + XK_Escape, Qt::Key_Escape, + XK_Tab, Qt::Key_Tab, + XK_ISO_Left_Tab, Qt::Key_Backtab, + XK_BackSpace, Qt::Key_Backspace, + XK_Return, Qt::Key_Return, + XK_Insert, Qt::Key_Insert, + XK_Delete, Qt::Key_Delete, + XK_Clear, Qt::Key_Delete, + XK_Pause, Qt::Key_Pause, + XK_Print, Qt::Key_Print, + 0x1005FF60, Qt::Key_SysReq, // hardcoded Sun SysReq + 0x1007ff00, Qt::Key_SysReq, // hardcoded X386 SysReq + + // cursor movement + + XK_Home, Qt::Key_Home, + XK_End, Qt::Key_End, + XK_Left, Qt::Key_Left, + XK_Up, Qt::Key_Up, + XK_Right, Qt::Key_Right, + XK_Down, Qt::Key_Down, + XK_Prior, Qt::Key_PageUp, + XK_Next, Qt::Key_PageDown, + + // modifiers + + XK_Shift_L, Qt::Key_Shift, + XK_Shift_R, Qt::Key_Shift, + XK_Shift_Lock, Qt::Key_Shift, + XK_Control_L, Qt::Key_Control, + XK_Control_R, Qt::Key_Control, + XK_Meta_L, Qt::Key_Meta, + XK_Meta_R, Qt::Key_Meta, + XK_Alt_L, Qt::Key_Alt, + XK_Alt_R, Qt::Key_Alt, + XK_Caps_Lock, Qt::Key_CapsLock, + XK_Num_Lock, Qt::Key_NumLock, + XK_Scroll_Lock, Qt::Key_ScrollLock, + XK_Super_L, Qt::Key_Super_L, + XK_Super_R, Qt::Key_Super_R, + XK_Menu, Qt::Key_Menu, + XK_Hyper_L, Qt::Key_Hyper_L, + XK_Hyper_R, Qt::Key_Hyper_R, + XK_Help, Qt::Key_Help, + 0x1000FF74, Qt::Key_Backtab, // hardcoded HP backtab + 0x1005FF10, Qt::Key_F11, // hardcoded Sun F36 (labeled F11) + 0x1005FF11, Qt::Key_F12, // hardcoded Sun F37 (labeled F12) + + // numeric and function keypad keys + + XK_KP_Space, Qt::Key_Space, + XK_KP_Tab, Qt::Key_Tab, + XK_KP_Enter, Qt::Key_Enter, + //XK_KP_F1, Qt::Key_F1, + //XK_KP_F2, Qt::Key_F2, + //XK_KP_F3, Qt::Key_F3, + //XK_KP_F4, Qt::Key_F4, + XK_KP_Home, Qt::Key_Home, + XK_KP_Left, Qt::Key_Left, + XK_KP_Up, Qt::Key_Up, + XK_KP_Right, Qt::Key_Right, + XK_KP_Down, Qt::Key_Down, + XK_KP_Prior, Qt::Key_PageUp, + XK_KP_Next, Qt::Key_PageDown, + XK_KP_End, Qt::Key_End, + XK_KP_Begin, Qt::Key_Clear, + XK_KP_Insert, Qt::Key_Insert, + XK_KP_Delete, Qt::Key_Delete, + XK_KP_Equal, Qt::Key_Equal, + XK_KP_Multiply, Qt::Key_Asterisk, + XK_KP_Add, Qt::Key_Plus, + XK_KP_Separator, Qt::Key_Comma, + XK_KP_Subtract, Qt::Key_Minus, + XK_KP_Decimal, Qt::Key_Period, + XK_KP_Divide, Qt::Key_Slash, + + // International input method support keys + + // International & multi-key character composition + XK_ISO_Level3_Shift, Qt::Key_AltGr, + XK_Multi_key, Qt::Key_Multi_key, + XK_Codeinput, Qt::Key_Codeinput, + XK_SingleCandidate, Qt::Key_SingleCandidate, + XK_MultipleCandidate, Qt::Key_MultipleCandidate, + XK_PreviousCandidate, Qt::Key_PreviousCandidate, + + // Misc Functions + XK_Mode_switch, Qt::Key_Mode_switch, + XK_script_switch, Qt::Key_Mode_switch, + + // Japanese keyboard support + XK_Kanji, Qt::Key_Kanji, + XK_Muhenkan, Qt::Key_Muhenkan, + //XK_Henkan_Mode, Qt::Key_Henkan_Mode, + XK_Henkan_Mode, Qt::Key_Henkan, + XK_Henkan, Qt::Key_Henkan, + XK_Romaji, Qt::Key_Romaji, + XK_Hiragana, Qt::Key_Hiragana, + XK_Katakana, Qt::Key_Katakana, + XK_Hiragana_Katakana, Qt::Key_Hiragana_Katakana, + XK_Zenkaku, Qt::Key_Zenkaku, + XK_Hankaku, Qt::Key_Hankaku, + XK_Zenkaku_Hankaku, Qt::Key_Zenkaku_Hankaku, + XK_Touroku, Qt::Key_Touroku, + XK_Massyo, Qt::Key_Massyo, + XK_Kana_Lock, Qt::Key_Kana_Lock, + XK_Kana_Shift, Qt::Key_Kana_Shift, + XK_Eisu_Shift, Qt::Key_Eisu_Shift, + XK_Eisu_toggle, Qt::Key_Eisu_toggle, + //XK_Kanji_Bangou, Qt::Key_Kanji_Bangou, + //XK_Zen_Koho, Qt::Key_Zen_Koho, + //XK_Mae_Koho, Qt::Key_Mae_Koho, + XK_Kanji_Bangou, Qt::Key_Codeinput, + XK_Zen_Koho, Qt::Key_MultipleCandidate, + XK_Mae_Koho, Qt::Key_PreviousCandidate, + +#ifdef XK_KOREAN + // Korean keyboard support + XK_Hangul, Qt::Key_Hangul, + XK_Hangul_Start, Qt::Key_Hangul_Start, + XK_Hangul_End, Qt::Key_Hangul_End, + XK_Hangul_Hanja, Qt::Key_Hangul_Hanja, + XK_Hangul_Jamo, Qt::Key_Hangul_Jamo, + XK_Hangul_Romaja, Qt::Key_Hangul_Romaja, + //XK_Hangul_Codeinput, Qt::Key_Hangul_Codeinput, + XK_Hangul_Codeinput, Qt::Key_Codeinput, + XK_Hangul_Jeonja, Qt::Key_Hangul_Jeonja, + XK_Hangul_Banja, Qt::Key_Hangul_Banja, + XK_Hangul_PreHanja, Qt::Key_Hangul_PreHanja, + XK_Hangul_PostHanja, Qt::Key_Hangul_PostHanja, + //XK_Hangul_SingleCandidate,Qt::Key_Hangul_SingleCandidate, + //XK_Hangul_MultipleCandidate,Qt::Key_Hangul_MultipleCandidate, + //XK_Hangul_PreviousCandidate,Qt::Key_Hangul_PreviousCandidate, + XK_Hangul_SingleCandidate, Qt::Key_SingleCandidate, + XK_Hangul_MultipleCandidate,Qt::Key_MultipleCandidate, + XK_Hangul_PreviousCandidate,Qt::Key_PreviousCandidate, + XK_Hangul_Special, Qt::Key_Hangul_Special, + //XK_Hangul_switch, Qt::Key_Hangul_switch, + XK_Hangul_switch, Qt::Key_Mode_switch, +#endif // XK_KOREAN + + // dead keys + XK_dead_grave, Qt::Key_Dead_Grave, + XK_dead_acute, Qt::Key_Dead_Acute, + XK_dead_circumflex, Qt::Key_Dead_Circumflex, + XK_dead_tilde, Qt::Key_Dead_Tilde, + XK_dead_macron, Qt::Key_Dead_Macron, + XK_dead_breve, Qt::Key_Dead_Breve, + XK_dead_abovedot, Qt::Key_Dead_Abovedot, + XK_dead_diaeresis, Qt::Key_Dead_Diaeresis, + XK_dead_abovering, Qt::Key_Dead_Abovering, + XK_dead_doubleacute, Qt::Key_Dead_Doubleacute, + XK_dead_caron, Qt::Key_Dead_Caron, + XK_dead_cedilla, Qt::Key_Dead_Cedilla, + XK_dead_ogonek, Qt::Key_Dead_Ogonek, + XK_dead_iota, Qt::Key_Dead_Iota, + XK_dead_voiced_sound, Qt::Key_Dead_Voiced_Sound, + XK_dead_semivoiced_sound, Qt::Key_Dead_Semivoiced_Sound, + XK_dead_belowdot, Qt::Key_Dead_Belowdot, + XK_dead_hook, Qt::Key_Dead_Hook, + XK_dead_horn, Qt::Key_Dead_Horn, + +#if 0 + // Special multimedia keys + // currently only tested with MS internet keyboard + + // browsing keys + XF86XK_Back, Qt::Key_Back, + XF86XK_Forward, Qt::Key_Forward, + XF86XK_Stop, Qt::Key_Stop, + XF86XK_Refresh, Qt::Key_Refresh, + XF86XK_Favorites, Qt::Key_Favorites, + XF86XK_AudioMedia, Qt::Key_LaunchMedia, + XF86XK_OpenURL, Qt::Key_OpenUrl, + XF86XK_HomePage, Qt::Key_HomePage, + XF86XK_Search, Qt::Key_Search, + + // media keys + XF86XK_AudioLowerVolume, Qt::Key_VolumeDown, + XF86XK_AudioMute, Qt::Key_VolumeMute, + XF86XK_AudioRaiseVolume, Qt::Key_VolumeUp, + XF86XK_AudioPlay, Qt::Key_MediaPlay, + XF86XK_AudioStop, Qt::Key_MediaStop, + XF86XK_AudioPrev, Qt::Key_MediaPrevious, + XF86XK_AudioNext, Qt::Key_MediaNext, + XF86XK_AudioRecord, Qt::Key_MediaRecord, + + // launch keys + XF86XK_Mail, Qt::Key_LaunchMail, + XF86XK_MyComputer, Qt::Key_Launch0, + XF86XK_Calculator, Qt::Key_Launch1, + XF86XK_Standby, Qt::Key_Standby, + + XF86XK_Launch0, Qt::Key_Launch2, + XF86XK_Launch1, Qt::Key_Launch3, + XF86XK_Launch2, Qt::Key_Launch4, + XF86XK_Launch3, Qt::Key_Launch5, + XF86XK_Launch4, Qt::Key_Launch6, + XF86XK_Launch5, Qt::Key_Launch7, + XF86XK_Launch6, Qt::Key_Launch8, + XF86XK_Launch7, Qt::Key_Launch9, + XF86XK_Launch8, Qt::Key_LaunchA, + XF86XK_Launch9, Qt::Key_LaunchB, + XF86XK_LaunchA, Qt::Key_LaunchC, + XF86XK_LaunchB, Qt::Key_LaunchD, + XF86XK_LaunchC, Qt::Key_LaunchE, + XF86XK_LaunchD, Qt::Key_LaunchF, +#endif + +#if 0 + // Qtopia keys + QTOPIAXK_Select, Qt::Key_Select, + QTOPIAXK_Yes, Qt::Key_Yes, + QTOPIAXK_No, Qt::Key_No, + QTOPIAXK_Cancel, Qt::Key_Cancel, + QTOPIAXK_Printer, Qt::Key_Printer, + QTOPIAXK_Execute, Qt::Key_Execute, + QTOPIAXK_Sleep, Qt::Key_Sleep, + QTOPIAXK_Play, Qt::Key_Play, + QTOPIAXK_Zoom, Qt::Key_Zoom, + QTOPIAXK_Context1, Qt::Key_Context1, + QTOPIAXK_Context2, Qt::Key_Context2, + QTOPIAXK_Context3, Qt::Key_Context3, + QTOPIAXK_Context4, Qt::Key_Context4, + QTOPIAXK_Call, Qt::Key_Call, + QTOPIAXK_Hangup, Qt::Key_Hangup, + QTOPIAXK_Flip, Qt::Key_Flip, +#endif + 0, 0 +}; + + +static int lookupCode(unsigned int xkeycode) +{ + if (xkeycode >= XK_F1 && xkeycode <= XK_F35) + return Qt::Key_F1 + (int(xkeycode) - XK_F1); + + const unsigned int *p = keyTbl; + while (*p) { + if (*p == xkeycode) + return *++p; + p += 2; + } + + return 0; +} + + +static Qt::KeyboardModifiers modifierFromKeyCode(int qtcode) +{ + switch (qtcode) { + case Qt::Key_Control: + return Qt::ControlModifier; + case Qt::Key_Alt: + return Qt::AltModifier; + case Qt::Key_Shift: + return Qt::ShiftModifier; + case Qt::Key_Meta: + return Qt::MetaModifier; + default: + return Qt::NoModifier; + } +} + +void QTestLiteWindow::handleKeyEvent(QEvent::Type type, void *ev) +{ + XKeyEvent *e = static_cast(ev); + + KeySym keySym; + QByteArray chars; + chars.resize(513); + + int count = XLookupString(e, chars.data(), chars.size(), &keySym, 0); + Q_UNUSED(count); +// qDebug() << "QTLWS::handleKeyEvent" << count << hex << "XKeysym:" << keySym; +// if (count) +// qDebug() << hex << int(chars[0]) << "String:" << chars; + + Qt::KeyboardModifiers modifiers = translateModifiers(e->state); + + int qtcode = lookupCode(keySym); +// qDebug() << "lookup: " << hex << keySym << qtcode << "mod" << modifiers; + + //X11 specifies state *before*, Qt expects state *after* the event + + modifiers ^= modifierFromKeyCode(qtcode); + + if (qtcode) { + QWindowSystemInterface::handleKeyEvent(widget(), e->time, type, qtcode, modifiers); + } else if (chars[0]) { + int qtcode = chars.toUpper()[0]; //Not exactly right... + if (modifiers & Qt::ControlModifier && qtcode < ' ') + qtcode = chars[0] + '@'; + QWindowSystemInterface::handleKeyEvent(widget(), e->time, type, qtcode, modifiers, QString::fromLatin1(chars)); + } else { + qWarning() << "unknown X keycode" << hex << e->keycode << keySym; + } +} + +void QTestLiteWindow::setGeometry(const QRect &rect) +{ + QRect oldRect = geometry(); + if (rect == oldRect) + return; + + //if unchanged ### + XMoveResizeWindow(xd->display, x_window, rect.x(), rect.y(), rect.width(), rect.height()); +} + + +Qt::WindowFlags QTestLiteWindow::windowFlags() const +{ + return window_flags; +} + +WId QTestLiteWindow::winId() const +{ + return x_window; +} + +void QTestLiteWindow::raise() +{ + XRaiseWindow(mPlatformIntegration->xd->display, x_window); +} + +void QTestLiteWindow::lower() +{ + XLowerWindow(mPlatformIntegration->xd->display, x_window); +} + +void QTestLiteWindow::setWindowTitle(const QString &title) +{ + QByteArray ba = title.toLatin1(); //We're not making a general solution here... + XTextProperty windowName; + windowName.value = (unsigned char *)ba.constData(); + windowName.encoding = XA_STRING; + windowName.format = 8; + windowName.nitems = ba.length(); + + XSetWMName(xd->display, x_window, &windowName); +} + + + +GC QTestLiteWindow::createGC() +{ + GC gc; + + gc = XCreateGC(xd->display, x_window, 0, 0); + if (gc < 0) { + qWarning("QTestLiteWindow::createGC() could not create GC"); + } + return gc; +} + + +void QTestLiteWindow::paintEvent() +{ +#ifdef MYX11_DEBUG + qDebug() << "QTestLiteWindow::paintEvent" << shm_img.size() << painted; +#endif + + windowSurface->flush(windowSurface->window(), QRect(xpos,ypos,width, height), QPoint()); +} + + +void QTestLiteWindow::resizeEvent(XConfigureEvent *e) +{ + + if ((e->width != width || e->height != height) && e->x == 0 && e->y == 0) { + //qDebug() << "resize with bogus pos" << e->x << e->y << e->width << e->height << "window"<< hex << window; + } else { + //qDebug() << "geometry change" << e->x << e->y << e->width << e->height << "window"<< hex << window; + xpos = e->x; + ypos = e->y; + } + width = e->width; + height = e->height; + +#ifdef MYX11_DEBUG + qDebug() << hex << window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << "geometry" << xpos << ypos << width << height << "img:" << shm_img.size(); +#endif + + QWindowSystemInterface::handleGeometryChange(widget(), QRect(xpos, ypos, width, height)); +} + + +void QTestLiteWindow::mousePressEvent(XButtonEvent *e) +{ + static long prevTime = 0; + static Window prevWindow; + static int prevX = -999; + static int prevY = -999; + + QEvent::Type type = QEvent::MouseButtonPress; + + if (e->window == prevWindow && long(e->time) - prevTime < QApplication::doubleClickInterval() + && qAbs(e->x - prevX) < 5 && qAbs(e->y - prevY) < 5) { + type = QEvent::MouseButtonDblClick; + prevTime = e->time - QApplication::doubleClickInterval(); //no double click next time + } else { + prevTime = e->time; + } + prevWindow = e->window; + prevX = e->x; + prevY = e->y; + + handleMouseEvent(type, e); +} + + + +// WindowFlag stuff, lots of copied code from qwidget_x11.cpp... + +//We're hacking here... + + +// MWM support +struct QtMWMHints { + ulong flags, functions, decorations; + long input_mode; + ulong status; +}; + +enum { + MWM_HINTS_FUNCTIONS = (1L << 0), + + MWM_FUNC_ALL = (1L << 0), + MWM_FUNC_RESIZE = (1L << 1), + MWM_FUNC_MOVE = (1L << 2), + MWM_FUNC_MINIMIZE = (1L << 3), + MWM_FUNC_MAXIMIZE = (1L << 4), + MWM_FUNC_CLOSE = (1L << 5), + + MWM_HINTS_DECORATIONS = (1L << 1), + + MWM_DECOR_ALL = (1L << 0), + MWM_DECOR_BORDER = (1L << 1), + MWM_DECOR_RESIZEH = (1L << 2), + MWM_DECOR_TITLE = (1L << 3), + MWM_DECOR_MENU = (1L << 4), + MWM_DECOR_MINIMIZE = (1L << 5), + MWM_DECOR_MAXIMIZE = (1L << 6), + + MWM_HINTS_INPUT_MODE = (1L << 2), + + MWM_INPUT_MODELESS = 0L, + MWM_INPUT_PRIMARY_APPLICATION_MODAL = 1L, + MWM_INPUT_FULL_APPLICATION_MODAL = 3L +}; + +static Atom mwm_hint_atom = XNone; + +#if 0 +static QtMWMHints GetMWMHints(Display *display, Window window) +{ + QtMWMHints mwmhints; + + Atom type; + int format; + ulong nitems, bytesLeft; + uchar *data = 0; + if ((XGetWindowProperty(display, window, mwm_hint_atom, 0, 5, false, + mwm_hint_atom, &type, &format, &nitems, &bytesLeft, + &data) == Success) + && (type == mwm_hint_atom + && format == 32 + && nitems >= 5)) { + mwmhints = *(reinterpret_cast(data)); + } else { + mwmhints.flags = 0L; + mwmhints.functions = MWM_FUNC_ALL; + mwmhints.decorations = MWM_DECOR_ALL; + mwmhints.input_mode = 0L; + mwmhints.status = 0L; + } + + if (data) + XFree(data); + + return mwmhints; +} +#endif + +static void SetMWMHints(Display *display, Window window, const QtMWMHints &mwmhints) +{ + if (mwmhints.flags != 0l) { + XChangeProperty(display, window, mwm_hint_atom, mwm_hint_atom, 32, + PropModeReplace, (unsigned char *) &mwmhints, 5); + } else { + XDeleteProperty(display, window, mwm_hint_atom); + } +} + +// Returns true if we should set WM_TRANSIENT_FOR on \a w +static inline bool isTransient(const QWidget *w) +{ + return ((w->windowType() == Qt::Dialog + || w->windowType() == Qt::Sheet + || w->windowType() == Qt::Tool + || w->windowType() == Qt::SplashScreen + || w->windowType() == Qt::ToolTip + || w->windowType() == Qt::Drawer + || w->windowType() == Qt::Popup) + && !w->testAttribute(Qt::WA_X11BypassTransientForHint)); +} + + + +Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) +{ + Q_ASSERT(flags & Qt::Window); + window_flags = flags; + + if (mwm_hint_atom == XNone) { + mwm_hint_atom = XInternAtom(xd->display, "_MOTIF_WM_HINTS\0", False); + } + +#ifdef MYX11_DEBUG + qDebug() << "QTestLiteWindow::setWindowFlags" << hex << window << "flags" << flags; +#endif + Qt::WindowType type = static_cast(int(flags & Qt::WindowType_Mask)); + + if (type == Qt::ToolTip) + flags |= Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint; + if (type == Qt::Popup) + flags |= Qt::X11BypassWindowManagerHint; + + bool topLevel = (flags & Qt::Window); + bool popup = (type == Qt::Popup); + bool dialog = (type == Qt::Dialog + || type == Qt::Sheet); + bool desktop = (type == Qt::Desktop); + bool tool = (type == Qt::Tool || type == Qt::SplashScreen + || type == Qt::ToolTip || type == Qt::Drawer); + + + Q_UNUSED(topLevel); + Q_UNUSED(dialog); + Q_UNUSED(desktop); + + + bool tooltip = (type == Qt::ToolTip); + + XSetWindowAttributes wsa; + + QtMWMHints mwmhints; + mwmhints.flags = 0L; + mwmhints.functions = 0L; + mwmhints.decorations = 0; + mwmhints.input_mode = 0L; + mwmhints.status = 0L; + + + ulong wsa_mask = 0; + if (type != Qt::SplashScreen) { // && customize) { + mwmhints.flags |= MWM_HINTS_DECORATIONS; + + bool customize = flags & Qt::CustomizeWindowHint; + if (!(flags & Qt::FramelessWindowHint) && !(customize && !(flags & Qt::WindowTitleHint))) { + mwmhints.decorations |= MWM_DECOR_BORDER; + mwmhints.decorations |= MWM_DECOR_RESIZEH; + + if (flags & Qt::WindowTitleHint) + mwmhints.decorations |= MWM_DECOR_TITLE; + + if (flags & Qt::WindowSystemMenuHint) + mwmhints.decorations |= MWM_DECOR_MENU; + + if (flags & Qt::WindowMinimizeButtonHint) { + mwmhints.decorations |= MWM_DECOR_MINIMIZE; + mwmhints.functions |= MWM_FUNC_MINIMIZE; + } + + if (flags & Qt::WindowMaximizeButtonHint) { + mwmhints.decorations |= MWM_DECOR_MAXIMIZE; + mwmhints.functions |= MWM_FUNC_MAXIMIZE; + } + + if (flags & Qt::WindowCloseButtonHint) + mwmhints.functions |= MWM_FUNC_CLOSE; + } + } else { + // if type == Qt::SplashScreen + mwmhints.decorations = MWM_DECOR_ALL; + } + + if (tool) { + wsa.save_under = True; + wsa_mask |= CWSaveUnder; + } + + if (flags & Qt::X11BypassWindowManagerHint) { + wsa.override_redirect = True; + wsa_mask |= CWOverrideRedirect; + } +#if 0 + if (wsa_mask && initializeWindow) { + Q_ASSERT(id); + XChangeWindowAttributes(dpy, id, wsa_mask, &wsa); + } +#endif + if (mwmhints.functions != 0) { + mwmhints.flags |= MWM_HINTS_FUNCTIONS; + mwmhints.functions |= MWM_FUNC_MOVE | MWM_FUNC_RESIZE; + } else { + mwmhints.functions = MWM_FUNC_ALL; + } + + if (!(flags & Qt::FramelessWindowHint) + && flags & Qt::CustomizeWindowHint + && flags & Qt::WindowTitleHint + && !(flags & + (Qt::WindowMinimizeButtonHint + | Qt::WindowMaximizeButtonHint + | Qt::WindowCloseButtonHint))) { + // a special case - only the titlebar without any button + mwmhints.flags = MWM_HINTS_FUNCTIONS; + mwmhints.functions = MWM_FUNC_MOVE | MWM_FUNC_RESIZE; + mwmhints.decorations = 0; + } + + SetMWMHints(xd->display, x_window, mwmhints); + +//##### only if initializeWindow??? + + if (popup || tooltip) { // popup widget +#ifdef MYX11_DEBUG + qDebug() << "Doing XChangeWindowAttributes for popup" << wsa.override_redirect; +#endif + // set EWMH window types + // setNetWmWindowTypes(); + + wsa.override_redirect = True; + wsa.save_under = True; + XChangeWindowAttributes(xd->display, x_window, CWOverrideRedirect | CWSaveUnder, + &wsa); + } else { +#ifdef MYX11_DEBUG + qDebug() << "Doing XChangeWindowAttributes for non-popup"; +#endif + } + + return flags; +} + +void QTestLiteWindow::setVisible(bool visible) +{ +#ifdef MYX11_DEBUG + qDebug() << "QTestLiteWindow::setVisible" << visible << hex << window; +#endif + if (visible) + XMapWindow(xd->display, x_window); + else + XUnmapWindow(xd->display, x_window); +} + + +void QTestLiteWindow::setCursor(QCursor * cursor) +{ + int id = cursor->handle(); + if (id == currentCursor) + return; + Cursor c; + if (!xd->cursors->exists(id)) { + if (cursor->shape() == Qt::BitmapCursor) + c = createCursorBitmap(cursor); + else + c = createCursorShape(cursor->shape()); + if (!c) { + return; + } + xd->cursors->createNode(id, c); + } else { + xd->cursors->incrementUseCount(id); + c = xd->cursors->cursor(id); + } + + if (currentCursor != -1) + xd->cursors->decrementUseCount(currentCursor); + currentCursor = id; + + XDefineCursor(xd->display, x_window, c); + XFlush(xd->display); +} + +Cursor QTestLiteWindow::createCursorBitmap(QCursor * cursor) +{ + XColor bg, fg; + bg.red = 255 << 8; + bg.green = 255 << 8; + bg.blue = 255 << 8; + fg.red = 0; + fg.green = 0; + fg.blue = 0; + QPoint spot = cursor->hotSpot(); + Window rootwin = x_window; + + QImage mapImage = cursor->bitmap()->toImage().convertToFormat(QImage::Format_MonoLSB); + QImage maskImage = cursor->mask()->toImage().convertToFormat(QImage::Format_MonoLSB); + + int width = cursor->bitmap()->width(); + int height = cursor->bitmap()->height(); + int bytesPerLine = mapImage.bytesPerLine(); + int destLineSize = width / 8; + if (width % 8) + destLineSize++; + + const uchar * map = mapImage.bits(); + const uchar * mask = maskImage.bits(); + + char * mapBits = new char[height * destLineSize]; + char * maskBits = new char[height * destLineSize]; + for (int i = 0; i < height; i++) { + memcpy(mapBits + (destLineSize * i),map + (bytesPerLine * i), destLineSize); + memcpy(maskBits + (destLineSize * i),mask + (bytesPerLine * i), destLineSize); + } + + Pixmap cp = XCreateBitmapFromData(xd->display, rootwin, mapBits, width, height); + Pixmap mp = XCreateBitmapFromData(xd->display, rootwin, maskBits, width, height); + Cursor c = XCreatePixmapCursor(xd->display, cp, mp, &fg, &bg, spot.x(), spot.y()); + XFreePixmap(xd->display, cp); + XFreePixmap(xd->display, mp); + delete[] mapBits; + delete[] maskBits; + + return c; +} + +Cursor QTestLiteWindow::createCursorShape(int cshape) +{ + Cursor cursor = 0; + + if (cshape < 0 || cshape > Qt::LastCursor) + return 0; + + switch (cshape) { + case Qt::ArrowCursor: + cursor = XCreateFontCursor(xd->display, XC_left_ptr); + break; + case Qt::UpArrowCursor: + cursor = XCreateFontCursor(xd->display, XC_center_ptr); + break; + case Qt::CrossCursor: + cursor = XCreateFontCursor(xd->display, XC_crosshair); + break; + case Qt::WaitCursor: + cursor = XCreateFontCursor(xd->display, XC_watch); + break; + case Qt::IBeamCursor: + cursor = XCreateFontCursor(xd->display, XC_xterm); + break; + case Qt::SizeAllCursor: + cursor = XCreateFontCursor(xd->display, XC_fleur); + break; + case Qt::PointingHandCursor: + cursor = XCreateFontCursor(xd->display, XC_hand2); + break; + case Qt::SizeBDiagCursor: + cursor = XCreateFontCursor(xd->display, XC_top_right_corner); + break; + case Qt::SizeFDiagCursor: + cursor = XCreateFontCursor(xd->display, XC_bottom_right_corner); + break; + case Qt::SizeVerCursor: + case Qt::SplitVCursor: + cursor = XCreateFontCursor(xd->display, XC_sb_v_double_arrow); + break; + case Qt::SizeHorCursor: + case Qt::SplitHCursor: + cursor = XCreateFontCursor(xd->display, XC_sb_h_double_arrow); + break; + case Qt::WhatsThisCursor: + cursor = XCreateFontCursor(xd->display, XC_question_arrow); + break; + case Qt::ForbiddenCursor: + cursor = XCreateFontCursor(xd->display, XC_circle); + break; + case Qt::BusyCursor: + cursor = XCreateFontCursor(xd->display, XC_watch); + break; + + default: //default cursor for all the rest + break; + } + return cursor; +} + + +MyX11Cursors::MyX11Cursors(Display * d) : firstExpired(0), lastExpired(0), display(d), removalDelay(3) +{ + connect(&timer, SIGNAL(timeout()), this, SLOT(timeout())); +} + +void MyX11Cursors::insertNode(MyX11CursorNode * node) +{ + QDateTime now = QDateTime::currentDateTime(); + QDateTime timeout = now.addSecs(removalDelay); + node->setExpiration(timeout); + node->setPost(0); + if (lastExpired) { + lastExpired->setPost(node); + node->setAnte(lastExpired); + } + lastExpired = node; + if (!firstExpired) { + firstExpired = node; + node->setAnte(0); + int interval = removalDelay * 1000; + timer.setInterval(interval); + timer.start(); + } +} + +void MyX11Cursors::removeNode(MyX11CursorNode * node) +{ + MyX11CursorNode *pre = node->ante(); + MyX11CursorNode *post = node->post(); + if (pre) + pre->setPost(post); + if (post) + post->setAnte(pre); + if (node == lastExpired) + lastExpired = pre; + if (node == firstExpired) { + firstExpired = post; + if (!firstExpired) { + timer.stop(); + return; + } + int interval = QDateTime::currentDateTime().secsTo(firstExpired->expiration()) * 1000; + timer.stop(); + timer.setInterval(interval); + timer.start(); + } +} + +void MyX11Cursors::incrementUseCount(int id) +{ + MyX11CursorNode * node = lookupMap.value(id); + Q_ASSERT(node); + if (!node->refCount) + removeNode(node); + node->refCount++; +} + +void MyX11Cursors::decrementUseCount(int id) +{ + MyX11CursorNode * node = lookupMap.value(id); + Q_ASSERT(node); + node->refCount--; + if (!node->refCount) + insertNode(node); +} + +void MyX11Cursors::createNode(int id, Cursor c) +{ + MyX11CursorNode * node = new MyX11CursorNode(id, c); + lookupMap.insert(id, node); +} + +void MyX11Cursors::timeout() +{ + MyX11CursorNode * node; + node = firstExpired; + QDateTime now = QDateTime::currentDateTime(); + while (node && now.secsTo(node->expiration()) < 1) { + Cursor c = node->cursor(); + int id = node->id(); + lookupMap.take(id); + MyX11CursorNode * tmp = node; + node = node->post(); + delete tmp; + XFreeCursor(display, c); + } + firstExpired = node; + if (node == 0) { + timer.stop(); + lastExpired = 0; + } + else { + int interval = QDateTime::currentDateTime().secsTo(firstExpired->expiration()) * 1000; + timer.setInterval(interval); + timer.start(); + } +} + +Cursor MyX11Cursors::cursor(int id) +{ + MyX11CursorNode * node = lookupMap.value(id); + Q_ASSERT(node); + return node->cursor(); +} + + + +/******************************************************************** + +MyDisplay class - perhaps better placed in qplatformintegration_testlite? + +*********************************************************************/ + +//### copied from qapplication_x11.cpp + +static int qt_x_errhandler(Display *dpy, XErrorEvent *err) +{ + +qDebug() << "qt_x_errhandler" << err->error_code; + + switch (err->error_code) { + case BadAtom: +#if 0 + if (err->request_code == 20 /* X_GetProperty */ + && (err->resourceid == XA_RESOURCE_MANAGER + || err->resourceid == XA_RGB_DEFAULT_MAP + || err->resourceid == ATOM(_NET_SUPPORTED) + || err->resourceid == ATOM(_NET_SUPPORTING_WM_CHECK) + || err->resourceid == ATOM(KDE_FULL_SESSION) + || err->resourceid == ATOM(KWIN_RUNNING) + || err->resourceid == ATOM(XdndProxy) + || err->resourceid == ATOM(XdndAware)) + + + ) { + // Perhaps we're running under SECURITY reduction? :/ + return 0; + } +#endif + qDebug() << "BadAtom"; + break; + + case BadWindow: + if (err->request_code == 2 /* X_ChangeWindowAttributes */ + || err->request_code == 38 /* X_QueryPointer */) { + for (int i = 0; i < ScreenCount(dpy); ++i) { + if (err->resourceid == RootWindow(dpy, i)) { + // Perhaps we're running under SECURITY reduction? :/ + return 0; + } + } + } + seen_badwindow = true; + if (err->request_code == 25 /* X_SendEvent */) { + for (int i = 0; i < ScreenCount(dpy); ++i) { + if (err->resourceid == RootWindow(dpy, i)) { + // Perhaps we're running under SECURITY reduction? :/ + return 0; + } + } +#if 0 + if (X11->xdndHandleBadwindow()) { + qDebug("xdndHandleBadwindow returned true"); + return 0; + } +#endif + } +#if 0 + if (X11->ignore_badwindow) + return 0; +#endif + break; + + case BadMatch: + if (err->request_code == 42 /* X_SetInputFocus */) + return 0; + break; + + default: +#if 0 //!defined(QT_NO_XINPUT) + if (err->request_code == X11->xinput_major + && err->error_code == (X11->xinput_errorbase + XI_BadDevice) + && err->minor_code == 3 /* X_OpenDevice */) { + return 0; + } +#endif + break; + } + + char errstr[256]; + XGetErrorText( dpy, err->error_code, errstr, 256 ); + char buffer[256]; + char request_str[256]; + qsnprintf(buffer, 256, "%d", err->request_code); + XGetErrorDatabaseText(dpy, "XRequest", buffer, "", request_str, 256); + if (err->request_code < 128) { + // X error for a normal protocol request + qWarning( "X Error: %s %d\n" + " Major opcode: %d (%s)\n" + " Resource id: 0x%lx", + errstr, err->error_code, + err->request_code, + request_str, + err->resourceid ); + } else { + // X error for an extension request + const char *extensionName = 0; +#if 0 + if (err->request_code == X11->xrender_major) + extensionName = "RENDER"; + else if (err->request_code == X11->xrandr_major) + extensionName = "RANDR"; + else if (err->request_code == X11->xinput_major) + extensionName = "XInputExtension"; + else if (err->request_code == X11->mitshm_major) + extensionName = "MIT-SHM"; +#endif + char minor_str[256]; + if (extensionName) { + qsnprintf(buffer, 256, "%s.%d", extensionName, err->minor_code); + XGetErrorDatabaseText(dpy, "XRequest", buffer, "", minor_str, 256); + } else { + extensionName = "Uknown extension"; + qsnprintf(minor_str, 256, "Unknown request"); + } + qWarning( "X Error: %s %d\n" + " Extension: %d (%s)\n" + " Minor opcode: %d (%s)\n" + " Resource id: 0x%lx", + errstr, err->error_code, + err->request_code, + extensionName, + err->minor_code, + minor_str, + err->resourceid ); + } + + // ### we really should distinguish between severe, non-severe and + // ### application specific errors + + return 0; +} + + +#ifdef KeyPress +#undef KeyPress +#endif +#ifdef KeyRelease +#undef KeyRelease +#endif + +bool MyDisplay::handleEvent(XEvent *xe) +{ + //qDebug() << "handleEvent" << xe->xany.type << xe->xany.window; + int quit = false; + QTestLiteWindow *xw = 0; + foreach (QTestLiteWindow *w, windowList) { + if (w->winId() == xe->xany.window) { + xw = w; + break; + } + } + if (!xw) { +#ifdef MYX11_DEBUG + qWarning() << "Unknown window" << hex << xe->xany.window << "received event" << xe->type; +#endif + return quit; + } + + switch (xe->type) { + + case ClientMessage: + if (xe->xclient.format == 32 && xe->xclient.message_type == wmProtocolsAtom) { + Atom a = xe->xclient.data.l[0]; + if (a == wmDeleteWindowAtom) + xw->handleCloseEvent(); +#ifdef MYX11_DEBUG + qDebug() << "ClientMessage WM_PROTOCOLS" << a; +#endif + } +#ifdef MYX11_DEBUG + else + qDebug() << "ClientMessage" << xe->xclient.format << xe->xclient.message_type; +#endif + break; + + case Expose: + if (xw) + if (xe->xexpose.count == 0) + xw->paintEvent(); + break; + case ConfigureNotify: + if (xw) + xw->resizeEvent(&xe->xconfigure); + break; + + case ButtonPress: + xw->mousePressEvent(&xe->xbutton); + break; + + case ButtonRelease: + xw->handleMouseEvent(QEvent::MouseButtonRelease, &xe->xbutton); + break; + + case MotionNotify: + xw->handleMouseEvent(QEvent::MouseMove, &xe->xbutton); + break; + + case XKeyPress: + xw->handleKeyEvent(QEvent::KeyPress, &xe->xkey); + break; + + case XKeyRelease: + xw->handleKeyEvent(QEvent::KeyRelease, &xe->xkey); + break; + + case EnterNotify: + xw->handleEnterEvent(); + break; + + case LeaveNotify: + xw->handleLeaveEvent(); + break; + + default: +#ifdef MYX11_DEBUG + qDebug() << hex << xe->xany.window << "Other X event" << xe->type; +#endif + break; + } + return quit; +}; + + + +MyDisplay::MyDisplay() +{ + char *display_name = getenv("DISPLAY"); + display = XOpenDisplay(display_name); + if (!display) { + fprintf(stderr, "Cannot connect to X server: %s\n", + display_name); + exit(1); + } + +#ifndef DONT_USE_MIT_SHM + Status MIT_SHM_extension_supported = XShmQueryExtension (display); + Q_ASSERT(MIT_SHM_extension_supported == True); +#endif + original_x_errhandler = XSetErrorHandler(qt_x_errhandler); + + if (qgetenv("DO_X_SYNCHRONIZE").toInt()) + XSynchronize(display, true); + + screen = DefaultScreen(display); + width = DisplayWidth(display, screen); + height = DisplayHeight(display, screen); + physicalWidth = DisplayWidthMM(display, screen); + physicalHeight = DisplayHeightMM(display, screen); + + int xSocketNumber = XConnectionNumber(display); +#ifdef MYX11_DEBUG + qDebug() << "X socket:"<< xSocketNumber; +#endif + QSocketNotifier *sock = new QSocketNotifier(xSocketNumber, QSocketNotifier::Read, this); + connect(sock, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); + + wmProtocolsAtom = XInternAtom (display, "WM_PROTOCOLS", False); + wmDeleteWindowAtom = XInternAtom (display, "WM_DELETE_WINDOW", False); + + cursors = new MyX11Cursors(display); +} + + +MyDisplay::~MyDisplay() +{ + XCloseDisplay(display); +} + + +void MyDisplay::eventDispatcher() +{ +// qDebug() << "eventDispatcher"; + + + ulong marker = XNextRequest(display); +// int i = 0; + while (XPending(display)) { + XEvent event; + XNextEvent(display, &event); + /* done = */ + handleEvent(&event); + + if (event.xany.serial >= marker) { +#ifdef MYX11_DEBUG + qDebug() << "potential livelock averted"; +#endif +#if 0 + if (XEventsQueued(display, QueuedAfterFlush)) { + qDebug() << " with events queued"; + QTimer::singleShot(0, this, SLOT(eventDispatcher())); + } +#endif + break; + } + } +} + + +QImage MyDisplay::grabWindow(Window window, int x, int y, int w, int h) +{ + if (w == 0 || h ==0) + return QImage(); + + //WinId 0 means the desktop widget + if (!window) + window = rootWindow(); + + XWindowAttributes window_attr; + if (!XGetWindowAttributes(display, window, &window_attr)) + return QImage(); + + if (w < 0) + w = window_attr.width - x; + if (h < 0) + h = window_attr.height - y; + + // Ideally, we should also limit ourselves to the screen area, but the Qt docs say + // that it's "unsafe" to go outside the screen, so we can ignore that problem. + + //We're definitely not optimizing for speed... + XImage *xi = XGetImage(display, window, x, y, w, h, AllPlanes, ZPixmap); + + if (!xi) + return QImage(); + + //taking a copy to make sure we have ownership -- not fast + QImage result = QImage( (uchar*) xi->data, xi->width, xi->height, xi->bytes_per_line, QImage::Format_RGB32 ).copy(); + + XDestroyImage(xi); + + return result; +} + + + + + + + +QT_END_NAMESPACE +#include "qtestlitewindow.moc" diff --git a/src/plugins/platforms/testlite/qtestlitewindow.h b/src/plugins/platforms/testlite/qtestlitewindow.h new file mode 100644 index 0000000..6fb7ed2 --- /dev/null +++ b/src/plugins/platforms/testlite/qtestlitewindow.h @@ -0,0 +1,157 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITEWINDOW_H +#define QTESTLITEWINDOW_H + +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include + + + +class QTestLiteIntegration; +class QTestLiteScreen; +class QTestLiteWindowSurface; +class MyX11Cursors; +class QTestLiteWindow; + +class MyDisplay : public QObject +{ + Q_OBJECT; +public: + MyDisplay(); + ~MyDisplay(); + + Window rootWindow() { return RootWindow(display, screen); } + unsigned long blackPixel() { return BlackPixel(display, screen); } + unsigned long whitePixel() { return WhitePixel(display, screen); } + + bool handleEvent(XEvent *xe); + QImage grabWindow(Window window, int x, int y, int w, int h); + +public slots: + void eventDispatcher(); + +public: //### + Display * display; + int screen; + int width, height; + int physicalWidth; + int physicalHeight; + + QList windowList; + + MyX11Cursors * cursors; +}; + +struct MyShmImageInfo; + +class QWindowSurface; + +class QTestLiteWindow : public QPlatformWindow +{ +public: + QTestLiteWindow(QTestLiteIntegration *platformIntegration, + QTestLiteScreen *screen, QWidget *window); + ~QTestLiteWindow(); + + + void mousePressEvent(XButtonEvent*); + void handleMouseEvent(QEvent::Type, XButtonEvent *ev); + + void handleKeyEvent(QEvent::Type, void *); + void handleCloseEvent(); + void handleEnterEvent(); + void handleLeaveEvent(); + + void resizeEvent(XConfigureEvent *configure_event); + void paintEvent(); + + + void setGeometry(const QRect &rect); + + Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); + Qt::WindowFlags windowFlags() const; + void setVisible(bool visible); + WId winId() const; + void raise(); + void lower(); + void setWindowTitle(const QString &title); + + void setCursor(QCursor * cursor); + +private: + int xpos, ypos; + int width, height; + Window x_window; + GC gc; + + GC createGC(); + Cursor createCursorShape(int cshape); + Cursor createCursorBitmap(QCursor * cursor); + + int currentCursor; + + QWindowSurface *windowSurface; + MyDisplay *xd; + + QTestLiteIntegration *mPlatformIntegration; + QTestLiteScreen *mScreen; + Qt::WindowFlags window_flags; + + friend class QTestLiteWindowSurface; // x_window, gc and windowSurface +}; + + + + + +#endif diff --git a/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp b/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp index 81fa247..b5a0f74 100644 --- a/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp @@ -45,36 +45,108 @@ #include #include -#include "x11util.h" +#include "qtestlitewindow.h" + +# include +# include +# include QT_BEGIN_NAMESPACE -QTestLiteWindowSurface::QTestLiteWindowSurface - (QTestLiteIntegration *platformIntegration, - QTestLiteScreen *screen, QWidget *window) - : QWindowSurface(window), - mPlatformIntegration(platformIntegration), - mScreen(screen), - xw(0) + +struct MyShmImageInfo { + MyShmImageInfo(Display *xdisplay) : image(0), display(xdisplay) {} + ~MyShmImageInfo() { destroy(); } + + void destroy(); + + XShmSegmentInfo shminfo; + XImage *image; + Display *display; +}; + +//void QTestLiteWindowSurface::flush() + + +#ifndef DONT_USE_MIT_SHM +void MyShmImageInfo::destroy() +{ + XShmDetach (display, &shminfo); + XDestroyImage (image); + shmdt (shminfo.shmaddr); + shmctl (shminfo.shmid, IPC_RMID, 0); +} +#endif + +void QTestLiteWindowSurface::resizeShmImage(int width, int height) { + MyDisplay *xd = xw->xd; - xw = static_cast(window->platformWindow())->xw; -// xw = new MyWindow(platformIntegration->xd, 0,0,300,300); +#ifdef DONT_USE_MIT_SHM + shm_img = QImage(width, height, QImage::Format_RGB32); +#else + if (image_info) + image_info->destroy(); + else + image_info = new MyShmImageInfo(xd->display); -// qDebug() << "QTestLiteWindowSurface::QTestLiteWindowSurface:" << xw->window; + Visual *visual = DefaultVisual(xd->display, xd->screen); + + + XImage *image = XShmCreateImage (xd->display, visual, 24, ZPixmap, 0, + &image_info->shminfo, width, height); + + + image_info->shminfo.shmid = shmget (IPC_PRIVATE, + image->bytes_per_line * image->height, IPC_CREAT|0777); + + image_info->shminfo.shmaddr = image->data = (char*)shmat (image_info->shminfo.shmid, 0, 0); + image_info->shminfo.readOnly = False; + image_info->image = image; + + Status shm_attach_status = XShmAttach(xd->display, &image_info->shminfo); + + Q_ASSERT(shm_attach_status == True); + + shm_img = QImage( (uchar*) image->data, image->width, image->height, image->bytes_per_line, QImage::Format_RGB32 ); +#endif + painted = false; +} + + +void QTestLiteWindowSurface::resizeBuffer(QSize s) +{ + if (shm_img.size() != s) + resizeShmImage(s.width(), s.height()); +} + +QSize QTestLiteWindowSurface::bufferSize() const +{ + return shm_img.size(); +} + +QTestLiteWindowSurface::QTestLiteWindowSurface (QTestLiteScreen */*screen*/, QWidget *window) + : QWindowSurface(window), + painted(false), image_info(0) +{ + xw = static_cast(window->platformWindow()); + xw->windowSurface = this; +// qDebug() << "QTestLiteWindowSurface::QTestLiteWindowSurface:" << xw->window; } QTestLiteWindowSurface::~QTestLiteWindowSurface() { -// qDebug() << "~QTestLiteWindowSurface" << xw->window; + qDebug() << "~QTestLiteWindowSurface"; + delete image_info; } QPaintDevice *QTestLiteWindowSurface::paintDevice() { - return xw->image(); + return &shm_img; } + void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) { Q_UNUSED(widget); @@ -83,22 +155,48 @@ void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const // qDebug() << "QTestLiteWindowSurface::flush:" << (long)this; - xw->paintEvent(); -} - + if (!painted) + return; -// void QTestLiteWindowSurface::resize(const QSize &s) -// { -// if (s == size()) -// return; + MyDisplay *xd = xw->xd; + GC gc = xw->gc; + Window window = xw->x_window; +#ifdef DONT_USE_MIT_SHM + // just convert the image every time... + if (!shm_img.isNull()) { + Visual *visual = DefaultVisual(xd->display, xd->screen); -// QWindowSurface::resize(size); + QImage image = shm_img; + //img.convertToFormat( + XImage *xi = XCreateImage(xd->display, visual, 24, ZPixmap, + 0, (char *) image.scanLine(0), image.width(), image.height(), + 32, image.bytesPerLine()); -// //if unchanged ### -// // xw->setSize(rect.width(), rect.height()); + int x = 0; + int y = 0; + /*int r =*/ XPutImage(xd->display, window, gc, xi, 0, 0, x, y, image.width(), image.height()); -// } + xi->data = 0; // QImage owns these bits + XDestroyImage(xi); + } +#else + // Use MIT_SHM + if (image_info->image) { + //qDebug() << "Here we go" << image_info->image->width << image_info->image->height; + int x = 0; + int y = 0; + + // We could set send_event to true, and then use the ShmCompletion to synchronize, + // but let's do like Qt/11 and just use XSync + XShmPutImage (xd->display, window, gc, image_info->image, 0, 0, + x, y, image_info->image->width, image_info->image->height, + /*send_event*/ False); + + XSync(xd->display, False); + } +#endif +} //### scroll logic copied from QRasterWindowSurface, we should make better API for this @@ -151,12 +249,12 @@ void copied_qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &o bool QTestLiteWindowSurface::scroll(const QRegion &area, int dx, int dy) { - if (!xw->image() || xw->image()->isNull()) + if (shm_img.isNull()) return false; const QVector rects = area.rects(); for (int i = 0; i < rects.size(); ++i) - copied_qt_scrollRectInImage(*xw->image(), rects.at(i), QPoint(dx, dy)); + copied_qt_scrollRectInImage(shm_img, rects.at(i), QPoint(dx, dy)); return true; } @@ -165,529 +263,12 @@ bool QTestLiteWindowSurface::scroll(const QRegion &area, int dx, int dy) void QTestLiteWindowSurface::beginPaint(const QRegion ®ion) { Q_UNUSED(region); - xw->resizeBuffer(size()); + resizeBuffer(size()); } void QTestLiteWindowSurface::endPaint(const QRegion ®ion) { Q_UNUSED(region); - xw->painted = true; //there is content in the buffer -} - - -/************************************************************************** -** QTestLiteWindow -**************************************************************************/ - -QTestLiteWindow::QTestLiteWindow(QTestLiteIntegration *platformIntegration, - QTestLiteScreen */*screen*/, QWidget *window) - :QPlatformWindow(window) -{ - xw = new MyWindow(platformIntegration->xd, 0,0,300,300); - setWindowFlags(window->windowFlags()); //##### This should not be the plugin's responsibility - - xw->windowTL = this; -} - - -QTestLiteWindow::~QTestLiteWindow() -{ - delete xw; -} - - - - - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Mouse event stuff - - - - -static Qt::MouseButtons translateMouseButtons(int s) -{ - Qt::MouseButtons ret = 0; - if (s & Button1Mask) - ret |= Qt::LeftButton; - if (s & Button2Mask) - ret |= Qt::MidButton; - if (s & Button3Mask) - ret |= Qt::RightButton; - return ret; -} - - -static Qt::KeyboardModifiers translateModifiers(int s) -{ - const uchar qt_alt_mask = Mod1Mask; - const uchar qt_meta_mask = Mod4Mask; - - - Qt::KeyboardModifiers ret = 0; - if (s & ShiftMask) - ret |= Qt::ShiftModifier; - if (s & ControlMask) - ret |= Qt::ControlModifier; - if (s & qt_alt_mask) - ret |= Qt::AltModifier; - if (s & qt_meta_mask) - ret |= Qt::MetaModifier; -#if 0 - if (s & qt_mode_switch_mask) - ret |= Qt::GroupSwitchModifier; -#endif - return ret; -} - -void QTestLiteWindow::handleMouseEvent(QEvent::Type type, void *ev) -{ - static QPoint mousePoint; - - XButtonEvent *e = static_cast(ev); - - Qt::MouseButton button = Qt::NoButton; - Qt::MouseButtons buttons = translateMouseButtons(e->state); - Qt::KeyboardModifiers modifiers = translateModifiers(e->state); - if (type != QEvent::MouseMove) { - switch (e->button) { - case Button1: button = Qt::LeftButton; break; - case Button2: button = Qt::MidButton; break; - case Button3: button = Qt::RightButton; break; - case Button4: - case Button5: - case 6: - case 7: { - //mouse wheel - if (type == QEvent::MouseButtonPress) { - //logic borrowed from qapplication_x11.cpp - int delta = 120 * ((e->button == Button4 || e->button == 6) ? 1 : -1); - bool hor = (((e->button == Button4 || e->button == Button5) - && (modifiers & Qt::AltModifier)) - || (e->button == 6 || e->button == 7)); - QWindowSystemInterface::handleWheelEvent(widget(), e->time, - QPoint(e->x, e->y), - QPoint(e->x_root, e->y_root), - delta, hor ? Qt::Horizontal : Qt::Vertical); - } - return; - } - default: break; - } - } - - buttons ^= button; // X event uses state *before*, Qt uses state *after* - - QWindowSystemInterface::handleMouseEvent(widget(), e->time, QPoint(e->x, e->y), - QPoint(e->x_root, e->y_root), - buttons); - - mousePoint = QPoint(e->x_root, e->y_root); -} - -void QTestLiteWindow::handleGeometryChange(int x, int y, int w, int h) -{ - QWindowSystemInterface::handleGeometryChange(widget(), QRect(x,y,w,h)); -} - - -void QTestLiteWindow::handleCloseEvent() -{ - QWindowSystemInterface::handleCloseEvent(widget()); -} - - -void QTestLiteWindow::handleEnterEvent() -{ - QWindowSystemInterface::handleEnterEvent(widget()); -} - -void QTestLiteWindow::handleLeaveEvent() -{ - QWindowSystemInterface::handleLeaveEvent(widget()); -} - - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Key event stuff -- not pretty either -// -// What we want to do is to port Robert's keytable code properly - - - - - - - -// keyboard mapping table -static const unsigned int keyTbl[] = { - - // misc keys - - XK_Escape, Qt::Key_Escape, - XK_Tab, Qt::Key_Tab, - XK_ISO_Left_Tab, Qt::Key_Backtab, - XK_BackSpace, Qt::Key_Backspace, - XK_Return, Qt::Key_Return, - XK_Insert, Qt::Key_Insert, - XK_Delete, Qt::Key_Delete, - XK_Clear, Qt::Key_Delete, - XK_Pause, Qt::Key_Pause, - XK_Print, Qt::Key_Print, - 0x1005FF60, Qt::Key_SysReq, // hardcoded Sun SysReq - 0x1007ff00, Qt::Key_SysReq, // hardcoded X386 SysReq - - // cursor movement - - XK_Home, Qt::Key_Home, - XK_End, Qt::Key_End, - XK_Left, Qt::Key_Left, - XK_Up, Qt::Key_Up, - XK_Right, Qt::Key_Right, - XK_Down, Qt::Key_Down, - XK_Prior, Qt::Key_PageUp, - XK_Next, Qt::Key_PageDown, - - // modifiers - - XK_Shift_L, Qt::Key_Shift, - XK_Shift_R, Qt::Key_Shift, - XK_Shift_Lock, Qt::Key_Shift, - XK_Control_L, Qt::Key_Control, - XK_Control_R, Qt::Key_Control, - XK_Meta_L, Qt::Key_Meta, - XK_Meta_R, Qt::Key_Meta, - XK_Alt_L, Qt::Key_Alt, - XK_Alt_R, Qt::Key_Alt, - XK_Caps_Lock, Qt::Key_CapsLock, - XK_Num_Lock, Qt::Key_NumLock, - XK_Scroll_Lock, Qt::Key_ScrollLock, - XK_Super_L, Qt::Key_Super_L, - XK_Super_R, Qt::Key_Super_R, - XK_Menu, Qt::Key_Menu, - XK_Hyper_L, Qt::Key_Hyper_L, - XK_Hyper_R, Qt::Key_Hyper_R, - XK_Help, Qt::Key_Help, - 0x1000FF74, Qt::Key_Backtab, // hardcoded HP backtab - 0x1005FF10, Qt::Key_F11, // hardcoded Sun F36 (labeled F11) - 0x1005FF11, Qt::Key_F12, // hardcoded Sun F37 (labeled F12) - - // numeric and function keypad keys - - XK_KP_Space, Qt::Key_Space, - XK_KP_Tab, Qt::Key_Tab, - XK_KP_Enter, Qt::Key_Enter, - //XK_KP_F1, Qt::Key_F1, - //XK_KP_F2, Qt::Key_F2, - //XK_KP_F3, Qt::Key_F3, - //XK_KP_F4, Qt::Key_F4, - XK_KP_Home, Qt::Key_Home, - XK_KP_Left, Qt::Key_Left, - XK_KP_Up, Qt::Key_Up, - XK_KP_Right, Qt::Key_Right, - XK_KP_Down, Qt::Key_Down, - XK_KP_Prior, Qt::Key_PageUp, - XK_KP_Next, Qt::Key_PageDown, - XK_KP_End, Qt::Key_End, - XK_KP_Begin, Qt::Key_Clear, - XK_KP_Insert, Qt::Key_Insert, - XK_KP_Delete, Qt::Key_Delete, - XK_KP_Equal, Qt::Key_Equal, - XK_KP_Multiply, Qt::Key_Asterisk, - XK_KP_Add, Qt::Key_Plus, - XK_KP_Separator, Qt::Key_Comma, - XK_KP_Subtract, Qt::Key_Minus, - XK_KP_Decimal, Qt::Key_Period, - XK_KP_Divide, Qt::Key_Slash, - - // International input method support keys - - // International & multi-key character composition - XK_ISO_Level3_Shift, Qt::Key_AltGr, - XK_Multi_key, Qt::Key_Multi_key, - XK_Codeinput, Qt::Key_Codeinput, - XK_SingleCandidate, Qt::Key_SingleCandidate, - XK_MultipleCandidate, Qt::Key_MultipleCandidate, - XK_PreviousCandidate, Qt::Key_PreviousCandidate, - - // Misc Functions - XK_Mode_switch, Qt::Key_Mode_switch, - XK_script_switch, Qt::Key_Mode_switch, - - // Japanese keyboard support - XK_Kanji, Qt::Key_Kanji, - XK_Muhenkan, Qt::Key_Muhenkan, - //XK_Henkan_Mode, Qt::Key_Henkan_Mode, - XK_Henkan_Mode, Qt::Key_Henkan, - XK_Henkan, Qt::Key_Henkan, - XK_Romaji, Qt::Key_Romaji, - XK_Hiragana, Qt::Key_Hiragana, - XK_Katakana, Qt::Key_Katakana, - XK_Hiragana_Katakana, Qt::Key_Hiragana_Katakana, - XK_Zenkaku, Qt::Key_Zenkaku, - XK_Hankaku, Qt::Key_Hankaku, - XK_Zenkaku_Hankaku, Qt::Key_Zenkaku_Hankaku, - XK_Touroku, Qt::Key_Touroku, - XK_Massyo, Qt::Key_Massyo, - XK_Kana_Lock, Qt::Key_Kana_Lock, - XK_Kana_Shift, Qt::Key_Kana_Shift, - XK_Eisu_Shift, Qt::Key_Eisu_Shift, - XK_Eisu_toggle, Qt::Key_Eisu_toggle, - //XK_Kanji_Bangou, Qt::Key_Kanji_Bangou, - //XK_Zen_Koho, Qt::Key_Zen_Koho, - //XK_Mae_Koho, Qt::Key_Mae_Koho, - XK_Kanji_Bangou, Qt::Key_Codeinput, - XK_Zen_Koho, Qt::Key_MultipleCandidate, - XK_Mae_Koho, Qt::Key_PreviousCandidate, - -#ifdef XK_KOREAN - // Korean keyboard support - XK_Hangul, Qt::Key_Hangul, - XK_Hangul_Start, Qt::Key_Hangul_Start, - XK_Hangul_End, Qt::Key_Hangul_End, - XK_Hangul_Hanja, Qt::Key_Hangul_Hanja, - XK_Hangul_Jamo, Qt::Key_Hangul_Jamo, - XK_Hangul_Romaja, Qt::Key_Hangul_Romaja, - //XK_Hangul_Codeinput, Qt::Key_Hangul_Codeinput, - XK_Hangul_Codeinput, Qt::Key_Codeinput, - XK_Hangul_Jeonja, Qt::Key_Hangul_Jeonja, - XK_Hangul_Banja, Qt::Key_Hangul_Banja, - XK_Hangul_PreHanja, Qt::Key_Hangul_PreHanja, - XK_Hangul_PostHanja, Qt::Key_Hangul_PostHanja, - //XK_Hangul_SingleCandidate,Qt::Key_Hangul_SingleCandidate, - //XK_Hangul_MultipleCandidate,Qt::Key_Hangul_MultipleCandidate, - //XK_Hangul_PreviousCandidate,Qt::Key_Hangul_PreviousCandidate, - XK_Hangul_SingleCandidate, Qt::Key_SingleCandidate, - XK_Hangul_MultipleCandidate,Qt::Key_MultipleCandidate, - XK_Hangul_PreviousCandidate,Qt::Key_PreviousCandidate, - XK_Hangul_Special, Qt::Key_Hangul_Special, - //XK_Hangul_switch, Qt::Key_Hangul_switch, - XK_Hangul_switch, Qt::Key_Mode_switch, -#endif // XK_KOREAN - - // dead keys - XK_dead_grave, Qt::Key_Dead_Grave, - XK_dead_acute, Qt::Key_Dead_Acute, - XK_dead_circumflex, Qt::Key_Dead_Circumflex, - XK_dead_tilde, Qt::Key_Dead_Tilde, - XK_dead_macron, Qt::Key_Dead_Macron, - XK_dead_breve, Qt::Key_Dead_Breve, - XK_dead_abovedot, Qt::Key_Dead_Abovedot, - XK_dead_diaeresis, Qt::Key_Dead_Diaeresis, - XK_dead_abovering, Qt::Key_Dead_Abovering, - XK_dead_doubleacute, Qt::Key_Dead_Doubleacute, - XK_dead_caron, Qt::Key_Dead_Caron, - XK_dead_cedilla, Qt::Key_Dead_Cedilla, - XK_dead_ogonek, Qt::Key_Dead_Ogonek, - XK_dead_iota, Qt::Key_Dead_Iota, - XK_dead_voiced_sound, Qt::Key_Dead_Voiced_Sound, - XK_dead_semivoiced_sound, Qt::Key_Dead_Semivoiced_Sound, - XK_dead_belowdot, Qt::Key_Dead_Belowdot, - XK_dead_hook, Qt::Key_Dead_Hook, - XK_dead_horn, Qt::Key_Dead_Horn, - -#if 0 - // Special multimedia keys - // currently only tested with MS internet keyboard - - // browsing keys - XF86XK_Back, Qt::Key_Back, - XF86XK_Forward, Qt::Key_Forward, - XF86XK_Stop, Qt::Key_Stop, - XF86XK_Refresh, Qt::Key_Refresh, - XF86XK_Favorites, Qt::Key_Favorites, - XF86XK_AudioMedia, Qt::Key_LaunchMedia, - XF86XK_OpenURL, Qt::Key_OpenUrl, - XF86XK_HomePage, Qt::Key_HomePage, - XF86XK_Search, Qt::Key_Search, - - // media keys - XF86XK_AudioLowerVolume, Qt::Key_VolumeDown, - XF86XK_AudioMute, Qt::Key_VolumeMute, - XF86XK_AudioRaiseVolume, Qt::Key_VolumeUp, - XF86XK_AudioPlay, Qt::Key_MediaPlay, - XF86XK_AudioStop, Qt::Key_MediaStop, - XF86XK_AudioPrev, Qt::Key_MediaPrevious, - XF86XK_AudioNext, Qt::Key_MediaNext, - XF86XK_AudioRecord, Qt::Key_MediaRecord, - - // launch keys - XF86XK_Mail, Qt::Key_LaunchMail, - XF86XK_MyComputer, Qt::Key_Launch0, - XF86XK_Calculator, Qt::Key_Launch1, - XF86XK_Standby, Qt::Key_Standby, - - XF86XK_Launch0, Qt::Key_Launch2, - XF86XK_Launch1, Qt::Key_Launch3, - XF86XK_Launch2, Qt::Key_Launch4, - XF86XK_Launch3, Qt::Key_Launch5, - XF86XK_Launch4, Qt::Key_Launch6, - XF86XK_Launch5, Qt::Key_Launch7, - XF86XK_Launch6, Qt::Key_Launch8, - XF86XK_Launch7, Qt::Key_Launch9, - XF86XK_Launch8, Qt::Key_LaunchA, - XF86XK_Launch9, Qt::Key_LaunchB, - XF86XK_LaunchA, Qt::Key_LaunchC, - XF86XK_LaunchB, Qt::Key_LaunchD, - XF86XK_LaunchC, Qt::Key_LaunchE, - XF86XK_LaunchD, Qt::Key_LaunchF, -#endif - -#if 0 - // Qtopia keys - QTOPIAXK_Select, Qt::Key_Select, - QTOPIAXK_Yes, Qt::Key_Yes, - QTOPIAXK_No, Qt::Key_No, - QTOPIAXK_Cancel, Qt::Key_Cancel, - QTOPIAXK_Printer, Qt::Key_Printer, - QTOPIAXK_Execute, Qt::Key_Execute, - QTOPIAXK_Sleep, Qt::Key_Sleep, - QTOPIAXK_Play, Qt::Key_Play, - QTOPIAXK_Zoom, Qt::Key_Zoom, - QTOPIAXK_Context1, Qt::Key_Context1, - QTOPIAXK_Context2, Qt::Key_Context2, - QTOPIAXK_Context3, Qt::Key_Context3, - QTOPIAXK_Context4, Qt::Key_Context4, - QTOPIAXK_Call, Qt::Key_Call, - QTOPIAXK_Hangup, Qt::Key_Hangup, - QTOPIAXK_Flip, Qt::Key_Flip, -#endif - 0, 0 -}; - - -static int lookupCode(unsigned int xkeycode) -{ - if (xkeycode >= XK_F1 && xkeycode <= XK_F35) - return Qt::Key_F1 + (int(xkeycode) - XK_F1); - - const unsigned int *p = keyTbl; - while (*p) { - if (*p == xkeycode) - return *++p; - p += 2; - } - - return 0; -} - - -static Qt::KeyboardModifiers modifierFromKeyCode(int qtcode) -{ - switch (qtcode) { - case Qt::Key_Control: - return Qt::ControlModifier; - case Qt::Key_Alt: - return Qt::AltModifier; - case Qt::Key_Shift: - return Qt::ShiftModifier; - case Qt::Key_Meta: - return Qt::MetaModifier; - default: - return Qt::NoModifier; - } -} - -void QTestLiteWindow::handleKeyEvent(QEvent::Type type, void *ev) -{ - XKeyEvent *e = static_cast(ev); - - KeySym keySym; - QByteArray chars; - chars.resize(513); - - int count = XLookupString(e, chars.data(), chars.size(), &keySym, 0); - -// qDebug() << "QTLWS::handleKeyEvent" << count << hex << "XKeysym:" << keySym; -// if (count) -// qDebug() << hex << int(chars[0]) << "String:" << chars; - - Qt::KeyboardModifiers modifiers = translateModifiers(e->state); - - int qtcode = lookupCode(keySym); -// qDebug() << "lookup: " << hex << keySym << qtcode << "mod" << modifiers; - - //X11 specifies state *before*, Qt expects state *after* the event - - modifiers ^= modifierFromKeyCode(qtcode); - - if (qtcode) { - QWindowSystemInterface::handleKeyEvent(widget(), e->time, type, qtcode, modifiers); - } else if (chars[0]) { - int qtcode = chars.toUpper()[0]; //Not exactly right... - if (modifiers & Qt::ControlModifier && qtcode < ' ') - qtcode = chars[0] + '@'; - QWindowSystemInterface::handleKeyEvent(widget(), e->time, type, qtcode, modifiers, QString::fromLatin1(chars)); - } else { - qWarning() << "unknown X keycode" << hex << e->keycode << keySym; - } -} - - - -void QTestLiteWindow::setGeometry(const QRect &rect) -{ - QRect oldRect = geometry(); - if (rect == oldRect) - return; - - //if unchanged ### - xw->setGeometry(rect.x(), rect.y(), rect.width(), rect.height()); -} - - - -Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) -{ - Q_ASSERT(flags & Qt::Window); - - window_flags = flags; - - xw->setWindowFlags(flags); - - return window_flags; - -} - -Qt::WindowFlags QTestLiteWindow::windowFlags() const -{ - return window_flags; -} - -void QTestLiteWindow::setVisible(bool visible) -{ - //qDebug() << "QTestLiteWindowSurface::setVisible" << visible << xw->window; - xw->setVisible(visible); -} - - -WId QTestLiteWindow::winId() const -{ - if (xw) - return (WId) xw->window; - else - return WId(0); -} - -void QTestLiteWindow::raise() -{ - WId window = winId(); - XRaiseWindow(mPlatformIntegration->xd->display, window); -} - -void QTestLiteWindow::lower() -{ - WId window = winId(); - XLowerWindow(mPlatformIntegration->xd->display, window); -} - -void QTestLiteWindow::setWindowTitle(const QString &title) -{ - xw->setWindowTitle(title); -} - -void QTestLiteWindow::setCursor(QCursor *cursor) -{ - xw->setCursor(cursor); + painted = true; //there is content in the buffer } QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qwindowsurface_testlite.h b/src/plugins/platforms/testlite/qwindowsurface_testlite.h index d713cc2..915e7fe 100644 --- a/src/plugins/platforms/testlite/qwindowsurface_testlite.h +++ b/src/plugins/platforms/testlite/qwindowsurface_testlite.h @@ -43,24 +43,23 @@ #define QWINDOWSURFACE_TESTLITE_H #include -#include -#include + QT_BEGIN_NAMESPACE -class MyWindow; +class QTestLiteWindow; class QTestLiteIntegration; class QTestLiteScreen; +class MyShmImageInfo; class QTestLiteWindowSurface : public QWindowSurface { public: - QTestLiteWindowSurface - (QTestLiteIntegration *platformIntegration, - QTestLiteScreen *screen, QWidget *window); + QTestLiteWindowSurface (QTestLiteScreen *screen, QWidget *window); ~QTestLiteWindowSurface(); QPaintDevice *paintDevice(); +// void flush(); void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); // void resize(const QSize &size); bool scroll(const QRegion &area, int dx, int dy); @@ -69,47 +68,18 @@ public: void endPaint(const QRegion ®ion); private: - QTestLiteIntegration *mPlatformIntegration; - QTestLiteScreen *mScreen; - Qt::WindowFlags window_flags; - MyWindow *xw; -}; - + bool painted; + void resizeBuffer(QSize); + QSize bufferSize() const; -class QTestLiteWindow : public QPlatformWindow -{ -public: - QTestLiteWindow(QTestLiteIntegration *platformIntegration, - QTestLiteScreen *screen, QWidget *window); - ~QTestLiteWindow(); + void resizeShmImage(int width, int height); - void handleMouseEvent(QEvent::Type, void *); //forwarding X types is apparently impossible :( - void handleKeyEvent(QEvent::Type, void *); - void handleGeometryChange(int x, int y, int w, int h); - void handleCloseEvent(); - void handleEnterEvent(); - void handleLeaveEvent(); + QImage shm_img; + MyShmImageInfo *image_info; - void setGeometry(const QRect &rect); - - Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); - Qt::WindowFlags windowFlags() const; - void setVisible(bool visible); - WId winId() const; - void raise(); - void lower(); - void setWindowTitle(const QString &title); - - void setCursor(QCursor * cursor); - -private: - QTestLiteIntegration *mPlatformIntegration; - QTestLiteScreen *mScreen; - Qt::WindowFlags window_flags; - MyWindow *xw; + QTestLiteWindow *xw; - friend class QTestLiteWindowSurface; //### needs refactoring }; diff --git a/src/plugins/platforms/testlite/testlite.pro b/src/plugins/platforms/testlite/testlite.pro index 442dd68..02122f1 100644 --- a/src/plugins/platforms/testlite/testlite.pro +++ b/src/plugins/platforms/testlite/testlite.pro @@ -3,12 +3,8 @@ include(../../qpluginbase.pri) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms -SOURCES = main.cpp qplatformintegration_testlite.cpp qwindowsurface_testlite.cpp -HEADERS = qplatformintegration_testlite.h qwindowsurface_testlite.h - - -HEADERS += x11util.h -SOURCES += x11util.cpp +SOURCES = main.cpp qplatformintegration_testlite.cpp qwindowsurface_testlite.cpp qtestlitewindow.cpp +HEADERS = qplatformintegration_testlite.h qwindowsurface_testlite.h qtestlitewindow.h LIBS += -lX11 -lXext diff --git a/src/plugins/platforms/testlite/x11util.cpp b/src/plugins/platforms/testlite/x11util.cpp deleted file mode 100644 index a869347..0000000 --- a/src/plugins/platforms/testlite/x11util.cpp +++ /dev/null @@ -1,1215 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -#include -#include -#include - -#include "x11util.h" -#include "qwindowsurface_testlite.h" - -#include -#include - - -#include - -#include - -# include -# include -# include - - -#include -#include -#include -#include - -//### remove stuff we don't want from qt_x11_p.h -#undef ATOM -#undef X11 - -//#define MYX11_DEBUG - -//#define DONT_USE_MIT_SHM - -static int (*original_x_errhandler)(Display *dpy, XErrorEvent *); -static bool seen_badwindow; - - -static Atom wmProtocolsAtom; -static Atom wmDeleteWindowAtom; - -//### copied from qapplication_x11.cpp - -static int qt_x_errhandler(Display *dpy, XErrorEvent *err) -{ - -qDebug() << "qt_x_errhandler" << err->error_code; - - switch (err->error_code) { - case BadAtom: -#if 0 - if (err->request_code == 20 /* X_GetProperty */ - && (err->resourceid == XA_RESOURCE_MANAGER - || err->resourceid == XA_RGB_DEFAULT_MAP - || err->resourceid == ATOM(_NET_SUPPORTED) - || err->resourceid == ATOM(_NET_SUPPORTING_WM_CHECK) - || err->resourceid == ATOM(KDE_FULL_SESSION) - || err->resourceid == ATOM(KWIN_RUNNING) - || err->resourceid == ATOM(XdndProxy) - || err->resourceid == ATOM(XdndAware)) - - - ) { - // Perhaps we're running under SECURITY reduction? :/ - return 0; - } -#endif - qDebug() << "BadAtom"; - break; - - case BadWindow: - if (err->request_code == 2 /* X_ChangeWindowAttributes */ - || err->request_code == 38 /* X_QueryPointer */) { - for (int i = 0; i < ScreenCount(dpy); ++i) { - if (err->resourceid == RootWindow(dpy, i)) { - // Perhaps we're running under SECURITY reduction? :/ - return 0; - } - } - } - seen_badwindow = true; - if (err->request_code == 25 /* X_SendEvent */) { - for (int i = 0; i < ScreenCount(dpy); ++i) { - if (err->resourceid == RootWindow(dpy, i)) { - // Perhaps we're running under SECURITY reduction? :/ - return 0; - } - } -#if 0 - if (X11->xdndHandleBadwindow()) { - qDebug("xdndHandleBadwindow returned true"); - return 0; - } -#endif - } -#if 0 - if (X11->ignore_badwindow) - return 0; -#endif - break; - - case BadMatch: - if (err->request_code == 42 /* X_SetInputFocus */) - return 0; - break; - - default: -#if 0 //!defined(QT_NO_XINPUT) - if (err->request_code == X11->xinput_major - && err->error_code == (X11->xinput_errorbase + XI_BadDevice) - && err->minor_code == 3 /* X_OpenDevice */) { - return 0; - } -#endif - break; - } - - char errstr[256]; - XGetErrorText( dpy, err->error_code, errstr, 256 ); - char buffer[256]; - char request_str[256]; - qsnprintf(buffer, 256, "%d", err->request_code); - XGetErrorDatabaseText(dpy, "XRequest", buffer, "", request_str, 256); - if (err->request_code < 128) { - // X error for a normal protocol request - qWarning( "X Error: %s %d\n" - " Major opcode: %d (%s)\n" - " Resource id: 0x%lx", - errstr, err->error_code, - err->request_code, - request_str, - err->resourceid ); - } else { - // X error for an extension request - const char *extensionName = 0; -#if 0 - if (err->request_code == X11->xrender_major) - extensionName = "RENDER"; - else if (err->request_code == X11->xrandr_major) - extensionName = "RANDR"; - else if (err->request_code == X11->xinput_major) - extensionName = "XInputExtension"; - else if (err->request_code == X11->mitshm_major) - extensionName = "MIT-SHM"; -#endif - char minor_str[256]; - if (extensionName) { - qsnprintf(buffer, 256, "%s.%d", extensionName, err->minor_code); - XGetErrorDatabaseText(dpy, "XRequest", buffer, "", minor_str, 256); - } else { - extensionName = "Uknown extension"; - qsnprintf(minor_str, 256, "Unknown request"); - } - qWarning( "X Error: %s %d\n" - " Extension: %d (%s)\n" - " Minor opcode: %d (%s)\n" - " Resource id: 0x%lx", - errstr, err->error_code, - err->request_code, - extensionName, - err->minor_code, - minor_str, - err->resourceid ); - } - - // ### we really should distinguish between severe, non-severe and - // ### application specific errors - - return 0; -} - - - - - - - - - -bool MyDisplay::handleEvent(XEvent *xe) -{ - //qDebug() << "handleEvent" << xe->xany.type << xe->xany.window; - int quit = false; - MyWindow *xw = 0; - foreach (MyWindow *w, windowList) { - if (w->window == xe->xany.window) { - xw = w; - break; - } - } - if (!xw) { -#ifdef MYX11_DEBUG - qWarning() << "Unknown window" << hex << xe->xany.window << "received event" << xe->type; -#endif - return quit; - } - - switch (xe->type) { - - case ClientMessage: - if (xe->xclient.format == 32 && xe->xclient.message_type == wmProtocolsAtom) { - Atom a = xe->xclient.data.l[0]; - if (a == wmDeleteWindowAtom) - xw->closeEvent(); -#ifdef MYX11_DEBUG - qDebug() << "ClientMessage WM_PROTOCOLS" << a; -#endif - } -#ifdef MYX11_DEBUG - else - qDebug() << "ClientMessage" << xe->xclient.format << xe->xclient.message_type; -#endif - break; - - case Expose: - if (xw) - if (xe->xexpose.count == 0) - xw->paintEvent(); - break; - case ConfigureNotify: - if (xw) - xw->resizeEvent(&xe->xconfigure); - break; - - case ButtonPress: - xw->mousePressEvent(&xe->xbutton); - break; - - case ButtonRelease: - xw->mouseReleaseEvent(&xe->xbutton); - break; - - case MotionNotify: - xw->mouseMoveEvent(&xe->xbutton); - break; - - case XKeyPress: - xw->keyPressEvent(&xe->xkey); - break; - - case XKeyRelease: - xw->keyReleaseEvent(&xe->xkey); - break; - - case EnterNotify: - xw->enterEvent(&xe->xcrossing); - break; - - case LeaveNotify: - xw->leaveEvent(&xe->xcrossing); - break; - - default: -#ifdef MYX11_DEBUG - qDebug() << hex << xe->xany.window << "Other X event" << xe->type; -#endif - break; - } - return quit; -}; - - - -MyDisplay::MyDisplay() -{ - char *display_name = getenv("DISPLAY"); - display = XOpenDisplay(display_name); - if (!display) { - fprintf(stderr, "Cannot connect to X server: %s\n", - display_name); - exit(1); - } - -#ifndef DONT_USE_MIT_SHM - Status MIT_SHM_extension_supported = XShmQueryExtension (display); - Q_ASSERT(MIT_SHM_extension_supported == True); -#endif - original_x_errhandler = XSetErrorHandler(qt_x_errhandler); - - if (qgetenv("DO_X_SYNCHRONIZE").toInt()) - XSynchronize(display, true); - - screen = DefaultScreen(display); - width = DisplayWidth(display, screen); - height = DisplayHeight(display, screen); - physicalWidth = DisplayWidthMM(display, screen); - physicalHeight = DisplayHeightMM(display, screen); - - int xSocketNumber = XConnectionNumber(display); -#ifdef MYX11_DEBUG - qDebug() << "X socket:"<< xSocketNumber; -#endif - QSocketNotifier *sock = new QSocketNotifier(xSocketNumber, QSocketNotifier::Read, this); - connect(sock, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); - - wmProtocolsAtom = XInternAtom (display, "WM_PROTOCOLS", False); - wmDeleteWindowAtom = XInternAtom (display, "WM_DELETE_WINDOW", False); - - cursors = new MyX11Cursors(display); -} - - -MyDisplay::~MyDisplay() -{ - XCloseDisplay(display); -} - - -void MyDisplay::eventDispatcher() -{ -// qDebug() << "eventDispatcher"; - - - ulong marker = XNextRequest(display); -// int i = 0; - while (XPending(display)) { - XEvent event; - XNextEvent(display, &event); - /* done = */ - handleEvent(&event); - - if (event.xany.serial >= marker) { -#ifdef MYX11_DEBUG - qDebug() << "potential livelock averted"; -#endif -#if 0 - if (XEventsQueued(display, QueuedAfterFlush)) { - qDebug() << " with events queued"; - QTimer::singleShot(0, this, SLOT(eventDispatcher())); - } -#endif - break; - } - } -} - - -QImage MyDisplay::grabWindow(Window window, int x, int y, int w, int h) -{ - if (w == 0 || h ==0) - return QImage(); - - //WinId 0 means the desktop widget - if (!window) - window = rootWindow(); - - XWindowAttributes window_attr; - if (!XGetWindowAttributes(display, window, &window_attr)) - return QImage(); - - if (w < 0) - w = window_attr.width - x; - if (h < 0) - h = window_attr.height - y; - - // Ideally, we should also limit ourselves to the screen area, but the Qt docs say - // that it's "unsafe" to go outside the screen, so we can ignore that problem. - - //We're definitely not optimizing for speed... - XImage *xi = XGetImage(display, window, x, y, w, h, AllPlanes, ZPixmap); - - if (!xi) - return QImage(); - - //taking a copy to make sure we have ownership -- not fast - QImage result = QImage( (uchar*) xi->data, xi->width, xi->height, xi->bytes_per_line, QImage::Format_RGB32 ).copy(); - - XDestroyImage(xi); - - return result; -} - - - - -struct MyShmImageInfo { - MyShmImageInfo(Display *xdisplay) : image(0), display(xdisplay) {} - ~MyShmImageInfo() { destroy(); } - - void destroy(); - - XShmSegmentInfo shminfo; - XImage *image; - Display *display; -}; - -MyWindow::MyWindow(MyDisplay *display, int x, int y, int w, int h) -{ - xd = display; - - xd->windowList.append(this); - - window = XCreateSimpleWindow(xd->display, xd->rootWindow(), - x, y, w, h, 0 /*border_width*/, - xd->blackPixel(), xd->whitePixel()); - - -#ifdef MYX11_DEBUG - qDebug() << "MyWindow::MyWindow" << hex << window; -#endif - - - width = -1; - height = -1; - xpos = -1; - ypos = -1; - - XSetWindowBackgroundPixmap(xd->display, window, XNone); - - XSelectInput(xd->display, window, ExposureMask | KeyPressMask | KeyReleaseMask | - EnterWindowMask | LeaveWindowMask | FocusChangeMask | - PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | - StructureNotifyMask); - - gc = createGC(); - - XChangeProperty (xd->display, window, - wmProtocolsAtom, - XA_ATOM, 32, PropModeAppend, - (unsigned char *) &wmDeleteWindowAtom, 1); - - - setWindowTitle(QLatin1String("Qt Lighthouse")); - - currentCursor = -1; - - image_info = 0; - painted = false; -} - - -void MyWindow::setWindowTitle(const QString &title) - -{ - QByteArray ba = title.toLatin1(); //We're not making a general solution here... - XTextProperty windowName; - windowName.value = (unsigned char *)ba.constData(); - windowName.encoding = XA_STRING; - windowName.format = 8; - windowName.nitems = ba.length(); - - XSetWMName(xd->display, window, &windowName); -} - -MyWindow::~MyWindow() -{ -#ifdef MYX11_DEBUG - qDebug() << "~MyWindow" << hex << window; -#endif - XFreeGC(xd->display, gc); - XDestroyWindow(xd->display, window); - - xd->windowList.removeAll(this); - - delete image_info; -} - -GC MyWindow::createGC() -{ - GC gc; - - gc = XCreateGC(xd->display, window, 0, 0); - if (gc < 0) { - qWarning("MyWindow::createGC() could not create GC"); - } - return gc; -} - -void MyWindow::closeEvent() -{ - windowTL->handleCloseEvent(); -} - -void MyWindow::paintEvent() -{ -#ifdef MYX11_DEBUG - qDebug() << "MyWindow::paintEvent" << shm_img.size() << painted; -#endif - if (!painted) - return; - -#ifdef DONT_USE_MIT_SHM - // just convert the image every time... - if (!shm_img.isNull()) { - Visual *visual = DefaultVisual(xd->display, xd->screen); - - QImage image = shm_img; - //img.convertToFormat( - XImage *xi = XCreateImage(xd->display, visual, 24, ZPixmap, - 0, (char *) image.scanLine(0), image.width(), image.height(), - 32, image.bytesPerLine()); - - int x = 0; - int y = 0; - - /*int r =*/ XPutImage(xd->display, window, gc, xi, 0, 0, x, y, image.width(), image.height()); - - xi->data = 0; // QImage owns these bits - XDestroyImage(xi); - } -#else - // Use MIT_SHM - if (image_info->image) { - //qDebug() << "Here we go" << image_info->image->width << image_info->image->height; - int x = 0; - int y = 0; - - // We could set send_event to true, and then use the ShmCompletion to synchronize, - // but let's do like Qt/11 and just use XSync - XShmPutImage (xd->display, window, gc, image_info->image, 0, 0, - x, y, image_info->image->width, image_info->image->height, - /*send_event*/ False); - - XSync(xd->display, False); - } -#endif -} - -#ifndef DONT_USE_MIT_SHM -void MyShmImageInfo::destroy() -{ - XShmDetach (display, &shminfo); - XDestroyImage (image); - shmdt (shminfo.shmaddr); - shmctl (shminfo.shmid, IPC_RMID, 0); -} -#endif - -void MyWindow::resizeShmImage(int width, int height) -{ -#ifdef DONT_USE_MIT_SHM - shm_img = QImage(width, height, QImage::Format_RGB32); -#else - if (image_info) - image_info->destroy(); - else - image_info = new MyShmImageInfo(xd->display); - - Visual *visual = DefaultVisual(xd->display, xd->screen); - - - XImage *image = XShmCreateImage (xd->display, visual, 24, ZPixmap, 0, - &image_info->shminfo, width, height); - - - image_info->shminfo.shmid = shmget (IPC_PRIVATE, - image->bytes_per_line * image->height, IPC_CREAT|0777); - - image_info->shminfo.shmaddr = image->data = (char*)shmat (image_info->shminfo.shmid, 0, 0); - image_info->shminfo.readOnly = False; - - image_info->image = image; - - Status shm_attach_status = XShmAttach(xd->display, &image_info->shminfo); - - Q_ASSERT(shm_attach_status == True); - - shm_img = QImage( (uchar*) image->data, image->width, image->height, image->bytes_per_line, QImage::Format_RGB32 ); -#endif - painted = false; -} - - -void MyWindow::resizeBuffer(QSize s) -{ - if (shm_img.size() != s) - resizeShmImage(s.width(), s.height()); -} - -QSize MyWindow::bufferSize() const -{ - return shm_img.size(); -} - - -void MyWindow::resizeEvent(XConfigureEvent *e) -{ - - if ((e->width != width || e->height != height) && e->x == 0 && e->y == 0) { - //qDebug() << "resize with bogus pos" << e->x << e->y << e->width << e->height << "window"<< hex << window; - } else { - //qDebug() << "geometry change" << e->x << e->y << e->width << e->height << "window"<< hex << window; - xpos = e->x; - ypos = e->y; - } - width = e->width; - height = e->height; - -#ifdef MYX11_DEBUG - qDebug() << hex << window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << "geometry" << xpos << ypos << width << height << "img:" << shm_img.size(); -#endif - - windowTL->handleGeometryChange(xpos, ypos, width, height); -} - -#if 0 -void MyWindow::setSize(int w, int h) -{ - XResizeWindow(xd->display, window, w, h); -} -#endif - -void MyWindow::setGeometry(int x, int y, int w, int h) -{ -#ifdef MYX11_DEBUG - qDebug() << "MyWindow::setGeometry" << hex << window << dec << x << y << w << h << "img:" << shm_img.size(); -#endif - XMoveResizeWindow(xd->display, window, x, y, w, h); -} - - -void MyWindow::enterEvent(XCrossingEvent *) -{ -#ifdef MYX11_DEBUG - qDebug() << "MyWindow::enterEvent" << hex << window; -#endif - windowTL->handleEnterEvent(); -} - -void MyWindow::leaveEvent(XCrossingEvent *) -{ -#ifdef MYX11_DEBUG - qDebug() << "MyWindow::enterEvent" << hex << window; -#endif - windowTL->handleLeaveEvent(); -} - -void MyWindow::mousePressEvent(XButtonEvent *e) -{ - static long prevTime = 0; - static Window prevWindow; - static int prevX = -999; - static int prevY = -999; - - QEvent::Type type = QEvent::MouseButtonPress; - - if (e->window == prevWindow && long(e->time) - prevTime < QApplication::doubleClickInterval() - && qAbs(e->x - prevX) < 5 && qAbs(e->y - prevY) < 5) { - type = QEvent::MouseButtonDblClick; - prevTime = e->time - QApplication::doubleClickInterval(); //no double click next time - } else { - prevTime = e->time; - } - prevWindow = e->window; - prevX = e->x; - prevY = e->y; - - windowTL->handleMouseEvent(type, e); -} - -void MyWindow::mouseReleaseEvent(XButtonEvent *e) -{ - windowTL->handleMouseEvent(QEvent::MouseButtonRelease, e); -} - -void MyWindow::mouseMoveEvent(XButtonEvent *e) -{ - windowTL->handleMouseEvent(QEvent::MouseMove, e); -} - -#ifdef KeyPress -#undef KeyPress -#endif - -void MyWindow::keyPressEvent(XKeyEvent *e) -{ - windowTL->handleKeyEvent(QEvent::KeyPress, e); -} - -#ifdef KeyRelease -#undef KeyRelease -#endif - -void MyWindow::keyReleaseEvent(XKeyEvent *e) -{ - windowTL->handleKeyEvent(QEvent::KeyRelease, e); -} - - -// WindowFlag stuff, lots of copied code from qwidget_x11.cpp... - -//We're hacking here... - - -// MWM support -struct QtMWMHints { - ulong flags, functions, decorations; - long input_mode; - ulong status; -}; - -enum { - MWM_HINTS_FUNCTIONS = (1L << 0), - - MWM_FUNC_ALL = (1L << 0), - MWM_FUNC_RESIZE = (1L << 1), - MWM_FUNC_MOVE = (1L << 2), - MWM_FUNC_MINIMIZE = (1L << 3), - MWM_FUNC_MAXIMIZE = (1L << 4), - MWM_FUNC_CLOSE = (1L << 5), - - MWM_HINTS_DECORATIONS = (1L << 1), - - MWM_DECOR_ALL = (1L << 0), - MWM_DECOR_BORDER = (1L << 1), - MWM_DECOR_RESIZEH = (1L << 2), - MWM_DECOR_TITLE = (1L << 3), - MWM_DECOR_MENU = (1L << 4), - MWM_DECOR_MINIMIZE = (1L << 5), - MWM_DECOR_MAXIMIZE = (1L << 6), - - MWM_HINTS_INPUT_MODE = (1L << 2), - - MWM_INPUT_MODELESS = 0L, - MWM_INPUT_PRIMARY_APPLICATION_MODAL = 1L, - MWM_INPUT_FULL_APPLICATION_MODAL = 3L -}; - -static Atom mwm_hint_atom = XNone; - -static QtMWMHints GetMWMHints(Display *display, Window window) -{ - QtMWMHints mwmhints; - - Atom type; - int format; - ulong nitems, bytesLeft; - uchar *data = 0; - if ((XGetWindowProperty(display, window, mwm_hint_atom, 0, 5, false, - mwm_hint_atom, &type, &format, &nitems, &bytesLeft, - &data) == Success) - && (type == mwm_hint_atom - && format == 32 - && nitems >= 5)) { - mwmhints = *(reinterpret_cast(data)); - } else { - mwmhints.flags = 0L; - mwmhints.functions = MWM_FUNC_ALL; - mwmhints.decorations = MWM_DECOR_ALL; - mwmhints.input_mode = 0L; - mwmhints.status = 0L; - } - - if (data) - XFree(data); - - return mwmhints; -} - -static void SetMWMHints(Display *display, Window window, const QtMWMHints &mwmhints) -{ - if (mwmhints.flags != 0l) { - XChangeProperty(display, window, mwm_hint_atom, mwm_hint_atom, 32, - PropModeReplace, (unsigned char *) &mwmhints, 5); - } else { - XDeleteProperty(display, window, mwm_hint_atom); - } -} - -// Returns true if we should set WM_TRANSIENT_FOR on \a w -static inline bool isTransient(const QWidget *w) -{ - return ((w->windowType() == Qt::Dialog - || w->windowType() == Qt::Sheet - || w->windowType() == Qt::Tool - || w->windowType() == Qt::SplashScreen - || w->windowType() == Qt::ToolTip - || w->windowType() == Qt::Drawer - || w->windowType() == Qt::Popup) - && !w->testAttribute(Qt::WA_X11BypassTransientForHint)); -} - - - -Qt::WindowFlags MyWindow::setWindowFlags(Qt::WindowFlags flags) -{ - - if (mwm_hint_atom == XNone) { - mwm_hint_atom = XInternAtom(xd->display, "_MOTIF_WM_HINTS\0", False); - } - -#ifdef MYX11_DEBUG - qDebug() << "MyWindow::setWindowFlags" << hex << window << "flags" << flags; -#endif - Qt::WindowType type = static_cast(int(flags & Qt::WindowType_Mask)); - - if (type == Qt::ToolTip) - flags |= Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint; - if (type == Qt::Popup) - flags |= Qt::X11BypassWindowManagerHint; - - bool topLevel = (flags & Qt::Window); - bool popup = (type == Qt::Popup); - bool dialog = (type == Qt::Dialog - || type == Qt::Sheet); - bool desktop = (type == Qt::Desktop); - bool tool = (type == Qt::Tool || type == Qt::SplashScreen - || type == Qt::ToolTip || type == Qt::Drawer); - - bool tooltip = (type == Qt::ToolTip); - - XSetWindowAttributes wsa; - - QtMWMHints mwmhints; - mwmhints.flags = 0L; - mwmhints.functions = 0L; - mwmhints.decorations = 0; - mwmhints.input_mode = 0L; - mwmhints.status = 0L; - - - ulong wsa_mask = 0; - if (type != Qt::SplashScreen) { // && customize) { - mwmhints.flags |= MWM_HINTS_DECORATIONS; - - bool customize = flags & Qt::CustomizeWindowHint; - if (!(flags & Qt::FramelessWindowHint) && !(customize && !(flags & Qt::WindowTitleHint))) { - mwmhints.decorations |= MWM_DECOR_BORDER; - mwmhints.decorations |= MWM_DECOR_RESIZEH; - - if (flags & Qt::WindowTitleHint) - mwmhints.decorations |= MWM_DECOR_TITLE; - - if (flags & Qt::WindowSystemMenuHint) - mwmhints.decorations |= MWM_DECOR_MENU; - - if (flags & Qt::WindowMinimizeButtonHint) { - mwmhints.decorations |= MWM_DECOR_MINIMIZE; - mwmhints.functions |= MWM_FUNC_MINIMIZE; - } - - if (flags & Qt::WindowMaximizeButtonHint) { - mwmhints.decorations |= MWM_DECOR_MAXIMIZE; - mwmhints.functions |= MWM_FUNC_MAXIMIZE; - } - - if (flags & Qt::WindowCloseButtonHint) - mwmhints.functions |= MWM_FUNC_CLOSE; - } - } else { - // if type == Qt::SplashScreen - mwmhints.decorations = MWM_DECOR_ALL; - } - - if (tool) { - wsa.save_under = True; - wsa_mask |= CWSaveUnder; - } - - if (flags & Qt::X11BypassWindowManagerHint) { - wsa.override_redirect = True; - wsa_mask |= CWOverrideRedirect; - } -#if 0 - if (wsa_mask && initializeWindow) { - Q_ASSERT(id); - XChangeWindowAttributes(dpy, id, wsa_mask, &wsa); - } -#endif - if (mwmhints.functions != 0) { - mwmhints.flags |= MWM_HINTS_FUNCTIONS; - mwmhints.functions |= MWM_FUNC_MOVE | MWM_FUNC_RESIZE; - } else { - mwmhints.functions = MWM_FUNC_ALL; - } - - if (!(flags & Qt::FramelessWindowHint) - && flags & Qt::CustomizeWindowHint - && flags & Qt::WindowTitleHint - && !(flags & - (Qt::WindowMinimizeButtonHint - | Qt::WindowMaximizeButtonHint - | Qt::WindowCloseButtonHint))) { - // a special case - only the titlebar without any button - mwmhints.flags = MWM_HINTS_FUNCTIONS; - mwmhints.functions = MWM_FUNC_MOVE | MWM_FUNC_RESIZE; - mwmhints.decorations = 0; - } - - SetMWMHints(xd->display, window, mwmhints); - -//##### only if initializeWindow??? - - if (popup || tooltip) { // popup widget -#ifdef MYX11_DEBUG - qDebug() << "Doing XChangeWindowAttributes for popup" << wsa.override_redirect; -#endif - // set EWMH window types - // setNetWmWindowTypes(); - - wsa.override_redirect = True; - wsa.save_under = True; - XChangeWindowAttributes(xd->display, window, CWOverrideRedirect | CWSaveUnder, - &wsa); - } else { -#ifdef MYX11_DEBUG - qDebug() << "Doing XChangeWindowAttributes for non-popup"; -#endif - } - - return flags; -} - -void MyWindow::setVisible(bool visible) -{ -#ifdef MYX11_DEBUG - qDebug() << "MyWindow::setVisible" << visible << hex << window; -#endif - if (visible) - XMapWindow(xd->display, window); - else - XUnmapWindow(xd->display, window); -} - -MyX11Cursors::MyX11Cursors(Display * d) : firstExpired(0), lastExpired(0), display(d), removalDelay(3) -{ - connect(&timer, SIGNAL(timeout()), this, SLOT(timeout())); -} - -void MyX11Cursors::insertNode(MyX11CursorNode * node) -{ - QDateTime now = QDateTime::currentDateTime(); - QDateTime timeout = now.addSecs(removalDelay); - node->setExpiration(timeout); - node->setPost(0); - if (lastExpired) { - lastExpired->setPost(node); - node->setAnte(lastExpired); - } - lastExpired = node; - if (!firstExpired) { - firstExpired = node; - node->setAnte(0); - int interval = removalDelay * 1000; - timer.setInterval(interval); - timer.start(); - } -} - -void MyX11Cursors::removeNode(MyX11CursorNode * node) -{ - MyX11CursorNode *pre = node->ante(); - MyX11CursorNode *post = node->post(); - if (pre) - pre->setPost(post); - if (post) - post->setAnte(pre); - if (node == lastExpired) - lastExpired = pre; - if (node == firstExpired) { - firstExpired = post; - if (!firstExpired) { - timer.stop(); - return; - } - int interval = QDateTime::currentDateTime().secsTo(firstExpired->expiration()) * 1000; - timer.stop(); - timer.setInterval(interval); - timer.start(); - } -} - -void MyX11Cursors::incrementUseCount(int id) -{ - MyX11CursorNode * node = lookupMap.value(id); - Q_ASSERT(node); - if (!node->refCount) - removeNode(node); - node->refCount++; -} - -void MyX11Cursors::decrementUseCount(int id) -{ - MyX11CursorNode * node = lookupMap.value(id); - Q_ASSERT(node); - node->refCount--; - if (!node->refCount) - insertNode(node); -} - -void MyX11Cursors::createNode(int id, Cursor c) -{ - MyX11CursorNode * node = new MyX11CursorNode(id, c); - lookupMap.insert(id, node); -} - -void MyX11Cursors::timeout() -{ - MyX11CursorNode * node; - node = firstExpired; - QDateTime now = QDateTime::currentDateTime(); - while (node && now.secsTo(node->expiration()) < 1) { - Cursor c = node->cursor(); - int id = node->id(); - lookupMap.take(id); - MyX11CursorNode * tmp = node; - node = node->post(); - delete tmp; - XFreeCursor(display, c); - } - firstExpired = node; - if (node == 0) { - timer.stop(); - lastExpired = 0; - } - else { - int interval = QDateTime::currentDateTime().secsTo(firstExpired->expiration()) * 1000; - timer.setInterval(interval); - timer.start(); - } -} - -Cursor MyX11Cursors::cursor(int id) -{ - MyX11CursorNode * node = lookupMap.value(id); - Q_ASSERT(node); - return node->cursor(); -} - -void MyWindow::setCursor(QCursor * cursor) -{ - int id = cursor->handle(); - if (id == currentCursor) - return; - Cursor c; - if (!xd->cursors->exists(id)) { - if (cursor->shape() == Qt::BitmapCursor) - c = createCursorBitmap(cursor); - else - c = createCursorShape(cursor->shape()); - if (!c) { - return; - } - xd->cursors->createNode(id, c); - } else { - xd->cursors->incrementUseCount(id); - c = xd->cursors->cursor(id); - } - - if (currentCursor != -1) - xd->cursors->decrementUseCount(currentCursor); - currentCursor = id; - - XDefineCursor(xd->display, window, c); - XFlush(xd->display); -} - -Cursor MyWindow::createCursorBitmap(QCursor * cursor) -{ - XColor bg, fg; - bg.red = 255 << 8; - bg.green = 255 << 8; - bg.blue = 255 << 8; - fg.red = 0; - fg.green = 0; - fg.blue = 0; - QPoint spot = cursor->hotSpot(); - Window rootwin = window; - - QImage mapImage = cursor->bitmap()->toImage().convertToFormat(QImage::Format_MonoLSB); - QImage maskImage = cursor->mask()->toImage().convertToFormat(QImage::Format_MonoLSB); - - int width = cursor->bitmap()->width(); - int height = cursor->bitmap()->height(); - int bytesPerLine = mapImage.bytesPerLine(); - int destLineSize = width / 8; - if (width % 8) - destLineSize++; - - const uchar * map = mapImage.bits(); - const uchar * mask = maskImage.bits(); - - char * mapBits = new char[height * destLineSize]; - char * maskBits = new char[height * destLineSize]; - for (int i = 0; i < height; i++) { - memcpy(mapBits + (destLineSize * i),map + (bytesPerLine * i), destLineSize); - memcpy(maskBits + (destLineSize * i),mask + (bytesPerLine * i), destLineSize); - } - - Pixmap cp = XCreateBitmapFromData(xd->display, rootwin, mapBits, width, height); - Pixmap mp = XCreateBitmapFromData(xd->display, rootwin, maskBits, width, height); - Cursor c = XCreatePixmapCursor(xd->display, cp, mp, &fg, &bg, spot.x(), spot.y()); - XFreePixmap(xd->display, cp); - XFreePixmap(xd->display, mp); - delete[] mapBits; - delete[] maskBits; - - return c; -} - -Cursor MyWindow::createCursorShape(int cshape) -{ - Cursor cursor = 0; - - if (cshape < 0 || cshape > Qt::LastCursor) - return 0; - - switch (cshape) { - case Qt::ArrowCursor: - cursor = XCreateFontCursor(xd->display, XC_left_ptr); - break; - case Qt::UpArrowCursor: - cursor = XCreateFontCursor(xd->display, XC_center_ptr); - break; - case Qt::CrossCursor: - cursor = XCreateFontCursor(xd->display, XC_crosshair); - break; - case Qt::WaitCursor: - cursor = XCreateFontCursor(xd->display, XC_watch); - break; - case Qt::IBeamCursor: - cursor = XCreateFontCursor(xd->display, XC_xterm); - break; - case Qt::SizeAllCursor: - cursor = XCreateFontCursor(xd->display, XC_fleur); - break; - case Qt::PointingHandCursor: - cursor = XCreateFontCursor(xd->display, XC_hand2); - break; - case Qt::SizeBDiagCursor: - cursor = XCreateFontCursor(xd->display, XC_top_right_corner); - break; - case Qt::SizeFDiagCursor: - cursor = XCreateFontCursor(xd->display, XC_bottom_right_corner); - break; - case Qt::SizeVerCursor: - case Qt::SplitVCursor: - cursor = XCreateFontCursor(xd->display, XC_sb_v_double_arrow); - break; - case Qt::SizeHorCursor: - case Qt::SplitHCursor: - cursor = XCreateFontCursor(xd->display, XC_sb_h_double_arrow); - break; - case Qt::WhatsThisCursor: - cursor = XCreateFontCursor(xd->display, XC_question_arrow); - break; - case Qt::ForbiddenCursor: - cursor = XCreateFontCursor(xd->display, XC_circle); - break; - case Qt::BusyCursor: - cursor = XCreateFontCursor(xd->display, XC_watch); - break; - - default: //default cursor for all the rest - break; - } - return cursor; -} - - -#if 0 - - - switch (cshape) { // map Q cursor to X cursor - case Qt::BlankCursor: - XColor bg, fg; - bg.red = 255 << 8; - bg.green = 255 << 8; - bg.blue = 255 << 8; - fg.red = 0; - fg.green = 0; - fg.blue = 0; - pm = XCreateBitmapFromData(dpy, rootwin, cur_blank_bits, 16, 16); - pmm = XCreateBitmapFromData(dpy, rootwin, cur_blank_bits, 16, 16); - hcurs = XCreatePixmapCursor(dpy, pm, pmm, &fg, &bg, 8, 8); - return; - break; - default: - qWarning("QCursor::update: Invalid cursor shape %d", cshape); - return; - } -#endif diff --git a/src/plugins/platforms/testlite/x11util.h b/src/plugins/platforms/testlite/x11util.h deleted file mode 100644 index b28d1e8..0000000 --- a/src/plugins/platforms/testlite/x11util.h +++ /dev/null @@ -1,204 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MYX11UTIL_H -#define MYX11UTIL_H - -#include -#include -#include -#include - -#include - -#include -#include - - -class MyWindow; -class MyX11Cursors; - -class MyDisplay : public QObject -{ - Q_OBJECT; -public: - MyDisplay(); - ~MyDisplay(); - - Window rootWindow() { return RootWindow(display, screen); } - unsigned long blackPixel() { return BlackPixel(display, screen); } - unsigned long whitePixel() { return WhitePixel(display, screen); } - - bool handleEvent(XEvent *xe); - QImage grabWindow(Window window, int x, int y, int w, int h); - -public slots: - void eventDispatcher(); - -public: //### - Display * display; - int screen; - int width, height; - int physicalWidth; - int physicalHeight; - - QList windowList; - - MyX11Cursors * cursors; -}; - -class QTestLiteWindow; //### abstract callback interface, anyone? - -struct MyShmImageInfo; - -class MyWindow : public QObject -{ - Q_OBJECT; -public: - MyWindow(MyDisplay *xd, int x, int y, int w, int h); - ~MyWindow(); - - - void mousePressEvent(XButtonEvent*); - void mouseReleaseEvent(XButtonEvent*); - void mouseMoveEvent(XButtonEvent*); - - void keyPressEvent(XKeyEvent*); - void keyReleaseEvent(XKeyEvent*); - - void enterEvent(XCrossingEvent*); - void leaveEvent(XCrossingEvent*); - - void closeEvent(); - void paintEvent(); - void resizeEvent(XConfigureEvent *configure_event); -// void setSize(int w, int h); - void setGeometry(int x, int y, int w, int h); - - GC createGC(); - - Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); - void setVisible(bool visible); - void setCursor(QCursor * cursor); - Cursor createCursorShape(int cshape); - Cursor createCursorBitmap(QCursor * cursor); - - void setWindowTitle(const QString &title); - - QImage *image() { return &shm_img; } - -public: //### - - int xpos, ypos; - int width, height; - Window window; - MyDisplay *xd; - GC gc; - - QTestLiteWindow *windowTL; - - int currentCursor; - bool painted; - void resizeBuffer(QSize); - QSize bufferSize() const; - -private: - void resizeShmImage(int width, int height); - - QImage shm_img; - MyShmImageInfo *image_info; -}; - -class MyX11CursorNode -{ -public: - MyX11CursorNode(int id, Cursor c) { idValue = id; cursorValue = c; refCount = 1; } - QDateTime expiration() { return t; } - void setExpiration(QDateTime val) { t = val; } - MyX11CursorNode * ante() { return before; } - void setAnte(MyX11CursorNode *node) { before = node; } - MyX11CursorNode * post() { return after; } - void setPost(MyX11CursorNode *node) { after = node; } - Cursor cursor() { return cursorValue; } - int id() { return idValue; } - unsigned int refCount; - -private: - MyX11CursorNode *before; - MyX11CursorNode *after; - QDateTime t; - Cursor cursorValue; - int idValue; - - Display * display; -}; - -class MyX11Cursors : public QObject -{ - Q_OBJECT -public: - MyX11Cursors(Display * d); - ~MyX11Cursors() { timer.stop(); } - void incrementUseCount(int id); - void decrementUseCount(int id); - void createNode(int id, Cursor c); - bool exists(int id) { return lookupMap.contains(id); } - Cursor cursor(int id); -public slots: - void timeout(); - -private: - void removeNode(MyX11CursorNode *node); - void insertNode(MyX11CursorNode *node); - - // linked list of cursors currently not assigned to any window - MyX11CursorNode *firstExpired; - MyX11CursorNode *lastExpired; - - QHash lookupMap; - QTimer timer; - - Display *display; - - int removalDelay; -}; - -#endif // MYX11UTIL_H -- cgit v0.12 From b260d7b806c239505324d6a4762d3755e74a1b61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 12 Apr 2010 12:33:25 +0200 Subject: Fix forward declaration in qplatformwindow_lite.h --- src/gui/kernel/qplatformwindow_lite.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qplatformwindow_lite.h b/src/gui/kernel/qplatformwindow_lite.h index 8771cfe..583ac28 100644 --- a/src/gui/kernel/qplatformwindow_lite.h +++ b/src/gui/kernel/qplatformwindow_lite.h @@ -47,13 +47,13 @@ #include #include -class QPlatformWindowPrivate; -class QWidget; QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +class QPlatformWindowPrivate; +class QWidget; class Q_GUI_EXPORT QPlatformWindow { Q_DECLARE_PRIVATE(QPlatformWindow); -- cgit v0.12 From 0851bd20f126a7dafec776771795e08de5ac9fe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 12 Apr 2010 12:46:34 +0200 Subject: Cleaned up Blitter Paint engine and fixed a couple of bugs --- src/gui/painting/qpaintengine_blitter.cpp | 111 ++++++++++----------- src/gui/painting/qpaintengine_blitter_p.h | 1 - .../platforms/directfb/qblitter_directfb.cpp | 5 +- 3 files changed, 56 insertions(+), 61 deletions(-) diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index 0b74a4d..54a146f 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -30,14 +30,20 @@ static inline void updateStateBits(uint *state, uint mask, bool on) *state = on ? (*state | mask) : (*state & ~mask); } +static inline bool checkStateAgainstMask(uint state, uint mask) +{ + return !state || (state & mask && !(state & ~mask)); +} + class CapabilitiesToStateMask { public: CapabilitiesToStateMask(QBlittable::Capabilities capabilities) : m_capabilities(capabilities), - fillRectMask(0), fillRectState(0), - drawRectMask(0), drawRectState(0), - drawPixmapMask(0), drawPixmapState(0) + fillRectMask(0), + drawRectMask(0), + drawPixmapMask(0), + capabillitiesState(0) { if (capabilities & QBlittable::SolidRectCapability) { setFillRectMask(); @@ -48,23 +54,26 @@ public: if (capabilities & QBlittable::SourceOverPixmapCapability) { setSourceOverPixmapMask(); } + if (capabilities & QBlittable::SourceOverScaledPixmapCapability) { + setSourceOverScaledPixmapMask(); + } } inline bool canBlitterFillRect() const { - return !fillRectState || (fillRectState & fillRectMask); + return checkStateAgainstMask(capabillitiesState,fillRectMask); } inline bool canBlitterDrawRectMask() const { - return drawRectState & drawRectMask; + return checkStateAgainstMask(capabillitiesState,drawRectMask); } bool canBlitterDrawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) const { if (pm.pixmapData()->classId() != QPixmapData::BlitterClass) return false; - if ((!drawPixmapState) || drawPixmapState & drawPixmapMask) { + if (checkStateAgainstMask(capabillitiesState,drawPixmapMask)) { if (m_capabilities & (QBlittable::SourceOverPixmapCapability | QBlittable::SourceOverScaledPixmapCapability)) { if (r.size() != sr.size()) { @@ -80,21 +89,8 @@ public: return false; } - inline void updateFillRectBits(uint mask, bool on) { - updateStateBits(&fillRectState,mask,on); - } - - inline void updateDrawRectBits(uint mask, bool on) { - updateStateBits(&drawRectState,mask,on); - } - - inline void updateDrawPixmapBits(uint mask, bool on) { - updateStateBits(&drawPixmapState,mask,on); - } - inline void updateAllWithBits(uint mask, bool on) { - updateStateBits(&fillRectState,mask,on); - updateStateBits(&drawRectState,mask,on); - updateStateBits(&drawPixmapState,mask,on); + inline void updateState(uint mask, bool on) { + updateStateBits(&capabillitiesState,mask,on); } public: @@ -138,17 +134,21 @@ public: setSourcePixmapMask(); } + void setSourceOverScaledPixmapMask() { + setSourceOverPixmapMask(); + updateStateBits(&drawRectMask, STATE_XFORM_SCALE, true); + } + QBlittable::Capabilities m_capabilities; uint fillRectMask; - uint fillRectState; uint drawRectMask; - uint drawRectState; uint drawPixmapMask; - uint drawPixmapState; + uint capabillitiesState; }; class QBlitterPaintEnginePrivate : public QPaintEngineExPrivate { + Q_DECLARE_PUBLIC(QBlitterPaintEngine); public: QBlitterPaintEnginePrivate(QBlittablePixmapData *p) : QPaintEngineExPrivate(), @@ -176,12 +176,13 @@ public: } void fillRect(const QRectF &rect, const QColor &color) { + Q_Q(QBlitterPaintEngine); pmData->unmarkRasterOverlay(rect); QRectF targetRect = rect; if (hasXForm) { - targetRect = state->matrix.mapRect(rect); + targetRect = q->state()->matrix.mapRect(rect); } - const QClipData *clipData = raster->d_func()->clip();; + const QClipData *clipData = q->clip(); if (clipData) { if (clipData->hasRectClip) { unlock(); @@ -214,23 +215,23 @@ public: QRectF intersectedRect = clip.intersected(target); if (intersectedRect.isEmpty()) return; - QRectF source = sr; if(intersectedRect.size() != target.size()) { qreal deltaTop = target.top() - intersectedRect.top(); qreal deltaLeft = target.left() - intersectedRect.left(); qreal deltaBottom = target.bottom() - intersectedRect.bottom(); qreal deltaRight = target.right() - intersectedRect.right(); - source.adjust(-deltaLeft,-deltaTop,deltaRight,deltaBottom); + source.adjust(-deltaLeft,-deltaTop,-deltaRight,-deltaBottom); } pmData->unmarkRasterOverlay(intersectedRect); pmData->blittable()->drawPixmap(intersectedRect, pm, source); } void updateClip() { - const QClipData *clip = raster->d_func()->clip(); - bool complex = clip != 0 && !(clip->hasRectClip || clip->hasRegionClip); - capabillities->updateAllWithBits(STATE_CLIP_COMPLEX, complex); + Q_Q(QBlitterPaintEngine); + const QClipData *clip = q->clip(); + bool complex = clip && !(clip->hasRectClip || clip->hasRegionClip); + capabillities->updateState(STATE_CLIP_COMPLEX, complex); } void systemStateChanged() { @@ -238,7 +239,6 @@ public: } QRasterPaintEngine *raster; - QRasterPaintEngineState *state; QBlittablePixmapData *pmData; bool isBlitterLocked; @@ -267,8 +267,6 @@ bool QBlitterPaintEngine::begin(QPaintDevice *pdev) { Q_D(QBlitterPaintEngine); - d->raster->setSystemRect(systemRect()); - d->raster->setSystemClip(systemClip()); setActive(true); bool ok = d->raster->begin(pdev); #ifdef QT_BLITTER_RASTEROVERLAY @@ -282,8 +280,6 @@ bool QBlitterPaintEngine::end() { Q_D(QBlitterPaintEngine); - d->raster->setPaintDevice(0); - d->raster->setActive(false); setActive(false); #ifdef QT_BLITTER_RASTEROVERLAY d->pmData->mergeOverlay(); @@ -321,7 +317,9 @@ void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) { if(rect.size().isEmpty()) return; + Q_D(QBlitterPaintEngine); + if (qbrush_style(brush) == Qt::SolidPattern && qbrush_color(brush).alpha() == 0xff && d->capabillities->canBlitterFillRect()) @@ -336,11 +334,11 @@ void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) qreal y = transformedRect.y(); QPixmap pm = brush.texture(); d->unlock(); - int srcX = (int)(rect.x() - d->raster->state()->brushOrigin.x()) % pm.width(); + int srcX = int(rect.x() - state()->brushOrigin.x()) % pm.width(); if (srcX < 0) srcX = pm.width() + srcX; const int startX = srcX; - int srcY = (int)(rect.y() - d->raster->state()->brushOrigin.y())% pm.height(); + int srcY = int(rect.y() - state()->brushOrigin.y()) % pm.height(); if (srcY < 0) srcY = pm.height() + srcY; while (!rectIsFilled) { @@ -350,7 +348,7 @@ void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) blitWidth = transformedRect.right() -x; if (y + blitHeight > transformedRect.bottom()) blitHeight = transformedRect.bottom() - y; - const QClipData *clipData = d->raster->d_func()->clip(); + const QClipData *clipData = clip(); if (clipData->hasRectClip) { QRect targetRect = QRect(x,y,blitWidth,blitHeight).intersected(clipData->clipRect); if (targetRect.isValid()) { @@ -434,7 +432,7 @@ void QBlitterPaintEngine::penChanged() Q_D(QBlitterPaintEngine); d->lock(); d->raster->penChanged(); - d->capabillities->updateDrawRectBits(STATE_PEN_ENABLED,qpen_style(d->state->pen) != Qt::NoPen); + d->capabillities->updateState(STATE_PEN_ENABLED,qpen_style(state()->pen) != Qt::NoPen); } void QBlitterPaintEngine::brushChanged() @@ -442,11 +440,11 @@ void QBlitterPaintEngine::brushChanged() Q_D(QBlitterPaintEngine); d->raster->brushChanged(); - bool solid = qbrush_style(d->state->brush) == Qt::SolidPattern; + bool solid = qbrush_style(state()->brush) == Qt::SolidPattern; - d->capabillities->updateDrawRectBits(STATE_BRUSH_PATTERN, !solid); - d->capabillities->updateDrawRectBits(STATE_BRUSH_ALPHA, - qbrush_color(d->state->brush).alpha() < 255); + d->capabillities->updateState(STATE_BRUSH_PATTERN, !solid); + d->capabillities->updateState(STATE_BRUSH_ALPHA, + qbrush_color(state()->brush).alpha() < 255); } void QBlitterPaintEngine::brushOriginChanged() @@ -460,8 +458,8 @@ void QBlitterPaintEngine::opacityChanged() Q_D(QBlitterPaintEngine); d->raster->opacityChanged(); - bool translucent = d->state->opacity < 1; - d->capabillities->updateAllWithBits(STATE_ALPHA,translucent); + bool translucent = state()->opacity < 1; + d->capabillities->updateState(STATE_ALPHA,translucent); } void QBlitterPaintEngine::compositionModeChanged() @@ -469,10 +467,10 @@ void QBlitterPaintEngine::compositionModeChanged() Q_D(QBlitterPaintEngine); d->raster->compositionModeChanged(); - bool nonTrivial = d->state->composition_mode != QPainter::CompositionMode_SourceOver - && d->state->composition_mode != QPainter::CompositionMode_Source; + bool nonTrivial = state()->composition_mode != QPainter::CompositionMode_SourceOver + && state()->composition_mode != QPainter::CompositionMode_Source; - d->capabillities->updateAllWithBits(STATE_BLENDING_COMPLEX,nonTrivial); + d->capabillities->updateState(STATE_BLENDING_COMPLEX,nonTrivial); } void QBlitterPaintEngine::renderHintsChanged() @@ -480,9 +478,8 @@ void QBlitterPaintEngine::renderHintsChanged() Q_D(QBlitterPaintEngine); d->raster->renderHintsChanged(); - bool aa = d->state->renderHints & QPainter::Antialiasing; - d->capabillities->updateFillRectBits(STATE_ANTIALIASING, aa); - d->capabillities->updateDrawRectBits(STATE_ANTIALIASING, aa); + bool aa = state()->renderHints & QPainter::Antialiasing; + d->capabillities->updateState(STATE_ANTIALIASING, aa); } @@ -491,9 +488,10 @@ void QBlitterPaintEngine::transformChanged() Q_D(QBlitterPaintEngine); d->raster->transformChanged(); - QTransform::TransformationType type = d->state->matrix.type(); + QTransform::TransformationType type = state()->matrix.type(); - d->capabillities->updateAllWithBits(STATE_XFORM_COMPLEX, type > QTransform::TxScale); + d->capabillities->updateState(STATE_XFORM_COMPLEX, type > QTransform::TxScale); + d->capabillities->updateState(STATE_XFORM_SCALE, type > QTransform::TxTranslate); d->hasXForm = type >= QTransform::TxTranslate; @@ -504,7 +502,7 @@ void QBlitterPaintEngine::drawRects(const QRect *rects, int rectCount) Q_D(QBlitterPaintEngine); if (d->capabillities->canBlitterDrawRectMask()) { for (int i=0; ifillRect(rects[i], qbrush_color(d->state->brush)); + d->fillRect(rects[i], qbrush_color(state()->brush)); } } else { d->pmData->markRasterOverlay(rects,rectCount); @@ -517,7 +515,7 @@ void QBlitterPaintEngine::drawRects(const QRectF *rects, int rectCount) Q_D(QBlitterPaintEngine); if (d->capabillities->canBlitterDrawRectMask()) { for (int i=0; ifillRect(rects[i], qbrush_color(d->state->brush)); + d->fillRect(rects[i], qbrush_color(state()->brush)); } } else { d->pmData->markRasterOverlay(rects,rectCount); @@ -600,7 +598,6 @@ void QBlitterPaintEngine::setState(QPainterState *s) d->lock(); QPaintEngineEx::setState(s); d->raster->setState(s); - d->state = (QRasterPaintEngineState *) s; clipEnabledChanged(); penChanged(); diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h index d436993..3a2fce5 100644 --- a/src/gui/painting/qpaintengine_blitter_p.h +++ b/src/gui/painting/qpaintengine_blitter_p.h @@ -64,7 +64,6 @@ public: private: QRasterPaintEngine *raster() const; - }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qblitter_directfb.cpp b/src/plugins/platforms/directfb/qblitter_directfb.cpp index 08dee0a..6525022 100644 --- a/src/plugins/platforms/directfb/qblitter_directfb.cpp +++ b/src/plugins/platforms/directfb/qblitter_directfb.cpp @@ -28,6 +28,7 @@ QDirectFbBlitter::QDirectFbBlitter(const QSize &rect, IDirectFBSurface *surface) dfb->CreateSurface(dfb,&surfaceDesc, &m_surface); m_surface->Clear(m_surface,0,0,0,0); } + } QDirectFbBlitter::~QDirectFbBlitter() @@ -60,13 +61,11 @@ void QDirectFbBlitter::drawPixmap(const QRectF &rect, const QPixmap &pixmap, con IDirectFBSurface *s = dfbBlitter->m_surface; quint32 blittingFlags = pixmap.hasAlpha()? DSBLIT_BLEND_ALPHACHANNEL : DSBLIT_NOFX; - - s->SetBlittingFlags(s, DFBSurfaceBlittingFlags(blittingFlags)); m_surface->SetBlittingFlags(m_surface, DFBSurfaceBlittingFlags(blittingFlags)); m_surface->SetPorterDuff(m_surface,DSPD_SRC_OVER); m_surface->SetDstBlendFunction(m_surface,DSBF_INVSRCALPHA); - const DFBRectangle sRect = { srcRect.x(), srcRect.y(), rect.width(), rect.height() }; + const DFBRectangle sRect = { srcRect.x(), srcRect.y(), srcRect.width(), srcRect.height() }; DFBResult result; if (rect.width() == srcRect.width() && rect.height() == srcRect.height()) -- cgit v0.12 From 3cf347414ce2203178893fb1fa1d005633d37526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 12 Apr 2010 13:47:52 +0200 Subject: Small optimalisation in DirectfbBlitter --- src/gui/painting/qpaintengine_blitter.cpp | 2 +- src/plugins/platforms/directfb/qblitter_directfb.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index 54a146f..4144696 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -533,7 +533,7 @@ void QBlitterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const Q if (d->hasXForm) { targetRect = state()->matrix.mapRect(r); } - const QClipData *clipData = d->raster->d_func()->clip(); + const QClipData *clipData = clip(); if (clipData) { if (clipData->hasRectClip) { d->clipAndDrawPixmap(clipData->clipRect,targetRect,pm,sr); diff --git a/src/plugins/platforms/directfb/qblitter_directfb.cpp b/src/plugins/platforms/directfb/qblitter_directfb.cpp index 6525022..20f8741 100644 --- a/src/plugins/platforms/directfb/qblitter_directfb.cpp +++ b/src/plugins/platforms/directfb/qblitter_directfb.cpp @@ -60,9 +60,15 @@ void QDirectFbBlitter::drawPixmap(const QRectF &rect, const QPixmap &pixmap, con IDirectFBSurface *s = dfbBlitter->m_surface; - quint32 blittingFlags = pixmap.hasAlpha()? DSBLIT_BLEND_ALPHACHANNEL : DSBLIT_NOFX; + DFBSurfaceBlittingFlags blittingFlags = DSBLIT_NOFX; + DFBSurfacePorterDuffRule porterDuff = DSPD_SRC; + if (pixmap.hasAlpha()) { + blittingFlags = DSBLIT_BLEND_ALPHACHANNEL; + porterDuff = DSPD_SRC_OVER; + } + m_surface->SetBlittingFlags(m_surface, DFBSurfaceBlittingFlags(blittingFlags)); - m_surface->SetPorterDuff(m_surface,DSPD_SRC_OVER); + m_surface->SetPorterDuff(m_surface,porterDuff); m_surface->SetDstBlendFunction(m_surface,DSBF_INVSRCALPHA); const DFBRectangle sRect = { srcRect.x(), srcRect.y(), srcRect.width(), srcRect.height() }; -- cgit v0.12 From 1d768c1deb98a8e32cdbd7790186e1d6a81acc29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 12 Apr 2010 14:20:39 +0200 Subject: Ifdef out QPlatformWindow implementation when not compiling lighthouse --- src/gui/kernel/qwidget.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 7eaf03c..07639ba 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -11842,6 +11842,7 @@ QWindowSurface *QWidget::windowSurface() const return bs ? bs->windowSurface : 0; } +#if defined(Q_WS_LITE) /*! \preliminary @@ -11879,6 +11880,7 @@ QPlatformWindow *QWidget::platformWindow() const return 0; } +#endif //defined(Q_WS_LITE) void QWidgetPrivate::getLayoutItemMargins(int *left, int *top, int *right, int *bottom) const { -- cgit v0.12 From 80c3790501df2ce3a8edf022e469317bc6f66246 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 12 Apr 2010 15:21:35 +0200 Subject: Make the VNC plugin compile and largely work --- src/gui/kernel/qplatformscreen_lite.h | 4 +- src/gui/kernel/qwidget_lite.cpp | 18 +++- src/plugins/platforms/fb_base/fb_base.cpp | 98 ++++++++++++++++------ src/plugins/platforms/fb_base/fb_base.h | 58 ++++++++++--- src/plugins/platforms/testlite/qtestlitewindow.cpp | 1 + src/plugins/platforms/vnc/main.cpp | 8 +- src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp | 22 ++++- src/plugins/platforms/vnc/qgraphicssystem_vnc.h | 11 +-- src/plugins/platforms/vnc/vnc.pro | 4 +- 9 files changed, 168 insertions(+), 56 deletions(-) diff --git a/src/gui/kernel/qplatformscreen_lite.h b/src/gui/kernel/qplatformscreen_lite.h index da0e26b..cae5f42 100644 --- a/src/gui/kernel/qplatformscreen_lite.h +++ b/src/gui/kernel/qplatformscreen_lite.h @@ -44,6 +44,7 @@ #include #include +#include QT_BEGIN_HEADER @@ -51,8 +52,9 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -class Q_GUI_EXPORT QPlatformScreen +class Q_GUI_EXPORT QPlatformScreen : public QObject { + Q_OBJECT public: virtual ~QPlatformScreen() { } diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index cf93c5e..465dbee 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -90,10 +90,8 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO void QWidget::destroy(bool destroyWindow, bool destroySubWindows) { - Q_UNUSED(destroyWindow); + Q_D(QWidget); Q_UNUSED(destroySubWindows); - // XXX - if ((windowType() == Qt::Popup)) qApp->d_func()->closePopup(this); @@ -101,6 +99,20 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) //### we don't have proper focus event handling yet if (this == QApplicationPrivate::active_window) QApplication::setActiveWindow(0); + + if (windowType() != Qt::Desktop) { + if (destroyWindow && isWindow()) { + QTLWExtra *topData = d->maybeTopData(); + if (topData) { + delete topData->platformWindow; + topData->platformWindow = 0; + } + } else { + if (parentWidget() && parentWidget()->testAttribute(Qt::WA_WState_Created)) { + d->hide_sys(); + } + } + } } void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) diff --git a/src/plugins/platforms/fb_base/fb_base.cpp b/src/plugins/platforms/fb_base/fb_base.cpp index d30746a..422222c 100644 --- a/src/plugins/platforms/fb_base/fb_base.cpp +++ b/src/plugins/platforms/fb_base/fb_base.cpp @@ -6,7 +6,7 @@ #include #include -QGraphicsSystemSoftwareCursor::QGraphicsSystemSoftwareCursor(QGraphicsSystemScreen *scr) +QGraphicsSystemSoftwareCursor::QGraphicsSystemSoftwareCursor(QPlatformScreen *scr) : QGraphicsSystemCursor(scr), currentRect(QRect()), prevRect(QRect()) { graphic = new QGraphicsSystemCursorImage(0, 0, 0, 0, 0, 0); @@ -126,6 +126,8 @@ QGraphicsSystemFbScreen::~QGraphicsSystemFbScreen() void QGraphicsSystemFbScreen::setDirty(const QRect &rect) { + +// qDebug() << "QGraphicsSystemFbScreen::setDirty" << rect; repaintRegion += rect; if (!redrawTimer.isActive()) { redrawTimer.start(); @@ -140,7 +142,7 @@ void QGraphicsSystemFbScreen::generateRects() for (int i = 0; i < windowStack.length(); i++) { if (remainingScreen.isEmpty()) break; - if (!windowStack[i]->window()->testAttribute(Qt::WA_TranslucentBackground)) { + if (!windowStack[i]->widget()->testAttribute(Qt::WA_TranslucentBackground)) { remainingScreen -= windowStack[i]->geometry(); QRegion windowRegion(windowStack[i]->geometry()); windowRegion -= remainingScreen; @@ -197,12 +199,13 @@ QRegion QGraphicsSystemFbScreen::doRedraw() for (int layerIndex = layer; layerIndex != -1; layerIndex--) { if (!windowStack[layerIndex]->visible()) continue; - if (windowStack[layerIndex]->window()->isMinimized()) + if (windowStack[layerIndex]->widget()->isMinimized()) continue; QRect windowRect = windowStack[layerIndex]->geometry(); QRect windowIntersect = rect.translated(-windowRect.left(), -windowRect.top()); - compositePainter->drawImage(rect, windowStack[layerIndex]->image(), +// qDebug() << " compositing" << layerIndex << windowStack[layerIndex]->surface->image().size(); + compositePainter->drawImage(rect, windowStack[layerIndex]->surface->image(), windowIntersect); if (firstLayer) { firstLayer = false; @@ -224,24 +227,29 @@ QRegion QGraphicsSystemFbScreen::doRedraw() touchedRegion += repaintRegion; repaintRegion = QRegion(); + + +// qDebug() << "QGraphicsSystemFbScreen::doRedraw" << windowStack.size() << mScreenImage->size() << touchedRegion; + + return touchedRegion; } -void QGraphicsSystemFbScreen::removeWindowSurface(QGraphicsSystemFbWindowSurface * surface) +void QGraphicsSystemFbScreen::removeWindow(QFbWindow * surface) { windowStack.removeOne(surface); invalidateRectCache(); setDirty(surface->geometry()); } -void QGraphicsSystemFbWindowSurface::raise() +void QFbWindow::raise() { mScreen->raise(this); } -void QGraphicsSystemFbScreen::raise(QWindowSurface * surface) +void QGraphicsSystemFbScreen::raise(QPlatformWindow * surface) { - QGraphicsSystemFbWindowSurface *s = static_cast(surface); + QFbWindow *s = static_cast(surface); int index = windowStack.indexOf(s); if (index <= 0) return; @@ -250,14 +258,14 @@ void QGraphicsSystemFbScreen::raise(QWindowSurface * surface) setDirty(s->geometry()); } -void QGraphicsSystemFbWindowSurface::lower() +void QFbWindow::lower() { mScreen->lower(this); } -void QGraphicsSystemFbScreen::lower(QWindowSurface * surface) +void QGraphicsSystemFbScreen::lower(QPlatformWindow * surface) { - QGraphicsSystemFbWindowSurface *s = static_cast(surface); + QFbWindow *s = static_cast(surface); int index = windowStack.indexOf(s); if (index == -1 || index == (windowStack.size() - 1)) return; @@ -271,34 +279,61 @@ QWidget * QGraphicsSystemFbScreen::topLevelAt(const QPoint & p) const for(int i = 0; i < windowStack.size(); i++) { if (windowStack[i]->geometry().contains(p, false) && windowStack[i]->visible() && - !windowStack[i]->window()->isMinimized()) { - return windowStack[i]->window(); + !windowStack[i]->widget()->isMinimized()) { + return windowStack[i]->widget(); } } return 0; } -QGraphicsSystemFbWindowSurface::QGraphicsSystemFbWindowSurface(QGraphicsSystemFbScreen *screen, QWidget *window) - : QWindowSurface(window), + + +QFbWindow::QFbWindow(QGraphicsSystemFbScreen *screen, QWidget *window) + :QPlatformWindow(window), mScreen(screen), visibleFlag(false) { static QAtomicInt winIdGenerator(1); + windowId = winIdGenerator.fetchAndAddRelaxed(1); +} + + +QFbWindow::~QFbWindow() +{ + mScreen->removeWindow(this); +} + +QGraphicsSystemFbWindowSurface::QGraphicsSystemFbWindowSurface(QGraphicsSystemFbScreen *screen, QWidget *window) + : QWindowSurface(window), + mScreen(screen) +{ mImage = QImage(window->size(), mScreen->format()); - windowId = winIdGenerator.fetchAndAddRelaxed(1); + + platformWindow = static_cast(window->platformWindow()); + platformWindow->surface = this; } QGraphicsSystemFbWindowSurface::~QGraphicsSystemFbWindowSurface() { - mScreen->removeWindowSurface(this); } + void QGraphicsSystemFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) { Q_UNUSED(widget); Q_UNUSED(offset); + +// qDebug() << "QGraphicsSystemFbWindowSurface::flush" << region; + + + platformWindow->repaint(region); +} + + +void QFbWindow::repaint(const QRegion ®ion) +{ QRect currentGeometry = geometry(); // If this is a move, redraw the previous location if (oldGeometry != currentGeometry) { @@ -314,21 +349,30 @@ void QGraphicsSystemFbWindowSurface::flush(QWidget *widget, const QRegion ®io mScreen->setDirty(dirtyRegion); } -void QGraphicsSystemFbWindowSurface::setGeometry(const QRect &rect) +void QGraphicsSystemFbWindowSurface::resize(const QSize &size) { - // store previous geometry for screen update + // change the widget's QImage if this is a resize + if (mImage.size() != size) + mImage = QImage(size, mScreen->format()); + QWindowSurface::resize(size); +} + +void QFbWindow::setGeometry(const QRect &rect) +{ +// store previous geometry for screen update oldGeometry = geometry(); - // change the widget's QImage if this is a resize - if (mImage.size() != rect.size()) - mImage = QImage(rect.size(), mScreen->format()); mScreen->invalidateRectCache(); - QWindowSystemInterface::handleGeometryChange(window(), rect); +//### QWindowSystemInterface::handleGeometryChange(window(), rect); - QWindowSurface::setGeometry(rect); + QPlatformWindow::setGeometry(rect); } + + + + bool QGraphicsSystemFbWindowSurface::scroll(const QRegion &area, int dx, int dy) { return QWindowSurface::scroll(area, dx, dy); @@ -344,21 +388,21 @@ void QGraphicsSystemFbWindowSurface::endPaint(const QRegion ®ion) Q_UNUSED(region); } -void QGraphicsSystemFbWindowSurface::setVisible(bool visible) +void QFbWindow::setVisible(bool visible) { visibleFlag = visible; mScreen->invalidateRectCache(); mScreen->setDirty(geometry()); } -Qt::WindowFlags QGraphicsSystemFbWindowSurface::setWindowFlags(Qt::WindowFlags type) +Qt::WindowFlags QFbWindow::setWindowFlags(Qt::WindowFlags type) { flags = type; mScreen->invalidateRectCache(); return flags; } -Qt::WindowFlags QGraphicsSystemFbWindowSurface::windowFlags() const +Qt::WindowFlags QFbWindow::windowFlags() const { return flags; } diff --git a/src/plugins/platforms/fb_base/fb_base.h b/src/plugins/platforms/fb_base/fb_base.h index 7f9b005..8df6b8e 100644 --- a/src/plugins/platforms/fb_base/fb_base.h +++ b/src/plugins/platforms/fb_base/fb_base.h @@ -1,12 +1,14 @@ #ifndef QLIGHTHOUSEGRAPHICSSCREEN_H #define QLIGHTHOUSEGRAPHICSSCREEN_H -#include +//#include #include #include #include #include #include +#include +#include class QMouseEvent; class QSize; @@ -17,7 +19,7 @@ class QGraphicsSystemFbScreen; class QGraphicsSystemSoftwareCursor : public QGraphicsSystemCursor { public: - QGraphicsSystemSoftwareCursor(QGraphicsSystemScreen * scr); + QGraphicsSystemSoftwareCursor(QPlatformScreen * scr); // output methods QRect dirtyRect(); @@ -39,6 +41,9 @@ private: QRect getCurrentRect(); }; + +class QFbWindow; + class QGraphicsSystemFbWindowSurface : public QWindowSurface { public: @@ -51,30 +56,58 @@ public: virtual void beginPaint(const QRegion ®ion); virtual void endPaint(const QRegion ®ion); - virtual void setVisible(bool visible); - virtual bool visible() { return visibleFlag; } + const QImage image() { return mImage; } - void setGeometry(const QRect &rect); + void resize(const QSize &size); + +protected: + friend class QFbWindow; + QFbWindow *platformWindow; + + QGraphicsSystemFbScreen *mScreen; + QImage mImage; +}; + + +class QFbWindow : public QPlatformWindow +{ +public: + + QFbWindow(QGraphicsSystemFbScreen *screen, QWidget *window); + ~QFbWindow(); + + + virtual void setVisible(bool visible); + virtual bool visible() { return visibleFlag; } virtual void raise(); virtual void lower(); + void setGeometry(const QRect &rect); + virtual Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); virtual Qt::WindowFlags windowFlags() const; WId winId() const { return windowId; } + + virtual void repaint(const QRegion&); + protected: + friend class QGraphicsSystemFbWindowSurface; + friend class QGraphicsSystemFbScreen; + QGraphicsSystemFbWindowSurface *surface; QGraphicsSystemFbScreen *mScreen; QRect oldGeometry; - QImage mImage; bool visibleFlag; Qt::WindowFlags flags; + WId windowId; }; -class QGraphicsSystemFbScreen : public QGraphicsSystemScreen + +class QGraphicsSystemFbScreen : public QPlatformScreen { Q_OBJECT public: @@ -93,18 +126,18 @@ public: virtual void setDirty(const QRect &rect); - virtual void removeWindowSurface(QGraphicsSystemFbWindowSurface * surface); - virtual void addWindowSurface(QGraphicsSystemFbWindowSurface * surface) { + virtual void removeWindow(QFbWindow * surface); + virtual void addWindow(QFbWindow * surface) { windowStack.prepend(surface); invalidateRectCache(); } - virtual void raise(QWindowSurface * surface); - virtual void lower(QWindowSurface * surface); + virtual void raise(QPlatformWindow * surface); + virtual void lower(QPlatformWindow * surface); virtual QWidget * topLevelAt(const QPoint & p) const; QImage * image() const { return mScreenImage; } QPaintDevice * paintDevice() const { return mScreenImage; } protected: - QList windowStack; + QList windowStack; QRegion repaintRegion; QGraphicsSystemSoftwareCursor * cursor; QTimer redrawTimer; @@ -126,6 +159,7 @@ private: void invalidateRectCache() { isUpToDate = false; } friend class QGraphicsSystemFbWindowSurface; + friend class QFbWindow; bool isUpToDate; }; diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index db3904f..0b215e3 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -622,6 +622,7 @@ void QTestLiteWindow::setGeometry(const QRect &rect) //if unchanged ### XMoveResizeWindow(xd->display, x_window, rect.x(), rect.y(), rect.width(), rect.height()); + QPlatformWindow::setGeometry(rect); } diff --git a/src/plugins/platforms/vnc/main.cpp b/src/plugins/platforms/vnc/main.cpp index f10748a..9de33eb 100644 --- a/src/plugins/platforms/vnc/main.cpp +++ b/src/plugins/platforms/vnc/main.cpp @@ -39,17 +39,17 @@ ** ****************************************************************************/ -#include #include "qgraphicssystem_vnc.h" #include +#include QT_BEGIN_NAMESPACE -class QVNCGraphicsSystemPlugin : public QGraphicsSystemPlugin +class QVNCGraphicsSystemPlugin : public QPlatformIntegrationPlugin { public: QStringList keys() const; - QGraphicsSystem *create(const QString&); + QPlatformIntegration *create(const QString&); }; QStringList QVNCGraphicsSystemPlugin::keys() const @@ -59,7 +59,7 @@ QStringList QVNCGraphicsSystemPlugin::keys() const return list; } -QGraphicsSystem* QVNCGraphicsSystemPlugin::create(const QString& system) +QPlatformIntegration* QVNCGraphicsSystemPlugin::create(const QString& system) { if (system.toLower() == "vnc") return new QVNCGraphicsSystem; diff --git a/src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp b/src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp index 7815f24..ef50230 100644 --- a/src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp +++ b/src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp @@ -104,12 +104,30 @@ QPixmapData *QVNCGraphicsSystem::createPixmapData(QPixmapData::PixelType type) c return new QRasterPixmapData(type); } -QWindowSurface *QVNCGraphicsSystem::createWindowSurface(QWidget *widget) const +// QWindowSurface *QVNCGraphicsSystem::createWindowSurface(QWidget *widget) const +// { +// if (widget->windowType() == Qt::Desktop) +// return 0; // Don't create an explicit window surface for the destkop. +// QGraphicsSystemFbWindowSurface * surface; +// surface = new QGraphicsSystemFbWindowSurface(mPrimaryScreen, widget); +// mPrimaryScreen->addWindowSurface(surface); +// return surface; +// } + +QWindowSurface *QVNCGraphicsSystem::createWindowSurfaceForWindow(QWidget *widget, WId) const { if (widget->windowType() == Qt::Desktop) return 0; // Don't create an explicit window surface for the destkop. QGraphicsSystemFbWindowSurface * surface; surface = new QGraphicsSystemFbWindowSurface(mPrimaryScreen, widget); - mPrimaryScreen->addWindowSurface(surface); return surface; } + + +QPlatformWindow *QVNCGraphicsSystem::createPlatformWindow(QWidget *widget, WId /*winId*/) const +{ + QFbWindow *w = new QFbWindow(mPrimaryScreen, widget); + mPrimaryScreen->addWindow(w); + return w; +} + diff --git a/src/plugins/platforms/vnc/qgraphicssystem_vnc.h b/src/plugins/platforms/vnc/qgraphicssystem_vnc.h index b3349b7..3205872 100644 --- a/src/plugins/platforms/vnc/qgraphicssystem_vnc.h +++ b/src/plugins/platforms/vnc/qgraphicssystem_vnc.h @@ -42,9 +42,9 @@ #ifndef QGRAPHICSSYSTEM_VNC_H #define QGRAPHICSSYSTEM_VNC_H -#include #include "qvnccursor.h" #include "../fb_base/fb_base.h" +#include QT_BEGIN_NAMESPACE @@ -73,20 +73,21 @@ private: class QVNCGraphicsSystemPrivate; -class QVNCGraphicsSystem : public QGraphicsSystem +class QVNCGraphicsSystem : public QPlatformIntegration { public: QVNCGraphicsSystem(); QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; + QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; + QWindowSurface *createWindowSurfaceForWindow(QWidget *widget, WId winId) const; - QList screens() const { return mScreens; } + QList screens() const { return mScreens; } private: QVNCGraphicsSystemScreen *mPrimaryScreen; - QList mScreens; + QList mScreens; }; diff --git a/src/plugins/platforms/vnc/vnc.pro b/src/plugins/platforms/vnc/vnc.pro index 0b73b5b..b1da572 100644 --- a/src/plugins/platforms/vnc/vnc.pro +++ b/src/plugins/platforms/vnc/vnc.pro @@ -1,7 +1,7 @@ TARGET = qvncgraphicssystem include(../../qpluginbase.pri) -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms SOURCES = main.cpp qgraphicssystem_vnc.cpp HEADERS = qgraphicssystem_vnc.h @@ -14,6 +14,6 @@ SOURCES += qvnccursor.cpp include(../fb_base/fb_base.pri) -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target -- cgit v0.12 From a87d8966946c47e234b8d5268c287ac96f1ea4c4 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 12 Apr 2010 15:44:57 +0200 Subject: Make hide() work. --- src/plugins/platforms/fb_base/fb_base.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/fb_base/fb_base.cpp b/src/plugins/platforms/fb_base/fb_base.cpp index 422222c..25426eb 100644 --- a/src/plugins/platforms/fb_base/fb_base.cpp +++ b/src/plugins/platforms/fb_base/fb_base.cpp @@ -142,6 +142,9 @@ void QGraphicsSystemFbScreen::generateRects() for (int i = 0; i < windowStack.length(); i++) { if (remainingScreen.isEmpty()) break; + if (!windowStack[i]->visible()) + continue; + if (!windowStack[i]->widget()->testAttribute(Qt::WA_TranslucentBackground)) { remainingScreen -= windowStack[i]->geometry(); QRegion windowRegion(windowStack[i]->geometry()); -- cgit v0.12 From 3a8b3299d7c956e3a9f4733bc7d459757081bdc2 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 12 Apr 2010 16:55:56 +0200 Subject: Make LinuxFb work --- src/gui/kernel/qapplication_lite.cpp | 11 +++++++++++ src/plugins/platforms/linuxfb/linuxfb.pro | 4 ++-- src/plugins/platforms/linuxfb/main.cpp | 8 ++++---- .../platforms/linuxfb/qgraphicssystem_linuxfb.cpp | 16 ++++++++++++++-- src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h | 11 ++++++----- 5 files changed, 37 insertions(+), 13 deletions(-) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 87fa933..867c2dc 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -422,6 +422,15 @@ static void init_platform(const QString &name) } + +static void cleanup_platform() +{ + delete QApplicationPrivate::platform_integration; + QApplicationPrivate::platform_integration = 0; + delete QApplicationPrivate::graphics_system; + QApplicationPrivate::graphics_system = 0; +} + static void init_plugins(const QList pluginList) { for (int i = 0; i < pluginList.count(); ++i) { @@ -520,6 +529,8 @@ void qt_init(QApplicationPrivate *priv, int type) void qt_cleanup() { + cleanup_platform(); + QPixmapCache::clear(); #ifndef QT_NO_CURSOR QCursorData::cleanup(); diff --git a/src/plugins/platforms/linuxfb/linuxfb.pro b/src/plugins/platforms/linuxfb/linuxfb.pro index 031b843..2633a10 100644 --- a/src/plugins/platforms/linuxfb/linuxfb.pro +++ b/src/plugins/platforms/linuxfb/linuxfb.pro @@ -1,12 +1,12 @@ TARGET = qlinuxfbgraphicssystem include(../../qpluginbase.pri) -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms SOURCES = main.cpp qgraphicssystem_linuxfb.cpp HEADERS = qgraphicssystem_linuxfb.h include(../fb_base/fb_base.pri) -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target diff --git a/src/plugins/platforms/linuxfb/main.cpp b/src/plugins/platforms/linuxfb/main.cpp index 4d03fe5..15305ed 100644 --- a/src/plugins/platforms/linuxfb/main.cpp +++ b/src/plugins/platforms/linuxfb/main.cpp @@ -39,16 +39,16 @@ ** ****************************************************************************/ -#include +#include #include "qgraphicssystem_linuxfb.h" QT_BEGIN_NAMESPACE -class QLinuxFbGraphicsSystemPlugin : public QGraphicsSystemPlugin +class QLinuxFbGraphicsSystemPlugin : public QPlatformIntegrationPlugin { public: QStringList keys() const; - QGraphicsSystem *create(const QString&); + QPlatformIntegration *create(const QString&); }; QStringList QLinuxFbGraphicsSystemPlugin::keys() const @@ -58,7 +58,7 @@ QStringList QLinuxFbGraphicsSystemPlugin::keys() const return list; } -QGraphicsSystem* QLinuxFbGraphicsSystemPlugin::create(const QString& system) +QPlatformIntegration* QLinuxFbGraphicsSystemPlugin::create(const QString& system) { if (system.toLower() == "linuxfb") return new QLinuxFbGraphicsSystem; diff --git a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp index 44960bb..cca567c 100644 --- a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp +++ b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp @@ -786,16 +786,28 @@ QPixmapData *QLinuxFbGraphicsSystem::createPixmapData(QPixmapData::PixelType typ return new QRasterPixmapData(type); } -QWindowSurface *QLinuxFbGraphicsSystem::createWindowSurface(QWidget *widget) const +QWindowSurface *QLinuxFbGraphicsSystem::createWindowSurfaceForWindow(QWidget *widget, WId) const { if (widget->windowType() == Qt::Desktop) return 0; // Don't create an explicit window surface for the destkop. QGraphicsSystemFbWindowSurface * surface = new QGraphicsSystemFbWindowSurface(mPrimaryScreen, widget); - mPrimaryScreen->addWindowSurface(surface); return surface; } + + +QPlatformWindow *QLinuxFbGraphicsSystem::createPlatformWindow(QWidget *widget, WId /*winId*/) const +{ + QFbWindow *w = new QFbWindow(mPrimaryScreen, widget); + mPrimaryScreen->addWindow(w); + return w; +} + + + + + QLinuxFbGraphicsSystemScreen::QLinuxFbGraphicsSystemScreen(uchar * d, int w, int h, int lstep, QImage::Format screenFormat) : compositePainter(0) { diff --git a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h index cc8ce7e..873b463 100644 --- a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h +++ b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h @@ -42,7 +42,7 @@ #ifndef QGRAPHICSSYSTEM_LINUXFB_H #define QGRAPHICSSYSTEM_LINUXFB_H -#include +#include #include "../fb_base/fb_base.h" QT_BEGIN_NAMESPACE @@ -70,20 +70,21 @@ struct fb_cmap; struct fb_var_screeninfo; struct fb_fix_screeninfo; -class QLinuxFbGraphicsSystem : public QGraphicsSystem +class QLinuxFbGraphicsSystem : public QPlatformIntegration { public: QLinuxFbGraphicsSystem(); ~QLinuxFbGraphicsSystem(); QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; + QPlatformWindow *createPlatformWindow(QWidget *widget, WId WinId) const; + QWindowSurface *createWindowSurfaceForWindow(QWidget *widget, WId WinId) const; - QList screens() const { return mScreens; } + QList screens() const { return mScreens; } private: QLinuxFbGraphicsSystemScreen *mPrimaryScreen; - QList mScreens; + QList mScreens; QLinuxFbGraphicsSystemPrivate *d_ptr; enum PixelType { NormalPixel, BGRPixel }; -- cgit v0.12 From c8f86b525a6eabb91ad4da2dfdd423a32263359a Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 13 Apr 2010 10:57:50 +0200 Subject: Rename classes to get rid of "GraphicsSystem" --- src/plugins/platforms/fb_base/fb_base.cpp | 48 ++++++++-------- src/plugins/platforms/fb_base/fb_base.h | 28 +++++----- src/plugins/platforms/linuxfb/main.cpp | 10 ++-- .../platforms/linuxfb/qgraphicssystem_linuxfb.cpp | 64 +++++++++++----------- .../platforms/linuxfb/qgraphicssystem_linuxfb.h | 16 +++--- src/plugins/platforms/vnc/main.cpp | 10 ++-- src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp | 32 +++++------ src/plugins/platforms/vnc/qgraphicssystem_vnc.h | 16 +++--- src/plugins/platforms/vnc/qvnccursor.cpp | 2 +- src/plugins/platforms/vnc/qvnccursor.h | 4 +- src/plugins/platforms/vnc/qvncserver.cpp | 16 +++--- src/plugins/platforms/vnc/qvncserver.h | 26 ++++----- 12 files changed, 136 insertions(+), 136 deletions(-) diff --git a/src/plugins/platforms/fb_base/fb_base.cpp b/src/plugins/platforms/fb_base/fb_base.cpp index 25426eb..1a6d04e 100644 --- a/src/plugins/platforms/fb_base/fb_base.cpp +++ b/src/plugins/platforms/fb_base/fb_base.cpp @@ -81,7 +81,7 @@ void QGraphicsSystemSoftwareCursor::changeCursor(QCursor * widgetCursor, QWidget screen->setDirty(currentRect); } -QGraphicsSystemFbScreen::QGraphicsSystemFbScreen() : cursor(0), mGeometry(), mDepth(16), mFormat(QImage::Format_RGB16), mScreenImage(0), compositePainter(0), isUpToDate(false) +QFbScreen::QFbScreen() : cursor(0), mGeometry(), mDepth(16), mFormat(QImage::Format_RGB16), mScreenImage(0), compositePainter(0), isUpToDate(false) { mScreenImage = new QImage(mGeometry.size(), mFormat); redrawTimer.setSingleShot(true); @@ -89,7 +89,7 @@ QGraphicsSystemFbScreen::QGraphicsSystemFbScreen() : cursor(0), mGeometry(), mDe QObject::connect(&redrawTimer, SIGNAL(timeout()), this, SLOT(doRedraw())); } -void QGraphicsSystemFbScreen::setGeometry(QRect rect) +void QFbScreen::setGeometry(QRect rect) { delete mScreenImage; mGeometry = rect; @@ -99,17 +99,17 @@ void QGraphicsSystemFbScreen::setGeometry(QRect rect) invalidateRectCache(); } -void QGraphicsSystemFbScreen::setDepth(int depth) +void QFbScreen::setDepth(int depth) { mDepth = depth; } -void QGraphicsSystemFbScreen::setPhysicalSize(QSize size) +void QFbScreen::setPhysicalSize(QSize size) { mPhysicalSize = size; } -void QGraphicsSystemFbScreen::setFormat(QImage::Format format) +void QFbScreen::setFormat(QImage::Format format) { mFormat = format; delete mScreenImage; @@ -118,23 +118,23 @@ void QGraphicsSystemFbScreen::setFormat(QImage::Format format) compositePainter = 0; } -QGraphicsSystemFbScreen::~QGraphicsSystemFbScreen() +QFbScreen::~QFbScreen() { delete compositePainter; delete mScreenImage; } -void QGraphicsSystemFbScreen::setDirty(const QRect &rect) +void QFbScreen::setDirty(const QRect &rect) { -// qDebug() << "QGraphicsSystemFbScreen::setDirty" << rect; +// qDebug() << "QFbScreen::setDirty" << rect; repaintRegion += rect; if (!redrawTimer.isActive()) { redrawTimer.start(); } } -void QGraphicsSystemFbScreen::generateRects() +void QFbScreen::generateRects() { cachedRects.clear(); QRegion remainingScreen(mGeometry); @@ -162,7 +162,7 @@ void QGraphicsSystemFbScreen::generateRects() -QRegion QGraphicsSystemFbScreen::doRedraw() +QRegion QFbScreen::doRedraw() { QRegion touchedRegion; if (cursor) @@ -232,13 +232,13 @@ QRegion QGraphicsSystemFbScreen::doRedraw() -// qDebug() << "QGraphicsSystemFbScreen::doRedraw" << windowStack.size() << mScreenImage->size() << touchedRegion; +// qDebug() << "QFbScreen::doRedraw" << windowStack.size() << mScreenImage->size() << touchedRegion; return touchedRegion; } -void QGraphicsSystemFbScreen::removeWindow(QFbWindow * surface) +void QFbScreen::removeWindow(QFbWindow * surface) { windowStack.removeOne(surface); invalidateRectCache(); @@ -250,7 +250,7 @@ void QFbWindow::raise() mScreen->raise(this); } -void QGraphicsSystemFbScreen::raise(QPlatformWindow * surface) +void QFbScreen::raise(QPlatformWindow * surface) { QFbWindow *s = static_cast(surface); int index = windowStack.indexOf(s); @@ -266,7 +266,7 @@ void QFbWindow::lower() mScreen->lower(this); } -void QGraphicsSystemFbScreen::lower(QPlatformWindow * surface) +void QFbScreen::lower(QPlatformWindow * surface) { QFbWindow *s = static_cast(surface); int index = windowStack.indexOf(s); @@ -277,7 +277,7 @@ void QGraphicsSystemFbScreen::lower(QPlatformWindow * surface) setDirty(s->geometry()); } -QWidget * QGraphicsSystemFbScreen::topLevelAt(const QPoint & p) const +QWidget * QFbScreen::topLevelAt(const QPoint & p) const { for(int i = 0; i < windowStack.size(); i++) { if (windowStack[i]->geometry().contains(p, false) && @@ -291,7 +291,7 @@ QWidget * QGraphicsSystemFbScreen::topLevelAt(const QPoint & p) const -QFbWindow::QFbWindow(QGraphicsSystemFbScreen *screen, QWidget *window) +QFbWindow::QFbWindow(QFbScreen *screen, QWidget *window) :QPlatformWindow(window), mScreen(screen), visibleFlag(false) @@ -307,7 +307,7 @@ QFbWindow::~QFbWindow() } -QGraphicsSystemFbWindowSurface::QGraphicsSystemFbWindowSurface(QGraphicsSystemFbScreen *screen, QWidget *window) +QFbWindowSurface::QFbWindowSurface(QFbScreen *screen, QWidget *window) : QWindowSurface(window), mScreen(screen) { @@ -317,18 +317,18 @@ QGraphicsSystemFbWindowSurface::QGraphicsSystemFbWindowSurface(QGraphicsSystemFb platformWindow->surface = this; } -QGraphicsSystemFbWindowSurface::~QGraphicsSystemFbWindowSurface() +QFbWindowSurface::~QFbWindowSurface() { } -void QGraphicsSystemFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +void QFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) { Q_UNUSED(widget); Q_UNUSED(offset); -// qDebug() << "QGraphicsSystemFbWindowSurface::flush" << region; +// qDebug() << "QFbWindowSurface::flush" << region; platformWindow->repaint(region); @@ -352,7 +352,7 @@ void QFbWindow::repaint(const QRegion ®ion) mScreen->setDirty(dirtyRegion); } -void QGraphicsSystemFbWindowSurface::resize(const QSize &size) +void QFbWindowSurface::resize(const QSize &size) { // change the widget's QImage if this is a resize if (mImage.size() != size) @@ -376,17 +376,17 @@ void QFbWindow::setGeometry(const QRect &rect) -bool QGraphicsSystemFbWindowSurface::scroll(const QRegion &area, int dx, int dy) +bool QFbWindowSurface::scroll(const QRegion &area, int dx, int dy) { return QWindowSurface::scroll(area, dx, dy); } -void QGraphicsSystemFbWindowSurface::beginPaint(const QRegion ®ion) +void QFbWindowSurface::beginPaint(const QRegion ®ion) { Q_UNUSED(region); } -void QGraphicsSystemFbWindowSurface::endPaint(const QRegion ®ion) +void QFbWindowSurface::endPaint(const QRegion ®ion) { Q_UNUSED(region); } diff --git a/src/plugins/platforms/fb_base/fb_base.h b/src/plugins/platforms/fb_base/fb_base.h index 8df6b8e..2738768 100644 --- a/src/plugins/platforms/fb_base/fb_base.h +++ b/src/plugins/platforms/fb_base/fb_base.h @@ -14,7 +14,7 @@ class QMouseEvent; class QSize; class QPainter; -class QGraphicsSystemFbScreen; +class QFbScreen; class QGraphicsSystemSoftwareCursor : public QGraphicsSystemCursor { @@ -44,11 +44,11 @@ private: class QFbWindow; -class QGraphicsSystemFbWindowSurface : public QWindowSurface +class QFbWindowSurface : public QWindowSurface { public: - QGraphicsSystemFbWindowSurface(QGraphicsSystemFbScreen *screen, QWidget *window); - ~QGraphicsSystemFbWindowSurface(); + QFbWindowSurface(QFbScreen *screen, QWidget *window); + ~QFbWindowSurface(); virtual QPaintDevice *paintDevice() { return &mImage; } virtual void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); @@ -65,7 +65,7 @@ protected: friend class QFbWindow; QFbWindow *platformWindow; - QGraphicsSystemFbScreen *mScreen; + QFbScreen *mScreen; QImage mImage; }; @@ -74,7 +74,7 @@ class QFbWindow : public QPlatformWindow { public: - QFbWindow(QGraphicsSystemFbScreen *screen, QWidget *window); + QFbWindow(QFbScreen *screen, QWidget *window); ~QFbWindow(); @@ -94,10 +94,10 @@ public: virtual void repaint(const QRegion&); protected: - friend class QGraphicsSystemFbWindowSurface; - friend class QGraphicsSystemFbScreen; - QGraphicsSystemFbWindowSurface *surface; - QGraphicsSystemFbScreen *mScreen; + friend class QFbWindowSurface; + friend class QFbScreen; + QFbWindowSurface *surface; + QFbScreen *mScreen; QRect oldGeometry; bool visibleFlag; Qt::WindowFlags flags; @@ -107,12 +107,12 @@ protected: }; -class QGraphicsSystemFbScreen : public QPlatformScreen +class QFbScreen : public QPlatformScreen { Q_OBJECT public: - QGraphicsSystemFbScreen(); - ~QGraphicsSystemFbScreen(); + QFbScreen(); + ~QFbScreen(); virtual QRect geometry() const { return mGeometry; } virtual int depth() const { return mDepth; } @@ -158,7 +158,7 @@ private: QList > cachedRects; void invalidateRectCache() { isUpToDate = false; } - friend class QGraphicsSystemFbWindowSurface; + friend class QFbWindowSurface; friend class QFbWindow; bool isUpToDate; }; diff --git a/src/plugins/platforms/linuxfb/main.cpp b/src/plugins/platforms/linuxfb/main.cpp index 15305ed..1ee24b6 100644 --- a/src/plugins/platforms/linuxfb/main.cpp +++ b/src/plugins/platforms/linuxfb/main.cpp @@ -44,28 +44,28 @@ QT_BEGIN_NAMESPACE -class QLinuxFbGraphicsSystemPlugin : public QPlatformIntegrationPlugin +class QLinuxFbIntegrationPlugin : public QPlatformIntegrationPlugin { public: QStringList keys() const; QPlatformIntegration *create(const QString&); }; -QStringList QLinuxFbGraphicsSystemPlugin::keys() const +QStringList QLinuxFbIntegrationPlugin::keys() const { QStringList list; list << "LinuxFb"; return list; } -QPlatformIntegration* QLinuxFbGraphicsSystemPlugin::create(const QString& system) +QPlatformIntegration* QLinuxFbIntegrationPlugin::create(const QString& system) { if (system.toLower() == "linuxfb") - return new QLinuxFbGraphicsSystem; + return new QLinuxFbIntegration; return 0; } -Q_EXPORT_PLUGIN2(linuxfb, QLinuxFbGraphicsSystemPlugin) +Q_EXPORT_PLUGIN2(linuxfb, QLinuxFbIntegrationPlugin) QT_END_NAMESPACE diff --git a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp index cca567c..25cdc7b 100644 --- a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp +++ b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp @@ -69,11 +69,11 @@ QT_BEGIN_NAMESPACE -class QLinuxFbGraphicsSystemPrivate +class QLinuxFbIntegrationPrivate { public: - QLinuxFbGraphicsSystemPrivate(); - ~QLinuxFbGraphicsSystemPrivate(); + QLinuxFbIntegrationPrivate(); + ~QLinuxFbIntegrationPrivate(); void openTty(); void closeTty(); @@ -94,7 +94,7 @@ public: QString displaySpec; }; -QLinuxFbGraphicsSystemPrivate::QLinuxFbGraphicsSystemPrivate() +QLinuxFbIntegrationPrivate::QLinuxFbIntegrationPrivate() : fd(-1), blank(true), doGraphicsMode(true), #ifdef QT_QWS_DEPTH_GENERIC doGenericColors(false), @@ -103,12 +103,12 @@ QLinuxFbGraphicsSystemPrivate::QLinuxFbGraphicsSystemPrivate() { } -QLinuxFbGraphicsSystemPrivate::~QLinuxFbGraphicsSystemPrivate() +QLinuxFbIntegrationPrivate::~QLinuxFbIntegrationPrivate() { closeTty(); } -void QLinuxFbGraphicsSystemPrivate::openTty() +void QLinuxFbIntegrationPrivate::openTty() { const char *const devs[] = {"/dev/tty0", "/dev/tty", "/dev/console", 0}; @@ -139,7 +139,7 @@ void QLinuxFbGraphicsSystemPrivate::openTty() QT_WRITE(ttyfd, termctl, sizeof(termctl)); } -void QLinuxFbGraphicsSystemPrivate::closeTty() +void QLinuxFbIntegrationPrivate::closeTty() { if (ttyfd == -1) return; @@ -155,33 +155,33 @@ void QLinuxFbGraphicsSystemPrivate::closeTty() ttyfd = -1; } -QLinuxFbGraphicsSystem::QLinuxFbGraphicsSystem() +QLinuxFbIntegration::QLinuxFbIntegration() { - d_ptr = new QLinuxFbGraphicsSystemPrivate(); + d_ptr = new QLinuxFbIntegrationPrivate(); // XXX QString displaySpec = QString::fromLatin1(qgetenv("QWS_DISPLAY")); if (!connect(displaySpec)) - qFatal("QLinuxFbGraphicsSystem: could not initialize screen"); + qFatal("QLinuxFbIntegration: could not initialize screen"); initDevice(); // Create a QImage directly on the screen's framebuffer. // This is the blit target for copying windows to the screen. - mPrimaryScreen = new QLinuxFbGraphicsSystemScreen(data, w, h, lstep, + mPrimaryScreen = new QLinuxFbScreen(data, w, h, lstep, screenFormat); mPrimaryScreen->setPhysicalSize(QSize(physWidth, physHeight)); mScreens.append(mPrimaryScreen); } -QLinuxFbGraphicsSystem::~QLinuxFbGraphicsSystem() +QLinuxFbIntegration::~QLinuxFbIntegration() { delete mPrimaryScreen; delete d_ptr; } -bool QLinuxFbGraphicsSystem::connect(const QString &displaySpec) +bool QLinuxFbIntegration::connect(const QString &displaySpec) { const QStringList args = displaySpec.split(QLatin1Char(':')); @@ -237,7 +237,7 @@ bool QLinuxFbGraphicsSystem::connect(const QString &displaySpec) /* Get fixed screen information */ if (d_ptr->fd != -1 && ioctl(d_ptr->fd, FBIOGET_FSCREENINFO, &finfo)) { - perror("QLinuxFbGraphicsSystem::connect"); + perror("QLinuxFbIntegration::connect"); qWarning("Error reading fixed information"); return false; } @@ -249,7 +249,7 @@ bool QLinuxFbGraphicsSystem::connect(const QString &displaySpec) /* Get variable screen information */ if (d_ptr->fd != -1 && ioctl(d_ptr->fd, FBIOGET_VSCREENINFO, &vinfo)) { - perror("QLinuxFbGraphicsSystem::connect"); + perror("QLinuxFbIntegration::connect"); qWarning("Error reading variable information"); return false; } @@ -295,7 +295,7 @@ bool QLinuxFbGraphicsSystem::connect(const QString &displaySpec) } if (w == 0 || h == 0) { - qWarning("QLinuxFbGraphicsSystem::connect(): Unable to find screen geometry, " + qWarning("QLinuxFbIntegration::connect(): Unable to find screen geometry, " "will use 320x240."); dw = w = 320; dh = h = 240; @@ -347,7 +347,7 @@ bool QLinuxFbGraphicsSystem::connect(const QString &displaySpec) MAP_SHARED, d_ptr->fd, 0); if ((long)data == -1) { - perror("QLinuxFbGraphicsSystem::connect"); + perror("QLinuxFbIntegration::connect"); qWarning("Error: failed to map framebuffer device to memory."); return false; } else { @@ -377,7 +377,7 @@ bool QLinuxFbGraphicsSystem::connect(const QString &displaySpec) startcmap.transp=(unsigned short int *) malloc(sizeof(unsigned short int)*screencols); if (d_ptr->fd == -1 || ioctl(d_ptr->fd, FBIOGETCMAP, &startcmap)) { - perror("QLinuxFbGraphicsSystem::connect"); + perror("QLinuxFbIntegration::connect"); qWarning("Error reading palette from framebuffer, using default palette"); createPalette(startcmap, vinfo, finfo); } @@ -411,7 +411,7 @@ bool QLinuxFbGraphicsSystem::connect(const QString &displaySpec) return true; } -bool QLinuxFbGraphicsSystem::initDevice() +bool QLinuxFbIntegration::initDevice() { d_ptr->openTty(); @@ -538,7 +538,7 @@ bool QLinuxFbGraphicsSystem::initDevice() return true; } -void QLinuxFbGraphicsSystem::setPixelFormat(struct fb_var_screeninfo info) +void QLinuxFbIntegration::setPixelFormat(struct fb_var_screeninfo info) { const fb_bitfield rgba[4] = { info.red, info.green, info.blue, info.transp }; @@ -626,7 +626,7 @@ void QLinuxFbGraphicsSystem::setPixelFormat(struct fb_var_screeninfo info) screenFormat = format; } -void QLinuxFbGraphicsSystem::createPalette(fb_cmap &cmap, fb_var_screeninfo &vinfo, fb_fix_screeninfo &finfo) +void QLinuxFbIntegration::createPalette(fb_cmap &cmap, fb_var_screeninfo &vinfo, fb_fix_screeninfo &finfo) { if((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4)) { screencols= (vinfo.bits_per_pixel==8) ? 256 : 16; @@ -756,7 +756,7 @@ void QLinuxFbGraphicsSystem::createPalette(fb_cmap &cmap, fb_var_screeninfo &vin } } -void QLinuxFbGraphicsSystem::blank(bool on) +void QLinuxFbIntegration::blank(bool on) { if (d_ptr->blank == on) return; @@ -781,23 +781,23 @@ void QLinuxFbGraphicsSystem::blank(bool on) d_ptr->blank = on; } -QPixmapData *QLinuxFbGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const +QPixmapData *QLinuxFbIntegration::createPixmapData(QPixmapData::PixelType type) const { return new QRasterPixmapData(type); } -QWindowSurface *QLinuxFbGraphicsSystem::createWindowSurfaceForWindow(QWidget *widget, WId) const +QWindowSurface *QLinuxFbIntegration::createWindowSurfaceForWindow(QWidget *widget, WId) const { if (widget->windowType() == Qt::Desktop) return 0; // Don't create an explicit window surface for the destkop. - QGraphicsSystemFbWindowSurface * surface = - new QGraphicsSystemFbWindowSurface(mPrimaryScreen, widget); + QFbWindowSurface * surface = + new QFbWindowSurface(mPrimaryScreen, widget); return surface; } -QPlatformWindow *QLinuxFbGraphicsSystem::createPlatformWindow(QWidget *widget, WId /*winId*/) const +QPlatformWindow *QLinuxFbIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const { QFbWindow *w = new QFbWindow(mPrimaryScreen, widget); mPrimaryScreen->addWindow(w); @@ -808,7 +808,7 @@ QPlatformWindow *QLinuxFbGraphicsSystem::createPlatformWindow(QWidget *widget, W -QLinuxFbGraphicsSystemScreen::QLinuxFbGraphicsSystemScreen(uchar * d, int w, +QLinuxFbScreen::QLinuxFbScreen(uchar * d, int w, int h, int lstep, QImage::Format screenFormat) : compositePainter(0) { data = d; @@ -823,7 +823,7 @@ QLinuxFbGraphicsSystemScreen::QLinuxFbGraphicsSystemScreen(uchar * d, int w, cursor = new QGraphicsSystemSoftwareCursor(this); } -void QLinuxFbGraphicsSystemScreen::setGeometry(QRect rect) +void QLinuxFbScreen::setGeometry(QRect rect) { mGeometry = rect; delete mFbScreenImage; @@ -837,7 +837,7 @@ void QLinuxFbGraphicsSystemScreen::setGeometry(QRect rect) mFormat); } -void QLinuxFbGraphicsSystemScreen::setFormat(QImage::Format format) +void QLinuxFbScreen::setFormat(QImage::Format format) { mFormat = format; delete mFbScreenImage; @@ -851,10 +851,10 @@ void QLinuxFbGraphicsSystemScreen::setFormat(QImage::Format format) mFormat); } -QRegion QLinuxFbGraphicsSystemScreen::doRedraw() +QRegion QLinuxFbScreen::doRedraw() { QRegion touched; - touched = QGraphicsSystemFbScreen::doRedraw(); + touched = QFbScreen::doRedraw(); if (!compositePainter) { compositePainter = new QPainter(mFbScreenImage); diff --git a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h index 873b463..7d4c031 100644 --- a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h +++ b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h @@ -47,10 +47,10 @@ QT_BEGIN_NAMESPACE -class QLinuxFbGraphicsSystemScreen : public QGraphicsSystemFbScreen +class QLinuxFbScreen : public QFbScreen { public: - QLinuxFbGraphicsSystemScreen(uchar * d, int w, int h, int lstep, QImage::Format screenFormat); + QLinuxFbScreen(uchar * d, int w, int h, int lstep, QImage::Format screenFormat); void setGeometry(QRect rect); void setFormat(QImage::Format format); @@ -65,16 +65,16 @@ private: QPainter *compositePainter; }; -class QLinuxFbGraphicsSystemPrivate; +class QLinuxFbIntegrationPrivate; struct fb_cmap; struct fb_var_screeninfo; struct fb_fix_screeninfo; -class QLinuxFbGraphicsSystem : public QPlatformIntegration +class QLinuxFbIntegration : public QPlatformIntegration { public: - QLinuxFbGraphicsSystem(); - ~QLinuxFbGraphicsSystem(); + QLinuxFbIntegration(); + ~QLinuxFbIntegration(); QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId WinId) const; @@ -83,9 +83,9 @@ public: QList screens() const { return mScreens; } private: - QLinuxFbGraphicsSystemScreen *mPrimaryScreen; + QLinuxFbScreen *mPrimaryScreen; QList mScreens; - QLinuxFbGraphicsSystemPrivate *d_ptr; + QLinuxFbIntegrationPrivate *d_ptr; enum PixelType { NormalPixel, BGRPixel }; diff --git a/src/plugins/platforms/vnc/main.cpp b/src/plugins/platforms/vnc/main.cpp index 9de33eb..23d78c1 100644 --- a/src/plugins/platforms/vnc/main.cpp +++ b/src/plugins/platforms/vnc/main.cpp @@ -45,28 +45,28 @@ QT_BEGIN_NAMESPACE -class QVNCGraphicsSystemPlugin : public QPlatformIntegrationPlugin +class QVNCIntegrationPlugin : public QPlatformIntegrationPlugin { public: QStringList keys() const; QPlatformIntegration *create(const QString&); }; -QStringList QVNCGraphicsSystemPlugin::keys() const +QStringList QVNCIntegrationPlugin::keys() const { QStringList list; list << "VNC"; return list; } -QPlatformIntegration* QVNCGraphicsSystemPlugin::create(const QString& system) +QPlatformIntegration* QVNCIntegrationPlugin::create(const QString& system) { if (system.toLower() == "vnc") - return new QVNCGraphicsSystem; + return new QVNCIntegration; return 0; } -Q_EXPORT_PLUGIN2(vnc, QVNCGraphicsSystemPlugin) +Q_EXPORT_PLUGIN2(vnc, QVNCIntegrationPlugin) QT_END_NAMESPACE diff --git a/src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp b/src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp index ef50230..cbc8bbd 100644 --- a/src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp +++ b/src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp @@ -51,8 +51,8 @@ #include -QVNCGraphicsSystemScreen::QVNCGraphicsSystemScreen() - : QGraphicsSystemFbScreen::QGraphicsSystemFbScreen() +QVNCScreen::QVNCScreen() + : QFbScreen::QFbScreen() { int w = 800; int h = 600; @@ -69,21 +69,21 @@ QVNCGraphicsSystemScreen::QVNCGraphicsSystemScreen() setPhysicalSize((geometry().size()*254)/720); - d_ptr = new QVNCGraphicsSystemScreenPrivate(this); + d_ptr = new QVNCScreenPrivate(this); cursor = new QVNCCursor(d_ptr->vncServer, this); d_ptr->vncServer->setCursor(static_cast(cursor)); } -QVNCDirtyMap *QVNCGraphicsSystemScreen::dirtyMap() +QVNCDirtyMap *QVNCScreen::dirtyMap() { return d_ptr->dirty; } -QRegion QVNCGraphicsSystemScreen::doRedraw() +QRegion QVNCScreen::doRedraw() { QRegion touched; - touched = QGraphicsSystemFbScreen::doRedraw(); + touched = QFbScreen::doRedraw(); QVector rects = touched.rects(); for (int i = 0; i < rects.size(); i++) @@ -92,39 +92,39 @@ QRegion QVNCGraphicsSystemScreen::doRedraw() } -QVNCGraphicsSystem::QVNCGraphicsSystem() +QVNCIntegration::QVNCIntegration() { - mPrimaryScreen = new QVNCGraphicsSystemScreen(); + mPrimaryScreen = new QVNCScreen(); mScreens.append(mPrimaryScreen); } -QPixmapData *QVNCGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const +QPixmapData *QVNCIntegration::createPixmapData(QPixmapData::PixelType type) const { return new QRasterPixmapData(type); } -// QWindowSurface *QVNCGraphicsSystem::createWindowSurface(QWidget *widget) const +// QWindowSurface *QVNCIntegration::createWindowSurface(QWidget *widget) const // { // if (widget->windowType() == Qt::Desktop) // return 0; // Don't create an explicit window surface for the destkop. -// QGraphicsSystemFbWindowSurface * surface; -// surface = new QGraphicsSystemFbWindowSurface(mPrimaryScreen, widget); +// QFbWindowSurface * surface; +// surface = new QFbWindowSurface(mPrimaryScreen, widget); // mPrimaryScreen->addWindowSurface(surface); // return surface; // } -QWindowSurface *QVNCGraphicsSystem::createWindowSurfaceForWindow(QWidget *widget, WId) const +QWindowSurface *QVNCIntegration::createWindowSurfaceForWindow(QWidget *widget, WId) const { if (widget->windowType() == Qt::Desktop) return 0; // Don't create an explicit window surface for the destkop. - QGraphicsSystemFbWindowSurface * surface; - surface = new QGraphicsSystemFbWindowSurface(mPrimaryScreen, widget); + QFbWindowSurface * surface; + surface = new QFbWindowSurface(mPrimaryScreen, widget); return surface; } -QPlatformWindow *QVNCGraphicsSystem::createPlatformWindow(QWidget *widget, WId /*winId*/) const +QPlatformWindow *QVNCIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const { QFbWindow *w = new QFbWindow(mPrimaryScreen, widget); mPrimaryScreen->addWindow(w); diff --git a/src/plugins/platforms/vnc/qgraphicssystem_vnc.h b/src/plugins/platforms/vnc/qgraphicssystem_vnc.h index 3205872..887ccc3 100644 --- a/src/plugins/platforms/vnc/qgraphicssystem_vnc.h +++ b/src/plugins/platforms/vnc/qgraphicssystem_vnc.h @@ -51,32 +51,32 @@ QT_BEGIN_NAMESPACE class QVNCServer; class QVNCDirtyMap; -class QVNCGraphicsSystemScreenPrivate; +class QVNCScreenPrivate; -class QVNCGraphicsSystemScreen : public QGraphicsSystemFbScreen +class QVNCScreen : public QFbScreen { public: - QVNCGraphicsSystemScreen(); + QVNCScreen(); int linestep() const { return image() ? image()->bytesPerLine() : 0; } uchar *base() const { return image() ? image()->bits() : 0; } QVNCDirtyMap *dirtyMap(); public: - QVNCGraphicsSystemScreenPrivate *d_ptr; + QVNCScreenPrivate *d_ptr; private: QVNCServer *server; QRegion doRedraw(); }; -class QVNCGraphicsSystemPrivate; +class QVNCIntegrationPrivate; -class QVNCGraphicsSystem : public QPlatformIntegration +class QVNCIntegration : public QPlatformIntegration { public: - QVNCGraphicsSystem(); + QVNCIntegration(); QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; @@ -86,7 +86,7 @@ public: private: - QVNCGraphicsSystemScreen *mPrimaryScreen; + QVNCScreen *mPrimaryScreen; QList mScreens; }; diff --git a/src/plugins/platforms/vnc/qvnccursor.cpp b/src/plugins/platforms/vnc/qvnccursor.cpp index fb214d8..78da53b 100644 --- a/src/plugins/platforms/vnc/qvnccursor.cpp +++ b/src/plugins/platforms/vnc/qvnccursor.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE -QVNCCursor::QVNCCursor(QVNCServer * srvr, QVNCGraphicsSystemScreen *scr ) +QVNCCursor::QVNCCursor(QVNCServer * srvr, QVNCScreen *scr ) :QGraphicsSystemSoftwareCursor(scr), useVncCursor(false), server(srvr) { } diff --git a/src/plugins/platforms/vnc/qvnccursor.h b/src/plugins/platforms/vnc/qvnccursor.h index 8ea0f45..2c6ff5b 100644 --- a/src/plugins/platforms/vnc/qvnccursor.h +++ b/src/plugins/platforms/vnc/qvnccursor.h @@ -48,12 +48,12 @@ QT_BEGIN_NAMESPACE -class QVNCGraphicsSystemScreen; +class QVNCScreen; class QVNCServer; class QVNCCursor : public QGraphicsSystemSoftwareCursor { public: - QVNCCursor(QVNCServer *, QVNCGraphicsSystemScreen *); + QVNCCursor(QVNCServer *, QVNCScreen *); // input methods void setCursorMode(bool vnc); diff --git a/src/plugins/platforms/vnc/qvncserver.cpp b/src/plugins/platforms/vnc/qvncserver.cpp index ea576d4..ab0a2f3 100644 --- a/src/plugins/platforms/vnc/qvncserver.cpp +++ b/src/plugins/platforms/vnc/qvncserver.cpp @@ -358,13 +358,13 @@ bool QRfbClientCutText::read(QTcpSocket *s) //=========================================================================== -QVNCServer::QVNCServer(QVNCGraphicsSystemScreen *screen) +QVNCServer::QVNCServer(QVNCScreen *screen) : qvnc_screen(screen), cursor(0) { init(5900); } -QVNCServer::QVNCServer(QVNCGraphicsSystemScreen *screen, int id) +QVNCServer::QVNCServer(QVNCScreen *screen, int id) : qvnc_screen(screen), cursor(0) { init(5900 + id); @@ -620,7 +620,7 @@ void QVNCServer::readClient() } #if 0//Q_BYTE_ORDER == Q_BIG_ENDIAN -bool QVNCGraphicsSystemScreen::swapBytes() const +bool QVNCScreen::swapBytes() const { if (depth() != 16) return false; @@ -1499,7 +1499,7 @@ static void blendCursor(QImage &image, const QRect &imageRect) } #endif // QT_NO_QWS_CURSOR -QVNCDirtyMap::QVNCDirtyMap(QVNCGraphicsSystemScreen *s) +QVNCDirtyMap::QVNCDirtyMap(QVNCScreen *s) : bytesPerPixel(0), numDirty(0), screen(s) { bytesPerPixel = (screen->depth() + 7) / 8; @@ -1885,7 +1885,7 @@ void QVNCServer::discardClient() -QVNCGraphicsSystemScreenPrivate::QVNCGraphicsSystemScreenPrivate(QVNCGraphicsSystemScreen *parent) +QVNCScreenPrivate::QVNCScreenPrivate(QVNCScreen *parent) : dpiX(72), dpiY(72), doOnScreenSurface(false), refreshRate(25), vncServer(0), q_ptr(parent) { @@ -1902,12 +1902,12 @@ QVNCGraphicsSystemScreenPrivate::QVNCGraphicsSystemScreenPrivate(QVNCGraphicsSys dirty = new QVNCDirtyMapOptimized(q_ptr); } -QVNCGraphicsSystemScreenPrivate::~QVNCGraphicsSystemScreenPrivate() +QVNCScreenPrivate::~QVNCScreenPrivate() { } -void QVNCGraphicsSystemScreenPrivate::setDirty(const QRect& rect, bool force) +void QVNCScreenPrivate::setDirty(const QRect& rect, bool force) { if (rect.isEmpty()) return; @@ -1916,7 +1916,7 @@ void QVNCGraphicsSystemScreenPrivate::setDirty(const QRect& rect, bool force) // q_ptr->screen()->setDirty(rect); if (!vncServer || !vncServer->isConnected()) { -// qDebug() << "QVNCGraphicsSystemScreenPrivate::setDirty() - Not connected"; +// qDebug() << "QVNCScreenPrivate::setDirty() - Not connected"; return; } const QRect r = rect; // .translated(-q_ptr->offset()); diff --git a/src/plugins/platforms/vnc/qvncserver.h b/src/plugins/platforms/vnc/qvncserver.h index 4fcdbae..41cadab 100644 --- a/src/plugins/platforms/vnc/qvncserver.h +++ b/src/plugins/platforms/vnc/qvncserver.h @@ -72,7 +72,7 @@ class QVNCServer; class QVNCCursor : public QProxyScreenCursor { public: - QVNCCursor(QVNCGraphicsSystemScreen *s); + QVNCCursor(QVNCScreen *s); ~QVNCCursor(); void hide(); @@ -82,7 +82,7 @@ public: private: void setDirty(const QRect &r) const; - QVNCGraphicsSystemScreen *screen; + QVNCScreen *screen; }; class QVNCClientCursor : public QProxyScreenCursor @@ -106,7 +106,7 @@ private: class QVNCDirtyMap { public: - QVNCDirtyMap(QVNCGraphicsSystemScreen *screen); + QVNCDirtyMap(QVNCScreen *screen); virtual ~QVNCDirtyMap(); void reset(); @@ -122,7 +122,7 @@ public: protected: uchar *map; - QVNCGraphicsSystemScreen *screen; + QVNCScreen *screen; uchar *buffer; int bufferWidth; int bufferHeight; @@ -134,7 +134,7 @@ template class QVNCDirtyMapOptimized : public QVNCDirtyMap { public: - QVNCDirtyMapOptimized(QVNCGraphicsSystemScreen *screen) : QVNCDirtyMap(screen) {} + QVNCDirtyMapOptimized(QVNCScreen *screen) : QVNCDirtyMap(screen) {} ~QVNCDirtyMapOptimized() {} void setDirty(int x, int y, bool force = false); @@ -246,11 +246,11 @@ public: quint32 length; }; -class QVNCGraphicsSystemScreenPrivate : public QObject +class QVNCScreenPrivate : public QObject { public: - QVNCGraphicsSystemScreenPrivate(QVNCGraphicsSystemScreen *parent); - ~QVNCGraphicsSystemScreenPrivate(); + QVNCScreenPrivate(QVNCScreen *parent); + ~QVNCScreenPrivate(); void setDirty(const QRect &rect, bool force = false); void configure(); @@ -266,7 +266,7 @@ public: QSharedMemory shm; #endif - QVNCGraphicsSystemScreen *q_ptr; + QVNCScreen *q_ptr; }; class QRfbEncoder @@ -438,8 +438,8 @@ class QVNCServer : public QObject { Q_OBJECT public: - QVNCServer(QVNCGraphicsSystemScreen *screen); - QVNCServer(QVNCGraphicsSystemScreen *screen, int id); + QVNCServer(QVNCScreen *screen); + QVNCServer(QVNCScreen *screen, int id); ~QVNCServer(); void setDirty(); @@ -464,7 +464,7 @@ public: return pixelFormat.bitsPerPixel / 8; } - inline QVNCGraphicsSystemScreen* screen() const { return qvnc_screen; } + inline QVNCScreen* screen() const { return qvnc_screen; } inline QVNCDirtyMap* dirtyMap() const { return qvnc_screen->dirtyMap(); } inline QTcpSocket* clientSocket() const { return client; } QImage *screenImage() const; @@ -519,7 +519,7 @@ private: #endif bool dirtyCursor; int refreshRate; - QVNCGraphicsSystemScreen *qvnc_screen; + QVNCScreen *qvnc_screen; #ifndef QT_NO_QWS_CURSOR QVNCClientCursor *qvnc_cursor; #endif -- cgit v0.12 From e8af272c0c95ab531a060d3e8e8e75b7b03619f4 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 13 Apr 2010 11:38:49 +0200 Subject: Port the QVFb backend to the new API --- src/plugins/platforms/qvfb/main.cpp | 16 +- .../platforms/qvfb/qgraphicssystem_qvfb.cpp | 434 -------------------- src/plugins/platforms/qvfb/qgraphicssystem_qvfb.h | 95 ----- src/plugins/platforms/qvfb/qvfb.pro | 11 +- src/plugins/platforms/qvfb/qvfbintegration.cpp | 439 +++++++++++++++++++++ src/plugins/platforms/qvfb/qvfbintegration.h | 97 +++++ src/plugins/platforms/qvfb/qwindowsurface_qvfb.cpp | 38 +- src/plugins/platforms/qvfb/qwindowsurface_qvfb.h | 26 +- 8 files changed, 586 insertions(+), 570 deletions(-) delete mode 100644 src/plugins/platforms/qvfb/qgraphicssystem_qvfb.cpp delete mode 100644 src/plugins/platforms/qvfb/qgraphicssystem_qvfb.h create mode 100644 src/plugins/platforms/qvfb/qvfbintegration.cpp create mode 100644 src/plugins/platforms/qvfb/qvfbintegration.h diff --git a/src/plugins/platforms/qvfb/main.cpp b/src/plugins/platforms/qvfb/main.cpp index b28dde8..409f11c 100644 --- a/src/plugins/platforms/qvfb/main.cpp +++ b/src/plugins/platforms/qvfb/main.cpp @@ -39,34 +39,34 @@ ** ****************************************************************************/ -#include -#include "qgraphicssystem_qvfb.h" +#include +#include "qvfbintegration.h" #include QT_BEGIN_NAMESPACE -class QVFbGraphicsSystemPlugin : public QGraphicsSystemPlugin +class QVFbIntegrationPlugin : public QPlatformIntegrationPlugin { public: QStringList keys() const; - QGraphicsSystem *create(const QString&); + QPlatformIntegration *create(const QString&); }; -QStringList QVFbGraphicsSystemPlugin::keys() const +QStringList QVFbIntegrationPlugin::keys() const { QStringList list; list << "QVFb"; return list; } -QGraphicsSystem* QVFbGraphicsSystemPlugin::create(const QString& system) +QPlatformIntegration* QVFbIntegrationPlugin::create(const QString& system) { if (system.toLower() == "qvfb") - return new QVFbGraphicsSystem; + return new QVFbIntegration; return 0; } -Q_EXPORT_PLUGIN2(qvfb, QVFbGraphicsSystemPlugin) +Q_EXPORT_PLUGIN2(qvfb, QVFbIntegrationPlugin) QT_END_NAMESPACE diff --git a/src/plugins/platforms/qvfb/qgraphicssystem_qvfb.cpp b/src/plugins/platforms/qvfb/qgraphicssystem_qvfb.cpp deleted file mode 100644 index 19058a6..0000000 --- a/src/plugins/platforms/qvfb/qgraphicssystem_qvfb.cpp +++ /dev/null @@ -1,434 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include // overrides QT_OPEN - -#include -#include - -#include "qgraphicssystem_qvfb.h" -#include "qwindowsurface_qvfb.h" -#include -#include -#include - -#include -#include -#include - -QT_BEGIN_NAMESPACE - - -class QVFbGraphicsSystemScreenKeyboardHandler : public QObject -{ - Q_OBJECT -public: - QVFbGraphicsSystemScreenKeyboardHandler(); - ~QVFbGraphicsSystemScreenKeyboardHandler(); - -private slots: - void readKeyboardData(); - -private: - int kbdFD; - int kbdIdx; - int kbdBufferLen; - unsigned char *kbdBuffer; - QSocketNotifier *keyNotifier; -}; - -QVFbGraphicsSystemScreenKeyboardHandler::QVFbGraphicsSystemScreenKeyboardHandler() -{ - int displayId = 0; //TODO displayId - const QString keyboardDev = QT_VFB_KEYBOARD_PIPE(displayId); - - - kbdFD = -1; - kbdIdx = 0; - kbdBufferLen = sizeof(QVFbKeyData) * 5; - kbdBuffer = new unsigned char [kbdBufferLen]; - - kbdFD = QT_OPEN(keyboardDev.toLatin1().constData(), O_RDWR | O_NDELAY); - - if (kbdFD == -1) { - perror("QVFbGraphicsSystemScreenKeyboardHandler"); - qWarning("QVFbGraphicsSystemScreenKeyboardHandler: Unable to open device %s", - qPrintable(keyboardDev)); - return; - } - - // Clear pending input - char buf[2]; - while (QT_READ(kbdFD, buf, 1) > 0) { } - - keyNotifier = new QSocketNotifier(kbdFD, QSocketNotifier::Read, this); - connect(keyNotifier, SIGNAL(activated(int)),this, SLOT(readKeyboardData())); - -} - -QVFbGraphicsSystemScreenKeyboardHandler::~QVFbGraphicsSystemScreenKeyboardHandler() -{ - if (kbdFD >= 0) - QT_CLOSE(kbdFD); - delete [] kbdBuffer; -} - - -void QVFbGraphicsSystemScreenKeyboardHandler::readKeyboardData() -{ - int n; - do { - n = QT_READ(kbdFD, kbdBuffer+kbdIdx, kbdBufferLen - kbdIdx); - if (n > 0) - kbdIdx += n; - } while (n > 0); - - int idx = 0; - while (kbdIdx - idx >= (int)sizeof(QVFbKeyData)) { - QVFbKeyData *kd = (QVFbKeyData *)(kbdBuffer + idx); - if (kd->unicode == 0 && kd->keycode == 0 && kd->modifiers == 0 && kd->press) { - // magic exit key - qWarning("Instructed to quit by Virtual Keyboard"); - qApp->quit(); - } - - //QWSServer::processKeyEvent(kd->unicode ? kd->unicode : 0xffff, kd->keycode, kd->modifiers, kd->press, kd->repeat); - - QEvent::Type type = kd->press ? QEvent::KeyPress : QEvent::KeyRelease; - - QString text; - if (kd->unicode && kd->unicode != 0xffff) - text += QChar(kd->unicode); - -// qDebug() << "readKeyboardData" << type << hex << kd->keycode << kd->modifiers << text; - - QWindowSystemInterface::handleKeyEvent(0, type, kd->keycode, kd->modifiers, text, kd->repeat, int(text.length())); - idx += sizeof(QVFbKeyData); - } - - int surplus = kbdIdx - idx; - for (int i = 0; i < surplus; i++) - kbdBuffer[i] = kbdBuffer[idx+i]; - kbdIdx = surplus; -} - - - - -class QVFbGraphicsSystemScreenMouseHandler : public QObject -{ - Q_OBJECT -public: - QVFbGraphicsSystemScreenMouseHandler(); - ~QVFbGraphicsSystemScreenMouseHandler(); - -private slots: - void readMouseData(); - -private: - int mouseFD; - int mouseIdx; - enum {mouseBufSize = 128}; - uchar mouseBuf[mouseBufSize]; - QSocketNotifier *mouseNotifier; - - int oldButtonState; -}; - -QVFbGraphicsSystemScreenMouseHandler::QVFbGraphicsSystemScreenMouseHandler() -{ - int displayId = 0; //TODO: displayId - QString mouseDev = QT_VFB_MOUSE_PIPE(displayId); - - mouseFD = QT_OPEN(mouseDev.toLatin1().constData(), O_RDWR | O_NDELAY); - - if (mouseFD == -1) { - perror("QVFbMouseHandler::QVFbMouseHandler"); - qWarning("QVFbMouseHander: Unable to open device %s", - qPrintable(mouseDev)); - return; - } - - // Clear pending input - char buf[2]; - while (QT_READ(mouseFD, buf, 1) > 0) { } - - mouseIdx = 0; - oldButtonState = 0; - mouseNotifier = new QSocketNotifier(mouseFD, QSocketNotifier::Read, this); - connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData())); -} - - -QVFbGraphicsSystemScreenMouseHandler::~QVFbGraphicsSystemScreenMouseHandler() -{ - if (mouseFD >= 0) - QT_CLOSE(mouseFD); -} - -void QVFbGraphicsSystemScreenMouseHandler::readMouseData() -{ - int n; - do { - n = QT_READ(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx); - if (n > 0) - mouseIdx += n; - } while (n > 0); - - int idx = 0; - static const int packetsize = sizeof(QPoint) + 2*sizeof(int); - while (mouseIdx-idx >= packetsize) { - uchar *mb = mouseBuf+idx; - QPoint mousePos = *reinterpret_cast(mb); - mb += sizeof(QPoint); - int bstate = *reinterpret_cast(mb); - mb += sizeof(int); - int wheel = *reinterpret_cast(mb); - - int button = bstate ^ oldButtonState; - QEvent::Type type = QEvent::MouseMove; - - if (button) { - type = (button & bstate) ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; - } - QWindowSystemInterface::handleMouseEvent(0, mousePos, mousePos, Qt::MouseButtons(bstate)); - -// qDebug() << "readMouseData" << mousePos << button << bstate << oldButtonState << type; - - oldButtonState = bstate; - - idx += packetsize; - } - - int surplus = mouseIdx - idx; - for (int i = 0; i < surplus; i++) - mouseBuf[i] = mouseBuf[idx+i]; - mouseIdx = surplus; - -} - - -class QVFbGraphicsSystemScreenPrivate -{ -public: - QVFbGraphicsSystemScreenPrivate(QVFbGraphicsSystemScreen *) - : shmrgn(0), hdr(0), data(0), mouseHandler(0), keyboardHandler(0) - { - connect(0); //for now we only handle one screen - } - - ~QVFbGraphicsSystemScreenPrivate() { disconnect(); } - void setDirty(const QRect &r); - - bool connect(int displayId); - void disconnect(); - - QImage *screenImage() { return &img; } - QSize screenSize() { return img.size(); } - - int depth() const { return img.depth(); } - QImage::Format format() const { return img.format(); } - -private: - unsigned char *shmrgn; - QVFbHeader *hdr; - uchar *data; - QVFbGraphicsSystemScreenMouseHandler *mouseHandler; - QVFbGraphicsSystemScreenKeyboardHandler *keyboardHandler; - - - QImage img; -}; - - -void QVFbGraphicsSystemScreenPrivate::setDirty(const QRect &r) -{ - hdr->dirty = true; - hdr->update = hdr->update.united(r); -} - - -bool QVFbGraphicsSystemScreenPrivate::connect(int displayId) -{ - - key_t key = ftok(QT_VFB_MOUSE_PIPE(displayId).toLatin1(), 'b'); - - if (key == -1) - return false; - - - int shmId = shmget(key, 0, 0); - if (shmId != -1) - shmrgn = (unsigned char *)shmat(shmId, 0, 0); - else - return false; - - if ((long)shmrgn == -1 || shmrgn == 0) { - qDebug("No shmrgn %ld", (long)shmrgn); - return false; - } - - hdr = (QVFbHeader *)shmrgn; - data = shmrgn + hdr->dataoffset; - - int w = hdr->width; - int h = hdr->height; - int d = hdr->depth; - int lstep = hdr->linestep; - - QImage::Format format = QImage::Format_Invalid; - if (d == 32) - format = QImage::Format_ARGB32_Premultiplied; - else if (d == 16) - format = QImage::Format_RGB16; - - - if (format == QImage::Format_Invalid) { - img = QImage(); - return false; - } - - img = QImage(data, w, h, lstep, format); - - qDebug("connected %dx%d %d bpp", w, h, d); - - - mouseHandler = new QVFbGraphicsSystemScreenMouseHandler; - keyboardHandler = new QVFbGraphicsSystemScreenKeyboardHandler; - return true; -} - -void QVFbGraphicsSystemScreenPrivate::disconnect() -{ - if ((long)shmrgn != -1 && shmrgn) { - shmdt((char*)shmrgn); - shmrgn = 0; - } - delete mouseHandler; - mouseHandler = 0; - delete keyboardHandler; - keyboardHandler = 0; -} - - -QVFbGraphicsSystemScreen::QVFbGraphicsSystemScreen() -{ - d_ptr = new QVFbGraphicsSystemScreenPrivate(this); -} - - -QVFbGraphicsSystemScreen::~QVFbGraphicsSystemScreen() -{ - delete d_ptr; -} - -void QVFbGraphicsSystemScreen::setDirty(const QRect &rect) -{ - d_ptr->setDirty(rect); -} - - - -QRect QVFbGraphicsSystemScreen::geometry() const { - return QRect(QPoint(), d_ptr->screenSize()); -} - - -int QVFbGraphicsSystemScreen::depth() const -{ - return d_ptr->depth(); -} - -QImage::Format QVFbGraphicsSystemScreen::format() const -{ - return d_ptr->format(); -} - -QSize QVFbGraphicsSystemScreen::physicalSize() const { - return (d_ptr->screenSize()*254)/720; -} - -#if 0 -int QVFbGraphicsSystemScreen::linestep() const { - return d_ptr->screenImage() ? d_ptr->screenImage()->bytesPerLine() : 0; -} - -uchar *QVFbGraphicsSystemScreen::base() const { - return d_ptr->screenImage() ? d_ptr->screenImage()->bits() : 0; -} -#endif - -QImage *QVFbGraphicsSystemScreen::screenImage() -{ - return d_ptr->screenImage(); -} - -QVFbGraphicsSystem::QVFbGraphicsSystem() -{ - mPrimaryScreen = new QVFbGraphicsSystemScreen(); - - mScreens.append(mPrimaryScreen); -} - -QPixmapData *QVFbGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const -{ - return new QRasterPixmapData(type); -} - -QWindowSurface *QVFbGraphicsSystem::createWindowSurface(QWidget *widget) const -{ - if (widget->windowType() == Qt::Desktop) - return 0; // Don't create an explicit window surface for the destkop. - return new QVFbWindowSurface - (const_cast(this), mPrimaryScreen, widget); -} - -QT_END_NAMESPACE - -#include "qgraphicssystem_qvfb.moc" diff --git a/src/plugins/platforms/qvfb/qgraphicssystem_qvfb.h b/src/plugins/platforms/qvfb/qgraphicssystem_qvfb.h deleted file mode 100644 index b31869c..0000000 --- a/src/plugins/platforms/qvfb/qgraphicssystem_qvfb.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSYSTEM_QVFB_H -#define QGRAPHICSSYSTEM_QVFB_H - -#include - -QT_BEGIN_NAMESPACE - - -class QVFbGraphicsSystemScreenPrivate; - -class QVFbGraphicsSystemScreen : public QGraphicsSystemScreen -{ -public: - QVFbGraphicsSystemScreen(); - ~QVFbGraphicsSystemScreen(); - - QRect geometry() const; - int depth() const; - QImage::Format format() const; - QSize physicalSize() const; - - QImage *screenImage(); - - void setDirty(const QRect &rect); - -public: - - QVFbGraphicsSystemScreenPrivate *d_ptr; -}; - -class QVFbGraphicsSystemPrivate; - - -class QVFbGraphicsSystem : public QGraphicsSystem -{ -public: - QVFbGraphicsSystem(); - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; - - QList screens() const { return mScreens; } - -private: - QVFbGraphicsSystemScreen *mPrimaryScreen; - QList mScreens; -}; - - - -QT_END_NAMESPACE - - -#endif diff --git a/src/plugins/platforms/qvfb/qvfb.pro b/src/plugins/platforms/qvfb/qvfb.pro index b321725..4dec274 100644 --- a/src/plugins/platforms/qvfb/qvfb.pro +++ b/src/plugins/platforms/qvfb/qvfb.pro @@ -1,12 +1,11 @@ -TARGET = qvfbgraphicssystem +TARGET = qvfbintegration include(../../qpluginbase.pri) -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms +SOURCES = main.cpp qvfbintegration.cpp qwindowsurface_qvfb.cpp +HEADERS = qvfbintegration.h qwindowsurface_qvfb.h -SOURCES = main.cpp qgraphicssystem_qvfb.cpp qwindowsurface_qvfb.cpp -HEADERS = qgraphicssystem_qvfb.h qwindowsurface_qvfb.h - -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target diff --git a/src/plugins/platforms/qvfb/qvfbintegration.cpp b/src/plugins/platforms/qvfb/qvfbintegration.cpp new file mode 100644 index 0000000..2a877e0 --- /dev/null +++ b/src/plugins/platforms/qvfb/qvfbintegration.cpp @@ -0,0 +1,439 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include // overrides QT_OPEN + +#include +#include + +#include "qvfbintegration.h" +#include "qwindowsurface_qvfb.h" +#include +#include +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + + +class QVFbScreenKeyboardHandler : public QObject +{ + Q_OBJECT +public: + QVFbScreenKeyboardHandler(); + ~QVFbScreenKeyboardHandler(); + +private slots: + void readKeyboardData(); + +private: + int kbdFD; + int kbdIdx; + int kbdBufferLen; + unsigned char *kbdBuffer; + QSocketNotifier *keyNotifier; +}; + +QVFbScreenKeyboardHandler::QVFbScreenKeyboardHandler() +{ + int displayId = 0; //TODO displayId + const QString keyboardDev = QT_VFB_KEYBOARD_PIPE(displayId); + + + kbdFD = -1; + kbdIdx = 0; + kbdBufferLen = sizeof(QVFbKeyData) * 5; + kbdBuffer = new unsigned char [kbdBufferLen]; + + kbdFD = QT_OPEN(keyboardDev.toLatin1().constData(), O_RDWR | O_NDELAY); + + if (kbdFD == -1) { + perror("QVFbScreenKeyboardHandler"); + qWarning("QVFbScreenKeyboardHandler: Unable to open device %s", + qPrintable(keyboardDev)); + return; + } + + // Clear pending input + char buf[2]; + while (QT_READ(kbdFD, buf, 1) > 0) { } + + keyNotifier = new QSocketNotifier(kbdFD, QSocketNotifier::Read, this); + connect(keyNotifier, SIGNAL(activated(int)),this, SLOT(readKeyboardData())); + +} + +QVFbScreenKeyboardHandler::~QVFbScreenKeyboardHandler() +{ + if (kbdFD >= 0) + QT_CLOSE(kbdFD); + delete [] kbdBuffer; +} + + +void QVFbScreenKeyboardHandler::readKeyboardData() +{ + int n; + do { + n = QT_READ(kbdFD, kbdBuffer+kbdIdx, kbdBufferLen - kbdIdx); + if (n > 0) + kbdIdx += n; + } while (n > 0); + + int idx = 0; + while (kbdIdx - idx >= (int)sizeof(QVFbKeyData)) { + QVFbKeyData *kd = (QVFbKeyData *)(kbdBuffer + idx); + if (kd->unicode == 0 && kd->keycode == 0 && kd->modifiers == 0 && kd->press) { + // magic exit key + qWarning("Instructed to quit by Virtual Keyboard"); + qApp->quit(); + } + + //QWSServer::processKeyEvent(kd->unicode ? kd->unicode : 0xffff, kd->keycode, kd->modifiers, kd->press, kd->repeat); + + QEvent::Type type = kd->press ? QEvent::KeyPress : QEvent::KeyRelease; + + QString text; + if (kd->unicode && kd->unicode != 0xffff) + text += QChar(kd->unicode); + +// qDebug() << "readKeyboardData" << type << hex << kd->keycode << kd->modifiers << text; + + QWindowSystemInterface::handleKeyEvent(0, type, kd->keycode, kd->modifiers, text, kd->repeat, int(text.length())); + idx += sizeof(QVFbKeyData); + } + + int surplus = kbdIdx - idx; + for (int i = 0; i < surplus; i++) + kbdBuffer[i] = kbdBuffer[idx+i]; + kbdIdx = surplus; +} + + + + +class QVFbScreenMouseHandler : public QObject +{ + Q_OBJECT +public: + QVFbScreenMouseHandler(); + ~QVFbScreenMouseHandler(); + +private slots: + void readMouseData(); + +private: + int mouseFD; + int mouseIdx; + enum {mouseBufSize = 128}; + uchar mouseBuf[mouseBufSize]; + QSocketNotifier *mouseNotifier; + + int oldButtonState; +}; + +QVFbScreenMouseHandler::QVFbScreenMouseHandler() +{ + int displayId = 0; //TODO: displayId + QString mouseDev = QT_VFB_MOUSE_PIPE(displayId); + + mouseFD = QT_OPEN(mouseDev.toLatin1().constData(), O_RDWR | O_NDELAY); + + if (mouseFD == -1) { + perror("QVFbMouseHandler::QVFbMouseHandler"); + qWarning("QVFbMouseHander: Unable to open device %s", + qPrintable(mouseDev)); + return; + } + + // Clear pending input + char buf[2]; + while (QT_READ(mouseFD, buf, 1) > 0) { } + + mouseIdx = 0; + oldButtonState = 0; + mouseNotifier = new QSocketNotifier(mouseFD, QSocketNotifier::Read, this); + connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData())); +} + + +QVFbScreenMouseHandler::~QVFbScreenMouseHandler() +{ + if (mouseFD >= 0) + QT_CLOSE(mouseFD); +} + +void QVFbScreenMouseHandler::readMouseData() +{ + int n; + do { + n = QT_READ(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx); + if (n > 0) + mouseIdx += n; + } while (n > 0); + + int idx = 0; + static const int packetsize = sizeof(QPoint) + 2*sizeof(int); + while (mouseIdx-idx >= packetsize) { + uchar *mb = mouseBuf+idx; + QPoint mousePos = *reinterpret_cast(mb); + mb += sizeof(QPoint); + int bstate = *reinterpret_cast(mb); + mb += sizeof(int); + //int wheel = *reinterpret_cast(mb); + + int button = bstate ^ oldButtonState; + QEvent::Type type = QEvent::MouseMove; + + if (button) { + type = (button & bstate) ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; + } + QWindowSystemInterface::handleMouseEvent(0, mousePos, mousePos, Qt::MouseButtons(bstate)); + +// qDebug() << "readMouseData" << mousePos << button << bstate << oldButtonState << type; + + oldButtonState = bstate; + + idx += packetsize; + } + + int surplus = mouseIdx - idx; + for (int i = 0; i < surplus; i++) + mouseBuf[i] = mouseBuf[idx+i]; + mouseIdx = surplus; + +} + + +class QVFbScreenPrivate +{ +public: + QVFbScreenPrivate(QVFbScreen *) + : shmrgn(0), hdr(0), data(0), mouseHandler(0), keyboardHandler(0) + { + connect(0); //for now we only handle one screen + } + + ~QVFbScreenPrivate() { disconnect(); } + void setDirty(const QRect &r); + + bool connect(int displayId); + void disconnect(); + + QImage *screenImage() { return &img; } + QSize screenSize() { return img.size(); } + + int depth() const { return img.depth(); } + QImage::Format format() const { return img.format(); } + +private: + unsigned char *shmrgn; + QVFbHeader *hdr; + uchar *data; + QVFbScreenMouseHandler *mouseHandler; + QVFbScreenKeyboardHandler *keyboardHandler; + + + QImage img; +}; + + +void QVFbScreenPrivate::setDirty(const QRect &r) +{ + hdr->dirty = true; + hdr->update = hdr->update.united(r); +} + + +bool QVFbScreenPrivate::connect(int displayId) +{ + + key_t key = ftok(QT_VFB_MOUSE_PIPE(displayId).toLatin1(), 'b'); + + if (key == -1) + return false; + + + int shmId = shmget(key, 0, 0); + if (shmId != -1) + shmrgn = (unsigned char *)shmat(shmId, 0, 0); + else + return false; + + if ((long)shmrgn == -1 || shmrgn == 0) { + qDebug("No shmrgn %ld", (long)shmrgn); + return false; + } + + hdr = (QVFbHeader *)shmrgn; + data = shmrgn + hdr->dataoffset; + + int w = hdr->width; + int h = hdr->height; + int d = hdr->depth; + int lstep = hdr->linestep; + + QImage::Format format = QImage::Format_Invalid; + if (d == 32) + format = QImage::Format_ARGB32_Premultiplied; + else if (d == 16) + format = QImage::Format_RGB16; + + + if (format == QImage::Format_Invalid) { + img = QImage(); + return false; + } + + img = QImage(data, w, h, lstep, format); + + qDebug("connected %dx%d %d bpp", w, h, d); + + + mouseHandler = new QVFbScreenMouseHandler; + keyboardHandler = new QVFbScreenKeyboardHandler; + return true; +} + +void QVFbScreenPrivate::disconnect() +{ + if ((long)shmrgn != -1 && shmrgn) { + shmdt((char*)shmrgn); + shmrgn = 0; + } + delete mouseHandler; + mouseHandler = 0; + delete keyboardHandler; + keyboardHandler = 0; +} + + +QVFbScreen::QVFbScreen() +{ + d_ptr = new QVFbScreenPrivate(this); +} + + +QVFbScreen::~QVFbScreen() +{ + delete d_ptr; +} + +void QVFbScreen::setDirty(const QRect &rect) +{ + d_ptr->setDirty(rect); +} + + + +QRect QVFbScreen::geometry() const { + return QRect(QPoint(), d_ptr->screenSize()); +} + + +int QVFbScreen::depth() const +{ + return d_ptr->depth(); +} + +QImage::Format QVFbScreen::format() const +{ + return d_ptr->format(); +} + +QSize QVFbScreen::physicalSize() const { + return (d_ptr->screenSize()*254)/720; +} + +#if 0 +int QVFbScreen::linestep() const { + return d_ptr->screenImage() ? d_ptr->screenImage()->bytesPerLine() : 0; +} + +uchar *QVFbScreen::base() const { + return d_ptr->screenImage() ? d_ptr->screenImage()->bits() : 0; +} +#endif + +QImage *QVFbScreen::screenImage() +{ + return d_ptr->screenImage(); +} + +QVFbIntegration::QVFbIntegration() +{ + mPrimaryScreen = new QVFbScreen(); + + mScreens.append(mPrimaryScreen); +} + +QPixmapData *QVFbIntegration::createPixmapData(QPixmapData::PixelType type) const +{ + return new QRasterPixmapData(type); +} + +QWindowSurface *QVFbIntegration::createWindowSurfaceForWindow(QWidget *widget, WId) const +{ + if (widget->windowType() == Qt::Desktop) + return 0; // Don't create an explicit window surface for the destkop. + return new QVFbWindowSurface(mPrimaryScreen, widget); +} + + +QPlatformWindow *QVFbIntegration::createPlatformWindow(QWidget *widget, WId) const +{ + return new QVFbWindow(mPrimaryScreen, widget); +} + +QT_END_NAMESPACE + +#include "qgraphicssystem_qvfb.moc" diff --git a/src/plugins/platforms/qvfb/qvfbintegration.h b/src/plugins/platforms/qvfb/qvfbintegration.h new file mode 100644 index 0000000..1207678 --- /dev/null +++ b/src/plugins/platforms/qvfb/qvfbintegration.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_QVFB_H +#define QGRAPHICSSYSTEM_QVFB_H + +#include +#include + +QT_BEGIN_NAMESPACE + + +class QVFbScreenPrivate; + +class QVFbScreen : public QPlatformScreen +{ +public: + QVFbScreen(); + ~QVFbScreen(); + + QRect geometry() const; + int depth() const; + QImage::Format format() const; + QSize physicalSize() const; + + QImage *screenImage(); + + void setDirty(const QRect &rect); + +public: + + QVFbScreenPrivate *d_ptr; +}; + +class QVFbIntegrationPrivate; + + +class QVFbIntegration : public QPlatformIntegration +{ +public: + QVFbIntegration(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; + QWindowSurface *createWindowSurfaceForWindow(QWidget *widget, WId winId) const; + + QList screens() const { return mScreens; } + +private: + QVFbScreen *mPrimaryScreen; + QList mScreens; +}; + + + +QT_END_NAMESPACE + + +#endif diff --git a/src/plugins/platforms/qvfb/qwindowsurface_qvfb.cpp b/src/plugins/platforms/qvfb/qwindowsurface_qvfb.cpp index 0aafe28..b46d9c0 100644 --- a/src/plugins/platforms/qvfb/qwindowsurface_qvfb.cpp +++ b/src/plugins/platforms/qvfb/qwindowsurface_qvfb.cpp @@ -41,15 +41,15 @@ #include "qwindowsurface_qvfb.h" -#include "qgraphicssystem_qvfb.h" +#include "qvfbintegration.h" #include #include #include QT_BEGIN_NAMESPACE -QVFbWindowSurface::QVFbWindowSurface(QVFbGraphicsSystem *graphicsSystem, - QVFbGraphicsSystemScreen *screen, QWidget *window) +QVFbWindowSurface::QVFbWindowSurface(//QVFbIntegration *graphicsSystem, + QVFbScreen *screen, QWidget *window) : QWindowSurface(window), mScreen(screen) { @@ -69,36 +69,40 @@ void QVFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoi Q_UNUSED(widget); Q_UNUSED(offset); - QRect rect = geometry(); - QPoint topLeft = rect.topLeft(); +// QRect rect = geometry(); +// QPoint topLeft = rect.topLeft(); mScreen->setDirty(region.boundingRect()); } -void QVFbWindowSurface::setGeometry(const QRect &) +void QVFbWindowSurface::resize(const QSize&) { // any size you like as long as it's full-screen... QRect rect(mScreen->availableGeometry()); - QWindowSystemInterface::handleGeometryChange(this->window(), rect); - - QWindowSurface::setGeometry(rect); + QWindowSurface::resize(rect.size()); } -bool QVFbWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - return QWindowSurface::scroll(area, dx, dy); -} -void QVFbWindowSurface::beginPaint(const QRegion ®ion) +QVFbWindow::QVFbWindow(QVFbScreen *screen, QWidget *window) + : QPlatformWindow(window), + mScreen(screen) { - Q_UNUSED(region); } -void QVFbWindowSurface::endPaint(const QRegion ®ion) + +void QVFbWindow::setGeometry(const QRect &) { - Q_UNUSED(region); + +// any size you like as long as it's full-screen... + + QRect rect(mScreen->availableGeometry()); + QWindowSystemInterface::handleGeometryChange(this->widget(), rect); + + QPlatformWindow::setGeometry(rect); } + + QT_END_NAMESPACE diff --git a/src/plugins/platforms/qvfb/qwindowsurface_qvfb.h b/src/plugins/platforms/qvfb/qwindowsurface_qvfb.h index 1971caa..9228189 100644 --- a/src/plugins/platforms/qvfb/qwindowsurface_qvfb.h +++ b/src/plugins/platforms/qvfb/qwindowsurface_qvfb.h @@ -43,32 +43,38 @@ #define QWINDOWSURFACE_QVFB_H #include +#include QT_BEGIN_NAMESPACE -class QVFbGraphicsSystem; -class QVFbGraphicsSystemScreen; +class QVFbIntegration; +class QVFbScreen; class QVFbWindowSurface : public QWindowSurface { public: - QVFbWindowSurface(QVFbGraphicsSystem *graphicsSystem, - QVFbGraphicsSystemScreen *screen, QWidget *window); + QVFbWindowSurface(QVFbScreen *screen, QWidget *window); ~QVFbWindowSurface(); QPaintDevice *paintDevice(); void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void setGeometry(const QRect &rect); - bool scroll(const QRegion &area, int dx, int dy); + void resize(const QSize &size); + +private: + QVFbScreen *mScreen; +}; - void beginPaint(const QRegion ®ion); - void endPaint(const QRegion ®ion); +class QVFbWindow : public QPlatformWindow +{ +public: + QVFbWindow(QVFbScreen *screen, QWidget *window); + void setGeometry(const QRect &rect); private: - QVFbGraphicsSystem *mGraphicsSystem; - QVFbGraphicsSystemScreen *mScreen; + QVFbScreen *mScreen; }; + QT_END_NAMESPACE #endif -- cgit v0.12 From f507dca0b179b85455662c69029435310320f4c0 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 13 Apr 2010 16:11:27 +0200 Subject: Oops, don't crash in raise()/lower() --- src/plugins/platforms/testlite/qplatformintegration_testlite.cpp | 2 +- src/plugins/platforms/testlite/qtestlitewindow.cpp | 6 +++--- src/plugins/platforms/testlite/qtestlitewindow.h | 3 +-- src/plugins/platforms/testlite/qwindowsurface_testlite.cpp | 1 - 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp b/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp index f9b3135..f13951d 100644 --- a/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp +++ b/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp @@ -113,7 +113,7 @@ QWindowSurface *QTestLiteIntegration::createWindowSurfaceForWindow(QWidget *widg QPlatformWindow *QTestLiteIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const { - return new QTestLiteWindow(const_cast(this), mPrimaryScreen, widget); + return new QTestLiteWindow(this, mPrimaryScreen, widget); } diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index 0b215e3..108f732 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -143,7 +143,7 @@ private: -QTestLiteWindow::QTestLiteWindow(QTestLiteIntegration *platformIntegration, +QTestLiteWindow::QTestLiteWindow(const QTestLiteIntegration *platformIntegration, QTestLiteScreen */*screen*/, QWidget *window) :QPlatformWindow(window) { @@ -638,12 +638,12 @@ WId QTestLiteWindow::winId() const void QTestLiteWindow::raise() { - XRaiseWindow(mPlatformIntegration->xd->display, x_window); + XRaiseWindow(xd->display, x_window); } void QTestLiteWindow::lower() { - XLowerWindow(mPlatformIntegration->xd->display, x_window); + XLowerWindow(xd->display, x_window); } void QTestLiteWindow::setWindowTitle(const QString &title) diff --git a/src/plugins/platforms/testlite/qtestlitewindow.h b/src/plugins/platforms/testlite/qtestlitewindow.h index 6fb7ed2..3624854 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.h +++ b/src/plugins/platforms/testlite/qtestlitewindow.h @@ -99,7 +99,7 @@ class QWindowSurface; class QTestLiteWindow : public QPlatformWindow { public: - QTestLiteWindow(QTestLiteIntegration *platformIntegration, + QTestLiteWindow(const QTestLiteIntegration *platformIntegration, QTestLiteScreen *screen, QWidget *window); ~QTestLiteWindow(); @@ -143,7 +143,6 @@ private: QWindowSurface *windowSurface; MyDisplay *xd; - QTestLiteIntegration *mPlatformIntegration; QTestLiteScreen *mScreen; Qt::WindowFlags window_flags; diff --git a/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp b/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp index b5a0f74..af10368 100644 --- a/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp +++ b/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp @@ -137,7 +137,6 @@ QTestLiteWindowSurface::QTestLiteWindowSurface (QTestLiteScreen */*screen*/, QWi QTestLiteWindowSurface::~QTestLiteWindowSurface() { - qDebug() << "~QTestLiteWindowSurface"; delete image_info; } -- cgit v0.12 From b2315a45cb1d64b86a4974ae0dac97c877a69d91 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 14 Apr 2010 11:07:02 +0200 Subject: Implement createWindowSurface, so that reparenting works MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Jørgen --- src/gui/painting/qgraphicssystem_lite.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/painting/qgraphicssystem_lite.cpp b/src/gui/painting/qgraphicssystem_lite.cpp index a62abbb..68d880b 100644 --- a/src/gui/painting/qgraphicssystem_lite.cpp +++ b/src/gui/painting/qgraphicssystem_lite.cpp @@ -51,8 +51,7 @@ QPixmapData *QLiteGraphicsSystem::createPixmapData(QPixmapData::PixelType type) QWindowSurface *QLiteGraphicsSystem::createWindowSurface(QWidget *widget) const { - qFatal("should not use QLiteGraphicsSystem::createWindowSurface"); - return 0; + return QApplicationPrivate::platformIntegration()->createWindowSurfaceForWindow(widget, widget->winId()); } QBlittable *QLiteGraphicsSystem::createBlittable(const QSize &size) const -- cgit v0.12 From 4e42cea17031ff90481a674686afdd5548fba4a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 14 Apr 2010 12:38:01 +0200 Subject: Refactored directfb plugin --- src/plugins/platforms/directfb/directfb.pro | 12 +- src/plugins/platforms/directfb/main.cpp | 2 +- .../platforms/directfb/qblitter_directfb.cpp | 114 ----------------- src/plugins/platforms/directfb/qblitter_directfb.h | 29 ----- .../platforms/directfb/qdirectfbblitter.cpp | 114 +++++++++++++++++ src/plugins/platforms/directfb/qdirectfbblitter.h | 29 +++++ .../platforms/directfb/qdirectfbconvenience.cpp | 2 +- src/plugins/platforms/directfb/qdirectfbcursor.cpp | 3 - .../platforms/directfb/qdirectfbintegration.cpp | 125 ++++++++++++++++++ .../platforms/directfb/qdirectfbintegration.h | 100 +++++++++++++++ .../platforms/directfb/qdirectfbwindowsurface.cpp | 141 +++++++++++++++++++++ .../platforms/directfb/qdirectfbwindowsurface.h | 77 +++++++++++ .../directfb/qplatformintegration_directfb.cpp | 125 ------------------ .../directfb/qplatformintegration_directfb.h | 99 --------------- .../platforms/directfb/qwindowsurface_directfb.cpp | 141 --------------------- .../platforms/directfb/qwindowsurface_directfb.h | 77 ----------- 16 files changed, 594 insertions(+), 596 deletions(-) delete mode 100644 src/plugins/platforms/directfb/qblitter_directfb.cpp delete mode 100644 src/plugins/platforms/directfb/qblitter_directfb.h create mode 100644 src/plugins/platforms/directfb/qdirectfbblitter.cpp create mode 100644 src/plugins/platforms/directfb/qdirectfbblitter.h create mode 100644 src/plugins/platforms/directfb/qdirectfbintegration.cpp create mode 100644 src/plugins/platforms/directfb/qdirectfbintegration.h create mode 100644 src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp create mode 100644 src/plugins/platforms/directfb/qdirectfbwindowsurface.h delete mode 100644 src/plugins/platforms/directfb/qplatformintegration_directfb.cpp delete mode 100644 src/plugins/platforms/directfb/qplatformintegration_directfb.h delete mode 100644 src/plugins/platforms/directfb/qwindowsurface_directfb.cpp delete mode 100644 src/plugins/platforms/directfb/qwindowsurface_directfb.h diff --git a/src/plugins/platforms/directfb/directfb.pro b/src/plugins/platforms/directfb/directfb.pro index ec5f0f1..f81ec31 100644 --- a/src/plugins/platforms/directfb/directfb.pro +++ b/src/plugins/platforms/directfb/directfb.pro @@ -13,16 +13,16 @@ INCLUDEPATH += $$DIRECTFB_INCLUDEPATH LIBS += $$DIRECTFB_LIBS SOURCES = main.cpp \ - qplatformintegration_directfb.cpp \ - qwindowsurface_directfb.cpp \ - qblitter_directfb.cpp \ + qdirectfbintegration.cpp \ + qdirectfbwindowsurface.cpp \ + qdirectfbblitter.cpp \ qdirectfbconvenience.cpp \ qdirectfbinput.cpp \ qdirectfbcursor.cpp \ qdirectfbwindow.cpp -HEADERS = qplatformintegration_directfb.h \ - qwindowsurface_directfb.h \ - qblitter_directfb.h \ +HEADERS = qdirectfbintegration.h \ + qdirectfbwindowsurface.h \ + qdirectfbblitter.h \ qdirectfbconvenience.h \ qdirectfbinput.h \ qdirectfbcursor.h \ diff --git a/src/plugins/platforms/directfb/main.cpp b/src/plugins/platforms/directfb/main.cpp index 1f0f081..9c7bcf6 100644 --- a/src/plugins/platforms/directfb/main.cpp +++ b/src/plugins/platforms/directfb/main.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include -#include "qplatformintegration_directfb.h" +#include "qdirectfbintegration.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/directfb/qblitter_directfb.cpp b/src/plugins/platforms/directfb/qblitter_directfb.cpp deleted file mode 100644 index 20f8741..0000000 --- a/src/plugins/platforms/directfb/qblitter_directfb.cpp +++ /dev/null @@ -1,114 +0,0 @@ -#include "qblitter_directfb.h" -#include "qdirectfbconvenience.h" - -#include - -#include - -#include - -QDirectFbBlitter::QDirectFbBlitter(const QSize &rect, IDirectFBSurface *surface) - : QBlittable(rect, QBlittable::Capabilities(QBlittable::SolidRectCapability - |QBlittable::SourcePixmapCapability - |QBlittable::SourceOverPixmapCapability - |QBlittable::SourceOverScaledPixmapCapability)) -{ - if (surface) { - m_surface = surface; - } else { - DFBSurfaceDescription surfaceDesc; - memset(&surfaceDesc,0,sizeof(DFBSurfaceDescription)); - surfaceDesc.width = rect.width(); - surfaceDesc.height = rect.height(); - surfaceDesc.caps = DSCAPS_PREMULTIPLIED; - surfaceDesc.pixelformat = DSPF_ARGB; - surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_CAPS | DSDESC_PIXELFORMAT); - - IDirectFB *dfb = QDirectFbConvenience::dfbInterface(); - dfb->CreateSurface(dfb,&surfaceDesc, &m_surface); - m_surface->Clear(m_surface,0,0,0,0); - } - -} - -QDirectFbBlitter::~QDirectFbBlitter() -{ - unlock(); - m_surface->Release(m_surface); -} - -void QDirectFbBlitter::fillRect(const QRectF &rect, const QColor &color) -{ - m_surface->SetColor(m_surface, color.red(), color.green(), color.blue(), color.alpha()); -// When the blitter api supports non opaque blits, also remember to change -// qpixmap_blitter.cpp::fill -// DFBSurfaceDrawingFlags drawingFlags = color.alpha() ? DSDRAW_BLEND : DSDRAW_NOFX; -// m_surface->SetDrawingFlags(m_surface, drawingFlags); - m_surface->SetDrawingFlags(m_surface, DSDRAW_NOFX); - m_surface->FillRectangle(m_surface, rect.x(), rect.y(), - rect.width(), rect.height()); -} - -void QDirectFbBlitter::drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &srcRect) -{ - QPixmapData *data = pixmap.pixmapData(); - Q_ASSERT(data->width() && data->height()); - Q_ASSERT(data->classId() == QPixmapData::BlitterClass); - QBlittablePixmapData *blitPm = static_cast(data); - QDirectFbBlitter *dfbBlitter = static_cast(blitPm->blittable()); - dfbBlitter->unlock(); - - IDirectFBSurface *s = dfbBlitter->m_surface; - - DFBSurfaceBlittingFlags blittingFlags = DSBLIT_NOFX; - DFBSurfacePorterDuffRule porterDuff = DSPD_SRC; - if (pixmap.hasAlpha()) { - blittingFlags = DSBLIT_BLEND_ALPHACHANNEL; - porterDuff = DSPD_SRC_OVER; - } - - m_surface->SetBlittingFlags(m_surface, DFBSurfaceBlittingFlags(blittingFlags)); - m_surface->SetPorterDuff(m_surface,porterDuff); - m_surface->SetDstBlendFunction(m_surface,DSBF_INVSRCALPHA); - - const DFBRectangle sRect = { srcRect.x(), srcRect.y(), srcRect.width(), srcRect.height() }; - - DFBResult result; - if (rect.width() == srcRect.width() && rect.height() == srcRect.height()) - result = m_surface->Blit(m_surface, s, &sRect, rect.x(), rect.y()); - else { - const DFBRectangle dRect = { rect.x(), rect.y(), rect.width(), rect.height() }; - result = m_surface->StretchBlit(m_surface, s, &sRect, &dRect); - } - if (result != DFB_OK) - DirectFBError("QDirectFBBlitter::drawPixmap()", result); -} - -QImage *QDirectFbBlitter::doLock() -{ - Q_ASSERT(m_surface); - Q_ASSERT(size().isValid()); - - void *mem; - int bpl; - const DFBResult result = m_surface->Lock(m_surface, DFBSurfaceLockFlags(DSLF_WRITE|DSLF_READ), static_cast(&mem), &bpl); - if (result == DFB_OK) { - DFBSurfacePixelFormat dfbFormat; - DFBSurfaceCapabilities dfbCaps; - m_surface->GetPixelFormat(m_surface,&dfbFormat); - m_surface->GetCapabilities(m_surface,&dfbCaps); - QImage::Format format = QDirectFbConvenience::imageFormatFromSurfaceFormat(dfbFormat, dfbCaps); - int w, h; - m_surface->GetSize(m_surface,&w,&h); - m_image = QImage(static_cast(mem),w,h,bpl,format); - } else { - DirectFBError("Failed to lock image", result); - } - - return &m_image; -} - -void QDirectFbBlitter::doUnlock() -{ - m_surface->Unlock(m_surface); -} diff --git a/src/plugins/platforms/directfb/qblitter_directfb.h b/src/plugins/platforms/directfb/qblitter_directfb.h deleted file mode 100644 index 85a303a..0000000 --- a/src/plugins/platforms/directfb/qblitter_directfb.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef QDIRECTFBBLITTER_H -#define QDIRECTFBBLITTER_H - -#include "qdirectfbconvenience.h" - -#include - -#include - -class QDirectFbBlitter : public QBlittable -{ -public: - QDirectFbBlitter(const QSize &size, IDirectFBSurface *surface = 0); - virtual ~QDirectFbBlitter(); - - virtual void fillRect(const QRectF &rect, const QColor &color); - virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect); - -protected: - virtual QImage *doLock(); - virtual void doUnlock(); - - IDirectFBSurface *m_surface; - QImage m_image; - - friend class QDirectFbConvenience; -}; - -#endif // QDIRECTFBBLITTER_H diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.cpp b/src/plugins/platforms/directfb/qdirectfbblitter.cpp new file mode 100644 index 0000000..15bb18b --- /dev/null +++ b/src/plugins/platforms/directfb/qdirectfbblitter.cpp @@ -0,0 +1,114 @@ +#include "qdirectfbblitter.h" +#include "qdirectfbconvenience.h" + +#include + +#include + +#include + +QDirectFbBlitter::QDirectFbBlitter(const QSize &rect, IDirectFBSurface *surface) + : QBlittable(rect, QBlittable::Capabilities(QBlittable::SolidRectCapability + |QBlittable::SourcePixmapCapability + |QBlittable::SourceOverPixmapCapability + |QBlittable::SourceOverScaledPixmapCapability)) +{ + if (surface) { + m_surface = surface; + } else { + DFBSurfaceDescription surfaceDesc; + memset(&surfaceDesc,0,sizeof(DFBSurfaceDescription)); + surfaceDesc.width = rect.width(); + surfaceDesc.height = rect.height(); + surfaceDesc.caps = DSCAPS_PREMULTIPLIED; + surfaceDesc.pixelformat = DSPF_ARGB; + surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_CAPS | DSDESC_PIXELFORMAT); + + IDirectFB *dfb = QDirectFbConvenience::dfbInterface(); + dfb->CreateSurface(dfb,&surfaceDesc, &m_surface); + m_surface->Clear(m_surface,0,0,0,0); + } + +} + +QDirectFbBlitter::~QDirectFbBlitter() +{ + unlock(); + m_surface->Release(m_surface); +} + +void QDirectFbBlitter::fillRect(const QRectF &rect, const QColor &color) +{ + m_surface->SetColor(m_surface, color.red(), color.green(), color.blue(), color.alpha()); +// When the blitter api supports non opaque blits, also remember to change +// qpixmap_blitter.cpp::fill +// DFBSurfaceDrawingFlags drawingFlags = color.alpha() ? DSDRAW_BLEND : DSDRAW_NOFX; +// m_surface->SetDrawingFlags(m_surface, drawingFlags); + m_surface->SetDrawingFlags(m_surface, DSDRAW_NOFX); + m_surface->FillRectangle(m_surface, rect.x(), rect.y(), + rect.width(), rect.height()); +} + +void QDirectFbBlitter::drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &srcRect) +{ + QPixmapData *data = pixmap.pixmapData(); + Q_ASSERT(data->width() && data->height()); + Q_ASSERT(data->classId() == QPixmapData::BlitterClass); + QBlittablePixmapData *blitPm = static_cast(data); + QDirectFbBlitter *dfbBlitter = static_cast(blitPm->blittable()); + dfbBlitter->unlock(); + + IDirectFBSurface *s = dfbBlitter->m_surface; + + DFBSurfaceBlittingFlags blittingFlags = DSBLIT_NOFX; + DFBSurfacePorterDuffRule porterDuff = DSPD_SRC; + if (pixmap.hasAlpha()) { + blittingFlags = DSBLIT_BLEND_ALPHACHANNEL; + porterDuff = DSPD_SRC_OVER; + } + + m_surface->SetBlittingFlags(m_surface, DFBSurfaceBlittingFlags(blittingFlags)); + m_surface->SetPorterDuff(m_surface,porterDuff); + m_surface->SetDstBlendFunction(m_surface,DSBF_INVSRCALPHA); + + const DFBRectangle sRect = { srcRect.x(), srcRect.y(), srcRect.width(), srcRect.height() }; + + DFBResult result; + if (rect.width() == srcRect.width() && rect.height() == srcRect.height()) + result = m_surface->Blit(m_surface, s, &sRect, rect.x(), rect.y()); + else { + const DFBRectangle dRect = { rect.x(), rect.y(), rect.width(), rect.height() }; + result = m_surface->StretchBlit(m_surface, s, &sRect, &dRect); + } + if (result != DFB_OK) + DirectFBError("QDirectFBBlitter::drawPixmap()", result); +} + +QImage *QDirectFbBlitter::doLock() +{ + Q_ASSERT(m_surface); + Q_ASSERT(size().isValid()); + + void *mem; + int bpl; + const DFBResult result = m_surface->Lock(m_surface, DFBSurfaceLockFlags(DSLF_WRITE|DSLF_READ), static_cast(&mem), &bpl); + if (result == DFB_OK) { + DFBSurfacePixelFormat dfbFormat; + DFBSurfaceCapabilities dfbCaps; + m_surface->GetPixelFormat(m_surface,&dfbFormat); + m_surface->GetCapabilities(m_surface,&dfbCaps); + QImage::Format format = QDirectFbConvenience::imageFormatFromSurfaceFormat(dfbFormat, dfbCaps); + int w, h; + m_surface->GetSize(m_surface,&w,&h); + m_image = QImage(static_cast(mem),w,h,bpl,format); + } else { + DirectFBError("Failed to lock image", result); + } + + return &m_image; +} + +void QDirectFbBlitter::doUnlock() +{ + m_surface->Unlock(m_surface); +} diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.h b/src/plugins/platforms/directfb/qdirectfbblitter.h new file mode 100644 index 0000000..85a303a --- /dev/null +++ b/src/plugins/platforms/directfb/qdirectfbblitter.h @@ -0,0 +1,29 @@ +#ifndef QDIRECTFBBLITTER_H +#define QDIRECTFBBLITTER_H + +#include "qdirectfbconvenience.h" + +#include + +#include + +class QDirectFbBlitter : public QBlittable +{ +public: + QDirectFbBlitter(const QSize &size, IDirectFBSurface *surface = 0); + virtual ~QDirectFbBlitter(); + + virtual void fillRect(const QRectF &rect, const QColor &color); + virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect); + +protected: + virtual QImage *doLock(); + virtual void doUnlock(); + + IDirectFBSurface *m_surface; + QImage m_image; + + friend class QDirectFbConvenience; +}; + +#endif // QDIRECTFBBLITTER_H diff --git a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp index 8594c09..adf9687 100644 --- a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp +++ b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp @@ -1,5 +1,5 @@ #include "qdirectfbconvenience.h" -#include "qblitter_directfb.h" +#include "qdirectfbblitter.h" #include diff --git a/src/plugins/platforms/directfb/qdirectfbcursor.cpp b/src/plugins/platforms/directfb/qdirectfbcursor.cpp index bb7088f..2edae45 100644 --- a/src/plugins/platforms/directfb/qdirectfbcursor.cpp +++ b/src/plugins/platforms/directfb/qdirectfbcursor.cpp @@ -1,9 +1,6 @@ #include "qdirectfbcursor.h" -#include "qblitter_directfb.h" -#include "qplatformintegration_directfb.h" #include "qdirectfbconvenience.h" -#include QDirectFBCursor::QDirectFBCursor(QPlatformScreen* screen) : QGraphicsSystemCursor(screen), surface(0) diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.cpp b/src/plugins/platforms/directfb/qdirectfbintegration.cpp new file mode 100644 index 0000000..b096081 --- /dev/null +++ b/src/plugins/platforms/directfb/qdirectfbintegration.cpp @@ -0,0 +1,125 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdirectfbintegration.h" +#include "qdirectfbwindowsurface.h" +#include "qdirectfbblitter.h" +#include "qdirectfbconvenience.h" +#include "qdirectfbcursor.h" +#include "qdirectfbwindow.h" + +#include +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +QDirectFbScreen::QDirectFbScreen(int display) + :QPlatformScreen() +{ + m_layer = QDirectFbConvenience::dfbDisplayLayer(display); + m_layer->SetCooperativeLevel(m_layer,DLSCL_SHARED); + + DFBDisplayLayerConfig config; + m_layer->GetConfiguration(m_layer, &config); + + m_format = QDirectFbConvenience::imageFormatFromSurfaceFormat(config.pixelformat, config.surface_caps); + m_geometry = QRect(0,0,config.width,config.height); + const int dpi = 72; + const qreal inch = 25.4; + m_depth = 32; + m_physicalSize = QSize(qRound(config.width * inch / dpi), qRound(config.height *inch / dpi)); + + cursor = new QDirectFBCursor(this); +} + +QDirectFbScreen::~QDirectFbScreen() +{ +} + +QDirectFbIntegration::QDirectFbIntegration() +{ + const QStringList args = QCoreApplication::arguments(); + int argc = args.size(); + char **argv = new char*[argc]; + + for (int i = 0; i < argc; ++i) + argv[i] = qstrdup(args.at(i).toLocal8Bit().constData()); + + DFBResult result = DirectFBInit(&argc, &argv); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreen: error initializing DirectFB", + result); + } + delete[] argv; + + QDirectFbScreen *primaryScreen = new QDirectFbScreen(0); + mScreens.append(primaryScreen); +} + +QPixmapData *QDirectFbIntegration::createPixmapData(QPixmapData::PixelType type) const +{ + if (type == QPixmapData::BitmapType) + return new QRasterPixmapData(type); + else + return new QBlittablePixmapData(type); +} + +QPlatformWindow *QDirectFbIntegration::createPlatformWindow(QWidget *widget, WId winId) const +{ + Q_UNUSED(winId); + return new QDirectFbWindow(widget); +} + +QWindowSurface *QDirectFbIntegration::createWindowSurfaceForWindow(QWidget *widget, WId winId) const +{ + return new QDirectFbWindowSurface(widget,winId); +} + +QBlittable *QDirectFbIntegration::createBlittable(const QSize &size) const +{ + return new QDirectFbBlitter(size); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.h b/src/plugins/platforms/directfb/qdirectfbintegration.h new file mode 100644 index 0000000..808bc9d --- /dev/null +++ b/src/plugins/platforms/directfb/qdirectfbintegration.h @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMINTEGRATION_DIRECTFB_H +#define QPLATFORMINTEGRATION_DIRECTFB_H + +#include "qdirectfbinput.h" + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QDirectFBCursor; + +class QDirectFbScreen : public QPlatformScreen +{ +Q_OBJECT +public: + QDirectFbScreen(int display); + ~QDirectFbScreen(); + + QRect geometry() const { return m_geometry; } + int depth() const { return m_depth; } + QImage::Format format() const { return m_format; } + QSize physicalSize() const { return m_physicalSize; } + +public: + QRect m_geometry; + int m_depth; + QImage::Format m_format; + QSize m_physicalSize; + + IDirectFBDisplayLayer *m_layer; + +private: + QDirectFBCursor * cursor; + +}; + +class QDirectFbIntegration : public QPlatformIntegration +{ +public: + QDirectFbIntegration(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; + QWindowSurface *createWindowSurfaceForWindow(QWidget *widget, WId winId) const; + QBlittable *createBlittable(const QSize &size) const; + + QList screens() const { return mScreens; } + + + +private: + QList mScreens; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp b/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp new file mode 100644 index 0000000..4ca9a72 --- /dev/null +++ b/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdirectfbwindowsurface.h" +#include "qdirectfbintegration.h" +#include "qdirectfbblitter.h" +#include "qdirectfbconvenience.h" +#include + +#include + +QT_BEGIN_NAMESPACE + +QDirectFbWindowSurface::QDirectFbWindowSurface(QWidget *window, WId wId) + : QWindowSurface(window), m_pixmap(0), m_pmdata(0), m_dfbSurface(0) +{ + + IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); + + DFBWindowID id(wId); + IDirectFBWindow *dfbWindow; + + layer->GetWindow(layer,id,&dfbWindow); + + dfbWindow->GetSurface(dfbWindow,&m_dfbSurface); +//WRONGSIZE + QDirectFbBlitter *blitter = new QDirectFbBlitter(window->rect().size(), m_dfbSurface); + m_pmdata = new QBlittablePixmapData(QPixmapData::PixmapType); + m_pmdata->setBlittable(blitter); + m_pixmap = new QPixmap(m_pmdata); +} + +QDirectFbWindowSurface::~QDirectFbWindowSurface() +{ + +} + +QPaintDevice *QDirectFbWindowSurface::paintDevice() +{ + return m_pixmap; +} + +void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + m_pmdata->blittable()->unlock(); + + QVector rects = region.rects(); + for (int i = 0 ; i < rects.size(); i++) { + const QRect rect = rects.at(i); + DFBRegion dfbReg = { rect.x() + offset.x(),rect.y() + offset.y(),rect.right() + offset.x(),rect.bottom() + offset.y()}; + m_dfbSurface->Flip(m_dfbSurface, &dfbReg, DFBSurfaceFlipFlags(DSFLIP_BLIT|DSFLIP_ONSYNC)); + } +} + +void QDirectFbWindowSurface::resize(const QSize &size) +{ + QWindowSurface::resize(size); + + //Have to add 1 ref ass it will be removed by deleting the old blitter in setBlittable + m_dfbSurface->AddRef(m_dfbSurface); + QDirectFbBlitter *blitter = new QDirectFbBlitter(size,m_dfbSurface); + m_pmdata->setBlittable(blitter); +} + +static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int dx, int dy) +{ + const DFBRectangle rect = { r.x(), r.y(), r.width(), r.height() }; + surface->Blit(surface, surface, &rect, r.x() + dx, r.y() + dy); + const DFBRegion region = { rect.x + dx, rect.y + dy, r.right() + dx, r.bottom() + dy }; + surface->Flip(surface, ®ion, DFBSurfaceFlipFlags(DSFLIP_BLIT)); +} + +bool QDirectFbWindowSurface::scroll(const QRegion &area, int dx, int dy) +{ + m_pmdata->blittable()->unlock(); + + if (!m_dfbSurface || area.isEmpty()) + return false; + m_dfbSurface->SetBlittingFlags(m_dfbSurface, DSBLIT_NOFX); + if (area.rectCount() == 1) { + scrollSurface(m_dfbSurface, area.boundingRect(), dx, dy); + } else { + const QVector rects = area.rects(); + const int n = rects.size(); + for (int i=0; i +#include + +#include + +QT_BEGIN_NAMESPACE + +class QDirectFbWindowSurface : public QWindowSurface +{ +public: + QDirectFbWindowSurface(QWidget *window, WId wid); + ~QDirectFbWindowSurface(); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void resize (const QSize &size); + bool scroll(const QRegion &area, int dx, int dy); + + void beginPaint(const QRegion ®ion); + void endPaint(const QRegion ®ion); + +private: + void lockSurfaceToImage(); + + QPixmap *m_pixmap; + QBlittablePixmapData *m_pmdata; + + IDirectFBSurface *m_dfbSurface; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/directfb/qplatformintegration_directfb.cpp b/src/plugins/platforms/directfb/qplatformintegration_directfb.cpp deleted file mode 100644 index 5f428ef..0000000 --- a/src/plugins/platforms/directfb/qplatformintegration_directfb.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qplatformintegration_directfb.h" -#include "qwindowsurface_directfb.h" -#include "qblitter_directfb.h" -#include "qdirectfbconvenience.h" -#include "qdirectfbcursor.h" -#include "qdirectfbwindow.h" - -#include -#include - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -QDirectFbScreen::QDirectFbScreen(int display) - :QPlatformScreen() -{ - m_layer = QDirectFbConvenience::dfbDisplayLayer(display); - m_layer->SetCooperativeLevel(m_layer,DLSCL_SHARED); - - DFBDisplayLayerConfig config; - m_layer->GetConfiguration(m_layer, &config); - - m_format = QDirectFbConvenience::imageFormatFromSurfaceFormat(config.pixelformat, config.surface_caps); - m_geometry = QRect(0,0,config.width,config.height); - const int dpi = 72; - const qreal inch = 25.4; - m_depth = 32; - m_physicalSize = QSize(qRound(config.width * inch / dpi), qRound(config.height *inch / dpi)); - - cursor = new QDirectFBCursor(this); -} - -QDirectFbScreen::~QDirectFbScreen() -{ -} - -QDirectFbIntegration::QDirectFbIntegration() -{ - const QStringList args = QCoreApplication::arguments(); - int argc = args.size(); - char **argv = new char*[argc]; - - for (int i = 0; i < argc; ++i) - argv[i] = qstrdup(args.at(i).toLocal8Bit().constData()); - - DFBResult result = DirectFBInit(&argc, &argv); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreen: error initializing DirectFB", - result); - } - delete[] argv; - - QDirectFbScreen *primaryScreen = new QDirectFbScreen(0); - mScreens.append(primaryScreen); -} - -QPixmapData *QDirectFbIntegration::createPixmapData(QPixmapData::PixelType type) const -{ - if (type == QPixmapData::BitmapType) - return new QRasterPixmapData(type); - else - return new QBlittablePixmapData(type); -} - -QPlatformWindow *QDirectFbIntegration::createPlatformWindow(QWidget *widget, WId winId) const -{ - Q_UNUSED(winId); - return new QDirectFbWindow(widget); -} - -QWindowSurface *QDirectFbIntegration::createWindowSurfaceForWindow(QWidget *widget, WId winId) const -{ - return new QDirectFbWindowSurface(widget,winId); -} - -QBlittable *QDirectFbIntegration::createBlittable(const QSize &size) const -{ - return new QDirectFbBlitter(size); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qplatformintegration_directfb.h b/src/plugins/platforms/directfb/qplatformintegration_directfb.h deleted file mode 100644 index a8489c0..0000000 --- a/src/plugins/platforms/directfb/qplatformintegration_directfb.h +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPLATFORMINTEGRATION_DIRECTFB_H -#define QPLATFORMINTEGRATION_DIRECTFB_H - -#include "qdirectfbinput.h" - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QDirectFBCursor; - -class QDirectFbScreen : public QPlatformScreen -{ -public: - QDirectFbScreen(int display); - ~QDirectFbScreen(); - - QRect geometry() const { return m_geometry; } - int depth() const { return m_depth; } - QImage::Format format() const { return m_format; } - QSize physicalSize() const { return m_physicalSize; } - -public: - QRect m_geometry; - int m_depth; - QImage::Format m_format; - QSize m_physicalSize; - - IDirectFBDisplayLayer *m_layer; - -private: - QDirectFBCursor * cursor; - -}; - -class QDirectFbIntegration : public QPlatformIntegration -{ -public: - QDirectFbIntegration(); - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; - QWindowSurface *createWindowSurfaceForWindow(QWidget *widget, WId winId) const; - QBlittable *createBlittable(const QSize &size) const; - - QList screens() const { return mScreens; } - - - -private: - QList mScreens; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/directfb/qwindowsurface_directfb.cpp b/src/plugins/platforms/directfb/qwindowsurface_directfb.cpp deleted file mode 100644 index e978cae..0000000 --- a/src/plugins/platforms/directfb/qwindowsurface_directfb.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwindowsurface_directfb.h" -#include "qplatformintegration_directfb.h" -#include "qblitter_directfb.h" -#include "qdirectfbconvenience.h" -#include - -#include - -QT_BEGIN_NAMESPACE - -QDirectFbWindowSurface::QDirectFbWindowSurface(QWidget *window, WId wId) - : QWindowSurface(window), m_pixmap(0), m_pmdata(0), m_dfbSurface(0) -{ - - IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); - - DFBWindowID id(wId); - IDirectFBWindow *dfbWindow; - - layer->GetWindow(layer,id,&dfbWindow); - - dfbWindow->GetSurface(dfbWindow,&m_dfbSurface); -//WRONGSIZE - QDirectFbBlitter *blitter = new QDirectFbBlitter(window->rect().size(), m_dfbSurface); - m_pmdata = new QBlittablePixmapData(QPixmapData::PixmapType); - m_pmdata->setBlittable(blitter); - m_pixmap = new QPixmap(m_pmdata); -} - -QDirectFbWindowSurface::~QDirectFbWindowSurface() -{ - -} - -QPaintDevice *QDirectFbWindowSurface::paintDevice() -{ - return m_pixmap; -} - -void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) -{ - Q_UNUSED(widget); - m_pmdata->blittable()->unlock(); - - QVector rects = region.rects(); - for (int i = 0 ; i < rects.size(); i++) { - const QRect rect = rects.at(i); - DFBRegion dfbReg = { rect.x() + offset.x(),rect.y() + offset.y(),rect.right() + offset.x(),rect.bottom() + offset.y()}; - m_dfbSurface->Flip(m_dfbSurface, &dfbReg, DFBSurfaceFlipFlags(DSFLIP_BLIT|DSFLIP_ONSYNC)); - } -} - -void QDirectFbWindowSurface::resize(const QSize &size) -{ - QWindowSurface::resize(size); - - //Have to add 1 ref ass it will be removed by deleting the old blitter in setBlittable - m_dfbSurface->AddRef(m_dfbSurface); - QDirectFbBlitter *blitter = new QDirectFbBlitter(size,m_dfbSurface); - m_pmdata->setBlittable(blitter); -} - -static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int dx, int dy) -{ - const DFBRectangle rect = { r.x(), r.y(), r.width(), r.height() }; - surface->Blit(surface, surface, &rect, r.x() + dx, r.y() + dy); - const DFBRegion region = { rect.x + dx, rect.y + dy, r.right() + dx, r.bottom() + dy }; - surface->Flip(surface, ®ion, DFBSurfaceFlipFlags(DSFLIP_BLIT)); -} - -bool QDirectFbWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - m_pmdata->blittable()->unlock(); - - if (!m_dfbSurface || area.isEmpty()) - return false; - m_dfbSurface->SetBlittingFlags(m_dfbSurface, DSBLIT_NOFX); - if (area.rectCount() == 1) { - scrollSurface(m_dfbSurface, area.boundingRect(), dx, dy); - } else { - const QVector rects = area.rects(); - const int n = rects.size(); - for (int i=0; i -#include - -#include - -QT_BEGIN_NAMESPACE - -class QDirectFbWindowSurface : public QWindowSurface -{ -public: - QDirectFbWindowSurface(QWidget *window, WId wid); - ~QDirectFbWindowSurface(); - - QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void resize (const QSize &size); - bool scroll(const QRegion &area, int dx, int dy); - - void beginPaint(const QRegion ®ion); - void endPaint(const QRegion ®ion); - -private: - void lockSurfaceToImage(); - - QPixmap *m_pixmap; - QBlittablePixmapData *m_pmdata; - - IDirectFBSurface *m_dfbSurface; -}; - -QT_END_NAMESPACE - -#endif -- cgit v0.12 From a43355f7d10a72f60719f7e5a617bcd0031f8fba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 19 Apr 2010 12:54:09 +0200 Subject: QPlatformScreen now has default implementation for physicalSize assuming dpi = 100. This also simplifies minimal slightly. Also use propper apis in qfont for default dpi by using QPlatformScreen --- src/gui/kernel/qplatformscreen_lite.cpp | 8 ++++++++ src/gui/kernel/qplatformscreen_lite.h | 2 +- src/gui/text/qfont.cpp | 14 ++++++++++++-- .../platforms/minimal/qplatformintegration_minimal.cpp | 1 - .../platforms/minimal/qplatformintegration_minimal.h | 1 - 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/gui/kernel/qplatformscreen_lite.cpp b/src/gui/kernel/qplatformscreen_lite.cpp index 4492463..4c0a02b 100644 --- a/src/gui/kernel/qplatformscreen_lite.cpp +++ b/src/gui/kernel/qplatformscreen_lite.cpp @@ -56,3 +56,11 @@ QWidget *QPlatformScreen::topLevelAt(const QPoint & pos) const return 0; } +QSize QPlatformScreen::physicalSize() const +{ + static const int dpi = 100; + int width = geometry().width() / dpi * qreal(25.4) ; + int height = geometry().height() / dpi * qreal(25.4) ; + return QSize(width,height); +} + diff --git a/src/gui/kernel/qplatformscreen_lite.h b/src/gui/kernel/qplatformscreen_lite.h index cae5f42..7d0e28d 100644 --- a/src/gui/kernel/qplatformscreen_lite.h +++ b/src/gui/kernel/qplatformscreen_lite.h @@ -62,7 +62,7 @@ public: virtual QRect availableGeometry() const {return geometry();}; virtual int depth() const = 0; virtual QImage::Format format() const = 0; - virtual QSize physicalSize() const = 0; + virtual QSize physicalSize() const; virtual void setDirty(const QRect &) {} virtual QWidget *topLevelAt(const QPoint &point) const; }; diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 01e4ef6..81d431c 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -75,6 +75,10 @@ #ifdef Q_OS_SYMBIAN #include "qt_s60_p.h" #endif +#ifdef Q_WS_LITE +#include +#include +#endif #include @@ -173,7 +177,10 @@ Q_GUI_EXPORT int qt_defaultDpiX() screen = subScreens.at(0); dpi = qRound(screen->width() / (screen->physicalWidth() / qreal(25.4))); #elif defined(Q_WS_LITE) - dpi = 72; + QPlatformScreen *screen = QApplicationPrivate::platformIntegration()->screens().at(0); + const QSize screenSize = screen->geometry().size(); + const QSize physicalSize = screen->physicalSize(); + dpi = qRound(screenSize.width() / (physicalSize.width() / qreal(25.4))); #elif defined(Q_OS_SYMBIAN) dpi = S60->defaultDpiX; #endif // Q_WS_X11 @@ -203,7 +210,10 @@ Q_GUI_EXPORT int qt_defaultDpiY() screen = subScreens.at(0); dpi = qRound(screen->height() / (screen->physicalHeight() / qreal(25.4))); #elif defined(Q_WS_LITE) - dpi = 72; + QPlatformScreen *screen = QApplicationPrivate::platformIntegration()->screens().at(0); + const QSize screenSize = screen->geometry().size(); + const QSize physicalSize = screen->physicalSize(); + dpi = qRound(screenSize.height() / (physicalSize.height() / qreal(25.4))); #elif defined(Q_OS_SYMBIAN) dpi = S60->defaultDpiY; #endif // Q_WS_X11 diff --git a/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp b/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp index 404ffbc..94aa4f3 100644 --- a/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp +++ b/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp @@ -11,7 +11,6 @@ QMinimalIntegration::QMinimalIntegration() mPrimaryScreen->mGeometry = QRect(0, 0, 240, 320); mPrimaryScreen->mDepth = 16; mPrimaryScreen->mFormat = QImage::Format_RGB16; - mPrimaryScreen->mPhysicalSize = QSize(40, 54); mScreens.append(mPrimaryScreen); } diff --git a/src/plugins/platforms/minimal/qplatformintegration_minimal.h b/src/plugins/platforms/minimal/qplatformintegration_minimal.h index 2e8a8cf..fefe6c3 100644 --- a/src/plugins/platforms/minimal/qplatformintegration_minimal.h +++ b/src/plugins/platforms/minimal/qplatformintegration_minimal.h @@ -57,7 +57,6 @@ public: QRect geometry() const { return mGeometry; } int depth() const { return mDepth; } QImage::Format format() const { return mFormat; } - QSize physicalSize() const { return mPhysicalSize; } public: QRect mGeometry; -- cgit v0.12 From 66e4d48129d6baa405ed9a4a22b12913227a8c45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 21 Apr 2010 08:28:30 +0200 Subject: Renamed createWindowSurfaceForWindow to createWindowSurface. Gave also a default dpi when there is no platform integration, ie. it has not been initialised yet or is being initialised. --- src/gui/kernel/qplatformintegration_lite.h | 2 +- src/gui/kernel/qwidget_lite.cpp | 2 +- src/gui/painting/qgraphicssystem_lite.cpp | 2 +- src/gui/text/qfont.cpp | 28 +++++++++++++++------- .../platforms/directfb/qdirectfbintegration.cpp | 2 +- .../platforms/directfb/qdirectfbintegration.h | 2 +- .../platforms/linuxfb/qgraphicssystem_linuxfb.cpp | 4 +--- .../platforms/linuxfb/qgraphicssystem_linuxfb.h | 2 +- .../minimal/qplatformintegration_minimal.cpp | 2 +- .../minimal/qplatformintegration_minimal.h | 2 +- src/plugins/platforms/qvfb/qvfbintegration.cpp | 6 ++--- src/plugins/platforms/qvfb/qvfbintegration.h | 2 +- .../testlite/qplatformintegration_testlite.cpp | 4 +--- .../testlite/qplatformintegration_testlite.h | 2 +- src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp | 4 +--- src/plugins/platforms/vnc/qgraphicssystem_vnc.h | 2 +- 16 files changed, 36 insertions(+), 32 deletions(-) diff --git a/src/gui/kernel/qplatformintegration_lite.h b/src/gui/kernel/qplatformintegration_lite.h index b13260e..ee6f833 100644 --- a/src/gui/kernel/qplatformintegration_lite.h +++ b/src/gui/kernel/qplatformintegration_lite.h @@ -63,7 +63,7 @@ public: // GraphicsSystem functions virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0; virtual QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const = 0; - virtual QWindowSurface *createWindowSurfaceForWindow(QWidget *widget, WId winId) const = 0; + virtual QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const = 0; virtual QBlittable *createBlittable(const QSize &size) const; // Window System functions diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index 465dbee..ee1a582 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -77,7 +77,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO Q_ASSERT(platformWindow); if (!surface) { - surface = QApplicationPrivate::platformIntegration()->createWindowSurfaceForWindow(q,platformWindow->winId()); + surface = QApplicationPrivate::platformIntegration()->createWindowSurface(q,platformWindow->winId()); } Q_ASSERT(surface); diff --git a/src/gui/painting/qgraphicssystem_lite.cpp b/src/gui/painting/qgraphicssystem_lite.cpp index 68d880b..1d24129 100644 --- a/src/gui/painting/qgraphicssystem_lite.cpp +++ b/src/gui/painting/qgraphicssystem_lite.cpp @@ -51,7 +51,7 @@ QPixmapData *QLiteGraphicsSystem::createPixmapData(QPixmapData::PixelType type) QWindowSurface *QLiteGraphicsSystem::createWindowSurface(QWidget *widget) const { - return QApplicationPrivate::platformIntegration()->createWindowSurfaceForWindow(widget, widget->winId()); + return QApplicationPrivate::platformIntegration()->createWindowSurface(widget, widget->winId()); } QBlittable *QLiteGraphicsSystem::createBlittable(const QSize &size) const diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 81d431c..2c2ceb1 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -177,10 +177,16 @@ Q_GUI_EXPORT int qt_defaultDpiX() screen = subScreens.at(0); dpi = qRound(screen->width() / (screen->physicalWidth() / qreal(25.4))); #elif defined(Q_WS_LITE) - QPlatformScreen *screen = QApplicationPrivate::platformIntegration()->screens().at(0); - const QSize screenSize = screen->geometry().size(); - const QSize physicalSize = screen->physicalSize(); - dpi = qRound(screenSize.width() / (physicalSize.width() / qreal(25.4))); + QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); + if (pi) { + QPlatformScreen *screen = QApplicationPrivate::platformIntegration()->screens().at(0); + const QSize screenSize = screen->geometry().size(); + const QSize physicalSize = screen->physicalSize(); + dpi = qRound(screenSize.width() / (physicalSize.width() / qreal(25.4))); + } else { + //PI has not been initialised, or it is being initialised. Give a default dpi + dpi = 100; + } #elif defined(Q_OS_SYMBIAN) dpi = S60->defaultDpiX; #endif // Q_WS_X11 @@ -210,10 +216,16 @@ Q_GUI_EXPORT int qt_defaultDpiY() screen = subScreens.at(0); dpi = qRound(screen->height() / (screen->physicalHeight() / qreal(25.4))); #elif defined(Q_WS_LITE) - QPlatformScreen *screen = QApplicationPrivate::platformIntegration()->screens().at(0); - const QSize screenSize = screen->geometry().size(); - const QSize physicalSize = screen->physicalSize(); - dpi = qRound(screenSize.height() / (physicalSize.height() / qreal(25.4))); + QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); + if (pi) { + QPlatformScreen *screen = QApplicationPrivate::platformIntegration()->screens().at(0); + const QSize screenSize = screen->geometry().size(); + const QSize physicalSize = screen->physicalSize(); + dpi = qRound(screenSize.height() / (physicalSize.height() / qreal(25.4))); + } else { + //PI has not been initialised, or it is being initialised. Give a default dpi + dpi = 100; + } #elif defined(Q_OS_SYMBIAN) dpi = S60->defaultDpiY; #endif // Q_WS_X11 diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.cpp b/src/plugins/platforms/directfb/qdirectfbintegration.cpp index b096081..60fce7e 100644 --- a/src/plugins/platforms/directfb/qdirectfbintegration.cpp +++ b/src/plugins/platforms/directfb/qdirectfbintegration.cpp @@ -112,7 +112,7 @@ QPlatformWindow *QDirectFbIntegration::createPlatformWindow(QWidget *widget, WId return new QDirectFbWindow(widget); } -QWindowSurface *QDirectFbIntegration::createWindowSurfaceForWindow(QWidget *widget, WId winId) const +QWindowSurface *QDirectFbIntegration::createWindowSurface(QWidget *widget, WId winId) const { return new QDirectFbWindowSurface(widget,winId); } diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.h b/src/plugins/platforms/directfb/qdirectfbintegration.h index 808bc9d..c0e770f 100644 --- a/src/plugins/platforms/directfb/qdirectfbintegration.h +++ b/src/plugins/platforms/directfb/qdirectfbintegration.h @@ -84,7 +84,7 @@ public: QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; - QWindowSurface *createWindowSurfaceForWindow(QWidget *widget, WId winId) const; + QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; QBlittable *createBlittable(const QSize &size) const; QList screens() const { return mScreens; } diff --git a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp index 25cdc7b..acc254a 100644 --- a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp +++ b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp @@ -786,10 +786,8 @@ QPixmapData *QLinuxFbIntegration::createPixmapData(QPixmapData::PixelType type) return new QRasterPixmapData(type); } -QWindowSurface *QLinuxFbIntegration::createWindowSurfaceForWindow(QWidget *widget, WId) const +QWindowSurface *QLinuxFbIntegration::createWindowSurface(QWidget *widget, WId) const { - if (widget->windowType() == Qt::Desktop) - return 0; // Don't create an explicit window surface for the destkop. QFbWindowSurface * surface = new QFbWindowSurface(mPrimaryScreen, widget); return surface; diff --git a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h index 7d4c031..dc61df5 100644 --- a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h +++ b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h @@ -78,7 +78,7 @@ public: QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId WinId) const; - QWindowSurface *createWindowSurfaceForWindow(QWidget *widget, WId WinId) const; + QWindowSurface *createWindowSurface(QWidget *widget, WId WinId) const; QList screens() const { return mScreens; } diff --git a/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp b/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp index 94aa4f3..73e025c 100644 --- a/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp +++ b/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp @@ -26,7 +26,7 @@ QPlatformWindow *QMinimalIntegration::createPlatformWindow(QWidget *widget, WId return new QPlatformWindow(widget); } -QWindowSurface *QMinimalIntegration::createWindowSurfaceForWindow(QWidget *widget, WId winId) const +QWindowSurface *QMinimalIntegration::createWindowSurface(QWidget *widget, WId winId) const { Q_UNUSED(winId); return new QMinimalWindowSurface(widget); diff --git a/src/plugins/platforms/minimal/qplatformintegration_minimal.h b/src/plugins/platforms/minimal/qplatformintegration_minimal.h index fefe6c3..a2f7449 100644 --- a/src/plugins/platforms/minimal/qplatformintegration_minimal.h +++ b/src/plugins/platforms/minimal/qplatformintegration_minimal.h @@ -72,7 +72,7 @@ public: QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; - QWindowSurface *createWindowSurfaceForWindow(QWidget *widget, WId winId) const; + QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; QList screens() const { return mScreens; } diff --git a/src/plugins/platforms/qvfb/qvfbintegration.cpp b/src/plugins/platforms/qvfb/qvfbintegration.cpp index 2a877e0..e22c724 100644 --- a/src/plugins/platforms/qvfb/qvfbintegration.cpp +++ b/src/plugins/platforms/qvfb/qvfbintegration.cpp @@ -421,10 +421,8 @@ QPixmapData *QVFbIntegration::createPixmapData(QPixmapData::PixelType type) cons return new QRasterPixmapData(type); } -QWindowSurface *QVFbIntegration::createWindowSurfaceForWindow(QWidget *widget, WId) const +QWindowSurface *QVFbIntegration::createWindowSurface(QWidget *widget, WId) const { - if (widget->windowType() == Qt::Desktop) - return 0; // Don't create an explicit window surface for the destkop. return new QVFbWindowSurface(mPrimaryScreen, widget); } @@ -436,4 +434,4 @@ QPlatformWindow *QVFbIntegration::createPlatformWindow(QWidget *widget, WId) con QT_END_NAMESPACE -#include "qgraphicssystem_qvfb.moc" +#include "qvfbintegration.moc" diff --git a/src/plugins/platforms/qvfb/qvfbintegration.h b/src/plugins/platforms/qvfb/qvfbintegration.h index 1207678..ab44d46 100644 --- a/src/plugins/platforms/qvfb/qvfbintegration.h +++ b/src/plugins/platforms/qvfb/qvfbintegration.h @@ -80,7 +80,7 @@ public: QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; - QWindowSurface *createWindowSurfaceForWindow(QWidget *widget, WId winId) const; + QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; QList screens() const { return mScreens; } diff --git a/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp b/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp index f13951d..f657617 100644 --- a/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp +++ b/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp @@ -103,10 +103,8 @@ QPixmapData *QTestLiteIntegration::createPixmapData(QPixmapData::PixelType type) return new QRasterPixmapData(type); } -QWindowSurface *QTestLiteIntegration::createWindowSurfaceForWindow(QWidget *widget, WId) const +QWindowSurface *QTestLiteIntegration::createWindowSurface(QWidget *widget, WId) const { - if (widget->windowType() == Qt::Desktop) - return 0; // Don't create an explicit window surface for the destkop. return new QTestLiteWindowSurface(mPrimaryScreen, widget); } diff --git a/src/plugins/platforms/testlite/qplatformintegration_testlite.h b/src/plugins/platforms/testlite/qplatformintegration_testlite.h index bd27d89..729e74f 100644 --- a/src/plugins/platforms/testlite/qplatformintegration_testlite.h +++ b/src/plugins/platforms/testlite/qplatformintegration_testlite.h @@ -75,7 +75,7 @@ public: QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; - QWindowSurface *createWindowSurfaceForWindow(QWidget *widget, WId winId) const; + QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; QPixmap grabWindow(WId window, int x, int y, int width, int height) const; diff --git a/src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp b/src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp index cbc8bbd..a872991 100644 --- a/src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp +++ b/src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp @@ -114,10 +114,8 @@ QPixmapData *QVNCIntegration::createPixmapData(QPixmapData::PixelType type) cons // return surface; // } -QWindowSurface *QVNCIntegration::createWindowSurfaceForWindow(QWidget *widget, WId) const +QWindowSurface *QVNCIntegration::createWindowSurface(QWidget *widget, WId) const { - if (widget->windowType() == Qt::Desktop) - return 0; // Don't create an explicit window surface for the destkop. QFbWindowSurface * surface; surface = new QFbWindowSurface(mPrimaryScreen, widget); return surface; diff --git a/src/plugins/platforms/vnc/qgraphicssystem_vnc.h b/src/plugins/platforms/vnc/qgraphicssystem_vnc.h index 887ccc3..524b888 100644 --- a/src/plugins/platforms/vnc/qgraphicssystem_vnc.h +++ b/src/plugins/platforms/vnc/qgraphicssystem_vnc.h @@ -80,7 +80,7 @@ public: QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; - QWindowSurface *createWindowSurfaceForWindow(QWidget *widget, WId winId) const; + QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; QList screens() const { return mScreens; } -- cgit v0.12 From bf9b927dd7143ef02591308b1cecc0c44417deb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 21 Apr 2010 15:45:53 +0200 Subject: Rename files in platform plugins follow same pattern --- src/plugins/platforms/linuxfb/linuxfb.pro | 4 +- src/plugins/platforms/linuxfb/main.cpp | 2 +- .../platforms/linuxfb/qgraphicssystem_linuxfb.cpp | 859 --------------------- .../platforms/linuxfb/qgraphicssystem_linuxfb.h | 129 ---- .../platforms/linuxfb/qlinuxfbintegration.cpp | 859 +++++++++++++++++++++ .../platforms/linuxfb/qlinuxfbintegration.h | 129 ++++ src/plugins/platforms/minimal/main.cpp | 2 +- src/plugins/platforms/minimal/minimal.pro | 8 +- .../platforms/minimal/qminimalintegration.cpp | 33 + .../platforms/minimal/qminimalintegration.h | 85 ++ .../platforms/minimal/qminimalwindowsurface.cpp | 85 ++ .../platforms/minimal/qminimalwindowsurface.h | 67 ++ .../minimal/qplatformintegration_minimal.cpp | 33 - .../minimal/qplatformintegration_minimal.h | 85 -- .../platforms/minimal/qwindowsurface_minimal.cpp | 85 -- .../platforms/minimal/qwindowsurface_minimal.h | 67 -- src/plugins/platforms/qvfb/qvfb.pro | 4 +- src/plugins/platforms/qvfb/qvfbintegration.cpp | 2 +- src/plugins/platforms/qvfb/qvfbwindowsurface.cpp | 108 +++ src/plugins/platforms/qvfb/qvfbwindowsurface.h | 80 ++ src/plugins/platforms/qvfb/qwindowsurface_qvfb.cpp | 108 --- src/plugins/platforms/qvfb/qwindowsurface_qvfb.h | 80 -- src/plugins/platforms/testlite/main.cpp | 2 +- .../testlite/qplatformintegration_testlite.cpp | 143 ---- .../testlite/qplatformintegration_testlite.h | 98 --- .../platforms/testlite/qtestliteintegration.cpp | 143 ++++ .../platforms/testlite/qtestliteintegration.h | 98 +++ src/plugins/platforms/testlite/qtestlitewindow.cpp | 4 +- .../platforms/testlite/qtestlitewindowsurface.cpp | 273 +++++++ .../platforms/testlite/qtestlitewindowsurface.h | 88 +++ .../platforms/testlite/qwindowsurface_testlite.cpp | 273 ------- .../platforms/testlite/qwindowsurface_testlite.h | 88 --- src/plugins/platforms/testlite/testlite.pro | 4 +- src/plugins/platforms/vnc/main.cpp | 2 +- src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp | 131 ---- src/plugins/platforms/vnc/qgraphicssystem_vnc.h | 98 --- src/plugins/platforms/vnc/qvnccursor.cpp | 2 +- src/plugins/platforms/vnc/qvncintegration.cpp | 131 ++++ src/plugins/platforms/vnc/qvncintegration.h | 98 +++ src/plugins/platforms/vnc/qvncserver.h | 2 +- src/plugins/platforms/vnc/vnc.pro | 4 +- 41 files changed, 2298 insertions(+), 2298 deletions(-) delete mode 100644 src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp delete mode 100644 src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h create mode 100644 src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp create mode 100644 src/plugins/platforms/linuxfb/qlinuxfbintegration.h create mode 100644 src/plugins/platforms/minimal/qminimalintegration.cpp create mode 100644 src/plugins/platforms/minimal/qminimalintegration.h create mode 100644 src/plugins/platforms/minimal/qminimalwindowsurface.cpp create mode 100644 src/plugins/platforms/minimal/qminimalwindowsurface.h delete mode 100644 src/plugins/platforms/minimal/qplatformintegration_minimal.cpp delete mode 100644 src/plugins/platforms/minimal/qplatformintegration_minimal.h delete mode 100644 src/plugins/platforms/minimal/qwindowsurface_minimal.cpp delete mode 100644 src/plugins/platforms/minimal/qwindowsurface_minimal.h create mode 100644 src/plugins/platforms/qvfb/qvfbwindowsurface.cpp create mode 100644 src/plugins/platforms/qvfb/qvfbwindowsurface.h delete mode 100644 src/plugins/platforms/qvfb/qwindowsurface_qvfb.cpp delete mode 100644 src/plugins/platforms/qvfb/qwindowsurface_qvfb.h delete mode 100644 src/plugins/platforms/testlite/qplatformintegration_testlite.cpp delete mode 100644 src/plugins/platforms/testlite/qplatformintegration_testlite.h create mode 100644 src/plugins/platforms/testlite/qtestliteintegration.cpp create mode 100644 src/plugins/platforms/testlite/qtestliteintegration.h create mode 100644 src/plugins/platforms/testlite/qtestlitewindowsurface.cpp create mode 100644 src/plugins/platforms/testlite/qtestlitewindowsurface.h delete mode 100644 src/plugins/platforms/testlite/qwindowsurface_testlite.cpp delete mode 100644 src/plugins/platforms/testlite/qwindowsurface_testlite.h delete mode 100644 src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp delete mode 100644 src/plugins/platforms/vnc/qgraphicssystem_vnc.h create mode 100644 src/plugins/platforms/vnc/qvncintegration.cpp create mode 100644 src/plugins/platforms/vnc/qvncintegration.h diff --git a/src/plugins/platforms/linuxfb/linuxfb.pro b/src/plugins/platforms/linuxfb/linuxfb.pro index 2633a10..8d4b6d7 100644 --- a/src/plugins/platforms/linuxfb/linuxfb.pro +++ b/src/plugins/platforms/linuxfb/linuxfb.pro @@ -3,8 +3,8 @@ include(../../qpluginbase.pri) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms -SOURCES = main.cpp qgraphicssystem_linuxfb.cpp -HEADERS = qgraphicssystem_linuxfb.h +SOURCES = main.cpp qlinuxfbintegration.cpp +HEADERS = qlinuxfbintegration.h include(../fb_base/fb_base.pri) diff --git a/src/plugins/platforms/linuxfb/main.cpp b/src/plugins/platforms/linuxfb/main.cpp index 1ee24b6..65569ac 100644 --- a/src/plugins/platforms/linuxfb/main.cpp +++ b/src/plugins/platforms/linuxfb/main.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include -#include "qgraphicssystem_linuxfb.h" +#include "qlinuxfbintegration.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp deleted file mode 100644 index 321e90f..0000000 --- a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp +++ /dev/null @@ -1,859 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgraphicssystem_linuxfb.h" -#include "../fb_base/fb_base.h" -#include -#include // overrides QT_OPEN -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if !defined(Q_OS_DARWIN) && !defined(Q_OS_FREEBSD) -#include - -#ifdef __i386__ -#include -#endif -#endif - -QT_BEGIN_NAMESPACE - -class QLinuxFbIntegrationPrivate -{ -public: - QLinuxFbIntegrationPrivate(); - ~QLinuxFbIntegrationPrivate(); - - void openTty(); - void closeTty(); - - int fd; - int startupw; - int startuph; - int startupd; - bool blank; - - bool doGraphicsMode; -#ifdef QT_QWS_DEPTH_GENERIC - bool doGenericColors; -#endif - int ttyfd; - long oldKdMode; - QString ttyDevice; - QString displaySpec; -}; - -QLinuxFbIntegrationPrivate::QLinuxFbIntegrationPrivate() - : fd(-1), blank(true), doGraphicsMode(true), -#ifdef QT_QWS_DEPTH_GENERIC - doGenericColors(false), -#endif - ttyfd(-1), oldKdMode(KD_TEXT) -{ -} - -QLinuxFbIntegrationPrivate::~QLinuxFbIntegrationPrivate() -{ - closeTty(); -} - -void QLinuxFbIntegrationPrivate::openTty() -{ - const char *const devs[] = {"/dev/tty0", "/dev/tty", "/dev/console", 0}; - - if (ttyDevice.isEmpty()) { - for (const char * const *dev = devs; *dev; ++dev) { - ttyfd = QT_OPEN(*dev, O_RDWR); - if (ttyfd != -1) - break; - } - } else { - ttyfd = QT_OPEN(ttyDevice.toAscii().constData(), O_RDWR); - } - - if (ttyfd == -1) - return; - - if (doGraphicsMode) { - ioctl(ttyfd, KDGETMODE, &oldKdMode); - if (oldKdMode != KD_GRAPHICS) { - int ret = ioctl(ttyfd, KDSETMODE, KD_GRAPHICS); - if (ret == -1) - doGraphicsMode = false; - } - } - - // No blankin' screen, no blinkin' cursor!, no cursor! - const char termctl[] = "\033[9;0]\033[?33l\033[?25l\033[?1c"; - QT_WRITE(ttyfd, termctl, sizeof(termctl)); -} - -void QLinuxFbIntegrationPrivate::closeTty() -{ - if (ttyfd == -1) - return; - - if (doGraphicsMode) - ioctl(ttyfd, KDSETMODE, oldKdMode); - - // Blankin' screen, blinkin' cursor! - const char termctl[] = "\033[9;15]\033[?33h\033[?25h\033[?0c"; - QT_WRITE(ttyfd, termctl, sizeof(termctl)); - - QT_CLOSE(ttyfd); - ttyfd = -1; -} - -QLinuxFbIntegration::QLinuxFbIntegration() -{ - d_ptr = new QLinuxFbIntegrationPrivate(); - - // XXX - QString displaySpec = QString::fromLatin1(qgetenv("QWS_DISPLAY")); - - if (!connect(displaySpec)) - qFatal("QLinuxFbIntegration: could not initialize screen"); - initDevice(); - - // Create a QImage directly on the screen's framebuffer. - // This is the blit target for copying windows to the screen. - mPrimaryScreen = new QLinuxFbScreen(data, w, h, lstep, - screenFormat); - mPrimaryScreen->setPhysicalSize(QSize(physWidth, physHeight)); - mScreens.append(mPrimaryScreen); -} - -QLinuxFbIntegration::~QLinuxFbIntegration() -{ - delete mPrimaryScreen; - delete d_ptr; -} - -bool QLinuxFbIntegration::connect(const QString &displaySpec) -{ - const QStringList args = displaySpec.split(QLatin1Char(':')); - - if (args.contains(QLatin1String("nographicsmodeswitch"))) - d_ptr->doGraphicsMode = false; - -#ifdef QT_QWS_DEPTH_GENERIC - if (args.contains(QLatin1String("genericcolors"))) - d_ptr->doGenericColors = true; -#endif - - QRegExp ttyRegExp(QLatin1String("tty=(.*)")); - if (args.indexOf(ttyRegExp) != -1) - d_ptr->ttyDevice = ttyRegExp.cap(1); - -#if 0 -#if Q_BYTE_ORDER == Q_BIG_ENDIAN -#ifndef QT_QWS_FRAMEBUFFER_LITTLE_ENDIAN - if (args.contains(QLatin1String("littleendian"))) -#endif - QScreen::setFrameBufferLittleEndian(true); -#endif -#endif - - // Check for explicitly specified device - const int len = 8; // "/dev/fbx" - int m = displaySpec.indexOf(QLatin1String("/dev/fb")); - - QString dev; - if (m > 0) - dev = displaySpec.mid(m, len); - else - dev = QLatin1String("/dev/fb0"); - - if (access(dev.toLatin1().constData(), R_OK|W_OK) == 0) - d_ptr->fd = QT_OPEN(dev.toLatin1().constData(), O_RDWR); - if (d_ptr->fd == -1) { - if (access(dev.toLatin1().constData(), R_OK) == 0) - d_ptr->fd = QT_OPEN(dev.toLatin1().constData(), O_RDONLY); - if (d_ptr->fd == 1) { - qWarning("Error opening framebuffer device %s", qPrintable(dev)); - return false; - } - } - - fb_fix_screeninfo finfo; - fb_var_screeninfo vinfo; - //####################### - // Shut up Valgrind - memset(&vinfo, 0, sizeof(vinfo)); - memset(&finfo, 0, sizeof(finfo)); - //####################### - - /* Get fixed screen information */ - if (d_ptr->fd != -1 && ioctl(d_ptr->fd, FBIOGET_FSCREENINFO, &finfo)) { - perror("QLinuxFbIntegration::connect"); - qWarning("Error reading fixed information"); - return false; - } - - if (finfo.type == FB_TYPE_VGA_PLANES) { - qWarning("VGA16 video mode not supported"); - return false; - } - - /* Get variable screen information */ - if (d_ptr->fd != -1 && ioctl(d_ptr->fd, FBIOGET_VSCREENINFO, &vinfo)) { - perror("QLinuxFbIntegration::connect"); - qWarning("Error reading variable information"); - return false; - } - - grayscale = vinfo.grayscale; - d = vinfo.bits_per_pixel; - if (d == 24) { - d = vinfo.red.length + vinfo.green.length + vinfo.blue.length; - if (d <= 0) - d = 24; // reset if color component lengths are not reported - } else if (d == 16) { - d = vinfo.red.length + vinfo.green.length + vinfo.blue.length; - if (d <= 0) - d = 16; - } - lstep = finfo.line_length; - - int xoff = vinfo.xoffset; - int yoff = vinfo.yoffset; - const char* qwssize; - if((qwssize=::getenv("QWS_SIZE")) && sscanf(qwssize,"%dx%d",&w,&h)==2) { - if (d_ptr->fd != -1) { - if ((uint)w > vinfo.xres) w = vinfo.xres; - if ((uint)h > vinfo.yres) h = vinfo.yres; - } - dw=w; - dh=h; - int xxoff, yyoff; - if (sscanf(qwssize, "%*dx%*d+%d+%d", &xxoff, &yyoff) == 2) { - if (xxoff < 0 || xxoff + w > (int)(vinfo.xres)) - xxoff = vinfo.xres - w; - if (yyoff < 0 || yyoff + h > (int)(vinfo.yres)) - yyoff = vinfo.yres - h; - xoff += xxoff; - yoff += yyoff; - } else { - xoff += (vinfo.xres - w)/2; - yoff += (vinfo.yres - h)/2; - } - } else { - dw=w=vinfo.xres; - dh=h=vinfo.yres; - } - - if (w == 0 || h == 0) { - qWarning("QLinuxFbIntegration::connect(): Unable to find screen geometry, " - "will use 320x240."); - dw = w = 320; - dh = h = 240; - } - - setPixelFormat(vinfo); - - // Handle display physical size spec. - QStringList displayArgs = displaySpec.split(QLatin1Char(':')); - QRegExp mmWidthRx(QLatin1String("mmWidth=?(\\d+)")); - int dimIdxW = displayArgs.indexOf(mmWidthRx); - QRegExp mmHeightRx(QLatin1String("mmHeight=?(\\d+)")); - int dimIdxH = displayArgs.indexOf(mmHeightRx); - if (dimIdxW >= 0) { - mmWidthRx.exactMatch(displayArgs.at(dimIdxW)); - physWidth = mmWidthRx.cap(1).toInt(); - if (dimIdxH < 0) - physHeight = dh*physWidth/dw; - } - if (dimIdxH >= 0) { - mmHeightRx.exactMatch(displayArgs.at(dimIdxH)); - physHeight = mmHeightRx.cap(1).toInt(); - if (dimIdxW < 0) - physWidth = dw*physHeight/dh; - } - if (dimIdxW < 0 && dimIdxH < 0) { - if (vinfo.width != 0 && vinfo.height != 0 - && vinfo.width != UINT_MAX && vinfo.height != UINT_MAX) { - physWidth = vinfo.width; - physHeight = vinfo.height; - } else { - const int dpi = 72; - physWidth = qRound(dw * 25.4 / dpi); - physHeight = qRound(dh * 25.4 / dpi); - } - } - - dataoffset = yoff * lstep + xoff * d / 8; - //qDebug("Using %dx%dx%d screen",w,h,d); - - /* Figure out the size of the screen in bytes */ - size = h * lstep; - - mapsize = finfo.smem_len; - - data = (unsigned char *)-1; - if (d_ptr->fd != -1) - data = (unsigned char *)mmap(0, mapsize, PROT_READ | PROT_WRITE, - MAP_SHARED, d_ptr->fd, 0); - - if ((long)data == -1) { - perror("QLinuxFbIntegration::connect"); - qWarning("Error: failed to map framebuffer device to memory."); - return false; - } else { - data += dataoffset; - } - -#if 0 - canaccel = useOffscreen(); - if(canaccel) - setupOffScreen(); -#endif - canaccel = false; - - // Now read in palette - if((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4)) { - screencols= (vinfo.bits_per_pixel==8) ? 256 : 16; - int loopc; - fb_cmap startcmap; - startcmap.start=0; - startcmap.len=screencols; - startcmap.red=(unsigned short int *) - malloc(sizeof(unsigned short int)*screencols); - startcmap.green=(unsigned short int *) - malloc(sizeof(unsigned short int)*screencols); - startcmap.blue=(unsigned short int *) - malloc(sizeof(unsigned short int)*screencols); - startcmap.transp=(unsigned short int *) - malloc(sizeof(unsigned short int)*screencols); - if (d_ptr->fd == -1 || ioctl(d_ptr->fd, FBIOGETCMAP, &startcmap)) { - perror("QLinuxFbIntegration::connect"); - qWarning("Error reading palette from framebuffer, using default palette"); - createPalette(startcmap, vinfo, finfo); - } - int bits_used = 0; - for(loopc=0;loopc> 8, - startcmap.green[loopc] >> 8, - startcmap.blue[loopc] >> 8); - bits_used |= startcmap.red[loopc] - | startcmap.green[loopc] - | startcmap.blue[loopc]; - } - // WORKAROUND: Some framebuffer drivers only return 8 bit - // color values, so we need to not bit shift them.. - if ((bits_used & 0x00ff) && !(bits_used & 0xff00)) { - for(loopc=0;loopcopenTty(); - - // Grab current mode so we can reset it - fb_var_screeninfo vinfo; - fb_fix_screeninfo finfo; - //####################### - // Shut up Valgrind - memset(&vinfo, 0, sizeof(vinfo)); - memset(&finfo, 0, sizeof(finfo)); - //####################### - - if (ioctl(d_ptr->fd, FBIOGET_VSCREENINFO, &vinfo)) { - perror("QLinuxFbScreen::initDevice"); - qFatal("Error reading variable information in card init"); - return false; - } - -#ifdef DEBUG_VINFO - qDebug("Greyscale %d",vinfo.grayscale); - qDebug("Nonstd %d",vinfo.nonstd); - qDebug("Red %d %d %d",vinfo.red.offset,vinfo.red.length, - vinfo.red.msb_right); - qDebug("Green %d %d %d",vinfo.green.offset,vinfo.green.length, - vinfo.green.msb_right); - qDebug("Blue %d %d %d",vinfo.blue.offset,vinfo.blue.length, - vinfo.blue.msb_right); - qDebug("Transparent %d %d %d",vinfo.transp.offset,vinfo.transp.length, - vinfo.transp.msb_right); -#endif - - d_ptr->startupw=vinfo.xres; - d_ptr->startuph=vinfo.yres; - d_ptr->startupd=vinfo.bits_per_pixel; - grayscale = vinfo.grayscale; - - if (ioctl(d_ptr->fd, FBIOGET_FSCREENINFO, &finfo)) { - perror("QLinuxFbScreen::initDevice"); - qCritical("Error reading fixed information in card init"); - // It's not an /error/ as such, though definitely a bad sign - // so we return true - return true; - } - -#ifdef __i386__ - // Now init mtrr - if(!::getenv("QWS_NOMTRR")) { - int mfd=QT_OPEN("/proc/mtrr",O_WRONLY,0); - // MTRR entry goes away when file is closed - i.e. - // hopefully when QWS is killed - if(mfd != -1) { - mtrr_sentry sentry; - sentry.base=(unsigned long int)finfo.smem_start; - //qDebug("Physical framebuffer address %p",(void*)finfo.smem_start); - // Size needs to be in 4k chunks, but that's not always - // what we get thanks to graphics card registers. Write combining - // these is Not Good, so we write combine what we can - // (which is not much - 4 megs on an 8 meg card, it seems) - unsigned int size=finfo.smem_len; - size=size >> 22; - size=size << 22; - sentry.size=size; - sentry.type=MTRR_TYPE_WRCOMB; - if(ioctl(mfd,MTRRIOC_ADD_ENTRY,&sentry)==-1) { - //printf("Couldn't add mtrr entry for %lx %lx, %s\n", - //sentry.base,sentry.size,strerror(errno)); - } - } - - // Should we close mfd here? - //QT_CLOSE(mfd); - } -#endif - if ((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4) || (finfo.visual==FB_VISUAL_DIRECTCOLOR)) - { - fb_cmap cmap; - createPalette(cmap, vinfo, finfo); - if (ioctl(d_ptr->fd, FBIOPUTCMAP, &cmap)) { - perror("QLinuxFbScreen::initDevice"); - qWarning("Error writing palette to framebuffer"); - } - free(cmap.red); - free(cmap.green); - free(cmap.blue); - free(cmap.transp); - } - -#if 0 - if (canaccel) { - *entryp=0; - *lowest = mapsize; - insert_entry(*entryp, *lowest, *lowest); // dummy entry to mark start - } - - shared->fifocount = 0; - shared->buffer_offset = 0xffffffff; // 0 would be a sensible offset (screen) - shared->linestep = 0; - shared->cliptop = 0xffffffff; - shared->clipleft = 0xffffffff; - shared->clipright = 0xffffffff; - shared->clipbottom = 0xffffffff; - shared->rop = 0xffffffff; -#endif - -#ifdef QT_QWS_DEPTH_GENERIC - if (pixelFormat() == QImage::Format_Invalid && screencols == 0 - && d_ptr->doGenericColors) - { - qt_set_generic_blit(this, vinfo.bits_per_pixel, - vinfo.red.length, vinfo.green.length, - vinfo.blue.length, vinfo.transp.length, - vinfo.red.offset, vinfo.green.offset, - vinfo.blue.offset, vinfo.transp.offset); - } -#endif - -#if 0 -#ifndef QT_NO_QWS_CURSOR - QScreenCursor::initSoftwareCursor(); -#endif -#endif - blank(false); - - return true; -} - -void QLinuxFbIntegration::setPixelFormat(struct fb_var_screeninfo info) -{ - const fb_bitfield rgba[4] = { info.red, info.green, - info.blue, info.transp }; - - QImage::Format format = QImage::Format_Invalid; - - switch (d) { - case 32: { - const fb_bitfield argb8888[4] = {{16, 8, 0}, {8, 8, 0}, - {0, 8, 0}, {24, 8, 0}}; - const fb_bitfield abgr8888[4] = {{0, 8, 0}, {8, 8, 0}, - {16, 8, 0}, {24, 8, 0}}; - if (memcmp(rgba, argb8888, 4 * sizeof(fb_bitfield)) == 0) { - format = QImage::Format_ARGB32; - } else if (memcmp(rgba, argb8888, 3 * sizeof(fb_bitfield)) == 0) { - format = QImage::Format_RGB32; - } else if (memcmp(rgba, abgr8888, 3 * sizeof(fb_bitfield)) == 0) { - format = QImage::Format_RGB32; - pixeltype = BGRPixel; - } - break; - } - case 24: { - const fb_bitfield rgb888[4] = {{16, 8, 0}, {8, 8, 0}, - {0, 8, 0}, {0, 0, 0}}; - const fb_bitfield bgr888[4] = {{0, 8, 0}, {8, 8, 0}, - {16, 8, 0}, {0, 0, 0}}; - if (memcmp(rgba, rgb888, 3 * sizeof(fb_bitfield)) == 0) { - format = QImage::Format_RGB888; - } else if (memcmp(rgba, bgr888, 3 * sizeof(fb_bitfield)) == 0) { - format = QImage::Format_RGB888; - pixeltype = BGRPixel; - } - break; - } - case 18: { - const fb_bitfield rgb666[4] = {{12, 6, 0}, {6, 6, 0}, - {0, 6, 0}, {0, 0, 0}}; - if (memcmp(rgba, rgb666, 3 * sizeof(fb_bitfield)) == 0) - format = QImage::Format_RGB666; - break; - } - case 16: { - const fb_bitfield rgb565[4] = {{11, 5, 0}, {5, 6, 0}, - {0, 5, 0}, {0, 0, 0}}; - const fb_bitfield bgr565[4] = {{0, 5, 0}, {5, 6, 0}, - {11, 5, 0}, {0, 0, 0}}; - if (memcmp(rgba, rgb565, 3 * sizeof(fb_bitfield)) == 0) { - format = QImage::Format_RGB16; - } else if (memcmp(rgba, bgr565, 3 * sizeof(fb_bitfield)) == 0) { - format = QImage::Format_RGB16; - pixeltype = BGRPixel; - } - break; - } - case 15: { - const fb_bitfield rgb1555[4] = {{10, 5, 0}, {5, 5, 0}, - {0, 5, 0}, {15, 1, 0}}; - const fb_bitfield bgr1555[4] = {{0, 5, 0}, {5, 5, 0}, - {10, 5, 0}, {15, 1, 0}}; - if (memcmp(rgba, rgb1555, 3 * sizeof(fb_bitfield)) == 0) { - format = QImage::Format_RGB555; - } else if (memcmp(rgba, bgr1555, 3 * sizeof(fb_bitfield)) == 0) { - format = QImage::Format_RGB555; - pixeltype = BGRPixel; - } - break; - } - case 12: { - const fb_bitfield rgb444[4] = {{8, 4, 0}, {4, 4, 0}, - {0, 4, 0}, {0, 0, 0}}; - if (memcmp(rgba, rgb444, 3 * sizeof(fb_bitfield)) == 0) - format = QImage::Format_RGB444; - break; - } - case 8: - break; - case 1: - format = QImage::Format_Mono; //###: LSB??? - break; - default: - break; - } - - screenFormat = format; -} - -void QLinuxFbIntegration::createPalette(fb_cmap &cmap, fb_var_screeninfo &vinfo, fb_fix_screeninfo &finfo) -{ - if((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4)) { - screencols= (vinfo.bits_per_pixel==8) ? 256 : 16; - cmap.start=0; - cmap.len=screencols; - cmap.red=(unsigned short int *) - malloc(sizeof(unsigned short int)*screencols); - cmap.green=(unsigned short int *) - malloc(sizeof(unsigned short int)*screencols); - cmap.blue=(unsigned short int *) - malloc(sizeof(unsigned short int)*screencols); - cmap.transp=(unsigned short int *) - malloc(sizeof(unsigned short int)*screencols); - - if (screencols==16) { - if (finfo.type == FB_TYPE_PACKED_PIXELS) { - // We'll setup a grayscale cmap for 4bpp linear - int val = 0; - for (int idx = 0; idx < 16; ++idx, val += 17) { - cmap.red[idx] = (val<<8)|val; - cmap.green[idx] = (val<<8)|val; - cmap.blue[idx] = (val<<8)|val; - screenclut[idx]=qRgb(val, val, val); - } - } else { - // Default 16 colour palette - // Green is now trolltech green so certain images look nicer - // black d_gray l_gray white red green blue cyan magenta yellow - unsigned char reds[16] = { 0x00, 0x7F, 0xBF, 0xFF, 0xFF, 0xA2, 0x00, 0xFF, 0xFF, 0x00, 0x7F, 0x7F, 0x00, 0x00, 0x00, 0x82 }; - unsigned char greens[16] = { 0x00, 0x7F, 0xBF, 0xFF, 0x00, 0xC5, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F }; - unsigned char blues[16] = { 0x00, 0x7F, 0xBF, 0xFF, 0x00, 0x11, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0x7F, 0x7F, 0x7F, 0x00, 0x00 }; - - for (int idx = 0; idx < 16; ++idx) { - cmap.red[idx] = ((reds[idx]) << 8)|reds[idx]; - cmap.green[idx] = ((greens[idx]) << 8)|greens[idx]; - cmap.blue[idx] = ((blues[idx]) << 8)|blues[idx]; - cmap.transp[idx] = 0; - screenclut[idx]=qRgb(reds[idx], greens[idx], blues[idx]); - } - } - } else { - if (grayscale) { - // Build grayscale palette - int i; - for(i=0;iblank == on) - return; - -#if defined(QT_QWS_IPAQ) - if (on) - system("apm -suspend"); -#else - if (d_ptr->fd == -1) - return; -// Some old kernel versions don't have this. These defines should go -// away eventually -#if defined(FBIOBLANK) -#if defined(VESA_POWERDOWN) && defined(VESA_NO_BLANKING) - ioctl(d_ptr->fd, FBIOBLANK, on ? VESA_POWERDOWN : VESA_NO_BLANKING); -#else - ioctl(d_ptr->fd, FBIOBLANK, on ? 1 : 0); -#endif -#endif -#endif - - d_ptr->blank = on; -} - -QPixmapData *QLinuxFbIntegration::createPixmapData(QPixmapData::PixelType type) const -{ - return new QRasterPixmapData(type); -} - -QWindowSurface *QLinuxFbIntegration::createWindowSurface(QWidget *widget, WId) const -{ - QFbWindowSurface * surface = - new QFbWindowSurface(mPrimaryScreen, widget); - return surface; -} - -QPlatformWindow *QLinuxFbIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const -{ - QFbWindow *w = new QFbWindow(mPrimaryScreen, widget); - mPrimaryScreen->addWindow(w); - return w; -} - -QLinuxFbScreen::QLinuxFbScreen(uchar * d, int w, - int h, int lstep, QImage::Format screenFormat) : compositePainter(0) -{ - data = d; - mGeometry = QRect(0,0,w,h); - bytesPerLine = lstep; - mFormat = screenFormat; - mDepth = 16; - mScreenImage = new QImage(mGeometry.width(), mGeometry.height(), - mFormat); - mFbScreenImage = new QImage(data, mGeometry.width(), mGeometry.height(), - bytesPerLine, mFormat); - cursor = new QGraphicsSystemSoftwareCursor(this); -} - -void QLinuxFbScreen::setGeometry(QRect rect) -{ - mGeometry = rect; - delete mFbScreenImage; - mFbScreenImage = new QImage(data, mGeometry.width(), mGeometry.height(), - bytesPerLine, mFormat); - delete compositePainter; - compositePainter = 0; - - delete mScreenImage; - mScreenImage = new QImage(mGeometry.width(), mGeometry.height(), - mFormat); -} - -void QLinuxFbScreen::setFormat(QImage::Format format) -{ - mFormat = format; - delete mFbScreenImage; - mFbScreenImage = new QImage(data, mGeometry.width(), mGeometry.height(), - bytesPerLine, mFormat); - delete compositePainter; - compositePainter = 0; - - delete mScreenImage; - mScreenImage = new QImage(mGeometry.width(), mGeometry.height(), - mFormat); -} - -QRegion QLinuxFbScreen::doRedraw() -{ - QRegion touched; - touched = QFbScreen::doRedraw(); - - if (!compositePainter) { - compositePainter = new QPainter(mFbScreenImage); - } - - QVector rects = touched.rects(); - for (int i = 0; i < rects.size(); i++) - compositePainter->drawImage(rects[i], *mScreenImage, rects[i]); - return touched; -} -QT_END_NAMESPACE diff --git a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h deleted file mode 100644 index dc61df5..0000000 --- a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSYSTEM_LINUXFB_H -#define QGRAPHICSSYSTEM_LINUXFB_H - -#include -#include "../fb_base/fb_base.h" - -QT_BEGIN_NAMESPACE - -class QLinuxFbScreen : public QFbScreen -{ -public: - QLinuxFbScreen(uchar * d, int w, int h, int lstep, QImage::Format screenFormat); - void setGeometry(QRect rect); - void setFormat(QImage::Format format); - -public slots: - QRegion doRedraw(); - -private: - QImage * mFbScreenImage; - uchar * data; - int bytesPerLine; - - QPainter *compositePainter; -}; - -class QLinuxFbIntegrationPrivate; -struct fb_cmap; -struct fb_var_screeninfo; -struct fb_fix_screeninfo; - -class QLinuxFbIntegration : public QPlatformIntegration -{ -public: - QLinuxFbIntegration(); - ~QLinuxFbIntegration(); - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QPlatformWindow *createPlatformWindow(QWidget *widget, WId WinId) const; - QWindowSurface *createWindowSurface(QWidget *widget, WId WinId) const; - - QList screens() const { return mScreens; } - -private: - QLinuxFbScreen *mPrimaryScreen; - QList mScreens; - QLinuxFbIntegrationPrivate *d_ptr; - - enum PixelType { NormalPixel, BGRPixel }; - - QRgb screenclut[256]; - int screencols; - - uchar * data; - - QImage::Format screenFormat; - int w; - int lstep; - int h; - int d; - PixelType pixeltype; - bool grayscale; - - int dw; - int dh; - - int size; // Screen size - int mapsize; // Total mapped memory - - int displayId; - - int physWidth; - int physHeight; - - bool canaccel; - int dataoffset; - int cacheStart; - - bool connect(const QString &displaySpec); - bool initDevice(); - void setPixelFormat(struct fb_var_screeninfo); - void createPalette(fb_cmap &cmap, fb_var_screeninfo &vinfo, fb_fix_screeninfo &finfo); - void blank(bool on); -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp new file mode 100644 index 0000000..391e105 --- /dev/null +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp @@ -0,0 +1,859 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qlinuxfbintegration.h" +#include "../fb_base/fb_base.h" +#include +#include // overrides QT_OPEN +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if !defined(Q_OS_DARWIN) && !defined(Q_OS_FREEBSD) +#include + +#ifdef __i386__ +#include +#endif +#endif + +QT_BEGIN_NAMESPACE + +class QLinuxFbIntegrationPrivate +{ +public: + QLinuxFbIntegrationPrivate(); + ~QLinuxFbIntegrationPrivate(); + + void openTty(); + void closeTty(); + + int fd; + int startupw; + int startuph; + int startupd; + bool blank; + + bool doGraphicsMode; +#ifdef QT_QWS_DEPTH_GENERIC + bool doGenericColors; +#endif + int ttyfd; + long oldKdMode; + QString ttyDevice; + QString displaySpec; +}; + +QLinuxFbIntegrationPrivate::QLinuxFbIntegrationPrivate() + : fd(-1), blank(true), doGraphicsMode(true), +#ifdef QT_QWS_DEPTH_GENERIC + doGenericColors(false), +#endif + ttyfd(-1), oldKdMode(KD_TEXT) +{ +} + +QLinuxFbIntegrationPrivate::~QLinuxFbIntegrationPrivate() +{ + closeTty(); +} + +void QLinuxFbIntegrationPrivate::openTty() +{ + const char *const devs[] = {"/dev/tty0", "/dev/tty", "/dev/console", 0}; + + if (ttyDevice.isEmpty()) { + for (const char * const *dev = devs; *dev; ++dev) { + ttyfd = QT_OPEN(*dev, O_RDWR); + if (ttyfd != -1) + break; + } + } else { + ttyfd = QT_OPEN(ttyDevice.toAscii().constData(), O_RDWR); + } + + if (ttyfd == -1) + return; + + if (doGraphicsMode) { + ioctl(ttyfd, KDGETMODE, &oldKdMode); + if (oldKdMode != KD_GRAPHICS) { + int ret = ioctl(ttyfd, KDSETMODE, KD_GRAPHICS); + if (ret == -1) + doGraphicsMode = false; + } + } + + // No blankin' screen, no blinkin' cursor!, no cursor! + const char termctl[] = "\033[9;0]\033[?33l\033[?25l\033[?1c"; + QT_WRITE(ttyfd, termctl, sizeof(termctl)); +} + +void QLinuxFbIntegrationPrivate::closeTty() +{ + if (ttyfd == -1) + return; + + if (doGraphicsMode) + ioctl(ttyfd, KDSETMODE, oldKdMode); + + // Blankin' screen, blinkin' cursor! + const char termctl[] = "\033[9;15]\033[?33h\033[?25h\033[?0c"; + QT_WRITE(ttyfd, termctl, sizeof(termctl)); + + QT_CLOSE(ttyfd); + ttyfd = -1; +} + +QLinuxFbIntegration::QLinuxFbIntegration() +{ + d_ptr = new QLinuxFbIntegrationPrivate(); + + // XXX + QString displaySpec = QString::fromLatin1(qgetenv("QWS_DISPLAY")); + + if (!connect(displaySpec)) + qFatal("QLinuxFbIntegration: could not initialize screen"); + initDevice(); + + // Create a QImage directly on the screen's framebuffer. + // This is the blit target for copying windows to the screen. + mPrimaryScreen = new QLinuxFbScreen(data, w, h, lstep, + screenFormat); + mPrimaryScreen->setPhysicalSize(QSize(physWidth, physHeight)); + mScreens.append(mPrimaryScreen); +} + +QLinuxFbIntegration::~QLinuxFbIntegration() +{ + delete mPrimaryScreen; + delete d_ptr; +} + +bool QLinuxFbIntegration::connect(const QString &displaySpec) +{ + const QStringList args = displaySpec.split(QLatin1Char(':')); + + if (args.contains(QLatin1String("nographicsmodeswitch"))) + d_ptr->doGraphicsMode = false; + +#ifdef QT_QWS_DEPTH_GENERIC + if (args.contains(QLatin1String("genericcolors"))) + d_ptr->doGenericColors = true; +#endif + + QRegExp ttyRegExp(QLatin1String("tty=(.*)")); + if (args.indexOf(ttyRegExp) != -1) + d_ptr->ttyDevice = ttyRegExp.cap(1); + +#if 0 +#if Q_BYTE_ORDER == Q_BIG_ENDIAN +#ifndef QT_QWS_FRAMEBUFFER_LITTLE_ENDIAN + if (args.contains(QLatin1String("littleendian"))) +#endif + QScreen::setFrameBufferLittleEndian(true); +#endif +#endif + + // Check for explicitly specified device + const int len = 8; // "/dev/fbx" + int m = displaySpec.indexOf(QLatin1String("/dev/fb")); + + QString dev; + if (m > 0) + dev = displaySpec.mid(m, len); + else + dev = QLatin1String("/dev/fb0"); + + if (access(dev.toLatin1().constData(), R_OK|W_OK) == 0) + d_ptr->fd = QT_OPEN(dev.toLatin1().constData(), O_RDWR); + if (d_ptr->fd == -1) { + if (access(dev.toLatin1().constData(), R_OK) == 0) + d_ptr->fd = QT_OPEN(dev.toLatin1().constData(), O_RDONLY); + if (d_ptr->fd == 1) { + qWarning("Error opening framebuffer device %s", qPrintable(dev)); + return false; + } + } + + fb_fix_screeninfo finfo; + fb_var_screeninfo vinfo; + //####################### + // Shut up Valgrind + memset(&vinfo, 0, sizeof(vinfo)); + memset(&finfo, 0, sizeof(finfo)); + //####################### + + /* Get fixed screen information */ + if (d_ptr->fd != -1 && ioctl(d_ptr->fd, FBIOGET_FSCREENINFO, &finfo)) { + perror("QLinuxFbIntegration::connect"); + qWarning("Error reading fixed information"); + return false; + } + + if (finfo.type == FB_TYPE_VGA_PLANES) { + qWarning("VGA16 video mode not supported"); + return false; + } + + /* Get variable screen information */ + if (d_ptr->fd != -1 && ioctl(d_ptr->fd, FBIOGET_VSCREENINFO, &vinfo)) { + perror("QLinuxFbIntegration::connect"); + qWarning("Error reading variable information"); + return false; + } + + grayscale = vinfo.grayscale; + d = vinfo.bits_per_pixel; + if (d == 24) { + d = vinfo.red.length + vinfo.green.length + vinfo.blue.length; + if (d <= 0) + d = 24; // reset if color component lengths are not reported + } else if (d == 16) { + d = vinfo.red.length + vinfo.green.length + vinfo.blue.length; + if (d <= 0) + d = 16; + } + lstep = finfo.line_length; + + int xoff = vinfo.xoffset; + int yoff = vinfo.yoffset; + const char* qwssize; + if((qwssize=::getenv("QWS_SIZE")) && sscanf(qwssize,"%dx%d",&w,&h)==2) { + if (d_ptr->fd != -1) { + if ((uint)w > vinfo.xres) w = vinfo.xres; + if ((uint)h > vinfo.yres) h = vinfo.yres; + } + dw=w; + dh=h; + int xxoff, yyoff; + if (sscanf(qwssize, "%*dx%*d+%d+%d", &xxoff, &yyoff) == 2) { + if (xxoff < 0 || xxoff + w > (int)(vinfo.xres)) + xxoff = vinfo.xres - w; + if (yyoff < 0 || yyoff + h > (int)(vinfo.yres)) + yyoff = vinfo.yres - h; + xoff += xxoff; + yoff += yyoff; + } else { + xoff += (vinfo.xres - w)/2; + yoff += (vinfo.yres - h)/2; + } + } else { + dw=w=vinfo.xres; + dh=h=vinfo.yres; + } + + if (w == 0 || h == 0) { + qWarning("QLinuxFbIntegration::connect(): Unable to find screen geometry, " + "will use 320x240."); + dw = w = 320; + dh = h = 240; + } + + setPixelFormat(vinfo); + + // Handle display physical size spec. + QStringList displayArgs = displaySpec.split(QLatin1Char(':')); + QRegExp mmWidthRx(QLatin1String("mmWidth=?(\\d+)")); + int dimIdxW = displayArgs.indexOf(mmWidthRx); + QRegExp mmHeightRx(QLatin1String("mmHeight=?(\\d+)")); + int dimIdxH = displayArgs.indexOf(mmHeightRx); + if (dimIdxW >= 0) { + mmWidthRx.exactMatch(displayArgs.at(dimIdxW)); + physWidth = mmWidthRx.cap(1).toInt(); + if (dimIdxH < 0) + physHeight = dh*physWidth/dw; + } + if (dimIdxH >= 0) { + mmHeightRx.exactMatch(displayArgs.at(dimIdxH)); + physHeight = mmHeightRx.cap(1).toInt(); + if (dimIdxW < 0) + physWidth = dw*physHeight/dh; + } + if (dimIdxW < 0 && dimIdxH < 0) { + if (vinfo.width != 0 && vinfo.height != 0 + && vinfo.width != UINT_MAX && vinfo.height != UINT_MAX) { + physWidth = vinfo.width; + physHeight = vinfo.height; + } else { + const int dpi = 72; + physWidth = qRound(dw * 25.4 / dpi); + physHeight = qRound(dh * 25.4 / dpi); + } + } + + dataoffset = yoff * lstep + xoff * d / 8; + //qDebug("Using %dx%dx%d screen",w,h,d); + + /* Figure out the size of the screen in bytes */ + size = h * lstep; + + mapsize = finfo.smem_len; + + data = (unsigned char *)-1; + if (d_ptr->fd != -1) + data = (unsigned char *)mmap(0, mapsize, PROT_READ | PROT_WRITE, + MAP_SHARED, d_ptr->fd, 0); + + if ((long)data == -1) { + perror("QLinuxFbIntegration::connect"); + qWarning("Error: failed to map framebuffer device to memory."); + return false; + } else { + data += dataoffset; + } + +#if 0 + canaccel = useOffscreen(); + if(canaccel) + setupOffScreen(); +#endif + canaccel = false; + + // Now read in palette + if((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4)) { + screencols= (vinfo.bits_per_pixel==8) ? 256 : 16; + int loopc; + fb_cmap startcmap; + startcmap.start=0; + startcmap.len=screencols; + startcmap.red=(unsigned short int *) + malloc(sizeof(unsigned short int)*screencols); + startcmap.green=(unsigned short int *) + malloc(sizeof(unsigned short int)*screencols); + startcmap.blue=(unsigned short int *) + malloc(sizeof(unsigned short int)*screencols); + startcmap.transp=(unsigned short int *) + malloc(sizeof(unsigned short int)*screencols); + if (d_ptr->fd == -1 || ioctl(d_ptr->fd, FBIOGETCMAP, &startcmap)) { + perror("QLinuxFbIntegration::connect"); + qWarning("Error reading palette from framebuffer, using default palette"); + createPalette(startcmap, vinfo, finfo); + } + int bits_used = 0; + for(loopc=0;loopc> 8, + startcmap.green[loopc] >> 8, + startcmap.blue[loopc] >> 8); + bits_used |= startcmap.red[loopc] + | startcmap.green[loopc] + | startcmap.blue[loopc]; + } + // WORKAROUND: Some framebuffer drivers only return 8 bit + // color values, so we need to not bit shift them.. + if ((bits_used & 0x00ff) && !(bits_used & 0xff00)) { + for(loopc=0;loopcopenTty(); + + // Grab current mode so we can reset it + fb_var_screeninfo vinfo; + fb_fix_screeninfo finfo; + //####################### + // Shut up Valgrind + memset(&vinfo, 0, sizeof(vinfo)); + memset(&finfo, 0, sizeof(finfo)); + //####################### + + if (ioctl(d_ptr->fd, FBIOGET_VSCREENINFO, &vinfo)) { + perror("QLinuxFbScreen::initDevice"); + qFatal("Error reading variable information in card init"); + return false; + } + +#ifdef DEBUG_VINFO + qDebug("Greyscale %d",vinfo.grayscale); + qDebug("Nonstd %d",vinfo.nonstd); + qDebug("Red %d %d %d",vinfo.red.offset,vinfo.red.length, + vinfo.red.msb_right); + qDebug("Green %d %d %d",vinfo.green.offset,vinfo.green.length, + vinfo.green.msb_right); + qDebug("Blue %d %d %d",vinfo.blue.offset,vinfo.blue.length, + vinfo.blue.msb_right); + qDebug("Transparent %d %d %d",vinfo.transp.offset,vinfo.transp.length, + vinfo.transp.msb_right); +#endif + + d_ptr->startupw=vinfo.xres; + d_ptr->startuph=vinfo.yres; + d_ptr->startupd=vinfo.bits_per_pixel; + grayscale = vinfo.grayscale; + + if (ioctl(d_ptr->fd, FBIOGET_FSCREENINFO, &finfo)) { + perror("QLinuxFbScreen::initDevice"); + qCritical("Error reading fixed information in card init"); + // It's not an /error/ as such, though definitely a bad sign + // so we return true + return true; + } + +#ifdef __i386__ + // Now init mtrr + if(!::getenv("QWS_NOMTRR")) { + int mfd=QT_OPEN("/proc/mtrr",O_WRONLY,0); + // MTRR entry goes away when file is closed - i.e. + // hopefully when QWS is killed + if(mfd != -1) { + mtrr_sentry sentry; + sentry.base=(unsigned long int)finfo.smem_start; + //qDebug("Physical framebuffer address %p",(void*)finfo.smem_start); + // Size needs to be in 4k chunks, but that's not always + // what we get thanks to graphics card registers. Write combining + // these is Not Good, so we write combine what we can + // (which is not much - 4 megs on an 8 meg card, it seems) + unsigned int size=finfo.smem_len; + size=size >> 22; + size=size << 22; + sentry.size=size; + sentry.type=MTRR_TYPE_WRCOMB; + if(ioctl(mfd,MTRRIOC_ADD_ENTRY,&sentry)==-1) { + //printf("Couldn't add mtrr entry for %lx %lx, %s\n", + //sentry.base,sentry.size,strerror(errno)); + } + } + + // Should we close mfd here? + //QT_CLOSE(mfd); + } +#endif + if ((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4) || (finfo.visual==FB_VISUAL_DIRECTCOLOR)) + { + fb_cmap cmap; + createPalette(cmap, vinfo, finfo); + if (ioctl(d_ptr->fd, FBIOPUTCMAP, &cmap)) { + perror("QLinuxFbScreen::initDevice"); + qWarning("Error writing palette to framebuffer"); + } + free(cmap.red); + free(cmap.green); + free(cmap.blue); + free(cmap.transp); + } + +#if 0 + if (canaccel) { + *entryp=0; + *lowest = mapsize; + insert_entry(*entryp, *lowest, *lowest); // dummy entry to mark start + } + + shared->fifocount = 0; + shared->buffer_offset = 0xffffffff; // 0 would be a sensible offset (screen) + shared->linestep = 0; + shared->cliptop = 0xffffffff; + shared->clipleft = 0xffffffff; + shared->clipright = 0xffffffff; + shared->clipbottom = 0xffffffff; + shared->rop = 0xffffffff; +#endif + +#ifdef QT_QWS_DEPTH_GENERIC + if (pixelFormat() == QImage::Format_Invalid && screencols == 0 + && d_ptr->doGenericColors) + { + qt_set_generic_blit(this, vinfo.bits_per_pixel, + vinfo.red.length, vinfo.green.length, + vinfo.blue.length, vinfo.transp.length, + vinfo.red.offset, vinfo.green.offset, + vinfo.blue.offset, vinfo.transp.offset); + } +#endif + +#if 0 +#ifndef QT_NO_QWS_CURSOR + QScreenCursor::initSoftwareCursor(); +#endif +#endif + blank(false); + + return true; +} + +void QLinuxFbIntegration::setPixelFormat(struct fb_var_screeninfo info) +{ + const fb_bitfield rgba[4] = { info.red, info.green, + info.blue, info.transp }; + + QImage::Format format = QImage::Format_Invalid; + + switch (d) { + case 32: { + const fb_bitfield argb8888[4] = {{16, 8, 0}, {8, 8, 0}, + {0, 8, 0}, {24, 8, 0}}; + const fb_bitfield abgr8888[4] = {{0, 8, 0}, {8, 8, 0}, + {16, 8, 0}, {24, 8, 0}}; + if (memcmp(rgba, argb8888, 4 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_ARGB32; + } else if (memcmp(rgba, argb8888, 3 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_RGB32; + } else if (memcmp(rgba, abgr8888, 3 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_RGB32; + pixeltype = BGRPixel; + } + break; + } + case 24: { + const fb_bitfield rgb888[4] = {{16, 8, 0}, {8, 8, 0}, + {0, 8, 0}, {0, 0, 0}}; + const fb_bitfield bgr888[4] = {{0, 8, 0}, {8, 8, 0}, + {16, 8, 0}, {0, 0, 0}}; + if (memcmp(rgba, rgb888, 3 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_RGB888; + } else if (memcmp(rgba, bgr888, 3 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_RGB888; + pixeltype = BGRPixel; + } + break; + } + case 18: { + const fb_bitfield rgb666[4] = {{12, 6, 0}, {6, 6, 0}, + {0, 6, 0}, {0, 0, 0}}; + if (memcmp(rgba, rgb666, 3 * sizeof(fb_bitfield)) == 0) + format = QImage::Format_RGB666; + break; + } + case 16: { + const fb_bitfield rgb565[4] = {{11, 5, 0}, {5, 6, 0}, + {0, 5, 0}, {0, 0, 0}}; + const fb_bitfield bgr565[4] = {{0, 5, 0}, {5, 6, 0}, + {11, 5, 0}, {0, 0, 0}}; + if (memcmp(rgba, rgb565, 3 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_RGB16; + } else if (memcmp(rgba, bgr565, 3 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_RGB16; + pixeltype = BGRPixel; + } + break; + } + case 15: { + const fb_bitfield rgb1555[4] = {{10, 5, 0}, {5, 5, 0}, + {0, 5, 0}, {15, 1, 0}}; + const fb_bitfield bgr1555[4] = {{0, 5, 0}, {5, 5, 0}, + {10, 5, 0}, {15, 1, 0}}; + if (memcmp(rgba, rgb1555, 3 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_RGB555; + } else if (memcmp(rgba, bgr1555, 3 * sizeof(fb_bitfield)) == 0) { + format = QImage::Format_RGB555; + pixeltype = BGRPixel; + } + break; + } + case 12: { + const fb_bitfield rgb444[4] = {{8, 4, 0}, {4, 4, 0}, + {0, 4, 0}, {0, 0, 0}}; + if (memcmp(rgba, rgb444, 3 * sizeof(fb_bitfield)) == 0) + format = QImage::Format_RGB444; + break; + } + case 8: + break; + case 1: + format = QImage::Format_Mono; //###: LSB??? + break; + default: + break; + } + + screenFormat = format; +} + +void QLinuxFbIntegration::createPalette(fb_cmap &cmap, fb_var_screeninfo &vinfo, fb_fix_screeninfo &finfo) +{ + if((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4)) { + screencols= (vinfo.bits_per_pixel==8) ? 256 : 16; + cmap.start=0; + cmap.len=screencols; + cmap.red=(unsigned short int *) + malloc(sizeof(unsigned short int)*screencols); + cmap.green=(unsigned short int *) + malloc(sizeof(unsigned short int)*screencols); + cmap.blue=(unsigned short int *) + malloc(sizeof(unsigned short int)*screencols); + cmap.transp=(unsigned short int *) + malloc(sizeof(unsigned short int)*screencols); + + if (screencols==16) { + if (finfo.type == FB_TYPE_PACKED_PIXELS) { + // We'll setup a grayscale cmap for 4bpp linear + int val = 0; + for (int idx = 0; idx < 16; ++idx, val += 17) { + cmap.red[idx] = (val<<8)|val; + cmap.green[idx] = (val<<8)|val; + cmap.blue[idx] = (val<<8)|val; + screenclut[idx]=qRgb(val, val, val); + } + } else { + // Default 16 colour palette + // Green is now trolltech green so certain images look nicer + // black d_gray l_gray white red green blue cyan magenta yellow + unsigned char reds[16] = { 0x00, 0x7F, 0xBF, 0xFF, 0xFF, 0xA2, 0x00, 0xFF, 0xFF, 0x00, 0x7F, 0x7F, 0x00, 0x00, 0x00, 0x82 }; + unsigned char greens[16] = { 0x00, 0x7F, 0xBF, 0xFF, 0x00, 0xC5, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F }; + unsigned char blues[16] = { 0x00, 0x7F, 0xBF, 0xFF, 0x00, 0x11, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0x7F, 0x7F, 0x7F, 0x00, 0x00 }; + + for (int idx = 0; idx < 16; ++idx) { + cmap.red[idx] = ((reds[idx]) << 8)|reds[idx]; + cmap.green[idx] = ((greens[idx]) << 8)|greens[idx]; + cmap.blue[idx] = ((blues[idx]) << 8)|blues[idx]; + cmap.transp[idx] = 0; + screenclut[idx]=qRgb(reds[idx], greens[idx], blues[idx]); + } + } + } else { + if (grayscale) { + // Build grayscale palette + int i; + for(i=0;iblank == on) + return; + +#if defined(QT_QWS_IPAQ) + if (on) + system("apm -suspend"); +#else + if (d_ptr->fd == -1) + return; +// Some old kernel versions don't have this. These defines should go +// away eventually +#if defined(FBIOBLANK) +#if defined(VESA_POWERDOWN) && defined(VESA_NO_BLANKING) + ioctl(d_ptr->fd, FBIOBLANK, on ? VESA_POWERDOWN : VESA_NO_BLANKING); +#else + ioctl(d_ptr->fd, FBIOBLANK, on ? 1 : 0); +#endif +#endif +#endif + + d_ptr->blank = on; +} + +QPixmapData *QLinuxFbIntegration::createPixmapData(QPixmapData::PixelType type) const +{ + return new QRasterPixmapData(type); +} + +QWindowSurface *QLinuxFbIntegration::createWindowSurface(QWidget *widget, WId) const +{ + QFbWindowSurface * surface = + new QFbWindowSurface(mPrimaryScreen, widget); + return surface; +} + +QPlatformWindow *QLinuxFbIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const +{ + QFbWindow *w = new QFbWindow(mPrimaryScreen, widget); + mPrimaryScreen->addWindow(w); + return w; +} + +QLinuxFbScreen::QLinuxFbScreen(uchar * d, int w, + int h, int lstep, QImage::Format screenFormat) : compositePainter(0) +{ + data = d; + mGeometry = QRect(0,0,w,h); + bytesPerLine = lstep; + mFormat = screenFormat; + mDepth = 16; + mScreenImage = new QImage(mGeometry.width(), mGeometry.height(), + mFormat); + mFbScreenImage = new QImage(data, mGeometry.width(), mGeometry.height(), + bytesPerLine, mFormat); + cursor = new QGraphicsSystemSoftwareCursor(this); +} + +void QLinuxFbScreen::setGeometry(QRect rect) +{ + mGeometry = rect; + delete mFbScreenImage; + mFbScreenImage = new QImage(data, mGeometry.width(), mGeometry.height(), + bytesPerLine, mFormat); + delete compositePainter; + compositePainter = 0; + + delete mScreenImage; + mScreenImage = new QImage(mGeometry.width(), mGeometry.height(), + mFormat); +} + +void QLinuxFbScreen::setFormat(QImage::Format format) +{ + mFormat = format; + delete mFbScreenImage; + mFbScreenImage = new QImage(data, mGeometry.width(), mGeometry.height(), + bytesPerLine, mFormat); + delete compositePainter; + compositePainter = 0; + + delete mScreenImage; + mScreenImage = new QImage(mGeometry.width(), mGeometry.height(), + mFormat); +} + +QRegion QLinuxFbScreen::doRedraw() +{ + QRegion touched; + touched = QFbScreen::doRedraw(); + + if (!compositePainter) { + compositePainter = new QPainter(mFbScreenImage); + } + + QVector rects = touched.rects(); + for (int i = 0; i < rects.size(); i++) + compositePainter->drawImage(rects[i], *mScreenImage, rects[i]); + return touched; +} +QT_END_NAMESPACE diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h new file mode 100644 index 0000000..dc61df5 --- /dev/null +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_LINUXFB_H +#define QGRAPHICSSYSTEM_LINUXFB_H + +#include +#include "../fb_base/fb_base.h" + +QT_BEGIN_NAMESPACE + +class QLinuxFbScreen : public QFbScreen +{ +public: + QLinuxFbScreen(uchar * d, int w, int h, int lstep, QImage::Format screenFormat); + void setGeometry(QRect rect); + void setFormat(QImage::Format format); + +public slots: + QRegion doRedraw(); + +private: + QImage * mFbScreenImage; + uchar * data; + int bytesPerLine; + + QPainter *compositePainter; +}; + +class QLinuxFbIntegrationPrivate; +struct fb_cmap; +struct fb_var_screeninfo; +struct fb_fix_screeninfo; + +class QLinuxFbIntegration : public QPlatformIntegration +{ +public: + QLinuxFbIntegration(); + ~QLinuxFbIntegration(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformWindow *createPlatformWindow(QWidget *widget, WId WinId) const; + QWindowSurface *createWindowSurface(QWidget *widget, WId WinId) const; + + QList screens() const { return mScreens; } + +private: + QLinuxFbScreen *mPrimaryScreen; + QList mScreens; + QLinuxFbIntegrationPrivate *d_ptr; + + enum PixelType { NormalPixel, BGRPixel }; + + QRgb screenclut[256]; + int screencols; + + uchar * data; + + QImage::Format screenFormat; + int w; + int lstep; + int h; + int d; + PixelType pixeltype; + bool grayscale; + + int dw; + int dh; + + int size; // Screen size + int mapsize; // Total mapped memory + + int displayId; + + int physWidth; + int physHeight; + + bool canaccel; + int dataoffset; + int cacheStart; + + bool connect(const QString &displaySpec); + bool initDevice(); + void setPixelFormat(struct fb_var_screeninfo); + void createPalette(fb_cmap &cmap, fb_var_screeninfo &vinfo, fb_fix_screeninfo &finfo); + void blank(bool on); +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/minimal/main.cpp b/src/plugins/platforms/minimal/main.cpp index 44c274b..4958468 100644 --- a/src/plugins/platforms/minimal/main.cpp +++ b/src/plugins/platforms/minimal/main.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include -#include "qplatformintegration_minimal.h" +#include "qminimalintegration.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/minimal/minimal.pro b/src/plugins/platforms/minimal/minimal.pro index 6c97f07..438a88e 100644 --- a/src/plugins/platforms/minimal/minimal.pro +++ b/src/plugins/platforms/minimal/minimal.pro @@ -4,10 +4,10 @@ include(../../qpluginbase.pri) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms SOURCES = main.cpp \ - qplatformintegration_minimal.cpp \ - qwindowsurface_minimal.cpp -HEADERS = qplatformintegration_minimal.h \ - qwindowsurface_minimal.h + qminimalintegration.cpp \ + qminimalwindowsurface.cpp +HEADERS = qminimalintegration.h \ + qminimalwindowsurface.h target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp new file mode 100644 index 0000000..e947bf1 --- /dev/null +++ b/src/plugins/platforms/minimal/qminimalintegration.cpp @@ -0,0 +1,33 @@ +#include "qminimalintegration.h" +#include "qminimalwindowsurface.h" + +#include +#include + +QMinimalIntegration::QMinimalIntegration() +{ + QMinimalScreen *mPrimaryScreen = new QMinimalScreen(); + + mPrimaryScreen->mGeometry = QRect(0, 0, 240, 320); + mPrimaryScreen->mDepth = 16; + mPrimaryScreen->mFormat = QImage::Format_RGB16; + + mScreens.append(mPrimaryScreen); +} + +QPixmapData *QMinimalIntegration::createPixmapData(QPixmapData::PixelType type) const +{ + return new QRasterPixmapData(type); +} + +QPlatformWindow *QMinimalIntegration::createPlatformWindow(QWidget *widget, WId winId) const +{ + Q_UNUSED(winId); + return new QPlatformWindow(widget); +} + +QWindowSurface *QMinimalIntegration::createWindowSurface(QWidget *widget, WId winId) const +{ + Q_UNUSED(winId); + return new QMinimalWindowSurface(widget); +} diff --git a/src/plugins/platforms/minimal/qminimalintegration.h b/src/plugins/platforms/minimal/qminimalintegration.h new file mode 100644 index 0000000..a2f7449 --- /dev/null +++ b/src/plugins/platforms/minimal/qminimalintegration.h @@ -0,0 +1,85 @@ + +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMINTEGRATION_MINIMAL_H +#define QPLATFORMINTEGRATION_MINIMAL_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QMinimalScreen : public QPlatformScreen +{ +public: + QMinimalScreen() + : mDepth(16), mFormat(QImage::Format_RGB16) {} + + QRect geometry() const { return mGeometry; } + int depth() const { return mDepth; } + QImage::Format format() const { return mFormat; } + +public: + QRect mGeometry; + int mDepth; + QImage::Format mFormat; + QSize mPhysicalSize; +}; + +class QMinimalIntegration : public QPlatformIntegration +{ +public: + QMinimalIntegration(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; + QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; + + QList screens() const { return mScreens; } + +private: + QList mScreens; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/minimal/qminimalwindowsurface.cpp b/src/plugins/platforms/minimal/qminimalwindowsurface.cpp new file mode 100644 index 0000000..ad5997e --- /dev/null +++ b/src/plugins/platforms/minimal/qminimalwindowsurface.cpp @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qminimalwindowsurface.h" +#include +#include + +QT_BEGIN_NAMESPACE + +QMinimalWindowSurface::QMinimalWindowSurface(QWidget *window) + : QWindowSurface(window) +{ + //qDebug() << "QMinimalWindowSurface::QMinimalWindowSurface:" << (long)this; +} + +QMinimalWindowSurface::~QMinimalWindowSurface() +{ +} + +QPaintDevice *QMinimalWindowSurface::paintDevice() +{ + //qDebug() << "QMinimalWindowSurface::paintDevice"; + return &mImage; +} + +void QMinimalWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + Q_UNUSED(region); + Q_UNUSED(offset); + + static int c = 0; + QString filename = QString("output%1.png").arg(c++, 4, 10, QLatin1Char('0')); + qDebug() << "QMinimalWindowSurface::flush() saving contents to" << filename.toLocal8Bit().constData(); + mImage.save(filename); +} + +void QMinimalWindowSurface::resize(const QSize &size) +{ + //qDebug() << "QMinimalWindowSurface::setGeometry:" << (long)this << rect; + QWindowSurface::resize(size); + QImage::Format format = QApplicationPrivate::platformIntegration()->screens().first()->format(); + if (mImage.size() != size) + mImage = QImage(size, format); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/minimal/qminimalwindowsurface.h b/src/plugins/platforms/minimal/qminimalwindowsurface.h new file mode 100644 index 0000000..96f989d --- /dev/null +++ b/src/plugins/platforms/minimal/qminimalwindowsurface.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSURFACE_MINIMAL_H +#define QWINDOWSURFACE_MINIMAL_H + +#include + +#include + +QT_BEGIN_NAMESPACE + +class QMinimalWindowSurface : public QWindowSurface +{ +public: + QMinimalWindowSurface(QWidget *window); + ~QMinimalWindowSurface(); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void resize(const QSize &size); + +private: + QImage mImage; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp b/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp deleted file mode 100644 index 73e025c..0000000 --- a/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "qplatformintegration_minimal.h" -#include "qwindowsurface_minimal.h" - -#include -#include - -QMinimalIntegration::QMinimalIntegration() -{ - QMinimalScreen *mPrimaryScreen = new QMinimalScreen(); - - mPrimaryScreen->mGeometry = QRect(0, 0, 240, 320); - mPrimaryScreen->mDepth = 16; - mPrimaryScreen->mFormat = QImage::Format_RGB16; - - mScreens.append(mPrimaryScreen); -} - -QPixmapData *QMinimalIntegration::createPixmapData(QPixmapData::PixelType type) const -{ - return new QRasterPixmapData(type); -} - -QPlatformWindow *QMinimalIntegration::createPlatformWindow(QWidget *widget, WId winId) const -{ - Q_UNUSED(winId); - return new QPlatformWindow(widget); -} - -QWindowSurface *QMinimalIntegration::createWindowSurface(QWidget *widget, WId winId) const -{ - Q_UNUSED(winId); - return new QMinimalWindowSurface(widget); -} diff --git a/src/plugins/platforms/minimal/qplatformintegration_minimal.h b/src/plugins/platforms/minimal/qplatformintegration_minimal.h deleted file mode 100644 index a2f7449..0000000 --- a/src/plugins/platforms/minimal/qplatformintegration_minimal.h +++ /dev/null @@ -1,85 +0,0 @@ - -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPLATFORMINTEGRATION_MINIMAL_H -#define QPLATFORMINTEGRATION_MINIMAL_H - -#include -#include - -QT_BEGIN_NAMESPACE - -class QMinimalScreen : public QPlatformScreen -{ -public: - QMinimalScreen() - : mDepth(16), mFormat(QImage::Format_RGB16) {} - - QRect geometry() const { return mGeometry; } - int depth() const { return mDepth; } - QImage::Format format() const { return mFormat; } - -public: - QRect mGeometry; - int mDepth; - QImage::Format mFormat; - QSize mPhysicalSize; -}; - -class QMinimalIntegration : public QPlatformIntegration -{ -public: - QMinimalIntegration(); - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; - QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; - - QList screens() const { return mScreens; } - -private: - QList mScreens; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/minimal/qwindowsurface_minimal.cpp b/src/plugins/platforms/minimal/qwindowsurface_minimal.cpp deleted file mode 100644 index 2f8b1f0..0000000 --- a/src/plugins/platforms/minimal/qwindowsurface_minimal.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwindowsurface_minimal.h" -#include -#include - -QT_BEGIN_NAMESPACE - -QMinimalWindowSurface::QMinimalWindowSurface(QWidget *window) - : QWindowSurface(window) -{ - //qDebug() << "QMinimalWindowSurface::QMinimalWindowSurface:" << (long)this; -} - -QMinimalWindowSurface::~QMinimalWindowSurface() -{ -} - -QPaintDevice *QMinimalWindowSurface::paintDevice() -{ - //qDebug() << "QMinimalWindowSurface::paintDevice"; - return &mImage; -} - -void QMinimalWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) -{ - Q_UNUSED(widget); - Q_UNUSED(region); - Q_UNUSED(offset); - - static int c = 0; - QString filename = QString("output%1.png").arg(c++, 4, 10, QLatin1Char('0')); - qDebug() << "QMinimalWindowSurface::flush() saving contents to" << filename.toLocal8Bit().constData(); - mImage.save(filename); -} - -void QMinimalWindowSurface::resize(const QSize &size) -{ - //qDebug() << "QMinimalWindowSurface::setGeometry:" << (long)this << rect; - QWindowSurface::resize(size); - QImage::Format format = QApplicationPrivate::platformIntegration()->screens().first()->format(); - if (mImage.size() != size) - mImage = QImage(size, format); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/minimal/qwindowsurface_minimal.h b/src/plugins/platforms/minimal/qwindowsurface_minimal.h deleted file mode 100644 index 96f989d..0000000 --- a/src/plugins/platforms/minimal/qwindowsurface_minimal.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_MINIMAL_H -#define QWINDOWSURFACE_MINIMAL_H - -#include - -#include - -QT_BEGIN_NAMESPACE - -class QMinimalWindowSurface : public QWindowSurface -{ -public: - QMinimalWindowSurface(QWidget *window); - ~QMinimalWindowSurface(); - - QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void resize(const QSize &size); - -private: - QImage mImage; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/qvfb/qvfb.pro b/src/plugins/platforms/qvfb/qvfb.pro index 4dec274..a560755 100644 --- a/src/plugins/platforms/qvfb/qvfb.pro +++ b/src/plugins/platforms/qvfb/qvfb.pro @@ -4,8 +4,8 @@ include(../../qpluginbase.pri) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms -SOURCES = main.cpp qvfbintegration.cpp qwindowsurface_qvfb.cpp -HEADERS = qvfbintegration.h qwindowsurface_qvfb.h +SOURCES = main.cpp qvfbintegration.cpp qvfbwindowsurface.cpp +HEADERS = qvfbintegration.h qvfbwindowsurface.h target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target diff --git a/src/plugins/platforms/qvfb/qvfbintegration.cpp b/src/plugins/platforms/qvfb/qvfbintegration.cpp index e22c724..84ab9fb 100644 --- a/src/plugins/platforms/qvfb/qvfbintegration.cpp +++ b/src/plugins/platforms/qvfb/qvfbintegration.cpp @@ -53,7 +53,7 @@ #include #include "qvfbintegration.h" -#include "qwindowsurface_qvfb.h" +#include "qvfbwindowsurface.h" #include #include #include diff --git a/src/plugins/platforms/qvfb/qvfbwindowsurface.cpp b/src/plugins/platforms/qvfb/qvfbwindowsurface.cpp new file mode 100644 index 0000000..6699072 --- /dev/null +++ b/src/plugins/platforms/qvfb/qvfbwindowsurface.cpp @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include "qvfbwindowsurface.h" +#include "qvfbintegration.h" +#include +#include +#include + +QT_BEGIN_NAMESPACE + +QVFbWindowSurface::QVFbWindowSurface(//QVFbIntegration *graphicsSystem, + QVFbScreen *screen, QWidget *window) + : QWindowSurface(window), + mScreen(screen) +{ +} + +QVFbWindowSurface::~QVFbWindowSurface() +{ +} + +QPaintDevice *QVFbWindowSurface::paintDevice() +{ + return mScreen->screenImage(); +} + +void QVFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + Q_UNUSED(offset); + +// QRect rect = geometry(); +// QPoint topLeft = rect.topLeft(); + + mScreen->setDirty(region.boundingRect()); +} + +void QVFbWindowSurface::resize(const QSize&) +{ + +// any size you like as long as it's full-screen... + + QRect rect(mScreen->availableGeometry()); + QWindowSurface::resize(rect.size()); +} + + +QVFbWindow::QVFbWindow(QVFbScreen *screen, QWidget *window) + : QPlatformWindow(window), + mScreen(screen) +{ +} + + +void QVFbWindow::setGeometry(const QRect &) +{ + +// any size you like as long as it's full-screen... + + QRect rect(mScreen->availableGeometry()); + QWindowSystemInterface::handleGeometryChange(this->widget(), rect); + + QPlatformWindow::setGeometry(rect); +} + + + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/qvfb/qvfbwindowsurface.h b/src/plugins/platforms/qvfb/qvfbwindowsurface.h new file mode 100644 index 0000000..9228189 --- /dev/null +++ b/src/plugins/platforms/qvfb/qvfbwindowsurface.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSURFACE_QVFB_H +#define QWINDOWSURFACE_QVFB_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QVFbIntegration; +class QVFbScreen; + +class QVFbWindowSurface : public QWindowSurface +{ +public: + QVFbWindowSurface(QVFbScreen *screen, QWidget *window); + ~QVFbWindowSurface(); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void resize(const QSize &size); + +private: + QVFbScreen *mScreen; +}; + +class QVFbWindow : public QPlatformWindow +{ +public: + QVFbWindow(QVFbScreen *screen, QWidget *window); + void setGeometry(const QRect &rect); + +private: + QVFbScreen *mScreen; +}; + + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/qvfb/qwindowsurface_qvfb.cpp b/src/plugins/platforms/qvfb/qwindowsurface_qvfb.cpp deleted file mode 100644 index b46d9c0..0000000 --- a/src/plugins/platforms/qvfb/qwindowsurface_qvfb.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include "qwindowsurface_qvfb.h" -#include "qvfbintegration.h" -#include -#include -#include - -QT_BEGIN_NAMESPACE - -QVFbWindowSurface::QVFbWindowSurface(//QVFbIntegration *graphicsSystem, - QVFbScreen *screen, QWidget *window) - : QWindowSurface(window), - mScreen(screen) -{ -} - -QVFbWindowSurface::~QVFbWindowSurface() -{ -} - -QPaintDevice *QVFbWindowSurface::paintDevice() -{ - return mScreen->screenImage(); -} - -void QVFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) -{ - Q_UNUSED(widget); - Q_UNUSED(offset); - -// QRect rect = geometry(); -// QPoint topLeft = rect.topLeft(); - - mScreen->setDirty(region.boundingRect()); -} - -void QVFbWindowSurface::resize(const QSize&) -{ - -// any size you like as long as it's full-screen... - - QRect rect(mScreen->availableGeometry()); - QWindowSurface::resize(rect.size()); -} - - -QVFbWindow::QVFbWindow(QVFbScreen *screen, QWidget *window) - : QPlatformWindow(window), - mScreen(screen) -{ -} - - -void QVFbWindow::setGeometry(const QRect &) -{ - -// any size you like as long as it's full-screen... - - QRect rect(mScreen->availableGeometry()); - QWindowSystemInterface::handleGeometryChange(this->widget(), rect); - - QPlatformWindow::setGeometry(rect); -} - - - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/qvfb/qwindowsurface_qvfb.h b/src/plugins/platforms/qvfb/qwindowsurface_qvfb.h deleted file mode 100644 index 9228189..0000000 --- a/src/plugins/platforms/qvfb/qwindowsurface_qvfb.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_QVFB_H -#define QWINDOWSURFACE_QVFB_H - -#include -#include - -QT_BEGIN_NAMESPACE - -class QVFbIntegration; -class QVFbScreen; - -class QVFbWindowSurface : public QWindowSurface -{ -public: - QVFbWindowSurface(QVFbScreen *screen, QWidget *window); - ~QVFbWindowSurface(); - - QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void resize(const QSize &size); - -private: - QVFbScreen *mScreen; -}; - -class QVFbWindow : public QPlatformWindow -{ -public: - QVFbWindow(QVFbScreen *screen, QWidget *window); - void setGeometry(const QRect &rect); - -private: - QVFbScreen *mScreen; -}; - - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/testlite/main.cpp b/src/plugins/platforms/testlite/main.cpp index c1759ef..29bbcea 100644 --- a/src/plugins/platforms/testlite/main.cpp +++ b/src/plugins/platforms/testlite/main.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include -#include "qplatformintegration_testlite.h" +#include "qtestliteintegration.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp b/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp deleted file mode 100644 index cc77bc7..0000000 --- a/src/plugins/platforms/testlite/qplatformintegration_testlite.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - - -#include "qplatformintegration_testlite.h" -#include "qwindowsurface_testlite.h" -#include -#include - -#include - -#include "qtestlitewindow.h" - -#ifndef QT_NO_OPENGL -#include -#include "qglxglcontext.h" -#endif - -QT_BEGIN_NAMESPACE - -class MyCursor : QGraphicsSystemCursor -{ -public: - MyCursor(QPlatformScreen *screen) : QGraphicsSystemCursor(screen) {} - - void changeCursor(QCursor * cursor, QWidget * widget) { - QTestLiteWindow *w = 0; - if (widget) { - QWidget *window = widget->window(); - w = static_cast(window->platformWindow()); - } else { - // No X11 cursor control when there is no widget under the cursor - return; - } - - //qDebug() << "changeCursor" << widget << ws; - if (!w) - return; - - w->setCursor(cursor); - } -}; - - -QTestLiteIntegration::QTestLiteIntegration() -{ - - xd = new MyDisplay; - - mPrimaryScreen = new QTestLiteScreen(); - - mPrimaryScreen->mGeometry = QRect - (0, 0, xd->width, xd->height); - mPrimaryScreen->mDepth = 32; - mPrimaryScreen->mFormat = QImage::Format_RGB32; - mPrimaryScreen->mPhysicalSize = - QSize(xd->physicalWidth, xd->physicalHeight); - - mScreens.append(mPrimaryScreen); - - - (void)new MyCursor(mPrimaryScreen); - -} - -QPixmapData *QTestLiteIntegration::createPixmapData(QPixmapData::PixelType type) const -{ - return new QRasterPixmapData(type); -} - -QWindowSurface *QTestLiteIntegration::createWindowSurface(QWidget *widget, WId) const -{ - return new QTestLiteWindowSurface(mPrimaryScreen, widget); -} - - -QPlatformWindow *QTestLiteIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const -{ - return new QTestLiteWindow(this, mPrimaryScreen, widget); -} - - - -QPixmap QTestLiteIntegration::grabWindow(WId window, int x, int y, int width, int height) const -{ - QImage img = xd->grabWindow(window, x, y, width, height); - return QPixmap::fromImage(img); -} - -#ifndef QT_NO_OPENGL -bool QTestLiteIntegration::hasOpenGL() const -{ - return glXQueryExtension(xd->display, 0, 0) != 0; -} - -QPlatformGLContext * QTestLiteIntegration::createGLContext() -{ - return new QGLXGLContext(xd->display); -} - -#endif // QT_NO_OPENGL - - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qplatformintegration_testlite.h b/src/plugins/platforms/testlite/qplatformintegration_testlite.h deleted file mode 100644 index 4260faa..0000000 --- a/src/plugins/platforms/testlite/qplatformintegration_testlite.h +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSYSTEM_TESTLITE_H -#define QGRAPHICSSYSTEM_TESTLITE_H - -#include -#include - -QT_BEGIN_NAMESPACE - -class MyDisplay; - -class QTestLiteScreen : public QPlatformScreen -{ -public: - QTestLiteScreen() - : mDepth(16), mFormat(QImage::Format_RGB16) {} - ~QTestLiteScreen() {} - - QRect geometry() const { return mGeometry; } - int depth() const { return mDepth; } - QImage::Format format() const { return mFormat; } - QSize physicalSize() const { return mPhysicalSize; } - -public: - QRect mGeometry; - int mDepth; - QImage::Format mFormat; - QSize mPhysicalSize; -}; - -class QTestLiteIntegration : public QPlatformIntegration -{ -public: - QTestLiteIntegration(); - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; - QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; - - QPixmap grabWindow(WId window, int x, int y, int width, int height) const; - - QList screens() const { return mScreens; } - -#ifndef QT_NO_OPENGL - bool hasOpenGL() const; - QPlatformGLContext * createGLContext(); -#endif - - MyDisplay *xd; - -private: - QTestLiteScreen *mPrimaryScreen; - QList mScreens; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/testlite/qtestliteintegration.cpp b/src/plugins/platforms/testlite/qtestliteintegration.cpp new file mode 100644 index 0000000..6c07349 --- /dev/null +++ b/src/plugins/platforms/testlite/qtestliteintegration.cpp @@ -0,0 +1,143 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + + +#include "qtestliteintegration.h" +#include "qtestlitewindowsurface.h" +#include +#include + +#include + +#include "qtestlitewindow.h" + +#ifndef QT_NO_OPENGL +#include +#include "qglxglcontext.h" +#endif + +QT_BEGIN_NAMESPACE + +class MyCursor : QGraphicsSystemCursor +{ +public: + MyCursor(QPlatformScreen *screen) : QGraphicsSystemCursor(screen) {} + + void changeCursor(QCursor * cursor, QWidget * widget) { + QTestLiteWindow *w = 0; + if (widget) { + QWidget *window = widget->window(); + w = static_cast(window->platformWindow()); + } else { + // No X11 cursor control when there is no widget under the cursor + return; + } + + //qDebug() << "changeCursor" << widget << ws; + if (!w) + return; + + w->setCursor(cursor); + } +}; + + +QTestLiteIntegration::QTestLiteIntegration() +{ + + xd = new MyDisplay; + + mPrimaryScreen = new QTestLiteScreen(); + + mPrimaryScreen->mGeometry = QRect + (0, 0, xd->width, xd->height); + mPrimaryScreen->mDepth = 32; + mPrimaryScreen->mFormat = QImage::Format_RGB32; + mPrimaryScreen->mPhysicalSize = + QSize(xd->physicalWidth, xd->physicalHeight); + + mScreens.append(mPrimaryScreen); + + + (void)new MyCursor(mPrimaryScreen); + +} + +QPixmapData *QTestLiteIntegration::createPixmapData(QPixmapData::PixelType type) const +{ + return new QRasterPixmapData(type); +} + +QWindowSurface *QTestLiteIntegration::createWindowSurface(QWidget *widget, WId) const +{ + return new QTestLiteWindowSurface(mPrimaryScreen, widget); +} + + +QPlatformWindow *QTestLiteIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const +{ + return new QTestLiteWindow(this, mPrimaryScreen, widget); +} + + + +QPixmap QTestLiteIntegration::grabWindow(WId window, int x, int y, int width, int height) const +{ + QImage img = xd->grabWindow(window, x, y, width, height); + return QPixmap::fromImage(img); +} + +#ifndef QT_NO_OPENGL +bool QTestLiteIntegration::hasOpenGL() const +{ + return glXQueryExtension(xd->display, 0, 0) != 0; +} + +QPlatformGLContext * QTestLiteIntegration::createGLContext() +{ + return new QGLXGLContext(xd->display); +} + +#endif // QT_NO_OPENGL + + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestliteintegration.h b/src/plugins/platforms/testlite/qtestliteintegration.h new file mode 100644 index 0000000..4260faa --- /dev/null +++ b/src/plugins/platforms/testlite/qtestliteintegration.h @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_TESTLITE_H +#define QGRAPHICSSYSTEM_TESTLITE_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class MyDisplay; + +class QTestLiteScreen : public QPlatformScreen +{ +public: + QTestLiteScreen() + : mDepth(16), mFormat(QImage::Format_RGB16) {} + ~QTestLiteScreen() {} + + QRect geometry() const { return mGeometry; } + int depth() const { return mDepth; } + QImage::Format format() const { return mFormat; } + QSize physicalSize() const { return mPhysicalSize; } + +public: + QRect mGeometry; + int mDepth; + QImage::Format mFormat; + QSize mPhysicalSize; +}; + +class QTestLiteIntegration : public QPlatformIntegration +{ +public: + QTestLiteIntegration(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; + QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; + + QPixmap grabWindow(WId window, int x, int y, int width, int height) const; + + QList screens() const { return mScreens; } + +#ifndef QT_NO_OPENGL + bool hasOpenGL() const; + QPlatformGLContext * createGLContext(); +#endif + + MyDisplay *xd; + +private: + QTestLiteScreen *mPrimaryScreen; + QList mScreens; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index 108f732..49b79ec 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qwindowsurface_testlite.h" -#include "qplatformintegration_testlite.h" +#include "qtestlitewindowsurface.h" +#include "qtestliteintegration.h" #include #include "qtestlitewindow.h" diff --git a/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp b/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp new file mode 100644 index 0000000..3567118 --- /dev/null +++ b/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp @@ -0,0 +1,273 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitewindowsurface.h" +#include "qtestliteintegration.h" + +#include +#include + +#include "qtestlitewindow.h" + +# include +# include +# include + +QT_BEGIN_NAMESPACE + + +struct MyShmImageInfo { + MyShmImageInfo(Display *xdisplay) : image(0), display(xdisplay) {} + ~MyShmImageInfo() { destroy(); } + + void destroy(); + + XShmSegmentInfo shminfo; + XImage *image; + Display *display; +}; + +//void QTestLiteWindowSurface::flush() + + +#ifndef DONT_USE_MIT_SHM +void MyShmImageInfo::destroy() +{ + XShmDetach (display, &shminfo); + XDestroyImage (image); + shmdt (shminfo.shmaddr); + shmctl (shminfo.shmid, IPC_RMID, 0); +} +#endif + +void QTestLiteWindowSurface::resizeShmImage(int width, int height) +{ + MyDisplay *xd = xw->xd; + +#ifdef DONT_USE_MIT_SHM + shm_img = QImage(width, height, QImage::Format_RGB32); +#else + if (image_info) + image_info->destroy(); + else + image_info = new MyShmImageInfo(xd->display); + + Visual *visual = DefaultVisual(xd->display, xd->screen); + + + XImage *image = XShmCreateImage (xd->display, visual, 24, ZPixmap, 0, + &image_info->shminfo, width, height); + + + image_info->shminfo.shmid = shmget (IPC_PRIVATE, + image->bytes_per_line * image->height, IPC_CREAT|0777); + + image_info->shminfo.shmaddr = image->data = (char*)shmat (image_info->shminfo.shmid, 0, 0); + image_info->shminfo.readOnly = False; + + image_info->image = image; + + Status shm_attach_status = XShmAttach(xd->display, &image_info->shminfo); + + Q_ASSERT(shm_attach_status == True); + + shm_img = QImage( (uchar*) image->data, image->width, image->height, image->bytes_per_line, QImage::Format_RGB32 ); +#endif + painted = false; +} + + +void QTestLiteWindowSurface::resizeBuffer(QSize s) +{ + if (shm_img.size() != s) + resizeShmImage(s.width(), s.height()); +} + +QSize QTestLiteWindowSurface::bufferSize() const +{ + return shm_img.size(); +} + +QTestLiteWindowSurface::QTestLiteWindowSurface (QTestLiteScreen */*screen*/, QWidget *window) + : QWindowSurface(window), + painted(false), image_info(0) +{ + xw = static_cast(window->platformWindow()); + xw->windowSurface = this; +// qDebug() << "QTestLiteWindowSurface::QTestLiteWindowSurface:" << xw->window; +} + +QTestLiteWindowSurface::~QTestLiteWindowSurface() +{ + delete image_info; +} + +QPaintDevice *QTestLiteWindowSurface::paintDevice() +{ + return &shm_img; +} + + +void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + Q_UNUSED(region); + Q_UNUSED(offset); + + // qDebug() << "QTestLiteWindowSurface::flush:" << (long)this; + + if (!painted) + return; + + MyDisplay *xd = xw->xd; + GC gc = xw->gc; + Window window = xw->x_window; +#ifdef DONT_USE_MIT_SHM + // just convert the image every time... + if (!shm_img.isNull()) { + Visual *visual = DefaultVisual(xd->display, xd->screen); + + QImage image = shm_img; + //img.convertToFormat( + XImage *xi = XCreateImage(xd->display, visual, 24, ZPixmap, + 0, (char *) image.scanLine(0), image.width(), image.height(), + 32, image.bytesPerLine()); + + int x = 0; + int y = 0; + + /*int r =*/ XPutImage(xd->display, window, gc, xi, 0, 0, x, y, image.width(), image.height()); + + xi->data = 0; // QImage owns these bits + XDestroyImage(xi); + } +#else + // Use MIT_SHM + if (image_info->image) { + //qDebug() << "Here we go" << image_info->image->width << image_info->image->height; + int x = 0; + int y = 0; + + // We could set send_event to true, and then use the ShmCompletion to synchronize, + // but let's do like Qt/11 and just use XSync + XShmPutImage (xd->display, window, gc, image_info->image, 0, 0, + x, y, image_info->image->width, image_info->image->height, + /*send_event*/ False); + + XSync(xd->display, False); + } +#endif +} + +//### scroll logic copied from QRasterWindowSurface, we should make better API for this + +void copied_qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset) +{ + // make sure we don't detach + uchar *mem = const_cast(const_cast(img).bits()); + + int lineskip = img.bytesPerLine(); + int depth = img.depth() >> 3; + + const QRect imageRect(0, 0, img.width(), img.height()); + const QRect r = rect & imageRect & imageRect.translated(-offset); + const QPoint p = rect.topLeft() + offset; + + if (r.isEmpty()) + return; + + const uchar *src; + uchar *dest; + + if (r.top() < p.y()) { + src = mem + r.bottom() * lineskip + r.left() * depth; + dest = mem + (p.y() + r.height() - 1) * lineskip + p.x() * depth; + lineskip = -lineskip; + } else { + src = mem + r.top() * lineskip + r.left() * depth; + dest = mem + p.y() * lineskip + p.x() * depth; + } + + const int w = r.width(); + int h = r.height(); + const int bytes = w * depth; + + // overlapping segments? + if (offset.y() == 0 && qAbs(offset.x()) < w) { + do { + ::memmove(dest, src, bytes); + dest += lineskip; + src += lineskip; + } while (--h); + } else { + do { + ::memcpy(dest, src, bytes); + dest += lineskip; + src += lineskip; + } while (--h); + } +} + +bool QTestLiteWindowSurface::scroll(const QRegion &area, int dx, int dy) +{ + if (shm_img.isNull()) + return false; + + const QVector rects = area.rects(); + for (int i = 0; i < rects.size(); ++i) + copied_qt_scrollRectInImage(shm_img, rects.at(i), QPoint(dx, dy)); + + return true; +} + + +void QTestLiteWindowSurface::beginPaint(const QRegion ®ion) +{ + Q_UNUSED(region); + resizeBuffer(size()); +} + +void QTestLiteWindowSurface::endPaint(const QRegion ®ion) +{ + Q_UNUSED(region); + painted = true; //there is content in the buffer +} +QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestlitewindowsurface.h b/src/plugins/platforms/testlite/qtestlitewindowsurface.h new file mode 100644 index 0000000..915e7fe --- /dev/null +++ b/src/plugins/platforms/testlite/qtestlitewindowsurface.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSURFACE_TESTLITE_H +#define QWINDOWSURFACE_TESTLITE_H + +#include + + +QT_BEGIN_NAMESPACE + +class QTestLiteWindow; +class QTestLiteIntegration; +class QTestLiteScreen; +class MyShmImageInfo; + +class QTestLiteWindowSurface : public QWindowSurface +{ +public: + QTestLiteWindowSurface (QTestLiteScreen *screen, QWidget *window); + ~QTestLiteWindowSurface(); + + QPaintDevice *paintDevice(); +// void flush(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); +// void resize(const QSize &size); + bool scroll(const QRegion &area, int dx, int dy); + + void beginPaint(const QRegion ®ion); + void endPaint(const QRegion ®ion); + +private: + bool painted; + void resizeBuffer(QSize); + QSize bufferSize() const; + + + void resizeShmImage(int width, int height); + + QImage shm_img; + MyShmImageInfo *image_info; + + QTestLiteWindow *xw; + +}; + + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp b/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp deleted file mode 100644 index af10368..0000000 --- a/src/plugins/platforms/testlite/qwindowsurface_testlite.cpp +++ /dev/null @@ -1,273 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwindowsurface_testlite.h" -#include "qplatformintegration_testlite.h" - -#include -#include - -#include "qtestlitewindow.h" - -# include -# include -# include - -QT_BEGIN_NAMESPACE - - -struct MyShmImageInfo { - MyShmImageInfo(Display *xdisplay) : image(0), display(xdisplay) {} - ~MyShmImageInfo() { destroy(); } - - void destroy(); - - XShmSegmentInfo shminfo; - XImage *image; - Display *display; -}; - -//void QTestLiteWindowSurface::flush() - - -#ifndef DONT_USE_MIT_SHM -void MyShmImageInfo::destroy() -{ - XShmDetach (display, &shminfo); - XDestroyImage (image); - shmdt (shminfo.shmaddr); - shmctl (shminfo.shmid, IPC_RMID, 0); -} -#endif - -void QTestLiteWindowSurface::resizeShmImage(int width, int height) -{ - MyDisplay *xd = xw->xd; - -#ifdef DONT_USE_MIT_SHM - shm_img = QImage(width, height, QImage::Format_RGB32); -#else - if (image_info) - image_info->destroy(); - else - image_info = new MyShmImageInfo(xd->display); - - Visual *visual = DefaultVisual(xd->display, xd->screen); - - - XImage *image = XShmCreateImage (xd->display, visual, 24, ZPixmap, 0, - &image_info->shminfo, width, height); - - - image_info->shminfo.shmid = shmget (IPC_PRIVATE, - image->bytes_per_line * image->height, IPC_CREAT|0777); - - image_info->shminfo.shmaddr = image->data = (char*)shmat (image_info->shminfo.shmid, 0, 0); - image_info->shminfo.readOnly = False; - - image_info->image = image; - - Status shm_attach_status = XShmAttach(xd->display, &image_info->shminfo); - - Q_ASSERT(shm_attach_status == True); - - shm_img = QImage( (uchar*) image->data, image->width, image->height, image->bytes_per_line, QImage::Format_RGB32 ); -#endif - painted = false; -} - - -void QTestLiteWindowSurface::resizeBuffer(QSize s) -{ - if (shm_img.size() != s) - resizeShmImage(s.width(), s.height()); -} - -QSize QTestLiteWindowSurface::bufferSize() const -{ - return shm_img.size(); -} - -QTestLiteWindowSurface::QTestLiteWindowSurface (QTestLiteScreen */*screen*/, QWidget *window) - : QWindowSurface(window), - painted(false), image_info(0) -{ - xw = static_cast(window->platformWindow()); - xw->windowSurface = this; -// qDebug() << "QTestLiteWindowSurface::QTestLiteWindowSurface:" << xw->window; -} - -QTestLiteWindowSurface::~QTestLiteWindowSurface() -{ - delete image_info; -} - -QPaintDevice *QTestLiteWindowSurface::paintDevice() -{ - return &shm_img; -} - - -void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) -{ - Q_UNUSED(widget); - Q_UNUSED(region); - Q_UNUSED(offset); - - // qDebug() << "QTestLiteWindowSurface::flush:" << (long)this; - - if (!painted) - return; - - MyDisplay *xd = xw->xd; - GC gc = xw->gc; - Window window = xw->x_window; -#ifdef DONT_USE_MIT_SHM - // just convert the image every time... - if (!shm_img.isNull()) { - Visual *visual = DefaultVisual(xd->display, xd->screen); - - QImage image = shm_img; - //img.convertToFormat( - XImage *xi = XCreateImage(xd->display, visual, 24, ZPixmap, - 0, (char *) image.scanLine(0), image.width(), image.height(), - 32, image.bytesPerLine()); - - int x = 0; - int y = 0; - - /*int r =*/ XPutImage(xd->display, window, gc, xi, 0, 0, x, y, image.width(), image.height()); - - xi->data = 0; // QImage owns these bits - XDestroyImage(xi); - } -#else - // Use MIT_SHM - if (image_info->image) { - //qDebug() << "Here we go" << image_info->image->width << image_info->image->height; - int x = 0; - int y = 0; - - // We could set send_event to true, and then use the ShmCompletion to synchronize, - // but let's do like Qt/11 and just use XSync - XShmPutImage (xd->display, window, gc, image_info->image, 0, 0, - x, y, image_info->image->width, image_info->image->height, - /*send_event*/ False); - - XSync(xd->display, False); - } -#endif -} - -//### scroll logic copied from QRasterWindowSurface, we should make better API for this - -void copied_qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset) -{ - // make sure we don't detach - uchar *mem = const_cast(const_cast(img).bits()); - - int lineskip = img.bytesPerLine(); - int depth = img.depth() >> 3; - - const QRect imageRect(0, 0, img.width(), img.height()); - const QRect r = rect & imageRect & imageRect.translated(-offset); - const QPoint p = rect.topLeft() + offset; - - if (r.isEmpty()) - return; - - const uchar *src; - uchar *dest; - - if (r.top() < p.y()) { - src = mem + r.bottom() * lineskip + r.left() * depth; - dest = mem + (p.y() + r.height() - 1) * lineskip + p.x() * depth; - lineskip = -lineskip; - } else { - src = mem + r.top() * lineskip + r.left() * depth; - dest = mem + p.y() * lineskip + p.x() * depth; - } - - const int w = r.width(); - int h = r.height(); - const int bytes = w * depth; - - // overlapping segments? - if (offset.y() == 0 && qAbs(offset.x()) < w) { - do { - ::memmove(dest, src, bytes); - dest += lineskip; - src += lineskip; - } while (--h); - } else { - do { - ::memcpy(dest, src, bytes); - dest += lineskip; - src += lineskip; - } while (--h); - } -} - -bool QTestLiteWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - if (shm_img.isNull()) - return false; - - const QVector rects = area.rects(); - for (int i = 0; i < rects.size(); ++i) - copied_qt_scrollRectInImage(shm_img, rects.at(i), QPoint(dx, dy)); - - return true; -} - - -void QTestLiteWindowSurface::beginPaint(const QRegion ®ion) -{ - Q_UNUSED(region); - resizeBuffer(size()); -} - -void QTestLiteWindowSurface::endPaint(const QRegion ®ion) -{ - Q_UNUSED(region); - painted = true; //there is content in the buffer -} -QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qwindowsurface_testlite.h b/src/plugins/platforms/testlite/qwindowsurface_testlite.h deleted file mode 100644 index 915e7fe..0000000 --- a/src/plugins/platforms/testlite/qwindowsurface_testlite.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_TESTLITE_H -#define QWINDOWSURFACE_TESTLITE_H - -#include - - -QT_BEGIN_NAMESPACE - -class QTestLiteWindow; -class QTestLiteIntegration; -class QTestLiteScreen; -class MyShmImageInfo; - -class QTestLiteWindowSurface : public QWindowSurface -{ -public: - QTestLiteWindowSurface (QTestLiteScreen *screen, QWidget *window); - ~QTestLiteWindowSurface(); - - QPaintDevice *paintDevice(); -// void flush(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); -// void resize(const QSize &size); - bool scroll(const QRegion &area, int dx, int dy); - - void beginPaint(const QRegion ®ion); - void endPaint(const QRegion ®ion); - -private: - bool painted; - void resizeBuffer(QSize); - QSize bufferSize() const; - - - void resizeShmImage(int width, int height); - - QImage shm_img; - MyShmImageInfo *image_info; - - QTestLiteWindow *xw; - -}; - - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/testlite/testlite.pro b/src/plugins/platforms/testlite/testlite.pro index 8f108ae..454193d 100644 --- a/src/plugins/platforms/testlite/testlite.pro +++ b/src/plugins/platforms/testlite/testlite.pro @@ -3,8 +3,8 @@ include(../../qpluginbase.pri) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms -SOURCES = main.cpp qplatformintegration_testlite.cpp qwindowsurface_testlite.cpp qtestlitewindow.cpp -HEADERS = qplatformintegration_testlite.h qwindowsurface_testlite.h qtestlitewindow.h +SOURCES = main.cpp qtestliteintegration.cpp qtestlitewindowsurface.cpp qtestlitewindow.cpp +HEADERS = qtestliteintegration.h qtestlitewindowsurface.h qtestlitewindow.h LIBS += -lX11 -lXext diff --git a/src/plugins/platforms/vnc/main.cpp b/src/plugins/platforms/vnc/main.cpp index 23d78c1..775259b 100644 --- a/src/plugins/platforms/vnc/main.cpp +++ b/src/plugins/platforms/vnc/main.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qgraphicssystem_vnc.h" +#include "qvncintegration.h" #include #include diff --git a/src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp b/src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp deleted file mode 100644 index a872991..0000000 --- a/src/plugins/platforms/vnc/qgraphicssystem_vnc.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgraphicssystem_vnc.h" -#include "../fb_base/fb_base.h" -#include -#include -#include - -#include -#include - -#include - - -QVNCScreen::QVNCScreen() - : QFbScreen::QFbScreen() -{ - int w = 800; - int h = 600; - int ew, eh; - const char *str; - if ((str=::getenv("QT_VNC_SIZE")) && sscanf(str,"%dx%d",&ew,&eh)==2) { - w = ew; - h = eh; - } - - setGeometry(QRect(0,0,w, h)); - setDepth(32); - setFormat(QImage::Format_RGB32); - setPhysicalSize((geometry().size()*254)/720); - - - d_ptr = new QVNCScreenPrivate(this); - - cursor = new QVNCCursor(d_ptr->vncServer, this); - d_ptr->vncServer->setCursor(static_cast(cursor)); -} - -QVNCDirtyMap *QVNCScreen::dirtyMap() -{ - return d_ptr->dirty; -} - -QRegion QVNCScreen::doRedraw() -{ - QRegion touched; - touched = QFbScreen::doRedraw(); - - QVector rects = touched.rects(); - for (int i = 0; i < rects.size(); i++) - d_ptr->setDirty(rects[i]); - return touched; -} - - -QVNCIntegration::QVNCIntegration() -{ - mPrimaryScreen = new QVNCScreen(); - - mScreens.append(mPrimaryScreen); -} - -QPixmapData *QVNCIntegration::createPixmapData(QPixmapData::PixelType type) const -{ - return new QRasterPixmapData(type); -} - -// QWindowSurface *QVNCIntegration::createWindowSurface(QWidget *widget) const -// { -// if (widget->windowType() == Qt::Desktop) -// return 0; // Don't create an explicit window surface for the destkop. -// QFbWindowSurface * surface; -// surface = new QFbWindowSurface(mPrimaryScreen, widget); -// mPrimaryScreen->addWindowSurface(surface); -// return surface; -// } - -QWindowSurface *QVNCIntegration::createWindowSurface(QWidget *widget, WId) const -{ - QFbWindowSurface * surface; - surface = new QFbWindowSurface(mPrimaryScreen, widget); - return surface; -} - - -QPlatformWindow *QVNCIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const -{ - QFbWindow *w = new QFbWindow(mPrimaryScreen, widget); - mPrimaryScreen->addWindow(w); - return w; -} - diff --git a/src/plugins/platforms/vnc/qgraphicssystem_vnc.h b/src/plugins/platforms/vnc/qgraphicssystem_vnc.h deleted file mode 100644 index 524b888..0000000 --- a/src/plugins/platforms/vnc/qgraphicssystem_vnc.h +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSYSTEM_VNC_H -#define QGRAPHICSSYSTEM_VNC_H - -#include "qvnccursor.h" -#include "../fb_base/fb_base.h" -#include - -QT_BEGIN_NAMESPACE - -class QVNCServer; -class QVNCDirtyMap; - -class QVNCScreenPrivate; - -class QVNCScreen : public QFbScreen -{ -public: - QVNCScreen(); - - int linestep() const { return image() ? image()->bytesPerLine() : 0; } - uchar *base() const { return image() ? image()->bits() : 0; } - QVNCDirtyMap *dirtyMap(); - -public: - QVNCScreenPrivate *d_ptr; - -private: - QVNCServer *server; - QRegion doRedraw(); -}; - -class QVNCIntegrationPrivate; - - -class QVNCIntegration : public QPlatformIntegration -{ -public: - QVNCIntegration(); - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; - QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; - - QList screens() const { return mScreens; } - - -private: - QVNCScreen *mPrimaryScreen; - QList mScreens; -}; - - - -QT_END_NAMESPACE - -#endif //QGRAPHICSSYSTEM_VNC_H - diff --git a/src/plugins/platforms/vnc/qvnccursor.cpp b/src/plugins/platforms/vnc/qvnccursor.cpp index 78da53b..8da06aa 100644 --- a/src/plugins/platforms/vnc/qvnccursor.cpp +++ b/src/plugins/platforms/vnc/qvnccursor.cpp @@ -49,7 +49,7 @@ #include "qvnccursor.h" #include "qvncserver.h" -#include "qgraphicssystem_vnc.h" +#include "qvncintegration.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/vnc/qvncintegration.cpp b/src/plugins/platforms/vnc/qvncintegration.cpp new file mode 100644 index 0000000..7bdba35 --- /dev/null +++ b/src/plugins/platforms/vnc/qvncintegration.cpp @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qvncintegration.h" +#include "../fb_base/fb_base.h" +#include +#include +#include + +#include +#include + +#include + + +QVNCScreen::QVNCScreen() + : QFbScreen::QFbScreen() +{ + int w = 800; + int h = 600; + int ew, eh; + const char *str; + if ((str=::getenv("QT_VNC_SIZE")) && sscanf(str,"%dx%d",&ew,&eh)==2) { + w = ew; + h = eh; + } + + setGeometry(QRect(0,0,w, h)); + setDepth(32); + setFormat(QImage::Format_RGB32); + setPhysicalSize((geometry().size()*254)/720); + + + d_ptr = new QVNCScreenPrivate(this); + + cursor = new QVNCCursor(d_ptr->vncServer, this); + d_ptr->vncServer->setCursor(static_cast(cursor)); +} + +QVNCDirtyMap *QVNCScreen::dirtyMap() +{ + return d_ptr->dirty; +} + +QRegion QVNCScreen::doRedraw() +{ + QRegion touched; + touched = QFbScreen::doRedraw(); + + QVector rects = touched.rects(); + for (int i = 0; i < rects.size(); i++) + d_ptr->setDirty(rects[i]); + return touched; +} + + +QVNCIntegration::QVNCIntegration() +{ + mPrimaryScreen = new QVNCScreen(); + + mScreens.append(mPrimaryScreen); +} + +QPixmapData *QVNCIntegration::createPixmapData(QPixmapData::PixelType type) const +{ + return new QRasterPixmapData(type); +} + +// QWindowSurface *QVNCIntegration::createWindowSurface(QWidget *widget) const +// { +// if (widget->windowType() == Qt::Desktop) +// return 0; // Don't create an explicit window surface for the destkop. +// QFbWindowSurface * surface; +// surface = new QFbWindowSurface(mPrimaryScreen, widget); +// mPrimaryScreen->addWindowSurface(surface); +// return surface; +// } + +QWindowSurface *QVNCIntegration::createWindowSurface(QWidget *widget, WId) const +{ + QFbWindowSurface * surface; + surface = new QFbWindowSurface(mPrimaryScreen, widget); + return surface; +} + + +QPlatformWindow *QVNCIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const +{ + QFbWindow *w = new QFbWindow(mPrimaryScreen, widget); + mPrimaryScreen->addWindow(w); + return w; +} + diff --git a/src/plugins/platforms/vnc/qvncintegration.h b/src/plugins/platforms/vnc/qvncintegration.h new file mode 100644 index 0000000..524b888 --- /dev/null +++ b/src/plugins/platforms/vnc/qvncintegration.h @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_VNC_H +#define QGRAPHICSSYSTEM_VNC_H + +#include "qvnccursor.h" +#include "../fb_base/fb_base.h" +#include + +QT_BEGIN_NAMESPACE + +class QVNCServer; +class QVNCDirtyMap; + +class QVNCScreenPrivate; + +class QVNCScreen : public QFbScreen +{ +public: + QVNCScreen(); + + int linestep() const { return image() ? image()->bytesPerLine() : 0; } + uchar *base() const { return image() ? image()->bits() : 0; } + QVNCDirtyMap *dirtyMap(); + +public: + QVNCScreenPrivate *d_ptr; + +private: + QVNCServer *server; + QRegion doRedraw(); +}; + +class QVNCIntegrationPrivate; + + +class QVNCIntegration : public QPlatformIntegration +{ +public: + QVNCIntegration(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; + QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; + + QList screens() const { return mScreens; } + + +private: + QVNCScreen *mPrimaryScreen; + QList mScreens; +}; + + + +QT_END_NAMESPACE + +#endif //QGRAPHICSSYSTEM_VNC_H + diff --git a/src/plugins/platforms/vnc/qvncserver.h b/src/plugins/platforms/vnc/qvncserver.h index 41cadab..b1a9797 100644 --- a/src/plugins/platforms/vnc/qvncserver.h +++ b/src/plugins/platforms/vnc/qvncserver.h @@ -53,7 +53,7 @@ // We mean it. // -#include "qgraphicssystem_vnc.h" +#include "qvncintegration.h" #include "qvnccursor.h" #define QT_NO_QWS_CURSOR diff --git a/src/plugins/platforms/vnc/vnc.pro b/src/plugins/platforms/vnc/vnc.pro index b1da572..65824a2 100644 --- a/src/plugins/platforms/vnc/vnc.pro +++ b/src/plugins/platforms/vnc/vnc.pro @@ -3,8 +3,8 @@ include(../../qpluginbase.pri) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms -SOURCES = main.cpp qgraphicssystem_vnc.cpp -HEADERS = qgraphicssystem_vnc.h +SOURCES = main.cpp qvncintegration.cpp +HEADERS = qvncintegration.h HEADERS += qvncserver.h SOURCES += qvncserver.cpp -- cgit v0.12 From 535161b217a9fb5117803cbff1ddcc97242c10f3 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 22 Apr 2010 15:16:32 +0200 Subject: Avoid copying code. --- src/gui/kernel/qapplication_lite.cpp | 2 +- src/gui/painting/qwindowsurface.cpp | 8 +++- .../platforms/testlite/qtestlitewindowsurface.cpp | 52 ++-------------------- 3 files changed, 11 insertions(+), 51 deletions(-) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 867c2dc..fae7663 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -627,7 +627,7 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterface::MouseEvent * //even if we're blocked by modality, we should deliver the mouse release event.. //### this code is not completely correct: multiple buttons can be pressed simultaneously if (!(implicit_mouse_grabber && buttons == Qt::NoButton)) { - qDebug() << "modal blocked mouse event to" << tlw; + //qDebug() << "modal blocked mouse event to" << tlw; return; } } diff --git a/src/gui/painting/qwindowsurface.cpp b/src/gui/painting/qwindowsurface.cpp index 7558cad..3b542bc 100644 --- a/src/gui/painting/qwindowsurface.cpp +++ b/src/gui/painting/qwindowsurface.cpp @@ -342,7 +342,13 @@ void QWindowSurface::setPartialUpdateSupport(bool enable) d_ptr->partialUpdateSupport = enable; } -void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset) +#ifdef Q_WS_LITE +#define Q_EXPORT_SCROLLRECT Q_GUI_EXPORT +#else +#define Q_EXPORT_SCROLLRECT +#endif + +void Q_EXPORT_SCROLLRECT qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset) { // make sure we don't detach uchar *mem = const_cast(const_cast(img).bits()); diff --git a/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp b/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp index 3567118..a14a50e 100644 --- a/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp @@ -197,54 +197,8 @@ void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const #endif } -//### scroll logic copied from QRasterWindowSurface, we should make better API for this - -void copied_qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset) -{ - // make sure we don't detach - uchar *mem = const_cast(const_cast(img).bits()); - - int lineskip = img.bytesPerLine(); - int depth = img.depth() >> 3; - - const QRect imageRect(0, 0, img.width(), img.height()); - const QRect r = rect & imageRect & imageRect.translated(-offset); - const QPoint p = rect.topLeft() + offset; - - if (r.isEmpty()) - return; - - const uchar *src; - uchar *dest; - - if (r.top() < p.y()) { - src = mem + r.bottom() * lineskip + r.left() * depth; - dest = mem + (p.y() + r.height() - 1) * lineskip + p.x() * depth; - lineskip = -lineskip; - } else { - src = mem + r.top() * lineskip + r.left() * depth; - dest = mem + p.y() * lineskip + p.x() * depth; - } - - const int w = r.width(); - int h = r.height(); - const int bytes = w * depth; - - // overlapping segments? - if (offset.y() == 0 && qAbs(offset.x()) < w) { - do { - ::memmove(dest, src, bytes); - dest += lineskip; - src += lineskip; - } while (--h); - } else { - do { - ::memcpy(dest, src, bytes); - dest += lineskip; - src += lineskip; - } while (--h); - } -} +// from qwindowsurface.cpp +extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); bool QTestLiteWindowSurface::scroll(const QRegion &area, int dx, int dy) { @@ -253,7 +207,7 @@ bool QTestLiteWindowSurface::scroll(const QRegion &area, int dx, int dy) const QVector rects = area.rects(); for (int i = 0; i < rects.size(); ++i) - copied_qt_scrollRectInImage(shm_img, rects.at(i), QPoint(dx, dy)); + qt_scrollRectInImage(shm_img, rects.at(i), QPoint(dx, dy)); return true; } -- cgit v0.12 From e45139ea8ba05d25bc2ead99b6d3b495bc4f84ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 22 Apr 2010 15:26:12 +0200 Subject: Enable some faster text drawing for lighthouse when using raster --- src/gui/painting/qpaintengine_raster.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 03318de..d734deb 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -94,6 +94,8 @@ # include #elif defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) # include +#elif defined(Q_WS_LITE) +# include #endif #if defined(Q_WS_WIN64) @@ -3314,9 +3316,9 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte } #endif // Q_WS_QWS -#if (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE) +#if (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) || defined(Q_WS_LITE)) && !defined(QT_NO_FREETYPE) -#if defined(Q_WS_QWS) && !defined(QT_NO_QWS_QPF2) +#if (defined(Q_WS_QWS) || defined(Q_WS_LITE)) && !defined(QT_NO_QWS_QPF2) if (fontEngine->type() == QFontEngine::QPF2) { QFontEngine *renderingEngine = static_cast(fontEngine)->renderingEngine(); if (renderingEngine) -- cgit v0.12 From 9fd7d1dd2822a410588da6042d57ac84fb5da1c8 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Fri, 23 Apr 2010 10:19:39 +0200 Subject: Update QGLWindowSurface to reflect geometry -> size name change --- src/opengl/qwindowsurface_gl.cpp | 38 +++++++++++++++++++++++++++----------- src/opengl/qwindowsurface_gl_p.h | 6 ++++++ 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index ca88de3..d9417d9 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -414,8 +414,13 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & QWidget *parent = widget->internalWinId() ? widget : widget->nativeParentWidget(); Q_ASSERT(parent); +#if !defined(Q_WS_LITE) if (!geometry().isValid()) return; +#else + if (!size().isValid()) + return; +#endif // Needed to support native child-widgets... hijackWindow(parent); @@ -638,20 +643,31 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & } +#if !defined(Q_WS_LITE) void QGLWindowSurface::setGeometry(const QRect &rect) { QWindowSurface::setGeometry(rect); d_ptr->geometry_updated = true; } - +#else +void QGLWindowSurface::resize(const QSize &size) +{ + QWindowSurface::resize(size); + d_ptr->geometry_updated = true; +} +#endif void QGLWindowSurface::updateGeometry() { if (!d_ptr->geometry_updated) return; d_ptr->geometry_updated = false; +#ifdef Q_WS_LITE + QSize surfSize = size(); +#else + QSize surfSize = geometry().size(); +#endif - QRect rect = geometry(); hijackWindow(window()); QGLContext *ctx = reinterpret_cast(window()->d_func()->extraData()->glContext); @@ -661,19 +677,19 @@ void QGLWindowSurface::updateGeometry() { const GLenum target = GL_TEXTURE_2D; - if (rect.width() <= 0 || rect.height() <= 0) + if (surfSize.width() <= 0 || surfSize.height() <= 0) return; - if (d_ptr->size == rect.size()) + if (d_ptr->size == surfSize) return; - d_ptr->size = rect.size(); + d_ptr->size = surfSize; if (d_ptr->ctx) { #ifndef QT_OPENGL_ES_2 if (d_ptr->destructive_swap_buffers) { glBindTexture(target, d_ptr->tex_id); - glTexImage2D(target, 0, GL_RGBA, rect.width(), rect.height(), 0, GL_RGB, GL_UNSIGNED_BYTE, 0); + glTexImage2D(target, 0, GL_RGBA, surfSize.width(), surfSize.height(), 0, GL_RGB, GL_UNSIGNED_BYTE, 0); glBindTexture(target, 0); } #endif @@ -698,10 +714,10 @@ void QGLWindowSurface::updateGeometry() { if (QGLExtensions::glExtensions() & QGLExtensions::FramebufferBlit) format.setSamples(8); - d_ptr->fbo = new QGLFramebufferObject(rect.size(), format); + d_ptr->fbo = new QGLFramebufferObject(surfSize, format); if (d_ptr->fbo->isValid()) { - qDebug() << "Created Window Surface FBO" << rect.size() + qDebug() << "Created Window Surface FBO" << surfSize << "with samples" << d_ptr->fbo->format().samples(); return; } else { @@ -722,7 +738,7 @@ void QGLWindowSurface::updateGeometry() { delete d_ptr->pb; - d_ptr->pb = new QGLPixelBuffer(rect.width(), rect.height(), + d_ptr->pb = new QGLPixelBuffer(surfSize.width(), surfSize.height(), QGLFormat(QGL::SampleBuffers | QGL::StencilBuffer | QGL::DepthBuffer), qt_gl_share_widget()); @@ -732,7 +748,7 @@ void QGLWindowSurface::updateGeometry() { glGenTextures(1, &d_ptr->pb_tex_id); glBindTexture(target, d_ptr->pb_tex_id); - glTexImage2D(target, 0, GL_RGBA, rect.width(), rect.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); + glTexImage2D(target, 0, GL_RGBA, surfSize.width(), surfSize.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); glTexParameterf(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); @@ -758,7 +774,7 @@ void QGLWindowSurface::updateGeometry() { if (d_ptr->destructive_swap_buffers) { glGenTextures(1, &d_ptr->tex_id); glBindTexture(target, d_ptr->tex_id); - glTexImage2D(target, 0, GL_RGBA, rect.width(), rect.height(), 0, GL_RGB, GL_UNSIGNED_BYTE, 0); + glTexImage2D(target, 0, GL_RGBA, surfSize.width(), surfSize.height(), 0, GL_RGB, GL_UNSIGNED_BYTE, 0); glTexParameterf(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); diff --git a/src/opengl/qwindowsurface_gl_p.h b/src/opengl/qwindowsurface_gl_p.h index 8ea714c..9d17514 100644 --- a/src/opengl/qwindowsurface_gl_p.h +++ b/src/opengl/qwindowsurface_gl_p.h @@ -86,7 +86,13 @@ public: QPaintDevice *paintDevice(); void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + +#if !defined(Q_WS_LITE) void setGeometry(const QRect &rect); +#else + virtual void resize(const QSize &size); +#endif + void updateGeometry(); bool scroll(const QRegion &area, int dx, int dy); -- cgit v0.12 From 69e54ffd1796312aca2db49f19b5de92e6dab3ae Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 23 Apr 2010 15:03:19 +0200 Subject: Crash fix Make sure double-linked list invariant is maintained --- src/plugins/platforms/testlite/qtestlitewindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index 49b79ec..545912e 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -1188,6 +1188,8 @@ void MyX11Cursors::timeout() lookupMap.take(id); MyX11CursorNode * tmp = node; node = node->post(); + if (node) + node->setAnte(0); delete tmp; XFreeCursor(display, c); } -- cgit v0.12 From 1acf354a1380586a754d2a0ed546e4dceb4296cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 27 Apr 2010 10:20:35 +0200 Subject: Compile fix qegl_lite.cpp --- src/gui/egl/qegl_lite.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/gui/egl/qegl_lite.cpp b/src/gui/egl/qegl_lite.cpp index 2bbf22b..10caf46 100644 --- a/src/gui/egl/qegl_lite.cpp +++ b/src/gui/egl/qegl_lite.cpp @@ -64,6 +64,7 @@ EGLNativeWindowType QEgl::nativeWindow(QWidget* widget) EGLNativePixmapType QEgl::nativePixmap(QPixmap* pixmap) { + Q_UNUSED(pixmap); return 0; } @@ -72,13 +73,11 @@ EGLNativePixmapType QEgl::nativePixmap(QPixmap* pixmap) // return eglGetDisplay(EGLNativeDisplayType(EGL_DEFAULT_DISPLAY)); //} -static QGraphicsSystemScreen *screenForDevice(QPaintDevice *device) +static QPlatformScreen *screenForDevice(QPaintDevice *device) { - QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); - if (!gs) - return 0; + QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); - QList screens = gs->screens(); + QList screens = pi->screens(); int screenNumber; if (device && device->devType() == QInternal::Widget) @@ -97,7 +96,7 @@ void QEglProperties::setPaintDeviceFormat(QPaintDevice *dev) return; // Find the QGLScreen for this paint device. - QGraphicsSystemScreen *screen = screenForDevice(dev); + QPlatformScreen *screen = screenForDevice(dev); if (!screen) return; int devType = dev->devType(); -- cgit v0.12 From 255371252bdad3cd370ccf95337c94baae7277a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 23 Apr 2010 08:38:44 +0200 Subject: Porting openkode platform plugin to new api --- src/plugins/platforms/openkode/frag.glslf | 8 - src/plugins/platforms/openkode/frag.h | 37 --- src/plugins/platforms/openkode/main.cpp | 16 +- src/plugins/platforms/openkode/openkode.pro | 22 +- .../openkode/qgraphicssystem_openkode.cpp | 236 ------------------ .../platforms/openkode/qgraphicssystem_openkode.h | 95 -------- .../platforms/openkode/qopenkodeintegration.cpp | 227 ++++++++++++++++++ .../platforms/openkode/qopenkodeintegration.h | 95 ++++++++ src/plugins/platforms/openkode/qopenkodewindow.cpp | 114 +++++++++ src/plugins/platforms/openkode/qopenkodewindow.h | 63 +++++ .../platforms/openkode/qopenkodewindowsurface.cpp | 187 +++++++++++++++ .../platforms/openkode/qopenkodewindowsurface.h | 75 ++++++ .../platforms/openkode/qwindowsurface_openkode.cpp | 265 --------------------- .../platforms/openkode/qwindowsurface_openkode.h | 79 ------ src/plugins/platforms/openkode/resources.qrc | 6 + src/plugins/platforms/openkode/shaders/frag.glslf | 8 + src/plugins/platforms/openkode/shaders/vert.glslv | 14 ++ src/plugins/platforms/openkode/vert.glslv | 14 -- src/plugins/platforms/openkode/vert.h | 63 ----- 19 files changed, 811 insertions(+), 813 deletions(-) delete mode 100644 src/plugins/platforms/openkode/frag.glslf delete mode 100644 src/plugins/platforms/openkode/frag.h delete mode 100644 src/plugins/platforms/openkode/qgraphicssystem_openkode.cpp delete mode 100644 src/plugins/platforms/openkode/qgraphicssystem_openkode.h create mode 100644 src/plugins/platforms/openkode/qopenkodeintegration.cpp create mode 100644 src/plugins/platforms/openkode/qopenkodeintegration.h create mode 100644 src/plugins/platforms/openkode/qopenkodewindow.cpp create mode 100644 src/plugins/platforms/openkode/qopenkodewindow.h create mode 100644 src/plugins/platforms/openkode/qopenkodewindowsurface.cpp create mode 100644 src/plugins/platforms/openkode/qopenkodewindowsurface.h delete mode 100644 src/plugins/platforms/openkode/qwindowsurface_openkode.cpp delete mode 100644 src/plugins/platforms/openkode/qwindowsurface_openkode.h create mode 100644 src/plugins/platforms/openkode/resources.qrc create mode 100644 src/plugins/platforms/openkode/shaders/frag.glslf create mode 100644 src/plugins/platforms/openkode/shaders/vert.glslv delete mode 100644 src/plugins/platforms/openkode/vert.glslv delete mode 100644 src/plugins/platforms/openkode/vert.h diff --git a/src/plugins/platforms/openkode/frag.glslf b/src/plugins/platforms/openkode/frag.glslf deleted file mode 100644 index a593434..0000000 --- a/src/plugins/platforms/openkode/frag.glslf +++ /dev/null @@ -1,8 +0,0 @@ -uniform sampler2D tex_samp; - -varying vec2 texcoord_var; - -void main() -{ - gl_FragColor = texture2D(tex_samp, texcoord_var); -} diff --git a/src/plugins/platforms/openkode/frag.h b/src/plugins/platforms/openkode/frag.h deleted file mode 100644 index 6575cb5..0000000 --- a/src/plugins/platforms/openkode/frag.h +++ /dev/null @@ -1,37 +0,0 @@ -0x4e,0x56,0x75,0x63,0x01,0x00,0x00,0x00,0x09,0x00,0x06,0x00,0x06,0x00,0x50,0x00, -0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x50,0x02,0x00,0x00,0x00,0x00,0x00,0x00, -0x03,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x40,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x27,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x50,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0xe8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x0b,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x70,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x01,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x90,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x11,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xb0,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x12,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0xc0,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x23,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x2b,0x00,0x00,0x00,0x7a,0x00,0x00,0x00,0xd0,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x2c,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x03,0x68,0x69,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff, -0x00,0x00,0x00,0x80,0x04,0x00,0x00,0x90,0x00,0x02,0x01,0x82,0x04,0x02,0x02,0x82, -0x01,0x00,0x40,0xf6,0x85,0xc7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x30,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x02,0x00,0x00,0x00,0x00,0x00,0x00, -0x3a,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x2a,0x00,0x06,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0x3b,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x02,0x00,0x00,0x00,0x00,0x00,0x00, -0x49,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x26,0x00,0x04,0x00,0x00,0x00, -0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0x00,0x74,0x65,0x78,0x5f,0x73,0x61,0x6d,0x70,0x00,0x00,0x00,0x74,0x65,0x78,0x63, -0x6f,0x6f,0x72,0x64,0x5f,0x76,0x61,0x72,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 diff --git a/src/plugins/platforms/openkode/main.cpp b/src/plugins/platforms/openkode/main.cpp index e9c1083..bd2b5c7 100644 --- a/src/plugins/platforms/openkode/main.cpp +++ b/src/plugins/platforms/openkode/main.cpp @@ -39,33 +39,33 @@ ** ****************************************************************************/ -#include -#include "qgraphicssystem_openkode.h" +#include +#include "qopenkodeintegration.h" QT_BEGIN_NAMESPACE -class QOpenKODEGraphicsSystemPlugin : public QGraphicsSystemPlugin +class QOpenKODEPlugin : public QPlatformIntegrationPlugin { public: QStringList keys() const; - QGraphicsSystem *create(const QString&); + QPlatformIntegration *create(const QString&); }; -QStringList QOpenKODEGraphicsSystemPlugin::keys() const +QStringList QOpenKODEPlugin::keys() const { QStringList list; list << "OpenKODE"; return list; } -QGraphicsSystem* QOpenKODEGraphicsSystemPlugin::create(const QString& system) +QPlatformIntegration * QOpenKODEPlugin::create(const QString& system) { if (system.toLower() == "openkode") - return new QOpenKODEGraphicsSystem; + return new QOpenKODEIntegration; return 0; } -Q_EXPORT_PLUGIN2(openkode, QOpenKODEGraphicsSystemPlugin) +Q_EXPORT_PLUGIN2(openkode, QOpenKODEPlugin) QT_END_NAMESPACE diff --git a/src/plugins/platforms/openkode/openkode.pro b/src/plugins/platforms/openkode/openkode.pro index 055048d..042b74d 100644 --- a/src/plugins/platforms/openkode/openkode.pro +++ b/src/plugins/platforms/openkode/openkode.pro @@ -1,14 +1,20 @@ -TARGET = qopenkodegraphicssystem +TARGET = qopenkodeintegration include(../../qpluginbase.pri) -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms -SOURCES = main.cpp qgraphicssystem_openkode.cpp qwindowsurface_openkode.cpp -HEADERS = qgraphicssystem_openkode.h qwindowsurface_openkode.h +SOURCES = main.cpp \ + qopenkodeintegration.cpp \ + qopenkodewindowsurface.cpp \ + qopenkodewindow.cpp -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +HEADERS = qopenkodeintegration.h \ + qopenkodewindowsurface.h \ + qopenkodewindow.h + +RESOURCES = resources.qrc + +target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target -# openkode specific stuff -INCLUDEPATH += $(OPENKODE_DIR)/include -LIBS += $${QMAKE_RPATH}/$(OPENKODE_DIR)/lib-target -L$(OPENKODE_DIR)/lib-target -lKD -lEGL -lGLESv2 +LIBS += -lKD -lEGL -lGLESv2 diff --git a/src/plugins/platforms/openkode/qgraphicssystem_openkode.cpp b/src/plugins/platforms/openkode/qgraphicssystem_openkode.cpp deleted file mode 100644 index 7a07776..0000000 --- a/src/plugins/platforms/openkode/qgraphicssystem_openkode.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins 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 http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgraphicssystem_openkode.h" -#include "qwindowsurface_openkode.h" -#include - -#include -#include - -#include -#include -#include - -#include "GLES2/gl2ext.h" - - -QT_BEGIN_NAMESPACE - -QOpenKODEGraphicsSystemScreen::QOpenKODEGraphicsSystemScreen() -{ - KDDesktopNV *kdDesktop = KD_NULL; - KDDisplayNV *kdDisplay = KD_NULL; - - qDebug() << "QOpenKODEGraphicsSystemScreen::QOpenKODEGraphicsSystemScreen()"; - - // Get the default desktop and display - kdDesktop = kdGetDesktopNV(KD_DEFAULT_DESKTOP_NV, KD_NULL); - if (!kdDesktop || kdDesktop == (void*)-1) { - qErrnoWarning(kdGetError(), "Could not obtain KDDesktopNV pointer"); - return; - } - - kdDisplay = kdGetDisplayNV(KD_DEFAULT_DISPLAY_NV, KD_NULL); - if (!kdDisplay || kdDisplay == (void*)-1) { - qErrnoWarning(kdGetError(), "Could not obtain KDDisplayNV pointer"); - kdReleaseDesktopNV(kdDesktop); - return; - } - - KDDisplayModeNV mode; - if (kdGetDisplayModeNV(kdDisplay, &mode)) { - qErrnoWarning(kdGetError(), "Could not get display mode"); - return; - } - - qDebug() << " - display mode " << mode.width << "x" << mode.height << " refresh " << mode.refresh; - - KDint desktopSize[] = { mode.width, mode.height }; - - if (kdSetDesktopPropertyivNV(kdDesktop, KD_DESKTOPPROPERTY_SIZE_NV, desktopSize)) { - qErrnoWarning(kdGetError(), "Could not set desktop size"); - return; - } - - // Once we've set up the desktop and display we don't need them anymore - kdReleaseDisplayNV(kdDisplay); - kdReleaseDesktopNV(kdDesktop); - - const int defaultDpi = 72; - mGeometry = QRect(0, 0, mode.width, mode.height); - mPhysicalSize = QSize(mode.width * 25.4 / defaultDpi, mode.height * 25.4 / defaultDpi); - - mDepth = 24; - mFormat = QImage::Format_RGB888; - - - QEglProperties properties; - properties.setPixelFormat(QImage::Format_RGB888); - properties.setValue(EGL_BUFFER_SIZE, EGL_DONT_CARE); - properties.setRenderableType(QEgl::OpenGL); - - if (!mContext.chooseConfig(properties, QEgl::BestPixelFormat)) { - qWarning("qEglContext: Unable to choose config!"); - return; - } - - if (!mContext.display()) { - qWarning("qEglContext: Unable to open display!"); - return; - } - - qDebug() << " - QEglContext::openDisplay OK"; -} - -static GLuint NvKdTestLoadShaders(const char *vertex_shader_binary, - const char *fragment_shader_binary, - GLuint vertex_shader_binary_size, - GLuint fragment_shader_binary_size) -{ - GLuint prog; - GLuint vertShader; - GLuint fragShader; - - // Create the program - prog = glCreateProgram(); - - // Create the GL shader objects - vertShader = glCreateShader(GL_VERTEX_SHADER); - fragShader = glCreateShader(GL_FRAGMENT_SHADER); - - // Load the binary data into the shader objects - glShaderBinary(1, &vertShader, - GL_NVIDIA_PLATFORM_BINARY_NV, vertex_shader_binary, vertex_shader_binary_size); - glShaderBinary(1, &fragShader, - GL_NVIDIA_PLATFORM_BINARY_NV, fragment_shader_binary, fragment_shader_binary_size); - - // Attach the shaders to the program - glAttachShader(prog, vertShader); - glAttachShader(prog, fragShader); - - // Delete the shaders - glDeleteShader(vertShader); - glDeleteShader(fragShader); - - // Link and validate the shader program - glLinkProgram(prog); - glValidateProgram(prog); - - return prog; -} - -class QOpenKODEEventLoopHelper : public QThread -{ -public: - QOpenKODEEventLoopHelper(QSemaphore *m) - : eventMutex(m) - { - m->acquire(); - } - -protected: - void run() - { - qDebug() << "initializing KD"; - kdInitializeNV(); - qDebug() << "done initializing KD"; - eventMutex->release(); - - const KDEvent *event; - while ((event = kdWaitEvent(-1)) != 0) { - qDebug() << "!!! received event!"; - kdDefaultEvent(event); - } - - qDebug() << "exiting event loop"; - } - -private: - QSemaphore *eventMutex; -}; - -QOpenKODEGraphicsSystem::QOpenKODEGraphicsSystem() - : eventMutex(1) -{ - QOpenKODEEventLoopHelper *loop = new QOpenKODEEventLoopHelper(&eventMutex); - loop->start(); - eventMutex.acquire(); // block until initialization done - - mPrimaryScreen = new QOpenKODEGraphicsSystemScreen(); - - mScreens.append(mPrimaryScreen); - -} - -QPixmapData *QOpenKODEGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const -{ - return new QRasterPixmapData(type); -} - -QWindowSurface *QOpenKODEGraphicsSystem::createWindowSurface(QWidget *widget) const -{ - return new QOpenKODEWindowSurface(mPrimaryScreen, widget); -} - -GLuint QOpenKODEGraphicsSystem::blitterProgram() -{ - static GLuint shaderProgram = 0; - if (!shaderProgram) { - - const char vertShaderBinary[] = { -# include "vert.h" - }; - const char fragShaderBinary[] = { -# include "frag.h" - }; - - shaderProgram = NvKdTestLoadShaders(vertShaderBinary, fragShaderBinary, - sizeof(vertShaderBinary), sizeof(fragShaderBinary)); - - if (!shaderProgram) - qFatal("QOpenKodeGraphicsSystem(): Cannot load shaders!"); - } - return shaderProgram; -} - - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/openkode/qgraphicssystem_openkode.h b/src/plugins/platforms/openkode/qgraphicssystem_openkode.h deleted file mode 100644 index 7d73ae0..0000000 --- a/src/plugins/platforms/openkode/qgraphicssystem_openkode.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins 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 http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSYSTEM_OPENKODE_H -#define QGRAPHICSSYSTEM_OPENKODE_H - -#include - -#include -#include - -# include - -QT_BEGIN_NAMESPACE - -struct KDDesktopNV; - -class QOpenKODEGraphicsSystemScreen : public QGraphicsSystemScreen -{ -public: - QOpenKODEGraphicsSystemScreen(); - ~QOpenKODEGraphicsSystemScreen() {} - - QRect geometry() const { return mGeometry; } - int depth() const { return mDepth; } - QImage::Format format() const { return mFormat; } - QSize physicalSize() const { return mPhysicalSize; } - -public: - QRect mGeometry; - int mDepth; - QImage::Format mFormat; - QSize mPhysicalSize; - QEglContext mContext; -}; - -class QOpenKODEGraphicsSystem : public QGraphicsSystem -{ -public: - QOpenKODEGraphicsSystem(); - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; - - QList screens() const { return mScreens; } - - static GLuint blitterProgram(); - -private: - QOpenKODEGraphicsSystemScreen *mPrimaryScreen; - QList mScreens; - QSemaphore eventMutex; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.cpp b/src/plugins/platforms/openkode/qopenkodeintegration.cpp new file mode 100644 index 0000000..d9430c2 --- /dev/null +++ b/src/plugins/platforms/openkode/qopenkodeintegration.cpp @@ -0,0 +1,227 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qopenkodeintegration.h" +#include "qopenkodewindowsurface.h" +#include "qopenkodewindow.h" + +#include + +#include +#include +#include + +#include +#include +#include + +#include "GLES2/gl2ext.h" + +#include + + +QT_BEGIN_NAMESPACE + +QOpenKODEScreen::QOpenKODEScreen() +{ + KDDesktopNV *kdDesktop = KD_NULL; + KDDisplayNV *kdDisplay = KD_NULL; + + qDebug() << "QOpenKODEScreen::QOpenKODEIntegrationScreen()"; + + // Get the default desktop and display + kdDesktop = kdGetDesktopNV(KD_DEFAULT_DESKTOP_NV, KD_NULL); + if (!kdDesktop || kdDesktop == (void*)-1) { + qErrnoWarning(kdGetError(), "Could not obtain KDDesktopNV pointer"); + return; + } + + kdDisplay = kdGetDisplayNV(KD_DEFAULT_DISPLAY_NV, KD_NULL); + if (!kdDisplay || kdDisplay == (void*)-1) { + qErrnoWarning(kdGetError(), "Could not obtain KDDisplayNV pointer"); + kdReleaseDesktopNV(kdDesktop); + return; + } + + KDDisplayModeNV mode; + if (kdGetDisplayModeNV(kdDisplay, &mode)) { + qErrnoWarning(kdGetError(), "Could not get display mode"); + return; + } + + qDebug() << " - display mode " << mode.width << "x" << mode.height << " refresh " << mode.refresh; + + KDint desktopSize[] = { mode.width, mode.height }; + + if (kdSetDesktopPropertyivNV(kdDesktop, KD_DESKTOPPROPERTY_SIZE_NV, desktopSize)) { + qErrnoWarning(kdGetError(), "Could not set desktop size"); + return; + } + + // Once we've set up the desktop and display we don't need them anymore + kdReleaseDisplayNV(kdDisplay); + kdReleaseDesktopNV(kdDesktop); + + const int defaultDpi = 72; + mGeometry = QRect(0, 0, mode.width, mode.height); + mPhysicalSize = QSize(mode.width * 25.4 / defaultDpi, mode.height * 25.4 / defaultDpi); + + mDepth = 24; + mFormat = QImage::Format_RGB32; +} + +static GLuint loadShaders(const QString &vertexShader, const QString &fragmentShader) +{ + GLuint prog = 0; + GLuint vertShader; + GLuint fragShader; + + // Create the program + prog = glCreateProgram(); + + // Create the GL shader objects + vertShader = glCreateShader(GL_VERTEX_SHADER); + fragShader = glCreateShader(GL_FRAGMENT_SHADER); + + // Load shader sources into GL and compile + QFile vertexFile(vertexShader); + vertexFile.open(QFile::ReadOnly); + QByteArray vertSource = vertexFile.readAll(); + const char *vertChar = vertSource.constData(); + int vertSize = vertSource.size(); + + QFile fragFile(fragmentShader); + fragFile.open(QFile::ReadOnly); + QByteArray fragSource = fragFile.readAll(); + const char *fragChar = fragSource.constData(); + int fragSize = fragSource.size(); + + glShaderSource(vertShader, 1, (const char**)&vertChar, &vertSize); + glCompileShader(vertShader); + + glShaderSource(fragShader, 1, (const char**)&fragChar, &fragSize); + glCompileShader(fragShader); + + // Attach the shaders to the program + glAttachShader(prog, vertShader); + glAttachShader(prog, fragShader); + + // Delete the shaders + glDeleteShader(vertShader); + glDeleteShader(fragShader); + + // Link and validate the shader program + glLinkProgram(prog); + glValidateProgram(prog); + + return prog; +} + +class QOpenKODEEventLoopHelper : public QThread +{ +public: + QOpenKODEEventLoopHelper(QSemaphore *m) + : eventMutex(m) + { + m->acquire(); + } + +protected: + void run() + { + if (kdInitializeNV() == KD_ENOTINITIALIZED) { + qFatal("Did not manage to initialize openkode"); + } + eventMutex->release(); + + const KDEvent *event; + while ((event = kdWaitEvent(-1)) != 0) { + qDebug() << "!!! received event!"; + kdDefaultEvent(event); + } + } + +private: + QSemaphore *eventMutex; +}; + +QOpenKODEIntegration::QOpenKODEIntegration() + : eventMutex(1) +{ + QOpenKODEEventLoopHelper *loop = new QOpenKODEEventLoopHelper(&eventMutex); + loop->start(); + eventMutex.acquire(); // block until initialization done + + QOpenKODEScreen *mPrimaryScreen = new QOpenKODEScreen(); + + mScreens.append(mPrimaryScreen); + +} + +QPixmapData *QOpenKODEIntegration::createPixmapData(QPixmapData::PixelType type) const +{ + return new QRasterPixmapData(type); +} + +QPlatformWindow *QOpenKODEIntegration::createPlatformWindow(QWidget *tlw, WId ) const +{ + return new QOpenKODEWindow(tlw); +} + +QWindowSurface *QOpenKODEIntegration::createWindowSurface(QWidget *widget, WId winId) const +{ + return new QOpenKODEWindowSurface(widget,winId); +} + +GLuint QOpenKODEIntegration::blitterProgram() +{ + static GLuint shaderProgram = 0; + if (!shaderProgram) { + + shaderProgram = loadShaders(":/shaders/vert.glslv",":/shaders/frag.glslf"); + if (!shaderProgram) + qFatal("QOpenKodeGraphicsSystem(): Cannot load shaders!"); + } + return shaderProgram; +} + + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.h b/src/plugins/platforms/openkode/qopenkodeintegration.h new file mode 100644 index 0000000..76ce219 --- /dev/null +++ b/src/plugins/platforms/openkode/qopenkodeintegration.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_OPENKODE_H +#define QGRAPHICSSYSTEM_OPENKODE_H + +#include + +#include +#include +#include + +# include + +QT_BEGIN_NAMESPACE + +struct KDDesktopNV; + +class QOpenKODEScreen : public QPlatformScreen +{ +public: + QOpenKODEScreen(); + ~QOpenKODEScreen() {} + + QRect geometry() const { return mGeometry; } + int depth() const { return mDepth; } + QImage::Format format() const { return mFormat; } + QSize physicalSize() const { return mPhysicalSize; } + +public: + QRect mGeometry; + int mDepth; + QImage::Format mFormat; + QSize mPhysicalSize; +}; + +class QOpenKODEIntegration : public QPlatformIntegration +{ +public: + QOpenKODEIntegration(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; + QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; + + virtual QList screens() const { return mScreens; } + + static GLuint blitterProgram(); + +private: + QList mScreens; + QSemaphore eventMutex; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/openkode/qopenkodewindow.cpp b/src/plugins/platforms/openkode/qopenkodewindow.cpp new file mode 100644 index 0000000..8e1527c --- /dev/null +++ b/src/plugins/platforms/openkode/qopenkodewindow.cpp @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "qopenkodewindow.h" + +#include + +#include +#include +#include + +QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) + : QPlatformWindow(tlw) +{ + /* Initialize EGL display */ + EGLBoolean rvbool = eglInitialize(QEgl::display(), KD_NULL, KD_NULL); + if (!rvbool) { + kdLogMessage("EGL failed to initialize display\n"); + } + + kdWindow = kdCreateWindow(QEgl::display(), + QEgl::defaultConfig(QInternal::Widget,QEgl::OpenGL,QEgl::Renderable), + KD_NULL); + if (!kdWindow) { + qErrnoWarning(kdGetError(), "Error creating native window"); + return; + } + + const KDint windowSize[2] = { tlw->width(), tlw->height() }; + if (kdSetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) { + qErrnoWarning(kdGetError(), "Could not set native window size"); + return; + } + +// const KDboolean windowExclusive[] = { false }; +// if (kdSetWindowPropertybv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_EXCLUSIVE_NV, windowExclusive)) { +// qErrnoWarning(kdGetError(), "Could not set exclusive bit"); +// //return; +// } +// +// const KDint windowPos[2] = { tlw->x(), tlw->y() }; +// if (kdSetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { +// qErrnoWarning(kdGetError(), "Could not set native window position"); +// return; +// } + + if (kdRealizeWindow(kdWindow, &eglWindow)) { + qErrnoWarning(kdGetError(), "Could not realize native window"); + return; + } +} + +void QOpenKODEWindow::setGeometry(const QRect &rect) +{ + const QRect geo = geometry(); + if (geo.size() != rect.size()) { + const KDint windowSize[2] = { rect.width(), rect.height() }; + if (kdSetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) { + qErrnoWarning(kdGetError(), "Could not set native window size"); + //return; + } + } + +// if (geo.topLeft() != rect.topLeft()) { +// const KDint windowPos[2] = { rect.x(), rect.y() }; +// if (kdSetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { +// qErrnoWarning(kdGetError(), "Could not set native window position"); +// //return; +// } +// } + +} + +void QOpenKODEWindow::setVisible(bool visible) +{ + +} diff --git a/src/plugins/platforms/openkode/qopenkodewindow.h b/src/plugins/platforms/openkode/qopenkodewindow.h new file mode 100644 index 0000000..b52f8e6 --- /dev/null +++ b/src/plugins/platforms/openkode/qopenkodewindow.h @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QOPENKODEWINDOW_H +#define QOPENKODEWINDOW_H + +#include + +#include + +class QOpenKODEWindow : public QPlatformWindow +{ +public: + QOpenKODEWindow(QWidget *tlw); + + void setGeometry(const QRect &rect); + void setVisible(bool visible); + WId winId() const { return WId(eglWindow); } + +private: + struct KDWindow *kdWindow; + EGLNativeWindowType eglWindow; +}; + +#endif //QOPENKODEWINDOW_H diff --git a/src/plugins/platforms/openkode/qopenkodewindowsurface.cpp b/src/plugins/platforms/openkode/qopenkodewindowsurface.cpp new file mode 100644 index 0000000..5eb0d2d --- /dev/null +++ b/src/plugins/platforms/openkode/qopenkodewindowsurface.cpp @@ -0,0 +1,187 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qopenkodewindowsurface.h" +#include "qopenkodeintegration.h" + +#include "qopenkodewindow.h" + +#include + +QT_BEGIN_NAMESPACE + +QOpenKODEWindowSurface::QOpenKODEWindowSurface + (QWidget *window, WId winId) + : QWindowSurface(window), + mSurface(EGL_NO_SURFACE), + mWin((EGLNativeWindowType) winId) +{ + EGLConfig config = QEgl::defaultConfig(QInternal::Widget,QEgl::OpenGL,QEgl::Renderable); + mContext.setConfig(config); + if (!mContext.createContext()) { + qWarning("QOpenKODEWindowSurface: Unable to create context"); + return; + } +} + +QOpenKODEWindowSurface::~QOpenKODEWindowSurface() +{ +} + +QPaintDevice *QOpenKODEWindowSurface::paintDevice() +{ + return &mImage; +} + +// ### TODO - this updates the entire toplevel, should only update the region +void QOpenKODEWindowSurface::flush(QWidget *, const QRegion ®ion, const QPoint &offset) +{ + mContext.makeCurrent(mSurface); + + if (!offset.isNull()) { + qWarning("Offset flushing not supported yet"); + return; + } + + if (!mContext.makeCurrent(mSurface)) { + qWarning("EGL couldn't make context/surface current: 0x%x", eglGetError()); + return; + } + + QRect boundingRect = region.boundingRect(); + + int x, y, w, h; + QImage blitImage; + if (true || boundingRect == mImage.rect()) { // TODO - check optimization + blitImage = mImage; + x = y = 0; + w = mImage.width(); + h = mImage.height(); + } else { + blitImage = mImage.copy(boundingRect); + w = boundingRect.width(); + h = boundingRect.height(); + x = boundingRect.x(); + y = boundingRect.y(); + } + +// qDebug() << "flush" << widget << offset << region.boundingRect() << mImage.format() << blitImage.format(); + + GLuint shaderProgram = QOpenKODEIntegration::blitterProgram(); + + glUseProgram(shaderProgram); + + GLuint index = glGetUniformLocation(shaderProgram, "window"); + glUniform2f(index, GLfloat(mImage.width()), GLfloat(mImage.height())); + + // attributes + GLuint posId = glGetAttribLocation(shaderProgram, "pos_attr"); + GLuint texcoordId = glGetAttribLocation(shaderProgram, "texcoord_attr"); + + // sampler + index = glGetUniformLocation(shaderProgram, "tex_samp"); + + glUniform1i(index, 0); + + glDisable(GL_DEPTH_TEST); + glActiveTexture(GL_TEXTURE0); + + GLuint texId; + GLfloat coords[8] = {x, y, x, y + h, x + w, y + h, x + w, y }; + GLfloat texcoords[8] = { 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0 }; + + // Generate texture for checkered background + glGenTextures(1, &texId); + glBindTexture(GL_TEXTURE_2D, texId); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, blitImage.bits()); + + // Enable vertex attribute associated with vertex position + glEnableVertexAttribArray(posId); + glEnableVertexAttribArray(texcoordId); + + // Set the quad vertices + glVertexAttribPointer(posId, 2, GL_FLOAT, 0, 0, coords); + glVertexAttribPointer(texcoordId, 2, GL_FLOAT, 0, 0, texcoords); + + // Draw the quad + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + + // Cleanup + glDisableVertexAttribArray(posId); + glDisableVertexAttribArray(texcoordId); + + // Release all textures + glBindTexture(GL_TEXTURE_2D, 0); + if (texId) + glDeleteTextures(1, &texId); + + mContext.swapBuffers(mSurface); + mContext.doneCurrent(); +} + +void QOpenKODEWindowSurface::resize(const QSize &size) +{ + QWindowSurface::resize(size); + mContext.destroySurface(mSurface); + mSurface = EGL_NO_SURFACE; + mImage = QImage(); + +} +void QOpenKODEWindowSurface::beginPaint(const QRegion ®ion) +{ + if (mSurface == EGL_NO_SURFACE) { + EGLConfig config = QEgl::defaultConfig(QInternal::Widget,QEgl::OpenGL,QEgl::Renderable); + EGLint windowAttrs[] = { EGL_NONE }; + mSurface = eglCreateWindowSurface(QEgl::display(), config, mWin, windowAttrs); + mImage = QImage(size(),QImage::Format_RGB32); + } +} + +void QOpenKODEWindowSurface::endPaint(const QRegion ®ion) +{ + Q_UNUSED(region); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/openkode/qopenkodewindowsurface.h b/src/plugins/platforms/openkode/qopenkodewindowsurface.h new file mode 100644 index 0000000..568dbc2 --- /dev/null +++ b/src/plugins/platforms/openkode/qopenkodewindowsurface.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSURFACE_OPENKODE_H +#define QWINDOWSURFACE_OPENKODE_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QOpenKODEWindow; + +class QOpenKODEWindowSurface : public QWindowSurface +{ +public: + QOpenKODEWindowSurface + (QWidget *window, WId winId); + ~QOpenKODEWindowSurface(); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void resize (const QSize &size); + + void beginPaint(const QRegion ®ion); + void endPaint(const QRegion ®ion); + +private: + QImage mImage; + EGLSurface mSurface; + QEglContext mContext; + EGLNativeWindowType mWin; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/openkode/qwindowsurface_openkode.cpp b/src/plugins/platforms/openkode/qwindowsurface_openkode.cpp deleted file mode 100644 index b3f3965..0000000 --- a/src/plugins/platforms/openkode/qwindowsurface_openkode.cpp +++ /dev/null @@ -1,265 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG 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 http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwindowsurface_openkode.h" -#include "qgraphicssystem_openkode.h" -#include - -#include "KD/kd.h" -#include "KD/NV_display.h" - -QT_BEGIN_NAMESPACE - -QOpenKODEWindowSurface::QOpenKODEWindowSurface - (QOpenKODEGraphicsSystemScreen *screen, QWidget *window) - : QWindowSurface(window), - mScreen(screen), - mSurface(0) -{ - qDebug() << "QOpenKODEWindowSurface::QOpenKODEWindowSurface:" << window << window->width() << "x" << window->height() - << "pos" << window->x() << "x" << window->y(); - - if (!mContext.display()) { - qWarning("qEglContext: Unable to open display!"); - return; - } - - QEglProperties properties; - properties.setPixelFormat(QImage::Format_RGB888); - properties.setValue(EGL_BUFFER_SIZE, EGL_DONT_CARE); - properties.setRenderableType(QEgl::OpenGL); - - if (!mContext.chooseConfig(properties, QEgl::BestPixelFormat)) { - qWarning("qEglContext: Unable to choose config!"); - return; - } - - createWindow(window); -} - -void QOpenKODEWindowSurface::createWindow(QWidget *window) -{ - qDebug() << "createWindow"; - kdWindow = kdCreateWindow(mContext.display(), mContext.config(), KD_NULL); - - if (!kdWindow) { - qErrnoWarning(kdGetError(), "Error creating native window"); - return; - } - - const KDint windowSize[2] = { window->width(), window->height() }; - if (kdSetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) { - qErrnoWarning(kdGetError(), "Could not set native window size"); - return; - } - - //const KDboolean windowExclusive[] = { false }; - //if (kdSetWindowPropertybv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_EXCLUSIVE_NV, windowExclusive)) { - // qErrnoWarning(kdGetError(), "Could not set exclusive bit"); - // //return; - //} - - //const KDint windowPos[2] = { window->x(), window->y() }; - //if (kdSetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { - // qErrnoWarning(kdGetError(), "Could not set native window position"); - // //return; - //} - - EGLNativeWindowType nativeWindow; - - if (kdRealizeWindow(kdWindow, &nativeWindow)) { - qErrnoWarning(kdGetError(), "Could not realize native window"); - return; - } - qDebug() << "kdRealizeWindow" << nativeWindow; - - // Create an EGL window surface for the native window - EGLint windowAttrs[3] = { EGL_NONE }; - qDebug() << "doing createwindowsurface"; - *mSurface = eglCreateWindowSurface(mContext.display(), - mContext.config(), - nativeWindow, - windowAttrs); - qDebug() << "create windowsurface"; - if (!mSurface) { - qWarning("EGL couldn't create window surface: 0x%x", eglGetError()); - return; - } - - qDebug() << "making context"; - if (!mContext.createContext()) { - qDebug() << "Unable to create context!"; - return; - } - - qDebug() << "about to make current"; - mContext.makeCurrent(mSurface); -} - -QOpenKODEWindowSurface::~QOpenKODEWindowSurface() -{ -} - -QPaintDevice *QOpenKODEWindowSurface::paintDevice() -{ - qDebug() << "QOpenKODEWindowSurface::paintDevice"; - return &mImage; -} - -// ### TODO - this updates the entire toplevel, should only update the region -void QOpenKODEWindowSurface::flush(QWidget *, const QRegion ®ion, const QPoint &offset) -{ - qDebug() << "in flush"; - if (!offset.isNull()) { - qWarning("Offset flushing not supported yet"); - return; - } - - if (!mContext.makeCurrent(mSurface)) { - qWarning("EGL couldn't make context/surface current: 0x%x", eglGetError()); - return; - } - - QRect boundingRect = region.boundingRect(); - - int x, y, w, h; - QImage blitImage; - if (true || boundingRect == mImage.rect()) { // TODO - check optimization - blitImage = mImage; - x = y = 0; - w = mImage.width(); - h = mImage.height(); - } else { - blitImage = mImage.copy(boundingRect); - w = boundingRect.width(); - h = boundingRect.height(); - x = boundingRect.x(); - y = boundingRect.y(); - } - -// qDebug() << "flush" << widget << offset << region.boundingRect() << mImage.format() << blitImage.format(); - - GLuint shaderProgram = QOpenKODEGraphicsSystem::blitterProgram(); - - glUseProgram(shaderProgram); - - GLuint index = glGetUniformLocation(shaderProgram, "window"); - glUniform2f(index, GLfloat(mImage.width()), GLfloat(mImage.height())); - - // attributes - GLuint posId = glGetAttribLocation(shaderProgram, "pos_attr"); - GLuint texcoordId = glGetAttribLocation(shaderProgram, "texcoord_attr"); - - // sampler - index = glGetUniformLocation(shaderProgram, "tex_samp"); - - glUniform1i(index, 0); - - glDisable(GL_DEPTH_TEST); - glActiveTexture(GL_TEXTURE0); - - GLuint texId; - GLfloat coords[8] = {x, y, x, y + h, x + w, y + h, x + w, y }; - GLfloat texcoords[8] = { 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0 }; - - // Generate texture for checkered background - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - glGenTextures(1, &texId); - glBindTexture(GL_TEXTURE_2D, texId); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, blitImage.bits()); - - // Enable vertex attribute associated with vertex position - glEnableVertexAttribArray(posId); - glEnableVertexAttribArray(texcoordId); - - // Set the quad vertices - glVertexAttribPointer(posId, 2, GL_FLOAT, 0, 0, coords); - glVertexAttribPointer(texcoordId, 2, GL_FLOAT, 0, 0, texcoords); - - // Draw the quad - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - - // Cleanup - glDisableVertexAttribArray(posId); - glDisableVertexAttribArray(texcoordId); - - // Release all textures - glBindTexture(GL_TEXTURE_2D, 0); - if (texId) - glDeleteTextures(1, &texId); - - mContext.doneCurrent(); - mContext.swapBuffers(mSurface); -} - -void QOpenKODEWindowSurface::setGeometry(const QRect &rect) -{ - qDebug() << "QOpenKODEWindowSurface::setGeometry:" << rect; - QWindowSurface::setGeometry(rect); - if (mImage.size() != rect.size()) - mImage = QImage(rect.size(), mScreen->format()); - - mContext.destroySurface(mSurface); - kdDestroyWindow(kdWindow); - createWindow(window()); - qDebug() << "set geometry workded"; -} - -bool QOpenKODEWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - return QWindowSurface::scroll(area, dx, dy); -} - -void QOpenKODEWindowSurface::beginPaint(const QRegion ®ion) -{ - Q_UNUSED(region); -} - -void QOpenKODEWindowSurface::endPaint(const QRegion ®ion) -{ - Q_UNUSED(region); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/openkode/qwindowsurface_openkode.h b/src/plugins/platforms/openkode/qwindowsurface_openkode.h deleted file mode 100644 index bee94a5..0000000 --- a/src/plugins/platforms/openkode/qwindowsurface_openkode.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG 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 http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_OPENKODE_H -#define QWINDOWSURFACE_OPENKODE_H - -#include -#include - -QT_BEGIN_NAMESPACE - -class QOpenKODEGraphicsSystemScreen; - -class QOpenKODEWindowSurface : public QWindowSurface -{ -public: - QOpenKODEWindowSurface - (QOpenKODEGraphicsSystemScreen *screen, QWidget *window); - ~QOpenKODEWindowSurface(); - - QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void setGeometry(const QRect &rect); - bool scroll(const QRegion &area, int dx, int dy); - - void beginPaint(const QRegion ®ion); - void endPaint(const QRegion ®ion); - -private: - QOpenKODEGraphicsSystemScreen *mScreen; - QImage mImage; - struct KDWindow *kdWindow; - EGLSurface *mSurface; - QEglContext mContext; - - void createWindow(QWidget *window); -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/openkode/resources.qrc b/src/plugins/platforms/openkode/resources.qrc new file mode 100644 index 0000000..dbb3419 --- /dev/null +++ b/src/plugins/platforms/openkode/resources.qrc @@ -0,0 +1,6 @@ + + + shaders/vert.glslv + shaders/frag.glslf + + diff --git a/src/plugins/platforms/openkode/shaders/frag.glslf b/src/plugins/platforms/openkode/shaders/frag.glslf new file mode 100644 index 0000000..ed360fe --- /dev/null +++ b/src/plugins/platforms/openkode/shaders/frag.glslf @@ -0,0 +1,8 @@ +uniform sampler2D tex_samp; + +varying vec2 texcoord_var; + +void main(void) +{ + gl_FragColor = texture2D(tex_samp, texcoord_var); +} diff --git a/src/plugins/platforms/openkode/shaders/vert.glslv b/src/plugins/platforms/openkode/shaders/vert.glslv new file mode 100644 index 0000000..57b5866 --- /dev/null +++ b/src/plugins/platforms/openkode/shaders/vert.glslv @@ -0,0 +1,14 @@ +uniform vec2 window; // window size + +// Per-vertex attributes] +attribute vec2 pos_attr; +attribute vec2 texcoord_attr; + +// Output vertex color +varying vec2 texcoord_var; + +void main() +{ + gl_Position = vec4( (2.0 * pos_attr / window -1.0) * vec2(1.0, -1.0), 0.0, 1.0); + texcoord_var = texcoord_attr; +} diff --git a/src/plugins/platforms/openkode/vert.glslv b/src/plugins/platforms/openkode/vert.glslv deleted file mode 100644 index 57b5866..0000000 --- a/src/plugins/platforms/openkode/vert.glslv +++ /dev/null @@ -1,14 +0,0 @@ -uniform vec2 window; // window size - -// Per-vertex attributes] -attribute vec2 pos_attr; -attribute vec2 texcoord_attr; - -// Output vertex color -varying vec2 texcoord_var; - -void main() -{ - gl_Position = vec4( (2.0 * pos_attr / window -1.0) * vec2(1.0, -1.0), 0.0, 1.0); - texcoord_var = texcoord_attr; -} diff --git a/src/plugins/platforms/openkode/vert.h b/src/plugins/platforms/openkode/vert.h deleted file mode 100644 index bdf564d..0000000 --- a/src/plugins/platforms/openkode/vert.h +++ /dev/null @@ -1,63 +0,0 @@ -0x4e,0x56,0x75,0x63,0x01,0x00,0x00,0x00,0x0a,0x00,0x06,0x00,0x06,0x00,0x50,0x00, -0x01,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0xf0,0x03,0x00,0x00,0x00,0x00,0x00,0x00, -0x03,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x60,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x24,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x70,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x26,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x90,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0xe8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x06,0x00,0x00,0x00,0x48,0x00,0x00,0x00,0xb0,0x01,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x28,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00, -0x05,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x10,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x20,0x02,0x00,0x00,0x00,0x00,0x00,0x00, -0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x01,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x30,0x02,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x23,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x2b,0x00,0x00,0x00,0x39,0x01,0x00,0x00,0xb0,0x02,0x00,0x00,0x00,0x00,0x00,0x00, -0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x30,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x04,0x05,0x08,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x0f,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x01,0x02,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0xff,0xff,0xff,0xff,0x04,0x05,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x80,0x3f,0x00,0x00,0x00,0x40,0x00,0x00,0x80,0xbf,0x00,0x00,0x00,0x00, -0x05,0x00,0x00,0x10,0x80,0xc7,0x00,0x24,0x05,0x02,0x00,0x10,0x80,0xc7,0x00,0x24, -0x01,0x02,0x81,0xc0,0x80,0x07,0x60,0x00,0x05,0x02,0x00,0x90,0x80,0x07,0x00,0x00, -0x09,0x00,0x01,0xe1,0x80,0x87,0x40,0x00,0x05,0x00,0x00,0x10,0x80,0xc7,0x00,0x24, -0x01,0x00,0x81,0xc0,0x80,0x07,0x60,0x00,0x09,0x04,0x00,0xa0,0x80,0x47,0x00,0xe4, -0x05,0x02,0x00,0x90,0x80,0x07,0x00,0x00,0x05,0x04,0x00,0x10,0x88,0xc7,0x03,0x04, -0x01,0x00,0x01,0xe1,0x88,0x87,0x40,0x00,0x09,0xf8,0x00,0x10,0x88,0xc7,0x03,0x04, -0x0d,0x00,0x00,0x10,0x88,0xc7,0x40,0x24,0x11,0x04,0x00,0x10,0x88,0xc7,0x23,0x04, -0x15,0x06,0x00,0x10,0x89,0xc7,0x23,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0xa0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xa1,0x03,0x00,0x00,0x00,0x00,0x00,0x00, -0xad,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x00,0x28,0x00,0x02,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00, -0xb6,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xb7,0x03,0x00,0x00,0x00,0x00,0x00,0x00, -0xbe,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x26,0x00,0x05,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0xbf,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x03,0x00,0x00,0x00,0x00,0x00,0x00, -0xc9,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x26,0x00,0x01,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0xca,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xcb,0x03,0x00,0x00,0x00,0x00,0x00,0x00, -0xd9,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x26,0x00,0x01,0x00,0x00,0x00, -0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0xda,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xdb,0x03,0x00,0x00,0x00,0x00,0x00,0x00, -0xe8,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x26,0x00,0x02,0x00,0x00,0x00, -0x04,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, -0x00,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x50,0x4f,0x53, -0x49,0x54,0x49,0x4f,0x4e,0x00,0x00,0x77,0x69,0x6e,0x64,0x6f,0x77,0x00,0x00,0x00, -0x70,0x6f,0x73,0x5f,0x61,0x74,0x74,0x72,0x00,0x00,0x00,0x74,0x65,0x78,0x63,0x6f, -0x6f,0x72,0x64,0x5f,0x61,0x74,0x74,0x72,0x00,0x00,0x00,0x74,0x65,0x78,0x63,0x6f, -0x6f,0x72,0x64,0x5f,0x76,0x61,0x72,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 -- cgit v0.12 From dbc2f9202688c56495b3f6d8cd3b977a9ae69a80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 29 Apr 2010 08:45:28 +0200 Subject: Compile with QT_NO_FSFILEENGINE. --- src/gui/dialogs/qfileinfogatherer_p.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/dialogs/qfileinfogatherer_p.h b/src/gui/dialogs/qfileinfogatherer_p.h index 5abcd94..4fe691e 100644 --- a/src/gui/dialogs/qfileinfogatherer_p.h +++ b/src/gui/dialogs/qfileinfogatherer_p.h @@ -84,10 +84,13 @@ public: && permissions() == fileInfo.permissions(); } +#ifndef QT_NO_FSFILEENGINE bool isCaseSensitive() const { QFSFileEngine fe(mFileInfo.absoluteFilePath()); return fe.caseSensitive(); } +#endif + QFile::Permissions permissions() const { return mFileInfo.permissions(); } -- cgit v0.12 From 4a7c8a2c12d5a1df34d1ae921e0ee709e2e0a904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 29 Apr 2010 08:49:03 +0200 Subject: Compile with QT_NO_CURSOR. --- src/gui/kernel/qwidget_lite.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index ee1a582..64fb6f7 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -686,6 +686,7 @@ void QWidgetPrivate::setModal_sys() { } +#ifndef QT_NO_CURSOR void qt_lite_set_cursor(QWidget * w, bool force) { static QPointer lastUnderMouse = 0; @@ -732,4 +733,6 @@ void qt_lite_set_cursor(QWidget * w, bool force) QCursor c = w->cursor(); cursor->changeCursor(&c, w); } +#endif //QT_NO_CURSOR + QT_END_NAMESPACE -- cgit v0.12 From d8a7d478681eaa6d92b70e3836eddc0fd52e79ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 29 Apr 2010 08:51:28 +0200 Subject: Compile with QT_NO_QWS_INPUTMETHODS --- src/gui/kernel/qapplication_lite.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index fae7663..f9e4242 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -447,6 +447,7 @@ static void init_plugins(const QList pluginList) } } +#ifndef QT_NO_QWS_INPUTMETHODS class QDummyInputContext : public QInputContext { public: @@ -459,6 +460,7 @@ public: bool isComposing() const { return false; } }; +#endif // QT_NO_QWS_INPUTMETHODS void qt_init(QApplicationPrivate *priv, int type) { -- cgit v0.12 From 385d2d14bc7994c3abb1de11dacf9a81eea01d4a Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 27 Apr 2010 15:59:50 +0200 Subject: Add QPlatformGLWidgetSurface to GL integrtation This class is a way to for the GL platform integration to track the movement and resizing of a QGLWidget with respect to the top-level. Most platform implementations will seperate the surface from the context anyway, so this is a natural abstraction. --- src/gui/kernel/qplatformintegration_lite.cpp | 2 +- src/gui/kernel/qplatformintegration_lite.h | 3 +- src/opengl/qgl.h | 9 ++ src/opengl/qgl_lite.cpp | 47 ++++--- src/opengl/qgl_p.h | 4 +- src/opengl/qglplatformintegration_lite.h | 26 ++-- src/plugins/platforms/testlite/qglxglcontext.cpp | 150 --------------------- src/plugins/platforms/testlite/qglxglcontext.h | 73 ---------- src/plugins/platforms/testlite/qglxintegration.cpp | 150 +++++++++++++++++++++ src/plugins/platforms/testlite/qglxintegration.h | 73 ++++++++++ 10 files changed, 283 insertions(+), 254 deletions(-) delete mode 100644 src/plugins/platforms/testlite/qglxglcontext.cpp delete mode 100644 src/plugins/platforms/testlite/qglxglcontext.h create mode 100644 src/plugins/platforms/testlite/qglxintegration.cpp create mode 100644 src/plugins/platforms/testlite/qglxintegration.h diff --git a/src/gui/kernel/qplatformintegration_lite.cpp b/src/gui/kernel/qplatformintegration_lite.cpp index 3fa874c..2d181f1 100644 --- a/src/gui/kernel/qplatformintegration_lite.cpp +++ b/src/gui/kernel/qplatformintegration_lite.cpp @@ -67,7 +67,7 @@ QPlatformGLContext * QPlatformIntegration::createGLContext() return 0; } -QPlatformGLWidgetSurface * QPlatformIntegration::createGLWidgetSurface(QGLWidget*) +QPlatformGLWidgetSurface * QPlatformIntegration::createGLWidgetSurface() { return 0; } diff --git a/src/gui/kernel/qplatformintegration_lite.h b/src/gui/kernel/qplatformintegration_lite.h index 70bd0ce..a509b52 100644 --- a/src/gui/kernel/qplatformintegration_lite.h +++ b/src/gui/kernel/qplatformintegration_lite.h @@ -54,7 +54,6 @@ QT_MODULE(Gui) #ifndef QT_NO_OPENGL class QPlatformGLContext; class QPlatformGLWidgetSurface; -class QGLWidget; #endif class Q_GUI_EXPORT QPlatformIntegration @@ -76,7 +75,7 @@ public: #ifndef QT_NO_OPENGL virtual bool hasOpenGL() const; virtual QPlatformGLContext * createGLContext(); - virtual QPlatformGLWidgetSurface * createGLWidgetSurface(QGLWidget*); + virtual QPlatformGLWidgetSurface * createGLWidgetSurface(); #endif }; diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index b1e2ede..e389e3f 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -128,6 +128,10 @@ class QGLOverlayWidget; class QGLWidgetPrivate; class QGLContextPrivate; +#ifdef Q_WS_LITE +class QPlatformGLWidgetSurface; +#endif + // Namespace class: namespace QGL { @@ -531,6 +535,11 @@ public: void drawTexture(const QPointF &point, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D); #endif +#ifdef Q_WS_LITE + // Used by the platform context to get at the surface which it created for the glwidget: + QPlatformGLWidgetSurface* platformSurface(); +#endif + public Q_SLOTS: virtual void updateGL(); virtual void updateOverlayGL(); diff --git a/src/opengl/qgl_lite.cpp b/src/opengl/qgl_lite.cpp index 2a70545..fa1439c 100644 --- a/src/opengl/qgl_lite.cpp +++ b/src/opengl/qgl_lite.cpp @@ -60,7 +60,7 @@ QPlatformGLContext::~QPlatformGLContext() { } -QPlatformGLWidgetSurface::QPlatformGLWidgetSurface(QGLWidget*) +QPlatformGLWidgetSurface::QPlatformGLWidgetSurface() { } @@ -149,22 +149,30 @@ void QGLWidget::setContext(QGLContext *context, QGLContext* oldcx = d->glcx; d->glcx = context; - // If the application has set WA_TranslucentBackground and not explicitly set - // the alpha buffer size to zero, modify the format so it have an alpha channel - QGLFormat& fmt = d->glcx->d_func()->glFormat; - if (testAttribute(Qt::WA_TranslucentBackground) && fmt.alphaBufferSize() == -1) - fmt.setAlphaBufferSize(1); + if (!d->wsurf) { + // If the application has set WA_TranslucentBackground and not explicitly set + // the alpha buffer size to zero, modify the format so it have an alpha channel + QGLFormat format = d->glcx->d_func()->glFormat; + if (testAttribute(Qt::WA_TranslucentBackground) && format.alphaBufferSize() == -1) + format.setAlphaBufferSize(1); + + d->wsurf = QApplicationPrivate::platformIntegration()->createGLWidgetSurface(); + d->wsurf->create(this, format); + d->glcx->d_func()->glFormat = format; + } - bool success = false; if (!d->glcx->isValid()) - success = !d->glcx->create(shareContext ? shareContext : oldcx); + d->glcx->create(shareContext ? shareContext : oldcx); if (deleteOldContext) delete oldcx; } - - +QPlatformGLWidgetSurface* QGLWidget::platformSurface() +{ + Q_D(QGLWidget); + return d->wsurf; +} void QGLWidgetPrivate::init(QGLContext *context, const QGLWidget *shareWidget) { @@ -181,7 +189,7 @@ QColor QGLContext::overlayTransparentColor() const return QColor(); // Invalid color } -uint QGLContext::colorIndex(const QColor& c) const +uint QGLContext::colorIndex(const QColor&) const { return 0; } @@ -214,7 +222,7 @@ QGLTemporaryContext::~QGLTemporaryContext() } -bool QGLWidgetPrivate::renderCxPm(QPixmap* pm) +bool QGLWidgetPrivate::renderCxPm(QPixmap*) { return false; } @@ -234,7 +242,7 @@ void QGLWidget::setMouseTracking(bool enable) bool QGLWidget::event(QEvent *e) { - QWidget::event(e); + return QWidget::event(e); } void QGLWidget::resizeEvent(QResizeEvent *) @@ -242,10 +250,17 @@ void QGLWidget::resizeEvent(QResizeEvent *) Q_D(QGLWidget); if (!isValid()) return; + + if (!d->wsurf) { + qWarning("QGLWidget::resizeEvent() - widget does not have a platform surface"); + return; + } + d->wsurf->setGeometry(geometry()); //### What about moveEvent? + makeCurrent(); -// if (!d->glcx->initialized()) -// glInit(); -// resizeGL(width(), height()); + if (!d->glcx->initialized()) + glInit(); + resizeGL(width(), height()); } diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index c7cd3fe..34cbdfc 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -165,7 +165,7 @@ class QGLWidgetPrivate : public QWidgetPrivate public: QGLWidgetPrivate() : QWidgetPrivate() , disable_clear_on_painter_begin(false) -#ifdef Q_WS_QWS +#if defined(Q_WS_QWS) || defined(Q_WS_LITE) , wsurf(0) #endif #if defined(Q_WS_X11) && !defined(QT_NO_EGL) @@ -207,6 +207,8 @@ public: void updatePaintDevice(); #elif defined(Q_WS_QWS) QWSGLWindowSurface *wsurf; +#elif defined (Q_WS_LITE) + QPlatformGLWidgetSurface* wsurf; #endif }; diff --git a/src/opengl/qglplatformintegration_lite.h b/src/opengl/qglplatformintegration_lite.h index d5bae45..94d4da0 100644 --- a/src/opengl/qglplatformintegration_lite.h +++ b/src/opengl/qglplatformintegration_lite.h @@ -48,13 +48,27 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +// QGLPlatformWidgetSurface does _not_ inherit from QWindowSurface +// - The backing store may be totally unaware of it's existance. +class Q_OPENGL_EXPORT QPlatformGLWidgetSurface +{ +public: + QPlatformGLWidgetSurface(); + virtual ~QPlatformGLWidgetSurface(); + + virtual bool create(QGLWidget*, QGLFormat&) = 0; + + virtual void setGeometry(const QRect&) = 0; +}; + + class Q_OPENGL_EXPORT QPlatformGLContext { public: QPlatformGLContext(); virtual ~QPlatformGLContext(); - virtual bool create(QPaintDevice* device, const QGLFormat& format, QPlatformGLContext* shareContext) = 0; + virtual bool create(QPaintDevice* device, QGLFormat& format, QPlatformGLContext* shareContext) = 0; virtual void makeCurrent() = 0; virtual void doneCurrent() = 0; @@ -63,16 +77,6 @@ public: }; -// QGLPlatformWidgetSurface does _not_ inherit from QWindowSurface -// - The backing store may be totally unaware of it's existance. -class QPlatformGLWidgetSurface -{ -public: - QPlatformGLWidgetSurface(QGLWidget*); - virtual ~QPlatformGLWidgetSurface(); - - virtual void setGeometry(const QRect&) = 0; -}; QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qglxglcontext.cpp b/src/plugins/platforms/testlite/qglxglcontext.cpp deleted file mode 100644 index 6fdbb56..0000000 --- a/src/plugins/platforms/testlite/qglxglcontext.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "x11util.h" -#include "qglxglcontext.h" -#include - -#include - -#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) -#include -#endif - - -QT_BEGIN_NAMESPACE - -QGLXGLContext::QGLXGLContext(Display *xdpy) - : QPlatformGLContext() - , m_display(xdpy) - , m_context(0) - , m_widget(0) -{ -} - -QGLXGLContext::~QGLXGLContext() -{ - if (m_context) { - qDebug("Destroying GLX context 0x%x", m_context); - glXDestroyContext(m_display, m_context); - } -} - -bool QGLXGLContext::create(QPaintDevice* device, const QGLFormat& format, QPlatformGLContext* shareContext) -{ - if (device->devType() != QInternal::Widget) { - qWarning("Creating a GL context is only supported on QWidgets"); - return false; - } - - m_widget = static_cast(device); - if (!m_widget->isTopLevel()) { - qWarning("Creating a GL context is only supported on top-level QWidgets"); - return false; - } - - // Get the XVisualInfo for the window: -// XWindowAttributes windowAttribs; -// XGetWindowAttributes(m_display, m_widget->winId(), &windowAttribs); - XVisualInfo visualInfoTemplate; - visualInfoTemplate.visualid = 33; //XVisualIDFromVisual(windowAttribs.visual); - XVisualInfo *visualInfo; - int matchingCount = 0; - visualInfo = XGetVisualInfo(m_display, VisualIDMask, &visualInfoTemplate, &matchingCount); - - m_context = glXCreateContext(m_display, visualInfo, 0, True); - - qDebug("Created GLX context 0x%x for visual ID %d", m_context, visualInfoTemplate.visualid); - - return true; -} - -void QGLXGLContext::makeCurrent() -{ - Window win = m_widget->winId(); - qDebug("QGLXGLContext::makeCurrent(window=0x%x, ctx=0x%x)", win, m_context); - - glXMakeCurrent(m_display, win, m_context); -} - -void QGLXGLContext::doneCurrent() -{ - glXMakeCurrent(m_display, 0, 0); -} - -void QGLXGLContext::swapBuffers() -{ - glXSwapBuffers(m_display, m_widget->winId()); -} - -void* QGLXGLContext::getProcAddress(const QString& procName) -{ - typedef void *(*qt_glXGetProcAddressARB)(const GLubyte *); - static qt_glXGetProcAddressARB glXGetProcAddressARB = 0; - static bool resolved = false; - - if (resolved && !glXGetProcAddressARB) - return 0; - if (!glXGetProcAddressARB) { - QList glxExt = QByteArray(glXGetClientString(m_display, GLX_EXTENSIONS)).split(' '); - if (glxExt.contains("GLX_ARB_get_proc_address")) { -#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) - void *handle = dlopen(NULL, RTLD_LAZY); - if (handle) { - glXGetProcAddressARB = (qt_glXGetProcAddressARB) dlsym(handle, "glXGetProcAddressARB"); - dlclose(handle); - } - if (!glXGetProcAddressARB) -#endif - { - extern const QString qt_gl_library_name(); - QLibrary lib(qt_gl_library_name()); - glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB"); - } - } - resolved = true; - } - if (!glXGetProcAddressARB) - return 0; - return glXGetProcAddressARB(reinterpret_cast(procName.toLatin1().data())); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qglxglcontext.h b/src/plugins/platforms/testlite/qglxglcontext.h deleted file mode 100644 index ff8fe85..0000000 --- a/src/plugins/platforms/testlite/qglxglcontext.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef Q_GLX_CONTEXT_H -#define Q_GLX_CONTEXT_H - -#include -#include "x11util.h" -#include - -QT_BEGIN_NAMESPACE - -class QGLXGLContext : public QPlatformGLContext -{ -public: - QGLXGLContext(Display* xdpy); - ~QGLXGLContext(); - - bool create(QPaintDevice* device, const QGLFormat& format, QPlatformGLContext* shareContext); - - void makeCurrent(); - void doneCurrent(); - void swapBuffers(); - void* getProcAddress(const QString& procName); - -private: - Display *m_display; - GLXContext m_context; - QWidget *m_widget; -}; - - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp new file mode 100644 index 0000000..6fdbb56 --- /dev/null +++ b/src/plugins/platforms/testlite/qglxintegration.cpp @@ -0,0 +1,150 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "x11util.h" +#include "qglxglcontext.h" +#include + +#include + +#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) +#include +#endif + + +QT_BEGIN_NAMESPACE + +QGLXGLContext::QGLXGLContext(Display *xdpy) + : QPlatformGLContext() + , m_display(xdpy) + , m_context(0) + , m_widget(0) +{ +} + +QGLXGLContext::~QGLXGLContext() +{ + if (m_context) { + qDebug("Destroying GLX context 0x%x", m_context); + glXDestroyContext(m_display, m_context); + } +} + +bool QGLXGLContext::create(QPaintDevice* device, const QGLFormat& format, QPlatformGLContext* shareContext) +{ + if (device->devType() != QInternal::Widget) { + qWarning("Creating a GL context is only supported on QWidgets"); + return false; + } + + m_widget = static_cast(device); + if (!m_widget->isTopLevel()) { + qWarning("Creating a GL context is only supported on top-level QWidgets"); + return false; + } + + // Get the XVisualInfo for the window: +// XWindowAttributes windowAttribs; +// XGetWindowAttributes(m_display, m_widget->winId(), &windowAttribs); + XVisualInfo visualInfoTemplate; + visualInfoTemplate.visualid = 33; //XVisualIDFromVisual(windowAttribs.visual); + XVisualInfo *visualInfo; + int matchingCount = 0; + visualInfo = XGetVisualInfo(m_display, VisualIDMask, &visualInfoTemplate, &matchingCount); + + m_context = glXCreateContext(m_display, visualInfo, 0, True); + + qDebug("Created GLX context 0x%x for visual ID %d", m_context, visualInfoTemplate.visualid); + + return true; +} + +void QGLXGLContext::makeCurrent() +{ + Window win = m_widget->winId(); + qDebug("QGLXGLContext::makeCurrent(window=0x%x, ctx=0x%x)", win, m_context); + + glXMakeCurrent(m_display, win, m_context); +} + +void QGLXGLContext::doneCurrent() +{ + glXMakeCurrent(m_display, 0, 0); +} + +void QGLXGLContext::swapBuffers() +{ + glXSwapBuffers(m_display, m_widget->winId()); +} + +void* QGLXGLContext::getProcAddress(const QString& procName) +{ + typedef void *(*qt_glXGetProcAddressARB)(const GLubyte *); + static qt_glXGetProcAddressARB glXGetProcAddressARB = 0; + static bool resolved = false; + + if (resolved && !glXGetProcAddressARB) + return 0; + if (!glXGetProcAddressARB) { + QList glxExt = QByteArray(glXGetClientString(m_display, GLX_EXTENSIONS)).split(' '); + if (glxExt.contains("GLX_ARB_get_proc_address")) { +#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) + void *handle = dlopen(NULL, RTLD_LAZY); + if (handle) { + glXGetProcAddressARB = (qt_glXGetProcAddressARB) dlsym(handle, "glXGetProcAddressARB"); + dlclose(handle); + } + if (!glXGetProcAddressARB) +#endif + { + extern const QString qt_gl_library_name(); + QLibrary lib(qt_gl_library_name()); + glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB"); + } + } + resolved = true; + } + if (!glXGetProcAddressARB) + return 0; + return glXGetProcAddressARB(reinterpret_cast(procName.toLatin1().data())); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qglxintegration.h b/src/plugins/platforms/testlite/qglxintegration.h new file mode 100644 index 0000000..ff8fe85 --- /dev/null +++ b/src/plugins/platforms/testlite/qglxintegration.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q_GLX_CONTEXT_H +#define Q_GLX_CONTEXT_H + +#include +#include "x11util.h" +#include + +QT_BEGIN_NAMESPACE + +class QGLXGLContext : public QPlatformGLContext +{ +public: + QGLXGLContext(Display* xdpy); + ~QGLXGLContext(); + + bool create(QPaintDevice* device, const QGLFormat& format, QPlatformGLContext* shareContext); + + void makeCurrent(); + void doneCurrent(); + void swapBuffers(); + void* getProcAddress(const QString& procName); + +private: + Display *m_display; + GLXContext m_context; + QWidget *m_widget; +}; + + +QT_END_NAMESPACE + +#endif -- cgit v0.12 From 35fb88fcd035d43684dfd78b64b04645826d4fac Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Thu, 29 Apr 2010 10:58:54 +0200 Subject: Update testlite to use new GL integration API --- src/plugins/platforms/testlite/qglxintegration.cpp | 190 ++++++++++++++++++--- src/plugins/platforms/testlite/qglxintegration.h | 41 +++-- .../platforms/testlite/qtestliteintegration.cpp | 11 +- .../platforms/testlite/qtestliteintegration.h | 1 + src/plugins/platforms/testlite/testlite.pro | 4 +- 5 files changed, 206 insertions(+), 41 deletions(-) diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp index 6fdbb56..9e83f85 100644 --- a/src/plugins/platforms/testlite/qglxintegration.cpp +++ b/src/plugins/platforms/testlite/qglxintegration.cpp @@ -39,12 +39,17 @@ ** ****************************************************************************/ -#include "x11util.h" -#include "qglxglcontext.h" -#include +#include +#include +#include "qtestlitewindow.h" + +#include +#include #include +#include "qglxintegration.h" + #if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) #include #endif @@ -52,11 +57,124 @@ QT_BEGIN_NAMESPACE -QGLXGLContext::QGLXGLContext(Display *xdpy) +GLXFBConfig qt_glx_integration_choose_config(MyDisplay* xd, QGLFormat& format, int drawableType) +{ + int configAttribs[] = { + GLX_DRAWABLE_TYPE, drawableType, + GLX_LEVEL, format.plane(), + GLX_RENDER_TYPE, GLX_RGBA_BIT, + GLX_DOUBLEBUFFER, format.doubleBuffer() ? True : False, + GLX_STEREO, format.stereo() ? True : False, + + GLX_DEPTH_SIZE, (format.depthBufferSize() == -1) ? 0 : format.depthBufferSize(), + GLX_STENCIL_SIZE, (format.stencilBufferSize() == -1) ? 0 : format.stencilBufferSize(), + GLX_SAMPLE_BUFFERS_ARB, (format.samples() == -1) ? 0 : format.samples(), + + GLX_RED_SIZE, (format.redBufferSize() == -1) ? 1 : format.redBufferSize(), + GLX_GREEN_SIZE, (format.greenBufferSize() == -1) ? 1 : format.greenBufferSize(), + GLX_BLUE_SIZE, (format.blueBufferSize() == -1) ? 1 : format.blueBufferSize(), + GLX_ALPHA_SIZE, (format.alphaBufferSize() == -1) ? 0 : format.alphaBufferSize(), + + GLX_ACCUM_RED_SIZE, (format.accumBufferSize() == -1) ? 0 : format.accumBufferSize(), + GLX_ACCUM_GREEN_SIZE, (format.accumBufferSize() == -1) ? 0 : format.accumBufferSize(), + GLX_ACCUM_BLUE_SIZE, (format.accumBufferSize() == -1) ? 0 : format.accumBufferSize(), + GLX_ACCUM_ALPHA_SIZE, (format.accumBufferSize() == -1) ? 0 : format.accumBufferSize(), + XNone + }; + + GLXFBConfig *configs; + int configCount = 0; + configs = glXChooseFBConfig(xd->display, xd->screen, configAttribs, &configCount); + + if (!configs) + return 0; + + GLXFBConfig chosenConfig = 0; + for (int i = 0; i < configCount; ++i) { + chosenConfig = configs[i]; + + // Make sure we try to get an ARGB visual if the format asked for an alpha: + if (format.alpha()) { + XVisualInfo* vi; + vi = glXGetVisualFromFBConfig(xd->display, configs[i]); + if (!vi) + continue; + + XRenderPictFormat *pictFormat = XRenderFindVisualFormat(xd->display, vi->visual); + XFree(vi); + + if (pictFormat && (pictFormat->type == PictTypeDirect) && pictFormat->direct.alphaMask) { + // The pict format for the visual matching the FBConfig indicates ARGB + break; + } + } else + break; // Just choose the first in the list if there's no alpha requested + } + + // TODO: Populate the QGLFormat with the values of the GLXFBConfig + + XFree(configs); + return chosenConfig; +} + + +QGLXGLWidgetSurface::QGLXGLWidgetSurface(MyDisplay* xd) + : QPlatformGLWidgetSurface() + , m_xd(xd) + , m_config(0) + , m_winId(0) +{ +} + +QGLXGLWidgetSurface::~QGLXGLWidgetSurface() +{ +} + +static Colormap qt_glx_integration_colormap = 0; + + +bool QGLXGLWidgetSurface::create(QGLWidget *widget, QGLFormat& format) +{ + m_config = qt_glx_integration_choose_config(m_xd, format, GLX_WINDOW_BIT); + + Window parentWindow = widget->window()->winId(); + + XVisualInfo* visualInfo; + visualInfo = glXGetVisualFromFBConfig(m_xd->display, m_config); + + if (!qt_glx_integration_colormap) { + qt_glx_integration_colormap = XCreateColormap(m_xd->display, parentWindow, + visualInfo->visual, AllocNone); + } + + XSetWindowAttributes windowAttribs; + windowAttribs.background_pixel = m_xd->whitePixel(); + windowAttribs.border_pixel = m_xd->blackPixel(); + windowAttribs.colormap = qt_glx_integration_colormap; + + m_winId = XCreateWindow(m_xd->display, parentWindow, + widget->x(), widget->y(), widget->width(), widget->height(), + 0, visualInfo->depth, InputOutput, visualInfo->visual, + CWBackPixel|CWBorderPixel|CWColormap, &windowAttribs); + + XMapWindow(m_xd->display, m_winId); + + XFree(visualInfo); + return true; +} + +void QGLXGLWidgetSurface::setGeometry(const QRect& rect) +{ + XMoveResizeWindow(m_xd->display, m_winId, rect.x(), rect.y(), rect.width(), rect.height()); +} + + +QGLXGLContext::QGLXGLContext(MyDisplay *xd) : QPlatformGLContext() - , m_display(xdpy) + , m_xd(xd) + , m_drawable(0) + , m_config(0) , m_context(0) - , m_widget(0) { } @@ -64,55 +182,75 @@ QGLXGLContext::~QGLXGLContext() { if (m_context) { qDebug("Destroying GLX context 0x%x", m_context); - glXDestroyContext(m_display, m_context); + glXDestroyContext(m_xd->display, m_context); } } -bool QGLXGLContext::create(QPaintDevice* device, const QGLFormat& format, QPlatformGLContext* shareContext) +bool QGLXGLContext::create(QPaintDevice* device, QGLFormat& format, QPlatformGLContext* shareContext) { + Q_UNUSED(format); + if (device->devType() != QInternal::Widget) { qWarning("Creating a GL context is only supported on QWidgets"); return false; } - m_widget = static_cast(device); - if (!m_widget->isTopLevel()) { - qWarning("Creating a GL context is only supported on top-level QWidgets"); - return false; + GLXContext shareGlxContext = 0; + if (shareContext) + shareGlxContext = static_cast(shareContext)->glxContext(); + + + QWidget* widget = static_cast(device); + QGLWidget* glWidget = qobject_cast(widget); + if (glWidget) { + // Take the config from the QGLWidget's glx surface: + QGLXGLWidgetSurface* surface = static_cast(glWidget->platformSurface()); + m_config = surface->config(); + m_drawable = (Drawable)surface->winId(); + } + else { + if (!widget->isTopLevel()) { + qWarning("Creating a GL context is only supported on top-level QWidgets"); + return false; + } + m_drawable = (Drawable)widget->platformWindow()->winId(); + + // ### This might choose a config with a visual that isn't compatable with the native window: + m_config = qt_glx_integration_choose_config(m_xd, format, GLX_WINDOW_BIT); } + m_context = glXCreateNewContext(m_xd->display, m_config, GLX_RGBA_TYPE, shareGlxContext, True); + // Get the XVisualInfo for the window: // XWindowAttributes windowAttribs; // XGetWindowAttributes(m_display, m_widget->winId(), &windowAttribs); - XVisualInfo visualInfoTemplate; - visualInfoTemplate.visualid = 33; //XVisualIDFromVisual(windowAttribs.visual); - XVisualInfo *visualInfo; - int matchingCount = 0; - visualInfo = XGetVisualInfo(m_display, VisualIDMask, &visualInfoTemplate, &matchingCount); +// XVisualInfo visualInfoTemplate; +// visualInfoTemplate.visualid = 33; //XVisualIDFromVisual(windowAttribs.visual); +// XVisualInfo *visualInfo; +// int matchingCount = 0; +// visualInfo = XGetVisualInfo(m_xd->display, VisualIDMask, &visualInfoTemplate, &matchingCount); - m_context = glXCreateContext(m_display, visualInfo, 0, True); +// m_context = glXCreateContext(m_xd->display, visualInfo, 0, True); - qDebug("Created GLX context 0x%x for visual ID %d", m_context, visualInfoTemplate.visualid); +// qDebug("Created GLX context 0x%x for visual ID %d", m_context, visualInfoTemplate.visualid); return true; } void QGLXGLContext::makeCurrent() { - Window win = m_widget->winId(); - qDebug("QGLXGLContext::makeCurrent(window=0x%x, ctx=0x%x)", win, m_context); - - glXMakeCurrent(m_display, win, m_context); + qDebug("QGLXGLContext::makeCurrent(window=0x%x, ctx=0x%x)", m_drawable, m_context); + glXMakeCurrent(m_xd->display, m_drawable, m_context); } void QGLXGLContext::doneCurrent() { - glXMakeCurrent(m_display, 0, 0); + glXMakeCurrent(m_xd->display, 0, 0); } void QGLXGLContext::swapBuffers() { - glXSwapBuffers(m_display, m_widget->winId()); + glXSwapBuffers(m_xd->display, m_drawable); } void* QGLXGLContext::getProcAddress(const QString& procName) @@ -124,7 +262,7 @@ void* QGLXGLContext::getProcAddress(const QString& procName) if (resolved && !glXGetProcAddressARB) return 0; if (!glXGetProcAddressARB) { - QList glxExt = QByteArray(glXGetClientString(m_display, GLX_EXTENSIONS)).split(' '); + QList glxExt = QByteArray(glXGetClientString(m_xd->display, GLX_EXTENSIONS)).split(' '); if (glxExt.contains("GLX_ARB_get_proc_address")) { #if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) void *handle = dlopen(NULL, RTLD_LAZY); diff --git a/src/plugins/platforms/testlite/qglxintegration.h b/src/plugins/platforms/testlite/qglxintegration.h index ff8fe85..c7cdc91 100644 --- a/src/plugins/platforms/testlite/qglxintegration.h +++ b/src/plugins/platforms/testlite/qglxintegration.h @@ -43,31 +43,52 @@ #define Q_GLX_CONTEXT_H #include -#include "x11util.h" #include QT_BEGIN_NAMESPACE +class MyDisplay; + +class QGLXGLWidgetSurface : public QPlatformGLWidgetSurface +{ +public: + QGLXGLWidgetSurface(MyDisplay* xd); + virtual ~QGLXGLWidgetSurface(); + + virtual bool create(QGLWidget*, QGLFormat&); + virtual void setGeometry(const QRect&); + + GLXFBConfig config() {return m_config;} + Window winId() {return m_winId;} + +private: + MyDisplay *m_xd; + GLXFBConfig m_config; + Window m_winId; +}; + class QGLXGLContext : public QPlatformGLContext { public: - QGLXGLContext(Display* xdpy); + QGLXGLContext(MyDisplay* xd); ~QGLXGLContext(); - bool create(QPaintDevice* device, const QGLFormat& format, QPlatformGLContext* shareContext); - - void makeCurrent(); - void doneCurrent(); - void swapBuffers(); - void* getProcAddress(const QString& procName); + virtual bool create(QPaintDevice* device, QGLFormat& format, QPlatformGLContext* shareContext); + virtual void makeCurrent(); + virtual void doneCurrent(); + virtual void swapBuffers(); + virtual void* getProcAddress(const QString& procName); + GLXContext glxContext() {return m_context;} private: - Display *m_display; + MyDisplay *m_xd; + Drawable m_drawable; + GLXFBConfig m_config; GLXContext m_context; - QWidget *m_widget; }; + QT_END_NAMESPACE #endif diff --git a/src/plugins/platforms/testlite/qtestliteintegration.cpp b/src/plugins/platforms/testlite/qtestliteintegration.cpp index 6c07349..32562dd 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.cpp +++ b/src/plugins/platforms/testlite/qtestliteintegration.cpp @@ -52,7 +52,7 @@ #ifndef QT_NO_OPENGL #include -#include "qglxglcontext.h" +#include "qglxintegration.h" #endif QT_BEGIN_NAMESPACE @@ -132,9 +132,14 @@ bool QTestLiteIntegration::hasOpenGL() const return glXQueryExtension(xd->display, 0, 0) != 0; } -QPlatformGLContext * QTestLiteIntegration::createGLContext() +QPlatformGLContext *QTestLiteIntegration::createGLContext() { - return new QGLXGLContext(xd->display); + return new QGLXGLContext(xd); +} + +QPlatformGLWidgetSurface *QTestLiteIntegration::createGLWidgetSurface() +{ + return new QGLXGLWidgetSurface(xd); } #endif // QT_NO_OPENGL diff --git a/src/plugins/platforms/testlite/qtestliteintegration.h b/src/plugins/platforms/testlite/qtestliteintegration.h index 4260faa..69dad93 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.h +++ b/src/plugins/platforms/testlite/qtestliteintegration.h @@ -84,6 +84,7 @@ public: #ifndef QT_NO_OPENGL bool hasOpenGL() const; QPlatformGLContext * createGLContext(); + QPlatformGLWidgetSurface * createGLWidgetSurface(); #endif MyDisplay *xd; diff --git a/src/plugins/platforms/testlite/testlite.pro b/src/plugins/platforms/testlite/testlite.pro index 454193d..0a5ebb2 100644 --- a/src/plugins/platforms/testlite/testlite.pro +++ b/src/plugins/platforms/testlite/testlite.pro @@ -10,8 +10,8 @@ LIBS += -lX11 -lXext contains(QT_CONFIG, opengl) { QT += opengl - HEADERS += qglxglcontext.h - SOURCES += qglxglcontext.cpp + HEADERS += qglxintegration.h + SOURCES += qglxintegration.cpp } target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems -- cgit v0.12 From 702c0546d7d0c39b436bc4a3ec00e24ef454a9b9 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Thu, 29 Apr 2010 16:39:06 +0200 Subject: Add QPlatformGLWidgetSurface::filterEvent This allows platform integrations to do something special when the QGLWidget recieves an event. Of particular interest is the ParentAboutToChange and ParentChange events. --- src/opengl/qgl_lite.cpp | 14 ++++++++++++++ src/opengl/qglplatformintegration_lite.h | 1 + 2 files changed, 15 insertions(+) diff --git a/src/opengl/qgl_lite.cpp b/src/opengl/qgl_lite.cpp index fa1439c..0ffda5f 100644 --- a/src/opengl/qgl_lite.cpp +++ b/src/opengl/qgl_lite.cpp @@ -68,6 +68,12 @@ QPlatformGLWidgetSurface::~QPlatformGLWidgetSurface() { } +bool QPlatformGLWidgetSurface::filterEvent(QEvent*) +{ + // By default, return false to allow the event to pass through + return false; +} + bool QGLFormat::hasOpenGL() { @@ -242,6 +248,14 @@ void QGLWidget::setMouseTracking(bool enable) bool QGLWidget::event(QEvent *e) { + Q_D(QGLWidget); + + if (d->wsurf) { + bool eventFiltered = d->wsurf->filterEvent(e); + if (eventFiltered) + return true; + } + return QWidget::event(e); } diff --git a/src/opengl/qglplatformintegration_lite.h b/src/opengl/qglplatformintegration_lite.h index 94d4da0..bec920c 100644 --- a/src/opengl/qglplatformintegration_lite.h +++ b/src/opengl/qglplatformintegration_lite.h @@ -59,6 +59,7 @@ public: virtual bool create(QGLWidget*, QGLFormat&) = 0; virtual void setGeometry(const QRect&) = 0; + virtual bool filterEvent(QEvent*); }; -- cgit v0.12 From c5d7513159feeda384d1c3f97906f7086cb38db8 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Thu, 29 Apr 2010 16:42:19 +0200 Subject: Fix re-parenting of QGLWidgets in testlite --- src/plugins/platforms/testlite/qglxintegration.cpp | 22 ++++++++++++++++++++++ src/plugins/platforms/testlite/qglxintegration.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp index 9e83f85..c21c3aa 100644 --- a/src/plugins/platforms/testlite/qglxintegration.cpp +++ b/src/plugins/platforms/testlite/qglxintegration.cpp @@ -123,6 +123,7 @@ QGLXGLWidgetSurface::QGLXGLWidgetSurface(MyDisplay* xd) , m_xd(xd) , m_config(0) , m_winId(0) + , m_widget(0) { } @@ -135,6 +136,8 @@ static Colormap qt_glx_integration_colormap = 0; bool QGLXGLWidgetSurface::create(QGLWidget *widget, QGLFormat& format) { + m_widget = widget; + m_config = qt_glx_integration_choose_config(m_xd, format, GLX_WINDOW_BIT); Window parentWindow = widget->window()->winId(); @@ -168,6 +171,25 @@ void QGLXGLWidgetSurface::setGeometry(const QRect& rect) XMoveResizeWindow(m_xd->display, m_winId, rect.x(), rect.y(), rect.width(), rect.height()); } +bool QGLXGLWidgetSurface::filterEvent(QEvent *e) +{ + if (e->type() == QEvent::ParentAboutToChange) { + // We temporarily hide the window and re-parent it with the root window + // as it's quite likely that the parent window is about to be deleted, + // which would otherwise destroy our window along with it. + XUnmapWindow(m_xd->display, m_winId); + XReparentWindow(m_xd->display, m_winId, m_xd->rootWindow(), 0, 0); + } + + if (e->type() == QEvent::ParentChange) { + // Once we've got a new parent, we need to reparent the window and show it again: + XReparentWindow(m_xd->display, m_winId, m_widget->window()->winId(), m_widget->x(), m_widget->y()); + XMapWindow(m_xd->display, m_winId); + } + + return false; // Allow the event to pass through to QGLWidget +} + QGLXGLContext::QGLXGLContext(MyDisplay *xd) : QPlatformGLContext() diff --git a/src/plugins/platforms/testlite/qglxintegration.h b/src/plugins/platforms/testlite/qglxintegration.h index c7cdc91..0302950 100644 --- a/src/plugins/platforms/testlite/qglxintegration.h +++ b/src/plugins/platforms/testlite/qglxintegration.h @@ -57,6 +57,7 @@ public: virtual bool create(QGLWidget*, QGLFormat&); virtual void setGeometry(const QRect&); + virtual bool filterEvent(QEvent*); GLXFBConfig config() {return m_config;} Window winId() {return m_winId;} @@ -65,6 +66,7 @@ private: MyDisplay *m_xd; GLXFBConfig m_config; Window m_winId; + QGLWidget* m_widget; }; class QGLXGLContext : public QPlatformGLContext -- cgit v0.12 From 327f7c9b055bd6c0131eb92fc7bed58698cb83b0 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Fri, 30 Apr 2010 13:43:42 +0200 Subject: Remove windowSurface member from QTestLiteWindow This makes QTestLiteWindow independent of the window surface, so window surfaces other than QTestLiteWindowSurface can be used too. Reviewed-By: Paul --- src/plugins/platforms/testlite/qtestlitewindow.cpp | 4 +--- src/plugins/platforms/testlite/qtestlitewindow.h | 3 --- src/plugins/platforms/testlite/qtestlitewindowsurface.cpp | 1 - 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index 545912e..242f335 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -39,7 +39,6 @@ ** ****************************************************************************/ -#include "qtestlitewindowsurface.h" #include "qtestliteintegration.h" #include @@ -184,7 +183,6 @@ QTestLiteWindow::QTestLiteWindow(const QTestLiteIntegration *platformIntegration setWindowTitle(QLatin1String("Qt Lighthouse")); currentCursor = -1; - windowSurface = 0; setWindowFlags(window->windowFlags()); //##### This should not be the plugin's responsibility @@ -678,7 +676,7 @@ void QTestLiteWindow::paintEvent() qDebug() << "QTestLiteWindow::paintEvent" << shm_img.size() << painted; #endif - windowSurface->flush(windowSurface->window(), QRect(xpos,ypos,width, height), QPoint()); + widget()->windowSurface()->flush(widget(), QRect(xpos,ypos,width, height), QPoint()); } diff --git a/src/plugins/platforms/testlite/qtestlitewindow.h b/src/plugins/platforms/testlite/qtestlitewindow.h index 3624854..28e49be 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.h +++ b/src/plugins/platforms/testlite/qtestlitewindow.h @@ -94,8 +94,6 @@ public: //### struct MyShmImageInfo; -class QWindowSurface; - class QTestLiteWindow : public QPlatformWindow { public: @@ -140,7 +138,6 @@ private: int currentCursor; - QWindowSurface *windowSurface; MyDisplay *xd; QTestLiteScreen *mScreen; diff --git a/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp b/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp index a14a50e..53f4791 100644 --- a/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp @@ -131,7 +131,6 @@ QTestLiteWindowSurface::QTestLiteWindowSurface (QTestLiteScreen */*screen*/, QWi painted(false), image_info(0) { xw = static_cast(window->platformWindow()); - xw->windowSurface = this; // qDebug() << "QTestLiteWindowSurface::QTestLiteWindowSurface:" << xw->window; } -- cgit v0.12 From 468af8f1dd1c9bc98919e8f407c9676e880249f9 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Fri, 30 Apr 2010 13:50:10 +0200 Subject: Export QGLWindowSurface so it can be used by Lighthouse plugins --- src/opengl/qwindowsurface_gl_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qwindowsurface_gl_p.h b/src/opengl/qwindowsurface_gl_p.h index 9d17514..6bff109 100644 --- a/src/opengl/qwindowsurface_gl_p.h +++ b/src/opengl/qwindowsurface_gl_p.h @@ -77,7 +77,7 @@ public: QGLWindowSurfacePrivate* d; }; -class QGLWindowSurface : public QObject, public QWindowSurface // , public QPaintDevice +class Q_OPENGL_EXPORT QGLWindowSurface : public QObject, public QWindowSurface // , public QPaintDevice { Q_OBJECT public: -- cgit v0.12 From d279e5d3ee808f4faeb5408dc66740b7fffab84f Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Fri, 30 Apr 2010 13:55:06 +0200 Subject: Fix GL extention function pointer lookups in testlite For some reason, if the application doesn't link against QtOpenGL then the qt_gl_library_name() symbol will be missing. For now just hard-code the library name to "GL". --- src/plugins/platforms/testlite/qglxintegration.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp index c21c3aa..d4383ef 100644 --- a/src/plugins/platforms/testlite/qglxintegration.cpp +++ b/src/plugins/platforms/testlite/qglxintegration.cpp @@ -296,7 +296,8 @@ void* QGLXGLContext::getProcAddress(const QString& procName) #endif { extern const QString qt_gl_library_name(); - QLibrary lib(qt_gl_library_name()); +// QLibrary lib(qt_gl_library_name()); + QLibrary lib(QLatin1String("GL")); glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB"); } } -- cgit v0.12 From a24c7ee4da84d3ac8e52cafda200f07c48d0bc98 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Fri, 30 Apr 2010 14:38:01 +0200 Subject: Add support for using OpenGL for window surfaces to testlite To use OpenGL for regular widget rendering, pass testlitegl as the argument to -platform. QGLWindowSurface works by creating a QGLContext on the top-level widget. As testlite's GL integration allows this, QGLWindowSurface can be used without modification. --- src/plugins/platforms/testlite/main.cpp | 7 +++++++ src/plugins/platforms/testlite/qtestliteintegration.cpp | 11 ++++++++++- src/plugins/platforms/testlite/qtestliteintegration.h | 5 ++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/testlite/main.cpp b/src/plugins/platforms/testlite/main.cpp index 29bbcea..5f631f0 100644 --- a/src/plugins/platforms/testlite/main.cpp +++ b/src/plugins/platforms/testlite/main.cpp @@ -55,6 +55,9 @@ QStringList QTestLiteIntegrationPlugin::keys() const { QStringList list; list << "TestLite"; +#ifndef QT_NO_OPENGL + list << "TestLiteGL"; +#endif return list; } @@ -62,6 +65,10 @@ QPlatformIntegration* QTestLiteIntegrationPlugin::create(const QString& system) { if (system.toLower() == "testlite") return new QTestLiteIntegration; +#ifndef QT_NO_OPENGL + if (system.toLower() == "testlitegl") + return new QTestLiteIntegration(true); +#endif return 0; } diff --git a/src/plugins/platforms/testlite/qtestliteintegration.cpp b/src/plugins/platforms/testlite/qtestliteintegration.cpp index 32562dd..f3c3688 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.cpp +++ b/src/plugins/platforms/testlite/qtestliteintegration.cpp @@ -53,6 +53,7 @@ #ifndef QT_NO_OPENGL #include #include "qglxintegration.h" +#include #endif QT_BEGIN_NAMESPACE @@ -81,7 +82,10 @@ public: }; -QTestLiteIntegration::QTestLiteIntegration() +QTestLiteIntegration::QTestLiteIntegration(bool useOpenGL) +#ifndef QT_NO_OPENGL + : mUseOpenGL(useOpenGL) +#endif { xd = new MyDisplay; @@ -109,6 +113,11 @@ QPixmapData *QTestLiteIntegration::createPixmapData(QPixmapData::PixelType type) QWindowSurface *QTestLiteIntegration::createWindowSurface(QWidget *widget, WId) const { +#ifndef QT_NO_OPENGL + if (mUseOpenGL) + return new QGLWindowSurface(widget); +#endif + return new QTestLiteWindowSurface(mPrimaryScreen, widget); } diff --git a/src/plugins/platforms/testlite/qtestliteintegration.h b/src/plugins/platforms/testlite/qtestliteintegration.h index 69dad93..8289a5c 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.h +++ b/src/plugins/platforms/testlite/qtestliteintegration.h @@ -71,7 +71,7 @@ public: class QTestLiteIntegration : public QPlatformIntegration { public: - QTestLiteIntegration(); + QTestLiteIntegration(bool useOpenGL = false); QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; @@ -90,6 +90,9 @@ public: MyDisplay *xd; private: +#ifndef QT_NO_OPENGL + bool mUseOpenGL; +#endif QTestLiteScreen *mPrimaryScreen; QList mScreens; }; -- cgit v0.12 From 7286bc3c88c632a3e081e8df40e0f94438da1911 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Fri, 30 Apr 2010 15:55:47 +0200 Subject: Use QGLPixmapData for testlite when in OpenGL mode --- src/opengl/qpixmapdata_gl_p.h | 2 +- src/plugins/platforms/testlite/qtestliteintegration.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/opengl/qpixmapdata_gl_p.h b/src/opengl/qpixmapdata_gl_p.h index c239bcb..736a28e 100644 --- a/src/opengl/qpixmapdata_gl_p.h +++ b/src/opengl/qpixmapdata_gl_p.h @@ -96,7 +96,7 @@ private: }; -class QGLPixmapData : public QPixmapData +class Q_OPENGL_EXPORT QGLPixmapData : public QPixmapData { public: QGLPixmapData(PixelType type); diff --git a/src/plugins/platforms/testlite/qtestliteintegration.cpp b/src/plugins/platforms/testlite/qtestliteintegration.cpp index f3c3688..3fa3495 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.cpp +++ b/src/plugins/platforms/testlite/qtestliteintegration.cpp @@ -54,6 +54,7 @@ #include #include "qglxintegration.h" #include +#include #endif QT_BEGIN_NAMESPACE @@ -108,6 +109,10 @@ QTestLiteIntegration::QTestLiteIntegration(bool useOpenGL) QPixmapData *QTestLiteIntegration::createPixmapData(QPixmapData::PixelType type) const { +#ifndef QT_NO_OPENGL + if (mUseOpenGL) + return new QGLPixmapData(type); +#endif return new QRasterPixmapData(type); } -- cgit v0.12 From 8a37bad57ef1fddc08c78f6ddc6fbcf0d3879676 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Fri, 30 Apr 2010 15:57:25 +0200 Subject: Fix selecting GLXFBConfigs with depth/stencil/sample buffers This has the unfortunate side effect that different GLXFBConfigs now get selected, which in turn have different visuals. It seems each different visual requires its own colormap (even though they are all TrueColor). To get round this, we allocate a new colormap for each widget. --- src/plugins/platforms/testlite/qglxintegration.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp index d4383ef..88764f3 100644 --- a/src/plugins/platforms/testlite/qglxintegration.cpp +++ b/src/plugins/platforms/testlite/qglxintegration.cpp @@ -59,6 +59,17 @@ QT_BEGIN_NAMESPACE GLXFBConfig qt_glx_integration_choose_config(MyDisplay* xd, QGLFormat& format, int drawableType) { + int depthSize = 0; + int stencilSize = 0; + int sampleSize = 0; + + if (format.depth()) + depthSize = (format.depthBufferSize() == -1) ? 1 : format.depthBufferSize(); + if (format.stencil()) + stencilSize = (format.stencilBufferSize() == -1) ? 1 : format.stencilBufferSize(); + if (format.sampleBuffers()) + sampleSize = (format.samples() == -1) ? 1 : format.samples(); + int configAttribs[] = { GLX_DRAWABLE_TYPE, drawableType, GLX_LEVEL, format.plane(), @@ -66,9 +77,9 @@ GLXFBConfig qt_glx_integration_choose_config(MyDisplay* xd, QGLFormat& format, i GLX_DOUBLEBUFFER, format.doubleBuffer() ? True : False, GLX_STEREO, format.stereo() ? True : False, - GLX_DEPTH_SIZE, (format.depthBufferSize() == -1) ? 0 : format.depthBufferSize(), - GLX_STENCIL_SIZE, (format.stencilBufferSize() == -1) ? 0 : format.stencilBufferSize(), - GLX_SAMPLE_BUFFERS_ARB, (format.samples() == -1) ? 0 : format.samples(), + GLX_DEPTH_SIZE, depthSize, + GLX_STENCIL_SIZE, stencilSize, + GLX_SAMPLE_BUFFERS_ARB, sampleSize, GLX_RED_SIZE, (format.redBufferSize() == -1) ? 1 : format.redBufferSize(), GLX_GREEN_SIZE, (format.greenBufferSize() == -1) ? 1 : format.greenBufferSize(), @@ -145,10 +156,11 @@ bool QGLXGLWidgetSurface::create(QGLWidget *widget, QGLFormat& format) XVisualInfo* visualInfo; visualInfo = glXGetVisualFromFBConfig(m_xd->display, m_config); - if (!qt_glx_integration_colormap) { + // ### This will leak the colormap, but we need a colormap for each visual +// if (!qt_glx_integration_colormap) { qt_glx_integration_colormap = XCreateColormap(m_xd->display, parentWindow, visualInfo->visual, AllocNone); - } +// } XSetWindowAttributes windowAttribs; windowAttribs.background_pixel = m_xd->whitePixel(); -- cgit v0.12 From b30a58d71d2608b033c1e9fcfa68cc69c14d31c7 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Mon, 3 May 2010 17:03:16 +0200 Subject: some cursor documentation fixes, reduce public access to class internals --- src/gui/painting/qgraphicssystemcursor_lite.cpp | 28 +++++++++++++++++-------- src/gui/painting/qgraphicssystemcursor_lite.h | 7 +++++-- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/gui/painting/qgraphicssystemcursor_lite.cpp b/src/gui/painting/qgraphicssystemcursor_lite.cpp index fdb026c..4c97948 100644 --- a/src/gui/painting/qgraphicssystemcursor_lite.cpp +++ b/src/gui/painting/qgraphicssystemcursor_lite.cpp @@ -66,7 +66,7 @@ QPointer QGraphicsSystemCursor::instance = 0; */ /*! - \fn virtual void pointerEvent(const QMouseEvent & event) + \fn virtual void QGraphicsSystemCursor::pointerEvent(const QMouseEvent & event) This method is called by Qt whenever a QMouseEvent is generated by the underlying pointer input. \a event is a reference to the QMouseEvent in @@ -76,7 +76,7 @@ QPointer QGraphicsSystemCursor::instance = 0; */ /*! - \fn virtual void changeCursor(QCursor * widgetCursor, QWidget * widget) + \fn virtual void QGraphicsSystemCursor::changeCursor(QCursor * widgetCursor, QWidget * widget) \brief This method is called by Qt whenever the cursor graphic should be changed. @@ -91,8 +91,9 @@ QPointer QGraphicsSystemCursor::instance = 0; */ /*! - Constructs a QGraphicsSystemCursor + \fn QGraphicsSystemCursor::QGraphicsSystemCursor() + \brief Constructs a QGraphicsSystemCursor */ QGraphicsSystemCursor::QGraphicsSystemCursor(QPlatformScreen *scr ) : screen(scr) @@ -104,6 +105,15 @@ QGraphicsSystemCursor::QGraphicsSystemCursor(QPlatformScreen *scr ) // Beginning of built-in cursor graphics // from src/gui/embedded/QGraphicsSystemCursorImage_qws.cpp +/*! + \class QGraphicsSystemCursorImage + + \brief The QGraphicsSystemCursorImage class provides a set of graphics + intended to be used as cursors. + + \sa QGraphicsSystemCursor +*/ + static QGraphicsSystemCursorImage *systemCursorTable[Qt::LastCursor+1]; static bool systemCursorTableInit = false; @@ -496,7 +506,7 @@ void QGraphicsSystemCursorImage::createSystemCursor(int id) } /*! - \fn void set(Qt::CursorShape id) + \fn void QGraphicsSystemCursorImage::set(Qt::CursorShape id) \brief Calling this method sets the cursor image to the specified shape @@ -525,7 +535,7 @@ void QGraphicsSystemCursorImage::set(Qt::CursorShape id) } /*! - \fn void set(const QImage * image, int hx, int hy) + \fn void QGraphicsSystemCursorImage::set(const QImage * image, int hx, int hy) \brief Set the cursor image to the specified QImage, with the hotsport at (hx, hy) @@ -544,7 +554,7 @@ void QGraphicsSystemCursorImage::set(const QImage * image, int hx, int hy) } /*! - \fn set(const uchar *data, const uchar *mask, int width, int height, int hx, int hy) + \fn void QGraphicsSystemCursorImage::set(const uchar *data, const uchar *mask, int width, int height, int hx, int hy) \brief set the cursor image to the graphic represented by the combination of data, mask, width, and height @@ -619,7 +629,7 @@ void QGraphicsSystemCursorImage::set(const uchar *data, const uchar *mask, } /*! - \fn QGraphicsSystemCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) + \fn QGraphicsSystemCursorImage::QGraphicsSystemCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) \brief set the cursor image to the graphic represented by the combination of data, mask, width, and height @@ -640,13 +650,13 @@ void QGraphicsSystemCursorImage::set(const uchar *data, const uchar *mask, */ /*! - \fn QImage *image() + \fn QImage *QGraphicsSystemCursorImage::image() \brief Return the cursor graphic as a pointer to a QImage */ /*! - \fn QPoint hotspot + \fn QPoint QGraphicsSystemCursorImage::hotspot() \brief Return the cursor's hotspot */ diff --git a/src/gui/painting/qgraphicssystemcursor_lite.h b/src/gui/painting/qgraphicssystemcursor_lite.h index 5288b83..1f4cfd6 100644 --- a/src/gui/painting/qgraphicssystemcursor_lite.h +++ b/src/gui/painting/qgraphicssystemcursor_lite.h @@ -78,9 +78,12 @@ public: static QPointer getInstance() { return instance; } protected: - static QPointer instance; // limit 1 cursor at a time - QPlatformScreen* screen; // Where to request an update + +private: + static QPointer instance; // limit 1 cursor at a time + friend void qt_lite_set_cursor(QWidget * w, bool force); + friend class QApplicationPrivate; }; QT_END_NAMESPACE -- cgit v0.12 From c6fd02d70e22d497658153abbd9fcf3176b550ca Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Tue, 4 May 2010 14:26:43 +0200 Subject: add parameter support for platform integration plugins --- src/gui/kernel/qplatformintegrationfactory_lite.cpp | 5 +++-- src/gui/kernel/qplatformintegrationplugin_lite.h | 4 ++-- src/plugins/platforms/directfb/main.cpp | 5 +++-- src/plugins/platforms/linuxfb/main.cpp | 5 +++-- src/plugins/platforms/minimal/main.cpp | 5 +++-- src/plugins/platforms/qvfb/main.cpp | 5 +++-- src/plugins/platforms/testlite/main.cpp | 5 +++-- src/plugins/platforms/vnc/main.cpp | 5 +++-- 8 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/gui/kernel/qplatformintegrationfactory_lite.cpp b/src/gui/kernel/qplatformintegrationfactory_lite.cpp index 7f650e9..9a00dea 100644 --- a/src/gui/kernel/qplatformintegrationfactory_lite.cpp +++ b/src/gui/kernel/qplatformintegrationfactory_lite.cpp @@ -57,12 +57,13 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, QPlatformIntegration *QPlatformIntegrationFactory::create(const QString& key) { QPlatformIntegration *ret = 0; - QString platform = key.toLower(); + QStringList paramList = key.split(QLatin1Char(':')); + QString platform = paramList.takeFirst().toLower(); qDebug() << loader()->keys(); #if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) if (QPlatformIntegrationFactoryInterface *factory = qobject_cast(loader()->instance(platform))) - ret = factory->create(platform); + ret = factory->create(platform, paramList); #endif return ret; diff --git a/src/gui/kernel/qplatformintegrationplugin_lite.h b/src/gui/kernel/qplatformintegrationplugin_lite.h index 0e116f2..9c37cf7 100644 --- a/src/gui/kernel/qplatformintegrationplugin_lite.h +++ b/src/gui/kernel/qplatformintegrationplugin_lite.h @@ -66,7 +66,7 @@ class QPlatformIntegration; struct QPlatformIntegrationFactoryInterface : public QFactoryInterface { - virtual QPlatformIntegration *create(const QString &key) = 0; + virtual QPlatformIntegration *create(const QString &key, const QStringList ¶mList) = 0; }; #define QPlatformIntegrationFactoryInterface_iid "com.nokia.Qt.QPlatformIntegrationFactoryInterface" @@ -82,7 +82,7 @@ public: ~QPlatformIntegrationPlugin(); virtual QStringList keys() const = 0; - virtual QPlatformIntegration *create(const QString &key) = 0; + virtual QPlatformIntegration *create(const QString &key, const QStringList ¶mList) = 0; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/main.cpp b/src/plugins/platforms/directfb/main.cpp index 9c7bcf6..f4ece32 100644 --- a/src/plugins/platforms/directfb/main.cpp +++ b/src/plugins/platforms/directfb/main.cpp @@ -48,7 +48,7 @@ class QDirectFbIntegrationPlugin : public QPlatformIntegrationPlugin { public: QStringList keys() const; - QPlatformIntegration *create(const QString&); + QPlatformIntegration *create(const QString&, const QStringList&); }; QStringList QDirectFbIntegrationPlugin::keys() const @@ -58,8 +58,9 @@ QStringList QDirectFbIntegrationPlugin::keys() const return list; } -QPlatformIntegration * QDirectFbIntegrationPlugin::create(const QString& system) +QPlatformIntegration * QDirectFbIntegrationPlugin::create(const QString& system, const QStringList& paramList) { + Q_UNUSED(paramList); if (system.toLower() == "directfb") return new QDirectFbIntegration; diff --git a/src/plugins/platforms/linuxfb/main.cpp b/src/plugins/platforms/linuxfb/main.cpp index 65569ac..c5f7fe0 100644 --- a/src/plugins/platforms/linuxfb/main.cpp +++ b/src/plugins/platforms/linuxfb/main.cpp @@ -48,7 +48,7 @@ class QLinuxFbIntegrationPlugin : public QPlatformIntegrationPlugin { public: QStringList keys() const; - QPlatformIntegration *create(const QString&); + QPlatformIntegration *create(const QString&, const QStringList&); }; QStringList QLinuxFbIntegrationPlugin::keys() const @@ -58,8 +58,9 @@ QStringList QLinuxFbIntegrationPlugin::keys() const return list; } -QPlatformIntegration* QLinuxFbIntegrationPlugin::create(const QString& system) +QPlatformIntegration* QLinuxFbIntegrationPlugin::create(const QString& system, const QStringList& paramList) { + Q_UNUSED(paramList); if (system.toLower() == "linuxfb") return new QLinuxFbIntegration; diff --git a/src/plugins/platforms/minimal/main.cpp b/src/plugins/platforms/minimal/main.cpp index 4958468..a4d646d 100644 --- a/src/plugins/platforms/minimal/main.cpp +++ b/src/plugins/platforms/minimal/main.cpp @@ -48,7 +48,7 @@ class QMinimalIntegrationPlugin : public QPlatformIntegrationPlugin { public: QStringList keys() const; - QPlatformIntegration *create(const QString&); + QPlatformIntegration *create(const QString&, const QStringList&); }; QStringList QMinimalIntegrationPlugin::keys() const @@ -58,8 +58,9 @@ QStringList QMinimalIntegrationPlugin::keys() const return list; } -QPlatformIntegration *QMinimalIntegrationPlugin::create(const QString& system) +QPlatformIntegration *QMinimalIntegrationPlugin::create(const QString& system, const QStringList& paramList) { + Q_UNUSED(paramList); if (system.toLower() == "minimal") return new QMinimalIntegration; diff --git a/src/plugins/platforms/qvfb/main.cpp b/src/plugins/platforms/qvfb/main.cpp index 409f11c..206ece8 100644 --- a/src/plugins/platforms/qvfb/main.cpp +++ b/src/plugins/platforms/qvfb/main.cpp @@ -49,7 +49,7 @@ class QVFbIntegrationPlugin : public QPlatformIntegrationPlugin { public: QStringList keys() const; - QPlatformIntegration *create(const QString&); + QPlatformIntegration *create(const QString&, const QStringList&); }; QStringList QVFbIntegrationPlugin::keys() const @@ -59,8 +59,9 @@ QStringList QVFbIntegrationPlugin::keys() const return list; } -QPlatformIntegration* QVFbIntegrationPlugin::create(const QString& system) +QPlatformIntegration* QVFbIntegrationPlugin::create(const QString& system, const QStringList& paramList) { + Q_UNUSED(paramList); if (system.toLower() == "qvfb") return new QVFbIntegration; diff --git a/src/plugins/platforms/testlite/main.cpp b/src/plugins/platforms/testlite/main.cpp index 5f631f0..2f6aa8b 100644 --- a/src/plugins/platforms/testlite/main.cpp +++ b/src/plugins/platforms/testlite/main.cpp @@ -48,7 +48,7 @@ class QTestLiteIntegrationPlugin : public QPlatformIntegrationPlugin { public: QStringList keys() const; - QPlatformIntegration *create(const QString&); + QPlatformIntegration *create(const QString&, const QStringList&); }; QStringList QTestLiteIntegrationPlugin::keys() const @@ -61,8 +61,9 @@ QStringList QTestLiteIntegrationPlugin::keys() const return list; } -QPlatformIntegration* QTestLiteIntegrationPlugin::create(const QString& system) +QPlatformIntegration* QTestLiteIntegrationPlugin::create(const QString& system, const QStringList& paramList) { + Q_UNUSED(paramList); if (system.toLower() == "testlite") return new QTestLiteIntegration; #ifndef QT_NO_OPENGL diff --git a/src/plugins/platforms/vnc/main.cpp b/src/plugins/platforms/vnc/main.cpp index 775259b..c66029c 100644 --- a/src/plugins/platforms/vnc/main.cpp +++ b/src/plugins/platforms/vnc/main.cpp @@ -49,7 +49,7 @@ class QVNCIntegrationPlugin : public QPlatformIntegrationPlugin { public: QStringList keys() const; - QPlatformIntegration *create(const QString&); + QPlatformIntegration *create(const QString&, const QStringList &); }; QStringList QVNCIntegrationPlugin::keys() const @@ -59,8 +59,9 @@ QStringList QVNCIntegrationPlugin::keys() const return list; } -QPlatformIntegration* QVNCIntegrationPlugin::create(const QString& system) +QPlatformIntegration* QVNCIntegrationPlugin::create(const QString& system, const QStringList& paramList) { + Q_UNUSED(paramList); if (system.toLower() == "vnc") return new QVNCIntegration; -- cgit v0.12 From 47f886467b04ce712b4dcd90f0201720d614ff28 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Tue, 4 May 2010 14:59:04 +0200 Subject: VNC parameters for size and display id --- src/plugins/platforms/vnc/main.cpp | 2 +- src/plugins/platforms/vnc/qvncintegration.cpp | 54 ++++++++++++++++++++------- src/plugins/platforms/vnc/qvncintegration.h | 4 +- src/plugins/platforms/vnc/qvncserver.cpp | 4 +- src/plugins/platforms/vnc/qvncserver.h | 2 +- 5 files changed, 46 insertions(+), 20 deletions(-) diff --git a/src/plugins/platforms/vnc/main.cpp b/src/plugins/platforms/vnc/main.cpp index c66029c..e051e2d 100644 --- a/src/plugins/platforms/vnc/main.cpp +++ b/src/plugins/platforms/vnc/main.cpp @@ -63,7 +63,7 @@ QPlatformIntegration* QVNCIntegrationPlugin::create(const QString& system, const { Q_UNUSED(paramList); if (system.toLower() == "vnc") - return new QVNCIntegration; + return new QVNCIntegration(paramList); return 0; } diff --git a/src/plugins/platforms/vnc/qvncintegration.cpp b/src/plugins/platforms/vnc/qvncintegration.cpp index 7bdba35..69aea79 100644 --- a/src/plugins/platforms/vnc/qvncintegration.cpp +++ b/src/plugins/platforms/vnc/qvncintegration.cpp @@ -51,25 +51,16 @@ #include -QVNCScreen::QVNCScreen() +QVNCScreen::QVNCScreen(QRect screenSize, int screenId) : QFbScreen::QFbScreen() { - int w = 800; - int h = 600; - int ew, eh; - const char *str; - if ((str=::getenv("QT_VNC_SIZE")) && sscanf(str,"%dx%d",&ew,&eh)==2) { - w = ew; - h = eh; - } - - setGeometry(QRect(0,0,w, h)); + setGeometry(screenSize); setDepth(32); setFormat(QImage::Format_RGB32); setPhysicalSize((geometry().size()*254)/720); - d_ptr = new QVNCScreenPrivate(this); + d_ptr = new QVNCScreenPrivate(this, screenId); cursor = new QVNCCursor(d_ptr->vncServer, this); d_ptr->vncServer->setCursor(static_cast(cursor)); @@ -91,10 +82,45 @@ QRegion QVNCScreen::doRedraw() return touched; } +static inline int defaultWidth() { return 800; } +static inline int defaultHeight() { return 600; } +static inline int defaultDisplay() { return 0; } + +static void usage() +{ + qWarning() << "VNC Platform Integration options:"; + qWarning() << " size=x - set the display width and height"; + qWarning() << " defaults to" << defaultWidth() << "x" << defaultHeight(); + qWarning() << " display= - set the VNC display port to ID + 5900"; + qWarning() << " defaults to" << defaultDisplay(); +} -QVNCIntegration::QVNCIntegration() +QVNCIntegration::QVNCIntegration(const QStringList& paramList) { - mPrimaryScreen = new QVNCScreen(); + int sizeX = defaultWidth(); + int sizeY = defaultHeight(); + int display = defaultDisplay(); + bool showUsage = false; + + foreach(QString confString, paramList) { + if (confString.startsWith(QLatin1String("size="))) { + QString val = confString.section(QLatin1Char('='), 1, 1); + sizeX = val.section(QLatin1Char('x'), 0, 0).toInt(); + sizeY = val.section(QLatin1Char('x'), 1, 1).toInt(); + } + else if (confString.startsWith(QLatin1String("display="))) { + display = confString.section(QLatin1Char('='), 1, 1).toInt(); + } + else { + qWarning() << "Unknown VNC option:" << confString; + showUsage = true; + } + } + + if (showUsage) + usage(); + + mPrimaryScreen = new QVNCScreen(QRect(0, 0, sizeX, sizeY), display); mScreens.append(mPrimaryScreen); } diff --git a/src/plugins/platforms/vnc/qvncintegration.h b/src/plugins/platforms/vnc/qvncintegration.h index 524b888..dcb5419 100644 --- a/src/plugins/platforms/vnc/qvncintegration.h +++ b/src/plugins/platforms/vnc/qvncintegration.h @@ -56,7 +56,7 @@ class QVNCScreenPrivate; class QVNCScreen : public QFbScreen { public: - QVNCScreen(); + QVNCScreen(QRect screenSize, int screenId); int linestep() const { return image() ? image()->bytesPerLine() : 0; } uchar *base() const { return image() ? image()->bits() : 0; } @@ -76,7 +76,7 @@ class QVNCIntegrationPrivate; class QVNCIntegration : public QPlatformIntegration { public: - QVNCIntegration(); + QVNCIntegration(const QStringList& paramList); QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; diff --git a/src/plugins/platforms/vnc/qvncserver.cpp b/src/plugins/platforms/vnc/qvncserver.cpp index ab0a2f3..bd4d6ab 100644 --- a/src/plugins/platforms/vnc/qvncserver.cpp +++ b/src/plugins/platforms/vnc/qvncserver.cpp @@ -1885,7 +1885,7 @@ void QVNCServer::discardClient() -QVNCScreenPrivate::QVNCScreenPrivate(QVNCScreen *parent) +QVNCScreenPrivate::QVNCScreenPrivate(QVNCScreen *parent, int screenId) : dpiX(72), dpiY(72), doOnScreenSurface(false), refreshRate(25), vncServer(0), q_ptr(parent) { @@ -1893,7 +1893,7 @@ QVNCScreenPrivate::QVNCScreenPrivate(QVNCScreen *parent) QWSSignalHandler::instance()->addObject(this); #endif - vncServer = new QVNCServer(q_ptr); + vncServer = new QVNCServer(q_ptr, screenId); vncServer->setRefreshRate(refreshRate); diff --git a/src/plugins/platforms/vnc/qvncserver.h b/src/plugins/platforms/vnc/qvncserver.h index b1a9797..837f1f4 100644 --- a/src/plugins/platforms/vnc/qvncserver.h +++ b/src/plugins/platforms/vnc/qvncserver.h @@ -249,7 +249,7 @@ public: class QVNCScreenPrivate : public QObject { public: - QVNCScreenPrivate(QVNCScreen *parent); + QVNCScreenPrivate(QVNCScreen *parent, int screenId); ~QVNCScreenPrivate(); void setDirty(const QRect &rect, bool force = false); -- cgit v0.12 From 208e207925f9073fdca55f5824ce4d0051c86c6c Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 5 May 2010 13:40:19 +0200 Subject: allow multiple cursors --- src/gui/kernel/qapplication_lite.cpp | 8 +-- src/gui/kernel/qwidget_lite.cpp | 67 +++++++++++++------------ src/gui/painting/qgraphicssystemcursor_lite.cpp | 4 +- src/gui/painting/qgraphicssystemcursor_lite.h | 9 ++-- src/plugins/platforms/fb_base/fb_base.h | 1 + 5 files changed, 48 insertions(+), 41 deletions(-) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index f9e4242..31db7d0 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -691,9 +691,11 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterface::MouseEvent * QMouseEvent ev(type, localPoint, globalPoint, button, buttons, modifiers); - QPointer cursor = QGraphicsSystemCursor::getInstance(); - if (cursor) - cursor->pointerEvent(ev); + QList > cursors = QGraphicsSystemCursor::getInstances(); + foreach (QWeakPointer cursor, cursors) { + if (cursor) + cursor.data()->pointerEvent(ev); + } QApplication::sendSpontaneousEvent(mouseWidget, &ev); } diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index 64fb6f7..ed731c0 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -689,6 +689,7 @@ void QWidgetPrivate::setModal_sys() #ifndef QT_NO_CURSOR void qt_lite_set_cursor(QWidget * w, bool force) { + static QCursor arrowCursor(Qt::ArrowCursor); static QPointer lastUnderMouse = 0; QCursor * override = QApplication::overrideCursor(); @@ -696,42 +697,46 @@ void qt_lite_set_cursor(QWidget * w, bool force) if (override && w != 0) return; - QPointer cursor = QGraphicsSystemCursor::getInstance(); - if (!cursor) - return; + QWidget *cursorWidget; + QCursor cursorCursor; - if (w == 0) { - if (override) { - cursor->changeCursor(override, QApplication::topLevelAt(QCursor::pos())); - return; + do { + if (w == 0) { + if (override) { + cursorCursor = *override; + cursorWidget = QApplication::topLevelAt(QCursor::pos()); + break; + } + w = QApplication::widgetAt(QCursor::pos()); + if (w == 0) // clear the override cursor while over empty space + w = QApplication::desktop(); + } else if (force) { + lastUnderMouse = w; + } else if (w->testAttribute(Qt::WA_WState_Created) && lastUnderMouse + && lastUnderMouse->effectiveWinId() == w->effectiveWinId()) { + w = lastUnderMouse; + } + if (w == QApplication::desktop() && !override) { + cursorCursor = arrowCursor; + cursorWidget = w; + break; } - w = QApplication::widgetAt(QCursor::pos()); - if (w == 0) // clear the override cursor while over empty space - w = QApplication::desktop(); - } else if (force) { - lastUnderMouse = w; - } else if (w->testAttribute(Qt::WA_WState_Created) && lastUnderMouse - && lastUnderMouse->effectiveWinId() == w->effectiveWinId()) { - w = lastUnderMouse; - } - - if (w == QApplication::desktop() && !override) { - QCursor c(Qt::ArrowCursor); - cursor->changeCursor(&c, w); - return; - } - QWidget * curWin = QApplication::activeWindow(); - if (!curWin && w && w->internalWinId()) - return; - QWidget* cW = w && !w->internalWinId() ? w : curWin; + QWidget * curWin = QApplication::activeWindow(); + if (!curWin && w && w->internalWinId()) + return; + QWidget* cW = w && !w->internalWinId() ? w : curWin; - if (!cW || cW->window() != w->window() || - !cW->isVisible() || !cW->underMouse() || override) - return; + if (!cW || cW->window() != w->window() || + !cW->isVisible() || !cW->underMouse() || override) + return; - QCursor c = w->cursor(); - cursor->changeCursor(&c, w); + cursorCursor = w->cursor(); + cursorWidget = w; + } while (0); + foreach (QWeakPointer cursor, QGraphicsSystemCursor::getInstances()) + if (cursor) + cursor.data()->changeCursor(&cursorCursor, cursorWidget); } #endif //QT_NO_CURSOR diff --git a/src/gui/painting/qgraphicssystemcursor_lite.cpp b/src/gui/painting/qgraphicssystemcursor_lite.cpp index 4c97948..623a75a 100644 --- a/src/gui/painting/qgraphicssystemcursor_lite.cpp +++ b/src/gui/painting/qgraphicssystemcursor_lite.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE -QPointer QGraphicsSystemCursor::instance = 0; +QList > QGraphicsSystemCursor::instances; /*! \class QGraphicsSystemCursor @@ -98,7 +98,7 @@ QPointer QGraphicsSystemCursor::instance = 0; QGraphicsSystemCursor::QGraphicsSystemCursor(QPlatformScreen *scr ) : screen(scr) { - instance = this; + instances.append(this); } // End of display and pointer event handling code diff --git a/src/gui/painting/qgraphicssystemcursor_lite.h b/src/gui/painting/qgraphicssystemcursor_lite.h index 1f4cfd6..a8a574e 100644 --- a/src/gui/painting/qgraphicssystemcursor_lite.h +++ b/src/gui/painting/qgraphicssystemcursor_lite.h @@ -44,10 +44,10 @@ #include #include #include -#include +#include #include -#include "qgraphicssystem_p.h" #include +#include QT_BEGIN_NAMESPACE @@ -75,13 +75,12 @@ public: virtual void pointerEvent(const QMouseEvent & event) { Q_UNUSED(event); } virtual void changeCursor(QCursor * widgetCursor, QWidget * widget) = 0; - static QPointer getInstance() { return instance; } - protected: QPlatformScreen* screen; // Where to request an update private: - static QPointer instance; // limit 1 cursor at a time + static QList > getInstances() { return instances; } + static QList > instances; friend void qt_lite_set_cursor(QWidget * w, bool force); friend class QApplicationPrivate; }; diff --git a/src/plugins/platforms/fb_base/fb_base.h b/src/plugins/platforms/fb_base/fb_base.h index 2b32209..13638a0 100644 --- a/src/plugins/platforms/fb_base/fb_base.h +++ b/src/plugins/platforms/fb_base/fb_base.h @@ -8,6 +8,7 @@ #include #include #include +#include class QMouseEvent; class QSize; -- cgit v0.12 From 810cadc8430556dae9d18299a98c8c92608676b1 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 5 May 2010 14:21:18 +0200 Subject: move cursor details into a private class --- src/gui/kernel/qapplication_lite.cpp | 2 +- src/gui/kernel/qwidget_lite.cpp | 2 +- src/gui/painting/qgraphicssystemcursor_lite.cpp | 4 ++-- src/gui/painting/qgraphicssystemcursor_lite.h | 11 +++++++++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 31db7d0..5fc56a8 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -691,7 +691,7 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterface::MouseEvent * QMouseEvent ev(type, localPoint, globalPoint, button, buttons, modifiers); - QList > cursors = QGraphicsSystemCursor::getInstances(); + QList > cursors = QGraphicsSystemCursorPrivate::getInstances(); foreach (QWeakPointer cursor, cursors) { if (cursor) cursor.data()->pointerEvent(ev); diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index ed731c0..eae83f9 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -734,7 +734,7 @@ void qt_lite_set_cursor(QWidget * w, bool force) cursorCursor = w->cursor(); cursorWidget = w; } while (0); - foreach (QWeakPointer cursor, QGraphicsSystemCursor::getInstances()) + foreach (QWeakPointer cursor, QGraphicsSystemCursorPrivate::getInstances()) if (cursor) cursor.data()->changeCursor(&cursorCursor, cursorWidget); } diff --git a/src/gui/painting/qgraphicssystemcursor_lite.cpp b/src/gui/painting/qgraphicssystemcursor_lite.cpp index 623a75a..752b406 100644 --- a/src/gui/painting/qgraphicssystemcursor_lite.cpp +++ b/src/gui/painting/qgraphicssystemcursor_lite.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE -QList > QGraphicsSystemCursor::instances; +QList > QGraphicsSystemCursorPrivate::instances; /*! \class QGraphicsSystemCursor @@ -98,7 +98,7 @@ QList > QGraphicsSystemCursor::instances; QGraphicsSystemCursor::QGraphicsSystemCursor(QPlatformScreen *scr ) : screen(scr) { - instances.append(this); + QGraphicsSystemCursorPrivate::instances.append(this); } // End of display and pointer event handling code diff --git a/src/gui/painting/qgraphicssystemcursor_lite.h b/src/gui/painting/qgraphicssystemcursor_lite.h index a8a574e..9c65f7f 100644 --- a/src/gui/painting/qgraphicssystemcursor_lite.h +++ b/src/gui/painting/qgraphicssystemcursor_lite.h @@ -67,6 +67,14 @@ private: QPoint hot; }; +class QGraphicsSystemCursor; + +class QGraphicsSystemCursorPrivate { +public: + static QList > getInstances() { return instances; } + static QList > instances; +}; + class Q_GUI_EXPORT QGraphicsSystemCursor : public QObject { public: QGraphicsSystemCursor(QPlatformScreen *); @@ -79,8 +87,7 @@ protected: QPlatformScreen* screen; // Where to request an update private: - static QList > getInstances() { return instances; } - static QList > instances; + Q_DECLARE_PRIVATE(QGraphicsSystemCursor); friend void qt_lite_set_cursor(QWidget * w, bool force); friend class QApplicationPrivate; }; -- cgit v0.12 From e5cf17ca04005909dfeca938606041dfa3a1b2ad Mon Sep 17 00:00:00 2001 From: tsenyk Date: Wed, 5 May 2010 14:27:01 +0200 Subject: ifdef fix for egl on ws_lite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit reviewed by: Jørgen --- src/opengl/qgl.cpp | 3 +- src/opengl/qgl_lite.cpp | 103 ++++++++++++++++++++++++++++++++++++++++++ src/opengl/qgl_p.h | 9 ++-- src/opengl/qglpixelbuffer_p.h | 3 +- 4 files changed, 112 insertions(+), 6 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 580f3d0..26eb1e7 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1588,7 +1588,8 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format) #endif #if defined(Q_WS_LITE) platformContext = 0; -#elif !defined(QT_NO_EGL) +#endif +#if !defined(QT_NO_EGL) ownsEglContext = false; eglContext = 0; eglSurface = EGL_NO_SURFACE; diff --git a/src/opengl/qgl_lite.cpp b/src/opengl/qgl_lite.cpp index 0ffda5f..426683b 100644 --- a/src/opengl/qgl_lite.cpp +++ b/src/opengl/qgl_lite.cpp @@ -49,6 +49,109 @@ #include "qgl_p.h" #include "qglplatformintegration_lite.h" +#ifndef QT_NO_EGL +#include "qgl_egl_p.h" + +void qt_eglproperties_set_glformat(QEglProperties& eglProperties, const QGLFormat& glFormat) +{ + int redSize = glFormat.redBufferSize(); + int greenSize = glFormat.greenBufferSize(); + int blueSize = glFormat.blueBufferSize(); + int alphaSize = glFormat.alphaBufferSize(); + int depthSize = glFormat.depthBufferSize(); + int stencilSize = glFormat.stencilBufferSize(); + int sampleCount = glFormat.samples(); + + // QGLFormat uses a magic value of -1 to indicate "don't care", even when a buffer of that + // type has been requested. So we must check QGLFormat's booleans too if size is -1: + if (glFormat.alpha() && alphaSize <= 0) + alphaSize = 1; + if (glFormat.depth() && depthSize <= 0) + depthSize = 1; + if (glFormat.stencil() && stencilSize <= 0) + stencilSize = 1; + if (glFormat.sampleBuffers() && sampleCount <= 0) + sampleCount = 1; + + // We want to make sure 16-bit configs are chosen over 32-bit configs as they will provide + // the best performance. The EGL config selection algorithm is a bit stange in this regard: + // The selection criteria for EGL_BUFFER_SIZE is "AtLeast", so we can't use it to discard + // 32-bit configs completely from the selection. So it then comes to the sorting algorithm. + // The red/green/blue sizes have a sort priority of 3, so they are sorted by first. The sort + // order is special and described as "by larger _total_ number of color bits.". So EGL will + // put 32-bit configs in the list before the 16-bit configs. However, the spec also goes on + // to say "If the requested number of bits in attrib_list for a particular component is 0, + // then the number of bits for that component is not considered". This part of the spec also + // seems to imply that setting the red/green/blue bits to zero means none of the components + // are considered and EGL disregards the entire sorting rule. It then looks to the next + // highest priority rule, which is EGL_BUFFER_SIZE. Despite the selection criteria being + // "AtLeast" for EGL_BUFFER_SIZE, it's sort order is "smaller" meaning 16-bit configs are + // put in the list before 32-bit configs. So, to make sure 16-bit is preffered over 32-bit, + // we must set the red/green/blue sizes to zero. This has an unfortunate consequence that + // if the application sets the red/green/blue size to 5/6/5 on the QGLFormat, they will + // probably get a 32-bit config, even when there's an RGB565 config avaliable. Oh well. + + // Now normalize the values so -1 becomes 0 + redSize = redSize > 0 ? redSize : 0; + greenSize = greenSize > 0 ? greenSize : 0; + blueSize = blueSize > 0 ? blueSize : 0; + alphaSize = alphaSize > 0 ? alphaSize : 0; + depthSize = depthSize > 0 ? depthSize : 0; + stencilSize = stencilSize > 0 ? stencilSize : 0; + sampleCount = sampleCount > 0 ? sampleCount : 0; + + eglProperties.setValue(EGL_RED_SIZE, redSize); + eglProperties.setValue(EGL_GREEN_SIZE, greenSize); + eglProperties.setValue(EGL_BLUE_SIZE, blueSize); + eglProperties.setValue(EGL_ALPHA_SIZE, alphaSize); + eglProperties.setValue(EGL_DEPTH_SIZE, depthSize); + eglProperties.setValue(EGL_STENCIL_SIZE, stencilSize); + eglProperties.setValue(EGL_SAMPLES, sampleCount); + eglProperties.setValue(EGL_SAMPLE_BUFFERS, sampleCount ? 1 : 0); +} + +// Updates "format" with the parameters of the selected configuration. +void qt_glformat_from_eglconfig(QGLFormat& format, const EGLConfig config) +{ + EGLint redSize = 0; + EGLint greenSize = 0; + EGLint blueSize = 0; + EGLint alphaSize = 0; + EGLint depthSize = 0; + EGLint stencilSize = 0; + EGLint sampleCount = 0; + EGLint level = 0; + + EGLDisplay display = QEgl::display(); + eglGetConfigAttrib(display, config, EGL_RED_SIZE, &redSize); + eglGetConfigAttrib(display, config, EGL_GREEN_SIZE, &greenSize); + eglGetConfigAttrib(display, config, EGL_BLUE_SIZE, &blueSize); + eglGetConfigAttrib(display, config, EGL_ALPHA_SIZE, &alphaSize); + eglGetConfigAttrib(display, config, EGL_DEPTH_SIZE, &depthSize); + eglGetConfigAttrib(display, config, EGL_STENCIL_SIZE, &stencilSize); + eglGetConfigAttrib(display, config, EGL_SAMPLES, &sampleCount); + eglGetConfigAttrib(display, config, EGL_LEVEL, &level); + + format.setRedBufferSize(redSize); + format.setGreenBufferSize(greenSize); + format.setBlueBufferSize(blueSize); + format.setAlphaBufferSize(alphaSize); + format.setDepthBufferSize(depthSize); + format.setStencilBufferSize(stencilSize); + format.setSamples(sampleCount); + format.setPlane(level + 1); // EGL calls level 0 "normal" whereas Qt calls 1 "normal" + format.setDirectRendering(true); // All EGL contexts are direct-rendered + format.setRgba(true); // EGL doesn't support colour index rendering + format.setStereo(false); // EGL doesn't support stereo buffers + format.setAccumBufferSize(0); // EGL doesn't support accululation buffers + + // Clear the EGL error state because some of the above may + // have errored out because the attribute is not applicable + // to the surface type. Such errors don't matter. + eglGetError(); +} +#endif + QT_BEGIN_NAMESPACE diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 34cbdfc..a2445b7 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -350,14 +350,17 @@ public: HBITMAP hbitmap; HDC hbitmap_hdc; #endif -#if defined(Q_WS_LITE) - QPlatformGLContext *platformContext; -#elif !defined(QT_NO_EGL) + +#if !defined(QT_NO_EGL) bool ownsEglContext; QEglContext *eglContext; EGLSurface eglSurface; void destroyEglSurfaceForDevice(); EGLSurface eglSurfaceForDevice() const; +#endif + +#if defined(Q_WS_LITE) + QPlatformGLContext *platformContext; #elif defined(Q_WS_X11) || defined(Q_WS_MAC) void* cx; #endif diff --git a/src/opengl/qglpixelbuffer_p.h b/src/opengl/qglpixelbuffer_p.h index de890c9..a7f4159 100644 --- a/src/opengl/qglpixelbuffer_p.h +++ b/src/opengl/qglpixelbuffer_p.h @@ -197,8 +197,7 @@ public: EGLSurface pbuf; QEglContext *ctx; int textureFormat; -#endif -#if defined(Q_WS_LITE) +#elif defined(Q_WS_LITE) // Stubs int pbuf; int ctx; -- cgit v0.12 From 6f39ecdabdae9b2132729a2a9940e5febaa420d2 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 5 May 2010 13:50:16 +0200 Subject: Small GL related fixes --- src/plugins/platforms/testlite/qglxintegration.cpp | 30 ++++++++++++++++++++-- src/plugins/platforms/testlite/qtestlitewindow.cpp | 13 +++++++--- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp index 88764f3..79596f5 100644 --- a/src/plugins/platforms/testlite/qglxintegration.cpp +++ b/src/plugins/platforms/testlite/qglxintegration.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#include #include #include @@ -54,7 +55,6 @@ #include #endif - QT_BEGIN_NAMESPACE GLXFBConfig qt_glx_integration_choose_config(MyDisplay* xd, QGLFormat& format, int drawableType) @@ -171,7 +171,11 @@ bool QGLXGLWidgetSurface::create(QGLWidget *widget, QGLFormat& format) widget->x(), widget->y(), widget->width(), widget->height(), 0, visualInfo->depth, InputOutput, visualInfo->visual, CWBackPixel|CWBorderPixel|CWColormap, &windowAttribs); +#ifdef MYX11_DEBUG + qDebug() << "QGLXGLWidgetSurface::create" << hex << "parent" << parentWindow << "win:" << m_winId << widget; +#endif + XSetWindowBackgroundPixmap(m_xd->display, m_winId, XNone); XMapWindow(m_xd->display, m_winId); XFree(visualInfo); @@ -180,7 +184,15 @@ bool QGLXGLWidgetSurface::create(QGLWidget *widget, QGLFormat& format) void QGLXGLWidgetSurface::setGeometry(const QRect& rect) { - XMoveResizeWindow(m_xd->display, m_winId, rect.x(), rect.y(), rect.width(), rect.height()); +#ifdef MYX11_DEBUG + qDebug() << "QGLXGLWidgetSurface::setGeometry" << rect << hex << m_xd->display << m_winId << "toplevel?" << m_widget->isWindow(); +#endif + //### toplevel QGLWidgets do have a separate X window owned by the surface, but it has a + // local geometry + if (m_widget->isWindow()) + XMoveResizeWindow(m_xd->display, m_winId, 0, 0, rect.width(), rect.height()); + else + XMoveResizeWindow(m_xd->display, m_winId, rect.x(), rect.y(), rect.width(), rect.height()); } bool QGLXGLWidgetSurface::filterEvent(QEvent *e) @@ -191,12 +203,18 @@ bool QGLXGLWidgetSurface::filterEvent(QEvent *e) // which would otherwise destroy our window along with it. XUnmapWindow(m_xd->display, m_winId); XReparentWindow(m_xd->display, m_winId, m_xd->rootWindow(), 0, 0); +#ifdef MYX11_DEBUG + qDebug() << "filterEvent unmap" << hex << m_winId; +#endif } if (e->type() == QEvent::ParentChange) { // Once we've got a new parent, we need to reparent the window and show it again: XReparentWindow(m_xd->display, m_winId, m_widget->window()->winId(), m_widget->x(), m_widget->y()); XMapWindow(m_xd->display, m_winId); +#ifdef MYX11_DEBUG + qDebug() << "filterEvent reparent" << hex << m_winId << "to:" << m_widget->window()->winId(); +#endif } return false; // Allow the event to pass through to QGLWidget @@ -241,6 +259,9 @@ bool QGLXGLContext::create(QPaintDevice* device, QGLFormat& format, QPlatformGLC QGLXGLWidgetSurface* surface = static_cast(glWidget->platformSurface()); m_config = surface->config(); m_drawable = (Drawable)surface->winId(); +#ifdef MYX11_DEBUG + qDebug() << "QGLXGLContext::create" << hex << m_config << m_drawable; +#endif } else { if (!widget->isTopLevel()) { @@ -254,6 +275,9 @@ bool QGLXGLContext::create(QPaintDevice* device, QGLFormat& format, QPlatformGLC } m_context = glXCreateNewContext(m_xd->display, m_config, GLX_RGBA_TYPE, shareGlxContext, True); +#ifdef MYX11_DEBUG + qDebug() << "QGLXGLContext::create context" << m_context; +#endif // Get the XVisualInfo for the window: // XWindowAttributes windowAttribs; @@ -273,7 +297,9 @@ bool QGLXGLContext::create(QPaintDevice* device, QGLFormat& format, QPlatformGLC void QGLXGLContext::makeCurrent() { +#ifdef MYX11_DEBUG qDebug("QGLXGLContext::makeCurrent(window=0x%x, ctx=0x%x)", m_drawable, m_context); +#endif glXMakeCurrent(m_xd->display, m_drawable, m_context); } diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index 242f335..b5ae4fc 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -69,6 +69,8 @@ #undef ATOM #undef X11 +//#define MYX11_DEBUG + QT_BEGIN_NAMESPACE static int (*original_x_errhandler)(Display *dpy, XErrorEvent *); @@ -158,6 +160,9 @@ QTestLiteWindow::QTestLiteWindow(const QTestLiteIntegration *platformIntegration x, y, w, h, 0 /*border_width*/, xd->blackPixel(), xd->whitePixel()); +#ifdef MYX11_DEBUG + qDebug() << "QTestLiteWindow::QTestLiteWindow creating" << hex << x_window << window; +#endif } width = -1; @@ -673,7 +678,7 @@ GC QTestLiteWindow::createGC() void QTestLiteWindow::paintEvent() { #ifdef MYX11_DEBUG - qDebug() << "QTestLiteWindow::paintEvent" << shm_img.size() << painted; +// qDebug() << "QTestLiteWindow::paintEvent" << shm_img.size() << painted; #endif widget()->windowSurface()->flush(widget(), QRect(xpos,ypos,width, height), QPoint()); @@ -694,7 +699,7 @@ void QTestLiteWindow::resizeEvent(XConfigureEvent *e) height = e->height; #ifdef MYX11_DEBUG - qDebug() << hex << window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << "geometry" << xpos << ypos << width << height << "img:" << shm_img.size(); + qDebug() << hex << x_window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << "geometry" << xpos << ypos << width << height; #endif QWindowSystemInterface::handleGeometryChange(widget(), QRect(xpos, ypos, width, height)); @@ -833,7 +838,7 @@ Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) } #ifdef MYX11_DEBUG - qDebug() << "QTestLiteWindow::setWindowFlags" << hex << window << "flags" << flags; + qDebug() << "QTestLiteWindow::setWindowFlags" << hex << x_window << "flags" << flags; #endif Qt::WindowType type = static_cast(int(flags & Qt::WindowType_Mask)); @@ -963,7 +968,7 @@ Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) void QTestLiteWindow::setVisible(bool visible) { #ifdef MYX11_DEBUG - qDebug() << "QTestLiteWindow::setVisible" << visible << hex << window; + qDebug() << "QTestLiteWindow::setVisible" << visible << hex << x_window; #endif if (visible) XMapWindow(xd->display, x_window); -- cgit v0.12 From 9b33f9c47cf5346404c54196b72d0b3b80f32454 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 10 May 2010 15:15:06 +0200 Subject: Build fix for Lighthouse --- src/plugins/mediaservices/gstreamer/gstreamer.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/mediaservices/gstreamer/gstreamer.pro b/src/plugins/mediaservices/gstreamer/gstreamer.pro index 6e05120..15c4b09 100644 --- a/src/plugins/mediaservices/gstreamer/gstreamer.pro +++ b/src/plugins/mediaservices/gstreamer/gstreamer.pro @@ -36,7 +36,7 @@ SOURCES += \ qvideosurfacegstsink.cpp -!win32:!embedded:!mac:!symbian { +!win32:!embedded:!mac:!symbian:!embedded_lite { LIBS += -lXv HEADERS += \ -- cgit v0.12 From b2e80f7525546b494543c902dbf8efb8b8609fc5 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Mon, 10 May 2010 15:40:28 +0200 Subject: adjust mouse movement for the screen's offset --- src/plugins/platforms/vnc/qvncserver.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/vnc/qvncserver.cpp b/src/plugins/platforms/vnc/qvncserver.cpp index bd4d6ab..6424083 100644 --- a/src/plugins/platforms/vnc/qvncserver.cpp +++ b/src/plugins/platforms/vnc/qvncserver.cpp @@ -836,7 +836,8 @@ void QVNCServer::pointerEvent() // const QPoint offset = qvnc_screen->offset(); // QWSServer::sendMouseEvent(offset + QPoint(ev.x, ev.y), ev.buttons); - + QPoint eventPoint(ev.x, ev.y); + eventPoint += screen()->geometry().topLeft(); //qDebug() << "pointerEvent" << ev.x << ev.y << hex << ev.buttons; if (ev.wheelDirection == ev.WheelNone) { QEvent::Type type = QEvent::MouseMove; @@ -844,7 +845,7 @@ void QVNCServer::pointerEvent() bool isPress; if (buttonChange(buttons, ev.buttons, &button, &isPress)) type = isPress ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; - QWindowSystemInterface::handleMouseEvent(0, QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), ev.buttons); + QWindowSystemInterface::handleMouseEvent(0, eventPoint, eventPoint, ev.buttons); } else { // No buttons or motion reported at the same time as wheel events Qt::Orientation orientation; @@ -853,7 +854,7 @@ void QVNCServer::pointerEvent() else orientation = Qt::Vertical; int delta = 120 * ((ev.wheelDirection == ev.WheelLeft || ev.wheelDirection == ev.WheelUp) ? 1 : -1); - QWindowSystemInterface::handleWheelEvent(0, QPoint(ev.x, ev.y), QPoint(ev.x, ev.y), delta, orientation); + QWindowSystemInterface::handleWheelEvent(0, eventPoint, eventPoint, delta, orientation); } handleMsg = false; } -- cgit v0.12 From 075e96eba50013c583234b787562e09bb7535dd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 29 Apr 2010 14:47:35 +0200 Subject: Say hello to Qt for Native Client. This commits adds build system to support for the native client compiler (x86-only for now), sets up global defines, and adds compile fixes for QtCore and QtGui. Details: * Add mkspecs for linux-nacl-g++ and macx-nacl-c++ * Add nacl configure option * Add qconfig-minimal-system-dependencies.h * Define Q_OS_NACL in qglobal.h * Add qnacalunimplemented.h/cpp with POSIX stubs. * .pro file changes for cross-compiling on Mac --- configure | 77 ++++- mkspecs/qws/linux-nacl-g++/qmake.conf | 74 ++++ mkspecs/qws/linux-nacl-g++/qplatformdefs.h | 175 ++++++++++ mkspecs/qws/macx-generic-g++/qmake.conf | 6 +- mkspecs/qws/macx-nacl-g++/qmake.conf | 95 ++++++ mkspecs/qws/macx-nacl-g++/qplatformdefs.h | 175 ++++++++++ src/corelib/arch/qatomic_arch.h | 2 + src/corelib/corelib.pro | 2 +- src/corelib/global/global.pri | 4 + .../global/qconfig-minimal-system-dependencies.h | 371 +++++++++++++++++++++ src/corelib/global/qglobal.h | 6 + src/corelib/global/qnaclunimplemented.cpp | 156 +++++++++ src/corelib/global/qnaclunimplemented.h | 85 +++++ src/corelib/io/io.pri | 10 +- src/corelib/io/qresource.cpp | 2 +- src/corelib/kernel/kernel.pri | 4 +- src/corelib/kernel/qcore_unix.cpp | 3 +- src/corelib/kernel/qeventdispatcher_unix.cpp | 14 +- src/corelib/kernel/qeventdispatcher_unix_p.h | 2 +- src/corelib/thread/qthread_unix.cpp | 2 + src/corelib/tools/tools.pri | 2 +- src/gui/kernel/mac.pri | 2 +- .../kernel/qplatformintegrationfactory_lite.cpp | 2 +- src/gui/text/qfontdatabase_qws.cpp | 2 + src/src.pro | 2 + 25 files changed, 1254 insertions(+), 21 deletions(-) create mode 100644 mkspecs/qws/linux-nacl-g++/qmake.conf create mode 100644 mkspecs/qws/linux-nacl-g++/qplatformdefs.h create mode 100644 mkspecs/qws/macx-nacl-g++/qmake.conf create mode 100644 mkspecs/qws/macx-nacl-g++/qplatformdefs.h create mode 100644 src/corelib/global/qconfig-minimal-system-dependencies.h create mode 100644 src/corelib/global/qnaclunimplemented.cpp create mode 100644 src/corelib/global/qnaclunimplemented.h diff --git a/configure b/configure index 69df540..da34fb5 100755 --- a/configure +++ b/configure @@ -296,6 +296,12 @@ earlyArgParse() VAL=$1 fi ;; + -nacl) + shift; + VAR=nacl + VAL=$1 + ;; + -h|help|--help|-help) if [ "$VAL" = "yes" ]; then OPT_HELP="$VAL" @@ -353,6 +359,15 @@ earlyArgParse() CFG_EMBEDDED=no fi ;; + nacl) + echo "Using NaCl at $VAL." + PLATFORM_X11=no + PLATFORM_MAC=no + PLATFORM_QWS=no + CFG_NACL_PATH=$VAL + CFG_EMBEDDED=nacl + ;; + developer-build) CFG_DEV="yes" ;; @@ -928,6 +943,44 @@ if [ -d "$relpath/src/plugins/gfxdrivers" ]; then fi #------------------------------------------------------------------------------- +# Set Default NaCl options +#------------------------------------------------------------------------------- +if [ "$CFG_EMBEDDED" = "nacl" ]; then + echo "Setting NaCl options:" + echo "-static" + CFG_SHARED=no + echo "-embedded-lite nacl" + PLATFORM_EMBLITE=yes + echo "-fast" + OPT_FAST=yes + echo "-release" + CFG_DEBUG=no + echo "-qconfig minimal-system-dependencies" + CFG_QCONFIG=minimal-system-dependencies + + if [ `uname` = "Linux" ]; then + I_FLAGS="$I_FLAGS -I${CFG_NACL_PATH}/toolchain/linux_x86/sdk/nacl-sdk/include" + L_FLAGS="$L_FLAGS -I${CFG_NACL_PATH}/toolchain/linux_x86/sdk/nacl-sdk/lib" + else + I_FLAGS="$I_FLAGS -I${CFG_NACL_PATH}/toolchain/mac_x86/sdk/nacl-sdk/include" + L_FLAGS="$L_FLAGS -I${CFG_NACL_PATH}/toolchain/mac_x86/sdk/nacl-sdk/lib" + fi + + echo "-no-multimedia -no-webkit -no-phonon -no-nultimedia -no-mediaservices -no-xmlpatterns -no-script -no-sql-sqlite -nomake tests" + CFG_MULTIMEDIA=no + CFG_WEBKIT=no + CFG_PHONON=no + CFG_MULTIMEDIA=no + CFG_MEDIASERVICES=no + CFG_XMLPATTERNS=no + CFG_SCRIPT=no + CFG_SQLITE=no + CFG_SQL_sqlite=no + CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS tests" + QT_CONFIG="$QT_CONFIG nacl" +fi + +#------------------------------------------------------------------------------- # parse command line arguments #------------------------------------------------------------------------------- @@ -1024,6 +1077,10 @@ while [ "$#" -gt 0 ]; do VAL=$1 fi ;; + -nacl) + VAR=nacl + shift; + ;; -opengl) VAR=opengl # this option may or may not be followed by an argument @@ -1262,6 +1319,8 @@ while [ "$#" -gt 0 ]; do CFG_EMBEDDED=no fi ;; + nacl) + ;; sse) if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then CFG_SSE="$VAL" @@ -3114,6 +3173,10 @@ if [ -z "$TEST_COMPILER" ]; then exit 1 fi +if [ "$CFG_EMBEDDED" = "nacl" ]; then + TEST_COMPILER="nacl-gcc" +fi + # auto-detect precompiled header support if [ "$CFG_PRECOMPILE" = "auto" ]; then if [ `echo "$CFG_MAC_ARCHS" | wc -w` -gt 1 ]; then @@ -6599,6 +6662,13 @@ if [ "$PLATFORM_EMBLITE" = "yes" ]; then QT_CONFIG="$QT_CONFIG embedded_lite" rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes fi + +if [ "$CFG_EMBEDDED" = "nacl" ]; then + QMAKE_CONFIG="$QMAKE_CONFIG nacl pepper" + QT_CONFIG="$QT_CONFIG nacl pepper" + rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes +fi + QMakeVar set PRECOMPILED_DIR ".pch/$QMAKE_OUTDIR" QMakeVar set OBJECTS_DIR ".obj/$QMAKE_OUTDIR" QMakeVar set MOC_DIR ".moc/$QMAKE_OUTDIR" @@ -7802,10 +7872,11 @@ QMAKE_LIBDIR_QT = \$\$QT_BUILD_TREE/lib EOF # Ensure we can link to uninistalled libraries -if linkerSupportsFlag -rpath-link "$outpath/lib"; then - echo "QMAKE_LFLAGS += -Wl,-rpath-link,\$\$QT_BUILD_TREE/lib" >> "$CACHEFILE.tmp" +if [ "$CFG_EMBEDDED" != "nacl" ]; then + if linkerSupportsFlag -rpath-link "$outpath/lib"; then + echo "QMAKE_LFLAGS += -Wl,-rpath-link,\$\$QT_BUILD_TREE/lib" >> "$CACHEFILE.tmp" + fi fi - if [ -n "$QT_CFLAGS_PSQL" ]; then echo "QT_CFLAGS_PSQL = $QT_CFLAGS_PSQL" >> "$CACHEFILE.tmp" fi diff --git a/mkspecs/qws/linux-nacl-g++/qmake.conf b/mkspecs/qws/linux-nacl-g++/qmake.conf new file mode 100644 index 0000000..83ce65b --- /dev/null +++ b/mkspecs/qws/linux-nacl-g++/qmake.conf @@ -0,0 +1,74 @@ +# +# qmake configuration for building with nacl-g++ +# + +include(../../common/unix.conf) +include(../../common/qws.conf) + +QT = core gui + +# copy of ../../common/g++.conf, with modifications: + +QMAKE_CC = nacl-gcc +QMAKE_CXX = nacl-g++ +QMAKE_LINK = nacl-g++ +QMAKE_LINK_SHLIB = nacl-g++ + +#QMAKE_CC = gcc +QMAKE_CFLAGS += -pipe -DXP_UNIX -DNACL_STANDALONE=1 +QMAKE_CFLAGS_DEPS += -M +QMAKE_CFLAGS_WARN_ON += -Wall -W +QMAKE_CFLAGS_WARN_OFF += -w +QMAKE_CFLAGS_RELEASE += -O2 +QMAKE_CFLAGS_DEBUG += -g +QMAKE_CFLAGS_SHLIB += -fPIC +#QMAKE_CFLAGS_STATIC_LIB += -fPIC +QMAKE_CFLAGS_YACC += -Wno-unused -Wno-parentheses +QMAKE_CFLAGS_HIDESYMS += -fvisibility=hidden +QMAKE_CFLAGS_PRECOMPILE += -x c-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} +QMAKE_CFLAGS_USE_PRECOMPILE += -include ${QMAKE_PCH_OUTPUT_BASE} + +#QMAKE_CXX = g++ +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS +QMAKE_CXXFLAGS_DEPS += $$QMAKE_CFLAGS_DEPS +QMAKE_CXXFLAGS_WARN_ON += $$QMAKE_CFLAGS_WARN_ON +QMAKE_CXXFLAGS_WARN_OFF += $$QMAKE_CFLAGS_WARN_OFF +QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE +QMAKE_CXXFLAGS_DEBUG += $$QMAKE_CFLAGS_DEBUG +QMAKE_CXXFLAGS_SHLIB += $$QMAKE_CFLAGS_SHLIB +QMAKE_CXXFLAGS_STATIC_LIB += $$QMAKE_CFLAGS_STATIC_LIB +QMAKE_CXXFLAGS_YACC += $$QMAKE_CFLAGS_YACC +QMAKE_CXXFLAGS_HIDESYMS += $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden +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_LFLAGS += +QMAKE_LFLAGS_RELEASE += -Wl,-O1 +QMAKE_LFLAGS_DEBUG += +QMAKE_LFLAGS_APP += +QMAKE_LFLAGS_SHLIB += -shared +QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB +QMAKE_LFLAGS_SONAME += -Wl,-soname, +QMAKE_LFLAGS_THREAD += +QMAKE_LFLAGS_NOUNDEF += -Wl,--no-undefined +QMAKE_LFLAGS_RPATH = -Wl,-rpath, + +QMAKE_LIBS = -lgoogle_nacl_imc -lgoogle_nacl_npruntime -lgoogle_nacl_pgl -lgoogle_nacl_gpu -lpthread -lsrpc + +QMAKE_PCH_OUTPUT_EXT = .gch + +# -Bsymbolic-functions (ld) support +QMAKE_LFLAGS_BSYMBOLIC_FUNC = -Wl,-Bsymbolic-functions +QMAKE_LFLAGS_DYNAMIC_LIST = -Wl,--dynamic-list, + +# modifications to linux.conf +QMAKE_AR = nacl-ar q +QMAKE_OBJCOPY = nacl-objcopy +QMAKE_STRIP = nacl-strip +QMAKE_LIBS_DYNLOAD = + +load(qt_config) diff --git a/mkspecs/qws/linux-nacl-g++/qplatformdefs.h b/mkspecs/qws/linux-nacl-g++/qplatformdefs.h new file mode 100644 index 0000000..a670ee5 --- /dev/null +++ b/mkspecs/qws/linux-nacl-g++/qplatformdefs.h @@ -0,0 +1,175 @@ +/**************************************************************************** + ** + ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + ** All rights reserved. + ** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying + ** this package. + ** + ** GNU Lesser General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU Lesser + ** General Public License version 2.1 as published by the Free Software + ** Foundation and appearing in the file LICENSE.LGPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU Lesser General Public License version 2.1 requirements + ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + ** + ** In addition, as a special exception, Nokia gives you certain additional + ** rights. These rights are described in the Nokia Qt LGPL Exception + ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. + ** + ** If you have questions regarding the use of this file, please contact + ** Nokia at qt-info@nokia.com. + ** + ** + ** + ** + ** + ** + ** + ** + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + +#ifndef QPLATFORMDEFS_H +#define QPLATFORMDEFS_H + +// Get Qt defines/settings + +#define _POSIX_TIMERS + +#include "qglobal.h" + + +#define _POSIX_TIMERS +// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs + +// 1) need to reset default environment if _BSD_SOURCE is defined +// 2) need to specify POSIX thread interfaces explicitly in glibc 2.0 +// 3) it seems older glibc need this to include the X/Open stuff +#ifndef _GNU_SOURCE +# define _GNU_SOURCE +#endif + +#include + + +// We are hot - unistd.h should have turned on the specific APIs we requested + +#include +#include +#include +#include +#include +#include +#include +//#include + +#include +//#include +//#include + +#include +//#include +//#include +#include +#include +//#include +#ifndef QT_NO_IPV6IFNAME +#include +#endif + +// extra disabling. +#ifdef __native_client__ +#define QT_NO_FSFILEENGINE +#define QT_NO_TRANSLATION +#endif + +#ifdef QT_LARGEFILE_SUPPORT +#define QT_STATBUF struct stat64 +#define QT_STATBUF4TSTAT struct stat64 +#define QT_STAT ::stat64 +#define QT_FSTAT ::fstat64 +#define QT_LSTAT ::lstat64 +#define QT_OPEN ::open64 +#define QT_TRUNCATE ::truncate64 +#define QT_FTRUNCATE ::ftruncate64 +#define QT_LSEEK ::lseek64 +#else +#define QT_STATBUF struct stat +#define QT_STATBUF4TSTAT struct stat +#define QT_STAT ::stat +#define QT_FSTAT ::fstat +#define QT_LSTAT ::lstat +#define QT_OPEN ::open +#define QT_TRUNCATE ::truncate +#define QT_FTRUNCATE ::ftruncate +#define QT_LSEEK ::lseek +#endif + +#ifdef QT_LARGEFILE_SUPPORT +#define QT_FOPEN ::fopen64 +#define QT_FSEEK ::fseeko64 +#define QT_FTELL ::ftello64 +#define QT_FGETPOS ::fgetpos64 +#define QT_FSETPOS ::fsetpos64 +#define QT_FPOS_T fpos64_t +#define QT_OFF_T off64_t +#else +#define QT_FOPEN ::fopen +#define QT_FSEEK ::fseek +#define QT_FTELL ::ftell +#define QT_FGETPOS ::fgetpos +#define QT_FSETPOS ::fsetpos +#define QT_FPOS_T fpos_t +#define QT_OFF_T long +#endif + +#define QT_STAT_REG S_IFREG +#define QT_STAT_DIR S_IFDIR +#define QT_STAT_MASK S_IFMT +#define QT_STAT_LNK S_IFLNK +#define QT_SOCKET_CONNECT ::connect +#define QT_SOCKET_BIND ::bind +#define QT_FILENO fileno +#define QT_CLOSE ::close +#define QT_READ ::read +#define QT_WRITE ::write +#define QT_ACCESS ::access +#define QT_GETCWD ::getcwd +#define QT_CHDIR ::chdir +#define QT_MKDIR ::mkdir +#define QT_RMDIR ::rmdir +#define QT_OPEN_LARGEFILE O_LARGEFILE +#define QT_OPEN_RDONLY O_RDONLY +#define QT_OPEN_WRONLY O_WRONLY +#define QT_OPEN_RDWR O_RDWR +#define QT_OPEN_CREAT O_CREAT +#define QT_OPEN_TRUNC O_TRUNC +#define QT_OPEN_APPEND O_APPEND + +#define QT_SIGNAL_RETTYPE void +#define QT_SIGNAL_ARGS int +#define QT_SIGNAL_IGNORE SIG_IGN + +#if defined(__GLIBC__) && (__GLIBC__ >= 2) +#define QT_SOCKLEN_T socklen_t +#else +#define QT_SOCKLEN_T int +#endif + +#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500) +#define QT_SNPRINTF ::snprintf +#define QT_VSNPRINTF ::vsnprintf +#endif + + +#endif // QPLATFORMDEFS_H diff --git a/mkspecs/qws/macx-generic-g++/qmake.conf b/mkspecs/qws/macx-generic-g++/qmake.conf index 9096712..63bfc57 100644 --- a/mkspecs/qws/macx-generic-g++/qmake.conf +++ b/mkspecs/qws/macx-generic-g++/qmake.conf @@ -2,6 +2,8 @@ # qmake configuration for macx-g++ with Qtopia Core # +include(../../common/unix.conf) + MAKEFILE_GENERATOR = UNIX TARGET_PLATFORM = macx TEMPLATE = app @@ -18,7 +20,7 @@ QMAKE_YACCFLAGS = -d QMAKE_CFLAGS = -pipe QMAKE_CFLAGS_WARN_ON = -Wall -W QMAKE_CFLAGS_WARN_OFF = -QMAKE_CFLAGS_RELEASE = -O2 -fno-default-inline +QMAKE_CFLAGS_RELEASE = -O2 QMAKE_CFLAGS_DEBUG = -g QMAKE_CFLAGS_SHLIB = -fPIC QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses @@ -29,7 +31,7 @@ QMAKE_CXX = $(TB)c++ QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -DQT_NO_QWS_TRANSFORMED QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE +QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -fno-default-inline QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC diff --git a/mkspecs/qws/macx-nacl-g++/qmake.conf b/mkspecs/qws/macx-nacl-g++/qmake.conf new file mode 100644 index 0000000..0a54b4b --- /dev/null +++ b/mkspecs/qws/macx-nacl-g++/qmake.conf @@ -0,0 +1,95 @@ +# +# qmake configuration for macx-nacl-g++ with embedded-lite +# + +include(../../common/unix.conf) + +MAKEFILE_GENERATOR = UNIX +TEMPLATE = app +CONFIG += qt warn_on release link_prl +QT += core gui +QMAKE_INCREMENTAL_STYLE = sublib +QMAKE_EXTENSION_SHLIB = dylib + + +QMAKE_CC = nacl-gcc +QMAKE_CXX = nacl-g++ +QMAKE_LINK = nacl-g++ +QMAKE_LINK_SHLIB = nacl-g++ + +#QMAKE_CC = $(TB)cc +QMAKE_LEX = flex +QMAKE_LEXFLAGS = +QMAKE_YACC = yacc +QMAKE_YACCFLAGS = -d +QMAKE_CFLAGS = -pipe -DXP_UNIX -DNACL_STANDALONE=1 +QMAKE_CFLAGS_WARN_ON = -Wall -W +QMAKE_CFLAGS_WARN_OFF = +QMAKE_CFLAGS_RELEASE = -O2 +QMAKE_CFLAGS_DEBUG = -g +QMAKE_CFLAGS_SHLIB = -fPIC +QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses +QMAKE_CFLAGS_THREAD = -D_REENTRANT +QMAKE_CFLAGS_HIDESYMS = -fvisibility=hidden + +#QMAKE_CXX = $(TB)c++ +QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -DQT_NO_QWS_TRANSFORMED +QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON +QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF +QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -fno-default-inline +QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG +QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB +QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC +QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD +QMAKE_CXXFLAGS_HIDESYMS = $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden + +QMAKE_INCDIR = +QMAKE_LIBDIR = +QMAKE_INCDIR_X11 = +QMAKE_LIBDIR_X11 = +QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS] +QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS] +QMAKE_INCDIR_OPENGL = +QMAKE_LIBDIR_OPENGL = +QMAKE_INCDIR_QTOPIA = $(QPEDIR)/include +QMAKE_LIBDIR_QTOPIA = $(QPEDIR)/lib + +#QMAKE_LINK = $$QMAKE_CXX +#QMAKE_LINK_SHLIB = $$QMAKE_CXX +QMAKE_LFLAGS = +QMAKE_LFLAGS_RELEASE = +QMAKE_LFLAGS_DEBUG = +QMAKE_LFLAGS_SHLIB = -dynamiclib +QMAKE_LFLAGS_INCREMENTAL = -undefined suppress -flat_namespace +QMAKE_LFLAGS_PLUGIN = -bundle +QMAKE_LFLAGS_SONAME = +QMAKE_LFLAGS_THREAD = + +QMAKE_LIBS = -lgoogle_nacl_imc -lgoogle_nacl_npruntime -lgoogle_nacl_pgl -lgoogle_nacl_gpu -lpthread -lsrpc +QMAKE_LIBS_X11 = +QMAKE_LIBS_X11SM = +QMAKE_LIBS_QT = -lqte +QMAKE_LIBS_QT_THREAD = -lqte-mt +QMAKE_LIBS_QT_OPENGL = -lqgl +QMAKE_LIBS_QTOPIA = -lqpe -lqtopia +QMAKE_LIBS_THREAD = +QMAKE_LIBS_OPENGL = + +QMAKE_MOC = $$[QT_INSTALL_BINS]/moc +QMAKE_UIC = $$[QT_INSTALL_BINS]/uic + +QMAKE_AR = nacl-ar q +QMAKE_OBJCOPY = nacl-objcopy +QMAKE_STRIP = nacl-strip +QMAKE_RANLIB = + +QMAKE_TAR = tar -cf +QMAKE_GZIP = gzip -9f + +QMAKE_COPY = cp -f +QMAKE_MOVE = mv -f +QMAKE_DEL_FILE = rm -f +QMAKE_DEL_DIR = rmdir +QMAKE_CHK_DIR_EXISTS = test -d +QMAKE_MKDIR = mkdir -p +load(qt_config) diff --git a/mkspecs/qws/macx-nacl-g++/qplatformdefs.h b/mkspecs/qws/macx-nacl-g++/qplatformdefs.h new file mode 100644 index 0000000..a670ee5 --- /dev/null +++ b/mkspecs/qws/macx-nacl-g++/qplatformdefs.h @@ -0,0 +1,175 @@ +/**************************************************************************** + ** + ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + ** All rights reserved. + ** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying + ** this package. + ** + ** GNU Lesser General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU Lesser + ** General Public License version 2.1 as published by the Free Software + ** Foundation and appearing in the file LICENSE.LGPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU Lesser General Public License version 2.1 requirements + ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + ** + ** In addition, as a special exception, Nokia gives you certain additional + ** rights. These rights are described in the Nokia Qt LGPL Exception + ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. + ** + ** If you have questions regarding the use of this file, please contact + ** Nokia at qt-info@nokia.com. + ** + ** + ** + ** + ** + ** + ** + ** + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + +#ifndef QPLATFORMDEFS_H +#define QPLATFORMDEFS_H + +// Get Qt defines/settings + +#define _POSIX_TIMERS + +#include "qglobal.h" + + +#define _POSIX_TIMERS +// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs + +// 1) need to reset default environment if _BSD_SOURCE is defined +// 2) need to specify POSIX thread interfaces explicitly in glibc 2.0 +// 3) it seems older glibc need this to include the X/Open stuff +#ifndef _GNU_SOURCE +# define _GNU_SOURCE +#endif + +#include + + +// We are hot - unistd.h should have turned on the specific APIs we requested + +#include +#include +#include +#include +#include +#include +#include +//#include + +#include +//#include +//#include + +#include +//#include +//#include +#include +#include +//#include +#ifndef QT_NO_IPV6IFNAME +#include +#endif + +// extra disabling. +#ifdef __native_client__ +#define QT_NO_FSFILEENGINE +#define QT_NO_TRANSLATION +#endif + +#ifdef QT_LARGEFILE_SUPPORT +#define QT_STATBUF struct stat64 +#define QT_STATBUF4TSTAT struct stat64 +#define QT_STAT ::stat64 +#define QT_FSTAT ::fstat64 +#define QT_LSTAT ::lstat64 +#define QT_OPEN ::open64 +#define QT_TRUNCATE ::truncate64 +#define QT_FTRUNCATE ::ftruncate64 +#define QT_LSEEK ::lseek64 +#else +#define QT_STATBUF struct stat +#define QT_STATBUF4TSTAT struct stat +#define QT_STAT ::stat +#define QT_FSTAT ::fstat +#define QT_LSTAT ::lstat +#define QT_OPEN ::open +#define QT_TRUNCATE ::truncate +#define QT_FTRUNCATE ::ftruncate +#define QT_LSEEK ::lseek +#endif + +#ifdef QT_LARGEFILE_SUPPORT +#define QT_FOPEN ::fopen64 +#define QT_FSEEK ::fseeko64 +#define QT_FTELL ::ftello64 +#define QT_FGETPOS ::fgetpos64 +#define QT_FSETPOS ::fsetpos64 +#define QT_FPOS_T fpos64_t +#define QT_OFF_T off64_t +#else +#define QT_FOPEN ::fopen +#define QT_FSEEK ::fseek +#define QT_FTELL ::ftell +#define QT_FGETPOS ::fgetpos +#define QT_FSETPOS ::fsetpos +#define QT_FPOS_T fpos_t +#define QT_OFF_T long +#endif + +#define QT_STAT_REG S_IFREG +#define QT_STAT_DIR S_IFDIR +#define QT_STAT_MASK S_IFMT +#define QT_STAT_LNK S_IFLNK +#define QT_SOCKET_CONNECT ::connect +#define QT_SOCKET_BIND ::bind +#define QT_FILENO fileno +#define QT_CLOSE ::close +#define QT_READ ::read +#define QT_WRITE ::write +#define QT_ACCESS ::access +#define QT_GETCWD ::getcwd +#define QT_CHDIR ::chdir +#define QT_MKDIR ::mkdir +#define QT_RMDIR ::rmdir +#define QT_OPEN_LARGEFILE O_LARGEFILE +#define QT_OPEN_RDONLY O_RDONLY +#define QT_OPEN_WRONLY O_WRONLY +#define QT_OPEN_RDWR O_RDWR +#define QT_OPEN_CREAT O_CREAT +#define QT_OPEN_TRUNC O_TRUNC +#define QT_OPEN_APPEND O_APPEND + +#define QT_SIGNAL_RETTYPE void +#define QT_SIGNAL_ARGS int +#define QT_SIGNAL_IGNORE SIG_IGN + +#if defined(__GLIBC__) && (__GLIBC__ >= 2) +#define QT_SOCKLEN_T socklen_t +#else +#define QT_SOCKLEN_T int +#endif + +#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500) +#define QT_SNPRINTF ::snprintf +#define QT_VSNPRINTF ::vsnprintf +#endif + + +#endif // QPLATFORMDEFS_H diff --git a/src/corelib/arch/qatomic_arch.h b/src/corelib/arch/qatomic_arch.h index 00b288b..5106d29 100644 --- a/src/corelib/arch/qatomic_arch.h +++ b/src/corelib/arch/qatomic_arch.h @@ -88,6 +88,8 @@ QT_BEGIN_HEADER # include "QtCore/qatomic_sh.h" #elif defined(QT_ARCH_SH4A) # include "QtCore/qatomic_sh4a.h" +#elif defined(QT_ARCH_NACL) +# include "QtCore/qatomic_generic.h" #else # error "Qt has not been ported to this architecture" #endif diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 83fa044..5a810b1 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -18,7 +18,7 @@ include(codecs/codecs.pri) include(statemachine/statemachine.pri) include(xml/xml.pri) -mac|darwin:LIBS_PRIVATE += -framework ApplicationServices +!nacl:mac|darwin:LIBS_PRIVATE += -framework ApplicationServices mac:lib_bundle:DEFINES += QT_NO_DEBUG_PLUGIN_CHECK win32:DEFINES-=QT_NO_CAST_TO_ASCII diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index b916b4d..758c5ee 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -13,6 +13,10 @@ SOURCES += \ global/qmalloc.cpp \ global/qnumeric.cpp +nacl { + SOURCES += global/qnaclunimplemented.cpp +} + # qlibraryinfo.cpp includes qconfig.cpp INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global diff --git a/src/corelib/global/qconfig-minimal-system-dependencies.h b/src/corelib/global/qconfig-minimal-system-dependencies.h new file mode 100644 index 0000000..c7e3633 --- /dev/null +++ b/src/corelib/global/qconfig-minimal-system-dependencies.h @@ -0,0 +1,371 @@ +/**************************************************************************** + ** + ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + ** All rights reserved. + ** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying + ** this package. + ** + ** GNU Lesser General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU Lesser + ** General Public License version 2.1 as published by the Free Software + ** Foundation and appearing in the file LICENSE.LGPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU Lesser General Public License version 2.1 requirements + ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + ** + ** In addition, as a special exception, Nokia gives you certain additional + ** rights. These rights are described in the Nokia Qt LGPL Exception + ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. + ** + ** If you have questions regarding the use of this file, please contact + ** Nokia at qt-info@nokia.com. + ** + ** + ** + ** + ** + ** + ** + ** + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + +#define QT_FONTS_ARE_RESOURCES + +/* Data structures */ +#ifndef QT_NO_QUUID_STRING +# define QT_NO_QUUID_STRING +#endif +#ifndef QT_NO_STL +# define QT_NO_STL +#endif +#ifndef QT_NO_TEXTDATE +# define QT_NO_TEXTDATE +#endif +#ifndef QT_NO_DATESTRING +# define QT_NO_DATESTRING +#endif + +/* Dialogs */ +#ifndef QT_NO_FILEDIALOG +# define QT_NO_FILEDIALOG +#endif +#ifndef QT_NO_PRINTDIALOG +# define QT_NO_PRINTDIALOG +#endif +#ifndef QT_NO_PRINTPREVIEWDIALOG +# define QT_NO_PRINTPREVIEWDIALOG +#endif + + +/* File I/O */ +#ifndef QT_NO_DOM +# define QT_NO_DOM +#endif +#ifndef QT_NO_FILESYSTEMWATCHER +# define QT_NO_FILESYSTEMWATCHER +#endif +#ifndef QT_NO_FSFILEENGINE +# define QT_NO_FSFILEENGINE +#endif +#ifndef QT_NO_FILESYSTEMMODEL +# define QT_NO_FILESYSTEMMODEL +#endif +#ifndef QT_NO_FILESYSTEMMODEL +# define QT_NO_FILESYSTEMMODEL +#endif +#ifndef QT_NO_PROCESS +# define QT_NO_PROCESS +#endif +#ifndef QT_NO_TEMPORARYFILE +# define QT_NO_TEMPORARYFILE +#endif +#ifndef QT_NO_SETTINGS +# define QT_NO_SETTINGS +#endif +#ifndef QT_NO_LIBRARY +# define QT_NO_LIBRARY +#endif + +/* Fonts */ +#ifndef QT_NO_QWS_QPF2 +# define QT_NO_QWS_QPF2 +#endif + +/* Images */ +#ifndef QT_NO_IMAGEFORMATPLUGIN +# define QT_NO_IMAGEFORMATPLUGIN +#endif +#ifndef QT_NO_IMAGE_HEURISTIC_MASK +# define QT_NO_IMAGE_HEURISTIC_MASK +#endif +#ifndef QT_NO_IMAGE_TEXT +# define QT_NO_IMAGE_TEXT +#endif +#ifndef QT_NO_MOVIE +# define QT_NO_MOVIE +#endif + +/* Internationalization */ +#ifndef QT_NO_BIG_CODECS +# define QT_NO_BIG_CODECS +#endif +#ifndef QT_NO_QWS_INPUTMETHODS +# define QT_NO_QWS_INPUTMETHODS +#endif +#ifndef QT_NO_TEXTCODEC +# define QT_NO_TEXTCODEC +#endif +#ifndef QT_NO_CODECS +# define QT_NO_CODECS +#endif +#ifndef QT_NO_TEXTCODECPLUGIN +# define QT_NO_TEXTCODECPLUGIN +#endif +#ifndef QT_NO_TRANSLATION +# define QT_NO_TRANSLATION +#endif +#ifndef QT_NO_TRANSLATION_UTF8 +# define QT_NO_TRANSLATION_UTF8 +#endif + +/* ItemViews */ + +#ifndef QT_NO_DIRMODEL +# define QT_NO_DIRMODEL +#endif + +/* Kernel */ +#ifndef QT_NO_CLIPBOARD +# define QT_NO_CLIPBOARD +#endif +#ifndef QT_NO_CSSPARSER +# define QT_NO_CSSPARSER +#endif +#ifndef QT_NO_CURSOR +# define QT_NO_CURSOR +#endif +#ifndef QT_NO_DRAGANDDROP +# define QT_NO_DRAGANDDROP +#endif +#ifndef QT_NO_EFFECTS +# define QT_NO_EFFECTS +#endif +#ifndef QT_NO_SESSIONMANAGER +# define QT_NO_SESSIONMANAGER +#endif +#ifndef QT_NO_SHAREDMEMORY +# define QT_NO_SHAREDMEMORY +#endif +#ifndef QT_NO_SOUND +# define QT_NO_SOUND +#endif +#ifndef QT_NO_SYSTEMLOCALE +# define QT_NO_SYSTEMSEMAPHORE +#endif +#ifndef QT_NO_SYSTEMSEMAPHORE +# define QT_NO_SYSTEMSEMAPHORE +#endif +#ifndef QT_NO_TABLETEVENT +# define QT_NO_TABLETEVENT +#endif +#ifndef QT_NO_CRASHHANDLER +# define QT_NO_CRASHHANDLER +#endif +#ifndef QT_NO_CONCURRENT +# define QT_NO_CONCURRENT +#endif +#ifndef QT_NO_XMLSTREAM +# define QT_NO_XMLSTREAM +#endif +#ifndef QT_NO_XMLSTREAMREADER +# define QT_NO_XMLSTREAMREADER +#endif +#ifndef QT_NO_XMLSTREAMWRITER +# define QT_NO_XMLSTREAMWRITER +#endif + +/* Networking */ +#ifndef QT_NO_COP +# define QT_NO_COP +#endif +#ifndef QT_NO_HOSTINFO +# define QT_NO_HOSTINFO +#endif +#ifndef QT_NO_HTTP +# define QT_NO_HTTP +#endif +#ifndef QT_NO_NETWORKPROXY +# define QT_NO_NETWORKPROXY +#endif +#ifndef QT_NO_SOCKS5 +# define QT_NO_SOCKS5 +#endif +#ifndef QT_NO_UDPSOCKET +# define QT_NO_UDPSOCKET +#endif +#ifndef QT_NO_URLINFO +# define QT_NO_URLINFO +#endif +#ifndef QT_NO_FTP +# define QT_NO_FTP +#endif + +/* Painting */ +#ifndef QT_NO_COLORNAMES +# define QT_NO_COLORNAMES +#endif +#ifndef QT_NO_DIRECTPAINTER +# define QT_NO_DIRECTPAINTER +#endif +#ifndef QT_NO_PAINTONSCREEN +# define QT_NO_PAINTONSCREEN +#endif +#ifndef QT_NO_PAINT_DEBUG +# define QT_NO_PAINT_DEBUG +#endif +#ifndef QT_NO_PICTURE +# define QT_NO_PICTURE +#endif +#ifndef QT_NO_PRINTER +# define QT_NO_PRINTER +#endif +#ifndef QT_NO_CUPS +# define QT_NO_CUPS +#endif + +/* Qt for Embedded Linux */ +#ifndef QT_NO_QWSEMBEDWIDGET +# define QT_NO_QWSEMBEDWIDGET +#endif +#ifndef QT_NO_QWS_ALPHA_CURSOR +# define QT_NO_QWS_ALPHA_CURSOR +#endif +#ifndef QT_NO_QWS_CURSOR +# define QT_NO_QWS_CURSOR +#endif +#ifndef QT_NO_QWS_DECORATION_DEFAULT +# define QT_NO_QWS_DECORATION_DEFAULT +#endif +#ifndef QT_NO_QWS_DECORATION_STYLED +# define QT_NO_QWS_DECORATION_STYLED +#endif +#ifndef QT_NO_QWS_DECORATION_WINDOWS +# define QT_NO_QWS_DECORATION_WINDOWS +#endif +#ifndef QT_NO_QWS_MANAGER +# define QT_NO_QWS_MANAGER +#endif +#ifndef QT_NO_QWS_KEYBOARD +# define QT_NO_QWS_KEYBOARD +#endif +#ifndef QT_NO_QWS_MOUSE +# define QT_NO_QWS_MOUSE +#endif +#ifndef QT_NO_QWS_MOUSE_AUTO +# define QT_NO_QWS_MOUSE_AUTO +#endif +#ifndef QT_NO_QWS_MOUSE_MANUAL +# define QT_NO_QWS_MOUSE_MANUAL +#endif +#ifndef QT_NO_QWS_MULTIPROCESS +# define QT_NO_QWS_MULTIPROCESS +#endif +#ifndef QT_NO_QWS_SOUNDSERVER +# define QT_NO_QWS_SOUNDSERVER +#endif +#ifndef QT_NO_SXE +# define QT_NO_SXE +#endif +#ifndef QT_NO_QWS_PROPERTIES +# define QT_NO_QWS_PROPERTIES +#endif +#ifndef QT_NO_QWS_PROXYSCREEN +# define QT_NO_QWS_PROXYSCREEN +#endif +#ifndef QT_NO_QWS_DYNAMICSCREENTRANSFORMATION +# define QT_NO_QWS_DYNAMICSCREENTRANSFORMATION +#endif +#ifndef QT_NO_QWS_LINUXFB +# define QT_NO_QWS_LINUXFB +#endif +#ifndef QT_NO_QWS_MOUSE_PC +# define QT_NO_QWS_MOUSE_PC +#endif +#ifndef QT_NO_QWS_MOUSE_LINUXTP +# define QT_NO_QWS_MOUSE_LINUXTP +#endif +#ifndef QT_NO_QWS_QPF +# define QT_NO_QWS_QPF +#endif + +/* SVG */ +#ifndef QT_NO_SVG +# define QT_NO_SVG +#endif +#ifndef QT_NO_GRAPHICSSVGITEM +# define QT_NO_GRAPHICSSVGITEM +#endif +#ifndef QT_NO_SVGGENERATOR +# define QT_NO_SVGGENERATOR +#endif +#ifndef QT_NO_SVGRENDERER +# define QT_NO_SVGRENDERER +#endif +#ifndef QT_NO_SVGWIDGET +# define QT_NO_SVGWIDGET +#endif + +/* Styles */ +#ifndef QT_NO_STYLE_MOTIF +# define QT_NO_STYLE_MOTIF +#endif +#ifndef QT_NO_STYLE_CDE +# define QT_NO_STYLE_CDE +#endif +#ifndef QT_NO_STYLE_STYLESHEET +# define QT_NO_STYLE_STYLESHEET +#endif +#ifndef QT_NO_STYLE_WINDOWSCE +# define QT_NO_STYLE_WINDOWSCE +#endif +#ifndef QT_NO_STYLE_WINDOWSMOBILE +# define QT_NO_STYLE_WINDOWSMOBILE +#endif +#ifndef QT_NO_STYLE_WINDOWSVISTA +# define QT_NO_STYLE_WINDOWSVISTA +#endif +#ifndef QT_NO_STYLE_WINDOWSXP +# define QT_NO_STYLE_WINDOWSXP +#endif + +/* Utilities */ +#ifndef QT_NO_ACCESSIBILITY +# define QT_NO_ACCESSIBILITY +#endif +#ifndef QT_NO_COMPLETER +# define QT_NO_COMPLETER +#endif +#ifndef QT_NO_DESKTOPSERVICES +# define QT_NO_DESKTOPSERVICES +#endif +#ifndef QT_NO_SCRIPT +# define QT_NO_SCRIPT +#endif +#ifndef QT_NO_SYSTEMTRAYICON +# define QT_NO_SYSTEMTRAYICON +#endif + +/* Windows */ +#ifndef QT_NO_WIN_ACTIVEQT +# define QT_NO_WIN_ACTIVEQT +#endif diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index ca3219f..45153b8 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -216,6 +216,8 @@ namespace QT_NAMESPACE {} # define Q_OS_ULTRIX #elif defined(sinix) # define Q_OS_RELIANT +#elif defined(__native_client__) +# define Q_OS_NACL #elif defined(__linux__) || defined(__linux) # define Q_OS_LINUX #elif defined(__FreeBSD__) || defined(__DragonFly__) @@ -2661,6 +2663,10 @@ QT_LICENSED_MODULE(DBus) # define QT_NO_PROCESS #endif +#ifdef Q_OS_NACL +#include +#endif + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/corelib/global/qnaclunimplemented.cpp b/src/corelib/global/qnaclunimplemented.cpp new file mode 100644 index 0000000..618ff3e --- /dev/null +++ b/src/corelib/global/qnaclunimplemented.cpp @@ -0,0 +1,156 @@ +/**************************************************************************** + ** + ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + ** All rights reserved. + ** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying + ** this package. + ** + ** GNU Lesser General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU Lesser + ** General Public License version 2.1 as published by the Free Software + ** Foundation and appearing in the file LICENSE.LGPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU Lesser General Public License version 2.1 requirements + ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + ** + ** In addition, as a special exception, Nokia gives you certain additional + ** rights. These rights are described in the Nokia Qt LGPL Exception + ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. + ** + ** If you have questions regarding the use of this file, please contact + ** Nokia at qt-info@nokia.com. + ** + ** + ** + ** + ** + ** + ** + ** + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + +#include "qnaclunimplemented.h" +#include +#include + +/* + The purpose of this file is to stub out certain functions + that are not provided by the Native Client SDK. This is + done as an alterative to sprinkling the Qt sources with + NACL ifdefs. + + There are two main classes of functions: + + - Fuctions that are called but can have no effect: + For these we simply give an empty implementation + + - Functions that are referenced in the source code, but + is not/must not be called at run-time: + These we either leave undefined or implement with a + qFatal. + + This is a work in progress. +*/ + +extern "C" { + +void pthread_cleanup_push(void (*)(void *), void *) +{ + +} + +void pthread_cleanup_pop(int) +{ + +} + +int pthread_setcancelstate(int, int *) +{ + return 0; +} + +int pthread_setcanceltype(int, int *) +{ + return 0; +} + +void pthread_testcancel(void) +{ + +} + + +int pthread_cancel(pthread_t) +{ + return 0; +} + +int pthread_attr_setinheritsched(pthread_attr_t *,int) +{ + return 0; +} + + +int pthread_attr_getinheritsched(const pthread_attr_t *, int *) +{ + return 0; +} + +// event dispatcher, select +//struct fd_set; +//struct timeval; + +int fcntl(int, int, ...) +{ + return 0; +} + +int sigaction(int, const struct sigaction *, struct sigaction *) +{ + return 0; +} + +int open(const char *, int, ...) +{ + return 0; +} + +int open64(const char *, int, ...) +{ + return 0; +} + +int access(const char *, int) +{ + return 0; +} + +typedef long off64_t; +off64_t ftello64(void *) +{ + qFatal("ftello64 called"); + return 0; +} + +off64_t lseek64(int, off_t, int) +{ + qFatal("lseek64 called"); + return 0; +} + +} // Extern C + +int select(int, fd_set *, fd_set *, fd_set *, struct timeval *) +{ + return 0; +} diff --git a/src/corelib/global/qnaclunimplemented.h b/src/corelib/global/qnaclunimplemented.h new file mode 100644 index 0000000..84085b5 --- /dev/null +++ b/src/corelib/global/qnaclunimplemented.h @@ -0,0 +1,85 @@ +/**************************************************************************** + ** + ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + ** All rights reserved. + ** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying + ** this package. + ** + ** GNU Lesser General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU Lesser + ** General Public License version 2.1 as published by the Free Software + ** Foundation and appearing in the file LICENSE.LGPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU Lesser General Public License version 2.1 requirements + ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + ** + ** In addition, as a special exception, Nokia gives you certain additional + ** rights. These rights are described in the Nokia Qt LGPL Exception + ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. + ** + ** If you have questions regarding the use of this file, please contact + ** Nokia at qt-info@nokia.com. + ** + ** + ** + ** + ** + ** + ** + ** + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + +#ifndef QNACLUNIMPLEMENTED_H +#define QNACLUNIMPLEMENTED_H + +#ifdef Q_OS_NACL + +// pthread +#include +#define PTHREAD_CANCEL_DISABLE 1 +#define PTHREAD_CANCEL_ENABLE 2 +#define PTHREAD_INHERIT_SCHED 3 + +extern "C" { + +void pthread_cleanup_push(void (*handler)(void *), void *arg); +void pthread_cleanup_pop(int execute); + +int pthread_setcancelstate(int state, int *oldstate); +int pthread_setcanceltype(int type, int *oldtype); +void pthread_testcancel(void); +int pthread_cancel(pthread_t thread); + +int pthread_attr_setinheritsched(pthread_attr_t *attr, + int inheritsched); +int pthread_attr_getinheritsched(const pthread_attr_t *attr, + int *inheritsched); + +// event dispatcher, select +//struct fd_set; +//struct timeval; +int fcntl(int fildes, int cmd, ...); +int sigaction(int sig, const struct sigaction * act, struct sigaction * oact); + +typedef long off64_t; +off64_t ftello64(void *stream); +off64_t lseek64(int fildes, off_t offset, int whence); +int open64(const char *path, int oflag, ...); + +} + +int select(int nfds, fd_set * readfds, fd_set * writefds, fd_set * errorfds, struct timeval * timeout); + +#endif //Q_OS_NACL + +#endif //QNACLUNIMPLEMENTED_H diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index ef448b1..7c14886 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -69,7 +69,7 @@ win32 { SOURCES += io/qfsfileengine_iterator_unix.cpp symbian:SOURCES += io/qprocess_symbian.cpp else:SOURCES += io/qprocess_unix.cpp - macx-*: { + !nacl:macx-*: { HEADERS += io/qfilesystemwatcher_fsevents_p.h SOURCES += io/qsettings_mac.cpp io/qfilesystemwatcher_fsevents.cpp } @@ -84,9 +84,11 @@ win32 { io/qfilesystemwatcher_dnotify_p.h } - freebsd-*|macx-*|darwin-*|openbsd-*:{ - SOURCES += io/qfilesystemwatcher_kqueue.cpp - HEADERS += io/qfilesystemwatcher_kqueue_p.h + !nacl { + freebsd-*|macx-*|darwin-*|openbsd-*:{ + SOURCES += io/qfilesystemwatcher_kqueue.cpp + HEADERS += io/qfilesystemwatcher_kqueue_p.h + } } symbian { diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index 8e76e9e..783fbb0 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -928,7 +928,7 @@ public: } }; -#if defined(Q_OS_UNIX) +#if defined(Q_OS_UNIX) && ! defined (Q_OS_NACL) #define QT_USE_MMAP #endif diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index 1851e04..6f53a3f 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -78,12 +78,12 @@ wince*: { kernel/qfunctions_wince.h } -mac:!embedded { +mac:!embedded:!embedded_lite { SOURCES += \ kernel/qcoreapplication_mac.cpp } -mac { +mac:!nacl { SOURCES += \ kernel/qcore_mac.cpp } diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp index e0d92c0..685576b 100644 --- a/src/corelib/kernel/qcore_unix.cpp +++ b/src/corelib/kernel/qcore_unix.cpp @@ -42,7 +42,8 @@ #include "qcore_unix_p.h" #include "qelapsedtimer.h" -#ifndef Q_OS_VXWORKS +#ifdef Q_OS_NACL +#elif !defined (Q_OS_VXWORKS) # if !defined(Q_OS_HPUX) || defined(__ia64) # include # endif diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp index f7d45ac..0c336e7 100644 --- a/src/corelib/kernel/qeventdispatcher_unix.cpp +++ b/src/corelib/kernel/qeventdispatcher_unix.cpp @@ -112,7 +112,9 @@ QEventDispatcherUNIXPrivate::QEventDispatcherUNIXPrivate() bool pipefail = false; // initialize the common parts of the event loop -#if defined(Q_OS_INTEGRITY) +#if defined(Q_OS_NACL) + // do nothing. +#elif defined(Q_OS_INTEGRITY) // INTEGRITY doesn't like a "select" on pipes, so use socketpair instead if (socketpair(AF_INET, SOCK_STREAM, PF_INET, thread_pipe) == -1) { perror("QEventDispatcherUNIXPrivate(): Unable to create socket pair"); @@ -157,7 +159,9 @@ QEventDispatcherUNIXPrivate::QEventDispatcherUNIXPrivate() QEventDispatcherUNIXPrivate::~QEventDispatcherUNIXPrivate() { -#if defined(Q_OS_VXWORKS) +#if defined(Q_OS_NACL) + // do nothing. +#elif defined(Q_OS_VXWORKS) close(thread_pipe[0]); char name[20]; @@ -312,7 +316,7 @@ int QEventDispatcherUNIXPrivate::doSelect(QEventLoop::ProcessEventsFlags flags, QTimerInfoList::QTimerInfoList() { -#if (_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(Q_OS_MAC) +#if (_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(Q_OS_MAC) && !defined(Q_OS_NACL) if (!QElapsedTimer::isMonotonic()) { // not using monotonic timers, initialize the timeChanged() machinery previousTime = qt_gettime(); @@ -364,6 +368,10 @@ timeval qAbs(const timeval &t) */ bool QTimerInfoList::timeChanged(timeval *delta) { +#ifdef Q_OS_NACL + Q_UNUSED(delta) + return false; // Calling "times" crashes. +#endif struct tms unused; clock_t currentTicks = times(&unused); diff --git a/src/corelib/kernel/qeventdispatcher_unix_p.h b/src/corelib/kernel/qeventdispatcher_unix_p.h index cbe58de..d38acf3 100644 --- a/src/corelib/kernel/qeventdispatcher_unix_p.h +++ b/src/corelib/kernel/qeventdispatcher_unix_p.h @@ -64,7 +64,7 @@ # include #else # include -# if !defined(Q_OS_HPUX) || defined(__ia64) +# if (!defined(Q_OS_HPUX) || defined(__ia64)) && !defined(Q_OS_NACL) # include # endif #endif diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index 6b34b5f..47a13d7 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -457,6 +457,7 @@ void QThread::usleep(unsigned long usecs) // Does some magic and calculate the Unix scheduler priorities // sched_policy is IN/OUT: it must be set to a valid policy before calling this function // sched_priority is OUT only +#if defined(Q_OS_DARWIN) || !defined(Q_OS_OPENBSD) && !defined(Q_OS_SYMBIAN) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING-0 >= 0) static bool calculateUnixPriority(int priority, int *sched_policy, int *sched_priority) { #ifdef SCHED_IDLE @@ -484,6 +485,7 @@ static bool calculateUnixPriority(int priority, int *sched_policy, int *sched_pr *sched_priority = prio; return true; } +#endif void QThread::start(Priority priority) { diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 4e0ebbc..f540f14 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -83,7 +83,7 @@ SOURCES += \ symbian:SOURCES+=tools/qlocale_symbian.cpp -mac:SOURCES += tools/qelapsedtimer_mac.cpp +!nacl:mac:SOURCES += tools/qelapsedtimer_mac.cpp else:symbian:SOURCES += tools/qelapsedtimer_symbian.cpp else:unix:SOURCES += tools/qelapsedtimer_unix.cpp else:win32:SOURCES += tools/qelapsedtimer_win.cpp diff --git a/src/gui/kernel/mac.pri b/src/gui/kernel/mac.pri index 1538510..eb47ce9 100644 --- a/src/gui/kernel/mac.pri +++ b/src/gui/kernel/mac.pri @@ -1,4 +1,4 @@ -!x11:!embedded:mac { +!x11:!embedded:!nacl:mac { LIBS_PRIVATE += -framework Carbon -lz *-mwerks:INCLUDEPATH += compat } diff --git a/src/gui/kernel/qplatformintegrationfactory_lite.cpp b/src/gui/kernel/qplatformintegrationfactory_lite.cpp index 9a00dea..cd7d171 100644 --- a/src/gui/kernel/qplatformintegrationfactory_lite.cpp +++ b/src/gui/kernel/qplatformintegrationfactory_lite.cpp @@ -60,8 +60,8 @@ QPlatformIntegration *QPlatformIntegrationFactory::create(const QString& key) QStringList paramList = key.split(QLatin1Char(':')); QString platform = paramList.takeFirst().toLower(); - qDebug() << loader()->keys(); #if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) + qDebug() << loader()->keys(); if (QPlatformIntegrationFactoryInterface *factory = qobject_cast(loader()->instance(platform))) ret = factory->create(platform, paramList); #endif diff --git a/src/gui/text/qfontdatabase_qws.cpp b/src/gui/text/qfontdatabase_qws.cpp index 4dd5019..09fb07c 100644 --- a/src/gui/text/qfontdatabase_qws.cpp +++ b/src/gui/text/qfontdatabase_qws.cpp @@ -388,12 +388,14 @@ static void initializeDb() } #endif +#ifndef QT_NO_QWS_QPF2 QDir dir(fontpath, QLatin1String("*.qpf2")); for (int i = 0; i < int(dir.count()); ++i) { const QByteArray file = QFile::encodeName(dir.absoluteFilePath(dir[i])); //qDebug() << "looking at" << file; db->addQPF2File(file); } +#endif #endif //QT_FONTS_ARE_RESOURCES diff --git a/src/src.pro b/src/src.pro index 9c4831c..d15e973 100644 --- a/src/src.pro +++ b/src/src.pro @@ -5,6 +5,8 @@ unset(SRC_SUBDIRS) win32:SRC_SUBDIRS += src_winmain symbian:SRC_SUBDIRS += src_s60main SRC_SUBDIRS += src_corelib src_xml src_network src_sql src_testlib +nacl: SRC_SUBDIRS -= src_network src_testlib +win32:SRC_SUBDIRS += src_activeqt !symbian:contains(QT_CONFIG, dbus):SRC_SUBDIRS += src_dbus !contains(QT_CONFIG, no-gui): SRC_SUBDIRS += src_gui !wince*:!symbian:!vxworks:contains(QT_CONFIG, qt3support): SRC_SUBDIRS += src_qt3support -- cgit v0.12 From 03db204f7c2b0c33c7235080362c7838980d0d8e Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Fri, 14 May 2010 12:42:45 +0200 Subject: make handle{Keyboard|Mouse|Wheel}Event thread-safe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed by: Jørgen --- src/gui/kernel/qeventdispatcher_glib_lite.cpp | 2 ++ src/gui/kernel/qeventdispatcher_lite.cpp | 2 ++ src/gui/kernel/qwindowsysteminterface.cpp | 12 ++++++++++++ src/gui/kernel/qwindowsysteminterface.h | 8 +++++--- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qeventdispatcher_glib_lite.cpp b/src/gui/kernel/qeventdispatcher_glib_lite.cpp index 0cfea8a..744925c 100644 --- a/src/gui/kernel/qeventdispatcher_glib_lite.cpp +++ b/src/gui/kernel/qeventdispatcher_glib_lite.cpp @@ -79,6 +79,8 @@ static gboolean userEventSourceDispatch(GSource *s, GSourceFunc, gpointer) QWindowSystemInterface::UserEvent * event; while (QWindowSystemInterfacePrivate::userEventsQueued()) { event = QWindowSystemInterfacePrivate::getUserEvent(); + if (!event) + break; // send through event filter if (source->q->filterEvent(event)) { diff --git a/src/gui/kernel/qeventdispatcher_lite.cpp b/src/gui/kernel/qeventdispatcher_lite.cpp index d500ad6..5b99a2f 100644 --- a/src/gui/kernel/qeventdispatcher_lite.cpp +++ b/src/gui/kernel/qeventdispatcher_lite.cpp @@ -89,6 +89,8 @@ bool QEventDispatcherLite::processEvents(QEventLoop::ProcessEventsFlags flags) && QWindowSystemInterfacePrivate::userEventsQueued() > 0) { // process a pending user input event event = QWindowSystemInterfacePrivate::getUserEvent(); + if (!event) + break; } else { break; } diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index d7b5eef..05ca3d3 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -52,6 +52,7 @@ QTime QWindowSystemInterface::eventTime; // QList QWindowSystemInterfacePrivate::userEventQueue; +QMutex QWindowSystemInterfacePrivate::queueMutex; extern QPointer qt_last_mouse_receiver; /*! @@ -109,4 +110,15 @@ void QWindowSystemInterface::handleWheelEvent(QWidget *tlw, ulong timestamp, con QWindowSystemInterfacePrivate::queueUserEvent(e); } +QWindowSystemInterface::UserEvent * QWindowSystemInterfacePrivate::getUserEvent() +{ + queueMutex.lock(); + QWindowSystemInterface::UserEvent *ret; + if (userEventQueue.isEmpty()) + ret = 0; + else + ret = userEventQueue.takeFirst(); + queueMutex.unlock(); + return ret; +} QT_END_NAMESPACE diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index 70b2830..d9bfc70 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -46,6 +46,7 @@ #include #include #include +#include QT_BEGIN_HEADER @@ -128,10 +129,11 @@ private: class QWindowSystemInterfacePrivate { public: static QList userEventQueue; + static QMutex queueMutex; - static int userEventsQueued() { return userEventQueue.count(); } - static QWindowSystemInterface::UserEvent * getUserEvent() { return userEventQueue.takeFirst(); } - static void queueUserEvent(QWindowSystemInterface::UserEvent *ev) { userEventQueue.append(ev); } + static int userEventsQueued() { queueMutex.lock(); int ret = userEventQueue.count(); queueMutex.unlock(); return ret; } + static QWindowSystemInterface::UserEvent * getUserEvent(); + static void queueUserEvent(QWindowSystemInterface::UserEvent *ev) { queueMutex.lock(); userEventQueue.append(ev); queueMutex.unlock(); } }; QT_END_NAMESPACE -- cgit v0.12 From 3cd3206cdaf4b1cf0ccf50b2d0a7d67a68be582e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 14 May 2010 13:18:23 +0200 Subject: Hardcode qDetectCPUFeatures to 0 for NaCl. The assembler fails verification, disable for now. --- src/corelib/tools/qsimd.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index 1ef513c..11357b3 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -54,7 +54,12 @@ uint qDetectCPUFeatures() if (features != 0xffffffff) return features; -#if defined (Q_OS_WINCE) +#if defined (Q_OS_NACL) + // The qDetectCPUFeatures assembler fails verification in the + // Native Client sandbox due to use of pushf/popf. + features = 0; + return features; +#elif defined (Q_OS_WINCE) #if defined (ARM) if (IsProcessorFeaturePresent(PF_ARM_INTEL_WMMX)) { features = IWMMXT; -- cgit v0.12 From 8ace0f0b97a4b321037e034b35b6342cf0e779cf Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 19 May 2010 11:15:21 +0200 Subject: fix event dispatcher sleep problem on Android --- src/gui/kernel/qapplication_p.h | 3 +++ src/gui/kernel/qwindowsysteminterface.cpp | 12 ++++++++++++ src/gui/kernel/qwindowsysteminterface.h | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 7202ae5..7ad8ca5 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -322,6 +322,9 @@ public: #if defined(Q_WS_LITE) static QPlatformIntegration *platformIntegration() { return platform_integration; } + + static QAbstractEventDispatcher *qt_lite_core_dispatcher() + { return QCoreApplication::instance()->d_func()->threadData->eventDispatcher; } #endif void createEventDispatcher(); diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 05ca3d3..22b45ac 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qwindowsysteminterface.h" #include "qapplication_p.h" +#include QT_BEGIN_NAMESPACE @@ -121,4 +122,15 @@ QWindowSystemInterface::UserEvent * QWindowSystemInterfacePrivate::getUserEvent( queueMutex.unlock(); return ret; } + +void QWindowSystemInterfacePrivate::queueUserEvent(QWindowSystemInterface::UserEvent *ev) +{ + queueMutex.lock(); + userEventQueue.append(ev); + queueMutex.unlock(); + + QAbstractEventDispatcher *dispatcher = QApplicationPrivate::qt_lite_core_dispatcher(); + if (dispatcher) + dispatcher->wakeUp(); +} QT_END_NAMESPACE diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index d9bfc70..e0c46d1 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -133,7 +133,7 @@ public: static int userEventsQueued() { queueMutex.lock(); int ret = userEventQueue.count(); queueMutex.unlock(); return ret; } static QWindowSystemInterface::UserEvent * getUserEvent(); - static void queueUserEvent(QWindowSystemInterface::UserEvent *ev) { queueMutex.lock(); userEventQueue.append(ev); queueMutex.unlock(); } + static void queueUserEvent(QWindowSystemInterface::UserEvent *ev); }; QT_END_NAMESPACE -- cgit v0.12 From 4fa3766090972de9faf9c25d9cba6d5ab467abeb Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 26 May 2010 15:46:01 +0200 Subject: touch interface for lighthouse plugins --- src/gui/kernel/qapplication_lite.cpp | 31 +++++++++++++++++++++++++++++++ src/gui/kernel/qapplication_p.h | 1 + src/gui/kernel/qwindowsysteminterface.cpp | 9 +++++++++ src/gui/kernel/qwindowsysteminterface.h | 23 +++++++++++++++++++++++ 4 files changed, 64 insertions(+) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 5fc56a8..491dd02 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -102,6 +102,11 @@ void QApplicationPrivate::processUserEvent(QWindowSystemInterface::UserEvent *e) case QEvent::KeyRelease: QApplicationPrivate::processKeyEvent(static_cast(e)); break; + case QEvent::TouchBegin: + case QEvent::TouchUpdate: + case QEvent::TouchEnd: + QApplicationPrivate::processTouchEvent(static_cast(e)); + break; default: qWarning() << "Unknown user input event type:" << e->type; break; @@ -797,4 +802,30 @@ void QApplicationPrivate::processCloseEvent(QWidget *tlw) tlw->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent); } +void QApplicationPrivate::processTouchEvent(QWindowSystemInterface::TouchEvent *e) +{ + QList touchPoints; + Qt::TouchPointStates states; + + int primaryPoint = -1; + foreach(struct QWindowSystemInterface::TouchPoint point, e->points) { + QTouchEvent::TouchPoint p; + p.setId(point.id); + p.setPressure(point.pressure); + states |= point.state; + if (point.isPrimary) { + point.state |= Qt::TouchPointPrimary; + primaryPoint = point.id; + } + p.setState(point.state); + p.setRect(point.area); + p.setScreenPos(point.area.center()); + p.setNormalizedPos(point.normalPosition); + + touchPoints.append(p); + } + + translateRawTouchEvent(e->widget.data(), e->devType, touchPoints); +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 7ad8ca5..f06826d 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -489,6 +489,7 @@ public: static void processMouseEvent(QWindowSystemInterface::MouseEvent *e); static void processKeyEvent(QWindowSystemInterface::KeyEvent *e); static void processWheelEvent(QWindowSystemInterface::WheelEvent *e); + static void processTouchEvent(QWindowSystemInterface::TouchEvent *e); static void processCloseEvent(QWidget *tlw); static void processGeometryChange(QWidget *tlw, const QRect &newRect); diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 22b45ac..102d1a3 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -133,4 +133,13 @@ void QWindowSystemInterfacePrivate::queueUserEvent(QWindowSystemInterface::UserE if (dispatcher) dispatcher->wakeUp(); } + +void QWindowSystemInterface::handleTouchEvent(QWidget *tlw, ulong timestamp, QEvent::Type type, QTouchEvent::DeviceType devType, QList points) +{ + if (!points.size()) // Touch events must have at least one point + return; + TouchEvent *e = new TouchEvent(tlw, timestamp, type, devType, points); + QWindowSystemInterfacePrivate::queueUserEvent(e); +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index e0c46d1..ca73305 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -75,6 +75,21 @@ public: static void handleWheelEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o); + struct TouchPoint { + int id; // for application use + bool isPrimary; // for application use + QPointF normalPosition; // touch device coordinates, (0 to 1, 0 to 1) + QRectF area; // the touched area, centered at position in screen coordinates + qreal pressure; // 0 to 1 + Qt::TouchPointStates state; //Qt::TouchPoint{Pressed|Moved|Stationary|Released} + }; + + static void handleTouchEvent(QWidget *w, QEvent::Type type, QTouchEvent::DeviceType devType, QList points) { + handleTouchEvent(w, eventTime.elapsed(), type, devType, points); + } + + static void handleTouchEvent(QWidget *w, ulong timestamp, QEvent::Type type, QTouchEvent::DeviceType devType, QList points); + // delivered directly by the plugin via spontaneous events static void handleGeometryChange(QWidget *w, const QRect &newRect); static void handleCloseEvent(QWidget *w); @@ -121,6 +136,14 @@ public: Qt::KeyboardModifiers modifiers; }; + class TouchEvent : public UserEvent { + public: + TouchEvent(QWidget *w, ulong time, QEvent::Type t, QTouchEvent::DeviceType d, QList p) + :UserEvent(w, time, t) { devType = d; points = p; } + QTouchEvent::DeviceType devType; + QList points; + }; + private: static QTime eventTime; -- cgit v0.12 From e998a905f6cf67a193aebc950776e84c8db13b6b Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Thu, 27 May 2010 17:34:25 +0200 Subject: include QTouchEvent header --- src/gui/kernel/qwindowsysteminterface.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index ca73305..efb515f 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -47,6 +47,7 @@ #include #include #include +#include QT_BEGIN_HEADER -- cgit v0.12 From 28580117adf5149e7ca15a43a398b412f4ec0ab4 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Mon, 31 May 2010 15:27:41 +0200 Subject: APIs for lighthouse plugins to declare screen changes These APIs provide a method for lighthouse plugins to intiate delivery of the QDesktopWidget signals: resized, screenCountChanged, and workAreaResized. The handleScreenGeometryChange and handleScreenAvailableGeometryChange functions also resize fullscreen and maximized toplevel widgets. --- src/gui/kernel/qapplication_lite.cpp | 44 +++++++++++++++++++++++++++++++ src/gui/kernel/qapplication_p.h | 4 +++ src/gui/kernel/qwindowsysteminterface.cpp | 15 +++++++++++ src/gui/kernel/qwindowsysteminterface.h | 4 +++ 4 files changed, 67 insertions(+) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 491dd02..6008a9f 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -828,4 +828,48 @@ void QApplicationPrivate::processTouchEvent(QWindowSystemInterface::TouchEvent * translateRawTouchEvent(e->widget.data(), e->devType, touchPoints); } +void QApplicationPrivate::reportScreenCount(int count) +{ + // signal anything listening for creation or deletion of screens + QDesktopWidget *desktop = QApplication::desktop(); + if (desktop) + emit desktop->screenCountChanged(count); +} + +void QApplicationPrivate::reportGeometryChange(int screenIndex) +{ + // signal anything listening for screen geometry changes + QDesktopWidget *desktop = QApplication::desktop(); + if (desktop) + emit desktop->resized(screenIndex); + + // make sure maximized and fullscreen windows are updated + QWidgetList list = QApplication::topLevelWidgets(); + for (int i = list.size() - 1; i >= 0; --i) { + QWidget *w = list.at(i); + if (w->isFullScreen()) + w->d_func()->setFullScreenSize_helper(); + else if (w->isMaximized()) + w->d_func()->setMaxWindowState_helper(); + } +} + +void QApplicationPrivate::reportAvailableGeometryChange(int screenIndex) +{ + // signal anything listening for screen geometry changes + QDesktopWidget *desktop = QApplication::desktop(); + if (desktop) + emit desktop->workAreaResized(screenIndex); + + // make sure maximized and fullscreen windows are updated + QWidgetList list = QApplication::topLevelWidgets(); + for (int i = list.size() - 1; i >= 0; --i) { + QWidget *w = list.at(i); + if (w->isFullScreen()) + w->d_func()->setFullScreenSize_helper(); + else if (w->isMaximized()) + w->d_func()->setMaxWindowState_helper(); + } +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index f06826d..e272a36 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -496,6 +496,10 @@ public: static void processUserEvent(QWindowSystemInterface::UserEvent *e); + static void reportScreenCount(int count); + static void reportGeometryChange(int screenIndex); + static void reportAvailableGeometryChange(int screenIndex); + #endif #ifdef Q_WS_QWS diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 102d1a3..cd466e3 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -142,4 +142,19 @@ void QWindowSystemInterface::handleTouchEvent(QWidget *tlw, ulong timestamp, QEv QWindowSystemInterfacePrivate::queueUserEvent(e); } +void QWindowSystemInterface::handleScreenGeometryChange(int screenIndex) +{ + QApplicationPrivate::reportGeometryChange(screenIndex); +} + +void QWindowSystemInterface::handleScreenAvailableGeometryChange(int screenIndex) +{ + QApplicationPrivate::reportAvailableGeometryChange(screenIndex); +} + +void QWindowSystemInterface::handleScreenCountChange(int count) +{ + QApplicationPrivate::reportScreenCount(count); +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index efb515f..8c69218 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -97,6 +97,10 @@ public: static void handleEnterEvent(QWidget *w); static void handleLeaveEvent(QWidget *w); + // Changes to the screen + static void handleScreenGeometryChange(int screenIndex); + static void handleScreenAvailableGeometryChange(int screenIndex); + static void handleScreenCountChange(int count); class UserEvent { public: -- cgit v0.12 From f3a920be362b85d248a9b76c1b15a0b096d7c90e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 14 May 2010 14:07:51 +0200 Subject: gl on openkode. QGLWidget only works for toplevel widgets and QGLWindowSurface is used for anything else --- src/gui/egl/egl.pri | 18 +- src/gui/kernel/qwidget_lite.cpp | 4 +- src/opengl/opengl.pro | 10 +- src/opengl/qgl_lite.cpp | 104 --------- src/plugins/platforms/openkode/main.cpp | 5 +- src/plugins/platforms/openkode/openkode.pro | 23 +- .../platforms/openkode/qopenkodeglintegration.cpp | 259 +++++++++++++++++++++ .../platforms/openkode/qopenkodeglintegration.h | 81 +++++++ .../platforms/openkode/qopenkodeintegration.cpp | 23 +- .../platforms/openkode/qopenkodeintegration.h | 4 + src/plugins/platforms/openkode/qopenkodewindow.cpp | 41 ++-- src/plugins/platforms/openkode/qopenkodewindow.h | 1 + .../platforms/openkode/qopenkodewindowsurface.cpp | 10 +- 13 files changed, 444 insertions(+), 139 deletions(-) create mode 100644 src/plugins/platforms/openkode/qopenkodeglintegration.cpp create mode 100644 src/plugins/platforms/openkode/qopenkodeglintegration.h diff --git a/src/gui/egl/egl.pri b/src/gui/egl/egl.pri index 595d135..253c091 100644 --- a/src/gui/egl/egl.pri +++ b/src/gui/egl/egl.pri @@ -6,9 +6,21 @@ contains(QT_CONFIG, egl): { egl/qeglcontext_p.h \ egl/qeglproperties_p.h - SOURCES += \ - egl/qegl.cpp \ - egl/qeglproperties.cpp + SOURCES += \ + egl/qegl.cpp \ + egl/qeglproperties.cpp + unix { + !isEmpty(QMAKE_INCDIR_EGL){ + INCLUDEPATH += $$QMAKE_INCDIR_EGL + } + !isEmpty(QMAKE_LIBDIR_EGL){ + for(p, QMAKE_LIBDIR_EGL) { + exists($$p):LIBS += -L$$p + } + } + + !isEmpty(QMAKE_LIBS_EGL): LIBS += $$QMAKE_LIBS_EGL + } wince*: SOURCES += egl/qegl_wince.cpp diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index eae83f9..d281bec 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -76,10 +76,10 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO } Q_ASSERT(platformWindow); - if (!surface) { + // QGLWidget does not need/work with a windowsurface + if (!surface && !q->inherits("QGLWidget")) { surface = QApplicationPrivate::platformIntegration()->createWindowSurface(q,platformWindow->winId()); } - Q_ASSERT(surface); data.window_flags = q->platformWindow()->setWindowFlags(data.window_flags); diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index 6eb4ebe..53f9d3e 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -77,16 +77,12 @@ SOURCES += qgl.cpp \ } embedded_lite { + DEFINES += QT_NO_EGL + SOURCES += qgl_lite.cpp HEADERS += qglplatformintegration_lite.h - # If we have EGL, use the EGL implementation of QGLPixelBuffer, otherwise we just provide - # a stubbed out one. PBuffers aren't too interesting anyway. - contains(QT_CONFIG, egl) { - SOURCES += qglpixelbuffer_egl.cpp - } else { - SOURCES += qglpixelbuffer_stub.cpp - } + SOURCES += qglpixelbuffer_stub.cpp } x11 { diff --git a/src/opengl/qgl_lite.cpp b/src/opengl/qgl_lite.cpp index 426683b..636c711 100644 --- a/src/opengl/qgl_lite.cpp +++ b/src/opengl/qgl_lite.cpp @@ -49,110 +49,6 @@ #include "qgl_p.h" #include "qglplatformintegration_lite.h" -#ifndef QT_NO_EGL -#include "qgl_egl_p.h" - -void qt_eglproperties_set_glformat(QEglProperties& eglProperties, const QGLFormat& glFormat) -{ - int redSize = glFormat.redBufferSize(); - int greenSize = glFormat.greenBufferSize(); - int blueSize = glFormat.blueBufferSize(); - int alphaSize = glFormat.alphaBufferSize(); - int depthSize = glFormat.depthBufferSize(); - int stencilSize = glFormat.stencilBufferSize(); - int sampleCount = glFormat.samples(); - - // QGLFormat uses a magic value of -1 to indicate "don't care", even when a buffer of that - // type has been requested. So we must check QGLFormat's booleans too if size is -1: - if (glFormat.alpha() && alphaSize <= 0) - alphaSize = 1; - if (glFormat.depth() && depthSize <= 0) - depthSize = 1; - if (glFormat.stencil() && stencilSize <= 0) - stencilSize = 1; - if (glFormat.sampleBuffers() && sampleCount <= 0) - sampleCount = 1; - - // We want to make sure 16-bit configs are chosen over 32-bit configs as they will provide - // the best performance. The EGL config selection algorithm is a bit stange in this regard: - // The selection criteria for EGL_BUFFER_SIZE is "AtLeast", so we can't use it to discard - // 32-bit configs completely from the selection. So it then comes to the sorting algorithm. - // The red/green/blue sizes have a sort priority of 3, so they are sorted by first. The sort - // order is special and described as "by larger _total_ number of color bits.". So EGL will - // put 32-bit configs in the list before the 16-bit configs. However, the spec also goes on - // to say "If the requested number of bits in attrib_list for a particular component is 0, - // then the number of bits for that component is not considered". This part of the spec also - // seems to imply that setting the red/green/blue bits to zero means none of the components - // are considered and EGL disregards the entire sorting rule. It then looks to the next - // highest priority rule, which is EGL_BUFFER_SIZE. Despite the selection criteria being - // "AtLeast" for EGL_BUFFER_SIZE, it's sort order is "smaller" meaning 16-bit configs are - // put in the list before 32-bit configs. So, to make sure 16-bit is preffered over 32-bit, - // we must set the red/green/blue sizes to zero. This has an unfortunate consequence that - // if the application sets the red/green/blue size to 5/6/5 on the QGLFormat, they will - // probably get a 32-bit config, even when there's an RGB565 config avaliable. Oh well. - - // Now normalize the values so -1 becomes 0 - redSize = redSize > 0 ? redSize : 0; - greenSize = greenSize > 0 ? greenSize : 0; - blueSize = blueSize > 0 ? blueSize : 0; - alphaSize = alphaSize > 0 ? alphaSize : 0; - depthSize = depthSize > 0 ? depthSize : 0; - stencilSize = stencilSize > 0 ? stencilSize : 0; - sampleCount = sampleCount > 0 ? sampleCount : 0; - - eglProperties.setValue(EGL_RED_SIZE, redSize); - eglProperties.setValue(EGL_GREEN_SIZE, greenSize); - eglProperties.setValue(EGL_BLUE_SIZE, blueSize); - eglProperties.setValue(EGL_ALPHA_SIZE, alphaSize); - eglProperties.setValue(EGL_DEPTH_SIZE, depthSize); - eglProperties.setValue(EGL_STENCIL_SIZE, stencilSize); - eglProperties.setValue(EGL_SAMPLES, sampleCount); - eglProperties.setValue(EGL_SAMPLE_BUFFERS, sampleCount ? 1 : 0); -} - -// Updates "format" with the parameters of the selected configuration. -void qt_glformat_from_eglconfig(QGLFormat& format, const EGLConfig config) -{ - EGLint redSize = 0; - EGLint greenSize = 0; - EGLint blueSize = 0; - EGLint alphaSize = 0; - EGLint depthSize = 0; - EGLint stencilSize = 0; - EGLint sampleCount = 0; - EGLint level = 0; - - EGLDisplay display = QEgl::display(); - eglGetConfigAttrib(display, config, EGL_RED_SIZE, &redSize); - eglGetConfigAttrib(display, config, EGL_GREEN_SIZE, &greenSize); - eglGetConfigAttrib(display, config, EGL_BLUE_SIZE, &blueSize); - eglGetConfigAttrib(display, config, EGL_ALPHA_SIZE, &alphaSize); - eglGetConfigAttrib(display, config, EGL_DEPTH_SIZE, &depthSize); - eglGetConfigAttrib(display, config, EGL_STENCIL_SIZE, &stencilSize); - eglGetConfigAttrib(display, config, EGL_SAMPLES, &sampleCount); - eglGetConfigAttrib(display, config, EGL_LEVEL, &level); - - format.setRedBufferSize(redSize); - format.setGreenBufferSize(greenSize); - format.setBlueBufferSize(blueSize); - format.setAlphaBufferSize(alphaSize); - format.setDepthBufferSize(depthSize); - format.setStencilBufferSize(stencilSize); - format.setSamples(sampleCount); - format.setPlane(level + 1); // EGL calls level 0 "normal" whereas Qt calls 1 "normal" - format.setDirectRendering(true); // All EGL contexts are direct-rendered - format.setRgba(true); // EGL doesn't support colour index rendering - format.setStereo(false); // EGL doesn't support stereo buffers - format.setAccumBufferSize(0); // EGL doesn't support accululation buffers - - // Clear the EGL error state because some of the above may - // have errored out because the attribute is not applicable - // to the surface type. Such errors don't matter. - eglGetError(); -} -#endif - - QT_BEGIN_NAMESPACE QPlatformGLContext::QPlatformGLContext() diff --git a/src/plugins/platforms/openkode/main.cpp b/src/plugins/platforms/openkode/main.cpp index bd2b5c7..b60ae1b 100644 --- a/src/plugins/platforms/openkode/main.cpp +++ b/src/plugins/platforms/openkode/main.cpp @@ -48,7 +48,7 @@ class QOpenKODEPlugin : public QPlatformIntegrationPlugin { public: QStringList keys() const; - QPlatformIntegration *create(const QString&); + QPlatformIntegration *create(const QString&, const QStringList&); }; QStringList QOpenKODEPlugin::keys() const @@ -58,8 +58,9 @@ QStringList QOpenKODEPlugin::keys() const return list; } -QPlatformIntegration * QOpenKODEPlugin::create(const QString& system) +QPlatformIntegration * QOpenKODEPlugin::create(const QString& system, const QStringList& paramList) { + Q_UNUSED(paramList); if (system.toLower() == "openkode") return new QOpenKODEIntegration; diff --git a/src/plugins/platforms/openkode/openkode.pro b/src/plugins/platforms/openkode/openkode.pro index 042b74d..0614b3b 100644 --- a/src/plugins/platforms/openkode/openkode.pro +++ b/src/plugins/platforms/openkode/openkode.pro @@ -1,20 +1,37 @@ TARGET = qopenkodeintegration include(../../qpluginbase.pri) +QT += opengl + QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms SOURCES = main.cpp \ qopenkodeintegration.cpp \ qopenkodewindowsurface.cpp \ - qopenkodewindow.cpp + qopenkodewindow.cpp \ + qopenkodeglintegration.cpp HEADERS = qopenkodeintegration.h \ qopenkodewindowsurface.h \ - qopenkodewindow.h + qopenkodewindow.h \ + qopenkodeglintegration.h RESOURCES = resources.qrc target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target -LIBS += -lKD -lEGL -lGLESv2 +LIBS += -lKD -lEGL +!isEmpty(QMAKE_INCDIR_OPENGL_ES2){ + INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2 +} +!isEmpty(QMAKE_LIBDIR_OPENGL_ES2){ + for(p, QMAKE_LIBDIR_OPENGL_ES2) { + exists($$p):LIBS += -L$$p + } +} +!isEmpty(QMAKE_LIBS_OPENGL_ES2){ + LIBS += $$QMAKE_LIBS_OPENGL_ES2 +} else { + LIBS += -lGLESv2 +} diff --git a/src/plugins/platforms/openkode/qopenkodeglintegration.cpp b/src/plugins/platforms/openkode/qopenkodeglintegration.cpp new file mode 100644 index 0000000..b0d901b --- /dev/null +++ b/src/plugins/platforms/openkode/qopenkodeglintegration.cpp @@ -0,0 +1,259 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qopenkodeglintegration.h" +#include +#include +#include + +#include + +#include + +void qt_eglproperties_set_glformat(QEglProperties& eglProperties, const QGLFormat& glFormat) +{ + int redSize = glFormat.redBufferSize(); + int greenSize = glFormat.greenBufferSize(); + int blueSize = glFormat.blueBufferSize(); + int alphaSize = glFormat.alphaBufferSize(); + int depthSize = glFormat.depthBufferSize(); + int stencilSize = glFormat.stencilBufferSize(); + int sampleCount = glFormat.samples(); + + // QGLFormat uses a magic value of -1 to indicate "don't care", even when a buffer of that + // type has been requested. So we must check QGLFormat's booleans too if size is -1: + if (glFormat.alpha() && alphaSize <= 0) + alphaSize = 1; + if (glFormat.depth() && depthSize <= 0) + depthSize = 1; + if (glFormat.stencil() && stencilSize <= 0) + stencilSize = 1; + if (glFormat.sampleBuffers() && sampleCount <= 0) + sampleCount = 1; + + // We want to make sure 16-bit configs are chosen over 32-bit configs as they will provide + // the best performance. The EGL config selection algorithm is a bit stange in this regard: + // The selection criteria for EGL_BUFFER_SIZE is "AtLeast", so we can't use it to discard + // 32-bit configs completely from the selection. So it then comes to the sorting algorithm. + // The red/green/blue sizes have a sort priority of 3, so they are sorted by first. The sort + // order is special and described as "by larger _total_ number of color bits.". So EGL will + // put 32-bit configs in the list before the 16-bit configs. However, the spec also goes on + // to say "If the requested number of bits in attrib_list for a particular component is 0, + // then the number of bits for that component is not considered". This part of the spec also + // seems to imply that setting the red/green/blue bits to zero means none of the components + // are considered and EGL disregards the entire sorting rule. It then looks to the next + // highest priority rule, which is EGL_BUFFER_SIZE. Despite the selection criteria being + // "AtLeast" for EGL_BUFFER_SIZE, it's sort order is "smaller" meaning 16-bit configs are + // put in the list before 32-bit configs. So, to make sure 16-bit is preffered over 32-bit, + // we must set the red/green/blue sizes to zero. This has an unfortunate consequence that + // if the application sets the red/green/blue size to 5/6/5 on the QGLFormat, they will + // probably get a 32-bit config, even when there's an RGB565 config avaliable. Oh well. + + // Now normalize the values so -1 becomes 0 + redSize = redSize > 0 ? redSize : 0; + greenSize = greenSize > 0 ? greenSize : 0; + blueSize = blueSize > 0 ? blueSize : 0; + alphaSize = alphaSize > 0 ? alphaSize : 0; + depthSize = depthSize > 0 ? depthSize : 0; + stencilSize = stencilSize > 0 ? stencilSize : 0; + sampleCount = sampleCount > 0 ? sampleCount : 0; + + eglProperties.setValue(EGL_RED_SIZE, redSize); + eglProperties.setValue(EGL_GREEN_SIZE, greenSize); + eglProperties.setValue(EGL_BLUE_SIZE, blueSize); + eglProperties.setValue(EGL_ALPHA_SIZE, alphaSize); + eglProperties.setValue(EGL_DEPTH_SIZE, depthSize); + eglProperties.setValue(EGL_STENCIL_SIZE, stencilSize); + eglProperties.setValue(EGL_SAMPLES, sampleCount); + eglProperties.setValue(EGL_SAMPLE_BUFFERS, sampleCount ? 1 : 0); +} + +// Updates "format" with the parameters of the selected configuration. +void qt_glformat_from_eglconfig(QGLFormat& format, const EGLConfig config) +{ + EGLint redSize = 0; + EGLint greenSize = 0; + EGLint blueSize = 0; + EGLint alphaSize = 0; + EGLint depthSize = 0; + EGLint stencilSize = 0; + EGLint sampleCount = 0; + EGLint level = 0; + + EGLDisplay display = QEgl::display(); + eglGetConfigAttrib(display, config, EGL_RED_SIZE, &redSize); + eglGetConfigAttrib(display, config, EGL_GREEN_SIZE, &greenSize); + eglGetConfigAttrib(display, config, EGL_BLUE_SIZE, &blueSize); + eglGetConfigAttrib(display, config, EGL_ALPHA_SIZE, &alphaSize); + eglGetConfigAttrib(display, config, EGL_DEPTH_SIZE, &depthSize); + eglGetConfigAttrib(display, config, EGL_STENCIL_SIZE, &stencilSize); + eglGetConfigAttrib(display, config, EGL_SAMPLES, &sampleCount); + eglGetConfigAttrib(display, config, EGL_LEVEL, &level); + + format.setRedBufferSize(redSize); + format.setGreenBufferSize(greenSize); + format.setBlueBufferSize(blueSize); + format.setAlphaBufferSize(alphaSize); + format.setDepthBufferSize(depthSize); + format.setStencilBufferSize(stencilSize); + format.setSamples(sampleCount); + format.setPlane(level + 1); // EGL calls level 0 "normal" whereas Qt calls 1 "normal" + format.setDirectRendering(true); // All EGL contexts are direct-rendered + format.setRgba(true); // EGL doesn't support colour index rendering + format.setStereo(false); // EGL doesn't support stereo buffers + format.setAccumBufferSize(0); // EGL doesn't support accululation buffers + + // Clear the EGL error state because some of the above may + // have errored out because the attribute is not applicable + // to the surface type. Such errors don't matter. + eglGetError(); +} + +QEGLPlatformWidgetSurface::QEGLPlatformWidgetSurface() + :QPlatformGLWidgetSurface() +{ + +} +QEGLPlatformWidgetSurface::~QEGLPlatformWidgetSurface() +{ +} + +bool QEGLPlatformWidgetSurface::create(QGLWidget* widget, QGLFormat& format) +{ + return true; +} +void QEGLPlatformWidgetSurface::setGeometry(const QRect& rect) +{ + Q_UNUSED(rect); +} +bool QEGLPlatformWidgetSurface::filterEvent(QEvent *event) +{ + return QPlatformGLWidgetSurface::filterEvent(event); +} + +QEGLPlatformContext::QEGLPlatformContext() +{ +} + +QEGLPlatformContext::~QEGLPlatformContext() +{ + if (m_eglSurface != EGL_NO_SURFACE) { + doneCurrent(); + eglDestroySurface(QEgl::display(), m_eglSurface); + m_eglSurface = EGL_NO_SURFACE; + } + + if (m_context != EGL_NO_CONTEXT) { + eglDestroyContext(QEgl::display(), m_context); + m_context = EGL_NO_CONTEXT; + } +} + +bool QEGLPlatformContext::create(QPaintDevice* device, QGLFormat& format, QPlatformGLContext* shareContext) +{ + QEglProperties properties; + properties.setValue(EGL_CONTEXT_CLIENT_VERSION, 2); + //lets go with all defaults :) Seems like we get bad attributes for anything else + //qt_eglproperties_set_glformat(properties,format); + format.setDepthBufferSize(1); + EGLConfig config = QEgl::defaultConfig(device->devType(), QEgl::OpenGL,QEgl::Renderable); + QEGLPlatformContext *eglShareContext = static_cast(shareContext); + if (shareContext && eglShareContext->m_context != EGL_NO_CONTEXT) { + m_context = eglCreateContext(QEgl::display(), config, eglShareContext->m_context, properties.properties()); + if (m_context == EGL_NO_CONTEXT) { + qWarning() << "QEglContext::createContext(): Could not share context:" << QEgl::errorString(); + shareContext = 0; + } + } else { + m_context = eglCreateContext(QEgl::display(), config, EGL_NO_CONTEXT, properties.properties()); + if (m_context == EGL_NO_CONTEXT) { + qWarning() << "QEglContext::createContext(): Unable to create EGL context:" << QEgl::errorString(); + return false; + } + } + //Get/create the EGLSurface + if (device && device->devType() == QInternal::Widget){ + QWidget* widget = static_cast(device); + QGLWidget* glWidget = qobject_cast(widget); + + if (!widget->isTopLevel()) { + qWarning("Creating a GL context is only supported on top-level QWidgets"); + return false; + } + EGLNativeWindowType winId = (EGLNativeWindowType) widget->window()->winId(); + + m_eglSurface = eglCreateWindowSurface(QEgl::display(), config, winId, 0); + makeCurrent(); + glClearColor(0.0, 0.0, 0.0, 1.0); + swapBuffers(); + + + } else { + qDebug() << "QEGLPlatformContext::create: didn't create surface!!!!!"; + } + return true; + +} + +void QEGLPlatformContext::makeCurrent() +{ + eglBindAPI(EGL_OPENGL_API); + bool ok = eglMakeCurrent(QEgl::display(), m_eglSurface, m_eglSurface, m_context); + if (!ok) + qWarning() << "QEGLPlatformContext::makeCurrent(" << m_eglSurface << "):" << QEgl::errorString(); +} +void QEGLPlatformContext::doneCurrent() +{ + eglBindAPI(EGL_OPENGL_ES_API); + bool ok = eglMakeCurrent(QEgl::display(), EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + if (!ok) + qWarning() << "QEGLPlatformContext::doneCurrent():" << QEgl::errorString(); +} +void QEGLPlatformContext::swapBuffers() +{ + bool ok = eglSwapBuffers(QEgl::display(), m_eglSurface); + if (!ok) + qWarning() << "QEGLPlatformContext::swapBuffers():" << QEgl::errorString(); +} +void* QEGLPlatformContext::getProcAddress(const QString& procName) +{ + eglGetProcAddress(qPrintable(procName)); +} diff --git a/src/plugins/platforms/openkode/qopenkodeglintegration.h b/src/plugins/platforms/openkode/qopenkodeglintegration.h new file mode 100644 index 0000000..c3291b8 --- /dev/null +++ b/src/plugins/platforms/openkode/qopenkodeglintegration.h @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QOPENKODEGLINTEGRATION_H +#define QOPENKODEGLINTEGRATION_H + +#include +#include +#include + +void qt_eglproperties_set_glformat(QEglProperties& eglProperties, const QGLFormat& glFormat); +// Updates "format" with the parameters of the selected configuration. +void qt_glformat_from_eglconfig(QGLFormat& format, const EGLConfig config); + +class QEGLPlatformWidgetSurface : public QPlatformGLWidgetSurface +{ +public: + QEGLPlatformWidgetSurface(); + virtual ~QEGLPlatformWidgetSurface(); + + bool create(QGLWidget*, QGLFormat&); + void setGeometry(const QRect&); + bool filterEvent(QEvent *); +}; + +class QEGLPlatformContext : public QPlatformGLContext +{ +public: + QEGLPlatformContext(); + ~QEGLPlatformContext(); + + bool create(QPaintDevice* device, QGLFormat& format, QPlatformGLContext* shareContext); + void makeCurrent(); + void doneCurrent(); + void swapBuffers(); + void* getProcAddress(const QString& procName); + +private: + EGLContext m_context; + EGLSurface m_eglSurface; +}; + +#endif //QOPENKODEGLINTEGRATION_H diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.cpp b/src/plugins/platforms/openkode/qopenkodeintegration.cpp index d9430c2..cd957af 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.cpp +++ b/src/plugins/platforms/openkode/qopenkodeintegration.cpp @@ -42,6 +42,10 @@ #include "qopenkodeintegration.h" #include "qopenkodewindowsurface.h" #include "qopenkodewindow.h" +#include "qopenkodeglintegration.h" + +#include +#include #include @@ -198,7 +202,7 @@ QOpenKODEIntegration::QOpenKODEIntegration() QPixmapData *QOpenKODEIntegration::createPixmapData(QPixmapData::PixelType type) const { - return new QRasterPixmapData(type); + return new QGLPixmapData(type); } QPlatformWindow *QOpenKODEIntegration::createPlatformWindow(QWidget *tlw, WId ) const @@ -206,9 +210,22 @@ QPlatformWindow *QOpenKODEIntegration::createPlatformWindow(QWidget *tlw, WId ) return new QOpenKODEWindow(tlw); } -QWindowSurface *QOpenKODEIntegration::createWindowSurface(QWidget *widget, WId winId) const +QWindowSurface *QOpenKODEIntegration::createWindowSurface(QWidget *widget, WId wid) const +{ + return new QGLWindowSurface(widget); +} + +bool QOpenKODEIntegration::hasOpenGL() const +{ + return true; +} +QPlatformGLContext *QOpenKODEIntegration::createGLContext() +{ + return new QEGLPlatformContext; +} +QPlatformGLWidgetSurface *QOpenKODEIntegration::createGLWidgetSurface() { - return new QOpenKODEWindowSurface(widget,winId); + return new QEGLPlatformWidgetSurface; } GLuint QOpenKODEIntegration::blitterProgram() diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.h b/src/plugins/platforms/openkode/qopenkodeintegration.h index 76ce219..ad6db4b 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.h +++ b/src/plugins/platforms/openkode/qopenkodeintegration.h @@ -81,6 +81,10 @@ public: QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; + bool hasOpenGL() const; + QPlatformGLContext * createGLContext(); + QPlatformGLWidgetSurface * createGLWidgetSurface(); + virtual QList screens() const { return mScreens; } static GLuint blitterProgram(); diff --git a/src/plugins/platforms/openkode/qopenkodewindow.cpp b/src/plugins/platforms/openkode/qopenkodewindow.cpp index 8e1527c..4d18a6f 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.cpp +++ b/src/plugins/platforms/openkode/qopenkodewindow.cpp @@ -63,23 +63,28 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) return; } - const KDint windowSize[2] = { tlw->width(), tlw->height() }; + const KDint windowSize[2] = { tlw->width(), tlw->height()-1 }; if (kdSetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) { qErrnoWarning(kdGetError(), "Could not set native window size"); return; } + KDboolean visibillity(false); + if (kdSetWindowPropertybv(kdWindow, KD_WINDOWPROPERTY_VISIBILITY, &visibillity)) { + qErrnoWarning(kdGetError(), "Could not set visibillity to false"); + } + // const KDboolean windowExclusive[] = { false }; // if (kdSetWindowPropertybv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_EXCLUSIVE_NV, windowExclusive)) { // qErrnoWarning(kdGetError(), "Could not set exclusive bit"); // //return; // } // -// const KDint windowPos[2] = { tlw->x(), tlw->y() }; -// if (kdSetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { -// qErrnoWarning(kdGetError(), "Could not set native window position"); -// return; -// } + const KDint windowPos[2] = { tlw->x(), tlw->y() }; + if (kdSetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { + qErrnoWarning(kdGetError(), "Could not set native window position"); + return; + } if (kdRealizeWindow(kdWindow, &eglWindow)) { qErrnoWarning(kdGetError(), "Could not realize native window"); @@ -87,6 +92,11 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) } } +QOpenKODEWindow::~QOpenKODEWindow() +{ + qDebug() << "destroying window"; + kdDestroyWindow(kdWindow); +} void QOpenKODEWindow::setGeometry(const QRect &rect) { const QRect geo = geometry(); @@ -98,17 +108,20 @@ void QOpenKODEWindow::setGeometry(const QRect &rect) } } -// if (geo.topLeft() != rect.topLeft()) { -// const KDint windowPos[2] = { rect.x(), rect.y() }; -// if (kdSetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { -// qErrnoWarning(kdGetError(), "Could not set native window position"); -// //return; -// } -// } + if (geo.topLeft() != rect.topLeft()) { + const KDint windowPos[2] = { rect.x(), rect.y() }; + if (kdSetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { + qErrnoWarning(kdGetError(), "Could not set native window position"); + //return; + } + } } void QOpenKODEWindow::setVisible(bool visible) { - + KDboolean visibillity(visible); + if (kdSetWindowPropertybv(kdWindow, KD_WINDOWPROPERTY_VISIBILITY, &visibillity)) { + qErrnoWarning(kdGetError(), "Could not set visibillity to false"); + } } diff --git a/src/plugins/platforms/openkode/qopenkodewindow.h b/src/plugins/platforms/openkode/qopenkodewindow.h index b52f8e6..741e676 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.h +++ b/src/plugins/platforms/openkode/qopenkodewindow.h @@ -50,6 +50,7 @@ class QOpenKODEWindow : public QPlatformWindow { public: QOpenKODEWindow(QWidget *tlw); + ~QOpenKODEWindow(); void setGeometry(const QRect &rect); void setVisible(bool visible); diff --git a/src/plugins/platforms/openkode/qopenkodewindowsurface.cpp b/src/plugins/platforms/openkode/qopenkodewindowsurface.cpp index 5eb0d2d..dacd019 100644 --- a/src/plugins/platforms/openkode/qopenkodewindowsurface.cpp +++ b/src/plugins/platforms/openkode/qopenkodewindowsurface.cpp @@ -135,7 +135,7 @@ void QOpenKODEWindowSurface::flush(QWidget *, const QRegion ®ion, const QPoin glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, blitImage.bits()); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, mImage.bits()); // Enable vertex attribute associated with vertex position glEnableVertexAttribArray(posId); @@ -157,8 +157,12 @@ void QOpenKODEWindowSurface::flush(QWidget *, const QRegion ®ion, const QPoin if (texId) glDeleteTextures(1, &texId); + eglWaitGL(); + mContext.swapBuffers(mSurface); mContext.doneCurrent(); + + eglWaitNative(EGL_CORE_NATIVE_ENGINE); } void QOpenKODEWindowSurface::resize(const QSize &size) @@ -171,10 +175,14 @@ void QOpenKODEWindowSurface::resize(const QSize &size) } void QOpenKODEWindowSurface::beginPaint(const QRegion ®ion) { + Q_UNUSED(region); if (mSurface == EGL_NO_SURFACE) { EGLConfig config = QEgl::defaultConfig(QInternal::Widget,QEgl::OpenGL,QEgl::Renderable); EGLint windowAttrs[] = { EGL_NONE }; mSurface = eglCreateWindowSurface(QEgl::display(), config, mWin, windowAttrs); + if (mSurface == EGL_NO_SURFACE) { + qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError()); + } mImage = QImage(size(),QImage::Format_RGB32); } } -- cgit v0.12 From e17ada56a676c7d87c0803cdc8367065e7aaa317 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Tue, 1 Jun 2010 15:34:52 +0200 Subject: make reporting screen size/count changes safe before QApplication constructor --- src/gui/kernel/qapplication.cpp | 3 +++ src/gui/kernel/qapplication_lite.cpp | 23 +++++++++++++++++------ src/gui/kernel/qapplication_p.h | 1 + 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 5b294cc..6dbb7f2 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -812,6 +812,9 @@ void QApplicationPrivate::construct( if (qt_is_gui_used) qt_guiPlatformPlugin(); #endif +#ifdef Q_WS_LITE + QApplicationPrivate::qapp_constructed = true; +#endif } #if defined(Q_WS_X11) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 6008a9f..2b94102 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -86,6 +86,8 @@ static int mousePressX; static int mousePressY; static int mouse_double_click_distance = 5; +bool QApplicationPrivate::qapp_constructed = false; // QApplication::QApplication completed? + void QApplicationPrivate::processUserEvent(QWindowSystemInterface::UserEvent *e) { switch(e->type) { @@ -830,18 +832,24 @@ void QApplicationPrivate::processTouchEvent(QWindowSystemInterface::TouchEvent * void QApplicationPrivate::reportScreenCount(int count) { + // This operation only makes sense after the QApplication constructor runs + if (!QApplicationPrivate::qapp_constructed) + return; + // signal anything listening for creation or deletion of screens QDesktopWidget *desktop = QApplication::desktop(); - if (desktop) - emit desktop->screenCountChanged(count); + emit desktop->screenCountChanged(count); } void QApplicationPrivate::reportGeometryChange(int screenIndex) { + // This operation only makes sense after the QApplication constructor runs + if (!QApplicationPrivate::qapp_constructed) + return; + // signal anything listening for screen geometry changes QDesktopWidget *desktop = QApplication::desktop(); - if (desktop) - emit desktop->resized(screenIndex); + emit desktop->resized(screenIndex); // make sure maximized and fullscreen windows are updated QWidgetList list = QApplication::topLevelWidgets(); @@ -856,10 +864,13 @@ void QApplicationPrivate::reportGeometryChange(int screenIndex) void QApplicationPrivate::reportAvailableGeometryChange(int screenIndex) { + // This operation only makes sense after the QApplication constructor runs + if (!QApplicationPrivate::qapp_constructed) + return; + // signal anything listening for screen geometry changes QDesktopWidget *desktop = QApplication::desktop(); - if (desktop) - emit desktop->workAreaResized(screenIndex); + emit desktop->workAreaResized(screenIndex); // make sure maximized and fullscreen windows are updated QWidgetList list = QApplication::topLevelWidgets(); diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index e272a36..58128c8 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -428,6 +428,7 @@ public: static QString graphics_system_name; #if defined(Q_WS_LITE) static QPlatformIntegration *platform_integration; + static bool qapp_constructed; #endif private: -- cgit v0.12 From 56a57f127354a42a5de8dc59510ba5a3cfd8b442 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 2 Jun 2010 12:36:37 +0200 Subject: use QCoreApplication::startingUp() to decide if QApplication::desktop() is safe --- src/gui/kernel/qapplication.cpp | 3 --- src/gui/kernel/qapplication_lite.cpp | 8 +++----- src/gui/kernel/qapplication_p.h | 1 - 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 6dbb7f2..5b294cc 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -812,9 +812,6 @@ void QApplicationPrivate::construct( if (qt_is_gui_used) qt_guiPlatformPlugin(); #endif -#ifdef Q_WS_LITE - QApplicationPrivate::qapp_constructed = true; -#endif } #if defined(Q_WS_X11) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 2b94102..792b28b 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -86,8 +86,6 @@ static int mousePressX; static int mousePressY; static int mouse_double_click_distance = 5; -bool QApplicationPrivate::qapp_constructed = false; // QApplication::QApplication completed? - void QApplicationPrivate::processUserEvent(QWindowSystemInterface::UserEvent *e) { switch(e->type) { @@ -833,7 +831,7 @@ void QApplicationPrivate::processTouchEvent(QWindowSystemInterface::TouchEvent * void QApplicationPrivate::reportScreenCount(int count) { // This operation only makes sense after the QApplication constructor runs - if (!QApplicationPrivate::qapp_constructed) + if (QCoreApplication::startingUp()) return; // signal anything listening for creation or deletion of screens @@ -844,7 +842,7 @@ void QApplicationPrivate::reportScreenCount(int count) void QApplicationPrivate::reportGeometryChange(int screenIndex) { // This operation only makes sense after the QApplication constructor runs - if (!QApplicationPrivate::qapp_constructed) + if (QCoreApplication::startingUp()) return; // signal anything listening for screen geometry changes @@ -865,7 +863,7 @@ void QApplicationPrivate::reportGeometryChange(int screenIndex) void QApplicationPrivate::reportAvailableGeometryChange(int screenIndex) { // This operation only makes sense after the QApplication constructor runs - if (!QApplicationPrivate::qapp_constructed) + if (QCoreApplication::startingUp()) return; // signal anything listening for screen geometry changes diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 58128c8..e272a36 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -428,7 +428,6 @@ public: static QString graphics_system_name; #if defined(Q_WS_LITE) static QPlatformIntegration *platform_integration; - static bool qapp_constructed; #endif private: -- cgit v0.12 From 31608f9ca899b4d85b3c339bbab24cf42450831f Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 2 Jun 2010 16:08:56 +0200 Subject: pass the QList of TouchPoints as a constant reference for handleTouchEvent --- src/gui/kernel/qapplication_lite.cpp | 23 +---------------------- src/gui/kernel/qwindowsysteminterface.cpp | 30 ++++++++++++++++++++++++++++-- src/gui/kernel/qwindowsysteminterface.h | 8 ++++---- 3 files changed, 33 insertions(+), 28 deletions(-) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 792b28b..4b935ae 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -804,28 +804,7 @@ void QApplicationPrivate::processCloseEvent(QWidget *tlw) void QApplicationPrivate::processTouchEvent(QWindowSystemInterface::TouchEvent *e) { - QList touchPoints; - Qt::TouchPointStates states; - - int primaryPoint = -1; - foreach(struct QWindowSystemInterface::TouchPoint point, e->points) { - QTouchEvent::TouchPoint p; - p.setId(point.id); - p.setPressure(point.pressure); - states |= point.state; - if (point.isPrimary) { - point.state |= Qt::TouchPointPrimary; - primaryPoint = point.id; - } - p.setState(point.state); - p.setRect(point.area); - p.setScreenPos(point.area.center()); - p.setNormalizedPos(point.normalPosition); - - touchPoints.append(p); - } - - translateRawTouchEvent(e->widget.data(), e->devType, touchPoints); + translateRawTouchEvent(e->widget.data(), e->devType, e->points); } void QApplicationPrivate::reportScreenCount(int count) diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index cd466e3..c9d177d 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -134,11 +134,37 @@ void QWindowSystemInterfacePrivate::queueUserEvent(QWindowSystemInterface::UserE dispatcher->wakeUp(); } -void QWindowSystemInterface::handleTouchEvent(QWidget *tlw, ulong timestamp, QEvent::Type type, QTouchEvent::DeviceType devType, QList points) +void QWindowSystemInterface::handleTouchEvent(QWidget *tlw, ulong timestamp, QEvent::Type type, QTouchEvent::DeviceType devType, const QList &points) { if (!points.size()) // Touch events must have at least one point return; - TouchEvent *e = new TouchEvent(tlw, timestamp, type, devType, points); + + QList touchPoints; + Qt::TouchPointStates states; + QTouchEvent::TouchPoint p; + + int primaryPoint = -1; + QList::const_iterator point = points.constBegin(); + QList::const_iterator end = points.constEnd(); + while (point != end) { + p.setId(point->id); + p.setPressure(point->pressure); + states |= point->state; + Qt::TouchPointStates state = point->state; + if (point->isPrimary) { + state |= Qt::TouchPointPrimary; + primaryPoint = point->id; + } + p.setState(state); + p.setRect(point->area); + p.setScreenPos(point->area.center()); + p.setNormalizedPos(point->normalPosition); + + touchPoints.append(p); + ++point; + } + + TouchEvent *e = new TouchEvent(tlw, timestamp, type, devType, touchPoints); QWindowSystemInterfacePrivate::queueUserEvent(e); } diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index 8c69218..88d6475 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -85,11 +85,11 @@ public: Qt::TouchPointStates state; //Qt::TouchPoint{Pressed|Moved|Stationary|Released} }; - static void handleTouchEvent(QWidget *w, QEvent::Type type, QTouchEvent::DeviceType devType, QList points) { + static void handleTouchEvent(QWidget *w, QEvent::Type type, QTouchEvent::DeviceType devType, const QList &points) { handleTouchEvent(w, eventTime.elapsed(), type, devType, points); } - static void handleTouchEvent(QWidget *w, ulong timestamp, QEvent::Type type, QTouchEvent::DeviceType devType, QList points); + static void handleTouchEvent(QWidget *w, ulong timestamp, QEvent::Type type, QTouchEvent::DeviceType devType, const QList &points); // delivered directly by the plugin via spontaneous events static void handleGeometryChange(QWidget *w, const QRect &newRect); @@ -143,10 +143,10 @@ public: class TouchEvent : public UserEvent { public: - TouchEvent(QWidget *w, ulong time, QEvent::Type t, QTouchEvent::DeviceType d, QList p) + TouchEvent(QWidget *w, ulong time, QEvent::Type t, QTouchEvent::DeviceType d, const QList &p) :UserEvent(w, time, t) { devType = d; points = p; } QTouchEvent::DeviceType devType; - QList points; + QList points; }; private: -- cgit v0.12 From 37ef97675aeb71a542ef179e98d5ee29f98d25c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 2 Jun 2010 16:17:22 +0200 Subject: Use the QBlittable::drawPixmap implementation for pixmaps when we can just enable a few more states --- src/gui/painting/qpaintengine_blitter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index 4144696..f2e6cdd 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -117,12 +117,12 @@ public: updateStateBits(&drawPixmapMask, STATE_XFORM_SCALE, true); updateStateBits(&drawPixmapMask, STATE_XFORM_COMPLEX, false); - updateStateBits(&drawPixmapMask, STATE_BRUSH_PATTERN, false); + updateStateBits(&drawPixmapMask, STATE_BRUSH_PATTERN, true); updateStateBits(&drawPixmapMask, STATE_BRUSH_ALPHA, false); - updateStateBits(&drawPixmapMask, STATE_PEN_ENABLED, false); + updateStateBits(&drawPixmapMask, STATE_PEN_ENABLED, true); - updateStateBits(&drawPixmapMask, STATE_ANTIALIASING, false); + updateStateBits(&drawPixmapMask, STATE_ANTIALIASING, true); updateStateBits(&drawPixmapMask, STATE_ALPHA, false); updateStateBits(&drawPixmapMask, STATE_BLENDING_COMPLEX, false); -- cgit v0.12 From 28547949cc78d25884a76bf3c2112a6217ba5b66 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Thu, 3 Jun 2010 13:19:37 +0200 Subject: software cursor cleanup --- src/plugins/platforms/fb_base/fb_base.cpp | 24 +++++++++++++----------- src/plugins/platforms/fb_base/fb_base.h | 6 ++++++ src/plugins/platforms/vnc/qvnccursor.cpp | 4 ++-- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/plugins/platforms/fb_base/fb_base.cpp b/src/plugins/platforms/fb_base/fb_base.cpp index f2009c1..cdcb608 100644 --- a/src/plugins/platforms/fb_base/fb_base.cpp +++ b/src/plugins/platforms/fb_base/fb_base.cpp @@ -26,25 +26,29 @@ void QGraphicsSystemSoftwareCursor::pointerEvent(const QMouseEvent & e) { Q_UNUSED(e); currentRect = getCurrentRect(); - screen->setDirty(currentRect); + setDirty(); } QRect QGraphicsSystemSoftwareCursor::drawCursor(QPainter & painter) { + dirty = false; if (currentRect.isNull()) return QRect(); + if (!currentRect.intersects(screen->geometry())) + return QRect(); + prevRect = currentRect; painter.drawImage(prevRect, *graphic->image()); + onScreen = true; return prevRect; } QRect QGraphicsSystemSoftwareCursor::dirtyRect() { - if (!prevRect.isNull()) { - QRect rect = prevRect; - prevRect = QRect(); - return rect; + if (onScreen) { + onScreen = false; + return prevRect; } return QRect(); } @@ -78,7 +82,7 @@ void QGraphicsSystemSoftwareCursor::changeCursor(QCursor * widgetCursor, QWidget setCursor(shape); } currentRect = getCurrentRect(); - screen->setDirty(currentRect); + setDirty(); } QFbScreen::QFbScreen() : cursor(0), mGeometry(), mDepth(16), mFormat(QImage::Format_RGB16), mScreenImage(0), compositePainter(0), isUpToDate(false) @@ -126,8 +130,6 @@ QFbScreen::~QFbScreen() void QFbScreen::setDirty(const QRect &rect) { - -// qDebug() << "QFbScreen::setDirty" << rect; repaintRegion += rect; if (!redrawTimer.isActive()) { redrawTimer.start(); @@ -165,9 +167,9 @@ void QFbScreen::generateRects() QRegion QFbScreen::doRedraw() { QRegion touchedRegion; - if (cursor) + if (cursor && cursor->isDirty() && cursor->isOnScreen()) repaintRegion += cursor->dirtyRect(); - if (repaintRegion.isEmpty()) + if (repaintRegion.isEmpty() && !cursor->isDirty()) return touchedRegion; QVector rects = repaintRegion.rects(); @@ -223,7 +225,7 @@ QRegion QFbScreen::doRedraw() } QRect cursorRect; - if (cursor) { + if (cursor && cursor->isDirty()) { cursorRect = cursor->drawCursor(*compositePainter); touchedRegion += cursorRect; } diff --git a/src/plugins/platforms/fb_base/fb_base.h b/src/plugins/platforms/fb_base/fb_base.h index 13638a0..d94462d 100644 --- a/src/plugins/platforms/fb_base/fb_base.h +++ b/src/plugins/platforms/fb_base/fb_base.h @@ -29,6 +29,10 @@ public: virtual void pointerEvent(const QMouseEvent & event); virtual void changeCursor(QCursor * widgetCursor, QWidget * widget); + virtual void setDirty() { dirty = true; screen->setDirty(QRect()); } + virtual bool isDirty() { return dirty; } + virtual bool isOnScreen() { return onScreen; } + protected: QGraphicsSystemCursorImage * graphic; @@ -39,6 +43,8 @@ private: QRect currentRect; // next place to draw the cursor QRect prevRect; // last place the cursor was drawn QRect getCurrentRect(); + bool dirty; + bool onScreen; }; class QFbWindow; diff --git a/src/plugins/platforms/vnc/qvnccursor.cpp b/src/plugins/platforms/vnc/qvnccursor.cpp index 8da06aa..72dcb25 100644 --- a/src/plugins/platforms/vnc/qvnccursor.cpp +++ b/src/plugins/platforms/vnc/qvnccursor.cpp @@ -64,14 +64,14 @@ void QVNCCursor::changeCursor(QCursor * widgetCursor, QWidget * widget) if (useVncCursor) { server->setDirtyCursor(); } else { - screen->setDirty(QRect(0,0,1,1)); + setDirty(); } } void QVNCCursor::setCursorMode(bool vnc) { if (vnc) { - screen->setDirty(dirtyRect()); + setDirty(); server->setDirtyCursor(); } else { server->setDirtyCursor(); -- cgit v0.12 From a498db43a02972e90df5f1cdd73e90260471f5f8 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Fri, 11 Jun 2010 12:50:27 +0200 Subject: litehouse multiscreen support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds QPlatformIntegration::moveToScreen(), which requests that a widget be moved to another screen. The default implementation ignores the request. The VNC plugin has been updated accordingly. It currently only supports non-virtual desktops. Review by: Jørgen --- src/gui/kernel/kernel.pri | 3 +- src/gui/kernel/qapplication_lite.cpp | 21 ++++++-- src/gui/kernel/qdesktopwidget_lite.cpp | 43 ++++++++++++++-- src/gui/kernel/qdesktopwidget_lite_p.h | 74 +++++++++++++++++++++++++++ src/gui/kernel/qplatformintegration_lite.h | 2 + src/gui/kernel/qwidget.cpp | 8 +++ src/gui/kernel/qwidget.h | 1 + src/gui/kernel/qwidget_lite.cpp | 31 ++++++++++- src/gui/kernel/qwidget_p.h | 2 + src/gui/kernel/qwindowsysteminterface.h | 2 +- src/plugins/platforms/fb_base/fb_base.cpp | 61 ++++++++++++++++------ src/plugins/platforms/fb_base/fb_base.h | 7 +-- src/plugins/platforms/vnc/qvncintegration.cpp | 40 +++++++++++++-- src/plugins/platforms/vnc/qvncintegration.h | 3 ++ src/plugins/platforms/vnc/qvncserver.cpp | 9 ++-- 15 files changed, 264 insertions(+), 43 deletions(-) create mode 100644 src/gui/kernel/qdesktopwidget_lite_p.h diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 049637f..bc9e70c 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -50,7 +50,8 @@ HEADERS += \ kernel/qgesturemanager_p.h \ kernel/qsoftkeymanager_p.h \ kernel/qsoftkeymanager_common_p.h \ - kernel/qguiplatformplugin_p.h + kernel/qguiplatformplugin_p.h \ + kernel/qdesktopwidget_lite_p.h SOURCES += \ kernel/qaction.cpp \ diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 4b935ae..dd25cd4 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -63,6 +63,7 @@ #include #include +#include "qdesktopwidget_lite_p.h" QT_BEGIN_NAMESPACE @@ -395,11 +396,16 @@ QWidget *QApplication::topLevelAt(const QPoint &pos) { QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); - QPlatformScreen *screen = pi->screens().first(); - if (!screen) - return 0; - QWidget *w = screen->topLevelAt(pos); - return w; + QList screens = pi->screens(); + QList::const_iterator screen = screens.constBegin(); + QList::const_iterator end = screens.constEnd(); + + while (screen != end) { + if ((*screen)->geometry().contains(pos)) + return (*screen)->topLevelAt(pos); + ++screen; + } + return 0; } void QApplication::beep() @@ -813,6 +819,7 @@ void QApplicationPrivate::reportScreenCount(int count) if (QCoreApplication::startingUp()) return; + QApplication::desktop()->d_func()->updateScreenList(); // signal anything listening for creation or deletion of screens QDesktopWidget *desktop = QApplication::desktop(); emit desktop->screenCountChanged(count); @@ -824,6 +831,8 @@ void QApplicationPrivate::reportGeometryChange(int screenIndex) if (QCoreApplication::startingUp()) return; + QApplication::desktop()->d_func()->updateScreenList(); + // signal anything listening for screen geometry changes QDesktopWidget *desktop = QApplication::desktop(); emit desktop->resized(screenIndex); @@ -845,6 +854,8 @@ void QApplicationPrivate::reportAvailableGeometryChange(int screenIndex) if (QCoreApplication::startingUp()) return; + QApplication::desktop()->d_func()->updateScreenList(); + // signal anything listening for screen geometry changes QDesktopWidget *desktop = QApplication::desktop(); emit desktop->workAreaResized(screenIndex); diff --git a/src/gui/kernel/qdesktopwidget_lite.cpp b/src/gui/kernel/qdesktopwidget_lite.cpp index b077d57..3e37faf 100644 --- a/src/gui/kernel/qdesktopwidget_lite.cpp +++ b/src/gui/kernel/qdesktopwidget_lite.cpp @@ -42,13 +42,43 @@ #include "qdesktopwidget.h" #include "private/qapplication_p.h" #include "private/qgraphicssystem_p.h" - +#include +#include "private/qwidget_p.h" +#include "private/qdesktopwidget_lite_p.h" QT_BEGIN_NAMESPACE QT_USE_NAMESPACE +void QDesktopWidgetPrivate::updateScreenList() +{ + QList screenList = QApplicationPrivate::platformIntegration()->screens(); + int targetLength = screenList.length(); + int currentLength = screens.length(); + + // Add or remove screen widgets as necessary + if(currentLength > targetLength) { + QDesktopScreenWidget *screen; + while (currentLength-- > targetLength) { + screen = screens.takeLast(); + delete screen; + } + } + else if (currentLength < targetLength) { + QDesktopScreenWidget *screen; + while (currentLength < targetLength) { + screen = new QDesktopScreenWidget(currentLength++); + screens.append(screen); + } + } + + // update the geometry of each screen widget + for (int i = 0; i < screens.length(); i++) { + screens.at(i)->setGeometry(screenList.at(i)->geometry()); + } +} + QDesktopWidget::QDesktopWidget() - : QWidget(0, Qt::Desktop) + : QWidget(*new QDesktopWidgetPrivate, 0, Qt::Desktop) { setObjectName(QLatin1String("desktop")); } @@ -59,7 +89,7 @@ QDesktopWidget::~QDesktopWidget() bool QDesktopWidget::isVirtualDesktop() const { - return true; + return QApplicationPrivate::platformIntegration()->isVirtualDesktop(); } int QDesktopWidget::primaryScreen() const @@ -73,9 +103,12 @@ int QDesktopWidget::numScreens() const return qMax(pi->screens().size(), 1); } -QWidget *QDesktopWidget::screen(int) +QWidget *QDesktopWidget::screen(int screen) { - return this; + Q_D(QDesktopWidget); + if (screen < 0 || screen >= d->screens.length()) + return d->screens.at(0); + return d->screens.at(screen); } const QRect QDesktopWidget::availableGeometry(int screenNo) const diff --git a/src/gui/kernel/qdesktopwidget_lite_p.h b/src/gui/kernel/qdesktopwidget_lite_p.h new file mode 100644 index 0000000..c04e172 --- /dev/null +++ b/src/gui/kernel/qdesktopwidget_lite_p.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#ifndef QDESKTOPWIDGET_LITE_P_H +#define QDESKTOPWIDGET_LITE_P_H + +#include "QDesktopWidget" +#include "private/qwidget_p.h" + +class QDesktopScreenWidget : public QWidget { + Q_OBJECT +public: + QDesktopScreenWidget(int screenNumber) { setWindowFlags(Qt::Desktop); setVisible(false); d_func()->screenNumber = screenNumber; } +}; + +class QDesktopWidgetPrivate : public QWidgetPrivate { +public: + QDesktopWidgetPrivate() { updateScreenList(); } + ~QDesktopWidgetPrivate() {foreach(QDesktopScreenWidget *s, screens) delete s; } + void updateScreenList(); + + QList screens; +}; + +#endif // QDESKTOPWIDGET_LITE_P_H diff --git a/src/gui/kernel/qplatformintegration_lite.h b/src/gui/kernel/qplatformintegration_lite.h index a509b52..aa71c3d 100644 --- a/src/gui/kernel/qplatformintegration_lite.h +++ b/src/gui/kernel/qplatformintegration_lite.h @@ -66,9 +66,11 @@ public: virtual QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const = 0; virtual QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const = 0; virtual QBlittable *createBlittable(const QSize &size) const; + virtual void moveToScreen(QWidget *window, int screen) {Q_UNUSED(window); Q_UNUSED(screen);} // Window System functions virtual QList screens() const = 0; + virtual bool isVirtualDesktop() { return false; } virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const; // OpenGL Integration functions diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 2c9730b..611bd50 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -211,6 +211,8 @@ QWidgetPrivate::QWidgetPrivate(int version) , hasAlienChildren(0) , window_event(0) , qd_hd(0) +#elif defined (Q_WS_LITE) + , screenNumber(0) #endif { if (!qApp) { @@ -1154,6 +1156,12 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f) // programmer specified desktop widget xinfo = desktopWidget->d_func()->xinfo; } +#elif defined(Q_WS_LITE) + if (desktopWidget) { + int screen = desktopWidget->d_func()->screenNumber; + QPlatformIntegration *platform = QApplicationPrivate::platformIntegration(); + platform->moveToScreen(q, screen); + } #else Q_UNUSED(desktopWidget); #endif diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index 7dff703..598e877 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -629,6 +629,7 @@ public: #if defined(Q_WS_LITE) void setPlatformWindow(QPlatformWindow *window); QPlatformWindow *platformWindow() const; + friend class QDesktopScreenWidget; #endif Q_SIGNALS: diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index d281bec..25cd0f6 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -85,6 +85,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO setWinId(q->platformWindow()->winId()); + QApplicationPrivate::platformIntegration()->moveToScreen(q, screenNumber); // qDebug() << "create_sys" << q << q->internalWinId(); } @@ -119,14 +120,31 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) { Q_Q(QWidget); -// QWidget *oldParent = q->parentWidget(); + + // QWidget *oldParent = q->parentWidget(); Qt::WindowFlags oldFlags = data.window_flags; + + int targetScreen = -1; + // Handle a request to move the widget to a particular screen + if (newparent && newparent->windowType() == Qt::Desktop) { + // make sure the widget is created on the same screen as the + // programmer specified desktop widget + + // get the desktop's screen number + targetScreen = newparent->d_func()->screenNumber; + newparent = 0; + } + if (parent != newparent) { QObjectPrivate::setParent_helper(newparent); //### why does this have to be done in the _sys function??? - } + if (!newparent) { f |= Qt::Window; + if (targetScreen == -1) { + if (parent) + targetScreen = qobject_cast(parent)->d_func()->screenNumber; + } } bool explicitlyHidden = q->testAttribute(Qt::WA_WState_Hidden) && q->testAttribute(Qt::WA_WState_ExplicitShowHide); @@ -153,6 +171,15 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) q->setAttribute(Qt::WA_WState_Hidden); q->setAttribute(Qt::WA_WState_ExplicitShowHide, explicitlyHidden); + // move the window to the selected screen + if (!newparent && targetScreen != -1) { + screenNumber = targetScreen; + // only if it is already created + if (q->testAttribute(Qt::WA_WState_Created)) { + QPlatformIntegration *platform = QApplicationPrivate::platformIntegration(); + platform->moveToScreen(q, targetScreen); + } + } } QPoint QWidget::mapToGlobal(const QPoint &pos) const diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index b5376a4..e0b8a67 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -815,6 +815,8 @@ public: #elif defined(Q_WS_LITE) void setMaxWindowState_helper(); void setFullScreenSize_helper(); + + int screenNumber; // screen the widget should be displayed on #ifndef QT_NO_CURSOR void updateCursor() const; #endif diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index 88d6475..614f983 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -105,7 +105,7 @@ public: class UserEvent { public: UserEvent(QWidget * w, ulong time, QEvent::Type t) - { widget = QWeakPointer::QWeakPointer(w); type = t; timestamp = time; } + { widget = QWeakPointer(w); type = t; timestamp = time; } QWeakPointer widget; QEvent::Type type; unsigned long timestamp; diff --git a/src/plugins/platforms/fb_base/fb_base.cpp b/src/plugins/platforms/fb_base/fb_base.cpp index cdcb608..0463a60 100644 --- a/src/plugins/platforms/fb_base/fb_base.cpp +++ b/src/plugins/platforms/fb_base/fb_base.cpp @@ -18,6 +18,8 @@ QRect QGraphicsSystemSoftwareCursor::getCurrentRect() QRect rect = graphic->image()->rect().translated(-graphic->hotspot().x(), -graphic->hotspot().y()); rect.translate(QCursor::pos()); + QPoint screenOffset = screen->geometry().topLeft(); + rect.translate(-screenOffset); // global to local translation return rect; } @@ -25,8 +27,12 @@ QRect QGraphicsSystemSoftwareCursor::getCurrentRect() void QGraphicsSystemSoftwareCursor::pointerEvent(const QMouseEvent & e) { Q_UNUSED(e); + QPoint screenOffset = screen->geometry().topLeft(); currentRect = getCurrentRect(); - setDirty(); + // global to local translation + if (onScreen || screen->geometry().intersects(currentRect.translated(screenOffset))) { + setDirty(); + } } QRect QGraphicsSystemSoftwareCursor::drawCursor(QPainter & painter) @@ -35,7 +41,10 @@ QRect QGraphicsSystemSoftwareCursor::drawCursor(QPainter & painter) if (currentRect.isNull()) return QRect(); - if (!currentRect.intersects(screen->geometry())) + // We need this because the cursor might be dirty due to moving off screen + QPoint screenOffset = screen->geometry().topLeft(); + // global to local translation + if (!currentRect.translated(screenOffset).intersects(screen->geometry())) return QRect(); prevRect = currentRect; @@ -82,7 +91,9 @@ void QGraphicsSystemSoftwareCursor::changeCursor(QCursor * widgetCursor, QWidget setCursor(shape); } currentRect = getCurrentRect(); - setDirty(); + QPoint screenOffset = screen->geometry().topLeft(); // global to local translation + if (onScreen || screen->geometry().intersects(currentRect.translated(screenOffset))) + setDirty(); } QFbScreen::QFbScreen() : cursor(0), mGeometry(), mDepth(16), mFormat(QImage::Format_RGB16), mScreenImage(0), compositePainter(0), isUpToDate(false) @@ -130,7 +141,9 @@ QFbScreen::~QFbScreen() void QFbScreen::setDirty(const QRect &rect) { - repaintRegion += rect; + QRect intersection = rect.intersected(mGeometry); + QPoint screenOffset = mGeometry.topLeft(); + repaintRegion += intersection.translated(-screenOffset); // global to local translation if (!redrawTimer.isActive()) { redrawTimer.start(); } @@ -139,7 +152,8 @@ void QFbScreen::setDirty(const QRect &rect) void QFbScreen::generateRects() { cachedRects.clear(); - QRegion remainingScreen(mGeometry); + QPoint screenOffset = mGeometry.topLeft(); + QRegion remainingScreen(mGeometry.translated(-screenOffset)); // global to local translation for (int i = 0; i < windowStack.length(); i++) { if (remainingScreen.isEmpty()) @@ -148,8 +162,8 @@ void QFbScreen::generateRects() continue; if (!windowStack[i]->widget()->testAttribute(Qt::WA_TranslucentBackground)) { - remainingScreen -= windowStack[i]->geometry(); - QRegion windowRegion(windowStack[i]->geometry()); + remainingScreen -= windowStack[i]->localGeometry(); + QRegion windowRegion(windowStack[i]->localGeometry()); windowRegion -= remainingScreen; foreach(QRect rect, windowRegion.rects()) { cachedRects += QPair(rect, i); @@ -166,11 +180,16 @@ void QFbScreen::generateRects() QRegion QFbScreen::doRedraw() { + QPoint screenOffset = mGeometry.topLeft(); // optimize me! + QRegion touchedRegion; - if (cursor && cursor->isDirty() && cursor->isOnScreen()) - repaintRegion += cursor->dirtyRect(); - if (repaintRegion.isEmpty() && !cursor->isDirty()) + if (cursor && cursor->isDirty() && cursor->isOnScreen()) { + QRect lastCursor = cursor->dirtyRect(); + repaintRegion += lastCursor; + } + if (repaintRegion.isEmpty() && !cursor->isDirty()) { return touchedRegion; + } QVector rects = repaintRegion.rects(); @@ -206,10 +225,9 @@ QRegion QFbScreen::doRedraw() continue; if (windowStack[layerIndex]->widget()->isMinimized()) continue; - QRect windowRect = windowStack[layerIndex]->geometry(); + QRect windowRect = windowStack[layerIndex]->geometry().translated(-screenOffset); QRect windowIntersect = rect.translated(-windowRect.left(), - -windowRect.top()); -// qDebug() << " compositing" << layerIndex << windowStack[layerIndex]->surface->image().size(); + -windowRect.top()); compositePainter->drawImage(rect, windowStack[layerIndex]->surface->image(), windowIntersect); if (firstLayer) { @@ -218,10 +236,6 @@ QRegion QFbScreen::doRedraw() } } } - if (!rectRegion.isEmpty()) - qWarning() << "non-empty region!" << rectRegion; - // Everything on screen should be mapped to a sub-rectangle - // unless it's off the screen... } QRect cursorRect; @@ -240,6 +254,16 @@ QRegion QFbScreen::doRedraw() return touchedRegion; } +void QFbScreen::addWindow(QFbWindow *surface) +{ + windowStack.prepend(surface); + surface->mScreen = this; + QPoint screenOffset = mGeometry.topLeft(); + surface->localGeometry() = surface->geometry().translated(-screenOffset); // global to local translation + invalidateRectCache(); + setDirty(surface->geometry()); +} + void QFbScreen::removeWindow(QFbWindow * surface) { windowStack.removeOne(surface); @@ -369,6 +393,9 @@ void QFbWindow::setGeometry(const QRect &rect) //### QWindowSystemInterface::handleGeometryChange(window(), rect); QPlatformWindow::setGeometry(rect); + + QPoint screenOffset = mScreen->geometry().topLeft(); + mLocalGeometry = rect.translated(-screenOffset); // global to local translation } bool QFbWindowSurface::scroll(const QRegion &area, int dx, int dy) diff --git a/src/plugins/platforms/fb_base/fb_base.h b/src/plugins/platforms/fb_base/fb_base.h index d94462d..f1dd574 100644 --- a/src/plugins/platforms/fb_base/fb_base.h +++ b/src/plugins/platforms/fb_base/fb_base.h @@ -98,6 +98,8 @@ public: virtual void repaint(const QRegion&); + virtual QRect localGeometry() { return mLocalGeometry; } + protected: friend class QFbWindowSurface; friend class QFbScreen; @@ -106,7 +108,7 @@ protected: QRect oldGeometry; bool visibleFlag; Qt::WindowFlags flags; - + QRect mLocalGeometry; // local screen coordinates WId windowId; }; @@ -131,8 +133,7 @@ public: virtual void setDirty(const QRect &rect); virtual void removeWindow(QFbWindow * surface); - virtual void addWindow(QFbWindow * surface) { - windowStack.prepend(surface); invalidateRectCache(); } + virtual void addWindow(QFbWindow * surface); virtual void raise(QPlatformWindow * surface); virtual void lower(QPlatformWindow * surface); virtual QWidget * topLevelAt(const QPoint & p) const; diff --git a/src/plugins/platforms/vnc/qvncintegration.cpp b/src/plugins/platforms/vnc/qvncintegration.cpp index 69aea79..de6d81f 100644 --- a/src/plugins/platforms/vnc/qvncintegration.cpp +++ b/src/plugins/platforms/vnc/qvncintegration.cpp @@ -50,7 +50,6 @@ #include - QVNCScreen::QVNCScreen(QRect screenSize, int screenId) : QFbScreen::QFbScreen() { @@ -99,6 +98,8 @@ QVNCIntegration::QVNCIntegration(const QStringList& paramList) { int sizeX = defaultWidth(); int sizeY = defaultHeight(); + int offsetX = 0; + int offsetY = 0; int display = defaultDisplay(); bool showUsage = false; @@ -111,6 +112,19 @@ QVNCIntegration::QVNCIntegration(const QStringList& paramList) else if (confString.startsWith(QLatin1String("display="))) { display = confString.section(QLatin1Char('='), 1, 1).toInt(); } + else if (confString.startsWith(QLatin1String("offset="))) { + QString val = confString.section(QLatin1Char('='), 1, 1); + offsetX = val.section(QLatin1Char('x'), 0, 0).toInt(); + offsetY = val.section(QLatin1Char('x'), 1, 1).toInt(); + } + else if (confString == QLatin1String("vnc")) { + QRect screenRect(offsetX, offsetY, sizeX, sizeY); + QVNCScreen *screen = new QVNCScreen(screenRect, display); + mScreens.append(screen); + screen->setObjectName(QString("screen %1").arg(display)); + screen->setDirty(screenRect); + ++display; + } else { qWarning() << "Unknown VNC option:" << confString; showUsage = true; @@ -120,9 +134,12 @@ QVNCIntegration::QVNCIntegration(const QStringList& paramList) if (showUsage) usage(); - mPrimaryScreen = new QVNCScreen(QRect(0, 0, sizeX, sizeY), display); - - mScreens.append(mPrimaryScreen); + QRect screenRect(offsetX, offsetY, sizeX, sizeY); + QVNCScreen *screen = new QVNCScreen(screenRect, display); + mScreens.append(screen); + mPrimaryScreen = qobject_cast(mScreens.first()); + screen->setObjectName(QString("screen %1").arg(display)); + screen->setDirty(screenRect); } QPixmapData *QVNCIntegration::createPixmapData(QPixmapData::PixelType type) const @@ -155,3 +172,18 @@ QPlatformWindow *QVNCIntegration::createPlatformWindow(QWidget *widget, WId /*wi return w; } +void QVNCIntegration::moveToScreen(QWidget *window, int screen) +{ + if (screen < 0 || screen > mScreens.size()) + return; + QVNCScreen * newScreen = qobject_cast(mScreens.at(screen)); + for(int i = 0; i < mScreens.size(); i++) { + QVNCScreen *oldScreen = qobject_cast(mScreens.at(i)); + if (oldScreen->windowStack.contains(static_cast(window->platformWindow()))) { + oldScreen->removeWindow(static_cast(window->platformWindow())); + break; + } + } + window->platformWindow()->setGeometry(window->geometry()); // this should be unified elsewhere + newScreen->addWindow(static_cast(window->platformWindow())); +} diff --git a/src/plugins/platforms/vnc/qvncintegration.h b/src/plugins/platforms/vnc/qvncintegration.h index dcb5419..3436e51 100644 --- a/src/plugins/platforms/vnc/qvncintegration.h +++ b/src/plugins/platforms/vnc/qvncintegration.h @@ -55,6 +55,7 @@ class QVNCScreenPrivate; class QVNCScreen : public QFbScreen { + Q_OBJECT public: QVNCScreen(QRect screenSize, int screenId); @@ -68,6 +69,7 @@ public: private: QVNCServer *server; QRegion doRedraw(); + friend class QVNCIntegration; }; class QVNCIntegrationPrivate; @@ -84,6 +86,7 @@ public: QList screens() const { return mScreens; } + void moveToScreen(QWidget *window, int screen); private: QVNCScreen *mPrimaryScreen; diff --git a/src/plugins/platforms/vnc/qvncserver.cpp b/src/plugins/platforms/vnc/qvncserver.cpp index 6424083..fb6eaa8 100644 --- a/src/plugins/platforms/vnc/qvncserver.cpp +++ b/src/plugins/platforms/vnc/qvncserver.cpp @@ -831,14 +831,13 @@ static bool buttonChange(Qt::MouseButtons before, Qt::MouseButtons after, Qt::Mo void QVNCServer::pointerEvent() { + QPoint screenOffset = this->screen()->geometry().topLeft(); + QRfbPointerEvent ev; if (ev.read(client)) { -// const QPoint offset = qvnc_screen->offset(); -// QWSServer::sendMouseEvent(offset + QPoint(ev.x, ev.y), ev.buttons); - QPoint eventPoint(ev.x, ev.y); - eventPoint += screen()->geometry().topLeft(); - //qDebug() << "pointerEvent" << ev.x << ev.y << hex << ev.buttons; + eventPoint += screenOffset; // local to global translation + if (ev.wheelDirection == ev.WheelNone) { QEvent::Type type = QEvent::MouseMove; Qt::MouseButton button = Qt::NoButton; -- cgit v0.12 From 7497ae0504a4186103c835c3c0cfca5133f2d50e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 11 Jun 2010 11:54:24 +0200 Subject: Added QPlatformGLContext to QPlatformWindow and removed the the creator function. Child QGLWidgets don't work --- src/gui/kernel/kernel.pri | 3 +- src/gui/kernel/qplatformglcontext_lite.h | 71 ++++++++++ src/gui/kernel/qplatformintegration_lite.cpp | 12 -- src/gui/kernel/qplatformintegration_lite.h | 10 -- src/gui/kernel/qplatformwindow_lite.cpp | 5 + src/gui/kernel/qplatformwindow_lite.h | 4 + src/gui/kernel/qwidget_lite.cpp | 12 +- src/opengl/opengl.pro | 6 +- src/opengl/qgl_lite.cpp | 80 ++--------- src/opengl/qgl_p.h | 6 +- src/opengl/qglplatformintegration_lite.h | 88 ------------ src/plugins/platforms/testlite/qglxintegration.cpp | 157 ++------------------- src/plugins/platforms/testlite/qglxintegration.h | 25 +--- .../platforms/testlite/qtestliteintegration.cpp | 18 --- .../platforms/testlite/qtestliteintegration.h | 6 - src/plugins/platforms/testlite/qtestlitewindow.cpp | 27 +++- src/plugins/platforms/testlite/qtestlitewindow.h | 4 + 17 files changed, 144 insertions(+), 390 deletions(-) create mode 100644 src/gui/kernel/qplatformglcontext_lite.h delete mode 100644 src/opengl/qglplatformintegration_lite.h diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index bc9e70c..f849ad7 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -208,7 +208,8 @@ embedded_lite { kernel/qplatformscreen_lite.h \ kernel/qplatformintegrationfactory_lite_p.h \ kernel/qplatformintegrationplugin_lite.h \ - kernel/qplatformwindow_lite.h + kernel/qplatformwindow_lite.h \ + kernel/qplatformglcontext_lite.h SOURCES += \ kernel/qapplication_lite.cpp \ diff --git a/src/gui/kernel/qplatformglcontext_lite.h b/src/gui/kernel/qplatformglcontext_lite.h new file mode 100644 index 0000000..8aeb635 --- /dev/null +++ b/src/gui/kernel/qplatformglcontext_lite.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenGL module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORM_GL_CONTEXT_H +#define QPLATFORM_GL_CONTEXT_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class Q_OPENGL_EXPORT QPlatformGLContext +{ +public: + //QPlatformGLContext(); + //virtual ~QPlatformGLContext(); + + //virtual bool create(QPaintDevice* device, QPlatformGLContext* shareContext) = 0; + + virtual void makeCurrent() = 0; + virtual void doneCurrent() = 0; + virtual void swapBuffers() = 0; + virtual void* getProcAddress(const QString& procName) = 0; + +}; + +QT_END_NAMESPACE + +QT_END_HEADER + + +#endif // QPLATFORM_GL_INTEGRATION_P_H diff --git a/src/gui/kernel/qplatformintegration_lite.cpp b/src/gui/kernel/qplatformintegration_lite.cpp index 2d181f1..6499570 100644 --- a/src/gui/kernel/qplatformintegration_lite.cpp +++ b/src/gui/kernel/qplatformintegration_lite.cpp @@ -56,21 +56,9 @@ QPixmap QPlatformIntegration::grabWindow(WId window, int x, int y, int width, in return QPixmap(); } -#ifndef QT_NO_OPENGL bool QPlatformIntegration::hasOpenGL() const { return false; } -QPlatformGLContext * QPlatformIntegration::createGLContext() -{ - return 0; -} - -QPlatformGLWidgetSurface * QPlatformIntegration::createGLWidgetSurface() -{ - return 0; -} -#endif - QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformintegration_lite.h b/src/gui/kernel/qplatformintegration_lite.h index aa71c3d..88c3049 100644 --- a/src/gui/kernel/qplatformintegration_lite.h +++ b/src/gui/kernel/qplatformintegration_lite.h @@ -51,11 +51,6 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -#ifndef QT_NO_OPENGL -class QPlatformGLContext; -class QPlatformGLWidgetSurface; -#endif - class Q_GUI_EXPORT QPlatformIntegration { public: @@ -73,12 +68,7 @@ public: virtual bool isVirtualDesktop() { return false; } virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const; -// OpenGL Integration functions -#ifndef QT_NO_OPENGL virtual bool hasOpenGL() const; - virtual QPlatformGLContext * createGLContext(); - virtual QPlatformGLWidgetSurface * createGLWidgetSurface(); -#endif }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformwindow_lite.cpp b/src/gui/kernel/qplatformwindow_lite.cpp index c8a3ed5..151e93d 100644 --- a/src/gui/kernel/qplatformwindow_lite.cpp +++ b/src/gui/kernel/qplatformwindow_lite.cpp @@ -76,3 +76,8 @@ void QPlatformWindow::setOpacity(qreal level) Q_UNUSED(level); qWarning("This plugin does not support setting window opacity"); } + +QPlatformGLContext *QPlatformWindow::glContext() +{ + return 0; +} diff --git a/src/gui/kernel/qplatformwindow_lite.h b/src/gui/kernel/qplatformwindow_lite.h index 583ac28..0a94fc0 100644 --- a/src/gui/kernel/qplatformwindow_lite.h +++ b/src/gui/kernel/qplatformwindow_lite.h @@ -54,6 +54,8 @@ QT_BEGIN_NAMESPACE class QPlatformWindowPrivate; class QWidget; +class QPlatformGLContext; + class Q_GUI_EXPORT QPlatformWindow { Q_DECLARE_PRIVATE(QPlatformWindow); @@ -75,6 +77,8 @@ public: virtual void lower(); virtual void setOpacity(qreal level); + + virtual QPlatformGLContext *glContext(); protected: QScopedPointer d_ptr; }; diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index 25cd0f6..e1a8d0d 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -77,7 +77,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO Q_ASSERT(platformWindow); // QGLWidget does not need/work with a windowsurface - if (!surface && !q->inherits("QGLWidget")) { + if (!surface) {// && !q->inherits("QGLWidget")) { surface = QApplicationPrivate::platformIntegration()->createWindowSurface(q,platformWindow->winId()); } @@ -343,18 +343,20 @@ void QWidgetPrivate::show_sys() if (!q->isWindow()) return; - if (QWindowSurface *surface = q->windowSurface()) { + if (QPlatformWindow *window = q->platformWindow()) { const QRect geomRect = q->geometry(); - const QRect windowRect = q->platformWindow()->geometry(); + const QRect windowRect = window->geometry(); if (windowRect != geomRect) { q->platformWindow()->setGeometry(geomRect); - if (windowRect.size() != geomRect.size()) { - surface->resize(geomRect.size()); + if (QWindowSurface *surface = q->windowSurface()) + if (windowRect.size() != geomRect.size()) { + surface->resize(geomRect.size()); } } q->platformWindow()->setVisible(true); } + if (q->windowType() != Qt::Popup && q->windowType() != Qt::ToolTip && !(q->windowFlags() & Qt::X11BypassWindowManagerHint)) q->activateWindow(); //### } diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index 53f9d3e..6670d14 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -79,10 +79,8 @@ SOURCES += qgl.cpp \ embedded_lite { DEFINES += QT_NO_EGL - SOURCES += qgl_lite.cpp - HEADERS += qglplatformintegration_lite.h - - SOURCES += qglpixelbuffer_stub.cpp + SOURCES += qgl_lite.cpp \ + qglpixelbuffer_stub.cpp } x11 { diff --git a/src/opengl/qgl_lite.cpp b/src/opengl/qgl_lite.cpp index 636c711..2003cc1 100644 --- a/src/opengl/qgl_lite.cpp +++ b/src/opengl/qgl_lite.cpp @@ -40,39 +40,18 @@ ****************************************************************************/ #include +#include #include #include #include +#include #include "qgl.h" #include "qgl_p.h" -#include "qglplatformintegration_lite.h" QT_BEGIN_NAMESPACE -QPlatformGLContext::QPlatformGLContext() -{ -} - -QPlatformGLContext::~QPlatformGLContext() -{ -} - -QPlatformGLWidgetSurface::QPlatformGLWidgetSurface() -{ -} - -QPlatformGLWidgetSurface::~QPlatformGLWidgetSurface() -{ -} - -bool QPlatformGLWidgetSurface::filterEvent(QEvent*) -{ - // By default, return false to allow the event to pass through - return false; -} - bool QGLFormat::hasOpenGL() { @@ -82,8 +61,16 @@ bool QGLFormat::hasOpenGL() bool QGLContext::chooseContext(const QGLContext* shareContext) { Q_D(QGLContext); - d->platformContext = QApplicationPrivate::platformIntegration()->createGLContext(); - d->valid = d->platformContext->create(d->paintDevice, d->glFormat, shareContext ? shareContext->d_func()->platformContext : 0); + if (!d->paintDevice && d->paintDevice->devType() != QInternal::Widget) { + d->valid = false; + }else { + QWidget *widget = static_cast(d->paintDevice); + if (!widget->platformWindow()){ + widget->winId();//make window + } + d->platformContext = widget->platformWindow()->glContext(); + d->valid =(bool) d->platformContext; + } return d->valid; } @@ -154,18 +141,6 @@ void QGLWidget::setContext(QGLContext *context, QGLContext* oldcx = d->glcx; d->glcx = context; - if (!d->wsurf) { - // If the application has set WA_TranslucentBackground and not explicitly set - // the alpha buffer size to zero, modify the format so it have an alpha channel - QGLFormat format = d->glcx->d_func()->glFormat; - if (testAttribute(Qt::WA_TranslucentBackground) && format.alphaBufferSize() == -1) - format.setAlphaBufferSize(1); - - d->wsurf = QApplicationPrivate::platformIntegration()->createGLWidgetSurface(); - d->wsurf->create(this, format); - d->glcx->d_func()->glFormat = format; - } - if (!d->glcx->isValid()) d->glcx->create(shareContext ? shareContext : oldcx); @@ -173,12 +148,6 @@ void QGLWidget::setContext(QGLContext *context, delete oldcx; } -QPlatformGLWidgetSurface* QGLWidget::platformSurface() -{ - Q_D(QGLWidget); - return d->wsurf; -} - void QGLWidgetPrivate::init(QGLContext *context, const QGLWidget *shareWidget) { initContext(context, shareWidget); @@ -247,33 +216,12 @@ void QGLWidget::setMouseTracking(bool enable) bool QGLWidget::event(QEvent *e) { - Q_D(QGLWidget); - - if (d->wsurf) { - bool eventFiltered = d->wsurf->filterEvent(e); - if (eventFiltered) - return true; - } - return QWidget::event(e); } -void QGLWidget::resizeEvent(QResizeEvent *) +void QGLWidget::resizeEvent(QResizeEvent *e) { - Q_D(QGLWidget); - if (!isValid()) - return; - - if (!d->wsurf) { - qWarning("QGLWidget::resizeEvent() - widget does not have a platform surface"); - return; - } - d->wsurf->setGeometry(geometry()); //### What about moveEvent? - - makeCurrent(); - if (!d->glcx->initialized()) - glInit(); - resizeGL(width(), height()); + return QWidget::resizeEvent(e); } diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 37466d8..042d5ae 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -69,7 +69,7 @@ #endif #if defined(Q_WS_LITE) -#include +#include #endif QT_BEGIN_NAMESPACE @@ -165,7 +165,7 @@ class QGLWidgetPrivate : public QWidgetPrivate public: QGLWidgetPrivate() : QWidgetPrivate() , disable_clear_on_painter_begin(false) -#if defined(Q_WS_QWS) || defined(Q_WS_LITE) +#if defined(Q_WS_QWS) , wsurf(0) #endif #if defined(Q_WS_X11) && !defined(QT_NO_EGL) @@ -207,8 +207,6 @@ public: void updatePaintDevice(); #elif defined(Q_WS_QWS) QWSGLWindowSurface *wsurf; -#elif defined (Q_WS_LITE) - QPlatformGLWidgetSurface* wsurf; #endif }; diff --git a/src/opengl/qglplatformintegration_lite.h b/src/opengl/qglplatformintegration_lite.h deleted file mode 100644 index bec920c..0000000 --- a/src/opengl/qglplatformintegration_lite.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPLATFORM_GL_CONTEXT_H -#define QPLATFORM_GL_CONTEXT_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -// QGLPlatformWidgetSurface does _not_ inherit from QWindowSurface -// - The backing store may be totally unaware of it's existance. -class Q_OPENGL_EXPORT QPlatformGLWidgetSurface -{ -public: - QPlatformGLWidgetSurface(); - virtual ~QPlatformGLWidgetSurface(); - - virtual bool create(QGLWidget*, QGLFormat&) = 0; - - virtual void setGeometry(const QRect&) = 0; - virtual bool filterEvent(QEvent*); -}; - - -class Q_OPENGL_EXPORT QPlatformGLContext -{ -public: - QPlatformGLContext(); - virtual ~QPlatformGLContext(); - - virtual bool create(QPaintDevice* device, QGLFormat& format, QPlatformGLContext* shareContext) = 0; - - virtual void makeCurrent() = 0; - virtual void doneCurrent() = 0; - virtual void swapBuffers() = 0; - virtual void* getProcAddress(const QString& procName) = 0; - -}; - - - -QT_END_NAMESPACE - -QT_END_HEADER - - -#endif // QPLATFORM_GL_INTEGRATION_P_H diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp index 79596f5..ba89dbd 100644 --- a/src/plugins/platforms/testlite/qglxintegration.cpp +++ b/src/plugins/platforms/testlite/qglxintegration.cpp @@ -128,106 +128,24 @@ GLXFBConfig qt_glx_integration_choose_config(MyDisplay* xd, QGLFormat& format, i return chosenConfig; } - -QGLXGLWidgetSurface::QGLXGLWidgetSurface(MyDisplay* xd) - : QPlatformGLWidgetSurface() +QGLXGLContext::QGLXGLContext(WId winId, MyDisplay *xd, QGLFormat& format, QPlatformGLContext* shareContext) + : QPlatformGLContext() , m_xd(xd) + , m_drawable((Drawable)winId) , m_config(0) - , m_winId(0) - , m_widget(0) -{ -} - -QGLXGLWidgetSurface::~QGLXGLWidgetSurface() -{ -} - -static Colormap qt_glx_integration_colormap = 0; - - -bool QGLXGLWidgetSurface::create(QGLWidget *widget, QGLFormat& format) + , m_context(0) { - m_widget = widget; + GLXContext shareGlxContext = 0; + if (shareContext) + shareGlxContext = static_cast(shareContext)->glxContext(); m_config = qt_glx_integration_choose_config(m_xd, format, GLX_WINDOW_BIT); - Window parentWindow = widget->window()->winId(); - - XVisualInfo* visualInfo; - visualInfo = glXGetVisualFromFBConfig(m_xd->display, m_config); - - // ### This will leak the colormap, but we need a colormap for each visual -// if (!qt_glx_integration_colormap) { - qt_glx_integration_colormap = XCreateColormap(m_xd->display, parentWindow, - visualInfo->visual, AllocNone); -// } - - XSetWindowAttributes windowAttribs; - windowAttribs.background_pixel = m_xd->whitePixel(); - windowAttribs.border_pixel = m_xd->blackPixel(); - windowAttribs.colormap = qt_glx_integration_colormap; - - m_winId = XCreateWindow(m_xd->display, parentWindow, - widget->x(), widget->y(), widget->width(), widget->height(), - 0, visualInfo->depth, InputOutput, visualInfo->visual, - CWBackPixel|CWBorderPixel|CWColormap, &windowAttribs); + m_context = glXCreateNewContext(m_xd->display, m_config, GLX_RGBA_TYPE, shareGlxContext, True); #ifdef MYX11_DEBUG - qDebug() << "QGLXGLWidgetSurface::create" << hex << "parent" << parentWindow << "win:" << m_winId << widget; + qDebug() << "QGLXGLContext::create context" << m_context; #endif - XSetWindowBackgroundPixmap(m_xd->display, m_winId, XNone); - XMapWindow(m_xd->display, m_winId); - - XFree(visualInfo); - return true; -} - -void QGLXGLWidgetSurface::setGeometry(const QRect& rect) -{ -#ifdef MYX11_DEBUG - qDebug() << "QGLXGLWidgetSurface::setGeometry" << rect << hex << m_xd->display << m_winId << "toplevel?" << m_widget->isWindow(); -#endif - //### toplevel QGLWidgets do have a separate X window owned by the surface, but it has a - // local geometry - if (m_widget->isWindow()) - XMoveResizeWindow(m_xd->display, m_winId, 0, 0, rect.width(), rect.height()); - else - XMoveResizeWindow(m_xd->display, m_winId, rect.x(), rect.y(), rect.width(), rect.height()); -} - -bool QGLXGLWidgetSurface::filterEvent(QEvent *e) -{ - if (e->type() == QEvent::ParentAboutToChange) { - // We temporarily hide the window and re-parent it with the root window - // as it's quite likely that the parent window is about to be deleted, - // which would otherwise destroy our window along with it. - XUnmapWindow(m_xd->display, m_winId); - XReparentWindow(m_xd->display, m_winId, m_xd->rootWindow(), 0, 0); -#ifdef MYX11_DEBUG - qDebug() << "filterEvent unmap" << hex << m_winId; -#endif - } - - if (e->type() == QEvent::ParentChange) { - // Once we've got a new parent, we need to reparent the window and show it again: - XReparentWindow(m_xd->display, m_winId, m_widget->window()->winId(), m_widget->x(), m_widget->y()); - XMapWindow(m_xd->display, m_winId); -#ifdef MYX11_DEBUG - qDebug() << "filterEvent reparent" << hex << m_winId << "to:" << m_widget->window()->winId(); -#endif - } - - return false; // Allow the event to pass through to QGLWidget -} - - -QGLXGLContext::QGLXGLContext(MyDisplay *xd) - : QPlatformGLContext() - , m_xd(xd) - , m_drawable(0) - , m_config(0) - , m_context(0) -{ } QGLXGLContext::~QGLXGLContext() @@ -238,63 +156,6 @@ QGLXGLContext::~QGLXGLContext() } } -bool QGLXGLContext::create(QPaintDevice* device, QGLFormat& format, QPlatformGLContext* shareContext) -{ - Q_UNUSED(format); - - if (device->devType() != QInternal::Widget) { - qWarning("Creating a GL context is only supported on QWidgets"); - return false; - } - - GLXContext shareGlxContext = 0; - if (shareContext) - shareGlxContext = static_cast(shareContext)->glxContext(); - - - QWidget* widget = static_cast(device); - QGLWidget* glWidget = qobject_cast(widget); - if (glWidget) { - // Take the config from the QGLWidget's glx surface: - QGLXGLWidgetSurface* surface = static_cast(glWidget->platformSurface()); - m_config = surface->config(); - m_drawable = (Drawable)surface->winId(); -#ifdef MYX11_DEBUG - qDebug() << "QGLXGLContext::create" << hex << m_config << m_drawable; -#endif - } - else { - if (!widget->isTopLevel()) { - qWarning("Creating a GL context is only supported on top-level QWidgets"); - return false; - } - m_drawable = (Drawable)widget->platformWindow()->winId(); - - // ### This might choose a config with a visual that isn't compatable with the native window: - m_config = qt_glx_integration_choose_config(m_xd, format, GLX_WINDOW_BIT); - } - - m_context = glXCreateNewContext(m_xd->display, m_config, GLX_RGBA_TYPE, shareGlxContext, True); -#ifdef MYX11_DEBUG - qDebug() << "QGLXGLContext::create context" << m_context; -#endif - - // Get the XVisualInfo for the window: -// XWindowAttributes windowAttribs; -// XGetWindowAttributes(m_display, m_widget->winId(), &windowAttribs); -// XVisualInfo visualInfoTemplate; -// visualInfoTemplate.visualid = 33; //XVisualIDFromVisual(windowAttribs.visual); -// XVisualInfo *visualInfo; -// int matchingCount = 0; -// visualInfo = XGetVisualInfo(m_xd->display, VisualIDMask, &visualInfoTemplate, &matchingCount); - -// m_context = glXCreateContext(m_xd->display, visualInfo, 0, True); - -// qDebug("Created GLX context 0x%x for visual ID %d", m_context, visualInfoTemplate.visualid); - - return true; -} - void QGLXGLContext::makeCurrent() { #ifdef MYX11_DEBUG diff --git a/src/plugins/platforms/testlite/qglxintegration.h b/src/plugins/platforms/testlite/qglxintegration.h index 0302950..6d9a216 100644 --- a/src/plugins/platforms/testlite/qglxintegration.h +++ b/src/plugins/platforms/testlite/qglxintegration.h @@ -42,40 +42,19 @@ #ifndef Q_GLX_CONTEXT_H #define Q_GLX_CONTEXT_H -#include +#include #include QT_BEGIN_NAMESPACE class MyDisplay; -class QGLXGLWidgetSurface : public QPlatformGLWidgetSurface -{ -public: - QGLXGLWidgetSurface(MyDisplay* xd); - virtual ~QGLXGLWidgetSurface(); - - virtual bool create(QGLWidget*, QGLFormat&); - virtual void setGeometry(const QRect&); - virtual bool filterEvent(QEvent*); - - GLXFBConfig config() {return m_config;} - Window winId() {return m_winId;} - -private: - MyDisplay *m_xd; - GLXFBConfig m_config; - Window m_winId; - QGLWidget* m_widget; -}; - class QGLXGLContext : public QPlatformGLContext { public: - QGLXGLContext(MyDisplay* xd); + QGLXGLContext(WId winId, MyDisplay *xd, QGLFormat& format, QPlatformGLContext* shareContext); ~QGLXGLContext(); - virtual bool create(QPaintDevice* device, QGLFormat& format, QPlatformGLContext* shareContext); virtual void makeCurrent(); virtual void doneCurrent(); virtual void swapBuffers(); diff --git a/src/plugins/platforms/testlite/qtestliteintegration.cpp b/src/plugins/platforms/testlite/qtestliteintegration.cpp index 3fa3495..3ce9b7c 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.cpp +++ b/src/plugins/platforms/testlite/qtestliteintegration.cpp @@ -109,19 +109,15 @@ QTestLiteIntegration::QTestLiteIntegration(bool useOpenGL) QPixmapData *QTestLiteIntegration::createPixmapData(QPixmapData::PixelType type) const { -#ifndef QT_NO_OPENGL if (mUseOpenGL) return new QGLPixmapData(type); -#endif return new QRasterPixmapData(type); } QWindowSurface *QTestLiteIntegration::createWindowSurface(QWidget *widget, WId) const { -#ifndef QT_NO_OPENGL if (mUseOpenGL) return new QGLWindowSurface(widget); -#endif return new QTestLiteWindowSurface(mPrimaryScreen, widget); } @@ -140,23 +136,9 @@ QPixmap QTestLiteIntegration::grabWindow(WId window, int x, int y, int width, in return QPixmap::fromImage(img); } -#ifndef QT_NO_OPENGL bool QTestLiteIntegration::hasOpenGL() const { return glXQueryExtension(xd->display, 0, 0) != 0; } -QPlatformGLContext *QTestLiteIntegration::createGLContext() -{ - return new QGLXGLContext(xd); -} - -QPlatformGLWidgetSurface *QTestLiteIntegration::createGLWidgetSurface() -{ - return new QGLXGLWidgetSurface(xd); -} - -#endif // QT_NO_OPENGL - - QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestliteintegration.h b/src/plugins/platforms/testlite/qtestliteintegration.h index 8289a5c..01d428c 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.h +++ b/src/plugins/platforms/testlite/qtestliteintegration.h @@ -81,18 +81,12 @@ public: QList screens() const { return mScreens; } -#ifndef QT_NO_OPENGL bool hasOpenGL() const; - QPlatformGLContext * createGLContext(); - QPlatformGLWidgetSurface * createGLWidgetSurface(); -#endif MyDisplay *xd; private: -#ifndef QT_NO_OPENGL bool mUseOpenGL; -#endif QTestLiteScreen *mPrimaryScreen; QList mScreens; }; diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index b5ae4fc..4ddb7ca 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -55,6 +55,9 @@ #include #include +#include +#include "qglxintegration.h" + #include #include @@ -146,7 +149,7 @@ private: QTestLiteWindow::QTestLiteWindow(const QTestLiteIntegration *platformIntegration, QTestLiteScreen */*screen*/, QWidget *window) - :QPlatformWindow(window) + :QPlatformWindow(window), mGLContext(0) { xd = platformIntegration->xd; xd->windowList.append(this); @@ -191,6 +194,7 @@ QTestLiteWindow::QTestLiteWindow(const QTestLiteIntegration *platformIntegration setWindowFlags(window->windowFlags()); //##### This should not be the plugin's responsibility + //xw->windowTL = this; } @@ -661,8 +665,6 @@ void QTestLiteWindow::setWindowTitle(const QString &title) XSetWMName(xd->display, x_window, &windowName); } - - GC QTestLiteWindow::createGC() { GC gc; @@ -674,14 +676,14 @@ GC QTestLiteWindow::createGC() return gc; } - void QTestLiteWindow::paintEvent() { #ifdef MYX11_DEBUG // qDebug() << "QTestLiteWindow::paintEvent" << shm_img.size() << painted; #endif - widget()->windowSurface()->flush(widget(), QRect(xpos,ypos,width, height), QPoint()); + if (QWindowSurface *surface = widget()->windowSurface()) + surface->flush(widget(), QRect(xpos,ypos,width, height), QPoint()); } @@ -1005,6 +1007,21 @@ void QTestLiteWindow::setCursor(QCursor * cursor) XFlush(xd->display); } +QPlatformGLContext *QTestLiteWindow::glContext() +{ + if (!mGLContext) { + mGLContext = createGLContext(); + } + return mGLContext; +} + +QPlatformGLContext *QTestLiteWindow::createGLContext() +{ + QGLFormat format; + QPlatformGLContext *context = new QGLXGLContext(x_window, xd, format, 0); + return context; +} + Cursor QTestLiteWindow::createCursorBitmap(QCursor * cursor) { XColor bg, fg; diff --git a/src/plugins/platforms/testlite/qtestlitewindow.h b/src/plugins/platforms/testlite/qtestlitewindow.h index 28e49be..5d27f3a 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.h +++ b/src/plugins/platforms/testlite/qtestlitewindow.h @@ -126,6 +126,8 @@ public: void setCursor(QCursor * cursor); + QPlatformGLContext *glContext(); + private: int xpos, ypos; int width, height; @@ -135,6 +137,7 @@ private: GC createGC(); Cursor createCursorShape(int cshape); Cursor createCursorBitmap(QCursor * cursor); + QPlatformGLContext *createGLContext(); int currentCursor; @@ -142,6 +145,7 @@ private: QTestLiteScreen *mScreen; Qt::WindowFlags window_flags; + QPlatformGLContext *mGLContext; friend class QTestLiteWindowSurface; // x_window, gc and windowSurface }; -- cgit v0.12 From 0fdbda6da734969a8ea4e28a327071865b58fb5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 11 Jun 2010 13:23:01 +0200 Subject: Add support for native children in QtGui again no pluginsupport though --- src/gui/kernel/qwidget.cpp | 6 ------ src/gui/painting/qbackingstore.cpp | 6 +----- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 611bd50..5078ba4 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -2429,10 +2429,7 @@ WId QWidget::effectiveWinId() const return id; QWidget *realParent = nativeParentWidget(); Q_ASSERT(realParent); -#ifndef Q_WS_LITE - //### we really need to implement winId functionality Q_ASSERT(realParent->internalWinId()); -#endif return realParent->internalWinId(); } @@ -4121,9 +4118,6 @@ QWidget *QWidget::window() const */ QWidget *QWidget::nativeParentWidget() const { -#ifdef Q_WS_LITE - return window(); //### we don't have native child widgets yet -#endif QWidget *parent = parentWidget(); while (parent && !parent->internalWinId()) parent = parent->parentWidget(); diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index 7220ce6..b158a76 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -747,12 +747,8 @@ void QWidgetBackingStore::markDirtyOnScreen(const QRegion ®ion, QWidget *widg } // Alien widgets. - if (!widget->internalWinId() && !widget->isWindow()) { //### LITEHACK we need winid support!!! -#ifdef Q_WS_LITE - QWidget *nativeParent = widget->window(); //### LITEHACK so far only toplevels are native -#else + if (!widget->internalWinId() && !widget->isWindow()) { QWidget *nativeParent = widget->nativeParentWidget(); // Alien widgets with the top-level as the native parent (common case). -#endif if (nativeParent == tlw) { if (!widget->testAttribute(Qt::WA_WState_InPaintEvent)) dirtyOnScreen += region.translated(topLevelOffset); -- cgit v0.12 From e5d607b3635d53c84dbb782f534d8cac9096dd14 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Tue, 15 Jun 2010 11:07:04 +0200 Subject: fixed software cursor rendering when the widget under the cursor is redrawn also check if the cursor exists before checking if it is dirty when considering an early exit from QFbScreen::doRedraw() --- src/plugins/platforms/fb_base/fb_base.cpp | 4 ++-- src/plugins/platforms/fb_base/fb_base.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/fb_base/fb_base.cpp b/src/plugins/platforms/fb_base/fb_base.cpp index 0463a60..5004a5a 100644 --- a/src/plugins/platforms/fb_base/fb_base.cpp +++ b/src/plugins/platforms/fb_base/fb_base.cpp @@ -187,7 +187,7 @@ QRegion QFbScreen::doRedraw() QRect lastCursor = cursor->dirtyRect(); repaintRegion += lastCursor; } - if (repaintRegion.isEmpty() && !cursor->isDirty()) { + if (repaintRegion.isEmpty() && (!cursor || !cursor->isDirty())) { return touchedRegion; } @@ -239,7 +239,7 @@ QRegion QFbScreen::doRedraw() } QRect cursorRect; - if (cursor && cursor->isDirty()) { + if (cursor && (cursor->isDirty() || repaintRegion.intersects(cursor->lastPainted()))) { cursorRect = cursor->drawCursor(*compositePainter); touchedRegion += cursorRect; } diff --git a/src/plugins/platforms/fb_base/fb_base.h b/src/plugins/platforms/fb_base/fb_base.h index f1dd574..124dde0 100644 --- a/src/plugins/platforms/fb_base/fb_base.h +++ b/src/plugins/platforms/fb_base/fb_base.h @@ -32,6 +32,7 @@ public: virtual void setDirty() { dirty = true; screen->setDirty(QRect()); } virtual bool isDirty() { return dirty; } virtual bool isOnScreen() { return onScreen; } + virtual QRect lastPainted() { return prevRect; } protected: QGraphicsSystemCursorImage * graphic; -- cgit v0.12 From 47b8d9d08386e841580ddc920681b07b338cbdb6 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Tue, 15 Jun 2010 13:09:50 +0200 Subject: virtual desktop multiscreen support - VNC plugin --- src/gui/kernel/qapplication_lite.cpp | 6 ++ src/gui/kernel/qdesktopwidget_lite.cpp | 14 ++++- src/gui/kernel/qdesktopwidget_lite_p.h | 3 +- src/plugins/platforms/fb_base/fb_base.cpp | 79 +++++++++++++++++++-------- src/plugins/platforms/fb_base/fb_base.h | 7 +-- src/plugins/platforms/vnc/qvncintegration.cpp | 22 +++++++- src/plugins/platforms/vnc/qvncintegration.h | 2 + 7 files changed, 100 insertions(+), 33 deletions(-) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index dd25cd4..bd72663 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -400,6 +400,12 @@ QWidget *QApplication::topLevelAt(const QPoint &pos) QList::const_iterator screen = screens.constBegin(); QList::const_iterator end = screens.constEnd(); + // The first screen in a virtual environment should know about all top levels + if (pi->isVirtualDesktop()) { + QWidget *w = (*screen)->topLevelAt(pos); + return w; + } + while (screen != end) { if ((*screen)->geometry().contains(pos)) return (*screen)->topLevelAt(pos); diff --git a/src/gui/kernel/qdesktopwidget_lite.cpp b/src/gui/kernel/qdesktopwidget_lite.cpp index 3e37faf..52c1b17 100644 --- a/src/gui/kernel/qdesktopwidget_lite.cpp +++ b/src/gui/kernel/qdesktopwidget_lite.cpp @@ -71,9 +71,19 @@ void QDesktopWidgetPrivate::updateScreenList() } } + QRegion virtualGeometry; + bool doVirtualGeometry = QApplicationPrivate::platformIntegration()->isVirtualDesktop(); + // update the geometry of each screen widget for (int i = 0; i < screens.length(); i++) { - screens.at(i)->setGeometry(screenList.at(i)->geometry()); + QRect screenGeometry = screenList.at(i)->geometry(); + screens.at(i)->setGeometry(screenGeometry); + if (doVirtualGeometry) + virtualGeometry += screenGeometry; + } + + if (doVirtualGeometry) { + virtualScreen.setGeometry(virtualGeometry.boundingRect()); } } @@ -106,6 +116,8 @@ int QDesktopWidget::numScreens() const QWidget *QDesktopWidget::screen(int screen) { Q_D(QDesktopWidget); + if (QApplicationPrivate::platformIntegration()->isVirtualDesktop()) + return &d->virtualScreen; if (screen < 0 || screen >= d->screens.length()) return d->screens.at(0); return d->screens.at(screen); diff --git a/src/gui/kernel/qdesktopwidget_lite_p.h b/src/gui/kernel/qdesktopwidget_lite_p.h index c04e172..2f7ad52 100644 --- a/src/gui/kernel/qdesktopwidget_lite_p.h +++ b/src/gui/kernel/qdesktopwidget_lite_p.h @@ -59,7 +59,7 @@ class QDesktopScreenWidget : public QWidget { Q_OBJECT public: - QDesktopScreenWidget(int screenNumber) { setWindowFlags(Qt::Desktop); setVisible(false); d_func()->screenNumber = screenNumber; } + QDesktopScreenWidget(int screenNumber = -1) { setWindowFlags(Qt::Desktop); setVisible(false); d_func()->screenNumber = screenNumber; } }; class QDesktopWidgetPrivate : public QWidgetPrivate { @@ -69,6 +69,7 @@ public: void updateScreenList(); QList screens; + QDesktopScreenWidget virtualScreen; }; #endif // QDESKTOPWIDGET_LITE_P_H diff --git a/src/plugins/platforms/fb_base/fb_base.cpp b/src/plugins/platforms/fb_base/fb_base.cpp index 5004a5a..be4a530 100644 --- a/src/plugins/platforms/fb_base/fb_base.cpp +++ b/src/plugins/platforms/fb_base/fb_base.cpp @@ -162,8 +162,9 @@ void QFbScreen::generateRects() continue; if (!windowStack[i]->widget()->testAttribute(Qt::WA_TranslucentBackground)) { - remainingScreen -= windowStack[i]->localGeometry(); - QRegion windowRegion(windowStack[i]->localGeometry()); + QRect localGeometry = windowStack.at(i)->geometry().translated(-screenOffset); // global to local translation + remainingScreen -= localGeometry; + QRegion windowRegion(localGeometry); windowRegion -= remainingScreen; foreach(QRect rect, windowRegion.rects()) { cachedRects += QPair(rect, i); @@ -180,7 +181,7 @@ void QFbScreen::generateRects() QRegion QFbScreen::doRedraw() { - QPoint screenOffset = mGeometry.topLeft(); // optimize me! + QPoint screenOffset = mGeometry.topLeft(); QRegion touchedRegion; if (cursor && cursor->isDirty() && cursor->isOnScreen()) { @@ -257,9 +258,7 @@ QRegion QFbScreen::doRedraw() void QFbScreen::addWindow(QFbWindow *surface) { windowStack.prepend(surface); - surface->mScreen = this; - QPoint screenOffset = mGeometry.topLeft(); - surface->localGeometry() = surface->geometry().translated(-screenOffset); // global to local translation + surface->mScreens.append(this); invalidateRectCache(); setDirty(surface->geometry()); } @@ -267,13 +266,19 @@ void QFbScreen::addWindow(QFbWindow *surface) void QFbScreen::removeWindow(QFbWindow * surface) { windowStack.removeOne(surface); + surface->mScreens.removeOne(this); invalidateRectCache(); setDirty(surface->geometry()); } void QFbWindow::raise() { - mScreen->raise(this); + QList::const_iterator i = mScreens.constBegin(); + QList::const_iterator end = mScreens.constEnd(); + while (i != end) { + (*i)->raise(this); + ++i; + } } void QFbScreen::raise(QPlatformWindow * surface) @@ -289,7 +294,12 @@ void QFbScreen::raise(QPlatformWindow * surface) void QFbWindow::lower() { - mScreen->lower(this); + QList::const_iterator i = mScreens.constBegin(); + QList::const_iterator end = mScreens.constEnd(); + while (i != end) { + (*i)->lower(this); + ++i; + } } void QFbScreen::lower(QPlatformWindow * surface) @@ -315,9 +325,8 @@ QWidget * QFbScreen::topLevelAt(const QPoint & p) const return 0; } -QFbWindow::QFbWindow(QFbScreen *screen, QWidget *window) +QFbWindow::QFbWindow(QWidget *window) :QPlatformWindow(window), - mScreen(screen), visibleFlag(false) { static QAtomicInt winIdGenerator(1); @@ -327,7 +336,12 @@ QFbWindow::QFbWindow(QFbScreen *screen, QWidget *window) QFbWindow::~QFbWindow() { - mScreen->removeWindow(this); + QList::const_iterator i = mScreens.constBegin(); + QList::const_iterator end = mScreens.constEnd(); + while (i != end) { + (*i)->removeWindow(this); + ++i; + } } @@ -361,18 +375,23 @@ void QFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoin void QFbWindow::repaint(const QRegion ®ion) { QRect currentGeometry = geometry(); - // If this is a move, redraw the previous location - if (oldGeometry != currentGeometry) { - mScreen->setDirty(oldGeometry); - oldGeometry = currentGeometry; - } QRect dirtyClient = region.boundingRect(); QRect dirtyRegion(currentGeometry.left() + dirtyClient.left(), currentGeometry.top() + dirtyClient.top(), dirtyClient.width(), dirtyClient.height()); - mScreen->setDirty(dirtyRegion); + QList::const_iterator i = mScreens.constBegin(); + QList::const_iterator end = mScreens.constEnd(); + while (i != end) { + // If this is a move, redraw the previous location + if (oldGeometry != currentGeometry) { + (*i)->setDirty(oldGeometry); + oldGeometry = currentGeometry; + } + (*i)->setDirty(dirtyRegion); + ++i; + } } void QFbWindowSurface::resize(const QSize &size) @@ -389,13 +408,15 @@ void QFbWindow::setGeometry(const QRect &rect) oldGeometry = geometry(); - mScreen->invalidateRectCache(); + QList::const_iterator i = mScreens.constBegin(); + QList::const_iterator end = mScreens.constEnd(); + while (i != end) { + (*i)->invalidateRectCache(); + ++i; + } //### QWindowSystemInterface::handleGeometryChange(window(), rect); QPlatformWindow::setGeometry(rect); - - QPoint screenOffset = mScreen->geometry().topLeft(); - mLocalGeometry = rect.translated(-screenOffset); // global to local translation } bool QFbWindowSurface::scroll(const QRegion &area, int dx, int dy) @@ -416,14 +437,24 @@ void QFbWindowSurface::endPaint(const QRegion ®ion) void QFbWindow::setVisible(bool visible) { visibleFlag = visible; - mScreen->invalidateRectCache(); - mScreen->setDirty(geometry()); + QList::const_iterator i = mScreens.constBegin(); + QList::const_iterator end = mScreens.constEnd(); + while (i != end) { + (*i)->invalidateRectCache(); + (*i)->setDirty(geometry()); + ++i; + } } Qt::WindowFlags QFbWindow::setWindowFlags(Qt::WindowFlags type) { flags = type; - mScreen->invalidateRectCache(); + QList::const_iterator i = mScreens.constBegin(); + QList::const_iterator end = mScreens.constEnd(); + while (i != end) { + (*i)->invalidateRectCache(); + ++i; + } return flags; } diff --git a/src/plugins/platforms/fb_base/fb_base.h b/src/plugins/platforms/fb_base/fb_base.h index 124dde0..3b5075d 100644 --- a/src/plugins/platforms/fb_base/fb_base.h +++ b/src/plugins/platforms/fb_base/fb_base.h @@ -80,7 +80,7 @@ class QFbWindow : public QPlatformWindow { public: - QFbWindow(QFbScreen *screen, QWidget *window); + QFbWindow(QWidget *window); ~QFbWindow(); @@ -99,17 +99,14 @@ public: virtual void repaint(const QRegion&); - virtual QRect localGeometry() { return mLocalGeometry; } - protected: friend class QFbWindowSurface; friend class QFbScreen; QFbWindowSurface *surface; - QFbScreen *mScreen; + QList mScreens; QRect oldGeometry; bool visibleFlag; Qt::WindowFlags flags; - QRect mLocalGeometry; // local screen coordinates WId windowId; }; diff --git a/src/plugins/platforms/vnc/qvncintegration.cpp b/src/plugins/platforms/vnc/qvncintegration.cpp index de6d81f..2ae34dc 100644 --- a/src/plugins/platforms/vnc/qvncintegration.cpp +++ b/src/plugins/platforms/vnc/qvncintegration.cpp @@ -95,6 +95,7 @@ static void usage() } QVNCIntegration::QVNCIntegration(const QStringList& paramList) + : virtualDesktop(false) { int sizeX = defaultWidth(); int sizeY = defaultHeight(); @@ -125,6 +126,9 @@ QVNCIntegration::QVNCIntegration(const QStringList& paramList) screen->setDirty(screenRect); ++display; } + else if (confString == QLatin1String("virtual")) { + virtualDesktop = true; + } else { qWarning() << "Unknown VNC option:" << confString; showUsage = true; @@ -167,13 +171,27 @@ QWindowSurface *QVNCIntegration::createWindowSurface(QWidget *widget, WId) const QPlatformWindow *QVNCIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const { - QFbWindow *w = new QFbWindow(mPrimaryScreen, widget); - mPrimaryScreen->addWindow(w); + QFbWindow *w = new QFbWindow(widget); + if (virtualDesktop) { + QList::const_iterator i = mScreens.constBegin(); + QList::const_iterator end = mScreens.constEnd(); + QFbScreen *screen; + while (i != end) { + screen = static_cast(*i); + screen->addWindow(w); + ++i; + } + } + else + mPrimaryScreen->addWindow(w); return w; } void QVNCIntegration::moveToScreen(QWidget *window, int screen) { + if (virtualDesktop) { // all windows exist on all screens in virtual desktop mode + return; + } if (screen < 0 || screen > mScreens.size()) return; QVNCScreen * newScreen = qobject_cast(mScreens.at(screen)); diff --git a/src/plugins/platforms/vnc/qvncintegration.h b/src/plugins/platforms/vnc/qvncintegration.h index 3436e51..d49e051 100644 --- a/src/plugins/platforms/vnc/qvncintegration.h +++ b/src/plugins/platforms/vnc/qvncintegration.h @@ -86,11 +86,13 @@ public: QList screens() const { return mScreens; } + bool isVirtualDesktop() { return virtualDesktop; } void moveToScreen(QWidget *window, int screen); private: QVNCScreen *mPrimaryScreen; QList mScreens; + bool virtualDesktop; }; -- cgit v0.12 From 853c01fe35431f78f2d3191b1592cc616c03ee09 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Tue, 15 Jun 2010 13:20:33 +0200 Subject: LinuxFB compilation fix --- src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp index 391e105..f79f956 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp @@ -794,7 +794,7 @@ QWindowSurface *QLinuxFbIntegration::createWindowSurface(QWidget *widget, WId) c QPlatformWindow *QLinuxFbIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const { - QFbWindow *w = new QFbWindow(mPrimaryScreen, widget); + QFbWindow *w = new QFbWindow(widget); mPrimaryScreen->addWindow(w); return w; } -- cgit v0.12 From 598455952bee3931934820db1dfe9e9ce4dc0388 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Tue, 15 Jun 2010 13:49:41 +0200 Subject: fix repaint of resized widgets that span multiple screens --- src/plugins/platforms/fb_base/fb_base.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/fb_base/fb_base.cpp b/src/plugins/platforms/fb_base/fb_base.cpp index be4a530..d63bfce 100644 --- a/src/plugins/platforms/fb_base/fb_base.cpp +++ b/src/plugins/platforms/fb_base/fb_base.cpp @@ -383,11 +383,13 @@ void QFbWindow::repaint(const QRegion ®ion) dirtyClient.height()); QList::const_iterator i = mScreens.constBegin(); QList::const_iterator end = mScreens.constEnd(); + QRect oldGeometryLocal = oldGeometry; + oldGeometry = currentGeometry; while (i != end) { // If this is a move, redraw the previous location - if (oldGeometry != currentGeometry) { - (*i)->setDirty(oldGeometry); - oldGeometry = currentGeometry; + if (oldGeometryLocal != currentGeometry) { + qDebug() << "repaint old area on screen" << (*i)->objectName(); + (*i)->setDirty(oldGeometryLocal); } (*i)->setDirty(dirtyRegion); ++i; -- cgit v0.12 From 7722d8c5f9871dfd09a298b4be243af6808407f1 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Tue, 15 Jun 2010 15:00:42 +0200 Subject: fix minimizing VNC and LinuxFB top levels --- src/plugins/platforms/fb_base/fb_base.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/fb_base/fb_base.cpp b/src/plugins/platforms/fb_base/fb_base.cpp index d63bfce..3b69550 100644 --- a/src/plugins/platforms/fb_base/fb_base.cpp +++ b/src/plugins/platforms/fb_base/fb_base.cpp @@ -160,6 +160,8 @@ void QFbScreen::generateRects() break; if (!windowStack[i]->visible()) continue; + if (windowStack[i]->widget()->isMinimized()) + continue; if (!windowStack[i]->widget()->testAttribute(Qt::WA_TranslucentBackground)) { QRect localGeometry = windowStack.at(i)->geometry().translated(-screenOffset); // global to local translation -- cgit v0.12 From 5343c882496586a73b7e0071178866b14b1dde8f Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 16 Jun 2010 12:47:23 +0200 Subject: Set the desktop widget geometry to reflect the size of the screen(s) Also removed a stray debug message --- src/gui/kernel/qdesktopwidget_lite.cpp | 6 +++--- src/plugins/platforms/fb_base/fb_base.cpp | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qdesktopwidget_lite.cpp b/src/gui/kernel/qdesktopwidget_lite.cpp index 52c1b17..553173b 100644 --- a/src/gui/kernel/qdesktopwidget_lite.cpp +++ b/src/gui/kernel/qdesktopwidget_lite.cpp @@ -82,15 +82,15 @@ void QDesktopWidgetPrivate::updateScreenList() virtualGeometry += screenGeometry; } - if (doVirtualGeometry) { - virtualScreen.setGeometry(virtualGeometry.boundingRect()); - } + virtualScreen.setGeometry(virtualGeometry.boundingRect()); } QDesktopWidget::QDesktopWidget() : QWidget(*new QDesktopWidgetPrivate, 0, Qt::Desktop) { + Q_D(QDesktopWidget); setObjectName(QLatin1String("desktop")); + this->setGeometry(d->virtualScreen.geometry()); } QDesktopWidget::~QDesktopWidget() diff --git a/src/plugins/platforms/fb_base/fb_base.cpp b/src/plugins/platforms/fb_base/fb_base.cpp index 3b69550..213a710 100644 --- a/src/plugins/platforms/fb_base/fb_base.cpp +++ b/src/plugins/platforms/fb_base/fb_base.cpp @@ -390,7 +390,6 @@ void QFbWindow::repaint(const QRegion ®ion) while (i != end) { // If this is a move, redraw the previous location if (oldGeometryLocal != currentGeometry) { - qDebug() << "repaint old area on screen" << (*i)->objectName(); (*i)->setDirty(oldGeometryLocal); } (*i)->setDirty(dirtyRegion); -- cgit v0.12 From fef040c3b697f5a14b06c63858a5832e1e833abb Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 16 Jun 2010 14:45:40 +0200 Subject: Disable Qt3Support for Lighthouse MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This turns it off hard, ignoring configure options to the contrary. Reviewed-by: Jørgen --- configure | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configure b/configure index da34fb5..9db16e3 100755 --- a/configure +++ b/configure @@ -2322,6 +2322,11 @@ if [ "$CFG_GUI" = "no" ]; then CFG_QT3SUPPORT="no" fi +#disable Qt3Support for Lighthouse +if [ "$PLATFORM_EMBLITE" = "yes" ]; then + CFG_QT3SUPPORT="no" +fi + # update QT_CONFIG to show our current predefined configuration case "$CFG_QCONFIG" in minimal|small|medium|large|full) -- cgit v0.12 From c12c0186a0ecdf43f8d0dcfc1d8bea704a4fe32b Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 16 Jun 2010 15:34:25 +0200 Subject: update QDesktopWidget geometry when screens are added, removed, or resized --- src/gui/kernel/qdesktopwidget_lite.cpp | 4 +++- src/gui/kernel/qdesktopwidget_lite_p.h | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qdesktopwidget_lite.cpp b/src/gui/kernel/qdesktopwidget_lite.cpp index 553173b..6ba5dd9 100644 --- a/src/gui/kernel/qdesktopwidget_lite.cpp +++ b/src/gui/kernel/qdesktopwidget_lite.cpp @@ -83,6 +83,8 @@ void QDesktopWidgetPrivate::updateScreenList() } virtualScreen.setGeometry(virtualGeometry.boundingRect()); + Q_Q(QDesktopWidget); + q->setGeometry(virtualScreen.geometry()); } QDesktopWidget::QDesktopWidget() @@ -90,7 +92,7 @@ QDesktopWidget::QDesktopWidget() { Q_D(QDesktopWidget); setObjectName(QLatin1String("desktop")); - this->setGeometry(d->virtualScreen.geometry()); + d->updateScreenList(); } QDesktopWidget::~QDesktopWidget() diff --git a/src/gui/kernel/qdesktopwidget_lite_p.h b/src/gui/kernel/qdesktopwidget_lite_p.h index 2f7ad52..33e4c98 100644 --- a/src/gui/kernel/qdesktopwidget_lite_p.h +++ b/src/gui/kernel/qdesktopwidget_lite_p.h @@ -63,8 +63,9 @@ public: }; class QDesktopWidgetPrivate : public QWidgetPrivate { + Q_DECLARE_PUBLIC(QDesktopWidget) + public: - QDesktopWidgetPrivate() { updateScreenList(); } ~QDesktopWidgetPrivate() {foreach(QDesktopScreenWidget *s, screens) delete s; } void updateScreenList(); -- cgit v0.12 From c28069a0c4d54d1c8a63bb17bb30ef45e7cf47a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 17 Jun 2010 10:23:57 +0200 Subject: Adding support for setParent api in plugins This is work in progress, but boxes and wolfenqt works in testlite:) --- src/gui/kernel/qplatformwindow_lite.cpp | 2 + src/gui/kernel/qplatformwindow_lite.h | 1 + src/gui/kernel/qwidget_lite.cpp | 45 ++++++++++++++++------ src/plugins/platforms/testlite/qtestlitewindow.cpp | 22 ++++++++--- src/plugins/platforms/testlite/qtestlitewindow.h | 1 + 5 files changed, 54 insertions(+), 17 deletions(-) diff --git a/src/gui/kernel/qplatformwindow_lite.cpp b/src/gui/kernel/qplatformwindow_lite.cpp index 151e93d..9efbf8b 100644 --- a/src/gui/kernel/qplatformwindow_lite.cpp +++ b/src/gui/kernel/qplatformwindow_lite.cpp @@ -65,6 +65,8 @@ Qt::WindowFlags QPlatformWindow::windowFlags() const WId QPlatformWindow::winId() const { return WId(0); } +void QPlatformWindow::setParent(const QPlatformWindow *) { qWarning("This plugin does not support setParent!"); } + void QPlatformWindow::setWindowTitle(const QString &) {} void QPlatformWindow::raise() { qWarning("This plugin does not support raise()"); } diff --git a/src/gui/kernel/qplatformwindow_lite.h b/src/gui/kernel/qplatformwindow_lite.h index 0a94fc0..5f8d259 100644 --- a/src/gui/kernel/qplatformwindow_lite.h +++ b/src/gui/kernel/qplatformwindow_lite.h @@ -71,6 +71,7 @@ public: virtual Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); virtual Qt::WindowFlags windowFlags() const; virtual WId winId() const; + virtual void setParent(const QPlatformWindow *window); virtual void setWindowTitle(const QString &); virtual void raise(); diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index e1a8d0d..445e166 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -85,6 +85,17 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO setWinId(q->platformWindow()->winId()); + QObjectList children = q->children(); + for (int i = 0; i < children.size(); i++) { + if (children.at(i)->isWidgetType()) { + const QWidget *childWidget = qobject_cast(children.at(i)); + QPlatformWindow *childWindow = childWidget->platformWindow(); + if (childWindow) { + childWindow->setParent(platformWindow); + } + } + } + QApplicationPrivate::platformIntegration()->moveToScreen(q, screenNumber); // qDebug() << "create_sys" << q << q->internalWinId(); } @@ -92,6 +103,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO void QWidget::destroy(bool destroyWindow, bool destroySubWindows) { Q_D(QWidget); + //### jl: subwindows now enabled Q_UNUSED(destroySubWindows); if ((windowType() == Qt::Popup)) @@ -137,6 +149,13 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) if (parent != newparent) { QObjectPrivate::setParent_helper(newparent); //### why does this have to be done in the _sys function??? + if (q->platformWindow()) { + QWidget * parentWithWindow = newparent->platformWindow()? newparent : newparent->nativeParentWidget(); + if (parentWithWindow && parentWithWindow->platformWindow()) { + q->platformWindow()->setParent(parentWithWindow->platformWindow()); + } + } + } if (!newparent) { @@ -167,6 +186,7 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) qDebug() << "######## setParent_sys() change from toplevel not implemented ########"; } + if (q->isWindow() || (!newparent || newparent->isVisible()) || explicitlyHidden) q->setAttribute(Qt::WA_WState_Hidden); q->setAttribute(Qt::WA_WState_ExplicitShowHide, explicitlyHidden); @@ -340,25 +360,26 @@ void QWidgetPrivate::show_sys() QApplication::postEvent(q, new QUpdateLaterEvent(q->rect())); - if (!q->isWindow()) - return; - - if (QPlatformWindow *window = q->platformWindow()) { + QPlatformWindow *window = q->platformWindow(); + if (window) { const QRect geomRect = q->geometry(); const QRect windowRect = window->geometry(); if (windowRect != geomRect) { - q->platformWindow()->setGeometry(geomRect); + window->setGeometry(geomRect); + } + if (q->isWindow()) { if (QWindowSurface *surface = q->windowSurface()) if (windowRect.size() != geomRect.size()) { surface->resize(geomRect.size()); } - } - q->platformWindow()->setVisible(true); - } + if (window) + window->setVisible(true); - if (q->windowType() != Qt::Popup && q->windowType() != Qt::ToolTip && !(q->windowFlags() & Qt::X11BypassWindowManagerHint)) - q->activateWindow(); //### + if (q->windowType() != Qt::Popup && q->windowType() != Qt::ToolTip && !(q->windowFlags() & Qt::X11BypassWindowManagerHint)) + q->activateWindow(); //### + } + } } @@ -540,10 +561,10 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) if (q->isVisible()) { - if (q->isWindow()) { + if (q->platformWindow()) { + q->platformWindow()->setGeometry(q->frameGeometry()); const QWidgetBackingStore *bs = maybeBackingStore(); if (bs->windowSurface) { - q->platformWindow()->setGeometry(q->frameGeometry()); if (isResize) bs->windowSurface->resize(r.size()); } diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index 4ddb7ca..2737db0 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -623,11 +623,6 @@ void QTestLiteWindow::handleKeyEvent(QEvent::Type type, void *ev) void QTestLiteWindow::setGeometry(const QRect &rect) { - QRect oldRect = geometry(); - if (rect == oldRect) - return; - - //if unchanged ### XMoveResizeWindow(xd->display, x_window, rect.x(), rect.y(), rect.width(), rect.height()); QPlatformWindow::setGeometry(rect); } @@ -643,6 +638,23 @@ WId QTestLiteWindow::winId() const return x_window; } +void QTestLiteWindow::setParent(const QPlatformWindow *window) +{ + /******** Cleaning up **********/ + Window parentXWindow, rootXWindow; + Window *children; + unsigned int nChildren; + if (XQueryTree(xd->display, x_window, &rootXWindow, &parentXWindow, &children, &nChildren)) { + if (parentXWindow) { + XUnmapWindow(xd->display, x_window); + XReparentWindow(xd->display, x_window, rootXWindow, 0, 0); + } + } + /******* Done cleaning up ********/ + XReparentWindow(xd->display,x_window,window->winId(),geometry().x(),geometry().y()); + XMapWindow(xd->display, x_window); +} + void QTestLiteWindow::raise() { XRaiseWindow(xd->display, x_window); diff --git a/src/plugins/platforms/testlite/qtestlitewindow.h b/src/plugins/platforms/testlite/qtestlitewindow.h index 5d27f3a..d405578 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.h +++ b/src/plugins/platforms/testlite/qtestlitewindow.h @@ -120,6 +120,7 @@ public: Qt::WindowFlags windowFlags() const; void setVisible(bool visible); WId winId() const; + void setParent(const QPlatformWindow *window); void raise(); void lower(); void setWindowTitle(const QString &title); -- cgit v0.12 From 793d1ed8d3a03eefdd487facdacf66ba575e1a07 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 17 Jun 2010 14:16:06 +0200 Subject: Tslib mouse input for Lighthouse --- src/plugins/generic/tslib/main.cpp | 78 +++++++++++++++++++ src/plugins/generic/tslib/qtslib.cpp | 144 +++++++++++++++++++++++++++++++++++ src/plugins/generic/tslib/qtslib.h | 77 +++++++++++++++++++ src/plugins/generic/tslib/tslib.pro | 13 ++++ 4 files changed, 312 insertions(+) create mode 100644 src/plugins/generic/tslib/main.cpp create mode 100644 src/plugins/generic/tslib/qtslib.cpp create mode 100644 src/plugins/generic/tslib/qtslib.h create mode 100644 src/plugins/generic/tslib/tslib.pro diff --git a/src/plugins/generic/tslib/main.cpp b/src/plugins/generic/tslib/main.cpp new file mode 100644 index 0000000..4e8e50a --- /dev/null +++ b/src/plugins/generic/tslib/main.cpp @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qtslib.h" + +QT_BEGIN_NAMESPACE + +class QTsLibPlugin : public QGenericPlugin +{ +public: + QTsLibPlugin(); + + QStringList keys() const; + QObject* create(const QString &key, const QString &specification); +}; + +QTsLibPlugin::QTsLibPlugin() + : QGenericPlugin() +{ +} + +QStringList QTsLibPlugin::keys() const +{ + return (QStringList() + << QLatin1String("Tslib") + << QLatin1String("TslibRaw")); +} + +QObject* QTsLibPlugin::create(const QString &key, + const QString &specification) +{ + if (!key.compare(QLatin1String("Tslib"), Qt::CaseInsensitive) || !key.compare(QLatin1String("TslibRaw"), Qt::CaseInsensitive)) + return new QTsLibMouseHandler(key, specification); + return 0; + } + +Q_EXPORT_PLUGIN2(qtslibplugin, QTsLibPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/generic/tslib/qtslib.cpp b/src/plugins/generic/tslib/qtslib.cpp new file mode 100644 index 0000000..12963a0 --- /dev/null +++ b/src/plugins/generic/tslib/qtslib.cpp @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include "qtslib.h" + + +#include +#include +#include +#include + +#include + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +QTsLibMouseHandler::QTsLibMouseHandler(const QString &key, + const QString &specification) + : m_notify(0), m_x(0), m_y(0), m_pressed(0), m_rawMode(false) +{ + qDebug() << "QTsLibMouseHandler" << key << specification; + setObjectName(QLatin1String("TSLib Mouse Handler")); + + QByteArray device = "/dev/input/event1"; + if (specification.startsWith("/dev/")) + device = specification.toLocal8Bit(); + + m_dev = ts_open(device.constData(), 1); + + if (ts_config(m_dev)) { + perror("Error configuring\n"); + } + + + m_rawMode = !key.compare(QLatin1String("TslibRaw"), Qt::CaseInsensitive); + + int fd = ts_fd(m_dev); + if (fd >= 0) { + m_notify = new QSocketNotifier(fd, QSocketNotifier::Read, this); + connect(m_notify, SIGNAL(activated(int)), this, SLOT(readMouseData())); + } else { + qWarning("Cannot open mouse input device '%s': %s", device.constData(), strerror(errno)); + return; + } +} + + +QTsLibMouseHandler::~QTsLibMouseHandler() +{ + if (m_dev) + ts_close(m_dev); +} + + +static bool get_sample(struct tsdev *dev, struct ts_sample *sample, bool rawMode) +{ + if (rawMode) { + return (ts_read_raw(dev, sample, 1) == 1); + } else { + int ret = ts_read(dev, sample, 1); + return ( ret == 1); + } +} + + +void QTsLibMouseHandler::readMouseData() +{ + ts_sample sample; + while (get_sample(m_dev, &sample, m_rawMode)) { + + bool pressed = sample.pressure; + int x = sample.x; + int y = sample.y; + + + if (!m_rawMode) { + //filtering: ignore movements of 2 pixels or less + int dx = x - m_x; + int dy = y - m_y; + if (dx*dx <= 4 && dy*dy <= 4 && pressed == m_pressed) + continue; + } else { + // work around missing coordinates on mouse release in raw mode + if (sample.pressure == 0 && sample.x == 0 && sample.y == 0) { + x = m_x; + y = m_y; + } + } + QPoint pos(x, y); + + //printf("handleMouseEvent %d %d %d %ld\n", m_x, m_y, pressed, sample.tv.tv_usec); + + QWindowSystemInterface::handleMouseEvent(0, pos, pos, pressed ? Qt::LeftButton : Qt::NoButton); + + m_x = x; + m_y = y; + m_pressed = pressed; + } +} + +QT_END_NAMESPACE diff --git a/src/plugins/generic/tslib/qtslib.h b/src/plugins/generic/tslib/qtslib.h new file mode 100644 index 0000000..5eab8b9 --- /dev/null +++ b/src/plugins/generic/tslib/qtslib.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTSLIB_H +#define QTSLIB_H + +#include +//#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QSocketNotifier; +struct tsdev; + +class QTsLibMouseHandler : public QObject +{ + Q_OBJECT +public: + QTsLibMouseHandler(const QString &key, const QString &specification); + ~QTsLibMouseHandler(); + +private slots: + void readMouseData(); + +private: + QSocketNotifier * m_notify; + tsdev *m_dev; + int m_x, m_y; + bool m_pressed; + bool m_rawMode; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTSLIB_H diff --git a/src/plugins/generic/tslib/tslib.pro b/src/plugins/generic/tslib/tslib.pro new file mode 100644 index 0000000..74c7fd2 --- /dev/null +++ b/src/plugins/generic/tslib/tslib.pro @@ -0,0 +1,13 @@ +TARGET = qlinuxinputplugin +include(../../qpluginbase.pri) + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/generic +target.path = $$[QT_INSTALL_PLUGINS]/generic +INSTALLS += target + +HEADERS = qtslib.h + +SOURCES = main.cpp \ + qtslib.cpp + +LIBS += -lts -- cgit v0.12 From 3566ab0c99056f20964f5586b5f7a1b92c095579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Mon, 21 Jun 2010 13:19:27 +0200 Subject: Compile testlite plugin without OpenGL (QT_NO_OPENGL). Reviewed-by: jorgen --- src/plugins/platforms/testlite/qtestliteintegration.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/testlite/qtestliteintegration.cpp b/src/plugins/platforms/testlite/qtestliteintegration.cpp index 3ce9b7c..46f2384 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.cpp +++ b/src/plugins/platforms/testlite/qtestliteintegration.cpp @@ -109,16 +109,19 @@ QTestLiteIntegration::QTestLiteIntegration(bool useOpenGL) QPixmapData *QTestLiteIntegration::createPixmapData(QPixmapData::PixelType type) const { +#ifndef QT_NO_OPENGL if (mUseOpenGL) return new QGLPixmapData(type); +#endif return new QRasterPixmapData(type); } QWindowSurface *QTestLiteIntegration::createWindowSurface(QWidget *widget, WId) const { +#ifndef QT_NO_OPENGL if (mUseOpenGL) return new QGLWindowSurface(widget); - +#endif return new QTestLiteWindowSurface(mPrimaryScreen, widget); } @@ -138,7 +141,10 @@ QPixmap QTestLiteIntegration::grabWindow(WId window, int x, int y, int width, in bool QTestLiteIntegration::hasOpenGL() const { +#ifndef QT_NO_OPENGL return glXQueryExtension(xd->display, 0, 0) != 0; +#endif + return false; } QT_END_NAMESPACE -- cgit v0.12 From 220174b663a2b4db94fc82feba6939b0bef52aa2 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Mon, 21 Jun 2010 17:38:19 +0200 Subject: document VNC options for multiple screens --- src/plugins/platforms/vnc/qvncintegration.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/platforms/vnc/qvncintegration.cpp b/src/plugins/platforms/vnc/qvncintegration.cpp index 2ae34dc..16fa5bb 100644 --- a/src/plugins/platforms/vnc/qvncintegration.cpp +++ b/src/plugins/platforms/vnc/qvncintegration.cpp @@ -92,6 +92,11 @@ static void usage() qWarning() << " defaults to" << defaultWidth() << "x" << defaultHeight(); qWarning() << " display= - set the VNC display port to ID + 5900"; qWarning() << " defaults to" << defaultDisplay(); + qWarning() << " offset=x - set the current screens offset"; + qWarning() << " vnc - start configuration of a new screen"; + qWarning() << " size and offset are inherited from the previous screen if not set"; + qWarning() << " display id is incremented from the previous screen if not set"; + qWarning() << " virtual - manage the set of screens as a virtual desktop"; } QVNCIntegration::QVNCIntegration(const QStringList& paramList) -- cgit v0.12 From dbbc370400922cf9963a9a80ac0d1396450e8ef3 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 21 Jun 2010 14:31:36 +0200 Subject: Copied VNC crash fixes from QWS Copied from commit 71b840ef81a9 and commit 57fcc060f --- src/plugins/platforms/vnc/qvncserver.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/vnc/qvncserver.cpp b/src/plugins/platforms/vnc/qvncserver.cpp index fb6eaa8..288d1bc 100644 --- a/src/plugins/platforms/vnc/qvncserver.cpp +++ b/src/plugins/platforms/vnc/qvncserver.cpp @@ -889,7 +889,7 @@ void QVNCServer::clientCutText() { QRfbClientCutText ev; - if (ev.read(client)) { + if (cutTextPending == 0 && ev.read(client)) { cutTextPending = ev.length; if (!cutTextPending) handleMsg = false; @@ -1317,7 +1317,7 @@ void QVNCServer::convertPixels(char *dst, const char *src, int count) const } if (count & 0x1) { const quint16 *src16 = reinterpret_cast(src); - dst32[count - 1] = qt_conv16ToRgb(src16[count - 1]); + *dst32 = qt_conv16ToRgb(src16[count - 1]); } return; #endif -- cgit v0.12 From 7e5ddd5ffb23fa5ebd33b747f28ee20647b9325b Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 21 Jun 2010 17:30:47 +0200 Subject: Support multiple display IDs for Lighthouse QVFb plugin --- src/plugins/platforms/qvfb/main.cpp | 2 +- src/plugins/platforms/qvfb/qvfbintegration.cpp | 35 ++++++++++++++------------ src/plugins/platforms/qvfb/qvfbintegration.h | 4 +-- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/plugins/platforms/qvfb/main.cpp b/src/plugins/platforms/qvfb/main.cpp index 206ece8..997e544 100644 --- a/src/plugins/platforms/qvfb/main.cpp +++ b/src/plugins/platforms/qvfb/main.cpp @@ -63,7 +63,7 @@ QPlatformIntegration* QVFbIntegrationPlugin::create(const QString& system, const { Q_UNUSED(paramList); if (system.toLower() == "qvfb") - return new QVFbIntegration; + return new QVFbIntegration(paramList); return 0; } diff --git a/src/plugins/platforms/qvfb/qvfbintegration.cpp b/src/plugins/platforms/qvfb/qvfbintegration.cpp index 84ab9fb..a50763a 100644 --- a/src/plugins/platforms/qvfb/qvfbintegration.cpp +++ b/src/plugins/platforms/qvfb/qvfbintegration.cpp @@ -69,7 +69,7 @@ class QVFbScreenKeyboardHandler : public QObject { Q_OBJECT public: - QVFbScreenKeyboardHandler(); + QVFbScreenKeyboardHandler(int displayId); ~QVFbScreenKeyboardHandler(); private slots: @@ -83,9 +83,8 @@ private: QSocketNotifier *keyNotifier; }; -QVFbScreenKeyboardHandler::QVFbScreenKeyboardHandler() +QVFbScreenKeyboardHandler::QVFbScreenKeyboardHandler(int displayId) { - int displayId = 0; //TODO displayId const QString keyboardDev = QT_VFB_KEYBOARD_PIPE(displayId); @@ -165,7 +164,7 @@ class QVFbScreenMouseHandler : public QObject { Q_OBJECT public: - QVFbScreenMouseHandler(); + QVFbScreenMouseHandler(int displayId); ~QVFbScreenMouseHandler(); private slots: @@ -181,9 +180,8 @@ private: int oldButtonState; }; -QVFbScreenMouseHandler::QVFbScreenMouseHandler() +QVFbScreenMouseHandler::QVFbScreenMouseHandler(int displayId) { - int displayId = 0; //TODO: displayId QString mouseDev = QT_VFB_MOUSE_PIPE(displayId); mouseFD = QT_OPEN(mouseDev.toLatin1().constData(), O_RDWR | O_NDELAY); @@ -257,10 +255,11 @@ void QVFbScreenMouseHandler::readMouseData() class QVFbScreenPrivate { public: - QVFbScreenPrivate(QVFbScreen *) + QVFbScreenPrivate(int id) : shmrgn(0), hdr(0), data(0), mouseHandler(0), keyboardHandler(0) { - connect(0); //for now we only handle one screen + displayId = id; + connect(displayId); } ~QVFbScreenPrivate() { disconnect(); } @@ -281,7 +280,7 @@ private: uchar *data; QVFbScreenMouseHandler *mouseHandler; QVFbScreenKeyboardHandler *keyboardHandler; - + int displayId; QImage img; }; @@ -296,7 +295,7 @@ void QVFbScreenPrivate::setDirty(const QRect &r) bool QVFbScreenPrivate::connect(int displayId) { - + qDebug() << "QVFbScreenPrivate::connect" << displayId; key_t key = ftok(QT_VFB_MOUSE_PIPE(displayId).toLatin1(), 'b'); if (key == -1) @@ -339,8 +338,8 @@ bool QVFbScreenPrivate::connect(int displayId) qDebug("connected %dx%d %d bpp", w, h, d); - mouseHandler = new QVFbScreenMouseHandler; - keyboardHandler = new QVFbScreenKeyboardHandler; + mouseHandler = new QVFbScreenMouseHandler(displayId); + keyboardHandler = new QVFbScreenKeyboardHandler(displayId); return true; } @@ -357,9 +356,9 @@ void QVFbScreenPrivate::disconnect() } -QVFbScreen::QVFbScreen() +QVFbScreen::QVFbScreen(int id) { - d_ptr = new QVFbScreenPrivate(this); + d_ptr = new QVFbScreenPrivate(id); } @@ -409,9 +408,13 @@ QImage *QVFbScreen::screenImage() return d_ptr->screenImage(); } -QVFbIntegration::QVFbIntegration() +QVFbIntegration::QVFbIntegration(const QStringList ¶mList) { - mPrimaryScreen = new QVFbScreen(); + int displayId = 0; + if (paramList.length() > 0) + displayId = paramList.at(0).toInt(); + + mPrimaryScreen = new QVFbScreen(displayId); mScreens.append(mPrimaryScreen); } diff --git a/src/plugins/platforms/qvfb/qvfbintegration.h b/src/plugins/platforms/qvfb/qvfbintegration.h index ab44d46..e46e0da 100644 --- a/src/plugins/platforms/qvfb/qvfbintegration.h +++ b/src/plugins/platforms/qvfb/qvfbintegration.h @@ -53,7 +53,7 @@ class QVFbScreenPrivate; class QVFbScreen : public QPlatformScreen { public: - QVFbScreen(); + QVFbScreen(int id); ~QVFbScreen(); QRect geometry() const; @@ -76,7 +76,7 @@ class QVFbIntegrationPrivate; class QVFbIntegration : public QPlatformIntegration { public: - QVFbIntegration(); + QVFbIntegration(const QStringList ¶mList); QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; -- cgit v0.12 From a2be3a026b1a18a14782c11fd89427e707b0d270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Mon, 21 Jun 2010 18:34:41 +0200 Subject: Remove unused function (declared, but not implemented). Doesn't compile on the Mac without this fix. Reviewed-by: Paul --- src/plugins/platforms/vnc/qvncserver.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/platforms/vnc/qvncserver.h b/src/plugins/platforms/vnc/qvncserver.h index 837f1f4..7244bdf 100644 --- a/src/plugins/platforms/vnc/qvncserver.h +++ b/src/plugins/platforms/vnc/qvncserver.h @@ -488,7 +488,6 @@ private slots: void readClient(); void checkUpdate(); void discardClient(); - void sendInputEvents(); private: void init(uint port); -- cgit v0.12 From e7a423571981294a8e0d27f041ff9296711b15e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Wed, 23 Jun 2010 13:59:39 +0200 Subject: Remove dead code (QPlatformGLWidgetSurface). Reviewed-by: jorgen --- src/opengl/qgl.h | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index 8da48ed..f0b36f7 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -128,10 +128,6 @@ class QGLOverlayWidget; class QGLWidgetPrivate; class QGLContextPrivate; -#ifdef Q_WS_LITE -class QPlatformGLWidgetSurface; -#endif - // Namespace class: namespace QGL { @@ -539,11 +535,6 @@ public: void drawTexture(const QPointF &point, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D); #endif -#ifdef Q_WS_LITE - // Used by the platform context to get at the surface which it created for the glwidget: - QPlatformGLWidgetSurface* platformSurface(); -#endif - public Q_SLOTS: virtual void updateGL(); virtual void updateOverlayGL(); -- cgit v0.12 From c845f1ed4c35e8a626389a415a56b07d6b5b83f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Wed, 23 Jun 2010 14:33:49 +0200 Subject: Compile openkode plugin. Reviewed-by: jorgen --- .../platforms/openkode/qopenkodeglintegration.cpp | 22 ---------------------- .../platforms/openkode/qopenkodeglintegration.h | 13 +------------ .../platforms/openkode/qopenkodeintegration.cpp | 6 +----- .../platforms/openkode/qopenkodeintegration.h | 2 +- 4 files changed, 3 insertions(+), 40 deletions(-) diff --git a/src/plugins/platforms/openkode/qopenkodeglintegration.cpp b/src/plugins/platforms/openkode/qopenkodeglintegration.cpp index b0d901b..7223538 100644 --- a/src/plugins/platforms/openkode/qopenkodeglintegration.cpp +++ b/src/plugins/platforms/openkode/qopenkodeglintegration.cpp @@ -147,28 +147,6 @@ void qt_glformat_from_eglconfig(QGLFormat& format, const EGLConfig config) eglGetError(); } -QEGLPlatformWidgetSurface::QEGLPlatformWidgetSurface() - :QPlatformGLWidgetSurface() -{ - -} -QEGLPlatformWidgetSurface::~QEGLPlatformWidgetSurface() -{ -} - -bool QEGLPlatformWidgetSurface::create(QGLWidget* widget, QGLFormat& format) -{ - return true; -} -void QEGLPlatformWidgetSurface::setGeometry(const QRect& rect) -{ - Q_UNUSED(rect); -} -bool QEGLPlatformWidgetSurface::filterEvent(QEvent *event) -{ - return QPlatformGLWidgetSurface::filterEvent(event); -} - QEGLPlatformContext::QEGLPlatformContext() { } diff --git a/src/plugins/platforms/openkode/qopenkodeglintegration.h b/src/plugins/platforms/openkode/qopenkodeglintegration.h index c3291b8..b0b7a48 100644 --- a/src/plugins/platforms/openkode/qopenkodeglintegration.h +++ b/src/plugins/platforms/openkode/qopenkodeglintegration.h @@ -42,7 +42,7 @@ #ifndef QOPENKODEGLINTEGRATION_H #define QOPENKODEGLINTEGRATION_H -#include +#include #include #include @@ -50,17 +50,6 @@ void qt_eglproperties_set_glformat(QEglProperties& eglProperties, const QGLForma // Updates "format" with the parameters of the selected configuration. void qt_glformat_from_eglconfig(QGLFormat& format, const EGLConfig config); -class QEGLPlatformWidgetSurface : public QPlatformGLWidgetSurface -{ -public: - QEGLPlatformWidgetSurface(); - virtual ~QEGLPlatformWidgetSurface(); - - bool create(QGLWidget*, QGLFormat&); - void setGeometry(const QRect&); - bool filterEvent(QEvent *); -}; - class QEGLPlatformContext : public QPlatformGLContext { public: diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.cpp b/src/plugins/platforms/openkode/qopenkodeintegration.cpp index cd957af..5e461ae 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.cpp +++ b/src/plugins/platforms/openkode/qopenkodeintegration.cpp @@ -212,7 +212,7 @@ QPlatformWindow *QOpenKODEIntegration::createPlatformWindow(QWidget *tlw, WId ) QWindowSurface *QOpenKODEIntegration::createWindowSurface(QWidget *widget, WId wid) const { - return new QGLWindowSurface(widget); + return new QOpenKODEWindowSurface(widget, wid); } bool QOpenKODEIntegration::hasOpenGL() const @@ -223,10 +223,6 @@ QPlatformGLContext *QOpenKODEIntegration::createGLContext() { return new QEGLPlatformContext; } -QPlatformGLWidgetSurface *QOpenKODEIntegration::createGLWidgetSurface() -{ - return new QEGLPlatformWidgetSurface; -} GLuint QOpenKODEIntegration::blitterProgram() { diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.h b/src/plugins/platforms/openkode/qopenkodeintegration.h index ad6db4b..f53c520 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.h +++ b/src/plugins/platforms/openkode/qopenkodeintegration.h @@ -47,6 +47,7 @@ #include #include #include +#include # include @@ -83,7 +84,6 @@ public: bool hasOpenGL() const; QPlatformGLContext * createGLContext(); - QPlatformGLWidgetSurface * createGLWidgetSurface(); virtual QList screens() const { return mScreens; } -- cgit v0.12 From fe26a83447d50422c992bde6bd429ba3209a9222 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 21 Jun 2010 13:36:03 +0200 Subject: Removing the default graphicsystem from lighthouse Reviewed-by: paul --- src/gui/kernel/qapplication_lite.cpp | 4 -- src/gui/kernel/qwidget_lite.cpp | 4 +- src/gui/painting/painting.pri | 6 +-- src/gui/painting/qgraphicssystem_lite.cpp | 62 --------------------------- src/gui/painting/qgraphicssystem_lite_p.h | 70 ------------------------------- 5 files changed, 4 insertions(+), 142 deletions(-) delete mode 100644 src/gui/painting/qgraphicssystem_lite.cpp delete mode 100644 src/gui/painting/qgraphicssystem_lite_p.h diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index bd72663..db31abd 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -57,7 +57,6 @@ #include #include -#include #include #include #include @@ -425,7 +424,6 @@ void QApplication::alert(QWidget *, int) static void init_platform(const QString &name) { QApplicationPrivate::platform_integration = QPlatformIntegrationFactory::create(name); - QApplicationPrivate::graphics_system = new QLiteGraphicsSystem; if (!QApplicationPrivate::platform_integration) { QStringList keys = QPlatformIntegrationFactory::keys(); QString fatalMessage = @@ -444,8 +442,6 @@ static void cleanup_platform() { delete QApplicationPrivate::platform_integration; QApplicationPrivate::platform_integration = 0; - delete QApplicationPrivate::graphics_system; - QApplicationPrivate::graphics_system = 0; } static void init_plugins(const QList pluginList) diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index 445e166..5380445 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -728,8 +728,8 @@ QPaintEngine *QWidget::paintEngine() const QWindowSurface *QWidgetPrivate::createDefaultWindowSurface_sys() { - qFatal("CreateDefaultWindowSurface_sys should not be used on lighthouse"); - return 0; + Q_Q(QWidget); + return QApplicationPrivate::platformIntegration()->createWindowSurface(q,0); } void QWidgetPrivate::setModal_sys() diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 37de177..46be728 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -191,11 +191,9 @@ embedded_lite { SOURCES += \ painting/qcolormap_lite.cpp \ painting/qpaintdevice_lite.cpp \ - painting/qgraphicssystemcursor_lite.cpp \ - painting/qgraphicssystem_lite.cpp + painting/qgraphicssystemcursor_lite.cpp HEADERS += \ - painting/qgraphicssystemcursor_lite.h \ - painting/qgraphicssystem_lite_p.h + painting/qgraphicssystemcursor_lite.h } symbian { diff --git a/src/gui/painting/qgraphicssystem_lite.cpp b/src/gui/painting/qgraphicssystem_lite.cpp deleted file mode 100644 index 1d24129..0000000 --- a/src/gui/painting/qgraphicssystem_lite.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgraphicssystem_lite_p.h" -#include - -QT_BEGIN_NAMESPACE - -QPixmapData *QLiteGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const -{ - return QApplicationPrivate::platformIntegration()->createPixmapData(type); -} - -QWindowSurface *QLiteGraphicsSystem::createWindowSurface(QWidget *widget) const -{ - return QApplicationPrivate::platformIntegration()->createWindowSurface(widget, widget->winId()); -} - -QBlittable *QLiteGraphicsSystem::createBlittable(const QSize &size) const -{ - return QApplicationPrivate::platformIntegration()->createBlittable(size); -} - -QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystem_lite_p.h b/src/gui/painting/qgraphicssystem_lite_p.h deleted file mode 100644 index e29fa83..0000000 --- a/src/gui/painting/qgraphicssystem_lite_p.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSYSTEM_MAC_P_H -#define QGRAPHICSSYSTEM_MAC_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "private/qgraphicssystem_p.h" - -QT_BEGIN_NAMESPACE - -class Q_GUI_EXPORT QLiteGraphicsSystem : public QGraphicsSystem -{ -public: - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; - QBlittable *createBlittable(const QSize &size) const; -}; - -QT_END_NAMESPACE - -#endif -- cgit v0.12 From 57522c3c389c133343c31770950648c3cf271406 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 23 Jun 2010 15:55:30 +0200 Subject: Disable the all native child widgets on lighthouse and make the mapping of native child widgets work with nativeParentWidget --- src/gui/kernel/qapplication_lite.cpp | 6 +++ src/gui/kernel/qwidget.cpp | 18 ++++----- src/gui/kernel/qwidget_lite.cpp | 44 +++++++++++++++------- src/opengl/qwindowsurface_gl.cpp | 2 +- src/plugins/platforms/testlite/qtestlitewindow.cpp | 17 ++------- 5 files changed, 47 insertions(+), 40 deletions(-) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index db31abd..9c36ef5 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -479,6 +479,7 @@ void qt_init(QApplicationPrivate *priv, int type) { Q_UNUSED(type); + qApp->setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); char *p; char **argv = priv->argv; int argc = priv->argc; @@ -787,6 +788,11 @@ void QApplicationPrivate::processKeyEvent(QWindowSystemInterface::KeyEvent *e) void QApplicationPrivate::processGeometryChange(QWidget *tlw, const QRect &newRect) { + if (!tlw->isWindow()) + return; //geo of native child widgets is controlled by lighthouse + //so we already have sent the events; besides this new rect + //is not mapped to parent + QRect cr(tlw->geometry()); bool isResize = cr.size() != newRect.size(); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 1df73c2..782cc1d 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1342,6 +1342,7 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow) flags |= Qt::Window; } +#ifndef Q_WS_LITE if (QWidget *parent = parentWidget()) { #ifdef Q_WS_MAC if (testAttribute(Qt::WA_NativeWindow) == false) @@ -1362,6 +1363,7 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow) return; } } +#endif //Q_WS_LITE #ifdef QT3_SUPPORT if (flags & Qt::WStaticContents) @@ -2424,6 +2426,7 @@ void QWidgetPrivate::createWinId(WId winid) #endif const bool forceNativeWindow = q->testAttribute(Qt::WA_NativeWindow); if (!q->testAttribute(Qt::WA_WState_Created) || (forceNativeWindow && !q->internalWinId())) { +#ifndef Q_WS_LITE if (!q->isWindow()) { QWidget *parent = q->parentWidget(); QWidgetPrivate *pd = parent->d_func(); @@ -2451,6 +2454,10 @@ void QWidgetPrivate::createWinId(WId winid) } else { q->create(); } +#else + q->create(); +#endif //Q_WS_LITE + } } @@ -10453,12 +10460,6 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) Q_ASSERT_X(sizeof(d->high_attributes)*8 >= (Qt::WA_AttributeCount - sizeof(uint)*8), "QWidget::setAttribute(WidgetAttribute, bool)", "QWidgetPrivate::high_attributes[] too small to contain all attributes in WidgetAttribute"); -#ifdef Q_WS_LITE - //### we don't have native child widgets, and WinId isn't really there yet - if (attribute == Qt::WA_NativeWindow) - return; -#endif - #ifdef Q_WS_WIN // ### Don't use PaintOnScreen+paintEngine() to do native painting in 5.0 if (attribute == Qt::WA_PaintOnScreen && on && !inherits("QGLWidget")) { @@ -11945,11 +11946,6 @@ QWindowSurface *QWidget::windowSurface() const */ void QWidget::setPlatformWindow(QPlatformWindow *window) { -#ifndef Q_BACKINGSTORE_SUBSURFACES - if (!isTopLevel()) - return; -#endif - Q_D(QWidget); QTLWExtra *topData = d->topData(); diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index 5380445..f92eb61 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -54,6 +54,23 @@ QT_BEGIN_NAMESPACE static QPlatformScreen *qt_screenForWidget(const QWidget *w); +void setParentForChildrenOfWidget(QPlatformWindow *window, const QWidget *widget) +{ + QObjectList children = widget->children(); + for (int i = 0; i < children.size(); i++) { + if (children.at(i)->isWidgetType()) { + const QWidget *childWidget = qobject_cast(children.at(i)); + if (childWidget) { // should not be nessesary + if (childWidget->platformWindow()) { + childWidget->platformWindow()->setParent(window); + } else { + setParentForChildrenOfWidget(window,childWidget); + } + } + } + } +} + void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyOldWindow) { Q_Q(QWidget); @@ -65,7 +82,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO Qt::WindowFlags flags = data.window_flags; - if (!(flags & Qt::Window) || q->windowType() == Qt::Desktop) + if ((!q->testAttribute(Qt::WA_NativeWindow) && !q->isWindow()) || q->windowType() == Qt::Desktop ) return; // we only care about real toplevels QWindowSurface *surface = q->windowSurface(); @@ -76,8 +93,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO } Q_ASSERT(platformWindow); - // QGLWidget does not need/work with a windowsurface - if (!surface) {// && !q->inherits("QGLWidget")) { + if (!surface) { surface = QApplicationPrivate::platformIntegration()->createWindowSurface(q,platformWindow->winId()); } @@ -85,14 +101,11 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO setWinId(q->platformWindow()->winId()); - QObjectList children = q->children(); - for (int i = 0; i < children.size(); i++) { - if (children.at(i)->isWidgetType()) { - const QWidget *childWidget = qobject_cast(children.at(i)); - QPlatformWindow *childWindow = childWidget->platformWindow(); - if (childWindow) { - childWindow->setParent(platformWindow); - } + //first check children. then find who for parent. + setParentForChildrenOfWidget(platformWindow,q); + if (QWidget *nativeParent = q->nativeParentWidget()) { + if (nativeParent->platformWindow()) { + platformWindow->setParent(nativeParent->platformWindow()); } } @@ -132,7 +145,6 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) { Q_Q(QWidget); - // QWidget *oldParent = q->parentWidget(); Qt::WindowFlags oldFlags = data.window_flags; @@ -560,9 +572,13 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) data.crect = r; if (q->isVisible()) { - if (q->platformWindow()) { - q->platformWindow()->setGeometry(q->frameGeometry()); + if (q->isWindow()) { + q->platformWindow()->setGeometry(q->frameGeometry()); + } else { + QPoint posInNativeParent = q->mapTo(q->nativeParentWidget(),QPoint()); + q->platformWindow()->setGeometry(QRect(posInNativeParent,r.size())); + } const QWidgetBackingStore *bs = maybeBackingStore(); if (bs->windowSurface) { if (isResize) diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index ad7c568..98455e1 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -290,7 +290,7 @@ QPaintEngine *QGLWindowSurfaceGLPaintDevice::paintEngine() const QGLWindowSurface::QGLWindowSurface(QWidget *window) : QWindowSurface(window), d_ptr(new QGLWindowSurfacePrivate) { - Q_ASSERT(window->isTopLevel()); +// Q_ASSERT(window->isTopLevel()); d_ptr->pb = 0; d_ptr->fbo = 0; d_ptr->ctx = 0; diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index 2737db0..82e64e6 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -640,18 +640,8 @@ WId QTestLiteWindow::winId() const void QTestLiteWindow::setParent(const QPlatformWindow *window) { - /******** Cleaning up **********/ - Window parentXWindow, rootXWindow; - Window *children; - unsigned int nChildren; - if (XQueryTree(xd->display, x_window, &rootXWindow, &parentXWindow, &children, &nChildren)) { - if (parentXWindow) { - XUnmapWindow(xd->display, x_window); - XReparentWindow(xd->display, x_window, rootXWindow, 0, 0); - } - } - /******* Done cleaning up ********/ - XReparentWindow(xd->display,x_window,window->winId(),geometry().x(),geometry().y()); + QPoint point = widget()->mapTo(widget()->nativeParentWidget(),QPoint()); + XReparentWindow(xd->display,x_window,window->winId(),point.x(),point.y()); XMapWindow(xd->display, x_window); } @@ -701,7 +691,6 @@ void QTestLiteWindow::paintEvent() void QTestLiteWindow::resizeEvent(XConfigureEvent *e) { - if ((e->width != width || e->height != height) && e->x == 0 && e->y == 0) { //qDebug() << "resize with bogus pos" << e->x << e->y << e->width << e->height << "window"<< hex << window; } else { @@ -844,7 +833,7 @@ static inline bool isTransient(const QWidget *w) Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) { - Q_ASSERT(flags & Qt::Window); +// Q_ASSERT(flags & Qt::Window); window_flags = flags; if (mwm_hint_atom == XNone) { -- cgit v0.12 From 415c1ee359249e3eb44ff56e6078076d6024afeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 24 Jun 2010 09:32:19 +0200 Subject: Say hello to Q_WS_QPA! Rename Q_WS_LITE -> Q_WS_QPA --- configure | 2 +- src/corelib/global/qglobal.cpp | 10 +++--- src/corelib/global/qglobal.h | 6 ++-- src/corelib/global/qnamespace.h | 2 +- src/corelib/io/qsettings.cpp | 2 +- src/corelib/io/qsettings_p.h | 2 +- src/gui/embedded/qkbd_qws.cpp | 4 +-- src/gui/image/qnativeimage.cpp | 2 +- src/gui/image/qpixmap.cpp | 2 +- src/gui/image/qpixmap_blitter.cpp | 2 +- src/gui/image/qpixmapdatafactory.cpp | 4 +-- src/gui/kernel/qapplication.cpp | 18 +++++----- src/gui/kernel/qapplication_p.h | 10 +++--- src/gui/kernel/qcursor.h | 2 +- src/gui/kernel/qcursor_p.h | 2 +- src/gui/kernel/qdnd_p.h | 2 +- src/gui/kernel/qguiplatformplugin.cpp | 2 +- src/gui/kernel/qwidget.cpp | 30 ++++++++-------- src/gui/kernel/qwidget.h | 2 +- src/gui/kernel/qwidget_p.h | 6 ++-- src/gui/kernel/qwindowdefs.h | 4 +-- src/gui/painting/qbackingstore.cpp | 10 +++--- src/gui/painting/qgraphicssystem.cpp | 4 +-- src/gui/painting/qpaintdevice.cpp | 2 +- src/gui/painting/qpaintengine.h | 2 +- src/gui/painting/qpaintengine_raster.cpp | 6 ++-- src/gui/painting/qregion.cpp | 4 +-- src/gui/painting/qregion.h | 6 ++-- src/gui/painting/qwindowsurface.cpp | 10 +++--- src/gui/painting/qwindowsurface_p.h | 2 +- src/gui/text/qfont.cpp | 6 ++-- src/gui/text/qfont.h | 4 +-- src/gui/text/qfontdatabase.cpp | 40 +++++++++++----------- src/gui/text/qfontdatabase.h | 2 +- src/gui/text/qfontengine.cpp | 4 +-- src/gui/text/qfontengine_ft_p.h | 2 +- src/gui/text/qfontengine_p.h | 2 +- src/gui/util/qdesktopservices.cpp | 2 +- src/opengl/qgl.cpp | 8 ++--- src/opengl/qgl_p.h | 6 ++-- src/opengl/qglpixelbuffer_p.h | 8 ++--- src/opengl/qwindowsurface_gl.cpp | 6 ++-- src/opengl/qwindowsurface_gl_p.h | 2 +- .../trace/qgraphicssystem_trace.cpp | 2 +- tests/auto/qaction/tst_qaction.cpp | 2 +- 45 files changed, 129 insertions(+), 129 deletions(-) diff --git a/configure b/configure index 41ccb34..6143ac1 100755 --- a/configure +++ b/configure @@ -7691,7 +7691,7 @@ fi # QWS if [ "$PLATFORM_EMBLITE" = "yes" ]; then # Add LITE to config.h - QCONFIG_FLAGS="$QCONFIG_FLAGS Q_WS_LITE QT_NO_QWS_QPF QT_NO_QWS_QPF2" + QCONFIG_FLAGS="$QCONFIG_FLAGS Q_WS_QPA QT_NO_QWS_QPF QT_NO_QWS_QPF2" fi if [ "${CFG_USE_FLOATMATH}" = "yes" ]; then diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index f4f9702..bf78c03 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1231,7 +1231,7 @@ bool qSharedBuild() Defined on Mac OS X. - \sa Q_WS_WIN, Q_WS_X11, Q_WS_QWS, Q_WS_LITE, Q_WS_S60 + \sa Q_WS_WIN, Q_WS_X11, Q_WS_QWS, Q_WS_QPA, Q_WS_S60 */ /*! @@ -1240,7 +1240,7 @@ bool qSharedBuild() Defined on Windows. - \sa Q_WS_MAC, Q_WS_X11, Q_WS_QWS, Q_WS_LITE, Q_WS_S60 + \sa Q_WS_MAC, Q_WS_X11, Q_WS_QWS, Q_WS_QPA, Q_WS_S60 */ /*! @@ -1249,7 +1249,7 @@ bool qSharedBuild() Defined on X11. - \sa Q_WS_MAC, Q_WS_WIN, Q_WS_QWS, Q_WS_LITE, Q_WS_S60 + \sa Q_WS_MAC, Q_WS_WIN, Q_WS_QWS, Q_WS_QPA, Q_WS_S60 */ /*! @@ -1258,11 +1258,11 @@ bool qSharedBuild() Defined on Qt for Embedded Linux. - \sa Q_WS_MAC, Q_WS_WIN, Q_WS_X11, Q_WS_LITE, Q_WS_S60 + \sa Q_WS_MAC, Q_WS_WIN, Q_WS_X11, Q_WS_QPA, Q_WS_S60 */ /*! - \macro Q_WS_LITE + \macro Q_WS_QPA \relates Defined on Qt for Embedded Linux, Lite version. diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 815b7da..00ba5c3 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -807,7 +807,7 @@ namespace QT_NAMESPACE {} # define Q_WS_PM # error "Qt does not work with OS/2 Presentation Manager or Workplace Shell" #elif defined(Q_OS_UNIX) -# if defined(Q_OS_MAC) && !defined(__USE_WS_X11__) && !defined(Q_WS_QWS) && !defined(Q_WS_LITE) +# if defined(Q_OS_MAC) && !defined(__USE_WS_X11__) && !defined(Q_WS_QWS) && !defined(Q_WS_QPA) # define Q_WS_MAC # define Q_WS_MACX # if defined(Q_OS_MAC64) @@ -819,7 +819,7 @@ namespace QT_NAMESPACE {} # if !defined(QT_NO_S60) # define Q_WS_S60 # endif -# elif !defined(Q_WS_QWS) && !defined(Q_WS_LITE) +# elif !defined(Q_WS_QWS) && !defined(Q_WS_QPA) # define Q_WS_X11 # endif #endif @@ -1078,7 +1078,7 @@ redefine to built-in booleans to make autotests work properly */ typedef int QNoImplicitBoolCast; -#if defined(QT_ARCH_ARM) || defined(QT_ARCH_ARMV6) || defined(QT_ARCH_AVR32) || (defined(QT_ARCH_MIPS) && (defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_WINCE))) || defined(QT_ARCH_SH) || defined(QT_ARCH_SH4A) +#if defined(QT_ARCH_ARM) || defined(QT_ARCH_ARMV6) || defined(QT_ARCH_AVR32) || (defined(QT_ARCH_MIPS) && (defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_WINCE))) || defined(QT_ARCH_SH) || defined(QT_ARCH_SH4A) #define QT_NO_FPU #endif diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 3a8b99f..6edadc5 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1654,7 +1654,7 @@ public: typedef void *HANDLE; #elif defined(Q_WS_X11) typedef unsigned long HANDLE; -#elif defined(Q_WS_QWS) || defined(Q_WS_LITE) +#elif defined(Q_WS_QWS) || defined(Q_WS_QPA) typedef void * HANDLE; #elif defined(Q_OS_SYMBIAN) typedef unsigned long int HANDLE; // equivalent to TUint32 diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 703a9d2..998c7cc 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -1126,7 +1126,7 @@ static void initDefaultPaths(QMutexLocker *locker) if (env == 0) { userPath = homePath; userPath += QLatin1Char('/'); -#if defined(Q_WS_QWS) || defined(Q_WS_LITE) +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) userPath += QLatin1String("Settings"); #else userPath += QLatin1String(".config"); diff --git a/src/corelib/io/qsettings_p.h b/src/corelib/io/qsettings_p.h index 569a61c..5ff4d96 100644 --- a/src/corelib/io/qsettings_p.h +++ b/src/corelib/io/qsettings_p.h @@ -70,7 +70,7 @@ QT_BEGIN_NAMESPACE -#if defined(Q_WS_QWS) || defined(Q_WS_LITE) +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) #define QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER #endif diff --git a/src/gui/embedded/qkbd_qws.cpp b/src/gui/embedded/qkbd_qws.cpp index c4dd6bd..a325b28 100644 --- a/src/gui/embedded/qkbd_qws.cpp +++ b/src/gui/embedded/qkbd_qws.cpp @@ -53,7 +53,7 @@ #include "qscreen_qws.h" #endif -#ifdef Q_WS_LITE +#ifdef Q_WS_QPA #include #include #endif @@ -362,7 +362,7 @@ void QWSKeyboardHandler::processKeyEvent(int unicode, int keycode, Qt::KeyboardM { #if defined(Q_WS_QWS) qwsServer->processKeyEvent(unicode, keycode, modifiers, isPress, autoRepeat); -#elif defined(Q_WS_LITE) +#elif defined(Q_WS_QPA) QEvent::Type type = isPress ? QEvent::KeyPress : QEvent::KeyRelease; QString str; if (unicode != 0xffff) diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp index d4cbdc6..84c9911 100644 --- a/src/gui/image/qnativeimage.cpp +++ b/src/gui/image/qnativeimage.cpp @@ -287,7 +287,7 @@ QNativeImage::~QNativeImage() QImage::Format QNativeImage::systemFormat() { -#ifdef Q_WS_LITE +#ifdef Q_WS_QPA return QApplicationPrivate::platformIntegration()->screens().at(0)->format(); #else return QImage::Format_RGB32; diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index ec640fc..1ae3bef 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -1934,7 +1934,7 @@ int QPixmap::defaultDepth() return 32; #elif defined(Q_OS_SYMBIAN) return S60->screenDepth; -#elif defined(Q_WS_LITE) +#elif defined(Q_WS_QPA) return 32; //LITE: use graphicssystem (we should do that in general) #endif } diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index 38a2f81..660f4d2 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -56,7 +56,7 @@ void QBlittablePixmapData::resize(int width, int height) m_blittable = 0; delete m_engine; m_engine = 0; -#ifdef Q_WS_LITE +#ifdef Q_WS_QPA d = QApplicationPrivate::platformIntegration()->screens().at(0)->depth(); #endif w = width; diff --git a/src/gui/image/qpixmapdatafactory.cpp b/src/gui/image/qpixmapdatafactory.cpp index ac79c75..b63d046 100644 --- a/src/gui/image/qpixmapdatafactory.cpp +++ b/src/gui/image/qpixmapdatafactory.cpp @@ -53,7 +53,7 @@ #ifdef Q_WS_MAC # include #endif -#ifdef Q_WS_LITE +#ifdef Q_WS_QPA # include #endif #ifdef Q_WS_S60 @@ -85,7 +85,7 @@ QPixmapData* QSimplePixmapDataFactory::create(QPixmapData::PixelType type) return new QRasterPixmapData(type); #elif defined(Q_WS_MAC) return new QMacPixmapData(type); -#elif defined(Q_WS_LITE) +#elif defined(Q_WS_QPA) return new QRasterPixmapData(type); #elif defined(Q_WS_S60) return new QS60PixmapData(type); diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 8b53d35..b3e6fcd 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -447,7 +447,7 @@ QPalette *QApplicationPrivate::sys_pal = 0; // default system palette QPalette *QApplicationPrivate::set_pal = 0; // default palette set by programmer QGraphicsSystem *QApplicationPrivate::graphics_system = 0; // default graphics system -#if defined(Q_WS_LITE) +#if defined(Q_WS_QPA) QPlatformIntegration *QApplicationPrivate::platform_integration = 0; #endif QString QApplicationPrivate::graphics_system_name; // graphics system id - for delayed initialization @@ -508,7 +508,7 @@ inline bool QApplicationPrivate::isAlien(QWidget *widget) { if (!widget) return false; -#if defined(Q_WS_QWS) || defined(Q_WS_LITE) +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) return !widget->isWindow() # ifdef Q_BACKINGSTORE_SUBSURFACES && !(widget->d_func()->maybeTopData() && widget->d_func()->maybeTopData()->windowSurface) @@ -923,7 +923,7 @@ void QApplicationPrivate::initialize() QWidgetPrivate::mapper = new QWidgetMapper; QWidgetPrivate::allWidgets = new QWidgetSet; -#if !defined(Q_WS_X11) && !defined(Q_WS_QWS) && !defined(Q_WS_LITE) +#if !defined(Q_WS_X11) && !defined(Q_WS_QWS) && !defined(Q_WS_QPA) // initialize the graphics system - on X11 this is initialized inside // qt_init() in qapplication_x11.cpp because of several reasons. // On QWS, the graphics system is set by the QScreen plugin. @@ -1590,7 +1590,7 @@ QStyle* QApplication::setStyle(const QString& style) void QApplication::setGraphicsSystem(const QString &system) { -#ifdef Q_WS_LITE +#ifdef Q_WS_QPA Q_UNUSED(system); #else # ifdef QT_GRAPHICSSYSTEM_RUNTIME @@ -2735,7 +2735,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) { // Update cursor for alien/graphics widgets. const bool enterOnAlien = (enter && (isAlien(enter) || enter->testAttribute(Qt::WA_DontShowOnScreen))); -#if defined(Q_WS_X11) || defined(Q_WS_LITE) +#if defined(Q_WS_X11) || defined(Q_WS_QPA) //Whenever we leave an alien widget on X11, we need to reset its nativeParentWidget()'s cursor. // This is not required on Windows as the cursor is reset on every single mouse move. QWidget *parentOfLeavingCursor = 0; @@ -2761,7 +2761,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) { { #if defined(Q_WS_X11) qt_x11_enforce_cursor(parentOfLeavingCursor,true); -#elif defined(Q_WS_LITE) +#elif defined(Q_WS_QPA) if (enter == QApplication::desktop()) { qt_lite_set_cursor(enter, true); } else { @@ -2791,7 +2791,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) { qt_x11_enforce_cursor(cursorWidget, true); #elif defined(Q_WS_S60) qt_symbian_set_cursor(cursorWidget, true); -#elif defined(Q_WS_LITE) +#elif defined(Q_WS_QPA) qt_lite_set_cursor(cursorWidget, true); #endif } @@ -3097,7 +3097,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event, return result; } -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_MAC) || defined(Q_WS_LITE) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_MAC) || defined(Q_WS_QPA) /* This function should only be called when the widget changes visibility, i.e. when the \a widget is shown, hidden or deleted. This function does nothing @@ -3109,7 +3109,7 @@ extern QWidget *qt_button_down; void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget) { #ifndef QT_NO_CURSOR -#if defined(Q_WS_QWS) || defined(Q_WS_LITE) +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) if (!widget || widget->isWindow()) return; #else diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 8d36519..ecfac78 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -76,7 +76,7 @@ #ifdef Q_OS_SYMBIAN #include #endif -#ifdef Q_WS_LITE +#ifdef Q_WS_QPA #include #include "QtGui/qplatformintegration_lite.h" #endif @@ -324,7 +324,7 @@ public: { return graphics_system; } #endif -#if defined(Q_WS_LITE) +#if defined(Q_WS_QPA) static QPlatformIntegration *platformIntegration() { return platform_integration; } @@ -489,7 +489,7 @@ public: static bool qt_mac_apply_settings(); #endif -#ifdef Q_WS_LITE +#ifdef Q_WS_QPA static void processMouseEvent(QWindowSystemInterface::MouseEvent *e); static void processKeyEvent(QWindowSystemInterface::KeyEvent *e); static void processWheelEvent(QWindowSystemInterface::WheelEvent *e); @@ -552,7 +552,7 @@ public: int symbianResourceChange(const QSymbianEvent *symbianEvent); #endif -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_MAC) || defined(Q_WS_LITE) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_MAC) || defined(Q_WS_QPA) void sendSyntheticEnterLeave(QWidget *widget); #endif @@ -660,7 +660,7 @@ Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window, extern void qt_x11_enforce_cursor(QWidget *); #elif defined(Q_OS_SYMBIAN) extern void qt_symbian_set_cursor(QWidget *, bool); -#elif defined (Q_WS_LITE) +#elif defined (Q_WS_QPA) extern void qt_lite_set_cursor(QWidget *, bool); #endif diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h index cb9e8a6..b414a78 100644 --- a/src/gui/kernel/qcursor.h +++ b/src/gui/kernel/qcursor.h @@ -126,7 +126,7 @@ public: static int x11Screen(); #elif defined(Q_WS_MAC) Qt::HANDLE handle() const; -#elif defined(Q_WS_QWS) || defined(Q_WS_LITE) +#elif defined(Q_WS_QWS) || defined(Q_WS_QPA) int handle() const; #elif defined(Q_OS_SYMBIAN) Qt::HANDLE handle() const; diff --git a/src/gui/kernel/qcursor_p.h b/src/gui/kernel/qcursor_p.h index dadb83c..bfd6eac 100644 --- a/src/gui/kernel/qcursor_p.h +++ b/src/gui/kernel/qcursor_p.h @@ -91,7 +91,7 @@ public: short hx, hy; #if defined (Q_WS_MAC) int mId; -#elif defined(Q_WS_QWS) || defined(Q_WS_LITE) +#elif defined(Q_WS_QWS) || defined(Q_WS_QPA) int id; #endif #if defined (Q_WS_WIN) diff --git a/src/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h index 3989979..598a9de 100644 --- a/src/gui/kernel/qdnd_p.h +++ b/src/gui/kernel/qdnd_p.h @@ -261,7 +261,7 @@ public: #endif private: -#if defined(Q_WS_QWS) || defined(Q_WS_LITE) +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) Qt::DropAction currentActionForOverrideCursor; #endif #ifdef Q_OS_SYMBIAN diff --git a/src/gui/kernel/qguiplatformplugin.cpp b/src/gui/kernel/qguiplatformplugin.cpp index 16a2a2b..98b9c4a 100644 --- a/src/gui/kernel/qguiplatformplugin.cpp +++ b/src/gui/kernel/qguiplatformplugin.cpp @@ -152,7 +152,7 @@ QString QGuiPlatformPlugin::styleName() return QLatin1String("Windows"); // default style for Symbian without S60 #elif defined(Q_WS_X11) && defined(Q_OS_IRIX) return QLatin1String("SGI"); // default style for X11 on IRIX -#elif defined(Q_WS_QWS) || defined(Q_WS_LITE) +#elif defined(Q_WS_QWS) || defined(Q_WS_QPA) return QLatin1String("Plastique"); // default style for X11 and small devices #elif defined(Q_WS_MAC) return QLatin1String("Macintosh"); // default style for all Mac's diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 782cc1d..57e3a31 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -75,7 +75,7 @@ # include "qpaintengine.h" // for PorterDuff # include "private/qwindowsurface_qws_p.h" #endif -#if defined(Q_WS_LITE) +#if defined(Q_WS_QPA) #include "qplatformwindow_lite.h" #endif #include "qpainter.h" @@ -259,7 +259,7 @@ QWidgetPrivate::QWidgetPrivate(int version) , hasAlienChildren(0) , window_event(0) , qd_hd(0) -#elif defined (Q_WS_LITE) +#elif defined (Q_WS_QPA) , screenNumber(0) #endif { @@ -1214,7 +1214,7 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f) // programmer specified desktop widget xinfo = desktopWidget->d_func()->xinfo; } -#elif defined(Q_WS_LITE) +#elif defined(Q_WS_QPA) if (desktopWidget) { int screen = desktopWidget->d_func()->screenNumber; QPlatformIntegration *platform = QApplicationPrivate::platformIntegration(); @@ -1342,7 +1342,7 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow) flags |= Qt::Window; } -#ifndef Q_WS_LITE +#ifndef Q_WS_QPA if (QWidget *parent = parentWidget()) { #ifdef Q_WS_MAC if (testAttribute(Qt::WA_NativeWindow) == false) @@ -1363,7 +1363,7 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow) return; } } -#endif //Q_WS_LITE +#endif //Q_WS_QPA #ifdef QT3_SUPPORT if (flags & Qt::WStaticContents) @@ -1526,7 +1526,7 @@ QWidget::~QWidget() else if (!internalWinId() && isVisible()) { qApp->d_func()->sendSyntheticEnterLeave(this); } -#elif defined(Q_WS_QWS) || defined(Q_WS_LITE) +#elif defined(Q_WS_QWS) || defined(Q_WS_QPA) else if (isVisible()) { qApp->d_func()->sendSyntheticEnterLeave(this); } @@ -1660,7 +1660,7 @@ void QWidgetPrivate::createTLExtra() static int count = 0; qDebug() << "tlextra" << ++count; #endif -#if defined(Q_WS_LITE) +#if defined(Q_WS_QPA) x->platformWindow = 0; #endif } @@ -2426,7 +2426,7 @@ void QWidgetPrivate::createWinId(WId winid) #endif const bool forceNativeWindow = q->testAttribute(Qt::WA_NativeWindow); if (!q->testAttribute(Qt::WA_WState_Created) || (forceNativeWindow && !q->internalWinId())) { -#ifndef Q_WS_LITE +#ifndef Q_WS_QPA if (!q->isWindow()) { QWidget *parent = q->parentWidget(); QWidgetPrivate *pd = parent->d_func(); @@ -2456,7 +2456,7 @@ void QWidgetPrivate::createWinId(WId winid) } #else q->create(); -#endif //Q_WS_LITE +#endif //Q_WS_QPA } } @@ -5410,7 +5410,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP //actually send the paint event QPaintEvent e(toBePainted); QCoreApplication::sendSpontaneousEvent(q, &e); -#if !defined(Q_WS_MAC) && !defined(Q_WS_QWS) && !defined(Q_WS_LITE) +#if !defined(Q_WS_MAC) && !defined(Q_WS_QWS) && !defined(Q_WS_QPA) if (backingStore && !onScreen && !asRoot && (q->internalWinId() || !q->nativeParentWidget()->isWindow())) backingStore->markDirtyOnScreen(toBePainted, q, offset); #endif @@ -7448,7 +7448,7 @@ void QWidgetPrivate::hide_helper() // next bit tries to move the focus if the focus widget is now // hidden. if (wasVisible) { -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_MAC) || defined(Q_WS_LITE) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_MAC) || defined(Q_WS_QPA) qApp->d_func()->sendSyntheticEnterLeave(q); #endif @@ -7580,7 +7580,7 @@ void QWidget::setVisible(bool visible) d->show_helper(); -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_MAC) || defined(Q_WS_LITE) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_MAC) || defined(Q_WS_QPA) qApp->d_func()->sendSyntheticEnterLeave(this); #endif } @@ -7712,7 +7712,7 @@ void QWidgetPrivate::hideChildren(bool spontaneous) widget->d_func()->hide_sys(); } } -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_MAC) || defined(Q_WS_LITE) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_MAC) || defined(Q_WS_QPA) qApp->d_func()->sendSyntheticEnterLeave(widget); #endif #ifndef QT_NO_ACCESSIBILITY @@ -11937,7 +11937,7 @@ QWindowSurface *QWidget::windowSurface() const return bs ? bs->windowSurface : 0; } -#if defined(Q_WS_LITE) +#if defined(Q_WS_QPA) /*! \preliminary @@ -11970,7 +11970,7 @@ QPlatformWindow *QWidget::platformWindow() const return 0; } -#endif //defined(Q_WS_LITE) +#endif //defined(Q_WS_QPA) void QWidgetPrivate::getLayoutItemMargins(int *left, int *top, int *right, int *bottom) const { diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index 740f4ff..8e08ce5 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -628,7 +628,7 @@ public: void setWindowSurface(QWindowSurface *surface); QWindowSurface *windowSurface() const; -#if defined(Q_WS_LITE) +#if defined(Q_WS_QPA) void setPlatformWindow(QPlatformWindow *window); QPlatformWindow *platformWindow() const; friend class QDesktopScreenWidget; diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 91cd1c5..5274c3b 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -102,7 +102,7 @@ class QWSManager; #if defined(Q_WS_MAC) class QCoreGraphicsPaintEnginePrivate; #endif -#if defined(Q_WS_LITE) +#if defined(Q_WS_QPA) class QPlatformWindow; #endif class QPaintEngine; @@ -227,7 +227,7 @@ struct QTLWExtra { #endif #elif defined(Q_OS_SYMBIAN) uint inExpose : 1; // Prevents drawing recursion -#elif defined(Q_WS_LITE) +#elif defined(Q_WS_QPA) QPlatformWindow *platformWindow; #endif }; @@ -870,7 +870,7 @@ public: void updateCursor() const; #endif QScreen* getScreen() const; -#elif defined(Q_WS_LITE) +#elif defined(Q_WS_QPA) void setMaxWindowState_helper(); void setFullScreenSize_helper(); diff --git a/src/gui/kernel/qwindowdefs.h b/src/gui/kernel/qwindowdefs.h index ea3281f..1dc7203 100644 --- a/src/gui/kernel/qwindowdefs.h +++ b/src/gui/kernel/qwindowdefs.h @@ -131,11 +131,11 @@ QT_END_HEADER #endif // Q_WS_QWS -#if defined(Q_WS_LITE) +#if defined(Q_WS_QPA) typedef unsigned long WId; -#endif // Q_WS_LITE +#endif // Q_WS_QPA #if defined(Q_OS_SYMBIAN) class CCoeControl; diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index 590b9a8..a73d63f 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -286,7 +286,7 @@ bool QWidgetBackingStore::bltRect(const QRect &rect, int dx, int dy, QWidget *wi void QWidgetBackingStore::releaseBuffer() { if (windowSurface) -#if defined(Q_WS_LITE) +#if defined(Q_WS_QPA) windowSurface->resize(QSize()); #else windowSurface->setGeometry(QRect()); @@ -420,7 +420,7 @@ QRegion QWidgetBackingStore::dirtyRegion(QWidget *widget) const { const bool widgetDirty = widget && widget != tlw; const QRect tlwRect(topLevelRect()); -#if defined(Q_WS_LITE) +#if defined(Q_WS_QPA) const QRect surfaceGeometry(tlwRect.topLeft(), windowSurface->size()); #else const QRect surfaceGeometry(windowSurface->geometry()); @@ -475,7 +475,7 @@ QRegion QWidgetBackingStore::dirtyRegion(QWidget *widget) const QRegion QWidgetBackingStore::staticContents(QWidget *parent, const QRect &withinClipRect) const { if (!parent && tlw->testAttribute(Qt::WA_StaticContents)) { -#if defined(Q_WS_LITE) +#if defined(Q_WS_QPA) const QSize surfaceGeometry(windowSurface->size()); #else const QRect surfaceGeometry(windowSurface->geometry()); @@ -1183,7 +1183,7 @@ void QWidgetBackingStore::sync() const bool inTopLevelResize = tlwExtra->inTopLevelResize; const QRect tlwRect(topLevelRect()); -#ifdef Q_WS_LITE +#ifdef Q_WS_QPA const QRect surfaceGeometry(tlwRect.topLeft(), windowSurface->size()); #else const QRect surfaceGeometry(windowSurface->geometry()); @@ -1207,7 +1207,7 @@ void QWidgetBackingStore::sync() } } -#ifdef Q_WS_LITE +#ifdef Q_WS_QPA if (inTopLevelResize || surfaceGeometry.size() != tlwRect.size()) windowSurface->resize(tlwRect.size()); #else diff --git a/src/gui/painting/qgraphicssystem.cpp b/src/gui/painting/qgraphicssystem.cpp index c9866ae..9f00e2a 100644 --- a/src/gui/painting/qgraphicssystem.cpp +++ b/src/gui/painting/qgraphicssystem.cpp @@ -50,7 +50,7 @@ #ifdef Q_WS_MAC # include #endif -#ifdef Q_WS_LITE +#ifdef Q_WS_QPA # include #endif #ifdef Q_WS_S60 @@ -77,7 +77,7 @@ QPixmapData *QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixelType typ return new QRasterPixmapData(type); #elif defined(Q_WS_MAC) return new QMacPixmapData(type); -#elif defined(Q_WS_LITE) +#elif defined(Q_WS_QPA) return QApplicationPrivate::platformIntegration()->createPixmapData(type); #elif defined(Q_WS_S60) return new QS60PixmapData(type); diff --git a/src/gui/painting/qpaintdevice.cpp b/src/gui/painting/qpaintdevice.cpp index 0042a47..cde7bfa 100644 --- a/src/gui/painting/qpaintdevice.cpp +++ b/src/gui/painting/qpaintdevice.cpp @@ -59,7 +59,7 @@ QPaintDevice::~QPaintDevice() } -#ifndef Q_WS_LITE +#ifndef Q_WS_QPA int QPaintDevice::metric(PaintDeviceMetric) const { qWarning("QPaintDevice::metrics: Device has no metric information"); diff --git a/src/gui/painting/qpaintengine.h b/src/gui/painting/qpaintengine.h index 349ebeb..ddb6195 100644 --- a/src/gui/painting/qpaintengine.h +++ b/src/gui/painting/qpaintengine.h @@ -271,7 +271,7 @@ private: friend class QtopiaPrintEnginePrivate; friend class QProxyFontEngine; #endif -#ifdef Q_WS_LITE +#ifdef Q_WS_QPA friend class QProxyFontEngine; #endif friend class QPainter; diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 4fad0c6..97db24b 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -95,7 +95,7 @@ # include #elif defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) # include -#elif defined(Q_WS_LITE) +#elif defined(Q_WS_QPA) # include #endif @@ -3410,9 +3410,9 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte } #endif // Q_WS_QWS -#if (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) || defined(Q_WS_LITE)) && !defined(QT_NO_FREETYPE) +#if (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) || defined(Q_WS_QPA)) && !defined(QT_NO_FREETYPE) -#if (defined(Q_WS_QWS) || defined(Q_WS_LITE)) && !defined(QT_NO_QWS_QPF2) +#if (defined(Q_WS_QWS) || defined(Q_WS_QPA)) && !defined(QT_NO_QWS_QPF2) if (fontEngine->type() == QFontEngine::QPF2) { QFontEngine *renderingEngine = static_cast(fontEngine)->renderingEngine(); if (renderingEngine) diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index c667f84..c57db82 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -1620,7 +1620,7 @@ QT_END_INCLUDE_NAMESPACE QT_BEGIN_INCLUDE_NAMESPACE # include "qregion_win.cpp" QT_END_INCLUDE_NAMESPACE -#elif defined(Q_WS_QWS) || defined(Q_WS_LITE) +#elif defined(Q_WS_QWS) || defined(Q_WS_QPA) static QRegionPrivate qrp; QRegion::QRegionData QRegion::shared_empty = {Q_BASIC_ATOMIC_INITIALIZER(1), &qrp}; #endif @@ -4231,7 +4231,7 @@ QRect QRegion::boundingRect() const Returns true if \a rect is guaranteed to be fully contained in \a region. A false return value does not guarantee the opposite. */ -#if defined(Q_WS_QWS) || defined(Q_WS_LITE) +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) Q_GUI_EXPORT #endif bool qt_region_strictContains(const QRegion ®ion, const QRect &rect) diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h index 66a3e7f..463d9ef 100644 --- a/src/gui/painting/qregion.h +++ b/src/gui/painting/qregion.h @@ -59,7 +59,7 @@ QT_MODULE(Gui) template class QVector; class QVariant; -#if defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) struct QRegionPrivate; #endif @@ -163,7 +163,7 @@ public: #endif HIMutableShapeRef toHIMutableShape() const; static QRegion fromHIShapeRef(HIShapeRef shape); -#elif defined(Q_WS_QWS) || defined(Q_WS_LITE) +#elif defined(Q_WS_QWS) || defined(Q_WS_QPA) inline void *handle() const { return d->qt_rgn; } #endif #endif @@ -203,7 +203,7 @@ private: #elif defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA) mutable RgnHandle unused; // Here for binary compatability reasons. ### Qt 5 remove. #endif -#if defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) QRegionPrivate *qt_rgn; #endif }; diff --git a/src/gui/painting/qwindowsurface.cpp b/src/gui/painting/qwindowsurface.cpp index c42ead0..845cf6d 100644 --- a/src/gui/painting/qwindowsurface.cpp +++ b/src/gui/painting/qwindowsurface.cpp @@ -58,11 +58,11 @@ public: } QWidget *window; -#if !defined(Q_WS_LITE) +#if !defined(Q_WS_QPA) QRect geometry; #else QSize size; -#endif //Q_WS_LITE +#endif //Q_WS_QPA QRegion staticContents; QList bufferImages; uint staticContentsSupport : 1; @@ -157,7 +157,7 @@ void QWindowSurface::endPaint(const QRegion &) d_ptr->bufferImages.clear(); } -#if !defined(Q_WS_LITE) +#if !defined(Q_WS_QPA) /*! Sets the currently allocated area to be the given \a rect. @@ -188,7 +188,7 @@ QSize QWindowSurface::size() const { return d_ptr->size; } -#endif //Q_WS_LITE +#endif //Q_WS_QPA /*! Scrolls the given \a area \a dx pixels to the right and \a dy @@ -345,7 +345,7 @@ void QWindowSurface::setPartialUpdateSupport(bool enable) d_ptr->partialUpdateSupport = enable; } -#ifdef Q_WS_LITE +#ifdef Q_WS_QPA #define Q_EXPORT_SCROLLRECT Q_GUI_EXPORT #else #define Q_EXPORT_SCROLLRECT diff --git a/src/gui/painting/qwindowsurface_p.h b/src/gui/painting/qwindowsurface_p.h index 512cb97..da02f5a 100644 --- a/src/gui/painting/qwindowsurface_p.h +++ b/src/gui/painting/qwindowsurface_p.h @@ -80,7 +80,7 @@ public: // can be larger than just the offset from the top-level widget as there may also be window // decorations which are painted into the window surface. virtual void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) = 0; -#if !defined(Q_WS_LITE) +#if !defined(Q_WS_QPA) virtual void setGeometry(const QRect &rect); QRect geometry() const; #else diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index bfd4ee9..3861196 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -75,7 +75,7 @@ #ifdef Q_OS_SYMBIAN #include #endif -#ifdef Q_WS_LITE +#ifdef Q_WS_QPA #include #include #endif @@ -176,7 +176,7 @@ Q_GUI_EXPORT int qt_defaultDpiX() if (!subScreens.isEmpty()) screen = subScreens.at(0); dpi = qRound(screen->width() / (screen->physicalWidth() / qreal(25.4))); -#elif defined(Q_WS_LITE) +#elif defined(Q_WS_QPA) QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); if (pi) { QPlatformScreen *screen = QApplicationPrivate::platformIntegration()->screens().at(0); @@ -215,7 +215,7 @@ Q_GUI_EXPORT int qt_defaultDpiY() if (!subScreens.isEmpty()) screen = subScreens.at(0); dpi = qRound(screen->height() / (screen->physicalHeight() / qreal(25.4))); -#elif defined(Q_WS_LITE) +#elif defined(Q_WS_QPA) QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); if (pi) { QPlatformScreen *screen = QApplicationPrivate::platformIntegration()->screens().at(0); diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h index 0189281..583b4ff 100644 --- a/src/gui/text/qfont.h +++ b/src/gui/text/qfont.h @@ -46,7 +46,7 @@ #include #include -#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_LITE) +#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_QPA) typedef struct FT_FaceRec_* FT_Face; #endif @@ -233,7 +233,7 @@ public: #ifdef Q_WS_MAC quint32 macFontID() const; #endif -#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_LITE) +#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_QPA) FT_Face freetypeFace() const; #endif diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 853eb05..748b271 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -56,7 +56,7 @@ #include #include -#if (defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE) +#if (defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE) # include # include FT_TRUETYPE_TABLES_H #endif @@ -152,10 +152,10 @@ struct QtFontSize unsigned short count : 16; #endif // Q_WS_X11 -#if defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) QByteArray fileName; int fileIndex; -#endif // defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) +#endif // defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) unsigned short pixelSize : 16; }; @@ -231,14 +231,14 @@ struct QtFontStyle delete [] weightName; delete [] setwidthName; #endif -#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) while (count) { // bitfield count-- in while condition does not work correctly in mwccsym2 count--; #ifdef Q_WS_X11 free(pixelSizes[count].encodings); #endif -#if defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) pixelSizes[count].fileName.~QByteArray(); #endif } @@ -256,7 +256,7 @@ struct QtFontStyle const char *weightName; const char *setwidthName; #endif // Q_WS_X11 -#if defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) bool antialiased; #endif @@ -302,7 +302,7 @@ QtFontSize *QtFontStyle::pixelSize(unsigned short size, bool add) pixelSizes[count].count = 0; pixelSizes[count].encodings = 0; #endif -#if defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) new (&pixelSizes[count].fileName) QByteArray; pixelSizes[count].fileIndex = 0; #endif @@ -388,7 +388,7 @@ struct QtFontFamily fixedPitchComputed(false), #endif name(n), count(0), foundries(0) -#if defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) , bogusWritingSystems(false) #endif { @@ -428,7 +428,7 @@ struct QtFontFamily int count; QtFontFoundry **foundries; -#if defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) bool bogusWritingSystems; QStringList fallbackFamilies; #endif @@ -475,7 +475,7 @@ QtFontFoundry *QtFontFamily::foundry(const QString &f, bool create) // ### copied to tools/makeqpf/qpf2.cpp -#if ((defined(Q_WS_QWS) || defined(Q_WS_LITE)) && !defined(QT_NO_FREETYPE)) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) || (defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)) +#if ((defined(Q_WS_QWS) || defined(Q_WS_QPA)) && !defined(QT_NO_FREETYPE)) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) || (defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)) // see the Unicode subset bitfields in the MSDN docs static int requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2] = { @@ -617,7 +617,7 @@ class QFontDatabasePrivate public: QFontDatabasePrivate() : count(0), families(0), reregisterAppFonts(false) -#if defined(Q_WS_QWS) || defined(Q_WS_LITE) +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) , stream(0) #endif #if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) @@ -665,11 +665,11 @@ public: void invalidate(); -#if defined(Q_WS_QWS) || defined(Q_WS_LITE) +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) bool loadFromCache(const QString &fontPath); void addQPF2File(const QByteArray &file); #endif // Q_WS_QWS -#if defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) void addFont(const QString &familyname, const char *foundryname, int weight, bool italic, int pixelSize, const QByteArray &file, int fileIndex, bool antialiased, @@ -678,7 +678,7 @@ public: QStringList addTTFile(const QByteArray &file, const QByteArray &fontData = QByteArray()); #endif // QT_NO_FREETYPE #endif -#if defined(Q_WS_QWS) || defined (Q_WS_LITE) +#if defined(Q_WS_QWS) || defined (Q_WS_QPA) QDataStream *stream; QStringList fallbackFamilies; #elif defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) @@ -732,7 +732,7 @@ QtFontFamily *QFontDatabasePrivate::family(const QString &f, bool create) return families[pos]; } -#if defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) void QFontDatabasePrivate::addFont(const QString &familyname, const char *foundryname, int weight, bool italic, int pixelSize, const QByteArray &file, int fileIndex, bool antialiased, const QList &writingSystems) @@ -763,7 +763,7 @@ void QFontDatabasePrivate::addFont(const QString &familyname, const char *foundr size->fileName = file; size->fileIndex = fileIndex; -#if defined(Q_WS_QWS) || defined(Q_WS_LITE) +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) if (stream) { *stream << familyname << foundry->name << weight << quint8(italic) << pixelSize << file << fileIndex << quint8(antialiased); @@ -778,7 +778,7 @@ void QFontDatabasePrivate::addFont(const QString &familyname, const char *foundr } #endif -#if (defined(Q_WS_QWS) || defined (Q_WS_LITE) || defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE) +#if (defined(Q_WS_QWS) || defined (Q_WS_QPA) || defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE) QStringList QFontDatabasePrivate::addTTFile(const QByteArray &file, const QByteArray &fontData) { QStringList families; @@ -891,7 +891,7 @@ static const int scriptForWritingSystem[] = { }; -#if defined Q_WS_QWS || defined(Q_WS_LITE) || (defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG)) || defined(Q_WS_WIN) +#if defined Q_WS_QWS || defined(Q_WS_QPA) || (defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG)) || defined(Q_WS_WIN) static inline bool requiresOpenType(int writingSystem) { return ((writingSystem >= QFontDatabase::Syriac && writingSystem <= QFontDatabase::Sinhala) @@ -965,7 +965,7 @@ static void match(int script, const QFontDef &request, const QString &family_name, const QString &foundry_name, int force_encoding_id, QtFontDesc *desc, const QList &blacklistedFamilies = QList(), bool forceXLFD=false); -#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_LITE) +#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_QPA) static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDef *fontDef) { fontDef->family = desc.family->name; @@ -1053,7 +1053,7 @@ QT_BEGIN_INCLUDE_NAMESPACE # include "qfontdatabase_mac.cpp" #elif defined(Q_WS_WIN) # include "qfontdatabase_win.cpp" -#elif defined(Q_WS_QWS) || defined(Q_WS_LITE) +#elif defined(Q_WS_QWS) || defined(Q_WS_QPA) # include "qfontdatabase_qws.cpp" #elif defined(Q_OS_SYMBIAN) # include "qfontdatabase_s60.cpp" diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h index 1339884..6a09b77 100644 --- a/src/gui/text/qfontdatabase.h +++ b/src/gui/text/qfontdatabase.h @@ -152,7 +152,7 @@ public: private: static void createDatabase(); static void parseFontName(const QString &name, QString &foundry, QString &family); -#if defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) static QFontEngine *findFont(int script, const QFontPrivate *fp, const QFontDef &request); #endif static void load(const QFontPrivate *d, int script); diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 060d9bc..fdb86ce 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -742,7 +742,7 @@ QFontEngineGlyphCache *QFontEngine::glyphCache(void *key, QFontEngineGlyphCache: return 0; } -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) static inline QFixed kerning(int left, int right, const QFontEngine::KernPair *pairs, int numPairs) { uint left_right = (left << 16) + right; @@ -1157,7 +1157,7 @@ glyph_metrics_t QFontEngineBox::boundingBox(const QGlyphLayout &glyphs) return overall; } -#if defined(Q_WS_QWS) || defined(Q_WS_LITE) +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) void QFontEngineBox::draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &ti) { if (!ti.glyphs.numGlyphs) diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index 4e86c0d..372ad0c 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -271,7 +271,7 @@ private: QGlyphSet *loadTransformedGlyphSet(const QTransform &matrix); bool loadGlyphs(QGlyphSet *gs, glyph_t *glyphs, int num_glyphs, GlyphFormat format = Format_Render); -#if defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) virtual void draw(QPaintEngine * /*p*/, qreal /*x*/, qreal /*y*/, const QTextItemInt & /*si*/) {} #endif diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 3e39f89..fb4556b 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -235,7 +235,7 @@ public: bool symbol; mutable HB_FontRec hbFont; mutable HB_Face hbFace; -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_LITE) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) struct KernPair { uint left_right; QFixed adjust; diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp index f26b27b..39a160e 100644 --- a/src/gui/util/qdesktopservices.cpp +++ b/src/gui/util/qdesktopservices.cpp @@ -45,7 +45,7 @@ #include -#if defined(Q_WS_QWS) || defined(Q_WS_LITE) +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) #include "qdesktopservices_qws.cpp" #elif defined(Q_WS_X11) #include "qdesktopservices_x11.cpp" diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index a43f1d4..1241b7a 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -96,7 +96,7 @@ QT_BEGIN_NAMESPACE -#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) || defined(Q_WS_LITE) +#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) || defined(Q_WS_QPA) QGLExtensionFuncs QGLContextPrivate::qt_extensionFuncs; #endif @@ -1393,7 +1393,7 @@ QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags() } } -#ifdef Q_WS_LITE +#ifdef Q_WS_QPA hasOpenGL(); // ### I have no idea why this is needed here, but it makes things work for testlite #endif @@ -1642,7 +1642,7 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format) # endif vi = 0; #endif -#if defined(Q_WS_LITE) +#if defined(Q_WS_QPA) platformContext = 0; #endif #if !defined(QT_NO_EGL) @@ -4049,7 +4049,7 @@ void QGLWidget::resizeOverlayGL(int, int) /*! \fn bool QGLWidget::event(QEvent *e) \reimp */ -#if !defined(Q_OS_WINCE) && !defined(Q_WS_QWS) && !defined(Q_WS_LITE) +#if !defined(Q_OS_WINCE) && !defined(Q_WS_QWS) && !defined(Q_WS_QPA) bool QGLWidget::event(QEvent *e) { Q_D(QGLWidget); diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index a1be68f..6c1e6aa 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -68,7 +68,7 @@ #include #endif -#if defined(Q_WS_LITE) +#if defined(Q_WS_QPA) #include #endif @@ -359,7 +359,7 @@ public: EGLSurface eglSurfaceForDevice() const; #endif -#if defined(Q_WS_LITE) +#if defined(Q_WS_QPA) QPlatformGLContext *platformContext; #elif defined(Q_WS_X11) || defined(Q_WS_MAC) void* cx; @@ -424,7 +424,7 @@ public: static inline QGLExtensionFuncs& extensionFuncs(const QGLContext *ctx) { return ctx->d_ptr->group->extensionFuncs(); } #endif -#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) || defined(Q_WS_LITE) +#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) || defined(Q_WS_QPA) static QGLExtensionFuncs qt_extensionFuncs; static inline QGLExtensionFuncs& extensionFuncs(const QGLContext *) { return qt_extensionFuncs; } #endif diff --git a/src/opengl/qglpixelbuffer_p.h b/src/opengl/qglpixelbuffer_p.h index a7f4159..69678d0 100644 --- a/src/opengl/qglpixelbuffer_p.h +++ b/src/opengl/qglpixelbuffer_p.h @@ -197,10 +197,10 @@ public: EGLSurface pbuf; QEglContext *ctx; int textureFormat; -#elif defined(Q_WS_LITE) - // Stubs - int pbuf; - int ctx; +#elif defined(Q_WS_QPA) + //stubs + void *pbuf; + void *ctx; #endif }; diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 98455e1..b7629c6 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -419,7 +419,7 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & QWidget *parent = widget->internalWinId() ? widget : widget->nativeParentWidget(); Q_ASSERT(parent); -#if !defined(Q_WS_LITE) +#if !defined(Q_WS_QPA) if (!geometry().isValid()) return; #else @@ -648,7 +648,7 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & } -#if !defined(Q_WS_LITE) +#if !defined(Q_WS_QPA) void QGLWindowSurface::setGeometry(const QRect &rect) { QWindowSurface::setGeometry(rect); @@ -667,7 +667,7 @@ void QGLWindowSurface::updateGeometry() { return; d_ptr->geometry_updated = false; -#ifdef Q_WS_LITE +#ifdef Q_WS_QPA QSize surfSize = size(); #else QSize surfSize = geometry().size(); diff --git a/src/opengl/qwindowsurface_gl_p.h b/src/opengl/qwindowsurface_gl_p.h index 6bff109..10c8658 100644 --- a/src/opengl/qwindowsurface_gl_p.h +++ b/src/opengl/qwindowsurface_gl_p.h @@ -87,7 +87,7 @@ public: QPaintDevice *paintDevice(); void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); -#if !defined(Q_WS_LITE) +#if !defined(Q_WS_QPA) void setGeometry(const QRect &rect); #else virtual void resize(const QSize &size); diff --git a/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp b/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp index 695050e..e2b9f99 100644 --- a/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp +++ b/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp @@ -98,7 +98,7 @@ QPaintDevice *QTraceWindowSurface::paintDevice() { if (!buffer) { buffer = new QPaintBuffer; -#ifdef Q_WS_LITE +#ifdef Q_WS_QPA buffer->setBoundingRect(QRect(QPoint(), size())); #else buffer->setBoundingRect(geometry()); diff --git a/tests/auto/qaction/tst_qaction.cpp b/tests/auto/qaction/tst_qaction.cpp index 26a28e7..66a1039 100644 --- a/tests/auto/qaction/tst_qaction.cpp +++ b/tests/auto/qaction/tst_qaction.cpp @@ -242,7 +242,7 @@ void tst_QAction::setStandardKeys() QList expected; #if defined(Q_WS_MAC) || defined(Q_OS_SYMBIAN) expected << QKeySequence("CTRL+C"); -#elif defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_LITE) +#elif defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_QPA) expected << QKeySequence("CTRL+C") << QKeySequence("CTRL+INSERT"); #else expected << QKeySequence("CTRL+C") << QKeySequence("F16") << QKeySequence("CTRL+INSERT"); -- cgit v0.12 From 4e27ff09ce4fae4b0af584e1dedb6fa189c6e3d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 24 Jun 2010 11:07:29 +0200 Subject: Renamed files from *_lite* to *_qpa* --- src/gui/egl/egl.pri | 2 +- src/gui/egl/qegl_lite.cpp | 111 --- src/gui/egl/qegl_qpa.cpp | 111 +++ src/gui/image/image.pri | 2 +- src/gui/image/qpixmap_lite.cpp | 49 -- src/gui/image/qpixmap_qpa.cpp | 49 ++ src/gui/kernel/kernel.pri | 52 +- src/gui/kernel/qapplication_lite.cpp | 882 --------------------- src/gui/kernel/qapplication_p.h | 2 +- src/gui/kernel/qapplication_qpa.cpp | 882 +++++++++++++++++++++ src/gui/kernel/qclipboard_lite.cpp | 163 ---- src/gui/kernel/qclipboard_qpa.cpp | 163 ++++ src/gui/kernel/qcursor_lite.cpp | 127 --- src/gui/kernel/qcursor_qpa.cpp | 127 +++ src/gui/kernel/qdesktopwidget_lite.cpp | 180 ----- src/gui/kernel/qdesktopwidget_lite_p.h | 76 -- src/gui/kernel/qdesktopwidget_qpa.cpp | 180 +++++ src/gui/kernel/qdesktopwidget_qpa_p.h | 76 ++ src/gui/kernel/qeventdispatcher_glib_lite.cpp | 139 ---- src/gui/kernel/qeventdispatcher_glib_lite_p.h | 88 -- src/gui/kernel/qeventdispatcher_glib_qpa.cpp | 139 ++++ src/gui/kernel/qeventdispatcher_glib_qpa_p.h | 88 ++ src/gui/kernel/qeventdispatcher_lite.cpp | 144 ---- src/gui/kernel/qeventdispatcher_lite_p.h | 86 -- src/gui/kernel/qeventdispatcher_qpa.cpp | 144 ++++ src/gui/kernel/qeventdispatcher_qpa_p.h | 86 ++ src/gui/kernel/qgenericplugin_lite.cpp | 112 --- src/gui/kernel/qgenericplugin_lite.h | 84 -- src/gui/kernel/qgenericplugin_qpa.cpp | 112 +++ src/gui/kernel/qgenericplugin_qpa.h | 84 ++ src/gui/kernel/qgenericpluginfactory_lite.cpp | 115 --- src/gui/kernel/qgenericpluginfactory_lite.h | 67 -- src/gui/kernel/qgenericpluginfactory_qpa.cpp | 115 +++ src/gui/kernel/qgenericpluginfactory_qpa.h | 67 ++ src/gui/kernel/qplatformglcontext_lite.h | 71 -- src/gui/kernel/qplatformglcontext_qpa.h | 71 ++ src/gui/kernel/qplatformintegration_lite.cpp | 64 -- src/gui/kernel/qplatformintegration_lite.h | 78 -- src/gui/kernel/qplatformintegration_qpa.cpp | 64 ++ src/gui/kernel/qplatformintegration_qpa.h | 78 ++ .../kernel/qplatformintegrationfactory_lite.cpp | 89 --- .../kernel/qplatformintegrationfactory_lite_p.h | 78 -- src/gui/kernel/qplatformintegrationfactory_qpa.cpp | 89 +++ src/gui/kernel/qplatformintegrationfactory_qpa_p.h | 78 ++ src/gui/kernel/qplatformintegrationplugin_lite.cpp | 55 -- src/gui/kernel/qplatformintegrationplugin_lite.h | 92 --- src/gui/kernel/qplatformintegrationplugin_qpa.cpp | 55 ++ src/gui/kernel/qplatformintegrationplugin_qpa.h | 92 +++ src/gui/kernel/qplatformscreen_lite.cpp | 66 -- src/gui/kernel/qplatformscreen_lite.h | 74 -- src/gui/kernel/qplatformscreen_qpa.cpp | 66 ++ src/gui/kernel/qplatformscreen_qpa.h | 74 ++ src/gui/kernel/qplatformwindow_lite.cpp | 85 -- src/gui/kernel/qplatformwindow_lite.h | 90 --- src/gui/kernel/qplatformwindow_qpa.cpp | 85 ++ src/gui/kernel/qplatformwindow_qpa.h | 90 +++ src/gui/kernel/qsound_lite.cpp | 74 -- src/gui/kernel/qsound_qpa.cpp | 74 ++ src/gui/kernel/qwidget.cpp | 2 +- src/gui/kernel/qwidget_lite.cpp | 809 ------------------- src/gui/kernel/qwidget_qpa.cpp | 809 +++++++++++++++++++ src/gui/painting/painting.pri | 8 +- src/gui/painting/qcolormap_lite.cpp | 231 ------ src/gui/painting/qcolormap_qpa.cpp | 231 ++++++ src/gui/painting/qgraphicssystemcursor_lite.cpp | 664 ---------------- src/gui/painting/qgraphicssystemcursor_lite.h | 97 --- src/gui/painting/qgraphicssystemcursor_qpa.cpp | 664 ++++++++++++++++ src/gui/painting/qgraphicssystemcursor_qpa.h | 97 +++ src/gui/painting/qpaintdevice_lite.cpp | 68 -- src/gui/painting/qpaintdevice_qpa.cpp | 68 ++ src/gui/text/qfont.cpp | 2 +- src/opengl/opengl.pro | 2 +- src/opengl/qgl_lite.cpp | 253 ------ src/opengl/qgl_qpa.cpp | 253 ++++++ 74 files changed, 5497 insertions(+), 5497 deletions(-) delete mode 100644 src/gui/egl/qegl_lite.cpp create mode 100644 src/gui/egl/qegl_qpa.cpp delete mode 100644 src/gui/image/qpixmap_lite.cpp create mode 100644 src/gui/image/qpixmap_qpa.cpp delete mode 100644 src/gui/kernel/qapplication_lite.cpp create mode 100644 src/gui/kernel/qapplication_qpa.cpp delete mode 100644 src/gui/kernel/qclipboard_lite.cpp create mode 100644 src/gui/kernel/qclipboard_qpa.cpp delete mode 100644 src/gui/kernel/qcursor_lite.cpp create mode 100644 src/gui/kernel/qcursor_qpa.cpp delete mode 100644 src/gui/kernel/qdesktopwidget_lite.cpp delete mode 100644 src/gui/kernel/qdesktopwidget_lite_p.h create mode 100644 src/gui/kernel/qdesktopwidget_qpa.cpp create mode 100644 src/gui/kernel/qdesktopwidget_qpa_p.h delete mode 100644 src/gui/kernel/qeventdispatcher_glib_lite.cpp delete mode 100644 src/gui/kernel/qeventdispatcher_glib_lite_p.h create mode 100644 src/gui/kernel/qeventdispatcher_glib_qpa.cpp create mode 100644 src/gui/kernel/qeventdispatcher_glib_qpa_p.h delete mode 100644 src/gui/kernel/qeventdispatcher_lite.cpp delete mode 100644 src/gui/kernel/qeventdispatcher_lite_p.h create mode 100644 src/gui/kernel/qeventdispatcher_qpa.cpp create mode 100644 src/gui/kernel/qeventdispatcher_qpa_p.h delete mode 100644 src/gui/kernel/qgenericplugin_lite.cpp delete mode 100644 src/gui/kernel/qgenericplugin_lite.h create mode 100644 src/gui/kernel/qgenericplugin_qpa.cpp create mode 100644 src/gui/kernel/qgenericplugin_qpa.h delete mode 100644 src/gui/kernel/qgenericpluginfactory_lite.cpp delete mode 100644 src/gui/kernel/qgenericpluginfactory_lite.h create mode 100644 src/gui/kernel/qgenericpluginfactory_qpa.cpp create mode 100644 src/gui/kernel/qgenericpluginfactory_qpa.h delete mode 100644 src/gui/kernel/qplatformglcontext_lite.h create mode 100644 src/gui/kernel/qplatformglcontext_qpa.h delete mode 100644 src/gui/kernel/qplatformintegration_lite.cpp delete mode 100644 src/gui/kernel/qplatformintegration_lite.h create mode 100644 src/gui/kernel/qplatformintegration_qpa.cpp create mode 100644 src/gui/kernel/qplatformintegration_qpa.h delete mode 100644 src/gui/kernel/qplatformintegrationfactory_lite.cpp delete mode 100644 src/gui/kernel/qplatformintegrationfactory_lite_p.h create mode 100644 src/gui/kernel/qplatformintegrationfactory_qpa.cpp create mode 100644 src/gui/kernel/qplatformintegrationfactory_qpa_p.h delete mode 100644 src/gui/kernel/qplatformintegrationplugin_lite.cpp delete mode 100644 src/gui/kernel/qplatformintegrationplugin_lite.h create mode 100644 src/gui/kernel/qplatformintegrationplugin_qpa.cpp create mode 100644 src/gui/kernel/qplatformintegrationplugin_qpa.h delete mode 100644 src/gui/kernel/qplatformscreen_lite.cpp delete mode 100644 src/gui/kernel/qplatformscreen_lite.h create mode 100644 src/gui/kernel/qplatformscreen_qpa.cpp create mode 100644 src/gui/kernel/qplatformscreen_qpa.h delete mode 100644 src/gui/kernel/qplatformwindow_lite.cpp delete mode 100644 src/gui/kernel/qplatformwindow_lite.h create mode 100644 src/gui/kernel/qplatformwindow_qpa.cpp create mode 100644 src/gui/kernel/qplatformwindow_qpa.h delete mode 100644 src/gui/kernel/qsound_lite.cpp create mode 100644 src/gui/kernel/qsound_qpa.cpp delete mode 100644 src/gui/kernel/qwidget_lite.cpp create mode 100644 src/gui/kernel/qwidget_qpa.cpp delete mode 100644 src/gui/painting/qcolormap_lite.cpp create mode 100644 src/gui/painting/qcolormap_qpa.cpp delete mode 100644 src/gui/painting/qgraphicssystemcursor_lite.cpp delete mode 100644 src/gui/painting/qgraphicssystemcursor_lite.h create mode 100644 src/gui/painting/qgraphicssystemcursor_qpa.cpp create mode 100644 src/gui/painting/qgraphicssystemcursor_qpa.h delete mode 100644 src/gui/painting/qpaintdevice_lite.cpp create mode 100644 src/gui/painting/qpaintdevice_qpa.cpp delete mode 100644 src/opengl/qgl_lite.cpp create mode 100644 src/opengl/qgl_qpa.cpp diff --git a/src/gui/egl/egl.pri b/src/gui/egl/egl.pri index 253c091..476f1a3 100644 --- a/src/gui/egl/egl.pri +++ b/src/gui/egl/egl.pri @@ -29,7 +29,7 @@ contains(QT_CONFIG, egl): { SOURCES += egl/qegl_qws.cpp } else { embedded_lite { - SOURCES += egl/qegl_lite.cpp + SOURCES += egl/qegl_qpa.cpp } else { symbian { SOURCES += egl/qegl_symbian.cpp diff --git a/src/gui/egl/qegl_lite.cpp b/src/gui/egl/qegl_lite.cpp deleted file mode 100644 index 10caf46..0000000 --- a/src/gui/egl/qegl_lite.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include "qeglcontext_p.h" - -#if !defined(QT_NO_EGL) - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -EGLNativeDisplayType QEgl::nativeDisplay() -{ - return EGLNativeDisplayType(EGL_DEFAULT_DISPLAY); -} - -EGLNativeWindowType QEgl::nativeWindow(QWidget* widget) -{ - return (EGLNativeWindowType)(widget->winId()); -} - -EGLNativePixmapType QEgl::nativePixmap(QPixmap* pixmap) -{ - Q_UNUSED(pixmap); - return 0; -} - -//EGLDisplay QEglContext::display() -//{ -// return eglGetDisplay(EGLNativeDisplayType(EGL_DEFAULT_DISPLAY)); -//} - -static QPlatformScreen *screenForDevice(QPaintDevice *device) -{ - QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); - - QList screens = pi->screens(); - - int screenNumber; - if (device && device->devType() == QInternal::Widget) - screenNumber = qApp->desktop()->screenNumber(static_cast(device)); - else - screenNumber = 0; - if (screenNumber < 0 || screenNumber >= screens.size()) - return 0; - return screens[screenNumber]; -} - -// Set pixel format and other properties based on a paint device. -void QEglProperties::setPaintDeviceFormat(QPaintDevice *dev) -{ - if (!dev) - return; - - // Find the QGLScreen for this paint device. - QPlatformScreen *screen = screenForDevice(dev); - if (!screen) - return; - int devType = dev->devType(); - if (devType == QInternal::Image) - setPixelFormat(static_cast(dev)->format()); - else - setPixelFormat(screen->format()); -} - -QT_END_NAMESPACE - -#endif // !QT_NO_EGL diff --git a/src/gui/egl/qegl_qpa.cpp b/src/gui/egl/qegl_qpa.cpp new file mode 100644 index 0000000..10caf46 --- /dev/null +++ b/src/gui/egl/qegl_qpa.cpp @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include "qeglcontext_p.h" + +#if !defined(QT_NO_EGL) + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +EGLNativeDisplayType QEgl::nativeDisplay() +{ + return EGLNativeDisplayType(EGL_DEFAULT_DISPLAY); +} + +EGLNativeWindowType QEgl::nativeWindow(QWidget* widget) +{ + return (EGLNativeWindowType)(widget->winId()); +} + +EGLNativePixmapType QEgl::nativePixmap(QPixmap* pixmap) +{ + Q_UNUSED(pixmap); + return 0; +} + +//EGLDisplay QEglContext::display() +//{ +// return eglGetDisplay(EGLNativeDisplayType(EGL_DEFAULT_DISPLAY)); +//} + +static QPlatformScreen *screenForDevice(QPaintDevice *device) +{ + QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); + + QList screens = pi->screens(); + + int screenNumber; + if (device && device->devType() == QInternal::Widget) + screenNumber = qApp->desktop()->screenNumber(static_cast(device)); + else + screenNumber = 0; + if (screenNumber < 0 || screenNumber >= screens.size()) + return 0; + return screens[screenNumber]; +} + +// Set pixel format and other properties based on a paint device. +void QEglProperties::setPaintDeviceFormat(QPaintDevice *dev) +{ + if (!dev) + return; + + // Find the QGLScreen for this paint device. + QPlatformScreen *screen = screenForDevice(dev); + if (!screen) + return; + int devType = dev->devType(); + if (devType == QInternal::Image) + setPixelFormat(static_cast(dev)->format()); + else + setPixelFormat(screen->format()); +} + +QT_END_NAMESPACE + +#endif // !QT_NO_EGL diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index 1df66a0..064ba32 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -64,7 +64,7 @@ embedded { SOURCES += image/qpixmap_qws.cpp } embedded_lite { - SOURCES += image/qpixmap_lite.cpp + SOURCES += image/qpixmap_qpa.cpp } x11 { HEADERS += image/qpixmap_x11_p.h diff --git a/src/gui/image/qpixmap_lite.cpp b/src/gui/image/qpixmap_lite.cpp deleted file mode 100644 index 61be216..0000000 --- a/src/gui/image/qpixmap_lite.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) -{ - return QApplicationPrivate::platformIntegration()->grabWindow(window, x, y, w, h); -} diff --git a/src/gui/image/qpixmap_qpa.cpp b/src/gui/image/qpixmap_qpa.cpp new file mode 100644 index 0000000..61be216 --- /dev/null +++ b/src/gui/image/qpixmap_qpa.cpp @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include + +QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) +{ + return QApplicationPrivate::platformIntegration()->grabWindow(window, x, y, w, h); +} diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index f849ad7..dcdfd04 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -51,7 +51,7 @@ HEADERS += \ kernel/qsoftkeymanager_p.h \ kernel/qsoftkeymanager_common_p.h \ kernel/qguiplatformplugin_p.h \ - kernel/qdesktopwidget_lite_p.h + kernel/qdesktopwidget_qpa_p.h SOURCES += \ kernel/qaction.cpp \ @@ -200,41 +200,41 @@ embedded { embedded_lite { HEADERS += \ - kernel/qgenericpluginfactory_lite.h \ - kernel/qgenericplugin_lite.h \ - kernel/qeventdispatcher_lite_p.h \ + kernel/qgenericpluginfactory_qpa.h \ + kernel/qgenericplugin_qpa.h \ + kernel/qeventdispatcher_qpa_p.h \ kernel/qwindowsysteminterface.h \ - kernel/qplatformintegration_lite.h \ - kernel/qplatformscreen_lite.h \ - kernel/qplatformintegrationfactory_lite_p.h \ - kernel/qplatformintegrationplugin_lite.h \ - kernel/qplatformwindow_lite.h \ - kernel/qplatformglcontext_lite.h + kernel/qplatformintegration_qpa.h \ + kernel/qplatformscreen_qpa.h \ + kernel/qplatformintegrationfactory_qpa_p.h \ + kernel/qplatformintegrationplugin_qpa.h \ + kernel/qplatformwindow_qpa.h \ + kernel/qplatformglcontext_qpa.h SOURCES += \ - kernel/qapplication_lite.cpp \ - kernel/qclipboard_lite.cpp \ - kernel/qcursor_lite.cpp \ + kernel/qapplication_qpa.cpp \ + kernel/qclipboard_qpa.cpp \ + kernel/qcursor_qpa.cpp \ kernel/qdnd_qws.cpp \ - kernel/qdesktopwidget_lite.cpp \ - kernel/qgenericpluginfactory_lite.cpp \ - kernel/qgenericplugin_lite.cpp \ + kernel/qdesktopwidget_qpa.cpp \ + kernel/qgenericpluginfactory_qpa.cpp \ + kernel/qgenericplugin_qpa.cpp \ kernel/qkeymapper_qws.cpp \ - kernel/qsound_lite.cpp \ - kernel/qwidget_lite.cpp \ - kernel/qeventdispatcher_lite.cpp \ + kernel/qsound_qpa.cpp \ + kernel/qwidget_qpa.cpp \ + kernel/qeventdispatcher_qpa.cpp \ kernel/qwindowsysteminterface.cpp \ - kernel/qplatformintegration_lite.cpp \ - kernel/qplatformscreen_lite.cpp \ - kernel/qplatformintegrationfactory_lite.cpp \ - kernel/qplatformintegrationplugin_lite.cpp \ - kernel/qplatformwindow_lite.cpp + kernel/qplatformintegration_qpa.cpp \ + kernel/qplatformscreen_qpa.cpp \ + kernel/qplatformintegrationfactory_qpa.cpp \ + kernel/qplatformintegrationplugin_qpa.cpp \ + kernel/qplatformwindow_qpa.cpp contains(QT_CONFIG, glib) { SOURCES += \ - kernel/qeventdispatcher_glib_lite.cpp + kernel/qeventdispatcher_glib_qpa.cpp HEADERS += \ - kernel/qeventdispatcher_glib_lite_p.h + kernel/qeventdispatcher_glib_qpa_p.h QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB LIBS_PRIVATE +=$$QT_LIBS_GLIB } diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp deleted file mode 100644 index 9c36ef5..0000000 --- a/src/gui/kernel/qapplication_lite.cpp +++ /dev/null @@ -1,882 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qapplication_p.h" -#include "qcolormap.h" -#include "qpixmapcache.h" -#if !defined(QT_NO_GLIB) -#include "qeventdispatcher_glib_lite_p.h" -#endif -#include "qeventdispatcher_lite_p.h" -#ifndef QT_NO_CURSOR -#include "private/qcursor_p.h" -#endif - -#include "private/qwidget_p.h" - -#include "qgenericpluginfactory_lite.h" -#include "qplatformintegrationfactory_lite_p.h" -#include - -#include -#include -#include -#include -#include - -#include "qdesktopwidget_lite_p.h" - -QT_BEGIN_NAMESPACE - -static QString appName; -static const char *appFont = 0; // application font - -QWidget *qt_button_down = 0; // widget got last button-down - -static bool app_do_modal = false; -extern QWidgetList *qt_modal_stack; // stack of modal widgets - -int qt_last_x = 0; -int qt_last_y = 0; -QPointer qt_last_mouse_receiver = 0; - -static Qt::KeyboardModifiers modifiers = Qt::NoModifier; -static Qt::MouseButtons buttons = Qt::NoButton; -static ulong mousePressTime; -static Qt::MouseButton mousePressButton = Qt::NoButton; -static int mousePressX; -static int mousePressY; -static int mouse_double_click_distance = 5; - -void QApplicationPrivate::processUserEvent(QWindowSystemInterface::UserEvent *e) -{ - switch(e->type) { - case QEvent::MouseButtonDblClick: // if mouse event, calculate appropriate widget and local coordinates - case QEvent::MouseButtonPress: - case QEvent::MouseButtonRelease: - case QEvent::MouseMove: - QApplicationPrivate::processMouseEvent(static_cast(e)); - break; - case QEvent::Wheel: - QApplicationPrivate::processWheelEvent(static_cast(e)); - break; - case QEvent::KeyPress: - case QEvent::KeyRelease: - QApplicationPrivate::processKeyEvent(static_cast(e)); - break; - case QEvent::TouchBegin: - case QEvent::TouchUpdate: - case QEvent::TouchEnd: - QApplicationPrivate::processTouchEvent(static_cast(e)); - break; - default: - qWarning() << "Unknown user input event type:" << e->type; - break; - } -} - -QString QApplicationPrivate::appName() const -{ - return QT_PREPEND_NAMESPACE(appName); -} - -void QApplicationPrivate::createEventDispatcher() -{ - Q_Q(QApplication); -#if !defined(QT_NO_GLIB) - if (qgetenv("QT_NO_GLIB").isEmpty() && QEventDispatcherGlib::versionSupported()) - eventDispatcher = new QLiteEventDispatcherGlib(q); - else -#endif - eventDispatcher = new QEventDispatcherLite(q); -} - -static bool qt_try_modal(QWidget *widget, QEvent::Type type) -{ - QWidget * top = 0; - - if (QApplicationPrivate::tryModalHelper(widget, &top)) - return true; - - bool block_event = false; - bool paint_event = false; - - switch (type) { -#if 0 - case QEvent::Focus: - if (!static_cast(event)->simpleData.get_focus) - break; - // drop through -#endif - case QEvent::MouseButtonPress: // disallow mouse/key events - case QEvent::MouseButtonRelease: - case QEvent::MouseMove: - case QEvent::KeyPress: - case QEvent::KeyRelease: - block_event = true; - break; - default: - break; - } - - if ((block_event || paint_event) && top->parentWidget() == 0) - top->raise(); - - return !block_event; -} - - - -void QApplicationPrivate::enterModal_sys(QWidget *widget) -{ - if (!qt_modal_stack) - qt_modal_stack = new QWidgetList; - qt_modal_stack->insert(0, widget); - app_do_modal = true; -} - -void QApplicationPrivate::leaveModal_sys(QWidget *widget ) -{ - if (qt_modal_stack && qt_modal_stack->removeAll(widget)) { - if (qt_modal_stack->isEmpty()) { - delete qt_modal_stack; - qt_modal_stack = 0; - } - } - app_do_modal = qt_modal_stack != 0; -} - -bool QApplicationPrivate::modalState() -{ - return app_do_modal; -} - -void QApplicationPrivate::closePopup(QWidget *popup) -{ - Q_Q(QApplication); - if (!popupWidgets) - return; - popupWidgets->removeAll(popup); - -//### -// if (popup == qt_popup_down) { -// qt_button_down = 0; -// qt_popup_down = 0; -// } - - if (QApplicationPrivate::popupWidgets->count() == 0) { // this was the last popup - delete QApplicationPrivate::popupWidgets; - QApplicationPrivate::popupWidgets = 0; - - //### replay mouse event? - - //### transfer/release mouse grab - - //### transfer/release keyboard grab - - //give back focus - - if (active_window) { - if (QWidget *fw = active_window->focusWidget()) { - if (fw != QApplication::focusWidget()) { - fw->setFocus(Qt::PopupFocusReason); - } else { - QFocusEvent e(QEvent::FocusIn, Qt::PopupFocusReason); - q->sendEvent(fw, &e); - } - } - } - - } else { - // A popup was closed, so the previous popup gets the focus. - - QWidget* aw = QApplicationPrivate::popupWidgets->last(); - if (QWidget *fw = aw->focusWidget()) - fw->setFocus(Qt::PopupFocusReason); - - //### regrab the keyboard and mouse in case 'popup' lost the grab - - - } - -} - -static int openPopupCount = 0; -void QApplicationPrivate::openPopup(QWidget *popup) -{ - openPopupCount++; - if (!popupWidgets) { // create list - popupWidgets = new QWidgetList; - - /* only grab if you are the first/parent popup */ - //#### ->grabMouse(popup,true); - //#### ->grabKeyboard(popup,true); - //### popupGrabOk = true; - } - popupWidgets->append(popup); // add to end of list - - // popups are not focus-handled by the window system (the first - // popup grabbed the keyboard), so we have to do that manually: A - // new popup gets the focus - if (popup->focusWidget()) { - popup->focusWidget()->setFocus(Qt::PopupFocusReason); - } else if (popupWidgets->count() == 1) { // this was the first popup - if (QWidget *fw = QApplication::focusWidget()) { - QFocusEvent e(QEvent::FocusOut, Qt::PopupFocusReason); - QApplication::sendEvent(fw, &e); - } - } -} - -void QApplicationPrivate::initializeMultitouch_sys() -{ -} - -void QApplicationPrivate::cleanupMultitouch_sys() -{ -} - -void QApplicationPrivate::initializeWidgetPaletteHash() -{ -} - -void QApplication::setCursorFlashTime(int msecs) -{ - QApplicationPrivate::cursor_flash_time = msecs; -} - -int QApplication::cursorFlashTime() -{ - return QApplicationPrivate::cursor_flash_time; -} - -void QApplication::setDoubleClickInterval(int ms) -{ - QApplicationPrivate::mouse_double_click_time = ms; -} - -int QApplication::doubleClickInterval() -{ - return QApplicationPrivate::mouse_double_click_time; -} - -void QApplication::setKeyboardInputInterval(int ms) -{ - QApplicationPrivate::keyboard_input_time = ms; -} - -int QApplication::keyboardInputInterval() -{ - return QApplicationPrivate::keyboard_input_time; -} - -#ifndef QT_NO_WHEELEVENT -void QApplication::setWheelScrollLines(int lines) -{ - QApplicationPrivate::wheel_scroll_lines = lines; -} - -int QApplication::wheelScrollLines() -{ - return QApplicationPrivate::wheel_scroll_lines; -} -#endif - -void QApplication::setEffectEnabled(Qt::UIEffect effect, bool enable) -{ - switch (effect) { - case Qt::UI_AnimateMenu: - QApplicationPrivate::animate_menu = enable; - break; - case Qt::UI_FadeMenu: - if (enable) - QApplicationPrivate::animate_menu = true; - QApplicationPrivate::fade_menu = enable; - break; - case Qt::UI_AnimateCombo: - QApplicationPrivate::animate_combo = enable; - break; - case Qt::UI_AnimateTooltip: - QApplicationPrivate::animate_tooltip = enable; - break; - case Qt::UI_FadeTooltip: - if (enable) - QApplicationPrivate::animate_tooltip = true; - QApplicationPrivate::fade_tooltip = enable; - break; - case Qt::UI_AnimateToolBox: - QApplicationPrivate::animate_toolbox = enable; - break; - default: - QApplicationPrivate::animate_ui = enable; - break; - } -} - -bool QApplication::isEffectEnabled(Qt::UIEffect effect) -{ - if (QColormap::instance().depth() < 16 || !QApplicationPrivate::animate_ui) - return false; - - switch(effect) { - case Qt::UI_AnimateMenu: - return QApplicationPrivate::animate_menu; - case Qt::UI_FadeMenu: - return QApplicationPrivate::fade_menu; - case Qt::UI_AnimateCombo: - return QApplicationPrivate::animate_combo; - case Qt::UI_AnimateTooltip: - return QApplicationPrivate::animate_tooltip; - case Qt::UI_FadeTooltip: - return QApplicationPrivate::fade_tooltip; - case Qt::UI_AnimateToolBox: - return QApplicationPrivate::animate_toolbox; - default: - return QApplicationPrivate::animate_ui; - } -} - -#ifndef QT_NO_CURSOR -void QApplication::setOverrideCursor(const QCursor &cursor) -{ - qApp->d_func()->cursor_list.prepend(cursor); - qt_lite_set_cursor(0, false); -} - -void QApplication::restoreOverrideCursor() -{ - if (qApp->d_func()->cursor_list.isEmpty()) - return; - qApp->d_func()->cursor_list.removeFirst(); - qt_lite_set_cursor(0, false); -} - -#endif// QT_NO_CURSOR - -QWidget *QApplication::topLevelAt(const QPoint &pos) -{ - QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); - - QList screens = pi->screens(); - QList::const_iterator screen = screens.constBegin(); - QList::const_iterator end = screens.constEnd(); - - // The first screen in a virtual environment should know about all top levels - if (pi->isVirtualDesktop()) { - QWidget *w = (*screen)->topLevelAt(pos); - return w; - } - - while (screen != end) { - if ((*screen)->geometry().contains(pos)) - return (*screen)->topLevelAt(pos); - ++screen; - } - return 0; -} - -void QApplication::beep() -{ -} - -void QApplication::alert(QWidget *, int) -{ -} - -static void init_platform(const QString &name) -{ - QApplicationPrivate::platform_integration = QPlatformIntegrationFactory::create(name); - if (!QApplicationPrivate::platform_integration) { - QStringList keys = QPlatformIntegrationFactory::keys(); - QString fatalMessage = - QString::fromLatin1("Failed to load platform plugin \"%1\". Available platforms are: \n").arg(name); - foreach(QString key, keys) { - fatalMessage.append(key + QString::fromLatin1("\n")); - } - qFatal("%s", fatalMessage.toLocal8Bit().constData()); - - } - -} - - -static void cleanup_platform() -{ - delete QApplicationPrivate::platform_integration; - QApplicationPrivate::platform_integration = 0; -} - -static void init_plugins(const QList pluginList) -{ - for (int i = 0; i < pluginList.count(); ++i) { - QByteArray pluginSpec = pluginList.at(i); - qDebug() << "init_plugins" << i << pluginSpec; - int colonPos = pluginSpec.indexOf(':'); - QObject *plugin; - if (colonPos < 0) - plugin = QGenericPluginFactory::create(QLatin1String(pluginSpec), QString()); - else - plugin = QGenericPluginFactory::create(QLatin1String(pluginSpec.mid(0, colonPos)), - QLatin1String(pluginSpec.mid(colonPos+1))); - qDebug() << " created" << plugin; - } -} - -#ifndef QT_NO_QWS_INPUTMETHODS -class QDummyInputContext : public QInputContext -{ -public: - explicit QDummyInputContext(QObject* parent = 0) : QInputContext(parent) {} - ~QDummyInputContext() {} - QString identifierName() { return QString(); } - QString language() { return QString(); } - - void reset() {} - bool isComposing() const { return false; } - -}; -#endif // QT_NO_QWS_INPUTMETHODS - -void qt_init(QApplicationPrivate *priv, int type) -{ - Q_UNUSED(type); - - qApp->setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); - char *p; - char **argv = priv->argv; - int argc = priv->argc; - - if (argv && *argv) { //apparently, we allow people to pass 0 on the other platforms - p = strrchr(argv[0], '/'); - appName = QString::fromLocal8Bit(p ? p + 1 : argv[0]); - } - - QList pluginList; - QString platformName = qgetenv("QT_LITE_PLATFORM"); - - // Get command line params - - int j = argc ? 1 : 0; - for (int i=1; iargc) { - priv->argv[j] = 0; - priv->argc = j; - } - -#if 0 - QByteArray pluginEnv = qgetenv("QT_LITE_PLUGINS"); - if (!pluginEnv.isEmpty()) { - pluginList.append(pluginEnv.split(';')); - } -#endif - - init_platform(platformName); - init_plugins(pluginList); - - QColormap::initialize(); - QFont::initialize(); -#ifndef QT_NO_CURSOR -// QCursorData::initialize(); -#endif - - qApp->setObjectName(appName); - -#ifndef QT_NO_QWS_INPUTMETHODS - qApp->setInputContext(new QDummyInputContext(qApp)); -#endif -} - -void qt_cleanup() -{ - cleanup_platform(); - - QPixmapCache::clear(); -#ifndef QT_NO_CURSOR - QCursorData::cleanup(); -#endif - QFont::cleanup(); - QColormap::cleanup(); - delete QApplicationPrivate::inputContext; - QApplicationPrivate::inputContext = 0; - - QApplicationPrivate::active_window = 0; //### this should not be necessary -} - - -#ifdef QT3_SUPPORT -void QApplication::setMainWidget(QWidget *mainWidget) -{ - QApplicationPrivate::main_widget = mainWidget; - if (QApplicationPrivate::main_widget && windowIcon().isNull() - && QApplicationPrivate::main_widget->testAttribute(Qt::WA_SetWindowIcon)) - setWindowIcon(QApplicationPrivate::main_widget->windowIcon()); -} -#endif - -void QApplicationPrivate::processMouseEvent(QWindowSystemInterface::MouseEvent *e) -{ - // qDebug() << "handleMouseEvent" << tlw << ev.pos() << ev.globalPos() << hex << ev.buttons(); - static QWeakPointer implicit_mouse_grabber; - - QEvent::Type type; - // move first - Qt::MouseButtons stateChange = e->buttons ^ buttons; - if (e->globalPos != QPoint(qt_last_x, qt_last_y) && (stateChange != Qt::NoButton)) { - QWindowSystemInterface::MouseEvent * newMouseEvent = new QWindowSystemInterface::MouseEvent(e->widget.data(), e->timestamp, e->localPos, e->globalPos, e->buttons); - QWindowSystemInterfacePrivate::userEventQueue.prepend(newMouseEvent); // just in case the move triggers a new event loop - stateChange = Qt::NoButton; - } - - QWidget * tlw = e->widget.data(); - - QPoint localPoint = e->localPos; - QPoint globalPoint = e->globalPos; - QWidget *mouseWindow = tlw; - - Qt::MouseButton button = Qt::NoButton; - - - if (qt_last_x != globalPoint.x() || qt_last_y != globalPoint.y()) { - type = QEvent::MouseMove; - qt_last_x = globalPoint.x(); - qt_last_y = globalPoint.y(); - if (qAbs(globalPoint.x() - mousePressX) > mouse_double_click_distance|| - qAbs(globalPoint.y() - mousePressY) > mouse_double_click_distance) - mousePressButton = Qt::NoButton; - } - else { // check to see if a new button has been pressed/released - for (int check = Qt::LeftButton; - check <= Qt::XButton2; - check = check << 1) { - if (check & stateChange) { - button = Qt::MouseButton(check); - break; - } - } - if (button == Qt::NoButton) { - // Ignore mouse events that don't change the current state - return; - } - buttons = e->buttons; - if (button & e->buttons) { - if ((e->timestamp - mousePressTime) < static_cast(QApplication::doubleClickInterval()) && button == mousePressButton) { - type = QEvent::MouseButtonDblClick; - mousePressButton = Qt::NoButton; - } - else { - type = QEvent::MouseButtonPress; - mousePressTime = e->timestamp; - mousePressButton = button; - mousePressX = qt_last_x; - mousePressY = qt_last_y; - } - } - else - type = QEvent::MouseButtonRelease; - } - - if (self->inPopupMode()) { - //popup mouse handling is magical... - mouseWindow = qApp->activePopupWidget(); - - implicit_mouse_grabber.clear(); - //### how should popup mode and implicit mouse grab interact? - - } else if (tlw && app_do_modal && !qt_try_modal(tlw, e->type) ) { - //even if we're blocked by modality, we should deliver the mouse release event.. - //### this code is not completely correct: multiple buttons can be pressed simultaneously - if (!(implicit_mouse_grabber && buttons == Qt::NoButton)) { - //qDebug() << "modal blocked mouse event to" << tlw; - return; - } - } - - // find the tlw if we didn't get it from the plugin - if (!mouseWindow) { - mouseWindow = QApplication::topLevelAt(globalPoint); - } - - if (!mouseWindow && !implicit_mouse_grabber) - mouseWindow = QApplication::desktop(); - - if (mouseWindow && mouseWindow != tlw) { - //we did not get a sensible localPoint from the window system, so let's calculate it - localPoint = mouseWindow->mapFromGlobal(globalPoint); - } - - // which child should have it? - QWidget *mouseWidget = mouseWindow; - if (mouseWindow) { - QWidget *w = mouseWindow->childAt(localPoint); - if (w) { - mouseWidget = w; - } - } - - //handle implicit mouse grab - if (type == QEvent::MouseButtonPress && !implicit_mouse_grabber) { - implicit_mouse_grabber = mouseWidget; - - Q_ASSERT(mouseWindow); - mouseWindow->activateWindow(); //focus - } else if (implicit_mouse_grabber) { - mouseWidget = implicit_mouse_grabber.data(); - mouseWindow = mouseWidget->window(); - if (mouseWindow != tlw) - localPoint = mouseWindow->mapFromGlobal(globalPoint); - } - - Q_ASSERT(mouseWidget); - - //localPoint is local to mouseWindow, but it needs to be local to mouseWidget - localPoint = mouseWidget->mapFrom(mouseWindow, localPoint); - - if (buttons == Qt::NoButton) { - //qDebug() << "resetting mouse grabber"; - implicit_mouse_grabber.clear(); - } - - if (mouseWidget != qt_last_mouse_receiver) { - dispatchEnterLeave(mouseWidget, qt_last_mouse_receiver); - qt_last_mouse_receiver = mouseWidget; - } - - // Remember, we might enter a modal event loop when sending the event, - // so think carefully before adding code below this point. - - // qDebug() << "sending mouse ev." << ev.type() << localPoint << globalPoint << ev.button() << ev.buttons() << mouseWidget << "mouse grabber" << implicit_mouse_grabber; - - QMouseEvent ev(type, localPoint, globalPoint, button, buttons, modifiers); - - QList > cursors = QGraphicsSystemCursorPrivate::getInstances(); - foreach (QWeakPointer cursor, cursors) { - if (cursor) - cursor.data()->pointerEvent(ev); - } - - QApplication::sendSpontaneousEvent(mouseWidget, &ev); -} - - -//### there's a lot of duplicated logic here -- refactoring required! - -void QApplicationPrivate::processWheelEvent(QWindowSystemInterface::WheelEvent *e) -{ -// QPoint localPoint = ev.pos(); - QPoint globalPoint = e->globalPos; -// bool trustLocalPoint = !!tlw; //is there something the local point can be local to? - QWidget *mouseWidget; - - qt_last_x = globalPoint.x(); - qt_last_y = globalPoint.y(); - - QWidget *mouseWindow = e->widget.data(); - - // find the tlw if we didn't get it from the plugin - if (!mouseWindow) { - mouseWindow = QApplication::topLevelAt(globalPoint); - } - - if (!mouseWindow) - return; - - mouseWidget = mouseWindow; - - if (app_do_modal && !qt_try_modal(mouseWindow, e->type) ) { - qDebug() << "modal blocked wheel event" << mouseWindow; - return; - } - QPoint p = mouseWindow->mapFromGlobal(globalPoint); - QWidget *w = mouseWindow->childAt(p); - if (w) { - mouseWidget = w; - p = mouseWidget->mapFromGlobal(globalPoint); - } - - QWheelEvent ev(p, globalPoint, e->delta, buttons, modifiers, - e->orient); - QApplication::sendSpontaneousEvent(mouseWidget, &ev); -} - - - -// Remember, Qt convention is: keyboard state is state *before* - -void QApplicationPrivate::processKeyEvent(QWindowSystemInterface::KeyEvent *e) -{ - QWidget *focusW = 0; - if (self->inPopupMode()) { - QWidget *popupW = qApp->activePopupWidget(); - focusW = popupW->focusWidget() ? popupW->focusWidget() : popupW; - } - if (!focusW) - focusW = QApplication::focusWidget(); - if (!focusW) { - focusW = e->widget.data(); - } - if (!focusW) - focusW = QApplication::activeWindow(); - - //qDebug() << "handleKeyEvent" << hex << e->key() << e->modifiers() << e->text() << "widget" << focusW; - - if (!focusW) - return; - if (app_do_modal && !qt_try_modal(focusW, e->type)) - return; - - modifiers = e->modifiers; - QKeyEvent ev(e->type, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount); - QApplication::sendSpontaneousEvent(focusW, &ev); -} - -void QApplicationPrivate::processGeometryChange(QWidget *tlw, const QRect &newRect) -{ - if (!tlw->isWindow()) - return; //geo of native child widgets is controlled by lighthouse - //so we already have sent the events; besides this new rect - //is not mapped to parent - - QRect cr(tlw->geometry()); - - bool isResize = cr.size() != newRect.size(); - bool isMove = cr.topLeft() != newRect.topLeft(); - tlw->data->crect = newRect; - if (isResize) { - QResizeEvent e(tlw->data->crect.size(), cr.size()); - QApplication::sendSpontaneousEvent(tlw, &e); - tlw->update(); - } - - if (isMove) { - //### frame geometry - QMoveEvent e(tlw->data->crect.topLeft(), cr.topLeft()); - QApplication::sendSpontaneousEvent(tlw, &e); - } -} - -void QApplicationPrivate::processCloseEvent(QWidget *tlw) -{ - tlw->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent); -} - -void QApplicationPrivate::processTouchEvent(QWindowSystemInterface::TouchEvent *e) -{ - translateRawTouchEvent(e->widget.data(), e->devType, e->points); -} - -void QApplicationPrivate::reportScreenCount(int count) -{ - // This operation only makes sense after the QApplication constructor runs - if (QCoreApplication::startingUp()) - return; - - QApplication::desktop()->d_func()->updateScreenList(); - // signal anything listening for creation or deletion of screens - QDesktopWidget *desktop = QApplication::desktop(); - emit desktop->screenCountChanged(count); -} - -void QApplicationPrivate::reportGeometryChange(int screenIndex) -{ - // This operation only makes sense after the QApplication constructor runs - if (QCoreApplication::startingUp()) - return; - - QApplication::desktop()->d_func()->updateScreenList(); - - // signal anything listening for screen geometry changes - QDesktopWidget *desktop = QApplication::desktop(); - emit desktop->resized(screenIndex); - - // make sure maximized and fullscreen windows are updated - QWidgetList list = QApplication::topLevelWidgets(); - for (int i = list.size() - 1; i >= 0; --i) { - QWidget *w = list.at(i); - if (w->isFullScreen()) - w->d_func()->setFullScreenSize_helper(); - else if (w->isMaximized()) - w->d_func()->setMaxWindowState_helper(); - } -} - -void QApplicationPrivate::reportAvailableGeometryChange(int screenIndex) -{ - // This operation only makes sense after the QApplication constructor runs - if (QCoreApplication::startingUp()) - return; - - QApplication::desktop()->d_func()->updateScreenList(); - - // signal anything listening for screen geometry changes - QDesktopWidget *desktop = QApplication::desktop(); - emit desktop->workAreaResized(screenIndex); - - // make sure maximized and fullscreen windows are updated - QWidgetList list = QApplication::topLevelWidgets(); - for (int i = list.size() - 1; i >= 0; --i) { - QWidget *w = list.at(i); - if (w->isFullScreen()) - w->d_func()->setFullScreenSize_helper(); - else if (w->isMaximized()) - w->d_func()->setMaxWindowState_helper(); - } -} - -QT_END_NAMESPACE diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index ecfac78..7d98f4d 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -78,7 +78,7 @@ #endif #ifdef Q_WS_QPA #include -#include "QtGui/qplatformintegration_lite.h" +#include "QtGui/qplatformintegration_qpa.h" #endif QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp new file mode 100644 index 0000000..afa069b --- /dev/null +++ b/src/gui/kernel/qapplication_qpa.cpp @@ -0,0 +1,882 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qapplication_p.h" +#include "qcolormap.h" +#include "qpixmapcache.h" +#if !defined(QT_NO_GLIB) +#include "qeventdispatcher_glib_qpa_p.h" +#endif +#include "qeventdispatcher_qpa_p.h" +#ifndef QT_NO_CURSOR +#include "private/qcursor_p.h" +#endif + +#include "private/qwidget_p.h" + +#include "qgenericpluginfactory_qpa.h" +#include "qplatformintegrationfactory_qpa_p.h" +#include + +#include +#include +#include +#include +#include + +#include "qdesktopwidget_qpa_p.h" + +QT_BEGIN_NAMESPACE + +static QString appName; +static const char *appFont = 0; // application font + +QWidget *qt_button_down = 0; // widget got last button-down + +static bool app_do_modal = false; +extern QWidgetList *qt_modal_stack; // stack of modal widgets + +int qt_last_x = 0; +int qt_last_y = 0; +QPointer qt_last_mouse_receiver = 0; + +static Qt::KeyboardModifiers modifiers = Qt::NoModifier; +static Qt::MouseButtons buttons = Qt::NoButton; +static ulong mousePressTime; +static Qt::MouseButton mousePressButton = Qt::NoButton; +static int mousePressX; +static int mousePressY; +static int mouse_double_click_distance = 5; + +void QApplicationPrivate::processUserEvent(QWindowSystemInterface::UserEvent *e) +{ + switch(e->type) { + case QEvent::MouseButtonDblClick: // if mouse event, calculate appropriate widget and local coordinates + case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + case QEvent::MouseMove: + QApplicationPrivate::processMouseEvent(static_cast(e)); + break; + case QEvent::Wheel: + QApplicationPrivate::processWheelEvent(static_cast(e)); + break; + case QEvent::KeyPress: + case QEvent::KeyRelease: + QApplicationPrivate::processKeyEvent(static_cast(e)); + break; + case QEvent::TouchBegin: + case QEvent::TouchUpdate: + case QEvent::TouchEnd: + QApplicationPrivate::processTouchEvent(static_cast(e)); + break; + default: + qWarning() << "Unknown user input event type:" << e->type; + break; + } +} + +QString QApplicationPrivate::appName() const +{ + return QT_PREPEND_NAMESPACE(appName); +} + +void QApplicationPrivate::createEventDispatcher() +{ + Q_Q(QApplication); +#if !defined(QT_NO_GLIB) + if (qgetenv("QT_NO_GLIB").isEmpty() && QEventDispatcherGlib::versionSupported()) + eventDispatcher = new QLiteEventDispatcherGlib(q); + else +#endif + eventDispatcher = new QEventDispatcherLite(q); +} + +static bool qt_try_modal(QWidget *widget, QEvent::Type type) +{ + QWidget * top = 0; + + if (QApplicationPrivate::tryModalHelper(widget, &top)) + return true; + + bool block_event = false; + bool paint_event = false; + + switch (type) { +#if 0 + case QEvent::Focus: + if (!static_cast(event)->simpleData.get_focus) + break; + // drop through +#endif + case QEvent::MouseButtonPress: // disallow mouse/key events + case QEvent::MouseButtonRelease: + case QEvent::MouseMove: + case QEvent::KeyPress: + case QEvent::KeyRelease: + block_event = true; + break; + default: + break; + } + + if ((block_event || paint_event) && top->parentWidget() == 0) + top->raise(); + + return !block_event; +} + + + +void QApplicationPrivate::enterModal_sys(QWidget *widget) +{ + if (!qt_modal_stack) + qt_modal_stack = new QWidgetList; + qt_modal_stack->insert(0, widget); + app_do_modal = true; +} + +void QApplicationPrivate::leaveModal_sys(QWidget *widget ) +{ + if (qt_modal_stack && qt_modal_stack->removeAll(widget)) { + if (qt_modal_stack->isEmpty()) { + delete qt_modal_stack; + qt_modal_stack = 0; + } + } + app_do_modal = qt_modal_stack != 0; +} + +bool QApplicationPrivate::modalState() +{ + return app_do_modal; +} + +void QApplicationPrivate::closePopup(QWidget *popup) +{ + Q_Q(QApplication); + if (!popupWidgets) + return; + popupWidgets->removeAll(popup); + +//### +// if (popup == qt_popup_down) { +// qt_button_down = 0; +// qt_popup_down = 0; +// } + + if (QApplicationPrivate::popupWidgets->count() == 0) { // this was the last popup + delete QApplicationPrivate::popupWidgets; + QApplicationPrivate::popupWidgets = 0; + + //### replay mouse event? + + //### transfer/release mouse grab + + //### transfer/release keyboard grab + + //give back focus + + if (active_window) { + if (QWidget *fw = active_window->focusWidget()) { + if (fw != QApplication::focusWidget()) { + fw->setFocus(Qt::PopupFocusReason); + } else { + QFocusEvent e(QEvent::FocusIn, Qt::PopupFocusReason); + q->sendEvent(fw, &e); + } + } + } + + } else { + // A popup was closed, so the previous popup gets the focus. + + QWidget* aw = QApplicationPrivate::popupWidgets->last(); + if (QWidget *fw = aw->focusWidget()) + fw->setFocus(Qt::PopupFocusReason); + + //### regrab the keyboard and mouse in case 'popup' lost the grab + + + } + +} + +static int openPopupCount = 0; +void QApplicationPrivate::openPopup(QWidget *popup) +{ + openPopupCount++; + if (!popupWidgets) { // create list + popupWidgets = new QWidgetList; + + /* only grab if you are the first/parent popup */ + //#### ->grabMouse(popup,true); + //#### ->grabKeyboard(popup,true); + //### popupGrabOk = true; + } + popupWidgets->append(popup); // add to end of list + + // popups are not focus-handled by the window system (the first + // popup grabbed the keyboard), so we have to do that manually: A + // new popup gets the focus + if (popup->focusWidget()) { + popup->focusWidget()->setFocus(Qt::PopupFocusReason); + } else if (popupWidgets->count() == 1) { // this was the first popup + if (QWidget *fw = QApplication::focusWidget()) { + QFocusEvent e(QEvent::FocusOut, Qt::PopupFocusReason); + QApplication::sendEvent(fw, &e); + } + } +} + +void QApplicationPrivate::initializeMultitouch_sys() +{ +} + +void QApplicationPrivate::cleanupMultitouch_sys() +{ +} + +void QApplicationPrivate::initializeWidgetPaletteHash() +{ +} + +void QApplication::setCursorFlashTime(int msecs) +{ + QApplicationPrivate::cursor_flash_time = msecs; +} + +int QApplication::cursorFlashTime() +{ + return QApplicationPrivate::cursor_flash_time; +} + +void QApplication::setDoubleClickInterval(int ms) +{ + QApplicationPrivate::mouse_double_click_time = ms; +} + +int QApplication::doubleClickInterval() +{ + return QApplicationPrivate::mouse_double_click_time; +} + +void QApplication::setKeyboardInputInterval(int ms) +{ + QApplicationPrivate::keyboard_input_time = ms; +} + +int QApplication::keyboardInputInterval() +{ + return QApplicationPrivate::keyboard_input_time; +} + +#ifndef QT_NO_WHEELEVENT +void QApplication::setWheelScrollLines(int lines) +{ + QApplicationPrivate::wheel_scroll_lines = lines; +} + +int QApplication::wheelScrollLines() +{ + return QApplicationPrivate::wheel_scroll_lines; +} +#endif + +void QApplication::setEffectEnabled(Qt::UIEffect effect, bool enable) +{ + switch (effect) { + case Qt::UI_AnimateMenu: + QApplicationPrivate::animate_menu = enable; + break; + case Qt::UI_FadeMenu: + if (enable) + QApplicationPrivate::animate_menu = true; + QApplicationPrivate::fade_menu = enable; + break; + case Qt::UI_AnimateCombo: + QApplicationPrivate::animate_combo = enable; + break; + case Qt::UI_AnimateTooltip: + QApplicationPrivate::animate_tooltip = enable; + break; + case Qt::UI_FadeTooltip: + if (enable) + QApplicationPrivate::animate_tooltip = true; + QApplicationPrivate::fade_tooltip = enable; + break; + case Qt::UI_AnimateToolBox: + QApplicationPrivate::animate_toolbox = enable; + break; + default: + QApplicationPrivate::animate_ui = enable; + break; + } +} + +bool QApplication::isEffectEnabled(Qt::UIEffect effect) +{ + if (QColormap::instance().depth() < 16 || !QApplicationPrivate::animate_ui) + return false; + + switch(effect) { + case Qt::UI_AnimateMenu: + return QApplicationPrivate::animate_menu; + case Qt::UI_FadeMenu: + return QApplicationPrivate::fade_menu; + case Qt::UI_AnimateCombo: + return QApplicationPrivate::animate_combo; + case Qt::UI_AnimateTooltip: + return QApplicationPrivate::animate_tooltip; + case Qt::UI_FadeTooltip: + return QApplicationPrivate::fade_tooltip; + case Qt::UI_AnimateToolBox: + return QApplicationPrivate::animate_toolbox; + default: + return QApplicationPrivate::animate_ui; + } +} + +#ifndef QT_NO_CURSOR +void QApplication::setOverrideCursor(const QCursor &cursor) +{ + qApp->d_func()->cursor_list.prepend(cursor); + qt_lite_set_cursor(0, false); +} + +void QApplication::restoreOverrideCursor() +{ + if (qApp->d_func()->cursor_list.isEmpty()) + return; + qApp->d_func()->cursor_list.removeFirst(); + qt_lite_set_cursor(0, false); +} + +#endif// QT_NO_CURSOR + +QWidget *QApplication::topLevelAt(const QPoint &pos) +{ + QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); + + QList screens = pi->screens(); + QList::const_iterator screen = screens.constBegin(); + QList::const_iterator end = screens.constEnd(); + + // The first screen in a virtual environment should know about all top levels + if (pi->isVirtualDesktop()) { + QWidget *w = (*screen)->topLevelAt(pos); + return w; + } + + while (screen != end) { + if ((*screen)->geometry().contains(pos)) + return (*screen)->topLevelAt(pos); + ++screen; + } + return 0; +} + +void QApplication::beep() +{ +} + +void QApplication::alert(QWidget *, int) +{ +} + +static void init_platform(const QString &name) +{ + QApplicationPrivate::platform_integration = QPlatformIntegrationFactory::create(name); + if (!QApplicationPrivate::platform_integration) { + QStringList keys = QPlatformIntegrationFactory::keys(); + QString fatalMessage = + QString::fromLatin1("Failed to load platform plugin \"%1\". Available platforms are: \n").arg(name); + foreach(QString key, keys) { + fatalMessage.append(key + QString::fromLatin1("\n")); + } + qFatal("%s", fatalMessage.toLocal8Bit().constData()); + + } + +} + + +static void cleanup_platform() +{ + delete QApplicationPrivate::platform_integration; + QApplicationPrivate::platform_integration = 0; +} + +static void init_plugins(const QList pluginList) +{ + for (int i = 0; i < pluginList.count(); ++i) { + QByteArray pluginSpec = pluginList.at(i); + qDebug() << "init_plugins" << i << pluginSpec; + int colonPos = pluginSpec.indexOf(':'); + QObject *plugin; + if (colonPos < 0) + plugin = QGenericPluginFactory::create(QLatin1String(pluginSpec), QString()); + else + plugin = QGenericPluginFactory::create(QLatin1String(pluginSpec.mid(0, colonPos)), + QLatin1String(pluginSpec.mid(colonPos+1))); + qDebug() << " created" << plugin; + } +} + +#ifndef QT_NO_QWS_INPUTMETHODS +class QDummyInputContext : public QInputContext +{ +public: + explicit QDummyInputContext(QObject* parent = 0) : QInputContext(parent) {} + ~QDummyInputContext() {} + QString identifierName() { return QString(); } + QString language() { return QString(); } + + void reset() {} + bool isComposing() const { return false; } + +}; +#endif // QT_NO_QWS_INPUTMETHODS + +void qt_init(QApplicationPrivate *priv, int type) +{ + Q_UNUSED(type); + + qApp->setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); + char *p; + char **argv = priv->argv; + int argc = priv->argc; + + if (argv && *argv) { //apparently, we allow people to pass 0 on the other platforms + p = strrchr(argv[0], '/'); + appName = QString::fromLocal8Bit(p ? p + 1 : argv[0]); + } + + QList pluginList; + QString platformName = qgetenv("QT_LITE_PLATFORM"); + + // Get command line params + + int j = argc ? 1 : 0; + for (int i=1; iargc) { + priv->argv[j] = 0; + priv->argc = j; + } + +#if 0 + QByteArray pluginEnv = qgetenv("QT_LITE_PLUGINS"); + if (!pluginEnv.isEmpty()) { + pluginList.append(pluginEnv.split(';')); + } +#endif + + init_platform(platformName); + init_plugins(pluginList); + + QColormap::initialize(); + QFont::initialize(); +#ifndef QT_NO_CURSOR +// QCursorData::initialize(); +#endif + + qApp->setObjectName(appName); + +#ifndef QT_NO_QWS_INPUTMETHODS + qApp->setInputContext(new QDummyInputContext(qApp)); +#endif +} + +void qt_cleanup() +{ + cleanup_platform(); + + QPixmapCache::clear(); +#ifndef QT_NO_CURSOR + QCursorData::cleanup(); +#endif + QFont::cleanup(); + QColormap::cleanup(); + delete QApplicationPrivate::inputContext; + QApplicationPrivate::inputContext = 0; + + QApplicationPrivate::active_window = 0; //### this should not be necessary +} + + +#ifdef QT3_SUPPORT +void QApplication::setMainWidget(QWidget *mainWidget) +{ + QApplicationPrivate::main_widget = mainWidget; + if (QApplicationPrivate::main_widget && windowIcon().isNull() + && QApplicationPrivate::main_widget->testAttribute(Qt::WA_SetWindowIcon)) + setWindowIcon(QApplicationPrivate::main_widget->windowIcon()); +} +#endif + +void QApplicationPrivate::processMouseEvent(QWindowSystemInterface::MouseEvent *e) +{ + // qDebug() << "handleMouseEvent" << tlw << ev.pos() << ev.globalPos() << hex << ev.buttons(); + static QWeakPointer implicit_mouse_grabber; + + QEvent::Type type; + // move first + Qt::MouseButtons stateChange = e->buttons ^ buttons; + if (e->globalPos != QPoint(qt_last_x, qt_last_y) && (stateChange != Qt::NoButton)) { + QWindowSystemInterface::MouseEvent * newMouseEvent = new QWindowSystemInterface::MouseEvent(e->widget.data(), e->timestamp, e->localPos, e->globalPos, e->buttons); + QWindowSystemInterfacePrivate::userEventQueue.prepend(newMouseEvent); // just in case the move triggers a new event loop + stateChange = Qt::NoButton; + } + + QWidget * tlw = e->widget.data(); + + QPoint localPoint = e->localPos; + QPoint globalPoint = e->globalPos; + QWidget *mouseWindow = tlw; + + Qt::MouseButton button = Qt::NoButton; + + + if (qt_last_x != globalPoint.x() || qt_last_y != globalPoint.y()) { + type = QEvent::MouseMove; + qt_last_x = globalPoint.x(); + qt_last_y = globalPoint.y(); + if (qAbs(globalPoint.x() - mousePressX) > mouse_double_click_distance|| + qAbs(globalPoint.y() - mousePressY) > mouse_double_click_distance) + mousePressButton = Qt::NoButton; + } + else { // check to see if a new button has been pressed/released + for (int check = Qt::LeftButton; + check <= Qt::XButton2; + check = check << 1) { + if (check & stateChange) { + button = Qt::MouseButton(check); + break; + } + } + if (button == Qt::NoButton) { + // Ignore mouse events that don't change the current state + return; + } + buttons = e->buttons; + if (button & e->buttons) { + if ((e->timestamp - mousePressTime) < static_cast(QApplication::doubleClickInterval()) && button == mousePressButton) { + type = QEvent::MouseButtonDblClick; + mousePressButton = Qt::NoButton; + } + else { + type = QEvent::MouseButtonPress; + mousePressTime = e->timestamp; + mousePressButton = button; + mousePressX = qt_last_x; + mousePressY = qt_last_y; + } + } + else + type = QEvent::MouseButtonRelease; + } + + if (self->inPopupMode()) { + //popup mouse handling is magical... + mouseWindow = qApp->activePopupWidget(); + + implicit_mouse_grabber.clear(); + //### how should popup mode and implicit mouse grab interact? + + } else if (tlw && app_do_modal && !qt_try_modal(tlw, e->type) ) { + //even if we're blocked by modality, we should deliver the mouse release event.. + //### this code is not completely correct: multiple buttons can be pressed simultaneously + if (!(implicit_mouse_grabber && buttons == Qt::NoButton)) { + //qDebug() << "modal blocked mouse event to" << tlw; + return; + } + } + + // find the tlw if we didn't get it from the plugin + if (!mouseWindow) { + mouseWindow = QApplication::topLevelAt(globalPoint); + } + + if (!mouseWindow && !implicit_mouse_grabber) + mouseWindow = QApplication::desktop(); + + if (mouseWindow && mouseWindow != tlw) { + //we did not get a sensible localPoint from the window system, so let's calculate it + localPoint = mouseWindow->mapFromGlobal(globalPoint); + } + + // which child should have it? + QWidget *mouseWidget = mouseWindow; + if (mouseWindow) { + QWidget *w = mouseWindow->childAt(localPoint); + if (w) { + mouseWidget = w; + } + } + + //handle implicit mouse grab + if (type == QEvent::MouseButtonPress && !implicit_mouse_grabber) { + implicit_mouse_grabber = mouseWidget; + + Q_ASSERT(mouseWindow); + mouseWindow->activateWindow(); //focus + } else if (implicit_mouse_grabber) { + mouseWidget = implicit_mouse_grabber.data(); + mouseWindow = mouseWidget->window(); + if (mouseWindow != tlw) + localPoint = mouseWindow->mapFromGlobal(globalPoint); + } + + Q_ASSERT(mouseWidget); + + //localPoint is local to mouseWindow, but it needs to be local to mouseWidget + localPoint = mouseWidget->mapFrom(mouseWindow, localPoint); + + if (buttons == Qt::NoButton) { + //qDebug() << "resetting mouse grabber"; + implicit_mouse_grabber.clear(); + } + + if (mouseWidget != qt_last_mouse_receiver) { + dispatchEnterLeave(mouseWidget, qt_last_mouse_receiver); + qt_last_mouse_receiver = mouseWidget; + } + + // Remember, we might enter a modal event loop when sending the event, + // so think carefully before adding code below this point. + + // qDebug() << "sending mouse ev." << ev.type() << localPoint << globalPoint << ev.button() << ev.buttons() << mouseWidget << "mouse grabber" << implicit_mouse_grabber; + + QMouseEvent ev(type, localPoint, globalPoint, button, buttons, modifiers); + + QList > cursors = QGraphicsSystemCursorPrivate::getInstances(); + foreach (QWeakPointer cursor, cursors) { + if (cursor) + cursor.data()->pointerEvent(ev); + } + + QApplication::sendSpontaneousEvent(mouseWidget, &ev); +} + + +//### there's a lot of duplicated logic here -- refactoring required! + +void QApplicationPrivate::processWheelEvent(QWindowSystemInterface::WheelEvent *e) +{ +// QPoint localPoint = ev.pos(); + QPoint globalPoint = e->globalPos; +// bool trustLocalPoint = !!tlw; //is there something the local point can be local to? + QWidget *mouseWidget; + + qt_last_x = globalPoint.x(); + qt_last_y = globalPoint.y(); + + QWidget *mouseWindow = e->widget.data(); + + // find the tlw if we didn't get it from the plugin + if (!mouseWindow) { + mouseWindow = QApplication::topLevelAt(globalPoint); + } + + if (!mouseWindow) + return; + + mouseWidget = mouseWindow; + + if (app_do_modal && !qt_try_modal(mouseWindow, e->type) ) { + qDebug() << "modal blocked wheel event" << mouseWindow; + return; + } + QPoint p = mouseWindow->mapFromGlobal(globalPoint); + QWidget *w = mouseWindow->childAt(p); + if (w) { + mouseWidget = w; + p = mouseWidget->mapFromGlobal(globalPoint); + } + + QWheelEvent ev(p, globalPoint, e->delta, buttons, modifiers, + e->orient); + QApplication::sendSpontaneousEvent(mouseWidget, &ev); +} + + + +// Remember, Qt convention is: keyboard state is state *before* + +void QApplicationPrivate::processKeyEvent(QWindowSystemInterface::KeyEvent *e) +{ + QWidget *focusW = 0; + if (self->inPopupMode()) { + QWidget *popupW = qApp->activePopupWidget(); + focusW = popupW->focusWidget() ? popupW->focusWidget() : popupW; + } + if (!focusW) + focusW = QApplication::focusWidget(); + if (!focusW) { + focusW = e->widget.data(); + } + if (!focusW) + focusW = QApplication::activeWindow(); + + //qDebug() << "handleKeyEvent" << hex << e->key() << e->modifiers() << e->text() << "widget" << focusW; + + if (!focusW) + return; + if (app_do_modal && !qt_try_modal(focusW, e->type)) + return; + + modifiers = e->modifiers; + QKeyEvent ev(e->type, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount); + QApplication::sendSpontaneousEvent(focusW, &ev); +} + +void QApplicationPrivate::processGeometryChange(QWidget *tlw, const QRect &newRect) +{ + if (!tlw->isWindow()) + return; //geo of native child widgets is controlled by lighthouse + //so we already have sent the events; besides this new rect + //is not mapped to parent + + QRect cr(tlw->geometry()); + + bool isResize = cr.size() != newRect.size(); + bool isMove = cr.topLeft() != newRect.topLeft(); + tlw->data->crect = newRect; + if (isResize) { + QResizeEvent e(tlw->data->crect.size(), cr.size()); + QApplication::sendSpontaneousEvent(tlw, &e); + tlw->update(); + } + + if (isMove) { + //### frame geometry + QMoveEvent e(tlw->data->crect.topLeft(), cr.topLeft()); + QApplication::sendSpontaneousEvent(tlw, &e); + } +} + +void QApplicationPrivate::processCloseEvent(QWidget *tlw) +{ + tlw->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent); +} + +void QApplicationPrivate::processTouchEvent(QWindowSystemInterface::TouchEvent *e) +{ + translateRawTouchEvent(e->widget.data(), e->devType, e->points); +} + +void QApplicationPrivate::reportScreenCount(int count) +{ + // This operation only makes sense after the QApplication constructor runs + if (QCoreApplication::startingUp()) + return; + + QApplication::desktop()->d_func()->updateScreenList(); + // signal anything listening for creation or deletion of screens + QDesktopWidget *desktop = QApplication::desktop(); + emit desktop->screenCountChanged(count); +} + +void QApplicationPrivate::reportGeometryChange(int screenIndex) +{ + // This operation only makes sense after the QApplication constructor runs + if (QCoreApplication::startingUp()) + return; + + QApplication::desktop()->d_func()->updateScreenList(); + + // signal anything listening for screen geometry changes + QDesktopWidget *desktop = QApplication::desktop(); + emit desktop->resized(screenIndex); + + // make sure maximized and fullscreen windows are updated + QWidgetList list = QApplication::topLevelWidgets(); + for (int i = list.size() - 1; i >= 0; --i) { + QWidget *w = list.at(i); + if (w->isFullScreen()) + w->d_func()->setFullScreenSize_helper(); + else if (w->isMaximized()) + w->d_func()->setMaxWindowState_helper(); + } +} + +void QApplicationPrivate::reportAvailableGeometryChange(int screenIndex) +{ + // This operation only makes sense after the QApplication constructor runs + if (QCoreApplication::startingUp()) + return; + + QApplication::desktop()->d_func()->updateScreenList(); + + // signal anything listening for screen geometry changes + QDesktopWidget *desktop = QApplication::desktop(); + emit desktop->workAreaResized(screenIndex); + + // make sure maximized and fullscreen windows are updated + QWidgetList list = QApplication::topLevelWidgets(); + for (int i = list.size() - 1; i >= 0; --i) { + QWidget *w = list.at(i); + if (w->isFullScreen()) + w->d_func()->setFullScreenSize_helper(); + else if (w->isMaximized()) + w->d_func()->setMaxWindowState_helper(); + } +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qclipboard_lite.cpp b/src/gui/kernel/qclipboard_lite.cpp deleted file mode 100644 index 92b9e83..0000000 --- a/src/gui/kernel/qclipboard_lite.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qclipboard.h" - -#ifndef QT_NO_CLIPBOARD - -#include "qmimedata.h" -#include "qapplication.h" - -QT_BEGIN_NAMESPACE - -QT_USE_NAMESPACE - - -class QClipboardData -{ -public: - QClipboardData(); - ~QClipboardData(); - - void setSource(QMimeData* s) - { - if (s == src) - return; - delete src; - src = s; - } - QMimeData* source() - { return src; } - - void clear(); - -private: - QMimeData* src; -}; - -QClipboardData::QClipboardData() -{ - src = 0; -} - -QClipboardData::~QClipboardData() -{ - delete src; -} - -void QClipboardData::clear() -{ - delete src; - src = 0; -} - - -static QClipboardData *internalCbData = 0; - -static void cleanupClipboardData() -{ - delete internalCbData; - internalCbData = 0; -} - -static QClipboardData *clipboardData() -{ - if (internalCbData == 0) { - internalCbData = new QClipboardData; - qAddPostRoutine(cleanupClipboardData); - } - return internalCbData; -} - - -void QClipboard::clear(Mode mode) -{ - setText(QString(), mode); -} - - -bool QClipboard::event(QEvent *e) -{ - return QObject::event(e); -} - -const QMimeData* QClipboard::mimeData(Mode mode) const -{ - if (mode != Clipboard) return 0; - - QClipboardData *d = clipboardData(); - return d->source(); -} - -void QClipboard::setMimeData(QMimeData* src, Mode mode) -{ - if (mode != Clipboard) return; - - QClipboardData *d = clipboardData(); - - d->setSource(src); - - emitChanged(QClipboard::Clipboard); -} - -bool QClipboard::supportsMode(Mode mode) const -{ - return (mode == Clipboard); -} - -bool QClipboard::ownsMode(Mode mode) const -{ - if (mode == Clipboard) - qWarning("QClipboard::ownsClipboard: UNIMPLEMENTED!"); - return false; -} - -void QClipboard::connectNotify( const char * ) -{ -} - -void QClipboard::ownerDestroyed() -{ -} - -#endif // QT_NO_CLIPBOARD - -QT_END_NAMESPACE diff --git a/src/gui/kernel/qclipboard_qpa.cpp b/src/gui/kernel/qclipboard_qpa.cpp new file mode 100644 index 0000000..92b9e83 --- /dev/null +++ b/src/gui/kernel/qclipboard_qpa.cpp @@ -0,0 +1,163 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qclipboard.h" + +#ifndef QT_NO_CLIPBOARD + +#include "qmimedata.h" +#include "qapplication.h" + +QT_BEGIN_NAMESPACE + +QT_USE_NAMESPACE + + +class QClipboardData +{ +public: + QClipboardData(); + ~QClipboardData(); + + void setSource(QMimeData* s) + { + if (s == src) + return; + delete src; + src = s; + } + QMimeData* source() + { return src; } + + void clear(); + +private: + QMimeData* src; +}; + +QClipboardData::QClipboardData() +{ + src = 0; +} + +QClipboardData::~QClipboardData() +{ + delete src; +} + +void QClipboardData::clear() +{ + delete src; + src = 0; +} + + +static QClipboardData *internalCbData = 0; + +static void cleanupClipboardData() +{ + delete internalCbData; + internalCbData = 0; +} + +static QClipboardData *clipboardData() +{ + if (internalCbData == 0) { + internalCbData = new QClipboardData; + qAddPostRoutine(cleanupClipboardData); + } + return internalCbData; +} + + +void QClipboard::clear(Mode mode) +{ + setText(QString(), mode); +} + + +bool QClipboard::event(QEvent *e) +{ + return QObject::event(e); +} + +const QMimeData* QClipboard::mimeData(Mode mode) const +{ + if (mode != Clipboard) return 0; + + QClipboardData *d = clipboardData(); + return d->source(); +} + +void QClipboard::setMimeData(QMimeData* src, Mode mode) +{ + if (mode != Clipboard) return; + + QClipboardData *d = clipboardData(); + + d->setSource(src); + + emitChanged(QClipboard::Clipboard); +} + +bool QClipboard::supportsMode(Mode mode) const +{ + return (mode == Clipboard); +} + +bool QClipboard::ownsMode(Mode mode) const +{ + if (mode == Clipboard) + qWarning("QClipboard::ownsClipboard: UNIMPLEMENTED!"); + return false; +} + +void QClipboard::connectNotify( const char * ) +{ +} + +void QClipboard::ownerDestroyed() +{ +} + +#endif // QT_NO_CLIPBOARD + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qcursor_lite.cpp b/src/gui/kernel/qcursor_lite.cpp deleted file mode 100644 index a6ae7d3..0000000 --- a/src/gui/kernel/qcursor_lite.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -QT_USE_NAMESPACE - -#ifndef QT_NO_CURSOR - -static int nextCursorId = Qt::BitmapCursor; - -/***************************************************************************** - Internal QCursorData class - *****************************************************************************/ - -QCursorData::QCursorData(Qt::CursorShape s) - : cshape(s), bm(0), bmm(0), hx(0), hy(0), id(s) -{ - ref = 1; -} - -QCursorData::~QCursorData() -{ - delete bm; - delete bmm; -} - - -/***************************************************************************** - Global cursors - *****************************************************************************/ - -extern QCursorData *qt_cursorTable[Qt::LastCursor + 1]; // qcursor.cpp - -int QCursor::handle() const -{ - return d->id; -} - - -QCursorData *QCursorData::setBitmap(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY) -{ - if (!QCursorData::initialized) - QCursorData::initialize(); - if (bitmap.depth() != 1 || mask.depth() != 1 || bitmap.size() != mask.size()) { - qWarning("QCursor: Cannot create bitmap cursor; invalid bitmap(s)"); - QCursorData *c = qt_cursorTable[0]; - c->ref.ref(); - return c; - } - QCursorData *d = new QCursorData; - d->bm = new QBitmap(bitmap); - d->bmm = new QBitmap(mask); - d->cshape = Qt::BitmapCursor; - d->id = ++nextCursorId; - d->hx = hotX >= 0 ? hotX : bitmap.width() / 2; - d->hy = hotY >= 0 ? hotY : bitmap.height() / 2; - - return d; -} - -void QCursorData::update() -{ -} - -#endif //QT_NO_CURSOR - -extern int qt_last_x,qt_last_y; - -QPoint QCursor::pos() -{ - return QPoint(qt_last_x, qt_last_y); -} - -void QCursor::setPos(int x, int y) -{ - // Need to check, since some X servers generate null mouse move - // events, causing looping in applications which call setPos() on - // every mouse move event. - // - if (pos() == QPoint(x, y)) - return; -} - -QT_END_NAMESPACE diff --git a/src/gui/kernel/qcursor_qpa.cpp b/src/gui/kernel/qcursor_qpa.cpp new file mode 100644 index 0000000..a6ae7d3 --- /dev/null +++ b/src/gui/kernel/qcursor_qpa.cpp @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +QT_USE_NAMESPACE + +#ifndef QT_NO_CURSOR + +static int nextCursorId = Qt::BitmapCursor; + +/***************************************************************************** + Internal QCursorData class + *****************************************************************************/ + +QCursorData::QCursorData(Qt::CursorShape s) + : cshape(s), bm(0), bmm(0), hx(0), hy(0), id(s) +{ + ref = 1; +} + +QCursorData::~QCursorData() +{ + delete bm; + delete bmm; +} + + +/***************************************************************************** + Global cursors + *****************************************************************************/ + +extern QCursorData *qt_cursorTable[Qt::LastCursor + 1]; // qcursor.cpp + +int QCursor::handle() const +{ + return d->id; +} + + +QCursorData *QCursorData::setBitmap(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY) +{ + if (!QCursorData::initialized) + QCursorData::initialize(); + if (bitmap.depth() != 1 || mask.depth() != 1 || bitmap.size() != mask.size()) { + qWarning("QCursor: Cannot create bitmap cursor; invalid bitmap(s)"); + QCursorData *c = qt_cursorTable[0]; + c->ref.ref(); + return c; + } + QCursorData *d = new QCursorData; + d->bm = new QBitmap(bitmap); + d->bmm = new QBitmap(mask); + d->cshape = Qt::BitmapCursor; + d->id = ++nextCursorId; + d->hx = hotX >= 0 ? hotX : bitmap.width() / 2; + d->hy = hotY >= 0 ? hotY : bitmap.height() / 2; + + return d; +} + +void QCursorData::update() +{ +} + +#endif //QT_NO_CURSOR + +extern int qt_last_x,qt_last_y; + +QPoint QCursor::pos() +{ + return QPoint(qt_last_x, qt_last_y); +} + +void QCursor::setPos(int x, int y) +{ + // Need to check, since some X servers generate null mouse move + // events, causing looping in applications which call setPos() on + // every mouse move event. + // + if (pos() == QPoint(x, y)) + return; +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qdesktopwidget_lite.cpp b/src/gui/kernel/qdesktopwidget_lite.cpp deleted file mode 100644 index 6ba5dd9..0000000 --- a/src/gui/kernel/qdesktopwidget_lite.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdesktopwidget.h" -#include "private/qapplication_p.h" -#include "private/qgraphicssystem_p.h" -#include -#include "private/qwidget_p.h" -#include "private/qdesktopwidget_lite_p.h" -QT_BEGIN_NAMESPACE - -QT_USE_NAMESPACE - -void QDesktopWidgetPrivate::updateScreenList() -{ - QList screenList = QApplicationPrivate::platformIntegration()->screens(); - int targetLength = screenList.length(); - int currentLength = screens.length(); - - // Add or remove screen widgets as necessary - if(currentLength > targetLength) { - QDesktopScreenWidget *screen; - while (currentLength-- > targetLength) { - screen = screens.takeLast(); - delete screen; - } - } - else if (currentLength < targetLength) { - QDesktopScreenWidget *screen; - while (currentLength < targetLength) { - screen = new QDesktopScreenWidget(currentLength++); - screens.append(screen); - } - } - - QRegion virtualGeometry; - bool doVirtualGeometry = QApplicationPrivate::platformIntegration()->isVirtualDesktop(); - - // update the geometry of each screen widget - for (int i = 0; i < screens.length(); i++) { - QRect screenGeometry = screenList.at(i)->geometry(); - screens.at(i)->setGeometry(screenGeometry); - if (doVirtualGeometry) - virtualGeometry += screenGeometry; - } - - virtualScreen.setGeometry(virtualGeometry.boundingRect()); - Q_Q(QDesktopWidget); - q->setGeometry(virtualScreen.geometry()); -} - -QDesktopWidget::QDesktopWidget() - : QWidget(*new QDesktopWidgetPrivate, 0, Qt::Desktop) -{ - Q_D(QDesktopWidget); - setObjectName(QLatin1String("desktop")); - d->updateScreenList(); -} - -QDesktopWidget::~QDesktopWidget() -{ -} - -bool QDesktopWidget::isVirtualDesktop() const -{ - return QApplicationPrivate::platformIntegration()->isVirtualDesktop(); -} - -int QDesktopWidget::primaryScreen() const -{ - return 0; -} - -int QDesktopWidget::numScreens() const -{ - QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); - return qMax(pi->screens().size(), 1); -} - -QWidget *QDesktopWidget::screen(int screen) -{ - Q_D(QDesktopWidget); - if (QApplicationPrivate::platformIntegration()->isVirtualDesktop()) - return &d->virtualScreen; - if (screen < 0 || screen >= d->screens.length()) - return d->screens.at(0); - return d->screens.at(screen); -} - -const QRect QDesktopWidget::availableGeometry(int screenNo) const -{ - QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); - QList screens = pi->screens(); - if (screenNo == -1) - screenNo = 0; - if (screenNo < 0 || screenNo >= screens.size()) - return QRect(); - else - return screens[screenNo]->availableGeometry(); -} - -const QRect QDesktopWidget::screenGeometry(int screenNo) const -{ - QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); - QList screens = pi->screens(); - if (screenNo == -1) - screenNo = 0; - if (screenNo < 0 || screenNo >= screens.size()) - return QRect(); - else - return screens[screenNo]->geometry(); -} - -int QDesktopWidget::screenNumber(const QWidget *w) const -{ - if (!w) - return 0; - - QRect frame = w->frameGeometry(); - if (!w->isWindow()) - frame.moveTopLeft(w->mapToGlobal(QPoint(0, 0))); - const QPoint midpoint = (frame.topLeft() + frame.bottomRight()) / 2; - return screenNumber(midpoint); -} - -int QDesktopWidget::screenNumber(const QPoint &p) const -{ - QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); - QList screens = pi->screens(); - - for (int i = 0; i < screens.size(); ++i) - if (screens[i]->geometry().contains(p)) - return i; - - return primaryScreen(); //even better would be closest screen -} - -void QDesktopWidget::resizeEvent(QResizeEvent *) -{ -} - -QT_END_NAMESPACE diff --git a/src/gui/kernel/qdesktopwidget_lite_p.h b/src/gui/kernel/qdesktopwidget_lite_p.h deleted file mode 100644 index 33e4c98..0000000 --- a/src/gui/kernel/qdesktopwidget_lite_p.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#ifndef QDESKTOPWIDGET_LITE_P_H -#define QDESKTOPWIDGET_LITE_P_H - -#include "QDesktopWidget" -#include "private/qwidget_p.h" - -class QDesktopScreenWidget : public QWidget { - Q_OBJECT -public: - QDesktopScreenWidget(int screenNumber = -1) { setWindowFlags(Qt::Desktop); setVisible(false); d_func()->screenNumber = screenNumber; } -}; - -class QDesktopWidgetPrivate : public QWidgetPrivate { - Q_DECLARE_PUBLIC(QDesktopWidget) - -public: - ~QDesktopWidgetPrivate() {foreach(QDesktopScreenWidget *s, screens) delete s; } - void updateScreenList(); - - QList screens; - QDesktopScreenWidget virtualScreen; -}; - -#endif // QDESKTOPWIDGET_LITE_P_H diff --git a/src/gui/kernel/qdesktopwidget_qpa.cpp b/src/gui/kernel/qdesktopwidget_qpa.cpp new file mode 100644 index 0000000..cff05f5 --- /dev/null +++ b/src/gui/kernel/qdesktopwidget_qpa.cpp @@ -0,0 +1,180 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdesktopwidget.h" +#include "private/qapplication_p.h" +#include "private/qgraphicssystem_p.h" +#include +#include "private/qwidget_p.h" +#include "private/qdesktopwidget_qpa_p.h" +QT_BEGIN_NAMESPACE + +QT_USE_NAMESPACE + +void QDesktopWidgetPrivate::updateScreenList() +{ + QList screenList = QApplicationPrivate::platformIntegration()->screens(); + int targetLength = screenList.length(); + int currentLength = screens.length(); + + // Add or remove screen widgets as necessary + if(currentLength > targetLength) { + QDesktopScreenWidget *screen; + while (currentLength-- > targetLength) { + screen = screens.takeLast(); + delete screen; + } + } + else if (currentLength < targetLength) { + QDesktopScreenWidget *screen; + while (currentLength < targetLength) { + screen = new QDesktopScreenWidget(currentLength++); + screens.append(screen); + } + } + + QRegion virtualGeometry; + bool doVirtualGeometry = QApplicationPrivate::platformIntegration()->isVirtualDesktop(); + + // update the geometry of each screen widget + for (int i = 0; i < screens.length(); i++) { + QRect screenGeometry = screenList.at(i)->geometry(); + screens.at(i)->setGeometry(screenGeometry); + if (doVirtualGeometry) + virtualGeometry += screenGeometry; + } + + virtualScreen.setGeometry(virtualGeometry.boundingRect()); + Q_Q(QDesktopWidget); + q->setGeometry(virtualScreen.geometry()); +} + +QDesktopWidget::QDesktopWidget() + : QWidget(*new QDesktopWidgetPrivate, 0, Qt::Desktop) +{ + Q_D(QDesktopWidget); + setObjectName(QLatin1String("desktop")); + d->updateScreenList(); +} + +QDesktopWidget::~QDesktopWidget() +{ +} + +bool QDesktopWidget::isVirtualDesktop() const +{ + return QApplicationPrivate::platformIntegration()->isVirtualDesktop(); +} + +int QDesktopWidget::primaryScreen() const +{ + return 0; +} + +int QDesktopWidget::numScreens() const +{ + QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); + return qMax(pi->screens().size(), 1); +} + +QWidget *QDesktopWidget::screen(int screen) +{ + Q_D(QDesktopWidget); + if (QApplicationPrivate::platformIntegration()->isVirtualDesktop()) + return &d->virtualScreen; + if (screen < 0 || screen >= d->screens.length()) + return d->screens.at(0); + return d->screens.at(screen); +} + +const QRect QDesktopWidget::availableGeometry(int screenNo) const +{ + QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); + QList screens = pi->screens(); + if (screenNo == -1) + screenNo = 0; + if (screenNo < 0 || screenNo >= screens.size()) + return QRect(); + else + return screens[screenNo]->availableGeometry(); +} + +const QRect QDesktopWidget::screenGeometry(int screenNo) const +{ + QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); + QList screens = pi->screens(); + if (screenNo == -1) + screenNo = 0; + if (screenNo < 0 || screenNo >= screens.size()) + return QRect(); + else + return screens[screenNo]->geometry(); +} + +int QDesktopWidget::screenNumber(const QWidget *w) const +{ + if (!w) + return 0; + + QRect frame = w->frameGeometry(); + if (!w->isWindow()) + frame.moveTopLeft(w->mapToGlobal(QPoint(0, 0))); + const QPoint midpoint = (frame.topLeft() + frame.bottomRight()) / 2; + return screenNumber(midpoint); +} + +int QDesktopWidget::screenNumber(const QPoint &p) const +{ + QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); + QList screens = pi->screens(); + + for (int i = 0; i < screens.size(); ++i) + if (screens[i]->geometry().contains(p)) + return i; + + return primaryScreen(); //even better would be closest screen +} + +void QDesktopWidget::resizeEvent(QResizeEvent *) +{ +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qdesktopwidget_qpa_p.h b/src/gui/kernel/qdesktopwidget_qpa_p.h new file mode 100644 index 0000000..33e4c98 --- /dev/null +++ b/src/gui/kernel/qdesktopwidget_qpa_p.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#ifndef QDESKTOPWIDGET_LITE_P_H +#define QDESKTOPWIDGET_LITE_P_H + +#include "QDesktopWidget" +#include "private/qwidget_p.h" + +class QDesktopScreenWidget : public QWidget { + Q_OBJECT +public: + QDesktopScreenWidget(int screenNumber = -1) { setWindowFlags(Qt::Desktop); setVisible(false); d_func()->screenNumber = screenNumber; } +}; + +class QDesktopWidgetPrivate : public QWidgetPrivate { + Q_DECLARE_PUBLIC(QDesktopWidget) + +public: + ~QDesktopWidgetPrivate() {foreach(QDesktopScreenWidget *s, screens) delete s; } + void updateScreenList(); + + QList screens; + QDesktopScreenWidget virtualScreen; +}; + +#endif // QDESKTOPWIDGET_LITE_P_H diff --git a/src/gui/kernel/qeventdispatcher_glib_lite.cpp b/src/gui/kernel/qeventdispatcher_glib_lite.cpp deleted file mode 100644 index 744925c..0000000 --- a/src/gui/kernel/qeventdispatcher_glib_lite.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qeventdispatcher_glib_lite_p.h" - -#include "qapplication.h" - -#include "qplatformdefs.h" -#include "qapplication.h" - -#include -#include "qapplication_p.h" - -#include - -QT_BEGIN_NAMESPACE - -struct GUserEventSource -{ - GSource source; - QLiteEventDispatcherGlib *q; -}; - -static gboolean userEventSourcePrepare(GSource *s, gint *timeout) -{ - Q_UNUSED(s) - Q_UNUSED(timeout) - - return QWindowSystemInterfacePrivate::userEventsQueued() > 0; -} - -static gboolean userEventSourceCheck(GSource *source) -{ - return userEventSourcePrepare(source, 0); -} - -static gboolean userEventSourceDispatch(GSource *s, GSourceFunc, gpointer) -{ - GUserEventSource * source = reinterpret_cast(s); - - QWindowSystemInterface::UserEvent * event; - while (QWindowSystemInterfacePrivate::userEventsQueued()) { - event = QWindowSystemInterfacePrivate::getUserEvent(); - if (!event) - break; - - // send through event filter - if (source->q->filterEvent(event)) { - delete event; - continue; - } - QApplicationPrivate::processUserEvent(event); - delete event; - } - - return true; -} - - -static GSourceFuncs userEventSourceFuncs = { - userEventSourcePrepare, - userEventSourceCheck, - userEventSourceDispatch, - NULL, - NULL, - NULL -}; - -QLiteEventDispatcherGlibPrivate::QLiteEventDispatcherGlibPrivate(GMainContext *context) - : QEventDispatcherGlibPrivate(context) -{ - userEventSource = reinterpret_cast(g_source_new(&userEventSourceFuncs, - sizeof(GUserEventSource))); - userEventSource->q = 0; - g_source_set_can_recurse(&userEventSource->source, true); - g_source_attach(&userEventSource->source, mainContext); -} - - -QLiteEventDispatcherGlib::QLiteEventDispatcherGlib(QObject *parent) - : QEventDispatcherGlib(*new QLiteEventDispatcherGlibPrivate, parent) -{ - Q_D(QLiteEventDispatcherGlib); - d->userEventSource->q = this; -} - -QLiteEventDispatcherGlib::~QLiteEventDispatcherGlib() -{ - Q_D(QLiteEventDispatcherGlib); - - g_source_destroy(&d->userEventSource->source); - g_source_unref(&d->userEventSource->source); - d->userEventSource = 0; -} - -bool QLiteEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags) -{ - return QEventDispatcherGlib::processEvents(flags); -} - -QT_END_NAMESPACE diff --git a/src/gui/kernel/qeventdispatcher_glib_lite_p.h b/src/gui/kernel/qeventdispatcher_glib_lite_p.h deleted file mode 100644 index 6ebdb25..0000000 --- a/src/gui/kernel/qeventdispatcher_glib_lite_p.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QLITEEVENTDISPATCHER_GLIB_P_H -#define QLITEEVENTDISPATCHER_GLIB_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of the QLibrary class. This header file may change from -// version to version without notice, or even be removed. -// -// We mean it. -// - -#include - -typedef struct _GMainContext GMainContext; - -QT_BEGIN_NAMESPACE -class QLiteEventDispatcherGlibPrivate; - -class QLiteEventDispatcherGlib : public QEventDispatcherGlib -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QLiteEventDispatcherGlib) - -public: - explicit QLiteEventDispatcherGlib(QObject *parent = 0); - ~QLiteEventDispatcherGlib(); - - bool processEvents(QEventLoop::ProcessEventsFlags flags); -}; - -struct GUserEventSource; - -class QLiteEventDispatcherGlibPrivate : public QEventDispatcherGlibPrivate -{ - Q_DECLARE_PUBLIC(QLiteEventDispatcherGlib) -public: - QLiteEventDispatcherGlibPrivate(GMainContext *context = 0); - GUserEventSource *userEventSource; -}; - - -QT_END_NAMESPACE - -#endif // QLITEEVENTDISPATCHER_GLIB_P_H diff --git a/src/gui/kernel/qeventdispatcher_glib_qpa.cpp b/src/gui/kernel/qeventdispatcher_glib_qpa.cpp new file mode 100644 index 0000000..f45902c --- /dev/null +++ b/src/gui/kernel/qeventdispatcher_glib_qpa.cpp @@ -0,0 +1,139 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qeventdispatcher_glib_qpa_p.h" + +#include "qapplication.h" + +#include "qplatformdefs.h" +#include "qapplication.h" + +#include +#include "qapplication_p.h" + +#include + +QT_BEGIN_NAMESPACE + +struct GUserEventSource +{ + GSource source; + QLiteEventDispatcherGlib *q; +}; + +static gboolean userEventSourcePrepare(GSource *s, gint *timeout) +{ + Q_UNUSED(s) + Q_UNUSED(timeout) + + return QWindowSystemInterfacePrivate::userEventsQueued() > 0; +} + +static gboolean userEventSourceCheck(GSource *source) +{ + return userEventSourcePrepare(source, 0); +} + +static gboolean userEventSourceDispatch(GSource *s, GSourceFunc, gpointer) +{ + GUserEventSource * source = reinterpret_cast(s); + + QWindowSystemInterface::UserEvent * event; + while (QWindowSystemInterfacePrivate::userEventsQueued()) { + event = QWindowSystemInterfacePrivate::getUserEvent(); + if (!event) + break; + + // send through event filter + if (source->q->filterEvent(event)) { + delete event; + continue; + } + QApplicationPrivate::processUserEvent(event); + delete event; + } + + return true; +} + + +static GSourceFuncs userEventSourceFuncs = { + userEventSourcePrepare, + userEventSourceCheck, + userEventSourceDispatch, + NULL, + NULL, + NULL +}; + +QLiteEventDispatcherGlibPrivate::QLiteEventDispatcherGlibPrivate(GMainContext *context) + : QEventDispatcherGlibPrivate(context) +{ + userEventSource = reinterpret_cast(g_source_new(&userEventSourceFuncs, + sizeof(GUserEventSource))); + userEventSource->q = 0; + g_source_set_can_recurse(&userEventSource->source, true); + g_source_attach(&userEventSource->source, mainContext); +} + + +QLiteEventDispatcherGlib::QLiteEventDispatcherGlib(QObject *parent) + : QEventDispatcherGlib(*new QLiteEventDispatcherGlibPrivate, parent) +{ + Q_D(QLiteEventDispatcherGlib); + d->userEventSource->q = this; +} + +QLiteEventDispatcherGlib::~QLiteEventDispatcherGlib() +{ + Q_D(QLiteEventDispatcherGlib); + + g_source_destroy(&d->userEventSource->source); + g_source_unref(&d->userEventSource->source); + d->userEventSource = 0; +} + +bool QLiteEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags) +{ + return QEventDispatcherGlib::processEvents(flags); +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qeventdispatcher_glib_qpa_p.h b/src/gui/kernel/qeventdispatcher_glib_qpa_p.h new file mode 100644 index 0000000..6ebdb25 --- /dev/null +++ b/src/gui/kernel/qeventdispatcher_glib_qpa_p.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QLITEEVENTDISPATCHER_GLIB_P_H +#define QLITEEVENTDISPATCHER_GLIB_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of the QLibrary class. This header file may change from +// version to version without notice, or even be removed. +// +// We mean it. +// + +#include + +typedef struct _GMainContext GMainContext; + +QT_BEGIN_NAMESPACE +class QLiteEventDispatcherGlibPrivate; + +class QLiteEventDispatcherGlib : public QEventDispatcherGlib +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QLiteEventDispatcherGlib) + +public: + explicit QLiteEventDispatcherGlib(QObject *parent = 0); + ~QLiteEventDispatcherGlib(); + + bool processEvents(QEventLoop::ProcessEventsFlags flags); +}; + +struct GUserEventSource; + +class QLiteEventDispatcherGlibPrivate : public QEventDispatcherGlibPrivate +{ + Q_DECLARE_PUBLIC(QLiteEventDispatcherGlib) +public: + QLiteEventDispatcherGlibPrivate(GMainContext *context = 0); + GUserEventSource *userEventSource; +}; + + +QT_END_NAMESPACE + +#endif // QLITEEVENTDISPATCHER_GLIB_P_H diff --git a/src/gui/kernel/qeventdispatcher_lite.cpp b/src/gui/kernel/qeventdispatcher_lite.cpp deleted file mode 100644 index 5b99a2f..0000000 --- a/src/gui/kernel/qeventdispatcher_lite.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qplatformdefs.h" -#include "qapplication.h" -#include "qeventdispatcher_lite_p.h" -#include "private/qeventdispatcher_unix_p.h" -#include "qapplication_p.h" -#ifndef QT_NO_THREAD -# include "qmutex.h" -#endif -#include - -#include -QT_BEGIN_NAMESPACE - -QT_USE_NAMESPACE - -class QEventDispatcherLitePrivate : public QEventDispatcherUNIXPrivate -{ - Q_DECLARE_PUBLIC(QEventDispatcherLite) -public: - inline QEventDispatcherLitePrivate() - { } -}; - - -QEventDispatcherLite::QEventDispatcherLite(QObject *parent) - : QEventDispatcherUNIX(*new QEventDispatcherLitePrivate, parent) -{ } - -QEventDispatcherLite::~QEventDispatcherLite() -{ } - - - -//#define ZERO_FOR_THE_MOMENT - -bool QEventDispatcherLite::processEvents(QEventLoop::ProcessEventsFlags flags) -{ - Q_D(QEventDispatcherLite); - int nevents = 0; - - // handle gui and posted events - d->interrupt = false; - QApplication::sendPostedEvents(); - - while (!d->interrupt) { // also flushes output buffer ###can be optimized - QWindowSystemInterface::UserEvent *event; - if (!(flags & QEventLoop::ExcludeUserInputEvents) - && QWindowSystemInterfacePrivate::userEventsQueued() > 0) { - // process a pending user input event - event = QWindowSystemInterfacePrivate::getUserEvent(); - if (!event) - break; - } else { - break; - } - - if (filterEvent(event)) { - delete event; - continue; - } - nevents++; - - QApplicationPrivate::processUserEvent(event); - delete event; - } - - if (!d->interrupt) { - if (QEventDispatcherUNIX::processEvents(flags)) - return true; - } - return (nevents > 0); -} - -bool QEventDispatcherLite::hasPendingEvents() -{ - extern uint qGlobalPostedEventsCount(); // from qapplication.cpp - return qGlobalPostedEventsCount() || QWindowSystemInterfacePrivate::userEventsQueued();; -} - -void QEventDispatcherLite::startingUp() -{ - -} - -void QEventDispatcherLite::closingDown() -{ - -} - -void QEventDispatcherLite::flush() -{ - if(qApp) - qApp->sendPostedEvents(); -} - - -int QEventDispatcherLite::select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, - timeval *timeout) -{ - return QEventDispatcherUNIX::select(nfds, readfds, writefds, exceptfds, timeout); -} - -QT_END_NAMESPACE diff --git a/src/gui/kernel/qeventdispatcher_lite_p.h b/src/gui/kernel/qeventdispatcher_lite_p.h deleted file mode 100644 index c098e6c..0000000 --- a/src/gui/kernel/qeventdispatcher_lite_p.h +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QEVENTDISPATCHER_LITE_P_H -#define QEVENTDISPATCHER_LITE_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 "private/qeventdispatcher_unix_p.h" - -QT_BEGIN_NAMESPACE - -class QEventDispatcherLitePrivate; - -class QEventDispatcherLite : public QEventDispatcherUNIX -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QEventDispatcherLite) - -public: - explicit QEventDispatcherLite(QObject *parent = 0); - ~QEventDispatcherLite(); - - bool processEvents(QEventLoop::ProcessEventsFlags flags); - bool hasPendingEvents(); - - void flush(); - - void startingUp(); - void closingDown(); - -protected: - int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, - timeval *timeout); -}; - -QT_END_NAMESPACE - -#endif // QEVENTDISPATCHER_LITE_P_H diff --git a/src/gui/kernel/qeventdispatcher_qpa.cpp b/src/gui/kernel/qeventdispatcher_qpa.cpp new file mode 100644 index 0000000..c6b5636 --- /dev/null +++ b/src/gui/kernel/qeventdispatcher_qpa.cpp @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformdefs.h" +#include "qapplication.h" +#include "qeventdispatcher_qpa_p.h" +#include "private/qeventdispatcher_unix_p.h" +#include "qapplication_p.h" +#ifndef QT_NO_THREAD +# include "qmutex.h" +#endif +#include + +#include +QT_BEGIN_NAMESPACE + +QT_USE_NAMESPACE + +class QEventDispatcherLitePrivate : public QEventDispatcherUNIXPrivate +{ + Q_DECLARE_PUBLIC(QEventDispatcherLite) +public: + inline QEventDispatcherLitePrivate() + { } +}; + + +QEventDispatcherLite::QEventDispatcherLite(QObject *parent) + : QEventDispatcherUNIX(*new QEventDispatcherLitePrivate, parent) +{ } + +QEventDispatcherLite::~QEventDispatcherLite() +{ } + + + +//#define ZERO_FOR_THE_MOMENT + +bool QEventDispatcherLite::processEvents(QEventLoop::ProcessEventsFlags flags) +{ + Q_D(QEventDispatcherLite); + int nevents = 0; + + // handle gui and posted events + d->interrupt = false; + QApplication::sendPostedEvents(); + + while (!d->interrupt) { // also flushes output buffer ###can be optimized + QWindowSystemInterface::UserEvent *event; + if (!(flags & QEventLoop::ExcludeUserInputEvents) + && QWindowSystemInterfacePrivate::userEventsQueued() > 0) { + // process a pending user input event + event = QWindowSystemInterfacePrivate::getUserEvent(); + if (!event) + break; + } else { + break; + } + + if (filterEvent(event)) { + delete event; + continue; + } + nevents++; + + QApplicationPrivate::processUserEvent(event); + delete event; + } + + if (!d->interrupt) { + if (QEventDispatcherUNIX::processEvents(flags)) + return true; + } + return (nevents > 0); +} + +bool QEventDispatcherLite::hasPendingEvents() +{ + extern uint qGlobalPostedEventsCount(); // from qapplication.cpp + return qGlobalPostedEventsCount() || QWindowSystemInterfacePrivate::userEventsQueued();; +} + +void QEventDispatcherLite::startingUp() +{ + +} + +void QEventDispatcherLite::closingDown() +{ + +} + +void QEventDispatcherLite::flush() +{ + if(qApp) + qApp->sendPostedEvents(); +} + + +int QEventDispatcherLite::select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, + timeval *timeout) +{ + return QEventDispatcherUNIX::select(nfds, readfds, writefds, exceptfds, timeout); +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qeventdispatcher_qpa_p.h b/src/gui/kernel/qeventdispatcher_qpa_p.h new file mode 100644 index 0000000..c098e6c --- /dev/null +++ b/src/gui/kernel/qeventdispatcher_qpa_p.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QEVENTDISPATCHER_LITE_P_H +#define QEVENTDISPATCHER_LITE_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 "private/qeventdispatcher_unix_p.h" + +QT_BEGIN_NAMESPACE + +class QEventDispatcherLitePrivate; + +class QEventDispatcherLite : public QEventDispatcherUNIX +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QEventDispatcherLite) + +public: + explicit QEventDispatcherLite(QObject *parent = 0); + ~QEventDispatcherLite(); + + bool processEvents(QEventLoop::ProcessEventsFlags flags); + bool hasPendingEvents(); + + void flush(); + + void startingUp(); + void closingDown(); + +protected: + int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, + timeval *timeout); +}; + +QT_END_NAMESPACE + +#endif // QEVENTDISPATCHER_LITE_P_H diff --git a/src/gui/kernel/qgenericplugin_lite.cpp b/src/gui/kernel/qgenericplugin_lite.cpp deleted file mode 100644 index 6a0fdb6..0000000 --- a/src/gui/kernel/qgenericplugin_lite.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgenericplugin_lite.h" - -#ifndef QT_NO_LIBRARY - -QT_BEGIN_NAMESPACE - -/*! - \class QGenericPlugin - \ingroup plugins - \ingroup lite - - \brief The QGenericPlugin class is an abstract base class for - window-system related plugins in Qt for Embedded Linux LITE. - - Note that this class is only available in \l{Qt for Embedded Linux LITE}. - - A mouse plugin can be created by subclassing - QGenericPlugin and reimplementing the pure virtual keys() and - create() functions. By exporting the derived class using the - Q_EXPORT_PLUGIN2() macro, The default implementation of the - QGenericPluginFactory class will automatically detect the plugin and - load the driver into the server application at run-time. See \l - {How to Create Qt Plugins} for details. - - \sa QGenericPluginFactory -*/ - -/*! - \fn QStringList QGenericPlugin::keys() const - - Implement this function to return the list of valid keys, i.e. the - drivers supported by this plugin. - - \sa create() -*/ - -/*! - Constructs a plugin with the given \a parent. - - Note that this constructor is invoked automatically by the - Q_EXPORT_PLUGIN2() macro, so there is no need for calling it - explicitly. -*/ -QGenericPlugin::QGenericPlugin(QObject *parent) - : QObject(parent) -{ -} - -/*! - Destroys the plugin. - - Note that Qt destroys a plugin automatically when it is no longer - used, so there is no need for calling the destructor explicitly. -*/ -QGenericPlugin::~QGenericPlugin() -{ -} - -/*! - \fn QObject* QGenericPlugin::create(const QString &key, const QString& specification) - - Implement this function to create a driver matching the type - specified by the given \a key and \a specification parameters. Note that - keys are case-insensitive. - - \sa keys() -*/ - -QT_END_NAMESPACE - -#endif // QT_NO_LIBRARY diff --git a/src/gui/kernel/qgenericplugin_lite.h b/src/gui/kernel/qgenericplugin_lite.h deleted file mode 100644 index a468a9f..0000000 --- a/src/gui/kernel/qgenericplugin_lite.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGENERICPLUGIN_LITE_H -#define QGENERICPLUGIN_LITE_H - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#ifndef QT_NO_LIBRARY - -//class QGenericObject; ????? - - struct Q_GUI_EXPORT QGenericPluginFactoryInterface : public QFactoryInterface -{ - virtual QObject* create(const QString &name, const QString &spec) = 0; -}; - -#define QGenericPluginFactoryInterface_iid "com.trolltech.Qt.QGenericPluginFactoryInterface" -Q_DECLARE_INTERFACE(QGenericPluginFactoryInterface, QGenericPluginFactoryInterface_iid) - -class Q_GUI_EXPORT QGenericPlugin : public QObject, public QGenericPluginFactoryInterface -{ - Q_OBJECT - Q_INTERFACES(QGenericPluginFactoryInterface:QFactoryInterface) -public: - explicit QGenericPlugin(QObject *parent = 0); - ~QGenericPlugin(); - - virtual QStringList keys() const = 0; - virtual QObject* create(const QString& name, const QString &spec) = 0; -}; - -#endif // QT_NO_LIBRARY - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QMOUSEDRIVERPLUGIN_QWS_H diff --git a/src/gui/kernel/qgenericplugin_qpa.cpp b/src/gui/kernel/qgenericplugin_qpa.cpp new file mode 100644 index 0000000..6290b40 --- /dev/null +++ b/src/gui/kernel/qgenericplugin_qpa.cpp @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgenericplugin_qpa.h" + +#ifndef QT_NO_LIBRARY + +QT_BEGIN_NAMESPACE + +/*! + \class QGenericPlugin + \ingroup plugins + \ingroup lite + + \brief The QGenericPlugin class is an abstract base class for + window-system related plugins in Qt for Embedded Linux LITE. + + Note that this class is only available in \l{Qt for Embedded Linux LITE}. + + A mouse plugin can be created by subclassing + QGenericPlugin and reimplementing the pure virtual keys() and + create() functions. By exporting the derived class using the + Q_EXPORT_PLUGIN2() macro, The default implementation of the + QGenericPluginFactory class will automatically detect the plugin and + load the driver into the server application at run-time. See \l + {How to Create Qt Plugins} for details. + + \sa QGenericPluginFactory +*/ + +/*! + \fn QStringList QGenericPlugin::keys() const + + Implement this function to return the list of valid keys, i.e. the + drivers supported by this plugin. + + \sa create() +*/ + +/*! + Constructs a plugin with the given \a parent. + + Note that this constructor is invoked automatically by the + Q_EXPORT_PLUGIN2() macro, so there is no need for calling it + explicitly. +*/ +QGenericPlugin::QGenericPlugin(QObject *parent) + : QObject(parent) +{ +} + +/*! + Destroys the plugin. + + Note that Qt destroys a plugin automatically when it is no longer + used, so there is no need for calling the destructor explicitly. +*/ +QGenericPlugin::~QGenericPlugin() +{ +} + +/*! + \fn QObject* QGenericPlugin::create(const QString &key, const QString& specification) + + Implement this function to create a driver matching the type + specified by the given \a key and \a specification parameters. Note that + keys are case-insensitive. + + \sa keys() +*/ + +QT_END_NAMESPACE + +#endif // QT_NO_LIBRARY diff --git a/src/gui/kernel/qgenericplugin_qpa.h b/src/gui/kernel/qgenericplugin_qpa.h new file mode 100644 index 0000000..a468a9f --- /dev/null +++ b/src/gui/kernel/qgenericplugin_qpa.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGENERICPLUGIN_LITE_H +#define QGENERICPLUGIN_LITE_H + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_LIBRARY + +//class QGenericObject; ????? + + struct Q_GUI_EXPORT QGenericPluginFactoryInterface : public QFactoryInterface +{ + virtual QObject* create(const QString &name, const QString &spec) = 0; +}; + +#define QGenericPluginFactoryInterface_iid "com.trolltech.Qt.QGenericPluginFactoryInterface" +Q_DECLARE_INTERFACE(QGenericPluginFactoryInterface, QGenericPluginFactoryInterface_iid) + +class Q_GUI_EXPORT QGenericPlugin : public QObject, public QGenericPluginFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QGenericPluginFactoryInterface:QFactoryInterface) +public: + explicit QGenericPlugin(QObject *parent = 0); + ~QGenericPlugin(); + + virtual QStringList keys() const = 0; + virtual QObject* create(const QString& name, const QString &spec) = 0; +}; + +#endif // QT_NO_LIBRARY + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMOUSEDRIVERPLUGIN_QWS_H diff --git a/src/gui/kernel/qgenericpluginfactory_lite.cpp b/src/gui/kernel/qgenericpluginfactory_lite.cpp deleted file mode 100644 index 76accbe..0000000 --- a/src/gui/kernel/qgenericpluginfactory_lite.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgenericpluginfactory_lite.h" - -#include "qapplication.h" -#include "private/qfactoryloader_p.h" -#include "qgenericplugin_lite.h" -#include "qdebug.h" - -QT_BEGIN_NAMESPACE - -#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL) -#ifndef QT_NO_LIBRARY - -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, - (QGenericPluginFactoryInterface_iid, - QLatin1String("/generic"), Qt::CaseInsensitive)) - -#endif //QT_NO_LIBRARY -#endif //QT_MAKEDLL - -/*! - \class QGenericPluginFactory - \ingroup qws - - \brief The QGenericPluginFactory class creates window-system - related plugin drivers in Qt for Embedded Linux LITE. - - Note that this class is only available in \l{Qt for Embedded Linux LITE}. - - - \sa QGenericPlugin -*/ - -/*! - Creates the driver specified by \a key, using the given \a specification. - - Note that the keys are case-insensitive. - - \sa keys() -*/ -QObject *QGenericPluginFactory::create(const QString& key, const QString &specification) -{ - QString driver = key.toLower(); - -#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL) -#ifndef QT_NO_LIBRARY - if (QGenericPluginFactoryInterface *factory = qobject_cast(loader()->instance(driver))) - return factory->create(driver, specification); -#endif -#endif - return 0; -} - -/*! - Returns the list of valid keys, i.e. the available mouse drivers. - - \sa create() -*/ -QStringList QGenericPluginFactory::keys() -{ - QStringList list; - -#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL) -#ifndef QT_NO_LIBRARY - QStringList plugins = loader()->keys(); - for (int i = 0; i < plugins.size(); ++i) { - if (!list.contains(plugins.at(i))) - list += plugins.at(i); - } -#endif //QT_NO_LIBRARY -#endif //QT_MAKEDLL - return list; -} - -QT_END_NAMESPACE diff --git a/src/gui/kernel/qgenericpluginfactory_lite.h b/src/gui/kernel/qgenericpluginfactory_lite.h deleted file mode 100644 index 86886f1..0000000 --- a/src/gui/kernel/qgenericpluginfactory_lite.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGENERICPLUGINFACTORY_LITE_H -#define QGENERICPLUGINFACTORY_LITE_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QString; -class QObject; - -class Q_GUI_EXPORT QGenericPluginFactory -{ -public: - static QStringList keys(); - static QObject *create(const QString&, const QString &); -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QGENERICPLUGINFACTORY_QWS_H diff --git a/src/gui/kernel/qgenericpluginfactory_qpa.cpp b/src/gui/kernel/qgenericpluginfactory_qpa.cpp new file mode 100644 index 0000000..dcc7cc7 --- /dev/null +++ b/src/gui/kernel/qgenericpluginfactory_qpa.cpp @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgenericpluginfactory_qpa.h" + +#include "qapplication.h" +#include "private/qfactoryloader_p.h" +#include "qgenericplugin_qpa.h" +#include "qdebug.h" + +QT_BEGIN_NAMESPACE + +#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL) +#ifndef QT_NO_LIBRARY + +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, + (QGenericPluginFactoryInterface_iid, + QLatin1String("/generic"), Qt::CaseInsensitive)) + +#endif //QT_NO_LIBRARY +#endif //QT_MAKEDLL + +/*! + \class QGenericPluginFactory + \ingroup qws + + \brief The QGenericPluginFactory class creates window-system + related plugin drivers in Qt for Embedded Linux LITE. + + Note that this class is only available in \l{Qt for Embedded Linux LITE}. + + + \sa QGenericPlugin +*/ + +/*! + Creates the driver specified by \a key, using the given \a specification. + + Note that the keys are case-insensitive. + + \sa keys() +*/ +QObject *QGenericPluginFactory::create(const QString& key, const QString &specification) +{ + QString driver = key.toLower(); + +#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL) +#ifndef QT_NO_LIBRARY + if (QGenericPluginFactoryInterface *factory = qobject_cast(loader()->instance(driver))) + return factory->create(driver, specification); +#endif +#endif + return 0; +} + +/*! + Returns the list of valid keys, i.e. the available mouse drivers. + + \sa create() +*/ +QStringList QGenericPluginFactory::keys() +{ + QStringList list; + +#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL) +#ifndef QT_NO_LIBRARY + QStringList plugins = loader()->keys(); + for (int i = 0; i < plugins.size(); ++i) { + if (!list.contains(plugins.at(i))) + list += plugins.at(i); + } +#endif //QT_NO_LIBRARY +#endif //QT_MAKEDLL + return list; +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qgenericpluginfactory_qpa.h b/src/gui/kernel/qgenericpluginfactory_qpa.h new file mode 100644 index 0000000..86886f1 --- /dev/null +++ b/src/gui/kernel/qgenericpluginfactory_qpa.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGENERICPLUGINFACTORY_LITE_H +#define QGENERICPLUGINFACTORY_LITE_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QString; +class QObject; + +class Q_GUI_EXPORT QGenericPluginFactory +{ +public: + static QStringList keys(); + static QObject *create(const QString&, const QString &); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QGENERICPLUGINFACTORY_QWS_H diff --git a/src/gui/kernel/qplatformglcontext_lite.h b/src/gui/kernel/qplatformglcontext_lite.h deleted file mode 100644 index 8aeb635..0000000 --- a/src/gui/kernel/qplatformglcontext_lite.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPLATFORM_GL_CONTEXT_H -#define QPLATFORM_GL_CONTEXT_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class Q_OPENGL_EXPORT QPlatformGLContext -{ -public: - //QPlatformGLContext(); - //virtual ~QPlatformGLContext(); - - //virtual bool create(QPaintDevice* device, QPlatformGLContext* shareContext) = 0; - - virtual void makeCurrent() = 0; - virtual void doneCurrent() = 0; - virtual void swapBuffers() = 0; - virtual void* getProcAddress(const QString& procName) = 0; - -}; - -QT_END_NAMESPACE - -QT_END_HEADER - - -#endif // QPLATFORM_GL_INTEGRATION_P_H diff --git a/src/gui/kernel/qplatformglcontext_qpa.h b/src/gui/kernel/qplatformglcontext_qpa.h new file mode 100644 index 0000000..8aeb635 --- /dev/null +++ b/src/gui/kernel/qplatformglcontext_qpa.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenGL module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORM_GL_CONTEXT_H +#define QPLATFORM_GL_CONTEXT_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class Q_OPENGL_EXPORT QPlatformGLContext +{ +public: + //QPlatformGLContext(); + //virtual ~QPlatformGLContext(); + + //virtual bool create(QPaintDevice* device, QPlatformGLContext* shareContext) = 0; + + virtual void makeCurrent() = 0; + virtual void doneCurrent() = 0; + virtual void swapBuffers() = 0; + virtual void* getProcAddress(const QString& procName) = 0; + +}; + +QT_END_NAMESPACE + +QT_END_HEADER + + +#endif // QPLATFORM_GL_INTEGRATION_P_H diff --git a/src/gui/kernel/qplatformintegration_lite.cpp b/src/gui/kernel/qplatformintegration_lite.cpp deleted file mode 100644 index 6499570..0000000 --- a/src/gui/kernel/qplatformintegration_lite.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qplatformintegration_lite.h" - -QT_BEGIN_NAMESPACE - -QBlittable *QPlatformIntegration::createBlittable(const QSize &) const -{ return 0; } - -QPixmap QPlatformIntegration::grabWindow(WId window, int x, int y, int width, int height) const -{ - Q_UNUSED(window); - Q_UNUSED(x); - Q_UNUSED(y); - Q_UNUSED(width); - Q_UNUSED(height); - return QPixmap(); -} - -bool QPlatformIntegration::hasOpenGL() const -{ - return false; -} - -QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformintegration_lite.h b/src/gui/kernel/qplatformintegration_lite.h deleted file mode 100644 index 88c3049..0000000 --- a/src/gui/kernel/qplatformintegration_lite.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPLATFORMINTEGRATION_H -#define QPLATFORMINTEGRATION_H - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class Q_GUI_EXPORT QPlatformIntegration -{ -public: - virtual ~QPlatformIntegration() { }; - -// GraphicsSystem functions - virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0; - virtual QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const = 0; - virtual QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const = 0; - virtual QBlittable *createBlittable(const QSize &size) const; - virtual void moveToScreen(QWidget *window, int screen) {Q_UNUSED(window); Q_UNUSED(screen);} - -// Window System functions - virtual QList screens() const = 0; - virtual bool isVirtualDesktop() { return false; } - virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const; - - virtual bool hasOpenGL() const; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QPLATFORMINTEGRATION_H diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp new file mode 100644 index 0000000..8666911 --- /dev/null +++ b/src/gui/kernel/qplatformintegration_qpa.cpp @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformintegration_qpa.h" + +QT_BEGIN_NAMESPACE + +QBlittable *QPlatformIntegration::createBlittable(const QSize &) const +{ return 0; } + +QPixmap QPlatformIntegration::grabWindow(WId window, int x, int y, int width, int height) const +{ + Q_UNUSED(window); + Q_UNUSED(x); + Q_UNUSED(y); + Q_UNUSED(width); + Q_UNUSED(height); + return QPixmap(); +} + +bool QPlatformIntegration::hasOpenGL() const +{ + return false; +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h new file mode 100644 index 0000000..f80b0ae --- /dev/null +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMINTEGRATION_H +#define QPLATFORMINTEGRATION_H + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class Q_GUI_EXPORT QPlatformIntegration +{ +public: + virtual ~QPlatformIntegration() { }; + +// GraphicsSystem functions + virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0; + virtual QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const = 0; + virtual QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const = 0; + virtual QBlittable *createBlittable(const QSize &size) const; + virtual void moveToScreen(QWidget *window, int screen) {Q_UNUSED(window); Q_UNUSED(screen);} + +// Window System functions + virtual QList screens() const = 0; + virtual bool isVirtualDesktop() { return false; } + virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const; + + virtual bool hasOpenGL() const; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPLATFORMINTEGRATION_H diff --git a/src/gui/kernel/qplatformintegrationfactory_lite.cpp b/src/gui/kernel/qplatformintegrationfactory_lite.cpp deleted file mode 100644 index cd7d171..0000000 --- a/src/gui/kernel/qplatformintegrationfactory_lite.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qplatformintegrationfactory_lite_p.h" -#include -#include "private/qfactoryloader_p.h" -#include "qmutex.h" - -#include "qapplication.h" -#include "qdebug.h" - -QT_BEGIN_NAMESPACE - -#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, - (QPlatformIntegrationFactoryInterface_iid, QLatin1String("/platforms"), Qt::CaseInsensitive)) -#endif - -QPlatformIntegration *QPlatformIntegrationFactory::create(const QString& key) -{ - QPlatformIntegration *ret = 0; - QStringList paramList = key.split(QLatin1Char(':')); - QString platform = paramList.takeFirst().toLower(); - -#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) - qDebug() << loader()->keys(); - if (QPlatformIntegrationFactoryInterface *factory = qobject_cast(loader()->instance(platform))) - ret = factory->create(platform, paramList); -#endif - - return ret; -} - -/*! - Returns the list of valid keys, i.e. the keys this factory can - create styles for. - - \sa create() -*/ -QStringList QPlatformIntegrationFactory::keys() -{ -#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) - QStringList list = loader()->keys(); -#else - QStringList list; -#endif - return list; -} - -QT_END_NAMESPACE - diff --git a/src/gui/kernel/qplatformintegrationfactory_lite_p.h b/src/gui/kernel/qplatformintegrationfactory_lite_p.h deleted file mode 100644 index ba02d2c..0000000 --- a/src/gui/kernel/qplatformintegrationfactory_lite_p.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPLATFORMINTEGRATIONFACTORY_H -#define QPLATFORMINTEGRATIONFACTORY_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 - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QPlatformIntegration; - -class QPlatformIntegrationFactory -{ -public: - static QStringList keys(); - static QPlatformIntegration *create(const QString&); -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QPLATFORMINTEGRATIONFACTORY_H - diff --git a/src/gui/kernel/qplatformintegrationfactory_qpa.cpp b/src/gui/kernel/qplatformintegrationfactory_qpa.cpp new file mode 100644 index 0000000..4f2bfa5 --- /dev/null +++ b/src/gui/kernel/qplatformintegrationfactory_qpa.cpp @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformintegrationfactory_qpa_p.h" +#include +#include "private/qfactoryloader_p.h" +#include "qmutex.h" + +#include "qapplication.h" +#include "qdebug.h" + +QT_BEGIN_NAMESPACE + +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, + (QPlatformIntegrationFactoryInterface_iid, QLatin1String("/platforms"), Qt::CaseInsensitive)) +#endif + +QPlatformIntegration *QPlatformIntegrationFactory::create(const QString& key) +{ + QPlatformIntegration *ret = 0; + QStringList paramList = key.split(QLatin1Char(':')); + QString platform = paramList.takeFirst().toLower(); + +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) + qDebug() << loader()->keys(); + if (QPlatformIntegrationFactoryInterface *factory = qobject_cast(loader()->instance(platform))) + ret = factory->create(platform, paramList); +#endif + + return ret; +} + +/*! + Returns the list of valid keys, i.e. the keys this factory can + create styles for. + + \sa create() +*/ +QStringList QPlatformIntegrationFactory::keys() +{ +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) + QStringList list = loader()->keys(); +#else + QStringList list; +#endif + return list; +} + +QT_END_NAMESPACE + diff --git a/src/gui/kernel/qplatformintegrationfactory_qpa_p.h b/src/gui/kernel/qplatformintegrationfactory_qpa_p.h new file mode 100644 index 0000000..ba02d2c --- /dev/null +++ b/src/gui/kernel/qplatformintegrationfactory_qpa_p.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMINTEGRATIONFACTORY_H +#define QPLATFORMINTEGRATIONFACTORY_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 + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QPlatformIntegration; + +class QPlatformIntegrationFactory +{ +public: + static QStringList keys(); + static QPlatformIntegration *create(const QString&); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPLATFORMINTEGRATIONFACTORY_H + diff --git a/src/gui/kernel/qplatformintegrationplugin_lite.cpp b/src/gui/kernel/qplatformintegrationplugin_lite.cpp deleted file mode 100644 index cb1ed83..0000000 --- a/src/gui/kernel/qplatformintegrationplugin_lite.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qplatformintegrationplugin_lite.h" - -QT_BEGIN_NAMESPACE - -QPlatformIntegrationPlugin::QPlatformIntegrationPlugin(QObject *parent) - : QObject(parent) -{ -} - -QPlatformIntegrationPlugin::~QPlatformIntegrationPlugin() -{ -} - -QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformintegrationplugin_lite.h b/src/gui/kernel/qplatformintegrationplugin_lite.h deleted file mode 100644 index 9c37cf7..0000000 --- a/src/gui/kernel/qplatformintegrationplugin_lite.h +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPLATFORMINTEGRATIONPLUGIN_H -#define QPLATFORMINTEGRATIONPLUGIN_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 -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QPlatformIntegration; - -struct QPlatformIntegrationFactoryInterface : public QFactoryInterface -{ - virtual QPlatformIntegration *create(const QString &key, const QStringList ¶mList) = 0; -}; - -#define QPlatformIntegrationFactoryInterface_iid "com.nokia.Qt.QPlatformIntegrationFactoryInterface" - -Q_DECLARE_INTERFACE(QPlatformIntegrationFactoryInterface, QPlatformIntegrationFactoryInterface_iid) - -class Q_GUI_EXPORT QPlatformIntegrationPlugin : public QObject, public QPlatformIntegrationFactoryInterface -{ - Q_OBJECT - Q_INTERFACES(QPlatformIntegrationFactoryInterface:QFactoryInterface) -public: - explicit QPlatformIntegrationPlugin(QObject *parent = 0); - ~QPlatformIntegrationPlugin(); - - virtual QStringList keys() const = 0; - virtual QPlatformIntegration *create(const QString &key, const QStringList ¶mList) = 0; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QPLATFORMINTEGRATIONPLUGIN_H diff --git a/src/gui/kernel/qplatformintegrationplugin_qpa.cpp b/src/gui/kernel/qplatformintegrationplugin_qpa.cpp new file mode 100644 index 0000000..3bf2474 --- /dev/null +++ b/src/gui/kernel/qplatformintegrationplugin_qpa.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformintegrationplugin_qpa.h" + +QT_BEGIN_NAMESPACE + +QPlatformIntegrationPlugin::QPlatformIntegrationPlugin(QObject *parent) + : QObject(parent) +{ +} + +QPlatformIntegrationPlugin::~QPlatformIntegrationPlugin() +{ +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformintegrationplugin_qpa.h b/src/gui/kernel/qplatformintegrationplugin_qpa.h new file mode 100644 index 0000000..9c37cf7 --- /dev/null +++ b/src/gui/kernel/qplatformintegrationplugin_qpa.h @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMINTEGRATIONPLUGIN_H +#define QPLATFORMINTEGRATIONPLUGIN_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 +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QPlatformIntegration; + +struct QPlatformIntegrationFactoryInterface : public QFactoryInterface +{ + virtual QPlatformIntegration *create(const QString &key, const QStringList ¶mList) = 0; +}; + +#define QPlatformIntegrationFactoryInterface_iid "com.nokia.Qt.QPlatformIntegrationFactoryInterface" + +Q_DECLARE_INTERFACE(QPlatformIntegrationFactoryInterface, QPlatformIntegrationFactoryInterface_iid) + +class Q_GUI_EXPORT QPlatformIntegrationPlugin : public QObject, public QPlatformIntegrationFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QPlatformIntegrationFactoryInterface:QFactoryInterface) +public: + explicit QPlatformIntegrationPlugin(QObject *parent = 0); + ~QPlatformIntegrationPlugin(); + + virtual QStringList keys() const = 0; + virtual QPlatformIntegration *create(const QString &key, const QStringList ¶mList) = 0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPLATFORMINTEGRATIONPLUGIN_H diff --git a/src/gui/kernel/qplatformscreen_lite.cpp b/src/gui/kernel/qplatformscreen_lite.cpp deleted file mode 100644 index 4c0a02b..0000000 --- a/src/gui/kernel/qplatformscreen_lite.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qplatformscreen_lite.h" -#include -#include - -QWidget *QPlatformScreen::topLevelAt(const QPoint & pos) const -{ - QWidgetList list = QApplication::topLevelWidgets(); - for (int i = list.size()-1; i >= 0; --i) { - QWidget *w = list[i]; - //### mask is ignored - if (w != QApplication::desktop() && w->isVisible() && w->geometry().contains(pos)) - return w; - } - - return 0; -} - -QSize QPlatformScreen::physicalSize() const -{ - static const int dpi = 100; - int width = geometry().width() / dpi * qreal(25.4) ; - int height = geometry().height() / dpi * qreal(25.4) ; - return QSize(width,height); -} - diff --git a/src/gui/kernel/qplatformscreen_lite.h b/src/gui/kernel/qplatformscreen_lite.h deleted file mode 100644 index 7d0e28d..0000000 --- a/src/gui/kernel/qplatformscreen_lite.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPLATFORMSCREEN_H -#define QPLATFORMSCREEN_H - -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class Q_GUI_EXPORT QPlatformScreen : public QObject -{ - Q_OBJECT -public: - virtual ~QPlatformScreen() { } - - virtual QRect geometry() const = 0; - virtual QRect availableGeometry() const {return geometry();}; - virtual int depth() const = 0; - virtual QImage::Format format() const = 0; - virtual QSize physicalSize() const; - virtual void setDirty(const QRect &) {} - virtual QWidget *topLevelAt(const QPoint &point) const; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QPLATFORMSCREEN_H diff --git a/src/gui/kernel/qplatformscreen_qpa.cpp b/src/gui/kernel/qplatformscreen_qpa.cpp new file mode 100644 index 0000000..478d2d6 --- /dev/null +++ b/src/gui/kernel/qplatformscreen_qpa.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformscreen_qpa.h" +#include +#include + +QWidget *QPlatformScreen::topLevelAt(const QPoint & pos) const +{ + QWidgetList list = QApplication::topLevelWidgets(); + for (int i = list.size()-1; i >= 0; --i) { + QWidget *w = list[i]; + //### mask is ignored + if (w != QApplication::desktop() && w->isVisible() && w->geometry().contains(pos)) + return w; + } + + return 0; +} + +QSize QPlatformScreen::physicalSize() const +{ + static const int dpi = 100; + int width = geometry().width() / dpi * qreal(25.4) ; + int height = geometry().height() / dpi * qreal(25.4) ; + return QSize(width,height); +} + diff --git a/src/gui/kernel/qplatformscreen_qpa.h b/src/gui/kernel/qplatformscreen_qpa.h new file mode 100644 index 0000000..7d0e28d --- /dev/null +++ b/src/gui/kernel/qplatformscreen_qpa.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMSCREEN_H +#define QPLATFORMSCREEN_H + +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class Q_GUI_EXPORT QPlatformScreen : public QObject +{ + Q_OBJECT +public: + virtual ~QPlatformScreen() { } + + virtual QRect geometry() const = 0; + virtual QRect availableGeometry() const {return geometry();}; + virtual int depth() const = 0; + virtual QImage::Format format() const = 0; + virtual QSize physicalSize() const; + virtual void setDirty(const QRect &) {} + virtual QWidget *topLevelAt(const QPoint &point) const; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPLATFORMSCREEN_H diff --git a/src/gui/kernel/qplatformwindow_lite.cpp b/src/gui/kernel/qplatformwindow_lite.cpp deleted file mode 100644 index 9efbf8b..0000000 --- a/src/gui/kernel/qplatformwindow_lite.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include "qplatformwindow_lite.h" - -#include - -class QPlatformWindowPrivate -{ - QWidget *tlw; - QRect rect; - friend class QPlatformWindow; -}; - -QPlatformWindow::QPlatformWindow(QWidget *tlw) - : d_ptr(new QPlatformWindowPrivate) -{ - Q_D(QPlatformWindow); - d->tlw = tlw; - tlw->setPlatformWindow(this); -} - -QPlatformWindow::~QPlatformWindow() -{ -} - -QWidget *QPlatformWindow::widget() const -{ - Q_D(const QPlatformWindow); - return d->tlw; -} - -void QPlatformWindow::setGeometry(const QRect &rect) -{ - Q_D(QPlatformWindow); - d->rect = rect; -} - -QRect QPlatformWindow::geometry() const -{ - Q_D(const QPlatformWindow); - return d->rect; -} - -/*! -Reimplemented in subclasses to show the surface if \a visible is \c true, and hide it if \a visible is \c false. -*/ -void QPlatformWindow::setVisible(bool visible) -{ - Q_UNUSED(visible); -} -/*! -Requests setting the window flags of this surface to \a type. Returns the actual flags set. -*/ -Qt::WindowFlags QPlatformWindow::setWindowFlags(Qt::WindowFlags flags) -{ - Q_UNUSED(flags); - return Qt::Window; -} - -/*! - Returns the effective window flags for this surface. -*/ -Qt::WindowFlags QPlatformWindow::windowFlags() const -{ - return Qt::Window; -} - -WId QPlatformWindow::winId() const { return WId(0); } - -void QPlatformWindow::setParent(const QPlatformWindow *) { qWarning("This plugin does not support setParent!"); } - -void QPlatformWindow::setWindowTitle(const QString &) {} - -void QPlatformWindow::raise() { qWarning("This plugin does not support raise()"); } - -void QPlatformWindow::lower() { qWarning("This plugin does not support lower()"); } - -void QPlatformWindow::setOpacity(qreal level) -{ - Q_UNUSED(level); - qWarning("This plugin does not support setting window opacity"); -} - -QPlatformGLContext *QPlatformWindow::glContext() -{ - return 0; -} diff --git a/src/gui/kernel/qplatformwindow_lite.h b/src/gui/kernel/qplatformwindow_lite.h deleted file mode 100644 index 5f8d259..0000000 --- a/src/gui/kernel/qplatformwindow_lite.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QPLATFORMWINDOW_H -#define QPLATFORMWINDOW_H - - -#include -#include -#include -#include - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QPlatformWindowPrivate; -class QWidget; -class QPlatformGLContext; - -class Q_GUI_EXPORT QPlatformWindow -{ - Q_DECLARE_PRIVATE(QPlatformWindow); -public: - QPlatformWindow(QWidget *tlw); - virtual ~QPlatformWindow(); - - QWidget *widget() const; - virtual void setGeometry(const QRect &rect); - virtual QRect geometry() const; - - virtual void setVisible(bool visible); - virtual Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); - virtual Qt::WindowFlags windowFlags() const; - virtual WId winId() const; - virtual void setParent(const QPlatformWindow *window); - - virtual void setWindowTitle(const QString &); - virtual void raise(); - virtual void lower(); - - virtual void setOpacity(qreal level); - - virtual QPlatformGLContext *glContext(); -protected: - QScopedPointer d_ptr; -}; - -QT_END_NAMESPACE - -QT_END_HEADER -#endif //QPLATFORMWINDOW_H diff --git a/src/gui/kernel/qplatformwindow_qpa.cpp b/src/gui/kernel/qplatformwindow_qpa.cpp new file mode 100644 index 0000000..c0e642c --- /dev/null +++ b/src/gui/kernel/qplatformwindow_qpa.cpp @@ -0,0 +1,85 @@ +#include "qplatformwindow_qpa.h" + +#include + +class QPlatformWindowPrivate +{ + QWidget *tlw; + QRect rect; + friend class QPlatformWindow; +}; + +QPlatformWindow::QPlatformWindow(QWidget *tlw) + : d_ptr(new QPlatformWindowPrivate) +{ + Q_D(QPlatformWindow); + d->tlw = tlw; + tlw->setPlatformWindow(this); +} + +QPlatformWindow::~QPlatformWindow() +{ +} + +QWidget *QPlatformWindow::widget() const +{ + Q_D(const QPlatformWindow); + return d->tlw; +} + +void QPlatformWindow::setGeometry(const QRect &rect) +{ + Q_D(QPlatformWindow); + d->rect = rect; +} + +QRect QPlatformWindow::geometry() const +{ + Q_D(const QPlatformWindow); + return d->rect; +} + +/*! +Reimplemented in subclasses to show the surface if \a visible is \c true, and hide it if \a visible is \c false. +*/ +void QPlatformWindow::setVisible(bool visible) +{ + Q_UNUSED(visible); +} +/*! +Requests setting the window flags of this surface to \a type. Returns the actual flags set. +*/ +Qt::WindowFlags QPlatformWindow::setWindowFlags(Qt::WindowFlags flags) +{ + Q_UNUSED(flags); + return Qt::Window; +} + +/*! + Returns the effective window flags for this surface. +*/ +Qt::WindowFlags QPlatformWindow::windowFlags() const +{ + return Qt::Window; +} + +WId QPlatformWindow::winId() const { return WId(0); } + +void QPlatformWindow::setParent(const QPlatformWindow *) { qWarning("This plugin does not support setParent!"); } + +void QPlatformWindow::setWindowTitle(const QString &) {} + +void QPlatformWindow::raise() { qWarning("This plugin does not support raise()"); } + +void QPlatformWindow::lower() { qWarning("This plugin does not support lower()"); } + +void QPlatformWindow::setOpacity(qreal level) +{ + Q_UNUSED(level); + qWarning("This plugin does not support setting window opacity"); +} + +QPlatformGLContext *QPlatformWindow::glContext() +{ + return 0; +} diff --git a/src/gui/kernel/qplatformwindow_qpa.h b/src/gui/kernel/qplatformwindow_qpa.h new file mode 100644 index 0000000..5f8d259 --- /dev/null +++ b/src/gui/kernel/qplatformwindow_qpa.h @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QPLATFORMWINDOW_H +#define QPLATFORMWINDOW_H + + +#include +#include +#include +#include + + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QPlatformWindowPrivate; +class QWidget; +class QPlatformGLContext; + +class Q_GUI_EXPORT QPlatformWindow +{ + Q_DECLARE_PRIVATE(QPlatformWindow); +public: + QPlatformWindow(QWidget *tlw); + virtual ~QPlatformWindow(); + + QWidget *widget() const; + virtual void setGeometry(const QRect &rect); + virtual QRect geometry() const; + + virtual void setVisible(bool visible); + virtual Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); + virtual Qt::WindowFlags windowFlags() const; + virtual WId winId() const; + virtual void setParent(const QPlatformWindow *window); + + virtual void setWindowTitle(const QString &); + virtual void raise(); + virtual void lower(); + + virtual void setOpacity(qreal level); + + virtual QPlatformGLContext *glContext(); +protected: + QScopedPointer d_ptr; +}; + +QT_END_NAMESPACE + +QT_END_HEADER +#endif //QPLATFORMWINDOW_H diff --git a/src/gui/kernel/qsound_lite.cpp b/src/gui/kernel/qsound_lite.cpp deleted file mode 100644 index a4c74a8..0000000 --- a/src/gui/kernel/qsound_lite.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qapplication.h" - -#ifndef QT_NO_SOUND - -#include "qsound.h" -#include "qsound_p.h" - -class QAuServerLite : public QAuServer -{ - Q_OBJECT -public: - QAuServerLite( QObject* parent ); - - void play( QSound* s ) {} - void stop( QSound* s ) {} - bool okay() { return false; } -}; - -QAuServerLite::QAuServerLite(QObject* parent) : - QAuServer(parent) -{ -} - -QAuServer* qt_new_audio_server() -{ - return new QAuServerLite(qApp); -} - -#include "qsound_lite.moc" - -#endif // QT_NO_SOUND - -QT_END_NAMESPACE diff --git a/src/gui/kernel/qsound_qpa.cpp b/src/gui/kernel/qsound_qpa.cpp new file mode 100644 index 0000000..0714185 --- /dev/null +++ b/src/gui/kernel/qsound_qpa.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qapplication.h" + +#ifndef QT_NO_SOUND + +#include "qsound.h" +#include "qsound_p.h" + +class QAuServerLite : public QAuServer +{ + Q_OBJECT +public: + QAuServerLite( QObject* parent ); + + void play( QSound* s ) {} + void stop( QSound* s ) {} + bool okay() { return false; } +}; + +QAuServerLite::QAuServerLite(QObject* parent) : + QAuServer(parent) +{ +} + +QAuServer* qt_new_audio_server() +{ + return new QAuServerLite(qApp); +} + +#include "qsound_qpa.moc" + +#endif // QT_NO_SOUND + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 57e3a31..53b35dd 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -76,7 +76,7 @@ # include "private/qwindowsurface_qws_p.h" #endif #if defined(Q_WS_QPA) -#include "qplatformwindow_lite.h" +#include "qplatformwindow_qpa.h" #endif #include "qpainter.h" #include "qtooltip.h" diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp deleted file mode 100644 index f92eb61..0000000 --- a/src/gui/kernel/qwidget_lite.cpp +++ /dev/null @@ -1,809 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "QtGui/qwidget.h" -#include "QtGui/qevent.h" -#include "QtGui/qapplication.h" -#include "QtGui/private/qbackingstore_p.h" -#include "QtGui/private/qwidget_p.h" -#include "QtGui/private/qgraphicssystem_p.h" -#include "QtGui/private/qapplication_p.h" -#include "QtGui/qdesktopwidget.h" -#include "QtGui/qplatformwindow_lite.h" - -#include - -QT_BEGIN_NAMESPACE -static QPlatformScreen *qt_screenForWidget(const QWidget *w); - -void setParentForChildrenOfWidget(QPlatformWindow *window, const QWidget *widget) -{ - QObjectList children = widget->children(); - for (int i = 0; i < children.size(); i++) { - if (children.at(i)->isWidgetType()) { - const QWidget *childWidget = qobject_cast(children.at(i)); - if (childWidget) { // should not be nessesary - if (childWidget->platformWindow()) { - childWidget->platformWindow()->setParent(window); - } else { - setParentForChildrenOfWidget(window,childWidget); - } - } - } - } -} - -void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyOldWindow) -{ - Q_Q(QWidget); - - Q_UNUSED(window); - Q_UNUSED(initializeWindow); - Q_UNUSED(destroyOldWindow); - // XXX - - Qt::WindowFlags flags = data.window_flags; - - if ((!q->testAttribute(Qt::WA_NativeWindow) && !q->isWindow()) || q->windowType() == Qt::Desktop ) - return; // we only care about real toplevels - - QWindowSurface *surface = q->windowSurface(); - QPlatformWindow *platformWindow = q->platformWindow(); - - if (!platformWindow) { - platformWindow = QApplicationPrivate::platformIntegration()->createPlatformWindow(q); - } - Q_ASSERT(platformWindow); - - if (!surface) { - surface = QApplicationPrivate::platformIntegration()->createWindowSurface(q,platformWindow->winId()); - } - - data.window_flags = q->platformWindow()->setWindowFlags(data.window_flags); - - setWinId(q->platformWindow()->winId()); - - //first check children. then find who for parent. - setParentForChildrenOfWidget(platformWindow,q); - if (QWidget *nativeParent = q->nativeParentWidget()) { - if (nativeParent->platformWindow()) { - platformWindow->setParent(nativeParent->platformWindow()); - } - } - - QApplicationPrivate::platformIntegration()->moveToScreen(q, screenNumber); -// qDebug() << "create_sys" << q << q->internalWinId(); -} - -void QWidget::destroy(bool destroyWindow, bool destroySubWindows) -{ - Q_D(QWidget); - //### jl: subwindows now enabled - Q_UNUSED(destroySubWindows); - - if ((windowType() == Qt::Popup)) - qApp->d_func()->closePopup(this); - - //### we don't have proper focus event handling yet - if (this == QApplicationPrivate::active_window) - QApplication::setActiveWindow(0); - - if (windowType() != Qt::Desktop) { - if (destroyWindow && isWindow()) { - QTLWExtra *topData = d->maybeTopData(); - if (topData) { - delete topData->platformWindow; - topData->platformWindow = 0; - } - } else { - if (parentWidget() && parentWidget()->testAttribute(Qt::WA_WState_Created)) { - d->hide_sys(); - } - } - } -} - -void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) -{ - Q_Q(QWidget); - - // QWidget *oldParent = q->parentWidget(); - Qt::WindowFlags oldFlags = data.window_flags; - - int targetScreen = -1; - // Handle a request to move the widget to a particular screen - if (newparent && newparent->windowType() == Qt::Desktop) { - // make sure the widget is created on the same screen as the - // programmer specified desktop widget - - // get the desktop's screen number - targetScreen = newparent->d_func()->screenNumber; - newparent = 0; - } - - if (parent != newparent) { - QObjectPrivate::setParent_helper(newparent); //### why does this have to be done in the _sys function??? - if (q->platformWindow()) { - QWidget * parentWithWindow = newparent->platformWindow()? newparent : newparent->nativeParentWidget(); - if (parentWithWindow && parentWithWindow->platformWindow()) { - q->platformWindow()->setParent(parentWithWindow->platformWindow()); - } - } - - } - - if (!newparent) { - f |= Qt::Window; - if (targetScreen == -1) { - if (parent) - targetScreen = qobject_cast(parent)->d_func()->screenNumber; - } - } - - bool explicitlyHidden = q->testAttribute(Qt::WA_WState_Hidden) && q->testAttribute(Qt::WA_WState_ExplicitShowHide); - - data.window_flags = f; - q->setAttribute(Qt::WA_WState_Created, false); - q->setAttribute(Qt::WA_WState_Visible, false); - q->setAttribute(Qt::WA_WState_Hidden, false); - - if (f & Qt::Window) { - //qDebug() << "setParent_sys" << q << newparent << hex << f; - if (QPlatformWindow *window = q->platformWindow()) - data.window_flags = window->setWindowFlags(data.window_flags); - } - // XXX Reparenting child to toplevel or vice versa ### - if ((f&Qt::Window) && !(oldFlags&Qt::Window)) { - //qDebug() << "setParent_sys() change to toplevel"; - q->create(); //### this cannot be right - } else if ((f&Qt::Window) && !(oldFlags&Qt::Window)) { - qDebug() << "######## setParent_sys() change from toplevel not implemented ########"; - } - - - if (q->isWindow() || (!newparent || newparent->isVisible()) || explicitlyHidden) - q->setAttribute(Qt::WA_WState_Hidden); - q->setAttribute(Qt::WA_WState_ExplicitShowHide, explicitlyHidden); - - // move the window to the selected screen - if (!newparent && targetScreen != -1) { - screenNumber = targetScreen; - // only if it is already created - if (q->testAttribute(Qt::WA_WState_Created)) { - QPlatformIntegration *platform = QApplicationPrivate::platformIntegration(); - platform->moveToScreen(q, targetScreen); - } - } -} - -QPoint QWidget::mapToGlobal(const QPoint &pos) const -{ - int x=pos.x(), y=pos.y(); - const QWidget* w = this; - while (w) { - x += w->data->crect.x(); - y += w->data->crect.y(); - w = w->isWindow() ? 0 : w->parentWidget(); - } - return QPoint(x, y); -} - -QPoint QWidget::mapFromGlobal(const QPoint &pos) const -{ - int x=pos.x(), y=pos.y(); - const QWidget* w = this; - while (w) { - x -= w->data->crect.x(); - y -= w->data->crect.y(); - w = w->isWindow() ? 0 : w->parentWidget(); - } - return QPoint(x, y); -} - -void QWidgetPrivate::updateSystemBackground() {} - -#ifndef QT_NO_CURSOR -void QWidgetPrivate::setCursor_sys(const QCursor &cursor) -{ - Q_UNUSED(cursor); - Q_Q(QWidget); - if (q->isVisible()) - qt_lite_set_cursor(q, false); -} - -void QWidgetPrivate::unsetCursor_sys() -{ - Q_Q(QWidget); - if (q->isVisible()) - qt_lite_set_cursor(q, false); -} - -void QWidgetPrivate::updateCursor() const -{ - // XXX -} - -#endif //QT_NO_CURSOR - -void QWidgetPrivate::setWindowTitle_sys(const QString &caption) -{ - Q_Q(QWidget); - if (!q->isWindow()) - return; - - if (QPlatformWindow *window = q->platformWindow()) - window->setWindowTitle(caption); - -} - -void QWidgetPrivate::setWindowIcon_sys(bool /*forceReset*/) -{ -} - -void QWidgetPrivate::setWindowIconText_sys(const QString &iconText) -{ - Q_UNUSED(iconText); -} - -QWidget *qt_pressGrab = 0; -QWidget *qt_mouseGrb = 0; -static QWidget *keyboardGrb = 0; - -void QWidget::grabMouse() -{ - if (qt_mouseGrb) - qt_mouseGrb->releaseMouse(); - - // XXX - //qwsDisplay()->grabMouse(this,true); - - qt_mouseGrb = this; - qt_pressGrab = 0; -} - -#ifndef QT_NO_CURSOR -void QWidget::grabMouse(const QCursor &cursor) -{ - Q_UNUSED(cursor); - - if (qt_mouseGrb) - qt_mouseGrb->releaseMouse(); - - // XXX - //qwsDisplay()->grabMouse(this,true); - //qwsDisplay()->selectCursor(this, cursor.handle()); - qt_mouseGrb = this; - qt_pressGrab = 0; -} -#endif - -void QWidget::releaseMouse() -{ - if (qt_mouseGrb == this) { - // XXX - //qwsDisplay()->grabMouse(this,false); - qt_mouseGrb = 0; - } -} - -void QWidget::grabKeyboard() -{ - if (keyboardGrb) - keyboardGrb->releaseKeyboard(); - // XXX - //qwsDisplay()->grabKeyboard(this, true); - keyboardGrb = this; -} - -void QWidget::releaseKeyboard() -{ - if (keyboardGrb == this) { - // XXX - //qwsDisplay()->grabKeyboard(this, false); - keyboardGrb = 0; - } -} - -QWidget *QWidget::mouseGrabber() -{ - if (qt_mouseGrb) - return qt_mouseGrb; - return qt_pressGrab; -} - -QWidget *QWidget::keyboardGrabber() -{ - return keyboardGrb; -} - -void QWidget::activateWindow() -{ - // XXX -// qDebug() << "QWidget::activateWindow" << this; - QApplication::setActiveWindow(this); //##### -} - -void QWidgetPrivate::show_sys() -{ - Q_Q(QWidget); - q->setAttribute(Qt::WA_Mapped); - if (q->testAttribute(Qt::WA_DontShowOnScreen)) { - invalidateBuffer(q->rect()); - return; - } - - QApplication::postEvent(q, new QUpdateLaterEvent(q->rect())); - - QPlatformWindow *window = q->platformWindow(); - if (window) { - const QRect geomRect = q->geometry(); - const QRect windowRect = window->geometry(); - if (windowRect != geomRect) { - window->setGeometry(geomRect); - } - if (q->isWindow()) { - if (QWindowSurface *surface = q->windowSurface()) - if (windowRect.size() != geomRect.size()) { - surface->resize(geomRect.size()); - } - - if (window) - window->setVisible(true); - - if (q->windowType() != Qt::Popup && q->windowType() != Qt::ToolTip && !(q->windowFlags() & Qt::X11BypassWindowManagerHint)) - q->activateWindow(); //### - } - } -} - - -void QWidgetPrivate::hide_sys() -{ - Q_Q(QWidget); - q->setAttribute(Qt::WA_Mapped, false); - if (!q->isWindow()) { - QWidget *p = q->parentWidget(); - if (p &&p->isVisible()) { - invalidateBuffer(q->rect()); - } - return; - } - if (QPlatformWindow *window = q->platformWindow()) { - window->setVisible(false); - } - - //### we don't yet have proper focus event handling - if (q == QApplicationPrivate::active_window) - QApplication::setActiveWindow(0); - -} - -void QWidgetPrivate::setMaxWindowState_helper() -{ - setFullScreenSize_helper(); //### decoration size -} - -void QWidgetPrivate::setFullScreenSize_helper() -{ - Q_Q(QWidget); - - const uint old_state = data.in_set_window_state; - data.in_set_window_state = 1; - - const QRect screen = qApp->desktop()->screenGeometry(qApp->desktop()->screenNumber(q)); - q->move(screen.topLeft()); - q->resize(screen.size()); - - data.in_set_window_state = old_state; -} - -static Qt::WindowStates effectiveState(Qt::WindowStates state) - { - if (state & Qt::WindowMinimized) - return Qt::WindowMinimized; - else if (state & Qt::WindowFullScreen) - return Qt::WindowFullScreen; - else if (state & Qt::WindowMaximized) - return Qt::WindowMaximized; - return Qt::WindowNoState; - } - -void QWidget::setWindowState(Qt::WindowStates newstate) -{ - Q_D(QWidget); - Qt::WindowStates oldstate = windowState(); - if (oldstate == newstate) - return; - if (isWindow() && !testAttribute(Qt::WA_WState_Created)) - create(); - - data->window_state = newstate; - data->in_set_window_state = 1; - bool needShow = false; - Qt::WindowStates newEffectiveState = effectiveState(newstate); - Qt::WindowStates oldEffectiveState = effectiveState(oldstate); - if (isWindow() && newEffectiveState != oldEffectiveState) { - d->createTLExtra(); - if (oldEffectiveState == Qt::WindowNoState) { //normal - d->topData()->normalGeometry = geometry(); - } else if (oldEffectiveState == Qt::WindowFullScreen) { - setParent(0, d->topData()->savedFlags); - needShow = true; - } else if (oldEffectiveState == Qt::WindowMinimized) { - needShow = true; - } - - if (newEffectiveState == Qt::WindowMinimized) { - //### not ideal... - hide(); - needShow = false; - } else if (newEffectiveState == Qt::WindowFullScreen) { - d->topData()->savedFlags = windowFlags(); - setParent(0, Qt::FramelessWindowHint | (windowFlags() & Qt::WindowStaysOnTopHint)); - d->setFullScreenSize_helper(); - raise(); - needShow = true; - } else if (newEffectiveState == Qt::WindowMaximized) { - createWinId(); - d->setMaxWindowState_helper(); - } else { //normal - QRect r = d->topData()->normalGeometry; - if (r.width() >= 0) { - d->topData()->normalGeometry = QRect(0,0,-1,-1); - setGeometry(r); - } - } - } - data->in_set_window_state = 0; - - if (needShow) - show(); - - if (newstate & Qt::WindowActive) - activateWindow(); - - QWindowStateChangeEvent e(oldstate); - QApplication::sendEvent(this, &e); -} - -void QWidgetPrivate::setFocus_sys() -{ - -} - -void QWidgetPrivate::raise_sys() -{ - Q_Q(QWidget); - if (q->isWindow()) { - q->platformWindow()->raise(); - } -} - -void QWidgetPrivate::lower_sys() -{ - Q_Q(QWidget); - if (q->isWindow()) { - Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); - q->platformWindow()->lower(); - } else if (QWidget *p = q->parentWidget()) { - setDirtyOpaqueRegion(); - p->d_func()->invalidateBuffer(effectiveRectFor(q->geometry())); - } -} - -void QWidgetPrivate::stackUnder_sys(QWidget*) -{ - Q_Q(QWidget); - if (QWidget *p = q->parentWidget()) { - setDirtyOpaqueRegion(); - p->d_func()->invalidateBuffer(effectiveRectFor(q->geometry())); - } -} - -void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) -{ - Q_Q(QWidget); - if (extra) { // any size restrictions? - w = qMin(w,extra->maxw); - h = qMin(h,extra->maxh); - w = qMax(w,extra->minw); - h = qMax(h,extra->minh); - } - - QPoint oldp = q->geometry().topLeft(); - QSize olds = q->size(); - QRect r(x, y, w, h); - - bool isResize = olds != r.size(); - isMove = oldp != r.topLeft(); //### why do we have isMove as a parameter? - - - // We only care about stuff that changes the geometry, or may - // cause the window manager to change its state - if (r.size() == olds && oldp == r.topLeft()) - return; - - if (!data.in_set_window_state) { - q->data->window_state &= ~Qt::WindowMaximized; - q->data->window_state &= ~Qt::WindowFullScreen; - if (q->isWindow()) - topData()->normalGeometry = QRect(0, 0, -1, -1); - } - - QPoint oldPos = q->pos(); - data.crect = r; - - if (q->isVisible()) { - if (q->platformWindow()) { - if (q->isWindow()) { - q->platformWindow()->setGeometry(q->frameGeometry()); - } else { - QPoint posInNativeParent = q->mapTo(q->nativeParentWidget(),QPoint()); - q->platformWindow()->setGeometry(QRect(posInNativeParent,r.size())); - } - const QWidgetBackingStore *bs = maybeBackingStore(); - if (bs->windowSurface) { - if (isResize) - bs->windowSurface->resize(r.size()); - } - } else { - if (isMove && !isResize) - moveRect(QRect(oldPos, olds), x - oldPos.x(), y - oldPos.y()); - else - invalidateBuffer_resizeHelper(oldPos, olds); - } - - if (isMove) { - QMoveEvent e(q->pos(), oldPos); - QApplication::sendEvent(q, &e); - } - if (isResize) { - QResizeEvent e(r.size(), olds); - QApplication::sendEvent(q, &e); - if (q->isWindow()) - q->update(); - } - } else { // not visible - if (isMove && q->pos() != oldPos) - q->setAttribute(Qt::WA_PendingMoveEvent, true); - if (isResize) - q->setAttribute(Qt::WA_PendingResizeEvent, true); - } - -} - -void QWidgetPrivate::setConstraints_sys() -{ -} - -void QWidgetPrivate::scroll_sys(int dx, int dy) -{ - Q_Q(QWidget); - scrollChildren(dx, dy); - scrollRect(q->rect(), dx, dy); -} - -void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r) -{ - scrollRect(r, dx, dy); -} - -static QPlatformScreen *qt_screenForWidget(const QWidget *w) -{ - if (!w) - return 0; - QRect frame = w->frameGeometry(); - if (!w->isWindow()) - frame.moveTopLeft(w->mapToGlobal(QPoint(0, 0))); - const QPoint p = (frame.topLeft() + frame.bottomRight()) / 2; - - QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); - QList screens = pi->screens(); - - for (int i = 0; i < screens.size(); ++i) { - if (screens[i]->geometry().contains(p)) - return screens[i]; - } - - // Assume screen zero if we have it. - if (!screens.isEmpty()) - return screens[0]; - else - qWarning("qt_screenForWidget: no screens"); - - return 0; -} - -int QWidget::metric(PaintDeviceMetric m) const -{ - Q_D(const QWidget); - - QPlatformScreen *screen = qt_screenForWidget(this); - if (!screen) { - if (m == PdmDpiX || m == PdmDpiY) - return 72; - return QPaintDevice::metric(m); - } - int val; - if (m == PdmWidth) { - val = data->crect.width(); - } else if (m == PdmWidthMM) { - val = data->crect.width() * screen->physicalSize().width() / screen->geometry().width(); - } else if (m == PdmHeight) { - val = data->crect.height(); - } else if (m == PdmHeightMM) { - val = data->crect.height() * screen->physicalSize().height() / screen->geometry().height(); - } else if (m == PdmDepth) { - return screen->depth(); - } else if (m == PdmDpiX || m == PdmPhysicalDpiX) { - if (d->extra && d->extra->customDpiX) - return d->extra->customDpiX; - else if (d->parent) - return static_cast(d->parent)->metric(m); - return qRound(screen->geometry().width() / double(screen->physicalSize().width() / 25.4)); - } else if (m == PdmDpiY || m == PdmPhysicalDpiY) { - if (d->extra && d->extra->customDpiY) - return d->extra->customDpiY; - else if (d->parent) - return static_cast(d->parent)->metric(m); - return qRound(screen->geometry().height() / double(screen->physicalSize().height() / 25.4)); - } else { - val = QPaintDevice::metric(m);// XXX - } - return val; -} - -void QWidgetPrivate::createSysExtra() -{ -} - -void QWidgetPrivate::deleteSysExtra() -{ -} - -void QWidgetPrivate::createTLSysExtra() -{ -} - -void QWidgetPrivate::deleteTLSysExtra() -{ -} - -void QWidgetPrivate::registerDropSite(bool on) -{ - Q_UNUSED(on); -} - -void QWidgetPrivate::setMask_sys(const QRegion ®ion) -{ - Q_UNUSED(region); - // XXX -} - -void QWidgetPrivate::updateFrameStrut() -{ - // XXX -} - -void QWidgetPrivate::setWindowOpacity_sys(qreal level) -{ - Q_Q(QWidget); - q->platformWindow()->setOpacity(level); -} - -void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect) -{ - Q_UNUSED(dontShow); - Q_UNUSED(oldRect); - // XXX -} - -QPaintEngine *QWidget::paintEngine() const -{ - qWarning("QWidget::paintEngine: Should no longer be called"); - return 0; //##### @@@ -} - -QWindowSurface *QWidgetPrivate::createDefaultWindowSurface_sys() -{ - Q_Q(QWidget); - return QApplicationPrivate::platformIntegration()->createWindowSurface(q,0); -} - -void QWidgetPrivate::setModal_sys() -{ -} - -#ifndef QT_NO_CURSOR -void qt_lite_set_cursor(QWidget * w, bool force) -{ - static QCursor arrowCursor(Qt::ArrowCursor); - static QPointer lastUnderMouse = 0; - - QCursor * override = QApplication::overrideCursor(); - - if (override && w != 0) - return; - - QWidget *cursorWidget; - QCursor cursorCursor; - - do { - if (w == 0) { - if (override) { - cursorCursor = *override; - cursorWidget = QApplication::topLevelAt(QCursor::pos()); - break; - } - w = QApplication::widgetAt(QCursor::pos()); - if (w == 0) // clear the override cursor while over empty space - w = QApplication::desktop(); - } else if (force) { - lastUnderMouse = w; - } else if (w->testAttribute(Qt::WA_WState_Created) && lastUnderMouse - && lastUnderMouse->effectiveWinId() == w->effectiveWinId()) { - w = lastUnderMouse; - } - if (w == QApplication::desktop() && !override) { - cursorCursor = arrowCursor; - cursorWidget = w; - break; - } - - QWidget * curWin = QApplication::activeWindow(); - if (!curWin && w && w->internalWinId()) - return; - QWidget* cW = w && !w->internalWinId() ? w : curWin; - - if (!cW || cW->window() != w->window() || - !cW->isVisible() || !cW->underMouse() || override) - return; - - cursorCursor = w->cursor(); - cursorWidget = w; - } while (0); - foreach (QWeakPointer cursor, QGraphicsSystemCursorPrivate::getInstances()) - if (cursor) - cursor.data()->changeCursor(&cursorCursor, cursorWidget); -} -#endif //QT_NO_CURSOR - -QT_END_NAMESPACE diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp new file mode 100644 index 0000000..11fa211 --- /dev/null +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -0,0 +1,809 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "QtGui/qwidget.h" +#include "QtGui/qevent.h" +#include "QtGui/qapplication.h" +#include "QtGui/private/qbackingstore_p.h" +#include "QtGui/private/qwidget_p.h" +#include "QtGui/private/qgraphicssystem_p.h" +#include "QtGui/private/qapplication_p.h" +#include "QtGui/qdesktopwidget.h" +#include "QtGui/qplatformwindow_qpa.h" + +#include + +QT_BEGIN_NAMESPACE +static QPlatformScreen *qt_screenForWidget(const QWidget *w); + +void setParentForChildrenOfWidget(QPlatformWindow *window, const QWidget *widget) +{ + QObjectList children = widget->children(); + for (int i = 0; i < children.size(); i++) { + if (children.at(i)->isWidgetType()) { + const QWidget *childWidget = qobject_cast(children.at(i)); + if (childWidget) { // should not be nessesary + if (childWidget->platformWindow()) { + childWidget->platformWindow()->setParent(window); + } else { + setParentForChildrenOfWidget(window,childWidget); + } + } + } + } +} + +void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyOldWindow) +{ + Q_Q(QWidget); + + Q_UNUSED(window); + Q_UNUSED(initializeWindow); + Q_UNUSED(destroyOldWindow); + // XXX + + Qt::WindowFlags flags = data.window_flags; + + if ((!q->testAttribute(Qt::WA_NativeWindow) && !q->isWindow()) || q->windowType() == Qt::Desktop ) + return; // we only care about real toplevels + + QWindowSurface *surface = q->windowSurface(); + QPlatformWindow *platformWindow = q->platformWindow(); + + if (!platformWindow) { + platformWindow = QApplicationPrivate::platformIntegration()->createPlatformWindow(q); + } + Q_ASSERT(platformWindow); + + if (!surface) { + surface = QApplicationPrivate::platformIntegration()->createWindowSurface(q,platformWindow->winId()); + } + + data.window_flags = q->platformWindow()->setWindowFlags(data.window_flags); + + setWinId(q->platformWindow()->winId()); + + //first check children. then find who for parent. + setParentForChildrenOfWidget(platformWindow,q); + if (QWidget *nativeParent = q->nativeParentWidget()) { + if (nativeParent->platformWindow()) { + platformWindow->setParent(nativeParent->platformWindow()); + } + } + + QApplicationPrivate::platformIntegration()->moveToScreen(q, screenNumber); +// qDebug() << "create_sys" << q << q->internalWinId(); +} + +void QWidget::destroy(bool destroyWindow, bool destroySubWindows) +{ + Q_D(QWidget); + //### jl: subwindows now enabled + Q_UNUSED(destroySubWindows); + + if ((windowType() == Qt::Popup)) + qApp->d_func()->closePopup(this); + + //### we don't have proper focus event handling yet + if (this == QApplicationPrivate::active_window) + QApplication::setActiveWindow(0); + + if (windowType() != Qt::Desktop) { + if (destroyWindow && isWindow()) { + QTLWExtra *topData = d->maybeTopData(); + if (topData) { + delete topData->platformWindow; + topData->platformWindow = 0; + } + } else { + if (parentWidget() && parentWidget()->testAttribute(Qt::WA_WState_Created)) { + d->hide_sys(); + } + } + } +} + +void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) +{ + Q_Q(QWidget); + + // QWidget *oldParent = q->parentWidget(); + Qt::WindowFlags oldFlags = data.window_flags; + + int targetScreen = -1; + // Handle a request to move the widget to a particular screen + if (newparent && newparent->windowType() == Qt::Desktop) { + // make sure the widget is created on the same screen as the + // programmer specified desktop widget + + // get the desktop's screen number + targetScreen = newparent->d_func()->screenNumber; + newparent = 0; + } + + if (parent != newparent) { + QObjectPrivate::setParent_helper(newparent); //### why does this have to be done in the _sys function??? + if (q->platformWindow()) { + QWidget * parentWithWindow = newparent->platformWindow()? newparent : newparent->nativeParentWidget(); + if (parentWithWindow && parentWithWindow->platformWindow()) { + q->platformWindow()->setParent(parentWithWindow->platformWindow()); + } + } + + } + + if (!newparent) { + f |= Qt::Window; + if (targetScreen == -1) { + if (parent) + targetScreen = qobject_cast(parent)->d_func()->screenNumber; + } + } + + bool explicitlyHidden = q->testAttribute(Qt::WA_WState_Hidden) && q->testAttribute(Qt::WA_WState_ExplicitShowHide); + + data.window_flags = f; + q->setAttribute(Qt::WA_WState_Created, false); + q->setAttribute(Qt::WA_WState_Visible, false); + q->setAttribute(Qt::WA_WState_Hidden, false); + + if (f & Qt::Window) { + //qDebug() << "setParent_sys" << q << newparent << hex << f; + if (QPlatformWindow *window = q->platformWindow()) + data.window_flags = window->setWindowFlags(data.window_flags); + } + // XXX Reparenting child to toplevel or vice versa ### + if ((f&Qt::Window) && !(oldFlags&Qt::Window)) { + //qDebug() << "setParent_sys() change to toplevel"; + q->create(); //### this cannot be right + } else if ((f&Qt::Window) && !(oldFlags&Qt::Window)) { + qDebug() << "######## setParent_sys() change from toplevel not implemented ########"; + } + + + if (q->isWindow() || (!newparent || newparent->isVisible()) || explicitlyHidden) + q->setAttribute(Qt::WA_WState_Hidden); + q->setAttribute(Qt::WA_WState_ExplicitShowHide, explicitlyHidden); + + // move the window to the selected screen + if (!newparent && targetScreen != -1) { + screenNumber = targetScreen; + // only if it is already created + if (q->testAttribute(Qt::WA_WState_Created)) { + QPlatformIntegration *platform = QApplicationPrivate::platformIntegration(); + platform->moveToScreen(q, targetScreen); + } + } +} + +QPoint QWidget::mapToGlobal(const QPoint &pos) const +{ + int x=pos.x(), y=pos.y(); + const QWidget* w = this; + while (w) { + x += w->data->crect.x(); + y += w->data->crect.y(); + w = w->isWindow() ? 0 : w->parentWidget(); + } + return QPoint(x, y); +} + +QPoint QWidget::mapFromGlobal(const QPoint &pos) const +{ + int x=pos.x(), y=pos.y(); + const QWidget* w = this; + while (w) { + x -= w->data->crect.x(); + y -= w->data->crect.y(); + w = w->isWindow() ? 0 : w->parentWidget(); + } + return QPoint(x, y); +} + +void QWidgetPrivate::updateSystemBackground() {} + +#ifndef QT_NO_CURSOR +void QWidgetPrivate::setCursor_sys(const QCursor &cursor) +{ + Q_UNUSED(cursor); + Q_Q(QWidget); + if (q->isVisible()) + qt_lite_set_cursor(q, false); +} + +void QWidgetPrivate::unsetCursor_sys() +{ + Q_Q(QWidget); + if (q->isVisible()) + qt_lite_set_cursor(q, false); +} + +void QWidgetPrivate::updateCursor() const +{ + // XXX +} + +#endif //QT_NO_CURSOR + +void QWidgetPrivate::setWindowTitle_sys(const QString &caption) +{ + Q_Q(QWidget); + if (!q->isWindow()) + return; + + if (QPlatformWindow *window = q->platformWindow()) + window->setWindowTitle(caption); + +} + +void QWidgetPrivate::setWindowIcon_sys(bool /*forceReset*/) +{ +} + +void QWidgetPrivate::setWindowIconText_sys(const QString &iconText) +{ + Q_UNUSED(iconText); +} + +QWidget *qt_pressGrab = 0; +QWidget *qt_mouseGrb = 0; +static QWidget *keyboardGrb = 0; + +void QWidget::grabMouse() +{ + if (qt_mouseGrb) + qt_mouseGrb->releaseMouse(); + + // XXX + //qwsDisplay()->grabMouse(this,true); + + qt_mouseGrb = this; + qt_pressGrab = 0; +} + +#ifndef QT_NO_CURSOR +void QWidget::grabMouse(const QCursor &cursor) +{ + Q_UNUSED(cursor); + + if (qt_mouseGrb) + qt_mouseGrb->releaseMouse(); + + // XXX + //qwsDisplay()->grabMouse(this,true); + //qwsDisplay()->selectCursor(this, cursor.handle()); + qt_mouseGrb = this; + qt_pressGrab = 0; +} +#endif + +void QWidget::releaseMouse() +{ + if (qt_mouseGrb == this) { + // XXX + //qwsDisplay()->grabMouse(this,false); + qt_mouseGrb = 0; + } +} + +void QWidget::grabKeyboard() +{ + if (keyboardGrb) + keyboardGrb->releaseKeyboard(); + // XXX + //qwsDisplay()->grabKeyboard(this, true); + keyboardGrb = this; +} + +void QWidget::releaseKeyboard() +{ + if (keyboardGrb == this) { + // XXX + //qwsDisplay()->grabKeyboard(this, false); + keyboardGrb = 0; + } +} + +QWidget *QWidget::mouseGrabber() +{ + if (qt_mouseGrb) + return qt_mouseGrb; + return qt_pressGrab; +} + +QWidget *QWidget::keyboardGrabber() +{ + return keyboardGrb; +} + +void QWidget::activateWindow() +{ + // XXX +// qDebug() << "QWidget::activateWindow" << this; + QApplication::setActiveWindow(this); //##### +} + +void QWidgetPrivate::show_sys() +{ + Q_Q(QWidget); + q->setAttribute(Qt::WA_Mapped); + if (q->testAttribute(Qt::WA_DontShowOnScreen)) { + invalidateBuffer(q->rect()); + return; + } + + QApplication::postEvent(q, new QUpdateLaterEvent(q->rect())); + + QPlatformWindow *window = q->platformWindow(); + if (window) { + const QRect geomRect = q->geometry(); + const QRect windowRect = window->geometry(); + if (windowRect != geomRect) { + window->setGeometry(geomRect); + } + if (q->isWindow()) { + if (QWindowSurface *surface = q->windowSurface()) + if (windowRect.size() != geomRect.size()) { + surface->resize(geomRect.size()); + } + + if (window) + window->setVisible(true); + + if (q->windowType() != Qt::Popup && q->windowType() != Qt::ToolTip && !(q->windowFlags() & Qt::X11BypassWindowManagerHint)) + q->activateWindow(); //### + } + } +} + + +void QWidgetPrivate::hide_sys() +{ + Q_Q(QWidget); + q->setAttribute(Qt::WA_Mapped, false); + if (!q->isWindow()) { + QWidget *p = q->parentWidget(); + if (p &&p->isVisible()) { + invalidateBuffer(q->rect()); + } + return; + } + if (QPlatformWindow *window = q->platformWindow()) { + window->setVisible(false); + } + + //### we don't yet have proper focus event handling + if (q == QApplicationPrivate::active_window) + QApplication::setActiveWindow(0); + +} + +void QWidgetPrivate::setMaxWindowState_helper() +{ + setFullScreenSize_helper(); //### decoration size +} + +void QWidgetPrivate::setFullScreenSize_helper() +{ + Q_Q(QWidget); + + const uint old_state = data.in_set_window_state; + data.in_set_window_state = 1; + + const QRect screen = qApp->desktop()->screenGeometry(qApp->desktop()->screenNumber(q)); + q->move(screen.topLeft()); + q->resize(screen.size()); + + data.in_set_window_state = old_state; +} + +static Qt::WindowStates effectiveState(Qt::WindowStates state) + { + if (state & Qt::WindowMinimized) + return Qt::WindowMinimized; + else if (state & Qt::WindowFullScreen) + return Qt::WindowFullScreen; + else if (state & Qt::WindowMaximized) + return Qt::WindowMaximized; + return Qt::WindowNoState; + } + +void QWidget::setWindowState(Qt::WindowStates newstate) +{ + Q_D(QWidget); + Qt::WindowStates oldstate = windowState(); + if (oldstate == newstate) + return; + if (isWindow() && !testAttribute(Qt::WA_WState_Created)) + create(); + + data->window_state = newstate; + data->in_set_window_state = 1; + bool needShow = false; + Qt::WindowStates newEffectiveState = effectiveState(newstate); + Qt::WindowStates oldEffectiveState = effectiveState(oldstate); + if (isWindow() && newEffectiveState != oldEffectiveState) { + d->createTLExtra(); + if (oldEffectiveState == Qt::WindowNoState) { //normal + d->topData()->normalGeometry = geometry(); + } else if (oldEffectiveState == Qt::WindowFullScreen) { + setParent(0, d->topData()->savedFlags); + needShow = true; + } else if (oldEffectiveState == Qt::WindowMinimized) { + needShow = true; + } + + if (newEffectiveState == Qt::WindowMinimized) { + //### not ideal... + hide(); + needShow = false; + } else if (newEffectiveState == Qt::WindowFullScreen) { + d->topData()->savedFlags = windowFlags(); + setParent(0, Qt::FramelessWindowHint | (windowFlags() & Qt::WindowStaysOnTopHint)); + d->setFullScreenSize_helper(); + raise(); + needShow = true; + } else if (newEffectiveState == Qt::WindowMaximized) { + createWinId(); + d->setMaxWindowState_helper(); + } else { //normal + QRect r = d->topData()->normalGeometry; + if (r.width() >= 0) { + d->topData()->normalGeometry = QRect(0,0,-1,-1); + setGeometry(r); + } + } + } + data->in_set_window_state = 0; + + if (needShow) + show(); + + if (newstate & Qt::WindowActive) + activateWindow(); + + QWindowStateChangeEvent e(oldstate); + QApplication::sendEvent(this, &e); +} + +void QWidgetPrivate::setFocus_sys() +{ + +} + +void QWidgetPrivate::raise_sys() +{ + Q_Q(QWidget); + if (q->isWindow()) { + q->platformWindow()->raise(); + } +} + +void QWidgetPrivate::lower_sys() +{ + Q_Q(QWidget); + if (q->isWindow()) { + Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); + q->platformWindow()->lower(); + } else if (QWidget *p = q->parentWidget()) { + setDirtyOpaqueRegion(); + p->d_func()->invalidateBuffer(effectiveRectFor(q->geometry())); + } +} + +void QWidgetPrivate::stackUnder_sys(QWidget*) +{ + Q_Q(QWidget); + if (QWidget *p = q->parentWidget()) { + setDirtyOpaqueRegion(); + p->d_func()->invalidateBuffer(effectiveRectFor(q->geometry())); + } +} + +void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) +{ + Q_Q(QWidget); + if (extra) { // any size restrictions? + w = qMin(w,extra->maxw); + h = qMin(h,extra->maxh); + w = qMax(w,extra->minw); + h = qMax(h,extra->minh); + } + + QPoint oldp = q->geometry().topLeft(); + QSize olds = q->size(); + QRect r(x, y, w, h); + + bool isResize = olds != r.size(); + isMove = oldp != r.topLeft(); //### why do we have isMove as a parameter? + + + // We only care about stuff that changes the geometry, or may + // cause the window manager to change its state + if (r.size() == olds && oldp == r.topLeft()) + return; + + if (!data.in_set_window_state) { + q->data->window_state &= ~Qt::WindowMaximized; + q->data->window_state &= ~Qt::WindowFullScreen; + if (q->isWindow()) + topData()->normalGeometry = QRect(0, 0, -1, -1); + } + + QPoint oldPos = q->pos(); + data.crect = r; + + if (q->isVisible()) { + if (q->platformWindow()) { + if (q->isWindow()) { + q->platformWindow()->setGeometry(q->frameGeometry()); + } else { + QPoint posInNativeParent = q->mapTo(q->nativeParentWidget(),QPoint()); + q->platformWindow()->setGeometry(QRect(posInNativeParent,r.size())); + } + const QWidgetBackingStore *bs = maybeBackingStore(); + if (bs->windowSurface) { + if (isResize) + bs->windowSurface->resize(r.size()); + } + } else { + if (isMove && !isResize) + moveRect(QRect(oldPos, olds), x - oldPos.x(), y - oldPos.y()); + else + invalidateBuffer_resizeHelper(oldPos, olds); + } + + if (isMove) { + QMoveEvent e(q->pos(), oldPos); + QApplication::sendEvent(q, &e); + } + if (isResize) { + QResizeEvent e(r.size(), olds); + QApplication::sendEvent(q, &e); + if (q->isWindow()) + q->update(); + } + } else { // not visible + if (isMove && q->pos() != oldPos) + q->setAttribute(Qt::WA_PendingMoveEvent, true); + if (isResize) + q->setAttribute(Qt::WA_PendingResizeEvent, true); + } + +} + +void QWidgetPrivate::setConstraints_sys() +{ +} + +void QWidgetPrivate::scroll_sys(int dx, int dy) +{ + Q_Q(QWidget); + scrollChildren(dx, dy); + scrollRect(q->rect(), dx, dy); +} + +void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r) +{ + scrollRect(r, dx, dy); +} + +static QPlatformScreen *qt_screenForWidget(const QWidget *w) +{ + if (!w) + return 0; + QRect frame = w->frameGeometry(); + if (!w->isWindow()) + frame.moveTopLeft(w->mapToGlobal(QPoint(0, 0))); + const QPoint p = (frame.topLeft() + frame.bottomRight()) / 2; + + QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); + QList screens = pi->screens(); + + for (int i = 0; i < screens.size(); ++i) { + if (screens[i]->geometry().contains(p)) + return screens[i]; + } + + // Assume screen zero if we have it. + if (!screens.isEmpty()) + return screens[0]; + else + qWarning("qt_screenForWidget: no screens"); + + return 0; +} + +int QWidget::metric(PaintDeviceMetric m) const +{ + Q_D(const QWidget); + + QPlatformScreen *screen = qt_screenForWidget(this); + if (!screen) { + if (m == PdmDpiX || m == PdmDpiY) + return 72; + return QPaintDevice::metric(m); + } + int val; + if (m == PdmWidth) { + val = data->crect.width(); + } else if (m == PdmWidthMM) { + val = data->crect.width() * screen->physicalSize().width() / screen->geometry().width(); + } else if (m == PdmHeight) { + val = data->crect.height(); + } else if (m == PdmHeightMM) { + val = data->crect.height() * screen->physicalSize().height() / screen->geometry().height(); + } else if (m == PdmDepth) { + return screen->depth(); + } else if (m == PdmDpiX || m == PdmPhysicalDpiX) { + if (d->extra && d->extra->customDpiX) + return d->extra->customDpiX; + else if (d->parent) + return static_cast(d->parent)->metric(m); + return qRound(screen->geometry().width() / double(screen->physicalSize().width() / 25.4)); + } else if (m == PdmDpiY || m == PdmPhysicalDpiY) { + if (d->extra && d->extra->customDpiY) + return d->extra->customDpiY; + else if (d->parent) + return static_cast(d->parent)->metric(m); + return qRound(screen->geometry().height() / double(screen->physicalSize().height() / 25.4)); + } else { + val = QPaintDevice::metric(m);// XXX + } + return val; +} + +void QWidgetPrivate::createSysExtra() +{ +} + +void QWidgetPrivate::deleteSysExtra() +{ +} + +void QWidgetPrivate::createTLSysExtra() +{ +} + +void QWidgetPrivate::deleteTLSysExtra() +{ +} + +void QWidgetPrivate::registerDropSite(bool on) +{ + Q_UNUSED(on); +} + +void QWidgetPrivate::setMask_sys(const QRegion ®ion) +{ + Q_UNUSED(region); + // XXX +} + +void QWidgetPrivate::updateFrameStrut() +{ + // XXX +} + +void QWidgetPrivate::setWindowOpacity_sys(qreal level) +{ + Q_Q(QWidget); + q->platformWindow()->setOpacity(level); +} + +void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect) +{ + Q_UNUSED(dontShow); + Q_UNUSED(oldRect); + // XXX +} + +QPaintEngine *QWidget::paintEngine() const +{ + qWarning("QWidget::paintEngine: Should no longer be called"); + return 0; //##### @@@ +} + +QWindowSurface *QWidgetPrivate::createDefaultWindowSurface_sys() +{ + Q_Q(QWidget); + return QApplicationPrivate::platformIntegration()->createWindowSurface(q,0); +} + +void QWidgetPrivate::setModal_sys() +{ +} + +#ifndef QT_NO_CURSOR +void qt_lite_set_cursor(QWidget * w, bool force) +{ + static QCursor arrowCursor(Qt::ArrowCursor); + static QPointer lastUnderMouse = 0; + + QCursor * override = QApplication::overrideCursor(); + + if (override && w != 0) + return; + + QWidget *cursorWidget; + QCursor cursorCursor; + + do { + if (w == 0) { + if (override) { + cursorCursor = *override; + cursorWidget = QApplication::topLevelAt(QCursor::pos()); + break; + } + w = QApplication::widgetAt(QCursor::pos()); + if (w == 0) // clear the override cursor while over empty space + w = QApplication::desktop(); + } else if (force) { + lastUnderMouse = w; + } else if (w->testAttribute(Qt::WA_WState_Created) && lastUnderMouse + && lastUnderMouse->effectiveWinId() == w->effectiveWinId()) { + w = lastUnderMouse; + } + if (w == QApplication::desktop() && !override) { + cursorCursor = arrowCursor; + cursorWidget = w; + break; + } + + QWidget * curWin = QApplication::activeWindow(); + if (!curWin && w && w->internalWinId()) + return; + QWidget* cW = w && !w->internalWinId() ? w : curWin; + + if (!cW || cW->window() != w->window() || + !cW->isVisible() || !cW->underMouse() || override) + return; + + cursorCursor = w->cursor(); + cursorWidget = w; + } while (0); + foreach (QWeakPointer cursor, QGraphicsSystemCursorPrivate::getInstances()) + if (cursor) + cursor.data()->changeCursor(&cursorCursor, cursorWidget); +} +#endif //QT_NO_CURSOR + +QT_END_NAMESPACE diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 46be728..07017ec 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -189,11 +189,11 @@ embedded { embedded_lite { SOURCES += \ - painting/qcolormap_lite.cpp \ - painting/qpaintdevice_lite.cpp \ - painting/qgraphicssystemcursor_lite.cpp + painting/qcolormap_qpa.cpp \ + painting/qpaintdevice_qpa.cpp \ + painting/qgraphicssystemcursor_qpa.cpp HEADERS += \ - painting/qgraphicssystemcursor_lite.h + painting/qgraphicssystemcursor_qpa.h } symbian { diff --git a/src/gui/painting/qcolormap_lite.cpp b/src/gui/painting/qcolormap_lite.cpp deleted file mode 100644 index 1f4fea8..0000000 --- a/src/gui/painting/qcolormap_lite.cpp +++ /dev/null @@ -1,231 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qcolormap.h" -#include "qcolor.h" -#include "qpaintdevice.h" -#include "private/qapplication_p.h" -#include "private/qgraphicssystem_p.h" - -QT_BEGIN_NAMESPACE - -class QColormapPrivate -{ -public: - inline QColormapPrivate() - : ref(1), mode(QColormap::Direct), depth(0), numcolors(0) - { } - - QAtomicInt ref; - - QColormap::Mode mode; - int depth; - int numcolors; -}; - -static QColormapPrivate *screenMap = 0; - -void QColormap::initialize() -{ - screenMap = new QColormapPrivate; - - QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); - QList screens = pi->screens(); - - screenMap->depth = screens[0]->depth(); - if (screenMap->depth < 8) { - screenMap->mode = QColormap::Indexed; - screenMap->numcolors = 256; - } else { - screenMap->mode = QColormap::Direct; - screenMap->numcolors = -1; - } -} - -void QColormap::cleanup() -{ - delete screenMap; - screenMap = 0; -} - -QColormap QColormap::instance(int /*screen*/) -{ - return QColormap(); -} - -QColormap::QColormap() - : d(screenMap) -{ d->ref.ref(); } - -QColormap::QColormap(const QColormap &colormap) - :d (colormap.d) -{ d->ref.ref(); } - -QColormap::~QColormap() -{ - if (!d->ref.deref()) - delete d; -} - -QColormap::Mode QColormap::mode() const -{ return d->mode; } - - -int QColormap::depth() const -{ return d->depth; } - - -int QColormap::size() const -{ - return d->numcolors; -} - -#ifndef QT_QWS_DEPTH16_RGB -#define QT_QWS_DEPTH16_RGB 565 -#endif -static const int qt_rbits = (QT_QWS_DEPTH16_RGB/100); -static const int qt_gbits = (QT_QWS_DEPTH16_RGB/10%10); -static const int qt_bbits = (QT_QWS_DEPTH16_RGB%10); -static const int qt_red_shift = qt_bbits+qt_gbits-(8-qt_rbits); -static const int qt_green_shift = qt_bbits-(8-qt_gbits); -static const int qt_neg_blue_shift = 8-qt_bbits; -static const int qt_blue_mask = (1<> qt_neg_blue_shift; - - return (tb & qt_blue_mask) | (tg & qt_green_mask) | (tr & qt_red_mask); -} - -inline QRgb qt_conv16ToRgb(ushort c) -{ - const int r=(c & qt_red_mask); - const int g=(c & qt_green_mask); - const int b=(c & qt_blue_mask); - const int tr = r >> qt_red_shift | r >> qt_red_rounding_shift; - const int tg = g >> qt_green_shift | g >> qt_green_rounding_shift; - const int tb = b << qt_neg_blue_shift | b >> qt_blue_rounding_shift; - - return qRgb(tr,tg,tb); -} - -uint QColormap::pixel(const QColor &color) const -{ - QRgb rgb = color.rgba(); - if (d->mode == QColormap::Direct) { - switch(d->depth) { - case 16: - return qt_convRgbTo16(rgb); - case 24: - case 32: - { - const int r = qRed(rgb); - const int g = qGreen(rgb); - const int b = qBlue(rgb); - const int red_shift = 16; - const int green_shift = 8; - const int red_mask = 0xff0000; - const int green_mask = 0x00ff00; - const int blue_mask = 0x0000ff; - const int tg = g << green_shift; -#ifdef QT_QWS_DEPTH_32_BGR - if (qt_screen->pixelType() == QScreen::BGRPixel) { - const int tb = b << red_shift; - return 0xff000000 | (r & blue_mask) | (tg & green_mask) | (tb & red_mask); - } -#endif - const int tr = r << red_shift; - return 0xff000000 | (b & blue_mask) | (tg & green_mask) | (tr & red_mask); - } - } - } - //XXX - //return qt_screen->alloc(qRed(rgb), qGreen(rgb), qBlue(rgb)); - return 0; -} - -const QColor QColormap::colorAt(uint pixel) const -{ - if (d->mode == Direct) { - if (d->depth == 16) { - pixel = qt_conv16ToRgb(pixel); - } - const int red_shift = 16; - const int green_shift = 8; - const int red_mask = 0xff0000; - const int green_mask = 0x00ff00; - const int blue_mask = 0x0000ff; -#ifdef QT_QWS_DEPTH_32_BGR - if (qt_screen->pixelType() == QScreen::BGRPixel) { - return QColor((pixel & blue_mask), - (pixel & green_mask) >> green_shift, - (pixel & red_mask) >> red_shift); - } -#endif - return QColor((pixel & red_mask) >> red_shift, - (pixel & green_mask) >> green_shift, - (pixel & blue_mask)); - } -#if 0 // XXX - Q_ASSERT_X(int(pixel) < qt_screen->numCols(), "QColormap::colorAt", "pixel out of bounds of palette"); - return QColor(qt_screen->clut()[pixel]); -#endif - return QColor(); -} - -const QVector QColormap::colormap() const -{ - return QVector(); -} - -QColormap &QColormap::operator=(const QColormap &colormap) -{ qAtomicAssign(d, colormap.d); return *this; } - -QT_END_NAMESPACE diff --git a/src/gui/painting/qcolormap_qpa.cpp b/src/gui/painting/qcolormap_qpa.cpp new file mode 100644 index 0000000..1f4fea8 --- /dev/null +++ b/src/gui/painting/qcolormap_qpa.cpp @@ -0,0 +1,231 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qcolormap.h" +#include "qcolor.h" +#include "qpaintdevice.h" +#include "private/qapplication_p.h" +#include "private/qgraphicssystem_p.h" + +QT_BEGIN_NAMESPACE + +class QColormapPrivate +{ +public: + inline QColormapPrivate() + : ref(1), mode(QColormap::Direct), depth(0), numcolors(0) + { } + + QAtomicInt ref; + + QColormap::Mode mode; + int depth; + int numcolors; +}; + +static QColormapPrivate *screenMap = 0; + +void QColormap::initialize() +{ + screenMap = new QColormapPrivate; + + QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); + QList screens = pi->screens(); + + screenMap->depth = screens[0]->depth(); + if (screenMap->depth < 8) { + screenMap->mode = QColormap::Indexed; + screenMap->numcolors = 256; + } else { + screenMap->mode = QColormap::Direct; + screenMap->numcolors = -1; + } +} + +void QColormap::cleanup() +{ + delete screenMap; + screenMap = 0; +} + +QColormap QColormap::instance(int /*screen*/) +{ + return QColormap(); +} + +QColormap::QColormap() + : d(screenMap) +{ d->ref.ref(); } + +QColormap::QColormap(const QColormap &colormap) + :d (colormap.d) +{ d->ref.ref(); } + +QColormap::~QColormap() +{ + if (!d->ref.deref()) + delete d; +} + +QColormap::Mode QColormap::mode() const +{ return d->mode; } + + +int QColormap::depth() const +{ return d->depth; } + + +int QColormap::size() const +{ + return d->numcolors; +} + +#ifndef QT_QWS_DEPTH16_RGB +#define QT_QWS_DEPTH16_RGB 565 +#endif +static const int qt_rbits = (QT_QWS_DEPTH16_RGB/100); +static const int qt_gbits = (QT_QWS_DEPTH16_RGB/10%10); +static const int qt_bbits = (QT_QWS_DEPTH16_RGB%10); +static const int qt_red_shift = qt_bbits+qt_gbits-(8-qt_rbits); +static const int qt_green_shift = qt_bbits-(8-qt_gbits); +static const int qt_neg_blue_shift = 8-qt_bbits; +static const int qt_blue_mask = (1<> qt_neg_blue_shift; + + return (tb & qt_blue_mask) | (tg & qt_green_mask) | (tr & qt_red_mask); +} + +inline QRgb qt_conv16ToRgb(ushort c) +{ + const int r=(c & qt_red_mask); + const int g=(c & qt_green_mask); + const int b=(c & qt_blue_mask); + const int tr = r >> qt_red_shift | r >> qt_red_rounding_shift; + const int tg = g >> qt_green_shift | g >> qt_green_rounding_shift; + const int tb = b << qt_neg_blue_shift | b >> qt_blue_rounding_shift; + + return qRgb(tr,tg,tb); +} + +uint QColormap::pixel(const QColor &color) const +{ + QRgb rgb = color.rgba(); + if (d->mode == QColormap::Direct) { + switch(d->depth) { + case 16: + return qt_convRgbTo16(rgb); + case 24: + case 32: + { + const int r = qRed(rgb); + const int g = qGreen(rgb); + const int b = qBlue(rgb); + const int red_shift = 16; + const int green_shift = 8; + const int red_mask = 0xff0000; + const int green_mask = 0x00ff00; + const int blue_mask = 0x0000ff; + const int tg = g << green_shift; +#ifdef QT_QWS_DEPTH_32_BGR + if (qt_screen->pixelType() == QScreen::BGRPixel) { + const int tb = b << red_shift; + return 0xff000000 | (r & blue_mask) | (tg & green_mask) | (tb & red_mask); + } +#endif + const int tr = r << red_shift; + return 0xff000000 | (b & blue_mask) | (tg & green_mask) | (tr & red_mask); + } + } + } + //XXX + //return qt_screen->alloc(qRed(rgb), qGreen(rgb), qBlue(rgb)); + return 0; +} + +const QColor QColormap::colorAt(uint pixel) const +{ + if (d->mode == Direct) { + if (d->depth == 16) { + pixel = qt_conv16ToRgb(pixel); + } + const int red_shift = 16; + const int green_shift = 8; + const int red_mask = 0xff0000; + const int green_mask = 0x00ff00; + const int blue_mask = 0x0000ff; +#ifdef QT_QWS_DEPTH_32_BGR + if (qt_screen->pixelType() == QScreen::BGRPixel) { + return QColor((pixel & blue_mask), + (pixel & green_mask) >> green_shift, + (pixel & red_mask) >> red_shift); + } +#endif + return QColor((pixel & red_mask) >> red_shift, + (pixel & green_mask) >> green_shift, + (pixel & blue_mask)); + } +#if 0 // XXX + Q_ASSERT_X(int(pixel) < qt_screen->numCols(), "QColormap::colorAt", "pixel out of bounds of palette"); + return QColor(qt_screen->clut()[pixel]); +#endif + return QColor(); +} + +const QVector QColormap::colormap() const +{ + return QVector(); +} + +QColormap &QColormap::operator=(const QColormap &colormap) +{ qAtomicAssign(d, colormap.d); return *this; } + +QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystemcursor_lite.cpp b/src/gui/painting/qgraphicssystemcursor_lite.cpp deleted file mode 100644 index 752b406..0000000 --- a/src/gui/painting/qgraphicssystemcursor_lite.cpp +++ /dev/null @@ -1,664 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qgraphicssystemcursor_lite.h" - -#include -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -QList > QGraphicsSystemCursorPrivate::instances; - -/*! - \class QGraphicsSystemCursor - - \brief The QGraphicsSystemCursor class provides information about - pointer device events (movement, buttons), and requests to change - the currently displayed cursor. - - Note that QGraphicsSystemCursor does not include any graphics for - display. An application that sets a QCursor may provide its own - graphics. - - \sa QGraphicsSystemCursorImage -*/ - -/*! - \fn virtual void QGraphicsSystemCursor::pointerEvent(const QMouseEvent & event) - - This method is called by Qt whenever a QMouseEvent is generated by the - underlying pointer input. \a event is a reference to the QMouseEvent in - question. A default do-nothing implementation is provided. - - \sa QApplicationPrivate::handleMouseEvent() -*/ - -/*! - \fn virtual void QGraphicsSystemCursor::changeCursor(QCursor * widgetCursor, QWidget * widget) - - \brief This method is called by Qt whenever the cursor graphic should be changed. - - Implementation of this method is mandatory for a subclass of QGraphicsSystemCursor. - - \a widgetCursor is a pointer to the QCursor that should be displayed. - - \a widget is a pointer to the widget currently displayed at QCursor::pos(). Note - that this may be 0 if the current position is not occupied by a displayed widget. - - \sa QApplicationPrivate::handleMouseEvent(), QCursor::pos() -*/ - -/*! - \fn QGraphicsSystemCursor::QGraphicsSystemCursor() - - \brief Constructs a QGraphicsSystemCursor -*/ -QGraphicsSystemCursor::QGraphicsSystemCursor(QPlatformScreen *scr ) - : screen(scr) -{ - QGraphicsSystemCursorPrivate::instances.append(this); -} - -// End of display and pointer event handling code -// Beginning of built-in cursor graphics -// from src/gui/embedded/QGraphicsSystemCursorImage_qws.cpp - -/*! - \class QGraphicsSystemCursorImage - - \brief The QGraphicsSystemCursorImage class provides a set of graphics - intended to be used as cursors. - - \sa QGraphicsSystemCursor -*/ - -static QGraphicsSystemCursorImage *systemCursorTable[Qt::LastCursor+1]; -static bool systemCursorTableInit = false; - -// 16 x 16 -static const uchar cur_arrow_bits[] = { - 0x07, 0x00, 0x39, 0x00, 0xc1, 0x01, 0x02, 0x0e, 0x02, 0x10, 0x02, 0x08, - 0x04, 0x04, 0x04, 0x02, 0x04, 0x04, 0x88, 0x08, 0x48, 0x11, 0x28, 0x22, - 0x10, 0x44, 0x00, 0x28, 0x00, 0x10, 0x00, 0x00 }; -static const uchar mcur_arrow_bits[] = { - 0x07, 0x00, 0x3f, 0x00, 0xff, 0x01, 0xfe, 0x0f, 0xfe, 0x1f, 0xfe, 0x0f, - 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x07, 0xf8, 0x0f, 0x78, 0x1f, 0x38, 0x3e, - 0x10, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00, 0x00 }; - -static const unsigned char cur_up_arrow_bits[] = { - 0x80, 0x00, 0x40, 0x01, 0x40, 0x01, 0x20, 0x02, 0x20, 0x02, 0x10, 0x04, - 0x10, 0x04, 0x08, 0x08, 0x78, 0x0f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, - 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01}; -static const unsigned char mcur_up_arrow_bits[] = { - 0x80, 0x00, 0xc0, 0x01, 0xc0, 0x01, 0xe0, 0x03, 0xe0, 0x03, 0xf0, 0x07, - 0xf0, 0x07, 0xf8, 0x0f, 0xf8, 0x0f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, - 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01}; - -static const unsigned char cur_cross_bits[] = { - 0xc0, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, - 0x7f, 0x7f, 0x01, 0x40, 0x7f, 0x7f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, - 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01, 0x00, 0x00}; -static const unsigned char mcur_cross_bits[] = { - 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, - 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, - 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0x00, 0x00}; - -static const uchar cur_ibeam_bits[] = { - 0x00, 0x00, 0xe0, 0x03, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, - 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, - 0x80, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00 }; -static const uchar mcur_ibeam_bits[] = { - 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, - 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, - 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0x00, 0x00 }; - -static const uchar cur_ver_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, - 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f, - 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00 }; -static const uchar mcur_ver_bits[] = { - 0x00, 0x00, 0x80, 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0xf8, 0x3f, - 0xfc, 0x7f, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xfc, 0x7f, 0xf8, 0x3f, - 0xf0, 0x1f, 0xe0, 0x0f, 0xc0, 0x07, 0x80, 0x03 }; - -static const uchar cur_hor_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x30, 0x18, - 0x38, 0x38, 0xfc, 0x7f, 0xfc, 0x7f, 0x38, 0x38, 0x30, 0x18, 0x20, 0x08, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar mcur_hor_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x40, 0x04, 0x60, 0x0c, 0x70, 0x1c, 0x78, 0x3c, - 0xfc, 0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfc, 0x7f, 0x78, 0x3c, - 0x70, 0x1c, 0x60, 0x0c, 0x40, 0x04, 0x00, 0x00 }; -static const uchar cur_bdiag_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x3e, 0x00, 0x3c, 0x00, 0x3e, - 0x00, 0x37, 0x88, 0x23, 0xd8, 0x01, 0xf8, 0x00, 0x78, 0x00, 0xf8, 0x00, - 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar mcur_bdiag_bits[] = { - 0x00, 0x00, 0xc0, 0x7f, 0x80, 0x7f, 0x00, 0x7f, 0x00, 0x7e, 0x04, 0x7f, - 0x8c, 0x7f, 0xdc, 0x77, 0xfc, 0x63, 0xfc, 0x41, 0xfc, 0x00, 0xfc, 0x01, - 0xfc, 0x03, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00 }; -static const uchar cur_fdiag_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0xf8, 0x00, 0x78, 0x00, - 0xf8, 0x00, 0xd8, 0x01, 0x88, 0x23, 0x00, 0x37, 0x00, 0x3e, 0x00, 0x3c, - 0x00, 0x3e, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00 }; -static const uchar mcur_fdiag_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x01, 0xfc, 0x00, - 0xfc, 0x41, 0xfc, 0x63, 0xdc, 0x77, 0x8c, 0x7f, 0x04, 0x7f, 0x00, 0x7e, - 0x00, 0x7f, 0x80, 0x7f, 0xc0, 0x7f, 0x00, 0x00 }; -static const uchar cur_blank_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -// 20 x 20 -static const uchar forbidden_bits[] = { - 0x00,0x00,0x00,0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xf0,0x00,0x38,0xc0,0x01, - 0x7c,0x80,0x03,0xec,0x00,0x03,0xce,0x01,0x07,0x86,0x03,0x06,0x06,0x07,0x06, - 0x06,0x0e,0x06,0x06,0x1c,0x06,0x0e,0x38,0x07,0x0c,0x70,0x03,0x1c,0xe0,0x03, - 0x38,0xc0,0x01,0xf0,0xe0,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00,0x00,0x00,0x00 }; - -static const uchar forbiddenm_bits[] = { - 0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xff,0x00,0xf8,0xff,0x01,0xfc,0xf0,0x03, - 0xfe,0xc0,0x07,0xfe,0x81,0x07,0xff,0x83,0x0f,0xcf,0x07,0x0f,0x8f,0x0f,0x0f, - 0x0f,0x1f,0x0f,0x0f,0x3e,0x0f,0x1f,0xfc,0x0f,0x1e,0xf8,0x07,0x3e,0xf0,0x07, - 0xfc,0xe0,0x03,0xf8,0xff,0x01,0xf0,0xff,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00}; - -// 32 x 32 -static const uchar wait_data_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, - 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x08, 0x20, 0x00, - 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, - 0x00, 0x50, 0x15, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x40, 0x05, 0x00, - 0x00, 0x80, 0x02, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x20, 0x08, 0x00, - 0x00, 0x10, 0x10, 0x00, 0x00, 0x08, 0x21, 0x00, 0x00, 0x88, 0x22, 0x00, - 0x00, 0x48, 0x25, 0x00, 0x00, 0xa8, 0x2a, 0x00, 0x00, 0xfc, 0x7f, 0x00, - 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar wait_mask_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, - 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xf8, 0x3f, 0x00, - 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, - 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xc0, 0x07, 0x00, - 0x00, 0x80, 0x03, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0xe0, 0x0f, 0x00, - 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, - 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, - 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -static const uchar hsplit_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, - 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, - 0x00, 0x41, 0x82, 0x00, 0x80, 0x41, 0x82, 0x01, 0xc0, 0x7f, 0xfe, 0x03, - 0x80, 0x41, 0x82, 0x01, 0x00, 0x41, 0x82, 0x00, 0x00, 0x40, 0x02, 0x00, - 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, - 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar hsplitm_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, - 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe3, 0xc7, 0x00, - 0x80, 0xe3, 0xc7, 0x01, 0xc0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x07, - 0xc0, 0xff, 0xff, 0x03, 0x80, 0xe3, 0xc7, 0x01, 0x00, 0xe3, 0xc7, 0x00, - 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, - 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar vsplit_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar vsplitm_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, - 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, - 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, - 0x80, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, - 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar phand_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, - 0x7e, 0x04, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x70, 0x08, 0x00, 0x00, - 0x08, 0x08, 0x00, 0x00, 0x70, 0x14, 0x00, 0x00, 0x08, 0x22, 0x00, 0x00, - 0x30, 0x41, 0x00, 0x00, 0xc0, 0x20, 0x00, 0x00, 0x40, 0x12, 0x00, 0x00, - 0x80, 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar phandm_bits[] = { - 0xfe, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, - 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, - 0xfc, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, - 0xf8, 0xff, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, - 0xc0, 0x1f, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, - 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -static const uchar size_all_data_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x80, 0x81, 0xc0, 0x00, - 0xc0, 0xff, 0xff, 0x01, 0x80, 0x81, 0xc0, 0x00, 0x00, 0x81, 0x40, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar size_all_mask_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, - 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc2, 0x21, 0x00, - 0x00, 0xc3, 0x61, 0x00, 0x80, 0xc3, 0xe1, 0x00, 0xc0, 0xff, 0xff, 0x01, - 0xe0, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0x01, 0x80, 0xc3, 0xe1, 0x00, - 0x00, 0xc3, 0x61, 0x00, 0x00, 0xc2, 0x21, 0x00, 0x00, 0xc0, 0x01, 0x00, - 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0xe0, 0x03, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -static const uchar whatsthis_bits[] = { - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0xf0, 0x07, 0x00, - 0x09, 0x18, 0x0e, 0x00, 0x11, 0x1c, 0x0e, 0x00, 0x21, 0x1c, 0x0e, 0x00, - 0x41, 0x1c, 0x0e, 0x00, 0x81, 0x1c, 0x0e, 0x00, 0x01, 0x01, 0x07, 0x00, - 0x01, 0x82, 0x03, 0x00, 0xc1, 0xc7, 0x01, 0x00, 0x49, 0xc0, 0x01, 0x00, - 0x95, 0xc0, 0x01, 0x00, 0x93, 0xc0, 0x01, 0x00, 0x21, 0x01, 0x00, 0x00, - 0x20, 0xc1, 0x01, 0x00, 0x40, 0xc2, 0x01, 0x00, 0x40, 0x02, 0x00, 0x00, - 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -static const uchar whatsthism_bits[] = { - 0x01, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x07, 0x00, 0x07, 0xf8, 0x0f, 0x00, - 0x0f, 0xfc, 0x1f, 0x00, 0x1f, 0x3e, 0x1f, 0x00, 0x3f, 0x3e, 0x1f, 0x00, - 0x7f, 0x3e, 0x1f, 0x00, 0xff, 0x3e, 0x1f, 0x00, 0xff, 0x9d, 0x0f, 0x00, - 0xff, 0xc3, 0x07, 0x00, 0xff, 0xe7, 0x03, 0x00, 0x7f, 0xe0, 0x03, 0x00, - 0xf7, 0xe0, 0x03, 0x00, 0xf3, 0xe0, 0x03, 0x00, 0xe1, 0xe1, 0x03, 0x00, - 0xe0, 0xe1, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, - 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; - -static const uchar busy_bits[] = { - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, - 0x41, 0xe0, 0xff, 0x00, 0x81, 0x20, 0x80, 0x00, 0x01, 0xe1, 0xff, 0x00, - 0x01, 0x42, 0x40, 0x00, 0xc1, 0x47, 0x40, 0x00, 0x49, 0x40, 0x55, 0x00, - 0x95, 0x80, 0x2a, 0x00, 0x93, 0x00, 0x15, 0x00, 0x21, 0x01, 0x0a, 0x00, - 0x20, 0x01, 0x11, 0x00, 0x40, 0x82, 0x20, 0x00, 0x40, 0x42, 0x44, 0x00, - 0x80, 0x41, 0x4a, 0x00, 0x00, 0x40, 0x55, 0x00, 0x00, 0xe0, 0xff, 0x00, - 0x00, 0x20, 0x80, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -static const uchar busym_bits[] = { - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, - 0x7f, 0xe0, 0xff, 0x00, 0xff, 0xe0, 0xff, 0x00, 0xff, 0xe1, 0xff, 0x00, - 0xff, 0xc3, 0x7f, 0x00, 0xff, 0xc7, 0x7f, 0x00, 0x7f, 0xc0, 0x7f, 0x00, - 0xf7, 0x80, 0x3f, 0x00, 0xf3, 0x00, 0x1f, 0x00, 0xe1, 0x01, 0x0e, 0x00, - 0xe0, 0x01, 0x1f, 0x00, 0xc0, 0x83, 0x3f, 0x00, 0xc0, 0xc3, 0x7f, 0x00, - 0x80, 0xc1, 0x7f, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0xe0, 0xff, 0x00, - 0x00, 0xe0, 0xff, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -// 16 x 16 -static const uchar openhand_bits[] = { - 0x80,0x01,0x58,0x0e,0x64,0x12,0x64,0x52,0x48,0xb2,0x48,0x92, - 0x16,0x90,0x19,0x80,0x11,0x40,0x02,0x40,0x04,0x40,0x04,0x20, - 0x08,0x20,0x10,0x10,0x20,0x10,0x00,0x00}; -static const uchar openhandm_bits[] = { - 0x80,0x01,0xd8,0x0f,0xfc,0x1f,0xfc,0x5f,0xf8,0xff,0xf8,0xff, - 0xfe,0xff,0xff,0xff,0xff,0x7f,0xfe,0x7f,0xfc,0x7f,0xfc,0x3f, - 0xf8,0x3f,0xf0,0x1f,0xe0,0x1f,0x00,0x00}; -static const uchar closedhand_bits[] = { - 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0x48,0x32,0x08,0x50, - 0x10,0x40,0x18,0x40,0x04,0x40,0x04,0x20,0x08,0x20,0x10,0x10, - 0x20,0x10,0x20,0x10,0x00,0x00,0x00,0x00}; -static const uchar closedhandm_bits[] = { - 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0xf8,0x3f,0xf8,0x7f, - 0xf0,0x7f,0xf8,0x7f,0xfc,0x7f,0xfc,0x3f,0xf8,0x3f,0xf0,0x1f, - 0xe0,0x1f,0xe0,0x1f,0x00,0x00,0x00,0x00}; - -void QGraphicsSystemCursorImage::createSystemCursor(int id) -{ - if (!systemCursorTableInit) { - for (int i = 0; i <= Qt::LastCursor; i++) - systemCursorTable[i] = 0; - systemCursorTableInit = true; - } - switch (id) { - // 16x16 cursors - case Qt::ArrowCursor: - systemCursorTable[Qt::ArrowCursor] = - new QGraphicsSystemCursorImage(cur_arrow_bits, mcur_arrow_bits, 16, 16, 0, 0); - break; - - case Qt::UpArrowCursor: - systemCursorTable[Qt::UpArrowCursor] = - new QGraphicsSystemCursorImage(cur_up_arrow_bits, mcur_up_arrow_bits, 16, 16, 7, 0); - break; - - case Qt::CrossCursor: - systemCursorTable[Qt::CrossCursor] = - new QGraphicsSystemCursorImage(cur_cross_bits, mcur_cross_bits, 16, 16, 7, 7); - break; - - case Qt::IBeamCursor: - systemCursorTable[Qt::IBeamCursor] = - new QGraphicsSystemCursorImage(cur_ibeam_bits, mcur_ibeam_bits, 16, 16, 7, 7); - break; - - case Qt::SizeVerCursor: - systemCursorTable[Qt::SizeVerCursor] = - new QGraphicsSystemCursorImage(cur_ver_bits, mcur_ver_bits, 16, 16, 7, 7); - break; - - case Qt::SizeHorCursor: - systemCursorTable[Qt::SizeHorCursor] = - new QGraphicsSystemCursorImage(cur_hor_bits, mcur_hor_bits, 16, 16, 7, 7); - break; - - case Qt::SizeBDiagCursor: - systemCursorTable[Qt::SizeBDiagCursor] = - new QGraphicsSystemCursorImage(cur_bdiag_bits, mcur_bdiag_bits, 16, 16, 7, 7); - break; - - case Qt::SizeFDiagCursor: - systemCursorTable[Qt::SizeFDiagCursor] = - new QGraphicsSystemCursorImage(cur_fdiag_bits, mcur_fdiag_bits, 16, 16, 7, 7); - break; - - case Qt::BlankCursor: - systemCursorTable[Qt::BlankCursor] = - new QGraphicsSystemCursorImage(0, 0, 0, 0, 0, 0); - break; - - // 20x20 cursors - case Qt::ForbiddenCursor: - systemCursorTable[Qt::ForbiddenCursor] = - new QGraphicsSystemCursorImage(forbidden_bits, forbiddenm_bits, 20, 20, 10, 10); - break; - - // 32x32 cursors - case Qt::WaitCursor: - systemCursorTable[Qt::WaitCursor] = - new QGraphicsSystemCursorImage(wait_data_bits, wait_mask_bits, 32, 32, 15, 15); - break; - - case Qt::SplitVCursor: - systemCursorTable[Qt::SplitVCursor] = - new QGraphicsSystemCursorImage(vsplit_bits, vsplitm_bits, 32, 32, 15, 15); - break; - - case Qt::SplitHCursor: - systemCursorTable[Qt::SplitHCursor] = - new QGraphicsSystemCursorImage(hsplit_bits, hsplitm_bits, 32, 32, 15, 15); - break; - - case Qt::SizeAllCursor: - systemCursorTable[Qt::SizeAllCursor] = - new QGraphicsSystemCursorImage(size_all_data_bits, size_all_mask_bits, 32, 32, 15, 15); - break; - - case Qt::PointingHandCursor: - systemCursorTable[Qt::PointingHandCursor] = - new QGraphicsSystemCursorImage(phand_bits, phandm_bits, 32, 32, 0, 0); - break; - - case Qt::WhatsThisCursor: - systemCursorTable[Qt::WhatsThisCursor] = - new QGraphicsSystemCursorImage(whatsthis_bits, whatsthism_bits, 32, 32, 0, 0); - break; - case Qt::BusyCursor: - systemCursorTable[Qt::BusyCursor] = - new QGraphicsSystemCursorImage(busy_bits, busym_bits, 32, 32, 0, 0); - break; - - case Qt::OpenHandCursor: - systemCursorTable[Qt::OpenHandCursor] = - new QGraphicsSystemCursorImage(openhand_bits, openhandm_bits, 16, 16, 8, 8); - break; - case Qt::ClosedHandCursor: - systemCursorTable[Qt::ClosedHandCursor] = - new QGraphicsSystemCursorImage(closedhand_bits, closedhandm_bits, 16, 16, 8, 8); - break; - default: - qWarning("Unknown system cursor %d", id); - } -} - -/*! - \fn void QGraphicsSystemCursorImage::set(Qt::CursorShape id) - - \brief Calling this method sets the cursor image to the specified shape - - \a id is one of the defined Qt::CursorShape values. - - If id is invalid, Qt::BitmapCursor, or unknown by the implementation, - Qt::ArrowCursor is used instead. -*/ - -void QGraphicsSystemCursorImage::set(Qt::CursorShape id) -{ - QGraphicsSystemCursorImage *cursor = 0; - if (id >= 0 && id <= Qt::LastCursor) { - if (!systemCursorTable[id]) - createSystemCursor(id); - cursor = systemCursorTable[id]; - } - - if (cursor == 0) { - if (!systemCursorTable[Qt::ArrowCursor]) - createSystemCursor(Qt::ArrowCursor); - cursor = systemCursorTable[Qt::ArrowCursor]; - } - cursorImage = cursor->cursorImage; - hot = cursor->hot; -} - -/*! - \fn void QGraphicsSystemCursorImage::set(const QImage * image, int hx, int hy) - - \brief Set the cursor image to the specified QImage, with the hotsport at (hx, hy) - - \a image A pointer to a QImage - - \a hx The x coordinate of the cursor's hotspot - - \a hy the y coordinate of the cursor's hotspot -*/ - -void QGraphicsSystemCursorImage::set(const QImage * image, int hx, int hy) -{ - hot.setX(hx); - hot.setY(hy); - cursorImage = *image; -} - -/*! - \fn void QGraphicsSystemCursorImage::set(const uchar *data, const uchar *mask, int width, int height, int hx, int hy) - - \brief set the cursor image to the graphic represented by the combination of data, mask, - width, and height - - \a data The pixel data of the graphic - - \a mask Mask data for the graphic. pixels in data with a corresponding mask bit of 0 are not drawn - - \a width The width of the graphic in pixels - - \a height The height of the graphic in pixels - - \a hx The X hotspot of the cursor graphic - - \a hy The Y hotspot of the cursor graphic -*/ -void QGraphicsSystemCursorImage::set(const uchar *data, const uchar *mask, - int width, int height, int hx, int hy) -{ - hot.setX(hx); - hot.setY(hy); - - cursorImage = QImage(width,height, QImage::Format_Indexed8); - - if (!width || !height || !data || !mask || cursorImage.isNull()) - return; - - cursorImage.setNumColors(3); - cursorImage.setColor(0, 0xff000000); - cursorImage.setColor(1, 0xffffffff); - cursorImage.setColor(2, 0x00000000); - - int bytesPerLine = (width + 7) / 8; - int p = 0; - int d, m; - - int x = -1, w = 0; - - uchar *cursor_data = cursorImage.bits(); - int bpl = cursorImage.bytesPerLine(); - for (int i = 0; i < height; i++) - { - for (int j = 0; j < bytesPerLine; j++, data++, mask++) - { - for (int b = 0; b < 8 && j*8+b < width; b++) - { - d = *data & (1 << b); - m = *mask & (1 << b); - if (d && m) p = 0; - else if (!d && m) p = 1; - else p = 2; - cursor_data[j*8+b] = p; - - // calc region - if (x < 0 && m) - x = j*8+b; - else if (x >= 0 && !m) { - x = -1; - w = 0; - } - if (m) - w++; - } - } - if (x >= 0) { - x = -1; - w = 0; - } - cursor_data += bpl; - } - -} - -/*! - \fn QGraphicsSystemCursorImage::QGraphicsSystemCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) - - \brief set the cursor image to the graphic represented by the combination of data, mask, - width, and height - - \a data The pixel data of the graphic - - \a mask Mask data for the graphic. pixels in data with a corresponding mask bit of 0 are not drawn - - \a width The width of the graphic in pixels - - \a height The height of the graphic in pixels - - \a hotX The X hotspot of the cursor graphic - - \a hotY The Y hotspot of the cursor graphic - - \sa set -*/ - -/*! - \fn QImage *QGraphicsSystemCursorImage::image() - - \brief Return the cursor graphic as a pointer to a QImage -*/ - -/*! - \fn QPoint QGraphicsSystemCursorImage::hotspot() - - \brief Return the cursor's hotspot -*/ - -QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystemcursor_lite.h b/src/gui/painting/qgraphicssystemcursor_lite.h deleted file mode 100644 index 9c65f7f..0000000 --- a/src/gui/painting/qgraphicssystemcursor_lite.h +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QGRAPHICSSYSTEMCURSOR_H -#define QGRAPHICSSYSTEMCURSOR_H - -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -// Cursor graphics management -class Q_GUI_EXPORT QGraphicsSystemCursorImage { -public: - QGraphicsSystemCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) - { set(data, mask, width, height, hotX, hotY); } - QImage * image() { return &cursorImage; } - QPoint hotspot() { return hot; } - void set(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); - void set(const QImage * image, int hx, int hy); - void set(Qt::CursorShape); -private: - static void createSystemCursor(int id); - QImage cursorImage; - QPoint hot; -}; - -class QGraphicsSystemCursor; - -class QGraphicsSystemCursorPrivate { -public: - static QList > getInstances() { return instances; } - static QList > instances; -}; - -class Q_GUI_EXPORT QGraphicsSystemCursor : public QObject { -public: - QGraphicsSystemCursor(QPlatformScreen *); - - // input methods - virtual void pointerEvent(const QMouseEvent & event) { Q_UNUSED(event); } - virtual void changeCursor(QCursor * widgetCursor, QWidget * widget) = 0; - -protected: - QPlatformScreen* screen; // Where to request an update - -private: - Q_DECLARE_PRIVATE(QGraphicsSystemCursor); - friend void qt_lite_set_cursor(QWidget * w, bool force); - friend class QApplicationPrivate; -}; - -QT_END_NAMESPACE - -#endif // QGRAPHICSSYSTEMCURSOR_H diff --git a/src/gui/painting/qgraphicssystemcursor_qpa.cpp b/src/gui/painting/qgraphicssystemcursor_qpa.cpp new file mode 100644 index 0000000..24376f9 --- /dev/null +++ b/src/gui/painting/qgraphicssystemcursor_qpa.cpp @@ -0,0 +1,664 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "qgraphicssystemcursor_qpa.h" + +#include +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +QList > QGraphicsSystemCursorPrivate::instances; + +/*! + \class QGraphicsSystemCursor + + \brief The QGraphicsSystemCursor class provides information about + pointer device events (movement, buttons), and requests to change + the currently displayed cursor. + + Note that QGraphicsSystemCursor does not include any graphics for + display. An application that sets a QCursor may provide its own + graphics. + + \sa QGraphicsSystemCursorImage +*/ + +/*! + \fn virtual void QGraphicsSystemCursor::pointerEvent(const QMouseEvent & event) + + This method is called by Qt whenever a QMouseEvent is generated by the + underlying pointer input. \a event is a reference to the QMouseEvent in + question. A default do-nothing implementation is provided. + + \sa QApplicationPrivate::handleMouseEvent() +*/ + +/*! + \fn virtual void QGraphicsSystemCursor::changeCursor(QCursor * widgetCursor, QWidget * widget) + + \brief This method is called by Qt whenever the cursor graphic should be changed. + + Implementation of this method is mandatory for a subclass of QGraphicsSystemCursor. + + \a widgetCursor is a pointer to the QCursor that should be displayed. + + \a widget is a pointer to the widget currently displayed at QCursor::pos(). Note + that this may be 0 if the current position is not occupied by a displayed widget. + + \sa QApplicationPrivate::handleMouseEvent(), QCursor::pos() +*/ + +/*! + \fn QGraphicsSystemCursor::QGraphicsSystemCursor() + + \brief Constructs a QGraphicsSystemCursor +*/ +QGraphicsSystemCursor::QGraphicsSystemCursor(QPlatformScreen *scr ) + : screen(scr) +{ + QGraphicsSystemCursorPrivate::instances.append(this); +} + +// End of display and pointer event handling code +// Beginning of built-in cursor graphics +// from src/gui/embedded/QGraphicsSystemCursorImage_qws.cpp + +/*! + \class QGraphicsSystemCursorImage + + \brief The QGraphicsSystemCursorImage class provides a set of graphics + intended to be used as cursors. + + \sa QGraphicsSystemCursor +*/ + +static QGraphicsSystemCursorImage *systemCursorTable[Qt::LastCursor+1]; +static bool systemCursorTableInit = false; + +// 16 x 16 +static const uchar cur_arrow_bits[] = { + 0x07, 0x00, 0x39, 0x00, 0xc1, 0x01, 0x02, 0x0e, 0x02, 0x10, 0x02, 0x08, + 0x04, 0x04, 0x04, 0x02, 0x04, 0x04, 0x88, 0x08, 0x48, 0x11, 0x28, 0x22, + 0x10, 0x44, 0x00, 0x28, 0x00, 0x10, 0x00, 0x00 }; +static const uchar mcur_arrow_bits[] = { + 0x07, 0x00, 0x3f, 0x00, 0xff, 0x01, 0xfe, 0x0f, 0xfe, 0x1f, 0xfe, 0x0f, + 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x07, 0xf8, 0x0f, 0x78, 0x1f, 0x38, 0x3e, + 0x10, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00, 0x00 }; + +static const unsigned char cur_up_arrow_bits[] = { + 0x80, 0x00, 0x40, 0x01, 0x40, 0x01, 0x20, 0x02, 0x20, 0x02, 0x10, 0x04, + 0x10, 0x04, 0x08, 0x08, 0x78, 0x0f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, + 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01}; +static const unsigned char mcur_up_arrow_bits[] = { + 0x80, 0x00, 0xc0, 0x01, 0xc0, 0x01, 0xe0, 0x03, 0xe0, 0x03, 0xf0, 0x07, + 0xf0, 0x07, 0xf8, 0x0f, 0xf8, 0x0f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01}; + +static const unsigned char cur_cross_bits[] = { + 0xc0, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, + 0x7f, 0x7f, 0x01, 0x40, 0x7f, 0x7f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, + 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01, 0x00, 0x00}; +static const unsigned char mcur_cross_bits[] = { + 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0x00, 0x00}; + +static const uchar cur_ibeam_bits[] = { + 0x00, 0x00, 0xe0, 0x03, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, + 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, + 0x80, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00 }; +static const uchar mcur_ibeam_bits[] = { + 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0x00, 0x00 }; + +static const uchar cur_ver_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f, + 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00 }; +static const uchar mcur_ver_bits[] = { + 0x00, 0x00, 0x80, 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0xf8, 0x3f, + 0xfc, 0x7f, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xfc, 0x7f, 0xf8, 0x3f, + 0xf0, 0x1f, 0xe0, 0x0f, 0xc0, 0x07, 0x80, 0x03 }; + +static const uchar cur_hor_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x30, 0x18, + 0x38, 0x38, 0xfc, 0x7f, 0xfc, 0x7f, 0x38, 0x38, 0x30, 0x18, 0x20, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar mcur_hor_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x40, 0x04, 0x60, 0x0c, 0x70, 0x1c, 0x78, 0x3c, + 0xfc, 0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfc, 0x7f, 0x78, 0x3c, + 0x70, 0x1c, 0x60, 0x0c, 0x40, 0x04, 0x00, 0x00 }; +static const uchar cur_bdiag_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x3e, 0x00, 0x3c, 0x00, 0x3e, + 0x00, 0x37, 0x88, 0x23, 0xd8, 0x01, 0xf8, 0x00, 0x78, 0x00, 0xf8, 0x00, + 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar mcur_bdiag_bits[] = { + 0x00, 0x00, 0xc0, 0x7f, 0x80, 0x7f, 0x00, 0x7f, 0x00, 0x7e, 0x04, 0x7f, + 0x8c, 0x7f, 0xdc, 0x77, 0xfc, 0x63, 0xfc, 0x41, 0xfc, 0x00, 0xfc, 0x01, + 0xfc, 0x03, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00 }; +static const uchar cur_fdiag_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0xf8, 0x00, 0x78, 0x00, + 0xf8, 0x00, 0xd8, 0x01, 0x88, 0x23, 0x00, 0x37, 0x00, 0x3e, 0x00, 0x3c, + 0x00, 0x3e, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00 }; +static const uchar mcur_fdiag_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x01, 0xfc, 0x00, + 0xfc, 0x41, 0xfc, 0x63, 0xdc, 0x77, 0x8c, 0x7f, 0x04, 0x7f, 0x00, 0x7e, + 0x00, 0x7f, 0x80, 0x7f, 0xc0, 0x7f, 0x00, 0x00 }; +static const uchar cur_blank_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +// 20 x 20 +static const uchar forbidden_bits[] = { + 0x00,0x00,0x00,0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xf0,0x00,0x38,0xc0,0x01, + 0x7c,0x80,0x03,0xec,0x00,0x03,0xce,0x01,0x07,0x86,0x03,0x06,0x06,0x07,0x06, + 0x06,0x0e,0x06,0x06,0x1c,0x06,0x0e,0x38,0x07,0x0c,0x70,0x03,0x1c,0xe0,0x03, + 0x38,0xc0,0x01,0xf0,0xe0,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00,0x00,0x00,0x00 }; + +static const uchar forbiddenm_bits[] = { + 0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xff,0x00,0xf8,0xff,0x01,0xfc,0xf0,0x03, + 0xfe,0xc0,0x07,0xfe,0x81,0x07,0xff,0x83,0x0f,0xcf,0x07,0x0f,0x8f,0x0f,0x0f, + 0x0f,0x1f,0x0f,0x0f,0x3e,0x0f,0x1f,0xfc,0x0f,0x1e,0xf8,0x07,0x3e,0xf0,0x07, + 0xfc,0xe0,0x03,0xf8,0xff,0x01,0xf0,0xff,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00}; + +// 32 x 32 +static const uchar wait_data_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, + 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x08, 0x20, 0x00, + 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, + 0x00, 0x50, 0x15, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x40, 0x05, 0x00, + 0x00, 0x80, 0x02, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x20, 0x08, 0x00, + 0x00, 0x10, 0x10, 0x00, 0x00, 0x08, 0x21, 0x00, 0x00, 0x88, 0x22, 0x00, + 0x00, 0x48, 0x25, 0x00, 0x00, 0xa8, 0x2a, 0x00, 0x00, 0xfc, 0x7f, 0x00, + 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar wait_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, + 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xf8, 0x3f, 0x00, + 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, + 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xc0, 0x07, 0x00, + 0x00, 0x80, 0x03, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0xe0, 0x0f, 0x00, + 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, + 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, + 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +static const uchar hsplit_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x41, 0x82, 0x00, 0x80, 0x41, 0x82, 0x01, 0xc0, 0x7f, 0xfe, 0x03, + 0x80, 0x41, 0x82, 0x01, 0x00, 0x41, 0x82, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar hsplitm_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, + 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe3, 0xc7, 0x00, + 0x80, 0xe3, 0xc7, 0x01, 0xc0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x07, + 0xc0, 0xff, 0xff, 0x03, 0x80, 0xe3, 0xc7, 0x01, 0x00, 0xe3, 0xc7, 0x00, + 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, + 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar vsplit_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar vsplitm_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, + 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, + 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, + 0x80, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, + 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar phand_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, + 0x7e, 0x04, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x70, 0x08, 0x00, 0x00, + 0x08, 0x08, 0x00, 0x00, 0x70, 0x14, 0x00, 0x00, 0x08, 0x22, 0x00, 0x00, + 0x30, 0x41, 0x00, 0x00, 0xc0, 0x20, 0x00, 0x00, 0x40, 0x12, 0x00, 0x00, + 0x80, 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar phandm_bits[] = { + 0xfe, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, + 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, + 0xfc, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, + 0xf8, 0xff, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, + 0xc0, 0x1f, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +static const uchar size_all_data_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x80, 0x81, 0xc0, 0x00, + 0xc0, 0xff, 0xff, 0x01, 0x80, 0x81, 0xc0, 0x00, 0x00, 0x81, 0x40, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar size_all_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, + 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc2, 0x21, 0x00, + 0x00, 0xc3, 0x61, 0x00, 0x80, 0xc3, 0xe1, 0x00, 0xc0, 0xff, 0xff, 0x01, + 0xe0, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0x01, 0x80, 0xc3, 0xe1, 0x00, + 0x00, 0xc3, 0x61, 0x00, 0x00, 0xc2, 0x21, 0x00, 0x00, 0xc0, 0x01, 0x00, + 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +static const uchar whatsthis_bits[] = { + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0xf0, 0x07, 0x00, + 0x09, 0x18, 0x0e, 0x00, 0x11, 0x1c, 0x0e, 0x00, 0x21, 0x1c, 0x0e, 0x00, + 0x41, 0x1c, 0x0e, 0x00, 0x81, 0x1c, 0x0e, 0x00, 0x01, 0x01, 0x07, 0x00, + 0x01, 0x82, 0x03, 0x00, 0xc1, 0xc7, 0x01, 0x00, 0x49, 0xc0, 0x01, 0x00, + 0x95, 0xc0, 0x01, 0x00, 0x93, 0xc0, 0x01, 0x00, 0x21, 0x01, 0x00, 0x00, + 0x20, 0xc1, 0x01, 0x00, 0x40, 0xc2, 0x01, 0x00, 0x40, 0x02, 0x00, 0x00, + 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; +static const uchar whatsthism_bits[] = { + 0x01, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x07, 0x00, 0x07, 0xf8, 0x0f, 0x00, + 0x0f, 0xfc, 0x1f, 0x00, 0x1f, 0x3e, 0x1f, 0x00, 0x3f, 0x3e, 0x1f, 0x00, + 0x7f, 0x3e, 0x1f, 0x00, 0xff, 0x3e, 0x1f, 0x00, 0xff, 0x9d, 0x0f, 0x00, + 0xff, 0xc3, 0x07, 0x00, 0xff, 0xe7, 0x03, 0x00, 0x7f, 0xe0, 0x03, 0x00, + 0xf7, 0xe0, 0x03, 0x00, 0xf3, 0xe0, 0x03, 0x00, 0xe1, 0xe1, 0x03, 0x00, + 0xe0, 0xe1, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, + 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; + +static const uchar busy_bits[] = { + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, + 0x41, 0xe0, 0xff, 0x00, 0x81, 0x20, 0x80, 0x00, 0x01, 0xe1, 0xff, 0x00, + 0x01, 0x42, 0x40, 0x00, 0xc1, 0x47, 0x40, 0x00, 0x49, 0x40, 0x55, 0x00, + 0x95, 0x80, 0x2a, 0x00, 0x93, 0x00, 0x15, 0x00, 0x21, 0x01, 0x0a, 0x00, + 0x20, 0x01, 0x11, 0x00, 0x40, 0x82, 0x20, 0x00, 0x40, 0x42, 0x44, 0x00, + 0x80, 0x41, 0x4a, 0x00, 0x00, 0x40, 0x55, 0x00, 0x00, 0xe0, 0xff, 0x00, + 0x00, 0x20, 0x80, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +static const uchar busym_bits[] = { + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, + 0x7f, 0xe0, 0xff, 0x00, 0xff, 0xe0, 0xff, 0x00, 0xff, 0xe1, 0xff, 0x00, + 0xff, 0xc3, 0x7f, 0x00, 0xff, 0xc7, 0x7f, 0x00, 0x7f, 0xc0, 0x7f, 0x00, + 0xf7, 0x80, 0x3f, 0x00, 0xf3, 0x00, 0x1f, 0x00, 0xe1, 0x01, 0x0e, 0x00, + 0xe0, 0x01, 0x1f, 0x00, 0xc0, 0x83, 0x3f, 0x00, 0xc0, 0xc3, 0x7f, 0x00, + 0x80, 0xc1, 0x7f, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0xe0, 0xff, 0x00, + 0x00, 0xe0, 0xff, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +// 16 x 16 +static const uchar openhand_bits[] = { + 0x80,0x01,0x58,0x0e,0x64,0x12,0x64,0x52,0x48,0xb2,0x48,0x92, + 0x16,0x90,0x19,0x80,0x11,0x40,0x02,0x40,0x04,0x40,0x04,0x20, + 0x08,0x20,0x10,0x10,0x20,0x10,0x00,0x00}; +static const uchar openhandm_bits[] = { + 0x80,0x01,0xd8,0x0f,0xfc,0x1f,0xfc,0x5f,0xf8,0xff,0xf8,0xff, + 0xfe,0xff,0xff,0xff,0xff,0x7f,0xfe,0x7f,0xfc,0x7f,0xfc,0x3f, + 0xf8,0x3f,0xf0,0x1f,0xe0,0x1f,0x00,0x00}; +static const uchar closedhand_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0x48,0x32,0x08,0x50, + 0x10,0x40,0x18,0x40,0x04,0x40,0x04,0x20,0x08,0x20,0x10,0x10, + 0x20,0x10,0x20,0x10,0x00,0x00,0x00,0x00}; +static const uchar closedhandm_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0xf8,0x3f,0xf8,0x7f, + 0xf0,0x7f,0xf8,0x7f,0xfc,0x7f,0xfc,0x3f,0xf8,0x3f,0xf0,0x1f, + 0xe0,0x1f,0xe0,0x1f,0x00,0x00,0x00,0x00}; + +void QGraphicsSystemCursorImage::createSystemCursor(int id) +{ + if (!systemCursorTableInit) { + for (int i = 0; i <= Qt::LastCursor; i++) + systemCursorTable[i] = 0; + systemCursorTableInit = true; + } + switch (id) { + // 16x16 cursors + case Qt::ArrowCursor: + systemCursorTable[Qt::ArrowCursor] = + new QGraphicsSystemCursorImage(cur_arrow_bits, mcur_arrow_bits, 16, 16, 0, 0); + break; + + case Qt::UpArrowCursor: + systemCursorTable[Qt::UpArrowCursor] = + new QGraphicsSystemCursorImage(cur_up_arrow_bits, mcur_up_arrow_bits, 16, 16, 7, 0); + break; + + case Qt::CrossCursor: + systemCursorTable[Qt::CrossCursor] = + new QGraphicsSystemCursorImage(cur_cross_bits, mcur_cross_bits, 16, 16, 7, 7); + break; + + case Qt::IBeamCursor: + systemCursorTable[Qt::IBeamCursor] = + new QGraphicsSystemCursorImage(cur_ibeam_bits, mcur_ibeam_bits, 16, 16, 7, 7); + break; + + case Qt::SizeVerCursor: + systemCursorTable[Qt::SizeVerCursor] = + new QGraphicsSystemCursorImage(cur_ver_bits, mcur_ver_bits, 16, 16, 7, 7); + break; + + case Qt::SizeHorCursor: + systemCursorTable[Qt::SizeHorCursor] = + new QGraphicsSystemCursorImage(cur_hor_bits, mcur_hor_bits, 16, 16, 7, 7); + break; + + case Qt::SizeBDiagCursor: + systemCursorTable[Qt::SizeBDiagCursor] = + new QGraphicsSystemCursorImage(cur_bdiag_bits, mcur_bdiag_bits, 16, 16, 7, 7); + break; + + case Qt::SizeFDiagCursor: + systemCursorTable[Qt::SizeFDiagCursor] = + new QGraphicsSystemCursorImage(cur_fdiag_bits, mcur_fdiag_bits, 16, 16, 7, 7); + break; + + case Qt::BlankCursor: + systemCursorTable[Qt::BlankCursor] = + new QGraphicsSystemCursorImage(0, 0, 0, 0, 0, 0); + break; + + // 20x20 cursors + case Qt::ForbiddenCursor: + systemCursorTable[Qt::ForbiddenCursor] = + new QGraphicsSystemCursorImage(forbidden_bits, forbiddenm_bits, 20, 20, 10, 10); + break; + + // 32x32 cursors + case Qt::WaitCursor: + systemCursorTable[Qt::WaitCursor] = + new QGraphicsSystemCursorImage(wait_data_bits, wait_mask_bits, 32, 32, 15, 15); + break; + + case Qt::SplitVCursor: + systemCursorTable[Qt::SplitVCursor] = + new QGraphicsSystemCursorImage(vsplit_bits, vsplitm_bits, 32, 32, 15, 15); + break; + + case Qt::SplitHCursor: + systemCursorTable[Qt::SplitHCursor] = + new QGraphicsSystemCursorImage(hsplit_bits, hsplitm_bits, 32, 32, 15, 15); + break; + + case Qt::SizeAllCursor: + systemCursorTable[Qt::SizeAllCursor] = + new QGraphicsSystemCursorImage(size_all_data_bits, size_all_mask_bits, 32, 32, 15, 15); + break; + + case Qt::PointingHandCursor: + systemCursorTable[Qt::PointingHandCursor] = + new QGraphicsSystemCursorImage(phand_bits, phandm_bits, 32, 32, 0, 0); + break; + + case Qt::WhatsThisCursor: + systemCursorTable[Qt::WhatsThisCursor] = + new QGraphicsSystemCursorImage(whatsthis_bits, whatsthism_bits, 32, 32, 0, 0); + break; + case Qt::BusyCursor: + systemCursorTable[Qt::BusyCursor] = + new QGraphicsSystemCursorImage(busy_bits, busym_bits, 32, 32, 0, 0); + break; + + case Qt::OpenHandCursor: + systemCursorTable[Qt::OpenHandCursor] = + new QGraphicsSystemCursorImage(openhand_bits, openhandm_bits, 16, 16, 8, 8); + break; + case Qt::ClosedHandCursor: + systemCursorTable[Qt::ClosedHandCursor] = + new QGraphicsSystemCursorImage(closedhand_bits, closedhandm_bits, 16, 16, 8, 8); + break; + default: + qWarning("Unknown system cursor %d", id); + } +} + +/*! + \fn void QGraphicsSystemCursorImage::set(Qt::CursorShape id) + + \brief Calling this method sets the cursor image to the specified shape + + \a id is one of the defined Qt::CursorShape values. + + If id is invalid, Qt::BitmapCursor, or unknown by the implementation, + Qt::ArrowCursor is used instead. +*/ + +void QGraphicsSystemCursorImage::set(Qt::CursorShape id) +{ + QGraphicsSystemCursorImage *cursor = 0; + if (id >= 0 && id <= Qt::LastCursor) { + if (!systemCursorTable[id]) + createSystemCursor(id); + cursor = systemCursorTable[id]; + } + + if (cursor == 0) { + if (!systemCursorTable[Qt::ArrowCursor]) + createSystemCursor(Qt::ArrowCursor); + cursor = systemCursorTable[Qt::ArrowCursor]; + } + cursorImage = cursor->cursorImage; + hot = cursor->hot; +} + +/*! + \fn void QGraphicsSystemCursorImage::set(const QImage * image, int hx, int hy) + + \brief Set the cursor image to the specified QImage, with the hotsport at (hx, hy) + + \a image A pointer to a QImage + + \a hx The x coordinate of the cursor's hotspot + + \a hy the y coordinate of the cursor's hotspot +*/ + +void QGraphicsSystemCursorImage::set(const QImage * image, int hx, int hy) +{ + hot.setX(hx); + hot.setY(hy); + cursorImage = *image; +} + +/*! + \fn void QGraphicsSystemCursorImage::set(const uchar *data, const uchar *mask, int width, int height, int hx, int hy) + + \brief set the cursor image to the graphic represented by the combination of data, mask, + width, and height + + \a data The pixel data of the graphic + + \a mask Mask data for the graphic. pixels in data with a corresponding mask bit of 0 are not drawn + + \a width The width of the graphic in pixels + + \a height The height of the graphic in pixels + + \a hx The X hotspot of the cursor graphic + + \a hy The Y hotspot of the cursor graphic +*/ +void QGraphicsSystemCursorImage::set(const uchar *data, const uchar *mask, + int width, int height, int hx, int hy) +{ + hot.setX(hx); + hot.setY(hy); + + cursorImage = QImage(width,height, QImage::Format_Indexed8); + + if (!width || !height || !data || !mask || cursorImage.isNull()) + return; + + cursorImage.setNumColors(3); + cursorImage.setColor(0, 0xff000000); + cursorImage.setColor(1, 0xffffffff); + cursorImage.setColor(2, 0x00000000); + + int bytesPerLine = (width + 7) / 8; + int p = 0; + int d, m; + + int x = -1, w = 0; + + uchar *cursor_data = cursorImage.bits(); + int bpl = cursorImage.bytesPerLine(); + for (int i = 0; i < height; i++) + { + for (int j = 0; j < bytesPerLine; j++, data++, mask++) + { + for (int b = 0; b < 8 && j*8+b < width; b++) + { + d = *data & (1 << b); + m = *mask & (1 << b); + if (d && m) p = 0; + else if (!d && m) p = 1; + else p = 2; + cursor_data[j*8+b] = p; + + // calc region + if (x < 0 && m) + x = j*8+b; + else if (x >= 0 && !m) { + x = -1; + w = 0; + } + if (m) + w++; + } + } + if (x >= 0) { + x = -1; + w = 0; + } + cursor_data += bpl; + } + +} + +/*! + \fn QGraphicsSystemCursorImage::QGraphicsSystemCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) + + \brief set the cursor image to the graphic represented by the combination of data, mask, + width, and height + + \a data The pixel data of the graphic + + \a mask Mask data for the graphic. pixels in data with a corresponding mask bit of 0 are not drawn + + \a width The width of the graphic in pixels + + \a height The height of the graphic in pixels + + \a hotX The X hotspot of the cursor graphic + + \a hotY The Y hotspot of the cursor graphic + + \sa set +*/ + +/*! + \fn QImage *QGraphicsSystemCursorImage::image() + + \brief Return the cursor graphic as a pointer to a QImage +*/ + +/*! + \fn QPoint QGraphicsSystemCursorImage::hotspot() + + \brief Return the cursor's hotspot +*/ + +QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystemcursor_qpa.h b/src/gui/painting/qgraphicssystemcursor_qpa.h new file mode 100644 index 0000000..9c65f7f --- /dev/null +++ b/src/gui/painting/qgraphicssystemcursor_qpa.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QGRAPHICSSYSTEMCURSOR_H +#define QGRAPHICSSYSTEMCURSOR_H + +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +// Cursor graphics management +class Q_GUI_EXPORT QGraphicsSystemCursorImage { +public: + QGraphicsSystemCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) + { set(data, mask, width, height, hotX, hotY); } + QImage * image() { return &cursorImage; } + QPoint hotspot() { return hot; } + void set(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); + void set(const QImage * image, int hx, int hy); + void set(Qt::CursorShape); +private: + static void createSystemCursor(int id); + QImage cursorImage; + QPoint hot; +}; + +class QGraphicsSystemCursor; + +class QGraphicsSystemCursorPrivate { +public: + static QList > getInstances() { return instances; } + static QList > instances; +}; + +class Q_GUI_EXPORT QGraphicsSystemCursor : public QObject { +public: + QGraphicsSystemCursor(QPlatformScreen *); + + // input methods + virtual void pointerEvent(const QMouseEvent & event) { Q_UNUSED(event); } + virtual void changeCursor(QCursor * widgetCursor, QWidget * widget) = 0; + +protected: + QPlatformScreen* screen; // Where to request an update + +private: + Q_DECLARE_PRIVATE(QGraphicsSystemCursor); + friend void qt_lite_set_cursor(QWidget * w, bool force); + friend class QApplicationPrivate; +}; + +QT_END_NAMESPACE + +#endif // QGRAPHICSSYSTEMCURSOR_H diff --git a/src/gui/painting/qpaintdevice_lite.cpp b/src/gui/painting/qpaintdevice_lite.cpp deleted file mode 100644 index 0d1ca92..0000000 --- a/src/gui/painting/qpaintdevice_lite.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpaintdevice.h" -#include "qpainter.h" -#include "qwidget.h" -#include "qbitmap.h" -#include "qapplication.h" - -QT_BEGIN_NAMESPACE - -extern void qt_painter_removePaintDevice(QPaintDevice *); //qpainter.cpp - -int QPaintDevice::metric(PaintDeviceMetric m) const -{ - qWarning("QPaintDevice::metrics: Device has no metric information"); - if (m == PdmDpiX) { - return 72; - } else if (m == PdmDpiY) { - return 72; - } else if (m == PdmNumColors) { - // FIXME: does this need to be a real value? - return 256; - } else { - qDebug("Unrecognised metric %d!",m); - return 0; - } -} - -QT_END_NAMESPACE diff --git a/src/gui/painting/qpaintdevice_qpa.cpp b/src/gui/painting/qpaintdevice_qpa.cpp new file mode 100644 index 0000000..0d1ca92 --- /dev/null +++ b/src/gui/painting/qpaintdevice_qpa.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qpaintdevice.h" +#include "qpainter.h" +#include "qwidget.h" +#include "qbitmap.h" +#include "qapplication.h" + +QT_BEGIN_NAMESPACE + +extern void qt_painter_removePaintDevice(QPaintDevice *); //qpainter.cpp + +int QPaintDevice::metric(PaintDeviceMetric m) const +{ + qWarning("QPaintDevice::metrics: Device has no metric information"); + if (m == PdmDpiX) { + return 72; + } else if (m == PdmDpiY) { + return 72; + } else if (m == PdmNumColors) { + // FIXME: does this need to be a real value? + return 256; + } else { + qDebug("Unrecognised metric %d!",m); + return 0; + } +} + +QT_END_NAMESPACE diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 3861196..e258a39 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -76,7 +76,7 @@ #include #endif #ifdef Q_WS_QPA -#include +#include #include #endif diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index 97c12b3..f196e00 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -80,7 +80,7 @@ SOURCES += qgl.cpp \ embedded_lite { DEFINES += QT_NO_EGL - SOURCES += qgl_lite.cpp \ + SOURCES += qgl_qpa.cpp \ qglpixelbuffer_stub.cpp } diff --git a/src/opengl/qgl_lite.cpp b/src/opengl/qgl_lite.cpp deleted file mode 100644 index 2003cc1..0000000 --- a/src/opengl/qgl_lite.cpp +++ /dev/null @@ -1,253 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include - -#include -#include - -#include "qgl.h" -#include "qgl_p.h" - -QT_BEGIN_NAMESPACE - - -bool QGLFormat::hasOpenGL() -{ - return QApplicationPrivate::platformIntegration()->hasOpenGL(); -} - -bool QGLContext::chooseContext(const QGLContext* shareContext) -{ - Q_D(QGLContext); - if (!d->paintDevice && d->paintDevice->devType() != QInternal::Widget) { - d->valid = false; - }else { - QWidget *widget = static_cast(d->paintDevice); - if (!widget->platformWindow()){ - widget->winId();//make window - } - d->platformContext = widget->platformWindow()->glContext(); - d->valid =(bool) d->platformContext; - } - - return d->valid; -} - -void QGLContext::reset() -{ - Q_D(QGLContext); - if (!d->valid) - return; - d->cleanup(); - doneCurrent(); - - if (d->platformContext) { - delete d->platformContext; - d->platformContext = 0; - } - - d->crWin = false; - d->sharing = false; - d->valid = false; - d->transpColor = QColor(); - d->initDone = false; - QGLContextGroup::removeShare(this); -} - -void QGLContext::makeCurrent() -{ - Q_D(QGLContext); - d->platformContext->makeCurrent(); - QGLContextPrivate::setCurrentContext(this); -} - -void QGLContext::doneCurrent() -{ - Q_D(QGLContext); - d->platformContext->doneCurrent(); - QGLContextPrivate::setCurrentContext(0); -} - -void QGLContext::swapBuffers() const -{ - Q_D(const QGLContext); - d->platformContext->swapBuffers(); -} - -void *QGLContext::getProcAddress(const QString &procName) const -{ - Q_D(const QGLContext); - return d->platformContext->getProcAddress(procName); -} - -void QGLWidget::setContext(QGLContext *context, - const QGLContext* shareContext, - bool deleteOldContext) -{ - Q_D(QGLWidget); - if (context == 0) { - qWarning("QGLWidget::setContext: Cannot set null context"); - return; - } - if (!context->deviceIsPixmap() && context->device() != this) { - qWarning("QGLWidget::setContext: Context must refer to this widget"); - return; - } - - if (d->glcx) - d->glcx->doneCurrent(); - QGLContext* oldcx = d->glcx; - d->glcx = context; - - if (!d->glcx->isValid()) - d->glcx->create(shareContext ? shareContext : oldcx); - - if (deleteOldContext) - delete oldcx; -} - -void QGLWidgetPrivate::init(QGLContext *context, const QGLWidget *shareWidget) -{ - initContext(context, shareWidget); -} - -bool QGLFormat::hasOpenGLOverlays() -{ - return false; -} - -QColor QGLContext::overlayTransparentColor() const -{ - return QColor(); // Invalid color -} - -uint QGLContext::colorIndex(const QColor&) const -{ - return 0; -} - -void QGLContext::generateFontDisplayLists(const QFont & fnt, int listBase) -{ - Q_UNUSED(fnt); - Q_UNUSED(listBase); -} - -/* - QGLTemporaryContext implementation -*/ -class QGLTemporaryContextPrivate -{ -public: - QGLWidget *widget; -}; - -QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) - : d(new QGLTemporaryContextPrivate) -{ - d->widget = new QGLWidget; - d->widget->makeCurrent(); -} - -QGLTemporaryContext::~QGLTemporaryContext() -{ - delete d->widget; -} - - -bool QGLWidgetPrivate::renderCxPm(QPixmap*) -{ - return false; -} - -/*! \internal - Free up any allocated colormaps. This fn is only called for - top-level widgets. -*/ -void QGLWidgetPrivate::cleanupColormaps() -{ -} - -void QGLWidget::setMouseTracking(bool enable) -{ - Q_UNUSED(enable); -} - -bool QGLWidget::event(QEvent *e) -{ - return QWidget::event(e); -} - -void QGLWidget::resizeEvent(QResizeEvent *e) -{ - return QWidget::resizeEvent(e); -} - - -const QGLContext* QGLWidget::overlayContext() const -{ - return 0; -} - -void QGLWidget::makeOverlayCurrent() -{ -} - - -void QGLWidget::updateOverlayGL() -{ -} - -const QGLColormap & QGLWidget::colormap() const -{ - Q_D(const QGLWidget); - return d->cmap; -} - -void QGLWidget::setColormap(const QGLColormap & c) -{ - Q_UNUSED(c); -} - -QT_END_NAMESPACE diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp new file mode 100644 index 0000000..2003cc1 --- /dev/null +++ b/src/opengl/qgl_qpa.cpp @@ -0,0 +1,253 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenGL module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include + +#include +#include + +#include "qgl.h" +#include "qgl_p.h" + +QT_BEGIN_NAMESPACE + + +bool QGLFormat::hasOpenGL() +{ + return QApplicationPrivate::platformIntegration()->hasOpenGL(); +} + +bool QGLContext::chooseContext(const QGLContext* shareContext) +{ + Q_D(QGLContext); + if (!d->paintDevice && d->paintDevice->devType() != QInternal::Widget) { + d->valid = false; + }else { + QWidget *widget = static_cast(d->paintDevice); + if (!widget->platformWindow()){ + widget->winId();//make window + } + d->platformContext = widget->platformWindow()->glContext(); + d->valid =(bool) d->platformContext; + } + + return d->valid; +} + +void QGLContext::reset() +{ + Q_D(QGLContext); + if (!d->valid) + return; + d->cleanup(); + doneCurrent(); + + if (d->platformContext) { + delete d->platformContext; + d->platformContext = 0; + } + + d->crWin = false; + d->sharing = false; + d->valid = false; + d->transpColor = QColor(); + d->initDone = false; + QGLContextGroup::removeShare(this); +} + +void QGLContext::makeCurrent() +{ + Q_D(QGLContext); + d->platformContext->makeCurrent(); + QGLContextPrivate::setCurrentContext(this); +} + +void QGLContext::doneCurrent() +{ + Q_D(QGLContext); + d->platformContext->doneCurrent(); + QGLContextPrivate::setCurrentContext(0); +} + +void QGLContext::swapBuffers() const +{ + Q_D(const QGLContext); + d->platformContext->swapBuffers(); +} + +void *QGLContext::getProcAddress(const QString &procName) const +{ + Q_D(const QGLContext); + return d->platformContext->getProcAddress(procName); +} + +void QGLWidget::setContext(QGLContext *context, + const QGLContext* shareContext, + bool deleteOldContext) +{ + Q_D(QGLWidget); + if (context == 0) { + qWarning("QGLWidget::setContext: Cannot set null context"); + return; + } + if (!context->deviceIsPixmap() && context->device() != this) { + qWarning("QGLWidget::setContext: Context must refer to this widget"); + return; + } + + if (d->glcx) + d->glcx->doneCurrent(); + QGLContext* oldcx = d->glcx; + d->glcx = context; + + if (!d->glcx->isValid()) + d->glcx->create(shareContext ? shareContext : oldcx); + + if (deleteOldContext) + delete oldcx; +} + +void QGLWidgetPrivate::init(QGLContext *context, const QGLWidget *shareWidget) +{ + initContext(context, shareWidget); +} + +bool QGLFormat::hasOpenGLOverlays() +{ + return false; +} + +QColor QGLContext::overlayTransparentColor() const +{ + return QColor(); // Invalid color +} + +uint QGLContext::colorIndex(const QColor&) const +{ + return 0; +} + +void QGLContext::generateFontDisplayLists(const QFont & fnt, int listBase) +{ + Q_UNUSED(fnt); + Q_UNUSED(listBase); +} + +/* + QGLTemporaryContext implementation +*/ +class QGLTemporaryContextPrivate +{ +public: + QGLWidget *widget; +}; + +QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) + : d(new QGLTemporaryContextPrivate) +{ + d->widget = new QGLWidget; + d->widget->makeCurrent(); +} + +QGLTemporaryContext::~QGLTemporaryContext() +{ + delete d->widget; +} + + +bool QGLWidgetPrivate::renderCxPm(QPixmap*) +{ + return false; +} + +/*! \internal + Free up any allocated colormaps. This fn is only called for + top-level widgets. +*/ +void QGLWidgetPrivate::cleanupColormaps() +{ +} + +void QGLWidget::setMouseTracking(bool enable) +{ + Q_UNUSED(enable); +} + +bool QGLWidget::event(QEvent *e) +{ + return QWidget::event(e); +} + +void QGLWidget::resizeEvent(QResizeEvent *e) +{ + return QWidget::resizeEvent(e); +} + + +const QGLContext* QGLWidget::overlayContext() const +{ + return 0; +} + +void QGLWidget::makeOverlayCurrent() +{ +} + + +void QGLWidget::updateOverlayGL() +{ +} + +const QGLColormap & QGLWidget::colormap() const +{ + Q_D(const QGLWidget); + return d->cmap; +} + +void QGLWidget::setColormap(const QGLColormap & c) +{ + Q_UNUSED(c); +} + +QT_END_NAMESPACE -- cgit v0.12 From 9716e12e0f5590ebc23ad9fb7ba75c6a3c5aadab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 24 Jun 2010 11:41:39 +0200 Subject: Adding -qpa configure switch also renaming the embedded_lite qmake switch to be qpa --- configure | 118 ++++++++++++------------ src/3rdparty/webkit/WebCore/WebCore.pro | 2 +- src/corelib/kernel/kernel.pri | 2 +- src/gui/accessible/accessible.pri | 2 +- src/gui/dialogs/dialogs.pri | 4 +- src/gui/egl/egl.pri | 2 +- src/gui/gui.pro | 2 +- src/gui/image/image.pri | 4 +- src/gui/inputmethod/inputmethod.pri | 2 +- src/gui/kernel/kernel.pri | 4 +- src/gui/painting/painting.pri | 14 +-- src/gui/styles/styles.pri | 2 +- src/gui/text/text.pri | 4 +- src/gui/util/util.pri | 4 +- src/gui/widgets/widgets.pri | 2 +- src/opengl/opengl.pro | 4 +- src/plugins/graphicssystems/graphicssystems.pro | 6 +- src/plugins/platforms/platforms.pro | 9 +- src/plugins/plugins.pro | 4 +- src/qt_install.pri | 2 +- tools/tools.pro | 2 +- 21 files changed, 94 insertions(+), 101 deletions(-) diff --git a/configure b/configure index 6143ac1..c33b522 100755 --- a/configure +++ b/configure @@ -187,7 +187,7 @@ fi PLATFORM_X11=no PLATFORM_MAC=no PLATFORM_QWS=maybe -PLATFORM_EMBLITE=maybe +PLATFORM_QPA=maybe BUILD_ON_MAC=no; [ -d /System/Library/Frameworks/Carbon.framework ] && BUILD_ON_MAC=yes @@ -286,8 +286,8 @@ earlyArgParse() VAL=$1 fi ;; - -embedded-lite) - VAR=embedded-lite + -embedded-lite|-qpa) + VAR=qpa # this option may or may not be followed by an argument if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then VAL=auto @@ -338,24 +338,24 @@ earlyArgParse() PLATFORM_X11=no PLATFORM_MAC=no PLATFORM_QWS=yes - PLATFORM_EMBLITE=no + PLATFORM_QPA=no fi else echo "No license exists to enable Qt for Embedded Linux. Disabling." CFG_EMBEDDED=no fi ;; - embedded-lite) + qpa) CFG_EMBEDDED="$VAL" - if [ "$PLATFORM_EMBLITE" != "no" ]; then - if [ "$PLATFORM_EMBLITE" = "maybe" ]; then + if [ "$PLATFORM_QPA" != "no" ]; then + if [ "$PLATFORM_QPA" = "maybe" ]; then PLATFORM_X11=no PLATFORM_MAC=no PLATFORM_QWS=no - PLATFORM_EMBLITE=yes + PLATFORM_QPA=yes fi else - echo "No license exists to enable Qt for Embedded Linux Lite. Disabling." + echo "No license exists to enable Qt QPA. Disabling." CFG_EMBEDDED=no fi ;; @@ -426,7 +426,7 @@ elif [ -f "$relpath"/LICENSE.PREVIEW.COMMERCIAL ] && [ $COMMERCIAL_USER = "yes" elif [ $COMMERCIAL_USER = "yes" ]; then # one of commercial editions [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes - [ "$PLATFORM_EMBLITE" = "maybe" ] && PLATFORM_EMBLITE=no + [ "$PLATFORM_QPA" = "maybe" ] && PLATFORM_QPA=no [ "$PLATFORM_QWS" = "maybe" ] && PLATFORM_QWS=no # read in the license file @@ -519,7 +519,7 @@ elif [ $COMMERCIAL_USER = "yes" ]; then PlatformCode=`echo "$PlatformCode" | sed 's/.$//'` ;; esac - ### EMBEDDED_LITE logic missing ### + ### EMBEDDED_QPA logic missing ### case "$PlatformCode,$PLATFORM_MAC,$PLATFORM_QWS" in X9,* | XC,* | XU,* | XW,* | XM,*) # Qt All-OS @@ -948,8 +948,8 @@ if [ "$CFG_EMBEDDED" = "nacl" ]; then echo "Setting NaCl options:" echo "-static" CFG_SHARED=no - echo "-embedded-lite nacl" - PLATFORM_EMBLITE=yes + echo "-qpa nacl" + PLATFORM_QPA=yes echo "-fast" OPT_FAST=yes echo "-release" @@ -1026,7 +1026,7 @@ while [ "$#" -gt 0 ]; do ;; #Qt style options that pass an argument -qconfig) - if [ "$PLATFORM_QWS" != "yes" -a "$PLATFORM_EMBLITE" != "yes" ]; then + if [ "$PLATFORM_QWS" != "yes" -a "$PLATFORM_QPA" != "yes" ]; then echo echo "WARNING: -qconfig is only tested and supported on Qt for Embedded Linux." echo @@ -1066,8 +1066,8 @@ while [ "$#" -gt 0 ]; do VAL=$1 fi ;; - -embedded-lite) - VAR=embedded-lite + -embedded-lite|-qpa) + VAR=qpa # this option may or may not be followed by an argument if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then VAL=auto @@ -1297,24 +1297,24 @@ while [ "$#" -gt 0 ]; do PLATFORM_X11=no PLATFORM_MAC=no PLATFORM_QWS=yes - PLATFORM_EMBLITE=no + PLATFORM_QPA=no fi else echo "No license exists to enable Qt for Embedded Linux. Disabling." CFG_EMBEDDED=no fi ;; - embedded-lite) + embedded-lite|qpa) CFG_EMBEDDED="$VAL" - if [ "$PLATFORM_EMBLITE" != "no" ]; then - if [ "$PLATFORM_EMBLITE" = "maybe" ]; then + if [ "$PLATFORM_QPA" != "no" ]; then + if [ "$PLATFORM_QPA" = "maybe" ]; then PLATFORM_X11=no PLATFORM_MAC=no PLATFORM_QWS=no - PLATFORM_EMBLITE=yes + PLATFORM_QPA=yes fi else - echo "No license exists to enable Qt for Embedded Linux Lite. Disabling." + echo "No license exists to enable Qt QPA. Disabling." CFG_EMBEDDED=no fi ;; @@ -1420,8 +1420,8 @@ while [ "$#" -gt 0 ]; do PLATFORM_MAC=no elif [ "$PLATFORM_QWS" = "yes" ]; then PLATFORM_QWS=no - elif [ "$PLATFORM_EMBLITE" = "yes" ]; then - PLATFORM_EMBLITE=no + elif [ "$PLATFORM_QPA" = "yes" ]; then + PLATFORM_QPA=no fi if [ "$CFG_FRAMEWORK" = "auto" ]; then CFG_FRAMEWORK=no @@ -2311,7 +2311,7 @@ if [ "$CFG_GUI" = "no" ]; then fi #disable Qt3Support for Lighthouse -if [ "$PLATFORM_EMBLITE" = "yes" ]; then +if [ "$PLATFORM_QPA" = "yes" ]; then CFG_QT3SUPPORT="no" fi @@ -2385,7 +2385,7 @@ if [ "$OPT_SHADOW" = "yes" ]; then [ "$OPT_VERBOSE" = "yes" ] && echo "Performing shadow build..." fi -if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "yes" ]; then +if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "yes" ]; then echo echo "WARNING: -debug-and-release is not supported anymore on Qt/X11 and Qt for Embedded Linux" echo "By default, Qt is built in release mode with separate debug information, so" @@ -2489,7 +2489,7 @@ if [ "$OPT_SHADOW" = "yes" ]; then fi # symlink fonts to be able to run application from build directory -if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ] && [ ! -d "${outpath}/lib/fonts" ]; then +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ] && [ ! -d "${outpath}/lib/fonts" ]; then if [ "$PLATFORM" = "$XPLATFORM" ]; then mkdir -p "${outpath}/lib" ln -s "${relpath}/lib/fonts" "${outpath}/lib/fonts" @@ -2529,7 +2529,7 @@ fi ### help #------------------------------------------------------------------------------- [ "$PLATFORM_QWS" = "yes" -a "$CFG_EMBEDDED" = "no" ] && CFG_EMBEDDED=auto -[ "$PLATFORM_EMBLITE" = "yes" -a "$CFG_EMBEDDED" = "no" ] && CFG_EMBEDDED=auto +[ "$PLATFORM_QPA" = "yes" -a "$CFG_EMBEDDED" = "no" ] && CFG_EMBEDDED=auto if [ "$CFG_EMBEDDED" != "no" ]; then case "$UNAME_SYSTEM:$UNAME_RELEASE" in Darwin:*) @@ -2604,7 +2604,7 @@ if [ "$CFG_EMBEDDED" != "no" ]; then echo "Qt for Embedded Linux is not supported on this platform. Disabling." CFG_EMBEDDED=no PLATFORM_QWS=no - PLATFORM_EMBLITE=no + PLATFORM_QPA=no ;; esac fi @@ -2773,7 +2773,7 @@ if [ -z "$PLATFORM" ]; then esac fi -if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then CFG_SM=no PLATFORMS=`find "$relpath/mkspecs/qws" | sed "s,$relpath/mkspecs/qws/,,"` else @@ -3087,7 +3087,7 @@ fi if [ "$OPT_VERBOSE" = "yes" ]; then echo "System architecture: '$CFG_ARCH'" - if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then + if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then echo "Host architecture: '$CFG_HOST_ARCH'" fi fi @@ -3278,7 +3278,7 @@ if [ "$CFG_USE_GNUMAKE" = "auto" ] && "$MAKE" -v | grep "GNU Make" >/dev/null 2> fi # If -opengl wasn't specified, don't try to auto-detect -if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ] && [ "$CFG_OPENGL" = "auto" ]; then +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ] && [ "$CFG_OPENGL" = "auto" ]; then CFG_OPENGL=no fi @@ -3354,8 +3354,8 @@ if [ -z "$QT_INSTALL_PREFIX" ]; then if [ -z "$QT_INSTALL_PREFIX" ]; then # still empty if [ "$CFG_DEV" = "yes" ]; then QT_INSTALL_PREFIX="$outpath" # In Development, we use sandboxed builds by default - elif [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then - if [ "$PLATFORM_EMBLITE" = "yes" ]; then + elif [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then + if [ "$PLATFORM_QPA" = "yes" ]; then QT_INSTALL_PREFIX="/usr/local/Trolltech/QtLighthouse-${QT_VERSION}" else QT_INSTALL_PREFIX="/usr/local/Trolltech/QtEmbedded-${QT_VERSION}" @@ -3576,7 +3576,7 @@ Installation options: -prefix ...... This will install everything relative to (default $QT_INSTALL_PREFIX) EOF -if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then cat <: arm mips x86 generic - -embedded-lite This will enable the Lighthouse build. + -qpa ......... This will enable the QPA build. Example values for : arm mips x86 generic - Lighthouse does not use QWS. + QPA is a window system agnostic implementation of Qt. -armfpa ............. Target platform uses the ARM-FPA floating point format. -no-armfpa .......... Target platform does not use the ARM-FPA floating point format. @@ -4190,7 +4190,7 @@ EOF fi -if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" -o "$PLATFORM_X11" = "yes" ]; then +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" -o "$PLATFORM_X11" = "yes" ]; then if [ "$CFG_GLIB" = "no" ]; then GBY=" " GBN="+" @@ -4229,7 +4229,7 @@ fi # Help # LICENSING, INTERACTIVE PART # ----------------------------------------------------------------------------- -if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then Platform="Qt for Embedded Linux" elif [ "$PLATFORM_MAC" = "yes" ]; then Platform="Qt for Mac OS X" @@ -5285,7 +5285,7 @@ fi # auto-detect iconv(3) support if [ "$CFG_ICONV" != "no" ]; then - if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then + if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "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 $MAC_CONFIG_TEST_COMMANDLINE; then CFG_ICONV=yes @@ -5346,7 +5346,7 @@ if [ "$PLATFORM_MAC" = "yes" -a ! -z "$QT_NAMESPACE" ]; then fi # X11/QWS/Lighthouse -if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then +if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then # auto-detect Glib support if [ "$CFG_GLIB" != "no" ]; then @@ -5917,7 +5917,7 @@ if [ "$PLATFORM_MAC" = "yes" ]; then fi -if [ "$PLATFORM_EMBLITE" = "yes" ]; then +if [ "$PLATFORM_QPA" = "yes" ]; then # auto-detect OpenGL support (es1 = OpenGL ES 1.x Common, es2 = OpenGL ES 2.x) if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengldesktop "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then @@ -6026,7 +6026,7 @@ if [ "$PLATFORM_QWS" = "yes" ]; then fi fi -if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then # screen drivers for screen in ${CFG_GFX_ON} ${CFG_GFX_PLUGIN}; do @@ -6210,7 +6210,7 @@ fi if [ "$CFG_DOUBLEFORMAT" = "auto" ]; then - if [ "$PLATFORM_QWS" != "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then + if [ "$PLATFORM_QWS" != "yes" -o "$PLATFORM_QPA" = "yes" ]; then CFG_DOUBLEFORMAT=normal else "$unixtests/doubleformat.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" @@ -6489,7 +6489,7 @@ fi #------------------------------------------------------------------------------- ### fix this: user input should be validated in a loop -if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then PROMPT_FOR_DEPTHS="yes" else PROMPT_FOR_DEPTHS="no" @@ -6684,7 +6684,7 @@ else fi if [ "$CFG_OPENGL" = "es1" ] || [ "$CFG_OPENGL" = "es2" ]; then - if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then + if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then if [ "$PLATFORM_QWS" = "yes" ]; then QCONFIG_FLAGS="$QCONFIG_FLAGS Q_BACKINGSTORE_SUBSURFACES" else @@ -6731,10 +6731,10 @@ if [ "$PLATFORM_QWS" = "yes" ]; then QT_CONFIG="$QT_CONFIG embedded" rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes fi -if [ "$PLATFORM_EMBLITE" = "yes" ]; then +if [ "$PLATFORM_QPA" = "yes" ]; then QMAKE_OUTDIR="${QMAKE_OUTDIR}-emb-$CFG_EMBEDDED" - QMAKE_CONFIG="$QMAKE_CONFIG embedded_lite" - QT_CONFIG="$QT_CONFIG embedded_lite" + QMAKE_CONFIG="$QMAKE_CONFIG qpa" + QT_CONFIG="$QT_CONFIG qpa" rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes fi @@ -6991,7 +6991,7 @@ if [ '!' -z "$I_FLAGS" ]; then fi # turn off exceptions for the compilers that support it -if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then COMPILER=`echo $XPLATFORM | cut -f 3- -d-` else COMPILER=`echo $PLATFORM | cut -f 2- -d-` @@ -6999,7 +6999,7 @@ fi if [ "$CFG_EXCEPTIONS" = "unspecified" -a "$PLATFORM_QWS" = "yes" ]; then CFG_EXCEPTIONS=no fi -if [ "$CFG_EXCEPTIONS" = "unspecified" -a "$PLATFORM_EMBLITE" = "yes" ]; then +if [ "$CFG_EXCEPTIONS" = "unspecified" -a "$PLATFORM_QPA" = "yes" ]; then CFG_EXCEPTIONS=no fi @@ -7388,7 +7388,7 @@ esac # ipv6 # # X11 : x11sm xinerama xcursor xfixes xrandr xrender mitshm fontconfig xkb -# Embedded: embedded embedded_lite freetype +# Embedded: embedded qpa freetype # ALL_OPTIONS= BUILD_CONFIG= @@ -7689,8 +7689,8 @@ if [ "$PLATFORM_QWS" = "yes" ]; then done fi # QWS -if [ "$PLATFORM_EMBLITE" = "yes" ]; then - # Add LITE to config.h +if [ "$PLATFORM_QPA" = "yes" ]; then + # Add QPA to config.h QCONFIG_FLAGS="$QCONFIG_FLAGS Q_WS_QPA QT_NO_QWS_QPF QT_NO_QWS_QPF2" fi @@ -8102,7 +8102,7 @@ else echo "Architecture: $CFG_ARCH" fi -if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then echo "Host architecture: $CFG_HOST_ARCH" fi @@ -8210,7 +8210,7 @@ else fi echo "zlib support ........... $CFG_ZLIB" echo "Session management ..... $CFG_SM" -if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_EMBLITE" = "yes" ]; then +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then echo "Embedded support ....... $CFG_EMBEDDED" if [ "$CFG_QWS_FREETYPE" = "auto" ]; then echo "Freetype2 support ...... $CFG_QWS_FREETYPE ($CFG_LIBFREETYPE)" diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index afb1bcd..9870769 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -49,7 +49,7 @@ TEMPLATE = lib TARGET = QtWebKit contains(QT_CONFIG, embedded):CONFIG += embedded -contains(QT_CONFIG, embedded_lite):CONFIG += embedded +contains(QT_CONFIG, qpa):CONFIG += embedded CONFIG(standalone_package) { isEmpty(WC_GENERATED_SOURCES_DIR):WC_GENERATED_SOURCES_DIR = $$PWD/generated diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index 6f53a3f..1e27c31 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -78,7 +78,7 @@ wince*: { kernel/qfunctions_wince.h } -mac:!embedded:!embedded_lite { +mac:!embedded:!qpa{ SOURCES += \ kernel/qcoreapplication_mac.cpp } diff --git a/src/gui/accessible/accessible.pri b/src/gui/accessible/accessible.pri index afa5ecd..31362ff 100644 --- a/src/gui/accessible/accessible.pri +++ b/src/gui/accessible/accessible.pri @@ -12,7 +12,7 @@ contains(QT_CONFIG, accessibility) { accessible/qaccessiblewidget.cpp \ accessible/qaccessibleplugin.cpp - mac:!embedded:!embedded_lite { + mac:!embedded:!qpa { HEADERS += accessible/qaccessible_mac_p.h OBJECTIVE_SOURCES += accessible/qaccessible_mac.mm \ accessible/qaccessible_mac_cocoa.mm diff --git a/src/gui/dialogs/dialogs.pri b/src/gui/dialogs/dialogs.pri index 20bdabc..cd8e71a 100644 --- a/src/gui/dialogs/dialogs.pri +++ b/src/gui/dialogs/dialogs.pri @@ -27,7 +27,7 @@ HEADERS += \ dialogs/qwizard.h \ dialogs/qprintpreviewdialog.h -!embedded:!embedded_lite:mac { +!embedded:!qpa:mac { OBJECTIVE_SOURCES += dialogs/qfiledialog_mac.mm \ dialogs/qfontdialog_mac.mm \ dialogs/qnspanelproxy_mac.mm \ @@ -61,7 +61,7 @@ win32 { !win32-borland:!wince*: LIBS += -lshell32 # the filedialog needs this library } -!mac:!embedded:!symbian:unix|embedded_lite { +!mac:!embedded:!symbian:unix|qpa { HEADERS += dialogs/qpagesetupdialog_unix_p.h SOURCES += dialogs/qprintdialog_unix.cpp \ dialogs/qpagesetupdialog_unix.cpp diff --git a/src/gui/egl/egl.pri b/src/gui/egl/egl.pri index 476f1a3..8e8664c 100644 --- a/src/gui/egl/egl.pri +++ b/src/gui/egl/egl.pri @@ -28,7 +28,7 @@ contains(QT_CONFIG, egl): { embedded { SOURCES += egl/qegl_qws.cpp } else { - embedded_lite { + qpa { SOURCES += egl/qegl_qpa.cpp } else { symbian { diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 4fbdb36..772f70b 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -5,7 +5,7 @@ DEFINES += QT_BUILD_GUI_LIB QT_NO_USING_NAMESPACE win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x65000000 irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused -!win32:!embedded:!embedded_lite:!mac:!symbian:CONFIG += x11 +!win32:!embedded:!qpa:!mac:!symbian:CONFIG += x11 unix:QMAKE_PKGCONFIG_REQUIRES = QtCore diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index 064ba32..13447e7 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -63,14 +63,14 @@ win32 { embedded { SOURCES += image/qpixmap_qws.cpp } -embedded_lite { +qpa { SOURCES += image/qpixmap_qpa.cpp } x11 { HEADERS += image/qpixmap_x11_p.h SOURCES += image/qpixmap_x11.cpp } -!embedded:!embedded_lite:mac { +!embedded:!qpa:mac { HEADERS += image/qpixmap_mac_p.h SOURCES += image/qpixmap_mac.cpp } diff --git a/src/gui/inputmethod/inputmethod.pri b/src/gui/inputmethod/inputmethod.pri index 6a3ef83..d439438 100644 --- a/src/gui/inputmethod/inputmethod.pri +++ b/src/gui/inputmethod/inputmethod.pri @@ -19,7 +19,7 @@ embedded { HEADERS += inputmethod/qwsinputcontext_p.h SOURCES += inputmethod/qwsinputcontext_qws.cpp } -mac:!embedded:!embedded_lite { +mac:!embedded:!qpa { HEADERS += inputmethod/qmacinputcontext_p.h SOURCES += inputmethod/qmacinputcontext_mac.cpp } diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index dcdfd04..5d92456 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -198,7 +198,7 @@ embedded { } } -embedded_lite { +qpa { HEADERS += \ kernel/qgenericpluginfactory_qpa.h \ kernel/qgenericplugin_qpa.h \ @@ -240,7 +240,7 @@ embedded_lite { } } -!embedded:!embedded_lite:!x11:mac { +!embedded:!qpa:!x11:mac { SOURCES += \ kernel/qclipboard_mac.cpp \ kernel/qmime_mac.cpp \ diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 07017ec..8d9b09e 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -119,7 +119,7 @@ embedded { SOURCES += \ painting/qgraphicssystem_qws.cpp \ -} else: if(!embedded_lite) { +} else: if(!qpa) { HEADERS += \ painting/qgraphicssystem_raster_p.h \ painting/qgraphicssystem_runtime_p.h \ @@ -147,7 +147,7 @@ unix:x11 { painting/qpaintengine_x11.cpp } -!embedded:!embedded_lite:!x11:mac { +!embedded:!qpa:!x11:mac { HEADERS += \ painting/qpaintengine_mac_p.h \ painting/qgraphicssystem_mac_p.h \ @@ -163,14 +163,14 @@ unix:x11 { painting/qprintengine_mac.mm \ } -unix:!mac:!symbian|embedded_lite { +unix:!mac:!symbian|qpa { HEADERS += \ painting/qprinterinfo_unix_p.h SOURCES += \ painting/qprinterinfo_unix.cpp } -win32|x11|mac|embedded|embedded_lite|symbian { +win32|x11|mac|embedded|qpa|symbian { SOURCES += painting/qbackingstore.cpp HEADERS += painting/qbackingstore_p.h } @@ -187,7 +187,7 @@ embedded { painting/qpaintdevice_qws.cpp } -embedded_lite { +qpa { SOURCES += \ painting/qcolormap_qpa.cpp \ painting/qpaintdevice_qpa.cpp \ @@ -206,7 +206,7 @@ symbian { painting/qpaintengine_s60_p.h } -x11|embedded|embedded_lite { +x11|embedded|qpa { contains(QT_CONFIG,qtopia) { DEFINES += QT_NO_CUPS QT_NO_LPR } else { @@ -372,7 +372,7 @@ x11 { SOURCES += painting/qwindowsurface_x11.cpp } -!embedded:!embedded_lite:mac { +!embedded:!qpa:mac { HEADERS += painting/qwindowsurface_mac_p.h SOURCES += painting/qwindowsurface_mac.cpp } diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri index 9d6b6fb..0bac0aa 100644 --- a/src/gui/styles/styles.pri +++ b/src/gui/styles/styles.pri @@ -35,7 +35,7 @@ contains( styles, all ) { styles = mac windows windowsxp windowsvista } -x11|embedded|embedded_lite|!macx-*:styles -= mac +x11|embedded|qpa|!macx-*:styles -= mac x11{ QMAKE_CXXFLAGS += $$QT_CFLAGS_QGTKSTYLE diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri index d7bddf5..04ab7df 100644 --- a/src/gui/text/text.pri +++ b/src/gui/text/text.pri @@ -89,7 +89,7 @@ unix:x11 { text/qfontengine_ft.cpp } -!embedded:!embedded_lite:!x11:mac { +!embedded:!qpa:!x11:mac { SOURCES += \ text/qfont_mac.cpp OBJECTIVE_SOURCES += text/qfontengine_mac.mm @@ -110,7 +110,7 @@ embedded { DEFINES += QT_NO_FONTCONFIG } -embedded_lite { +qpa { SOURCES += \ text/qfont_qws.cpp \ text/qfontengine_ft.cpp \ diff --git a/src/gui/util/util.pri b/src/gui/util/util.pri index dd99aa8..f66f9ff 100644 --- a/src/gui/util/util.pri +++ b/src/gui/util/util.pri @@ -33,12 +33,12 @@ unix:x11 { util/qsystemtrayicon_x11.cpp } -embedded|embedded_lite { +embedded|qpa { SOURCES += \ util/qsystemtrayicon_qws.cpp } -!embedded:!embedded_lite:!x11:mac { +!embedded:!qpa:!x11:mac { OBJECTIVE_SOURCES += util/qsystemtrayicon_mac.mm } diff --git a/src/gui/widgets/widgets.pri b/src/gui/widgets/widgets.pri index 9fe2b3d..669b838 100644 --- a/src/gui/widgets/widgets.pri +++ b/src/gui/widgets/widgets.pri @@ -144,7 +144,7 @@ SOURCES += \ widgets/qplaintextedit.cpp \ widgets/qprintpreviewwidget.cpp -!embedded:!embedded_lite:mac { +!embedded:!qpa:mac { HEADERS += widgets/qmacnativewidget_mac.h \ widgets/qmaccocoaviewcontainer_mac.h OBJECTIVE_HEADERS += widgets/qcocoatoolbardelegate_mac_p.h \ diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index f196e00..09a6b0f 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -11,7 +11,7 @@ unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui include(../qbase.pri) -!win32:!embedded:!mac:!embedded_lite:CONFIG += x11 +!win32:!embedded:!mac:!qpa:CONFIG += x11 contains(QT_CONFIG, opengl):CONFIG += opengl contains(QT_CONFIG, opengles1):CONFIG += opengles1 contains(QT_CONFIG, opengles2):CONFIG += opengles2 @@ -77,7 +77,7 @@ SOURCES += qgl.cpp \ } -embedded_lite { +qpa { DEFINES += QT_NO_EGL SOURCES += qgl_qpa.cpp \ diff --git a/src/plugins/graphicssystems/graphicssystems.pro b/src/plugins/graphicssystems/graphicssystems.pro index c00c9ff..7a8f4d6 100644 --- a/src/plugins/graphicssystems/graphicssystems.pro +++ b/src/plugins/graphicssystems/graphicssystems.pro @@ -2,11 +2,7 @@ TEMPLATE = subdirs SUBDIRS += trace !wince*:contains(QT_CONFIG, opengl):SUBDIRS += opengl contains(QT_CONFIG, openvg):contains(QT_CONFIG, egl) { - embedded_lite { - SUBDIRS += openvglite - } else { - SUBDIRS += openvg - } + SUBDIRS += openvg } contains(QT_CONFIG, shivavg) { diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro index 9688443..b68230c 100644 --- a/src/plugins/platforms/platforms.pro +++ b/src/plugins/platforms/platforms.pro @@ -1,14 +1,11 @@ TEMPLATE = subdirs contains(QT_CONFIG, openvg):contains(QT_CONFIG, egl) { - embedded_lite { - SUBDIRS += openvglite - } + SUBDIRS += openvglite } -embedded_lite { SUBDIRS += minimal -} -embedded_lite:x11 { +#this don't work. but leave it for now +qpa:x11 { SUBDIRS += testlite } diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 04e8c7c..bc76a0c 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -7,12 +7,12 @@ unix:!symbian { SUBDIRS *= codecs } !contains(QT_CONFIG, no-gui): SUBDIRS *= imageformats iconengines -!embedded:!embedded_lite:SUBDIRS *= graphicssystems +!embedded:!qpa:SUBDIRS *= graphicssystems embedded:SUBDIRS *= gfxdrivers decorations mousedrivers kbddrivers !win32:!embedded:!mac:!symbian:SUBDIRS *= inputmethods !symbian:!contains(QT_CONFIG, no-gui):SUBDIRS += accessible symbian:SUBDIRS += s60 contains(QT_CONFIG, phonon): SUBDIRS *= phonon contains(QT_CONFIG, multimedia): SUBDIRS *= audio - +qpa:SUBDIRS += platforms diff --git a/src/qt_install.pri b/src/qt_install.pri index 3cea79c..268bb86 100644 --- a/src/qt_install.pri +++ b/src/qt_install.pri @@ -38,7 +38,7 @@ qt_install_headers { } } -embedded|embedded_lite: equals(TARGET, QtGui) { +embedded|qpa: equals(TARGET, QtGui) { # install fonts for embedded INSTALLS += fonts fonts.path = $$[QT_INSTALL_LIBS]/fonts diff --git a/tools/tools.pro b/tools/tools.pro index 03d01a0..8002b4b 100644 --- a/tools/tools.pro +++ b/tools/tools.pro @@ -20,7 +20,7 @@ TEMPLATE = subdirs SUBDIRS += designer } } - unix:!mac:!embedded:!embedded_lite:contains(QT_CONFIG, qt3support):SUBDIRS += qtconfig + unix:!mac:!embedded:!qpa:contains(QT_CONFIG, qt3support):SUBDIRS += qtconfig win32:!wince*:SUBDIRS += activeqt } contains(QT_CONFIG, declarative):SUBDIRS += qml -- cgit v0.12 From 3a34a71c6f70a709ac494e65d465dcd4e346ccbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 24 Jun 2010 12:46:49 +0200 Subject: Remove QSound for Lighthouse --- src/gui/kernel/kernel.pri | 13 +++++--- src/gui/kernel/qsound_qpa.cpp | 74 ------------------------------------------- 2 files changed, 9 insertions(+), 78 deletions(-) delete mode 100644 src/gui/kernel/qsound_qpa.cpp diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 5d92456..965cbe3 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -32,8 +32,6 @@ HEADERS += \ kernel/qshortcutmap_p.h \ kernel/qsizepolicy.h \ kernel/qpalette.h \ - kernel/qsound.h \ - kernel/qsound_p.h \ kernel/qstackedlayout.h \ kernel/qtooltip.h \ kernel/qwhatsthis.h \ @@ -73,7 +71,6 @@ SOURCES += \ kernel/qpalette.cpp \ kernel/qshortcut.cpp \ kernel/qshortcutmap.cpp \ - kernel/qsound.cpp \ kernel/qstackedlayout.cpp \ kernel/qtooltip.cpp \ kernel/qguivariant.cpp \ @@ -198,6 +195,15 @@ embedded { } } +!qpa { + HEADERS += \ + kernel/qsound.h \ + kernel/qsound_p.h + + SOURCES += \ + kernel/qsound.cpp +} + qpa { HEADERS += \ kernel/qgenericpluginfactory_qpa.h \ @@ -220,7 +226,6 @@ qpa { kernel/qgenericpluginfactory_qpa.cpp \ kernel/qgenericplugin_qpa.cpp \ kernel/qkeymapper_qws.cpp \ - kernel/qsound_qpa.cpp \ kernel/qwidget_qpa.cpp \ kernel/qeventdispatcher_qpa.cpp \ kernel/qwindowsysteminterface.cpp \ diff --git a/src/gui/kernel/qsound_qpa.cpp b/src/gui/kernel/qsound_qpa.cpp deleted file mode 100644 index 0714185..0000000 --- a/src/gui/kernel/qsound_qpa.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qapplication.h" - -#ifndef QT_NO_SOUND - -#include "qsound.h" -#include "qsound_p.h" - -class QAuServerLite : public QAuServer -{ - Q_OBJECT -public: - QAuServerLite( QObject* parent ); - - void play( QSound* s ) {} - void stop( QSound* s ) {} - bool okay() { return false; } -}; - -QAuServerLite::QAuServerLite(QObject* parent) : - QAuServer(parent) -{ -} - -QAuServer* qt_new_audio_server() -{ - return new QAuServerLite(qApp); -} - -#include "qsound_qpa.moc" - -#endif // QT_NO_SOUND - -QT_END_NAMESPACE -- cgit v0.12 From 1e88fd57c693db1e4b6f0c42a2c05fad935fb4b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 24 Jun 2010 14:02:41 +0200 Subject: Refactored QGraphicsSystemCursor -> QPlatformCursor --- src/gui/image/qpixmap_blitter.cpp | 4 + src/gui/kernel/qapplication_qpa.cpp | 6 +- src/gui/kernel/qwidget_qpa.cpp | 4 +- src/gui/painting/painting.pri | 4 +- src/gui/painting/qgraphicssystemcursor_qpa.cpp | 664 --------------------- src/gui/painting/qgraphicssystemcursor_qpa.h | 97 --- src/gui/painting/qplatformcursor_qpa.cpp | 664 +++++++++++++++++++++ src/gui/painting/qplatformcursor_qpa.h | 97 +++ src/plugins/platforms/directfb/qdirectfbcursor.cpp | 4 +- src/plugins/platforms/directfb/qdirectfbcursor.h | 6 +- src/plugins/platforms/fb_base/fb_base.cpp | 24 +- src/plugins/platforms/fb_base/fb_base.h | 10 +- .../platforms/linuxfb/qlinuxfbintegration.cpp | 2 +- .../platforms/testlite/qtestliteintegration.cpp | 6 +- src/plugins/platforms/vnc/qvnccursor.cpp | 6 +- src/plugins/platforms/vnc/qvnccursor.h | 2 +- 16 files changed, 802 insertions(+), 798 deletions(-) delete mode 100644 src/gui/painting/qgraphicssystemcursor_qpa.cpp delete mode 100644 src/gui/painting/qgraphicssystemcursor_qpa.h create mode 100644 src/gui/painting/qplatformcursor_qpa.cpp create mode 100644 src/gui/painting/qplatformcursor_qpa.h diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index 660f4d2..d91a269 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -37,7 +37,11 @@ QBlittable *QBlittablePixmapData::blittable() const { if (!m_blittable) { QBlittablePixmapData *that = const_cast(this); +#ifdef Q_WS_QPA //####jl: graphics system nor platformintegration should have createBlittable + that->m_blittable = QApplicationPrivate::platformIntegration()->createBlittable(QSize(w,h)); +#else that->m_blittable = QApplicationPrivate::graphicsSystem()->createBlittable(QSize(w,h)); +#endif } return m_blittable; diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp index afa069b..1fc202c 100644 --- a/src/gui/kernel/qapplication_qpa.cpp +++ b/src/gui/kernel/qapplication_qpa.cpp @@ -57,7 +57,7 @@ #include #include -#include +#include #include #include #include @@ -705,8 +705,8 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterface::MouseEvent * QMouseEvent ev(type, localPoint, globalPoint, button, buttons, modifiers); - QList > cursors = QGraphicsSystemCursorPrivate::getInstances(); - foreach (QWeakPointer cursor, cursors) { + QList > cursors = QPlatformCursorPrivate::getInstances(); + foreach (QWeakPointer cursor, cursors) { if (cursor) cursor.data()->pointerEvent(ev); } diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp index 11fa211..a543c8f 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -49,7 +49,7 @@ #include "QtGui/qdesktopwidget.h" #include "QtGui/qplatformwindow_qpa.h" -#include +#include QT_BEGIN_NAMESPACE static QPlatformScreen *qt_screenForWidget(const QWidget *w); @@ -800,7 +800,7 @@ void qt_lite_set_cursor(QWidget * w, bool force) cursorCursor = w->cursor(); cursorWidget = w; } while (0); - foreach (QWeakPointer cursor, QGraphicsSystemCursorPrivate::getInstances()) + foreach (QWeakPointer cursor, QPlatformCursorPrivate::getInstances()) if (cursor) cursor.data()->changeCursor(&cursorCursor, cursorWidget); } diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 8d9b09e..b235320 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -191,9 +191,9 @@ qpa { SOURCES += \ painting/qcolormap_qpa.cpp \ painting/qpaintdevice_qpa.cpp \ - painting/qgraphicssystemcursor_qpa.cpp + painting/qplatformcursor_qpa.cpp HEADERS += \ - painting/qgraphicssystemcursor_qpa.h + painting/qplatformcursor_qpa.h } symbian { diff --git a/src/gui/painting/qgraphicssystemcursor_qpa.cpp b/src/gui/painting/qgraphicssystemcursor_qpa.cpp deleted file mode 100644 index 24376f9..0000000 --- a/src/gui/painting/qgraphicssystemcursor_qpa.cpp +++ /dev/null @@ -1,664 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qgraphicssystemcursor_qpa.h" - -#include -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -QList > QGraphicsSystemCursorPrivate::instances; - -/*! - \class QGraphicsSystemCursor - - \brief The QGraphicsSystemCursor class provides information about - pointer device events (movement, buttons), and requests to change - the currently displayed cursor. - - Note that QGraphicsSystemCursor does not include any graphics for - display. An application that sets a QCursor may provide its own - graphics. - - \sa QGraphicsSystemCursorImage -*/ - -/*! - \fn virtual void QGraphicsSystemCursor::pointerEvent(const QMouseEvent & event) - - This method is called by Qt whenever a QMouseEvent is generated by the - underlying pointer input. \a event is a reference to the QMouseEvent in - question. A default do-nothing implementation is provided. - - \sa QApplicationPrivate::handleMouseEvent() -*/ - -/*! - \fn virtual void QGraphicsSystemCursor::changeCursor(QCursor * widgetCursor, QWidget * widget) - - \brief This method is called by Qt whenever the cursor graphic should be changed. - - Implementation of this method is mandatory for a subclass of QGraphicsSystemCursor. - - \a widgetCursor is a pointer to the QCursor that should be displayed. - - \a widget is a pointer to the widget currently displayed at QCursor::pos(). Note - that this may be 0 if the current position is not occupied by a displayed widget. - - \sa QApplicationPrivate::handleMouseEvent(), QCursor::pos() -*/ - -/*! - \fn QGraphicsSystemCursor::QGraphicsSystemCursor() - - \brief Constructs a QGraphicsSystemCursor -*/ -QGraphicsSystemCursor::QGraphicsSystemCursor(QPlatformScreen *scr ) - : screen(scr) -{ - QGraphicsSystemCursorPrivate::instances.append(this); -} - -// End of display and pointer event handling code -// Beginning of built-in cursor graphics -// from src/gui/embedded/QGraphicsSystemCursorImage_qws.cpp - -/*! - \class QGraphicsSystemCursorImage - - \brief The QGraphicsSystemCursorImage class provides a set of graphics - intended to be used as cursors. - - \sa QGraphicsSystemCursor -*/ - -static QGraphicsSystemCursorImage *systemCursorTable[Qt::LastCursor+1]; -static bool systemCursorTableInit = false; - -// 16 x 16 -static const uchar cur_arrow_bits[] = { - 0x07, 0x00, 0x39, 0x00, 0xc1, 0x01, 0x02, 0x0e, 0x02, 0x10, 0x02, 0x08, - 0x04, 0x04, 0x04, 0x02, 0x04, 0x04, 0x88, 0x08, 0x48, 0x11, 0x28, 0x22, - 0x10, 0x44, 0x00, 0x28, 0x00, 0x10, 0x00, 0x00 }; -static const uchar mcur_arrow_bits[] = { - 0x07, 0x00, 0x3f, 0x00, 0xff, 0x01, 0xfe, 0x0f, 0xfe, 0x1f, 0xfe, 0x0f, - 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x07, 0xf8, 0x0f, 0x78, 0x1f, 0x38, 0x3e, - 0x10, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00, 0x00 }; - -static const unsigned char cur_up_arrow_bits[] = { - 0x80, 0x00, 0x40, 0x01, 0x40, 0x01, 0x20, 0x02, 0x20, 0x02, 0x10, 0x04, - 0x10, 0x04, 0x08, 0x08, 0x78, 0x0f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, - 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01}; -static const unsigned char mcur_up_arrow_bits[] = { - 0x80, 0x00, 0xc0, 0x01, 0xc0, 0x01, 0xe0, 0x03, 0xe0, 0x03, 0xf0, 0x07, - 0xf0, 0x07, 0xf8, 0x0f, 0xf8, 0x0f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, - 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01}; - -static const unsigned char cur_cross_bits[] = { - 0xc0, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, - 0x7f, 0x7f, 0x01, 0x40, 0x7f, 0x7f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, - 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01, 0x00, 0x00}; -static const unsigned char mcur_cross_bits[] = { - 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, - 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, - 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0x00, 0x00}; - -static const uchar cur_ibeam_bits[] = { - 0x00, 0x00, 0xe0, 0x03, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, - 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, - 0x80, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00 }; -static const uchar mcur_ibeam_bits[] = { - 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, - 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, - 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0x00, 0x00 }; - -static const uchar cur_ver_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, - 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f, - 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00 }; -static const uchar mcur_ver_bits[] = { - 0x00, 0x00, 0x80, 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0xf8, 0x3f, - 0xfc, 0x7f, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xfc, 0x7f, 0xf8, 0x3f, - 0xf0, 0x1f, 0xe0, 0x0f, 0xc0, 0x07, 0x80, 0x03 }; - -static const uchar cur_hor_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x30, 0x18, - 0x38, 0x38, 0xfc, 0x7f, 0xfc, 0x7f, 0x38, 0x38, 0x30, 0x18, 0x20, 0x08, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar mcur_hor_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x40, 0x04, 0x60, 0x0c, 0x70, 0x1c, 0x78, 0x3c, - 0xfc, 0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfc, 0x7f, 0x78, 0x3c, - 0x70, 0x1c, 0x60, 0x0c, 0x40, 0x04, 0x00, 0x00 }; -static const uchar cur_bdiag_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x3e, 0x00, 0x3c, 0x00, 0x3e, - 0x00, 0x37, 0x88, 0x23, 0xd8, 0x01, 0xf8, 0x00, 0x78, 0x00, 0xf8, 0x00, - 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar mcur_bdiag_bits[] = { - 0x00, 0x00, 0xc0, 0x7f, 0x80, 0x7f, 0x00, 0x7f, 0x00, 0x7e, 0x04, 0x7f, - 0x8c, 0x7f, 0xdc, 0x77, 0xfc, 0x63, 0xfc, 0x41, 0xfc, 0x00, 0xfc, 0x01, - 0xfc, 0x03, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00 }; -static const uchar cur_fdiag_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0xf8, 0x00, 0x78, 0x00, - 0xf8, 0x00, 0xd8, 0x01, 0x88, 0x23, 0x00, 0x37, 0x00, 0x3e, 0x00, 0x3c, - 0x00, 0x3e, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00 }; -static const uchar mcur_fdiag_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x01, 0xfc, 0x00, - 0xfc, 0x41, 0xfc, 0x63, 0xdc, 0x77, 0x8c, 0x7f, 0x04, 0x7f, 0x00, 0x7e, - 0x00, 0x7f, 0x80, 0x7f, 0xc0, 0x7f, 0x00, 0x00 }; -static const uchar cur_blank_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -// 20 x 20 -static const uchar forbidden_bits[] = { - 0x00,0x00,0x00,0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xf0,0x00,0x38,0xc0,0x01, - 0x7c,0x80,0x03,0xec,0x00,0x03,0xce,0x01,0x07,0x86,0x03,0x06,0x06,0x07,0x06, - 0x06,0x0e,0x06,0x06,0x1c,0x06,0x0e,0x38,0x07,0x0c,0x70,0x03,0x1c,0xe0,0x03, - 0x38,0xc0,0x01,0xf0,0xe0,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00,0x00,0x00,0x00 }; - -static const uchar forbiddenm_bits[] = { - 0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xff,0x00,0xf8,0xff,0x01,0xfc,0xf0,0x03, - 0xfe,0xc0,0x07,0xfe,0x81,0x07,0xff,0x83,0x0f,0xcf,0x07,0x0f,0x8f,0x0f,0x0f, - 0x0f,0x1f,0x0f,0x0f,0x3e,0x0f,0x1f,0xfc,0x0f,0x1e,0xf8,0x07,0x3e,0xf0,0x07, - 0xfc,0xe0,0x03,0xf8,0xff,0x01,0xf0,0xff,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00}; - -// 32 x 32 -static const uchar wait_data_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, - 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x08, 0x20, 0x00, - 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, - 0x00, 0x50, 0x15, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x40, 0x05, 0x00, - 0x00, 0x80, 0x02, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x20, 0x08, 0x00, - 0x00, 0x10, 0x10, 0x00, 0x00, 0x08, 0x21, 0x00, 0x00, 0x88, 0x22, 0x00, - 0x00, 0x48, 0x25, 0x00, 0x00, 0xa8, 0x2a, 0x00, 0x00, 0xfc, 0x7f, 0x00, - 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar wait_mask_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, - 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xf8, 0x3f, 0x00, - 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, - 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xc0, 0x07, 0x00, - 0x00, 0x80, 0x03, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0xe0, 0x0f, 0x00, - 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, - 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, - 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -static const uchar hsplit_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, - 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, - 0x00, 0x41, 0x82, 0x00, 0x80, 0x41, 0x82, 0x01, 0xc0, 0x7f, 0xfe, 0x03, - 0x80, 0x41, 0x82, 0x01, 0x00, 0x41, 0x82, 0x00, 0x00, 0x40, 0x02, 0x00, - 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, - 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar hsplitm_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, - 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe3, 0xc7, 0x00, - 0x80, 0xe3, 0xc7, 0x01, 0xc0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x07, - 0xc0, 0xff, 0xff, 0x03, 0x80, 0xe3, 0xc7, 0x01, 0x00, 0xe3, 0xc7, 0x00, - 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, - 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar vsplit_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar vsplitm_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, - 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, - 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, - 0x80, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, - 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar phand_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, - 0x7e, 0x04, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x70, 0x08, 0x00, 0x00, - 0x08, 0x08, 0x00, 0x00, 0x70, 0x14, 0x00, 0x00, 0x08, 0x22, 0x00, 0x00, - 0x30, 0x41, 0x00, 0x00, 0xc0, 0x20, 0x00, 0x00, 0x40, 0x12, 0x00, 0x00, - 0x80, 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar phandm_bits[] = { - 0xfe, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, - 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, - 0xfc, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, - 0xf8, 0xff, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, - 0xc0, 0x1f, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, - 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -static const uchar size_all_data_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x80, 0x81, 0xc0, 0x00, - 0xc0, 0xff, 0xff, 0x01, 0x80, 0x81, 0xc0, 0x00, 0x00, 0x81, 0x40, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar size_all_mask_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, - 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc2, 0x21, 0x00, - 0x00, 0xc3, 0x61, 0x00, 0x80, 0xc3, 0xe1, 0x00, 0xc0, 0xff, 0xff, 0x01, - 0xe0, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0x01, 0x80, 0xc3, 0xe1, 0x00, - 0x00, 0xc3, 0x61, 0x00, 0x00, 0xc2, 0x21, 0x00, 0x00, 0xc0, 0x01, 0x00, - 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0xe0, 0x03, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -static const uchar whatsthis_bits[] = { - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0xf0, 0x07, 0x00, - 0x09, 0x18, 0x0e, 0x00, 0x11, 0x1c, 0x0e, 0x00, 0x21, 0x1c, 0x0e, 0x00, - 0x41, 0x1c, 0x0e, 0x00, 0x81, 0x1c, 0x0e, 0x00, 0x01, 0x01, 0x07, 0x00, - 0x01, 0x82, 0x03, 0x00, 0xc1, 0xc7, 0x01, 0x00, 0x49, 0xc0, 0x01, 0x00, - 0x95, 0xc0, 0x01, 0x00, 0x93, 0xc0, 0x01, 0x00, 0x21, 0x01, 0x00, 0x00, - 0x20, 0xc1, 0x01, 0x00, 0x40, 0xc2, 0x01, 0x00, 0x40, 0x02, 0x00, 0x00, - 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -static const uchar whatsthism_bits[] = { - 0x01, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x07, 0x00, 0x07, 0xf8, 0x0f, 0x00, - 0x0f, 0xfc, 0x1f, 0x00, 0x1f, 0x3e, 0x1f, 0x00, 0x3f, 0x3e, 0x1f, 0x00, - 0x7f, 0x3e, 0x1f, 0x00, 0xff, 0x3e, 0x1f, 0x00, 0xff, 0x9d, 0x0f, 0x00, - 0xff, 0xc3, 0x07, 0x00, 0xff, 0xe7, 0x03, 0x00, 0x7f, 0xe0, 0x03, 0x00, - 0xf7, 0xe0, 0x03, 0x00, 0xf3, 0xe0, 0x03, 0x00, 0xe1, 0xe1, 0x03, 0x00, - 0xe0, 0xe1, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, - 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; - -static const uchar busy_bits[] = { - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, - 0x41, 0xe0, 0xff, 0x00, 0x81, 0x20, 0x80, 0x00, 0x01, 0xe1, 0xff, 0x00, - 0x01, 0x42, 0x40, 0x00, 0xc1, 0x47, 0x40, 0x00, 0x49, 0x40, 0x55, 0x00, - 0x95, 0x80, 0x2a, 0x00, 0x93, 0x00, 0x15, 0x00, 0x21, 0x01, 0x0a, 0x00, - 0x20, 0x01, 0x11, 0x00, 0x40, 0x82, 0x20, 0x00, 0x40, 0x42, 0x44, 0x00, - 0x80, 0x41, 0x4a, 0x00, 0x00, 0x40, 0x55, 0x00, 0x00, 0xe0, 0xff, 0x00, - 0x00, 0x20, 0x80, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -static const uchar busym_bits[] = { - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, - 0x7f, 0xe0, 0xff, 0x00, 0xff, 0xe0, 0xff, 0x00, 0xff, 0xe1, 0xff, 0x00, - 0xff, 0xc3, 0x7f, 0x00, 0xff, 0xc7, 0x7f, 0x00, 0x7f, 0xc0, 0x7f, 0x00, - 0xf7, 0x80, 0x3f, 0x00, 0xf3, 0x00, 0x1f, 0x00, 0xe1, 0x01, 0x0e, 0x00, - 0xe0, 0x01, 0x1f, 0x00, 0xc0, 0x83, 0x3f, 0x00, 0xc0, 0xc3, 0x7f, 0x00, - 0x80, 0xc1, 0x7f, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0xe0, 0xff, 0x00, - 0x00, 0xe0, 0xff, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -// 16 x 16 -static const uchar openhand_bits[] = { - 0x80,0x01,0x58,0x0e,0x64,0x12,0x64,0x52,0x48,0xb2,0x48,0x92, - 0x16,0x90,0x19,0x80,0x11,0x40,0x02,0x40,0x04,0x40,0x04,0x20, - 0x08,0x20,0x10,0x10,0x20,0x10,0x00,0x00}; -static const uchar openhandm_bits[] = { - 0x80,0x01,0xd8,0x0f,0xfc,0x1f,0xfc,0x5f,0xf8,0xff,0xf8,0xff, - 0xfe,0xff,0xff,0xff,0xff,0x7f,0xfe,0x7f,0xfc,0x7f,0xfc,0x3f, - 0xf8,0x3f,0xf0,0x1f,0xe0,0x1f,0x00,0x00}; -static const uchar closedhand_bits[] = { - 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0x48,0x32,0x08,0x50, - 0x10,0x40,0x18,0x40,0x04,0x40,0x04,0x20,0x08,0x20,0x10,0x10, - 0x20,0x10,0x20,0x10,0x00,0x00,0x00,0x00}; -static const uchar closedhandm_bits[] = { - 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0xf8,0x3f,0xf8,0x7f, - 0xf0,0x7f,0xf8,0x7f,0xfc,0x7f,0xfc,0x3f,0xf8,0x3f,0xf0,0x1f, - 0xe0,0x1f,0xe0,0x1f,0x00,0x00,0x00,0x00}; - -void QGraphicsSystemCursorImage::createSystemCursor(int id) -{ - if (!systemCursorTableInit) { - for (int i = 0; i <= Qt::LastCursor; i++) - systemCursorTable[i] = 0; - systemCursorTableInit = true; - } - switch (id) { - // 16x16 cursors - case Qt::ArrowCursor: - systemCursorTable[Qt::ArrowCursor] = - new QGraphicsSystemCursorImage(cur_arrow_bits, mcur_arrow_bits, 16, 16, 0, 0); - break; - - case Qt::UpArrowCursor: - systemCursorTable[Qt::UpArrowCursor] = - new QGraphicsSystemCursorImage(cur_up_arrow_bits, mcur_up_arrow_bits, 16, 16, 7, 0); - break; - - case Qt::CrossCursor: - systemCursorTable[Qt::CrossCursor] = - new QGraphicsSystemCursorImage(cur_cross_bits, mcur_cross_bits, 16, 16, 7, 7); - break; - - case Qt::IBeamCursor: - systemCursorTable[Qt::IBeamCursor] = - new QGraphicsSystemCursorImage(cur_ibeam_bits, mcur_ibeam_bits, 16, 16, 7, 7); - break; - - case Qt::SizeVerCursor: - systemCursorTable[Qt::SizeVerCursor] = - new QGraphicsSystemCursorImage(cur_ver_bits, mcur_ver_bits, 16, 16, 7, 7); - break; - - case Qt::SizeHorCursor: - systemCursorTable[Qt::SizeHorCursor] = - new QGraphicsSystemCursorImage(cur_hor_bits, mcur_hor_bits, 16, 16, 7, 7); - break; - - case Qt::SizeBDiagCursor: - systemCursorTable[Qt::SizeBDiagCursor] = - new QGraphicsSystemCursorImage(cur_bdiag_bits, mcur_bdiag_bits, 16, 16, 7, 7); - break; - - case Qt::SizeFDiagCursor: - systemCursorTable[Qt::SizeFDiagCursor] = - new QGraphicsSystemCursorImage(cur_fdiag_bits, mcur_fdiag_bits, 16, 16, 7, 7); - break; - - case Qt::BlankCursor: - systemCursorTable[Qt::BlankCursor] = - new QGraphicsSystemCursorImage(0, 0, 0, 0, 0, 0); - break; - - // 20x20 cursors - case Qt::ForbiddenCursor: - systemCursorTable[Qt::ForbiddenCursor] = - new QGraphicsSystemCursorImage(forbidden_bits, forbiddenm_bits, 20, 20, 10, 10); - break; - - // 32x32 cursors - case Qt::WaitCursor: - systemCursorTable[Qt::WaitCursor] = - new QGraphicsSystemCursorImage(wait_data_bits, wait_mask_bits, 32, 32, 15, 15); - break; - - case Qt::SplitVCursor: - systemCursorTable[Qt::SplitVCursor] = - new QGraphicsSystemCursorImage(vsplit_bits, vsplitm_bits, 32, 32, 15, 15); - break; - - case Qt::SplitHCursor: - systemCursorTable[Qt::SplitHCursor] = - new QGraphicsSystemCursorImage(hsplit_bits, hsplitm_bits, 32, 32, 15, 15); - break; - - case Qt::SizeAllCursor: - systemCursorTable[Qt::SizeAllCursor] = - new QGraphicsSystemCursorImage(size_all_data_bits, size_all_mask_bits, 32, 32, 15, 15); - break; - - case Qt::PointingHandCursor: - systemCursorTable[Qt::PointingHandCursor] = - new QGraphicsSystemCursorImage(phand_bits, phandm_bits, 32, 32, 0, 0); - break; - - case Qt::WhatsThisCursor: - systemCursorTable[Qt::WhatsThisCursor] = - new QGraphicsSystemCursorImage(whatsthis_bits, whatsthism_bits, 32, 32, 0, 0); - break; - case Qt::BusyCursor: - systemCursorTable[Qt::BusyCursor] = - new QGraphicsSystemCursorImage(busy_bits, busym_bits, 32, 32, 0, 0); - break; - - case Qt::OpenHandCursor: - systemCursorTable[Qt::OpenHandCursor] = - new QGraphicsSystemCursorImage(openhand_bits, openhandm_bits, 16, 16, 8, 8); - break; - case Qt::ClosedHandCursor: - systemCursorTable[Qt::ClosedHandCursor] = - new QGraphicsSystemCursorImage(closedhand_bits, closedhandm_bits, 16, 16, 8, 8); - break; - default: - qWarning("Unknown system cursor %d", id); - } -} - -/*! - \fn void QGraphicsSystemCursorImage::set(Qt::CursorShape id) - - \brief Calling this method sets the cursor image to the specified shape - - \a id is one of the defined Qt::CursorShape values. - - If id is invalid, Qt::BitmapCursor, or unknown by the implementation, - Qt::ArrowCursor is used instead. -*/ - -void QGraphicsSystemCursorImage::set(Qt::CursorShape id) -{ - QGraphicsSystemCursorImage *cursor = 0; - if (id >= 0 && id <= Qt::LastCursor) { - if (!systemCursorTable[id]) - createSystemCursor(id); - cursor = systemCursorTable[id]; - } - - if (cursor == 0) { - if (!systemCursorTable[Qt::ArrowCursor]) - createSystemCursor(Qt::ArrowCursor); - cursor = systemCursorTable[Qt::ArrowCursor]; - } - cursorImage = cursor->cursorImage; - hot = cursor->hot; -} - -/*! - \fn void QGraphicsSystemCursorImage::set(const QImage * image, int hx, int hy) - - \brief Set the cursor image to the specified QImage, with the hotsport at (hx, hy) - - \a image A pointer to a QImage - - \a hx The x coordinate of the cursor's hotspot - - \a hy the y coordinate of the cursor's hotspot -*/ - -void QGraphicsSystemCursorImage::set(const QImage * image, int hx, int hy) -{ - hot.setX(hx); - hot.setY(hy); - cursorImage = *image; -} - -/*! - \fn void QGraphicsSystemCursorImage::set(const uchar *data, const uchar *mask, int width, int height, int hx, int hy) - - \brief set the cursor image to the graphic represented by the combination of data, mask, - width, and height - - \a data The pixel data of the graphic - - \a mask Mask data for the graphic. pixels in data with a corresponding mask bit of 0 are not drawn - - \a width The width of the graphic in pixels - - \a height The height of the graphic in pixels - - \a hx The X hotspot of the cursor graphic - - \a hy The Y hotspot of the cursor graphic -*/ -void QGraphicsSystemCursorImage::set(const uchar *data, const uchar *mask, - int width, int height, int hx, int hy) -{ - hot.setX(hx); - hot.setY(hy); - - cursorImage = QImage(width,height, QImage::Format_Indexed8); - - if (!width || !height || !data || !mask || cursorImage.isNull()) - return; - - cursorImage.setNumColors(3); - cursorImage.setColor(0, 0xff000000); - cursorImage.setColor(1, 0xffffffff); - cursorImage.setColor(2, 0x00000000); - - int bytesPerLine = (width + 7) / 8; - int p = 0; - int d, m; - - int x = -1, w = 0; - - uchar *cursor_data = cursorImage.bits(); - int bpl = cursorImage.bytesPerLine(); - for (int i = 0; i < height; i++) - { - for (int j = 0; j < bytesPerLine; j++, data++, mask++) - { - for (int b = 0; b < 8 && j*8+b < width; b++) - { - d = *data & (1 << b); - m = *mask & (1 << b); - if (d && m) p = 0; - else if (!d && m) p = 1; - else p = 2; - cursor_data[j*8+b] = p; - - // calc region - if (x < 0 && m) - x = j*8+b; - else if (x >= 0 && !m) { - x = -1; - w = 0; - } - if (m) - w++; - } - } - if (x >= 0) { - x = -1; - w = 0; - } - cursor_data += bpl; - } - -} - -/*! - \fn QGraphicsSystemCursorImage::QGraphicsSystemCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) - - \brief set the cursor image to the graphic represented by the combination of data, mask, - width, and height - - \a data The pixel data of the graphic - - \a mask Mask data for the graphic. pixels in data with a corresponding mask bit of 0 are not drawn - - \a width The width of the graphic in pixels - - \a height The height of the graphic in pixels - - \a hotX The X hotspot of the cursor graphic - - \a hotY The Y hotspot of the cursor graphic - - \sa set -*/ - -/*! - \fn QImage *QGraphicsSystemCursorImage::image() - - \brief Return the cursor graphic as a pointer to a QImage -*/ - -/*! - \fn QPoint QGraphicsSystemCursorImage::hotspot() - - \brief Return the cursor's hotspot -*/ - -QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystemcursor_qpa.h b/src/gui/painting/qgraphicssystemcursor_qpa.h deleted file mode 100644 index 9c65f7f..0000000 --- a/src/gui/painting/qgraphicssystemcursor_qpa.h +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QGRAPHICSSYSTEMCURSOR_H -#define QGRAPHICSSYSTEMCURSOR_H - -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -// Cursor graphics management -class Q_GUI_EXPORT QGraphicsSystemCursorImage { -public: - QGraphicsSystemCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) - { set(data, mask, width, height, hotX, hotY); } - QImage * image() { return &cursorImage; } - QPoint hotspot() { return hot; } - void set(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); - void set(const QImage * image, int hx, int hy); - void set(Qt::CursorShape); -private: - static void createSystemCursor(int id); - QImage cursorImage; - QPoint hot; -}; - -class QGraphicsSystemCursor; - -class QGraphicsSystemCursorPrivate { -public: - static QList > getInstances() { return instances; } - static QList > instances; -}; - -class Q_GUI_EXPORT QGraphicsSystemCursor : public QObject { -public: - QGraphicsSystemCursor(QPlatformScreen *); - - // input methods - virtual void pointerEvent(const QMouseEvent & event) { Q_UNUSED(event); } - virtual void changeCursor(QCursor * widgetCursor, QWidget * widget) = 0; - -protected: - QPlatformScreen* screen; // Where to request an update - -private: - Q_DECLARE_PRIVATE(QGraphicsSystemCursor); - friend void qt_lite_set_cursor(QWidget * w, bool force); - friend class QApplicationPrivate; -}; - -QT_END_NAMESPACE - -#endif // QGRAPHICSSYSTEMCURSOR_H diff --git a/src/gui/painting/qplatformcursor_qpa.cpp b/src/gui/painting/qplatformcursor_qpa.cpp new file mode 100644 index 0000000..6665396 --- /dev/null +++ b/src/gui/painting/qplatformcursor_qpa.cpp @@ -0,0 +1,664 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "qplatformcursor_qpa.h" + +#include +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +QList > QPlatformCursorPrivate::instances; + +/*! + \class QGraphicsSystemCursor + + \brief The QGraphicsSystemCursor class provides information about + pointer device events (movement, buttons), and requests to change + the currently displayed cursor. + + Note that QGraphicsSystemCursor does not include any graphics for + display. An application that sets a QCursor may provide its own + graphics. + + \sa QGraphicsSystemCursorImage +*/ + +/*! + \fn virtual void QGraphicsSystemCursor::pointerEvent(const QMouseEvent & event) + + This method is called by Qt whenever a QMouseEvent is generated by the + underlying pointer input. \a event is a reference to the QMouseEvent in + question. A default do-nothing implementation is provided. + + \sa QApplicationPrivate::handleMouseEvent() +*/ + +/*! + \fn virtual void QGraphicsSystemCursor::changeCursor(QCursor * widgetCursor, QWidget * widget) + + \brief This method is called by Qt whenever the cursor graphic should be changed. + + Implementation of this method is mandatory for a subclass of QGraphicsSystemCursor. + + \a widgetCursor is a pointer to the QCursor that should be displayed. + + \a widget is a pointer to the widget currently displayed at QCursor::pos(). Note + that this may be 0 if the current position is not occupied by a displayed widget. + + \sa QApplicationPrivate::handleMouseEvent(), QCursor::pos() +*/ + +/*! + \fn QGraphicsSystemCursor::QGraphicsSystemCursor() + + \brief Constructs a QGraphicsSystemCursor +*/ +QPlatformCursor::QPlatformCursor(QPlatformScreen *scr ) + : screen(scr) +{ + QPlatformCursorPrivate::instances.append(this); +} + +// End of display and pointer event handling code +// Beginning of built-in cursor graphics +// from src/gui/embedded/QGraphicsSystemCursorImage_qws.cpp + +/*! + \class QGraphicsSystemCursorImage + + \brief The QGraphicsSystemCursorImage class provides a set of graphics + intended to be used as cursors. + + \sa QGraphicsSystemCursor +*/ + +static QPlatformCursorImage *systemCursorTable[Qt::LastCursor+1]; +static bool systemCursorTableInit = false; + +// 16 x 16 +static const uchar cur_arrow_bits[] = { + 0x07, 0x00, 0x39, 0x00, 0xc1, 0x01, 0x02, 0x0e, 0x02, 0x10, 0x02, 0x08, + 0x04, 0x04, 0x04, 0x02, 0x04, 0x04, 0x88, 0x08, 0x48, 0x11, 0x28, 0x22, + 0x10, 0x44, 0x00, 0x28, 0x00, 0x10, 0x00, 0x00 }; +static const uchar mcur_arrow_bits[] = { + 0x07, 0x00, 0x3f, 0x00, 0xff, 0x01, 0xfe, 0x0f, 0xfe, 0x1f, 0xfe, 0x0f, + 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x07, 0xf8, 0x0f, 0x78, 0x1f, 0x38, 0x3e, + 0x10, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00, 0x00 }; + +static const unsigned char cur_up_arrow_bits[] = { + 0x80, 0x00, 0x40, 0x01, 0x40, 0x01, 0x20, 0x02, 0x20, 0x02, 0x10, 0x04, + 0x10, 0x04, 0x08, 0x08, 0x78, 0x0f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, + 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01}; +static const unsigned char mcur_up_arrow_bits[] = { + 0x80, 0x00, 0xc0, 0x01, 0xc0, 0x01, 0xe0, 0x03, 0xe0, 0x03, 0xf0, 0x07, + 0xf0, 0x07, 0xf8, 0x0f, 0xf8, 0x0f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01}; + +static const unsigned char cur_cross_bits[] = { + 0xc0, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, + 0x7f, 0x7f, 0x01, 0x40, 0x7f, 0x7f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, + 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01, 0x00, 0x00}; +static const unsigned char mcur_cross_bits[] = { + 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0x00, 0x00}; + +static const uchar cur_ibeam_bits[] = { + 0x00, 0x00, 0xe0, 0x03, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, + 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, + 0x80, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00 }; +static const uchar mcur_ibeam_bits[] = { + 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0x00, 0x00 }; + +static const uchar cur_ver_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f, + 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00 }; +static const uchar mcur_ver_bits[] = { + 0x00, 0x00, 0x80, 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0xf8, 0x3f, + 0xfc, 0x7f, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xfc, 0x7f, 0xf8, 0x3f, + 0xf0, 0x1f, 0xe0, 0x0f, 0xc0, 0x07, 0x80, 0x03 }; + +static const uchar cur_hor_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x30, 0x18, + 0x38, 0x38, 0xfc, 0x7f, 0xfc, 0x7f, 0x38, 0x38, 0x30, 0x18, 0x20, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar mcur_hor_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x40, 0x04, 0x60, 0x0c, 0x70, 0x1c, 0x78, 0x3c, + 0xfc, 0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfc, 0x7f, 0x78, 0x3c, + 0x70, 0x1c, 0x60, 0x0c, 0x40, 0x04, 0x00, 0x00 }; +static const uchar cur_bdiag_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x3e, 0x00, 0x3c, 0x00, 0x3e, + 0x00, 0x37, 0x88, 0x23, 0xd8, 0x01, 0xf8, 0x00, 0x78, 0x00, 0xf8, 0x00, + 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar mcur_bdiag_bits[] = { + 0x00, 0x00, 0xc0, 0x7f, 0x80, 0x7f, 0x00, 0x7f, 0x00, 0x7e, 0x04, 0x7f, + 0x8c, 0x7f, 0xdc, 0x77, 0xfc, 0x63, 0xfc, 0x41, 0xfc, 0x00, 0xfc, 0x01, + 0xfc, 0x03, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00 }; +static const uchar cur_fdiag_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0xf8, 0x00, 0x78, 0x00, + 0xf8, 0x00, 0xd8, 0x01, 0x88, 0x23, 0x00, 0x37, 0x00, 0x3e, 0x00, 0x3c, + 0x00, 0x3e, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00 }; +static const uchar mcur_fdiag_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x01, 0xfc, 0x00, + 0xfc, 0x41, 0xfc, 0x63, 0xdc, 0x77, 0x8c, 0x7f, 0x04, 0x7f, 0x00, 0x7e, + 0x00, 0x7f, 0x80, 0x7f, 0xc0, 0x7f, 0x00, 0x00 }; +static const uchar cur_blank_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +// 20 x 20 +static const uchar forbidden_bits[] = { + 0x00,0x00,0x00,0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xf0,0x00,0x38,0xc0,0x01, + 0x7c,0x80,0x03,0xec,0x00,0x03,0xce,0x01,0x07,0x86,0x03,0x06,0x06,0x07,0x06, + 0x06,0x0e,0x06,0x06,0x1c,0x06,0x0e,0x38,0x07,0x0c,0x70,0x03,0x1c,0xe0,0x03, + 0x38,0xc0,0x01,0xf0,0xe0,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00,0x00,0x00,0x00 }; + +static const uchar forbiddenm_bits[] = { + 0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xff,0x00,0xf8,0xff,0x01,0xfc,0xf0,0x03, + 0xfe,0xc0,0x07,0xfe,0x81,0x07,0xff,0x83,0x0f,0xcf,0x07,0x0f,0x8f,0x0f,0x0f, + 0x0f,0x1f,0x0f,0x0f,0x3e,0x0f,0x1f,0xfc,0x0f,0x1e,0xf8,0x07,0x3e,0xf0,0x07, + 0xfc,0xe0,0x03,0xf8,0xff,0x01,0xf0,0xff,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00}; + +// 32 x 32 +static const uchar wait_data_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, + 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x08, 0x20, 0x00, + 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, + 0x00, 0x50, 0x15, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x40, 0x05, 0x00, + 0x00, 0x80, 0x02, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x20, 0x08, 0x00, + 0x00, 0x10, 0x10, 0x00, 0x00, 0x08, 0x21, 0x00, 0x00, 0x88, 0x22, 0x00, + 0x00, 0x48, 0x25, 0x00, 0x00, 0xa8, 0x2a, 0x00, 0x00, 0xfc, 0x7f, 0x00, + 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar wait_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, + 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xf8, 0x3f, 0x00, + 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, + 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xc0, 0x07, 0x00, + 0x00, 0x80, 0x03, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0xe0, 0x0f, 0x00, + 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, + 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, + 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +static const uchar hsplit_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x41, 0x82, 0x00, 0x80, 0x41, 0x82, 0x01, 0xc0, 0x7f, 0xfe, 0x03, + 0x80, 0x41, 0x82, 0x01, 0x00, 0x41, 0x82, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar hsplitm_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, + 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe3, 0xc7, 0x00, + 0x80, 0xe3, 0xc7, 0x01, 0xc0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x07, + 0xc0, 0xff, 0xff, 0x03, 0x80, 0xe3, 0xc7, 0x01, 0x00, 0xe3, 0xc7, 0x00, + 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, + 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar vsplit_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar vsplitm_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, + 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, + 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, + 0x80, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, + 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar phand_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, + 0x7e, 0x04, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x70, 0x08, 0x00, 0x00, + 0x08, 0x08, 0x00, 0x00, 0x70, 0x14, 0x00, 0x00, 0x08, 0x22, 0x00, 0x00, + 0x30, 0x41, 0x00, 0x00, 0xc0, 0x20, 0x00, 0x00, 0x40, 0x12, 0x00, 0x00, + 0x80, 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar phandm_bits[] = { + 0xfe, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, + 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, + 0xfc, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, + 0xf8, 0xff, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, + 0xc0, 0x1f, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +static const uchar size_all_data_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x80, 0x81, 0xc0, 0x00, + 0xc0, 0xff, 0xff, 0x01, 0x80, 0x81, 0xc0, 0x00, 0x00, 0x81, 0x40, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar size_all_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, + 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc2, 0x21, 0x00, + 0x00, 0xc3, 0x61, 0x00, 0x80, 0xc3, 0xe1, 0x00, 0xc0, 0xff, 0xff, 0x01, + 0xe0, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0x01, 0x80, 0xc3, 0xe1, 0x00, + 0x00, 0xc3, 0x61, 0x00, 0x00, 0xc2, 0x21, 0x00, 0x00, 0xc0, 0x01, 0x00, + 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +static const uchar whatsthis_bits[] = { + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0xf0, 0x07, 0x00, + 0x09, 0x18, 0x0e, 0x00, 0x11, 0x1c, 0x0e, 0x00, 0x21, 0x1c, 0x0e, 0x00, + 0x41, 0x1c, 0x0e, 0x00, 0x81, 0x1c, 0x0e, 0x00, 0x01, 0x01, 0x07, 0x00, + 0x01, 0x82, 0x03, 0x00, 0xc1, 0xc7, 0x01, 0x00, 0x49, 0xc0, 0x01, 0x00, + 0x95, 0xc0, 0x01, 0x00, 0x93, 0xc0, 0x01, 0x00, 0x21, 0x01, 0x00, 0x00, + 0x20, 0xc1, 0x01, 0x00, 0x40, 0xc2, 0x01, 0x00, 0x40, 0x02, 0x00, 0x00, + 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; +static const uchar whatsthism_bits[] = { + 0x01, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x07, 0x00, 0x07, 0xf8, 0x0f, 0x00, + 0x0f, 0xfc, 0x1f, 0x00, 0x1f, 0x3e, 0x1f, 0x00, 0x3f, 0x3e, 0x1f, 0x00, + 0x7f, 0x3e, 0x1f, 0x00, 0xff, 0x3e, 0x1f, 0x00, 0xff, 0x9d, 0x0f, 0x00, + 0xff, 0xc3, 0x07, 0x00, 0xff, 0xe7, 0x03, 0x00, 0x7f, 0xe0, 0x03, 0x00, + 0xf7, 0xe0, 0x03, 0x00, 0xf3, 0xe0, 0x03, 0x00, 0xe1, 0xe1, 0x03, 0x00, + 0xe0, 0xe1, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, + 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; + +static const uchar busy_bits[] = { + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, + 0x41, 0xe0, 0xff, 0x00, 0x81, 0x20, 0x80, 0x00, 0x01, 0xe1, 0xff, 0x00, + 0x01, 0x42, 0x40, 0x00, 0xc1, 0x47, 0x40, 0x00, 0x49, 0x40, 0x55, 0x00, + 0x95, 0x80, 0x2a, 0x00, 0x93, 0x00, 0x15, 0x00, 0x21, 0x01, 0x0a, 0x00, + 0x20, 0x01, 0x11, 0x00, 0x40, 0x82, 0x20, 0x00, 0x40, 0x42, 0x44, 0x00, + 0x80, 0x41, 0x4a, 0x00, 0x00, 0x40, 0x55, 0x00, 0x00, 0xe0, 0xff, 0x00, + 0x00, 0x20, 0x80, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +static const uchar busym_bits[] = { + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, + 0x7f, 0xe0, 0xff, 0x00, 0xff, 0xe0, 0xff, 0x00, 0xff, 0xe1, 0xff, 0x00, + 0xff, 0xc3, 0x7f, 0x00, 0xff, 0xc7, 0x7f, 0x00, 0x7f, 0xc0, 0x7f, 0x00, + 0xf7, 0x80, 0x3f, 0x00, 0xf3, 0x00, 0x1f, 0x00, 0xe1, 0x01, 0x0e, 0x00, + 0xe0, 0x01, 0x1f, 0x00, 0xc0, 0x83, 0x3f, 0x00, 0xc0, 0xc3, 0x7f, 0x00, + 0x80, 0xc1, 0x7f, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0xe0, 0xff, 0x00, + 0x00, 0xe0, 0xff, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +// 16 x 16 +static const uchar openhand_bits[] = { + 0x80,0x01,0x58,0x0e,0x64,0x12,0x64,0x52,0x48,0xb2,0x48,0x92, + 0x16,0x90,0x19,0x80,0x11,0x40,0x02,0x40,0x04,0x40,0x04,0x20, + 0x08,0x20,0x10,0x10,0x20,0x10,0x00,0x00}; +static const uchar openhandm_bits[] = { + 0x80,0x01,0xd8,0x0f,0xfc,0x1f,0xfc,0x5f,0xf8,0xff,0xf8,0xff, + 0xfe,0xff,0xff,0xff,0xff,0x7f,0xfe,0x7f,0xfc,0x7f,0xfc,0x3f, + 0xf8,0x3f,0xf0,0x1f,0xe0,0x1f,0x00,0x00}; +static const uchar closedhand_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0x48,0x32,0x08,0x50, + 0x10,0x40,0x18,0x40,0x04,0x40,0x04,0x20,0x08,0x20,0x10,0x10, + 0x20,0x10,0x20,0x10,0x00,0x00,0x00,0x00}; +static const uchar closedhandm_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0xf8,0x3f,0xf8,0x7f, + 0xf0,0x7f,0xf8,0x7f,0xfc,0x7f,0xfc,0x3f,0xf8,0x3f,0xf0,0x1f, + 0xe0,0x1f,0xe0,0x1f,0x00,0x00,0x00,0x00}; + +void QPlatformCursorImage::createSystemCursor(int id) +{ + if (!systemCursorTableInit) { + for (int i = 0; i <= Qt::LastCursor; i++) + systemCursorTable[i] = 0; + systemCursorTableInit = true; + } + switch (id) { + // 16x16 cursors + case Qt::ArrowCursor: + systemCursorTable[Qt::ArrowCursor] = + new QPlatformCursorImage(cur_arrow_bits, mcur_arrow_bits, 16, 16, 0, 0); + break; + + case Qt::UpArrowCursor: + systemCursorTable[Qt::UpArrowCursor] = + new QPlatformCursorImage(cur_up_arrow_bits, mcur_up_arrow_bits, 16, 16, 7, 0); + break; + + case Qt::CrossCursor: + systemCursorTable[Qt::CrossCursor] = + new QPlatformCursorImage(cur_cross_bits, mcur_cross_bits, 16, 16, 7, 7); + break; + + case Qt::IBeamCursor: + systemCursorTable[Qt::IBeamCursor] = + new QPlatformCursorImage(cur_ibeam_bits, mcur_ibeam_bits, 16, 16, 7, 7); + break; + + case Qt::SizeVerCursor: + systemCursorTable[Qt::SizeVerCursor] = + new QPlatformCursorImage(cur_ver_bits, mcur_ver_bits, 16, 16, 7, 7); + break; + + case Qt::SizeHorCursor: + systemCursorTable[Qt::SizeHorCursor] = + new QPlatformCursorImage(cur_hor_bits, mcur_hor_bits, 16, 16, 7, 7); + break; + + case Qt::SizeBDiagCursor: + systemCursorTable[Qt::SizeBDiagCursor] = + new QPlatformCursorImage(cur_bdiag_bits, mcur_bdiag_bits, 16, 16, 7, 7); + break; + + case Qt::SizeFDiagCursor: + systemCursorTable[Qt::SizeFDiagCursor] = + new QPlatformCursorImage(cur_fdiag_bits, mcur_fdiag_bits, 16, 16, 7, 7); + break; + + case Qt::BlankCursor: + systemCursorTable[Qt::BlankCursor] = + new QPlatformCursorImage(0, 0, 0, 0, 0, 0); + break; + + // 20x20 cursors + case Qt::ForbiddenCursor: + systemCursorTable[Qt::ForbiddenCursor] = + new QPlatformCursorImage(forbidden_bits, forbiddenm_bits, 20, 20, 10, 10); + break; + + // 32x32 cursors + case Qt::WaitCursor: + systemCursorTable[Qt::WaitCursor] = + new QPlatformCursorImage(wait_data_bits, wait_mask_bits, 32, 32, 15, 15); + break; + + case Qt::SplitVCursor: + systemCursorTable[Qt::SplitVCursor] = + new QPlatformCursorImage(vsplit_bits, vsplitm_bits, 32, 32, 15, 15); + break; + + case Qt::SplitHCursor: + systemCursorTable[Qt::SplitHCursor] = + new QPlatformCursorImage(hsplit_bits, hsplitm_bits, 32, 32, 15, 15); + break; + + case Qt::SizeAllCursor: + systemCursorTable[Qt::SizeAllCursor] = + new QPlatformCursorImage(size_all_data_bits, size_all_mask_bits, 32, 32, 15, 15); + break; + + case Qt::PointingHandCursor: + systemCursorTable[Qt::PointingHandCursor] = + new QPlatformCursorImage(phand_bits, phandm_bits, 32, 32, 0, 0); + break; + + case Qt::WhatsThisCursor: + systemCursorTable[Qt::WhatsThisCursor] = + new QPlatformCursorImage(whatsthis_bits, whatsthism_bits, 32, 32, 0, 0); + break; + case Qt::BusyCursor: + systemCursorTable[Qt::BusyCursor] = + new QPlatformCursorImage(busy_bits, busym_bits, 32, 32, 0, 0); + break; + + case Qt::OpenHandCursor: + systemCursorTable[Qt::OpenHandCursor] = + new QPlatformCursorImage(openhand_bits, openhandm_bits, 16, 16, 8, 8); + break; + case Qt::ClosedHandCursor: + systemCursorTable[Qt::ClosedHandCursor] = + new QPlatformCursorImage(closedhand_bits, closedhandm_bits, 16, 16, 8, 8); + break; + default: + qWarning("Unknown system cursor %d", id); + } +} + +/*! + \fn void QGraphicsSystemCursorImage::set(Qt::CursorShape id) + + \brief Calling this method sets the cursor image to the specified shape + + \a id is one of the defined Qt::CursorShape values. + + If id is invalid, Qt::BitmapCursor, or unknown by the implementation, + Qt::ArrowCursor is used instead. +*/ + +void QPlatformCursorImage::set(Qt::CursorShape id) +{ + QPlatformCursorImage *cursor = 0; + if (id >= 0 && id <= Qt::LastCursor) { + if (!systemCursorTable[id]) + createSystemCursor(id); + cursor = systemCursorTable[id]; + } + + if (cursor == 0) { + if (!systemCursorTable[Qt::ArrowCursor]) + createSystemCursor(Qt::ArrowCursor); + cursor = systemCursorTable[Qt::ArrowCursor]; + } + cursorImage = cursor->cursorImage; + hot = cursor->hot; +} + +/*! + \fn void QGraphicsSystemCursorImage::set(const QImage * image, int hx, int hy) + + \brief Set the cursor image to the specified QImage, with the hotsport at (hx, hy) + + \a image A pointer to a QImage + + \a hx The x coordinate of the cursor's hotspot + + \a hy the y coordinate of the cursor's hotspot +*/ + +void QPlatformCursorImage::set(const QImage * image, int hx, int hy) +{ + hot.setX(hx); + hot.setY(hy); + cursorImage = *image; +} + +/*! + \fn void QGraphicsSystemCursorImage::set(const uchar *data, const uchar *mask, int width, int height, int hx, int hy) + + \brief set the cursor image to the graphic represented by the combination of data, mask, + width, and height + + \a data The pixel data of the graphic + + \a mask Mask data for the graphic. pixels in data with a corresponding mask bit of 0 are not drawn + + \a width The width of the graphic in pixels + + \a height The height of the graphic in pixels + + \a hx The X hotspot of the cursor graphic + + \a hy The Y hotspot of the cursor graphic +*/ +void QPlatformCursorImage::set(const uchar *data, const uchar *mask, + int width, int height, int hx, int hy) +{ + hot.setX(hx); + hot.setY(hy); + + cursorImage = QImage(width,height, QImage::Format_Indexed8); + + if (!width || !height || !data || !mask || cursorImage.isNull()) + return; + + cursorImage.setNumColors(3); + cursorImage.setColor(0, 0xff000000); + cursorImage.setColor(1, 0xffffffff); + cursorImage.setColor(2, 0x00000000); + + int bytesPerLine = (width + 7) / 8; + int p = 0; + int d, m; + + int x = -1, w = 0; + + uchar *cursor_data = cursorImage.bits(); + int bpl = cursorImage.bytesPerLine(); + for (int i = 0; i < height; i++) + { + for (int j = 0; j < bytesPerLine; j++, data++, mask++) + { + for (int b = 0; b < 8 && j*8+b < width; b++) + { + d = *data & (1 << b); + m = *mask & (1 << b); + if (d && m) p = 0; + else if (!d && m) p = 1; + else p = 2; + cursor_data[j*8+b] = p; + + // calc region + if (x < 0 && m) + x = j*8+b; + else if (x >= 0 && !m) { + x = -1; + w = 0; + } + if (m) + w++; + } + } + if (x >= 0) { + x = -1; + w = 0; + } + cursor_data += bpl; + } + +} + +/*! + \fn QGraphicsSystemCursorImage::QGraphicsSystemCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) + + \brief set the cursor image to the graphic represented by the combination of data, mask, + width, and height + + \a data The pixel data of the graphic + + \a mask Mask data for the graphic. pixels in data with a corresponding mask bit of 0 are not drawn + + \a width The width of the graphic in pixels + + \a height The height of the graphic in pixels + + \a hotX The X hotspot of the cursor graphic + + \a hotY The Y hotspot of the cursor graphic + + \sa set +*/ + +/*! + \fn QImage *QGraphicsSystemCursorImage::image() + + \brief Return the cursor graphic as a pointer to a QImage +*/ + +/*! + \fn QPoint QGraphicsSystemCursorImage::hotspot() + + \brief Return the cursor's hotspot +*/ + +QT_END_NAMESPACE diff --git a/src/gui/painting/qplatformcursor_qpa.h b/src/gui/painting/qplatformcursor_qpa.h new file mode 100644 index 0000000..bb8bbb7 --- /dev/null +++ b/src/gui/painting/qplatformcursor_qpa.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QGRAPHICSSYSTEMCURSOR_H +#define QGRAPHICSSYSTEMCURSOR_H + +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +// Cursor graphics management +class Q_GUI_EXPORT QPlatformCursorImage { +public: + QPlatformCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) + { set(data, mask, width, height, hotX, hotY); } + QImage * image() { return &cursorImage; } + QPoint hotspot() { return hot; } + void set(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); + void set(const QImage * image, int hx, int hy); + void set(Qt::CursorShape); +private: + static void createSystemCursor(int id); + QImage cursorImage; + QPoint hot; +}; + +class QPlatformCursor; + +class QPlatformCursorPrivate { +public: + static QList > getInstances() { return instances; } + static QList > instances; +}; + +class Q_GUI_EXPORT QPlatformCursor : public QObject { +public: + QPlatformCursor(QPlatformScreen *); + + // input methods + virtual void pointerEvent(const QMouseEvent & event) { Q_UNUSED(event); } + virtual void changeCursor(QCursor * widgetCursor, QWidget * widget) = 0; + +protected: + QPlatformScreen* screen; // Where to request an update + +private: + Q_DECLARE_PRIVATE(QPlatformCursor); + friend void qt_lite_set_cursor(QWidget * w, bool force); + friend class QApplicationPrivate; +}; + +QT_END_NAMESPACE + +#endif // QGRAPHICSSYSTEMCURSOR_H diff --git a/src/plugins/platforms/directfb/qdirectfbcursor.cpp b/src/plugins/platforms/directfb/qdirectfbcursor.cpp index 2edae45..f2c9f35 100644 --- a/src/plugins/platforms/directfb/qdirectfbcursor.cpp +++ b/src/plugins/platforms/directfb/qdirectfbcursor.cpp @@ -3,10 +3,10 @@ QDirectFBCursor::QDirectFBCursor(QPlatformScreen* screen) : - QGraphicsSystemCursor(screen), surface(0) + QPlatformCursor(screen), surface(0) { QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),DLID_PRIMARY, &m_layer); - image = new QGraphicsSystemCursorImage(0, 0, 0, 0, 0, 0); + image = new QPlatformCursorImage(0, 0, 0, 0, 0, 0); } void QDirectFBCursor::changeCursor(QCursor * cursor, QWidget * widget) diff --git a/src/plugins/platforms/directfb/qdirectfbcursor.h b/src/plugins/platforms/directfb/qdirectfbcursor.h index 1566e7c..6aecb16 100644 --- a/src/plugins/platforms/directfb/qdirectfbcursor.h +++ b/src/plugins/platforms/directfb/qdirectfbcursor.h @@ -1,12 +1,12 @@ #ifndef QDIRECTFBCURSOR_H #define QDIRECTFBCURSOR_H -#include +#include #include class QDirectFbScreen; class QDirectFbBlitter; -class QDirectFBCursor : public QGraphicsSystemCursor +class QDirectFBCursor : public QPlatformCursor { public: QDirectFBCursor(QPlatformScreen *screem); @@ -15,7 +15,7 @@ public: private: IDirectFBDisplayLayer * m_layer; IDirectFBSurface * surface; - QGraphicsSystemCursorImage * image; + QPlatformCursorImage * image; QDirectFbBlitter *blitter; }; diff --git a/src/plugins/platforms/fb_base/fb_base.cpp b/src/plugins/platforms/fb_base/fb_base.cpp index 213a710..ef7ab02 100644 --- a/src/plugins/platforms/fb_base/fb_base.cpp +++ b/src/plugins/platforms/fb_base/fb_base.cpp @@ -3,17 +3,17 @@ #include #include #include -#include +#include #include -QGraphicsSystemSoftwareCursor::QGraphicsSystemSoftwareCursor(QPlatformScreen *scr) - : QGraphicsSystemCursor(scr), currentRect(QRect()), prevRect(QRect()) +QPlatformSoftwareCursor::QPlatformSoftwareCursor(QPlatformScreen *scr) + : QPlatformCursor(scr), currentRect(QRect()), prevRect(QRect()) { - graphic = new QGraphicsSystemCursorImage(0, 0, 0, 0, 0, 0); + graphic = new QPlatformCursorImage(0, 0, 0, 0, 0, 0); setCursor(Qt::ArrowCursor); } -QRect QGraphicsSystemSoftwareCursor::getCurrentRect() +QRect QPlatformSoftwareCursor::getCurrentRect() { QRect rect = graphic->image()->rect().translated(-graphic->hotspot().x(), -graphic->hotspot().y()); @@ -24,7 +24,7 @@ QRect QGraphicsSystemSoftwareCursor::getCurrentRect() } -void QGraphicsSystemSoftwareCursor::pointerEvent(const QMouseEvent & e) +void QPlatformSoftwareCursor::pointerEvent(const QMouseEvent & e) { Q_UNUSED(e); QPoint screenOffset = screen->geometry().topLeft(); @@ -35,7 +35,7 @@ void QGraphicsSystemSoftwareCursor::pointerEvent(const QMouseEvent & e) } } -QRect QGraphicsSystemSoftwareCursor::drawCursor(QPainter & painter) +QRect QPlatformSoftwareCursor::drawCursor(QPainter & painter) { dirty = false; if (currentRect.isNull()) @@ -53,7 +53,7 @@ QRect QGraphicsSystemSoftwareCursor::drawCursor(QPainter & painter) return prevRect; } -QRect QGraphicsSystemSoftwareCursor::dirtyRect() +QRect QPlatformSoftwareCursor::dirtyRect() { if (onScreen) { onScreen = false; @@ -62,22 +62,22 @@ QRect QGraphicsSystemSoftwareCursor::dirtyRect() return QRect(); } -void QGraphicsSystemSoftwareCursor::setCursor(Qt::CursorShape shape) +void QPlatformSoftwareCursor::setCursor(Qt::CursorShape shape) { graphic->set(shape); } -void QGraphicsSystemSoftwareCursor::setCursor(const QImage * image, int hotx, int hoty) +void QPlatformSoftwareCursor::setCursor(const QImage * image, int hotx, int hoty) { graphic->set(image, hotx, hoty); } -void QGraphicsSystemSoftwareCursor::setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) +void QPlatformSoftwareCursor::setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) { graphic->set(data, mask, width, height, hotX, hotY); } -void QGraphicsSystemSoftwareCursor::changeCursor(QCursor * widgetCursor, QWidget * widget) +void QPlatformSoftwareCursor::changeCursor(QCursor * widgetCursor, QWidget * widget) { Q_UNUSED(widget); Qt::CursorShape shape = widgetCursor->shape(); diff --git a/src/plugins/platforms/fb_base/fb_base.h b/src/plugins/platforms/fb_base/fb_base.h index 3b5075d..10f292e 100644 --- a/src/plugins/platforms/fb_base/fb_base.h +++ b/src/plugins/platforms/fb_base/fb_base.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include #include @@ -16,10 +16,10 @@ class QPainter; class QFbScreen; -class QGraphicsSystemSoftwareCursor : public QGraphicsSystemCursor +class QPlatformSoftwareCursor : public QPlatformCursor { public: - QGraphicsSystemSoftwareCursor(QPlatformScreen * scr); + QPlatformSoftwareCursor(QPlatformScreen * scr); // output methods QRect dirtyRect(); @@ -35,7 +35,7 @@ public: virtual QRect lastPainted() { return prevRect; } protected: - QGraphicsSystemCursorImage * graphic; + QPlatformCursorImage * graphic; private: void setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); @@ -142,7 +142,7 @@ public: protected: QList windowStack; QRegion repaintRegion; - QGraphicsSystemSoftwareCursor * cursor; + QPlatformSoftwareCursor * cursor; QTimer redrawTimer; protected slots: diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp index f79f956..437af81 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp @@ -811,7 +811,7 @@ QLinuxFbScreen::QLinuxFbScreen(uchar * d, int w, mFormat); mFbScreenImage = new QImage(data, mGeometry.width(), mGeometry.height(), bytesPerLine, mFormat); - cursor = new QGraphicsSystemSoftwareCursor(this); + cursor = new QPlatformSoftwareCursor(this); } void QLinuxFbScreen::setGeometry(QRect rect) diff --git a/src/plugins/platforms/testlite/qtestliteintegration.cpp b/src/plugins/platforms/testlite/qtestliteintegration.cpp index 46f2384..3f500c0 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.cpp +++ b/src/plugins/platforms/testlite/qtestliteintegration.cpp @@ -46,7 +46,7 @@ #include #include -#include +#include #include "qtestlitewindow.h" @@ -59,10 +59,10 @@ QT_BEGIN_NAMESPACE -class MyCursor : QGraphicsSystemCursor +class MyCursor : QPlatformCursor { public: - MyCursor(QPlatformScreen *screen) : QGraphicsSystemCursor(screen) {} + MyCursor(QPlatformScreen *screen) : QPlatformCursor(screen) {} void changeCursor(QCursor * cursor, QWidget * widget) { QTestLiteWindow *w = 0; diff --git a/src/plugins/platforms/vnc/qvnccursor.cpp b/src/plugins/platforms/vnc/qvnccursor.cpp index 72dcb25..e83696d 100644 --- a/src/plugins/platforms/vnc/qvnccursor.cpp +++ b/src/plugins/platforms/vnc/qvnccursor.cpp @@ -54,13 +54,13 @@ QT_BEGIN_NAMESPACE QVNCCursor::QVNCCursor(QVNCServer * srvr, QVNCScreen *scr ) - :QGraphicsSystemSoftwareCursor(scr), useVncCursor(false), server(srvr) + :QPlatformSoftwareCursor(scr), useVncCursor(false), server(srvr) { } void QVNCCursor::changeCursor(QCursor * widgetCursor, QWidget * widget) { - QGraphicsSystemSoftwareCursor::changeCursor(widgetCursor, widget); + QPlatformSoftwareCursor::changeCursor(widgetCursor, widget); if (useVncCursor) { server->setDirtyCursor(); } else { @@ -84,7 +84,7 @@ QRect QVNCCursor::drawCursor(QPainter & painter) if (useVncCursor) return QRect(); - return QGraphicsSystemSoftwareCursor::drawCursor(painter); + return QPlatformSoftwareCursor::drawCursor(painter); } void QVNCCursor::clearClientCursor() diff --git a/src/plugins/platforms/vnc/qvnccursor.h b/src/plugins/platforms/vnc/qvnccursor.h index 2c6ff5b..eeb3686 100644 --- a/src/plugins/platforms/vnc/qvnccursor.h +++ b/src/plugins/platforms/vnc/qvnccursor.h @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE class QVNCScreen; class QVNCServer; -class QVNCCursor : public QGraphicsSystemSoftwareCursor { +class QVNCCursor : public QPlatformSoftwareCursor { public: QVNCCursor(QVNCServer *, QVNCScreen *); -- cgit v0.12 From 13cc79de7b96cfe367869a748d07d502997d0342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 24 Jun 2010 14:41:17 +0200 Subject: Refactored classes and functions using lite --- src/gui/kernel/kernel.pri | 6 +++--- src/gui/kernel/qapplication.cpp | 9 ++++----- src/gui/kernel/qapplication_p.h | 4 ++-- src/gui/kernel/qapplication_qpa.cpp | 12 ++++++------ src/gui/kernel/qdesktopwidget_qpa_p.h | 6 +++--- src/gui/kernel/qeventdispatcher_glib_qpa.cpp | 16 ++++++++-------- src/gui/kernel/qeventdispatcher_glib_qpa_p.h | 22 +++++++++++----------- src/gui/kernel/qeventdispatcher_qpa.cpp | 26 +++++++++++++------------- src/gui/kernel/qeventdispatcher_qpa_p.h | 16 ++++++++-------- src/gui/kernel/qgenericplugin_qpa.cpp | 6 +++--- src/gui/kernel/qgenericplugin_qpa.h | 6 +++--- src/gui/kernel/qgenericpluginfactory_qpa.cpp | 6 +++--- src/gui/kernel/qgenericpluginfactory_qpa.h | 6 +++--- src/gui/kernel/qwidget_qpa.cpp | 6 +++--- src/gui/kernel/qwindowsysteminterface.cpp | 2 +- src/gui/painting/qplatformcursor_qpa.h | 2 +- 16 files changed, 75 insertions(+), 76 deletions(-) diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 965cbe3..f773906 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -48,8 +48,7 @@ HEADERS += \ kernel/qgesturemanager_p.h \ kernel/qsoftkeymanager_p.h \ kernel/qsoftkeymanager_common_p.h \ - kernel/qguiplatformplugin_p.h \ - kernel/qdesktopwidget_qpa_p.h + kernel/qguiplatformplugin_p.h SOURCES += \ kernel/qaction.cpp \ @@ -215,7 +214,8 @@ qpa { kernel/qplatformintegrationfactory_qpa_p.h \ kernel/qplatformintegrationplugin_qpa.h \ kernel/qplatformwindow_qpa.h \ - kernel/qplatformglcontext_qpa.h + kernel/qplatformglcontext_qpa.h \ + kernel/qdesktopwidget_qpa_p.h SOURCES += \ kernel/qapplication_qpa.cpp \ diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index b3e6fcd..e1ed588 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -927,8 +927,7 @@ void QApplicationPrivate::initialize() // initialize the graphics system - on X11 this is initialized inside // qt_init() in qapplication_x11.cpp because of several reasons. // On QWS, the graphics system is set by the QScreen plugin. - // For lighthouse it will be initialized to QLiteGraphicsSystem - // when the platformIntegration plugin is instansiated in qt_init( + // We don't use graphics systems in Qt QPA graphics_system = QGraphicsSystemFactory::create(graphics_system_name); #endif @@ -2763,9 +2762,9 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) { qt_x11_enforce_cursor(parentOfLeavingCursor,true); #elif defined(Q_WS_QPA) if (enter == QApplication::desktop()) { - qt_lite_set_cursor(enter, true); + qt_qpa_set_cursor(enter, true); } else { - qt_lite_set_cursor(parentOfLeavingCursor, true); + qt_qpa_set_cursor(parentOfLeavingCursor, true); } #endif } @@ -2792,7 +2791,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) { #elif defined(Q_WS_S60) qt_symbian_set_cursor(cursorWidget, true); #elif defined(Q_WS_QPA) - qt_lite_set_cursor(cursorWidget, true); + qt_qpa_set_cursor(cursorWidget, true); #endif } } diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 7d98f4d..68ec648 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -328,7 +328,7 @@ public: static QPlatformIntegration *platformIntegration() { return platform_integration; } - static QAbstractEventDispatcher *qt_lite_core_dispatcher() + static QAbstractEventDispatcher *qt_qpa_core_dispatcher() { return QCoreApplication::instance()->d_func()->threadData->eventDispatcher; } #endif @@ -661,7 +661,7 @@ Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window, #elif defined(Q_OS_SYMBIAN) extern void qt_symbian_set_cursor(QWidget *, bool); #elif defined (Q_WS_QPA) - extern void qt_lite_set_cursor(QWidget *, bool); + extern void qt_qpa_set_cursor(QWidget *, bool); #endif QT_END_NAMESPACE diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp index 1fc202c..2adcfc1 100644 --- a/src/gui/kernel/qapplication_qpa.cpp +++ b/src/gui/kernel/qapplication_qpa.cpp @@ -123,10 +123,10 @@ void QApplicationPrivate::createEventDispatcher() Q_Q(QApplication); #if !defined(QT_NO_GLIB) if (qgetenv("QT_NO_GLIB").isEmpty() && QEventDispatcherGlib::versionSupported()) - eventDispatcher = new QLiteEventDispatcherGlib(q); + eventDispatcher = new QPAEventDispatcherGlib(q); else #endif - eventDispatcher = new QEventDispatcherLite(q); + eventDispatcher = new QEventDispatcherQPA(q); } static bool qt_try_modal(QWidget *widget, QEvent::Type type) @@ -378,7 +378,7 @@ bool QApplication::isEffectEnabled(Qt::UIEffect effect) void QApplication::setOverrideCursor(const QCursor &cursor) { qApp->d_func()->cursor_list.prepend(cursor); - qt_lite_set_cursor(0, false); + qt_qpa_set_cursor(0, false); } void QApplication::restoreOverrideCursor() @@ -386,7 +386,7 @@ void QApplication::restoreOverrideCursor() if (qApp->d_func()->cursor_list.isEmpty()) return; qApp->d_func()->cursor_list.removeFirst(); - qt_lite_set_cursor(0, false); + qt_qpa_set_cursor(0, false); } #endif// QT_NO_CURSOR @@ -490,7 +490,7 @@ void qt_init(QApplicationPrivate *priv, int type) } QList pluginList; - QString platformName = qgetenv("QT_LITE_PLATFORM"); + QString platformName = qgetenv("QT_QPA_PLATFORM"); // Get command line params @@ -521,7 +521,7 @@ void qt_init(QApplicationPrivate *priv, int type) } #if 0 - QByteArray pluginEnv = qgetenv("QT_LITE_PLUGINS"); + QByteArray pluginEnv = qgetenv("QT_QPA_PLUGINS"); if (!pluginEnv.isEmpty()) { pluginList.append(pluginEnv.split(';')); } diff --git a/src/gui/kernel/qdesktopwidget_qpa_p.h b/src/gui/kernel/qdesktopwidget_qpa_p.h index 33e4c98..8bed09d 100644 --- a/src/gui/kernel/qdesktopwidget_qpa_p.h +++ b/src/gui/kernel/qdesktopwidget_qpa_p.h @@ -50,8 +50,8 @@ // We mean it. // -#ifndef QDESKTOPWIDGET_LITE_P_H -#define QDESKTOPWIDGET_LITE_P_H +#ifndef QDESKTOPWIDGET_QPA_P_H +#define QDESKTOPWIDGET_QPA_P_H #include "QDesktopWidget" #include "private/qwidget_p.h" @@ -73,4 +73,4 @@ public: QDesktopScreenWidget virtualScreen; }; -#endif // QDESKTOPWIDGET_LITE_P_H +#endif // QDESKTOPWIDGET_QPA_P_H diff --git a/src/gui/kernel/qeventdispatcher_glib_qpa.cpp b/src/gui/kernel/qeventdispatcher_glib_qpa.cpp index f45902c..9585b26 100644 --- a/src/gui/kernel/qeventdispatcher_glib_qpa.cpp +++ b/src/gui/kernel/qeventdispatcher_glib_qpa.cpp @@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE struct GUserEventSource { GSource source; - QLiteEventDispatcherGlib *q; + QPAEventDispatcherGlib *q; }; static gboolean userEventSourcePrepare(GSource *s, gint *timeout) @@ -104,7 +104,7 @@ static GSourceFuncs userEventSourceFuncs = { NULL }; -QLiteEventDispatcherGlibPrivate::QLiteEventDispatcherGlibPrivate(GMainContext *context) +QPAEventDispatcherGlibPrivate::QPAEventDispatcherGlibPrivate(GMainContext *context) : QEventDispatcherGlibPrivate(context) { userEventSource = reinterpret_cast(g_source_new(&userEventSourceFuncs, @@ -115,23 +115,23 @@ QLiteEventDispatcherGlibPrivate::QLiteEventDispatcherGlibPrivate(GMainContext *c } -QLiteEventDispatcherGlib::QLiteEventDispatcherGlib(QObject *parent) - : QEventDispatcherGlib(*new QLiteEventDispatcherGlibPrivate, parent) +QPAEventDispatcherGlib::QPAEventDispatcherGlib(QObject *parent) + : QEventDispatcherGlib(*new QPAEventDispatcherGlibPrivate, parent) { - Q_D(QLiteEventDispatcherGlib); + Q_D(QPAEventDispatcherGlib); d->userEventSource->q = this; } -QLiteEventDispatcherGlib::~QLiteEventDispatcherGlib() +QPAEventDispatcherGlib::~QPAEventDispatcherGlib() { - Q_D(QLiteEventDispatcherGlib); + Q_D(QPAEventDispatcherGlib); g_source_destroy(&d->userEventSource->source); g_source_unref(&d->userEventSource->source); d->userEventSource = 0; } -bool QLiteEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags) +bool QPAEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags) { return QEventDispatcherGlib::processEvents(flags); } diff --git a/src/gui/kernel/qeventdispatcher_glib_qpa_p.h b/src/gui/kernel/qeventdispatcher_glib_qpa_p.h index 6ebdb25..1c32ab2 100644 --- a/src/gui/kernel/qeventdispatcher_glib_qpa_p.h +++ b/src/gui/kernel/qeventdispatcher_glib_qpa_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QLITEEVENTDISPATCHER_GLIB_P_H -#define QLITEEVENTDISPATCHER_GLIB_P_H +#ifndef QEVENTDISPATCHER_GLIB_QPA_P_H +#define QEVENTDISPATCHER_GLIB_QPA_P_H // // W A R N I N G @@ -58,31 +58,31 @@ typedef struct _GMainContext GMainContext; QT_BEGIN_NAMESPACE -class QLiteEventDispatcherGlibPrivate; +class QPAEventDispatcherGlibPrivate; -class QLiteEventDispatcherGlib : public QEventDispatcherGlib +class QPAEventDispatcherGlib : public QEventDispatcherGlib { Q_OBJECT - Q_DECLARE_PRIVATE(QLiteEventDispatcherGlib) + Q_DECLARE_PRIVATE(QPAEventDispatcherGlib) public: - explicit QLiteEventDispatcherGlib(QObject *parent = 0); - ~QLiteEventDispatcherGlib(); + explicit QPAEventDispatcherGlib(QObject *parent = 0); + ~QPAEventDispatcherGlib(); bool processEvents(QEventLoop::ProcessEventsFlags flags); }; struct GUserEventSource; -class QLiteEventDispatcherGlibPrivate : public QEventDispatcherGlibPrivate +class QPAEventDispatcherGlibPrivate : public QEventDispatcherGlibPrivate { - Q_DECLARE_PUBLIC(QLiteEventDispatcherGlib) + Q_DECLARE_PUBLIC(QPAEventDispatcherGlib) public: - QLiteEventDispatcherGlibPrivate(GMainContext *context = 0); + QPAEventDispatcherGlibPrivate(GMainContext *context = 0); GUserEventSource *userEventSource; }; QT_END_NAMESPACE -#endif // QLITEEVENTDISPATCHER_GLIB_P_H +#endif // QEVENTDISPATCHER_GLIB_QPA_P_H diff --git a/src/gui/kernel/qeventdispatcher_qpa.cpp b/src/gui/kernel/qeventdispatcher_qpa.cpp index c6b5636..5740548 100644 --- a/src/gui/kernel/qeventdispatcher_qpa.cpp +++ b/src/gui/kernel/qeventdispatcher_qpa.cpp @@ -54,29 +54,29 @@ QT_BEGIN_NAMESPACE QT_USE_NAMESPACE -class QEventDispatcherLitePrivate : public QEventDispatcherUNIXPrivate +class QEventDispatcherQPAPrivate : public QEventDispatcherUNIXPrivate { - Q_DECLARE_PUBLIC(QEventDispatcherLite) + Q_DECLARE_PUBLIC(QEventDispatcherQPA) public: - inline QEventDispatcherLitePrivate() + inline QEventDispatcherQPAPrivate() { } }; -QEventDispatcherLite::QEventDispatcherLite(QObject *parent) - : QEventDispatcherUNIX(*new QEventDispatcherLitePrivate, parent) +QEventDispatcherQPA::QEventDispatcherQPA(QObject *parent) + : QEventDispatcherUNIX(*new QEventDispatcherQPAPrivate, parent) { } -QEventDispatcherLite::~QEventDispatcherLite() +QEventDispatcherQPA::~QEventDispatcherQPA() { } //#define ZERO_FOR_THE_MOMENT -bool QEventDispatcherLite::processEvents(QEventLoop::ProcessEventsFlags flags) +bool QEventDispatcherQPA::processEvents(QEventLoop::ProcessEventsFlags flags) { - Q_D(QEventDispatcherLite); + Q_D(QEventDispatcherQPA); int nevents = 0; // handle gui and posted events @@ -112,30 +112,30 @@ bool QEventDispatcherLite::processEvents(QEventLoop::ProcessEventsFlags flags) return (nevents > 0); } -bool QEventDispatcherLite::hasPendingEvents() +bool QEventDispatcherQPA::hasPendingEvents() { extern uint qGlobalPostedEventsCount(); // from qapplication.cpp return qGlobalPostedEventsCount() || QWindowSystemInterfacePrivate::userEventsQueued();; } -void QEventDispatcherLite::startingUp() +void QEventDispatcherQPA::startingUp() { } -void QEventDispatcherLite::closingDown() +void QEventDispatcherQPA::closingDown() { } -void QEventDispatcherLite::flush() +void QEventDispatcherQPA::flush() { if(qApp) qApp->sendPostedEvents(); } -int QEventDispatcherLite::select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, +int QEventDispatcherQPA::select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, timeval *timeout) { return QEventDispatcherUNIX::select(nfds, readfds, writefds, exceptfds, timeout); diff --git a/src/gui/kernel/qeventdispatcher_qpa_p.h b/src/gui/kernel/qeventdispatcher_qpa_p.h index c098e6c..878daaa 100644 --- a/src/gui/kernel/qeventdispatcher_qpa_p.h +++ b/src/gui/kernel/qeventdispatcher_qpa_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QEVENTDISPATCHER_LITE_P_H -#define QEVENTDISPATCHER_LITE_P_H +#ifndef QEVENTDISPATCHER_QPA_P_H +#define QEVENTDISPATCHER_QPA_P_H // // W A R N I N G @@ -57,16 +57,16 @@ QT_BEGIN_NAMESPACE -class QEventDispatcherLitePrivate; +class QEventDispatcherQPAPrivate; -class QEventDispatcherLite : public QEventDispatcherUNIX +class QEventDispatcherQPA : public QEventDispatcherUNIX { Q_OBJECT - Q_DECLARE_PRIVATE(QEventDispatcherLite) + Q_DECLARE_PRIVATE(QEventDispatcherQPA) public: - explicit QEventDispatcherLite(QObject *parent = 0); - ~QEventDispatcherLite(); + explicit QEventDispatcherQPA(QObject *parent = 0); + ~QEventDispatcherQPA(); bool processEvents(QEventLoop::ProcessEventsFlags flags); bool hasPendingEvents(); @@ -83,4 +83,4 @@ protected: QT_END_NAMESPACE -#endif // QEVENTDISPATCHER_LITE_P_H +#endif // QEVENTDISPATCHER_QPA_P_H diff --git a/src/gui/kernel/qgenericplugin_qpa.cpp b/src/gui/kernel/qgenericplugin_qpa.cpp index 6290b40..43d6525 100644 --- a/src/gui/kernel/qgenericplugin_qpa.cpp +++ b/src/gui/kernel/qgenericplugin_qpa.cpp @@ -48,12 +48,12 @@ QT_BEGIN_NAMESPACE /*! \class QGenericPlugin \ingroup plugins - \ingroup lite + \ingroup qpa \brief The QGenericPlugin class is an abstract base class for - window-system related plugins in Qt for Embedded Linux LITE. + window-system related plugins in Qt QPA. - Note that this class is only available in \l{Qt for Embedded Linux LITE}. + Note that this class is only available in \l{Qt QPA}. A mouse plugin can be created by subclassing QGenericPlugin and reimplementing the pure virtual keys() and diff --git a/src/gui/kernel/qgenericplugin_qpa.h b/src/gui/kernel/qgenericplugin_qpa.h index a468a9f..e1792cd 100644 --- a/src/gui/kernel/qgenericplugin_qpa.h +++ b/src/gui/kernel/qgenericplugin_qpa.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QGENERICPLUGIN_LITE_H -#define QGENERICPLUGIN_LITE_H +#ifndef QGENERICPLUGIN_QPA_H +#define QGENERICPLUGIN_QPA_H #include #include @@ -81,4 +81,4 @@ QT_END_NAMESPACE QT_END_HEADER -#endif // QMOUSEDRIVERPLUGIN_QWS_H +#endif // QGENERICPLUGIN_QPA_H diff --git a/src/gui/kernel/qgenericpluginfactory_qpa.cpp b/src/gui/kernel/qgenericpluginfactory_qpa.cpp index dcc7cc7..abc575a 100644 --- a/src/gui/kernel/qgenericpluginfactory_qpa.cpp +++ b/src/gui/kernel/qgenericpluginfactory_qpa.cpp @@ -60,12 +60,12 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, /*! \class QGenericPluginFactory - \ingroup qws + \ingroup qpa \brief The QGenericPluginFactory class creates window-system - related plugin drivers in Qt for Embedded Linux LITE. + related plugin drivers in Qt QPA. - Note that this class is only available in \l{Qt for Embedded Linux LITE}. + Note that this class is only available in \l{Qt QPA}. \sa QGenericPlugin diff --git a/src/gui/kernel/qgenericpluginfactory_qpa.h b/src/gui/kernel/qgenericpluginfactory_qpa.h index 86886f1..59eac38 100644 --- a/src/gui/kernel/qgenericpluginfactory_qpa.h +++ b/src/gui/kernel/qgenericpluginfactory_qpa.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QGENERICPLUGINFACTORY_LITE_H -#define QGENERICPLUGINFACTORY_LITE_H +#ifndef QGENERICPLUGINFACTORY_QPA_H +#define QGENERICPLUGINFACTORY_QPA_H #include @@ -64,4 +64,4 @@ QT_END_NAMESPACE QT_END_HEADER -#endif // QGENERICPLUGINFACTORY_QWS_H +#endif // QGENERICPLUGINFACTORY_QPA_H diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp index a543c8f..8bb3f38 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -246,14 +246,14 @@ void QWidgetPrivate::setCursor_sys(const QCursor &cursor) Q_UNUSED(cursor); Q_Q(QWidget); if (q->isVisible()) - qt_lite_set_cursor(q, false); + qt_qpa_set_cursor(q, false); } void QWidgetPrivate::unsetCursor_sys() { Q_Q(QWidget); if (q->isVisible()) - qt_lite_set_cursor(q, false); + qt_qpa_set_cursor(q, false); } void QWidgetPrivate::updateCursor() const @@ -753,7 +753,7 @@ void QWidgetPrivate::setModal_sys() } #ifndef QT_NO_CURSOR -void qt_lite_set_cursor(QWidget * w, bool force) +void qt_qpa_set_cursor(QWidget * w, bool force) { static QCursor arrowCursor(Qt::ArrowCursor); static QPointer lastUnderMouse = 0; diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index c9d177d..4cf9ded 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -129,7 +129,7 @@ void QWindowSystemInterfacePrivate::queueUserEvent(QWindowSystemInterface::UserE userEventQueue.append(ev); queueMutex.unlock(); - QAbstractEventDispatcher *dispatcher = QApplicationPrivate::qt_lite_core_dispatcher(); + QAbstractEventDispatcher *dispatcher = QApplicationPrivate::qt_qpa_core_dispatcher(); if (dispatcher) dispatcher->wakeUp(); } diff --git a/src/gui/painting/qplatformcursor_qpa.h b/src/gui/painting/qplatformcursor_qpa.h index bb8bbb7..5f1654d 100644 --- a/src/gui/painting/qplatformcursor_qpa.h +++ b/src/gui/painting/qplatformcursor_qpa.h @@ -88,7 +88,7 @@ protected: private: Q_DECLARE_PRIVATE(QPlatformCursor); - friend void qt_lite_set_cursor(QWidget * w, bool force); + friend void qt_qpa_set_cursor(QWidget * w, bool force); friend class QApplicationPrivate; }; -- cgit v0.12 From bd337d251a3ff54c6845f1c4469ec7c99068971e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 24 Jun 2010 15:03:26 +0200 Subject: Removed QGraphicsSystem include from QPlatformIntegration --- src/gui/kernel/qplatformintegration_qpa.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index f80b0ae..ea0ed35 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -42,19 +42,24 @@ #ifndef QPLATFORMINTEGRATION_H #define QPLATFORMINTEGRATION_H -#include +#include +#include #include QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Gui) +//QT_MODULE(Gui) +class QPlatformWindow; +class QWindowSurface; +class QBlittable; +class QWidget; class Q_GUI_EXPORT QPlatformIntegration { public: - virtual ~QPlatformIntegration() { }; + virtual ~QPlatformIntegration() { } // GraphicsSystem functions virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0; @@ -69,6 +74,7 @@ public: virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const; virtual bool hasOpenGL() const; + }; QT_END_NAMESPACE -- cgit v0.12 From d879c51dea3521d36a2f47e2406a99386f442254 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 24 Jun 2010 15:50:16 +0200 Subject: Compile fix for testlite plugin --- src/plugins/platforms/testlite/qtestliteintegration.h | 3 +++ src/plugins/platforms/testlite/qtestlitewindow.cpp | 1 + 2 files changed, 4 insertions(+) diff --git a/src/plugins/platforms/testlite/qtestliteintegration.h b/src/plugins/platforms/testlite/qtestliteintegration.h index 01d428c..ac10841 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.h +++ b/src/plugins/platforms/testlite/qtestliteintegration.h @@ -45,6 +45,9 @@ #include #include +//make sure textstream is included before any X11 headers +#include + QT_BEGIN_NAMESPACE class MyDisplay; diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index 82e64e6..0f6c921 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -41,6 +41,7 @@ #include "qtestliteintegration.h" #include +#include #include "qtestlitewindow.h" -- cgit v0.12 From 38e29c10cfdee145cb5e56f789f2b156a7ae3b35 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 29 Jun 2010 10:21:35 +0200 Subject: Compile after _qpa renaming --- src/plugins/generic/linuxinput/main.cpp | 2 +- src/plugins/generic/tslib/main.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/generic/linuxinput/main.cpp b/src/plugins/generic/linuxinput/main.cpp index 25e80eb..dc05254 100644 --- a/src/plugins/generic/linuxinput/main.cpp +++ b/src/plugins/generic/linuxinput/main.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include +#include #include "qlinuxinput.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/generic/tslib/main.cpp b/src/plugins/generic/tslib/main.cpp index 4e8e50a..502c6a0 100644 --- a/src/plugins/generic/tslib/main.cpp +++ b/src/plugins/generic/tslib/main.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include +#include #include "qtslib.h" QT_BEGIN_NAMESPACE -- cgit v0.12 From 9cc54422943c0fc662b7b0c9a0d10565f7f6e73b Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 30 Jun 2010 11:09:25 +0200 Subject: check for a null new parent before trying to access its platformWindow This fixes a crash seen in the arora browser when exiting --- src/gui/kernel/qwidget_qpa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp index 8bb3f38..1acf398 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -161,7 +161,7 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) if (parent != newparent) { QObjectPrivate::setParent_helper(newparent); //### why does this have to be done in the _sys function??? - if (q->platformWindow()) { + if (q->platformWindow() && newparent) { QWidget * parentWithWindow = newparent->platformWindow()? newparent : newparent->nativeParentWidget(); if (parentWithWindow && parentWithWindow->platformWindow()) { q->platformWindow()->setParent(parentWithWindow->platformWindow()); -- cgit v0.12 From d7168ae0ff930f19f206a1b56c03fc35b22bb948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 7 Jul 2010 15:09:35 +0200 Subject: Never compile lighthouse with EGL support it should reside in the plugin, not in the opengl module nor in gui --- configure | 5 +++++ src/gui/kernel/qplatformglcontext_qpa.h | 5 +---- src/opengl/opengl.pro | 2 -- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/configure b/configure index 23aa101..a57f6ce 100755 --- a/configure +++ b/configure @@ -6636,6 +6636,11 @@ else QT_CONFIG="$QT_CONFIG accessibility" fi +# egl stuff does not belong in lighthouse, but rather in plugins +if [ "$PLATFORM_QPA" = "yes" ]; then + CFG_EGL="no" +fi + # enable egl if [ "$CFG_EGL" = "no" ]; then QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EGL" diff --git a/src/gui/kernel/qplatformglcontext_qpa.h b/src/gui/kernel/qplatformglcontext_qpa.h index 8aeb635..dcfd54c 100644 --- a/src/gui/kernel/qplatformglcontext_qpa.h +++ b/src/gui/kernel/qplatformglcontext_qpa.h @@ -51,10 +51,7 @@ QT_BEGIN_NAMESPACE class Q_OPENGL_EXPORT QPlatformGLContext { public: - //QPlatformGLContext(); - //virtual ~QPlatformGLContext(); - - //virtual bool create(QPaintDevice* device, QPlatformGLContext* shareContext) = 0; + virtual ~QPlatformGLContext() { } virtual void makeCurrent() = 0; virtual void doneCurrent() = 0; diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index 09a6b0f..772c27f 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -78,8 +78,6 @@ SOURCES += qgl.cpp \ } qpa { - DEFINES += QT_NO_EGL - SOURCES += qgl_qpa.cpp \ qglpixelbuffer_stub.cpp } -- cgit v0.12 From 8ede118779b0b4cde591f3bf5ec94f7a6f25e2a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 7 Jul 2010 15:11:01 +0200 Subject: Make openkode work with new interfaces and moved egl stuff into plugin --- .../platforms/openkode/qopenkodeglintegration.cpp | 189 ++++----------------- .../platforms/openkode/qopenkodeglintegration.h | 14 +- .../platforms/openkode/qopenkodeintegration.cpp | 41 ++++- .../platforms/openkode/qopenkodeintegration.h | 9 +- src/plugins/platforms/openkode/qopenkodewindow.cpp | 160 ++++++++++++++--- src/plugins/platforms/openkode/qopenkodewindow.h | 14 +- .../platforms/openkode/qopenkodewindowsurface.cpp | 39 ++--- .../platforms/openkode/qopenkodewindowsurface.h | 8 +- 8 files changed, 239 insertions(+), 235 deletions(-) diff --git a/src/plugins/platforms/openkode/qopenkodeglintegration.cpp b/src/plugins/platforms/openkode/qopenkodeglintegration.cpp index 7223538..4296876 100644 --- a/src/plugins/platforms/openkode/qopenkodeglintegration.cpp +++ b/src/plugins/platforms/openkode/qopenkodeglintegration.cpp @@ -40,198 +40,69 @@ ****************************************************************************/ #include "qopenkodeglintegration.h" + +#include + #include #include #include #include -#include -void qt_eglproperties_set_glformat(QEglProperties& eglProperties, const QGLFormat& glFormat) +QEGLPlatformContext::QEGLPlatformContext(EGLDisplay display, EGLConfig config, EGLint contextAttrs[], EGLSurface surface, EGLenum eglApi) + : m_eglDisplay(display) + , m_eglSurface(surface) + , m_eglApi(eglApi) { - int redSize = glFormat.redBufferSize(); - int greenSize = glFormat.greenBufferSize(); - int blueSize = glFormat.blueBufferSize(); - int alphaSize = glFormat.alphaBufferSize(); - int depthSize = glFormat.depthBufferSize(); - int stencilSize = glFormat.stencilBufferSize(); - int sampleCount = glFormat.samples(); - - // QGLFormat uses a magic value of -1 to indicate "don't care", even when a buffer of that - // type has been requested. So we must check QGLFormat's booleans too if size is -1: - if (glFormat.alpha() && alphaSize <= 0) - alphaSize = 1; - if (glFormat.depth() && depthSize <= 0) - depthSize = 1; - if (glFormat.stencil() && stencilSize <= 0) - stencilSize = 1; - if (glFormat.sampleBuffers() && sampleCount <= 0) - sampleCount = 1; - - // We want to make sure 16-bit configs are chosen over 32-bit configs as they will provide - // the best performance. The EGL config selection algorithm is a bit stange in this regard: - // The selection criteria for EGL_BUFFER_SIZE is "AtLeast", so we can't use it to discard - // 32-bit configs completely from the selection. So it then comes to the sorting algorithm. - // The red/green/blue sizes have a sort priority of 3, so they are sorted by first. The sort - // order is special and described as "by larger _total_ number of color bits.". So EGL will - // put 32-bit configs in the list before the 16-bit configs. However, the spec also goes on - // to say "If the requested number of bits in attrib_list for a particular component is 0, - // then the number of bits for that component is not considered". This part of the spec also - // seems to imply that setting the red/green/blue bits to zero means none of the components - // are considered and EGL disregards the entire sorting rule. It then looks to the next - // highest priority rule, which is EGL_BUFFER_SIZE. Despite the selection criteria being - // "AtLeast" for EGL_BUFFER_SIZE, it's sort order is "smaller" meaning 16-bit configs are - // put in the list before 32-bit configs. So, to make sure 16-bit is preffered over 32-bit, - // we must set the red/green/blue sizes to zero. This has an unfortunate consequence that - // if the application sets the red/green/blue size to 5/6/5 on the QGLFormat, they will - // probably get a 32-bit config, even when there's an RGB565 config avaliable. Oh well. - - // Now normalize the values so -1 becomes 0 - redSize = redSize > 0 ? redSize : 0; - greenSize = greenSize > 0 ? greenSize : 0; - blueSize = blueSize > 0 ? blueSize : 0; - alphaSize = alphaSize > 0 ? alphaSize : 0; - depthSize = depthSize > 0 ? depthSize : 0; - stencilSize = stencilSize > 0 ? stencilSize : 0; - sampleCount = sampleCount > 0 ? sampleCount : 0; - - eglProperties.setValue(EGL_RED_SIZE, redSize); - eglProperties.setValue(EGL_GREEN_SIZE, greenSize); - eglProperties.setValue(EGL_BLUE_SIZE, blueSize); - eglProperties.setValue(EGL_ALPHA_SIZE, alphaSize); - eglProperties.setValue(EGL_DEPTH_SIZE, depthSize); - eglProperties.setValue(EGL_STENCIL_SIZE, stencilSize); - eglProperties.setValue(EGL_SAMPLES, sampleCount); - eglProperties.setValue(EGL_SAMPLE_BUFFERS, sampleCount ? 1 : 0); -} - -// Updates "format" with the parameters of the selected configuration. -void qt_glformat_from_eglconfig(QGLFormat& format, const EGLConfig config) -{ - EGLint redSize = 0; - EGLint greenSize = 0; - EGLint blueSize = 0; - EGLint alphaSize = 0; - EGLint depthSize = 0; - EGLint stencilSize = 0; - EGLint sampleCount = 0; - EGLint level = 0; - - EGLDisplay display = QEgl::display(); - eglGetConfigAttrib(display, config, EGL_RED_SIZE, &redSize); - eglGetConfigAttrib(display, config, EGL_GREEN_SIZE, &greenSize); - eglGetConfigAttrib(display, config, EGL_BLUE_SIZE, &blueSize); - eglGetConfigAttrib(display, config, EGL_ALPHA_SIZE, &alphaSize); - eglGetConfigAttrib(display, config, EGL_DEPTH_SIZE, &depthSize); - eglGetConfigAttrib(display, config, EGL_STENCIL_SIZE, &stencilSize); - eglGetConfigAttrib(display, config, EGL_SAMPLES, &sampleCount); - eglGetConfigAttrib(display, config, EGL_LEVEL, &level); - - format.setRedBufferSize(redSize); - format.setGreenBufferSize(greenSize); - format.setBlueBufferSize(blueSize); - format.setAlphaBufferSize(alphaSize); - format.setDepthBufferSize(depthSize); - format.setStencilBufferSize(stencilSize); - format.setSamples(sampleCount); - format.setPlane(level + 1); // EGL calls level 0 "normal" whereas Qt calls 1 "normal" - format.setDirectRendering(true); // All EGL contexts are direct-rendered - format.setRgba(true); // EGL doesn't support colour index rendering - format.setStereo(false); // EGL doesn't support stereo buffers - format.setAccumBufferSize(0); // EGL doesn't support accululation buffers - - // Clear the EGL error state because some of the above may - // have errored out because the attribute is not applicable - // to the surface type. Such errors don't matter. - eglGetError(); -} + if (m_eglSurface == EGL_NO_SURFACE) { + qWarning("Createing QEGLPlatformContext with no surface"); + } -QEGLPlatformContext::QEGLPlatformContext() -{ + eglBindAPI(m_eglApi); + m_eglContext = eglCreateContext(m_eglDisplay,config, KD_NULL,contextAttrs); + if (!m_eglContext) { + qErrnoWarning("QEGLPlatformContext could not create eglContext"); + } } QEGLPlatformContext::~QEGLPlatformContext() { if (m_eglSurface != EGL_NO_SURFACE) { doneCurrent(); - eglDestroySurface(QEgl::display(), m_eglSurface); + eglDestroySurface(m_eglDisplay, m_eglSurface); m_eglSurface = EGL_NO_SURFACE; } - if (m_context != EGL_NO_CONTEXT) { - eglDestroyContext(QEgl::display(), m_context); - m_context = EGL_NO_CONTEXT; - } -} - -bool QEGLPlatformContext::create(QPaintDevice* device, QGLFormat& format, QPlatformGLContext* shareContext) -{ - QEglProperties properties; - properties.setValue(EGL_CONTEXT_CLIENT_VERSION, 2); - //lets go with all defaults :) Seems like we get bad attributes for anything else - //qt_eglproperties_set_glformat(properties,format); - format.setDepthBufferSize(1); - EGLConfig config = QEgl::defaultConfig(device->devType(), QEgl::OpenGL,QEgl::Renderable); - QEGLPlatformContext *eglShareContext = static_cast(shareContext); - if (shareContext && eglShareContext->m_context != EGL_NO_CONTEXT) { - m_context = eglCreateContext(QEgl::display(), config, eglShareContext->m_context, properties.properties()); - if (m_context == EGL_NO_CONTEXT) { - qWarning() << "QEglContext::createContext(): Could not share context:" << QEgl::errorString(); - shareContext = 0; - } - } else { - m_context = eglCreateContext(QEgl::display(), config, EGL_NO_CONTEXT, properties.properties()); - if (m_context == EGL_NO_CONTEXT) { - qWarning() << "QEglContext::createContext(): Unable to create EGL context:" << QEgl::errorString(); - return false; - } + if (m_eglContext != EGL_NO_CONTEXT) { + eglDestroyContext(m_eglDisplay, m_eglContext); + m_eglContext = EGL_NO_CONTEXT; } - //Get/create the EGLSurface - if (device && device->devType() == QInternal::Widget){ - QWidget* widget = static_cast(device); - QGLWidget* glWidget = qobject_cast(widget); - - if (!widget->isTopLevel()) { - qWarning("Creating a GL context is only supported on top-level QWidgets"); - return false; - } - EGLNativeWindowType winId = (EGLNativeWindowType) widget->window()->winId(); - - m_eglSurface = eglCreateWindowSurface(QEgl::display(), config, winId, 0); - makeCurrent(); - glClearColor(0.0, 0.0, 0.0, 1.0); - swapBuffers(); - - - } else { - qDebug() << "QEGLPlatformContext::create: didn't create surface!!!!!"; - } - return true; - } void QEGLPlatformContext::makeCurrent() { - eglBindAPI(EGL_OPENGL_API); - bool ok = eglMakeCurrent(QEgl::display(), m_eglSurface, m_eglSurface, m_context); + eglBindAPI(m_eglApi); + bool ok = eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext); if (!ok) - qWarning() << "QEGLPlatformContext::makeCurrent(" << m_eglSurface << "):" << QEgl::errorString(); + qWarning() << "QEGLPlatformContext::makeCurrent(" << m_eglSurface << "):" << eglGetError(); } void QEGLPlatformContext::doneCurrent() { - eglBindAPI(EGL_OPENGL_ES_API); - bool ok = eglMakeCurrent(QEgl::display(), EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + eglBindAPI(m_eglApi); + bool ok = eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); if (!ok) - qWarning() << "QEGLPlatformContext::doneCurrent():" << QEgl::errorString(); + qWarning() << "QEGLPlatformContext::doneCurrent():" << eglGetError(); } void QEGLPlatformContext::swapBuffers() { - bool ok = eglSwapBuffers(QEgl::display(), m_eglSurface); + eglBindAPI(m_eglApi); + bool ok = eglSwapBuffers(m_eglDisplay, m_eglSurface); if (!ok) - qWarning() << "QEGLPlatformContext::swapBuffers():" << QEgl::errorString(); + qWarning() << "QEGLPlatformContext::swapBuffers():" << eglGetError(); } void* QEGLPlatformContext::getProcAddress(const QString& procName) { - eglGetProcAddress(qPrintable(procName)); + eglBindAPI(m_eglApi); + return (void *)eglGetProcAddress(qPrintable(procName)); } diff --git a/src/plugins/platforms/openkode/qopenkodeglintegration.h b/src/plugins/platforms/openkode/qopenkodeglintegration.h index b0b7a48..19d155a 100644 --- a/src/plugins/platforms/openkode/qopenkodeglintegration.h +++ b/src/plugins/platforms/openkode/qopenkodeglintegration.h @@ -42,29 +42,25 @@ #ifndef QOPENKODEGLINTEGRATION_H #define QOPENKODEGLINTEGRATION_H -#include -#include +#include #include -void qt_eglproperties_set_glformat(QEglProperties& eglProperties, const QGLFormat& glFormat); -// Updates "format" with the parameters of the selected configuration. -void qt_glformat_from_eglconfig(QGLFormat& format, const EGLConfig config); - class QEGLPlatformContext : public QPlatformGLContext { public: - QEGLPlatformContext(); + QEGLPlatformContext(EGLDisplay display, EGLConfig config, EGLint contextAttrs[], EGLSurface surface, EGLenum eglApi); ~QEGLPlatformContext(); - bool create(QPaintDevice* device, QGLFormat& format, QPlatformGLContext* shareContext); void makeCurrent(); void doneCurrent(); void swapBuffers(); void* getProcAddress(const QString& procName); private: - EGLContext m_context; + EGLContext m_eglContext; + EGLDisplay m_eglDisplay; EGLSurface m_eglSurface; + EGLenum m_eglApi; }; #endif //QOPENKODEGLINTEGRATION_H diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.cpp b/src/plugins/platforms/openkode/qopenkodeintegration.cpp index 5e461ae..52b57d9 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.cpp +++ b/src/plugins/platforms/openkode/qopenkodeintegration.cpp @@ -57,6 +57,8 @@ #include #include +#include + #include "GLES2/gl2ext.h" #include @@ -85,6 +87,19 @@ QOpenKODEScreen::QOpenKODEScreen() return; } + KDboolean enabled = KD_TRUE; + kdSetDisplayPropertybvNV(kdDisplay, + KD_DISPLAYPROPERTY_ENABLED_NV, + &enabled); + KDboolean power = KD_DISPLAY_POWER_ON; + kdSetDisplayPropertyivNV(kdDisplay, + KD_DISPLAYPROPERTY_POWER_NV, + &power); + + kdSetDisplayPropertycvNV(kdDisplay, + KD_DISPLAYPROPERTY_DESKTOP_NAME_NV, + KD_DEFAULT_DESKTOP_NV); + KDDisplayModeNV mode; if (kdGetDisplayModeNV(kdDisplay, &mode)) { qErrnoWarning(kdGetError(), "Could not get display mode"); @@ -95,15 +110,26 @@ QOpenKODEScreen::QOpenKODEScreen() KDint desktopSize[] = { mode.width, mode.height }; - if (kdSetDesktopPropertyivNV(kdDesktop, KD_DESKTOPPROPERTY_SIZE_NV, desktopSize)) { - qErrnoWarning(kdGetError(), "Could not set desktop size"); - return; - } +// if (kdSetDesktopPropertyivNV(kdDesktop, KD_DESKTOPPROPERTY_SIZE_NV, desktopSize)) { +// qErrnoWarning(kdGetError(), "Could not set desktop size"); +// return; +// } // Once we've set up the desktop and display we don't need them anymore kdReleaseDisplayNV(kdDisplay); kdReleaseDesktopNV(kdDesktop); + mEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); + if (mEglDisplay == EGL_NO_DISPLAY) { + qErrnoWarning("EGL failed to obtain display"); + } + + /* Initialize EGL display */ + EGLBoolean rvbool = eglInitialize(mEglDisplay, 0, 0); + if (!rvbool) { + qErrnoWarning("EGL failed to initialize display"); + } + const int defaultDpi = 72; mGeometry = QRect(0, 0, mode.width, mode.height); mPhysicalSize = QSize(mode.width * 25.4 / defaultDpi, mode.height * 25.4 / defaultDpi); @@ -212,17 +238,14 @@ QPlatformWindow *QOpenKODEIntegration::createPlatformWindow(QWidget *tlw, WId ) QWindowSurface *QOpenKODEIntegration::createWindowSurface(QWidget *widget, WId wid) const { - return new QOpenKODEWindowSurface(widget, wid); +// return new QOpenKODEWindowSurface(widget, wid); + return new QGLWindowSurface(widget); } bool QOpenKODEIntegration::hasOpenGL() const { return true; } -QPlatformGLContext *QOpenKODEIntegration::createGLContext() -{ - return new QEGLPlatformContext; -} GLuint QOpenKODEIntegration::blitterProgram() { diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.h b/src/plugins/platforms/openkode/qopenkodeintegration.h index f53c520..9029086 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.h +++ b/src/plugins/platforms/openkode/qopenkodeintegration.h @@ -46,10 +46,10 @@ #include #include -#include -#include +#include -# include +#include +#include QT_BEGIN_NAMESPACE @@ -57,6 +57,7 @@ struct KDDesktopNV; class QOpenKODEScreen : public QPlatformScreen { + Q_OBJECT public: QOpenKODEScreen(); ~QOpenKODEScreen() {} @@ -66,11 +67,13 @@ public: QImage::Format format() const { return mFormat; } QSize physicalSize() const { return mPhysicalSize; } + EGLDisplay eglDisplay() { return mEglDisplay; } public: QRect mGeometry; int mDepth; QImage::Format mFormat; QSize mPhysicalSize; + EGLDisplay mEglDisplay; }; class QOpenKODEIntegration : public QPlatformIntegration diff --git a/src/plugins/platforms/openkode/qopenkodewindow.cpp b/src/plugins/platforms/openkode/qopenkodewindow.cpp index 4d18a6f..88e6a75 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.cpp +++ b/src/plugins/platforms/openkode/qopenkodewindow.cpp @@ -39,40 +39,112 @@ ** ****************************************************************************/ #include "qopenkodewindow.h" +#include "qopenkodeintegration.h" +#include "qopenkodeglintegration.h" +#include #include -#include +#include + #include +#include +#include #include QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) : QPlatformWindow(tlw) { - /* Initialize EGL display */ - EGLBoolean rvbool = eglInitialize(QEgl::display(), KD_NULL, KD_NULL); - if (!rvbool) { - kdLogMessage("EGL failed to initialize display\n"); + EGLint configAttrs[] = { + EGL_RED_SIZE, 1, + EGL_GREEN_SIZE, 1, + EGL_BLUE_SIZE, 1, + EGL_BUFFER_SIZE, 16, + EGL_DEPTH_SIZE, 0, + EGL_LEVEL, 0, + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, +// #ifdef EGL_NV_coverage_sample +// EGL_COVERAGE_BUFFERS_NV, 1, +// EGL_COVERAGE_SAMPLES_NV, 5, +// #endif + EGL_ALPHA_SIZE, 0, +// EGL_LUMINANCE_SIZE, 0, + EGL_ALPHA_MASK_SIZE, 0, + EGL_SAMPLES, 0, + EGL_SAMPLE_BUFFERS, 0, +// EGL_STENCIL_SIZE, 0, + EGL_SURFACE_TYPE, EGL_WINDOW_BIT, + EGL_TRANSPARENT_TYPE, EGL_NONE, + EGL_NONE + }; + EGLint contextAttrs[] = { + EGL_CONTEXT_CLIENT_VERSION, 2, // NOTE: not needed for VG + EGL_NONE + }; + + // EGL_RENDER_BUFFER, EGL_BACK_BUFFER, +// m_eglWindowAttrs.append(EGL_RENDER_BUFFER); +// m_eglWindowAttrs.append(EGL_BACK_BUFFER); + m_eglWindowAttrs.append(EGL_NONE); + + EGLenum eglApi = EGL_OPENGL_ES_API; + eglBindAPI(eglApi); + + QList screens = QApplicationPrivate::platformIntegration()->screens(); + //XXXX: jl figure out how to pick the correct screen. +// Q_ASSERT(screens.size() > tlw->d_func()->screenNumber); +// QOpenKODEScreen *screen = qobject_cast(screens.at(tlw->d_func()->screenNumber)); + QOpenKODEScreen *screen = qobject_cast(screens.at(0)); + if (!screen) { + qErrnoWarning("Could not make QOpenKODEWindow without a screen"); + } + + EGLint configCount; + // Find out how many configurations suit our needs + EGLBoolean eglStatus = eglChooseConfig(screen->eglDisplay(), configAttrs, + KD_NULL, 0, &configCount); + if (!eglStatus || !configCount) { + qErrnoWarning("EGL failed to return any matching configurations"); + } + + qDebug() << "config count" << configCount; + + // Allocate room for the list of matching configurations + EGLConfig *configList = (EGLConfig*)kdMalloc(configCount * sizeof(EGLConfig)); + if (!configList) { + qErrnoWarning("kdMalloc failure obtaining configuration list"); } - kdWindow = kdCreateWindow(QEgl::display(), - QEgl::defaultConfig(QInternal::Widget,QEgl::OpenGL,QEgl::Renderable), + // Obtain the configuration list from EGL + eglStatus = eglChooseConfig(screen->eglDisplay(), configAttrs, + configList, configCount, &configCount); + if (!eglStatus || !configCount) { + qErrnoWarning("EGL failed to populate configuration list"); + } + + // Select an EGL configuration that matches the native window + + m_eglConfig = configList[11]; + kdFree(configList);//free the list not the configs + + m_kdWindow = kdCreateWindow(screen->eglDisplay(), + m_eglConfig, KD_NULL); - if (!kdWindow) { + if (!m_kdWindow) { qErrnoWarning(kdGetError(), "Error creating native window"); return; } const KDint windowSize[2] = { tlw->width(), tlw->height()-1 }; - if (kdSetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) { + if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) { qErrnoWarning(kdGetError(), "Could not set native window size"); return; } - KDboolean visibillity(false); - if (kdSetWindowPropertybv(kdWindow, KD_WINDOWPROPERTY_VISIBILITY, &visibillity)) { - qErrnoWarning(kdGetError(), "Could not set visibillity to false"); - } +// KDboolean visibillity(false); +// if (kdSetWindowPropertybv(m_kdWindow, KD_WINDOWPROPERTY_VISIBILITY, &visibillity)) { +// qErrnoWarning(kdGetError(), "Could not set visibillity to false"); +// } // const KDboolean windowExclusive[] = { false }; // if (kdSetWindowPropertybv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_EXCLUSIVE_NV, windowExclusive)) { @@ -81,28 +153,44 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) // } // const KDint windowPos[2] = { tlw->x(), tlw->y() }; - if (kdSetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { + if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { qErrnoWarning(kdGetError(), "Could not set native window position"); return; } - if (kdRealizeWindow(kdWindow, &eglWindow)) { + if (kdRealizeWindow(m_kdWindow, &m_eglWindow)) { qErrnoWarning(kdGetError(), "Could not realize native window"); return; } + + KDint32 layer = 1; + kdGetWindowPropertyiv(m_kdWindow,KD_WINDOWPROPERTY_DESKTOP_LAYER_NV,&layer); + qDebug() << "LAYER:" << layer; + + EGLSurface surface = eglCreateWindowSurface(screen->eglDisplay(),m_eglConfig,m_eglWindow,m_eglWindowAttrs.constData()); + + qDebug() << "surface id " << surface; + + m_platformGlContext = new QEGLPlatformContext(screen->eglDisplay(),m_eglConfig,contextAttrs,surface,eglApi); + m_platformGlContext->makeCurrent(); + glClearColor(0,0,0,0); + + } QOpenKODEWindow::~QOpenKODEWindow() { - qDebug() << "destroying window"; - kdDestroyWindow(kdWindow); + qDebug() << "destroying window" << m_kdWindow; +// delete m_platformGlContext; + kdDestroyWindow(m_kdWindow); } void QOpenKODEWindow::setGeometry(const QRect &rect) { + qDebug() << "setting geo"; const QRect geo = geometry(); if (geo.size() != rect.size()) { const KDint windowSize[2] = { rect.width(), rect.height() }; - if (kdSetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) { + if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) { qErrnoWarning(kdGetError(), "Could not set native window size"); //return; } @@ -110,18 +198,50 @@ void QOpenKODEWindow::setGeometry(const QRect &rect) if (geo.topLeft() != rect.topLeft()) { const KDint windowPos[2] = { rect.x(), rect.y() }; - if (kdSetWindowPropertyiv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { + if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { qErrnoWarning(kdGetError(), "Could not set native window position"); //return; } } + delete m_platformGlContext; + + QList screens = QApplicationPrivate::platformIntegration()->screens(); + //XXXX: jl figure out how to pick the correct screen. +// Q_ASSERT(screens.size() > tlw->d_func()->screenNumber); +// QOpenKODEScreen *screen = qobject_cast(screens.at(tlw->d_func()->screenNumber)); + QOpenKODEScreen *screen = qobject_cast(screens.at(0)); + +// if (kdRealizeWindow(m_kdWindow, &m_eglWindow)) { +// qErrnoWarning(kdGetError(), "Could not realize native window in geo"); +// return; +// } + + EGLint contextAttrs[] = { + EGL_CONTEXT_CLIENT_VERSION, 2, // NOTE: not needed for VG + EGL_NONE + }; + + EGLenum eglApi = EGL_OPENGL_ES_API; + + EGLSurface surface = eglCreateWindowSurface(screen->eglDisplay(),m_eglConfig,m_eglWindow,m_eglWindowAttrs.constData()); + + qDebug() << "surface id " << surface; + + m_platformGlContext = new QEGLPlatformContext(screen->eglDisplay(),m_eglConfig,contextAttrs,surface,eglApi); + m_platformGlContext->makeCurrent(); + glClearColor(0,0,0,1); } void QOpenKODEWindow::setVisible(bool visible) { KDboolean visibillity(visible); - if (kdSetWindowPropertybv(kdWindow, KD_WINDOWPROPERTY_VISIBILITY, &visibillity)) { + if (kdSetWindowPropertybv(m_kdWindow, KD_WINDOWPROPERTY_VISIBILITY, &visibillity)) { qErrnoWarning(kdGetError(), "Could not set visibillity to false"); } } + +QPlatformGLContext *QOpenKODEWindow::glContext() +{ + return m_platformGlContext; +} diff --git a/src/plugins/platforms/openkode/qopenkodewindow.h b/src/plugins/platforms/openkode/qopenkodewindow.h index 741e676..04fa70a 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.h +++ b/src/plugins/platforms/openkode/qopenkodewindow.h @@ -43,9 +43,12 @@ #define QOPENKODEWINDOW_H #include +#include #include +class QEGLPlatformContext; + class QOpenKODEWindow : public QPlatformWindow { public: @@ -54,11 +57,16 @@ public: void setGeometry(const QRect &rect); void setVisible(bool visible); - WId winId() const { return WId(eglWindow); } + WId winId() const { return WId(m_eglWindow); } + + QPlatformGLContext *glContext(); private: - struct KDWindow *kdWindow; - EGLNativeWindowType eglWindow; + struct KDWindow *m_kdWindow; + EGLNativeWindowType m_eglWindow; + EGLConfig m_eglConfig; + QVector m_eglWindowAttrs; + QEGLPlatformContext *m_platformGlContext; }; #endif //QOPENKODEWINDOW_H diff --git a/src/plugins/platforms/openkode/qopenkodewindowsurface.cpp b/src/plugins/platforms/openkode/qopenkodewindowsurface.cpp index dacd019..a349031 100644 --- a/src/plugins/platforms/openkode/qopenkodewindowsurface.cpp +++ b/src/plugins/platforms/openkode/qopenkodewindowsurface.cpp @@ -45,21 +45,14 @@ #include "qopenkodewindow.h" #include +#include QT_BEGIN_NAMESPACE QOpenKODEWindowSurface::QOpenKODEWindowSurface - (QWidget *window, WId winId) - : QWindowSurface(window), - mSurface(EGL_NO_SURFACE), - mWin((EGLNativeWindowType) winId) + (QWidget *window, WId) + : QWindowSurface(window), m_platformGLContext(window->platformWindow()->glContext()) { - EGLConfig config = QEgl::defaultConfig(QInternal::Widget,QEgl::OpenGL,QEgl::Renderable); - mContext.setConfig(config); - if (!mContext.createContext()) { - qWarning("QOpenKODEWindowSurface: Unable to create context"); - return; - } } QOpenKODEWindowSurface::~QOpenKODEWindowSurface() @@ -72,19 +65,16 @@ QPaintDevice *QOpenKODEWindowSurface::paintDevice() } // ### TODO - this updates the entire toplevel, should only update the region -void QOpenKODEWindowSurface::flush(QWidget *, const QRegion ®ion, const QPoint &offset) +void QOpenKODEWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) { - mContext.makeCurrent(mSurface); + m_platformGLContext->makeCurrent(); if (!offset.isNull()) { qWarning("Offset flushing not supported yet"); return; } - if (!mContext.makeCurrent(mSurface)) { - qWarning("EGL couldn't make context/surface current: 0x%x", eglGetError()); - return; - } + m_platformGLContext->makeCurrent(); QRect boundingRect = region.boundingRect(); @@ -103,7 +93,7 @@ void QOpenKODEWindowSurface::flush(QWidget *, const QRegion ®ion, const QPoin y = boundingRect.y(); } -// qDebug() << "flush" << widget << offset << region.boundingRect() << mImage.format() << blitImage.format(); + qDebug() << "flush" << widget << offset << region.boundingRect() << mImage.format() << blitImage.format(); GLuint shaderProgram = QOpenKODEIntegration::blitterProgram(); @@ -159,8 +149,8 @@ void QOpenKODEWindowSurface::flush(QWidget *, const QRegion ®ion, const QPoin eglWaitGL(); - mContext.swapBuffers(mSurface); - mContext.doneCurrent(); + m_platformGLContext->swapBuffers(); + m_platformGLContext->doneCurrent(); eglWaitNative(EGL_CORE_NATIVE_ENGINE); } @@ -168,21 +158,14 @@ void QOpenKODEWindowSurface::flush(QWidget *, const QRegion ®ion, const QPoin void QOpenKODEWindowSurface::resize(const QSize &size) { QWindowSurface::resize(size); - mContext.destroySurface(mSurface); - mSurface = EGL_NO_SURFACE; mImage = QImage(); } void QOpenKODEWindowSurface::beginPaint(const QRegion ®ion) { Q_UNUSED(region); - if (mSurface == EGL_NO_SURFACE) { - EGLConfig config = QEgl::defaultConfig(QInternal::Widget,QEgl::OpenGL,QEgl::Renderable); - EGLint windowAttrs[] = { EGL_NONE }; - mSurface = eglCreateWindowSurface(QEgl::display(), config, mWin, windowAttrs); - if (mSurface == EGL_NO_SURFACE) { - qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError()); - } + if (mImage.isNull()) { + m_platformGLContext = window()->platformWindow()->glContext(); mImage = QImage(size(),QImage::Format_RGB32); } } diff --git a/src/plugins/platforms/openkode/qopenkodewindowsurface.h b/src/plugins/platforms/openkode/qopenkodewindowsurface.h index 568dbc2..4acd1d8 100644 --- a/src/plugins/platforms/openkode/qopenkodewindowsurface.h +++ b/src/plugins/platforms/openkode/qopenkodewindowsurface.h @@ -43,11 +43,13 @@ #define QWINDOWSURFACE_OPENKODE_H #include -#include + +#include QT_BEGIN_NAMESPACE class QOpenKODEWindow; +class QPlatformGLContext; class QOpenKODEWindowSurface : public QWindowSurface { @@ -65,9 +67,7 @@ public: private: QImage mImage; - EGLSurface mSurface; - QEglContext mContext; - EGLNativeWindowType mWin; + QPlatformGLContext *m_platformGLContext; }; QT_END_NAMESPACE -- cgit v0.12 From 2b384a4df14fab0f377b04df24b67ee7634f8403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 8 Jul 2010 08:28:35 +0200 Subject: Make tempcontext use new lighthouse api --- src/opengl/qgl_qpa.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index 2003cc1..be2ef87 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -180,14 +180,16 @@ void QGLContext::generateFontDisplayLists(const QFont & fnt, int listBase) class QGLTemporaryContextPrivate { public: - QGLWidget *widget; + QWidget *widget; }; QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) : d(new QGLTemporaryContextPrivate) { - d->widget = new QGLWidget; - d->widget->makeCurrent(); + d->widget = new QWidget; + d->widget->setGeometry(0,0,3,3); + d->widget->winId(); + d->widget->platformWindow()->glContext()->makeCurrent(); } QGLTemporaryContext::~QGLTemporaryContext() -- cgit v0.12 From 13e75dd03d2fb8a1f01406c30520cef80cb2800a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 8 Jul 2010 10:19:01 +0200 Subject: Fix deletion of QPlatformGLContext it is owned by the QPlatformWindow, and should thus be delted by it, even for QGLContext --- src/opengl/qgl_qpa.cpp | 2 +- src/plugins/platforms/openkode/qopenkodewindow.cpp | 36 ++++++---------------- 2 files changed, 10 insertions(+), 28 deletions(-) diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index be2ef87..aa124fe 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -84,7 +84,7 @@ void QGLContext::reset() doneCurrent(); if (d->platformContext) { - delete d->platformContext; + //dont delete. This will be done by the platform d->platformContext = 0; } diff --git a/src/plugins/platforms/openkode/qopenkodewindow.cpp b/src/plugins/platforms/openkode/qopenkodewindow.cpp index 88e6a75..e40783f 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.cpp +++ b/src/plugins/platforms/openkode/qopenkodewindow.cpp @@ -82,7 +82,6 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) EGL_NONE }; - // EGL_RENDER_BUFFER, EGL_BACK_BUFFER, // m_eglWindowAttrs.append(EGL_RENDER_BUFFER); // m_eglWindowAttrs.append(EGL_BACK_BUFFER); m_eglWindowAttrs.append(EGL_NONE); @@ -141,17 +140,11 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) return; } -// KDboolean visibillity(false); -// if (kdSetWindowPropertybv(m_kdWindow, KD_WINDOWPROPERTY_VISIBILITY, &visibillity)) { -// qErrnoWarning(kdGetError(), "Could not set visibillity to false"); -// } - -// const KDboolean windowExclusive[] = { false }; -// if (kdSetWindowPropertybv(kdWindow, KD_WINDOWPROPERTY_DESKTOP_EXCLUSIVE_NV, windowExclusive)) { -// qErrnoWarning(kdGetError(), "Could not set exclusive bit"); -// //return; -// } -// + KDboolean visibillity(false); + if (kdSetWindowPropertybv(m_kdWindow, KD_WINDOWPROPERTY_VISIBILITY, &visibillity)) { + qErrnoWarning(kdGetError(), "Could not set visibillity to false"); + } + const KDint windowPos[2] = { tlw->x(), tlw->y() }; if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { qErrnoWarning(kdGetError(), "Could not set native window position"); @@ -169,19 +162,13 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) EGLSurface surface = eglCreateWindowSurface(screen->eglDisplay(),m_eglConfig,m_eglWindow,m_eglWindowAttrs.constData()); - qDebug() << "surface id " << surface; - m_platformGlContext = new QEGLPlatformContext(screen->eglDisplay(),m_eglConfig,contextAttrs,surface,eglApi); - m_platformGlContext->makeCurrent(); - glClearColor(0,0,0,0); - - } QOpenKODEWindow::~QOpenKODEWindow() { qDebug() << "destroying window" << m_kdWindow; -// delete m_platformGlContext; + delete m_platformGlContext; kdDestroyWindow(m_kdWindow); } void QOpenKODEWindow::setGeometry(const QRect &rect) @@ -189,7 +176,7 @@ void QOpenKODEWindow::setGeometry(const QRect &rect) qDebug() << "setting geo"; const QRect geo = geometry(); if (geo.size() != rect.size()) { - const KDint windowSize[2] = { rect.width(), rect.height() }; + const KDint windowSize[2] = { rect.width(), rect.height() -1 }; if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) { qErrnoWarning(kdGetError(), "Could not set native window size"); //return; @@ -206,17 +193,13 @@ void QOpenKODEWindow::setGeometry(const QRect &rect) delete m_platformGlContext; + /********####neeeds cleaning up **********/ QList screens = QApplicationPrivate::platformIntegration()->screens(); //XXXX: jl figure out how to pick the correct screen. // Q_ASSERT(screens.size() > tlw->d_func()->screenNumber); // QOpenKODEScreen *screen = qobject_cast(screens.at(tlw->d_func()->screenNumber)); QOpenKODEScreen *screen = qobject_cast(screens.at(0)); -// if (kdRealizeWindow(m_kdWindow, &m_eglWindow)) { -// qErrnoWarning(kdGetError(), "Could not realize native window in geo"); -// return; -// } - EGLint contextAttrs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, // NOTE: not needed for VG EGL_NONE @@ -229,8 +212,7 @@ void QOpenKODEWindow::setGeometry(const QRect &rect) qDebug() << "surface id " << surface; m_platformGlContext = new QEGLPlatformContext(screen->eglDisplay(),m_eglConfig,contextAttrs,surface,eglApi); - m_platformGlContext->makeCurrent(); - glClearColor(0,0,0,1); + /*******************************************/ } void QOpenKODEWindow::setVisible(bool visible) -- cgit v0.12 From c7590d9f255e1efd3dc528e1052f997f4f477009 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 8 Jul 2010 11:08:49 +0200 Subject: cleaning up QOpenKODEWindow --- src/plugins/platforms/openkode/qopenkodewindow.cpp | 35 +++++++--------------- src/plugins/platforms/openkode/qopenkodewindow.h | 2 ++ 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/src/plugins/platforms/openkode/qopenkodewindow.cpp b/src/plugins/platforms/openkode/qopenkodewindow.cpp index e40783f..52117ad 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.cpp +++ b/src/plugins/platforms/openkode/qopenkodewindow.cpp @@ -77,17 +77,17 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) EGL_TRANSPARENT_TYPE, EGL_NONE, EGL_NONE }; - EGLint contextAttrs[] = { - EGL_CONTEXT_CLIENT_VERSION, 2, // NOTE: not needed for VG - EGL_NONE - }; + + m_eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); + m_eglContextAttrs.append(2); + m_eglContextAttrs.append(EGL_NONE); // m_eglWindowAttrs.append(EGL_RENDER_BUFFER); // m_eglWindowAttrs.append(EGL_BACK_BUFFER); m_eglWindowAttrs.append(EGL_NONE); - EGLenum eglApi = EGL_OPENGL_ES_API; - eglBindAPI(eglApi); + m_eglApi = EGL_OPENGL_ES_API; + eglBindAPI(m_eglApi); QList screens = QApplicationPrivate::platformIntegration()->screens(); //XXXX: jl figure out how to pick the correct screen. @@ -162,7 +162,8 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) EGLSurface surface = eglCreateWindowSurface(screen->eglDisplay(),m_eglConfig,m_eglWindow,m_eglWindowAttrs.constData()); - m_platformGlContext = new QEGLPlatformContext(screen->eglDisplay(),m_eglConfig,contextAttrs,surface,eglApi); + m_platformGlContext = new QEGLPlatformContext(screen->eglDisplay(), m_eglConfig, + m_eglContextAttrs.data(), surface, m_eglApi); } QOpenKODEWindow::~QOpenKODEWindow() @@ -191,28 +192,14 @@ void QOpenKODEWindow::setGeometry(const QRect &rect) } } + //need to recreate context delete m_platformGlContext; - /********####neeeds cleaning up **********/ QList screens = QApplicationPrivate::platformIntegration()->screens(); - //XXXX: jl figure out how to pick the correct screen. -// Q_ASSERT(screens.size() > tlw->d_func()->screenNumber); -// QOpenKODEScreen *screen = qobject_cast(screens.at(tlw->d_func()->screenNumber)); QOpenKODEScreen *screen = qobject_cast(screens.at(0)); - - EGLint contextAttrs[] = { - EGL_CONTEXT_CLIENT_VERSION, 2, // NOTE: not needed for VG - EGL_NONE - }; - - EGLenum eglApi = EGL_OPENGL_ES_API; - EGLSurface surface = eglCreateWindowSurface(screen->eglDisplay(),m_eglConfig,m_eglWindow,m_eglWindowAttrs.constData()); - - qDebug() << "surface id " << surface; - - m_platformGlContext = new QEGLPlatformContext(screen->eglDisplay(),m_eglConfig,contextAttrs,surface,eglApi); - /*******************************************/ + m_platformGlContext = new QEGLPlatformContext(screen->eglDisplay(),m_eglConfig, + m_eglContextAttrs.data(),surface,m_eglApi); } void QOpenKODEWindow::setVisible(bool visible) diff --git a/src/plugins/platforms/openkode/qopenkodewindow.h b/src/plugins/platforms/openkode/qopenkodewindow.h index 04fa70a..51252a9 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.h +++ b/src/plugins/platforms/openkode/qopenkodewindow.h @@ -66,6 +66,8 @@ private: EGLNativeWindowType m_eglWindow; EGLConfig m_eglConfig; QVector m_eglWindowAttrs; + QVector m_eglContextAttrs; + EGLenum m_eglApi; QEGLPlatformContext *m_platformGlContext; }; -- cgit v0.12 From e7054204ff74bde531d293de5b360587724f6857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 9 Jul 2010 16:04:46 +0200 Subject: Added QPlatformWindowFormat Its mostly a copy of QGLFormat Only plugin that uses it is the openkode, and thats just a poc. --- src/gui/kernel/kernel.pri | 6 +- src/gui/kernel/qplatformwindow_qpa.cpp | 41 + src/gui/kernel/qplatformwindow_qpa.h | 2 + src/gui/kernel/qplatformwindowformat_qpa.cpp | 1283 ++++++++++++++++++++ src/gui/kernel/qplatformwindowformat_qpa.h | 256 ++++ src/gui/kernel/qwidget.cpp | 37 +- src/gui/kernel/qwidget.h | 8 + src/gui/kernel/qwidget_p.h | 1 + src/gui/kernel/qwidget_qpa.cpp | 52 + .../platforms/openkode/qopenkodeintegration.cpp | 8 +- src/plugins/platforms/openkode/qopenkodewindow.cpp | 290 ++++- 11 files changed, 1891 insertions(+), 93 deletions(-) create mode 100644 src/gui/kernel/qplatformwindowformat_qpa.cpp create mode 100644 src/gui/kernel/qplatformwindowformat_qpa.h diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index f773906..e9b8f25 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -214,9 +214,10 @@ qpa { kernel/qplatformintegrationfactory_qpa_p.h \ kernel/qplatformintegrationplugin_qpa.h \ kernel/qplatformwindow_qpa.h \ + kernel/qplatformwindowformat_qpa.h \ kernel/qplatformglcontext_qpa.h \ kernel/qdesktopwidget_qpa_p.h - + SOURCES += \ kernel/qapplication_qpa.cpp \ kernel/qclipboard_qpa.cpp \ @@ -233,7 +234,8 @@ qpa { kernel/qplatformscreen_qpa.cpp \ kernel/qplatformintegrationfactory_qpa.cpp \ kernel/qplatformintegrationplugin_qpa.cpp \ - kernel/qplatformwindow_qpa.cpp + kernel/qplatformwindow_qpa.cpp \ + kernel/qplatformwindowformat_qpa.cpp contains(QT_CONFIG, glib) { SOURCES += \ diff --git a/src/gui/kernel/qplatformwindow_qpa.cpp b/src/gui/kernel/qplatformwindow_qpa.cpp index c0e642c..4cd8ead 100644 --- a/src/gui/kernel/qplatformwindow_qpa.cpp +++ b/src/gui/kernel/qplatformwindow_qpa.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "qplatformwindow_qpa.h" #include diff --git a/src/gui/kernel/qplatformwindow_qpa.h b/src/gui/kernel/qplatformwindow_qpa.h index 5f8d259..e8b5ad8 100644 --- a/src/gui/kernel/qplatformwindow_qpa.h +++ b/src/gui/kernel/qplatformwindow_qpa.h @@ -82,6 +82,8 @@ public: virtual QPlatformGLContext *glContext(); protected: QScopedPointer d_ptr; +private: + Q_DISABLE_COPY(QPlatformWindow); }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformwindowformat_qpa.cpp b/src/gui/kernel/qplatformwindowformat_qpa.cpp new file mode 100644 index 0000000..4ded26b --- /dev/null +++ b/src/gui/kernel/qplatformwindowformat_qpa.cpp @@ -0,0 +1,1283 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformwindowformat_qpa.h" + +Q_GLOBAL_STATIC(QPlatformWindowFormat, q_platformwindow_default_format); + +class QPlatformWindowFormatPrivate +{ +public: + QPlatformWindowFormatPrivate() + : ref(1) + , opts(QPlatformWindowFormat::DoubleBuffer | QPlatformWindowFormat::DepthBuffer + | QPlatformWindowFormat::Rgba | QPlatformWindowFormat::DirectRendering + | QPlatformWindowFormat::StencilBuffer | QPlatformWindowFormat::DeprecatedFunctions) + , depthSize(-1) + , accumSize(-1) + , stencilSize(-1) + , redSize(-1) + , greenSize(-1) + , blueSize(-1) + , alphaSize(-1) + , numSamples(-1) + , swapInterval(-1) + , majorVersion(1) + , minorVersion(0) + , profile(QPlatformWindowFormat::NoProfile) + { + } + + QPlatformWindowFormatPrivate(const QPlatformWindowFormatPrivate *other) + : ref(1), + opts(other->opts), + depthSize(other->depthSize), + accumSize(other->accumSize), + stencilSize(other->stencilSize), + redSize(other->redSize), + greenSize(other->greenSize), + blueSize(other->blueSize), + alphaSize(other->alphaSize), + numSamples(other->numSamples), + swapInterval(other->swapInterval), + majorVersion(other->majorVersion), + minorVersion(other->minorVersion), + profile(other->profile) + { + } + QAtomicInt ref; + QPlatformWindowFormat::FormatOptions opts; + int depthSize; + int accumSize; + int stencilSize; + int redSize; + int greenSize; + int blueSize; + int alphaSize; + int numSamples; + int swapInterval; + int majorVersion; + int minorVersion; + QPlatformWindowFormat::OpenGLContextProfile profile; +}; + +/*! + \class QGLFormat + \brief The QGLFormat class specifies the display format of an OpenGL + rendering context. + + \ingroup painting-3D + + A display format has several characteristics: + \list + \i \link setDoubleBuffer() Double or single buffering.\endlink + \i \link setDepth() Depth buffer.\endlink + \i \link setRgba() RGBA or color index mode.\endlink + \i \link setAlpha() Alpha channel.\endlink + \i \link setAccum() Accumulation buffer.\endlink + \i \link setStencil() Stencil buffer.\endlink + \i \link setStereo() Stereo buffers.\endlink + \i \link setDirectRendering() Direct rendering.\endlink + \i \link setOverlay() Presence of an overlay.\endlink + \i \link setPlane() Plane of an overlay.\endlink + \i \link setSampleBuffers() Multisample buffers.\endlink + \endlist + + You can also specify preferred bit depths for the color buffer, + depth buffer, alpha buffer, accumulation buffer and the stencil + buffer with the functions: setRedBufferSize(), setGreenBufferSize(), + setBlueBufferSize(), setDepthBufferSize(), setAlphaBufferSize(), + setAccumBufferSize() and setStencilBufferSize(). + + Note that even if you specify that you prefer a 32 bit depth + buffer (e.g. with setDepthBufferSize(32)), the format that is + chosen may not have a 32 bit depth buffer, even if there is a + format available with a 32 bit depth buffer. The main reason for + this is how the system dependant picking algorithms work on the + different platforms, and some format options may have higher + precedence than others. + + You create and tell a QGLFormat object what rendering options you + want from an OpenGL rendering context. + + OpenGL drivers or accelerated hardware may or may not support + advanced features such as alpha channel or stereographic viewing. + If you request some features that the driver/hardware does not + provide when you create a QGLWidget, you will get a rendering + context with the nearest subset of features. + + There are different ways to define the display characteristics of + a rendering context. One is to create a QGLFormat and make it the + default for the entire application: + \snippet doc/src/snippets/code/src_opengl_qgl.cpp 0 + + Or you can specify the desired format when creating an object of + your QGLWidget subclass: + \snippet doc/src/snippets/code/src_opengl_qgl.cpp 1 + + After the widget has been created, you can find out which of the + requested features the system was able to provide: + \snippet doc/src/snippets/code/src_opengl_qgl.cpp 2 + + \legalese + OpenGL is a trademark of Silicon Graphics, Inc. in the + United States and other countries. + \endlegalese + + \sa QGLContext, QGLWidget +*/ + +/*! + Constructs a QGLFormat object with the following default settings: + \list + \i \link setDoubleBuffer() Double buffer:\endlink Enabled. + \i \link setDepth() Depth buffer:\endlink Enabled. + \i \link setRgba() RGBA:\endlink Enabled (i.e., color index disabled). + \i \link setAlpha() Alpha channel:\endlink Disabled. + \i \link setAccum() Accumulator buffer:\endlink Disabled. + \i \link setStencil() Stencil buffer:\endlink Enabled. + \i \link setStereo() Stereo:\endlink Disabled. + \i \link setDirectRendering() Direct rendering:\endlink Enabled. + \i \link setOverlay() Overlay:\endlink Disabled. + \i \link setPlane() Plane:\endlink 0 (i.e., normal plane). + \i \link setSampleBuffers() Multisample buffers:\endlink Disabled. + \endlist +*/ + +QPlatformWindowFormat::QPlatformWindowFormat() +{ + d = new QPlatformWindowFormatPrivate; +} + + +/*! + Creates a QGLFormat object that is a copy of the current + defaultFormat(). + + If \a options is not 0, the default format is modified by the + specified format options. The \a options parameter should be + QGL::FormatOption values OR'ed together. + + This constructor makes it easy to specify a certain desired format + in classes derived from QGLWidget, for example: + \snippet doc/src/snippets/code/src_opengl_qgl.cpp 3 + + Note that there are QGL::FormatOption values to turn format settings + both on and off, e.g. QGL::DepthBuffer and QGL::NoDepthBuffer, + QGL::DirectRendering and QGL::IndirectRendering, etc. + + The \a plane parameter defaults to 0 and is the plane which this + format should be associated with. Not all OpenGL implementations + supports overlay/underlay rendering planes. + + \sa defaultFormat(), setOption(), setPlane() +*/ + +QPlatformWindowFormat::QPlatformWindowFormat(QPlatformWindowFormat::FormatOptions options) +{ + d = new QPlatformWindowFormatPrivate; + QPlatformWindowFormat::FormatOptions newOpts = options; + d->opts = defaultFormat().d->opts; + d->opts |= (newOpts & 0xffff); + d->opts &= ~(newOpts >> 16); +} + +/*! + \internal +*/ +void QPlatformWindowFormat::detach() +{ + if (d->ref != 1) { + QPlatformWindowFormatPrivate *newd = new QPlatformWindowFormatPrivate(d); + if (!d->ref.deref()) + delete d; + d = newd; + } +} + +/*! + Constructs a copy of \a other. +*/ + +QPlatformWindowFormat::QPlatformWindowFormat(const QPlatformWindowFormat &other) +{ + d = other.d; + d->ref.ref(); +} + +/*! + Assigns \a other to this object. +*/ + +QPlatformWindowFormat &QPlatformWindowFormat::operator=(const QPlatformWindowFormat &other) +{ + if (d != other.d) { + other.d->ref.ref(); + if (!d->ref.deref()) + delete d; + d = other.d; + } + return *this; +} + +/*! + Destroys the QGLFormat. +*/ +QPlatformWindowFormat::~QPlatformWindowFormat() +{ + if (!d->ref.deref()) + delete d; +} + +/*! + \fn bool QGLFormat::doubleBuffer() const + + Returns true if double buffering is enabled; otherwise returns + false. Double buffering is enabled by default. + + \sa setDoubleBuffer() +*/ + +/*! + If \a enable is true sets double buffering; otherwise sets single + buffering. + + Double buffering is enabled by default. + + Double buffering is a technique where graphics are rendered on an + off-screen buffer and not directly to the screen. When the drawing + has been completed, the program calls a swapBuffers() function to + exchange the screen contents with the buffer. The result is + flicker-free drawing and often better performance. + + \sa doubleBuffer(), QGLContext::swapBuffers(), + QGLWidget::swapBuffers() +*/ + +void QPlatformWindowFormat::setDoubleBuffer(bool enable) +{ + setOption(enable ? QPlatformWindowFormat::DoubleBuffer : QPlatformWindowFormat::SingleBuffer); +} + + +/*! + \fn bool QGLFormat::depth() const + + Returns true if the depth buffer is enabled; otherwise returns + false. The depth buffer is enabled by default. + + \sa setDepth(), setDepthBufferSize() +*/ + +/*! + If \a enable is true enables the depth buffer; otherwise disables + the depth buffer. + + The depth buffer is enabled by default. + + The purpose of a depth buffer (or Z-buffering) is to remove hidden + surfaces. Pixels are assigned Z values based on the distance to + the viewer. A pixel with a high Z value is closer to the viewer + than a pixel with a low Z value. This information is used to + decide whether to draw a pixel or not. + + \sa depth(), setDepthBufferSize() +*/ + +void QPlatformWindowFormat::setDepth(bool enable) +{ + setOption(enable ? QPlatformWindowFormat::DepthBuffer : QPlatformWindowFormat::NoDepthBuffer); +} + + +/*! + \fn bool QGLFormat::rgba() const + + Returns true if RGBA color mode is set. Returns false if color + index mode is set. The default color mode is RGBA. + + \sa setRgba() +*/ + +/*! + If \a enable is true sets RGBA mode. If \a enable is false sets + color index mode. + + The default color mode is RGBA. + + RGBA is the preferred mode for most OpenGL applications. In RGBA + color mode you specify colors as red + green + blue + alpha + quadruplets. + + In color index mode you specify an index into a color lookup + table. + + \sa rgba() +*/ + +void QPlatformWindowFormat::setRgba(bool enable) +{ + setOption(enable ? QPlatformWindowFormat::Rgba : QPlatformWindowFormat::ColorIndex); +} + + +/*! + \fn bool QGLFormat::alpha() const + + Returns true if the alpha buffer in the framebuffer is enabled; + otherwise returns false. The alpha buffer is disabled by default. + + \sa setAlpha(), setAlphaBufferSize() +*/ + +/*! + If \a enable is true enables the alpha buffer; otherwise disables + the alpha buffer. + + The alpha buffer is disabled by default. + + The alpha buffer is typically used for implementing transparency + or translucency. The A in RGBA specifies the transparency of a + pixel. + + \sa alpha(), setAlphaBufferSize() +*/ + +void QPlatformWindowFormat::setAlpha(bool enable) +{ + setOption(enable ? QPlatformWindowFormat::AlphaChannel : QPlatformWindowFormat::NoAlphaChannel); +} + + +/*! + \fn bool QGLFormat::accum() const + + Returns true if the accumulation buffer is enabled; otherwise + returns false. The accumulation buffer is disabled by default. + + \sa setAccum(), setAccumBufferSize() +*/ + +/*! + If \a enable is true enables the accumulation buffer; otherwise + disables the accumulation buffer. + + The accumulation buffer is disabled by default. + + The accumulation buffer is used to create blur effects and + multiple exposures. + + \sa accum(), setAccumBufferSize() +*/ + +void QPlatformWindowFormat::setAccum(bool enable) +{ + setOption(enable ? QPlatformWindowFormat::AccumBuffer : QPlatformWindowFormat::NoAccumBuffer); +} + + +/*! + \fn bool QGLFormat::stencil() const + + Returns true if the stencil buffer is enabled; otherwise returns + false. The stencil buffer is enabled by default. + + \sa setStencil(), setStencilBufferSize() +*/ + +/*! + If \a enable is true enables the stencil buffer; otherwise + disables the stencil buffer. + + The stencil buffer is enabled by default. + + The stencil buffer masks certain parts of the drawing area so that + masked parts are not drawn on. + + \sa stencil(), setStencilBufferSize() +*/ + +void QPlatformWindowFormat::setStencil(bool enable) +{ + setOption(enable ? QPlatformWindowFormat::StencilBuffer: QPlatformWindowFormat::NoStencilBuffer); +} + + +/*! + \fn bool QGLFormat::stereo() const + + Returns true if stereo buffering is enabled; otherwise returns + false. Stereo buffering is disabled by default. + + \sa setStereo() +*/ + +/*! + If \a enable is true enables stereo buffering; otherwise disables + stereo buffering. + + Stereo buffering is disabled by default. + + Stereo buffering provides extra color buffers to generate left-eye + and right-eye images. + + \sa stereo() +*/ + +void QPlatformWindowFormat::setStereo(bool enable) +{ + setOption(enable ? QPlatformWindowFormat::StereoBuffers : QPlatformWindowFormat::NoStereoBuffers); +} + + +/*! + \fn bool QGLFormat::directRendering() const + + Returns true if direct rendering is enabled; otherwise returns + false. + + Direct rendering is enabled by default. + + \sa setDirectRendering() +*/ + +/*! + If \a enable is true enables direct rendering; otherwise disables + direct rendering. + + Direct rendering is enabled by default. + + Enabling this option will make OpenGL bypass the underlying window + system and render directly from hardware to the screen, if this is + supported by the system. + + \sa directRendering() +*/ + +void QPlatformWindowFormat::setDirectRendering(bool enable) +{ + setOption(enable ? QPlatformWindowFormat::DirectRendering : QPlatformWindowFormat::IndirectRendering); +} + +/*! + \fn bool QGLFormat::sampleBuffers() const + + Returns true if multisample buffer support is enabled; otherwise + returns false. + + The multisample buffer is disabled by default. + + \sa setSampleBuffers() +*/ + +/*! + If \a enable is true, a GL context with multisample buffer support + is picked; otherwise ignored. + + \sa sampleBuffers(), setSamples(), samples() +*/ +void QPlatformWindowFormat::setSampleBuffers(bool enable) +{ + setOption(enable ? QPlatformWindowFormat::SampleBuffers : QPlatformWindowFormat::NoSampleBuffers); +} + +/*! + Returns the number of samples per pixel when multisampling is + enabled. By default, the highest number of samples that is + available is used. + + \sa setSampleBuffers(), sampleBuffers(), setSamples() +*/ +int QPlatformWindowFormat::samples() const +{ + return d->numSamples; +} + +/*! + Set the preferred number of samples per pixel when multisampling + is enabled to \a numSamples. By default, the highest number of + samples available is used. + + \sa setSampleBuffers(), sampleBuffers(), samples() +*/ +void QPlatformWindowFormat::setSamples(int numSamples) +{ + detach(); + if (numSamples < 0) { + qWarning("QGLFormat::setSamples: Cannot have negative number of samples per pixel %d", numSamples); + return; + } + d->numSamples = numSamples; + setSampleBuffers(numSamples > 0); +} + +/*! + \since 4.2 + + Set the preferred swap interval. This can be used to sync the GL + drawing into a system window to the vertical refresh of the screen. + Setting an \a interval value of 0 will turn the vertical refresh syncing + off, any value higher than 0 will turn the vertical syncing on. + + Under Windows and under X11, where the \c{WGL_EXT_swap_control} + and \c{GLX_SGI_video_sync} extensions are used, the \a interval + parameter can be used to set the minimum number of video frames + that are displayed before a buffer swap will occur. In effect, + setting the \a interval to 10, means there will be 10 vertical + retraces between every buffer swap. + + Under Windows the \c{WGL_EXT_swap_control} extension has to be present, + and under X11 the \c{GLX_SGI_video_sync} extension has to be present. +*/ +void QPlatformWindowFormat::setSwapInterval(int interval) +{ + detach(); + d->swapInterval = interval; +} + +/*! + \since 4.2 + + Returns the currently set swap interval. -1 is returned if setting + the swap interval isn't supported in the system GL implementation. +*/ +int QPlatformWindowFormat::swapInterval() const +{ + return d->swapInterval; +} + +///*! +// \fn bool QGLFormat::hasOverlay() const + +// Returns true if overlay plane is enabled; otherwise returns false. + +// Overlay is disabled by default. + +// \sa setOverlay() +//*/ + +///*! +// If \a enable is true enables an overlay plane; otherwise disables +// the overlay plane. + +// Enabling the overlay plane will cause QGLWidget to create an +// additional context in an overlay plane. See the QGLWidget +// documentation for further information. + +// \sa hasOverlay() +//*/ + +//void QPlatformWindowFormat::setOverlay(bool enable) +//{ +// setOption(enable ? QPlatformWindowFormat::HasOverlay : QPlatformWindowFormat::NoOverlay); +//} + +/*! + Sets the format option to \a opt. + + \sa testOption() +*/ + +void QPlatformWindowFormat::setOption(QPlatformWindowFormat::FormatOptions opt) +{ + detach(); + if (opt & 0xffff) + d->opts |= opt; + else + d->opts &= ~(opt >> 16); +} + + + +/*! + Returns true if format option \a opt is set; otherwise returns false. + + \sa setOption() +*/ + +bool QPlatformWindowFormat::testOption(QPlatformWindowFormat::FormatOptions opt) const +{ + if (opt & 0xffff) + return (d->opts & opt) != 0; + else + return (d->opts & (opt >> 16)) == 0; +} + +/*! + Set the minimum depth buffer size to \a size. + + \sa depthBufferSize(), setDepth(), depth() +*/ +void QPlatformWindowFormat::setDepthBufferSize(int size) +{ + detach(); + if (size < 0) { + qWarning("QGLFormat::setDepthBufferSize: Cannot set negative depth buffer size %d", size); + return; + } + d->depthSize = size; + setDepth(size > 0); +} + +/*! + Returns the depth buffer size. + + \sa depth(), setDepth(), setDepthBufferSize() +*/ +int QPlatformWindowFormat::depthBufferSize() const +{ + return d->depthSize; +} + +/*! + \since 4.2 + + Set the preferred red buffer size to \a size. + + \sa setGreenBufferSize(), setBlueBufferSize(), setAlphaBufferSize() +*/ +void QPlatformWindowFormat::setRedBufferSize(int size) +{ + detach(); + if (size < 0) { + qWarning("QGLFormat::setRedBufferSize: Cannot set negative red buffer size %d", size); + return; + } + d->redSize = size; +} + +/*! + \since 4.2 + + Returns the red buffer size. + + \sa setRedBufferSize() +*/ +int QPlatformWindowFormat::redBufferSize() const +{ + return d->redSize; +} + +/*! + \since 4.2 + + Set the preferred green buffer size to \a size. + + \sa setRedBufferSize(), setBlueBufferSize(), setAlphaBufferSize() +*/ +void QPlatformWindowFormat::setGreenBufferSize(int size) +{ + detach(); + if (size < 0) { + qWarning("QGLFormat::setGreenBufferSize: Cannot set negative green buffer size %d", size); + return; + } + d->greenSize = size; +} + +/*! + \since 4.2 + + Returns the green buffer size. + + \sa setGreenBufferSize() +*/ +int QPlatformWindowFormat::greenBufferSize() const +{ + return d->greenSize; +} + +/*! + \since 4.2 + + Set the preferred blue buffer size to \a size. + + \sa setRedBufferSize(), setGreenBufferSize(), setAlphaBufferSize() +*/ +void QPlatformWindowFormat::setBlueBufferSize(int size) +{ + detach(); + if (size < 0) { + qWarning("QGLFormat::setBlueBufferSize: Cannot set negative blue buffer size %d", size); + return; + } + d->blueSize = size; +} + +/*! + \since 4.2 + + Returns the blue buffer size. + + \sa setBlueBufferSize() +*/ +int QPlatformWindowFormat::blueBufferSize() const +{ + return d->blueSize; +} + +/*! + Set the preferred alpha buffer size to \a size. + This function implicitly enables the alpha channel. + + \sa setRedBufferSize(), setGreenBufferSize(), alphaBufferSize() +*/ +void QPlatformWindowFormat::setAlphaBufferSize(int size) +{ + detach(); + if (size < 0) { + qWarning("QGLFormat::setAlphaBufferSize: Cannot set negative alpha buffer size %d", size); + return; + } + d->alphaSize = size; + setAlpha(size > 0); +} + +/*! + Returns the alpha buffer size. + + \sa alpha(), setAlpha(), setAlphaBufferSize() +*/ +int QPlatformWindowFormat::alphaBufferSize() const +{ + return d->alphaSize; +} + +/*! + Set the preferred accumulation buffer size, where \a size is the + bit depth for each RGBA component. + + \sa accum(), setAccum(), accumBufferSize() +*/ +void QPlatformWindowFormat::setAccumBufferSize(int size) +{ + detach(); + if (size < 0) { + qWarning("QGLFormat::setAccumBufferSize: Cannot set negative accumulate buffer size %d", size); + return; + } + d->accumSize = size; + setAccum(size > 0); +} + +/*! + Returns the accumulation buffer size. + + \sa setAccumBufferSize(), accum(), setAccum() +*/ +int QPlatformWindowFormat::accumBufferSize() const +{ + return d->accumSize; +} + +/*! + Set the preferred stencil buffer size to \a size. + + \sa stencilBufferSize(), setStencil(), stencil() +*/ +void QPlatformWindowFormat::setStencilBufferSize(int size) +{ + detach(); + if (size < 0) { + qWarning("QGLFormat::setStencilBufferSize: Cannot set negative stencil buffer size %d", size); + return; + } + d->stencilSize = size; + setStencil(size > 0); +} + +/*! + Returns the stencil buffer size. + + \sa stencil(), setStencil(), setStencilBufferSize() +*/ +int QPlatformWindowFormat::stencilBufferSize() const +{ + return d->stencilSize; +} + +/*! + \since 4.7 + + Set the OpenGL version to the \a major and \a minor numbers. If a + context compatible with the requested OpenGL version cannot be + created, a context compatible with version 1.x is created instead. + + \sa majorVersion(), minorVersion() +*/ +void QPlatformWindowFormat::setVersion(int major, int minor) +{ + if (major < 1 || minor < 0) { + qWarning("QGLFormat::setVersion: Cannot set zero or negative version number %d.%d", major, minor); + return; + } + detach(); + d->majorVersion = major; + d->minorVersion = minor; +} + +/*! + \since 4.7 + + Returns the OpenGL major version. + + \sa setVersion(), minorVersion() +*/ +int QPlatformWindowFormat::majorVersion() const +{ + return d->majorVersion; +} + +/*! + \since 4.7 + + Returns the OpenGL minor version. + + \sa setVersion(), majorVersion() +*/ +int QPlatformWindowFormat::minorVersion() const +{ + return d->minorVersion; +} + +/*! + \enum QGLFormat::OpenGLContextProfile + \since 4.7 + + This enum describes the OpenGL context profiles that can be + specified for contexts implementing OpenGL version 3.2 or + higher. These profiles are different from OpenGL ES profiles. + + \value NoProfile OpenGL version is lower than 3.2. + \value CoreProfile Functionality deprecated in OpenGL version 3.0 is not available. + \value CompatibilityProfile Functionality from earlier OpenGL versions is available. +*/ + +/*! + \since 4.7 + + Set the OpenGL context profile to \a profile. The \a profile is + ignored if the requested OpenGL version is less than 3.2. + + \sa profile() +*/ +void QPlatformWindowFormat::setProfile(OpenGLContextProfile profile) +{ + detach(); + d->profile = profile; +} + +/*! + \since 4.7 + + Returns the OpenGL context profile. + + \sa setProfile() +*/ +QPlatformWindowFormat::OpenGLContextProfile QPlatformWindowFormat::profile() const +{ + return d->profile; +} + + +/*! + \fn bool QGLFormat::hasOpenGL() + + Returns true if the window system has any OpenGL support; + otherwise returns false. + + \warning This function must not be called until the QApplication + object has been created. +*/ + + + +/*! + \fn bool QGLFormat::hasOpenGLOverlays() + + Returns true if the window system supports OpenGL overlays; + otherwise returns false. + + \warning This function must not be called until the QApplication + object has been created. +*/ + +QPlatformWindowFormat::OpenGLVersionFlags Q_AUTOTEST_EXPORT qOpenGLVersionFlagsFromString(const QString &versionString) +{ + QPlatformWindowFormat::OpenGLVersionFlags versionFlags = QPlatformWindowFormat::OpenGL_Version_None; + + if (versionString.startsWith(QLatin1String("OpenGL ES"))) { + QStringList parts = versionString.split(QLatin1Char(' ')); + if (parts.size() >= 3) { + if (parts[2].startsWith(QLatin1String("1."))) { + if (parts[1].endsWith(QLatin1String("-CM"))) { + versionFlags |= QPlatformWindowFormat::OpenGL_ES_Common_Version_1_0 | + QPlatformWindowFormat::OpenGL_ES_CommonLite_Version_1_0; + if (parts[2].startsWith(QLatin1String("1.1"))) + versionFlags |= QPlatformWindowFormat::OpenGL_ES_Common_Version_1_1 | + QPlatformWindowFormat::OpenGL_ES_CommonLite_Version_1_1; + } else { + // Not -CM, must be CL, CommonLite + versionFlags |= QPlatformWindowFormat::OpenGL_ES_CommonLite_Version_1_0; + if (parts[2].startsWith(QLatin1String("1.1"))) + versionFlags |= QPlatformWindowFormat::OpenGL_ES_CommonLite_Version_1_1; + } + } else { + // OpenGL ES version 2.0 or higher + versionFlags |= QPlatformWindowFormat::OpenGL_ES_Version_2_0; + } + } else { + // if < 3 parts to the name, it is an unrecognised OpenGL ES + qWarning("Unrecognised OpenGL ES version"); + } + } else { + // not ES, regular OpenGL, the version numbers are first in the string + if (versionString.startsWith(QLatin1String("1."))) { + switch (versionString[2].toAscii()) { + case '5': + versionFlags |= QPlatformWindowFormat::OpenGL_Version_1_5; + case '4': + versionFlags |= QPlatformWindowFormat::OpenGL_Version_1_4; + case '3': + versionFlags |= QPlatformWindowFormat::OpenGL_Version_1_3; + case '2': + versionFlags |= QPlatformWindowFormat::OpenGL_Version_1_2; + case '1': + versionFlags |= QPlatformWindowFormat::OpenGL_Version_1_1; + default: + break; + } + } else if (versionString.startsWith(QLatin1String("2."))) { + versionFlags |= QPlatformWindowFormat::OpenGL_Version_1_1 | + QPlatformWindowFormat::OpenGL_Version_1_2 | + QPlatformWindowFormat::OpenGL_Version_1_3 | + QPlatformWindowFormat::OpenGL_Version_1_4 | + QPlatformWindowFormat::OpenGL_Version_1_5 | + QPlatformWindowFormat::OpenGL_Version_2_0; + if (versionString[2].toAscii() == '1') + versionFlags |= QPlatformWindowFormat::OpenGL_Version_2_1; + } else if (versionString.startsWith(QLatin1String("3."))) { + versionFlags |= QPlatformWindowFormat::OpenGL_Version_1_1 | + QPlatformWindowFormat::OpenGL_Version_1_2 | + QPlatformWindowFormat::OpenGL_Version_1_3 | + QPlatformWindowFormat::OpenGL_Version_1_4 | + QPlatformWindowFormat::OpenGL_Version_1_5 | + QPlatformWindowFormat::OpenGL_Version_2_0 | + QPlatformWindowFormat::OpenGL_Version_2_1 | + QPlatformWindowFormat::OpenGL_Version_3_0; + switch (versionString[2].toAscii()) { + case '3': + versionFlags |= QPlatformWindowFormat::OpenGL_Version_3_3; + case '2': + versionFlags |= QPlatformWindowFormat::OpenGL_Version_3_2; + case '1': + versionFlags |= QPlatformWindowFormat::OpenGL_Version_3_1; + case '0': + break; + default: + versionFlags |= QPlatformWindowFormat::OpenGL_Version_3_1 | + QPlatformWindowFormat::OpenGL_Version_3_2 | + QPlatformWindowFormat::OpenGL_Version_3_3; + break; + } + } else if (versionString.startsWith(QLatin1String("4."))) { + versionFlags |= QPlatformWindowFormat::OpenGL_Version_1_1 | + QPlatformWindowFormat::OpenGL_Version_1_2 | + QPlatformWindowFormat::OpenGL_Version_1_3 | + QPlatformWindowFormat::OpenGL_Version_1_4 | + QPlatformWindowFormat::OpenGL_Version_1_5 | + QPlatformWindowFormat::OpenGL_Version_2_0 | + QPlatformWindowFormat::OpenGL_Version_2_1 | + QPlatformWindowFormat::OpenGL_Version_3_0 | + QPlatformWindowFormat::OpenGL_Version_3_1 | + QPlatformWindowFormat::OpenGL_Version_3_2 | + QPlatformWindowFormat::OpenGL_Version_3_3 | + QPlatformWindowFormat::OpenGL_Version_4_0; + } else { + versionFlags |= QPlatformWindowFormat::OpenGL_Version_1_1 | + QPlatformWindowFormat::OpenGL_Version_1_2 | + QPlatformWindowFormat::OpenGL_Version_1_3 | + QPlatformWindowFormat::OpenGL_Version_1_4 | + QPlatformWindowFormat::OpenGL_Version_1_5 | + QPlatformWindowFormat::OpenGL_Version_2_0 | + QPlatformWindowFormat::OpenGL_Version_2_1 | + QPlatformWindowFormat::OpenGL_Version_3_0 | + QPlatformWindowFormat::OpenGL_Version_3_1 | + QPlatformWindowFormat::OpenGL_Version_3_2 | + QPlatformWindowFormat::OpenGL_Version_3_3 | + QPlatformWindowFormat::OpenGL_Version_4_0; + } + } + return versionFlags; +} + +/*! + \enum QGLFormat::OpenGLVersionFlag + \since 4.2 + + This enum describes the various OpenGL versions that are + recognized by Qt. Use the QGLFormat::openGLVersionFlags() function + to identify which versions that are supported at runtime. + + \value OpenGL_Version_None If no OpenGL is present or if no OpenGL context is current. + + \value OpenGL_Version_1_1 OpenGL version 1.1 or higher is present. + + \value OpenGL_Version_1_2 OpenGL version 1.2 or higher is present. + + \value OpenGL_Version_1_3 OpenGL version 1.3 or higher is present. + + \value OpenGL_Version_1_4 OpenGL version 1.4 or higher is present. + + \value OpenGL_Version_1_5 OpenGL version 1.5 or higher is present. + + \value OpenGL_Version_2_0 OpenGL version 2.0 or higher is present. + Note that version 2.0 supports all the functionality of version 1.5. + + \value OpenGL_Version_2_1 OpenGL version 2.1 or higher is present. + + \value OpenGL_Version_3_0 OpenGL version 3.0 or higher is present. + + \value OpenGL_Version_3_1 OpenGL version 3.1 or higher is present. + Note that OpenGL version 3.1 or higher does not necessarily support all the features of + version 3.0 and lower. + + \value OpenGL_Version_3_2 OpenGL version 3.2 or higher is present. + + \value OpenGL_ES_CommonLite_Version_1_0 OpenGL ES version 1.0 Common Lite or higher is present. + + \value OpenGL_ES_Common_Version_1_0 OpenGL ES version 1.0 Common or higher is present. + The Common profile supports all the features of Common Lite. + + \value OpenGL_ES_CommonLite_Version_1_1 OpenGL ES version 1.1 Common Lite or higher is present. + + \value OpenGL_ES_Common_Version_1_1 OpenGL ES version 1.1 Common or higher is present. + The Common profile supports all the features of Common Lite. + + \value OpenGL_ES_Version_2_0 OpenGL ES version 2.0 or higher is present. + Note that OpenGL ES version 2.0 does not support all the features of OpenGL ES 1.x. + So if OpenGL_ES_Version_2_0 is returned, none of the ES 1.x flags are returned. + + See also \l{http://www.opengl.org} for more information about the different + revisions of OpenGL. + + \sa openGLVersionFlags() +*/ + +/*! + \since 4.2 + + Identifies, at runtime, which OpenGL versions that are supported + by the current platform. + + Note that if OpenGL version 1.5 is supported, its predecessors + (i.e., version 1.4 and lower) are also supported. To identify the + support of a particular feature, like multi texturing, test for + the version in which the feature was first introduced (i.e., + version 1.3 in the case of multi texturing) to adapt to the largest + possible group of runtime platforms. + + This function needs a valid current OpenGL context to work; + otherwise it will return OpenGL_Version_None. + + \sa hasOpenGL(), hasOpenGLOverlays() +*/ +QPlatformWindowFormat::OpenGLVersionFlags QPlatformWindowFormat::openGLVersionFlags() +{ +// static bool cachedDefault = false; + static OpenGLVersionFlags defaultVersionFlags = OpenGL_Version_None; +// QGLContext *currentCtx = const_cast(QGLContext::currentContext()); +// QGLTemporaryContext *tmpContext = 0; + +// if (currentCtx && currentCtx->d_func()->version_flags_cached) +// return currentCtx->d_func()->version_flags; + +// if (!currentCtx) { +// if (cachedDefault) { +// return defaultVersionFlags; +// } else { +// if (!hasOpenGL()) +// return defaultVersionFlags; +// tmpContext = new QGLTemporaryContext; +// cachedDefault = true; +// } +// } + +// QString versionString(QLatin1String(reinterpret_cast(glGetString(GL_VERSION)))); +// OpenGLVersionFlags versionFlags = qOpenGLVersionFlagsFromString(versionString); +// if (currentCtx) { +// currentCtx->d_func()->version_flags_cached = true; +// currentCtx->d_func()->version_flags = versionFlags; +// } +// if (tmpContext) { +// defaultVersionFlags = versionFlags; +// delete tmpContext; +// } + +// return versionFlags; + return defaultVersionFlags; +} + + +/*! + Returns the default QGLFormat for the application. All QGLWidget + objects that are created use this format unless another format is + specified, e.g. when they are constructed. + + If no special default format has been set using + setDefaultFormat(), the default format is the same as that created + with QGLFormat(). + + \sa setDefaultFormat() +*/ + +QPlatformWindowFormat QPlatformWindowFormat::defaultFormat() +{ + return *q_platformwindow_default_format(); +} + +/*! + Sets a new default QGLFormat for the application to \a f. For + example, to set single buffering as the default instead of double + buffering, your main() might contain code like this: + \snippet doc/src/snippets/code/src_opengl_qgl.cpp 4 + + \sa defaultFormat() +*/ + +void QPlatformWindowFormat::setDefaultFormat(const QPlatformWindowFormat &f) +{ + *q_platformwindow_default_format() = f; +} + + +/*! + Returns the default QGLFormat for overlay contexts. + + The default overlay format is: + \list + \i \link setDoubleBuffer() Double buffer:\endlink Disabled. + \i \link setDepth() Depth buffer:\endlink Disabled. + \i \link setRgba() RGBA:\endlink Disabled (i.e., color index enabled). + \i \link setAlpha() Alpha channel:\endlink Disabled. + \i \link setAccum() Accumulator buffer:\endlink Disabled. + \i \link setStencil() Stencil buffer:\endlink Disabled. + \i \link setStereo() Stereo:\endlink Disabled. + \i \link setDirectRendering() Direct rendering:\endlink Enabled. + \i \link setOverlay() Overlay:\endlink Disabled. + \i \link setSampleBuffers() Multisample buffers:\endlink Disabled. + \i \link setPlane() Plane:\endlink 1 (i.e., first overlay plane). + \endlist + + \sa setDefaultFormat() +*/ + +//QPlatformWindowFormat QPlatformWindowFormat::defaultOverlayFormat() +//{ +// return *defaultOverlayFormatInstance(); +//} + +///*! +// Sets a new default QGLFormat for overlay contexts to \a f. This +// format is used whenever a QGLWidget is created with a format that +// hasOverlay() enabled. + +// For example, to get a double buffered overlay context (if +// available), use code like this: + +// \snippet doc/src/snippets/code/src_opengl_qgl.cpp 5 + +// As usual, you can find out after widget creation whether the +// underlying OpenGL system was able to provide the requested +// specification: + +// \snippet doc/src/snippets/code/src_opengl_qgl.cpp 6 + +// \sa defaultOverlayFormat() +//*/ + +//void QPlatformWindowFormat::setDefaultOverlayFormat(const QPlatformWindowFormat &f) +//{ +// QPlatformWindowFormat *defaultFormat = defaultOverlayFormatInstance(); +// *defaultFormat = f; +// // Make sure the user doesn't request that the overlays themselves +// // have overlays, since it is unlikely that the system supports +// // infinitely many planes... +// defaultFormat->setOverlay(false); +//} + + +/*! + Returns true if all the options of the two QGLFormat objects + \a a and \a b are equal; otherwise returns false. + + \relates QGLFormat +*/ + +bool operator==(const QPlatformWindowFormat& a, const QPlatformWindowFormat& b) +{ + return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts + && a.d->alphaSize == b.d->alphaSize + && a.d->accumSize == b.d->accumSize + && a.d->stencilSize == b.d->stencilSize + && a.d->depthSize == b.d->depthSize + && a.d->redSize == b.d->redSize + && a.d->greenSize == b.d->greenSize + && a.d->blueSize == b.d->blueSize + && a.d->numSamples == b.d->numSamples + && a.d->swapInterval == b.d->swapInterval + && a.d->majorVersion == b.d->majorVersion + && a.d->minorVersion == b.d->minorVersion + && a.d->profile == b.d->profile); +} + + +/*! + Returns false if all the options of the two QGLFormat objects + \a a and \a b are equal; otherwise returns true. + + \relates QGLFormat +*/ + +bool operator!=(const QPlatformWindowFormat& a, const QPlatformWindowFormat& b) +{ + return !(a == b); +} diff --git a/src/gui/kernel/qplatformwindowformat_qpa.h b/src/gui/kernel/qplatformwindowformat_qpa.h new file mode 100644 index 0000000..929ad7a --- /dev/null +++ b/src/gui/kernel/qplatformwindowformat_qpa.h @@ -0,0 +1,256 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QPLATFORMWINDOWFORMAT_QPA_H +#define QPLATFORMWINDOWFORMAT_QPA_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QPlatformWindowFormatPrivate; + +class Q_GUI_EXPORT QPlatformWindowFormat +{ +public: + enum FormatOption { + DoubleBuffer = 0x0001, + DepthBuffer = 0x0002, + Rgba = 0x0004, + AlphaChannel = 0x0008, + AccumBuffer = 0x0010, + StencilBuffer = 0x0020, + StereoBuffers = 0x0040, + DirectRendering = 0x0080, + HasOverlay = 0x0100, + SampleBuffers = 0x0200, + DeprecatedFunctions = 0x0400, + SingleBuffer = DoubleBuffer << 16, + NoDepthBuffer = DepthBuffer << 16, + ColorIndex = Rgba << 16, + NoAlphaChannel = AlphaChannel << 16, + NoAccumBuffer = AccumBuffer << 16, + NoStencilBuffer = StencilBuffer << 16, + NoStereoBuffers = StereoBuffers << 16, + IndirectRendering = DirectRendering << 16, + NoOverlay = HasOverlay << 16, + NoSampleBuffers = SampleBuffers << 16, + NoDeprecatedFunctions = DeprecatedFunctions << 16 + }; + Q_DECLARE_FLAGS(FormatOptions, FormatOption) + + enum OpenGLVersionFlag { + OpenGL_Version_None = 0x00000000, + OpenGL_Version_1_1 = 0x00000001, + OpenGL_Version_1_2 = 0x00000002, + OpenGL_Version_1_3 = 0x00000004, + OpenGL_Version_1_4 = 0x00000008, + OpenGL_Version_1_5 = 0x00000010, + OpenGL_Version_2_0 = 0x00000020, + OpenGL_Version_2_1 = 0x00000040, + OpenGL_ES_Common_Version_1_0 = 0x00000080, + OpenGL_ES_CommonLite_Version_1_0 = 0x00000100, + OpenGL_ES_Common_Version_1_1 = 0x00000200, + OpenGL_ES_CommonLite_Version_1_1 = 0x00000400, + OpenGL_ES_Version_2_0 = 0x00000800, + OpenGL_Version_3_0 = 0x00001000, + OpenGL_Version_3_1 = 0x00002000, + OpenGL_Version_3_2 = 0x00004000, + OpenGL_Version_3_3 = 0x00008000, + OpenGL_Version_4_0 = 0x00010000 + }; + Q_DECLARE_FLAGS(OpenGLVersionFlags, OpenGLVersionFlag) + + QPlatformWindowFormat(); + QPlatformWindowFormat(FormatOptions options); + QPlatformWindowFormat(const QPlatformWindowFormat &other); + QPlatformWindowFormat &operator=(const QPlatformWindowFormat &other); + ~QPlatformWindowFormat(); + + void setDepthBufferSize(int size); + int depthBufferSize() const; + + void setAccumBufferSize(int size); + int accumBufferSize() const; + + void setRedBufferSize(int size); + int redBufferSize() const; + + void setGreenBufferSize(int size); + int greenBufferSize() const; + + void setBlueBufferSize(int size); + int blueBufferSize() const; + + void setAlphaBufferSize(int size); + int alphaBufferSize() const; + + void setStencilBufferSize(int size); + int stencilBufferSize() const; + + void setSampleBuffers(bool enable); + bool sampleBuffers() const; + + void setSamples(int numSamples); + int samples() const; + + void setSwapInterval(int interval); + int swapInterval() const; + + bool doubleBuffer() const; + void setDoubleBuffer(bool enable); + bool depth() const; + void setDepth(bool enable); + bool rgba() const; + void setRgba(bool enable); + bool alpha() const; + void setAlpha(bool enable); + bool accum() const; + void setAccum(bool enable); + bool stencil() const; + void setStencil(bool enable); + bool stereo() const; + void setStereo(bool enable); + bool directRendering() const; + void setDirectRendering(bool enable); +// bool hasOverlay() const; +// void setOverlay(bool enable); + + void setOption(QPlatformWindowFormat::FormatOptions opt); + bool testOption(QPlatformWindowFormat::FormatOptions opt) const; + + static QPlatformWindowFormat defaultFormat(); + static void setDefaultFormat(const QPlatformWindowFormat& f); + +// static QPlatformWindowFormat defaultOverlayFormat(); +// static void setDefaultOverlayFormat(const QPlatformWindowFormat& f); + + static bool hasOpenGL(); + static bool hasOpenGLOverlays(); + + void setVersion(int major, int minor); + int majorVersion() const; + int minorVersion() const; + + enum OpenGLContextProfile { + NoProfile, + CoreProfile, + CompatibilityProfile + }; + + void setProfile(OpenGLContextProfile profile); + OpenGLContextProfile profile() const; + + + static OpenGLVersionFlags openGLVersionFlags(); + +private: + QPlatformWindowFormatPrivate *d; + + void detach(); + + friend Q_GUI_EXPORT bool operator==(const QPlatformWindowFormat&, const QPlatformWindowFormat&); + friend Q_GUI_EXPORT bool operator!=(const QPlatformWindowFormat&, const QPlatformWindowFormat&); +}; + +Q_GUI_EXPORT bool operator==(const QPlatformWindowFormat&, const QPlatformWindowFormat&); +Q_GUI_EXPORT bool operator!=(const QPlatformWindowFormat&, const QPlatformWindowFormat&); + +Q_DECLARE_OPERATORS_FOR_FLAGS(QPlatformWindowFormat::FormatOptions) +Q_DECLARE_OPERATORS_FOR_FLAGS(QPlatformWindowFormat::OpenGLVersionFlags) + +inline bool QPlatformWindowFormat::doubleBuffer() const +{ + return testOption(QPlatformWindowFormat::DoubleBuffer); +} + +inline bool QPlatformWindowFormat::depth() const +{ + return testOption(QPlatformWindowFormat::DepthBuffer); +} + +inline bool QPlatformWindowFormat::rgba() const +{ + return testOption(QPlatformWindowFormat::Rgba); +} + +inline bool QPlatformWindowFormat::alpha() const +{ + return testOption(QPlatformWindowFormat::AlphaChannel); +} + +inline bool QPlatformWindowFormat::accum() const +{ + return testOption(QPlatformWindowFormat::AccumBuffer); +} + +inline bool QPlatformWindowFormat::stencil() const +{ + return testOption(QPlatformWindowFormat::StencilBuffer); +} + +inline bool QPlatformWindowFormat::stereo() const +{ + return testOption(QPlatformWindowFormat::StereoBuffers); +} + +inline bool QPlatformWindowFormat::directRendering() const +{ + return testOption(QPlatformWindowFormat::DirectRendering); +} + +//inline bool QPlatformWindowFormat::hasOverlay() const +//{ +// return testOption(QPlatformWindowFormat::HasOverlay); +//} + +inline bool QPlatformWindowFormat::sampleBuffers() const +{ + return testOption(QPlatformWindowFormat::SampleBuffers); +} + + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif //QPLATFORMWINDOWFORMAT_QPA_H diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 53b35dd..943da79 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1662,6 +1662,7 @@ void QWidgetPrivate::createTLExtra() #endif #if defined(Q_WS_QPA) x->platformWindow = 0; + x->platformWindowFormat = QPlatformWindowFormat::defaultFormat(); #endif } } @@ -2455,6 +2456,7 @@ void QWidgetPrivate::createWinId(WId winid) q->create(); } #else + Q_UNUSED(winid); q->create(); #endif //Q_WS_QPA @@ -11937,41 +11939,6 @@ QWindowSurface *QWidget::windowSurface() const return bs ? bs->windowSurface : 0; } -#if defined(Q_WS_QPA) -/*! - \preliminary - - Sets the window to be the \a window specified. - The QWidget takes ownership of the \a surface. -*/ -void QWidget::setPlatformWindow(QPlatformWindow *window) -{ - Q_D(QWidget); - - QTLWExtra *topData = d->topData(); - if (topData->platformWindow == window) - return; - - delete topData->platformWindow; - topData->platformWindow = window; -} - -/*! - \preliminary - - Returns the QPlatformWindow this widget will be drawn into. -*/ -QPlatformWindow *QWidget::platformWindow() const -{ - Q_D(const QWidget); - QTLWExtra *extra = d->maybeTopData(); - if (extra && extra->platformWindow) - return extra->platformWindow; - - return 0; -} -#endif //defined(Q_WS_QPA) - void QWidgetPrivate::getLayoutItemMargins(int *left, int *top, int *right, int *bottom) const { if (left) diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index 8e08ce5..c750465 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -56,6 +56,10 @@ #include #include +#ifdef Q_WS_QPA //should this go somewhere else? +#include +#endif + #ifdef QT_INCLUDE_COMPAT #include #endif @@ -631,6 +635,10 @@ public: #if defined(Q_WS_QPA) void setPlatformWindow(QPlatformWindow *window); QPlatformWindow *platformWindow() const; + + void setPlatformWindowFormat(const QPlatformWindowFormat &format); + QPlatformWindowFormat platformWindowFormat() const; + friend class QDesktopScreenWidget; #endif diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 5274c3b..3903124 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -229,6 +229,7 @@ struct QTLWExtra { uint inExpose : 1; // Prevents drawing recursion #elif defined(Q_WS_QPA) QPlatformWindow *platformWindow; + QPlatformWindowFormat platformWindowFormat; #endif }; diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp index 1acf398..4229a05 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -691,6 +691,58 @@ int QWidget::metric(PaintDeviceMetric m) const return val; } +/*! + \preliminary + + Sets the window to be the \a window specified. + The QWidget takes ownership of the \a surface. +*/ +void QWidget::setPlatformWindow(QPlatformWindow *window) +{ + Q_D(QWidget); + + QTLWExtra *topData = d->topData(); + if (topData->platformWindow == window) + return; + + delete topData->platformWindow; + topData->platformWindow = window; +} + +/*! + \preliminary + + Returns the QPlatformWindow this widget will be drawn into. +*/ +QPlatformWindow *QWidget::platformWindow() const +{ + Q_D(const QWidget); + QTLWExtra *extra = d->maybeTopData(); + if (extra && extra->platformWindow) + return extra->platformWindow; + + return 0; +} + +void QWidget::setPlatformWindowFormat(const QPlatformWindowFormat &format) +{ + Q_D(QWidget); + QTLWExtra *topData = d->topData(); + topData->platformWindowFormat = format; +} + +QPlatformWindowFormat QWidget::platformWindowFormat() const +{ + Q_D(const QWidget); + + QTLWExtra *extra = d->maybeTopData(); + if (extra){ + return extra->platformWindowFormat; + } else { + return QPlatformWindowFormat::defaultFormat(); + } +} + void QWidgetPrivate::createSysExtra() { } diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.cpp b/src/plugins/platforms/openkode/qopenkodeintegration.cpp index 52b57d9..eed268e 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.cpp +++ b/src/plugins/platforms/openkode/qopenkodeintegration.cpp @@ -110,10 +110,10 @@ QOpenKODEScreen::QOpenKODEScreen() KDint desktopSize[] = { mode.width, mode.height }; -// if (kdSetDesktopPropertyivNV(kdDesktop, KD_DESKTOPPROPERTY_SIZE_NV, desktopSize)) { -// qErrnoWarning(kdGetError(), "Could not set desktop size"); -// return; -// } + if (kdSetDesktopPropertyivNV(kdDesktop, KD_DESKTOPPROPERTY_SIZE_NV, desktopSize)) { + qErrnoWarning(kdGetError(), "Could not set desktop size"); + return; + } // Once we've set up the desktop and display we don't need them anymore kdReleaseDisplayNV(kdDisplay); diff --git a/src/plugins/platforms/openkode/qopenkodewindow.cpp b/src/plugins/platforms/openkode/qopenkodewindow.cpp index 52117ad..f62eae5 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.cpp +++ b/src/plugins/platforms/openkode/qopenkodewindow.cpp @@ -50,33 +50,243 @@ #include #include #include + +#include #include +QVector q_createConfigAttributesFromFormat(const QPlatformWindowFormat &format) +{ + int redSize = format.redBufferSize(); + int greenSize = format.greenBufferSize(); + int blueSize = format.blueBufferSize(); + int alphaSize = format.alphaBufferSize(); + int depthSize = format.depthBufferSize(); + int stencilSize = format.stencilBufferSize(); + int sampleCount = format.samples(); + + // QPlatformWindowFormat uses a magic value of -1 to indicate "don't care", even when a buffer of that + // type has been requested. So we must check QPlatformWindowFormat's booleans too if size is -1: + if (format.alpha() && alphaSize <= 0) + alphaSize = 1; + if (format.depth() && depthSize <= 0) + depthSize = 1; + if (format.stencil() && stencilSize <= 0) + stencilSize = 1; + if (format.sampleBuffers() && sampleCount <= 0) + sampleCount = 1; + + // We want to make sure 16-bit configs are chosen over 32-bit configs as they will provide + // the best performance. The EGL config selection algorithm is a bit stange in this regard: + // The selection criteria for EGL_BUFFER_SIZE is "AtLeast", so we can't use it to discard + // 32-bit configs completely from the selection. So it then comes to the sorting algorithm. + // The red/green/blue sizes have a sort priority of 3, so they are sorted by first. The sort + // order is special and described as "by larger _total_ number of color bits.". So EGL will + // put 32-bit configs in the list before the 16-bit configs. However, the spec also goes on + // to say "If the requested number of bits in attrib_list for a particular component is 0, + // then the number of bits for that component is not considered". This part of the spec also + // seems to imply that setting the red/green/blue bits to zero means none of the components + // are considered and EGL disregards the entire sorting rule. It then looks to the next + // highest priority rule, which is EGL_BUFFER_SIZE. Despite the selection criteria being + // "AtLeast" for EGL_BUFFER_SIZE, it's sort order is "smaller" meaning 16-bit configs are + // put in the list before 32-bit configs. So, to make sure 16-bit is preffered over 32-bit, + // we must set the red/green/blue sizes to zero. This has an unfortunate consequence that + // if the application sets the red/green/blue size to 5/6/5 on the QPlatformWindowFormat, + // they will probably get a 32-bit config, even when there's an RGB565 config avaliable. + + // Now normalize the values so -1 becomes 0 + redSize = redSize > 0 ? redSize : 0; + greenSize = greenSize > 0 ? greenSize : 0; + blueSize = blueSize > 0 ? blueSize : 0; + alphaSize = alphaSize > 0 ? alphaSize : 0; + depthSize = depthSize > 0 ? depthSize : 0; + stencilSize = stencilSize > 0 ? stencilSize : 0; + sampleCount = sampleCount > 0 ? sampleCount : 0; + + QVector configAttributes; + + configAttributes.append(EGL_RED_SIZE); + configAttributes.append(redSize); + + configAttributes.append(EGL_GREEN_SIZE); + configAttributes.append(greenSize); + + configAttributes.append(EGL_BLUE_SIZE); + configAttributes.append(blueSize); + + configAttributes.append(EGL_ALPHA_SIZE); + configAttributes.append(alphaSize); + + configAttributes.append(EGL_DEPTH_SIZE); + configAttributes.append(depthSize); + + configAttributes.append(EGL_STENCIL_SIZE); + configAttributes.append(stencilSize); + + configAttributes.append(EGL_SAMPLES); + configAttributes.append(sampleCount); + + configAttributes.append(EGL_SAMPLE_BUFFERS); + configAttributes.append(sampleCount? 1:0); + + return configAttributes; +} + +bool q_reduceConfigAttributes(QVector *configAttributes) +{ + int i = -1; + // Reduce the complexity of a configuration request to ask for less + // because the previous request did not result in success. Returns + // true if the complexity was reduced, or false if no further + // reductions in complexity are possible. + + i = configAttributes->indexOf(EGL_SWAP_BEHAVIOR); + if (i >= 0) { + configAttributes->remove(i,2); + } + +#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT + // For OpenVG, we sometimes try to create a surface using a pre-multiplied format. If we can't + // find a config which supports pre-multiplied formats, remove the flag on the surface type: + + i = configAttributes->indexOf(EGL_SURFACE_TYPE); + if (i >= 0) { + EGLint surfaceType = configAttributes->at(i +1); + if (surfaceType & EGL_VG_ALPHA_FORMAT_PRE_BIT) { + surfaceType ^= EGL_VG_ALPHA_FORMAT_PRE_BIT; + configAttributes->replace(i+1,surfaceType); + return true; + } + } +#endif + + // EGL chooses configs with the highest color depth over + // those with smaller (but faster) lower color depths. One + // way around this is to set EGL_BUFFER_SIZE to 16, which + // trumps the others. Of course, there may not be a 16-bit + // config avaliable, so it's the first restraint we remove. + i = configAttributes->indexOf(EGL_BUFFER_SIZE); + if (i >= 0) { + if (configAttributes->at(i+1) == 16) { + configAttributes->remove(i,2); + return true; + } + } + + i = configAttributes->indexOf(EGL_SAMPLE_BUFFERS); + if (i >= 0) { + configAttributes->remove(i,2); + i = configAttributes->indexOf(EGL_SAMPLES); + if (i >= 0) { + configAttributes->remove(i,2); + } + return true; + } + + i = configAttributes->indexOf(EGL_ALPHA_SIZE); + if (i >= 0) { + configAttributes->remove(i,2); +#if defined(EGL_BIND_TO_TEXTURE_RGBA) && defined(EGL_BIND_TO_TEXTURE_RGB) + i = configAttributes->indexOf(EGL_BIND_TO_TEXTURE_RGBA); + if (i >= 0) { + configAttributes->replace(i,EGL_BIND_TO_TEXTURE_RGB); + configAttributes->replace(i+1,TRUE); + + } +#endif + return true; + } + + i = configAttributes->indexOf(EGL_STENCIL_SIZE); + if (i >= 0) { + configAttributes->remove(i,2); + return true; + } + i = configAttributes->indexOf(EGL_DEPTH_SIZE); + if (i >= 0) { + configAttributes->remove(i,2); + return true; + } +#ifdef EGL_BIND_TO_TEXTURE_RGB + i = configAttributes->indexOf(EGL_BIND_TO_TEXTURE_RGB); + if (i >= 0) { + configAttributes->remove(i,2); + return true; + } +#endif + + return false; +} + +EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformWindowFormat &format, EGLenum eglApi) +{ + EGLConfig cfg = 0; + QVector configureAttributes = q_createConfigAttributesFromFormat(format); + configureAttributes.append(EGL_SURFACE_TYPE); + configureAttributes.append(EGL_WINDOW_BIT); + + configureAttributes.append(EGL_RENDERABLE_TYPE); + configureAttributes.append(EGL_OPENGL_ES2_BIT); + + configureAttributes.append(EGL_NONE); + + do { + // Get the number of matching configurations for this set of properties. + EGLint matching = 0; + if (!eglChooseConfig(display, configureAttributes.constData(), 0, 0, &matching) || !matching) + continue; + +// // If we want the best pixel format, then return the first +// // matching configuration. +// if (match == QEgl::BestPixelFormat) { +// eglChooseConfig(display, props.properties(), &cfg, 1, &matching); +// if (matching < 1) +// continue; +// return cfg; +// } + + // Fetch all of the matching configurations and find the + // first that matches the pixel format we wanted. + int i = configureAttributes.indexOf(EGL_RED_SIZE); + int confAttrRed = configureAttributes.at(i+1); + i = configureAttributes.indexOf(EGL_GREEN_SIZE); + int confAttrGreen = configureAttributes.at(i+1); + i = configureAttributes.indexOf(EGL_BLUE_SIZE); + int confAttrBlue = configureAttributes.at(i+1); + i = configureAttributes.indexOf(EGL_ALPHA_SIZE); + int confAttrAlpha = configureAttributes.at(i+1); + + EGLint size = matching; + EGLConfig *configs = new EGLConfig [size]; + eglChooseConfig(display, configureAttributes.constData(), configs, size, &matching); + for (EGLint index = 0; index < size; ++index) { + EGLint red, green, blue, alpha; + eglGetConfigAttrib(display, configs[index], EGL_RED_SIZE, &red); + eglGetConfigAttrib(display, configs[index], EGL_GREEN_SIZE, &green); + eglGetConfigAttrib(display, configs[index], EGL_BLUE_SIZE, &blue); + eglGetConfigAttrib(display, configs[index], EGL_ALPHA_SIZE, &alpha); +// qDebug() << "red" << red << confAttrRed; +// qDebug() << "green" << green << confAttrGreen; +// qDebug() << "blue" << blue << confAttrBlue; +// qDebug() << "alpha" << alpha << confAttrAlpha << (confAttrAlpha == 0 || alpha == confAttrAlpha); + if (red == confAttrRed && + green == confAttrGreen && + blue == confAttrBlue && + (confAttrAlpha == 0 || + alpha == confAttrAlpha)) { + cfg = configs[index]; + delete [] configs; + return cfg; + } + } + delete [] configs; + } while (q_reduceConfigAttributes(&configureAttributes)); + qDebug() << "RETURNING NULL!"; + return 0; +} + QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) : QPlatformWindow(tlw) { - EGLint configAttrs[] = { - EGL_RED_SIZE, 1, - EGL_GREEN_SIZE, 1, - EGL_BLUE_SIZE, 1, - EGL_BUFFER_SIZE, 16, - EGL_DEPTH_SIZE, 0, - EGL_LEVEL, 0, - EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, -// #ifdef EGL_NV_coverage_sample -// EGL_COVERAGE_BUFFERS_NV, 1, -// EGL_COVERAGE_SAMPLES_NV, 5, -// #endif - EGL_ALPHA_SIZE, 0, -// EGL_LUMINANCE_SIZE, 0, - EGL_ALPHA_MASK_SIZE, 0, - EGL_SAMPLES, 0, - EGL_SAMPLE_BUFFERS, 0, -// EGL_STENCIL_SIZE, 0, - EGL_SURFACE_TYPE, EGL_WINDOW_BIT, - EGL_TRANSPARENT_TYPE, EGL_NONE, - EGL_NONE - }; m_eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); m_eglContextAttrs.append(2); @@ -98,33 +308,13 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) qErrnoWarning("Could not make QOpenKODEWindow without a screen"); } - EGLint configCount; - // Find out how many configurations suit our needs - EGLBoolean eglStatus = eglChooseConfig(screen->eglDisplay(), configAttrs, - KD_NULL, 0, &configCount); - if (!eglStatus || !configCount) { - qErrnoWarning("EGL failed to return any matching configurations"); - } - - qDebug() << "config count" << configCount; - - // Allocate room for the list of matching configurations - EGLConfig *configList = (EGLConfig*)kdMalloc(configCount * sizeof(EGLConfig)); - if (!configList) { - qErrnoWarning("kdMalloc failure obtaining configuration list"); - } + QPlatformWindowFormat format = tlw->platformWindowFormat(); + format.setRedBufferSize(5); + format.setGreenBufferSize(6); + format.setBlueBufferSize(5); + tlw->setPlatformWindowFormat(format); - // Obtain the configuration list from EGL - eglStatus = eglChooseConfig(screen->eglDisplay(), configAttrs, - configList, configCount, &configCount); - if (!eglStatus || !configCount) { - qErrnoWarning("EGL failed to populate configuration list"); - } - - // Select an EGL configuration that matches the native window - - m_eglConfig = configList[11]; - kdFree(configList);//free the list not the configs + m_eglConfig = q_configFromQPlatformWindowFormat(screen->eglDisplay(),tlw->platformWindowFormat(),m_eglApi); m_kdWindow = kdCreateWindow(screen->eglDisplay(), m_eglConfig, @@ -156,10 +346,6 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) return; } - KDint32 layer = 1; - kdGetWindowPropertyiv(m_kdWindow,KD_WINDOWPROPERTY_DESKTOP_LAYER_NV,&layer); - qDebug() << "LAYER:" << layer; - EGLSurface surface = eglCreateWindowSurface(screen->eglDisplay(),m_eglConfig,m_eglWindow,m_eglWindowAttrs.constData()); m_platformGlContext = new QEGLPlatformContext(screen->eglDisplay(), m_eglConfig, -- cgit v0.12 From 82ea3e45567dbe83d97638124e7351dc462afe3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 12 Jul 2010 09:43:04 +0200 Subject: clean up QPlatformWindowFormat --- src/gui/kernel/qapplication.cpp | 2 + src/gui/kernel/qplatformintegration_qpa.h | 2 +- src/gui/kernel/qplatformwindowformat_qpa.cpp | 342 ++------------------------- src/gui/kernel/qplatformwindowformat_qpa.h | 47 +--- 4 files changed, 25 insertions(+), 368 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index e1ed588..ac79958 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -6032,6 +6032,8 @@ QPixmap QApplicationPrivate::getPixmapCursor(Qt::CursorShape cshape) default: break; } +#else + Q_UNUSED(cshape); #endif return QPixmap(); } diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index ea0ed35..8c1659f 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -42,8 +42,8 @@ #ifndef QPLATFORMINTEGRATION_H #define QPLATFORMINTEGRATION_H -#include #include +#include #include QT_BEGIN_HEADER diff --git a/src/gui/kernel/qplatformwindowformat_qpa.cpp b/src/gui/kernel/qplatformwindowformat_qpa.cpp index 4ded26b..bc234ab 100644 --- a/src/gui/kernel/qplatformwindowformat_qpa.cpp +++ b/src/gui/kernel/qplatformwindowformat_qpa.cpp @@ -62,7 +62,7 @@ public: , swapInterval(-1) , majorVersion(1) , minorVersion(0) - , profile(QPlatformWindowFormat::NoProfile) + , windowApi(QPlatformWindowFormat::Raster) { } @@ -80,7 +80,7 @@ public: swapInterval(other->swapInterval), majorVersion(other->majorVersion), minorVersion(other->minorVersion), - profile(other->profile) + windowApi(other->windowApi) { } QAtomicInt ref; @@ -96,7 +96,7 @@ public: int swapInterval; int majorVersion; int minorVersion; - QPlatformWindowFormat::OpenGLContextProfile profile; + QPlatformWindowFormat::WindowApi windowApi; }; /*! @@ -584,6 +584,17 @@ int QPlatformWindowFormat::swapInterval() const return d->swapInterval; } +void QPlatformWindowFormat::setWindowApi(QPlatformWindowFormat::WindowApi api) +{ + detach(); + d->windowApi = api; +} + +QPlatformWindowFormat::WindowApi QPlatformWindowFormat::windowApi() const +{ + return d->windowApi; +} + ///*! // \fn bool QGLFormat::hasOverlay() const @@ -835,329 +846,6 @@ int QPlatformWindowFormat::stencilBufferSize() const } /*! - \since 4.7 - - Set the OpenGL version to the \a major and \a minor numbers. If a - context compatible with the requested OpenGL version cannot be - created, a context compatible with version 1.x is created instead. - - \sa majorVersion(), minorVersion() -*/ -void QPlatformWindowFormat::setVersion(int major, int minor) -{ - if (major < 1 || minor < 0) { - qWarning("QGLFormat::setVersion: Cannot set zero or negative version number %d.%d", major, minor); - return; - } - detach(); - d->majorVersion = major; - d->minorVersion = minor; -} - -/*! - \since 4.7 - - Returns the OpenGL major version. - - \sa setVersion(), minorVersion() -*/ -int QPlatformWindowFormat::majorVersion() const -{ - return d->majorVersion; -} - -/*! - \since 4.7 - - Returns the OpenGL minor version. - - \sa setVersion(), majorVersion() -*/ -int QPlatformWindowFormat::minorVersion() const -{ - return d->minorVersion; -} - -/*! - \enum QGLFormat::OpenGLContextProfile - \since 4.7 - - This enum describes the OpenGL context profiles that can be - specified for contexts implementing OpenGL version 3.2 or - higher. These profiles are different from OpenGL ES profiles. - - \value NoProfile OpenGL version is lower than 3.2. - \value CoreProfile Functionality deprecated in OpenGL version 3.0 is not available. - \value CompatibilityProfile Functionality from earlier OpenGL versions is available. -*/ - -/*! - \since 4.7 - - Set the OpenGL context profile to \a profile. The \a profile is - ignored if the requested OpenGL version is less than 3.2. - - \sa profile() -*/ -void QPlatformWindowFormat::setProfile(OpenGLContextProfile profile) -{ - detach(); - d->profile = profile; -} - -/*! - \since 4.7 - - Returns the OpenGL context profile. - - \sa setProfile() -*/ -QPlatformWindowFormat::OpenGLContextProfile QPlatformWindowFormat::profile() const -{ - return d->profile; -} - - -/*! - \fn bool QGLFormat::hasOpenGL() - - Returns true if the window system has any OpenGL support; - otherwise returns false. - - \warning This function must not be called until the QApplication - object has been created. -*/ - - - -/*! - \fn bool QGLFormat::hasOpenGLOverlays() - - Returns true if the window system supports OpenGL overlays; - otherwise returns false. - - \warning This function must not be called until the QApplication - object has been created. -*/ - -QPlatformWindowFormat::OpenGLVersionFlags Q_AUTOTEST_EXPORT qOpenGLVersionFlagsFromString(const QString &versionString) -{ - QPlatformWindowFormat::OpenGLVersionFlags versionFlags = QPlatformWindowFormat::OpenGL_Version_None; - - if (versionString.startsWith(QLatin1String("OpenGL ES"))) { - QStringList parts = versionString.split(QLatin1Char(' ')); - if (parts.size() >= 3) { - if (parts[2].startsWith(QLatin1String("1."))) { - if (parts[1].endsWith(QLatin1String("-CM"))) { - versionFlags |= QPlatformWindowFormat::OpenGL_ES_Common_Version_1_0 | - QPlatformWindowFormat::OpenGL_ES_CommonLite_Version_1_0; - if (parts[2].startsWith(QLatin1String("1.1"))) - versionFlags |= QPlatformWindowFormat::OpenGL_ES_Common_Version_1_1 | - QPlatformWindowFormat::OpenGL_ES_CommonLite_Version_1_1; - } else { - // Not -CM, must be CL, CommonLite - versionFlags |= QPlatformWindowFormat::OpenGL_ES_CommonLite_Version_1_0; - if (parts[2].startsWith(QLatin1String("1.1"))) - versionFlags |= QPlatformWindowFormat::OpenGL_ES_CommonLite_Version_1_1; - } - } else { - // OpenGL ES version 2.0 or higher - versionFlags |= QPlatformWindowFormat::OpenGL_ES_Version_2_0; - } - } else { - // if < 3 parts to the name, it is an unrecognised OpenGL ES - qWarning("Unrecognised OpenGL ES version"); - } - } else { - // not ES, regular OpenGL, the version numbers are first in the string - if (versionString.startsWith(QLatin1String("1."))) { - switch (versionString[2].toAscii()) { - case '5': - versionFlags |= QPlatformWindowFormat::OpenGL_Version_1_5; - case '4': - versionFlags |= QPlatformWindowFormat::OpenGL_Version_1_4; - case '3': - versionFlags |= QPlatformWindowFormat::OpenGL_Version_1_3; - case '2': - versionFlags |= QPlatformWindowFormat::OpenGL_Version_1_2; - case '1': - versionFlags |= QPlatformWindowFormat::OpenGL_Version_1_1; - default: - break; - } - } else if (versionString.startsWith(QLatin1String("2."))) { - versionFlags |= QPlatformWindowFormat::OpenGL_Version_1_1 | - QPlatformWindowFormat::OpenGL_Version_1_2 | - QPlatformWindowFormat::OpenGL_Version_1_3 | - QPlatformWindowFormat::OpenGL_Version_1_4 | - QPlatformWindowFormat::OpenGL_Version_1_5 | - QPlatformWindowFormat::OpenGL_Version_2_0; - if (versionString[2].toAscii() == '1') - versionFlags |= QPlatformWindowFormat::OpenGL_Version_2_1; - } else if (versionString.startsWith(QLatin1String("3."))) { - versionFlags |= QPlatformWindowFormat::OpenGL_Version_1_1 | - QPlatformWindowFormat::OpenGL_Version_1_2 | - QPlatformWindowFormat::OpenGL_Version_1_3 | - QPlatformWindowFormat::OpenGL_Version_1_4 | - QPlatformWindowFormat::OpenGL_Version_1_5 | - QPlatformWindowFormat::OpenGL_Version_2_0 | - QPlatformWindowFormat::OpenGL_Version_2_1 | - QPlatformWindowFormat::OpenGL_Version_3_0; - switch (versionString[2].toAscii()) { - case '3': - versionFlags |= QPlatformWindowFormat::OpenGL_Version_3_3; - case '2': - versionFlags |= QPlatformWindowFormat::OpenGL_Version_3_2; - case '1': - versionFlags |= QPlatformWindowFormat::OpenGL_Version_3_1; - case '0': - break; - default: - versionFlags |= QPlatformWindowFormat::OpenGL_Version_3_1 | - QPlatformWindowFormat::OpenGL_Version_3_2 | - QPlatformWindowFormat::OpenGL_Version_3_3; - break; - } - } else if (versionString.startsWith(QLatin1String("4."))) { - versionFlags |= QPlatformWindowFormat::OpenGL_Version_1_1 | - QPlatformWindowFormat::OpenGL_Version_1_2 | - QPlatformWindowFormat::OpenGL_Version_1_3 | - QPlatformWindowFormat::OpenGL_Version_1_4 | - QPlatformWindowFormat::OpenGL_Version_1_5 | - QPlatformWindowFormat::OpenGL_Version_2_0 | - QPlatformWindowFormat::OpenGL_Version_2_1 | - QPlatformWindowFormat::OpenGL_Version_3_0 | - QPlatformWindowFormat::OpenGL_Version_3_1 | - QPlatformWindowFormat::OpenGL_Version_3_2 | - QPlatformWindowFormat::OpenGL_Version_3_3 | - QPlatformWindowFormat::OpenGL_Version_4_0; - } else { - versionFlags |= QPlatformWindowFormat::OpenGL_Version_1_1 | - QPlatformWindowFormat::OpenGL_Version_1_2 | - QPlatformWindowFormat::OpenGL_Version_1_3 | - QPlatformWindowFormat::OpenGL_Version_1_4 | - QPlatformWindowFormat::OpenGL_Version_1_5 | - QPlatformWindowFormat::OpenGL_Version_2_0 | - QPlatformWindowFormat::OpenGL_Version_2_1 | - QPlatformWindowFormat::OpenGL_Version_3_0 | - QPlatformWindowFormat::OpenGL_Version_3_1 | - QPlatformWindowFormat::OpenGL_Version_3_2 | - QPlatformWindowFormat::OpenGL_Version_3_3 | - QPlatformWindowFormat::OpenGL_Version_4_0; - } - } - return versionFlags; -} - -/*! - \enum QGLFormat::OpenGLVersionFlag - \since 4.2 - - This enum describes the various OpenGL versions that are - recognized by Qt. Use the QGLFormat::openGLVersionFlags() function - to identify which versions that are supported at runtime. - - \value OpenGL_Version_None If no OpenGL is present or if no OpenGL context is current. - - \value OpenGL_Version_1_1 OpenGL version 1.1 or higher is present. - - \value OpenGL_Version_1_2 OpenGL version 1.2 or higher is present. - - \value OpenGL_Version_1_3 OpenGL version 1.3 or higher is present. - - \value OpenGL_Version_1_4 OpenGL version 1.4 or higher is present. - - \value OpenGL_Version_1_5 OpenGL version 1.5 or higher is present. - - \value OpenGL_Version_2_0 OpenGL version 2.0 or higher is present. - Note that version 2.0 supports all the functionality of version 1.5. - - \value OpenGL_Version_2_1 OpenGL version 2.1 or higher is present. - - \value OpenGL_Version_3_0 OpenGL version 3.0 or higher is present. - - \value OpenGL_Version_3_1 OpenGL version 3.1 or higher is present. - Note that OpenGL version 3.1 or higher does not necessarily support all the features of - version 3.0 and lower. - - \value OpenGL_Version_3_2 OpenGL version 3.2 or higher is present. - - \value OpenGL_ES_CommonLite_Version_1_0 OpenGL ES version 1.0 Common Lite or higher is present. - - \value OpenGL_ES_Common_Version_1_0 OpenGL ES version 1.0 Common or higher is present. - The Common profile supports all the features of Common Lite. - - \value OpenGL_ES_CommonLite_Version_1_1 OpenGL ES version 1.1 Common Lite or higher is present. - - \value OpenGL_ES_Common_Version_1_1 OpenGL ES version 1.1 Common or higher is present. - The Common profile supports all the features of Common Lite. - - \value OpenGL_ES_Version_2_0 OpenGL ES version 2.0 or higher is present. - Note that OpenGL ES version 2.0 does not support all the features of OpenGL ES 1.x. - So if OpenGL_ES_Version_2_0 is returned, none of the ES 1.x flags are returned. - - See also \l{http://www.opengl.org} for more information about the different - revisions of OpenGL. - - \sa openGLVersionFlags() -*/ - -/*! - \since 4.2 - - Identifies, at runtime, which OpenGL versions that are supported - by the current platform. - - Note that if OpenGL version 1.5 is supported, its predecessors - (i.e., version 1.4 and lower) are also supported. To identify the - support of a particular feature, like multi texturing, test for - the version in which the feature was first introduced (i.e., - version 1.3 in the case of multi texturing) to adapt to the largest - possible group of runtime platforms. - - This function needs a valid current OpenGL context to work; - otherwise it will return OpenGL_Version_None. - - \sa hasOpenGL(), hasOpenGLOverlays() -*/ -QPlatformWindowFormat::OpenGLVersionFlags QPlatformWindowFormat::openGLVersionFlags() -{ -// static bool cachedDefault = false; - static OpenGLVersionFlags defaultVersionFlags = OpenGL_Version_None; -// QGLContext *currentCtx = const_cast(QGLContext::currentContext()); -// QGLTemporaryContext *tmpContext = 0; - -// if (currentCtx && currentCtx->d_func()->version_flags_cached) -// return currentCtx->d_func()->version_flags; - -// if (!currentCtx) { -// if (cachedDefault) { -// return defaultVersionFlags; -// } else { -// if (!hasOpenGL()) -// return defaultVersionFlags; -// tmpContext = new QGLTemporaryContext; -// cachedDefault = true; -// } -// } - -// QString versionString(QLatin1String(reinterpret_cast(glGetString(GL_VERSION)))); -// OpenGLVersionFlags versionFlags = qOpenGLVersionFlagsFromString(versionString); -// if (currentCtx) { -// currentCtx->d_func()->version_flags_cached = true; -// currentCtx->d_func()->version_flags = versionFlags; -// } -// if (tmpContext) { -// defaultVersionFlags = versionFlags; -// delete tmpContext; -// } - -// return versionFlags; - return defaultVersionFlags; -} - - -/*! Returns the default QGLFormat for the application. All QGLWidget objects that are created use this format unless another format is specified, e.g. when they are constructed. @@ -1266,7 +954,7 @@ bool operator==(const QPlatformWindowFormat& a, const QPlatformWindowFormat& b) && a.d->swapInterval == b.d->swapInterval && a.d->majorVersion == b.d->majorVersion && a.d->minorVersion == b.d->minorVersion - && a.d->profile == b.d->profile); + && a.d->windowApi == b.d->windowApi); } diff --git a/src/gui/kernel/qplatformwindowformat_qpa.h b/src/gui/kernel/qplatformwindowformat_qpa.h index 929ad7a..3c5f907 100644 --- a/src/gui/kernel/qplatformwindowformat_qpa.h +++ b/src/gui/kernel/qplatformwindowformat_qpa.h @@ -78,27 +78,11 @@ public: }; Q_DECLARE_FLAGS(FormatOptions, FormatOption) - enum OpenGLVersionFlag { - OpenGL_Version_None = 0x00000000, - OpenGL_Version_1_1 = 0x00000001, - OpenGL_Version_1_2 = 0x00000002, - OpenGL_Version_1_3 = 0x00000004, - OpenGL_Version_1_4 = 0x00000008, - OpenGL_Version_1_5 = 0x00000010, - OpenGL_Version_2_0 = 0x00000020, - OpenGL_Version_2_1 = 0x00000040, - OpenGL_ES_Common_Version_1_0 = 0x00000080, - OpenGL_ES_CommonLite_Version_1_0 = 0x00000100, - OpenGL_ES_Common_Version_1_1 = 0x00000200, - OpenGL_ES_CommonLite_Version_1_1 = 0x00000400, - OpenGL_ES_Version_2_0 = 0x00000800, - OpenGL_Version_3_0 = 0x00001000, - OpenGL_Version_3_1 = 0x00002000, - OpenGL_Version_3_2 = 0x00004000, - OpenGL_Version_3_3 = 0x00008000, - OpenGL_Version_4_0 = 0x00010000 + enum WindowApi { + Raster, + OpenGL, + OpenVG }; - Q_DECLARE_FLAGS(OpenGLVersionFlags, OpenGLVersionFlag) QPlatformWindowFormat(); QPlatformWindowFormat(FormatOptions options); @@ -136,6 +120,9 @@ public: void setSwapInterval(int interval); int swapInterval() const; + void setWindowApi(QPlatformWindowFormat::WindowApi api); + WindowApi windowApi() const; + bool doubleBuffer() const; void setDoubleBuffer(bool enable); bool depth() const; @@ -164,25 +151,6 @@ public: // static QPlatformWindowFormat defaultOverlayFormat(); // static void setDefaultOverlayFormat(const QPlatformWindowFormat& f); - static bool hasOpenGL(); - static bool hasOpenGLOverlays(); - - void setVersion(int major, int minor); - int majorVersion() const; - int minorVersion() const; - - enum OpenGLContextProfile { - NoProfile, - CoreProfile, - CompatibilityProfile - }; - - void setProfile(OpenGLContextProfile profile); - OpenGLContextProfile profile() const; - - - static OpenGLVersionFlags openGLVersionFlags(); - private: QPlatformWindowFormatPrivate *d; @@ -196,7 +164,6 @@ Q_GUI_EXPORT bool operator==(const QPlatformWindowFormat&, const QPlatformWindow Q_GUI_EXPORT bool operator!=(const QPlatformWindowFormat&, const QPlatformWindowFormat&); Q_DECLARE_OPERATORS_FOR_FLAGS(QPlatformWindowFormat::FormatOptions) -Q_DECLARE_OPERATORS_FOR_FLAGS(QPlatformWindowFormat::OpenGLVersionFlags) inline bool QPlatformWindowFormat::doubleBuffer() const { -- cgit v0.12 From 4892e8fcebdbdb8a612189682f3a18db6cb51158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 12 Jul 2010 10:34:20 +0200 Subject: Lighthouse egl refactoring Moved the openkode egl code into a convenience directory so it can be used by other plugins --- .../platforms/eglconvenience/qeglconvenience.cpp | 233 +++++++++++++++++++ .../platforms/eglconvenience/qeglconvenience.h | 54 +++++ .../eglconvenience/qeglplatformcontext.cpp | 104 +++++++++ .../platforms/eglconvenience/qeglplatformcontext.h | 66 ++++++ src/plugins/platforms/openkode/openkode.pro | 6 +- .../platforms/openkode/qopenkodeglintegration.cpp | 108 --------- .../platforms/openkode/qopenkodeglintegration.h | 66 ------ .../platforms/openkode/qopenkodeintegration.cpp | 24 +- src/plugins/platforms/openkode/qopenkodewindow.cpp | 250 +-------------------- 9 files changed, 494 insertions(+), 417 deletions(-) create mode 100644 src/plugins/platforms/eglconvenience/qeglconvenience.cpp create mode 100644 src/plugins/platforms/eglconvenience/qeglconvenience.h create mode 100644 src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp create mode 100644 src/plugins/platforms/eglconvenience/qeglplatformcontext.h delete mode 100644 src/plugins/platforms/openkode/qopenkodeglintegration.cpp delete mode 100644 src/plugins/platforms/openkode/qopenkodeglintegration.h diff --git a/src/plugins/platforms/eglconvenience/qeglconvenience.cpp b/src/plugins/platforms/eglconvenience/qeglconvenience.cpp new file mode 100644 index 0000000..1064e47 --- /dev/null +++ b/src/plugins/platforms/eglconvenience/qeglconvenience.cpp @@ -0,0 +1,233 @@ +#include "qeglconvenience.h" + +#include + +QVector q_createConfigAttributesFromFormat(const QPlatformWindowFormat &format) +{ + int redSize = format.redBufferSize(); + int greenSize = format.greenBufferSize(); + int blueSize = format.blueBufferSize(); + int alphaSize = format.alphaBufferSize(); + int depthSize = format.depthBufferSize(); + int stencilSize = format.stencilBufferSize(); + int sampleCount = format.samples(); + + // QPlatformWindowFormat uses a magic value of -1 to indicate "don't care", even when a buffer of that + // type has been requested. So we must check QPlatformWindowFormat's booleans too if size is -1: + if (format.alpha() && alphaSize <= 0) + alphaSize = 1; + if (format.depth() && depthSize <= 0) + depthSize = 1; + if (format.stencil() && stencilSize <= 0) + stencilSize = 1; + if (format.sampleBuffers() && sampleCount <= 0) + sampleCount = 1; + + // We want to make sure 16-bit configs are chosen over 32-bit configs as they will provide + // the best performance. The EGL config selection algorithm is a bit stange in this regard: + // The selection criteria for EGL_BUFFER_SIZE is "AtLeast", so we can't use it to discard + // 32-bit configs completely from the selection. So it then comes to the sorting algorithm. + // The red/green/blue sizes have a sort priority of 3, so they are sorted by first. The sort + // order is special and described as "by larger _total_ number of color bits.". So EGL will + // put 32-bit configs in the list before the 16-bit configs. However, the spec also goes on + // to say "If the requested number of bits in attrib_list for a particular component is 0, + // then the number of bits for that component is not considered". This part of the spec also + // seems to imply that setting the red/green/blue bits to zero means none of the components + // are considered and EGL disregards the entire sorting rule. It then looks to the next + // highest priority rule, which is EGL_BUFFER_SIZE. Despite the selection criteria being + // "AtLeast" for EGL_BUFFER_SIZE, it's sort order is "smaller" meaning 16-bit configs are + // put in the list before 32-bit configs. So, to make sure 16-bit is preffered over 32-bit, + // we must set the red/green/blue sizes to zero. This has an unfortunate consequence that + // if the application sets the red/green/blue size to 5/6/5 on the QPlatformWindowFormat, + // they will probably get a 32-bit config, even when there's an RGB565 config avaliable. + + // Now normalize the values so -1 becomes 0 + redSize = redSize > 0 ? redSize : 0; + greenSize = greenSize > 0 ? greenSize : 0; + blueSize = blueSize > 0 ? blueSize : 0; + alphaSize = alphaSize > 0 ? alphaSize : 0; + depthSize = depthSize > 0 ? depthSize : 0; + stencilSize = stencilSize > 0 ? stencilSize : 0; + sampleCount = sampleCount > 0 ? sampleCount : 0; + + QVector configAttributes; + + configAttributes.append(EGL_RED_SIZE); + configAttributes.append(redSize); + + configAttributes.append(EGL_GREEN_SIZE); + configAttributes.append(greenSize); + + configAttributes.append(EGL_BLUE_SIZE); + configAttributes.append(blueSize); + + configAttributes.append(EGL_ALPHA_SIZE); + configAttributes.append(alphaSize); + + configAttributes.append(EGL_DEPTH_SIZE); + configAttributes.append(depthSize); + + configAttributes.append(EGL_STENCIL_SIZE); + configAttributes.append(stencilSize); + + configAttributes.append(EGL_SAMPLES); + configAttributes.append(sampleCount); + + configAttributes.append(EGL_SAMPLE_BUFFERS); + configAttributes.append(sampleCount? 1:0); + + return configAttributes; +} + +bool q_reduceConfigAttributes(QVector *configAttributes) +{ + int i = -1; + // Reduce the complexity of a configuration request to ask for less + // because the previous request did not result in success. Returns + // true if the complexity was reduced, or false if no further + // reductions in complexity are possible. + + i = configAttributes->indexOf(EGL_SWAP_BEHAVIOR); + if (i >= 0) { + configAttributes->remove(i,2); + } + +#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT + // For OpenVG, we sometimes try to create a surface using a pre-multiplied format. If we can't + // find a config which supports pre-multiplied formats, remove the flag on the surface type: + + i = configAttributes->indexOf(EGL_SURFACE_TYPE); + if (i >= 0) { + EGLint surfaceType = configAttributes->at(i +1); + if (surfaceType & EGL_VG_ALPHA_FORMAT_PRE_BIT) { + surfaceType ^= EGL_VG_ALPHA_FORMAT_PRE_BIT; + configAttributes->replace(i+1,surfaceType); + return true; + } + } +#endif + + // EGL chooses configs with the highest color depth over + // those with smaller (but faster) lower color depths. One + // way around this is to set EGL_BUFFER_SIZE to 16, which + // trumps the others. Of course, there may not be a 16-bit + // config avaliable, so it's the first restraint we remove. + i = configAttributes->indexOf(EGL_BUFFER_SIZE); + if (i >= 0) { + if (configAttributes->at(i+1) == 16) { + configAttributes->remove(i,2); + return true; + } + } + + i = configAttributes->indexOf(EGL_SAMPLE_BUFFERS); + if (i >= 0) { + configAttributes->remove(i,2); + i = configAttributes->indexOf(EGL_SAMPLES); + if (i >= 0) { + configAttributes->remove(i,2); + } + return true; + } + + i = configAttributes->indexOf(EGL_ALPHA_SIZE); + if (i >= 0) { + configAttributes->remove(i,2); +#if defined(EGL_BIND_TO_TEXTURE_RGBA) && defined(EGL_BIND_TO_TEXTURE_RGB) + i = configAttributes->indexOf(EGL_BIND_TO_TEXTURE_RGBA); + if (i >= 0) { + configAttributes->replace(i,EGL_BIND_TO_TEXTURE_RGB); + configAttributes->replace(i+1,TRUE); + + } +#endif + return true; + } + + i = configAttributes->indexOf(EGL_STENCIL_SIZE); + if (i >= 0) { + configAttributes->remove(i,2); + return true; + } + i = configAttributes->indexOf(EGL_DEPTH_SIZE); + if (i >= 0) { + configAttributes->remove(i,2); + return true; + } +#ifdef EGL_BIND_TO_TEXTURE_RGB + i = configAttributes->indexOf(EGL_BIND_TO_TEXTURE_RGB); + if (i >= 0) { + configAttributes->remove(i,2); + return true; + } +#endif + + return false; +} + +EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformWindowFormat &format) +{ + EGLConfig cfg = 0; + QVector configureAttributes = q_createConfigAttributesFromFormat(format); + configureAttributes.append(EGL_SURFACE_TYPE); //we only support eglconfigs for windows for now + configureAttributes.append(EGL_WINDOW_BIT); + + configureAttributes.append(EGL_RENDERABLE_TYPE); + if (format.windowApi() == QPlatformWindowFormat::OpenVG) { + configureAttributes.append(EGL_OPENVG_BIT); + } else { + configureAttributes.append(EGL_OPENGL_ES2_BIT); + } + + configureAttributes.append(EGL_NONE); + + do { + // Get the number of matching configurations for this set of properties. + EGLint matching = 0; + if (!eglChooseConfig(display, configureAttributes.constData(), 0, 0, &matching) || !matching) + continue; + +// // If we want the best pixel format, then return the first +// // matching configuration. +// if (match == QEgl::BestPixelFormat) { +// eglChooseConfig(display, props.properties(), &cfg, 1, &matching); +// if (matching < 1) +// continue; +// return cfg; +// } + + // Fetch all of the matching configurations and find the + // first that matches the pixel format we wanted. + int i = configureAttributes.indexOf(EGL_RED_SIZE); + int confAttrRed = configureAttributes.at(i+1); + i = configureAttributes.indexOf(EGL_GREEN_SIZE); + int confAttrGreen = configureAttributes.at(i+1); + i = configureAttributes.indexOf(EGL_BLUE_SIZE); + int confAttrBlue = configureAttributes.at(i+1); + i = configureAttributes.indexOf(EGL_ALPHA_SIZE); + int confAttrAlpha = configureAttributes.at(i+1); + + EGLint size = matching; + EGLConfig *configs = new EGLConfig [size]; + eglChooseConfig(display, configureAttributes.constData(), configs, size, &matching); + for (EGLint index = 0; index < size; ++index) { + EGLint red, green, blue, alpha; + eglGetConfigAttrib(display, configs[index], EGL_RED_SIZE, &red); + eglGetConfigAttrib(display, configs[index], EGL_GREEN_SIZE, &green); + eglGetConfigAttrib(display, configs[index], EGL_BLUE_SIZE, &blue); + eglGetConfigAttrib(display, configs[index], EGL_ALPHA_SIZE, &alpha); + if (red == confAttrRed && + green == confAttrGreen && + blue == confAttrBlue && + (confAttrAlpha == 0 || + alpha == confAttrAlpha)) { + cfg = configs[index]; + delete [] configs; + return cfg; + } + } + delete [] configs; + } while (q_reduceConfigAttributes(&configureAttributes)); + qDebug() << "RETURNING NULL!"; + return 0; +} diff --git a/src/plugins/platforms/eglconvenience/qeglconvenience.h b/src/plugins/platforms/eglconvenience/qeglconvenience.h new file mode 100644 index 0000000..bd5a6d3 --- /dev/null +++ b/src/plugins/platforms/eglconvenience/qeglconvenience.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QEGLCONVENIENCE_H +#define QEGLCONVENIENCE_H + +#include + +#include +#include + +QVector q_createConfigAttributesFromFormat(const QPlatformWindowFormat &format); +bool q_reduceConfigAttributes(QVector *configAttributes); +EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformWindowFormat &format); + + +#endif //QEGLCONVENIENCE_H diff --git a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp new file mode 100644 index 0000000..6afeb70 --- /dev/null +++ b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qeglplatformcontext.h" + +#include + +#include +#include + +QEGLPlatformContext::QEGLPlatformContext(EGLDisplay display, EGLConfig config, EGLint contextAttrs[], EGLSurface surface, EGLenum eglApi) + : m_eglDisplay(display) + , m_eglSurface(surface) + , m_eglApi(eglApi) +{ + if (m_eglSurface == EGL_NO_SURFACE) { + qWarning("Createing QEGLPlatformContext with no surface"); + } + + eglBindAPI(m_eglApi); + m_eglContext = eglCreateContext(m_eglDisplay,config, 0,contextAttrs); + if (!m_eglContext) { + qErrnoWarning("QEGLPlatformContext could not create eglContext"); + } +} + +QEGLPlatformContext::~QEGLPlatformContext() +{ + if (m_eglSurface != EGL_NO_SURFACE) { + doneCurrent(); + eglDestroySurface(m_eglDisplay, m_eglSurface); + m_eglSurface = EGL_NO_SURFACE; + } + + if (m_eglContext != EGL_NO_CONTEXT) { + eglDestroyContext(m_eglDisplay, m_eglContext); + m_eglContext = EGL_NO_CONTEXT; + } +} + +void QEGLPlatformContext::makeCurrent() +{ + eglBindAPI(m_eglApi); + bool ok = eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext); + if (!ok) + qWarning() << "QEGLPlatformContext::makeCurrent(" << m_eglSurface << "):" << eglGetError(); +} +void QEGLPlatformContext::doneCurrent() +{ + eglBindAPI(m_eglApi); + bool ok = eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + if (!ok) + qWarning() << "QEGLPlatformContext::doneCurrent():" << eglGetError(); +} +void QEGLPlatformContext::swapBuffers() +{ + eglBindAPI(m_eglApi); + bool ok = eglSwapBuffers(m_eglDisplay, m_eglSurface); + if (!ok) + qWarning() << "QEGLPlatformContext::swapBuffers():" << eglGetError(); +} +void* QEGLPlatformContext::getProcAddress(const QString& procName) +{ + eglBindAPI(m_eglApi); + return (void *)eglGetProcAddress(qPrintable(procName)); +} diff --git a/src/plugins/platforms/eglconvenience/qeglplatformcontext.h b/src/plugins/platforms/eglconvenience/qeglplatformcontext.h new file mode 100644 index 0000000..19d155a --- /dev/null +++ b/src/plugins/platforms/eglconvenience/qeglplatformcontext.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QOPENKODEGLINTEGRATION_H +#define QOPENKODEGLINTEGRATION_H + +#include +#include + +class QEGLPlatformContext : public QPlatformGLContext +{ +public: + QEGLPlatformContext(EGLDisplay display, EGLConfig config, EGLint contextAttrs[], EGLSurface surface, EGLenum eglApi); + ~QEGLPlatformContext(); + + void makeCurrent(); + void doneCurrent(); + void swapBuffers(); + void* getProcAddress(const QString& procName); + +private: + EGLContext m_eglContext; + EGLDisplay m_eglDisplay; + EGLSurface m_eglSurface; + EGLenum m_eglApi; +}; + +#endif //QOPENKODEGLINTEGRATION_H diff --git a/src/plugins/platforms/openkode/openkode.pro b/src/plugins/platforms/openkode/openkode.pro index 0614b3b..c039131 100644 --- a/src/plugins/platforms/openkode/openkode.pro +++ b/src/plugins/platforms/openkode/openkode.pro @@ -9,12 +9,14 @@ SOURCES = main.cpp \ qopenkodeintegration.cpp \ qopenkodewindowsurface.cpp \ qopenkodewindow.cpp \ - qopenkodeglintegration.cpp + ../eglconvenience/qeglplatformcontext.cpp \ + ../eglconvenience/qeglconvenience.cpp HEADERS = qopenkodeintegration.h \ qopenkodewindowsurface.h \ qopenkodewindow.h \ - qopenkodeglintegration.h + ../eglconvenience/qeglplatformcontext.h \ + ../eglconvenience/qeglconvenience.h RESOURCES = resources.qrc diff --git a/src/plugins/platforms/openkode/qopenkodeglintegration.cpp b/src/plugins/platforms/openkode/qopenkodeglintegration.cpp deleted file mode 100644 index 4296876..0000000 --- a/src/plugins/platforms/openkode/qopenkodeglintegration.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins 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 http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qopenkodeglintegration.h" - -#include - -#include -#include -#include - -#include - - -QEGLPlatformContext::QEGLPlatformContext(EGLDisplay display, EGLConfig config, EGLint contextAttrs[], EGLSurface surface, EGLenum eglApi) - : m_eglDisplay(display) - , m_eglSurface(surface) - , m_eglApi(eglApi) -{ - if (m_eglSurface == EGL_NO_SURFACE) { - qWarning("Createing QEGLPlatformContext with no surface"); - } - - eglBindAPI(m_eglApi); - m_eglContext = eglCreateContext(m_eglDisplay,config, KD_NULL,contextAttrs); - if (!m_eglContext) { - qErrnoWarning("QEGLPlatformContext could not create eglContext"); - } -} - -QEGLPlatformContext::~QEGLPlatformContext() -{ - if (m_eglSurface != EGL_NO_SURFACE) { - doneCurrent(); - eglDestroySurface(m_eglDisplay, m_eglSurface); - m_eglSurface = EGL_NO_SURFACE; - } - - if (m_eglContext != EGL_NO_CONTEXT) { - eglDestroyContext(m_eglDisplay, m_eglContext); - m_eglContext = EGL_NO_CONTEXT; - } -} - -void QEGLPlatformContext::makeCurrent() -{ - eglBindAPI(m_eglApi); - bool ok = eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext); - if (!ok) - qWarning() << "QEGLPlatformContext::makeCurrent(" << m_eglSurface << "):" << eglGetError(); -} -void QEGLPlatformContext::doneCurrent() -{ - eglBindAPI(m_eglApi); - bool ok = eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - if (!ok) - qWarning() << "QEGLPlatformContext::doneCurrent():" << eglGetError(); -} -void QEGLPlatformContext::swapBuffers() -{ - eglBindAPI(m_eglApi); - bool ok = eglSwapBuffers(m_eglDisplay, m_eglSurface); - if (!ok) - qWarning() << "QEGLPlatformContext::swapBuffers():" << eglGetError(); -} -void* QEGLPlatformContext::getProcAddress(const QString& procName) -{ - eglBindAPI(m_eglApi); - return (void *)eglGetProcAddress(qPrintable(procName)); -} diff --git a/src/plugins/platforms/openkode/qopenkodeglintegration.h b/src/plugins/platforms/openkode/qopenkodeglintegration.h deleted file mode 100644 index 19d155a..0000000 --- a/src/plugins/platforms/openkode/qopenkodeglintegration.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins 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 http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QOPENKODEGLINTEGRATION_H -#define QOPENKODEGLINTEGRATION_H - -#include -#include - -class QEGLPlatformContext : public QPlatformGLContext -{ -public: - QEGLPlatformContext(EGLDisplay display, EGLConfig config, EGLint contextAttrs[], EGLSurface surface, EGLenum eglApi); - ~QEGLPlatformContext(); - - void makeCurrent(); - void doneCurrent(); - void swapBuffers(); - void* getProcAddress(const QString& procName); - -private: - EGLContext m_eglContext; - EGLDisplay m_eglDisplay; - EGLSurface m_eglSurface; - EGLenum m_eglApi; -}; - -#endif //QOPENKODEGLINTEGRATION_H diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.cpp b/src/plugins/platforms/openkode/qopenkodeintegration.cpp index eed268e..270763b 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.cpp +++ b/src/plugins/platforms/openkode/qopenkodeintegration.cpp @@ -42,7 +42,6 @@ #include "qopenkodeintegration.h" #include "qopenkodewindowsurface.h" #include "qopenkodewindow.h" -#include "qopenkodeglintegration.h" #include #include @@ -238,8 +237,27 @@ QPlatformWindow *QOpenKODEIntegration::createPlatformWindow(QWidget *tlw, WId ) QWindowSurface *QOpenKODEIntegration::createWindowSurface(QWidget *widget, WId wid) const { -// return new QOpenKODEWindowSurface(widget, wid); - return new QGLWindowSurface(widget); + QWindowSurface *returnSurface = 0; + switch (widget->platformWindowFormat().windowApi()) { + + case QPlatformWindowFormat::Raster: + returnSurface = new QOpenKODEWindowSurface(widget, wid); + break; + + case QPlatformWindowFormat::OpenGL: + returnSurface = new QGLWindowSurface(widget); + break; + + case QPlatformWindowFormat::OpenVG: +// returnSurface = new QVGWindowSurface(widget); + break; + + default: + returnSurface = new QGLWindowSurface(widget); + break; + } + + return returnSurface; } bool QOpenKODEIntegration::hasOpenGL() const diff --git a/src/plugins/platforms/openkode/qopenkodewindow.cpp b/src/plugins/platforms/openkode/qopenkodewindow.cpp index f62eae5..2213a8f 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.cpp +++ b/src/plugins/platforms/openkode/qopenkodewindow.cpp @@ -40,7 +40,8 @@ ****************************************************************************/ #include "qopenkodewindow.h" #include "qopenkodeintegration.h" -#include "qopenkodeglintegration.h" +#include "../eglconvenience/qeglplatformcontext.h" +#include "../eglconvenience/qeglconvenience.h" #include #include @@ -54,251 +55,25 @@ #include #include -QVector q_createConfigAttributesFromFormat(const QPlatformWindowFormat &format) -{ - int redSize = format.redBufferSize(); - int greenSize = format.greenBufferSize(); - int blueSize = format.blueBufferSize(); - int alphaSize = format.alphaBufferSize(); - int depthSize = format.depthBufferSize(); - int stencilSize = format.stencilBufferSize(); - int sampleCount = format.samples(); - - // QPlatformWindowFormat uses a magic value of -1 to indicate "don't care", even when a buffer of that - // type has been requested. So we must check QPlatformWindowFormat's booleans too if size is -1: - if (format.alpha() && alphaSize <= 0) - alphaSize = 1; - if (format.depth() && depthSize <= 0) - depthSize = 1; - if (format.stencil() && stencilSize <= 0) - stencilSize = 1; - if (format.sampleBuffers() && sampleCount <= 0) - sampleCount = 1; - - // We want to make sure 16-bit configs are chosen over 32-bit configs as they will provide - // the best performance. The EGL config selection algorithm is a bit stange in this regard: - // The selection criteria for EGL_BUFFER_SIZE is "AtLeast", so we can't use it to discard - // 32-bit configs completely from the selection. So it then comes to the sorting algorithm. - // The red/green/blue sizes have a sort priority of 3, so they are sorted by first. The sort - // order is special and described as "by larger _total_ number of color bits.". So EGL will - // put 32-bit configs in the list before the 16-bit configs. However, the spec also goes on - // to say "If the requested number of bits in attrib_list for a particular component is 0, - // then the number of bits for that component is not considered". This part of the spec also - // seems to imply that setting the red/green/blue bits to zero means none of the components - // are considered and EGL disregards the entire sorting rule. It then looks to the next - // highest priority rule, which is EGL_BUFFER_SIZE. Despite the selection criteria being - // "AtLeast" for EGL_BUFFER_SIZE, it's sort order is "smaller" meaning 16-bit configs are - // put in the list before 32-bit configs. So, to make sure 16-bit is preffered over 32-bit, - // we must set the red/green/blue sizes to zero. This has an unfortunate consequence that - // if the application sets the red/green/blue size to 5/6/5 on the QPlatformWindowFormat, - // they will probably get a 32-bit config, even when there's an RGB565 config avaliable. - - // Now normalize the values so -1 becomes 0 - redSize = redSize > 0 ? redSize : 0; - greenSize = greenSize > 0 ? greenSize : 0; - blueSize = blueSize > 0 ? blueSize : 0; - alphaSize = alphaSize > 0 ? alphaSize : 0; - depthSize = depthSize > 0 ? depthSize : 0; - stencilSize = stencilSize > 0 ? stencilSize : 0; - sampleCount = sampleCount > 0 ? sampleCount : 0; - - QVector configAttributes; - - configAttributes.append(EGL_RED_SIZE); - configAttributes.append(redSize); - - configAttributes.append(EGL_GREEN_SIZE); - configAttributes.append(greenSize); - configAttributes.append(EGL_BLUE_SIZE); - configAttributes.append(blueSize); - - configAttributes.append(EGL_ALPHA_SIZE); - configAttributes.append(alphaSize); - - configAttributes.append(EGL_DEPTH_SIZE); - configAttributes.append(depthSize); - - configAttributes.append(EGL_STENCIL_SIZE); - configAttributes.append(stencilSize); - - configAttributes.append(EGL_SAMPLES); - configAttributes.append(sampleCount); - - configAttributes.append(EGL_SAMPLE_BUFFERS); - configAttributes.append(sampleCount? 1:0); - - return configAttributes; -} -bool q_reduceConfigAttributes(QVector *configAttributes) +QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) + : QPlatformWindow(tlw) { - int i = -1; - // Reduce the complexity of a configuration request to ask for less - // because the previous request did not result in success. Returns - // true if the complexity was reduced, or false if no further - // reductions in complexity are possible. - - i = configAttributes->indexOf(EGL_SWAP_BEHAVIOR); - if (i >= 0) { - configAttributes->remove(i,2); - } -#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT - // For OpenVG, we sometimes try to create a surface using a pre-multiplied format. If we can't - // find a config which supports pre-multiplied formats, remove the flag on the surface type: + if (tlw->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenVG) { + m_eglApi = EGL_OPENVG_API; + } else { + m_eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); + m_eglContextAttrs.append(2); - i = configAttributes->indexOf(EGL_SURFACE_TYPE); - if (i >= 0) { - EGLint surfaceType = configAttributes->at(i +1); - if (surfaceType & EGL_VG_ALPHA_FORMAT_PRE_BIT) { - surfaceType ^= EGL_VG_ALPHA_FORMAT_PRE_BIT; - configAttributes->replace(i+1,surfaceType); - return true; - } + m_eglApi = EGL_OPENGL_ES_API; } -#endif - - // EGL chooses configs with the highest color depth over - // those with smaller (but faster) lower color depths. One - // way around this is to set EGL_BUFFER_SIZE to 16, which - // trumps the others. Of course, there may not be a 16-bit - // config avaliable, so it's the first restraint we remove. - i = configAttributes->indexOf(EGL_BUFFER_SIZE); - if (i >= 0) { - if (configAttributes->at(i+1) == 16) { - configAttributes->remove(i,2); - return true; - } - } - - i = configAttributes->indexOf(EGL_SAMPLE_BUFFERS); - if (i >= 0) { - configAttributes->remove(i,2); - i = configAttributes->indexOf(EGL_SAMPLES); - if (i >= 0) { - configAttributes->remove(i,2); - } - return true; - } - - i = configAttributes->indexOf(EGL_ALPHA_SIZE); - if (i >= 0) { - configAttributes->remove(i,2); -#if defined(EGL_BIND_TO_TEXTURE_RGBA) && defined(EGL_BIND_TO_TEXTURE_RGB) - i = configAttributes->indexOf(EGL_BIND_TO_TEXTURE_RGBA); - if (i >= 0) { - configAttributes->replace(i,EGL_BIND_TO_TEXTURE_RGB); - configAttributes->replace(i+1,TRUE); - - } -#endif - return true; - } - - i = configAttributes->indexOf(EGL_STENCIL_SIZE); - if (i >= 0) { - configAttributes->remove(i,2); - return true; - } - i = configAttributes->indexOf(EGL_DEPTH_SIZE); - if (i >= 0) { - configAttributes->remove(i,2); - return true; - } -#ifdef EGL_BIND_TO_TEXTURE_RGB - i = configAttributes->indexOf(EGL_BIND_TO_TEXTURE_RGB); - if (i >= 0) { - configAttributes->remove(i,2); - return true; - } -#endif - - return false; -} - -EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformWindowFormat &format, EGLenum eglApi) -{ - EGLConfig cfg = 0; - QVector configureAttributes = q_createConfigAttributesFromFormat(format); - configureAttributes.append(EGL_SURFACE_TYPE); - configureAttributes.append(EGL_WINDOW_BIT); - - configureAttributes.append(EGL_RENDERABLE_TYPE); - configureAttributes.append(EGL_OPENGL_ES2_BIT); - - configureAttributes.append(EGL_NONE); - - do { - // Get the number of matching configurations for this set of properties. - EGLint matching = 0; - if (!eglChooseConfig(display, configureAttributes.constData(), 0, 0, &matching) || !matching) - continue; - -// // If we want the best pixel format, then return the first -// // matching configuration. -// if (match == QEgl::BestPixelFormat) { -// eglChooseConfig(display, props.properties(), &cfg, 1, &matching); -// if (matching < 1) -// continue; -// return cfg; -// } - - // Fetch all of the matching configurations and find the - // first that matches the pixel format we wanted. - int i = configureAttributes.indexOf(EGL_RED_SIZE); - int confAttrRed = configureAttributes.at(i+1); - i = configureAttributes.indexOf(EGL_GREEN_SIZE); - int confAttrGreen = configureAttributes.at(i+1); - i = configureAttributes.indexOf(EGL_BLUE_SIZE); - int confAttrBlue = configureAttributes.at(i+1); - i = configureAttributes.indexOf(EGL_ALPHA_SIZE); - int confAttrAlpha = configureAttributes.at(i+1); - - EGLint size = matching; - EGLConfig *configs = new EGLConfig [size]; - eglChooseConfig(display, configureAttributes.constData(), configs, size, &matching); - for (EGLint index = 0; index < size; ++index) { - EGLint red, green, blue, alpha; - eglGetConfigAttrib(display, configs[index], EGL_RED_SIZE, &red); - eglGetConfigAttrib(display, configs[index], EGL_GREEN_SIZE, &green); - eglGetConfigAttrib(display, configs[index], EGL_BLUE_SIZE, &blue); - eglGetConfigAttrib(display, configs[index], EGL_ALPHA_SIZE, &alpha); -// qDebug() << "red" << red << confAttrRed; -// qDebug() << "green" << green << confAttrGreen; -// qDebug() << "blue" << blue << confAttrBlue; -// qDebug() << "alpha" << alpha << confAttrAlpha << (confAttrAlpha == 0 || alpha == confAttrAlpha); - if (red == confAttrRed && - green == confAttrGreen && - blue == confAttrBlue && - (confAttrAlpha == 0 || - alpha == confAttrAlpha)) { - cfg = configs[index]; - delete [] configs; - return cfg; - } - } - delete [] configs; - } while (q_reduceConfigAttributes(&configureAttributes)); - qDebug() << "RETURNING NULL!"; - return 0; -} - -QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) - : QPlatformWindow(tlw) -{ + eglBindAPI(m_eglApi); - m_eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); - m_eglContextAttrs.append(2); m_eglContextAttrs.append(EGL_NONE); - -// m_eglWindowAttrs.append(EGL_RENDER_BUFFER); -// m_eglWindowAttrs.append(EGL_BACK_BUFFER); m_eglWindowAttrs.append(EGL_NONE); - m_eglApi = EGL_OPENGL_ES_API; - eglBindAPI(m_eglApi); - QList screens = QApplicationPrivate::platformIntegration()->screens(); //XXXX: jl figure out how to pick the correct screen. // Q_ASSERT(screens.size() > tlw->d_func()->screenNumber); @@ -314,7 +89,7 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) format.setBlueBufferSize(5); tlw->setPlatformWindowFormat(format); - m_eglConfig = q_configFromQPlatformWindowFormat(screen->eglDisplay(),tlw->platformWindowFormat(),m_eglApi); + m_eglConfig = q_configFromQPlatformWindowFormat(screen->eglDisplay(),tlw->platformWindowFormat()); m_kdWindow = kdCreateWindow(screen->eglDisplay(), m_eglConfig, @@ -360,7 +135,6 @@ QOpenKODEWindow::~QOpenKODEWindow() } void QOpenKODEWindow::setGeometry(const QRect &rect) { - qDebug() << "setting geo"; const QRect geo = geometry(); if (geo.size() != rect.size()) { const KDint windowSize[2] = { rect.width(), rect.height() -1 }; -- cgit v0.12 From ad0d0c4b6f7958b3cde01855b0f3b9c68db5253a Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 12 Jul 2010 15:42:55 +0200 Subject: Add full-screen EGL-based GL backend QGLWidget doesn't work yet --- src/plugins/platforms/eglfs/eglintegration.cpp | 469 +++++++++++++++++++++++++ src/plugins/platforms/eglfs/eglintegration.h | 70 ++++ src/plugins/platforms/eglfs/eglintegration.pro | 14 + src/plugins/platforms/eglfs/main.cpp | 72 ++++ 4 files changed, 625 insertions(+) create mode 100644 src/plugins/platforms/eglfs/eglintegration.cpp create mode 100644 src/plugins/platforms/eglfs/eglintegration.h create mode 100644 src/plugins/platforms/eglfs/eglintegration.pro create mode 100644 src/plugins/platforms/eglfs/main.cpp diff --git a/src/plugins/platforms/eglfs/eglintegration.cpp b/src/plugins/platforms/eglfs/eglintegration.cpp new file mode 100644 index 0000000..5ea0bb2 --- /dev/null +++ b/src/plugins/platforms/eglfs/eglintegration.cpp @@ -0,0 +1,469 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "eglintegration.h" + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "../eglconvenience/qeglconvenience.h" + +//#define QEGL_EXTRA_DEBUG +#ifdef QEGL_EXTRA_DEBUG +struct AttrInfo { EGLint attr; const char *name; }; +static struct AttrInfo attrs[] = { + {EGL_BUFFER_SIZE, "EGL_BUFFER_SIZE"}, + {EGL_ALPHA_SIZE, "EGL_ALPHA_SIZE"}, + {EGL_BLUE_SIZE, "EGL_BLUE_SIZE"}, + {EGL_GREEN_SIZE, "EGL_GREEN_SIZE"}, + {EGL_RED_SIZE, "EGL_RED_SIZE"}, + {EGL_DEPTH_SIZE, "EGL_DEPTH_SIZE"}, + {EGL_STENCIL_SIZE, "EGL_STENCIL_SIZE"}, + {EGL_CONFIG_CAVEAT, "EGL_CONFIG_CAVEAT"}, + {EGL_CONFIG_ID, "EGL_CONFIG_ID"}, + {EGL_LEVEL, "EGL_LEVEL"}, + {EGL_MAX_PBUFFER_HEIGHT, "EGL_MAX_PBUFFER_HEIGHT"}, + {EGL_MAX_PBUFFER_PIXELS, "EGL_MAX_PBUFFER_PIXELS"}, + {EGL_MAX_PBUFFER_WIDTH, "EGL_MAX_PBUFFER_WIDTH"}, + {EGL_NATIVE_RENDERABLE, "EGL_NATIVE_RENDERABLE"}, + {EGL_NATIVE_VISUAL_ID, "EGL_NATIVE_VISUAL_ID"}, + {EGL_NATIVE_VISUAL_TYPE, "EGL_NATIVE_VISUAL_TYPE"}, + {EGL_SAMPLES, "EGL_SAMPLES"}, + {EGL_SAMPLE_BUFFERS, "EGL_SAMPLE_BUFFERS"}, + {EGL_SURFACE_TYPE, "EGL_SURFACE_TYPE"}, + {EGL_TRANSPARENT_TYPE, "EGL_TRANSPARENT_TYPE"}, + {EGL_TRANSPARENT_BLUE_VALUE, "EGL_TRANSPARENT_BLUE_VALUE"}, + {EGL_TRANSPARENT_GREEN_VALUE, "EGL_TRANSPARENT_GREEN_VALUE"}, + {EGL_TRANSPARENT_RED_VALUE, "EGL_TRANSPARENT_RED_VALUE"}, + {EGL_BIND_TO_TEXTURE_RGB, "EGL_BIND_TO_TEXTURE_RGB"}, + {EGL_BIND_TO_TEXTURE_RGBA, "EGL_BIND_TO_TEXTURE_RGBA"}, + {EGL_MIN_SWAP_INTERVAL, "EGL_MIN_SWAP_INTERVAL"}, + {EGL_MAX_SWAP_INTERVAL, "EGL_MAX_SWAP_INTERVAL"}, + {-1, 0}}; +#endif //QEGL_EXTRA_DEBUG + + +class QEglScreen; + +class QEglContext : public QPlatformGLContext +{ +public: + QEglContext(QGLFormat& format, QPlatformGLContext* shareContext = 0); + ~QEglContext(); + + virtual void makeCurrent(); + virtual void doneCurrent(); + virtual void swapBuffers(); + virtual void* getProcAddress(const QString& procName); + + EGLContext eglContext() {return m_context;} + QSize size() const { return m_size; } + + QGLFormat format() const { return m_format; } +private: + + EGLContext m_context; + EGLDisplay m_dpy; + EGLSurface m_surface; + QSize m_size; + static bool singleton_watch; + QGLFormat m_format; +}; + +bool QEglContext::singleton_watch = false; + +QEglContext::QEglContext(QGLFormat& format, QPlatformGLContext* shareContext) +{ + if (singleton_watch) + qFatal("There can be only one"); + singleton_watch = true; + + Q_UNUSED(shareContext); + Q_UNUSED(format); + + EGLint major, minor; +#ifdef QEGL_EXTRA_DEBUG + EGLint index; +#endif + if (!eglBindAPI(EGL_OPENGL_ES_API)) { + fprintf(stderr, "Could not bind GL_ES API\n"); + qFatal("EGL error"); + } + + m_dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); + if (m_dpy == EGL_NO_DISPLAY) { + fprintf(stderr, "Could not open egl display\n"); + qFatal("EGL error"); + } + fprintf(stderr, "Opened display %p\n", m_dpy); + + if (!eglInitialize(m_dpy, &major, &minor)) { + fprintf(stderr, "Could not initialize egl display\n"); + qFatal("EGL error"); + } + + fprintf(stderr, "Initialized display %d %d\n", major, minor); + + QPlatformWindowFormat platformFormat; + platformFormat.setDepth(16); + platformFormat.setWindowApi(QPlatformWindowFormat::OpenGL); + platformFormat.setRedBufferSize(5); + platformFormat.setGreenBufferSize(6); + platformFormat.setBlueBufferSize(5); + EGLConfig config = q_configFromQPlatformWindowFormat(m_dpy, platformFormat); + +#ifdef QEGL_EXTRA_DEBUG + fprintf(stderr, "Configuration %d matches requirements\n", (int)config); + + for (index = 0; attrs[index].attr != -1; ++index) { + EGLint value; + if (eglGetConfigAttrib(m_dpy, config, attrs[index].attr, &value)) { + printf("\t%s: %d\n", attrs[index].name, (int)value); + } + } + printf("\n"); +#endif + EGLint temp; + EGLint attribList[32]; + + temp = 0; + + attribList[temp++] = EGL_CONTEXT_CLIENT_VERSION; + attribList[temp++] = 2; // GLES version 2 + attribList[temp++] = EGL_NONE; + + + m_context = eglCreateContext(m_dpy, config, NULL, attribList); + if (m_context == EGL_NO_CONTEXT) { + fprintf(stderr, "Could not create the egl context\n"); + eglTerminate(m_dpy); + qFatal("EGL error"); + } + + m_surface = eglCreateWindowSurface(m_dpy, config, 0, NULL); + if (m_surface == EGL_NO_SURFACE) { + fprintf(stderr, "Could not create the egl surface: error = 0x%x\n", eglGetError()); + eglTerminate(m_dpy); + qFatal("EGL error"); + } + + EGLint w,h; + + eglQuerySurface(m_dpy, m_surface, EGL_WIDTH, &w); + eglQuerySurface(m_dpy, m_surface, EGL_HEIGHT, &h); + fprintf(stderr, "Created surface %dx%d\n", w, h); + + m_size = QSize(w,h); + + +} + +QEglContext::~QEglContext() +{ +#ifdef QEGL_EXTRA_DEBUG + qDebug() << "QEglContext::~QEglContext()"; +#endif +} + +void QEglContext::makeCurrent() +{ +#ifdef QEGL_EXTRA_DEBUG + fprintf(stderr, "QEglContext::makeCurrent\n"); +#endif + if (!eglMakeCurrent(m_dpy, m_surface, m_surface, m_context)) + fprintf(stderr, "Could not make the egl context current\n"); + +#ifdef QEGL_EXTRA_DEBUG + static bool showDebug = true; + if (showDebug) { + showDebug = false; + const char *str = (const char*)glGetString(GL_VENDOR); + qDebug() << "Vendor" << str; + printf("Vendor %s\n", str); + str = (const char*)glGetString(GL_RENDERER); + qDebug() << "Renderer" << str; + printf("Renderer %s\n", str); + str = (const char*)glGetString(GL_VERSION); + qDebug() << "Version" << str; + printf("Version %s\n", str); + + str = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION); + qDebug() << "Shader version" << str; + + str = (const char*)glGetString(GL_EXTENSIONS); + qDebug() << "Extensions" << str; + printf("Extensions %s\n", str); + + } +#endif +} + +void QEglContext::doneCurrent() +{ +#ifdef QEGL_EXTRA_DEBUG + fprintf(stderr, "QEglContext::doneCurrent\n"); +#endif + if (!eglMakeCurrent(m_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)) + fprintf(stderr, "Could not release the egl context\n"); +} + +void QEglContext::swapBuffers() +{ +#ifdef QEGL_EXTRA_DEBUG + fprintf(stderr, "QEglContext::swapBuffers\n"); +#endif + eglSwapBuffers(m_dpy, m_surface); +} + +void* QEglContext::getProcAddress(const QString& procName) +{ +#ifdef QEGL_EXTRA_DEBUG + fprintf(stderr, "QEglContext::getProcAddress\n"); +#endif + return (void*)eglGetProcAddress(qPrintable(procName)); +} + + +class QEglPaintDevice; +class QEglScreen : public QPlatformScreen +{ +public: + QEglScreen(); + ~QEglScreen() {} + + QRect geometry() const { /*qDebug() << "QEglScreen::geometry()";*/ return m_geometry; } + int depth() const { qDebug() << "QEglScreen::depth()"; return m_depth; } + QImage::Format format() const {qDebug() << "QEglScreen::format()"; return m_format; } + //QSize physicalSize() const { return m_physicalSize; } //### + +public: + QRect m_geometry; + int m_depth; + QImage::Format m_format; + //QSize m_physicalSize; + QEglContext * m_platformContext; +}; + + +class QEglWindow : public QPlatformWindow +{ +public: + QEglWindow(QWidget *w, QEglScreen *screen); + QPlatformGLContext *glContext(); + + void setGeometry(const QRect &); + WId winId() const; + + QGLContext *context() { return m_context; } + QEglPaintDevice *paintDevice() { return m_pd; } +private: + QEglScreen *m_screen; + QEglPaintDevice *m_pd; + QGLContext *m_context; + WId m_winid; +}; + +class QEglPaintDevice : public QGLPaintDevice +{ +public: + QEglPaintDevice(QEglScreen *screen, QEglWindow *window); + + QSize size() const { return m_screen->geometry().size(); } + QGLContext* context() const { return m_window->context();} + + QPaintEngine *paintEngine() const { return qt_qgl_paint_engine(); } + + void beginPaint(){ + QGLPaintDevice::beginPaint(); + } +private: + QEglScreen *m_screen; + QEglWindow * m_window; +}; + + + + +QEglScreen::QEglScreen() + : m_depth(16), m_format(QImage::Format_RGB16), m_platformContext(0) +{ +#ifdef QEGL_EXTRA_DEBUG + fprintf(stderr, "QEglScreen %p\n", this); +#endif + QGLFormat format = QGLFormat::defaultFormat(); + m_platformContext = new QEglContext(format); + + + m_geometry = QRect(QPoint(), m_platformContext->size()); + +} + + + + +QEglPaintDevice::QEglPaintDevice(QEglScreen *screen, QEglWindow *window) + :QGLPaintDevice(), m_screen(screen), m_window(window) +{ +#ifdef QEGL_EXTRA_DEBUG + qDebug() << "QEglPaintDevice" << this << screen << window; +#endif +} + + + +QEglWindow::QEglWindow(QWidget *w, QEglScreen *screen) + : QPlatformWindow(w), m_screen(screen), m_pd(0), m_context(0) +{ + static int serialNo = 0; + m_winid = ++serialNo; +#ifdef QEGL_EXTRA_DEBUG + fprintf(stderr, "QEglWindow %p: %p %p 0x%x\n", this, w, screen, uint(m_winid)); +#endif + m_pd = new QEglPaintDevice(screen, this); + m_context = new QGLContext( screen->m_platformContext->format(), w); + m_context->create(); +} + + +void QEglWindow::setGeometry(const QRect &) +{ + // We only support full-screen windows + QRect rect(m_screen->availableGeometry()); + QWindowSystemInterface::handleGeometryChange(this->widget(), rect); + + QPlatformWindow::setGeometry(rect); +} + +WId QEglWindow::winId() const +{ + return m_winid; +} + + + +QPlatformGLContext *QEglWindow::glContext() +{ +#ifdef QEGL_EXTRA_DEBUG + fprintf(stderr, "QEglWindow::glContext %p\n", m_screen->m_platformContext); +#endif + Q_ASSERT(m_screen); + return m_screen->m_platformContext; +} + +QEglIntegration::QEglIntegration() +{ + m_primaryScreen = new QEglScreen(); + + mScreens.append(m_primaryScreen); +#ifdef QEGL_EXTRA_DEBUG + fprintf(stderr, "QEglIntegration\n"); +#endif +} + +QPixmapData *QEglIntegration::createPixmapData(QPixmapData::PixelType type) const +{ +#ifdef QEGL_EXTRA_DEBUG + fprintf(stderr, "QEglIntegration::createPixmapData %d\n", type); +#endif + return new QGLPixmapData(type); +} + +QPlatformWindow *QEglIntegration::createPlatformWindow(QWidget *widget, WId winId) const +{ + Q_UNUSED(winId); +#ifdef QEGL_EXTRA_DEBUG + qDebug() << "QEglIntegration::createPlatformWindow" << widget; +#endif + return new QEglWindow(widget, m_primaryScreen); +} + + +class QEglWindowSurface : public QWindowSurface +{ +public: + QEglWindowSurface(QWidget *window, QEglScreen *screen); + ~QEglWindowSurface() {} + + QPaintDevice *paintDevice() { return m_window->paintDevice(); } + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void resize(const QSize &size) {} +private: + QEglScreen *m_screen; + QEglWindow *m_window; +}; + +QEglWindowSurface::QEglWindowSurface(QWidget *window, QEglScreen *screen) + :QWindowSurface(window), m_screen(screen), m_window(0) +{ +#ifdef QEGL_EXTRA_DEBUG + qDebug() << "QEglWindowSurface" << window << screen; +#endif + m_window = static_cast(window->platformWindow()); +} + + +void QEglWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + Q_UNUSED(region); + Q_UNUSED(offset); +#ifdef QEGL_EXTRA_DEBUG + qDebug() << "QEglWindowSurface::flush"; +#endif + m_screen->m_platformContext->swapBuffers(); +} + +QWindowSurface *QEglIntegration::createWindowSurface(QWidget *widget, WId winId) const +{ + Q_UNUSED(winId); + +#ifdef QEGL_EXTRA_DEBUG + qDebug() << "QEglIntegration::createWindowSurface" << widget; +#endif + return new QEglWindowSurface(widget, m_primaryScreen); +} diff --git a/src/plugins/platforms/eglfs/eglintegration.h b/src/plugins/platforms/eglfs/eglintegration.h new file mode 100644 index 0000000..7b9b8cf --- /dev/null +++ b/src/plugins/platforms/eglfs/eglintegration.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef EGLINTEGRATION_H +#define EGLINTEGRATION_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QEglScreen; +class QEglIntegration : public QPlatformIntegration +{ +public: + QEglIntegration(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; + QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; + + QList screens() const { return mScreens; } + +private: + QList mScreens; + QEglScreen *m_primaryScreen; +}; + +QT_END_NAMESPACE + + +#endif diff --git a/src/plugins/platforms/eglfs/eglintegration.pro b/src/plugins/platforms/eglfs/eglintegration.pro new file mode 100644 index 0000000..7cd2f05 --- /dev/null +++ b/src/plugins/platforms/eglfs/eglintegration.pro @@ -0,0 +1,14 @@ +TARGET = eglintegration +TEMPLATE = lib +CONFIG += plugin + +QT += opengl + +SOURCES = main.cpp \ + eglintegration.cpp \ + ../eglconvenience/qeglconvenience.cpp +HEADERS = eglintegration.h \ + ../eglconvenience/qeglconvenience.h + +target.path += $$[QT_INSTALL_PLUGINS]/platforms +INSTALLS += target diff --git a/src/plugins/platforms/eglfs/main.cpp b/src/plugins/platforms/eglfs/main.cpp new file mode 100644 index 0000000..adaea78 --- /dev/null +++ b/src/plugins/platforms/eglfs/main.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "eglintegration.h" + +QT_BEGIN_NAMESPACE + +class QEglIntegrationPlugin : public QPlatformIntegrationPlugin +{ +public: + QStringList keys() const; + QPlatformIntegration *create(const QString&, const QStringList&); +}; + +QStringList QEglIntegrationPlugin::keys() const +{ + QStringList list; + list << "EglFS"; + return list; +} + +QPlatformIntegration* QEglIntegrationPlugin::create(const QString& system, const QStringList& paramList) +{ + Q_UNUSED(paramList); + if (system.toLower() == "eglfs") + return new QEglIntegration; + + return 0; +} + +Q_EXPORT_PLUGIN2(eglintegration, QEglIntegrationPlugin) + +QT_END_NAMESPACE -- cgit v0.12 From bc5f5d99078d9ca1f4fc80fc7d0fe753d5ef396a Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 14 Jul 2010 15:51:25 +0200 Subject: Temporary hack so QtOpenGL compiles for Lighthouse --- src/opengl/qgl.cpp | 4 ++-- src/opengl/qwindowsurface_gl.cpp | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 4353d4b..2f16b99 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2263,7 +2263,7 @@ static void convertToGLFormatHelper(QImage &dst, const QImage &img, GLenum textu } } -#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) +#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) || defined(Q_WS_QPA) QGLExtensionFuncs& QGLContextPrivate::extensionFuncs(const QGLContext *) { return qt_extensionFuncs; @@ -5301,7 +5301,7 @@ void QGLWidgetPrivate::initContext(QGLContext *context, const QGLWidget* shareWi glcx = new QGLContext(QGLFormat::defaultFormat(), q); } -#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) +#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) || defined(Q_WS_QPA) Q_GLOBAL_STATIC(QString, qt_gl_lib_name) Q_OPENGL_EXPORT void qt_set_gl_library_name(const QString& name) diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 6571a76..8c54fd1 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -499,11 +499,13 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & } } #endif +#ifndef Q_WS_QPA //############################################### if (d_ptr->paintedRegion.boundingRect() != geometry()) { // Emits warning if not supported. Should never happen unless // setPartialUpdateSupport(true) has been called. context()->d_func()->swapRegion(&d_ptr->paintedRegion); } else +#endif context()->swapBuffers(); d_ptr->paintedRegion = QRegion(); -- cgit v0.12 From 1bc01e54e190915d64d2e42a0bc18ee01131b1d5 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 15 Jul 2010 15:12:24 +0200 Subject: Remove qDebug() --- src/plugins/platforms/eglfs/eglintegration.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/eglfs/eglintegration.cpp b/src/plugins/platforms/eglfs/eglintegration.cpp index 5ea0bb2..9470c99 100644 --- a/src/plugins/platforms/eglfs/eglintegration.cpp +++ b/src/plugins/platforms/eglfs/eglintegration.cpp @@ -276,9 +276,9 @@ public: QEglScreen(); ~QEglScreen() {} - QRect geometry() const { /*qDebug() << "QEglScreen::geometry()";*/ return m_geometry; } - int depth() const { qDebug() << "QEglScreen::depth()"; return m_depth; } - QImage::Format format() const {qDebug() << "QEglScreen::format()"; return m_format; } + QRect geometry() const { return m_geometry; } + int depth() const { return m_depth; } + QImage::Format format() const { return m_format; } //QSize physicalSize() const { return m_physicalSize; } //### public: -- cgit v0.12 From d9b023b5d38d858f29e7095aeb25a84f09a19c13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 15 Jul 2010 16:57:07 +0200 Subject: Eventloop integration in Lighthouse This is exprimental and does not work with the glib eventloop. --- src/gui/kernel/kernel.pri | 6 +- src/gui/kernel/qeventdispatcher_glib_qpa.cpp | 8 + src/gui/kernel/qeventdispatcher_qpa.cpp | 186 +++++++++++++++++++-- src/gui/kernel/qeventdispatcher_qpa_p.h | 6 +- .../kernel/qplatformeventloopintegration_qpa.cpp | 0 src/gui/kernel/qplatformeventloopintegration_qpa.h | 13 ++ src/gui/kernel/qplatformintegration_qpa.cpp | 5 + src/gui/kernel/qplatformintegration_qpa.h | 5 + src/plugins/platforms/openkode/openkode.pro | 6 +- .../openkode/qopenkodeeventloopintegration.cpp | 29 ++++ .../openkode/qopenkodeeventloopintegration.h | 17 ++ .../platforms/openkode/qopenkodeintegration.cpp | 42 +---- .../platforms/openkode/qopenkodeintegration.h | 4 +- src/plugins/platforms/openkode/qopenkodewindow.cpp | 1 - .../platforms/openkode/qopenkodewindowsurface.cpp | 6 +- 15 files changed, 272 insertions(+), 62 deletions(-) create mode 100644 src/gui/kernel/qplatformeventloopintegration_qpa.cpp create mode 100644 src/gui/kernel/qplatformeventloopintegration_qpa.h create mode 100644 src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp create mode 100644 src/plugins/platforms/openkode/qopenkodeeventloopintegration.h diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 02badee..ba86c1c 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -219,7 +219,8 @@ qpa { kernel/qplatformwindow_qpa.h \ kernel/qplatformwindowformat_qpa.h \ kernel/qplatformglcontext_qpa.h \ - kernel/qdesktopwidget_qpa_p.h + kernel/qdesktopwidget_qpa_p.h \ + kernel/qplatformeventloopintegration_qpa.h SOURCES += \ kernel/qapplication_qpa.cpp \ @@ -238,7 +239,8 @@ qpa { kernel/qplatformintegrationfactory_qpa.cpp \ kernel/qplatformintegrationplugin_qpa.cpp \ kernel/qplatformwindow_qpa.cpp \ - kernel/qplatformwindowformat_qpa.cpp + kernel/qplatformwindowformat_qpa.cpp \ + kernel/qplatformeventloopintegration_qpa.cpp contains(QT_CONFIG, glib) { SOURCES += \ diff --git a/src/gui/kernel/qeventdispatcher_glib_qpa.cpp b/src/gui/kernel/qeventdispatcher_glib_qpa.cpp index 9585b26..981991d 100644 --- a/src/gui/kernel/qeventdispatcher_glib_qpa.cpp +++ b/src/gui/kernel/qeventdispatcher_glib_qpa.cpp @@ -133,6 +133,14 @@ QPAEventDispatcherGlib::~QPAEventDispatcherGlib() bool QPAEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags) { + static bool init = false; + if (!init) { + if (QApplicationPrivate::platformIntegration()->createEventLoopIntegration()) { + qWarning("Eventloop integration is not supported by the glib event dispatcher"); + qWarning("Use the UNIX event dispatcher by defining environment variable QT_NO_GLIB=1"); + } + init = true; + } return QEventDispatcherGlib::processEvents(flags); } diff --git a/src/gui/kernel/qeventdispatcher_qpa.cpp b/src/gui/kernel/qeventdispatcher_qpa.cpp index 5740548..f7f3db3 100644 --- a/src/gui/kernel/qeventdispatcher_qpa.cpp +++ b/src/gui/kernel/qeventdispatcher_qpa.cpp @@ -44,24 +44,135 @@ #include "qeventdispatcher_qpa_p.h" #include "private/qeventdispatcher_unix_p.h" #include "qapplication_p.h" -#ifndef QT_NO_THREAD -# include "qmutex.h" -#endif +#include "qplatformeventloopintegration_qpa.h" + #include +#include +#include +#include #include + QT_BEGIN_NAMESPACE QT_USE_NAMESPACE +class Rendezvous +{ +public: + void checkpoint() + { + if (state.testAndSetOrdered(0,1)) { + semaphore.acquire(); + } else if (state.testAndSetAcquire(1,0)) { + semaphore.release(); + } else { + qWarning("Barrier internal error"); + } + } +private: + QSemaphore semaphore; + QAtomicInt state; +}; + +class SelectWorker : public QThread +{ +public: + SelectWorker(QEventDispatcherQPAPrivate *eventDispatcherPrivate) + : QThread(), + m_edPrivate(eventDispatcherPrivate), + m_retVal(0) + { + } + + void setSelectValues(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds) + { + m_nfds = nfds; + m_readfds = readfds; + m_writefds = writefds; + m_exceptfds = exceptfds; + + + } + + int retVal() const { + return m_retVal; + } + +protected: + void run(); + +private: + QEventDispatcherQPAPrivate *m_edPrivate; + int m_retVal; + + int m_nfds; + fd_set *m_readfds, *m_writefds, *m_exceptfds; +}; + class QEventDispatcherQPAPrivate : public QEventDispatcherUNIXPrivate { Q_DECLARE_PUBLIC(QEventDispatcherQPA) public: - inline QEventDispatcherQPAPrivate() - { } -}; + QEventDispatcherQPAPrivate() + : eventLoopIntegration(0), + barrierBeforeBlocking(0), + barrierReturnValue(0), + selectReturnMutex(0), + selectWorkerNeedsSync(true), + selectWorkerHasResult(false), + m_integrationInitialised(false), + m_hasIntegration(false) + { + } + + ~QEventDispatcherQPAPrivate() + { + delete selectWorker; + delete eventLoopIntegration; + delete barrierBeforeBlocking; + delete barrierReturnValue; + delete selectReturnMutex; + } + + bool hasIntegration() const + { + if (!m_integrationInitialised) { + QEventDispatcherQPAPrivate *that = const_cast(this); + if (qApp && (qApp->thread() == QThread::currentThread())) { // guiThread + if (QApplicationPrivate::platformIntegration()) { + that->eventLoopIntegration = QApplicationPrivate::platformIntegration()->createEventLoopIntegration(); + if (that->eventLoopIntegration) { + that->selectWorker = new SelectWorker(that); + that->barrierBeforeBlocking = new Rendezvous; + that->barrierReturnValue = new Rendezvous; + that->selectReturnMutex = new QMutex; + that->selectWorker->start(); + that->m_hasIntegration = true; + if (!QElapsedTimer::isMonotonic()) + qWarning("Having eventloop integration without monotonic timers can lead to undefined behaviour"); + } + } + } + that->m_integrationInitialised = true; + } + return m_hasIntegration; + } + + QPlatformEventLoopIntegration *eventLoopIntegration; + Rendezvous *barrierBeforeBlocking; + Rendezvous *barrierReturnValue; + + QMutex *selectReturnMutex; + bool selectWorkerNeedsSync; + bool selectWorkerHasResult; + + SelectWorker *selectWorker; +private: + bool m_integrationInitialised; + bool m_hasIntegration; +}; QEventDispatcherQPA::QEventDispatcherQPA(QObject *parent) : QEventDispatcherUNIX(*new QEventDispatcherQPAPrivate, parent) @@ -70,10 +181,6 @@ QEventDispatcherQPA::QEventDispatcherQPA(QObject *parent) QEventDispatcherQPA::~QEventDispatcherQPA() { } - - -//#define ZERO_FOR_THE_MOMENT - bool QEventDispatcherQPA::processEvents(QEventLoop::ProcessEventsFlags flags) { Q_D(QEventDispatcherQPA); @@ -115,17 +222,24 @@ bool QEventDispatcherQPA::processEvents(QEventLoop::ProcessEventsFlags flags) bool QEventDispatcherQPA::hasPendingEvents() { extern uint qGlobalPostedEventsCount(); // from qapplication.cpp - return qGlobalPostedEventsCount() || QWindowSystemInterfacePrivate::userEventsQueued();; + return qGlobalPostedEventsCount() || QWindowSystemInterfacePrivate::userEventsQueued(); } -void QEventDispatcherQPA::startingUp() +void QEventDispatcherQPA::registerSocketNotifier(QSocketNotifier *notifier) { + Q_D(QEventDispatcherQPA); + QEventDispatcherUNIX::registerSocketNotifier(notifier); + if (d->hasIntegration()) + wakeUp(); } -void QEventDispatcherQPA::closingDown() +void QEventDispatcherQPA::unregisterSocketNotifier(QSocketNotifier *notifier) { - + Q_D(QEventDispatcherQPA); + QEventDispatcherUNIX::unregisterSocketNotifier(notifier); + if (d->hasIntegration()) + wakeUp(); } void QEventDispatcherQPA::flush() @@ -138,7 +252,49 @@ void QEventDispatcherQPA::flush() int QEventDispatcherQPA::select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, timeval *timeout) { - return QEventDispatcherUNIX::select(nfds, readfds, writefds, exceptfds, timeout); + Q_D(QEventDispatcherQPA); + int retVal = 0; + if (d->hasIntegration()) { + qint64 timeoutmsec = timeout->tv_sec * 1000 + (timeout->tv_usec/1000); + d->selectReturnMutex->lock(); + if (d->selectWorkerNeedsSync) { + if (d->selectWorkerHasResult) { + retVal = d->selectWorker->retVal(); + d->selectWorkerHasResult = false; + + d->selectReturnMutex->unlock(); + d->barrierReturnValue->checkpoint(); + return retVal; + } else { + d->selectWorkerNeedsSync = false; + d->selectWorker->setSelectValues(nfds,readfds, writefds, exceptfds); + d->barrierBeforeBlocking->checkpoint(); + } + } + d->selectReturnMutex->unlock(); + d->eventLoopIntegration->processEvents(timeoutmsec); + retVal = 0; //is 0 if select has not returned + } else { + retVal = QEventDispatcherUNIX::select(nfds, readfds, writefds, exceptfds, timeout); + } + return retVal; } +void SelectWorker::run() +{ + while(true) { + m_retVal = 0; + m_edPrivate->barrierBeforeBlocking->checkpoint(); // wait for mainthread + int tmpRet = qt_safe_select(m_nfds,m_readfds,m_writefds,m_exceptfds,0); + m_edPrivate->selectReturnMutex->lock(); + m_edPrivate->eventLoopIntegration->wakeup(); + + m_edPrivate->selectWorkerNeedsSync = true; + m_edPrivate->selectWorkerHasResult = true; + m_retVal = tmpRet; + + m_edPrivate->selectReturnMutex->unlock(); + m_edPrivate->barrierReturnValue->checkpoint(); + } +} QT_END_NAMESPACE diff --git a/src/gui/kernel/qeventdispatcher_qpa_p.h b/src/gui/kernel/qeventdispatcher_qpa_p.h index 878daaa..8065c3e 100644 --- a/src/gui/kernel/qeventdispatcher_qpa_p.h +++ b/src/gui/kernel/qeventdispatcher_qpa_p.h @@ -71,10 +71,10 @@ public: bool processEvents(QEventLoop::ProcessEventsFlags flags); bool hasPendingEvents(); - void flush(); + void registerSocketNotifier(QSocketNotifier *notifier); + void unregisterSocketNotifier(QSocketNotifier *notifier); - void startingUp(); - void closingDown(); + void flush(); protected: int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, diff --git a/src/gui/kernel/qplatformeventloopintegration_qpa.cpp b/src/gui/kernel/qplatformeventloopintegration_qpa.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/gui/kernel/qplatformeventloopintegration_qpa.h b/src/gui/kernel/qplatformeventloopintegration_qpa.h new file mode 100644 index 0000000..5e4c227 --- /dev/null +++ b/src/gui/kernel/qplatformeventloopintegration_qpa.h @@ -0,0 +1,13 @@ +#ifndef QPLATFORMEVENTLOOPINTEGRATION_QPA_H +#define QPLATFORMEVENTLOOPINTEGRATION_QPA_H + +#include + +class QPlatformEventLoopIntegration +{ +public: + virtual void processEvents( qint64 msec ) = 0; + virtual void wakeup() = 0; +}; + +#endif // QPLATFORMEVENTLOOPINTEGRATION_QPA_H diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp index 8666911..b3f46ce 100644 --- a/src/gui/kernel/qplatformintegration_qpa.cpp +++ b/src/gui/kernel/qplatformintegration_qpa.cpp @@ -56,6 +56,11 @@ QPixmap QPlatformIntegration::grabWindow(WId window, int x, int y, int width, in return QPixmap(); } +QPlatformEventLoopIntegration *QPlatformIntegration::createEventLoopIntegration() const +{ + return 0; +} + bool QPlatformIntegration::hasOpenGL() const { return false; diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index 8c1659f..11377e7 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -55,6 +55,7 @@ class QPlatformWindow; class QWindowSurface; class QBlittable; class QWidget; +class QPlatformEventLoopIntegration; class Q_GUI_EXPORT QPlatformIntegration { @@ -73,8 +74,12 @@ public: virtual bool isVirtualDesktop() { return false; } virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const; +// Experimental + virtual QPlatformEventLoopIntegration *createEventLoopIntegration() const; + virtual bool hasOpenGL() const; + }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/openkode/openkode.pro b/src/plugins/platforms/openkode/openkode.pro index c039131..2d90b15 100644 --- a/src/plugins/platforms/openkode/openkode.pro +++ b/src/plugins/platforms/openkode/openkode.pro @@ -10,13 +10,15 @@ SOURCES = main.cpp \ qopenkodewindowsurface.cpp \ qopenkodewindow.cpp \ ../eglconvenience/qeglplatformcontext.cpp \ - ../eglconvenience/qeglconvenience.cpp + ../eglconvenience/qeglconvenience.cpp \ + qopenkodeeventloopintegration.cpp HEADERS = qopenkodeintegration.h \ qopenkodewindowsurface.h \ qopenkodewindow.h \ ../eglconvenience/qeglplatformcontext.h \ - ../eglconvenience/qeglconvenience.h + ../eglconvenience/qeglconvenience.h \ + qopenkodeeventloopintegration.h RESOURCES = resources.qrc diff --git a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp new file mode 100644 index 0000000..467b5b5 --- /dev/null +++ b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp @@ -0,0 +1,29 @@ +#include "qopenkodeeventloopintegration.h" + +#include + +#include + +QOpenKODEEventLoopIntegration::QOpenKODEEventLoopIntegration() +{ + m_kdThread = kdThreadSelf(); +} + +void QOpenKODEEventLoopIntegration::processEvents(qint64 msec) +{ + if (msec == 0) + msec = -1; + const KDEvent *event = kdWaitEvent(msec*1000); + if (event) { + kdDefaultEvent(event); + while ((event = kdWaitEvent(0)) != 0) { + kdDefaultEvent(event); + } + } +} + +void QOpenKODEEventLoopIntegration::wakeup() +{ + KDEvent *event = kdCreateEvent(); + kdPostThreadEvent(event,m_kdThread); +} diff --git a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h new file mode 100644 index 0000000..ef04640 --- /dev/null +++ b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h @@ -0,0 +1,17 @@ +#ifndef QOPENKODEEVENTLOOPINTEGRATION_H +#define QOPENKODEEVENTLOOPINTEGRATION_H + +#include + +class KDThread; +class QOpenKODEEventLoopIntegration : public QPlatformEventLoopIntegration +{ +public: + QOpenKODEEventLoopIntegration(); + void processEvents(qint64 msec); + void wakeup(); +private: + KDThread *m_kdThread; +}; + +#endif // QOPENKODEEVENTLOOPINTEGRATION_H diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.cpp b/src/plugins/platforms/openkode/qopenkodeintegration.cpp index 270763b..5dada28 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.cpp +++ b/src/plugins/platforms/openkode/qopenkodeintegration.cpp @@ -42,6 +42,7 @@ #include "qopenkodeintegration.h" #include "qopenkodewindowsurface.h" #include "qopenkodewindow.h" +#include "qopenkodeeventloopintegration.h" #include #include @@ -184,41 +185,11 @@ static GLuint loadShaders(const QString &vertexShader, const QString &fragmentSh return prog; } -class QOpenKODEEventLoopHelper : public QThread -{ -public: - QOpenKODEEventLoopHelper(QSemaphore *m) - : eventMutex(m) - { - m->acquire(); - } - -protected: - void run() - { - if (kdInitializeNV() == KD_ENOTINITIALIZED) { - qFatal("Did not manage to initialize openkode"); - } - eventMutex->release(); - - const KDEvent *event; - while ((event = kdWaitEvent(-1)) != 0) { - qDebug() << "!!! received event!"; - kdDefaultEvent(event); - } - } - -private: - QSemaphore *eventMutex; -}; - QOpenKODEIntegration::QOpenKODEIntegration() - : eventMutex(1) { - QOpenKODEEventLoopHelper *loop = new QOpenKODEEventLoopHelper(&eventMutex); - loop->start(); - eventMutex.acquire(); // block until initialization done - + if (kdInitializeNV() == KD_ENOTINITIALIZED) { + qFatal("Did not manage to initialize openkode"); + } QOpenKODEScreen *mPrimaryScreen = new QOpenKODEScreen(); mScreens.append(mPrimaryScreen); @@ -265,6 +236,11 @@ bool QOpenKODEIntegration::hasOpenGL() const return true; } +QPlatformEventLoopIntegration *QOpenKODEIntegration::createEventLoopIntegration() const +{ + return new QOpenKODEEventLoopIntegration; +} + GLuint QOpenKODEIntegration::blitterProgram() { static GLuint shaderProgram = 0; diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.h b/src/plugins/platforms/openkode/qopenkodeintegration.h index 9029086..0eaf127 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.h +++ b/src/plugins/platforms/openkode/qopenkodeintegration.h @@ -86,7 +86,8 @@ public: QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; bool hasOpenGL() const; - QPlatformGLContext * createGLContext(); + + QPlatformEventLoopIntegration *createEventLoopIntegration() const; virtual QList screens() const { return mScreens; } @@ -94,7 +95,6 @@ public: private: QList mScreens; - QSemaphore eventMutex; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/openkode/qopenkodewindow.cpp b/src/plugins/platforms/openkode/qopenkodewindow.cpp index 2213a8f..faba2fb 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.cpp +++ b/src/plugins/platforms/openkode/qopenkodewindow.cpp @@ -60,7 +60,6 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) : QPlatformWindow(tlw) { - if (tlw->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenVG) { m_eglApi = EGL_OPENVG_API; } else { diff --git a/src/plugins/platforms/openkode/qopenkodewindowsurface.cpp b/src/plugins/platforms/openkode/qopenkodewindowsurface.cpp index a349031..84e27f5 100644 --- a/src/plugins/platforms/openkode/qopenkodewindowsurface.cpp +++ b/src/plugins/platforms/openkode/qopenkodewindowsurface.cpp @@ -93,8 +93,6 @@ void QOpenKODEWindowSurface::flush(QWidget *widget, const QRegion ®ion, const y = boundingRect.y(); } - qDebug() << "flush" << widget << offset << region.boundingRect() << mImage.format() << blitImage.format(); - GLuint shaderProgram = QOpenKODEIntegration::blitterProgram(); glUseProgram(shaderProgram); @@ -125,7 +123,7 @@ void QOpenKODEWindowSurface::flush(QWidget *widget, const QRegion ®ion, const glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, mImage.bits()); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, mImage.bits()); // Enable vertex attribute associated with vertex position glEnableVertexAttribArray(posId); @@ -166,7 +164,7 @@ void QOpenKODEWindowSurface::beginPaint(const QRegion ®ion) Q_UNUSED(region); if (mImage.isNull()) { m_platformGLContext = window()->platformWindow()->glContext(); - mImage = QImage(size(),QImage::Format_RGB32); + mImage = QImage(size(),QImage::Format_RGB888); } } -- cgit v0.12 From a7182f757e5414d7baf21fdc098f3f6649e6a1d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 20 Jul 2010 13:16:09 +0200 Subject: Cleanup directfb input handling in lighthouse --- src/plugins/platforms/directfb/qdirectfbinput.cpp | 97 +++++++--------------- src/plugins/platforms/directfb/qdirectfbinput.h | 42 +++------- .../platforms/directfb/qdirectfbintegration.cpp | 24 +++++- .../platforms/directfb/qdirectfbintegration.h | 6 +- src/plugins/platforms/directfb/qdirectfbwindow.cpp | 8 +- src/plugins/platforms/directfb/qdirectfbwindow.h | 5 +- 6 files changed, 74 insertions(+), 108 deletions(-) diff --git a/src/plugins/platforms/directfb/qdirectfbinput.cpp b/src/plugins/platforms/directfb/qdirectfbinput.cpp index 90c3348..7101b7b 100644 --- a/src/plugins/platforms/directfb/qdirectfbinput.cpp +++ b/src/plugins/platforms/directfb/qdirectfbinput.cpp @@ -10,89 +10,61 @@ #include -InputSocketWaiter::InputSocketWaiter(IDirectFBEventBuffer *eventBuffer, QObject *parent) - : QThread(parent), m_eventBuffer(eventBuffer),m_shouldStop(false) +QDirectFbInput::QDirectFbInput(QObject *parent) + : QObject(parent), m_shouldStop(false) { - this->start(); -} + m_dfbInterface = QDirectFbConvenience::dfbInterface(); -InputSocketWaiter::~InputSocketWaiter() -{ - m_shouldStop = true; - m_eventBuffer->WakeUp(m_eventBuffer); - m_cleanupMutex.lock(); -} + DFBResult ok = m_dfbInterface->CreateEventBuffer(m_dfbInterface,&m_eventBuffer); + if (ok != DFB_OK) + DirectFBError("Failed to initialise eventbuffer", ok); + + m_dfbInterface->GetDisplayLayer(m_dfbInterface,DLID_PRIMARY, &m_dfbDisplayLayer); -void InputSocketWaiter::continueWaitingForEvents() -{ - m_finishedProcessingEvents.wakeAll(); } -void InputSocketWaiter::run() +void QDirectFbInput::runInputEventLoop() { - m_cleanupMutex.lock(); - while (1) { + while (true) { m_eventBuffer->WaitForEvent(m_eventBuffer); - if (m_shouldStop) + if (m_shouldStop) { + m_waitStop.release(); break; - emit newEvent(); - QMutex waitForProcessingMutex; - waitForProcessingMutex.lock(); - m_finishedProcessingEvents.wait(&waitForProcessingMutex); - } - m_cleanupMutex.unlock(); -} - -QDirectFbInput *QDirectFbInput::instance() -{ - static QDirectFbInput *input = 0; - if (!input) { - input = new QDirectFbInput(); + } + handleEvents(); } - return input; } -QDirectFbInput::QDirectFbInput() - : QObject() +void QDirectFbInput::stopInputEventLoop() { - dfbInterface = QDirectFbConvenience::dfbInterface(); - - DFBResult ok = dfbInterface->CreateEventBuffer(dfbInterface,&eventBuffer); - if (ok != DFB_OK) - DirectFBError("Failed to initialise eventbuffer", ok); - - dfbInterface->GetDisplayLayer(dfbInterface,DLID_PRIMARY, &dfbDisplayLayer); - - m_inputHandler = new InputSocketWaiter(eventBuffer,this); - connect(m_inputHandler,SIGNAL(newEvent()),this,SLOT(handleEvents())); - - connect(QApplication::instance(),SIGNAL(aboutToQuit()),SLOT(applicationEnd())); + m_shouldStop = true; + m_waitStop.acquire(); } void QDirectFbInput::addWindow(DFBWindowID id, QWidget *tlw) { - tlwMap.insert(id,tlw); + m_tlwMap.insert(id,tlw); IDirectFBWindow *window; - dfbDisplayLayer->GetWindow(dfbDisplayLayer,id,&window); + m_dfbDisplayLayer->GetWindow(m_dfbDisplayLayer,id,&window); - window->AttachEventBuffer(window,eventBuffer); + window->AttachEventBuffer(window,m_eventBuffer); } void QDirectFbInput::removeWindow(WId wId) { IDirectFBWindow *window; - dfbDisplayLayer->GetWindow(dfbDisplayLayer,wId, &window); + m_dfbDisplayLayer->GetWindow(m_dfbDisplayLayer,wId, &window); - window->DetachEventBuffer(window,eventBuffer); - tlwMap.remove(wId); + window->DetachEventBuffer(window,m_eventBuffer); + m_tlwMap.remove(wId); } void QDirectFbInput::handleEvents() { - DFBResult hasEvent = eventBuffer->HasEvent(eventBuffer); + DFBResult hasEvent = m_eventBuffer->HasEvent(m_eventBuffer); while(hasEvent == DFB_OK){ DFBEvent event; - DFBResult ok = eventBuffer->GetEvent(eventBuffer,&event); + DFBResult ok = m_eventBuffer->GetEvent(m_eventBuffer,&event); if (ok != DFB_OK) DirectFBError("Failed to get event",ok); if (event.clazz == DFEC_WINDOW) { @@ -118,9 +90,8 @@ void QDirectFbInput::handleEvents() } - hasEvent = eventBuffer->HasEvent(eventBuffer); + hasEvent = m_eventBuffer->HasEvent(m_eventBuffer); } - m_inputHandler->continueWaitingForEvents(); } void QDirectFbInput::handleMouseEvents(const DFBEvent &event) @@ -140,22 +111,16 @@ void QDirectFbInput::handleMouseEvents(const DFBEvent &event) } else if (event.window.type == DWET_BUTTONUP) { window->UngrabPointer(window); } - QWidget *tlw = tlwMap.value(event.window.window_id); + QWidget *tlw = m_tlwMap.value(event.window.window_id); QWindowSystemInterface::handleMouseEvent(tlw, timestamp, p, globalPos, buttons); } -void QDirectFbInput::applicationEnd() -{ - delete m_inputHandler; - m_inputHandler = 0; -} - void QDirectFbInput::handleWheelEvent(const DFBEvent &event) { QPoint p(event.window.cx, event.window.cy); QPoint globalPos = globalPoint(event); long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000); - QWidget *tlw = tlwMap.value(event.window.window_id); + QWidget *tlw = m_tlwMap.value(event.window.window_id); QWindowSystemInterface::handleWheelEvent(tlw, timestamp, p, globalPos, event.window.step*120, Qt::Vertical); @@ -172,13 +137,13 @@ void QDirectFbInput::handleKeyEvents(const DFBEvent &event) QChar character; if (DFB_KEY_TYPE(event.window.key_symbol) == DIKT_UNICODE) character = QChar(event.window.key_symbol); - QWidget *tlw = tlwMap.value(event.window.window_id); + QWidget *tlw = m_tlwMap.value(event.window.window_id); QWindowSystemInterface::handleKeyEvent(tlw, timestamp, type, key, modifiers, character); } void QDirectFbInput::handleEnterLeaveEvents(const DFBEvent &event) { - QWidget *tlw = tlwMap.value(event.window.window_id); + QWidget *tlw = m_tlwMap.value(event.window.window_id); switch (event.window.type) { case DWET_ENTER: QWindowSystemInterface::handleEnterEvent(tlw); @@ -194,7 +159,7 @@ void QDirectFbInput::handleEnterLeaveEvents(const DFBEvent &event) inline QPoint QDirectFbInput::globalPoint(const DFBEvent &event) const { IDirectFBWindow *window; - dfbDisplayLayer->GetWindow(dfbDisplayLayer,event.window.window_id,&window); + m_dfbDisplayLayer->GetWindow(m_dfbDisplayLayer,event.window.window_id,&window); int x,y; window->GetPosition(window,&x,&y); return QPoint(event.window.cx +x, event.window.cy + y); diff --git a/src/plugins/platforms/directfb/qdirectfbinput.h b/src/plugins/platforms/directfb/qdirectfbinput.h index 016e7f1..0b2e7ed 100644 --- a/src/plugins/platforms/directfb/qdirectfbinput.h +++ b/src/plugins/platforms/directfb/qdirectfbinput.h @@ -1,9 +1,7 @@ #ifndef QDIRECTFBINPUT_H #define QDIRECTFBINPUT_H -#include -#include -#include +#include #include #include #include @@ -13,53 +11,35 @@ #include -class InputSocketWaiter : public QThread -{ - Q_OBJECT -public: - InputSocketWaiter(IDirectFBEventBuffer *eventBuffer, QObject *parent); - virtual ~InputSocketWaiter(); - void continueWaitingForEvents(); -protected: - void run(); -signals: - void newEvent(); -private: - IDirectFBEventBuffer *m_eventBuffer; - bool m_shouldStop; - QMutex m_cleanupMutex; - QWaitCondition m_finishedProcessingEvents; -}; - class QDirectFbInput : public QObject { Q_OBJECT public: - static QDirectFbInput *instance(); + QDirectFbInput(QObject *parent); void addWindow(DFBWindowID id, QWidget *tlw); void removeWindow(WId wId); public slots: + void runInputEventLoop(); + void stopInputEventLoop(); void handleEvents(); - void applicationEnd(); private: - QDirectFbInput(); - void handleMouseEvents(const DFBEvent &event); void handleWheelEvent(const DFBEvent &event); void handleKeyEvents(const DFBEvent &event); void handleEnterLeaveEvents(const DFBEvent &event); - IDirectFB *dfbInterface; - IDirectFBDisplayLayer *dfbDisplayLayer; - IDirectFBEventBuffer *eventBuffer; + inline QPoint globalPoint(const DFBEvent &event) const; - QHashtlwMap; - inline QPoint globalPoint(const DFBEvent &event) const; + IDirectFB *m_dfbInterface; + IDirectFBDisplayLayer *m_dfbDisplayLayer; + IDirectFBEventBuffer *m_eventBuffer; - InputSocketWaiter *m_inputHandler; + bool m_shouldStop; + QSemaphore m_waitStop; + QHashm_tlwMap; }; #endif // QDIRECTFBINPUT_H diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.cpp b/src/plugins/platforms/directfb/qdirectfbintegration.cpp index 60fce7e..c47fc8d 100644 --- a/src/plugins/platforms/directfb/qdirectfbintegration.cpp +++ b/src/plugins/platforms/directfb/qdirectfbintegration.cpp @@ -49,9 +49,10 @@ #include #include -#include -#include -#include +#include +#include +#include +#include QT_BEGIN_NAMESPACE @@ -94,8 +95,22 @@ QDirectFbIntegration::QDirectFbIntegration() } delete[] argv; + QDirectFbScreen *primaryScreen = new QDirectFbScreen(0); mScreens.append(primaryScreen); + + mInputRunner = new QThread; + mInput = new QDirectFbInput(0); + mInput->moveToThread(mInputRunner); + QObject::connect(mInputRunner,SIGNAL(started()),mInput,SLOT(runInputEventLoop())); + mInputRunner->start(); +} + +QDirectFbIntegration::~QDirectFbIntegration() +{ + mInput->stopInputEventLoop(); + delete mInputRunner; + delete mInput; } QPixmapData *QDirectFbIntegration::createPixmapData(QPixmapData::PixelType type) const @@ -109,7 +124,8 @@ QPixmapData *QDirectFbIntegration::createPixmapData(QPixmapData::PixelType type) QPlatformWindow *QDirectFbIntegration::createPlatformWindow(QWidget *widget, WId winId) const { Q_UNUSED(winId); - return new QDirectFbWindow(widget); + QDirectFbInput *input = const_cast(mInput);//gah + return new QDirectFbWindow(widget,input); } QWindowSurface *QDirectFbIntegration::createWindowSurface(QWidget *widget, WId winId) const diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.h b/src/plugins/platforms/directfb/qdirectfbintegration.h index c0e770f..27847e2 100644 --- a/src/plugins/platforms/directfb/qdirectfbintegration.h +++ b/src/plugins/platforms/directfb/qdirectfbintegration.h @@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE +class QThread; class QDirectFBCursor; class QDirectFbScreen : public QPlatformScreen @@ -81,6 +82,7 @@ class QDirectFbIntegration : public QPlatformIntegration { public: QDirectFbIntegration(); + ~QDirectFbIntegration(); QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; @@ -89,10 +91,10 @@ public: QList screens() const { return mScreens; } - - private: QList mScreens; + QDirectFbInput *mInput; + QThread *mInputRunner; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.cpp b/src/plugins/platforms/directfb/qdirectfbwindow.cpp index d88953e..30e6f5a 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindow.cpp +++ b/src/plugins/platforms/directfb/qdirectfbwindow.cpp @@ -45,8 +45,8 @@ #include -QDirectFbWindow::QDirectFbWindow(QWidget *tlw) - : QPlatformWindow(tlw) +QDirectFbWindow::QDirectFbWindow(QWidget *tlw, QDirectFbInput *inputhandler) + : QPlatformWindow(tlw), m_inputHandler(inputhandler) { IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); DFBDisplayLayerConfig layerConfig; @@ -83,12 +83,12 @@ QDirectFbWindow::QDirectFbWindow(QWidget *tlw) DFBWindowID id; m_dfbWindow->GetID(m_dfbWindow, &id); - QDirectFbInput::instance()->addWindow(id,tlw); + m_inputHandler->addWindow(id,tlw); } QDirectFbWindow::~QDirectFbWindow() { - QDirectFbInput::instance()->removeWindow(winId()); + m_inputHandler->removeWindow(winId()); m_dfbWindow->Destroy(m_dfbWindow); } diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.h b/src/plugins/platforms/directfb/qdirectfbwindow.h index d5fd408..b512afd 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindow.h +++ b/src/plugins/platforms/directfb/qdirectfbwindow.h @@ -45,13 +45,14 @@ #include #include "qdirectfbconvenience.h" +#include "qdirectfbinput.h" QT_BEGIN_NAMESPACE class QDirectFbWindow : public QPlatformWindow { public: - QDirectFbWindow(QWidget *tlw); + QDirectFbWindow(QWidget *tlw, QDirectFbInput *inputhandler); ~QDirectFbWindow(); void setGeometry(const QRect &rect); @@ -66,6 +67,8 @@ public: private: IDirectFBWindow *m_dfbWindow; + QDirectFbInput *m_inputHandler; + }; QT_END_NAMESPACE -- cgit v0.12 From 8dd6b648a7cf1625e078e91328ffebfa4a92529c Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 20 Jul 2010 16:13:13 +0200 Subject: Add Lighthouse #ifdefs --- tests/auto/qwidget/tst_qwidget.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index f91ad6b..5e39c27 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -357,7 +357,7 @@ private slots: void setClearAndResizeMask(); void maskedUpdate(); -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_QWS) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_QPA) void syntheticEnterLeave(); void taskQTBUG_4055_sendSyntheticEnterLeave(); #endif @@ -1979,7 +1979,7 @@ void tst_QWidget::showMaximized() layouted.showNormal(); QVERIFY(!(layouted.windowState() & Qt::WindowMaximized)); -#if !defined(Q_WS_QWS) && !defined(Q_OS_WINCE) && !defined(Q_WS_S60) +#if !defined(Q_WS_QWS) && !defined(Q_OS_WINCE) && !defined(Q_WS_S60) && !defined(Q_WS_QPA) //embedded may choose a different size to fit on the screen. QCOMPARE(layouted.size(), layouted.sizeHint()); #endif @@ -2078,7 +2078,7 @@ void tst_QWidget::showFullScreen() layouted.showNormal(); QVERIFY(!(layouted.windowState() & Qt::WindowFullScreen)); -#if !defined(Q_WS_QWS) && !defined(Q_OS_WINCE) && !defined (Q_WS_S60) +#if !defined(Q_WS_QWS) && !defined(Q_OS_WINCE) && !defined (Q_WS_S60) && !defined(Q_WS_QPA) //embedded may choose a different size to fit on the screen. QCOMPARE(layouted.size(), layouted.sizeHint()); #endif @@ -6362,7 +6362,7 @@ void tst_QWidget::compatibilityChildInsertedEvents() EventRecorder::EventList() << qMakePair(&widget, QEvent::PolishRequest) << qMakePair(&widget, QEvent::Type(QEvent::User + 1)) -#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_S60) +#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_S60) || defined(Q_WS_QPA) << qMakePair(&widget, QEvent::UpdateRequest) #endif ; @@ -6458,7 +6458,7 @@ void tst_QWidget::compatibilityChildInsertedEvents() << qMakePair(&widget, QEvent::PolishRequest) << qMakePair(&widget, QEvent::Type(QEvent::User + 1)) << qMakePair(&widget, QEvent::Type(QEvent::User + 2)) -#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_S60) +#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_S60) || defined(Q_WS_QPA) << qMakePair(&widget, QEvent::UpdateRequest) #endif ; @@ -6554,7 +6554,7 @@ void tst_QWidget::compatibilityChildInsertedEvents() << qMakePair(&widget, QEvent::PolishRequest) << qMakePair(&widget, QEvent::Type(QEvent::User + 1)) << qMakePair(&widget, QEvent::Type(QEvent::User + 2)) -#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_S60) +#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_S60) || defined(Q_WS_QPA) << qMakePair(&widget, QEvent::UpdateRequest) #endif ; @@ -9167,7 +9167,7 @@ void tst_QWidget::maskedUpdate() QTRY_COMPARE(grandChild.paintedRegion, QRegion(grandChild.rect())); // Full update. } -#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS) +#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_QPA) void tst_QWidget::syntheticEnterLeave() { class MyWidget : public QWidget -- cgit v0.12 From bc786ded04aa316f99cf9ac4cf8b714ee46575b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 20 Jul 2010 14:38:12 +0200 Subject: Made the rest of QWindowSystemInterface callback functions thread safe and cleaned up the headerfile --- src/gui/kernel/kernel.pri | 7 +- src/gui/kernel/qapplication_p.h | 29 +-- src/gui/kernel/qapplication_qpa.cpp | 133 ++++++++------ src/gui/kernel/qeventdispatcher_glib_qpa.cpp | 10 +- src/gui/kernel/qeventdispatcher_qpa.cpp | 10 +- src/gui/kernel/qwindowsysteminterface.cpp | 186 ------------------- src/gui/kernel/qwindowsysteminterface.h | 169 ------------------ src/gui/kernel/qwindowsysteminterface_qpa.cpp | 246 ++++++++++++++++++++++++++ src/gui/kernel/qwindowsysteminterface_qpa.h | 96 ++++++++++ src/gui/kernel/qwindowsysteminterface_qpa_p.h | 201 +++++++++++++++++++++ 10 files changed, 657 insertions(+), 430 deletions(-) delete mode 100644 src/gui/kernel/qwindowsysteminterface.cpp delete mode 100644 src/gui/kernel/qwindowsysteminterface.h create mode 100644 src/gui/kernel/qwindowsysteminterface_qpa.cpp create mode 100644 src/gui/kernel/qwindowsysteminterface_qpa.h create mode 100644 src/gui/kernel/qwindowsysteminterface_qpa_p.h diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index ba86c1c..43b1ab8 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -48,7 +48,7 @@ HEADERS += \ kernel/qgesturemanager_p.h \ kernel/qsoftkeymanager_p.h \ kernel/qsoftkeymanager_common_p.h \ - kernel/qguiplatformplugin_p.h + kernel/qguiplatformplugin_p.h \ SOURCES += \ kernel/qaction.cpp \ @@ -211,7 +211,8 @@ qpa { kernel/qgenericpluginfactory_qpa.h \ kernel/qgenericplugin_qpa.h \ kernel/qeventdispatcher_qpa_p.h \ - kernel/qwindowsysteminterface.h \ + kernel/qwindowsysteminterface_qpa.h \ + kernel/qwindowsysteminterface_qpa_p.h \ kernel/qplatformintegration_qpa.h \ kernel/qplatformscreen_qpa.h \ kernel/qplatformintegrationfactory_qpa_p.h \ @@ -233,7 +234,7 @@ qpa { kernel/qkeymapper_qws.cpp \ kernel/qwidget_qpa.cpp \ kernel/qeventdispatcher_qpa.cpp \ - kernel/qwindowsysteminterface.cpp \ + kernel/qwindowsysteminterface_qpa.cpp \ kernel/qplatformintegration_qpa.cpp \ kernel/qplatformscreen_qpa.cpp \ kernel/qplatformintegrationfactory_qpa.cpp \ diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 68ec648..0602d82 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -78,6 +78,7 @@ #endif #ifdef Q_WS_QPA #include +#include "qwindowsysteminterface_qpa_p.h" #include "QtGui/qplatformintegration_qpa.h" #endif @@ -490,19 +491,27 @@ public: #endif #ifdef Q_WS_QPA - static void processMouseEvent(QWindowSystemInterface::MouseEvent *e); - static void processKeyEvent(QWindowSystemInterface::KeyEvent *e); - static void processWheelEvent(QWindowSystemInterface::WheelEvent *e); - static void processTouchEvent(QWindowSystemInterface::TouchEvent *e); + static void processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *e); + static void processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent *e); + static void processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e); + static void processTouchEvent(QWindowSystemInterfacePrivate::TouchEvent *e); - static void processCloseEvent(QWidget *tlw); - static void processGeometryChange(QWidget *tlw, const QRect &newRect); + static void processCloseEvent(QWindowSystemInterfacePrivate::CloseEvent *e); - static void processUserEvent(QWindowSystemInterface::UserEvent *e); + static void processMoveEvent(QWindowSystemInterfacePrivate::MoveEvent *e); + static void processResizeEvent(QWindowSystemInterfacePrivate::ResizeEvent *e); - static void reportScreenCount(int count); - static void reportGeometryChange(int screenIndex); - static void reportAvailableGeometryChange(int screenIndex); + static void processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *e); + static void processLeaveEvent(QWindowSystemInterfacePrivate::LeaveEvent *e); + + static void processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e); + +// static void reportScreenCount(int count); + static void reportScreenCount(QWindowSystemInterfacePrivate::ScreenCountEvent *e); +// static void reportGeometryChange(int screenIndex); + static void reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e); +// static void reportAvailableGeometryChange(int screenIndex); + static void reportAvailableGeometryChange(QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *e); #endif diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp index 2adcfc1..42907ae 100644 --- a/src/gui/kernel/qapplication_qpa.cpp +++ b/src/gui/kernel/qapplication_qpa.cpp @@ -60,6 +60,7 @@ #include #include #include +#include "qwindowsysteminterface_qpa_p.h" #include #include "qdesktopwidget_qpa_p.h" @@ -86,26 +87,48 @@ static int mousePressX; static int mousePressY; static int mouse_double_click_distance = 5; -void QApplicationPrivate::processUserEvent(QWindowSystemInterface::UserEvent *e) +void QApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e) { switch(e->type) { - case QEvent::MouseButtonDblClick: // if mouse event, calculate appropriate widget and local coordinates - case QEvent::MouseButtonPress: - case QEvent::MouseButtonRelease: - case QEvent::MouseMove: - QApplicationPrivate::processMouseEvent(static_cast(e)); + case QWindowSystemInterfacePrivate::Mouse: + QApplicationPrivate::processMouseEvent(static_cast(e)); break; - case QEvent::Wheel: - QApplicationPrivate::processWheelEvent(static_cast(e)); + case QWindowSystemInterfacePrivate::Wheel: + QApplicationPrivate::processWheelEvent(static_cast(e)); break; - case QEvent::KeyPress: - case QEvent::KeyRelease: - QApplicationPrivate::processKeyEvent(static_cast(e)); + case QWindowSystemInterfacePrivate::Key: + QApplicationPrivate::processKeyEvent(static_cast(e)); + break; + case QWindowSystemInterfacePrivate::Touch: + QApplicationPrivate::processTouchEvent(static_cast(e)); + break; + case QWindowSystemInterfacePrivate::Move: + QApplicationPrivate::processMoveEvent(static_cast(e)); + break; + case QWindowSystemInterfacePrivate::Resize: + QApplicationPrivate::processResizeEvent(static_cast(e)); + break; + case QWindowSystemInterfacePrivate::Enter: + QApplicationPrivate::processEnterEvent(static_cast(e)); + break; + case QWindowSystemInterfacePrivate::Leave: + QApplicationPrivate::processLeaveEvent(static_cast(e)); + break; + case QWindowSystemInterfacePrivate::Close: + QApplicationPrivate::processCloseEvent( + static_cast(e)); + break; + case QWindowSystemInterfacePrivate::ScreenCountChange: + QApplicationPrivate::reportScreenCount( + static_cast(e)); break; - case QEvent::TouchBegin: - case QEvent::TouchUpdate: - case QEvent::TouchEnd: - QApplicationPrivate::processTouchEvent(static_cast(e)); + case QWindowSystemInterfacePrivate::ScreenGeometry: + QApplicationPrivate::reportGeometryChange( + static_cast(e)); + break; + case QWindowSystemInterfacePrivate::ScreenAvailableGeometry: + QApplicationPrivate::reportAvailableGeometryChange( + static_cast(e)); break; default: qWarning() << "Unknown user input event type:" << e->type; @@ -570,7 +593,7 @@ void QApplication::setMainWidget(QWidget *mainWidget) } #endif -void QApplicationPrivate::processMouseEvent(QWindowSystemInterface::MouseEvent *e) +void QApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *e) { // qDebug() << "handleMouseEvent" << tlw << ev.pos() << ev.globalPos() << hex << ev.buttons(); static QWeakPointer implicit_mouse_grabber; @@ -579,8 +602,9 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterface::MouseEvent * // move first Qt::MouseButtons stateChange = e->buttons ^ buttons; if (e->globalPos != QPoint(qt_last_x, qt_last_y) && (stateChange != Qt::NoButton)) { - QWindowSystemInterface::MouseEvent * newMouseEvent = new QWindowSystemInterface::MouseEvent(e->widget.data(), e->timestamp, e->localPos, e->globalPos, e->buttons); - QWindowSystemInterfacePrivate::userEventQueue.prepend(newMouseEvent); // just in case the move triggers a new event loop + QWindowSystemInterfacePrivate::MouseEvent * newMouseEvent = + new QWindowSystemInterfacePrivate::MouseEvent(e->widget.data(), e->timestamp, e->localPos, e->globalPos, e->buttons); + QWindowSystemInterfacePrivate::windowSystemEventQueue.prepend(newMouseEvent); // just in case the move triggers a new event loop stateChange = Qt::NoButton; } @@ -639,7 +663,7 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterface::MouseEvent * implicit_mouse_grabber.clear(); //### how should popup mode and implicit mouse grab interact? - } else if (tlw && app_do_modal && !qt_try_modal(tlw, e->type) ) { + } else if (tlw && app_do_modal && !qt_try_modal(tlw, QEvent::MouseButtonRelease) ) { //even if we're blocked by modality, we should deliver the mouse release event.. //### this code is not completely correct: multiple buttons can be pressed simultaneously if (!(implicit_mouse_grabber && buttons == Qt::NoButton)) { @@ -717,7 +741,7 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterface::MouseEvent * //### there's a lot of duplicated logic here -- refactoring required! -void QApplicationPrivate::processWheelEvent(QWindowSystemInterface::WheelEvent *e) +void QApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e) { // QPoint localPoint = ev.pos(); QPoint globalPoint = e->globalPos; @@ -739,7 +763,7 @@ void QApplicationPrivate::processWheelEvent(QWindowSystemInterface::WheelEvent * mouseWidget = mouseWindow; - if (app_do_modal && !qt_try_modal(mouseWindow, e->type) ) { + if (app_do_modal && !qt_try_modal(mouseWindow, QEvent::Wheel) ) { qDebug() << "modal blocked wheel event" << mouseWindow; return; } @@ -759,7 +783,7 @@ void QApplicationPrivate::processWheelEvent(QWindowSystemInterface::WheelEvent * // Remember, Qt convention is: keyboard state is state *before* -void QApplicationPrivate::processKeyEvent(QWindowSystemInterface::KeyEvent *e) +void QApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent *e) { QWidget *focusW = 0; if (self->inPopupMode()) { @@ -778,50 +802,54 @@ void QApplicationPrivate::processKeyEvent(QWindowSystemInterface::KeyEvent *e) if (!focusW) return; - if (app_do_modal && !qt_try_modal(focusW, e->type)) + if (app_do_modal && !qt_try_modal(focusW, e->keyType)) return; modifiers = e->modifiers; - QKeyEvent ev(e->type, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount); + QKeyEvent ev(e->keyType, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount); QApplication::sendSpontaneousEvent(focusW, &ev); } -void QApplicationPrivate::processGeometryChange(QWidget *tlw, const QRect &newRect) +void QApplicationPrivate::processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *e) { - if (!tlw->isWindow()) - return; //geo of native child widgets is controlled by lighthouse - //so we already have sent the events; besides this new rect - //is not mapped to parent + QApplicationPrivate::dispatchEnterLeave(e->enter.data(),0); + qt_last_mouse_receiver = e->enter.data(); +} - QRect cr(tlw->geometry()); +void QApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::LeaveEvent *e) +{ + QApplicationPrivate::dispatchEnterLeave(0,qt_last_mouse_receiver); - bool isResize = cr.size() != newRect.size(); - bool isMove = cr.topLeft() != newRect.topLeft(); - tlw->data->crect = newRect; - if (isResize) { - QResizeEvent e(tlw->data->crect.size(), cr.size()); - QApplication::sendSpontaneousEvent(tlw, &e); - tlw->update(); - } + if (e->leave.data() && !e->leave.data()->isAncestorOf(qt_last_mouse_receiver)) //(???) this should not happen + QApplicationPrivate::dispatchEnterLeave(0, e->leave.data()); + qt_last_mouse_receiver = 0; - if (isMove) { - //### frame geometry - QMoveEvent e(tlw->data->crect.topLeft(), cr.topLeft()); - QApplication::sendSpontaneousEvent(tlw, &e); - } } -void QApplicationPrivate::processCloseEvent(QWidget *tlw) +void QApplicationPrivate::processMoveEvent(QWindowSystemInterfacePrivate::MoveEvent *moveEvent) +{ + QMoveEvent e(moveEvent->moved.data()->geometry().topLeft(), moveEvent->newPos); + QApplication::sendSpontaneousEvent(moveEvent->moved.data(), &e); +} + +void QApplicationPrivate::processResizeEvent(QWindowSystemInterfacePrivate::ResizeEvent *e) +{ + QResizeEvent resizeEvent(e->sizeChanged.data()->data->crect.size(), e->newSize); + QApplication::sendSpontaneousEvent(e->sizeChanged.data(), &resizeEvent); + e->sizeChanged.data()->update(); +} + +void QApplicationPrivate::processCloseEvent(QWindowSystemInterfacePrivate::CloseEvent *e) { - tlw->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent); + e->topLevel.data()->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent); } -void QApplicationPrivate::processTouchEvent(QWindowSystemInterface::TouchEvent *e) +void QApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::TouchEvent *e) { translateRawTouchEvent(e->widget.data(), e->devType, e->points); } -void QApplicationPrivate::reportScreenCount(int count) +void QApplicationPrivate::reportScreenCount(QWindowSystemInterfacePrivate::ScreenCountEvent *e) { // This operation only makes sense after the QApplication constructor runs if (QCoreApplication::startingUp()) @@ -830,10 +858,10 @@ void QApplicationPrivate::reportScreenCount(int count) QApplication::desktop()->d_func()->updateScreenList(); // signal anything listening for creation or deletion of screens QDesktopWidget *desktop = QApplication::desktop(); - emit desktop->screenCountChanged(count); + emit desktop->screenCountChanged(e->count); } -void QApplicationPrivate::reportGeometryChange(int screenIndex) +void QApplicationPrivate::reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e) { // This operation only makes sense after the QApplication constructor runs if (QCoreApplication::startingUp()) @@ -843,7 +871,7 @@ void QApplicationPrivate::reportGeometryChange(int screenIndex) // signal anything listening for screen geometry changes QDesktopWidget *desktop = QApplication::desktop(); - emit desktop->resized(screenIndex); + emit desktop->resized(e->index); // make sure maximized and fullscreen windows are updated QWidgetList list = QApplication::topLevelWidgets(); @@ -856,7 +884,8 @@ void QApplicationPrivate::reportGeometryChange(int screenIndex) } } -void QApplicationPrivate::reportAvailableGeometryChange(int screenIndex) +void QApplicationPrivate::reportAvailableGeometryChange( + QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *e) { // This operation only makes sense after the QApplication constructor runs if (QCoreApplication::startingUp()) @@ -866,7 +895,7 @@ void QApplicationPrivate::reportAvailableGeometryChange(int screenIndex) // signal anything listening for screen geometry changes QDesktopWidget *desktop = QApplication::desktop(); - emit desktop->workAreaResized(screenIndex); + emit desktop->workAreaResized(e->index); // make sure maximized and fullscreen windows are updated QWidgetList list = QApplication::topLevelWidgets(); diff --git a/src/gui/kernel/qeventdispatcher_glib_qpa.cpp b/src/gui/kernel/qeventdispatcher_glib_qpa.cpp index 981991d..01d40ca 100644 --- a/src/gui/kernel/qeventdispatcher_glib_qpa.cpp +++ b/src/gui/kernel/qeventdispatcher_glib_qpa.cpp @@ -64,7 +64,7 @@ static gboolean userEventSourcePrepare(GSource *s, gint *timeout) Q_UNUSED(s) Q_UNUSED(timeout) - return QWindowSystemInterfacePrivate::userEventsQueued() > 0; + return QWindowSystemInterfacePrivate::windowSystemEventsQueued() > 0; } static gboolean userEventSourceCheck(GSource *source) @@ -76,9 +76,9 @@ static gboolean userEventSourceDispatch(GSource *s, GSourceFunc, gpointer) { GUserEventSource * source = reinterpret_cast(s); - QWindowSystemInterface::UserEvent * event; - while (QWindowSystemInterfacePrivate::userEventsQueued()) { - event = QWindowSystemInterfacePrivate::getUserEvent(); + QWindowSystemInterfacePrivate::WindowSystemEvent * event; + while (QWindowSystemInterfacePrivate::windowSystemEventsQueued()) { + event = QWindowSystemInterfacePrivate::getWindowSystemEvent(); if (!event) break; @@ -87,7 +87,7 @@ static gboolean userEventSourceDispatch(GSource *s, GSourceFunc, gpointer) delete event; continue; } - QApplicationPrivate::processUserEvent(event); + QApplicationPrivate::processWindowSystemEvent(event); delete event; } diff --git a/src/gui/kernel/qeventdispatcher_qpa.cpp b/src/gui/kernel/qeventdispatcher_qpa.cpp index f7f3db3..4464036 100644 --- a/src/gui/kernel/qeventdispatcher_qpa.cpp +++ b/src/gui/kernel/qeventdispatcher_qpa.cpp @@ -191,11 +191,11 @@ bool QEventDispatcherQPA::processEvents(QEventLoop::ProcessEventsFlags flags) QApplication::sendPostedEvents(); while (!d->interrupt) { // also flushes output buffer ###can be optimized - QWindowSystemInterface::UserEvent *event; + QWindowSystemInterfacePrivate::WindowSystemEvent *event; if (!(flags & QEventLoop::ExcludeUserInputEvents) - && QWindowSystemInterfacePrivate::userEventsQueued() > 0) { + && QWindowSystemInterfacePrivate::windowSystemEventsQueued() > 0) { // process a pending user input event - event = QWindowSystemInterfacePrivate::getUserEvent(); + event = QWindowSystemInterfacePrivate::getWindowSystemEvent(); if (!event) break; } else { @@ -208,7 +208,7 @@ bool QEventDispatcherQPA::processEvents(QEventLoop::ProcessEventsFlags flags) } nevents++; - QApplicationPrivate::processUserEvent(event); + QApplicationPrivate::processWindowSystemEvent(event); delete event; } @@ -222,7 +222,7 @@ bool QEventDispatcherQPA::processEvents(QEventLoop::ProcessEventsFlags flags) bool QEventDispatcherQPA::hasPendingEvents() { extern uint qGlobalPostedEventsCount(); // from qapplication.cpp - return qGlobalPostedEventsCount() || QWindowSystemInterfacePrivate::userEventsQueued(); + return qGlobalPostedEventsCount() || QWindowSystemInterfacePrivate::windowSystemEventsQueued(); } void QEventDispatcherQPA::registerSocketNotifier(QSocketNotifier *notifier) diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp deleted file mode 100644 index 4cf9ded..0000000 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qwindowsysteminterface.h" -#include "qapplication_p.h" -#include - -QT_BEGIN_NAMESPACE - - -QTime QWindowSystemInterface::eventTime; - -//------------------------------------------------------------ -// -// Callback functions for plugins: -// - -QList QWindowSystemInterfacePrivate::userEventQueue; -QMutex QWindowSystemInterfacePrivate::queueMutex; - -extern QPointer qt_last_mouse_receiver; -/*! - -\a tlw == 0 means that \a ev is in global coords only - - -*/ - - -void QWindowSystemInterface::handleEnterEvent(QWidget *tlw) -{ - if (tlw) { - QApplicationPrivate::dispatchEnterLeave(tlw, 0); - qt_last_mouse_receiver = tlw; - } -} - -void QWindowSystemInterface::handleLeaveEvent(QWidget *tlw) -{ - QApplicationPrivate::dispatchEnterLeave(0, qt_last_mouse_receiver); - if (tlw && !tlw->isAncestorOf(qt_last_mouse_receiver)) //(???) this should not happen - QApplicationPrivate::dispatchEnterLeave(0, tlw); - qt_last_mouse_receiver = 0; -} - -void QWindowSystemInterface::handleGeometryChange(QWidget *tlw, const QRect &newRect) -{ - if (tlw) - QApplicationPrivate::processGeometryChange(tlw, newRect); -} - - -void QWindowSystemInterface::handleCloseEvent(QWidget *tlw) -{ - if (tlw) - QApplicationPrivate::processCloseEvent(tlw); -} - -void QWindowSystemInterface::handleMouseEvent(QWidget *tlw, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b) -{ - MouseEvent * e = new MouseEvent(tlw, timestamp, local, global, b); - QWindowSystemInterfacePrivate::queueUserEvent(e); -} - -void QWindowSystemInterface::handleKeyEvent(QWidget *tlw, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count) -{ - KeyEvent * e = new KeyEvent(tlw, timestamp, t, k, mods, text, autorep, count); - QWindowSystemInterfacePrivate::queueUserEvent(e); -} - -void QWindowSystemInterface::handleWheelEvent(QWidget *tlw, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) -{ - WheelEvent *e = new WheelEvent(tlw, timestamp, local, global, d, o); - QWindowSystemInterfacePrivate::queueUserEvent(e); -} - -QWindowSystemInterface::UserEvent * QWindowSystemInterfacePrivate::getUserEvent() -{ - queueMutex.lock(); - QWindowSystemInterface::UserEvent *ret; - if (userEventQueue.isEmpty()) - ret = 0; - else - ret = userEventQueue.takeFirst(); - queueMutex.unlock(); - return ret; -} - -void QWindowSystemInterfacePrivate::queueUserEvent(QWindowSystemInterface::UserEvent *ev) -{ - queueMutex.lock(); - userEventQueue.append(ev); - queueMutex.unlock(); - - QAbstractEventDispatcher *dispatcher = QApplicationPrivate::qt_qpa_core_dispatcher(); - if (dispatcher) - dispatcher->wakeUp(); -} - -void QWindowSystemInterface::handleTouchEvent(QWidget *tlw, ulong timestamp, QEvent::Type type, QTouchEvent::DeviceType devType, const QList &points) -{ - if (!points.size()) // Touch events must have at least one point - return; - - QList touchPoints; - Qt::TouchPointStates states; - QTouchEvent::TouchPoint p; - - int primaryPoint = -1; - QList::const_iterator point = points.constBegin(); - QList::const_iterator end = points.constEnd(); - while (point != end) { - p.setId(point->id); - p.setPressure(point->pressure); - states |= point->state; - Qt::TouchPointStates state = point->state; - if (point->isPrimary) { - state |= Qt::TouchPointPrimary; - primaryPoint = point->id; - } - p.setState(state); - p.setRect(point->area); - p.setScreenPos(point->area.center()); - p.setNormalizedPos(point->normalPosition); - - touchPoints.append(p); - ++point; - } - - TouchEvent *e = new TouchEvent(tlw, timestamp, type, devType, touchPoints); - QWindowSystemInterfacePrivate::queueUserEvent(e); -} - -void QWindowSystemInterface::handleScreenGeometryChange(int screenIndex) -{ - QApplicationPrivate::reportGeometryChange(screenIndex); -} - -void QWindowSystemInterface::handleScreenAvailableGeometryChange(int screenIndex) -{ - QApplicationPrivate::reportAvailableGeometryChange(screenIndex); -} - -void QWindowSystemInterface::handleScreenCountChange(int count) -{ - QApplicationPrivate::reportScreenCount(count); -} - -QT_END_NAMESPACE diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h deleted file mode 100644 index 614f983..0000000 --- a/src/gui/kernel/qwindowsysteminterface.h +++ /dev/null @@ -1,169 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QWINDOWSYSTEMINTERFACE_H -#define QWINDOWSYSTEMINTERFACE_H - -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class Q_GUI_EXPORT QWindowSystemInterface -{ -public: - static void handleMouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b) { - handleMouseEvent(w, eventTime.elapsed(), local, global, b); - } - - static void handleMouseEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b); - - static void handleKeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) { - handleKeyEvent(w, eventTime.elapsed(), t, k, mods, text, autorep, count); - } - - static void handleKeyEvent(QWidget *w, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); - - static void handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) { - handleWheelEvent(w, eventTime.elapsed(), local, global, d, o); - } - - static void handleWheelEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o); - - struct TouchPoint { - int id; // for application use - bool isPrimary; // for application use - QPointF normalPosition; // touch device coordinates, (0 to 1, 0 to 1) - QRectF area; // the touched area, centered at position in screen coordinates - qreal pressure; // 0 to 1 - Qt::TouchPointStates state; //Qt::TouchPoint{Pressed|Moved|Stationary|Released} - }; - - static void handleTouchEvent(QWidget *w, QEvent::Type type, QTouchEvent::DeviceType devType, const QList &points) { - handleTouchEvent(w, eventTime.elapsed(), type, devType, points); - } - - static void handleTouchEvent(QWidget *w, ulong timestamp, QEvent::Type type, QTouchEvent::DeviceType devType, const QList &points); - - // delivered directly by the plugin via spontaneous events - static void handleGeometryChange(QWidget *w, const QRect &newRect); - static void handleCloseEvent(QWidget *w); - static void handleEnterEvent(QWidget *w); - static void handleLeaveEvent(QWidget *w); - - // Changes to the screen - static void handleScreenGeometryChange(int screenIndex); - static void handleScreenAvailableGeometryChange(int screenIndex); - static void handleScreenCountChange(int count); - - class UserEvent { - public: - UserEvent(QWidget * w, ulong time, QEvent::Type t) - { widget = QWeakPointer(w); type = t; timestamp = time; } - QWeakPointer widget; - QEvent::Type type; - unsigned long timestamp; - }; - - class MouseEvent : public UserEvent { - public: - MouseEvent(QWidget * w, ulong time, const QPoint & local, const QPoint & global, Qt::MouseButtons b) - : UserEvent(w, time, QEvent::MouseMove){ localPos = local; globalPos = global; buttons = b; } - QPoint localPos; - QPoint globalPos; - Qt::MouseButtons buttons; - }; - - class WheelEvent : public UserEvent { - public: - WheelEvent(QWidget *w, ulong time, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) - : UserEvent(w, time, QEvent::Wheel) { localPos = local; globalPos = global; delta = d; orient = o; } - int delta; - QPoint localPos; - QPoint globalPos; - Qt::Orientation orient; - }; - - class KeyEvent : public UserEvent { - public: - KeyEvent(QWidget *w, ulong time, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) - :UserEvent(w, time, t){ key = k; unicode = text; repeat = autorep; repeatCount = count; modifiers = mods; } - int key; - QString unicode; - bool repeat; - ushort repeatCount; - Qt::KeyboardModifiers modifiers; - }; - - class TouchEvent : public UserEvent { - public: - TouchEvent(QWidget *w, ulong time, QEvent::Type t, QTouchEvent::DeviceType d, const QList &p) - :UserEvent(w, time, t) { devType = d; points = p; } - QTouchEvent::DeviceType devType; - QList points; - }; - -private: - static QTime eventTime; - -}; - -class QWindowSystemInterfacePrivate { -public: - static QList userEventQueue; - static QMutex queueMutex; - - static int userEventsQueued() { queueMutex.lock(); int ret = userEventQueue.count(); queueMutex.unlock(); return ret; } - static QWindowSystemInterface::UserEvent * getUserEvent(); - static void queueUserEvent(QWindowSystemInterface::UserEvent *ev); -}; - -QT_END_NAMESPACE -QT_END_HEADER -#endif // QWINDOWSYSTEMINTERFACE_H diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp new file mode 100644 index 0000000..dd78e8e --- /dev/null +++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp @@ -0,0 +1,246 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "qwindowsysteminterface_qpa.h" +#include "qwindowsysteminterface_qpa_p.h" +#include "qapplication_p.h" +#include + +QT_BEGIN_NAMESPACE + + +QTime QWindowSystemInterfacePrivate::eventTime; + +//------------------------------------------------------------ +// +// Callback functions for plugins: +// + +QList QWindowSystemInterfacePrivate::windowSystemEventQueue; +QMutex QWindowSystemInterfacePrivate::queueMutex; + +extern QPointer qt_last_mouse_receiver; + + +void QWindowSystemInterface::handleEnterEvent(QWidget *tlw) +{ + if (tlw) { + QWindowSystemInterfacePrivate::EnterEvent *e = new QWindowSystemInterfacePrivate::EnterEvent(tlw); + QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + } +} + +void QWindowSystemInterface::handleLeaveEvent(QWidget *tlw) +{ + QWindowSystemInterfacePrivate::LeaveEvent *e = new QWindowSystemInterfacePrivate::LeaveEvent(tlw); + QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); +} + +void QWindowSystemInterface::handleGeometryChange(QWidget *tlw, const QRect &newRect) +{ + if (!tlw) + return; + if (!tlw->isWindow()) + return; //geo of native child widgets is controlled by lighthouse + //so we already have sent the events; besides this new rect + //is not mapped to parent + + QRect cr(tlw->geometry()); + + bool isResize = cr.size() != newRect.size(); + bool isMove = cr.topLeft() != newRect.topLeft(); + if (isResize) { + QWindowSystemInterfacePrivate::ResizeEvent *resizeEvent = + new QWindowSystemInterfacePrivate::ResizeEvent(tlw,newRect.size()); + QWindowSystemInterfacePrivate::queueWindowSystemEvent(resizeEvent); + } + + if (isMove) { + QWindowSystemInterfacePrivate::MoveEvent *moveEvent = + new QWindowSystemInterfacePrivate::MoveEvent(tlw,newRect.topLeft()); + QWindowSystemInterfacePrivate::queueWindowSystemEvent(moveEvent); + } +} + + +void QWindowSystemInterface::handleCloseEvent(QWidget *tlw) +{ + if (tlw) { + QWindowSystemInterfacePrivate::CloseEvent *e = + new QWindowSystemInterfacePrivate::CloseEvent(tlw); + QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + } +} + +/*! + +\a tlw == 0 means that \a ev is in global coords only + + +*/ +void QWindowSystemInterface::handleMouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b) { + unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); + handleMouseEvent(w, time, local, global, b); +} + +void QWindowSystemInterface::handleMouseEvent(QWidget *tlw, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b) +{ + QWindowSystemInterfacePrivate::MouseEvent * e = + new QWindowSystemInterfacePrivate::MouseEvent(tlw, timestamp, local, global, b); + QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); +} + +void QWindowSystemInterface::handleKeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count) { + unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); + handleKeyEvent(w, time, t, k, mods, text, autorep, count); +} + +void QWindowSystemInterface::handleKeyEvent(QWidget *tlw, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count) +{ + QWindowSystemInterfacePrivate::KeyEvent * e = + new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, t, k, mods, text, autorep, count); + QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); +} + +void QWindowSystemInterface::handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) { + unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); + handleWheelEvent(w, time, local, global, d, o); +} + +void QWindowSystemInterface::handleWheelEvent(QWidget *tlw, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) +{ + QWindowSystemInterfacePrivate::WheelEvent *e = + new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, d, o); + QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); +} + +int QWindowSystemInterfacePrivate::windowSystemEventsQueued() +{ + queueMutex.lock(); + int ret = windowSystemEventQueue.count(); + queueMutex.unlock(); + return ret; +} + +QWindowSystemInterfacePrivate::WindowSystemEvent * QWindowSystemInterfacePrivate::getWindowSystemEvent() +{ + queueMutex.lock(); + QWindowSystemInterfacePrivate::WindowSystemEvent *ret; + if (windowSystemEventQueue.isEmpty()) + ret = 0; + else + ret = windowSystemEventQueue.takeFirst(); + queueMutex.unlock(); + return ret; +} + +void QWindowSystemInterfacePrivate::queueWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *ev) +{ + queueMutex.lock(); + windowSystemEventQueue.append(ev); + queueMutex.unlock(); + + QAbstractEventDispatcher *dispatcher = QApplicationPrivate::qt_qpa_core_dispatcher(); + if (dispatcher) + dispatcher->wakeUp(); +} + +void QWindowSystemInterface::handleTouchEvent(QWidget *w, QEvent::Type type, QTouchEvent::DeviceType devType, const QList &points) { + unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); + handleTouchEvent(w, time, type, devType, points); +} + +void QWindowSystemInterface::handleTouchEvent(QWidget *tlw, ulong timestamp, QEvent::Type type, QTouchEvent::DeviceType devType, const QList &points) +{ + if (!points.size()) // Touch events must have at least one point + return; + + QList touchPoints; + Qt::TouchPointStates states; + QTouchEvent::TouchPoint p; + + int primaryPoint = -1; + QList::const_iterator point = points.constBegin(); + QList::const_iterator end = points.constEnd(); + while (point != end) { + p.setId(point->id); + p.setPressure(point->pressure); + states |= point->state; + Qt::TouchPointStates state = point->state; + if (point->isPrimary) { + state |= Qt::TouchPointPrimary; + primaryPoint = point->id; + } + p.setState(state); + p.setRect(point->area); + p.setScreenPos(point->area.center()); + p.setNormalizedPos(point->normalPosition); + + touchPoints.append(p); + ++point; + } + + QWindowSystemInterfacePrivate::TouchEvent *e = + new QWindowSystemInterfacePrivate::TouchEvent(tlw, timestamp, type, devType, touchPoints); + QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); +} + +void QWindowSystemInterface::handleScreenGeometryChange(int screenIndex) +{ + QWindowSystemInterfacePrivate::ScreenGeometryEvent *e = + new QWindowSystemInterfacePrivate::ScreenGeometryEvent(screenIndex); + QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); +} + +void QWindowSystemInterface::handleScreenAvailableGeometryChange(int screenIndex) +{ + QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *e = + new QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent(screenIndex); + QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); +} + +void QWindowSystemInterface::handleScreenCountChange(int count) +{ + QWindowSystemInterfacePrivate::ScreenCountEvent *e = + new QWindowSystemInterfacePrivate::ScreenCountEvent(count); + QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h new file mode 100644 index 0000000..e57fa8e --- /dev/null +++ b/src/gui/kernel/qwindowsysteminterface_qpa.h @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QWINDOWSYSTEMINTERFACE_H +#define QWINDOWSYSTEMINTERFACE_H + +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class Q_GUI_EXPORT QWindowSystemInterface +{ +public: + static void handleMouseEvent(QWidget *w, const QPoint & local, const QPoint & global, Qt::MouseButtons b); + static void handleMouseEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b); + + static void handleKeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); + static void handleKeyEvent(QWidget *w, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); + + static void handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o); + static void handleWheelEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o); + + struct TouchPoint { + int id; // for application use + bool isPrimary; // for application use + QPointF normalPosition; // touch device coordinates, (0 to 1, 0 to 1) + QRectF area; // the touched area, centered at position in screen coordinates + qreal pressure; // 0 to 1 + Qt::TouchPointStates state; //Qt::TouchPoint{Pressed|Moved|Stationary|Released} + }; + + static void handleTouchEvent(QWidget *w, QEvent::Type type, QTouchEvent::DeviceType devType, const QList &points); + static void handleTouchEvent(QWidget *w, ulong timestamp, QEvent::Type type, QTouchEvent::DeviceType devType, const QList &points); + + // delivered directly by the plugin via spontaneous events + static void handleGeometryChange(QWidget *w, const QRect &newRect); + static void handleCloseEvent(QWidget *w); + static void handleEnterEvent(QWidget *w); + static void handleLeaveEvent(QWidget *w); + + // Changes to the screen + static void handleScreenGeometryChange(int screenIndex); + static void handleScreenAvailableGeometryChange(int screenIndex); + static void handleScreenCountChange(int count); +}; + +QT_END_NAMESPACE +QT_END_HEADER +#endif // QWINDOWSYSTEMINTERFACE_H diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h new file mode 100644 index 0000000..90d1702 --- /dev/null +++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h @@ -0,0 +1,201 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QWINDOWSYSTEMINTERFACE_QPA_P_H +#define QWINDOWSYSTEMINTERFACE_QPA_P_H + +#include "qwindowsysteminterface_qpa.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QWindowSystemInterfacePrivate { +public: + Q_ENUMS(EventType); + + enum EventType { + Close, + Resize, + Move, + Enter, + Leave, + Mouse, + Wheel, + Key, + Touch, + ScreenGeometry, + ScreenAvailableGeometry, + ScreenCountChange + }; + + class WindowSystemEvent { + public: + WindowSystemEvent(EventType t) + : type(t) { } + EventType type; + }; + + class CloseEvent : public WindowSystemEvent { + public: + CloseEvent(QWidget *tlw) + : WindowSystemEvent(Close), topLevel(tlw) { } + QWeakPointer topLevel; + }; + + class ResizeEvent : public WindowSystemEvent { + public: + ResizeEvent(QWidget *sizeChanged, const QSize &newSize) + : WindowSystemEvent(Resize), sizeChanged(sizeChanged), newSize(newSize) + { } + QWeakPointer sizeChanged; + QSize newSize; + }; + + class MoveEvent : public WindowSystemEvent { + public: + MoveEvent(QWidget *moved, const QPoint &newPos) + : WindowSystemEvent(Move), moved(moved), newPos(newPos) + { } + QWeakPointer moved; + QPoint newPos; + }; + + class EnterEvent : public WindowSystemEvent { + public: + EnterEvent(QWidget *enter) + : WindowSystemEvent(Enter), enter(enter) + { } + QWeakPointer enter; + }; + + class LeaveEvent : public WindowSystemEvent { + public: + LeaveEvent(QWidget *leave) + : WindowSystemEvent(Leave), leave(leave) + { } + QWeakPointer leave; + }; + + class UserEvent : public WindowSystemEvent { + public: + UserEvent(QWidget * w, ulong time, EventType t) + : WindowSystemEvent(t), widget(w), timestamp(time) { } + QWeakPointer widget; + unsigned long timestamp; + }; + + class MouseEvent : public UserEvent { + public: + MouseEvent(QWidget * w, ulong time, const QPoint & local, const QPoint & global, Qt::MouseButtons b) + : UserEvent(w, time, Mouse), localPos(local), globalPos(global), buttons(b) { } + QPoint localPos; + QPoint globalPos; + Qt::MouseButtons buttons; + }; + + class WheelEvent : public UserEvent { + public: + WheelEvent(QWidget *w, ulong time, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) + : UserEvent(w, time, Wheel), delta(d), localPos(local), globalPos(global), orient(o) { } + int delta; + QPoint localPos; + QPoint globalPos; + Qt::Orientation orient; + }; + + class KeyEvent : public UserEvent { + public: + KeyEvent(QWidget *w, ulong time, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) + :UserEvent(w, time, Key), key(k), unicode(text), repeat(autorep), + repeatCount(count), modifiers(mods), keyType(t) { } + int key; + QString unicode; + bool repeat; + ushort repeatCount; + Qt::KeyboardModifiers modifiers; + QEvent::Type keyType; + }; + + class TouchEvent : public UserEvent { + public: + TouchEvent(QWidget *w, ulong time, QEvent::Type t, QTouchEvent::DeviceType d, const QList &p) + :UserEvent(w, time, Touch), devType(d), points(p), touchType(t) { } + QTouchEvent::DeviceType devType; + QList points; + QEvent::Type touchType; + + }; + + class ScreenCountEvent : public WindowSystemEvent { + public: + ScreenCountEvent (int count) + : WindowSystemEvent(ScreenCountChange) , count(count) { } + int count; + }; + + class ScreenGeometryEvent : public WindowSystemEvent { + public: + ScreenGeometryEvent(int index) + : WindowSystemEvent(ScreenGeometry), index(index) { } + int index; + }; + + class ScreenAvailableGeometryEvent : public WindowSystemEvent { + public: + ScreenAvailableGeometryEvent(int index) + : WindowSystemEvent(ScreenAvailableGeometry), index(index) { } + int index; + }; + + static QList windowSystemEventQueue; + static QMutex queueMutex; + + static int windowSystemEventsQueued(); + static WindowSystemEvent * getWindowSystemEvent(); + static void queueWindowSystemEvent(WindowSystemEvent *ev); + + static QTime eventTime; +}; + +QT_END_HEADER +QT_END_NAMESPACE + +#endif // QWINDOWSYSTEMINTERFACE_QPA_P_H -- cgit v0.12 From a17b1d7c18737de1b3c6122a1f9766cbaa0d7c26 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 21 Jul 2010 10:14:18 +0200 Subject: Less ugly hack to make QtOpenGL compile on Lighthouse This cleans up after commit bc5f5d99078d9ca1f4fc80fc7d0fe753d5ef396a --- src/gui/painting/qwindowsurface_p.h | 1 + src/opengl/qwindowsurface_gl.cpp | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/painting/qwindowsurface_p.h b/src/gui/painting/qwindowsurface_p.h index da02f5a..c845021 100644 --- a/src/gui/painting/qwindowsurface_p.h +++ b/src/gui/painting/qwindowsurface_p.h @@ -86,6 +86,7 @@ public: #else virtual void resize(const QSize &size); QSize size() const; + inline QRect geometry() const { return QRect(QPoint(), size()); } //### cleanup before Qt 5 #endif virtual bool scroll(const QRegion &area, int dx, int dy); diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 8c54fd1..6571a76 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -499,13 +499,11 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & } } #endif -#ifndef Q_WS_QPA //############################################### if (d_ptr->paintedRegion.boundingRect() != geometry()) { // Emits warning if not supported. Should never happen unless // setPartialUpdateSupport(true) has been called. context()->d_func()->swapRegion(&d_ptr->paintedRegion); } else -#endif context()->swapBuffers(); d_ptr->paintedRegion = QRegion(); -- cgit v0.12 From 22edd932bb5af334bbe1a1774604332eee14814f Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 21 Jul 2010 12:24:02 +0200 Subject: Don't turn off exceptions by default in Lighthouse --- configure | 3 --- 1 file changed, 3 deletions(-) diff --git a/configure b/configure index 97f7fb2..a7f545a 100755 --- a/configure +++ b/configure @@ -7007,9 +7007,6 @@ fi if [ "$CFG_EXCEPTIONS" = "unspecified" -a "$PLATFORM_QWS" = "yes" ]; then CFG_EXCEPTIONS=no fi -if [ "$CFG_EXCEPTIONS" = "unspecified" -a "$PLATFORM_QPA" = "yes" ]; then - CFG_EXCEPTIONS=no -fi if [ "$CFG_EXCEPTIONS" != "no" ]; then QTCONFIG_CONFIG="$QTCONFIG_CONFIG exceptions" -- cgit v0.12 From 705f497bc21863b2bb580d39aabe371622f937aa Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 21 Jul 2010 12:40:42 +0200 Subject: Skip QSound autotest on Lighthouse QSound is not implemented. --- tests/auto/qsound/tst_qsound.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/auto/qsound/tst_qsound.cpp b/tests/auto/qsound/tst_qsound.cpp index eda99a1..295ed91 100644 --- a/tests/auto/qsound/tst_qsound.cpp +++ b/tests/auto/qsound/tst_qsound.cpp @@ -63,6 +63,9 @@ private slots: void tst_QSound::checkFinished() { +#if defined(Q_WS_QPA) + QSKIP("QSound is not implemented on Lighthouse", SkipAll); +#else QSound sound(SRCDIR"4.wav"); sound.setLoops(3); sound.play(); @@ -72,15 +75,17 @@ void tst_QSound::checkFinished() QEXPECT_FAIL("", "QSound buggy on embedded (task QTBUG-157)", Abort); #endif QVERIFY(sound.isFinished() ); +#endif } void tst_QSound::staticPlay() { QSKIP("Test disabled -- only for manual purposes", SkipAll); - +#if !defined(Q_WS_QPA) // Check that you hear sound with static play also. QSound::play(SRCDIR"4.wav"); QTest::qWait(2000); +#endif } QTEST_MAIN(tst_QSound); -- cgit v0.12 From e485492385d5d02b170617251678a7d28d39c8d9 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 21 Jul 2010 13:31:33 +0200 Subject: Header file cleanup Make the "headers" autotest pass on Lighthouse --- src/gui/kernel/qplatformwindowformat_qpa.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qplatformwindowformat_qpa.h b/src/gui/kernel/qplatformwindowformat_qpa.h index 3c5f907..09c3520 100644 --- a/src/gui/kernel/qplatformwindowformat_qpa.h +++ b/src/gui/kernel/qplatformwindowformat_qpa.h @@ -41,7 +41,7 @@ #ifndef QPLATFORMWINDOWFORMAT_QPA_H #define QPLATFORMWINDOWFORMAT_QPA_H -#include +#include QT_BEGIN_HEADER -- cgit v0.12 From 3d0c33f70fb60095f9a1065eceb1ae1aa854af2d Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 21 Jul 2010 16:07:13 +0200 Subject: Autotest fixes for Lighthouse --- tests/auto/qwidget/tst_qwidget.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 5e39c27..6450793 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -2167,7 +2167,10 @@ void tst_QWidget::resizeEvent() wParent.show(); QCOMPARE (wChild.m_resizeEventCount, 1); // initial resize event before paint wParent.hide(); - wChild.resize(QSize(640,480)); + QSize safeSize(640,480); + if (wChild.size() == safeSize) + safeSize.setWidth(639); + wChild.resize(safeSize); QCOMPARE (wChild.m_resizeEventCount, 1); wParent.show(); QCOMPARE (wChild.m_resizeEventCount, 2); @@ -2178,7 +2181,10 @@ void tst_QWidget::resizeEvent() wTopLevel.show(); QCOMPARE (wTopLevel.m_resizeEventCount, 1); // initial resize event before paint for toplevels wTopLevel.hide(); - wTopLevel.resize(QSize(640,480)); + QSize safeSize(640,480); + if (wTopLevel.size() == safeSize) + safeSize.setWidth(639); + wTopLevel.resize(safeSize); QCOMPARE (wTopLevel.m_resizeEventCount, 1); wTopLevel.show(); QCOMPARE (wTopLevel.m_resizeEventCount, 2); @@ -3375,6 +3381,10 @@ void tst_QWidget::widgetAt() #if defined(Q_OS_SYMBIAN) QEXPECT_FAIL("", "Symbian/S60 does only support rectangular regions", Continue); //See also task 147191 #endif +#if defined(Q_WS_QPA) + QEXPECT_FAIL("", "Window mask not implemented on Lighthouse", Continue); +#endif + QTRY_COMPARE(QApplication::widgetAt(100,100)->objectName(), w1->objectName()); QTRY_COMPARE(QApplication::widgetAt(101,101)->objectName(), w2->objectName()); @@ -3393,6 +3403,9 @@ void tst_QWidget::widgetAt() #if defined(Q_OS_SYMBIAN) QEXPECT_FAIL("", "Symbian/S60 does only support rectangular regions", Continue); //See also task 147191 #endif +#if defined(Q_WS_QPA) + QEXPECT_FAIL("", "Window mask not implemented on Lighthouse", Continue); +#endif QTRY_VERIFY(QApplication::widgetAt(100,100) == w1); QTRY_VERIFY(QApplication::widgetAt(101,101) == w2); -- cgit v0.12 From 77d17d054b8baff411613206a099af36f8e0bc43 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 21 Jul 2010 16:07:34 +0200 Subject: Quick-and-dirty grabWindoe() implementation for the VNC plugin --- src/plugins/platforms/vnc/qvncintegration.cpp | 44 +++++++++++++++++++++------ src/plugins/platforms/vnc/qvncintegration.h | 2 ++ 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/vnc/qvncintegration.cpp b/src/plugins/platforms/vnc/qvncintegration.cpp index 16fa5bb..331c16a 100644 --- a/src/plugins/platforms/vnc/qvncintegration.cpp +++ b/src/plugins/platforms/vnc/qvncintegration.cpp @@ -156,16 +156,6 @@ QPixmapData *QVNCIntegration::createPixmapData(QPixmapData::PixelType type) cons return new QRasterPixmapData(type); } -// QWindowSurface *QVNCIntegration::createWindowSurface(QWidget *widget) const -// { -// if (widget->windowType() == Qt::Desktop) -// return 0; // Don't create an explicit window surface for the destkop. -// QFbWindowSurface * surface; -// surface = new QFbWindowSurface(mPrimaryScreen, widget); -// mPrimaryScreen->addWindowSurface(surface); -// return surface; -// } - QWindowSurface *QVNCIntegration::createWindowSurface(QWidget *widget, WId) const { QFbWindowSurface * surface; @@ -192,6 +182,40 @@ QPlatformWindow *QVNCIntegration::createPlatformWindow(QWidget *widget, WId /*wi return w; } +QPixmap QVNCIntegration::grabWindow(WId window, int x, int y, int width, int height) const +{ +// qDebug() << "QVNCIntegration::grabWindow" << window << x << y << width << height; + + if (window == 0) { //desktop + QImage *desktopImage = mPrimaryScreen->image(); + if (x==0 && y == 0 && width < 0 && height < 0) { + return QPixmap::fromImage(*desktopImage); + } + if (width < 0) + width = desktopImage->width() - x; + if (height < 0) + height = desktopImage->height() - y; + int bytesPerPixel = desktopImage->depth()/8; //We don't support 1, 2, or 4 bpp + QImage img(desktopImage->scanLine(y) + bytesPerPixel*x, width, height, desktopImage->bytesPerLine(), desktopImage->format()); + return QPixmap::fromImage(img); + } + QWidget *win = QWidget::find(window); + if (win) { + QRect r = win->geometry(); + if (width < 0) + width = r.width() - x; + if (height < 0) + height = r.height() - y; + QImage *desktopImage = mPrimaryScreen->image(); + int bytesPerPixel = desktopImage->depth()/8; //We don't support 1, 2, or 4 bpp + + QImage img(desktopImage->scanLine(r.top() + y) + bytesPerPixel*(r.left()+x), width, height, desktopImage->bytesPerLine(), desktopImage->format()); + return QPixmap::fromImage(img); + } + return QPixmap(); +} + + void QVNCIntegration::moveToScreen(QWidget *window, int screen) { if (virtualDesktop) { // all windows exist on all screens in virtual desktop mode diff --git a/src/plugins/platforms/vnc/qvncintegration.h b/src/plugins/platforms/vnc/qvncintegration.h index d49e051..241993d 100644 --- a/src/plugins/platforms/vnc/qvncintegration.h +++ b/src/plugins/platforms/vnc/qvncintegration.h @@ -84,6 +84,8 @@ public: QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; + QPixmap grabWindow(WId window, int x, int y, int width, int height) const; + QList screens() const { return mScreens; } bool isVirtualDesktop() { return virtualDesktop; } -- cgit v0.12 From 96f1f3d575a12967657bb534ee5accc04d52984e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 21 Jul 2010 09:58:25 +0200 Subject: Removed createBlittable factory function from PlatformIntegration and moved it onto QBlittablePixmap making the class abstract. The creator function was seen as to spesialised to be part of the PlatformIntegration class, and belonged to the QBlittablePixmap class anyway since that was the PixmapData type you would need to return to use the blitter api. Also removed the cross platform examples as they are more confusing than anything else. For usage of QBlittable look in the directfb platform integration plugin. --- src/gui/image/qpixmap_blitter.cpp | 10 +-- src/gui/image/qpixmap_blitter_p.h | 3 +- src/gui/kernel/qapplication_p.h | 4 +- src/gui/kernel/qplatformintegration_qpa.cpp | 3 - src/gui/kernel/qplatformintegration_qpa.h | 2 +- src/gui/painting/painting.pri | 6 +- src/gui/painting/qblittable_p.h | 3 +- src/gui/painting/qgraphicssystem.cpp | 3 - src/gui/painting/qgraphicssystem_p.h | 1 - .../painting/qwindowsurface_rasterblittable.cpp | 26 ------- .../painting/qwindowsurface_rasterblittable_p.h | 21 ------ .../gfxdrivers/blittableqvfb/blittableqvfb.pro | 28 -------- src/plugins/gfxdrivers/blittableqvfb/main.cpp | 81 ---------------------- .../gfxdrivers/blittableqvfb/qblittable_image.h | 48 ------------- .../blittableqvfb/qgraphicssystem_blittableqvfb.h | 47 ------------- .../blittableqvfb/qscreen_blittableqvfb.h | 14 ---- .../blittableqvfb/qwindowsurface_qwsblittable.cpp | 0 .../blittableqvfb/qwindowsurface_qwsblittable.h | 36 ---------- .../graphicssystems/blittable/blittable.pro | 11 --- src/plugins/graphicssystems/blittable/main.cpp | 73 ------------------- .../graphicssystems/blittable/qblittable_image.h | 48 ------------- .../blittable/qgraphicssystem_blittable.h | 53 -------------- src/plugins/platforms/directfb/qdirectfbblitter.h | 6 ++ .../platforms/directfb/qdirectfbintegration.cpp | 2 +- .../platforms/directfb/qdirectfbwindowsurface.cpp | 2 +- 25 files changed, 21 insertions(+), 510 deletions(-) delete mode 100644 src/gui/painting/qwindowsurface_rasterblittable.cpp delete mode 100644 src/gui/painting/qwindowsurface_rasterblittable_p.h delete mode 100644 src/plugins/gfxdrivers/blittableqvfb/blittableqvfb.pro delete mode 100644 src/plugins/gfxdrivers/blittableqvfb/main.cpp delete mode 100644 src/plugins/gfxdrivers/blittableqvfb/qblittable_image.h delete mode 100644 src/plugins/gfxdrivers/blittableqvfb/qgraphicssystem_blittableqvfb.h delete mode 100644 src/plugins/gfxdrivers/blittableqvfb/qscreen_blittableqvfb.h delete mode 100644 src/plugins/gfxdrivers/blittableqvfb/qwindowsurface_qwsblittable.cpp delete mode 100644 src/plugins/gfxdrivers/blittableqvfb/qwindowsurface_qwsblittable.h delete mode 100644 src/plugins/graphicssystems/blittable/blittable.pro delete mode 100644 src/plugins/graphicssystems/blittable/main.cpp delete mode 100644 src/plugins/graphicssystems/blittable/qblittable_image.h delete mode 100644 src/plugins/graphicssystems/blittable/qgraphicssystem_blittable.h diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index d91a269..9a7ebe2 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -14,8 +14,8 @@ QT_BEGIN_NAMESPACE static int global_ser_no = 0; -QBlittablePixmapData::QBlittablePixmapData(QPixmapData::PixelType type) - : QPixmapData(type,BlitterClass), m_engine(0), m_blittable(0) +QBlittablePixmapData::QBlittablePixmapData() + : QPixmapData(QPixmapData::PixmapType,BlitterClass), m_engine(0), m_blittable(0) #ifdef QT_BLITTER_RASTEROVERLAY ,m_rasterOverlay(0), m_unmergedCopy(0) #endif //QT_BLITTER_RASTEROVERLAY @@ -37,11 +37,7 @@ QBlittable *QBlittablePixmapData::blittable() const { if (!m_blittable) { QBlittablePixmapData *that = const_cast(this); -#ifdef Q_WS_QPA //####jl: graphics system nor platformintegration should have createBlittable - that->m_blittable = QApplicationPrivate::platformIntegration()->createBlittable(QSize(w,h)); -#else - that->m_blittable = QApplicationPrivate::graphicsSystem()->createBlittable(QSize(w,h)); -#endif + that->m_blittable = this->createBlittable(QSize(w,h)); } return m_blittable; diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h index b9f7630..e404199 100644 --- a/src/gui/image/qpixmap_blitter_p.h +++ b/src/gui/image/qpixmap_blitter_p.h @@ -11,9 +11,10 @@ class Q_GUI_EXPORT QBlittablePixmapData : public QPixmapData { // Q_DECLARE_PRIVATE(QBlittablePixmapData); public: - QBlittablePixmapData(QPixmapData::PixelType type); + QBlittablePixmapData(); ~QBlittablePixmapData(); + virtual QBlittable *createBlittable(const QSize &size) const = 0; QBlittable *blittable() const; void setBlittable(QBlittable *blittable); diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 0602d82..de97f62 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -432,8 +432,10 @@ public: static QPalette *set_pal; static QGraphicsSystem *graphics_system; static QString graphics_system_name; - static QPlatformIntegration *platform_integration; static bool runtime_graphics_system; +#ifdef Q_WS_QPA + static QPlatformIntegration *platform_integration; +#endif private: static QFont *app_font; // private for a reason! Always use QApplication::font() instead! diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp index b3f46ce..b4987f2 100644 --- a/src/gui/kernel/qplatformintegration_qpa.cpp +++ b/src/gui/kernel/qplatformintegration_qpa.cpp @@ -43,9 +43,6 @@ QT_BEGIN_NAMESPACE -QBlittable *QPlatformIntegration::createBlittable(const QSize &) const -{ return 0; } - QPixmap QPlatformIntegration::grabWindow(WId window, int x, int y, int width, int height) const { Q_UNUSED(window); diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index 11377e7..f6f10a8 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -66,7 +66,6 @@ public: virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0; virtual QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const = 0; virtual QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const = 0; - virtual QBlittable *createBlittable(const QSize &size) const; virtual void moveToScreen(QWidget *window, int screen) {Q_UNUSED(window); Q_UNUSED(screen);} // Window System functions @@ -77,6 +76,7 @@ public: // Experimental virtual QPlatformEventLoopIntegration *createEventLoopIntegration() const; +// should it be hasGLContext? virtual bool hasOpenGL() const; diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 7ef6598..92c4e84 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -125,16 +125,14 @@ embedded { painting/qgraphicssystem_runtime_p.h \ painting/qgraphicssystemfactory_p.h \ painting/qgraphicssystemplugin_p.h \ - painting/qwindowsurface_raster_p.h \ - painting/qwindowsurface_rasterblittable_p.h \ + painting/qwindowsurface_raster_p.h SOURCES += \ painting/qgraphicssystem_raster.cpp \ painting/qgraphicssystem_runtime.cpp \ painting/qgraphicssystemfactory.cpp \ painting/qgraphicssystemplugin.cpp \ - painting/qwindowsurface_raster.cpp \ - painting/qwindowsurface_rasterblittable.cpp \ + painting/qwindowsurface_raster.cpp } unix:x11 { diff --git a/src/gui/painting/qblittable_p.h b/src/gui/painting/qblittable_p.h index 645f37e..71e80af 100644 --- a/src/gui/painting/qblittable_p.h +++ b/src/gui/painting/qblittable_p.h @@ -2,7 +2,8 @@ #define QBLITTABLE_P_H #include -#include +#include + #ifndef QT_NO_BLITTABLE QT_BEGIN_NAMESPACE diff --git a/src/gui/painting/qgraphicssystem.cpp b/src/gui/painting/qgraphicssystem.cpp index a03bdab..f594136 100644 --- a/src/gui/painting/qgraphicssystem.cpp +++ b/src/gui/painting/qgraphicssystem.cpp @@ -63,9 +63,6 @@ QGraphicsSystem::~QGraphicsSystem() { } -QBlittable *QGraphicsSystem::createBlittable(const QSize &) const -{ return 0; } - QPixmapData *QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixelType type) { #ifdef Q_WS_QWS diff --git a/src/gui/painting/qgraphicssystem_p.h b/src/gui/painting/qgraphicssystem_p.h index 0d84886..a75ea61 100644 --- a/src/gui/painting/qgraphicssystem_p.h +++ b/src/gui/painting/qgraphicssystem_p.h @@ -70,7 +70,6 @@ public: virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0; virtual QPixmapData *createPixmapData(QPixmapData *origin); virtual QWindowSurface *createWindowSurface(QWidget *widget) const = 0; - virtual QBlittable *createBlittable(const QSize &size) const; virtual ~QGraphicsSystem(); diff --git a/src/gui/painting/qwindowsurface_rasterblittable.cpp b/src/gui/painting/qwindowsurface_rasterblittable.cpp deleted file mode 100644 index 56a79ba..0000000 --- a/src/gui/painting/qwindowsurface_rasterblittable.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "qwindowsurface_rasterblittable_p.h" - -#include -#include - -QRasterBlittableWindowSurface::QRasterBlittableWindowSurface(QWidget *widget) - : QRasterWindowSurface(widget), - m_currentImage(0), - m_blittable(0), - m_pmData(new QBlittablePixmapData(QPixmapData::PixmapType)), - m_pixmap(new QPixmap(m_pmData)) -{ -} - -QPaintDevice *QRasterBlittableWindowSurface::paintDevice() -{ - QPaintDevice *device = QRasterWindowSurface::paintDevice(); - if (m_currentImage != device) { - if (device->devType() == QInternal::Image) { - m_currentImage = static_cast(device); - m_blittable = createBlittable(m_currentImage); - m_pmData->setBlittable(m_blittable); - } - } - return m_pixmap; -} diff --git a/src/gui/painting/qwindowsurface_rasterblittable_p.h b/src/gui/painting/qwindowsurface_rasterblittable_p.h deleted file mode 100644 index 1e697c7..0000000 --- a/src/gui/painting/qwindowsurface_rasterblittable_p.h +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include - -class QBlittable; -class QBlittablePixmapData; - -class Q_GUI_EXPORT QRasterBlittableWindowSurface : public QRasterWindowSurface -{ -public: - QRasterBlittableWindowSurface(QWidget *widget); - - virtual QBlittable *createBlittable(QImage *rasterSurface) = 0; - - QPaintDevice *paintDevice(); - -private: - QImage *m_currentImage; - QBlittable *m_blittable; - QBlittablePixmapData *m_pmData; - QPixmap *m_pixmap; -}; diff --git a/src/plugins/gfxdrivers/blittableqvfb/blittableqvfb.pro b/src/plugins/gfxdrivers/blittableqvfb/blittableqvfb.pro deleted file mode 100644 index d6a2018..0000000 --- a/src/plugins/gfxdrivers/blittableqvfb/blittableqvfb.pro +++ /dev/null @@ -1,28 +0,0 @@ -TARGET = qscreenblittablevfb -include(../../qpluginbase.pri) - -DEFINES += QT_QWS_QVFB QT_QWS_MOUSE_QVFB QT_QWS_KBD_QVFB - -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/gfxdrivers - -HEADERS = qgraphicssystem_blittableqvfb.h \ - qscreen_blittableqvfb.h \ - qwindowsurface_qwsblittable.h \ - qblittable_image.h - -SOURCES = main.cpp \ - qwindowsurface_qwsblittable.cpp - -#include qvfb sources -HEADERS += \ - $$QT_SOURCE_TREE/src/gui/embedded/qscreenvfb_qws.h \ - $$QT_SOURCE_TREE/src/gui/embedded/qkbdvfb_qws.h \ - $$QT_SOURCE_TREE/src/gui/embedded/qmousevfb_qws.h - -SOURCES += \ - $$QT_SOURCE_TREE/src/gui/embedded/qscreenvfb_qws.cpp \ - $$QT_SOURCE_TREE/src/gui/embedded/qkbdvfb_qws.cpp \ - $$QT_SOURCE_TREE/src/gui/embedded/qmousevfb_qws.cpp - -target.path += $$[QT_INSTALL_PLUGINS]/gfxdrivers -INSTALLS += target diff --git a/src/plugins/gfxdrivers/blittableqvfb/main.cpp b/src/plugins/gfxdrivers/blittableqvfb/main.cpp deleted file mode 100644 index b6d2603..0000000 --- a/src/plugins/gfxdrivers/blittableqvfb/main.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include "qscreen_blittableqvfb.h" - -#ifndef QT_NO_LIBRARY -QT_BEGIN_NAMESPACE - -class ScreenBlittableVfbDriver : public QScreenDriverPlugin -{ -public: - ScreenBlittableVfbDriver(); - - QStringList keys() const; - QScreen *create(const QString&, int displayId); -}; - -ScreenBlittableVfbDriver::ScreenBlittableVfbDriver() -: QScreenDriverPlugin() -{ -} - -QStringList ScreenBlittableVfbDriver::keys() const -{ - QStringList list; - list << "BlittableQVFb"; - return list; -} - -QScreen* ScreenBlittableVfbDriver::create(const QString& driver, int displayId) -{ - if (driver.toLower() == "blittableqvfb") - return new QBlittableVFbScreen(displayId); - - return 0; -} - -Q_EXPORT_PLUGIN2(qscreenblittablevfb, ScreenBlittableVfbDriver) - -QT_END_NAMESPACE -#endif //QT_NO_LIBRARY diff --git a/src/plugins/gfxdrivers/blittableqvfb/qblittable_image.h b/src/plugins/gfxdrivers/blittableqvfb/qblittable_image.h deleted file mode 100644 index 3f8dc69..0000000 --- a/src/plugins/gfxdrivers/blittableqvfb/qblittable_image.h +++ /dev/null @@ -1,48 +0,0 @@ -#include - -#include - - -class QImageBlittable : public QBlittable -{ -public: - QImageBlittable(QImage *image, bool deleteImage) - : QBlittable(image->size(), QBlittable::Capabilities(QBlittable::SolidRectCapability - |QBlittable::SourcePixmapCapability - |QBlittable::SourceOverPixmapCapability - |QBlittable::SourceOverScaledPixmapCapability)), - m_image(image), m_deleteImage(deleteImage) - { - - } - - ~QImageBlittable() { - if (m_deleteImage) - delete m_image; - } - - void fillRect(const QRectF &rect, const QColor &color) - { - QPainter p(lock()); - p.fillRect(rect,color); - } - void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &source) - { - //here it is possible to do a pixmap.pixmapData()->buffer() - //but is like this to show how to get the the blitter - QPixmapData *data = pixmap.pixmapData(); - Q_ASSERT(data->width() && data->height()); - Q_ASSERT(data->classId() == QPixmapData::BlitterClass); - QBlittablePixmapData *blittableData = static_cast(data); - - QPainter p(lock()); - p.drawImage(rect, *blittableData->blittable()->lock(),source); - } - -protected: - QImage *doLock() { return m_image; } - void doUnlock() { } -private: - QImage *m_image; - bool m_deleteImage; -}; diff --git a/src/plugins/gfxdrivers/blittableqvfb/qgraphicssystem_blittableqvfb.h b/src/plugins/gfxdrivers/blittableqvfb/qgraphicssystem_blittableqvfb.h deleted file mode 100644 index 89940d0..0000000 --- a/src/plugins/gfxdrivers/blittableqvfb/qgraphicssystem_blittableqvfb.h +++ /dev/null @@ -1,47 +0,0 @@ -#include -#include -#include -#include - -#include "qwindowsurface_qwsblittable.h" -#include "qblittable_image.h" -#include - -class QBlittableVFbGraphicsSystem : public QGraphicsSystem -{ -public: - QPixmapData *createPixmapData(QPixmapData::PixelType type) const - { - if (type == QPixmapData::PixmapType) { - return new QBlittablePixmapData(type); - } else { - return new QRasterPixmapData(type); - } - } - - QWindowSurface *createWindowSurface(QWidget *widget) const - { - if (QApplication::type() == QApplication::GuiServer) - return new QWSBlittableMemSurface(widget); - else - return QScreen::instance()->createSurface(widget); - } - - QBlittable *createBlittable(const QSize &size) const - { - QImage *image = new QImage(size,QImage::Format_ARGB32); - return new QImageBlittable(image,true); - } - - static QGraphicsSystem *instance() - { - static QGraphicsSystem *system = 0; - if (!system) { - system = new QBlittableVFbGraphicsSystem; - } - return system; - } - -private: - QBlittableVFbGraphicsSystem() { } -}; diff --git a/src/plugins/gfxdrivers/blittableqvfb/qscreen_blittableqvfb.h b/src/plugins/gfxdrivers/blittableqvfb/qscreen_blittableqvfb.h deleted file mode 100644 index 645aeec..0000000 --- a/src/plugins/gfxdrivers/blittableqvfb/qscreen_blittableqvfb.h +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include "qgraphicssystem_blittableqvfb.h" - -class QBlittableVFbScreen : public QVFbScreen -{ -public: - explicit QBlittableVFbScreen(int display_id) - : QVFbScreen(display_id) - { - setGraphicsSystem(QBlittableVFbGraphicsSystem::instance()); - - } - -}; diff --git a/src/plugins/gfxdrivers/blittableqvfb/qwindowsurface_qwsblittable.cpp b/src/plugins/gfxdrivers/blittableqvfb/qwindowsurface_qwsblittable.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/src/plugins/gfxdrivers/blittableqvfb/qwindowsurface_qwsblittable.h b/src/plugins/gfxdrivers/blittableqvfb/qwindowsurface_qwsblittable.h deleted file mode 100644 index b955322..0000000 --- a/src/plugins/gfxdrivers/blittableqvfb/qwindowsurface_qwsblittable.h +++ /dev/null @@ -1,36 +0,0 @@ -#include "qblittable_image.h" - -#include -#include - -class QBlittablePixmapData; - -class Q_GUI_EXPORT QWSBlittableMemSurface : public QWSLocalMemSurface -{ -public: - QWSBlittableMemSurface( QWidget *window ) - : QWSLocalMemSurface(window), - m_currentPaintDevice(0), - pmData(new QBlittablePixmapData(QPixmapData::PixmapType)), - pm(pmData) - { - } - - QPaintDevice *paintDevice() - { - if (QWSLocalMemSurface::paintDevice() != m_currentPaintDevice) { - QPaintDevice *device = QWSLocalMemSurface::paintDevice(); - if (device->devType() == QInternal::Image) { - img = *static_cast(device); - pmData->setBlittable(new QImageBlittable(&img,false)); - } - } - return ± - } - -private: - QPaintDevice *m_currentPaintDevice; - QBlittablePixmapData *pmData; - QPixmap pm; -}; - diff --git a/src/plugins/graphicssystems/blittable/blittable.pro b/src/plugins/graphicssystems/blittable/blittable.pro deleted file mode 100644 index 34c4165..0000000 --- a/src/plugins/graphicssystems/blittable/blittable.pro +++ /dev/null @@ -1,11 +0,0 @@ -TARGET = qblittablegraphicssystem -include(../../qpluginbase.pri) - -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems - -SOURCES = main.cpp -HEADERS = qblittable_image.h \ - qgraphicssystem_blittable.h - -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems -INSTALLS += target diff --git a/src/plugins/graphicssystems/blittable/main.cpp b/src/plugins/graphicssystems/blittable/main.cpp deleted file mode 100644 index 06c3189..0000000 --- a/src/plugins/graphicssystems/blittable/main.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "qgraphicssystem_blittable.h" - -QT_BEGIN_NAMESPACE - -class QBlittableGraphicsSystemPlugin : public QGraphicsSystemPlugin -{ -public: - QStringList keys() const; - QGraphicsSystem *create(const QString&); -}; - -QStringList QBlittableGraphicsSystemPlugin::keys() const -{ - QStringList list; - list << QLatin1String("Blittable"); - return list; -} - -QGraphicsSystem* QBlittableGraphicsSystemPlugin::create(const QString& system) -{ - if (system.toLower() == QLatin1String("blittable")) { - return new QBlittableGraphicsSystem; - } - - return 0; -} - -Q_EXPORT_PLUGIN2(blittable, QBlittableGraphicsSystemPlugin) - -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/blittable/qblittable_image.h b/src/plugins/graphicssystems/blittable/qblittable_image.h deleted file mode 100644 index 3f8dc69..0000000 --- a/src/plugins/graphicssystems/blittable/qblittable_image.h +++ /dev/null @@ -1,48 +0,0 @@ -#include - -#include - - -class QImageBlittable : public QBlittable -{ -public: - QImageBlittable(QImage *image, bool deleteImage) - : QBlittable(image->size(), QBlittable::Capabilities(QBlittable::SolidRectCapability - |QBlittable::SourcePixmapCapability - |QBlittable::SourceOverPixmapCapability - |QBlittable::SourceOverScaledPixmapCapability)), - m_image(image), m_deleteImage(deleteImage) - { - - } - - ~QImageBlittable() { - if (m_deleteImage) - delete m_image; - } - - void fillRect(const QRectF &rect, const QColor &color) - { - QPainter p(lock()); - p.fillRect(rect,color); - } - void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &source) - { - //here it is possible to do a pixmap.pixmapData()->buffer() - //but is like this to show how to get the the blitter - QPixmapData *data = pixmap.pixmapData(); - Q_ASSERT(data->width() && data->height()); - Q_ASSERT(data->classId() == QPixmapData::BlitterClass); - QBlittablePixmapData *blittableData = static_cast(data); - - QPainter p(lock()); - p.drawImage(rect, *blittableData->blittable()->lock(),source); - } - -protected: - QImage *doLock() { return m_image; } - void doUnlock() { } -private: - QImage *m_image; - bool m_deleteImage; -}; diff --git a/src/plugins/graphicssystems/blittable/qgraphicssystem_blittable.h b/src/plugins/graphicssystems/blittable/qgraphicssystem_blittable.h deleted file mode 100644 index d45907f..0000000 --- a/src/plugins/graphicssystems/blittable/qgraphicssystem_blittable.h +++ /dev/null @@ -1,53 +0,0 @@ -#include -#include -#include -#include -#include - -#include "qblittable_image.h" - -class QImageBlittableWindowSurface : public QRasterBlittableWindowSurface -{ -public: - QImageBlittableWindowSurface(QWidget *widget) - : QRasterBlittableWindowSurface(widget) - {} - - QBlittable *createBlittable(QImage *rasterSurface) - { - return new QImageBlittable(rasterSurface,false); - } - -}; - -class QBlittableGraphicsSystem : public QGraphicsSystem -{ -public: - ~QBlittableGraphicsSystem() { } - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const - { - if (type == QPixmapData::PixmapType) - return new QBlittablePixmapData(type); - else - return new QRasterPixmapData(type); - } - - QWindowSurface *createWindowSurface(QWidget *widget) const - { - return new QImageBlittableWindowSurface(widget); - } - - QBlittable *createBlittable(const QSize &size) const - { - QImage *image = new QImage(size, QImage::Format_ARGB32_Premultiplied); - return new QImageBlittable(image,true); - } - - QList screens() - { return m_screens; } - - QList m_screens; -}; - - diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.h b/src/plugins/platforms/directfb/qdirectfbblitter.h index 85a303a..2a39912 100644 --- a/src/plugins/platforms/directfb/qdirectfbblitter.h +++ b/src/plugins/platforms/directfb/qdirectfbblitter.h @@ -26,4 +26,10 @@ protected: friend class QDirectFbConvenience; }; +class QDirectFbBlitterPixmapData : public QBlittablePixmapData +{ +public: + QBlittable *createBlittable(const QSize &size) const { return new QDirectFbBlitter(size); } +}; + #endif // QDIRECTFBBLITTER_H diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.cpp b/src/plugins/platforms/directfb/qdirectfbintegration.cpp index c47fc8d..b19a1d9 100644 --- a/src/plugins/platforms/directfb/qdirectfbintegration.cpp +++ b/src/plugins/platforms/directfb/qdirectfbintegration.cpp @@ -118,7 +118,7 @@ QPixmapData *QDirectFbIntegration::createPixmapData(QPixmapData::PixelType type) if (type == QPixmapData::BitmapType) return new QRasterPixmapData(type); else - return new QBlittablePixmapData(type); + return new QDirectFbBlitterPixmapData; } QPlatformWindow *QDirectFbIntegration::createPlatformWindow(QWidget *widget, WId winId) const diff --git a/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp b/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp index 4ca9a72..271d061 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp @@ -63,7 +63,7 @@ QDirectFbWindowSurface::QDirectFbWindowSurface(QWidget *window, WId wId) dfbWindow->GetSurface(dfbWindow,&m_dfbSurface); //WRONGSIZE QDirectFbBlitter *blitter = new QDirectFbBlitter(window->rect().size(), m_dfbSurface); - m_pmdata = new QBlittablePixmapData(QPixmapData::PixmapType); + m_pmdata = new QDirectFbBlitterPixmapData; m_pmdata->setBlittable(blitter); m_pixmap = new QPixmap(m_pmdata); } -- cgit v0.12 From 733ea3622dc6feb06979bade95318664a94a6e21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 22 Jul 2010 12:03:52 +0200 Subject: Fix Resize bug introduced by bc786ded04aa316f99cf9ac4cf8b714ee46575b5 --- src/gui/kernel/qapplication_qpa.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp index 42907ae..a433ccd 100644 --- a/src/gui/kernel/qapplication_qpa.cpp +++ b/src/gui/kernel/qapplication_qpa.cpp @@ -828,12 +828,14 @@ void QApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::Leave void QApplicationPrivate::processMoveEvent(QWindowSystemInterfacePrivate::MoveEvent *moveEvent) { - QMoveEvent e(moveEvent->moved.data()->geometry().topLeft(), moveEvent->newPos); - QApplication::sendSpontaneousEvent(moveEvent->moved.data(), &e); + moveEvent->moved.data()->data->crect.setTopLeft(moveEvent->newPos); + QMoveEvent e(moveEvent->moved.data()->geometry().topLeft(), moveEvent->newPos); + QApplication::sendSpontaneousEvent(moveEvent->moved.data(), &e); } void QApplicationPrivate::processResizeEvent(QWindowSystemInterfacePrivate::ResizeEvent *e) { + e->sizeChanged.data()->data->crect.setSize(e->newSize); QResizeEvent resizeEvent(e->sizeChanged.data()->data->crect.size(), e->newSize); QApplication::sendSpontaneousEvent(e->sizeChanged.data(), &resizeEvent); e->sizeChanged.data()->update(); -- cgit v0.12 From ec0ce7be116f0c4f854ef1efbb90d22f7c76aa4d Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 22 Jul 2010 14:53:02 +0200 Subject: Don't crash if widget is deleted before event is processed --- src/gui/kernel/qapplication_qpa.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp index a433ccd..d289dee 100644 --- a/src/gui/kernel/qapplication_qpa.cpp +++ b/src/gui/kernel/qapplication_qpa.cpp @@ -828,6 +828,10 @@ void QApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::Leave void QApplicationPrivate::processMoveEvent(QWindowSystemInterfacePrivate::MoveEvent *moveEvent) { + if (moveEvent->moved.isNull()) { + //qDebug() << "QApplicationPrivate::processMoveEvent NULL"; + return; + } moveEvent->moved.data()->data->crect.setTopLeft(moveEvent->newPos); QMoveEvent e(moveEvent->moved.data()->geometry().topLeft(), moveEvent->newPos); QApplication::sendSpontaneousEvent(moveEvent->moved.data(), &e); @@ -835,6 +839,10 @@ void QApplicationPrivate::processMoveEvent(QWindowSystemInterfacePrivate::MoveEv void QApplicationPrivate::processResizeEvent(QWindowSystemInterfacePrivate::ResizeEvent *e) { + if (e->sizeChanged.isNull()) { + //qDebug() << "QApplicationPrivate::processResizeEvent NULL"; + return; + } e->sizeChanged.data()->data->crect.setSize(e->newSize); QResizeEvent resizeEvent(e->sizeChanged.data()->data->crect.size(), e->newSize); QApplication::sendSpontaneousEvent(e->sizeChanged.data(), &resizeEvent); @@ -843,6 +851,10 @@ void QApplicationPrivate::processResizeEvent(QWindowSystemInterfacePrivate::Resi void QApplicationPrivate::processCloseEvent(QWindowSystemInterfacePrivate::CloseEvent *e) { + if (e->topLevel.isNull()) { + //qDebug() << "QApplicationPrivate::processCloseEvent NULL"; + return; + } e->topLevel.data()->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent); } -- cgit v0.12 From d15e6a32aeced893a5b5b790f3235cc7b3e0b9af Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 22 Jul 2010 14:53:53 +0200 Subject: Implement reparenting a created toplevel window --- src/gui/kernel/qwidget_qpa.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp index 4229a05..ac868eb 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -60,7 +60,7 @@ void setParentForChildrenOfWidget(QPlatformWindow *window, const QWidget *widget for (int i = 0; i < children.size(); i++) { if (children.at(i)->isWidgetType()) { const QWidget *childWidget = qobject_cast(children.at(i)); - if (childWidget) { // should not be nessesary + if (childWidget) { // should not be necessary if (childWidget->platformWindow()) { childWidget->platformWindow()->setParent(window); } else { @@ -179,6 +179,12 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) } bool explicitlyHidden = q->testAttribute(Qt::WA_WState_Hidden) && q->testAttribute(Qt::WA_WState_ExplicitShowHide); + + // Reparenting toplevel to child + if (!(f&Qt::Window) && (oldFlags&Qt::Window)) { + //qDebug() << "setParent_sys() change from toplevel"; + q->destroy(); + } data.window_flags = f; q->setAttribute(Qt::WA_WState_Created, false); @@ -190,12 +196,11 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) if (QPlatformWindow *window = q->platformWindow()) data.window_flags = window->setWindowFlags(data.window_flags); } - // XXX Reparenting child to toplevel or vice versa ### + + // Reparenting child to toplevel if ((f&Qt::Window) && !(oldFlags&Qt::Window)) { //qDebug() << "setParent_sys() change to toplevel"; - q->create(); //### this cannot be right - } else if ((f&Qt::Window) && !(oldFlags&Qt::Window)) { - qDebug() << "######## setParent_sys() change from toplevel not implemented ########"; + q->create(); //### too early: this ought to happen at show() time } -- cgit v0.12 From be08fbc13f7370b6cc0c34660b4d1c16e4fdd3f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 23 Jul 2010 10:24:06 +0200 Subject: Handle behavior change in resize and move events in Lighthouse Dont post the resize event and move event seperatly on the windowsystemintegration event queue, but as one event which will be processed in one go. --- src/gui/kernel/qapplication_p.h | 3 +- src/gui/kernel/qapplication_qpa.cpp | 47 ++++++++++++++------------- src/gui/kernel/qwidget_qpa.cpp | 1 + src/gui/kernel/qwindowsysteminterface_qpa.cpp | 24 ++------------ src/gui/kernel/qwindowsysteminterface_qpa_p.h | 22 ++++--------- 5 files changed, 35 insertions(+), 62 deletions(-) diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index de97f62..933e0ab 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -500,8 +500,7 @@ public: static void processCloseEvent(QWindowSystemInterfacePrivate::CloseEvent *e); - static void processMoveEvent(QWindowSystemInterfacePrivate::MoveEvent *e); - static void processResizeEvent(QWindowSystemInterfacePrivate::ResizeEvent *e); + static void processGeometryChangeEvent(QWindowSystemInterfacePrivate::GeometryChangeEvent *e); static void processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *e); static void processLeaveEvent(QWindowSystemInterfacePrivate::LeaveEvent *e); diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp index d289dee..26ae82d 100644 --- a/src/gui/kernel/qapplication_qpa.cpp +++ b/src/gui/kernel/qapplication_qpa.cpp @@ -102,11 +102,8 @@ void QApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate case QWindowSystemInterfacePrivate::Touch: QApplicationPrivate::processTouchEvent(static_cast(e)); break; - case QWindowSystemInterfacePrivate::Move: - QApplicationPrivate::processMoveEvent(static_cast(e)); - break; - case QWindowSystemInterfacePrivate::Resize: - QApplicationPrivate::processResizeEvent(static_cast(e)); + case QWindowSystemInterfacePrivate::GeometryChange: + QApplicationPrivate::processGeometryChangeEvent(static_cast(e)); break; case QWindowSystemInterfacePrivate::Enter: QApplicationPrivate::processEnterEvent(static_cast(e)); @@ -826,27 +823,33 @@ void QApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::Leave } -void QApplicationPrivate::processMoveEvent(QWindowSystemInterfacePrivate::MoveEvent *moveEvent) + +void QApplicationPrivate::processGeometryChangeEvent(QWindowSystemInterfacePrivate::GeometryChangeEvent *e) { - if (moveEvent->moved.isNull()) { - //qDebug() << "QApplicationPrivate::processMoveEvent NULL"; - return; + if (e->tlw.isNull()) + return; + QWidget *tlw = e->tlw.data(); + if (!tlw->isWindow()) + return; //geo of native child widgets is controlled by lighthouse + //so we already have sent the events; besides this new rect + //is not mapped to parent + + QRect newRect = e->newGeometry; + QRect cr(tlw->geometry()); + bool isResize = cr.size() != newRect.size(); + bool isMove = cr.topLeft() != newRect.topLeft(); + tlw->data->crect = newRect; + if (isResize) { + QResizeEvent e(tlw->data->crect.size(), cr.size()); + QApplication::sendSpontaneousEvent(tlw, &e); + tlw->update(); } - moveEvent->moved.data()->data->crect.setTopLeft(moveEvent->newPos); - QMoveEvent e(moveEvent->moved.data()->geometry().topLeft(), moveEvent->newPos); - QApplication::sendSpontaneousEvent(moveEvent->moved.data(), &e); -} -void QApplicationPrivate::processResizeEvent(QWindowSystemInterfacePrivate::ResizeEvent *e) -{ - if (e->sizeChanged.isNull()) { - //qDebug() << "QApplicationPrivate::processResizeEvent NULL"; - return; + if (isMove) { + //### frame geometry + QMoveEvent e(tlw->data->crect.topLeft(), cr.topLeft()); + QApplication::sendSpontaneousEvent(tlw, &e); } - e->sizeChanged.data()->data->crect.setSize(e->newSize); - QResizeEvent resizeEvent(e->sizeChanged.data()->data->crect.size(), e->newSize); - QApplication::sendSpontaneousEvent(e->sizeChanged.data(), &resizeEvent); - e->sizeChanged.data()->update(); } void QApplicationPrivate::processCloseEvent(QWindowSystemInterfacePrivate::CloseEvent *e) diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp index ac868eb..1b7d9d2 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -128,6 +128,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) if (windowType() != Qt::Desktop) { if (destroyWindow && isWindow()) { +//### jl: delete all child windows... QTLWExtra *topData = d->maybeTopData(); if (topData) { delete topData->platformWindow; diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp index dd78e8e..c49bd36 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp +++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp @@ -75,28 +75,8 @@ void QWindowSystemInterface::handleLeaveEvent(QWidget *tlw) void QWindowSystemInterface::handleGeometryChange(QWidget *tlw, const QRect &newRect) { - if (!tlw) - return; - if (!tlw->isWindow()) - return; //geo of native child widgets is controlled by lighthouse - //so we already have sent the events; besides this new rect - //is not mapped to parent - - QRect cr(tlw->geometry()); - - bool isResize = cr.size() != newRect.size(); - bool isMove = cr.topLeft() != newRect.topLeft(); - if (isResize) { - QWindowSystemInterfacePrivate::ResizeEvent *resizeEvent = - new QWindowSystemInterfacePrivate::ResizeEvent(tlw,newRect.size()); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(resizeEvent); - } - - if (isMove) { - QWindowSystemInterfacePrivate::MoveEvent *moveEvent = - new QWindowSystemInterfacePrivate::MoveEvent(tlw,newRect.topLeft()); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(moveEvent); - } + QWindowSystemInterfacePrivate::GeometryChangeEvent *e = new QWindowSystemInterfacePrivate::GeometryChangeEvent(tlw,newRect); + QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); } diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h index 90d1702..5f3ac5d 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h @@ -53,8 +53,7 @@ public: enum EventType { Close, - Resize, - Move, + GeometryChange, Enter, Leave, Mouse, @@ -80,22 +79,13 @@ public: QWeakPointer topLevel; }; - class ResizeEvent : public WindowSystemEvent { + class GeometryChangeEvent : public WindowSystemEvent { public: - ResizeEvent(QWidget *sizeChanged, const QSize &newSize) - : WindowSystemEvent(Resize), sizeChanged(sizeChanged), newSize(newSize) + GeometryChangeEvent(QWidget *tlw, const QRect &newGeometry) + : WindowSystemEvent(GeometryChange), tlw(tlw), newGeometry(newGeometry) { } - QWeakPointer sizeChanged; - QSize newSize; - }; - - class MoveEvent : public WindowSystemEvent { - public: - MoveEvent(QWidget *moved, const QPoint &newPos) - : WindowSystemEvent(Move), moved(moved), newPos(newPos) - { } - QWeakPointer moved; - QPoint newPos; + QWeakPointer tlw; + QRect newGeometry; }; class EnterEvent : public WindowSystemEvent { -- cgit v0.12 From 699d74a9fae0b2d03e5c74bfb9590f6f0809ef4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 23 Jul 2010 09:46:23 +0200 Subject: Make it possible to have shared contexts to Lighthouse This adds a getter to QPlatformGLContext for the "default shared context". The setter is protected as it is the plugins responsibillity to create it or not. QPlatformWindowFormat has also gotten a pointer to a QPlatformGLContext for a non default shared context. Only implemented shared contexts in testlite for now. --- src/gui/kernel/kernel.pri | 3 +- src/gui/kernel/qapplication_qpa.cpp | 4 +- src/gui/kernel/qplatformglcontext_qpa.cpp | 54 +++++++++ src/gui/kernel/qplatformglcontext_qpa.h | 5 + src/gui/kernel/qplatformintegration_qpa.h | 6 +- src/gui/kernel/qplatformwindowformat_qpa.cpp | 37 ++++-- src/gui/kernel/qplatformwindowformat_qpa.h | 17 ++- src/gui/kernel/qwidget.cpp | 2 + src/gui/kernel/qwidget_qpa.cpp | 2 +- src/opengl/qgl_qpa.cpp | 3 + src/plugins/platforms/testlite/qglxintegration.cpp | 133 +++++++++++++++------ src/plugins/platforms/testlite/qglxintegration.h | 18 ++- src/plugins/platforms/testlite/qtestlitewindow.cpp | 43 +++---- 13 files changed, 247 insertions(+), 80 deletions(-) create mode 100644 src/gui/kernel/qplatformglcontext_qpa.cpp diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 43b1ab8..9941b1b 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -241,7 +241,8 @@ qpa { kernel/qplatformintegrationplugin_qpa.cpp \ kernel/qplatformwindow_qpa.cpp \ kernel/qplatformwindowformat_qpa.cpp \ - kernel/qplatformeventloopintegration_qpa.cpp + kernel/qplatformeventloopintegration_qpa.cpp \ + kernel/qplatformglcontext_qpa.cpp contains(QT_CONFIG, glib) { SOURCES += \ diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp index 26ae82d..e5b5396 100644 --- a/src/gui/kernel/qapplication_qpa.cpp +++ b/src/gui/kernel/qapplication_qpa.cpp @@ -510,7 +510,7 @@ void qt_init(QApplicationPrivate *priv, int type) } QList pluginList; - QString platformName = qgetenv("QT_QPA_PLATFORM"); + QString platformName = QLatin1String(qgetenv("QT_QPA_PLATFORM")); // Get command line params @@ -526,7 +526,7 @@ void qt_init(QApplicationPrivate *priv, int type) appFont = argv[i]; } else if (arg == "-platform") { if (++i < argc) - platformName = argv[i]; + platformName = QLatin1String(argv[i]); } else if (arg == "-plugin") { if (++i < argc) pluginList << argv[i]; diff --git a/src/gui/kernel/qplatformglcontext_qpa.cpp b/src/gui/kernel/qplatformglcontext_qpa.cpp new file mode 100644 index 0000000..a2ffbf3 --- /dev/null +++ b/src/gui/kernel/qplatformglcontext_qpa.cpp @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenGL module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformglcontext_qpa.h" + +static QPlatformGLContext *staticSharedContext = 0; + +void QPlatformGLContext::setDefaultSharedContext(QPlatformGLContext *sharedContext) +{ + staticSharedContext = sharedContext; +} + +QPlatformGLContext *QPlatformGLContext::defaultSharedContext() +{ + return staticSharedContext; +} diff --git a/src/gui/kernel/qplatformglcontext_qpa.h b/src/gui/kernel/qplatformglcontext_qpa.h index dcfd54c..9f3bfb3 100644 --- a/src/gui/kernel/qplatformglcontext_qpa.h +++ b/src/gui/kernel/qplatformglcontext_qpa.h @@ -58,6 +58,11 @@ public: virtual void swapBuffers() = 0; virtual void* getProcAddress(const QString& procName) = 0; + static QPlatformGLContext *defaultSharedContext(); + +protected: + static void setDefaultSharedContext(QPlatformGLContext *sharedContext); + }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index f6f10a8..9f7367e 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -73,10 +73,12 @@ public: virtual bool isVirtualDesktop() { return false; } virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const; -// Experimental +// Experimental in mainthread eventloop integration +// This should only be used if it is only possible to do window system event processing in +// the gui thread. All of the functions in QWindowSystemInterface are thread safe. virtual QPlatformEventLoopIntegration *createEventLoopIntegration() const; -// should it be hasGLContext? +//jl:XXX should it be hasGLContext and do we need it at all? virtual bool hasOpenGL() const; diff --git a/src/gui/kernel/qplatformwindowformat_qpa.cpp b/src/gui/kernel/qplatformwindowformat_qpa.cpp index bc234ab..9d86948 100644 --- a/src/gui/kernel/qplatformwindowformat_qpa.cpp +++ b/src/gui/kernel/qplatformwindowformat_qpa.cpp @@ -50,7 +50,8 @@ public: : ref(1) , opts(QPlatformWindowFormat::DoubleBuffer | QPlatformWindowFormat::DepthBuffer | QPlatformWindowFormat::Rgba | QPlatformWindowFormat::DirectRendering - | QPlatformWindowFormat::StencilBuffer | QPlatformWindowFormat::DeprecatedFunctions) + | QPlatformWindowFormat::StencilBuffer | QPlatformWindowFormat::DeprecatedFunctions + | QPlatformWindowFormat::UseDefaultSharedContext) , depthSize(-1) , accumSize(-1) , stencilSize(-1) @@ -60,9 +61,8 @@ public: , alphaSize(-1) , numSamples(-1) , swapInterval(-1) - , majorVersion(1) - , minorVersion(0) , windowApi(QPlatformWindowFormat::Raster) + , sharedContext(0) { } @@ -78,9 +78,8 @@ public: alphaSize(other->alphaSize), numSamples(other->numSamples), swapInterval(other->swapInterval), - majorVersion(other->majorVersion), - minorVersion(other->minorVersion), - windowApi(other->windowApi) + windowApi(other->windowApi), + sharedContext(other->sharedContext) { } QAtomicInt ref; @@ -94,9 +93,8 @@ public: int alphaSize; int numSamples; int swapInterval; - int majorVersion; - int minorVersion; QPlatformWindowFormat::WindowApi windowApi; + QPlatformGLContext *sharedContext; }; /*! @@ -519,6 +517,16 @@ void QPlatformWindowFormat::setSampleBuffers(bool enable) setOption(enable ? QPlatformWindowFormat::SampleBuffers : QPlatformWindowFormat::NoSampleBuffers); } +void QPlatformWindowFormat::setUseDefaultSharedContext(bool enable) +{ + if (enable) { + setOption(QPlatformWindowFormat::UseDefaultSharedContext); + d->sharedContext = 0; + } else { + setOption(QPlatformWindowFormat::NoDefaultSharedContext); + } +} + /*! Returns the number of samples per pixel when multisampling is enabled. By default, the highest number of samples that is @@ -595,6 +603,17 @@ QPlatformWindowFormat::WindowApi QPlatformWindowFormat::windowApi() const return d->windowApi; } +void QPlatformWindowFormat::setSharedContext(QPlatformGLContext *context) +{ + setUseDefaultSharedContext(false); + d->sharedContext = context; +} + +QPlatformGLContext *QPlatformWindowFormat::sharedGLContext() const +{ + return d->sharedContext; +} + ///*! // \fn bool QGLFormat::hasOverlay() const @@ -952,8 +971,6 @@ bool operator==(const QPlatformWindowFormat& a, const QPlatformWindowFormat& b) && a.d->blueSize == b.d->blueSize && a.d->numSamples == b.d->numSamples && a.d->swapInterval == b.d->swapInterval - && a.d->majorVersion == b.d->majorVersion - && a.d->minorVersion == b.d->minorVersion && a.d->windowApi == b.d->windowApi); } diff --git a/src/gui/kernel/qplatformwindowformat_qpa.h b/src/gui/kernel/qplatformwindowformat_qpa.h index 3c5f907..37e628d 100644 --- a/src/gui/kernel/qplatformwindowformat_qpa.h +++ b/src/gui/kernel/qplatformwindowformat_qpa.h @@ -64,6 +64,7 @@ public: HasOverlay = 0x0100, SampleBuffers = 0x0200, DeprecatedFunctions = 0x0400, + UseDefaultSharedContext = 0x0800, SingleBuffer = DoubleBuffer << 16, NoDepthBuffer = DepthBuffer << 16, ColorIndex = Rgba << 16, @@ -74,7 +75,9 @@ public: IndirectRendering = DirectRendering << 16, NoOverlay = HasOverlay << 16, NoSampleBuffers = SampleBuffers << 16, - NoDeprecatedFunctions = DeprecatedFunctions << 16 + NoDeprecatedFunctions = DeprecatedFunctions << 16, + NoDefaultSharedContext = UseDefaultSharedContext << 16 + }; Q_DECLARE_FLAGS(FormatOptions, FormatOption) @@ -123,6 +126,9 @@ public: void setWindowApi(QPlatformWindowFormat::WindowApi api); WindowApi windowApi() const; + void setSharedContext(QPlatformGLContext *context); + QPlatformGLContext *sharedGLContext() const; + bool doubleBuffer() const; void setDoubleBuffer(bool enable); bool depth() const; @@ -139,6 +145,8 @@ public: void setStereo(bool enable); bool directRendering() const; void setDirectRendering(bool enable); + bool useDefaultSharedContext() const; + void setUseDefaultSharedContext(bool enable); // bool hasOverlay() const; // void setOverlay(bool enable); @@ -148,9 +156,6 @@ public: static QPlatformWindowFormat defaultFormat(); static void setDefaultFormat(const QPlatformWindowFormat& f); -// static QPlatformWindowFormat defaultOverlayFormat(); -// static void setDefaultOverlayFormat(const QPlatformWindowFormat& f); - private: QPlatformWindowFormatPrivate *d; @@ -215,6 +220,10 @@ inline bool QPlatformWindowFormat::sampleBuffers() const return testOption(QPlatformWindowFormat::SampleBuffers); } +inline bool QPlatformWindowFormat::useDefaultSharedContext() const +{ + return testOption(QPlatformWindowFormat::UseDefaultSharedContext); +} QT_END_NAMESPACE diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 958c476..c236c60 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -2410,7 +2410,9 @@ WId QWidget::winId() const qDebug() << "QWidget::winId: creating native window for" << this; #endif QWidget *that = const_cast(this); +#ifndef Q_WS_QPA that->setAttribute(Qt::WA_NativeWindow); +#endif that->d_func()->createWinId(); return that->data->winid; } diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp index 1b7d9d2..104c529 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -182,7 +182,7 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) bool explicitlyHidden = q->testAttribute(Qt::WA_WState_Hidden) && q->testAttribute(Qt::WA_WState_ExplicitShowHide); // Reparenting toplevel to child - if (!(f&Qt::Window) && (oldFlags&Qt::Window)) { + if (!(f&Qt::Window) && (oldFlags&Qt::Window) && !q->testAttribute(Qt::WA_NativeWindow)) { //qDebug() << "setParent_sys() change from toplevel"; q->destroy(); } diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index aa124fe..0fc885c 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -66,6 +66,9 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) }else { QWidget *widget = static_cast(d->paintDevice); if (!widget->platformWindow()){ + QPlatformWindowFormat format = widget->platformWindowFormat(); + format.setWindowApi(QPlatformWindowFormat::OpenGL); + widget->setPlatformWindowFormat(format); widget->winId();//make window } d->platformContext = widget->platformWindow()->glContext(); diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp index ba89dbd..4d807b0 100644 --- a/src/plugins/platforms/testlite/qglxintegration.cpp +++ b/src/plugins/platforms/testlite/qglxintegration.cpp @@ -57,8 +57,12 @@ QT_BEGIN_NAMESPACE -GLXFBConfig qt_glx_integration_choose_config(MyDisplay* xd, QGLFormat& format, int drawableType) +QMutex QGLXGLContext::m_defaultSharedContextMutex(QMutex::Recursive); + +QVector QGLXGLContext::buildSpec(const QPlatformWindowFormat &format) { + QVector spec(48); + int i = 0; int depthSize = 0; int stencilSize = 0; int sampleSize = 0; @@ -70,33 +74,30 @@ GLXFBConfig qt_glx_integration_choose_config(MyDisplay* xd, QGLFormat& format, i if (format.sampleBuffers()) sampleSize = (format.samples() == -1) ? 1 : format.samples(); - int configAttribs[] = { - GLX_DRAWABLE_TYPE, drawableType, - GLX_LEVEL, format.plane(), - GLX_RENDER_TYPE, GLX_RGBA_BIT, - GLX_DOUBLEBUFFER, format.doubleBuffer() ? True : False, - GLX_STEREO, format.stereo() ? True : False, - - GLX_DEPTH_SIZE, depthSize, - GLX_STENCIL_SIZE, stencilSize, - GLX_SAMPLE_BUFFERS_ARB, sampleSize, - - GLX_RED_SIZE, (format.redBufferSize() == -1) ? 1 : format.redBufferSize(), - GLX_GREEN_SIZE, (format.greenBufferSize() == -1) ? 1 : format.greenBufferSize(), - GLX_BLUE_SIZE, (format.blueBufferSize() == -1) ? 1 : format.blueBufferSize(), - GLX_ALPHA_SIZE, (format.alphaBufferSize() == -1) ? 0 : format.alphaBufferSize(), - - GLX_ACCUM_RED_SIZE, (format.accumBufferSize() == -1) ? 0 : format.accumBufferSize(), - GLX_ACCUM_GREEN_SIZE, (format.accumBufferSize() == -1) ? 0 : format.accumBufferSize(), - GLX_ACCUM_BLUE_SIZE, (format.accumBufferSize() == -1) ? 0 : format.accumBufferSize(), - GLX_ACCUM_ALPHA_SIZE, (format.accumBufferSize() == -1) ? 0 : format.accumBufferSize(), - XNone - }; + spec[i++] = GLX_DRAWABLE_TYPE; spec[i++] = GLX_WINDOW_BIT; + spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_RGBA_BIT; + spec[i++] = GLX_DOUBLEBUFFER; spec[i++] = format.doubleBuffer() ? True : False; + spec[i++] = GLX_STEREO; spec[i++] = format.stereo() ? True : False; - GLXFBConfig *configs; - int configCount = 0; - configs = glXChooseFBConfig(xd->display, xd->screen, configAttribs, &configCount); + spec[i++] = GLX_DEPTH_SIZE; spec[i++] = depthSize; + spec[i++] = GLX_STENCIL_SIZE; spec[i++] = stencilSize; + spec[i++] = GLX_SAMPLE_BUFFERS_ARB; spec[i++] = sampleSize; + spec[i++] = GLX_RED_SIZE; spec[i++] = (format.redBufferSize() == -1) ? 1 : format.redBufferSize(); + spec[i++] = GLX_GREEN_SIZE; spec[i++] = (format.greenBufferSize() == -1) ? 1 : format.greenBufferSize(); + spec[i++] = GLX_BLUE_SIZE; spec[i++] = (format.blueBufferSize() == -1) ? 1 : format.blueBufferSize(); + spec[i++] = GLX_ALPHA_SIZE; spec[i++] = (format.alphaBufferSize() == -1) ? 0 : format.alphaBufferSize(); + + spec[i++] = GLX_ACCUM_RED_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 0 : format.accumBufferSize(); + spec[i++] = GLX_ACCUM_GREEN_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 0 : format.accumBufferSize(); + spec[i++] = GLX_ACCUM_BLUE_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 0 : format.accumBufferSize(); + spec[i++] = GLX_ACCUM_ALPHA_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 0 : format.accumBufferSize(); + spec[i++] = XNone; + return spec; +} + +GLXFBConfig QGLXGLContext::findConfig(const GLXFBConfig *configs, int configCount, const QPlatformWindowFormat &format, const MyDisplay *xd) +{ if (!configs) return 0; @@ -121,31 +122,60 @@ GLXFBConfig qt_glx_integration_choose_config(MyDisplay* xd, QGLFormat& format, i } else break; // Just choose the first in the list if there's no alpha requested } - - // TODO: Populate the QGLFormat with the values of the GLXFBConfig - - XFree(configs); return chosenConfig; } -QGLXGLContext::QGLXGLContext(WId winId, MyDisplay *xd, QGLFormat& format, QPlatformGLContext* shareContext) +QGLXGLContext::QGLXGLContext(Window window, MyDisplay *xd, const QPlatformWindowFormat &format) : QPlatformGLContext() , m_xd(xd) - , m_drawable((Drawable)winId) - , m_config(0) + , m_drawable((Drawable)window) , m_context(0) { + if (!QPlatformGLContext::defaultSharedContext()) { + if (m_defaultSharedContextMutex.tryLock()){ + createDefaultSharedContex(xd); + m_defaultSharedContextMutex.unlock(); + } else { + m_defaultSharedContextMutex.lock(); //wait to the the shared context is created + m_defaultSharedContextMutex.unlock(); + } + } + + QPlatformGLContext *sharePlatformContext; + if (format.useDefaultSharedContext()) { + sharePlatformContext = QPlatformGLContext::defaultSharedContext(); + } else { + sharePlatformContext = format.sharedGLContext(); + } GLXContext shareGlxContext = 0; - if (shareContext) - shareGlxContext = static_cast(shareContext)->glxContext(); + if (sharePlatformContext) + shareGlxContext = static_cast(sharePlatformContext)->glxContext(); - m_config = qt_glx_integration_choose_config(m_xd, format, GLX_WINDOW_BIT); + QVector spec = buildSpec(format); + int confcount = 0; + GLXFBConfig *configs; + configs = glXChooseFBConfig(xd->display,xd->screen,spec.constData(),&confcount); + if (confcount) + { + GLXFBConfig config = findConfig(configs,confcount,format,xd); + m_context = glXCreateNewContext(xd->display,config,GLX_RGBA_TYPE,shareGlxContext,TRUE); + XFree(configs); + } else { + qFatal("Warning no context created"); + } - m_context = glXCreateNewContext(m_xd->display, m_config, GLX_RGBA_TYPE, shareGlxContext, True); #ifdef MYX11_DEBUG qDebug() << "QGLXGLContext::create context" << m_context; #endif +// TODO: Populate the QGLFormat with the values of the GLXFBConfig + +} + +QGLXGLContext::QGLXGLContext(MyDisplay *display, Drawable drawable, GLXContext context) + : QPlatformGLContext(), m_xd(display), m_drawable(drawable), m_context(context) +{ + } QGLXGLContext::~QGLXGLContext() @@ -156,6 +186,35 @@ QGLXGLContext::~QGLXGLContext() } } +void QGLXGLContext::createDefaultSharedContex(MyDisplay *xd) +{ + int x = 0; + int y = 0; + int w = 3; + int h = 3; + + Window sharedWindow = XCreateSimpleWindow(xd->display, xd->rootWindow(), + x, y, w, h, 0 /*border_width*/, + xd->blackPixel(), xd->whitePixel()); + GLXContext context; + QPlatformWindowFormat format; + QVector spec = buildSpec(format); + int confcount = 0; + GLXFBConfig *configs; + configs = glXChooseFBConfig(xd->display,xd->screen,spec.constData(),&confcount); + if (confcount) + { + GLXFBConfig config = findConfig(configs,confcount,format,xd); + context = glXCreateNewContext(xd->display,config,GLX_RGBA_TYPE,0,TRUE); + XFree(configs); + QPlatformGLContext *sharedContext = new QGLXGLContext(xd,sharedWindow,context); + QPlatformGLContext::setDefaultSharedContext(sharedContext); + } else { + qFatal("Warning no shared context created"); + } + +} + void QGLXGLContext::makeCurrent() { #ifdef MYX11_DEBUG diff --git a/src/plugins/platforms/testlite/qglxintegration.h b/src/plugins/platforms/testlite/qglxintegration.h index 6d9a216..decbe36 100644 --- a/src/plugins/platforms/testlite/qglxintegration.h +++ b/src/plugins/platforms/testlite/qglxintegration.h @@ -42,7 +42,13 @@ #ifndef Q_GLX_CONTEXT_H #define Q_GLX_CONTEXT_H +#include "qtestlitewindow.h" + #include +#include + +#include + #include QT_BEGIN_NAMESPACE @@ -52,7 +58,7 @@ class MyDisplay; class QGLXGLContext : public QPlatformGLContext { public: - QGLXGLContext(WId winId, MyDisplay *xd, QGLFormat& format, QPlatformGLContext* shareContext); + QGLXGLContext(Window window, MyDisplay *xd, const QPlatformWindowFormat &format); ~QGLXGLContext(); virtual void makeCurrent(); @@ -61,11 +67,19 @@ public: virtual void* getProcAddress(const QString& procName); GLXContext glxContext() {return m_context;} + + private: + static QVector buildSpec(const QPlatformWindowFormat &format); + static GLXFBConfig findConfig(const GLXFBConfig *configs,int configCount, const QPlatformWindowFormat &format, const MyDisplay *xd); + MyDisplay *m_xd; Drawable m_drawable; - GLXFBConfig m_config; GLXContext m_context; + + QGLXGLContext (MyDisplay *display, Drawable drawable, GLXContext context); + static QMutex m_defaultSharedContextMutex; + static void createDefaultSharedContex(MyDisplay *xd); }; diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index 0f6c921..f774458 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -84,8 +84,6 @@ static bool seen_badwindow; static Atom wmProtocolsAtom; static Atom wmDeleteWindowAtom; - - class MyX11CursorNode { public: @@ -155,14 +153,26 @@ QTestLiteWindow::QTestLiteWindow(const QTestLiteIntegration *platformIntegration xd = platformIntegration->xd; xd->windowList.append(this); { - int x = 0; - int y = 0; - int w = 300; - int h = 300; //### - - x_window = XCreateSimpleWindow(xd->display, xd->rootWindow(), - x, y, w, h, 0 /*border_width*/, - xd->blackPixel(), xd->whitePixel()); + int x = window->x(); + int y = window->y(); + int w = window->width(); + int h = window->height(); + +// int n, i; +// if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL) { +// x_visualInfo = QGLXGLContext::findVisual(window->platformWindowFormat(),xd); + +// XSetWindowAttributes a; +// a.background_pixel = xd->whitePixel(); +// a.border_pixel = xd->blackPixel(); +// x_window = XCreateWindow(xd->display, xd->rootWindow(),x, y, w, h, +// 0, visualInfo()->depth, InputOutput, visualInfo()->visual, +// CWBackPixel|CWBorderPixel, &a); +// } else { + x_window = XCreateSimpleWindow(xd->display, xd->rootWindow(), + x, y, w, h, 0 /*border_width*/, + xd->blackPixel(), xd->whitePixel()); +// } #ifdef MYX11_DEBUG qDebug() << "QTestLiteWindow::QTestLiteWindow creating" << hex << x_window << window; @@ -187,16 +197,7 @@ QTestLiteWindow::QTestLiteWindow(const QTestLiteIntegration *platformIntegration wmProtocolsAtom, XA_ATOM, 32, PropModeAppend, (unsigned char *) &wmDeleteWindowAtom, 1); - - - setWindowTitle(QLatin1String("Qt Lighthouse")); - currentCursor = -1; - - setWindowFlags(window->windowFlags()); //##### This should not be the plugin's responsibility - - - //xw->windowTL = this; } @@ -209,6 +210,7 @@ QTestLiteWindow::~QTestLiteWindow() XDestroyWindow(xd->display, x_window); xd->windowList.removeAll(this); + delete mGLContext; } @@ -1019,8 +1021,7 @@ QPlatformGLContext *QTestLiteWindow::glContext() QPlatformGLContext *QTestLiteWindow::createGLContext() { - QGLFormat format; - QPlatformGLContext *context = new QGLXGLContext(x_window, xd, format, 0); + QPlatformGLContext *context = new QGLXGLContext(x_window, xd, widget()->platformWindowFormat()); return context; } -- cgit v0.12 From 4fb48f92e7553e8854c943e6117875c2e2b393f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 26 Jul 2010 08:09:04 +0200 Subject: Destroy subwindows in lighthouse --- src/gui/kernel/qwidget_qpa.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp index 104c529..3584f87 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -116,8 +116,6 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO void QWidget::destroy(bool destroyWindow, bool destroySubWindows) { Q_D(QWidget); - //### jl: subwindows now enabled - Q_UNUSED(destroySubWindows); if ((windowType() == Qt::Popup)) qApp->d_func()->closePopup(this); @@ -127,8 +125,18 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) QApplication::setActiveWindow(0); if (windowType() != Qt::Desktop) { - if (destroyWindow && isWindow()) { -//### jl: delete all child windows... + if (destroySubWindows) { + QObjectList childList(children()); + for (int i = 0; i < childList.size(); i++) { + QWidget *widget = qobject_cast(childList.at(i)); + if (widget && widget->testAttribute(Qt::WA_NativeWindow)) { + if (widget->platformWindow()) { + widget->destroy(); + } + } + } + } + if (destroyWindow) { QTLWExtra *topData = d->maybeTopData(); if (topData) { delete topData->platformWindow; -- cgit v0.12 From 11a16e38df8022b41aae0d41a67e8b5542801d1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 26 Jul 2010 08:15:22 +0200 Subject: fix QGLContext::reset in lighthouse --- src/opengl/qgl_qpa.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index 0fc885c..917842b 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -87,8 +87,10 @@ void QGLContext::reset() doneCurrent(); if (d->platformContext) { - //dont delete. This will be done by the platform - d->platformContext = 0; + if (d->paintDevice && d->paintDevice->devType() == QInternal::Widget) { + QWidget *widget = static_cast(d->paintDevice); + widget->destroy(); + } } d->crWin = false; -- cgit v0.12 From 925fc21fcfdb48093032921e76c9274512699a9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 26 Jul 2010 08:18:18 +0200 Subject: Added QGLFormat to QPlatformWindowFormat conversion --- src/gui/kernel/qplatformwindowformat_qpa.cpp | 68 +++++++++++++-------------- src/opengl/qgl_qpa.cpp | 70 ++++++++++++++++++++++++++-- 2 files changed, 100 insertions(+), 38 deletions(-) diff --git a/src/gui/kernel/qplatformwindowformat_qpa.cpp b/src/gui/kernel/qplatformwindowformat_qpa.cpp index 9d86948..1112ba9 100644 --- a/src/gui/kernel/qplatformwindowformat_qpa.cpp +++ b/src/gui/kernel/qplatformwindowformat_qpa.cpp @@ -98,8 +98,8 @@ public: }; /*! - \class QGLFormat - \brief The QGLFormat class specifies the display format of an OpenGL + \class QPlatformWindowFormat + \brief The QPlatformWindowFormat class specifies the display format of an OpenGL rendering context. \ingroup painting-3D @@ -133,7 +133,7 @@ public: different platforms, and some format options may have higher precedence than others. - You create and tell a QGLFormat object what rendering options you + You create and tell a QPlatformWindowFormat object what rendering options you want from an OpenGL rendering context. OpenGL drivers or accelerated hardware may or may not support @@ -143,7 +143,7 @@ public: context with the nearest subset of features. There are different ways to define the display characteristics of - a rendering context. One is to create a QGLFormat and make it the + a rendering context. One is to create a QPlatformWindowFormat and make it the default for the entire application: \snippet doc/src/snippets/code/src_opengl_qgl.cpp 0 @@ -164,7 +164,7 @@ public: */ /*! - Constructs a QGLFormat object with the following default settings: + Constructs a QPlatformWindowFormat object with the following default settings: \list \i \link setDoubleBuffer() Double buffer:\endlink Enabled. \i \link setDepth() Depth buffer:\endlink Enabled. @@ -187,7 +187,7 @@ QPlatformWindowFormat::QPlatformWindowFormat() /*! - Creates a QGLFormat object that is a copy of the current + Creates a QPlatformWindowFormat object that is a copy of the current defaultFormat(). If \a options is not 0, the default format is modified by the @@ -257,7 +257,7 @@ QPlatformWindowFormat &QPlatformWindowFormat::operator=(const QPlatformWindowFor } /*! - Destroys the QGLFormat. + Destroys the QPlatformWindowFormat. */ QPlatformWindowFormat::~QPlatformWindowFormat() { @@ -266,7 +266,7 @@ QPlatformWindowFormat::~QPlatformWindowFormat() } /*! - \fn bool QGLFormat::doubleBuffer() const + \fn bool QPlatformWindowFormat::doubleBuffer() const Returns true if double buffering is enabled; otherwise returns false. Double buffering is enabled by default. @@ -297,7 +297,7 @@ void QPlatformWindowFormat::setDoubleBuffer(bool enable) /*! - \fn bool QGLFormat::depth() const + \fn bool QPlatformWindowFormat::depth() const Returns true if the depth buffer is enabled; otherwise returns false. The depth buffer is enabled by default. @@ -327,7 +327,7 @@ void QPlatformWindowFormat::setDepth(bool enable) /*! - \fn bool QGLFormat::rgba() const + \fn bool QPlatformWindowFormat::rgba() const Returns true if RGBA color mode is set. Returns false if color index mode is set. The default color mode is RGBA. @@ -358,7 +358,7 @@ void QPlatformWindowFormat::setRgba(bool enable) /*! - \fn bool QGLFormat::alpha() const + \fn bool QPlatformWindowFormat::alpha() const Returns true if the alpha buffer in the framebuffer is enabled; otherwise returns false. The alpha buffer is disabled by default. @@ -386,7 +386,7 @@ void QPlatformWindowFormat::setAlpha(bool enable) /*! - \fn bool QGLFormat::accum() const + \fn bool QPlatformWindowFormat::accum() const Returns true if the accumulation buffer is enabled; otherwise returns false. The accumulation buffer is disabled by default. @@ -413,7 +413,7 @@ void QPlatformWindowFormat::setAccum(bool enable) /*! - \fn bool QGLFormat::stencil() const + \fn bool QPlatformWindowFormat::stencil() const Returns true if the stencil buffer is enabled; otherwise returns false. The stencil buffer is enabled by default. @@ -440,7 +440,7 @@ void QPlatformWindowFormat::setStencil(bool enable) /*! - \fn bool QGLFormat::stereo() const + \fn bool QPlatformWindowFormat::stereo() const Returns true if stereo buffering is enabled; otherwise returns false. Stereo buffering is disabled by default. @@ -467,7 +467,7 @@ void QPlatformWindowFormat::setStereo(bool enable) /*! - \fn bool QGLFormat::directRendering() const + \fn bool QPlatformWindowFormat::directRendering() const Returns true if direct rendering is enabled; otherwise returns false. @@ -496,7 +496,7 @@ void QPlatformWindowFormat::setDirectRendering(bool enable) } /*! - \fn bool QGLFormat::sampleBuffers() const + \fn bool QPlatformWindowFormat::sampleBuffers() const Returns true if multisample buffer support is enabled; otherwise returns false. @@ -550,7 +550,7 @@ void QPlatformWindowFormat::setSamples(int numSamples) { detach(); if (numSamples < 0) { - qWarning("QGLFormat::setSamples: Cannot have negative number of samples per pixel %d", numSamples); + qWarning("QPlatformWindowFormat::setSamples: Cannot have negative number of samples per pixel %d", numSamples); return; } d->numSamples = numSamples; @@ -615,7 +615,7 @@ QPlatformGLContext *QPlatformWindowFormat::sharedGLContext() const } ///*! -// \fn bool QGLFormat::hasOverlay() const +// \fn bool QPlatformWindowFormat::hasOverlay() const // Returns true if overlay plane is enabled; otherwise returns false. @@ -680,7 +680,7 @@ void QPlatformWindowFormat::setDepthBufferSize(int size) { detach(); if (size < 0) { - qWarning("QGLFormat::setDepthBufferSize: Cannot set negative depth buffer size %d", size); + qWarning("QPlatformWindowFormat::setDepthBufferSize: Cannot set negative depth buffer size %d", size); return; } d->depthSize = size; @@ -708,7 +708,7 @@ void QPlatformWindowFormat::setRedBufferSize(int size) { detach(); if (size < 0) { - qWarning("QGLFormat::setRedBufferSize: Cannot set negative red buffer size %d", size); + qWarning("QPlatformWindowFormat::setRedBufferSize: Cannot set negative red buffer size %d", size); return; } d->redSize = size; @@ -737,7 +737,7 @@ void QPlatformWindowFormat::setGreenBufferSize(int size) { detach(); if (size < 0) { - qWarning("QGLFormat::setGreenBufferSize: Cannot set negative green buffer size %d", size); + qWarning("QPlatformWindowFormat::setGreenBufferSize: Cannot set negative green buffer size %d", size); return; } d->greenSize = size; @@ -766,7 +766,7 @@ void QPlatformWindowFormat::setBlueBufferSize(int size) { detach(); if (size < 0) { - qWarning("QGLFormat::setBlueBufferSize: Cannot set negative blue buffer size %d", size); + qWarning("QPlatformWindowFormat::setBlueBufferSize: Cannot set negative blue buffer size %d", size); return; } d->blueSize = size; @@ -794,7 +794,7 @@ void QPlatformWindowFormat::setAlphaBufferSize(int size) { detach(); if (size < 0) { - qWarning("QGLFormat::setAlphaBufferSize: Cannot set negative alpha buffer size %d", size); + qWarning("QPlatformWindowFormat::setAlphaBufferSize: Cannot set negative alpha buffer size %d", size); return; } d->alphaSize = size; @@ -821,7 +821,7 @@ void QPlatformWindowFormat::setAccumBufferSize(int size) { detach(); if (size < 0) { - qWarning("QGLFormat::setAccumBufferSize: Cannot set negative accumulate buffer size %d", size); + qWarning("QPlatformWindowFormat::setAccumBufferSize: Cannot set negative accumulate buffer size %d", size); return; } d->accumSize = size; @@ -847,7 +847,7 @@ void QPlatformWindowFormat::setStencilBufferSize(int size) { detach(); if (size < 0) { - qWarning("QGLFormat::setStencilBufferSize: Cannot set negative stencil buffer size %d", size); + qWarning("QPlatformWindowFormat::setStencilBufferSize: Cannot set negative stencil buffer size %d", size); return; } d->stencilSize = size; @@ -865,13 +865,13 @@ int QPlatformWindowFormat::stencilBufferSize() const } /*! - Returns the default QGLFormat for the application. All QGLWidget + Returns the default QPlatformWindowFormat for the application. All QGLWidget objects that are created use this format unless another format is specified, e.g. when they are constructed. If no special default format has been set using setDefaultFormat(), the default format is the same as that created - with QGLFormat(). + with QPlatformWindowFormat(). \sa setDefaultFormat() */ @@ -882,7 +882,7 @@ QPlatformWindowFormat QPlatformWindowFormat::defaultFormat() } /*! - Sets a new default QGLFormat for the application to \a f. For + Sets a new default QPlatformWindowFormat for the application to \a f. For example, to set single buffering as the default instead of double buffering, your main() might contain code like this: \snippet doc/src/snippets/code/src_opengl_qgl.cpp 4 @@ -897,7 +897,7 @@ void QPlatformWindowFormat::setDefaultFormat(const QPlatformWindowFormat &f) /*! - Returns the default QGLFormat for overlay contexts. + Returns the default QPlatformWindowFormat for overlay contexts. The default overlay format is: \list @@ -923,7 +923,7 @@ void QPlatformWindowFormat::setDefaultFormat(const QPlatformWindowFormat &f) //} ///*! -// Sets a new default QGLFormat for overlay contexts to \a f. This +// Sets a new default QPlatformWindowFormat for overlay contexts to \a f. This // format is used whenever a QGLWidget is created with a format that // hasOverlay() enabled. @@ -953,10 +953,10 @@ void QPlatformWindowFormat::setDefaultFormat(const QPlatformWindowFormat &f) /*! - Returns true if all the options of the two QGLFormat objects + Returns true if all the options of the two QPlatformWindowFormat objects \a a and \a b are equal; otherwise returns false. - \relates QGLFormat + \relates QPlatformWindowFormat */ bool operator==(const QPlatformWindowFormat& a, const QPlatformWindowFormat& b) @@ -976,10 +976,10 @@ bool operator==(const QPlatformWindowFormat& a, const QPlatformWindowFormat& b) /*! - Returns false if all the options of the two QGLFormat objects + Returns false if all the options of the two QPlatformWindowFormat objects \a a and \a b are equal; otherwise returns true. - \relates QGLFormat + \relates QPlatformWindowFormat */ bool operator!=(const QPlatformWindowFormat& a, const QPlatformWindowFormat& b) diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index 917842b..8fa210b 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -52,6 +52,67 @@ QT_BEGIN_NAMESPACE +static QGLFormat qt_platformwindowformat_to_glformat(const QPlatformWindowFormat &format) +{ + QGLFormat retFormat; + retFormat.setAccum(format.accum()); + if (format.accumBufferSize() >= 0) + retFormat.setAccumBufferSize(format.accumBufferSize()); + retFormat.setAlpha(format.alpha()); + if (format.alphaBufferSize() >= 0) + retFormat.setAlphaBufferSize(format.alphaBufferSize()); + if (format.blueBufferSize() >= 0) + retFormat.setBlueBufferSize(format.blueBufferSize()); + retFormat.setDepth(format.depth()); + if (format.depthBufferSize() >= 0) + retFormat.setDepthBufferSize(format.depthBufferSize()); + retFormat.setDirectRendering(format.directRendering()); + retFormat.setDoubleBuffer(format.doubleBuffer()); + if (format.greenBufferSize() >= 0) + retFormat.setGreenBufferSize(format.greenBufferSize()); + if (format.redBufferSize() >= 0) + retFormat.setRedBufferSize(format.redBufferSize()); + retFormat.setRgba(format.rgba()); + retFormat.setSampleBuffers(format.sampleBuffers()); + retFormat.setSamples(format.sampleBuffers()); + retFormat.setStencil(format.stencil()); + if (format.stencilBufferSize() >= 0) + retFormat.setStencilBufferSize(format.stencilBufferSize()); + retFormat.setStereo(format.stereo()); + retFormat.setSwapInterval(format.swapInterval()); + return retFormat; +} + +static QPlatformWindowFormat qt_glformat_to_platformwindowformat(const QGLFormat &format) +{ + QPlatformWindowFormat retFormat; + retFormat.setAccum(format.accum()); + if (format.accumBufferSize() >= 0) + retFormat.setAccumBufferSize(format.accumBufferSize()); + retFormat.setAlpha(format.alpha()); + if (format.alphaBufferSize() >= 0) + retFormat.setAlphaBufferSize(format.alphaBufferSize()); + if (format.blueBufferSize() >= 0) + retFormat.setBlueBufferSize(format.blueBufferSize()); + retFormat.setDepth(format.depth()); + if (format.depthBufferSize() >= 0) + retFormat.setDepthBufferSize(format.depthBufferSize()); + retFormat.setDirectRendering(format.directRendering()); + retFormat.setDoubleBuffer(format.doubleBuffer()); + if (format.greenBufferSize() >= 0) + retFormat.setGreenBufferSize(format.greenBufferSize()); + if (format.redBufferSize() >= 0) + retFormat.setRedBufferSize(format.redBufferSize()); + retFormat.setRgba(format.rgba()); + retFormat.setSampleBuffers(format.sampleBuffers()); + retFormat.setSamples(format.sampleBuffers()); + retFormat.setStencil(format.stencil()); + if (format.stencilBufferSize() >= 0) + retFormat.setStencilBufferSize(format.stencilBufferSize()); + retFormat.setStereo(format.stereo()); + retFormat.setSwapInterval(format.swapInterval()); + return retFormat; +} bool QGLFormat::hasOpenGL() { @@ -61,14 +122,15 @@ bool QGLFormat::hasOpenGL() bool QGLContext::chooseContext(const QGLContext* shareContext) { Q_D(QGLContext); - if (!d->paintDevice && d->paintDevice->devType() != QInternal::Widget) { + if (!d->paintDevice || d->paintDevice->devType() != QInternal::Widget) { d->valid = false; }else { QWidget *widget = static_cast(d->paintDevice); if (!widget->platformWindow()){ - QPlatformWindowFormat format = widget->platformWindowFormat(); - format.setWindowApi(QPlatformWindowFormat::OpenGL); - widget->setPlatformWindowFormat(format); + QGLFormat glformat = format(); + QPlatformWindowFormat winFormat = qt_glformat_to_platformwindowformat(glformat); + winFormat.setWindowApi(QPlatformWindowFormat::OpenGL); + widget->setPlatformWindowFormat(winFormat); widget->winId();//make window } d->platformContext = widget->platformWindow()->glContext(); -- cgit v0.12 From f3ae27721ad0e71923e8538370731f91acb53601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 26 Jul 2010 09:34:10 +0200 Subject: Renamed files in EGLFS platform plugin --- src/plugins/platforms/eglfs/eglfs.pro | 16 + src/plugins/platforms/eglfs/eglintegration.cpp | 469 ---------------------- src/plugins/platforms/eglfs/eglintegration.h | 70 ---- src/plugins/platforms/eglfs/eglintegration.pro | 14 - src/plugins/platforms/eglfs/main.cpp | 2 +- src/plugins/platforms/eglfs/qeglfsintegration.cpp | 469 ++++++++++++++++++++++ src/plugins/platforms/eglfs/qeglfsintegration.h | 70 ++++ 7 files changed, 556 insertions(+), 554 deletions(-) create mode 100644 src/plugins/platforms/eglfs/eglfs.pro delete mode 100644 src/plugins/platforms/eglfs/eglintegration.cpp delete mode 100644 src/plugins/platforms/eglfs/eglintegration.h delete mode 100644 src/plugins/platforms/eglfs/eglintegration.pro create mode 100644 src/plugins/platforms/eglfs/qeglfsintegration.cpp create mode 100644 src/plugins/platforms/eglfs/qeglfsintegration.h diff --git a/src/plugins/platforms/eglfs/eglfs.pro b/src/plugins/platforms/eglfs/eglfs.pro new file mode 100644 index 0000000..2cc5997 --- /dev/null +++ b/src/plugins/platforms/eglfs/eglfs.pro @@ -0,0 +1,16 @@ +TARGET = qeglfs +TEMPLATE = lib +CONFIG += plugin + +QT += opengl + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms + +SOURCES = main.cpp \ + qeglfsintegration.cpp \ + ../eglconvenience/qeglconvenience.cpp +HEADERS = qeglfsintegration.h \ + ../eglconvenience/qeglconvenience.h + +target.path += $$[QT_INSTALL_PLUGINS]/platforms +INSTALLS += target diff --git a/src/plugins/platforms/eglfs/eglintegration.cpp b/src/plugins/platforms/eglfs/eglintegration.cpp deleted file mode 100644 index 9470c99..0000000 --- a/src/plugins/platforms/eglfs/eglintegration.cpp +++ /dev/null @@ -1,469 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "eglintegration.h" - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "../eglconvenience/qeglconvenience.h" - -//#define QEGL_EXTRA_DEBUG -#ifdef QEGL_EXTRA_DEBUG -struct AttrInfo { EGLint attr; const char *name; }; -static struct AttrInfo attrs[] = { - {EGL_BUFFER_SIZE, "EGL_BUFFER_SIZE"}, - {EGL_ALPHA_SIZE, "EGL_ALPHA_SIZE"}, - {EGL_BLUE_SIZE, "EGL_BLUE_SIZE"}, - {EGL_GREEN_SIZE, "EGL_GREEN_SIZE"}, - {EGL_RED_SIZE, "EGL_RED_SIZE"}, - {EGL_DEPTH_SIZE, "EGL_DEPTH_SIZE"}, - {EGL_STENCIL_SIZE, "EGL_STENCIL_SIZE"}, - {EGL_CONFIG_CAVEAT, "EGL_CONFIG_CAVEAT"}, - {EGL_CONFIG_ID, "EGL_CONFIG_ID"}, - {EGL_LEVEL, "EGL_LEVEL"}, - {EGL_MAX_PBUFFER_HEIGHT, "EGL_MAX_PBUFFER_HEIGHT"}, - {EGL_MAX_PBUFFER_PIXELS, "EGL_MAX_PBUFFER_PIXELS"}, - {EGL_MAX_PBUFFER_WIDTH, "EGL_MAX_PBUFFER_WIDTH"}, - {EGL_NATIVE_RENDERABLE, "EGL_NATIVE_RENDERABLE"}, - {EGL_NATIVE_VISUAL_ID, "EGL_NATIVE_VISUAL_ID"}, - {EGL_NATIVE_VISUAL_TYPE, "EGL_NATIVE_VISUAL_TYPE"}, - {EGL_SAMPLES, "EGL_SAMPLES"}, - {EGL_SAMPLE_BUFFERS, "EGL_SAMPLE_BUFFERS"}, - {EGL_SURFACE_TYPE, "EGL_SURFACE_TYPE"}, - {EGL_TRANSPARENT_TYPE, "EGL_TRANSPARENT_TYPE"}, - {EGL_TRANSPARENT_BLUE_VALUE, "EGL_TRANSPARENT_BLUE_VALUE"}, - {EGL_TRANSPARENT_GREEN_VALUE, "EGL_TRANSPARENT_GREEN_VALUE"}, - {EGL_TRANSPARENT_RED_VALUE, "EGL_TRANSPARENT_RED_VALUE"}, - {EGL_BIND_TO_TEXTURE_RGB, "EGL_BIND_TO_TEXTURE_RGB"}, - {EGL_BIND_TO_TEXTURE_RGBA, "EGL_BIND_TO_TEXTURE_RGBA"}, - {EGL_MIN_SWAP_INTERVAL, "EGL_MIN_SWAP_INTERVAL"}, - {EGL_MAX_SWAP_INTERVAL, "EGL_MAX_SWAP_INTERVAL"}, - {-1, 0}}; -#endif //QEGL_EXTRA_DEBUG - - -class QEglScreen; - -class QEglContext : public QPlatformGLContext -{ -public: - QEglContext(QGLFormat& format, QPlatformGLContext* shareContext = 0); - ~QEglContext(); - - virtual void makeCurrent(); - virtual void doneCurrent(); - virtual void swapBuffers(); - virtual void* getProcAddress(const QString& procName); - - EGLContext eglContext() {return m_context;} - QSize size() const { return m_size; } - - QGLFormat format() const { return m_format; } -private: - - EGLContext m_context; - EGLDisplay m_dpy; - EGLSurface m_surface; - QSize m_size; - static bool singleton_watch; - QGLFormat m_format; -}; - -bool QEglContext::singleton_watch = false; - -QEglContext::QEglContext(QGLFormat& format, QPlatformGLContext* shareContext) -{ - if (singleton_watch) - qFatal("There can be only one"); - singleton_watch = true; - - Q_UNUSED(shareContext); - Q_UNUSED(format); - - EGLint major, minor; -#ifdef QEGL_EXTRA_DEBUG - EGLint index; -#endif - if (!eglBindAPI(EGL_OPENGL_ES_API)) { - fprintf(stderr, "Could not bind GL_ES API\n"); - qFatal("EGL error"); - } - - m_dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); - if (m_dpy == EGL_NO_DISPLAY) { - fprintf(stderr, "Could not open egl display\n"); - qFatal("EGL error"); - } - fprintf(stderr, "Opened display %p\n", m_dpy); - - if (!eglInitialize(m_dpy, &major, &minor)) { - fprintf(stderr, "Could not initialize egl display\n"); - qFatal("EGL error"); - } - - fprintf(stderr, "Initialized display %d %d\n", major, minor); - - QPlatformWindowFormat platformFormat; - platformFormat.setDepth(16); - platformFormat.setWindowApi(QPlatformWindowFormat::OpenGL); - platformFormat.setRedBufferSize(5); - platformFormat.setGreenBufferSize(6); - platformFormat.setBlueBufferSize(5); - EGLConfig config = q_configFromQPlatformWindowFormat(m_dpy, platformFormat); - -#ifdef QEGL_EXTRA_DEBUG - fprintf(stderr, "Configuration %d matches requirements\n", (int)config); - - for (index = 0; attrs[index].attr != -1; ++index) { - EGLint value; - if (eglGetConfigAttrib(m_dpy, config, attrs[index].attr, &value)) { - printf("\t%s: %d\n", attrs[index].name, (int)value); - } - } - printf("\n"); -#endif - EGLint temp; - EGLint attribList[32]; - - temp = 0; - - attribList[temp++] = EGL_CONTEXT_CLIENT_VERSION; - attribList[temp++] = 2; // GLES version 2 - attribList[temp++] = EGL_NONE; - - - m_context = eglCreateContext(m_dpy, config, NULL, attribList); - if (m_context == EGL_NO_CONTEXT) { - fprintf(stderr, "Could not create the egl context\n"); - eglTerminate(m_dpy); - qFatal("EGL error"); - } - - m_surface = eglCreateWindowSurface(m_dpy, config, 0, NULL); - if (m_surface == EGL_NO_SURFACE) { - fprintf(stderr, "Could not create the egl surface: error = 0x%x\n", eglGetError()); - eglTerminate(m_dpy); - qFatal("EGL error"); - } - - EGLint w,h; - - eglQuerySurface(m_dpy, m_surface, EGL_WIDTH, &w); - eglQuerySurface(m_dpy, m_surface, EGL_HEIGHT, &h); - fprintf(stderr, "Created surface %dx%d\n", w, h); - - m_size = QSize(w,h); - - -} - -QEglContext::~QEglContext() -{ -#ifdef QEGL_EXTRA_DEBUG - qDebug() << "QEglContext::~QEglContext()"; -#endif -} - -void QEglContext::makeCurrent() -{ -#ifdef QEGL_EXTRA_DEBUG - fprintf(stderr, "QEglContext::makeCurrent\n"); -#endif - if (!eglMakeCurrent(m_dpy, m_surface, m_surface, m_context)) - fprintf(stderr, "Could not make the egl context current\n"); - -#ifdef QEGL_EXTRA_DEBUG - static bool showDebug = true; - if (showDebug) { - showDebug = false; - const char *str = (const char*)glGetString(GL_VENDOR); - qDebug() << "Vendor" << str; - printf("Vendor %s\n", str); - str = (const char*)glGetString(GL_RENDERER); - qDebug() << "Renderer" << str; - printf("Renderer %s\n", str); - str = (const char*)glGetString(GL_VERSION); - qDebug() << "Version" << str; - printf("Version %s\n", str); - - str = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION); - qDebug() << "Shader version" << str; - - str = (const char*)glGetString(GL_EXTENSIONS); - qDebug() << "Extensions" << str; - printf("Extensions %s\n", str); - - } -#endif -} - -void QEglContext::doneCurrent() -{ -#ifdef QEGL_EXTRA_DEBUG - fprintf(stderr, "QEglContext::doneCurrent\n"); -#endif - if (!eglMakeCurrent(m_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)) - fprintf(stderr, "Could not release the egl context\n"); -} - -void QEglContext::swapBuffers() -{ -#ifdef QEGL_EXTRA_DEBUG - fprintf(stderr, "QEglContext::swapBuffers\n"); -#endif - eglSwapBuffers(m_dpy, m_surface); -} - -void* QEglContext::getProcAddress(const QString& procName) -{ -#ifdef QEGL_EXTRA_DEBUG - fprintf(stderr, "QEglContext::getProcAddress\n"); -#endif - return (void*)eglGetProcAddress(qPrintable(procName)); -} - - -class QEglPaintDevice; -class QEglScreen : public QPlatformScreen -{ -public: - QEglScreen(); - ~QEglScreen() {} - - QRect geometry() const { return m_geometry; } - int depth() const { return m_depth; } - QImage::Format format() const { return m_format; } - //QSize physicalSize() const { return m_physicalSize; } //### - -public: - QRect m_geometry; - int m_depth; - QImage::Format m_format; - //QSize m_physicalSize; - QEglContext * m_platformContext; -}; - - -class QEglWindow : public QPlatformWindow -{ -public: - QEglWindow(QWidget *w, QEglScreen *screen); - QPlatformGLContext *glContext(); - - void setGeometry(const QRect &); - WId winId() const; - - QGLContext *context() { return m_context; } - QEglPaintDevice *paintDevice() { return m_pd; } -private: - QEglScreen *m_screen; - QEglPaintDevice *m_pd; - QGLContext *m_context; - WId m_winid; -}; - -class QEglPaintDevice : public QGLPaintDevice -{ -public: - QEglPaintDevice(QEglScreen *screen, QEglWindow *window); - - QSize size() const { return m_screen->geometry().size(); } - QGLContext* context() const { return m_window->context();} - - QPaintEngine *paintEngine() const { return qt_qgl_paint_engine(); } - - void beginPaint(){ - QGLPaintDevice::beginPaint(); - } -private: - QEglScreen *m_screen; - QEglWindow * m_window; -}; - - - - -QEglScreen::QEglScreen() - : m_depth(16), m_format(QImage::Format_RGB16), m_platformContext(0) -{ -#ifdef QEGL_EXTRA_DEBUG - fprintf(stderr, "QEglScreen %p\n", this); -#endif - QGLFormat format = QGLFormat::defaultFormat(); - m_platformContext = new QEglContext(format); - - - m_geometry = QRect(QPoint(), m_platformContext->size()); - -} - - - - -QEglPaintDevice::QEglPaintDevice(QEglScreen *screen, QEglWindow *window) - :QGLPaintDevice(), m_screen(screen), m_window(window) -{ -#ifdef QEGL_EXTRA_DEBUG - qDebug() << "QEglPaintDevice" << this << screen << window; -#endif -} - - - -QEglWindow::QEglWindow(QWidget *w, QEglScreen *screen) - : QPlatformWindow(w), m_screen(screen), m_pd(0), m_context(0) -{ - static int serialNo = 0; - m_winid = ++serialNo; -#ifdef QEGL_EXTRA_DEBUG - fprintf(stderr, "QEglWindow %p: %p %p 0x%x\n", this, w, screen, uint(m_winid)); -#endif - m_pd = new QEglPaintDevice(screen, this); - m_context = new QGLContext( screen->m_platformContext->format(), w); - m_context->create(); -} - - -void QEglWindow::setGeometry(const QRect &) -{ - // We only support full-screen windows - QRect rect(m_screen->availableGeometry()); - QWindowSystemInterface::handleGeometryChange(this->widget(), rect); - - QPlatformWindow::setGeometry(rect); -} - -WId QEglWindow::winId() const -{ - return m_winid; -} - - - -QPlatformGLContext *QEglWindow::glContext() -{ -#ifdef QEGL_EXTRA_DEBUG - fprintf(stderr, "QEglWindow::glContext %p\n", m_screen->m_platformContext); -#endif - Q_ASSERT(m_screen); - return m_screen->m_platformContext; -} - -QEglIntegration::QEglIntegration() -{ - m_primaryScreen = new QEglScreen(); - - mScreens.append(m_primaryScreen); -#ifdef QEGL_EXTRA_DEBUG - fprintf(stderr, "QEglIntegration\n"); -#endif -} - -QPixmapData *QEglIntegration::createPixmapData(QPixmapData::PixelType type) const -{ -#ifdef QEGL_EXTRA_DEBUG - fprintf(stderr, "QEglIntegration::createPixmapData %d\n", type); -#endif - return new QGLPixmapData(type); -} - -QPlatformWindow *QEglIntegration::createPlatformWindow(QWidget *widget, WId winId) const -{ - Q_UNUSED(winId); -#ifdef QEGL_EXTRA_DEBUG - qDebug() << "QEglIntegration::createPlatformWindow" << widget; -#endif - return new QEglWindow(widget, m_primaryScreen); -} - - -class QEglWindowSurface : public QWindowSurface -{ -public: - QEglWindowSurface(QWidget *window, QEglScreen *screen); - ~QEglWindowSurface() {} - - QPaintDevice *paintDevice() { return m_window->paintDevice(); } - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void resize(const QSize &size) {} -private: - QEglScreen *m_screen; - QEglWindow *m_window; -}; - -QEglWindowSurface::QEglWindowSurface(QWidget *window, QEglScreen *screen) - :QWindowSurface(window), m_screen(screen), m_window(0) -{ -#ifdef QEGL_EXTRA_DEBUG - qDebug() << "QEglWindowSurface" << window << screen; -#endif - m_window = static_cast(window->platformWindow()); -} - - -void QEglWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) -{ - Q_UNUSED(widget); - Q_UNUSED(region); - Q_UNUSED(offset); -#ifdef QEGL_EXTRA_DEBUG - qDebug() << "QEglWindowSurface::flush"; -#endif - m_screen->m_platformContext->swapBuffers(); -} - -QWindowSurface *QEglIntegration::createWindowSurface(QWidget *widget, WId winId) const -{ - Q_UNUSED(winId); - -#ifdef QEGL_EXTRA_DEBUG - qDebug() << "QEglIntegration::createWindowSurface" << widget; -#endif - return new QEglWindowSurface(widget, m_primaryScreen); -} diff --git a/src/plugins/platforms/eglfs/eglintegration.h b/src/plugins/platforms/eglfs/eglintegration.h deleted file mode 100644 index 7b9b8cf..0000000 --- a/src/plugins/platforms/eglfs/eglintegration.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef EGLINTEGRATION_H -#define EGLINTEGRATION_H - -#include -#include - -QT_BEGIN_NAMESPACE - -class QEglScreen; -class QEglIntegration : public QPlatformIntegration -{ -public: - QEglIntegration(); - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; - QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; - - QList screens() const { return mScreens; } - -private: - QList mScreens; - QEglScreen *m_primaryScreen; -}; - -QT_END_NAMESPACE - - -#endif diff --git a/src/plugins/platforms/eglfs/eglintegration.pro b/src/plugins/platforms/eglfs/eglintegration.pro deleted file mode 100644 index 7cd2f05..0000000 --- a/src/plugins/platforms/eglfs/eglintegration.pro +++ /dev/null @@ -1,14 +0,0 @@ -TARGET = eglintegration -TEMPLATE = lib -CONFIG += plugin - -QT += opengl - -SOURCES = main.cpp \ - eglintegration.cpp \ - ../eglconvenience/qeglconvenience.cpp -HEADERS = eglintegration.h \ - ../eglconvenience/qeglconvenience.h - -target.path += $$[QT_INSTALL_PLUGINS]/platforms -INSTALLS += target diff --git a/src/plugins/platforms/eglfs/main.cpp b/src/plugins/platforms/eglfs/main.cpp index adaea78..e1731e8 100644 --- a/src/plugins/platforms/eglfs/main.cpp +++ b/src/plugins/platforms/eglfs/main.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include -#include "eglintegration.h" +#include "qeglfsintegration.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp new file mode 100644 index 0000000..4d17980 --- /dev/null +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -0,0 +1,469 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qeglfsintegration.h" + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "../eglconvenience/qeglconvenience.h" + +//#define QEGL_EXTRA_DEBUG +#ifdef QEGL_EXTRA_DEBUG +struct AttrInfo { EGLint attr; const char *name; }; +static struct AttrInfo attrs[] = { + {EGL_BUFFER_SIZE, "EGL_BUFFER_SIZE"}, + {EGL_ALPHA_SIZE, "EGL_ALPHA_SIZE"}, + {EGL_BLUE_SIZE, "EGL_BLUE_SIZE"}, + {EGL_GREEN_SIZE, "EGL_GREEN_SIZE"}, + {EGL_RED_SIZE, "EGL_RED_SIZE"}, + {EGL_DEPTH_SIZE, "EGL_DEPTH_SIZE"}, + {EGL_STENCIL_SIZE, "EGL_STENCIL_SIZE"}, + {EGL_CONFIG_CAVEAT, "EGL_CONFIG_CAVEAT"}, + {EGL_CONFIG_ID, "EGL_CONFIG_ID"}, + {EGL_LEVEL, "EGL_LEVEL"}, + {EGL_MAX_PBUFFER_HEIGHT, "EGL_MAX_PBUFFER_HEIGHT"}, + {EGL_MAX_PBUFFER_PIXELS, "EGL_MAX_PBUFFER_PIXELS"}, + {EGL_MAX_PBUFFER_WIDTH, "EGL_MAX_PBUFFER_WIDTH"}, + {EGL_NATIVE_RENDERABLE, "EGL_NATIVE_RENDERABLE"}, + {EGL_NATIVE_VISUAL_ID, "EGL_NATIVE_VISUAL_ID"}, + {EGL_NATIVE_VISUAL_TYPE, "EGL_NATIVE_VISUAL_TYPE"}, + {EGL_SAMPLES, "EGL_SAMPLES"}, + {EGL_SAMPLE_BUFFERS, "EGL_SAMPLE_BUFFERS"}, + {EGL_SURFACE_TYPE, "EGL_SURFACE_TYPE"}, + {EGL_TRANSPARENT_TYPE, "EGL_TRANSPARENT_TYPE"}, + {EGL_TRANSPARENT_BLUE_VALUE, "EGL_TRANSPARENT_BLUE_VALUE"}, + {EGL_TRANSPARENT_GREEN_VALUE, "EGL_TRANSPARENT_GREEN_VALUE"}, + {EGL_TRANSPARENT_RED_VALUE, "EGL_TRANSPARENT_RED_VALUE"}, + {EGL_BIND_TO_TEXTURE_RGB, "EGL_BIND_TO_TEXTURE_RGB"}, + {EGL_BIND_TO_TEXTURE_RGBA, "EGL_BIND_TO_TEXTURE_RGBA"}, + {EGL_MIN_SWAP_INTERVAL, "EGL_MIN_SWAP_INTERVAL"}, + {EGL_MAX_SWAP_INTERVAL, "EGL_MAX_SWAP_INTERVAL"}, + {-1, 0}}; +#endif //QEGL_EXTRA_DEBUG + + +class QEglScreen; + +class QEglContext : public QPlatformGLContext +{ +public: + QEglContext(QGLFormat& format, QPlatformGLContext* shareContext = 0); + ~QEglContext(); + + virtual void makeCurrent(); + virtual void doneCurrent(); + virtual void swapBuffers(); + virtual void* getProcAddress(const QString& procName); + + EGLContext eglContext() {return m_context;} + QSize size() const { return m_size; } + + QGLFormat format() const { return m_format; } +private: + + EGLContext m_context; + EGLDisplay m_dpy; + EGLSurface m_surface; + QSize m_size; + static bool singleton_watch; + QGLFormat m_format; +}; + +bool QEglContext::singleton_watch = false; + +QEglContext::QEglContext(QGLFormat& format, QPlatformGLContext* shareContext) +{ + if (singleton_watch) + qFatal("There can be only one"); + singleton_watch = true; + + Q_UNUSED(shareContext); + Q_UNUSED(format); + + EGLint major, minor; +#ifdef QEGL_EXTRA_DEBUG + EGLint index; +#endif + if (!eglBindAPI(EGL_OPENGL_ES_API)) { + fprintf(stderr, "Could not bind GL_ES API\n"); + qFatal("EGL error"); + } + + m_dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); + if (m_dpy == EGL_NO_DISPLAY) { + fprintf(stderr, "Could not open egl display\n"); + qFatal("EGL error"); + } + fprintf(stderr, "Opened display %p\n", m_dpy); + + if (!eglInitialize(m_dpy, &major, &minor)) { + fprintf(stderr, "Could not initialize egl display\n"); + qFatal("EGL error"); + } + + fprintf(stderr, "Initialized display %d %d\n", major, minor); + + QPlatformWindowFormat platformFormat; + platformFormat.setDepth(16); + platformFormat.setWindowApi(QPlatformWindowFormat::OpenGL); + platformFormat.setRedBufferSize(5); + platformFormat.setGreenBufferSize(6); + platformFormat.setBlueBufferSize(5); + EGLConfig config = q_configFromQPlatformWindowFormat(m_dpy, platformFormat); + +#ifdef QEGL_EXTRA_DEBUG + fprintf(stderr, "Configuration %d matches requirements\n", (int)config); + + for (index = 0; attrs[index].attr != -1; ++index) { + EGLint value; + if (eglGetConfigAttrib(m_dpy, config, attrs[index].attr, &value)) { + printf("\t%s: %d\n", attrs[index].name, (int)value); + } + } + printf("\n"); +#endif + EGLint temp; + EGLint attribList[32]; + + temp = 0; + + attribList[temp++] = EGL_CONTEXT_CLIENT_VERSION; + attribList[temp++] = 2; // GLES version 2 + attribList[temp++] = EGL_NONE; + + + m_context = eglCreateContext(m_dpy, config, NULL, attribList); + if (m_context == EGL_NO_CONTEXT) { + fprintf(stderr, "Could not create the egl context\n"); + eglTerminate(m_dpy); + qFatal("EGL error"); + } + + m_surface = eglCreateWindowSurface(m_dpy, config, 0, NULL); + if (m_surface == EGL_NO_SURFACE) { + fprintf(stderr, "Could not create the egl surface: error = 0x%x\n", eglGetError()); + eglTerminate(m_dpy); + qFatal("EGL error"); + } + + EGLint w,h; + + eglQuerySurface(m_dpy, m_surface, EGL_WIDTH, &w); + eglQuerySurface(m_dpy, m_surface, EGL_HEIGHT, &h); + fprintf(stderr, "Created surface %dx%d\n", w, h); + + m_size = QSize(w,h); + + +} + +QEglContext::~QEglContext() +{ +#ifdef QEGL_EXTRA_DEBUG + qDebug() << "QEglContext::~QEglContext()"; +#endif +} + +void QEglContext::makeCurrent() +{ +#ifdef QEGL_EXTRA_DEBUG + fprintf(stderr, "QEglContext::makeCurrent\n"); +#endif + if (!eglMakeCurrent(m_dpy, m_surface, m_surface, m_context)) + fprintf(stderr, "Could not make the egl context current\n"); + +#ifdef QEGL_EXTRA_DEBUG + static bool showDebug = true; + if (showDebug) { + showDebug = false; + const char *str = (const char*)glGetString(GL_VENDOR); + qDebug() << "Vendor" << str; + printf("Vendor %s\n", str); + str = (const char*)glGetString(GL_RENDERER); + qDebug() << "Renderer" << str; + printf("Renderer %s\n", str); + str = (const char*)glGetString(GL_VERSION); + qDebug() << "Version" << str; + printf("Version %s\n", str); + + str = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION); + qDebug() << "Shader version" << str; + + str = (const char*)glGetString(GL_EXTENSIONS); + qDebug() << "Extensions" << str; + printf("Extensions %s\n", str); + + } +#endif +} + +void QEglContext::doneCurrent() +{ +#ifdef QEGL_EXTRA_DEBUG + fprintf(stderr, "QEglContext::doneCurrent\n"); +#endif + if (!eglMakeCurrent(m_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)) + fprintf(stderr, "Could not release the egl context\n"); +} + +void QEglContext::swapBuffers() +{ +#ifdef QEGL_EXTRA_DEBUG + fprintf(stderr, "QEglContext::swapBuffers\n"); +#endif + eglSwapBuffers(m_dpy, m_surface); +} + +void* QEglContext::getProcAddress(const QString& procName) +{ +#ifdef QEGL_EXTRA_DEBUG + fprintf(stderr, "QEglContext::getProcAddress\n"); +#endif + return (void*)eglGetProcAddress(qPrintable(procName)); +} + + +class QEglPaintDevice; +class QEglScreen : public QPlatformScreen +{ +public: + QEglScreen(); + ~QEglScreen() {} + + QRect geometry() const { return m_geometry; } + int depth() const { return m_depth; } + QImage::Format format() const { return m_format; } + //QSize physicalSize() const { return m_physicalSize; } //### + +public: + QRect m_geometry; + int m_depth; + QImage::Format m_format; + //QSize m_physicalSize; + QEglContext * m_platformContext; +}; + + +class QEglWindow : public QPlatformWindow +{ +public: + QEglWindow(QWidget *w, QEglScreen *screen); + QPlatformGLContext *glContext(); + + void setGeometry(const QRect &); + WId winId() const; + + QGLContext *context() { return m_context; } + QEglPaintDevice *paintDevice() { return m_pd; } +private: + QEglScreen *m_screen; + QEglPaintDevice *m_pd; + QGLContext *m_context; + WId m_winid; +}; + +class QEglPaintDevice : public QGLPaintDevice +{ +public: + QEglPaintDevice(QEglScreen *screen, QEglWindow *window); + + QSize size() const { return m_screen->geometry().size(); } + QGLContext* context() const { return m_window->context();} + + QPaintEngine *paintEngine() const { return qt_qgl_paint_engine(); } + + void beginPaint(){ + QGLPaintDevice::beginPaint(); + } +private: + QEglScreen *m_screen; + QEglWindow * m_window; +}; + + + + +QEglScreen::QEglScreen() + : m_depth(16), m_format(QImage::Format_RGB16), m_platformContext(0) +{ +#ifdef QEGL_EXTRA_DEBUG + fprintf(stderr, "QEglScreen %p\n", this); +#endif + QGLFormat format = QGLFormat::defaultFormat(); + m_platformContext = new QEglContext(format); + + + m_geometry = QRect(QPoint(), m_platformContext->size()); + +} + + + + +QEglPaintDevice::QEglPaintDevice(QEglScreen *screen, QEglWindow *window) + :QGLPaintDevice(), m_screen(screen), m_window(window) +{ +#ifdef QEGL_EXTRA_DEBUG + qDebug() << "QEglPaintDevice" << this << screen << window; +#endif +} + + + +QEglWindow::QEglWindow(QWidget *w, QEglScreen *screen) + : QPlatformWindow(w), m_screen(screen), m_pd(0), m_context(0) +{ + static int serialNo = 0; + m_winid = ++serialNo; +#ifdef QEGL_EXTRA_DEBUG + fprintf(stderr, "QEglWindow %p: %p %p 0x%x\n", this, w, screen, uint(m_winid)); +#endif + m_pd = new QEglPaintDevice(screen, this); + m_context = new QGLContext( screen->m_platformContext->format(), w); + m_context->create(); +} + + +void QEglWindow::setGeometry(const QRect &) +{ + // We only support full-screen windows + QRect rect(m_screen->availableGeometry()); + QWindowSystemInterface::handleGeometryChange(this->widget(), rect); + + QPlatformWindow::setGeometry(rect); +} + +WId QEglWindow::winId() const +{ + return m_winid; +} + + + +QPlatformGLContext *QEglWindow::glContext() +{ +#ifdef QEGL_EXTRA_DEBUG + fprintf(stderr, "QEglWindow::glContext %p\n", m_screen->m_platformContext); +#endif + Q_ASSERT(m_screen); + return m_screen->m_platformContext; +} + +QEglIntegration::QEglIntegration() +{ + m_primaryScreen = new QEglScreen(); + + mScreens.append(m_primaryScreen); +#ifdef QEGL_EXTRA_DEBUG + fprintf(stderr, "QEglIntegration\n"); +#endif +} + +QPixmapData *QEglIntegration::createPixmapData(QPixmapData::PixelType type) const +{ +#ifdef QEGL_EXTRA_DEBUG + fprintf(stderr, "QEglIntegration::createPixmapData %d\n", type); +#endif + return new QGLPixmapData(type); +} + +QPlatformWindow *QEglIntegration::createPlatformWindow(QWidget *widget, WId winId) const +{ + Q_UNUSED(winId); +#ifdef QEGL_EXTRA_DEBUG + qDebug() << "QEglIntegration::createPlatformWindow" << widget; +#endif + return new QEglWindow(widget, m_primaryScreen); +} + + +class QEglWindowSurface : public QWindowSurface +{ +public: + QEglWindowSurface(QWidget *window, QEglScreen *screen); + ~QEglWindowSurface() {} + + QPaintDevice *paintDevice() { return m_window->paintDevice(); } + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void resize(const QSize &size) {} +private: + QEglScreen *m_screen; + QEglWindow *m_window; +}; + +QEglWindowSurface::QEglWindowSurface(QWidget *window, QEglScreen *screen) + :QWindowSurface(window), m_screen(screen), m_window(0) +{ +#ifdef QEGL_EXTRA_DEBUG + qDebug() << "QEglWindowSurface" << window << screen; +#endif + m_window = static_cast(window->platformWindow()); +} + + +void QEglWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + Q_UNUSED(region); + Q_UNUSED(offset); +#ifdef QEGL_EXTRA_DEBUG + qDebug() << "QEglWindowSurface::flush"; +#endif + m_screen->m_platformContext->swapBuffers(); +} + +QWindowSurface *QEglIntegration::createWindowSurface(QWidget *widget, WId winId) const +{ + Q_UNUSED(winId); + +#ifdef QEGL_EXTRA_DEBUG + qDebug() << "QEglIntegration::createWindowSurface" << widget; +#endif + return new QEglWindowSurface(widget, m_primaryScreen); +} diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.h b/src/plugins/platforms/eglfs/qeglfsintegration.h new file mode 100644 index 0000000..7b9b8cf --- /dev/null +++ b/src/plugins/platforms/eglfs/qeglfsintegration.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef EGLINTEGRATION_H +#define EGLINTEGRATION_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QEglScreen; +class QEglIntegration : public QPlatformIntegration +{ +public: + QEglIntegration(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; + QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; + + QList screens() const { return mScreens; } + +private: + QList mScreens; + QEglScreen *m_primaryScreen; +}; + +QT_END_NAMESPACE + + +#endif -- cgit v0.12 From 4edb2026545574e287c3d71c272c02dec9134e89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 27 Jul 2010 07:42:44 +0200 Subject: Refactored the eglfs plugin seperated the functionality into different files, and made the paintdevice belong to the windowsurface. Everything really belongs to the screen, since everything is full screen but, this makes it more on par with the other plugins. --- src/gui/kernel/qplatformscreen_qpa.h | 2 +- .../platforms/eglconvenience/qeglconvenience.cpp | 5 +- .../eglconvenience/qeglplatformcontext.cpp | 47 ++- src/plugins/platforms/eglfs/eglfs.pro | 17 +- src/plugins/platforms/eglfs/main.cpp | 2 +- src/plugins/platforms/eglfs/qeglfsintegration.cpp | 412 +-------------------- src/plugins/platforms/eglfs/qeglfsintegration.h | 13 +- src/plugins/platforms/eglfs/qeglfsscreen.cpp | 174 +++++++++ src/plugins/platforms/eglfs/qeglfsscreen.h | 75 ++++ src/plugins/platforms/eglfs/qeglfswindow.cpp | 83 +++++ src/plugins/platforms/eglfs/qeglfswindow.h | 69 ++++ .../platforms/eglfs/qeglfswindowsurface.cpp | 103 ++++++ src/plugins/platforms/eglfs/qeglfswindowsurface.h | 66 ++++ 13 files changed, 655 insertions(+), 413 deletions(-) create mode 100644 src/plugins/platforms/eglfs/qeglfsscreen.cpp create mode 100644 src/plugins/platforms/eglfs/qeglfsscreen.h create mode 100644 src/plugins/platforms/eglfs/qeglfswindow.cpp create mode 100644 src/plugins/platforms/eglfs/qeglfswindow.h create mode 100644 src/plugins/platforms/eglfs/qeglfswindowsurface.cpp create mode 100644 src/plugins/platforms/eglfs/qeglfswindowsurface.h diff --git a/src/gui/kernel/qplatformscreen_qpa.h b/src/gui/kernel/qplatformscreen_qpa.h index 7d0e28d..f603db5 100644 --- a/src/gui/kernel/qplatformscreen_qpa.h +++ b/src/gui/kernel/qplatformscreen_qpa.h @@ -59,7 +59,7 @@ public: virtual ~QPlatformScreen() { } virtual QRect geometry() const = 0; - virtual QRect availableGeometry() const {return geometry();}; + virtual QRect availableGeometry() const {return geometry();} virtual int depth() const = 0; virtual QImage::Format format() const = 0; virtual QSize physicalSize() const; diff --git a/src/plugins/platforms/eglconvenience/qeglconvenience.cpp b/src/plugins/platforms/eglconvenience/qeglconvenience.cpp index 1064e47..c50101d 100644 --- a/src/plugins/platforms/eglconvenience/qeglconvenience.cpp +++ b/src/plugins/platforms/eglconvenience/qeglconvenience.cpp @@ -1,7 +1,5 @@ #include "qeglconvenience.h" -#include - QVector q_createConfigAttributesFromFormat(const QPlatformWindowFormat &format) { int redSize = format.redBufferSize(); @@ -178,7 +176,6 @@ EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformW } else { configureAttributes.append(EGL_OPENGL_ES2_BIT); } - configureAttributes.append(EGL_NONE); do { @@ -228,6 +225,6 @@ EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformW } delete [] configs; } while (q_reduceConfigAttributes(&configureAttributes)); - qDebug() << "RETURNING NULL!"; + qWarning("Cant find EGLConfig, returning null config"); return 0; } diff --git a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp index 6afeb70..a72f7b2 100644 --- a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp +++ b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp @@ -43,7 +43,6 @@ #include -#include #include QEGLPlatformContext::QEGLPlatformContext(EGLDisplay display, EGLConfig config, EGLint contextAttrs[], EGLSurface surface, EGLenum eglApi) @@ -57,13 +56,18 @@ QEGLPlatformContext::QEGLPlatformContext(EGLDisplay display, EGLConfig config, E eglBindAPI(m_eglApi); m_eglContext = eglCreateContext(m_eglDisplay,config, 0,contextAttrs); - if (!m_eglContext) { - qErrnoWarning("QEGLPlatformContext could not create eglContext"); + if (m_eglContext == EGL_NO_CONTEXT) { + qWarning("Could not create the egl context\n"); + eglTerminate(m_eglDisplay); + qFatal("EGL error"); } } QEGLPlatformContext::~QEGLPlatformContext() { +#ifdef QEGL_EXTRA_DEBUG + qWarning("QEglContext::~QEglContext(): %p\n",this); +#endif if (m_eglSurface != EGL_NO_SURFACE) { doneCurrent(); eglDestroySurface(m_eglDisplay, m_eglSurface); @@ -78,27 +82,58 @@ QEGLPlatformContext::~QEGLPlatformContext() void QEGLPlatformContext::makeCurrent() { +#ifdef QEGL_EXTRA_DEBUG + qWarning("QEglContext::makeCurrent: %p\n",this); +#endif eglBindAPI(m_eglApi); bool ok = eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext); if (!ok) - qWarning() << "QEGLPlatformContext::makeCurrent(" << m_eglSurface << "):" << eglGetError(); + qWarning("QEGLPlatformContext::makeCurrent: eglError: %d, this: %p \n", eglGetError(), this); +#ifdef QEGL_EXTRA_DEBUG + static bool showDebug = true; + if (showDebug) { + showDebug = false; + const char *str = (const char*)glGetString(GL_VENDOR); + qWarning("Vendor %s\n", str); + str = (const char*)glGetString(GL_RENDERER); + qWarning("Renderer %s\n", str); + str = (const char*)glGetString(GL_VERSION); + qWarning("Version %s\n", str); + + str = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION); + qWarning("Extensions %s\n",str); + + str = (const char*)glGetString(GL_EXTENSIONS); + qWarning("Extensions %s\n", str); + + } +#endif } void QEGLPlatformContext::doneCurrent() { +#ifdef QEGL_EXTRA_DEBUG + qWarning("QEglContext::doneCurrent:%p\n",this); +#endif eglBindAPI(m_eglApi); bool ok = eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); if (!ok) - qWarning() << "QEGLPlatformContext::doneCurrent():" << eglGetError(); + qWarning("QEGLPlatformContext::doneCurrent(): eglError: %d, this: %p \n", eglGetError(), this); } void QEGLPlatformContext::swapBuffers() { +#ifdef QEGL_EXTRA_DEBUG + qWarning("QEglContext::swapBuffers:%p\n",this); +#endif eglBindAPI(m_eglApi); bool ok = eglSwapBuffers(m_eglDisplay, m_eglSurface); if (!ok) - qWarning() << "QEGLPlatformContext::swapBuffers():" << eglGetError(); + qWarning("QEGLPlatformContext::swapBuffers(): eglError: %d, this: %p \n", eglGetError(), this); } void* QEGLPlatformContext::getProcAddress(const QString& procName) { +#ifdef QEGL_EXTRA_DEBUG + qWarning("QEglContext::getProcAddress%p\n",this); +#endif eglBindAPI(m_eglApi); return (void *)eglGetProcAddress(qPrintable(procName)); } diff --git a/src/plugins/platforms/eglfs/eglfs.pro b/src/plugins/platforms/eglfs/eglfs.pro index 2cc5997..5d1318a 100644 --- a/src/plugins/platforms/eglfs/eglfs.pro +++ b/src/plugins/platforms/eglfs/eglfs.pro @@ -6,11 +6,24 @@ QT += opengl QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms +#DEFINES += QEGL_EXTRA_DEBUG + +#DEFINES += Q_OPENKODE + SOURCES = main.cpp \ qeglfsintegration.cpp \ - ../eglconvenience/qeglconvenience.cpp + ../eglconvenience/qeglconvenience.cpp \ + ../eglconvenience/qeglplatformcontext.cpp \ + qeglfswindow.cpp \ + qeglfswindowsurface.cpp \ + qeglfsscreen.cpp + HEADERS = qeglfsintegration.h \ - ../eglconvenience/qeglconvenience.h + ../eglconvenience/qeglconvenience.h \ + ../eglconvenience/qeglplatformcontext.h \ + qeglfswindow.h \ + qeglfswindowsurface.h \ + qeglfsscreen.h target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target diff --git a/src/plugins/platforms/eglfs/main.cpp b/src/plugins/platforms/eglfs/main.cpp index e1731e8..d0a82b7 100644 --- a/src/plugins/platforms/eglfs/main.cpp +++ b/src/plugins/platforms/eglfs/main.cpp @@ -62,7 +62,7 @@ QPlatformIntegration* QEglIntegrationPlugin::create(const QString& system, const { Q_UNUSED(paramList); if (system.toLower() == "eglfs") - return new QEglIntegration; + return new QEglFSIntegration; return 0; } diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index 4d17980..2b673ae 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -41,429 +41,53 @@ #include "qeglfsintegration.h" +#include "qeglfswindow.h" +#include "qeglfswindowsurface.h" + #include -#include +#include #include -#include -#include #include -#include -#include - -#include "../eglconvenience/qeglconvenience.h" - -//#define QEGL_EXTRA_DEBUG -#ifdef QEGL_EXTRA_DEBUG -struct AttrInfo { EGLint attr; const char *name; }; -static struct AttrInfo attrs[] = { - {EGL_BUFFER_SIZE, "EGL_BUFFER_SIZE"}, - {EGL_ALPHA_SIZE, "EGL_ALPHA_SIZE"}, - {EGL_BLUE_SIZE, "EGL_BLUE_SIZE"}, - {EGL_GREEN_SIZE, "EGL_GREEN_SIZE"}, - {EGL_RED_SIZE, "EGL_RED_SIZE"}, - {EGL_DEPTH_SIZE, "EGL_DEPTH_SIZE"}, - {EGL_STENCIL_SIZE, "EGL_STENCIL_SIZE"}, - {EGL_CONFIG_CAVEAT, "EGL_CONFIG_CAVEAT"}, - {EGL_CONFIG_ID, "EGL_CONFIG_ID"}, - {EGL_LEVEL, "EGL_LEVEL"}, - {EGL_MAX_PBUFFER_HEIGHT, "EGL_MAX_PBUFFER_HEIGHT"}, - {EGL_MAX_PBUFFER_PIXELS, "EGL_MAX_PBUFFER_PIXELS"}, - {EGL_MAX_PBUFFER_WIDTH, "EGL_MAX_PBUFFER_WIDTH"}, - {EGL_NATIVE_RENDERABLE, "EGL_NATIVE_RENDERABLE"}, - {EGL_NATIVE_VISUAL_ID, "EGL_NATIVE_VISUAL_ID"}, - {EGL_NATIVE_VISUAL_TYPE, "EGL_NATIVE_VISUAL_TYPE"}, - {EGL_SAMPLES, "EGL_SAMPLES"}, - {EGL_SAMPLE_BUFFERS, "EGL_SAMPLE_BUFFERS"}, - {EGL_SURFACE_TYPE, "EGL_SURFACE_TYPE"}, - {EGL_TRANSPARENT_TYPE, "EGL_TRANSPARENT_TYPE"}, - {EGL_TRANSPARENT_BLUE_VALUE, "EGL_TRANSPARENT_BLUE_VALUE"}, - {EGL_TRANSPARENT_GREEN_VALUE, "EGL_TRANSPARENT_GREEN_VALUE"}, - {EGL_TRANSPARENT_RED_VALUE, "EGL_TRANSPARENT_RED_VALUE"}, - {EGL_BIND_TO_TEXTURE_RGB, "EGL_BIND_TO_TEXTURE_RGB"}, - {EGL_BIND_TO_TEXTURE_RGBA, "EGL_BIND_TO_TEXTURE_RGBA"}, - {EGL_MIN_SWAP_INTERVAL, "EGL_MIN_SWAP_INTERVAL"}, - {EGL_MAX_SWAP_INTERVAL, "EGL_MAX_SWAP_INTERVAL"}, - {-1, 0}}; -#endif //QEGL_EXTRA_DEBUG - - -class QEglScreen; - -class QEglContext : public QPlatformGLContext -{ -public: - QEglContext(QGLFormat& format, QPlatformGLContext* shareContext = 0); - ~QEglContext(); - - virtual void makeCurrent(); - virtual void doneCurrent(); - virtual void swapBuffers(); - virtual void* getProcAddress(const QString& procName); - - EGLContext eglContext() {return m_context;} - QSize size() const { return m_size; } - - QGLFormat format() const { return m_format; } -private: - - EGLContext m_context; - EGLDisplay m_dpy; - EGLSurface m_surface; - QSize m_size; - static bool singleton_watch; - QGLFormat m_format; -}; - -bool QEglContext::singleton_watch = false; - -QEglContext::QEglContext(QGLFormat& format, QPlatformGLContext* shareContext) -{ - if (singleton_watch) - qFatal("There can be only one"); - singleton_watch = true; - - Q_UNUSED(shareContext); - Q_UNUSED(format); - - EGLint major, minor; -#ifdef QEGL_EXTRA_DEBUG - EGLint index; -#endif - if (!eglBindAPI(EGL_OPENGL_ES_API)) { - fprintf(stderr, "Could not bind GL_ES API\n"); - qFatal("EGL error"); - } - - m_dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); - if (m_dpy == EGL_NO_DISPLAY) { - fprintf(stderr, "Could not open egl display\n"); - qFatal("EGL error"); - } - fprintf(stderr, "Opened display %p\n", m_dpy); - - if (!eglInitialize(m_dpy, &major, &minor)) { - fprintf(stderr, "Could not initialize egl display\n"); - qFatal("EGL error"); - } - - fprintf(stderr, "Initialized display %d %d\n", major, minor); - - QPlatformWindowFormat platformFormat; - platformFormat.setDepth(16); - platformFormat.setWindowApi(QPlatformWindowFormat::OpenGL); - platformFormat.setRedBufferSize(5); - platformFormat.setGreenBufferSize(6); - platformFormat.setBlueBufferSize(5); - EGLConfig config = q_configFromQPlatformWindowFormat(m_dpy, platformFormat); - -#ifdef QEGL_EXTRA_DEBUG - fprintf(stderr, "Configuration %d matches requirements\n", (int)config); - - for (index = 0; attrs[index].attr != -1; ++index) { - EGLint value; - if (eglGetConfigAttrib(m_dpy, config, attrs[index].attr, &value)) { - printf("\t%s: %d\n", attrs[index].name, (int)value); - } - } - printf("\n"); -#endif - EGLint temp; - EGLint attribList[32]; - - temp = 0; - - attribList[temp++] = EGL_CONTEXT_CLIENT_VERSION; - attribList[temp++] = 2; // GLES version 2 - attribList[temp++] = EGL_NONE; - - - m_context = eglCreateContext(m_dpy, config, NULL, attribList); - if (m_context == EGL_NO_CONTEXT) { - fprintf(stderr, "Could not create the egl context\n"); - eglTerminate(m_dpy); - qFatal("EGL error"); - } - - m_surface = eglCreateWindowSurface(m_dpy, config, 0, NULL); - if (m_surface == EGL_NO_SURFACE) { - fprintf(stderr, "Could not create the egl surface: error = 0x%x\n", eglGetError()); - eglTerminate(m_dpy); - qFatal("EGL error"); - } - - EGLint w,h; - - eglQuerySurface(m_dpy, m_surface, EGL_WIDTH, &w); - eglQuerySurface(m_dpy, m_surface, EGL_HEIGHT, &h); - fprintf(stderr, "Created surface %dx%d\n", w, h); - - m_size = QSize(w,h); +QT_BEGIN_NAMESPACE -} - -QEglContext::~QEglContext() -{ -#ifdef QEGL_EXTRA_DEBUG - qDebug() << "QEglContext::~QEglContext()"; -#endif -} - -void QEglContext::makeCurrent() -{ -#ifdef QEGL_EXTRA_DEBUG - fprintf(stderr, "QEglContext::makeCurrent\n"); -#endif - if (!eglMakeCurrent(m_dpy, m_surface, m_surface, m_context)) - fprintf(stderr, "Could not make the egl context current\n"); - -#ifdef QEGL_EXTRA_DEBUG - static bool showDebug = true; - if (showDebug) { - showDebug = false; - const char *str = (const char*)glGetString(GL_VENDOR); - qDebug() << "Vendor" << str; - printf("Vendor %s\n", str); - str = (const char*)glGetString(GL_RENDERER); - qDebug() << "Renderer" << str; - printf("Renderer %s\n", str); - str = (const char*)glGetString(GL_VERSION); - qDebug() << "Version" << str; - printf("Version %s\n", str); - - str = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION); - qDebug() << "Shader version" << str; - - str = (const char*)glGetString(GL_EXTENSIONS); - qDebug() << "Extensions" << str; - printf("Extensions %s\n", str); - - } -#endif -} - -void QEglContext::doneCurrent() +QEglFSIntegration::QEglFSIntegration() { -#ifdef QEGL_EXTRA_DEBUG - fprintf(stderr, "QEglContext::doneCurrent\n"); -#endif - if (!eglMakeCurrent(m_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)) - fprintf(stderr, "Could not release the egl context\n"); -} - -void QEglContext::swapBuffers() -{ -#ifdef QEGL_EXTRA_DEBUG - fprintf(stderr, "QEglContext::swapBuffers\n"); -#endif - eglSwapBuffers(m_dpy, m_surface); -} - -void* QEglContext::getProcAddress(const QString& procName) -{ -#ifdef QEGL_EXTRA_DEBUG - fprintf(stderr, "QEglContext::getProcAddress\n"); -#endif - return (void*)eglGetProcAddress(qPrintable(procName)); -} - - -class QEglPaintDevice; -class QEglScreen : public QPlatformScreen -{ -public: - QEglScreen(); - ~QEglScreen() {} - - QRect geometry() const { return m_geometry; } - int depth() const { return m_depth; } - QImage::Format format() const { return m_format; } - //QSize physicalSize() const { return m_physicalSize; } //### - -public: - QRect m_geometry; - int m_depth; - QImage::Format m_format; - //QSize m_physicalSize; - QEglContext * m_platformContext; -}; - - -class QEglWindow : public QPlatformWindow -{ -public: - QEglWindow(QWidget *w, QEglScreen *screen); - QPlatformGLContext *glContext(); - - void setGeometry(const QRect &); - WId winId() const; - - QGLContext *context() { return m_context; } - QEglPaintDevice *paintDevice() { return m_pd; } -private: - QEglScreen *m_screen; - QEglPaintDevice *m_pd; - QGLContext *m_context; - WId m_winid; -}; - -class QEglPaintDevice : public QGLPaintDevice -{ -public: - QEglPaintDevice(QEglScreen *screen, QEglWindow *window); - - QSize size() const { return m_screen->geometry().size(); } - QGLContext* context() const { return m_window->context();} - - QPaintEngine *paintEngine() const { return qt_qgl_paint_engine(); } - - void beginPaint(){ - QGLPaintDevice::beginPaint(); - } -private: - QEglScreen *m_screen; - QEglWindow * m_window; -}; - - - - -QEglScreen::QEglScreen() - : m_depth(16), m_format(QImage::Format_RGB16), m_platformContext(0) -{ -#ifdef QEGL_EXTRA_DEBUG - fprintf(stderr, "QEglScreen %p\n", this); -#endif - QGLFormat format = QGLFormat::defaultFormat(); - m_platformContext = new QEglContext(format); - - - m_geometry = QRect(QPoint(), m_platformContext->size()); - -} - - - - -QEglPaintDevice::QEglPaintDevice(QEglScreen *screen, QEglWindow *window) - :QGLPaintDevice(), m_screen(screen), m_window(window) -{ -#ifdef QEGL_EXTRA_DEBUG - qDebug() << "QEglPaintDevice" << this << screen << window; -#endif -} - - - -QEglWindow::QEglWindow(QWidget *w, QEglScreen *screen) - : QPlatformWindow(w), m_screen(screen), m_pd(0), m_context(0) -{ - static int serialNo = 0; - m_winid = ++serialNo; -#ifdef QEGL_EXTRA_DEBUG - fprintf(stderr, "QEglWindow %p: %p %p 0x%x\n", this, w, screen, uint(m_winid)); -#endif - m_pd = new QEglPaintDevice(screen, this); - m_context = new QGLContext( screen->m_platformContext->format(), w); - m_context->create(); -} - - -void QEglWindow::setGeometry(const QRect &) -{ - // We only support full-screen windows - QRect rect(m_screen->availableGeometry()); - QWindowSystemInterface::handleGeometryChange(this->widget(), rect); - - QPlatformWindow::setGeometry(rect); -} - -WId QEglWindow::winId() const -{ - return m_winid; -} - - - -QPlatformGLContext *QEglWindow::glContext() -{ -#ifdef QEGL_EXTRA_DEBUG - fprintf(stderr, "QEglWindow::glContext %p\n", m_screen->m_platformContext); -#endif - Q_ASSERT(m_screen); - return m_screen->m_platformContext; -} - -QEglIntegration::QEglIntegration() -{ - m_primaryScreen = new QEglScreen(); + m_primaryScreen = new QEglFSScreen(EGL_DEFAULT_DISPLAY); mScreens.append(m_primaryScreen); #ifdef QEGL_EXTRA_DEBUG - fprintf(stderr, "QEglIntegration\n"); + qWarning("QEglIntegration\n"); #endif } -QPixmapData *QEglIntegration::createPixmapData(QPixmapData::PixelType type) const +QPixmapData *QEglFSIntegration::createPixmapData(QPixmapData::PixelType type) const { #ifdef QEGL_EXTRA_DEBUG - fprintf(stderr, "QEglIntegration::createPixmapData %d\n", type); + qWarning("QEglIntegration::createPixmapData %d\n", type); #endif return new QGLPixmapData(type); } -QPlatformWindow *QEglIntegration::createPlatformWindow(QWidget *widget, WId winId) const +QPlatformWindow *QEglFSIntegration::createPlatformWindow(QWidget *widget, WId winId) const { Q_UNUSED(winId); #ifdef QEGL_EXTRA_DEBUG - qDebug() << "QEglIntegration::createPlatformWindow" << widget; + qWarning("QEglIntegration::createPlatformWindow %p\n",widget); #endif - return new QEglWindow(widget, m_primaryScreen); + return new QEglFSWindow(widget, m_primaryScreen); } -class QEglWindowSurface : public QWindowSurface -{ -public: - QEglWindowSurface(QWidget *window, QEglScreen *screen); - ~QEglWindowSurface() {} - - QPaintDevice *paintDevice() { return m_window->paintDevice(); } - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void resize(const QSize &size) {} -private: - QEglScreen *m_screen; - QEglWindow *m_window; -}; - -QEglWindowSurface::QEglWindowSurface(QWidget *window, QEglScreen *screen) - :QWindowSurface(window), m_screen(screen), m_window(0) -{ -#ifdef QEGL_EXTRA_DEBUG - qDebug() << "QEglWindowSurface" << window << screen; -#endif - m_window = static_cast(window->platformWindow()); -} - - -void QEglWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) -{ - Q_UNUSED(widget); - Q_UNUSED(region); - Q_UNUSED(offset); -#ifdef QEGL_EXTRA_DEBUG - qDebug() << "QEglWindowSurface::flush"; -#endif - m_screen->m_platformContext->swapBuffers(); -} - -QWindowSurface *QEglIntegration::createWindowSurface(QWidget *widget, WId winId) const +QWindowSurface *QEglFSIntegration::createWindowSurface(QWidget *widget, WId winId) const { Q_UNUSED(winId); #ifdef QEGL_EXTRA_DEBUG - qDebug() << "QEglIntegration::createWindowSurface" << widget; + qWarning("QEglIntegration::createWindowSurface %p\n",widget); #endif - return new QEglWindowSurface(widget, m_primaryScreen); + return new QEglFSWindowSurface(m_primaryScreen,widget); } + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.h b/src/plugins/platforms/eglfs/qeglfsintegration.h index 7b9b8cf..f15b6b2 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.h +++ b/src/plugins/platforms/eglfs/qeglfsintegration.h @@ -42,16 +42,19 @@ #ifndef EGLINTEGRATION_H #define EGLINTEGRATION_H +#include "qeglfsscreen.h" + #include #include +QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE -class QEglScreen; -class QEglIntegration : public QPlatformIntegration +class QEglFSIntegration : public QPlatformIntegration { public: - QEglIntegration(); + QEglFSIntegration(); QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; @@ -61,10 +64,10 @@ public: private: QList mScreens; - QEglScreen *m_primaryScreen; + QEglFSScreen *m_primaryScreen; }; QT_END_NAMESPACE - +QT_END_HEADER #endif diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp new file mode 100644 index 0000000..a390106 --- /dev/null +++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp @@ -0,0 +1,174 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "qeglfsscreen.h" + +#include "../eglconvenience/qeglconvenience.h" +#include "../eglconvenience/qeglplatformcontext.h" + +#ifdef Q_OPENKODE +#include +#include +#endif //Q_OPENKODE + +QT_BEGIN_NAMESPACE + +#ifdef QEGL_EXTRA_DEBUG +struct AttrInfo { EGLint attr; const char *name; }; +static struct AttrInfo attrs[] = { + {EGL_BUFFER_SIZE, "EGL_BUFFER_SIZE"}, + {EGL_ALPHA_SIZE, "EGL_ALPHA_SIZE"}, + {EGL_BLUE_SIZE, "EGL_BLUE_SIZE"}, + {EGL_GREEN_SIZE, "EGL_GREEN_SIZE"}, + {EGL_RED_SIZE, "EGL_RED_SIZE"}, + {EGL_DEPTH_SIZE, "EGL_DEPTH_SIZE"}, + {EGL_STENCIL_SIZE, "EGL_STENCIL_SIZE"}, + {EGL_CONFIG_CAVEAT, "EGL_CONFIG_CAVEAT"}, + {EGL_CONFIG_ID, "EGL_CONFIG_ID"}, + {EGL_LEVEL, "EGL_LEVEL"}, + {EGL_MAX_PBUFFER_HEIGHT, "EGL_MAX_PBUFFER_HEIGHT"}, + {EGL_MAX_PBUFFER_PIXELS, "EGL_MAX_PBUFFER_PIXELS"}, + {EGL_MAX_PBUFFER_WIDTH, "EGL_MAX_PBUFFER_WIDTH"}, + {EGL_NATIVE_RENDERABLE, "EGL_NATIVE_RENDERABLE"}, + {EGL_NATIVE_VISUAL_ID, "EGL_NATIVE_VISUAL_ID"}, + {EGL_NATIVE_VISUAL_TYPE, "EGL_NATIVE_VISUAL_TYPE"}, + {EGL_SAMPLES, "EGL_SAMPLES"}, + {EGL_SAMPLE_BUFFERS, "EGL_SAMPLE_BUFFERS"}, + {EGL_SURFACE_TYPE, "EGL_SURFACE_TYPE"}, + {EGL_TRANSPARENT_TYPE, "EGL_TRANSPARENT_TYPE"}, + {EGL_TRANSPARENT_BLUE_VALUE, "EGL_TRANSPARENT_BLUE_VALUE"}, + {EGL_TRANSPARENT_GREEN_VALUE, "EGL_TRANSPARENT_GREEN_VALUE"}, + {EGL_TRANSPARENT_RED_VALUE, "EGL_TRANSPARENT_RED_VALUE"}, + {EGL_BIND_TO_TEXTURE_RGB, "EGL_BIND_TO_TEXTURE_RGB"}, + {EGL_BIND_TO_TEXTURE_RGBA, "EGL_BIND_TO_TEXTURE_RGBA"}, + {EGL_MIN_SWAP_INTERVAL, "EGL_MIN_SWAP_INTERVAL"}, + {EGL_MAX_SWAP_INTERVAL, "EGL_MAX_SWAP_INTERVAL"}, + {-1, 0}}; +#endif //QEGL_EXTRA_DEBUG + +QEglFSScreen::QEglFSScreen(EGLNativeDisplayType display) + : m_depth(16), m_format(QImage::Format_RGB16), m_platformContext(0) +{ +#ifdef QEGL_EXTRA_DEBUG + qWarning("QEglScreen %p\n", this); +#endif + + EGLint major, minor; +#ifdef QEGL_EXTRA_DEBUG + EGLint index; +#endif + if (!eglBindAPI(EGL_OPENGL_ES_API)) { + qWarning("Could not bind GL_ES API\n"); + qFatal("EGL error"); + } + + m_dpy = eglGetDisplay(display); + if (m_dpy == EGL_NO_DISPLAY) { + qWarning("Could not open egl display\n"); + qFatal("EGL error"); + } + qWarning("Opened display %p\n", m_dpy); + + if (!eglInitialize(m_dpy, &major, &minor)) { + qWarning("Could not initialize egl display\n"); + qFatal("EGL error"); + } + + qWarning("Initialized display %d %d\n", major, minor); + + QPlatformWindowFormat platformFormat; + platformFormat.setDepth(16); + platformFormat.setWindowApi(QPlatformWindowFormat::OpenGL); + platformFormat.setRedBufferSize(8); + platformFormat.setGreenBufferSize(8); + platformFormat.setBlueBufferSize(8); + EGLConfig config = q_configFromQPlatformWindowFormat(m_dpy, platformFormat); + + EGLNativeWindowType eglWindow = 0; +#ifdef Q_OPENKODE + if (kdInitializeNV() == KD_ENOTINITIALIZED) { + qFatal("Did not manage to initialize openkode"); + } + KDWindow *window = kdCreateWindow(m_dpy,config,0); + + kdRealizeWindow(window,&eglWindow); +#endif + + m_surface = eglCreateWindowSurface(m_dpy, config, eglWindow, NULL); + if (m_surface == EGL_NO_SURFACE) { + qWarning("Could not create the egl surface: error = 0x%x\n", eglGetError()); + eglTerminate(m_dpy); + qFatal("EGL error"); + } + // qWarning("Created surface %dx%d\n", w, h); + +#ifdef QEGL_EXTRA_DEBUG + qWarning("Configuration %d matches requirements\n", (int)config); + + for (index = 0; attrs[index].attr != -1; ++index) { + EGLint value; + if (eglGetConfigAttrib(m_dpy, config, attrs[index].attr, &value)) { + qWarning("\t%s: %d\n", attrs[index].name, (int)value); + } + } + qWarning("\n"); +#endif + + EGLint temp; + EGLint attribList[32]; + + temp = 0; + + attribList[temp++] = EGL_CONTEXT_CLIENT_VERSION; + attribList[temp++] = 2; // GLES version 2 + attribList[temp++] = EGL_NONE; + + m_platformContext = new QEGLPlatformContext(m_dpy,config,attribList,m_surface,EGL_OPENGL_ES_API); + +// qWarning("Created platformcontext"); + EGLint w,h; + + eglQuerySurface(m_dpy, m_surface, EGL_WIDTH, &w); + eglQuerySurface(m_dpy, m_surface, EGL_HEIGHT, &h); + + m_geometry = QRect(0,0,w,h); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.h b/src/plugins/platforms/eglfs/qeglfsscreen.h new file mode 100644 index 0000000..f68ab14 --- /dev/null +++ b/src/plugins/platforms/eglfs/qeglfsscreen.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QEGLSCREEN_H +#define QEGLSCREEN_H + +#include + + +#include + +QT_BEGIN_NAMESPACE + +class QPlatformGLContext; + +class QEglFSScreen : public QPlatformScreen //huh: FullScreenScreen ;) just to follow namespace +{ +public: + QEglFSScreen(EGLNativeDisplayType display); + ~QEglFSScreen() {} + + QRect geometry() const { return m_geometry; } + int depth() const { return m_depth; } + QImage::Format format() const { return m_format; } + + QPlatformGLContext *platformContext() const { return m_platformContext; } + +private: + QRect m_geometry; + int m_depth; + QImage::Format m_format; + QPlatformGLContext *m_platformContext; + EGLDisplay m_dpy; + EGLSurface m_surface; +}; + +QT_END_NAMESPACE +#endif // QEGLSCREEN_H diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp new file mode 100644 index 0000000..db15862 --- /dev/null +++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "qeglfswindow.h" + +#include + +QT_BEGIN_NAMESPACE + +QEglFSWindow::QEglFSWindow(QWidget *w, QEglFSScreen *screen) + : QPlatformWindow(w), m_screen(screen) +{ + static int serialNo = 0; + m_winid = ++serialNo; +#ifdef QEGL_EXTRA_DEBUG + qWarning("QEglWindow %p: %p %p 0x%x\n", this, w, screen, uint(m_winid)); +#endif +} + + +void QEglFSWindow::setGeometry(const QRect &) +{ + // We only support full-screen windows + QRect rect(m_screen->availableGeometry()); + QWindowSystemInterface::handleGeometryChange(this->widget(), rect); + + QPlatformWindow::setGeometry(rect); +} + +WId QEglFSWindow::winId() const +{ + return m_winid; +} + + + +QPlatformGLContext *QEglFSWindow::glContext() +{ +#ifdef QEGL_EXTRA_DEBUG + qWarning("QEglWindow::glContext %p\n", m_screen->platformContext()); +#endif + Q_ASSERT(m_screen); + return m_screen->platformContext(); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfswindow.h b/src/plugins/platforms/eglfs/qeglfswindow.h new file mode 100644 index 0000000..f605cf4 --- /dev/null +++ b/src/plugins/platforms/eglfs/qeglfswindow.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QEGLWINDOW_H +#define QEGLWINDOW_H + +#include "qeglfsintegration.h" +#include "qeglfsscreen.h" + + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QEglFSWindow : public QPlatformWindow +{ +public: + QEglFSWindow(QWidget *w, QEglFSScreen *screen); + QPlatformGLContext *glContext(); + + void setGeometry(const QRect &); + WId winId() const; + +private: + QEglFSScreen *m_screen; + WId m_winid; +}; +QT_END_NAMESPACE +#endif // QEGLWINDOW_H diff --git a/src/plugins/platforms/eglfs/qeglfswindowsurface.cpp b/src/plugins/platforms/eglfs/qeglfswindowsurface.cpp new file mode 100644 index 0000000..a613dda --- /dev/null +++ b/src/plugins/platforms/eglfs/qeglfswindowsurface.cpp @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "qeglfswindowsurface.h" + +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +class QEglFSPaintDevice : public QGLPaintDevice +{ +public: + QEglFSPaintDevice(QEglFSScreen *screen, QWidget *widget) + :QGLPaintDevice(), m_screen(screen) + { + #ifdef QEGL_EXTRA_DEBUG + qWarning("QEglPaintDevice %p, %p, %p",this, screen, widget); + #endif + QGLFormat format; + m_context = new QGLContext(format, widget); + m_context->create(); + } + + QSize size() const { return m_screen->geometry().size(); } + QGLContext* context() const { return m_context;} + + QPaintEngine *paintEngine() const { return qt_qgl_paint_engine(); } + + void beginPaint(){ + QGLPaintDevice::beginPaint(); + } +private: + QEglFSScreen *m_screen; + QGLContext *m_context; +}; + + +QEglFSWindowSurface::QEglFSWindowSurface( QEglFSScreen *screen, QWidget *window ) + :QWindowSurface(window) +{ +#ifdef QEGL_EXTRA_DEBUG + qWarning("QEglWindowSurface %p, %p", window, screen); +#endif + m_paintDevice = new QEglFSPaintDevice(screen,window); +} + +void QEglFSWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + Q_UNUSED(region); + Q_UNUSED(offset); +#ifdef QEGL_EXTRA_DEBUG + qWarning("QEglWindowSurface::flush %p",widget); +#endif + widget->platformWindow()->glContext()->swapBuffers(); +} + +void QEglFSWindowSurface::resize(const QSize &size) +{ + Q_UNUSED(size); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfswindowsurface.h b/src/plugins/platforms/eglfs/qeglfswindowsurface.h new file mode 100644 index 0000000..571b9bd --- /dev/null +++ b/src/plugins/platforms/eglfs/qeglfswindowsurface.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QEGLWINDOWSURFACE_H +#define QEGLWINDOWSURFACE_H + +#include "qeglfsintegration.h" +#include "qeglfswindow.h" + +#include + +QT_BEGIN_NAMESPACE + +class QEglFSWindowSurface : public QWindowSurface +{ +public: + QEglFSWindowSurface(QEglFSScreen *screen, QWidget *window); + ~QEglFSWindowSurface() {} + + QPaintDevice *paintDevice() { return m_paintDevice; } + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void resize(const QSize &size); +private: + QPaintDevice *m_paintDevice; +}; + +QT_END_NAMESPACE + +#endif // QEGLWINDOWSURFACE_H -- cgit v0.12 From c984a856ccf72731da052ff8bdae88fe3921fc83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 27 Jul 2010 08:30:58 +0200 Subject: Add QT_BEGIN_NAMESPACE and QT_BEGIN_HEADER to openkode plugin --- src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp | 4 +++- src/plugins/platforms/openkode/qopenkodeeventloopintegration.h | 7 +++++++ src/plugins/platforms/openkode/qopenkodeintegration.h | 2 ++ src/plugins/platforms/openkode/qopenkodewindow.cpp | 3 ++- src/plugins/platforms/openkode/qopenkodewindow.h | 6 ++++++ src/plugins/platforms/openkode/qopenkodewindowsurface.h | 2 ++ 6 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp index 467b5b5..e21e1d7 100644 --- a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp +++ b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp @@ -2,7 +2,7 @@ #include -#include +QT_BEGIN_NAMESPACE QOpenKODEEventLoopIntegration::QOpenKODEEventLoopIntegration() { @@ -27,3 +27,5 @@ void QOpenKODEEventLoopIntegration::wakeup() KDEvent *event = kdCreateEvent(); kdPostThreadEvent(event,m_kdThread); } + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h index ef04640..868eda8 100644 --- a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h +++ b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h @@ -4,6 +4,10 @@ #include class KDThread; + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + class QOpenKODEEventLoopIntegration : public QPlatformEventLoopIntegration { public: @@ -14,4 +18,7 @@ private: KDThread *m_kdThread; }; +QT_END_NAMESPACE +QT_END_HEADER + #endif // QOPENKODEEVENTLOOPINTEGRATION_H diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.h b/src/plugins/platforms/openkode/qopenkodeintegration.h index 0eaf127..8d3d175 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.h +++ b/src/plugins/platforms/openkode/qopenkodeintegration.h @@ -51,6 +51,7 @@ #include #include +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE struct KDDesktopNV; @@ -98,5 +99,6 @@ private: }; QT_END_NAMESPACE +QT_END_HEADER #endif diff --git a/src/plugins/platforms/openkode/qopenkodewindow.cpp b/src/plugins/platforms/openkode/qopenkodewindow.cpp index faba2fb..2ad9238 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.cpp +++ b/src/plugins/platforms/openkode/qopenkodewindow.cpp @@ -55,7 +55,7 @@ #include #include - +QT_BEGIN_NAMESPACE QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) : QPlatformWindow(tlw) @@ -173,3 +173,4 @@ QPlatformGLContext *QOpenKODEWindow::glContext() { return m_platformGlContext; } +QT_END_NAMESPACE diff --git a/src/plugins/platforms/openkode/qopenkodewindow.h b/src/plugins/platforms/openkode/qopenkodewindow.h index 51252a9..d11c0d8 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.h +++ b/src/plugins/platforms/openkode/qopenkodewindow.h @@ -47,6 +47,9 @@ #include +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + class QEGLPlatformContext; class QOpenKODEWindow : public QPlatformWindow @@ -71,4 +74,7 @@ private: QEGLPlatformContext *m_platformGlContext; }; +QT_END_NAMESPACE +QT_END_HEADER + #endif //QOPENKODEWINDOW_H diff --git a/src/plugins/platforms/openkode/qopenkodewindowsurface.h b/src/plugins/platforms/openkode/qopenkodewindowsurface.h index 4acd1d8..f12b625 100644 --- a/src/plugins/platforms/openkode/qopenkodewindowsurface.h +++ b/src/plugins/platforms/openkode/qopenkodewindowsurface.h @@ -46,6 +46,7 @@ #include +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE class QOpenKODEWindow; @@ -71,5 +72,6 @@ private: }; QT_END_NAMESPACE +QT_END_HEADER #endif -- cgit v0.12 From e7c239407698f2a5d4f4b4000ecdd5969025fe1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 27 Jul 2010 08:32:57 +0200 Subject: Made QPlatformWidnow::glContext a const function --- src/gui/kernel/qplatformwindow_qpa.cpp | 2 +- src/gui/kernel/qplatformwindow_qpa.h | 2 +- src/plugins/platforms/eglfs/qeglfswindow.cpp | 2 +- src/plugins/platforms/eglfs/qeglfswindow.h | 3 ++- src/plugins/platforms/openkode/qopenkodewindow.cpp | 2 +- src/plugins/platforms/openkode/qopenkodewindow.h | 2 +- src/plugins/platforms/testlite/qglxintegration.cpp | 2 +- src/plugins/platforms/testlite/qtestlitewindow.cpp | 11 +++-------- src/plugins/platforms/testlite/qtestlitewindow.h | 3 +-- 9 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/gui/kernel/qplatformwindow_qpa.cpp b/src/gui/kernel/qplatformwindow_qpa.cpp index 4cd8ead..4ac4736 100644 --- a/src/gui/kernel/qplatformwindow_qpa.cpp +++ b/src/gui/kernel/qplatformwindow_qpa.cpp @@ -120,7 +120,7 @@ void QPlatformWindow::setOpacity(qreal level) qWarning("This plugin does not support setting window opacity"); } -QPlatformGLContext *QPlatformWindow::glContext() +QPlatformGLContext *QPlatformWindow::glContext() const { return 0; } diff --git a/src/gui/kernel/qplatformwindow_qpa.h b/src/gui/kernel/qplatformwindow_qpa.h index e8b5ad8..2275c02 100644 --- a/src/gui/kernel/qplatformwindow_qpa.h +++ b/src/gui/kernel/qplatformwindow_qpa.h @@ -79,7 +79,7 @@ public: virtual void setOpacity(qreal level); - virtual QPlatformGLContext *glContext(); + virtual QPlatformGLContext *glContext() const; protected: QScopedPointer d_ptr; private: diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp index db15862..86cc98b 100644 --- a/src/plugins/platforms/eglfs/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp @@ -71,7 +71,7 @@ WId QEglFSWindow::winId() const -QPlatformGLContext *QEglFSWindow::glContext() +QPlatformGLContext *QEglFSWindow::glContext() const { #ifdef QEGL_EXTRA_DEBUG qWarning("QEglWindow::glContext %p\n", m_screen->platformContext()); diff --git a/src/plugins/platforms/eglfs/qeglfswindow.h b/src/plugins/platforms/eglfs/qeglfswindow.h index f605cf4..0c3bc84 100644 --- a/src/plugins/platforms/eglfs/qeglfswindow.h +++ b/src/plugins/platforms/eglfs/qeglfswindow.h @@ -56,11 +56,12 @@ class QEglFSWindow : public QPlatformWindow { public: QEglFSWindow(QWidget *w, QEglFSScreen *screen); - QPlatformGLContext *glContext(); void setGeometry(const QRect &); WId winId() const; + QPlatformGLContext *glContext() const; + private: QEglFSScreen *m_screen; WId m_winid; diff --git a/src/plugins/platforms/openkode/qopenkodewindow.cpp b/src/plugins/platforms/openkode/qopenkodewindow.cpp index 2ad9238..81f38d2 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.cpp +++ b/src/plugins/platforms/openkode/qopenkodewindow.cpp @@ -169,7 +169,7 @@ void QOpenKODEWindow::setVisible(bool visible) } } -QPlatformGLContext *QOpenKODEWindow::glContext() +QPlatformGLContext *QOpenKODEWindow::glContext() const { return m_platformGlContext; } diff --git a/src/plugins/platforms/openkode/qopenkodewindow.h b/src/plugins/platforms/openkode/qopenkodewindow.h index d11c0d8..3e7ee56 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.h +++ b/src/plugins/platforms/openkode/qopenkodewindow.h @@ -62,7 +62,7 @@ public: void setVisible(bool visible); WId winId() const { return WId(m_eglWindow); } - QPlatformGLContext *glContext(); + QPlatformGLContext *glContext() const; private: struct KDWindow *m_kdWindow; diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp index 4d807b0..e554e8d 100644 --- a/src/plugins/platforms/testlite/qglxintegration.cpp +++ b/src/plugins/platforms/testlite/qglxintegration.cpp @@ -181,7 +181,7 @@ QGLXGLContext::QGLXGLContext(MyDisplay *display, Drawable drawable, GLXContext c QGLXGLContext::~QGLXGLContext() { if (m_context) { - qDebug("Destroying GLX context 0x%x", m_context); + qDebug("Destroying GLX context 0x%p", m_context); glXDestroyContext(m_xd->display, m_context); } } diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index f774458..67ec97c 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -1011,20 +1011,15 @@ void QTestLiteWindow::setCursor(QCursor * cursor) XFlush(xd->display); } -QPlatformGLContext *QTestLiteWindow::glContext() +QPlatformGLContext *QTestLiteWindow::glContext() const { if (!mGLContext) { - mGLContext = createGLContext(); + QTestLiteWindow *that = const_cast(this); + that->mGLContext = new QGLXGLContext(x_window, xd, widget()->platformWindowFormat()); } return mGLContext; } -QPlatformGLContext *QTestLiteWindow::createGLContext() -{ - QPlatformGLContext *context = new QGLXGLContext(x_window, xd, widget()->platformWindowFormat()); - return context; -} - Cursor QTestLiteWindow::createCursorBitmap(QCursor * cursor) { XColor bg, fg; diff --git a/src/plugins/platforms/testlite/qtestlitewindow.h b/src/plugins/platforms/testlite/qtestlitewindow.h index d405578..dc628f1 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.h +++ b/src/plugins/platforms/testlite/qtestlitewindow.h @@ -127,7 +127,7 @@ public: void setCursor(QCursor * cursor); - QPlatformGLContext *glContext(); + QPlatformGLContext *glContext() const; private: int xpos, ypos; @@ -138,7 +138,6 @@ private: GC createGC(); Cursor createCursorShape(int cshape); Cursor createCursorBitmap(QCursor * cursor); - QPlatformGLContext *createGLContext(); int currentCursor; -- cgit v0.12 From 24322b3d6b1e7b33f936081a2dcaa3d62c9b501f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 28 Jul 2010 12:17:53 +0200 Subject: Fix so that eventloop intgration can have 0 timeouts --- src/gui/kernel/qeventdispatcher_qpa.cpp | 4 +++- src/gui/kernel/qwindowsysteminterface_qpa.h | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qeventdispatcher_qpa.cpp b/src/gui/kernel/qeventdispatcher_qpa.cpp index 4464036..cb70141 100644 --- a/src/gui/kernel/qeventdispatcher_qpa.cpp +++ b/src/gui/kernel/qeventdispatcher_qpa.cpp @@ -255,7 +255,9 @@ int QEventDispatcherQPA::select(int nfds, fd_set *readfds, fd_set *writefds, fd_ Q_D(QEventDispatcherQPA); int retVal = 0; if (d->hasIntegration()) { - qint64 timeoutmsec = timeout->tv_sec * 1000 + (timeout->tv_usec/1000); + qint64 timeoutmsec = 0; + if (timeout) + timeoutmsec = timeout->tv_sec * 1000 + (timeout->tv_usec/1000); d->selectReturnMutex->lock(); if (d->selectWorkerNeedsSync) { if (d->selectWorkerHasResult) { diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h index e57fa8e..5ff4275 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa.h @@ -79,7 +79,6 @@ public: static void handleTouchEvent(QWidget *w, QEvent::Type type, QTouchEvent::DeviceType devType, const QList &points); static void handleTouchEvent(QWidget *w, ulong timestamp, QEvent::Type type, QTouchEvent::DeviceType devType, const QList &points); - // delivered directly by the plugin via spontaneous events static void handleGeometryChange(QWidget *w, const QRect &newRect); static void handleCloseEvent(QWidget *w); static void handleEnterEvent(QWidget *w); -- cgit v0.12 From da0d594f7d1b01145c5ec47f36d039435e04e7a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 2 Aug 2010 12:05:20 +0200 Subject: Make eglfs use defaultsharedcontext --- src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp | 5 +++++ src/plugins/platforms/eglconvenience/qeglplatformcontext.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp index a72f7b2..b3a5bba 100644 --- a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp +++ b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp @@ -137,3 +137,8 @@ void* QEGLPlatformContext::getProcAddress(const QString& procName) eglBindAPI(m_eglApi); return (void *)eglGetProcAddress(qPrintable(procName)); } + +void QEGLPlatformContext::makeDefaultSaredContext() +{ + setDefaultSharedContext(this); +} diff --git a/src/plugins/platforms/eglconvenience/qeglplatformcontext.h b/src/plugins/platforms/eglconvenience/qeglplatformcontext.h index 19d155a..2a49129 100644 --- a/src/plugins/platforms/eglconvenience/qeglplatformcontext.h +++ b/src/plugins/platforms/eglconvenience/qeglplatformcontext.h @@ -56,6 +56,7 @@ public: void swapBuffers(); void* getProcAddress(const QString& procName); + void makeDefaultSaredContext(); private: EGLContext m_eglContext; EGLDisplay m_eglDisplay; -- cgit v0.12 From 6e0edcce4c215f01416a5ee8467b7abe4665e592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 2 Aug 2010 12:07:12 +0200 Subject: Make openkode plugin handle events And make it also work without a gui manager --- src/gui/kernel/qapplication_qpa.cpp | 3 + src/gui/kernel/qplatformwindow_qpa.cpp | 9 +- src/gui/kernel/qwidget_qpa.cpp | 3 + src/plugins/platforms/openkode/openkode.pro | 5 +- .../platforms/openkode/openkodekeytranslator.h | 244 +++++++++++++++++++++ .../openkode/qopenkodeeventloopintegration.cpp | 47 ++++ .../openkode/qopenkodeeventloopintegration.h | 4 + .../platforms/openkode/qopenkodeintegration.cpp | 23 +- .../platforms/openkode/qopenkodeintegration.h | 13 +- src/plugins/platforms/openkode/qopenkodewindow.cpp | 191 +++++++++++++--- src/plugins/platforms/openkode/qopenkodewindow.h | 9 +- .../platforms/openkode/qopenkodewindowsurface.cpp | 176 --------------- .../platforms/openkode/qopenkodewindowsurface.h | 77 ------- 13 files changed, 508 insertions(+), 296 deletions(-) create mode 100644 src/plugins/platforms/openkode/openkodekeytranslator.h delete mode 100644 src/plugins/platforms/openkode/qopenkodewindowsurface.cpp delete mode 100644 src/plugins/platforms/openkode/qopenkodewindowsurface.h diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp index e5b5396..b89e81d 100644 --- a/src/gui/kernel/qapplication_qpa.cpp +++ b/src/gui/kernel/qapplication_qpa.cpp @@ -802,6 +802,9 @@ void QApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEven if (app_do_modal && !qt_try_modal(focusW, e->keyType)) return; + if (!focusW->isWindow()) + focusW = focusW->window(); + modifiers = e->modifiers; QKeyEvent ev(e->keyType, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount); QApplication::sendSpontaneousEvent(focusW, &ev); diff --git a/src/gui/kernel/qplatformwindow_qpa.cpp b/src/gui/kernel/qplatformwindow_qpa.cpp index 4ac4736..9d722d8 100644 --- a/src/gui/kernel/qplatformwindow_qpa.cpp +++ b/src/gui/kernel/qplatformwindow_qpa.cpp @@ -47,6 +47,7 @@ class QPlatformWindowPrivate { QWidget *tlw; QRect rect; + Qt::WindowFlags flags; friend class QPlatformWindow; }; @@ -92,8 +93,9 @@ Requests setting the window flags of this surface to \a type. Returns the actual */ Qt::WindowFlags QPlatformWindow::setWindowFlags(Qt::WindowFlags flags) { - Q_UNUSED(flags); - return Qt::Window; + Q_D(QPlatformWindow); + d->flags = flags; + return flags; } /*! @@ -101,7 +103,8 @@ Qt::WindowFlags QPlatformWindow::setWindowFlags(Qt::WindowFlags flags) */ Qt::WindowFlags QPlatformWindow::windowFlags() const { - return Qt::Window; + Q_D(const QPlatformWindow); + return d->flags; } WId QPlatformWindow::winId() const { return WId(0); } diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp index 3584f87..ef53004 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -63,6 +63,7 @@ void setParentForChildrenOfWidget(QPlatformWindow *window, const QWidget *widget if (childWidget) { // should not be necessary if (childWidget->platformWindow()) { childWidget->platformWindow()->setParent(window); + childWidget->platformWindow()->setWindowFlags(Qt::SubWindow); } else { setParentForChildrenOfWidget(window,childWidget); } @@ -106,6 +107,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO if (QWidget *nativeParent = q->nativeParentWidget()) { if (nativeParent->platformWindow()) { platformWindow->setParent(nativeParent->platformWindow()); + platformWindow->setWindowFlags(Qt::SubWindow); } } @@ -174,6 +176,7 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) QWidget * parentWithWindow = newparent->platformWindow()? newparent : newparent->nativeParentWidget(); if (parentWithWindow && parentWithWindow->platformWindow()) { q->platformWindow()->setParent(parentWithWindow->platformWindow()); + q->platformWindow()->setWindowFlags(Qt::SubWindow); } } diff --git a/src/plugins/platforms/openkode/openkode.pro b/src/plugins/platforms/openkode/openkode.pro index 2d90b15..5f2c1cc 100644 --- a/src/plugins/platforms/openkode/openkode.pro +++ b/src/plugins/platforms/openkode/openkode.pro @@ -7,18 +7,17 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms SOURCES = main.cpp \ qopenkodeintegration.cpp \ - qopenkodewindowsurface.cpp \ qopenkodewindow.cpp \ ../eglconvenience/qeglplatformcontext.cpp \ ../eglconvenience/qeglconvenience.cpp \ qopenkodeeventloopintegration.cpp HEADERS = qopenkodeintegration.h \ - qopenkodewindowsurface.h \ qopenkodewindow.h \ ../eglconvenience/qeglplatformcontext.h \ ../eglconvenience/qeglconvenience.h \ - qopenkodeeventloopintegration.h + qopenkodeeventloopintegration.h \ + openkodekeytranslator.h RESOURCES = resources.qrc diff --git a/src/plugins/platforms/openkode/openkodekeytranslator.h b/src/plugins/platforms/openkode/openkodekeytranslator.h new file mode 100644 index 0000000..e0ba5c1 --- /dev/null +++ b/src/plugins/platforms/openkode/openkodekeytranslator.h @@ -0,0 +1,244 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG 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 http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef OPENKODEKEYTRANSLATOR_H +#define OPENKODEKEYTRANSLATOR_H + +#ifdef KD_ATX_keyboard + +#include + +QT_BEGIN_NAMESPACE + +Qt::Key keyTranslator( int key ) +{ + switch (key) { +// KD_KEY_ACCEPT_ATX: +// KD_KEY_AGAIN_ATX: +// KD_KEY_ALLCANDIDATES_ATX +// KD_KEY_ALPHANUMERIC_ATX + case KD_KEY_ALT_ATX: + return Qt::Key_Alt; + case KD_KEY_ALTGRAPH_ATX: + return Qt::Key_AltGr; +// KD_KEY_APPS_ATX +// KD_KEY_ATTN_ATX +// KD_KEY_BROWSERBACK_ATX +// KD_KEY_BROWSERFAVORITES_ATX +// KD_KEY_BROWSERFORWARD_ATX +// KD_KEY_BROWSERHOME_ATX +// KD_KEY_BROWSERREFRESH_ATX +// KD_KEY_BROWSERSEARCH_ATX +// KD_KEY_BROWSERSTOP_ATX + case KD_KEY_CAPSLOCK_ATX: + return Qt::Key_CapsLock; + case KD_KEY_CLEAR_ATX: + return Qt::Key_Clear; + case KD_KEY_CODEINPUT_ATX: + return Qt::Key_Codeinput; +// KD_KEY_COMPOSE_ATX + case KD_KEY_CONTROL_ATX: + return Qt::Key_Control; +// KD_KEY_CRSEL_ATX +// KD_KEY_CONVERT_ATX + case KD_KEY_COPY_ATX: + return Qt::Key_Copy; + case KD_KEY_CUT_ATX: + return Qt::Key_Cut; + case KD_KEY_DOWN_ATX: + return Qt::Key_Down; + case KD_KEY_END_ATX: + return Qt::Key_End; + case KD_KEY_ENTER_ATX: + return Qt::Key_Enter; +// KD_KEY_ERASEEOF_ATX +// KD_KEY_EXECUTE_ATX +// KD_KEY_EXSEL_ATX + case KD_KEY_F1_ATX: + return Qt::Key_F1; + case KD_KEY_F2_ATX: + return Qt::Key_F2; + case KD_KEY_F3_ATX: + return Qt::Key_F3; + case KD_KEY_F4_ATX: + return Qt::Key_F4; + case KD_KEY_F5_ATX: + return Qt::Key_F5; + case KD_KEY_F6_ATX: + return Qt::Key_F6; + case KD_KEY_F7_ATX: + return Qt::Key_F7; + case KD_KEY_F8_ATX: + return Qt::Key_F8; + case KD_KEY_F9_ATX: + return Qt::Key_F9; + case KD_KEY_F10_ATX: + return Qt::Key_F10; + case KD_KEY_F11_ATX: + return Qt::Key_F11; + case KD_KEY_F12_ATX: + return Qt::Key_F12; + case KD_KEY_F13_ATX: + return Qt::Key_F13; + case KD_KEY_F14_ATX: + return Qt::Key_F14; + case KD_KEY_F15_ATX: + return Qt::Key_F15; + case KD_KEY_F16_ATX: + return Qt::Key_F16; + case KD_KEY_F17_ATX: + return Qt::Key_F17; + case KD_KEY_F18_ATX: + return Qt::Key_F18; + case KD_KEY_F19_ATX: + return Qt::Key_F19; + case KD_KEY_F20_ATX: + return Qt::Key_F20; + case KD_KEY_F21_ATX: + return Qt::Key_F21; + case KD_KEY_F22_ATX: + return Qt::Key_F22; + case KD_KEY_F23_ATX: + return Qt::Key_F23; + case KD_KEY_F24_ATX: + return Qt::Key_F24; +// KD_KEY_FINALMODE_ATX +// KD_KEY_FIND_ATX +// KD_KEY_FULLWIDTH_ATX +// KD_KEY_HALFWIDTH_ATX + case KD_KEY_HANGULMODE_ATX: + return Qt::Key_Hangul; +// KD_KEY_HANJAMODE_ATX + case KD_KEY_HELP_ATX: + return Qt::Key_Help; + case KD_KEY_HIRAGANA_ATX: + return Qt::Key_Hiragana; + case KD_KEY_HOME_ATX: + return Qt::Key_Home; + case KD_KEY_INSERT_ATX: + return Qt::Key_Insert; +// KD_KEY_JAPANESEHIRAGANA_ATX: +// KD_KEY_JAPANESEKATAKANA_ATX +// KD_KEY_JAPANESEROMAJI_ATX +// KD_KEY_JUNJAMODE_ATX + case KD_KEY_KANAMODE_ATX: + return Qt::Key_Kana_Lock; //? + case KD_KEY_KANJIMODE_ATX: + return Qt::Key_Kanji; +// KD_KEY_KATAKANA_ATX +// KD_KEY_LAUNCHAPPLICATION1_ATX +// KD_KEY_LAUNCHAPPLICATION2_ATX + case KD_KEY_LAUNCHMAIL_ATX: + return Qt::Key_MailForward; + case KD_KEY_LEFT_ATX: + return Qt::Key_Left; + case KD_KEY_META_ATX: + return Qt::Key_Meta; + case KD_KEY_MEDIANEXTTRACK_ATX: + return Qt::Key_MediaNext; + case KD_KEY_MEDIAPLAYPAUSE_ATX: + return Qt::Key_MediaPause; + case KD_KEY_MEDIAPREVIOUSTRACK_ATX: + return Qt::Key_MediaPrevious; + case KD_KEY_MEDIASTOP_ATX: + return Qt::Key_MediaStop; + case KD_KEY_MODECHANGE_ATX: + return Qt::Key_Mode_switch; +// KD_KEY_NONCONVERT_ATX + case KD_KEY_NUMLOCK_ATX: + return Qt::Key_NumLock; + case KD_KEY_PAGEDOWN_ATX: + return Qt::Key_PageDown; + case KD_KEY_PAGEUP_ATX: + return Qt::Key_PageUp; + case KD_KEY_PASTE_ATX: + return Qt::Key_Paste; + case KD_KEY_PAUSE_ATX: + return Qt::Key_Pause; + case KD_KEY_PLAY_ATX: + return Qt::Key_Play; +// KD_KEY_PREVIOUSCANDIDATE_ATX + case KD_KEY_PRINTSCREEN_ATX: + return Qt::Key_Print; +// case KD_KEY_PROCESS_ATX +// case KD_KEY_PROPS_ATX + case KD_KEY_RIGHT_ATX: + return Qt::Key_Right; +// KD_KEY_ROMANCHARACTERS_ATX + case KD_KEY_SCROLL_ATX: + return Qt::Key_ScrollLock; + case KD_KEY_SELECT_ATX: + return Qt::Key_Select; +// KD_KEY_SELECTMEDIA_ATX + case KD_KEY_SHIFT_ATX: + return Qt::Key_Shift; + case KD_KEY_STOP_ATX: + return Qt::Key_Stop; + case KD_KEY_UP_ATX: + return Qt::Key_Up; +// KD_KEY_UNDO_ATX + case KD_KEY_VOLUMEDOWN_ATX: + return Qt::Key_VolumeDown; + case KD_KEY_VOLUMEMUTE_ATX: + return Qt::Key_VolumeMute; + case KD_KEY_VOLUMEUP_ATX: + return Qt::Key_VolumeUp; + case KD_KEY_WIN_ATX: + return Qt::Key_Meta; + case KD_KEY_ZOOM_ATX: + return Qt::Key_Zoom; + case 0x8: + return Qt::Key_Backspace; + case 0x1b: + return Qt::Key_Escape; + case 0x9: + return Qt::Key_Tab; + + default: + break; + } + + return Qt::Key_Escape; +} + +QT_END_NAMESPACE +#endif //KD_ATX_keyboard +#endif // OPENKODEKEYTRANSLATOR_H diff --git a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp index e21e1d7..bc92d0e 100644 --- a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp +++ b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.cpp @@ -1,12 +1,57 @@ #include "qopenkodeeventloopintegration.h" +#include + #include +#include QT_BEGIN_NAMESPACE +static const int QT_EVENT_WAKEUP_EVENTLOOP = KD_EVENT_USER + 1; + +void kdprocessevent( const KDEvent *event) +{ + switch (event->type) { + case KD_EVENT_INPUT: + qDebug() << "KD_EVENT_INPUT"; + break; + case KD_EVENT_INPUT_POINTER: + qDebug() << "KD_EVENT_INPUT_POINTER"; + break; + case KD_EVENT_WINDOW_CLOSE: + qDebug() << "KD_EVENT_WINDOW_CLOSE"; + break; + case KD_EVENT_WINDOWPROPERTY_CHANGE: + qDebug() << "KD_EVENT_WINDOWPROPERTY_CHANGE"; + qDebug() << event->data.windowproperty.pname; + break; + case KD_EVENT_WINDOW_FOCUS: + qDebug() << "KD_EVENT_WINDOW_FOCUS"; + break; + case KD_EVENT_WINDOW_REDRAW: + qDebug() << "KD_EVENT_WINDOW_REDRAW"; + break; + case KD_EVENT_USER: + qDebug() << "KD_EVENT_USER"; + break; + case KD_EVENT_INPUT_KEY_ATX: + qDebug() << "KD_EVENT_INPUT_KEY_ATX"; + break; + case QT_EVENT_WAKEUP_EVENTLOOP: +// qDebug() << "QT_EVENT_WAKEUP_EVENTLOOP"; + break; + default: + break; + } + + kdDefaultEvent(event); + +} + QOpenKODEEventLoopIntegration::QOpenKODEEventLoopIntegration() { m_kdThread = kdThreadSelf(); + kdInstallCallback(&kdprocessevent,QT_EVENT_WAKEUP_EVENTLOOP,this); } void QOpenKODEEventLoopIntegration::processEvents(qint64 msec) @@ -25,6 +70,8 @@ void QOpenKODEEventLoopIntegration::processEvents(qint64 msec) void QOpenKODEEventLoopIntegration::wakeup() { KDEvent *event = kdCreateEvent(); + event->type = QT_EVENT_WAKEUP_EVENTLOOP; + event->userptr = this; kdPostThreadEvent(event,m_kdThread); } diff --git a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h index 868eda8..03f800c 100644 --- a/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h +++ b/src/plugins/platforms/openkode/qopenkodeeventloopintegration.h @@ -4,6 +4,7 @@ #include class KDThread; +class KDEvent; QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -14,7 +15,10 @@ public: QOpenKODEEventLoopIntegration(); void processEvents(qint64 msec); void wakeup(); + + void processInputEvent(const KDEvent *event); private: + KDThread *m_kdThread; }; diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.cpp b/src/plugins/platforms/openkode/qopenkodeintegration.cpp index 5dada28..8fc3862 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.cpp +++ b/src/plugins/platforms/openkode/qopenkodeintegration.cpp @@ -40,7 +40,6 @@ ****************************************************************************/ #include "qopenkodeintegration.h" -#include "qopenkodewindowsurface.h" #include "qopenkodewindow.h" #include "qopenkodeeventloopintegration.h" @@ -67,6 +66,7 @@ QT_BEGIN_NAMESPACE QOpenKODEScreen::QOpenKODEScreen() + : mIsFullScreen(false) { KDDesktopNV *kdDesktop = KD_NULL; KDDisplayNV *kdDisplay = KD_NULL; @@ -130,12 +130,13 @@ QOpenKODEScreen::QOpenKODEScreen() qErrnoWarning("EGL failed to initialize display"); } - const int defaultDpi = 72; - mGeometry = QRect(0, 0, mode.width, mode.height); - mPhysicalSize = QSize(mode.width * 25.4 / defaultDpi, mode.height * 25.4 / defaultDpi); +// cursor = new QOpenKODECursor(this); + mGeometry = QRect(0, 0, mode.width, mode.height); mDepth = 24; mFormat = QImage::Format_RGB32; + + } static GLuint loadShaders(const QString &vertexShader, const QString &fragmentShader) @@ -186,6 +187,7 @@ static GLuint loadShaders(const QString &vertexShader, const QString &fragmentSh } QOpenKODEIntegration::QOpenKODEIntegration() + : mEventLoopIntegration(0) { if (kdInitializeNV() == KD_ENOTINITIALIZED) { qFatal("Did not manage to initialize openkode"); @@ -195,6 +197,10 @@ QOpenKODEIntegration::QOpenKODEIntegration() mScreens.append(mPrimaryScreen); } +QOpenKODEIntegration::~QOpenKODEIntegration() +{ + delete mEventLoopIntegration; +} QPixmapData *QOpenKODEIntegration::createPixmapData(QPixmapData::PixelType type) const { @@ -212,9 +218,6 @@ QWindowSurface *QOpenKODEIntegration::createWindowSurface(QWidget *widget, WId w switch (widget->platformWindowFormat().windowApi()) { case QPlatformWindowFormat::Raster: - returnSurface = new QOpenKODEWindowSurface(widget, wid); - break; - case QPlatformWindowFormat::OpenGL: returnSurface = new QGLWindowSurface(widget); break; @@ -238,7 +241,11 @@ bool QOpenKODEIntegration::hasOpenGL() const QPlatformEventLoopIntegration *QOpenKODEIntegration::createEventLoopIntegration() const { - return new QOpenKODEEventLoopIntegration; + if (!mEventLoopIntegration) { + QOpenKODEIntegration *that = const_cast(this); + that->mEventLoopIntegration = new QOpenKODEEventLoopIntegration; + } + return mEventLoopIntegration; } GLuint QOpenKODEIntegration::blitterProgram() diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.h b/src/plugins/platforms/openkode/qopenkodeintegration.h index 8d3d175..454aa90 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.h +++ b/src/plugins/platforms/openkode/qopenkodeintegration.h @@ -42,6 +42,8 @@ #ifndef QGRAPHICSSYSTEM_OPENKODE_H #define QGRAPHICSSYSTEM_OPENKODE_H +#include "qopenkodeeventloopintegration.h" + #include #include @@ -55,6 +57,7 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE struct KDDesktopNV; +class QOpenKODECursor; class QOpenKODEScreen : public QPlatformScreen { @@ -66,21 +69,24 @@ public: QRect geometry() const { return mGeometry; } int depth() const { return mDepth; } QImage::Format format() const { return mFormat; } - QSize physicalSize() const { return mPhysicalSize; } EGLDisplay eglDisplay() { return mEglDisplay; } -public: + + bool isFullScreen() const {return mIsFullScreen;} + void setFullScreen(bool fullscreen) { mIsFullScreen = fullscreen; } +private: QRect mGeometry; int mDepth; QImage::Format mFormat; - QSize mPhysicalSize; EGLDisplay mEglDisplay; + bool mIsFullScreen; }; class QOpenKODEIntegration : public QPlatformIntegration { public: QOpenKODEIntegration(); + ~QOpenKODEIntegration(); QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; @@ -96,6 +102,7 @@ public: private: QList mScreens; + QOpenKODEEventLoopIntegration *mEventLoopIntegration; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/openkode/qopenkodewindow.cpp b/src/plugins/platforms/openkode/qopenkodewindow.cpp index 81f38d2..c890641 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.cpp +++ b/src/plugins/platforms/openkode/qopenkodewindow.cpp @@ -45,6 +45,10 @@ #include #include +#include +#ifdef KD_ATX_keyboard +#include "openkodekeytranslator.h" +#endif #include @@ -57,6 +61,20 @@ QT_BEGIN_NAMESPACE +void kdProcessMouseEvents( const KDEvent *event ) +{ + QOpenKODEWindow *window = static_cast(event->userptr); + window->processMouseEvents(event); +} + +#ifdef KD_ATX_keyboard +void kdProcessKeyEvents( const KDEvent *event ) +{ + QOpenKODEWindow *window = static_cast(event->userptr); + window->processKeyEvents(event); +} +#endif //KD_ATX_keyboard + QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) : QPlatformWindow(tlw) { @@ -92,54 +110,90 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) m_kdWindow = kdCreateWindow(screen->eglDisplay(), m_eglConfig, - KD_NULL); + this); + kdInstallCallback(kdProcessMouseEvents,KD_EVENT_INPUT_POINTER,this); +#ifdef KD_ATX_keyboard + kdInstallCallback(kdProcessKeyEvents, KD_EVENT_INPUT_KEY_ATX,this); +#endif //KD_ATX_keyboard + if (!m_kdWindow) { qErrnoWarning(kdGetError(), "Error creating native window"); return; } - const KDint windowSize[2] = { tlw->width(), tlw->height()-1 }; - if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) { - qErrnoWarning(kdGetError(), "Could not set native window size"); - return; + bool fullscreen = false; + KDboolean exclusive(false); + if (kdSetWindowPropertybv(m_kdWindow,KD_WINDOWPROPERTY_DESKTOP_EXCLUSIVE_NV, &exclusive)) { + fullscreen = true; } - KDboolean visibillity(false); - if (kdSetWindowPropertybv(m_kdWindow, KD_WINDOWPROPERTY_VISIBILITY, &visibillity)) { - qErrnoWarning(kdGetError(), "Could not set visibillity to false"); - } + if (fullscreen) { + tlw->setGeometry(screen->geometry()); + screen->setFullScreen(fullscreen); + }else { + const KDint windowSize[2] = { tlw->width(), tlw->height() }; + if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) { + qErrnoWarning(kdGetError(), "Could not set native window size"); + } + KDboolean visibillity(false); + if (kdSetWindowPropertybv(m_kdWindow, KD_WINDOWPROPERTY_VISIBILITY, &visibillity)) { + qErrnoWarning(kdGetError(), "Could not set visibillity to false"); + } - const KDint windowPos[2] = { tlw->x(), tlw->y() }; - if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { - qErrnoWarning(kdGetError(), "Could not set native window position"); - return; + const KDint windowPos[2] = { tlw->x(), tlw->y() }; + if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { + qErrnoWarning(kdGetError(), "Could not set native window position"); + return; + } } - if (kdRealizeWindow(m_kdWindow, &m_eglWindow)) { - qErrnoWarning(kdGetError(), "Could not realize native window"); - return; - } - EGLSurface surface = eglCreateWindowSurface(screen->eglDisplay(),m_eglConfig,m_eglWindow,m_eglWindowAttrs.constData()); - m_platformGlContext = new QEGLPlatformContext(screen->eglDisplay(), m_eglConfig, - m_eglContextAttrs.data(), surface, m_eglApi); + + if (!fullscreen || (fullscreen && !QPlatformGLContext::defaultSharedContext())) { + if (kdRealizeWindow(m_kdWindow, &m_eglWindow)) { + qErrnoWarning(kdGetError(), "Could not realize native window"); + return; + } + + EGLSurface surface = eglCreateWindowSurface(screen->eglDisplay(),m_eglConfig,m_eglWindow,m_eglWindowAttrs.constData()); + m_platformGlContext = new QEGLPlatformContext(screen->eglDisplay(), m_eglConfig, + m_eglContextAttrs.data(), surface, m_eglApi); + m_platformGlContext->makeDefaultSaredContext(); + } else { + m_platformGlContext = static_cast(QPlatformGLContext::defaultSharedContext()); + kdDestroyWindow(m_kdWindow); + m_kdWindow = 0; + } } + QOpenKODEWindow::~QOpenKODEWindow() { qDebug() << "destroying window" << m_kdWindow; - delete m_platformGlContext; - kdDestroyWindow(m_kdWindow); + if (m_platformGlContext != QPlatformGLContext::defaultSharedContext()) { + delete m_platformGlContext; + } + if (m_kdWindow) + kdDestroyWindow(m_kdWindow); } void QOpenKODEWindow::setGeometry(const QRect &rect) { + if (!m_kdWindow) { + QList screens = QApplicationPrivate::platformIntegration()->screens(); + QOpenKODEScreen *screen = qobject_cast(screens.at(0)); + widget()->setGeometry(screen->geometry()); + return; + } + bool needToDeleteContext = false; const QRect geo = geometry(); if (geo.size() != rect.size()) { - const KDint windowSize[2] = { rect.width(), rect.height() -1 }; + const KDint windowSize[2] = { rect.width(), rect.height() }; if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) { qErrnoWarning(kdGetError(), "Could not set native window size"); //return; + } else { + needToDeleteContext = true; } } @@ -148,11 +202,16 @@ void QOpenKODEWindow::setGeometry(const QRect &rect) if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { qErrnoWarning(kdGetError(), "Could not set native window position"); //return; + } else { + needToDeleteContext = true; } } //need to recreate context - delete m_platformGlContext; + if (needToDeleteContext) { + qDebug() << "deleting context"; + delete m_platformGlContext; + } QList screens = QApplicationPrivate::platformIntegration()->screens(); QOpenKODEScreen *screen = qobject_cast(screens.at(0)); @@ -163,14 +222,96 @@ void QOpenKODEWindow::setGeometry(const QRect &rect) void QOpenKODEWindow::setVisible(bool visible) { + if (!m_kdWindow) + return; KDboolean visibillity(visible); if (kdSetWindowPropertybv(m_kdWindow, KD_WINDOWPROPERTY_VISIBILITY, &visibillity)) { - qErrnoWarning(kdGetError(), "Could not set visibillity to false"); + qErrnoWarning(kdGetError(), "Could not set visibillity property"); } } +WId QOpenKODEWindow::winId() const +{ + static int i = 0; + return i++; +} + QPlatformGLContext *QOpenKODEWindow::glContext() const { return m_platformGlContext; } + +void QOpenKODEWindow::raise() +{ + if (!m_kdWindow) + return; + KDboolean focus(true); + if (kdSetWindowPropertybv(m_kdWindow, KD_WINDOWPROPERTY_FOCUS, &focus)) { + qErrnoWarning(kdGetError(), "Could not set focus"); + } +} + +void QOpenKODEWindow::lower() +{ + if (!m_kdWindow) + return; + KDboolean focus(false); + if (kdSetWindowPropertybv(m_kdWindow, KD_WINDOWPROPERTY_FOCUS, &focus)) { + qErrnoWarning(kdGetError(), "Could not set focus"); + } +} + +void QOpenKODEWindow::processMouseEvents(const KDEvent *event) +{ + int x = event->data.inputpointer.x; + int y = event->data.inputpointer.y; + Qt::MouseButtons buttons; + switch(event->data.inputpointer.select) { + case 1: + buttons = Qt::LeftButton; + break; + default: + buttons = Qt::NoButton; + } + qDebug() << x << y; + QPoint pos(x,y); + QWindowSystemInterface::handleMouseEvent(0,event->timestamp,pos,pos,buttons); +} + +void QOpenKODEWindow::processKeyEvents(const KDEvent *event) +{ +#ifdef KD_ATX_keyboard + //KD_KEY_PRESS_ATX 1 + QEvent::Type keyPressed = QEvent::KeyRelease; + if (event->data.keyboardInputKey.flags) + keyPressed = QEvent::KeyPress; +//KD_KEY_LOCATION_LEFT_ATX // dont care for now +//KD_KEY_LOCATION_RIGHT_ATX +//KD_KEY_LOCATION_NUMPAD_ATX + Qt::KeyboardModifiers mod = Qt::NoModifier; + int openkodeMods = event->data.keyboardInputKey.flags; + if (openkodeMods & KD_KEY_MODIFIER_SHIFT_ATX) + mod |= Qt::ShiftModifier; + if (openkodeMods & KD_KEY_MODIFIER_CTRL_ATX) + mod |= Qt::ControlModifier; + if (openkodeMods & KD_KEY_MODIFIER_ALT_ATX) + mod |= Qt::AltModifier; + if (openkodeMods & KD_KEY_MODIFIER_META_ATX) + mod |= Qt::MetaModifier; + + Qt::Key qtKey; + QChar keyText; + int key = event->data.keyboardInputKey.keycode; + if (key >= 0x20 && key <= 0x0ff){ // 8 bit printable Latin1 + qtKey = Qt::Key(key); + keyText = QChar(event->data.keyboardInputKeyChar.character); + if (!(mod & Qt::ShiftModifier)) + keyText = keyText.toLower(); + } else { + qtKey = keyTranslator(key); + } + QWindowSystemInterface::handleKeyEvent(0,event->timestamp,keyPressed,qtKey,mod,keyText); +#endif +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/openkode/qopenkodewindow.h b/src/plugins/platforms/openkode/qopenkodewindow.h index 3e7ee56..1980c15 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.h +++ b/src/plugins/platforms/openkode/qopenkodewindow.h @@ -51,6 +51,7 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE class QEGLPlatformContext; +class QPlatformEventLoopIntegration; class QOpenKODEWindow : public QPlatformWindow { @@ -60,10 +61,16 @@ public: void setGeometry(const QRect &rect); void setVisible(bool visible); - WId winId() const { return WId(m_eglWindow); } + WId winId() const; QPlatformGLContext *glContext() const; + void raise(); + void lower(); + + void processKeyEvents( const KDEvent *event ); + void processMouseEvents( const KDEvent *event ); + private: struct KDWindow *m_kdWindow; EGLNativeWindowType m_eglWindow; diff --git a/src/plugins/platforms/openkode/qopenkodewindowsurface.cpp b/src/plugins/platforms/openkode/qopenkodewindowsurface.cpp deleted file mode 100644 index 84e27f5..0000000 --- a/src/plugins/platforms/openkode/qopenkodewindowsurface.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG 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 http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qopenkodewindowsurface.h" -#include "qopenkodeintegration.h" - -#include "qopenkodewindow.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -QOpenKODEWindowSurface::QOpenKODEWindowSurface - (QWidget *window, WId) - : QWindowSurface(window), m_platformGLContext(window->platformWindow()->glContext()) -{ -} - -QOpenKODEWindowSurface::~QOpenKODEWindowSurface() -{ -} - -QPaintDevice *QOpenKODEWindowSurface::paintDevice() -{ - return &mImage; -} - -// ### TODO - this updates the entire toplevel, should only update the region -void QOpenKODEWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) -{ - m_platformGLContext->makeCurrent(); - - if (!offset.isNull()) { - qWarning("Offset flushing not supported yet"); - return; - } - - m_platformGLContext->makeCurrent(); - - QRect boundingRect = region.boundingRect(); - - int x, y, w, h; - QImage blitImage; - if (true || boundingRect == mImage.rect()) { // TODO - check optimization - blitImage = mImage; - x = y = 0; - w = mImage.width(); - h = mImage.height(); - } else { - blitImage = mImage.copy(boundingRect); - w = boundingRect.width(); - h = boundingRect.height(); - x = boundingRect.x(); - y = boundingRect.y(); - } - - GLuint shaderProgram = QOpenKODEIntegration::blitterProgram(); - - glUseProgram(shaderProgram); - - GLuint index = glGetUniformLocation(shaderProgram, "window"); - glUniform2f(index, GLfloat(mImage.width()), GLfloat(mImage.height())); - - // attributes - GLuint posId = glGetAttribLocation(shaderProgram, "pos_attr"); - GLuint texcoordId = glGetAttribLocation(shaderProgram, "texcoord_attr"); - - // sampler - index = glGetUniformLocation(shaderProgram, "tex_samp"); - - glUniform1i(index, 0); - - glDisable(GL_DEPTH_TEST); - glActiveTexture(GL_TEXTURE0); - - GLuint texId; - GLfloat coords[8] = {x, y, x, y + h, x + w, y + h, x + w, y }; - GLfloat texcoords[8] = { 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0 }; - - // Generate texture for checkered background - glGenTextures(1, &texId); - glBindTexture(GL_TEXTURE_2D, texId); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, mImage.bits()); - - // Enable vertex attribute associated with vertex position - glEnableVertexAttribArray(posId); - glEnableVertexAttribArray(texcoordId); - - // Set the quad vertices - glVertexAttribPointer(posId, 2, GL_FLOAT, 0, 0, coords); - glVertexAttribPointer(texcoordId, 2, GL_FLOAT, 0, 0, texcoords); - - // Draw the quad - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - - // Cleanup - glDisableVertexAttribArray(posId); - glDisableVertexAttribArray(texcoordId); - - // Release all textures - glBindTexture(GL_TEXTURE_2D, 0); - if (texId) - glDeleteTextures(1, &texId); - - eglWaitGL(); - - m_platformGLContext->swapBuffers(); - m_platformGLContext->doneCurrent(); - - eglWaitNative(EGL_CORE_NATIVE_ENGINE); -} - -void QOpenKODEWindowSurface::resize(const QSize &size) -{ - QWindowSurface::resize(size); - mImage = QImage(); - -} -void QOpenKODEWindowSurface::beginPaint(const QRegion ®ion) -{ - Q_UNUSED(region); - if (mImage.isNull()) { - m_platformGLContext = window()->platformWindow()->glContext(); - mImage = QImage(size(),QImage::Format_RGB888); - } -} - -void QOpenKODEWindowSurface::endPaint(const QRegion ®ion) -{ - Q_UNUSED(region); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/openkode/qopenkodewindowsurface.h b/src/plugins/platforms/openkode/qopenkodewindowsurface.h deleted file mode 100644 index f12b625..0000000 --- a/src/plugins/platforms/openkode/qopenkodewindowsurface.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG 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 http://www.qtsoftware.com/contact. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_OPENKODE_H -#define QWINDOWSURFACE_OPENKODE_H - -#include - -#include - -QT_BEGIN_HEADER -QT_BEGIN_NAMESPACE - -class QOpenKODEWindow; -class QPlatformGLContext; - -class QOpenKODEWindowSurface : public QWindowSurface -{ -public: - QOpenKODEWindowSurface - (QWidget *window, WId winId); - ~QOpenKODEWindowSurface(); - - QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void resize (const QSize &size); - - void beginPaint(const QRegion ®ion); - void endPaint(const QRegion ®ion); - -private: - QImage mImage; - QPlatformGLContext *m_platformGLContext; -}; - -QT_END_NAMESPACE -QT_END_HEADER - -#endif -- cgit v0.12 From c0eb289559705e15fe13013c72a218e647ad6d90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 3 Aug 2010 08:46:44 +0200 Subject: Make it possible to view what format a QPlatformGlContext has QPlatformGlContext has now a pure virtual format getter. The way its intended to work is that the tlw has a QPlatformWindowFormat which is the requested format. Once you get the QPlatformGlContext of the window, you can request the QPlatformWindowFormat of the context to see what you really got. --- src/gui/kernel/qplatformglcontext_qpa.cpp | 3 ++ src/gui/kernel/qplatformglcontext_qpa.h | 5 +- src/opengl/qgl_qpa.cpp | 1 + .../platforms/eglconvenience/qeglconvenience.cpp | 45 +++++++++++++++++ .../platforms/eglconvenience/qeglconvenience.h | 4 ++ .../eglconvenience/qeglplatformcontext.cpp | 12 ++++- .../platforms/eglconvenience/qeglplatformcontext.h | 4 ++ src/plugins/platforms/testlite/qglxintegration.cpp | 57 ++++++++++++++++++++-- src/plugins/platforms/testlite/qglxintegration.h | 4 +- 9 files changed, 129 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qplatformglcontext_qpa.cpp b/src/gui/kernel/qplatformglcontext_qpa.cpp index a2ffbf3..36db2b0 100644 --- a/src/gui/kernel/qplatformglcontext_qpa.cpp +++ b/src/gui/kernel/qplatformglcontext_qpa.cpp @@ -41,6 +41,9 @@ #include "qplatformglcontext_qpa.h" +QPlatformGLContext::~QPlatformGLContext() +{ } + static QPlatformGLContext *staticSharedContext = 0; void QPlatformGLContext::setDefaultSharedContext(QPlatformGLContext *sharedContext) diff --git a/src/gui/kernel/qplatformglcontext_qpa.h b/src/gui/kernel/qplatformglcontext_qpa.h index 9f3bfb3..d235848 100644 --- a/src/gui/kernel/qplatformglcontext_qpa.h +++ b/src/gui/kernel/qplatformglcontext_qpa.h @@ -51,16 +51,19 @@ QT_BEGIN_NAMESPACE class Q_OPENGL_EXPORT QPlatformGLContext { public: - virtual ~QPlatformGLContext() { } + virtual ~QPlatformGLContext(); virtual void makeCurrent() = 0; virtual void doneCurrent() = 0; virtual void swapBuffers() = 0; virtual void* getProcAddress(const QString& procName) = 0; + virtual QPlatformWindowFormat platformWindowFormat() const = 0; + static QPlatformGLContext *defaultSharedContext(); protected: + static void setDefaultSharedContext(QPlatformGLContext *sharedContext); }; diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index 8fa210b..f859ff1 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -134,6 +134,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) widget->winId();//make window } d->platformContext = widget->platformWindow()->glContext(); + d->glFormat = qt_platformwindowformat_to_glformat(d->platformContext->platformWindowFormat()); d->valid =(bool) d->platformContext; } diff --git a/src/plugins/platforms/eglconvenience/qeglconvenience.cpp b/src/plugins/platforms/eglconvenience/qeglconvenience.cpp index c50101d..b3a4c53 100644 --- a/src/plugins/platforms/eglconvenience/qeglconvenience.cpp +++ b/src/plugins/platforms/eglconvenience/qeglconvenience.cpp @@ -1,5 +1,7 @@ #include "qeglconvenience.h" +QT_BEGIN_NAMESPACE + QVector q_createConfigAttributesFromFormat(const QPlatformWindowFormat &format) { int redSize = format.redBufferSize(); @@ -228,3 +230,46 @@ EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformW qWarning("Cant find EGLConfig, returning null config"); return 0; } + +QPlatformWindowFormat qt_qPlatformWindowFormatFromConfig(EGLDisplay display, const EGLConfig config) +{ + QPlatformWindowFormat format; + EGLint redSize = 0; + EGLint greenSize = 0; + EGLint blueSize = 0; + EGLint alphaSize = 0; + EGLint depthSize = 0; + EGLint stencilSize = 0; + EGLint sampleCount = 0; + EGLint level = 0; + + eglGetConfigAttrib(display, config, EGL_RED_SIZE, &redSize); + eglGetConfigAttrib(display, config, EGL_GREEN_SIZE, &greenSize); + eglGetConfigAttrib(display, config, EGL_BLUE_SIZE, &blueSize); + eglGetConfigAttrib(display, config, EGL_ALPHA_SIZE, &alphaSize); + eglGetConfigAttrib(display, config, EGL_DEPTH_SIZE, &depthSize); + eglGetConfigAttrib(display, config, EGL_STENCIL_SIZE, &stencilSize); + eglGetConfigAttrib(display, config, EGL_SAMPLES, &sampleCount); + eglGetConfigAttrib(display, config, EGL_LEVEL, &level); + + format.setRedBufferSize(redSize); + format.setGreenBufferSize(greenSize); + format.setBlueBufferSize(blueSize); + format.setAlphaBufferSize(alphaSize); + format.setDepthBufferSize(depthSize); + format.setStencilBufferSize(stencilSize); + format.setSamples(sampleCount); + format.setDirectRendering(true); // All EGL contexts are direct-rendered + format.setRgba(true); // EGL doesn't support colour index rendering + format.setStereo(false); // EGL doesn't support stereo buffers + format.setAccumBufferSize(0); // EGL doesn't support accululation buffers + + // Clear the EGL error state because some of the above may + // have errored out because the attribute is not applicable + // to the surface type. Such errors don't matter. + eglGetError(); + + return format; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglconvenience/qeglconvenience.h b/src/plugins/platforms/eglconvenience/qeglconvenience.h index bd5a6d3..12731e1 100644 --- a/src/plugins/platforms/eglconvenience/qeglconvenience.h +++ b/src/plugins/platforms/eglconvenience/qeglconvenience.h @@ -46,9 +46,13 @@ #include #include +QT_BEGIN_NAMESPACE + QVector q_createConfigAttributesFromFormat(const QPlatformWindowFormat &format); bool q_reduceConfigAttributes(QVector *configAttributes); EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformWindowFormat &format); +QPlatformWindowFormat qt_qPlatformWindowFormatFromConfig(EGLDisplay display, const EGLConfig config); +QT_END_NAMESPACE #endif //QEGLCONVENIENCE_H diff --git a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp index b3a5bba..87cd958 100644 --- a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp +++ b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp @@ -45,8 +45,11 @@ #include +#include "qeglconvenience.h" + QEGLPlatformContext::QEGLPlatformContext(EGLDisplay display, EGLConfig config, EGLint contextAttrs[], EGLSurface surface, EGLenum eglApi) - : m_eglDisplay(display) + : QPlatformGLContext() + , m_eglDisplay(display) , m_eglSurface(surface) , m_eglApi(eglApi) { @@ -61,6 +64,8 @@ QEGLPlatformContext::QEGLPlatformContext(EGLDisplay display, EGLConfig config, E eglTerminate(m_eglDisplay); qFatal("EGL error"); } + + m_windowFormat = qt_qPlatformWindowFormatFromConfig(display,config); } QEGLPlatformContext::~QEGLPlatformContext() @@ -142,3 +147,8 @@ void QEGLPlatformContext::makeDefaultSaredContext() { setDefaultSharedContext(this); } + +QPlatformWindowFormat QEGLPlatformContext::platformWindowFormat() const +{ + return m_windowFormat; +} diff --git a/src/plugins/platforms/eglconvenience/qeglplatformcontext.h b/src/plugins/platforms/eglconvenience/qeglplatformcontext.h index 2a49129..b0cbbe0 100644 --- a/src/plugins/platforms/eglconvenience/qeglplatformcontext.h +++ b/src/plugins/platforms/eglconvenience/qeglplatformcontext.h @@ -57,11 +57,15 @@ public: void* getProcAddress(const QString& procName); void makeDefaultSaredContext(); + + QPlatformWindowFormat platformWindowFormat() const; private: EGLContext m_eglContext; EGLDisplay m_eglDisplay; EGLSurface m_eglSurface; EGLenum m_eglApi; + + QPlatformWindowFormat m_windowFormat; }; #endif //QOPENKODEGLINTEGRATION_H diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp index e554e8d..57f9de4 100644 --- a/src/plugins/platforms/testlite/qglxintegration.cpp +++ b/src/plugins/platforms/testlite/qglxintegration.cpp @@ -125,6 +125,54 @@ GLXFBConfig QGLXGLContext::findConfig(const GLXFBConfig *configs, int configCoun return chosenConfig; } +QPlatformWindowFormat QGLXGLContext::platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config) +{ + QPlatformWindowFormat format; + int redSize = 0; + int greenSize = 0; + int blueSize = 0; + int alphaSize = 0; + int depthSize = 0; + int stencilSize = 0; + int sampleCount = 0; + int level = 0; + int rgba = 0; + int stereo = 0; + int accumSizeA = 0; + int accumSizeR = 0; + int accumSizeG = 0; + int accumSizeB = 0; + + glXGetFBConfigAttrib(display, config, GLX_RED_SIZE, &redSize); + glXGetFBConfigAttrib(display, config, GLX_GREEN_SIZE, &greenSize); + glXGetFBConfigAttrib(display, config, GLX_BLUE_SIZE, &blueSize); + glXGetFBConfigAttrib(display, config, GLX_ALPHA_SIZE, &alphaSize); + glXGetFBConfigAttrib(display, config, GLX_DEPTH_SIZE, &depthSize); + glXGetFBConfigAttrib(display, config, GLX_STENCIL_SIZE, &stencilSize); + glXGetFBConfigAttrib(display, config, GLX_SAMPLES, &sampleCount); + glXGetFBConfigAttrib(display, config, GLX_LEVEL, &level); + glXGetFBConfigAttrib(display, config, GLX_RGBA, &rgba); + glXGetFBConfigAttrib(display, config, GLX_STEREO, &stereo); + glXGetFBConfigAttrib(display, config, GLX_ACCUM_ALPHA_SIZE, &accumSizeA); + glXGetFBConfigAttrib(display, config, GLX_ACCUM_RED_SIZE, &accumSizeR); + glXGetFBConfigAttrib(display, config, GLX_ACCUM_GREEN_SIZE, &accumSizeG); + glXGetFBConfigAttrib(display, config, GLX_ACCUM_BLUE_SIZE, &accumSizeB); + + format.setRedBufferSize(redSize); + format.setGreenBufferSize(greenSize); + format.setBlueBufferSize(blueSize); + format.setAlphaBufferSize(alphaSize); + format.setDepthBufferSize(depthSize); + format.setStencilBufferSize(stencilSize); + format.setSamples(sampleCount); + format.setDirectRendering(true); // We don't support anything else for now. + format.setRgba(rgba); + format.setStereo(stereo); + format.setAccumBufferSize(accumSizeA + accumSizeB + accumSizeG + accumSizeR); + + return format; +} + QGLXGLContext::QGLXGLContext(Window window, MyDisplay *xd, const QPlatformWindowFormat &format) : QPlatformGLContext() , m_xd(xd) @@ -159,6 +207,7 @@ QGLXGLContext::QGLXGLContext(Window window, MyDisplay *xd, const QPlatformWindow { GLXFBConfig config = findConfig(configs,confcount,format,xd); m_context = glXCreateNewContext(xd->display,config,GLX_RGBA_TYPE,shareGlxContext,TRUE); + m_windowFormat = QGLXGLContext::platformWindowFromGLXFBConfig(xd->display,config); XFree(configs); } else { qFatal("Warning no context created"); @@ -167,9 +216,6 @@ QGLXGLContext::QGLXGLContext(Window window, MyDisplay *xd, const QPlatformWindow #ifdef MYX11_DEBUG qDebug() << "QGLXGLContext::create context" << m_context; #endif - -// TODO: Populate the QGLFormat with the values of the GLXFBConfig - } QGLXGLContext::QGLXGLContext(MyDisplay *display, Drawable drawable, GLXContext context) @@ -266,4 +312,9 @@ void* QGLXGLContext::getProcAddress(const QString& procName) return glXGetProcAddressARB(reinterpret_cast(procName.toLatin1().data())); } +QPlatformWindowFormat QGLXGLContext::platformWindowFormat() const +{ + return m_windowFormat; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qglxintegration.h b/src/plugins/platforms/testlite/qglxintegration.h index decbe36..5a98e25 100644 --- a/src/plugins/platforms/testlite/qglxintegration.h +++ b/src/plugins/platforms/testlite/qglxintegration.h @@ -68,14 +68,16 @@ public: GLXContext glxContext() {return m_context;} - + QPlatformWindowFormat platformWindowFormat() const; private: static QVector buildSpec(const QPlatformWindowFormat &format); static GLXFBConfig findConfig(const GLXFBConfig *configs,int configCount, const QPlatformWindowFormat &format, const MyDisplay *xd); + static QPlatformWindowFormat platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config); MyDisplay *m_xd; Drawable m_drawable; GLXContext m_context; + QPlatformWindowFormat m_windowFormat; QGLXGLContext (MyDisplay *display, Drawable drawable, GLXContext context); static QMutex m_defaultSharedContextMutex; -- cgit v0.12 From 42cdfaf86d34afeb6448723839fef70fe477deed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 3 Aug 2010 12:44:00 +0200 Subject: Make QOpenKODEWindow not delete context when in fullscreen mode --- src/plugins/platforms/openkode/qopenkodewindow.cpp | 59 +++++++++++----------- src/plugins/platforms/openkode/qopenkodewindow.h | 2 + 2 files changed, 32 insertions(+), 29 deletions(-) diff --git a/src/plugins/platforms/openkode/qopenkodewindow.cpp b/src/plugins/platforms/openkode/qopenkodewindow.cpp index c890641..454a50f 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.cpp +++ b/src/plugins/platforms/openkode/qopenkodewindow.cpp @@ -76,7 +76,7 @@ void kdProcessKeyEvents( const KDEvent *event ) #endif //KD_ATX_keyboard QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) - : QPlatformWindow(tlw) + : QPlatformWindow(tlw), isFullScreen(false) { if (tlw->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenVG) { m_eglApi = EGL_OPENVG_API; @@ -121,15 +121,14 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) return; } - bool fullscreen = false; KDboolean exclusive(false); if (kdSetWindowPropertybv(m_kdWindow,KD_WINDOWPROPERTY_DESKTOP_EXCLUSIVE_NV, &exclusive)) { - fullscreen = true; + isFullScreen = true; } - if (fullscreen) { + if (isFullScreen) { tlw->setGeometry(screen->geometry()); - screen->setFullScreen(fullscreen); + screen->setFullScreen(isFullScreen); }else { const KDint windowSize[2] = { tlw->width(), tlw->height() }; if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) { @@ -150,7 +149,7 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) - if (!fullscreen || (fullscreen && !QPlatformGLContext::defaultSharedContext())) { + if (!isFullScreen || (isFullScreen && !QPlatformGLContext::defaultSharedContext())) { if (kdRealizeWindow(m_kdWindow, &m_eglWindow)) { qErrnoWarning(kdGetError(), "Could not realize native window"); return; @@ -179,31 +178,33 @@ QOpenKODEWindow::~QOpenKODEWindow() } void QOpenKODEWindow::setGeometry(const QRect &rect) { - if (!m_kdWindow) { + if (isFullScreen) { QList screens = QApplicationPrivate::platformIntegration()->screens(); QOpenKODEScreen *screen = qobject_cast(screens.at(0)); widget()->setGeometry(screen->geometry()); return; } bool needToDeleteContext = false; - const QRect geo = geometry(); - if (geo.size() != rect.size()) { - const KDint windowSize[2] = { rect.width(), rect.height() }; - if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) { - qErrnoWarning(kdGetError(), "Could not set native window size"); - //return; - } else { - needToDeleteContext = true; + if (!isFullScreen) { + const QRect geo = geometry(); + if (geo.size() != rect.size()) { + const KDint windowSize[2] = { rect.width(), rect.height() }; + if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_SIZE, windowSize)) { + qErrnoWarning(kdGetError(), "Could not set native window size"); + //return; + } else { + needToDeleteContext = true; + } } - } - if (geo.topLeft() != rect.topLeft()) { - const KDint windowPos[2] = { rect.x(), rect.y() }; - if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { - qErrnoWarning(kdGetError(), "Could not set native window position"); - //return; - } else { - needToDeleteContext = true; + if (geo.topLeft() != rect.topLeft()) { + const KDint windowPos[2] = { rect.x(), rect.y() }; + if (kdSetWindowPropertyiv(m_kdWindow, KD_WINDOWPROPERTY_DESKTOP_OFFSET_NV, windowPos)) { + qErrnoWarning(kdGetError(), "Could not set native window position"); + //return; + } else { + needToDeleteContext = true; + } } } @@ -211,13 +212,13 @@ void QOpenKODEWindow::setGeometry(const QRect &rect) if (needToDeleteContext) { qDebug() << "deleting context"; delete m_platformGlContext; - } - QList screens = QApplicationPrivate::platformIntegration()->screens(); - QOpenKODEScreen *screen = qobject_cast(screens.at(0)); - EGLSurface surface = eglCreateWindowSurface(screen->eglDisplay(),m_eglConfig,m_eglWindow,m_eglWindowAttrs.constData()); - m_platformGlContext = new QEGLPlatformContext(screen->eglDisplay(),m_eglConfig, - m_eglContextAttrs.data(),surface,m_eglApi); + QList screens = QApplicationPrivate::platformIntegration()->screens(); + QOpenKODEScreen *screen = qobject_cast(screens.at(0)); + EGLSurface surface = eglCreateWindowSurface(screen->eglDisplay(),m_eglConfig,m_eglWindow,m_eglWindowAttrs.constData()); + m_platformGlContext = new QEGLPlatformContext(screen->eglDisplay(),m_eglConfig, + m_eglContextAttrs.data(),surface,m_eglApi); + } } void QOpenKODEWindow::setVisible(bool visible) diff --git a/src/plugins/platforms/openkode/qopenkodewindow.h b/src/plugins/platforms/openkode/qopenkodewindow.h index 1980c15..27d33d6 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.h +++ b/src/plugins/platforms/openkode/qopenkodewindow.h @@ -79,6 +79,8 @@ private: QVector m_eglContextAttrs; EGLenum m_eglApi; QEGLPlatformContext *m_platformGlContext; + + bool isFullScreen; }; QT_END_NAMESPACE -- cgit v0.12 From 34a3b5d2a0c86a534b9d7b036fb1aaf1eb1c65b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 3 Aug 2010 14:03:28 +0200 Subject: QGLWindowSurface does not support partialupdates if not EGL is defined --- src/opengl/qwindowsurface_gl.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index ef115bd..b3c9df1 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -370,6 +370,8 @@ void QGLWindowSurface::hijackWindow(QWidget *widget) setPartialUpdateSupport(false); // Force full-screen updates else setPartialUpdateSupport(true); +#else + setPartialUpdateSupport(false); #endif widgetPrivate->extraData()->glContext = ctx; -- cgit v0.12 From 7992c2d3a4413082fd40e4099f735d95d522b0f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 4 Aug 2010 13:48:43 +0200 Subject: Make QWidget::setPlatformWindowFormat recreate platformWindow if the platformWindow is visible. Also had to make sure that the QGLContext of a QGLWidget was recreated. --- src/gui/kernel/qwidget_qpa.cpp | 41 ++++++++++++++-------- src/opengl/qgl_qpa.cpp | 29 +++++++++------ src/plugins/platforms/testlite/qtestlitewindow.cpp | 2 +- 3 files changed, 47 insertions(+), 25 deletions(-) diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp index ef53004..e11f1fc 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -54,22 +54,26 @@ QT_BEGIN_NAMESPACE static QPlatformScreen *qt_screenForWidget(const QWidget *w); -void setParentForChildrenOfWidget(QPlatformWindow *window, const QWidget *widget) +void q_createNativeChildrenAndSetParent(QPlatformWindow *parentWindow, const QWidget *parentWidget) { - QObjectList children = widget->children(); + QObjectList children = parentWidget->children(); for (int i = 0; i < children.size(); i++) { if (children.at(i)->isWidgetType()) { const QWidget *childWidget = qobject_cast(children.at(i)); if (childWidget) { // should not be necessary + if (childWidget->testAttribute(Qt::WA_NativeWindow)) { + if (!childWidget->platformWindow()) + childWidget->winId(); + } if (childWidget->platformWindow()) { - childWidget->platformWindow()->setParent(window); - childWidget->platformWindow()->setWindowFlags(Qt::SubWindow); + childWidget->platformWindow()->setParent(parentWindow); } else { - setParentForChildrenOfWidget(window,childWidget); + q_createNativeChildrenAndSetParent(parentWindow,childWidget); } } } } + } void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyOldWindow) @@ -79,7 +83,6 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO Q_UNUSED(window); Q_UNUSED(initializeWindow); Q_UNUSED(destroyOldWindow); - // XXX Qt::WindowFlags flags = data.window_flags; @@ -102,12 +105,13 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO setWinId(q->platformWindow()->winId()); - //first check children. then find who for parent. - setParentForChildrenOfWidget(platformWindow,q); + //first check children. and create them if necessary + q_createNativeChildrenAndSetParent(q->platformWindow(),q); + + //if we we have a parent, then set correct parent; if (QWidget *nativeParent = q->nativeParentWidget()) { if (nativeParent->platformWindow()) { platformWindow->setParent(nativeParent->platformWindow()); - platformWindow->setWindowFlags(Qt::SubWindow); } } @@ -143,6 +147,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) if (topData) { delete topData->platformWindow; topData->platformWindow = 0; + d->data.winid = 0; } } else { if (parentWidget() && parentWidget()->testAttribute(Qt::WA_WState_Created)) { @@ -176,7 +181,6 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) QWidget * parentWithWindow = newparent->platformWindow()? newparent : newparent->nativeParentWidget(); if (parentWithWindow && parentWithWindow->platformWindow()) { q->platformWindow()->setParent(parentWithWindow->platformWindow()); - q->platformWindow()->setWindowFlags(Qt::SubWindow); } } @@ -615,7 +619,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) if (isResize) { QResizeEvent e(r.size(), olds); QApplication::sendEvent(q, &e); - if (q->isWindow()) + if (q->platformWindow()) q->update(); } } else { // not visible @@ -743,9 +747,18 @@ QPlatformWindow *QWidget::platformWindow() const void QWidget::setPlatformWindowFormat(const QPlatformWindowFormat &format) { - Q_D(QWidget); - QTLWExtra *topData = d->topData(); - topData->platformWindowFormat = format; + if (isWindow() || testAttribute(Qt::WA_NativeWindow)) { + Q_D(QWidget); + QTLWExtra *topData = d->topData(); + topData->platformWindowFormat = format; + if (testAttribute(Qt::WA_WState_Created)) { + bool wasVisible = testAttribute(Qt::WA_WState_Visible); + destroy(); + d->create_sys(0,true,true); + if (wasVisible) + topData->platformWindow->setVisible(true); + } + } } QPlatformWindowFormat QWidget::platformWindowFormat() const diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index f859ff1..5e05de1 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -129,11 +129,15 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) if (!widget->platformWindow()){ QGLFormat glformat = format(); QPlatformWindowFormat winFormat = qt_glformat_to_platformwindowformat(glformat); + if (shareContext) { + winFormat.setSharedContext(shareContext->d_func()->platformContext); + } winFormat.setWindowApi(QPlatformWindowFormat::OpenGL); widget->setPlatformWindowFormat(winFormat); widget->winId();//make window } d->platformContext = widget->platformWindow()->glContext(); + Q_ASSERT(d->platformContext); d->glFormat = qt_platformwindowformat_to_glformat(d->platformContext->platformWindowFormat()); d->valid =(bool) d->platformContext; } @@ -147,14 +151,6 @@ void QGLContext::reset() if (!d->valid) return; d->cleanup(); - doneCurrent(); - - if (d->platformContext) { - if (d->paintDevice && d->paintDevice->devType() == QInternal::Widget) { - QWidget *widget = static_cast(d->paintDevice); - widget->destroy(); - } - } d->crWin = false; d->sharing = false; @@ -204,8 +200,6 @@ void QGLWidget::setContext(QGLContext *context, return; } - if (d->glcx) - d->glcx->doneCurrent(); QGLContext* oldcx = d->glcx; d->glcx = context; @@ -286,11 +280,26 @@ void QGLWidget::setMouseTracking(bool enable) bool QGLWidget::event(QEvent *e) { + Q_D(QGLWidget); + if (e->type() == QEvent::WinIdChange) { + if (d->glcx->isValid()) { + if (QGLContext::currentContext() == d->glcx) + QGLContextPrivate::setCurrentContext(0); //Its not valid anymore + setContext(new QGLContext(d->glcx->requestedFormat(), this)); + + } + } return QWidget::event(e); } void QGLWidget::resizeEvent(QResizeEvent *e) { + Q_D(QGLWidget); + if (!isValid()) + return; + if (!d->glcx->initialized()) + glInit(); + resizeGL(width(), height()); return QWidget::resizeEvent(e); } diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index 67ec97c..fd02bc4 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -206,11 +206,11 @@ QTestLiteWindow::~QTestLiteWindow() #ifdef MYX11_DEBUG qDebug() << "~QTestLiteWindow" << hex << x_window; #endif + delete mGLContext; XFreeGC(xd->display, gc); XDestroyWindow(xd->display, x_window); xd->windowList.removeAll(this); - delete mGLContext; } -- cgit v0.12 From 8fb1271a4c211adcf3e74f545d8133671747e230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 4 Aug 2010 16:21:09 +0200 Subject: Forgot to makeCurrent before QGLWidget::resizeGL in Lighthouse --- src/opengl/qgl_qpa.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index 5e05de1..3d5b74f 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -297,6 +297,7 @@ void QGLWidget::resizeEvent(QResizeEvent *e) Q_D(QGLWidget); if (!isValid()) return; + makeCurrent(); if (!d->glcx->initialized()) glInit(); resizeGL(width(), height()); -- cgit v0.12 From 1be2e830da7aa09f92d8cdca906f8a588cd10381 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 5 Aug 2010 11:55:01 +0200 Subject: Remove "disabling opengl tests by default" in configure for lighthouse --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 52a36eb..aa2341a 100755 --- a/configure +++ b/configure @@ -3324,7 +3324,7 @@ if [ "$CFG_USE_GNUMAKE" = "auto" ] && "$MAKE" -v | grep "GNU Make" >/dev/null 2> fi # If -opengl wasn't specified, don't try to auto-detect -if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ] && [ "$CFG_OPENGL" = "auto" ]; then +if [ "$PLATFORM_QWS" = "yes" ] && [ "$CFG_OPENGL" = "auto" ]; then CFG_OPENGL=no fi -- cgit v0.12 From 261fa64d61111741a9746459eac4901248eb19d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 5 Aug 2010 13:58:51 +0200 Subject: Force 16 bit in eglfs --- src/plugins/platforms/eglfs/qeglfsscreen.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp index a390106..0d72862 100644 --- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp +++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp @@ -116,9 +116,9 @@ QEglFSScreen::QEglFSScreen(EGLNativeDisplayType display) QPlatformWindowFormat platformFormat; platformFormat.setDepth(16); platformFormat.setWindowApi(QPlatformWindowFormat::OpenGL); - platformFormat.setRedBufferSize(8); - platformFormat.setGreenBufferSize(8); - platformFormat.setBlueBufferSize(8); + platformFormat.setRedBufferSize(5); + platformFormat.setGreenBufferSize(6); + platformFormat.setBlueBufferSize(5); EGLConfig config = q_configFromQPlatformWindowFormat(m_dpy, platformFormat); EGLNativeWindowType eglWindow = 0; -- cgit v0.12 From a1f0a650578b71fddae9db05435715338b15ba35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 6 Aug 2010 07:53:28 +0200 Subject: Make the GLX integration give more correct format Also create a correct window for the format. --- src/gui/kernel/qplatformwindowformat_qpa.cpp | 24 ++++ src/gui/kernel/qplatformwindowformat_qpa.h | 7 + src/opengl/qgl_qpa.cpp | 3 +- src/plugins/platforms/testlite/qglxintegration.cpp | 159 ++++++++++++--------- src/plugins/platforms/testlite/qglxintegration.h | 7 +- src/plugins/platforms/testlite/qtestlitewindow.cpp | 25 ++-- 6 files changed, 138 insertions(+), 87 deletions(-) diff --git a/src/gui/kernel/qplatformwindowformat_qpa.cpp b/src/gui/kernel/qplatformwindowformat_qpa.cpp index 1112ba9..d497e85 100644 --- a/src/gui/kernel/qplatformwindowformat_qpa.cpp +++ b/src/gui/kernel/qplatformwindowformat_qpa.cpp @@ -41,6 +41,8 @@ #include "qplatformwindowformat_qpa.h" +#include + Q_GLOBAL_STATIC(QPlatformWindowFormat, q_platformwindow_default_format); class QPlatformWindowFormatPrivate @@ -986,3 +988,25 @@ bool operator!=(const QPlatformWindowFormat& a, const QPlatformWindowFormat& b) { return !(a == b); } + +#ifndef QT_NO_DEBUG_STREAM +QDebug operator<<(QDebug dbg, const QPlatformWindowFormat &f) +{ + const QPlatformWindowFormatPrivate * const d = f.d; + + dbg.nospace() << "QGLFormat(" + << "options " << d->opts + << ", depthBufferSize " << d->depthSize + << ", accumBufferSize " << d->accumSize + << ", stencilBufferSize " << d->stencilSize + << ", redBufferSize " << d->redSize + << ", greenBufferSize " << d->greenSize + << ", blueBufferSize " << d->blueSize + << ", alphaBufferSize " << d->alphaSize + << ", samples " << d->numSamples + << ", swapInterval " << d->swapInterval + << ')'; + + return dbg.space(); +} +#endif diff --git a/src/gui/kernel/qplatformwindowformat_qpa.h b/src/gui/kernel/qplatformwindowformat_qpa.h index 37e628d..075e796 100644 --- a/src/gui/kernel/qplatformwindowformat_qpa.h +++ b/src/gui/kernel/qplatformwindowformat_qpa.h @@ -163,11 +163,18 @@ private: friend Q_GUI_EXPORT bool operator==(const QPlatformWindowFormat&, const QPlatformWindowFormat&); friend Q_GUI_EXPORT bool operator!=(const QPlatformWindowFormat&, const QPlatformWindowFormat&); +#ifndef QT_NO_DEBUG_STREAM + friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QPlatformWindowFormat &); +#endif }; Q_GUI_EXPORT bool operator==(const QPlatformWindowFormat&, const QPlatformWindowFormat&); Q_GUI_EXPORT bool operator!=(const QPlatformWindowFormat&, const QPlatformWindowFormat&); +#ifndef QT_NO_DEBUG_STREAM +Q_OPENGL_EXPORT QDebug operator<<(QDebug, const QPlatformWindowFormat &); +#endif + Q_DECLARE_OPERATORS_FOR_FLAGS(QPlatformWindowFormat::FormatOptions) inline bool QPlatformWindowFormat::doubleBuffer() const diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index 3d5b74f..5f0bca3 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -105,7 +105,8 @@ static QPlatformWindowFormat qt_glformat_to_platformwindowformat(const QGLFormat retFormat.setRedBufferSize(format.redBufferSize()); retFormat.setRgba(format.rgba()); retFormat.setSampleBuffers(format.sampleBuffers()); - retFormat.setSamples(format.sampleBuffers()); + if (format.samples() >= 0) + retFormat.setSamples(format.samples()); retFormat.setStencil(format.stencil()); if (format.stencilBufferSize() >= 0) retFormat.setStencilBufferSize(format.stencilBufferSize()); diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp index 57f9de4..47a4f5a 100644 --- a/src/plugins/platforms/testlite/qglxintegration.cpp +++ b/src/plugins/platforms/testlite/qglxintegration.cpp @@ -63,69 +63,94 @@ QVector QGLXGLContext::buildSpec(const QPlatformWindowFormat &format) { QVector spec(48); int i = 0; - int depthSize = 0; - int stencilSize = 0; - int sampleSize = 0; - - if (format.depth()) - depthSize = (format.depthBufferSize() == -1) ? 1 : format.depthBufferSize(); - if (format.stencil()) - stencilSize = (format.stencilBufferSize() == -1) ? 1 : format.stencilBufferSize(); - if (format.sampleBuffers()) - sampleSize = (format.samples() == -1) ? 1 : format.samples(); + spec[i++] = GLX_LEVEL; + spec[i++] = 0; spec[i++] = GLX_DRAWABLE_TYPE; spec[i++] = GLX_WINDOW_BIT; - spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_RGBA_BIT; + + if (format.rgba()) { + spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_RGBA_BIT; + spec[i++] = GLX_RED_SIZE; spec[i++] = (format.redBufferSize() == -1) ? 1 : format.redBufferSize(); + spec[i++] = GLX_GREEN_SIZE; spec[i++] = (format.greenBufferSize() == -1) ? 1 : format.greenBufferSize(); + spec[i++] = GLX_BLUE_SIZE; spec[i++] = (format.blueBufferSize() == -1) ? 1 : format.blueBufferSize(); + if (format.alpha()) { + spec[i++] = GLX_ALPHA_SIZE; spec[i++] = (format.alphaBufferSize() == -1) ? 1 : format.alphaBufferSize(); + } + + spec[i++] = GLX_ACCUM_RED_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + spec[i++] = GLX_ACCUM_GREEN_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + spec[i++] = GLX_ACCUM_BLUE_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + + if (format.alpha()) { + spec[i++] = GLX_ACCUM_ALPHA_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + } + + } else { + spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_COLOR_INDEX_BIT; //I'm really not sure if this works.... + spec[i++] = GLX_BUFFER_SIZE; spec[i++] = 8; + } + spec[i++] = GLX_DOUBLEBUFFER; spec[i++] = format.doubleBuffer() ? True : False; spec[i++] = GLX_STEREO; spec[i++] = format.stereo() ? True : False; - spec[i++] = GLX_DEPTH_SIZE; spec[i++] = depthSize; - spec[i++] = GLX_STENCIL_SIZE; spec[i++] = stencilSize; - spec[i++] = GLX_SAMPLE_BUFFERS_ARB; spec[i++] = sampleSize; + if (format.depth()) { + spec[i++] = GLX_DEPTH_SIZE; spec[i++] = (format.depthBufferSize() == -1) ? 1 : format.depthBufferSize(); + } - spec[i++] = GLX_RED_SIZE; spec[i++] = (format.redBufferSize() == -1) ? 1 : format.redBufferSize(); - spec[i++] = GLX_GREEN_SIZE; spec[i++] = (format.greenBufferSize() == -1) ? 1 : format.greenBufferSize(); - spec[i++] = GLX_BLUE_SIZE; spec[i++] = (format.blueBufferSize() == -1) ? 1 : format.blueBufferSize(); - spec[i++] = GLX_ALPHA_SIZE; spec[i++] = (format.alphaBufferSize() == -1) ? 0 : format.alphaBufferSize(); + if (format.stencil()) { + spec[i++] = GLX_STENCIL_SIZE; spec[i++] = (format.stencilBufferSize() == -1) ? 1 : format.stencilBufferSize(); + } + if (format.sampleBuffers()) { + spec[i++] = GLX_SAMPLE_BUFFERS_ARB; + spec[i++] = 1; + spec[i++] = GLX_SAMPLES_ARB; + spec[i++] = format.samples() == -1 ? 4 : format.samples(); + } - spec[i++] = GLX_ACCUM_RED_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 0 : format.accumBufferSize(); - spec[i++] = GLX_ACCUM_GREEN_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 0 : format.accumBufferSize(); - spec[i++] = GLX_ACCUM_BLUE_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 0 : format.accumBufferSize(); - spec[i++] = GLX_ACCUM_ALPHA_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 0 : format.accumBufferSize(); spec[i++] = XNone; return spec; } -GLXFBConfig QGLXGLContext::findConfig(const GLXFBConfig *configs, int configCount, const QPlatformWindowFormat &format, const MyDisplay *xd) +GLXFBConfig QGLXGLContext::findConfig(const MyDisplay *xd, const QPlatformWindowFormat &format) { - if (!configs) - return 0; - + QVector spec = buildSpec(format); + int confcount = 0; + GLXFBConfig *configs; GLXFBConfig chosenConfig = 0; - for (int i = 0; i < configCount; ++i) { - chosenConfig = configs[i]; + configs = glXChooseFBConfig(xd->display,xd->screen,spec.constData(),&confcount); + if (confcount) + { + for (int i = 0; i < confcount; i++) { + chosenConfig = configs[i]; + + // Make sure we try to get an ARGB visual if the format asked for an alpha: + if (format.alpha()) { + int alphaSize; + glXGetFBConfigAttrib(xd->display,configs[i],GLX_ALPHA_SIZE,&alphaSize); + if (alphaSize > 0) + break; + } else { + break; // Just choose the first in the list if there's no alpha requested + } + } - // Make sure we try to get an ARGB visual if the format asked for an alpha: - if (format.alpha()) { - XVisualInfo* vi; - vi = glXGetVisualFromFBConfig(xd->display, configs[i]); - if (!vi) - continue; + XFree(configs); + } - XRenderPictFormat *pictFormat = XRenderFindVisualFormat(xd->display, vi->visual); - XFree(vi); + if (!chosenConfig) + qFatal("Warning no context created"); - if (pictFormat && (pictFormat->type == PictTypeDirect) && pictFormat->direct.alphaMask) { - // The pict format for the visual matching the FBConfig indicates ARGB - break; - } - } else - break; // Just choose the first in the list if there's no alpha requested - } return chosenConfig; } -QPlatformWindowFormat QGLXGLContext::platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config) +XVisualInfo *QGLXGLContext::findVisualInfo(const MyDisplay *xd, const QPlatformWindowFormat &format) +{ + GLXFBConfig config = QGLXGLContext::findConfig(xd,format); + XVisualInfo *visualInfo = glXGetVisualFromFBConfig(xd->display,config); + return visualInfo; +} + +QPlatformWindowFormat QGLXGLContext::platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext ctx) { QPlatformWindowFormat format; int redSize = 0; @@ -134,6 +159,7 @@ QPlatformWindowFormat QGLXGLContext::platformWindowFromGLXFBConfig(Display *disp int alphaSize = 0; int depthSize = 0; int stencilSize = 0; + int sampleBuffers = 0; int sampleCount = 0; int level = 0; int rgba = 0; @@ -143,15 +169,17 @@ QPlatformWindowFormat QGLXGLContext::platformWindowFromGLXFBConfig(Display *disp int accumSizeG = 0; int accumSizeB = 0; + XVisualInfo *vi = glXGetVisualFromFBConfig(display,config); + glXGetConfig(display,vi,GLX_RGBA,&rgba); + XFree(vi); glXGetFBConfigAttrib(display, config, GLX_RED_SIZE, &redSize); glXGetFBConfigAttrib(display, config, GLX_GREEN_SIZE, &greenSize); glXGetFBConfigAttrib(display, config, GLX_BLUE_SIZE, &blueSize); glXGetFBConfigAttrib(display, config, GLX_ALPHA_SIZE, &alphaSize); glXGetFBConfigAttrib(display, config, GLX_DEPTH_SIZE, &depthSize); glXGetFBConfigAttrib(display, config, GLX_STENCIL_SIZE, &stencilSize); - glXGetFBConfigAttrib(display, config, GLX_SAMPLES, &sampleCount); + glXGetFBConfigAttrib(display, config, GLX_SAMPLES, &sampleBuffers); glXGetFBConfigAttrib(display, config, GLX_LEVEL, &level); - glXGetFBConfigAttrib(display, config, GLX_RGBA, &rgba); glXGetFBConfigAttrib(display, config, GLX_STEREO, &stereo); glXGetFBConfigAttrib(display, config, GLX_ACCUM_ALPHA_SIZE, &accumSizeA); glXGetFBConfigAttrib(display, config, GLX_ACCUM_RED_SIZE, &accumSizeR); @@ -164,11 +192,16 @@ QPlatformWindowFormat QGLXGLContext::platformWindowFromGLXFBConfig(Display *disp format.setAlphaBufferSize(alphaSize); format.setDepthBufferSize(depthSize); format.setStencilBufferSize(stencilSize); - format.setSamples(sampleCount); - format.setDirectRendering(true); // We don't support anything else for now. + format.setSampleBuffers(sampleBuffers); + if (format.sampleBuffers()) { + glXGetFBConfigAttrib(display, config, GLX_SAMPLES_ARB, &sampleCount); + format.setSamples(sampleCount); + } + + format.setDirectRendering(glXIsDirect(display, ctx)); format.setRgba(rgba); format.setStereo(stereo); - format.setAccumBufferSize(accumSizeA + accumSizeB + accumSizeG + accumSizeR); + format.setAccumBufferSize(accumSizeB); return format; } @@ -199,19 +232,9 @@ QGLXGLContext::QGLXGLContext(Window window, MyDisplay *xd, const QPlatformWindow if (sharePlatformContext) shareGlxContext = static_cast(sharePlatformContext)->glxContext(); - QVector spec = buildSpec(format); - int confcount = 0; - GLXFBConfig *configs; - configs = glXChooseFBConfig(xd->display,xd->screen,spec.constData(),&confcount); - if (confcount) - { - GLXFBConfig config = findConfig(configs,confcount,format,xd); - m_context = glXCreateNewContext(xd->display,config,GLX_RGBA_TYPE,shareGlxContext,TRUE); - m_windowFormat = QGLXGLContext::platformWindowFromGLXFBConfig(xd->display,config); - XFree(configs); - } else { - qFatal("Warning no context created"); - } + GLXFBConfig config = findConfig(xd,format); + m_context = glXCreateNewContext(xd->display,config,GLX_RGBA_TYPE,shareGlxContext,TRUE); + m_windowFormat = QGLXGLContext::platformWindowFromGLXFBConfig(xd->display,config,m_context); #ifdef MYX11_DEBUG qDebug() << "QGLXGLContext::create context" << m_context; @@ -243,16 +266,10 @@ void QGLXGLContext::createDefaultSharedContex(MyDisplay *xd) x, y, w, h, 0 /*border_width*/, xd->blackPixel(), xd->whitePixel()); GLXContext context; - QPlatformWindowFormat format; - QVector spec = buildSpec(format); - int confcount = 0; - GLXFBConfig *configs; - configs = glXChooseFBConfig(xd->display,xd->screen,spec.constData(),&confcount); - if (confcount) - { - GLXFBConfig config = findConfig(configs,confcount,format,xd); + QPlatformWindowFormat format = QPlatformWindowFormat::defaultFormat(); + GLXFBConfig config = findConfig(xd,format); + if (config) { context = glXCreateNewContext(xd->display,config,GLX_RGBA_TYPE,0,TRUE); - XFree(configs); QPlatformGLContext *sharedContext = new QGLXGLContext(xd,sharedWindow,context); QPlatformGLContext::setDefaultSharedContext(sharedContext); } else { diff --git a/src/plugins/platforms/testlite/qglxintegration.h b/src/plugins/platforms/testlite/qglxintegration.h index 5a98e25..2f7c70e 100644 --- a/src/plugins/platforms/testlite/qglxintegration.h +++ b/src/plugins/platforms/testlite/qglxintegration.h @@ -69,10 +69,13 @@ public: GLXContext glxContext() {return m_context;} QPlatformWindowFormat platformWindowFormat() const; + + static XVisualInfo *findVisualInfo(const MyDisplay *xd, const QPlatformWindowFormat &format); private: + static GLXFBConfig findConfig(const MyDisplay *xd,const QPlatformWindowFormat &format); static QVector buildSpec(const QPlatformWindowFormat &format); - static GLXFBConfig findConfig(const GLXFBConfig *configs,int configCount, const QPlatformWindowFormat &format, const MyDisplay *xd); - static QPlatformWindowFormat platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config); + static QPlatformWindowFormat platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext context); + MyDisplay *m_xd; Drawable m_drawable; diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index fd02bc4..39b2cc0 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -56,7 +56,6 @@ #include #include -#include #include "qglxintegration.h" #include @@ -158,21 +157,21 @@ QTestLiteWindow::QTestLiteWindow(const QTestLiteIntegration *platformIntegration int w = window->width(); int h = window->height(); -// int n, i; -// if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL) { -// x_visualInfo = QGLXGLContext::findVisual(window->platformWindowFormat(),xd); - -// XSetWindowAttributes a; -// a.background_pixel = xd->whitePixel(); -// a.border_pixel = xd->blackPixel(); -// x_window = XCreateWindow(xd->display, xd->rootWindow(),x, y, w, h, -// 0, visualInfo()->depth, InputOutput, visualInfo()->visual, -// CWBackPixel|CWBorderPixel, &a); -// } else { + if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL) { + + XVisualInfo *visualInfo = QGLXGLContext::findVisualInfo(xd,window->platformWindowFormat()); + Colormap cmap = XCreateColormap(xd->display,xd->rootWindow(),visualInfo->visual,AllocNone); + + XSetWindowAttributes a; + a.colormap = cmap; + x_window = XCreateWindow(xd->display, xd->rootWindow(),x, y, w, h, + 0, visualInfo->depth, InputOutput, visualInfo->visual, + CWColormap, &a); + } else { x_window = XCreateSimpleWindow(xd->display, xd->rootWindow(), x, y, w, h, 0 /*border_width*/, xd->blackPixel(), xd->whitePixel()); -// } + } #ifdef MYX11_DEBUG qDebug() << "QTestLiteWindow::QTestLiteWindow creating" << hex << x_window << window; -- cgit v0.12 From a8530e5db7ae25ea0ab5df4681308374abf8b6ba Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Fri, 6 Aug 2010 12:35:47 +0200 Subject: Allow customizing the default fbo from the QPlatformGLContext. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Jørgen Lind --- src/gui/kernel/qplatformglcontext_qpa.cpp | 12 ++++++++++++ src/gui/kernel/qplatformglcontext_qpa.h | 1 + src/opengl/qgl_qpa.cpp | 1 + src/opengl/qglpaintdevice.cpp | 6 ++++++ 4 files changed, 20 insertions(+) diff --git a/src/gui/kernel/qplatformglcontext_qpa.cpp b/src/gui/kernel/qplatformglcontext_qpa.cpp index 36db2b0..4fcd9b8 100644 --- a/src/gui/kernel/qplatformglcontext_qpa.cpp +++ b/src/gui/kernel/qplatformglcontext_qpa.cpp @@ -44,6 +44,18 @@ QPlatformGLContext::~QPlatformGLContext() { } +/*! + The frame buffer object that a QGLWidget is painted to and that gets bound + when a QGLFramebufferObject is released. + + The default implementation returns 0, which denotes the default + window-system provided frame buffer. +*/ +GLuint QPlatformGLContext::defaultFBO() const +{ + return 0; +} + static QPlatformGLContext *staticSharedContext = 0; void QPlatformGLContext::setDefaultSharedContext(QPlatformGLContext *sharedContext) diff --git a/src/gui/kernel/qplatformglcontext_qpa.h b/src/gui/kernel/qplatformglcontext_qpa.h index d235848..9bfe676 100644 --- a/src/gui/kernel/qplatformglcontext_qpa.h +++ b/src/gui/kernel/qplatformglcontext_qpa.h @@ -57,6 +57,7 @@ public: virtual void doneCurrent() = 0; virtual void swapBuffers() = 0; virtual void* getProcAddress(const QString& procName) = 0; + virtual GLuint defaultFBO() const; virtual QPlatformWindowFormat platformWindowFormat() const = 0; diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index 5f0bca3..b05df64 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -139,6 +139,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) } d->platformContext = widget->platformWindow()->glContext(); Q_ASSERT(d->platformContext); + d->default_fbo = d->platformContext->defaultFBO(); d->glFormat = qt_platformwindowformat_to_glformat(d->platformContext->platformWindowFormat()); d->valid =(bool) d->platformContext; } diff --git a/src/opengl/qglpaintdevice.cpp b/src/opengl/qglpaintdevice.cpp index e1dcbfd..e12fdae 100644 --- a/src/opengl/qglpaintdevice.cpp +++ b/src/opengl/qglpaintdevice.cpp @@ -166,6 +166,12 @@ void QGLWidgetGLPaintDevice::setWidget(QGLWidget* w) void QGLWidgetGLPaintDevice::beginPaint() { + // ### This should be in setWidget(), but the context of the QGLWidget + // hasn't been set there yet. +#ifdef Q_WS_QPA + m_thisFBO = context()->d_ptr->platformContext->defaultFBO(); +#endif + QGLPaintDevice::beginPaint(); if (!glWidget->d_func()->disable_clear_on_painter_begin && glWidget->autoFillBackground()) { if (glWidget->testAttribute(Qt::WA_TranslucentBackground)) -- cgit v0.12 From 4a0ecee1fca85468c1cbcf8abb68f3d066ca4f60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 6 Aug 2010 08:41:19 +0200 Subject: Make testlite work without glx --- src/plugins/platforms/testlite/qglxintegration.h | 2 -- src/plugins/platforms/testlite/qtestliteintegration.cpp | 5 +---- src/plugins/platforms/testlite/qtestlitewindow.cpp | 13 +++++++++++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/testlite/qglxintegration.h b/src/plugins/platforms/testlite/qglxintegration.h index 2f7c70e..562967a 100644 --- a/src/plugins/platforms/testlite/qglxintegration.h +++ b/src/plugins/platforms/testlite/qglxintegration.h @@ -87,8 +87,6 @@ private: static void createDefaultSharedContex(MyDisplay *xd); }; - - QT_END_NAMESPACE #endif diff --git a/src/plugins/platforms/testlite/qtestliteintegration.cpp b/src/plugins/platforms/testlite/qtestliteintegration.cpp index 3f500c0..a8e0fa7 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.cpp +++ b/src/plugins/platforms/testlite/qtestliteintegration.cpp @@ -52,10 +52,9 @@ #ifndef QT_NO_OPENGL #include -#include "qglxintegration.h" #include #include -#endif +#endif //QT_NO_OPENGL QT_BEGIN_NAMESPACE @@ -84,9 +83,7 @@ public: QTestLiteIntegration::QTestLiteIntegration(bool useOpenGL) -#ifndef QT_NO_OPENGL : mUseOpenGL(useOpenGL) -#endif { xd = new MyDisplay; diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index 39b2cc0..1f477db 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -42,6 +42,7 @@ #include "qtestliteintegration.h" #include #include +#include #include "qtestlitewindow.h" @@ -56,7 +57,9 @@ #include #include +#ifndef QT_NO_OPENGL #include "qglxintegration.h" +#endif #include #include @@ -157,8 +160,9 @@ QTestLiteWindow::QTestLiteWindow(const QTestLiteIntegration *platformIntegration int w = window->width(); int h = window->height(); - if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL) { - + if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL + && QApplicationPrivate::platformIntegration()->hasOpenGL() ) { +#ifndef QT_NO_OPENGL XVisualInfo *visualInfo = QGLXGLContext::findVisualInfo(xd,window->platformWindowFormat()); Colormap cmap = XCreateColormap(xd->display,xd->rootWindow(),visualInfo->visual,AllocNone); @@ -167,6 +171,7 @@ QTestLiteWindow::QTestLiteWindow(const QTestLiteIntegration *platformIntegration x_window = XCreateWindow(xd->display, xd->rootWindow(),x, y, w, h, 0, visualInfo->depth, InputOutput, visualInfo->visual, CWColormap, &a); +#endif //QT_NO_OPENGL } else { x_window = XCreateSimpleWindow(xd->display, xd->rootWindow(), x, y, w, h, 0 /*border_width*/, @@ -1012,9 +1017,13 @@ void QTestLiteWindow::setCursor(QCursor * cursor) QPlatformGLContext *QTestLiteWindow::glContext() const { + if (!QApplicationPrivate::platformIntegration()->hasOpenGL()) + return 0; if (!mGLContext) { QTestLiteWindow *that = const_cast(this); +#ifndef QT_NO_OPENGL that->mGLContext = new QGLXGLContext(x_window, xd, widget()->platformWindowFormat()); +#endif } return mGLContext; } -- cgit v0.12 From 783f218aac7c73837405af4893d8dd35b425a710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 6 Aug 2010 13:23:06 +0200 Subject: Fixed Lighthouse tempcontext to reset to current context and made glxintegrations shared context use the correct window configuration --- src/opengl/qgl_qpa.cpp | 13 ++++++++----- src/plugins/platforms/testlite/qglxintegration.cpp | 17 ++++++++++++----- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index b05df64..ad125fe 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -244,20 +244,23 @@ void QGLContext::generateFontDisplayLists(const QFont & fnt, int listBase) class QGLTemporaryContextPrivate { public: - QWidget *widget; + QGLWidget *widget; + QGLContext *context; }; QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) : d(new QGLTemporaryContextPrivate) { - d->widget = new QWidget; - d->widget->setGeometry(0,0,3,3); - d->widget->winId(); - d->widget->platformWindow()->glContext()->makeCurrent(); + d->context = const_cast(QGLContext::currentContext()); + d->context->doneCurrent(); + d->widget = new QGLWidget; + d->widget->makeCurrent(); } QGLTemporaryContext::~QGLTemporaryContext() { + d->widget->doneCurrent(); + d->context->makeCurrent(); delete d->widget; } diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp index 47a4f5a..050643c 100644 --- a/src/plugins/platforms/testlite/qglxintegration.cpp +++ b/src/plugins/platforms/testlite/qglxintegration.cpp @@ -262,20 +262,27 @@ void QGLXGLContext::createDefaultSharedContex(MyDisplay *xd) int w = 3; int h = 3; - Window sharedWindow = XCreateSimpleWindow(xd->display, xd->rootWindow(), - x, y, w, h, 0 /*border_width*/, - xd->blackPixel(), xd->whitePixel()); - GLXContext context; QPlatformWindowFormat format = QPlatformWindowFormat::defaultFormat(); + GLXContext context; GLXFBConfig config = findConfig(xd,format); if (config) { + XVisualInfo *visualInfo = glXGetVisualFromFBConfig(xd->display,config); + Colormap cmap = XCreateColormap(xd->display,xd->rootWindow(),visualInfo->visual,AllocNone); + XSetWindowAttributes a; + a.colormap = cmap; + Window sharedWindow = XCreateWindow(xd->display, xd->rootWindow(),x, y, w, h, + 0, visualInfo->depth, InputOutput, visualInfo->visual, + CWColormap, &a); + context = glXCreateNewContext(xd->display,config,GLX_RGBA_TYPE,0,TRUE); QPlatformGLContext *sharedContext = new QGLXGLContext(xd,sharedWindow,context); QPlatformGLContext::setDefaultSharedContext(sharedContext); } else { - qFatal("Warning no shared context created"); + qWarning("Warning no shared context created"); } + + } void QGLXGLContext::makeCurrent() -- cgit v0.12 From 1d8ce23abdb0bd980292e4a9c8d87c019585150a Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Fri, 6 Aug 2010 13:42:43 +0200 Subject: Add missing null check to lighthouse's QGLTemporaryContext. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Jørgen Lind --- src/opengl/qgl_qpa.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index ad125fe..d87e668 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -252,7 +252,8 @@ QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) : d(new QGLTemporaryContextPrivate) { d->context = const_cast(QGLContext::currentContext()); - d->context->doneCurrent(); + if (d->context) + d->context->doneCurrent(); d->widget = new QGLWidget; d->widget->makeCurrent(); } @@ -260,7 +261,8 @@ QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) QGLTemporaryContext::~QGLTemporaryContext() { d->widget->doneCurrent(); - d->context->makeCurrent(); + if (d->context) + d->context->makeCurrent(); delete d->widget; } -- cgit v0.12 From 47bed030ffedded5914d8309bf2e1cccc1fd78d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 6 Aug 2010 15:10:20 +0200 Subject: Added reduced config to glxconfig should help if there are not many glxconfigs available. Also made QGLTemporaryContext use a QWidget again instead of a QGLWidget; This allows us to ask for a smaller window size before making the context. --- src/opengl/qgl_qpa.cpp | 14 +++-- src/plugins/platforms/testlite/qglxintegration.cpp | 68 ++++++++++++++++------ src/plugins/platforms/testlite/qglxintegration.h | 1 + 3 files changed, 60 insertions(+), 23 deletions(-) diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index d87e668..c328819 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -244,7 +244,7 @@ void QGLContext::generateFontDisplayLists(const QFont & fnt, int listBase) class QGLTemporaryContextPrivate { public: - QGLWidget *widget; + QWidget *widget; QGLContext *context; }; @@ -254,13 +254,19 @@ QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) d->context = const_cast(QGLContext::currentContext()); if (d->context) d->context->doneCurrent(); - d->widget = new QGLWidget; - d->widget->makeCurrent(); + d->widget = new QWidget; + d->widget->setGeometry(0,0,3,3); + QPlatformWindowFormat format = d->widget->platformWindowFormat(); + format.setWindowApi(QPlatformWindowFormat::OpenGL); + d->widget->winId(); + + + d->widget->platformWindow()->glContext()->makeCurrent(); } QGLTemporaryContext::~QGLTemporaryContext() { - d->widget->doneCurrent(); + d->widget->platformWindow()->glContext()->doneCurrent(); if (d->context) d->context->makeCurrent(); delete d->widget; diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp index 050643c..ba161c1 100644 --- a/src/plugins/platforms/testlite/qglxintegration.cpp +++ b/src/plugins/platforms/testlite/qglxintegration.cpp @@ -113,28 +113,33 @@ QVector QGLXGLContext::buildSpec(const QPlatformWindowFormat &format) GLXFBConfig QGLXGLContext::findConfig(const MyDisplay *xd, const QPlatformWindowFormat &format) { - QVector spec = buildSpec(format); - int confcount = 0; - GLXFBConfig *configs; + bool reduced = true; GLXFBConfig chosenConfig = 0; - configs = glXChooseFBConfig(xd->display,xd->screen,spec.constData(),&confcount); - if (confcount) - { - for (int i = 0; i < confcount; i++) { - chosenConfig = configs[i]; - - // Make sure we try to get an ARGB visual if the format asked for an alpha: - if (format.alpha()) { - int alphaSize; - glXGetFBConfigAttrib(xd->display,configs[i],GLX_ALPHA_SIZE,&alphaSize); - if (alphaSize > 0) - break; - } else { - break; // Just choose the first in the list if there's no alpha requested + QPlatformWindowFormat reducedFormat = format; + while (!chosenConfig && reduced) { + QVector spec = buildSpec(reducedFormat); + int confcount = 0; + GLXFBConfig *configs; + configs = glXChooseFBConfig(xd->display,xd->screen,spec.constData(),&confcount); + if (confcount) + { + for (int i = 0; i < confcount; i++) { + chosenConfig = configs[i]; + + // Make sure we try to get an ARGB visual if the format asked for an alpha: + if (format.alpha()) { + int alphaSize; + glXGetFBConfigAttrib(xd->display,configs[i],GLX_ALPHA_SIZE,&alphaSize); + if (alphaSize > 0) + break; + } else { + break; // Just choose the first in the list if there's no alpha requested + } } - } - XFree(configs); + XFree(configs); + } + reducedFormat = reducePlatformWindowFormat(format,&reduced); } if (!chosenConfig) @@ -206,6 +211,31 @@ QPlatformWindowFormat QGLXGLContext::platformWindowFromGLXFBConfig(Display *disp return format; } +QPlatformWindowFormat QGLXGLContext::reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced) +{ + QPlatformWindowFormat retFormat = format; + *reduced = true; + + if (retFormat.sampleBuffers()) { + retFormat.setSampleBuffers(false); + } else if (retFormat.stereo()) { + retFormat.setStereo(false); + } else if (retFormat.accum()) { + retFormat.setAccum(false); + }else if (retFormat.stencil()) { + retFormat.setStencil(false); + }else if (retFormat.alpha()) { + retFormat.setAlpha(false); + }else if (retFormat.depth()) { + retFormat.setDepth(false); + }else if (retFormat.doubleBuffer()) { + retFormat.setDoubleBuffer(false); + }else{ + *reduced = false; + } + return retFormat; +} + QGLXGLContext::QGLXGLContext(Window window, MyDisplay *xd, const QPlatformWindowFormat &format) : QPlatformGLContext() , m_xd(xd) diff --git a/src/plugins/platforms/testlite/qglxintegration.h b/src/plugins/platforms/testlite/qglxintegration.h index 562967a..479be4b 100644 --- a/src/plugins/platforms/testlite/qglxintegration.h +++ b/src/plugins/platforms/testlite/qglxintegration.h @@ -75,6 +75,7 @@ private: static GLXFBConfig findConfig(const MyDisplay *xd,const QPlatformWindowFormat &format); static QVector buildSpec(const QPlatformWindowFormat &format); static QPlatformWindowFormat platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext context); + static QPlatformWindowFormat reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced); MyDisplay *m_xd; -- cgit v0.12 From eaf64f3a07533a30aa29eed85f6a3cbc744722a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 6 Aug 2010 16:31:15 +0200 Subject: Cleaned up in includes in Lighthouse headerfiles --- src/gui/kernel/qplatformglcontext_qpa.cpp | 2 +- src/gui/kernel/qplatformglcontext_qpa.h | 5 +++-- src/gui/kernel/qplatformintegration_qpa.h | 1 + src/gui/kernel/qplatformscreen_qpa.h | 9 ++++++++- src/plugins/platforms/eglconvenience/qeglconvenience.h | 2 +- src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp | 3 ++- 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qplatformglcontext_qpa.cpp b/src/gui/kernel/qplatformglcontext_qpa.cpp index 4fcd9b8..516bf24 100644 --- a/src/gui/kernel/qplatformglcontext_qpa.cpp +++ b/src/gui/kernel/qplatformglcontext_qpa.cpp @@ -51,7 +51,7 @@ QPlatformGLContext::~QPlatformGLContext() The default implementation returns 0, which denotes the default window-system provided frame buffer. */ -GLuint QPlatformGLContext::defaultFBO() const +unsigned long QPlatformGLContext::defaultFBO() const { return 0; } diff --git a/src/gui/kernel/qplatformglcontext_qpa.h b/src/gui/kernel/qplatformglcontext_qpa.h index 9bfe676..3e7656b 100644 --- a/src/gui/kernel/qplatformglcontext_qpa.h +++ b/src/gui/kernel/qplatformglcontext_qpa.h @@ -42,7 +42,8 @@ #ifndef QPLATFORM_GL_CONTEXT_H #define QPLATFORM_GL_CONTEXT_H -#include +#include +#include QT_BEGIN_HEADER @@ -57,7 +58,7 @@ public: virtual void doneCurrent() = 0; virtual void swapBuffers() = 0; virtual void* getProcAddress(const QString& procName) = 0; - virtual GLuint defaultFBO() const; + virtual unsigned long defaultFBO() const; virtual QPlatformWindowFormat platformWindowFormat() const = 0; diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index 9f7367e..8cecbb4 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -43,6 +43,7 @@ #define QPLATFORMINTEGRATION_H #include +#include #include #include diff --git a/src/gui/kernel/qplatformscreen_qpa.h b/src/gui/kernel/qplatformscreen_qpa.h index f603db5..1704f0f 100644 --- a/src/gui/kernel/qplatformscreen_qpa.h +++ b/src/gui/kernel/qplatformscreen_qpa.h @@ -42,10 +42,17 @@ #ifndef QPLATFORMSCREEN_H #define QPLATFORMSCREEN_H +#include +#include +#include +#include #include -#include #include +#include +#include +#include + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglconvenience/qeglconvenience.h b/src/plugins/platforms/eglconvenience/qeglconvenience.h index 12731e1..484894b 100644 --- a/src/plugins/platforms/eglconvenience/qeglconvenience.h +++ b/src/plugins/platforms/eglconvenience/qeglconvenience.h @@ -41,11 +41,11 @@ #ifndef QEGLCONVENIENCE_H #define QEGLCONVENIENCE_H -#include #include #include +#include QT_BEGIN_NAMESPACE QVector q_createConfigAttributesFromFormat(const QPlatformWindowFormat &format); diff --git a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp index 87cd958..04720b5 100644 --- a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp +++ b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp @@ -41,12 +41,13 @@ #include "qeglplatformcontext.h" -#include #include #include "qeglconvenience.h" +#include + QEGLPlatformContext::QEGLPlatformContext(EGLDisplay display, EGLConfig config, EGLint contextAttrs[], EGLSurface surface, EGLenum eglApi) : QPlatformGLContext() , m_eglDisplay(display) -- cgit v0.12 From 3b048f8727a125eef2ac132d95dd3d9c2acbcab2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 11 Aug 2010 11:01:53 +0200 Subject: Revert "Allow customizing the default fbo from the QPlatformGLContext." This reverts commit a8530e5db7ae25ea0ab5df4681308374abf8b6ba. Conflicts: src/gui/kernel/qplatformglcontext_qpa.cpp src/gui/kernel/qplatformglcontext_qpa.h --- src/gui/kernel/qplatformglcontext_qpa.cpp | 12 ------------ src/gui/kernel/qplatformglcontext_qpa.h | 1 - src/opengl/qgl_qpa.cpp | 1 - src/opengl/qglpaintdevice.cpp | 6 ------ 4 files changed, 20 deletions(-) diff --git a/src/gui/kernel/qplatformglcontext_qpa.cpp b/src/gui/kernel/qplatformglcontext_qpa.cpp index 516bf24..36db2b0 100644 --- a/src/gui/kernel/qplatformglcontext_qpa.cpp +++ b/src/gui/kernel/qplatformglcontext_qpa.cpp @@ -44,18 +44,6 @@ QPlatformGLContext::~QPlatformGLContext() { } -/*! - The frame buffer object that a QGLWidget is painted to and that gets bound - when a QGLFramebufferObject is released. - - The default implementation returns 0, which denotes the default - window-system provided frame buffer. -*/ -unsigned long QPlatformGLContext::defaultFBO() const -{ - return 0; -} - static QPlatformGLContext *staticSharedContext = 0; void QPlatformGLContext::setDefaultSharedContext(QPlatformGLContext *sharedContext) diff --git a/src/gui/kernel/qplatformglcontext_qpa.h b/src/gui/kernel/qplatformglcontext_qpa.h index 3e7656b..ff848ed 100644 --- a/src/gui/kernel/qplatformglcontext_qpa.h +++ b/src/gui/kernel/qplatformglcontext_qpa.h @@ -58,7 +58,6 @@ public: virtual void doneCurrent() = 0; virtual void swapBuffers() = 0; virtual void* getProcAddress(const QString& procName) = 0; - virtual unsigned long defaultFBO() const; virtual QPlatformWindowFormat platformWindowFormat() const = 0; diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index c328819..49c0860 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -139,7 +139,6 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) } d->platformContext = widget->platformWindow()->glContext(); Q_ASSERT(d->platformContext); - d->default_fbo = d->platformContext->defaultFBO(); d->glFormat = qt_platformwindowformat_to_glformat(d->platformContext->platformWindowFormat()); d->valid =(bool) d->platformContext; } diff --git a/src/opengl/qglpaintdevice.cpp b/src/opengl/qglpaintdevice.cpp index e12fdae..e1dcbfd 100644 --- a/src/opengl/qglpaintdevice.cpp +++ b/src/opengl/qglpaintdevice.cpp @@ -166,12 +166,6 @@ void QGLWidgetGLPaintDevice::setWidget(QGLWidget* w) void QGLWidgetGLPaintDevice::beginPaint() { - // ### This should be in setWidget(), but the context of the QGLWidget - // hasn't been set there yet. -#ifdef Q_WS_QPA - m_thisFBO = context()->d_ptr->platformContext->defaultFBO(); -#endif - QGLPaintDevice::beginPaint(); if (!glWidget->d_func()->disable_clear_on_painter_begin && glWidget->autoFillBackground()) { if (glWidget->testAttribute(Qt::WA_TranslucentBackground)) -- cgit v0.12 From 144f1f710ad46e89a7c07e94f80ac3744ace5c3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 11 Aug 2010 11:07:19 +0200 Subject: Fix typo in glxintegration did actually not reduce the format more than one level, and if that didn't wasnt enough it would end up in an infinite loop. --- src/plugins/platforms/testlite/qglxintegration.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp index ba161c1..fbffcab 100644 --- a/src/plugins/platforms/testlite/qglxintegration.cpp +++ b/src/plugins/platforms/testlite/qglxintegration.cpp @@ -125,9 +125,8 @@ GLXFBConfig QGLXGLContext::findConfig(const MyDisplay *xd, const QPlatformWindow { for (int i = 0; i < confcount; i++) { chosenConfig = configs[i]; - // Make sure we try to get an ARGB visual if the format asked for an alpha: - if (format.alpha()) { + if (reducedFormat.alpha()) { int alphaSize; glXGetFBConfigAttrib(xd->display,configs[i],GLX_ALPHA_SIZE,&alphaSize); if (alphaSize > 0) @@ -139,11 +138,11 @@ GLXFBConfig QGLXGLContext::findConfig(const MyDisplay *xd, const QPlatformWindow XFree(configs); } - reducedFormat = reducePlatformWindowFormat(format,&reduced); + reducedFormat = reducePlatformWindowFormat(reducedFormat,&reduced); } if (!chosenConfig) - qFatal("Warning no context created"); + qWarning("Warning no context created"); return chosenConfig; } -- cgit v0.12 From 660732ed870d584ef704941a4b6a00dc6c84f38e Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 18 Aug 2010 11:02:16 +0200 Subject: Only list activeqt once This caused build errors for the Windows platform. Looks like a merge error introduced in commit 075e96eba50 --- src/src.pro | 1 - 1 file changed, 1 deletion(-) diff --git a/src/src.pro b/src/src.pro index 6118622..94ecb1b 100644 --- a/src/src.pro +++ b/src/src.pro @@ -6,7 +6,6 @@ win32:SRC_SUBDIRS += src_winmain symbian:SRC_SUBDIRS += src_s60main SRC_SUBDIRS += src_corelib src_xml src_network src_sql src_testlib nacl: SRC_SUBDIRS -= src_network src_testlib -win32:SRC_SUBDIRS += src_activeqt !symbian:contains(QT_CONFIG, dbus):SRC_SUBDIRS += src_dbus !contains(QT_CONFIG, no-gui): SRC_SUBDIRS += src_gui !wince*:!symbian:!vxworks:contains(QT_CONFIG, qt3support): SRC_SUBDIRS += src_qt3support -- cgit v0.12 From 411525a29e1d98c5e2a7052307bcd9e386710f26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 18 Aug 2010 11:48:39 +0200 Subject: Lighthouse:Only native children uses setParent --- src/gui/kernel/qwidget_qpa.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp index e11f1fc..b3599bd 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -109,9 +109,11 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO q_createNativeChildrenAndSetParent(q->platformWindow(),q); //if we we have a parent, then set correct parent; - if (QWidget *nativeParent = q->nativeParentWidget()) { - if (nativeParent->platformWindow()) { - platformWindow->setParent(nativeParent->platformWindow()); + if (!q->isWindow()) { + if (QWidget *nativeParent = q->nativeParentWidget()) { + if (nativeParent->platformWindow()) { + platformWindow->setParent(nativeParent->platformWindow()); + } } } -- cgit v0.12 From 9fb2afe3a31da4f08bdd5090a5b4aefd2035a46d Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 18 Aug 2010 12:27:08 +0200 Subject: Compile on Symbian after commit 075e96eba5001 --- src/corelib/thread/qthread_unix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index 16a0a46..f8cf67d 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -465,7 +465,7 @@ void QThread::usleep(unsigned long usecs) // Does some magic and calculate the Unix scheduler priorities // sched_policy is IN/OUT: it must be set to a valid policy before calling this function // sched_priority is OUT only -#if defined(Q_OS_DARWIN) || !defined(Q_OS_OPENBSD) && !defined(Q_OS_SYMBIAN) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING-0 >= 0) +#if defined(Q_OS_DARWIN) || !defined(Q_OS_OPENBSD) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING-0 >= 0) static bool calculateUnixPriority(int priority, int *sched_policy, int *sched_priority) { #ifdef SCHED_IDLE -- cgit v0.12 From c02ad51733d0a2885ddb39cb7e3b09355ab97213 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 18 Aug 2010 12:51:00 +0200 Subject: Work around compile error with g++ for Windows --- src/gui/kernel/qapplication_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 628a041..b4a3f50 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -951,7 +951,7 @@ Q_GLOBAL_STATIC(WinClassNameHash, winclassNames) // const QString qt_reg_winclass(QWidget *w) // register window class { - int flags = w ? w->windowFlags() : 0; + int flags = w ? int(w->windowFlags()) : 0; int type = flags & Qt::WindowType_Mask; uint style; -- cgit v0.12 From 74d519f87e804b624ac76337fe2905d512d363fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 18 Aug 2010 14:22:09 +0200 Subject: Lighthouse: don't force sending key events to the TLW --- src/gui/kernel/qapplication_qpa.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp index b89e81d..e5b5396 100644 --- a/src/gui/kernel/qapplication_qpa.cpp +++ b/src/gui/kernel/qapplication_qpa.cpp @@ -802,9 +802,6 @@ void QApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEven if (app_do_modal && !qt_try_modal(focusW, e->keyType)) return; - if (!focusW->isWindow()) - focusW = focusW->window(); - modifiers = e->modifiers; QKeyEvent ev(e->keyType, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount); QApplication::sendSpontaneousEvent(focusW, &ev); -- cgit v0.12 From 5508ea53b0af0c580dbf7466bf2731dcbad399de Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 20 Aug 2010 10:26:50 +0200 Subject: Clean up lighthouse header files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes configure warnings Reviewed-by: Jørgen --- src/corelib/global/qglobal.h | 2 +- src/corelib/global/qnaclunimplemented.h | 8 ++++++++ src/gui/kernel/qplatformeventloopintegration_qpa.h | 12 +++++++++++- src/gui/kernel/qplatformglcontext_qpa.h | 4 +++- src/gui/kernel/qplatformintegration_qpa.h | 3 ++- src/gui/kernel/qplatformwindow_qpa.h | 2 ++ src/gui/kernel/qplatformwindowformat_qpa.h | 4 +++- src/gui/painting/qplatformcursor_qpa.h | 20 +++++++++++++------- 8 files changed, 43 insertions(+), 12 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 2d37a59..4b25503 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2666,7 +2666,7 @@ QT_LICENSED_MODULE(DBus) #endif #ifdef Q_OS_NACL -#include +#include #endif QT_END_NAMESPACE diff --git a/src/corelib/global/qnaclunimplemented.h b/src/corelib/global/qnaclunimplemented.h index 84085b5..ba43915 100644 --- a/src/corelib/global/qnaclunimplemented.h +++ b/src/corelib/global/qnaclunimplemented.h @@ -50,6 +50,10 @@ #define PTHREAD_CANCEL_ENABLE 2 #define PTHREAD_INHERIT_SCHED 3 +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + extern "C" { void pthread_cleanup_push(void (*handler)(void *), void *arg); @@ -80,6 +84,10 @@ int open64(const char *path, int oflag, ...); int select(int nfds, fd_set * readfds, fd_set * writefds, fd_set * errorfds, struct timeval * timeout); +QT_END_NAMESPACE + +QT_END_HEADER + #endif //Q_OS_NACL #endif //QNACLUNIMPLEMENTED_H diff --git a/src/gui/kernel/qplatformeventloopintegration_qpa.h b/src/gui/kernel/qplatformeventloopintegration_qpa.h index 5e4c227..7343566 100644 --- a/src/gui/kernel/qplatformeventloopintegration_qpa.h +++ b/src/gui/kernel/qplatformeventloopintegration_qpa.h @@ -1,7 +1,13 @@ #ifndef QPLATFORMEVENTLOOPINTEGRATION_QPA_H #define QPLATFORMEVENTLOOPINTEGRATION_QPA_H -#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) class QPlatformEventLoopIntegration { @@ -10,4 +16,8 @@ public: virtual void wakeup() = 0; }; +QT_END_NAMESPACE + +QT_END_HEADER + #endif // QPLATFORMEVENTLOOPINTEGRATION_QPA_H diff --git a/src/gui/kernel/qplatformglcontext_qpa.h b/src/gui/kernel/qplatformglcontext_qpa.h index ff848ed..ed41723 100644 --- a/src/gui/kernel/qplatformglcontext_qpa.h +++ b/src/gui/kernel/qplatformglcontext_qpa.h @@ -43,12 +43,14 @@ #define QPLATFORM_GL_CONTEXT_H #include -#include +#include QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Gui) + class Q_OPENGL_EXPORT QPlatformGLContext { public: diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index 8cecbb4..9460910 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -51,7 +51,8 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -//QT_MODULE(Gui) +QT_MODULE(Gui) + class QPlatformWindow; class QWindowSurface; class QBlittable; diff --git a/src/gui/kernel/qplatformwindow_qpa.h b/src/gui/kernel/qplatformwindow_qpa.h index 2275c02..6dfba05 100644 --- a/src/gui/kernel/qplatformwindow_qpa.h +++ b/src/gui/kernel/qplatformwindow_qpa.h @@ -52,6 +52,8 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Gui) + class QPlatformWindowPrivate; class QWidget; class QPlatformGLContext; diff --git a/src/gui/kernel/qplatformwindowformat_qpa.h b/src/gui/kernel/qplatformwindowformat_qpa.h index 075e796..63df76a 100644 --- a/src/gui/kernel/qplatformwindowformat_qpa.h +++ b/src/gui/kernel/qplatformwindowformat_qpa.h @@ -41,12 +41,14 @@ #ifndef QPLATFORMWINDOWFORMAT_QPA_H #define QPLATFORMWINDOWFORMAT_QPA_H -#include +#include QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Gui) + class QPlatformWindowFormatPrivate; class Q_GUI_EXPORT QPlatformWindowFormat diff --git a/src/gui/painting/qplatformcursor_qpa.h b/src/gui/painting/qplatformcursor_qpa.h index 5f1654d..abdbfee 100644 --- a/src/gui/painting/qplatformcursor_qpa.h +++ b/src/gui/painting/qplatformcursor_qpa.h @@ -41,16 +41,20 @@ #ifndef QGRAPHICSSYSTEMCURSOR_H #define QGRAPHICSSYSTEMCURSOR_H -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +QT_MODULE(Gui) + // Cursor graphics management class Q_GUI_EXPORT QPlatformCursorImage { public: @@ -94,4 +98,6 @@ private: QT_END_NAMESPACE +QT_END_HEADER + #endif // QGRAPHICSSYSTEMCURSOR_H -- cgit v0.12 From 53ce5a08f5a0a4e09ec81486275039afbf76fe3c Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 20 Aug 2010 12:14:34 +0200 Subject: Move qplatformcursor from gui/painting to gui/kernel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Jørgen --- src/gui/kernel/kernel.pri | 6 +- src/gui/kernel/qplatformcursor_qpa.cpp | 664 +++++++++++++++++++++++++++++++ src/gui/kernel/qplatformcursor_qpa.h | 103 +++++ src/gui/painting/painting.pri | 5 +- src/gui/painting/qplatformcursor_qpa.cpp | 664 ------------------------------- src/gui/painting/qplatformcursor_qpa.h | 103 ----- 6 files changed, 772 insertions(+), 773 deletions(-) create mode 100644 src/gui/kernel/qplatformcursor_qpa.cpp create mode 100644 src/gui/kernel/qplatformcursor_qpa.h delete mode 100644 src/gui/painting/qplatformcursor_qpa.cpp delete mode 100644 src/gui/painting/qplatformcursor_qpa.h diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 9941b1b..703a1cb 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -221,7 +221,8 @@ qpa { kernel/qplatformwindowformat_qpa.h \ kernel/qplatformglcontext_qpa.h \ kernel/qdesktopwidget_qpa_p.h \ - kernel/qplatformeventloopintegration_qpa.h + kernel/qplatformeventloopintegration_qpa.h \ + painting/qplatformcursor_qpa.h SOURCES += \ kernel/qapplication_qpa.cpp \ @@ -242,7 +243,8 @@ qpa { kernel/qplatformwindow_qpa.cpp \ kernel/qplatformwindowformat_qpa.cpp \ kernel/qplatformeventloopintegration_qpa.cpp \ - kernel/qplatformglcontext_qpa.cpp + kernel/qplatformglcontext_qpa.cpp \ + painting/qplatformcursor_qpa.cpp contains(QT_CONFIG, glib) { SOURCES += \ diff --git a/src/gui/kernel/qplatformcursor_qpa.cpp b/src/gui/kernel/qplatformcursor_qpa.cpp new file mode 100644 index 0000000..6665396 --- /dev/null +++ b/src/gui/kernel/qplatformcursor_qpa.cpp @@ -0,0 +1,664 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "qplatformcursor_qpa.h" + +#include +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +QList > QPlatformCursorPrivate::instances; + +/*! + \class QGraphicsSystemCursor + + \brief The QGraphicsSystemCursor class provides information about + pointer device events (movement, buttons), and requests to change + the currently displayed cursor. + + Note that QGraphicsSystemCursor does not include any graphics for + display. An application that sets a QCursor may provide its own + graphics. + + \sa QGraphicsSystemCursorImage +*/ + +/*! + \fn virtual void QGraphicsSystemCursor::pointerEvent(const QMouseEvent & event) + + This method is called by Qt whenever a QMouseEvent is generated by the + underlying pointer input. \a event is a reference to the QMouseEvent in + question. A default do-nothing implementation is provided. + + \sa QApplicationPrivate::handleMouseEvent() +*/ + +/*! + \fn virtual void QGraphicsSystemCursor::changeCursor(QCursor * widgetCursor, QWidget * widget) + + \brief This method is called by Qt whenever the cursor graphic should be changed. + + Implementation of this method is mandatory for a subclass of QGraphicsSystemCursor. + + \a widgetCursor is a pointer to the QCursor that should be displayed. + + \a widget is a pointer to the widget currently displayed at QCursor::pos(). Note + that this may be 0 if the current position is not occupied by a displayed widget. + + \sa QApplicationPrivate::handleMouseEvent(), QCursor::pos() +*/ + +/*! + \fn QGraphicsSystemCursor::QGraphicsSystemCursor() + + \brief Constructs a QGraphicsSystemCursor +*/ +QPlatformCursor::QPlatformCursor(QPlatformScreen *scr ) + : screen(scr) +{ + QPlatformCursorPrivate::instances.append(this); +} + +// End of display and pointer event handling code +// Beginning of built-in cursor graphics +// from src/gui/embedded/QGraphicsSystemCursorImage_qws.cpp + +/*! + \class QGraphicsSystemCursorImage + + \brief The QGraphicsSystemCursorImage class provides a set of graphics + intended to be used as cursors. + + \sa QGraphicsSystemCursor +*/ + +static QPlatformCursorImage *systemCursorTable[Qt::LastCursor+1]; +static bool systemCursorTableInit = false; + +// 16 x 16 +static const uchar cur_arrow_bits[] = { + 0x07, 0x00, 0x39, 0x00, 0xc1, 0x01, 0x02, 0x0e, 0x02, 0x10, 0x02, 0x08, + 0x04, 0x04, 0x04, 0x02, 0x04, 0x04, 0x88, 0x08, 0x48, 0x11, 0x28, 0x22, + 0x10, 0x44, 0x00, 0x28, 0x00, 0x10, 0x00, 0x00 }; +static const uchar mcur_arrow_bits[] = { + 0x07, 0x00, 0x3f, 0x00, 0xff, 0x01, 0xfe, 0x0f, 0xfe, 0x1f, 0xfe, 0x0f, + 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x07, 0xf8, 0x0f, 0x78, 0x1f, 0x38, 0x3e, + 0x10, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00, 0x00 }; + +static const unsigned char cur_up_arrow_bits[] = { + 0x80, 0x00, 0x40, 0x01, 0x40, 0x01, 0x20, 0x02, 0x20, 0x02, 0x10, 0x04, + 0x10, 0x04, 0x08, 0x08, 0x78, 0x0f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, + 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01}; +static const unsigned char mcur_up_arrow_bits[] = { + 0x80, 0x00, 0xc0, 0x01, 0xc0, 0x01, 0xe0, 0x03, 0xe0, 0x03, 0xf0, 0x07, + 0xf0, 0x07, 0xf8, 0x0f, 0xf8, 0x0f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01}; + +static const unsigned char cur_cross_bits[] = { + 0xc0, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, + 0x7f, 0x7f, 0x01, 0x40, 0x7f, 0x7f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, + 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01, 0x00, 0x00}; +static const unsigned char mcur_cross_bits[] = { + 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0x00, 0x00}; + +static const uchar cur_ibeam_bits[] = { + 0x00, 0x00, 0xe0, 0x03, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, + 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, + 0x80, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00 }; +static const uchar mcur_ibeam_bits[] = { + 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, + 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0x00, 0x00 }; + +static const uchar cur_ver_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f, + 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00 }; +static const uchar mcur_ver_bits[] = { + 0x00, 0x00, 0x80, 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0xf8, 0x3f, + 0xfc, 0x7f, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xfc, 0x7f, 0xf8, 0x3f, + 0xf0, 0x1f, 0xe0, 0x0f, 0xc0, 0x07, 0x80, 0x03 }; + +static const uchar cur_hor_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x30, 0x18, + 0x38, 0x38, 0xfc, 0x7f, 0xfc, 0x7f, 0x38, 0x38, 0x30, 0x18, 0x20, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar mcur_hor_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x40, 0x04, 0x60, 0x0c, 0x70, 0x1c, 0x78, 0x3c, + 0xfc, 0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfc, 0x7f, 0x78, 0x3c, + 0x70, 0x1c, 0x60, 0x0c, 0x40, 0x04, 0x00, 0x00 }; +static const uchar cur_bdiag_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x3e, 0x00, 0x3c, 0x00, 0x3e, + 0x00, 0x37, 0x88, 0x23, 0xd8, 0x01, 0xf8, 0x00, 0x78, 0x00, 0xf8, 0x00, + 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar mcur_bdiag_bits[] = { + 0x00, 0x00, 0xc0, 0x7f, 0x80, 0x7f, 0x00, 0x7f, 0x00, 0x7e, 0x04, 0x7f, + 0x8c, 0x7f, 0xdc, 0x77, 0xfc, 0x63, 0xfc, 0x41, 0xfc, 0x00, 0xfc, 0x01, + 0xfc, 0x03, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00 }; +static const uchar cur_fdiag_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0xf8, 0x00, 0x78, 0x00, + 0xf8, 0x00, 0xd8, 0x01, 0x88, 0x23, 0x00, 0x37, 0x00, 0x3e, 0x00, 0x3c, + 0x00, 0x3e, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00 }; +static const uchar mcur_fdiag_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x01, 0xfc, 0x00, + 0xfc, 0x41, 0xfc, 0x63, 0xdc, 0x77, 0x8c, 0x7f, 0x04, 0x7f, 0x00, 0x7e, + 0x00, 0x7f, 0x80, 0x7f, 0xc0, 0x7f, 0x00, 0x00 }; +static const uchar cur_blank_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +// 20 x 20 +static const uchar forbidden_bits[] = { + 0x00,0x00,0x00,0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xf0,0x00,0x38,0xc0,0x01, + 0x7c,0x80,0x03,0xec,0x00,0x03,0xce,0x01,0x07,0x86,0x03,0x06,0x06,0x07,0x06, + 0x06,0x0e,0x06,0x06,0x1c,0x06,0x0e,0x38,0x07,0x0c,0x70,0x03,0x1c,0xe0,0x03, + 0x38,0xc0,0x01,0xf0,0xe0,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00,0x00,0x00,0x00 }; + +static const uchar forbiddenm_bits[] = { + 0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xff,0x00,0xf8,0xff,0x01,0xfc,0xf0,0x03, + 0xfe,0xc0,0x07,0xfe,0x81,0x07,0xff,0x83,0x0f,0xcf,0x07,0x0f,0x8f,0x0f,0x0f, + 0x0f,0x1f,0x0f,0x0f,0x3e,0x0f,0x1f,0xfc,0x0f,0x1e,0xf8,0x07,0x3e,0xf0,0x07, + 0xfc,0xe0,0x03,0xf8,0xff,0x01,0xf0,0xff,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00}; + +// 32 x 32 +static const uchar wait_data_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, + 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x08, 0x20, 0x00, + 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, + 0x00, 0x50, 0x15, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x40, 0x05, 0x00, + 0x00, 0x80, 0x02, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x20, 0x08, 0x00, + 0x00, 0x10, 0x10, 0x00, 0x00, 0x08, 0x21, 0x00, 0x00, 0x88, 0x22, 0x00, + 0x00, 0x48, 0x25, 0x00, 0x00, 0xa8, 0x2a, 0x00, 0x00, 0xfc, 0x7f, 0x00, + 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar wait_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, + 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xf8, 0x3f, 0x00, + 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, + 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xc0, 0x07, 0x00, + 0x00, 0x80, 0x03, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0xe0, 0x0f, 0x00, + 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, + 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, + 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +static const uchar hsplit_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x41, 0x82, 0x00, 0x80, 0x41, 0x82, 0x01, 0xc0, 0x7f, 0xfe, 0x03, + 0x80, 0x41, 0x82, 0x01, 0x00, 0x41, 0x82, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, + 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar hsplitm_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, + 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe3, 0xc7, 0x00, + 0x80, 0xe3, 0xc7, 0x01, 0xc0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x07, + 0xc0, 0xff, 0xff, 0x03, 0x80, 0xe3, 0xc7, 0x01, 0x00, 0xe3, 0xc7, 0x00, + 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, + 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar vsplit_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar vsplitm_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, + 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, + 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, + 0x80, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, + 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar phand_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, + 0x7e, 0x04, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x70, 0x08, 0x00, 0x00, + 0x08, 0x08, 0x00, 0x00, 0x70, 0x14, 0x00, 0x00, 0x08, 0x22, 0x00, 0x00, + 0x30, 0x41, 0x00, 0x00, 0xc0, 0x20, 0x00, 0x00, 0x40, 0x12, 0x00, 0x00, + 0x80, 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar phandm_bits[] = { + 0xfe, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, + 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, + 0xfc, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, + 0xf8, 0xff, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, + 0xc0, 0x1f, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +static const uchar size_all_data_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x80, 0x81, 0xc0, 0x00, + 0xc0, 0xff, 0xff, 0x01, 0x80, 0x81, 0xc0, 0x00, 0x00, 0x81, 0x40, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static const uchar size_all_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, + 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc2, 0x21, 0x00, + 0x00, 0xc3, 0x61, 0x00, 0x80, 0xc3, 0xe1, 0x00, 0xc0, 0xff, 0xff, 0x01, + 0xe0, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0x01, 0x80, 0xc3, 0xe1, 0x00, + 0x00, 0xc3, 0x61, 0x00, 0x00, 0xc2, 0x21, 0x00, 0x00, 0xc0, 0x01, 0x00, + 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0xe0, 0x03, 0x00, + 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + +static const uchar whatsthis_bits[] = { + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0xf0, 0x07, 0x00, + 0x09, 0x18, 0x0e, 0x00, 0x11, 0x1c, 0x0e, 0x00, 0x21, 0x1c, 0x0e, 0x00, + 0x41, 0x1c, 0x0e, 0x00, 0x81, 0x1c, 0x0e, 0x00, 0x01, 0x01, 0x07, 0x00, + 0x01, 0x82, 0x03, 0x00, 0xc1, 0xc7, 0x01, 0x00, 0x49, 0xc0, 0x01, 0x00, + 0x95, 0xc0, 0x01, 0x00, 0x93, 0xc0, 0x01, 0x00, 0x21, 0x01, 0x00, 0x00, + 0x20, 0xc1, 0x01, 0x00, 0x40, 0xc2, 0x01, 0x00, 0x40, 0x02, 0x00, 0x00, + 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; +static const uchar whatsthism_bits[] = { + 0x01, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x07, 0x00, 0x07, 0xf8, 0x0f, 0x00, + 0x0f, 0xfc, 0x1f, 0x00, 0x1f, 0x3e, 0x1f, 0x00, 0x3f, 0x3e, 0x1f, 0x00, + 0x7f, 0x3e, 0x1f, 0x00, 0xff, 0x3e, 0x1f, 0x00, 0xff, 0x9d, 0x0f, 0x00, + 0xff, 0xc3, 0x07, 0x00, 0xff, 0xe7, 0x03, 0x00, 0x7f, 0xe0, 0x03, 0x00, + 0xf7, 0xe0, 0x03, 0x00, 0xf3, 0xe0, 0x03, 0x00, 0xe1, 0xe1, 0x03, 0x00, + 0xe0, 0xe1, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, + 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; + +static const uchar busy_bits[] = { + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, + 0x41, 0xe0, 0xff, 0x00, 0x81, 0x20, 0x80, 0x00, 0x01, 0xe1, 0xff, 0x00, + 0x01, 0x42, 0x40, 0x00, 0xc1, 0x47, 0x40, 0x00, 0x49, 0x40, 0x55, 0x00, + 0x95, 0x80, 0x2a, 0x00, 0x93, 0x00, 0x15, 0x00, 0x21, 0x01, 0x0a, 0x00, + 0x20, 0x01, 0x11, 0x00, 0x40, 0x82, 0x20, 0x00, 0x40, 0x42, 0x44, 0x00, + 0x80, 0x41, 0x4a, 0x00, 0x00, 0x40, 0x55, 0x00, 0x00, 0xe0, 0xff, 0x00, + 0x00, 0x20, 0x80, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +static const uchar busym_bits[] = { + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, + 0x7f, 0xe0, 0xff, 0x00, 0xff, 0xe0, 0xff, 0x00, 0xff, 0xe1, 0xff, 0x00, + 0xff, 0xc3, 0x7f, 0x00, 0xff, 0xc7, 0x7f, 0x00, 0x7f, 0xc0, 0x7f, 0x00, + 0xf7, 0x80, 0x3f, 0x00, 0xf3, 0x00, 0x1f, 0x00, 0xe1, 0x01, 0x0e, 0x00, + 0xe0, 0x01, 0x1f, 0x00, 0xc0, 0x83, 0x3f, 0x00, 0xc0, 0xc3, 0x7f, 0x00, + 0x80, 0xc1, 0x7f, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0xe0, 0xff, 0x00, + 0x00, 0xe0, 0xff, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +// 16 x 16 +static const uchar openhand_bits[] = { + 0x80,0x01,0x58,0x0e,0x64,0x12,0x64,0x52,0x48,0xb2,0x48,0x92, + 0x16,0x90,0x19,0x80,0x11,0x40,0x02,0x40,0x04,0x40,0x04,0x20, + 0x08,0x20,0x10,0x10,0x20,0x10,0x00,0x00}; +static const uchar openhandm_bits[] = { + 0x80,0x01,0xd8,0x0f,0xfc,0x1f,0xfc,0x5f,0xf8,0xff,0xf8,0xff, + 0xfe,0xff,0xff,0xff,0xff,0x7f,0xfe,0x7f,0xfc,0x7f,0xfc,0x3f, + 0xf8,0x3f,0xf0,0x1f,0xe0,0x1f,0x00,0x00}; +static const uchar closedhand_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0x48,0x32,0x08,0x50, + 0x10,0x40,0x18,0x40,0x04,0x40,0x04,0x20,0x08,0x20,0x10,0x10, + 0x20,0x10,0x20,0x10,0x00,0x00,0x00,0x00}; +static const uchar closedhandm_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0xf8,0x3f,0xf8,0x7f, + 0xf0,0x7f,0xf8,0x7f,0xfc,0x7f,0xfc,0x3f,0xf8,0x3f,0xf0,0x1f, + 0xe0,0x1f,0xe0,0x1f,0x00,0x00,0x00,0x00}; + +void QPlatformCursorImage::createSystemCursor(int id) +{ + if (!systemCursorTableInit) { + for (int i = 0; i <= Qt::LastCursor; i++) + systemCursorTable[i] = 0; + systemCursorTableInit = true; + } + switch (id) { + // 16x16 cursors + case Qt::ArrowCursor: + systemCursorTable[Qt::ArrowCursor] = + new QPlatformCursorImage(cur_arrow_bits, mcur_arrow_bits, 16, 16, 0, 0); + break; + + case Qt::UpArrowCursor: + systemCursorTable[Qt::UpArrowCursor] = + new QPlatformCursorImage(cur_up_arrow_bits, mcur_up_arrow_bits, 16, 16, 7, 0); + break; + + case Qt::CrossCursor: + systemCursorTable[Qt::CrossCursor] = + new QPlatformCursorImage(cur_cross_bits, mcur_cross_bits, 16, 16, 7, 7); + break; + + case Qt::IBeamCursor: + systemCursorTable[Qt::IBeamCursor] = + new QPlatformCursorImage(cur_ibeam_bits, mcur_ibeam_bits, 16, 16, 7, 7); + break; + + case Qt::SizeVerCursor: + systemCursorTable[Qt::SizeVerCursor] = + new QPlatformCursorImage(cur_ver_bits, mcur_ver_bits, 16, 16, 7, 7); + break; + + case Qt::SizeHorCursor: + systemCursorTable[Qt::SizeHorCursor] = + new QPlatformCursorImage(cur_hor_bits, mcur_hor_bits, 16, 16, 7, 7); + break; + + case Qt::SizeBDiagCursor: + systemCursorTable[Qt::SizeBDiagCursor] = + new QPlatformCursorImage(cur_bdiag_bits, mcur_bdiag_bits, 16, 16, 7, 7); + break; + + case Qt::SizeFDiagCursor: + systemCursorTable[Qt::SizeFDiagCursor] = + new QPlatformCursorImage(cur_fdiag_bits, mcur_fdiag_bits, 16, 16, 7, 7); + break; + + case Qt::BlankCursor: + systemCursorTable[Qt::BlankCursor] = + new QPlatformCursorImage(0, 0, 0, 0, 0, 0); + break; + + // 20x20 cursors + case Qt::ForbiddenCursor: + systemCursorTable[Qt::ForbiddenCursor] = + new QPlatformCursorImage(forbidden_bits, forbiddenm_bits, 20, 20, 10, 10); + break; + + // 32x32 cursors + case Qt::WaitCursor: + systemCursorTable[Qt::WaitCursor] = + new QPlatformCursorImage(wait_data_bits, wait_mask_bits, 32, 32, 15, 15); + break; + + case Qt::SplitVCursor: + systemCursorTable[Qt::SplitVCursor] = + new QPlatformCursorImage(vsplit_bits, vsplitm_bits, 32, 32, 15, 15); + break; + + case Qt::SplitHCursor: + systemCursorTable[Qt::SplitHCursor] = + new QPlatformCursorImage(hsplit_bits, hsplitm_bits, 32, 32, 15, 15); + break; + + case Qt::SizeAllCursor: + systemCursorTable[Qt::SizeAllCursor] = + new QPlatformCursorImage(size_all_data_bits, size_all_mask_bits, 32, 32, 15, 15); + break; + + case Qt::PointingHandCursor: + systemCursorTable[Qt::PointingHandCursor] = + new QPlatformCursorImage(phand_bits, phandm_bits, 32, 32, 0, 0); + break; + + case Qt::WhatsThisCursor: + systemCursorTable[Qt::WhatsThisCursor] = + new QPlatformCursorImage(whatsthis_bits, whatsthism_bits, 32, 32, 0, 0); + break; + case Qt::BusyCursor: + systemCursorTable[Qt::BusyCursor] = + new QPlatformCursorImage(busy_bits, busym_bits, 32, 32, 0, 0); + break; + + case Qt::OpenHandCursor: + systemCursorTable[Qt::OpenHandCursor] = + new QPlatformCursorImage(openhand_bits, openhandm_bits, 16, 16, 8, 8); + break; + case Qt::ClosedHandCursor: + systemCursorTable[Qt::ClosedHandCursor] = + new QPlatformCursorImage(closedhand_bits, closedhandm_bits, 16, 16, 8, 8); + break; + default: + qWarning("Unknown system cursor %d", id); + } +} + +/*! + \fn void QGraphicsSystemCursorImage::set(Qt::CursorShape id) + + \brief Calling this method sets the cursor image to the specified shape + + \a id is one of the defined Qt::CursorShape values. + + If id is invalid, Qt::BitmapCursor, or unknown by the implementation, + Qt::ArrowCursor is used instead. +*/ + +void QPlatformCursorImage::set(Qt::CursorShape id) +{ + QPlatformCursorImage *cursor = 0; + if (id >= 0 && id <= Qt::LastCursor) { + if (!systemCursorTable[id]) + createSystemCursor(id); + cursor = systemCursorTable[id]; + } + + if (cursor == 0) { + if (!systemCursorTable[Qt::ArrowCursor]) + createSystemCursor(Qt::ArrowCursor); + cursor = systemCursorTable[Qt::ArrowCursor]; + } + cursorImage = cursor->cursorImage; + hot = cursor->hot; +} + +/*! + \fn void QGraphicsSystemCursorImage::set(const QImage * image, int hx, int hy) + + \brief Set the cursor image to the specified QImage, with the hotsport at (hx, hy) + + \a image A pointer to a QImage + + \a hx The x coordinate of the cursor's hotspot + + \a hy the y coordinate of the cursor's hotspot +*/ + +void QPlatformCursorImage::set(const QImage * image, int hx, int hy) +{ + hot.setX(hx); + hot.setY(hy); + cursorImage = *image; +} + +/*! + \fn void QGraphicsSystemCursorImage::set(const uchar *data, const uchar *mask, int width, int height, int hx, int hy) + + \brief set the cursor image to the graphic represented by the combination of data, mask, + width, and height + + \a data The pixel data of the graphic + + \a mask Mask data for the graphic. pixels in data with a corresponding mask bit of 0 are not drawn + + \a width The width of the graphic in pixels + + \a height The height of the graphic in pixels + + \a hx The X hotspot of the cursor graphic + + \a hy The Y hotspot of the cursor graphic +*/ +void QPlatformCursorImage::set(const uchar *data, const uchar *mask, + int width, int height, int hx, int hy) +{ + hot.setX(hx); + hot.setY(hy); + + cursorImage = QImage(width,height, QImage::Format_Indexed8); + + if (!width || !height || !data || !mask || cursorImage.isNull()) + return; + + cursorImage.setNumColors(3); + cursorImage.setColor(0, 0xff000000); + cursorImage.setColor(1, 0xffffffff); + cursorImage.setColor(2, 0x00000000); + + int bytesPerLine = (width + 7) / 8; + int p = 0; + int d, m; + + int x = -1, w = 0; + + uchar *cursor_data = cursorImage.bits(); + int bpl = cursorImage.bytesPerLine(); + for (int i = 0; i < height; i++) + { + for (int j = 0; j < bytesPerLine; j++, data++, mask++) + { + for (int b = 0; b < 8 && j*8+b < width; b++) + { + d = *data & (1 << b); + m = *mask & (1 << b); + if (d && m) p = 0; + else if (!d && m) p = 1; + else p = 2; + cursor_data[j*8+b] = p; + + // calc region + if (x < 0 && m) + x = j*8+b; + else if (x >= 0 && !m) { + x = -1; + w = 0; + } + if (m) + w++; + } + } + if (x >= 0) { + x = -1; + w = 0; + } + cursor_data += bpl; + } + +} + +/*! + \fn QGraphicsSystemCursorImage::QGraphicsSystemCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) + + \brief set the cursor image to the graphic represented by the combination of data, mask, + width, and height + + \a data The pixel data of the graphic + + \a mask Mask data for the graphic. pixels in data with a corresponding mask bit of 0 are not drawn + + \a width The width of the graphic in pixels + + \a height The height of the graphic in pixels + + \a hotX The X hotspot of the cursor graphic + + \a hotY The Y hotspot of the cursor graphic + + \sa set +*/ + +/*! + \fn QImage *QGraphicsSystemCursorImage::image() + + \brief Return the cursor graphic as a pointer to a QImage +*/ + +/*! + \fn QPoint QGraphicsSystemCursorImage::hotspot() + + \brief Return the cursor's hotspot +*/ + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformcursor_qpa.h b/src/gui/kernel/qplatformcursor_qpa.h new file mode 100644 index 0000000..abdbfee --- /dev/null +++ b/src/gui/kernel/qplatformcursor_qpa.h @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QGRAPHICSSYSTEMCURSOR_H +#define QGRAPHICSSYSTEMCURSOR_H + +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +// Cursor graphics management +class Q_GUI_EXPORT QPlatformCursorImage { +public: + QPlatformCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) + { set(data, mask, width, height, hotX, hotY); } + QImage * image() { return &cursorImage; } + QPoint hotspot() { return hot; } + void set(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); + void set(const QImage * image, int hx, int hy); + void set(Qt::CursorShape); +private: + static void createSystemCursor(int id); + QImage cursorImage; + QPoint hot; +}; + +class QPlatformCursor; + +class QPlatformCursorPrivate { +public: + static QList > getInstances() { return instances; } + static QList > instances; +}; + +class Q_GUI_EXPORT QPlatformCursor : public QObject { +public: + QPlatformCursor(QPlatformScreen *); + + // input methods + virtual void pointerEvent(const QMouseEvent & event) { Q_UNUSED(event); } + virtual void changeCursor(QCursor * widgetCursor, QWidget * widget) = 0; + +protected: + QPlatformScreen* screen; // Where to request an update + +private: + Q_DECLARE_PRIVATE(QPlatformCursor); + friend void qt_qpa_set_cursor(QWidget * w, bool force); + friend class QApplicationPrivate; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QGRAPHICSSYSTEMCURSOR_H diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 1f76b6f..088ad42 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -188,10 +188,7 @@ embedded { qpa { SOURCES += \ painting/qcolormap_qpa.cpp \ - painting/qpaintdevice_qpa.cpp \ - painting/qplatformcursor_qpa.cpp - HEADERS += \ - painting/qplatformcursor_qpa.h + painting/qpaintdevice_qpa.cpp } symbian { diff --git a/src/gui/painting/qplatformcursor_qpa.cpp b/src/gui/painting/qplatformcursor_qpa.cpp deleted file mode 100644 index 6665396..0000000 --- a/src/gui/painting/qplatformcursor_qpa.cpp +++ /dev/null @@ -1,664 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qplatformcursor_qpa.h" - -#include -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -QList > QPlatformCursorPrivate::instances; - -/*! - \class QGraphicsSystemCursor - - \brief The QGraphicsSystemCursor class provides information about - pointer device events (movement, buttons), and requests to change - the currently displayed cursor. - - Note that QGraphicsSystemCursor does not include any graphics for - display. An application that sets a QCursor may provide its own - graphics. - - \sa QGraphicsSystemCursorImage -*/ - -/*! - \fn virtual void QGraphicsSystemCursor::pointerEvent(const QMouseEvent & event) - - This method is called by Qt whenever a QMouseEvent is generated by the - underlying pointer input. \a event is a reference to the QMouseEvent in - question. A default do-nothing implementation is provided. - - \sa QApplicationPrivate::handleMouseEvent() -*/ - -/*! - \fn virtual void QGraphicsSystemCursor::changeCursor(QCursor * widgetCursor, QWidget * widget) - - \brief This method is called by Qt whenever the cursor graphic should be changed. - - Implementation of this method is mandatory for a subclass of QGraphicsSystemCursor. - - \a widgetCursor is a pointer to the QCursor that should be displayed. - - \a widget is a pointer to the widget currently displayed at QCursor::pos(). Note - that this may be 0 if the current position is not occupied by a displayed widget. - - \sa QApplicationPrivate::handleMouseEvent(), QCursor::pos() -*/ - -/*! - \fn QGraphicsSystemCursor::QGraphicsSystemCursor() - - \brief Constructs a QGraphicsSystemCursor -*/ -QPlatformCursor::QPlatformCursor(QPlatformScreen *scr ) - : screen(scr) -{ - QPlatformCursorPrivate::instances.append(this); -} - -// End of display and pointer event handling code -// Beginning of built-in cursor graphics -// from src/gui/embedded/QGraphicsSystemCursorImage_qws.cpp - -/*! - \class QGraphicsSystemCursorImage - - \brief The QGraphicsSystemCursorImage class provides a set of graphics - intended to be used as cursors. - - \sa QGraphicsSystemCursor -*/ - -static QPlatformCursorImage *systemCursorTable[Qt::LastCursor+1]; -static bool systemCursorTableInit = false; - -// 16 x 16 -static const uchar cur_arrow_bits[] = { - 0x07, 0x00, 0x39, 0x00, 0xc1, 0x01, 0x02, 0x0e, 0x02, 0x10, 0x02, 0x08, - 0x04, 0x04, 0x04, 0x02, 0x04, 0x04, 0x88, 0x08, 0x48, 0x11, 0x28, 0x22, - 0x10, 0x44, 0x00, 0x28, 0x00, 0x10, 0x00, 0x00 }; -static const uchar mcur_arrow_bits[] = { - 0x07, 0x00, 0x3f, 0x00, 0xff, 0x01, 0xfe, 0x0f, 0xfe, 0x1f, 0xfe, 0x0f, - 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x07, 0xf8, 0x0f, 0x78, 0x1f, 0x38, 0x3e, - 0x10, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00, 0x00 }; - -static const unsigned char cur_up_arrow_bits[] = { - 0x80, 0x00, 0x40, 0x01, 0x40, 0x01, 0x20, 0x02, 0x20, 0x02, 0x10, 0x04, - 0x10, 0x04, 0x08, 0x08, 0x78, 0x0f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, - 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01}; -static const unsigned char mcur_up_arrow_bits[] = { - 0x80, 0x00, 0xc0, 0x01, 0xc0, 0x01, 0xe0, 0x03, 0xe0, 0x03, 0xf0, 0x07, - 0xf0, 0x07, 0xf8, 0x0f, 0xf8, 0x0f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, - 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01}; - -static const unsigned char cur_cross_bits[] = { - 0xc0, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, - 0x7f, 0x7f, 0x01, 0x40, 0x7f, 0x7f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, - 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01, 0x00, 0x00}; -static const unsigned char mcur_cross_bits[] = { - 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, - 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, - 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0x00, 0x00}; - -static const uchar cur_ibeam_bits[] = { - 0x00, 0x00, 0xe0, 0x03, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, - 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, - 0x80, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00 }; -static const uchar mcur_ibeam_bits[] = { - 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, - 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, - 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0x00, 0x00 }; - -static const uchar cur_ver_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, - 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f, - 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00 }; -static const uchar mcur_ver_bits[] = { - 0x00, 0x00, 0x80, 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0xf8, 0x3f, - 0xfc, 0x7f, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xfc, 0x7f, 0xf8, 0x3f, - 0xf0, 0x1f, 0xe0, 0x0f, 0xc0, 0x07, 0x80, 0x03 }; - -static const uchar cur_hor_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x30, 0x18, - 0x38, 0x38, 0xfc, 0x7f, 0xfc, 0x7f, 0x38, 0x38, 0x30, 0x18, 0x20, 0x08, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar mcur_hor_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x40, 0x04, 0x60, 0x0c, 0x70, 0x1c, 0x78, 0x3c, - 0xfc, 0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfc, 0x7f, 0x78, 0x3c, - 0x70, 0x1c, 0x60, 0x0c, 0x40, 0x04, 0x00, 0x00 }; -static const uchar cur_bdiag_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x3e, 0x00, 0x3c, 0x00, 0x3e, - 0x00, 0x37, 0x88, 0x23, 0xd8, 0x01, 0xf8, 0x00, 0x78, 0x00, 0xf8, 0x00, - 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar mcur_bdiag_bits[] = { - 0x00, 0x00, 0xc0, 0x7f, 0x80, 0x7f, 0x00, 0x7f, 0x00, 0x7e, 0x04, 0x7f, - 0x8c, 0x7f, 0xdc, 0x77, 0xfc, 0x63, 0xfc, 0x41, 0xfc, 0x00, 0xfc, 0x01, - 0xfc, 0x03, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00 }; -static const uchar cur_fdiag_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0xf8, 0x00, 0x78, 0x00, - 0xf8, 0x00, 0xd8, 0x01, 0x88, 0x23, 0x00, 0x37, 0x00, 0x3e, 0x00, 0x3c, - 0x00, 0x3e, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00 }; -static const uchar mcur_fdiag_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x01, 0xfc, 0x00, - 0xfc, 0x41, 0xfc, 0x63, 0xdc, 0x77, 0x8c, 0x7f, 0x04, 0x7f, 0x00, 0x7e, - 0x00, 0x7f, 0x80, 0x7f, 0xc0, 0x7f, 0x00, 0x00 }; -static const uchar cur_blank_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -// 20 x 20 -static const uchar forbidden_bits[] = { - 0x00,0x00,0x00,0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xf0,0x00,0x38,0xc0,0x01, - 0x7c,0x80,0x03,0xec,0x00,0x03,0xce,0x01,0x07,0x86,0x03,0x06,0x06,0x07,0x06, - 0x06,0x0e,0x06,0x06,0x1c,0x06,0x0e,0x38,0x07,0x0c,0x70,0x03,0x1c,0xe0,0x03, - 0x38,0xc0,0x01,0xf0,0xe0,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00,0x00,0x00,0x00 }; - -static const uchar forbiddenm_bits[] = { - 0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xff,0x00,0xf8,0xff,0x01,0xfc,0xf0,0x03, - 0xfe,0xc0,0x07,0xfe,0x81,0x07,0xff,0x83,0x0f,0xcf,0x07,0x0f,0x8f,0x0f,0x0f, - 0x0f,0x1f,0x0f,0x0f,0x3e,0x0f,0x1f,0xfc,0x0f,0x1e,0xf8,0x07,0x3e,0xf0,0x07, - 0xfc,0xe0,0x03,0xf8,0xff,0x01,0xf0,0xff,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00}; - -// 32 x 32 -static const uchar wait_data_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, - 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x08, 0x20, 0x00, - 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, - 0x00, 0x50, 0x15, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x40, 0x05, 0x00, - 0x00, 0x80, 0x02, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x20, 0x08, 0x00, - 0x00, 0x10, 0x10, 0x00, 0x00, 0x08, 0x21, 0x00, 0x00, 0x88, 0x22, 0x00, - 0x00, 0x48, 0x25, 0x00, 0x00, 0xa8, 0x2a, 0x00, 0x00, 0xfc, 0x7f, 0x00, - 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar wait_mask_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, - 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xf8, 0x3f, 0x00, - 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, - 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xc0, 0x07, 0x00, - 0x00, 0x80, 0x03, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0xe0, 0x0f, 0x00, - 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, - 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, - 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -static const uchar hsplit_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, - 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, - 0x00, 0x41, 0x82, 0x00, 0x80, 0x41, 0x82, 0x01, 0xc0, 0x7f, 0xfe, 0x03, - 0x80, 0x41, 0x82, 0x01, 0x00, 0x41, 0x82, 0x00, 0x00, 0x40, 0x02, 0x00, - 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, - 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar hsplitm_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, - 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe3, 0xc7, 0x00, - 0x80, 0xe3, 0xc7, 0x01, 0xc0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x07, - 0xc0, 0xff, 0xff, 0x03, 0x80, 0xe3, 0xc7, 0x01, 0x00, 0xe3, 0xc7, 0x00, - 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, - 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar vsplit_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar vsplitm_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, - 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, - 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, - 0x80, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, - 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar phand_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, - 0x7e, 0x04, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x70, 0x08, 0x00, 0x00, - 0x08, 0x08, 0x00, 0x00, 0x70, 0x14, 0x00, 0x00, 0x08, 0x22, 0x00, 0x00, - 0x30, 0x41, 0x00, 0x00, 0xc0, 0x20, 0x00, 0x00, 0x40, 0x12, 0x00, 0x00, - 0x80, 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar phandm_bits[] = { - 0xfe, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, - 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, - 0xfc, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, - 0xf8, 0xff, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, - 0xc0, 0x1f, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, - 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -static const uchar size_all_data_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x80, 0x81, 0xc0, 0x00, - 0xc0, 0xff, 0xff, 0x01, 0x80, 0x81, 0xc0, 0x00, 0x00, 0x81, 0x40, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const uchar size_all_mask_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, - 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc2, 0x21, 0x00, - 0x00, 0xc3, 0x61, 0x00, 0x80, 0xc3, 0xe1, 0x00, 0xc0, 0xff, 0xff, 0x01, - 0xe0, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0x01, 0x80, 0xc3, 0xe1, 0x00, - 0x00, 0xc3, 0x61, 0x00, 0x00, 0xc2, 0x21, 0x00, 0x00, 0xc0, 0x01, 0x00, - 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0xe0, 0x03, 0x00, - 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -static const uchar whatsthis_bits[] = { - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0xf0, 0x07, 0x00, - 0x09, 0x18, 0x0e, 0x00, 0x11, 0x1c, 0x0e, 0x00, 0x21, 0x1c, 0x0e, 0x00, - 0x41, 0x1c, 0x0e, 0x00, 0x81, 0x1c, 0x0e, 0x00, 0x01, 0x01, 0x07, 0x00, - 0x01, 0x82, 0x03, 0x00, 0xc1, 0xc7, 0x01, 0x00, 0x49, 0xc0, 0x01, 0x00, - 0x95, 0xc0, 0x01, 0x00, 0x93, 0xc0, 0x01, 0x00, 0x21, 0x01, 0x00, 0x00, - 0x20, 0xc1, 0x01, 0x00, 0x40, 0xc2, 0x01, 0x00, 0x40, 0x02, 0x00, 0x00, - 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -static const uchar whatsthism_bits[] = { - 0x01, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x07, 0x00, 0x07, 0xf8, 0x0f, 0x00, - 0x0f, 0xfc, 0x1f, 0x00, 0x1f, 0x3e, 0x1f, 0x00, 0x3f, 0x3e, 0x1f, 0x00, - 0x7f, 0x3e, 0x1f, 0x00, 0xff, 0x3e, 0x1f, 0x00, 0xff, 0x9d, 0x0f, 0x00, - 0xff, 0xc3, 0x07, 0x00, 0xff, 0xe7, 0x03, 0x00, 0x7f, 0xe0, 0x03, 0x00, - 0xf7, 0xe0, 0x03, 0x00, 0xf3, 0xe0, 0x03, 0x00, 0xe1, 0xe1, 0x03, 0x00, - 0xe0, 0xe1, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, - 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; - -static const uchar busy_bits[] = { - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x09, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, - 0x41, 0xe0, 0xff, 0x00, 0x81, 0x20, 0x80, 0x00, 0x01, 0xe1, 0xff, 0x00, - 0x01, 0x42, 0x40, 0x00, 0xc1, 0x47, 0x40, 0x00, 0x49, 0x40, 0x55, 0x00, - 0x95, 0x80, 0x2a, 0x00, 0x93, 0x00, 0x15, 0x00, 0x21, 0x01, 0x0a, 0x00, - 0x20, 0x01, 0x11, 0x00, 0x40, 0x82, 0x20, 0x00, 0x40, 0x42, 0x44, 0x00, - 0x80, 0x41, 0x4a, 0x00, 0x00, 0x40, 0x55, 0x00, 0x00, 0xe0, 0xff, 0x00, - 0x00, 0x20, 0x80, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -static const uchar busym_bits[] = { - 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, - 0x7f, 0xe0, 0xff, 0x00, 0xff, 0xe0, 0xff, 0x00, 0xff, 0xe1, 0xff, 0x00, - 0xff, 0xc3, 0x7f, 0x00, 0xff, 0xc7, 0x7f, 0x00, 0x7f, 0xc0, 0x7f, 0x00, - 0xf7, 0x80, 0x3f, 0x00, 0xf3, 0x00, 0x1f, 0x00, 0xe1, 0x01, 0x0e, 0x00, - 0xe0, 0x01, 0x1f, 0x00, 0xc0, 0x83, 0x3f, 0x00, 0xc0, 0xc3, 0x7f, 0x00, - 0x80, 0xc1, 0x7f, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0xe0, 0xff, 0x00, - 0x00, 0xe0, 0xff, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -// 16 x 16 -static const uchar openhand_bits[] = { - 0x80,0x01,0x58,0x0e,0x64,0x12,0x64,0x52,0x48,0xb2,0x48,0x92, - 0x16,0x90,0x19,0x80,0x11,0x40,0x02,0x40,0x04,0x40,0x04,0x20, - 0x08,0x20,0x10,0x10,0x20,0x10,0x00,0x00}; -static const uchar openhandm_bits[] = { - 0x80,0x01,0xd8,0x0f,0xfc,0x1f,0xfc,0x5f,0xf8,0xff,0xf8,0xff, - 0xfe,0xff,0xff,0xff,0xff,0x7f,0xfe,0x7f,0xfc,0x7f,0xfc,0x3f, - 0xf8,0x3f,0xf0,0x1f,0xe0,0x1f,0x00,0x00}; -static const uchar closedhand_bits[] = { - 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0x48,0x32,0x08,0x50, - 0x10,0x40,0x18,0x40,0x04,0x40,0x04,0x20,0x08,0x20,0x10,0x10, - 0x20,0x10,0x20,0x10,0x00,0x00,0x00,0x00}; -static const uchar closedhandm_bits[] = { - 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0xf8,0x3f,0xf8,0x7f, - 0xf0,0x7f,0xf8,0x7f,0xfc,0x7f,0xfc,0x3f,0xf8,0x3f,0xf0,0x1f, - 0xe0,0x1f,0xe0,0x1f,0x00,0x00,0x00,0x00}; - -void QPlatformCursorImage::createSystemCursor(int id) -{ - if (!systemCursorTableInit) { - for (int i = 0; i <= Qt::LastCursor; i++) - systemCursorTable[i] = 0; - systemCursorTableInit = true; - } - switch (id) { - // 16x16 cursors - case Qt::ArrowCursor: - systemCursorTable[Qt::ArrowCursor] = - new QPlatformCursorImage(cur_arrow_bits, mcur_arrow_bits, 16, 16, 0, 0); - break; - - case Qt::UpArrowCursor: - systemCursorTable[Qt::UpArrowCursor] = - new QPlatformCursorImage(cur_up_arrow_bits, mcur_up_arrow_bits, 16, 16, 7, 0); - break; - - case Qt::CrossCursor: - systemCursorTable[Qt::CrossCursor] = - new QPlatformCursorImage(cur_cross_bits, mcur_cross_bits, 16, 16, 7, 7); - break; - - case Qt::IBeamCursor: - systemCursorTable[Qt::IBeamCursor] = - new QPlatformCursorImage(cur_ibeam_bits, mcur_ibeam_bits, 16, 16, 7, 7); - break; - - case Qt::SizeVerCursor: - systemCursorTable[Qt::SizeVerCursor] = - new QPlatformCursorImage(cur_ver_bits, mcur_ver_bits, 16, 16, 7, 7); - break; - - case Qt::SizeHorCursor: - systemCursorTable[Qt::SizeHorCursor] = - new QPlatformCursorImage(cur_hor_bits, mcur_hor_bits, 16, 16, 7, 7); - break; - - case Qt::SizeBDiagCursor: - systemCursorTable[Qt::SizeBDiagCursor] = - new QPlatformCursorImage(cur_bdiag_bits, mcur_bdiag_bits, 16, 16, 7, 7); - break; - - case Qt::SizeFDiagCursor: - systemCursorTable[Qt::SizeFDiagCursor] = - new QPlatformCursorImage(cur_fdiag_bits, mcur_fdiag_bits, 16, 16, 7, 7); - break; - - case Qt::BlankCursor: - systemCursorTable[Qt::BlankCursor] = - new QPlatformCursorImage(0, 0, 0, 0, 0, 0); - break; - - // 20x20 cursors - case Qt::ForbiddenCursor: - systemCursorTable[Qt::ForbiddenCursor] = - new QPlatformCursorImage(forbidden_bits, forbiddenm_bits, 20, 20, 10, 10); - break; - - // 32x32 cursors - case Qt::WaitCursor: - systemCursorTable[Qt::WaitCursor] = - new QPlatformCursorImage(wait_data_bits, wait_mask_bits, 32, 32, 15, 15); - break; - - case Qt::SplitVCursor: - systemCursorTable[Qt::SplitVCursor] = - new QPlatformCursorImage(vsplit_bits, vsplitm_bits, 32, 32, 15, 15); - break; - - case Qt::SplitHCursor: - systemCursorTable[Qt::SplitHCursor] = - new QPlatformCursorImage(hsplit_bits, hsplitm_bits, 32, 32, 15, 15); - break; - - case Qt::SizeAllCursor: - systemCursorTable[Qt::SizeAllCursor] = - new QPlatformCursorImage(size_all_data_bits, size_all_mask_bits, 32, 32, 15, 15); - break; - - case Qt::PointingHandCursor: - systemCursorTable[Qt::PointingHandCursor] = - new QPlatformCursorImage(phand_bits, phandm_bits, 32, 32, 0, 0); - break; - - case Qt::WhatsThisCursor: - systemCursorTable[Qt::WhatsThisCursor] = - new QPlatformCursorImage(whatsthis_bits, whatsthism_bits, 32, 32, 0, 0); - break; - case Qt::BusyCursor: - systemCursorTable[Qt::BusyCursor] = - new QPlatformCursorImage(busy_bits, busym_bits, 32, 32, 0, 0); - break; - - case Qt::OpenHandCursor: - systemCursorTable[Qt::OpenHandCursor] = - new QPlatformCursorImage(openhand_bits, openhandm_bits, 16, 16, 8, 8); - break; - case Qt::ClosedHandCursor: - systemCursorTable[Qt::ClosedHandCursor] = - new QPlatformCursorImage(closedhand_bits, closedhandm_bits, 16, 16, 8, 8); - break; - default: - qWarning("Unknown system cursor %d", id); - } -} - -/*! - \fn void QGraphicsSystemCursorImage::set(Qt::CursorShape id) - - \brief Calling this method sets the cursor image to the specified shape - - \a id is one of the defined Qt::CursorShape values. - - If id is invalid, Qt::BitmapCursor, or unknown by the implementation, - Qt::ArrowCursor is used instead. -*/ - -void QPlatformCursorImage::set(Qt::CursorShape id) -{ - QPlatformCursorImage *cursor = 0; - if (id >= 0 && id <= Qt::LastCursor) { - if (!systemCursorTable[id]) - createSystemCursor(id); - cursor = systemCursorTable[id]; - } - - if (cursor == 0) { - if (!systemCursorTable[Qt::ArrowCursor]) - createSystemCursor(Qt::ArrowCursor); - cursor = systemCursorTable[Qt::ArrowCursor]; - } - cursorImage = cursor->cursorImage; - hot = cursor->hot; -} - -/*! - \fn void QGraphicsSystemCursorImage::set(const QImage * image, int hx, int hy) - - \brief Set the cursor image to the specified QImage, with the hotsport at (hx, hy) - - \a image A pointer to a QImage - - \a hx The x coordinate of the cursor's hotspot - - \a hy the y coordinate of the cursor's hotspot -*/ - -void QPlatformCursorImage::set(const QImage * image, int hx, int hy) -{ - hot.setX(hx); - hot.setY(hy); - cursorImage = *image; -} - -/*! - \fn void QGraphicsSystemCursorImage::set(const uchar *data, const uchar *mask, int width, int height, int hx, int hy) - - \brief set the cursor image to the graphic represented by the combination of data, mask, - width, and height - - \a data The pixel data of the graphic - - \a mask Mask data for the graphic. pixels in data with a corresponding mask bit of 0 are not drawn - - \a width The width of the graphic in pixels - - \a height The height of the graphic in pixels - - \a hx The X hotspot of the cursor graphic - - \a hy The Y hotspot of the cursor graphic -*/ -void QPlatformCursorImage::set(const uchar *data, const uchar *mask, - int width, int height, int hx, int hy) -{ - hot.setX(hx); - hot.setY(hy); - - cursorImage = QImage(width,height, QImage::Format_Indexed8); - - if (!width || !height || !data || !mask || cursorImage.isNull()) - return; - - cursorImage.setNumColors(3); - cursorImage.setColor(0, 0xff000000); - cursorImage.setColor(1, 0xffffffff); - cursorImage.setColor(2, 0x00000000); - - int bytesPerLine = (width + 7) / 8; - int p = 0; - int d, m; - - int x = -1, w = 0; - - uchar *cursor_data = cursorImage.bits(); - int bpl = cursorImage.bytesPerLine(); - for (int i = 0; i < height; i++) - { - for (int j = 0; j < bytesPerLine; j++, data++, mask++) - { - for (int b = 0; b < 8 && j*8+b < width; b++) - { - d = *data & (1 << b); - m = *mask & (1 << b); - if (d && m) p = 0; - else if (!d && m) p = 1; - else p = 2; - cursor_data[j*8+b] = p; - - // calc region - if (x < 0 && m) - x = j*8+b; - else if (x >= 0 && !m) { - x = -1; - w = 0; - } - if (m) - w++; - } - } - if (x >= 0) { - x = -1; - w = 0; - } - cursor_data += bpl; - } - -} - -/*! - \fn QGraphicsSystemCursorImage::QGraphicsSystemCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) - - \brief set the cursor image to the graphic represented by the combination of data, mask, - width, and height - - \a data The pixel data of the graphic - - \a mask Mask data for the graphic. pixels in data with a corresponding mask bit of 0 are not drawn - - \a width The width of the graphic in pixels - - \a height The height of the graphic in pixels - - \a hotX The X hotspot of the cursor graphic - - \a hotY The Y hotspot of the cursor graphic - - \sa set -*/ - -/*! - \fn QImage *QGraphicsSystemCursorImage::image() - - \brief Return the cursor graphic as a pointer to a QImage -*/ - -/*! - \fn QPoint QGraphicsSystemCursorImage::hotspot() - - \brief Return the cursor's hotspot -*/ - -QT_END_NAMESPACE diff --git a/src/gui/painting/qplatformcursor_qpa.h b/src/gui/painting/qplatformcursor_qpa.h deleted file mode 100644 index abdbfee..0000000 --- a/src/gui/painting/qplatformcursor_qpa.h +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QGRAPHICSSYSTEMCURSOR_H -#define QGRAPHICSSYSTEMCURSOR_H - -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -// Cursor graphics management -class Q_GUI_EXPORT QPlatformCursorImage { -public: - QPlatformCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) - { set(data, mask, width, height, hotX, hotY); } - QImage * image() { return &cursorImage; } - QPoint hotspot() { return hot; } - void set(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); - void set(const QImage * image, int hx, int hy); - void set(Qt::CursorShape); -private: - static void createSystemCursor(int id); - QImage cursorImage; - QPoint hot; -}; - -class QPlatformCursor; - -class QPlatformCursorPrivate { -public: - static QList > getInstances() { return instances; } - static QList > instances; -}; - -class Q_GUI_EXPORT QPlatformCursor : public QObject { -public: - QPlatformCursor(QPlatformScreen *); - - // input methods - virtual void pointerEvent(const QMouseEvent & event) { Q_UNUSED(event); } - virtual void changeCursor(QCursor * widgetCursor, QWidget * widget) = 0; - -protected: - QPlatformScreen* screen; // Where to request an update - -private: - Q_DECLARE_PRIVATE(QPlatformCursor); - friend void qt_qpa_set_cursor(QWidget * w, bool force); - friend class QApplicationPrivate; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QGRAPHICSSYSTEMCURSOR_H -- cgit v0.12 From c0c2e556e98ffe550cbedb4e3a0def5dd272ce25 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 25 Aug 2010 11:31:15 +0200 Subject: qdrawhelper: fix assert in fetchTransformedBilinear There can be rounding errors. Reviewed-by: paul --- src/gui/painting/qdrawhelper.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index d6beb72..c5704fb 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -747,7 +747,6 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator * if (fdx <= fixed_scale && fdx > 0) { // scale up on X int disty = (fy & 0x0000ffff) >> 8; int idisty = 256 - disty; - int count = length * data->m11 + 2; int x = fx >> 16; // The idea is first to do the interpolation between the row s1 and the row s2 @@ -756,7 +755,9 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator * // intermediate_buffer[0] is a buffer of red-blue component of the pixel, in the form 0x00RR00BB // intermediate_buffer[1] is the alpha-green component of the pixel, in the form 0x00AA00GG quint32 intermediate_buffer[2][buffer_size + 2]; - Q_ASSERT(length * data->m11 <= buffer_size); + // count is the size used in the intermediate_buffer. + int count = qCeil(length * data->m11) + 2; //+1 for the last pixel to interpolate with, and +1 for rounding errors. + Q_ASSERT(count <= buffer_size + 2); //length is supposed to be <= buffer_size and data->m11 < 1 in this case int f = 0; int lim = count; if (blendType == BlendTransformedBilinearTiled) { -- cgit v0.12 From deef2e16776c171d4b033257cd4fc3ab2bd005a3 Mon Sep 17 00:00:00 2001 From: aavit Date: Wed, 25 Aug 2010 13:49:34 +0200 Subject: First shot at a new client-server based autotest of the Arthur 2D rendering system, based on the lance test tool. Hence dubbed lancelot. --- tests/arthur/baselineserver/bin/runserver | 6 + tests/arthur/baselineserver/src/baselineserver.cpp | 188 +++++++ tests/arthur/baselineserver/src/baselineserver.h | 74 +++ tests/arthur/baselineserver/src/baselineserver.pro | 25 + tests/arthur/baselineserver/src/main.cpp | 16 + tests/arthur/common/baselineprotocol.cpp | 219 ++++++++ tests/arthur/common/baselineprotocol.h | 76 +++ tests/arthur/common/baselineprotocol.pri | 9 + tests/auto/lancelot/lancelot.pro | 10 + tests/auto/lancelot/scripts/aliasing.qps | 156 ++++++ tests/auto/lancelot/scripts/arcs.qps | 68 +++ tests/auto/lancelot/scripts/arcs2.qps | 47 ++ tests/auto/lancelot/scripts/background.qps | 136 +++++ tests/auto/lancelot/scripts/background_brush.qps | 5 + tests/auto/lancelot/scripts/beziers.qps | 147 ++++++ tests/auto/lancelot/scripts/bitmaps.qps | 166 ++++++ tests/auto/lancelot/scripts/borderimage.qps | 120 +++++ tests/auto/lancelot/scripts/brush_pens.qps | 104 ++++ tests/auto/lancelot/scripts/brushes.qps | 79 +++ tests/auto/lancelot/scripts/clippaths.qps | 60 +++ tests/auto/lancelot/scripts/clipping.qps | 182 +++++++ tests/auto/lancelot/scripts/clipping_state.qps | 47 ++ tests/auto/lancelot/scripts/cliprects.qps | 59 +++ tests/auto/lancelot/scripts/conical_gradients.qps | 85 ++++ .../scripts/conical_gradients_perspectives.qps | 64 +++ tests/auto/lancelot/scripts/dashes.qps | 268 ++++++++++ tests/auto/lancelot/scripts/degeneratebeziers.qps | 10 + tests/auto/lancelot/scripts/deviceclipping.qps | 48 ++ tests/auto/lancelot/scripts/drawpoints.qps | 101 ++++ tests/auto/lancelot/scripts/ellipses.qps | 86 ++++ tests/auto/lancelot/scripts/filltest.qps | 413 +++++++++++++++ tests/auto/lancelot/scripts/gradients.qps | 44 ++ tests/auto/lancelot/scripts/image_formats.qps | 81 +++ tests/auto/lancelot/scripts/images.qps | 106 ++++ tests/auto/lancelot/scripts/images2.qps | 145 ++++++ tests/auto/lancelot/scripts/join_cap_styles.qps | 63 +++ .../join_cap_styles_duplicate_control_points.qps | 68 +++ tests/auto/lancelot/scripts/linear_gradients.qps | 144 ++++++ .../scripts/linear_gradients_perspectives.qps | 62 +++ .../scripts/linear_resolving_gradients.qps | 66 +++ tests/auto/lancelot/scripts/lineconsistency.qps | 72 +++ tests/auto/lancelot/scripts/linedashes.qps | 94 ++++ tests/auto/lancelot/scripts/linedashes2.qps | 154 ++++++ tests/auto/lancelot/scripts/linedashes2_aa.qps | 5 + tests/auto/lancelot/scripts/lines.qps | 558 +++++++++++++++++++++ tests/auto/lancelot/scripts/lines2.qps | 179 +++++++ tests/auto/lancelot/scripts/pathfill.qps | 38 ++ tests/auto/lancelot/scripts/paths.qps | 34 ++ tests/auto/lancelot/scripts/paths_aa.qps | 4 + tests/auto/lancelot/scripts/pens.qps | 133 +++++ tests/auto/lancelot/scripts/pens_aa.qps | 6 + tests/auto/lancelot/scripts/pens_cosmetic.qps | 110 ++++ tests/auto/lancelot/scripts/perspectives.qps | 72 +++ tests/auto/lancelot/scripts/perspectives2.qps | 309 ++++++++++++ tests/auto/lancelot/scripts/pixmap_rotation.qps | 30 ++ tests/auto/lancelot/scripts/pixmap_scaling.qps | 224 +++++++++ tests/auto/lancelot/scripts/pixmap_subpixel.qps | 117 +++++ tests/auto/lancelot/scripts/pixmaps.qps | 106 ++++ tests/auto/lancelot/scripts/porter_duff.qps | 251 +++++++++ tests/auto/lancelot/scripts/porter_duff2.qps | 261 ++++++++++ tests/auto/lancelot/scripts/primitives.qps | 184 +++++++ tests/auto/lancelot/scripts/radial_gradients.qps | 99 ++++ .../scripts/radial_gradients_perspectives.qps | 62 +++ tests/auto/lancelot/scripts/rasterops.qps | 87 ++++ tests/auto/lancelot/scripts/sizes.qps | 150 ++++++ tests/auto/lancelot/scripts/text.qps | 124 +++++ tests/auto/lancelot/scripts/text_perspectives.qps | 102 ++++ tests/auto/lancelot/scripts/tiled_pixmap.qps | 84 ++++ tests/auto/lancelot/tst_lancelot.cpp | 238 +++++++++ tests/auto/other.pro | 1 + 70 files changed, 7741 insertions(+) create mode 100755 tests/arthur/baselineserver/bin/runserver create mode 100644 tests/arthur/baselineserver/src/baselineserver.cpp create mode 100644 tests/arthur/baselineserver/src/baselineserver.h create mode 100644 tests/arthur/baselineserver/src/baselineserver.pro create mode 100644 tests/arthur/baselineserver/src/main.cpp create mode 100644 tests/arthur/common/baselineprotocol.cpp create mode 100644 tests/arthur/common/baselineprotocol.h create mode 100644 tests/arthur/common/baselineprotocol.pri create mode 100644 tests/auto/lancelot/lancelot.pro create mode 100644 tests/auto/lancelot/scripts/aliasing.qps create mode 100644 tests/auto/lancelot/scripts/arcs.qps create mode 100644 tests/auto/lancelot/scripts/arcs2.qps create mode 100644 tests/auto/lancelot/scripts/background.qps create mode 100644 tests/auto/lancelot/scripts/background_brush.qps create mode 100644 tests/auto/lancelot/scripts/beziers.qps create mode 100644 tests/auto/lancelot/scripts/bitmaps.qps create mode 100644 tests/auto/lancelot/scripts/borderimage.qps create mode 100644 tests/auto/lancelot/scripts/brush_pens.qps create mode 100644 tests/auto/lancelot/scripts/brushes.qps create mode 100644 tests/auto/lancelot/scripts/clippaths.qps create mode 100644 tests/auto/lancelot/scripts/clipping.qps create mode 100644 tests/auto/lancelot/scripts/clipping_state.qps create mode 100644 tests/auto/lancelot/scripts/cliprects.qps create mode 100644 tests/auto/lancelot/scripts/conical_gradients.qps create mode 100644 tests/auto/lancelot/scripts/conical_gradients_perspectives.qps create mode 100644 tests/auto/lancelot/scripts/dashes.qps create mode 100644 tests/auto/lancelot/scripts/degeneratebeziers.qps create mode 100644 tests/auto/lancelot/scripts/deviceclipping.qps create mode 100644 tests/auto/lancelot/scripts/drawpoints.qps create mode 100644 tests/auto/lancelot/scripts/ellipses.qps create mode 100644 tests/auto/lancelot/scripts/filltest.qps create mode 100644 tests/auto/lancelot/scripts/gradients.qps create mode 100644 tests/auto/lancelot/scripts/image_formats.qps create mode 100644 tests/auto/lancelot/scripts/images.qps create mode 100644 tests/auto/lancelot/scripts/images2.qps create mode 100644 tests/auto/lancelot/scripts/join_cap_styles.qps create mode 100644 tests/auto/lancelot/scripts/join_cap_styles_duplicate_control_points.qps create mode 100644 tests/auto/lancelot/scripts/linear_gradients.qps create mode 100644 tests/auto/lancelot/scripts/linear_gradients_perspectives.qps create mode 100644 tests/auto/lancelot/scripts/linear_resolving_gradients.qps create mode 100644 tests/auto/lancelot/scripts/lineconsistency.qps create mode 100644 tests/auto/lancelot/scripts/linedashes.qps create mode 100644 tests/auto/lancelot/scripts/linedashes2.qps create mode 100644 tests/auto/lancelot/scripts/linedashes2_aa.qps create mode 100644 tests/auto/lancelot/scripts/lines.qps create mode 100644 tests/auto/lancelot/scripts/lines2.qps create mode 100644 tests/auto/lancelot/scripts/pathfill.qps create mode 100644 tests/auto/lancelot/scripts/paths.qps create mode 100644 tests/auto/lancelot/scripts/paths_aa.qps create mode 100644 tests/auto/lancelot/scripts/pens.qps create mode 100644 tests/auto/lancelot/scripts/pens_aa.qps create mode 100644 tests/auto/lancelot/scripts/pens_cosmetic.qps create mode 100644 tests/auto/lancelot/scripts/perspectives.qps create mode 100644 tests/auto/lancelot/scripts/perspectives2.qps create mode 100644 tests/auto/lancelot/scripts/pixmap_rotation.qps create mode 100644 tests/auto/lancelot/scripts/pixmap_scaling.qps create mode 100644 tests/auto/lancelot/scripts/pixmap_subpixel.qps create mode 100644 tests/auto/lancelot/scripts/pixmaps.qps create mode 100644 tests/auto/lancelot/scripts/porter_duff.qps create mode 100644 tests/auto/lancelot/scripts/porter_duff2.qps create mode 100644 tests/auto/lancelot/scripts/primitives.qps create mode 100644 tests/auto/lancelot/scripts/radial_gradients.qps create mode 100644 tests/auto/lancelot/scripts/radial_gradients_perspectives.qps create mode 100644 tests/auto/lancelot/scripts/rasterops.qps create mode 100644 tests/auto/lancelot/scripts/sizes.qps create mode 100644 tests/auto/lancelot/scripts/text.qps create mode 100644 tests/auto/lancelot/scripts/text_perspectives.qps create mode 100644 tests/auto/lancelot/scripts/tiled_pixmap.qps create mode 100644 tests/auto/lancelot/tst_lancelot.cpp diff --git a/tests/arthur/baselineserver/bin/runserver b/tests/arthur/baselineserver/bin/runserver new file mode 100755 index 0000000..52feb86 --- /dev/null +++ b/tests/arthur/baselineserver/bin/runserver @@ -0,0 +1,6 @@ +#!/bin/bash + +while true; do + ./baselineserver + sleep 5 +done diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp new file mode 100644 index 0000000..bba2cd8 --- /dev/null +++ b/tests/arthur/baselineserver/src/baselineserver.cpp @@ -0,0 +1,188 @@ +#include "baselineserver.h" +#include +#include +#include +#include +#include +#include + +QString BaselineServer::storage; + +BaselineServer::BaselineServer(QObject *parent) + : QTcpServer(parent) +{ + QFileInfo me(QCoreApplication::applicationFilePath()); + meLastMod = me.lastModified(); + heartbeatTimer = new QTimer(this); + connect(heartbeatTimer, SIGNAL(timeout()), this, SLOT(heartbeat())); + heartbeatTimer->start(HEARTBEAT*1000); +} + +QString BaselineServer::storagePath() +{ + if (storage.isEmpty()) { + QDir dir(QCoreApplication::applicationDirPath()); + dir.cdUp(); + storage = dir.path() + QLatin1String("/storage/"); + } + return storage; +} + +void BaselineServer::incomingConnection(int socketDescriptor) +{ + qDebug() << "Server: New connection!"; + BaselineThread *thread = new BaselineThread(socketDescriptor, this); + connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); + thread->start(); +} + +void BaselineServer::heartbeat() +{ + // The idea is to exit to be restarted when modified, as soon as not actually serving + QFileInfo me(QCoreApplication::applicationFilePath()); + if (me.lastModified() == meLastMod) + return; + + // (could close() here to avoid accepting new connections, to avoid livelock) + // also, could check for a timeout to force exit, to avoid hung threads blocking + bool isServing = false; + foreach(BaselineThread *thread, findChildren()) { + if (thread->isRunning()) { + isServing = true; + break; + } + } + + if (!isServing) + QCoreApplication::exit(); +} + +BaselineThread::BaselineThread(int socketDescriptor, QObject *parent) + : QThread(parent), socketDescriptor(socketDescriptor) +{ +} + +void BaselineThread::run() +{ + BaselineHandler handler(socketDescriptor); + exec(); +} + + +BaselineHandler::BaselineHandler(int socketDescriptor) + : QObject(), connectionEstablished(false) +{ + runId = QDateTime::currentDateTime().toString(QLatin1String("MMMdd-hhmmss")); + + connect(&proto.socket, SIGNAL(readyRead()), this, SLOT(receiveRequest())); + connect(&proto.socket, SIGNAL(disconnected()), this, SLOT(receiveDisconnect())); + proto.socket.setSocketDescriptor(socketDescriptor); +} + + +void BaselineHandler::receiveRequest() +{ + if (!connectionEstablished) { + if (!proto.acceptConnection(&plat)) { + qWarning() << runId << "Accepting new connection failed. " << proto.errorMessage(); + QThread::currentThread()->exit(1); + return; + } + connectionEstablished = true; + qDebug() << runId << "Connection established with" << plat.hostname << "Qt version:" << plat.qtVersion << plat.buildKey; + return; + } + + QByteArray block; + BaselineProtocol::Command cmd; + if (!proto.receiveBlock(&cmd, &block)) { + qWarning() << runId << "Command reception failed. "<< proto.errorMessage(); + QThread::currentThread()->exit(1); + return; + } + + switch(cmd) { + case BaselineProtocol::RequestBaseline: + provideBaseline(block); + break; + case BaselineProtocol::AcceptNewBaseline: + storeImage(block, true); + break; + case BaselineProtocol::AcceptMismatch: + storeImage(block, false); + break; + default: + qWarning() << runId << "Unknown command received. " << proto.errorMessage(); + QThread::currentThread()->exit(1); + } +} + + +void BaselineHandler::provideBaseline(const QByteArray &caseId) +{ + qDebug() << runId << "Received request for baseline" << caseId; + + QFile file(pathForCaseId(caseId)); + if (!file.open(QIODevice::ReadOnly)) { + qDebug() << runId << "baseline not found."; + proto.sendBlock(BaselineProtocol::BaselineNotPresent, caseId); + return; + } + proto.sendBlock(BaselineProtocol::AcceptBaseline, file.readAll()); +} + + +void BaselineHandler::storeImage(const QByteArray &imageBlock, bool isBaseline) +{ + QBuffer buf; + buf.setData(imageBlock); + buf.open(QIODevice::ReadOnly); + QDataStream ds(&buf); + QByteArray caseId; + ds >> caseId; + //# For futuresafeness, should make caseId FS-safe - but revertable... + QFile file(pathForCaseId(caseId, isBaseline)); + qDebug() << runId << "Received" << (isBaseline ? "baseline" : "mismatched") << "image for:" << caseId << "Storing in" << file.fileName(); + QString path = file.fileName().section(QDir::separator(), 0, -2); + QDir cwd; + if (!cwd.exists(path)) + cwd.mkpath(path); + if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) { + qWarning() << runId << "Failed to store" << file.fileName(); + return; + } + file.write(imageBlock.constData()+buf.pos(), imageBlock.size()-buf.pos()); + + QByteArray msg(isBaseline ? "Mismatching" : "Baseline"); + msg += " image stored in " + + QHostInfo::localHostName().toLatin1() + '.' + + QHostInfo::localDomainName().toLatin1() + ':' + + QFileInfo(file).absoluteFilePath().toLatin1(); + proto.sendBlock(BaselineProtocol::Ack, msg); + qDebug() << runId << "Storing done."; +} + + +void BaselineHandler::receiveDisconnect() +{ + qDebug() << runId << "Client disconnected."; + QThread::currentThread()->exit(0); +} + + +QString BaselineHandler::pathForCaseId(const QByteArray &caseId, bool isBaseline) +{ + QString storePath = BaselineServer::storagePath(); + storePath += plat.buildKey.section(QLatin1Char(' '), 1, 1) + QLatin1String("_Qt-") + + plat.qtVersion + QDir::separator(); + if (isBaseline) + storePath += QLatin1String("baselines") + QDir::separator(); + else + storePath += runId + QDir::separator(); + return storePath + caseId + QLatin1Char('.') + QLatin1String(FileFormat); +} + + +// - transferring and comparing checksums instead of images +// - then we could now if multiple error/imgs are really the same (and just store it once) +// - e.g. using db diff --git a/tests/arthur/baselineserver/src/baselineserver.h b/tests/arthur/baselineserver/src/baselineserver.h new file mode 100644 index 0000000..8cd9f56 --- /dev/null +++ b/tests/arthur/baselineserver/src/baselineserver.h @@ -0,0 +1,74 @@ +#ifndef BASELINESERVER_H +#define BASELINESERVER_H + +#include +#include +#include +#include +#include "baselineprotocol.h" +#include +#include +#include + +// #seconds between update checks +#define HEARTBEAT 10 + +class BaselineServer : public QTcpServer +{ + Q_OBJECT + +public: + BaselineServer(QObject *parent = 0); + + static QString storagePath(); + +protected: + void incomingConnection(int socketDescriptor); + +private slots: + void heartbeat(); + +private: + QTimer *heartbeatTimer; + QDateTime meLastMod; + static QString storage; +}; + + + +class BaselineThread : public QThread +{ + Q_OBJECT + +public: + BaselineThread(int socketDescriptor, QObject *parent); + void run(); + +private: + int socketDescriptor; +}; + + +class BaselineHandler : public QObject +{ + Q_OBJECT + +public: + BaselineHandler(int socketDescriptor); + +private slots: + void receiveRequest(); + void receiveDisconnect(); + +private: + void provideBaseline(const QByteArray &caseId); + void storeImage(const QByteArray &imageBlock, bool isBaseline); + QString pathForCaseId(const QByteArray &caseId, bool isBaseline = true); + + BaselineProtocol proto; + PlatformInfo plat; + bool connectionEstablished; + QString runId; +}; + +#endif // BASELINESERVER_H diff --git a/tests/arthur/baselineserver/src/baselineserver.pro b/tests/arthur/baselineserver/src/baselineserver.pro new file mode 100644 index 0000000..2065d4a --- /dev/null +++ b/tests/arthur/baselineserver/src/baselineserver.pro @@ -0,0 +1,25 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2010-08-11T11:51:09 +# +#------------------------------------------------- + +QT += core network + +# gui needed for QImage +# QT -= gui + +TARGET = baselineserver +DESTDIR = ../bin +CONFIG += console +CONFIG -= app_bundle + +TEMPLATE = app + +include(../../common/baselineprotocol.pri) + +SOURCES += main.cpp \ + baselineserver.cpp + +HEADERS += \ + baselineserver.h diff --git a/tests/arthur/baselineserver/src/main.cpp b/tests/arthur/baselineserver/src/main.cpp new file mode 100644 index 0000000..46048db --- /dev/null +++ b/tests/arthur/baselineserver/src/main.cpp @@ -0,0 +1,16 @@ +#include +#include "baselineserver.h" + +int main(int argc, char *argv[]) +{ + QCoreApplication a(argc, argv); + + BaselineServer server; + if (!server.listen(QHostAddress::Any, BaselineProtocol::ServerPort)) { + qWarning("Failed to listen!"); + return 1; + } + + qDebug() << "Listening for connections"; + return a.exec(); +} diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp new file mode 100644 index 0000000..fb4f06d --- /dev/null +++ b/tests/arthur/common/baselineprotocol.cpp @@ -0,0 +1,219 @@ + +#include "baselineprotocol.h" +#include +#include +#include +#include + +PlatformInfo::PlatformInfo(bool useLocal) +{ + if (useLocal) { + buildKey = QLibraryInfo::buildKey(); + qtVersion = QLatin1String(qVersion()); + hostname = QHostInfo::localHostName(); + } +} + +QDataStream & operator<< (QDataStream &stream, const PlatformInfo &pinfo) +{ + stream << pinfo.buildKey << pinfo.qtVersion << pinfo.hostname; + return stream; +} + +QDataStream & operator>> (QDataStream& stream, PlatformInfo& pinfo) +{ + stream >> pinfo.buildKey >> pinfo.qtVersion >> pinfo.hostname; + return stream; +} + +BaselineProtocol::~BaselineProtocol() +{ + socket.close(); + if (socket.state() != QTcpSocket::UnconnectedState) + socket.waitForDisconnected(Timeout); +} + + +bool BaselineProtocol::connect() +{ + errMsg.clear(); + //TBD: determine server address; for now localhost + QLatin1String serverName("localhost"); + + socket.connectToHost(serverName, ServerPort); + + if (!socket.waitForConnected(Timeout)) { + errMsg += QLatin1String("TCP connectToHost failed. Host:") + serverName + QLatin1String(" port:") + QString::number(ServerPort); + return false; + } + + PlatformInfo pi(true); + QByteArray block; + QDataStream ds(&block, QIODevice::ReadWrite); + ds << pi; + if (!sendBlock(AcceptPlatformInfo, block)) { + errMsg += QLatin1String("Failed to send data to server."); + return false; + } + + Command cmd = Ack; + if (!receiveBlock(&cmd, &block) || cmd != Ack) { + errMsg += QLatin1String("Failed to get response from server."); + return false; + } + + return true; +} + + +bool BaselineProtocol::acceptConnection(PlatformInfo *pi) +{ + errMsg.clear(); + + QByteArray block; + Command cmd = AcceptPlatformInfo; + if (!receiveBlock(&cmd, &block) || cmd != AcceptPlatformInfo) + return false; + + if (pi) { + QDataStream ds(block); + ds >> *pi; + } + + if (!sendBlock(Ack, QByteArray())) + return false; + return true; +} + + +bool BaselineProtocol::requestBaseline(const QString &caseId, Command *response, QImage *baseline) +{ + errMsg.clear(); + if (!sendBlock(RequestBaseline, caseId.toLatin1())) + return false; + QByteArray imgData; + Command cmd; + if (!receiveBlock(&cmd, &imgData)) + return false; + if (response) + *response = cmd; + if (cmd == BaselineNotPresent || cmd == IgnoreCase) + return true; + else if (cmd == AcceptBaseline) { + if (baseline) { + // hm, get the name also, for checking? + *baseline = QImage::fromData(imgData); + if (baseline->isNull()) { + errMsg.prepend(QLatin1String("Invalid baseline image data received. ")); + return false; + } + } + return true; + } + errMsg.prepend(QLatin1String("Unexpected reply from server on baseline request. ")); + return false; +} + + +bool BaselineProtocol::submitNewBaseline(const QString &caseId, const QImage &baseline) +{ + errMsg.clear(); + QBuffer buf; + buf.open(QIODevice::WriteOnly); + QDataStream ds(&buf); + ds << caseId.toLatin1(); + if (!baseline.save(&buf, FileFormat)) { + errMsg = QLatin1String("Failed to convert new baseline image to ") + QLatin1String(FileFormat); + return false; + } + if (!sendBlock(AcceptNewBaseline, buf.data())) { + errMsg.prepend(QLatin1String("Failed to submit new baseline to server. ")); + return false; + } + Command cmd; + receiveBlock(&cmd, 0); // Just wait for the pong; ignore reply contents + return true; +} + + +bool BaselineProtocol::submitMismatch(const QString &caseId, const QImage &mismatch, QByteArray *failMsg) +{ + errMsg.clear(); + QBuffer buf; + buf.open(QIODevice::WriteOnly); + QDataStream ds(&buf); + ds << caseId.toLatin1(); + if (!mismatch.save(&buf, FileFormat)) { + errMsg = QLatin1String("Failed to convert mismatched image to ") + QLatin1String(FileFormat); + return false; + } + if (!sendBlock(AcceptMismatch, buf.data())) { + errMsg.prepend(QLatin1String("Failed to submit mismatched image to server. ")); + return false; + } + Command cmd; + if (!receiveBlock(&cmd, failMsg)) { + errMsg.prepend(QLatin1String("Failed to receive response on mismatched image from server. ")); + return false; + } + return true; +} + + +bool BaselineProtocol::sendBlock(Command cmd, const QByteArray &block) +{ + QDataStream s(&socket); + // TBD: set qds version as a constant + s << quint16(ProtocolVersion) << quint16(cmd); + s.writeBytes(block.constData(), block.size()); + return true; +} + + +bool BaselineProtocol::receiveBlock(Command *cmd, QByteArray *block) +{ + while (socket.bytesAvailable() < int(2*sizeof(quint16) + sizeof(quint32))) { + if (!socket.waitForReadyRead(Timeout)) + return false; + } + QDataStream ds(&socket); + quint16 rcvProtocolVersion, rcvCmd; + ds >> rcvProtocolVersion >> rcvCmd; + if (rcvProtocolVersion != ProtocolVersion) { + // TBD: More resilient handling of this case; the server should accept client's version + errMsg = QLatin1String("Server protocol version mismatch, received:") + QString::number(rcvProtocolVersion); + + return false; + } + if (cmd) + *cmd = Command(rcvCmd); + + QByteArray uMsg; + quint32 remaining; + ds >> remaining; + uMsg.resize(remaining); + int got = 0; + char* uMsgBuf = uMsg.data(); + do { + got = ds.readRawData(uMsgBuf, remaining); + remaining -= got; + uMsgBuf += got; + } while (remaining && got >= 0 && socket.waitForReadyRead(Timeout)); + + if (got < 0) + return false; + + if (block) + *block = uMsg; + + return true; +} + + +QString BaselineProtocol::errorMessage() +{ + QString ret = errMsg; + if (socket.error() >= 0) + ret += QLatin1String(" Socket state: ") + socket.errorString(); + return ret; +} diff --git a/tests/arthur/common/baselineprotocol.h b/tests/arthur/common/baselineprotocol.h new file mode 100644 index 0000000..8740413 --- /dev/null +++ b/tests/arthur/common/baselineprotocol.h @@ -0,0 +1,76 @@ +#ifndef BASELINEPROTOCOL_H +#define BASELINEPROTOCOL_H + +#include +#include + +#define FileFormat "png" + +struct PlatformInfo +{ +public: + PlatformInfo(bool useLocal = false); + + QString buildKey; + QString qtVersion; + QString hostname; +}; + + + +class BaselineProtocol +{ +public: + BaselineProtocol() {} + ~BaselineProtocol(); + + // **************************************************** + // Important constants here + // **************************************************** + enum Constant { + ProtocolVersion = 1, + ServerPort = 54129, + Timeout = 100000 + }; + + enum Command { + UnknownError = 0, + // Queries + AcceptPlatformInfo = 1, + RequestBaseline = 2, + AcceptNewBaseline = 3, + AcceptMismatch = 4, + // Responses + Ack = 128, + AcceptBaseline = 129, + BaselineNotPresent = 130, + IgnoreCase = 131 + }; + + // For client: + bool connect(); + bool requestBaseline(const QString &caseId, Command *response, QImage *baseline); + bool submitNewBaseline(const QString &caseId, const QImage &baseline); + bool submitMismatch(const QString &caseId, const QImage &mismatch, QByteArray *failMsg); + + // For server: + bool acceptConnection(PlatformInfo *pi); + + QString errorMessage(); + +private: + bool sendBlock(Command cmd, const QByteArray &block); + bool receiveBlock(Command *cmd, QByteArray *block); + QString errMsg; + QTcpSocket socket; + + friend class BaselineThread; + friend class BaselineHandler; +}; + + +QDataStream & operator<< (QDataStream &stream, const PlatformInfo &pinfo); + +QDataStream & operator>> (QDataStream& stream, PlatformInfo& pinfo); + +#endif // BASELINEPROTOCOL_H diff --git a/tests/arthur/common/baselineprotocol.pri b/tests/arthur/common/baselineprotocol.pri new file mode 100644 index 0000000..338339e --- /dev/null +++ b/tests/arthur/common/baselineprotocol.pri @@ -0,0 +1,9 @@ +INCLUDEPATH += $$PWD + +QT *= network + +SOURCES += \ + $$PWD/baselineprotocol.cpp + +HEADERS += \ + $$PWD/baselineprotocol.h diff --git a/tests/auto/lancelot/lancelot.pro b/tests/auto/lancelot/lancelot.pro new file mode 100644 index 0000000..d0138bd --- /dev/null +++ b/tests/auto/lancelot/lancelot.pro @@ -0,0 +1,10 @@ +load(qttest_p4) +QT += xml svg +contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2):QT += opengl + +SOURCES += tst_lancelot.cpp + +include($$QT_SOURCE_TREE/tests/arthur/common/common.pri) +include($$QT_SOURCE_TREE/tests/arthur/common/baselineprotocol.pri) + +!symbian:!wince*:DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/lancelot/scripts/aliasing.qps b/tests/auto/lancelot/scripts/aliasing.qps new file mode 100644 index 0000000..59878f9 --- /dev/null +++ b/tests/auto/lancelot/scripts/aliasing.qps @@ -0,0 +1,156 @@ + +path_moveTo convexPath 25 0 +path_lineTo convexPath 50 50 +path_lineTo convexPath 25 25 +path_lineTo convexPath 0 50 +path_closeSubpath convexPath + +pixmap_load border.png pixmap + +setRenderHint LineAntialiasing false +translate 10 10 + +begin_block drawing + setPen black 1 + setBrush 7f7fff + drawPath convexPath + + setFont "monospace" 8 + setPen black + drawText 0 68 "QwErTy@" + + + setPen black 1 + setBrush 7f7fff + drawRect 0 80 10 5 + + setPen black 1 + setBrush noBrush + drawRect 20 80 10 5 + + setPen noPen + setBrush 7f7fff + drawRect 40 80 10 5 + + + setPen black 2 + setBrush 7f7fff + drawRect 0 90 10 5 + + setPen black 2 + setBrush noBrush + drawRect 20 90 10 5 + + setPen noPen + setBrush 7f7fff + drawRect 40 90 10 5 + + + setPen black 3 + setBrush 7f7fff + drawRect 0 100 10 5 + + setPen black 3 + setBrush noBrush + drawRect 20 100 10 5 + + setPen noPen + setBrush 7f7fff + drawRect 40 100 10 5 + + + setPen black 1 + setBrush noBrush + drawLine 10 110 20 120 + drawLine 30 120 40 110 + + setPen black 2 + setBrush noBrush + drawLine 10 120 20 130 + drawLine 30 130 40 120 + + setPen black 3 + setBrush noBrush + drawLine 10 130 20 140 + drawLine 30 140 40 130 + + drawPixmap pixmap 0 150 + + setRenderHint SmoothPixmapTransform false + drawPixmap pixmap 20 150 15 15 0 0 10 10 + +end_block + +translate 0 180 +setRenderHint LineAntialiasing true +repeat_block drawing +drawText 15 185 "0.0" + +resetMatrix +translate 70.2 10.2 +setRenderHint LineAntialiasing false +repeat_block drawing +translate 0 180 +setRenderHint LineAntialiasing true +repeat_block drawing +translate -0.2 -0.2 +drawText 15 185 "0.2" + + +resetMatrix +translate 130.4 10.4 +setRenderHint LineAntialiasing false +repeat_block drawing +translate 0 180 +setRenderHint LineAntialiasing true +repeat_block drawing +translate -0.4 -0.4 +drawText 15 185 "0.4" + + +resetMatrix +translate 190.5 10.5 +setRenderHint LineAntialiasing false +repeat_block drawing +translate 0 180 +setRenderHint LineAntialiasing true +repeat_block drawing +translate -0.5 -0.5 +drawText 15 185 "0.5" + + +resetMatrix +translate 250.6 10.6 +setRenderHint LineAntialiasing false +repeat_block drawing +translate 0 180 +setRenderHint LineAntialiasing true +repeat_block drawing +translate -0.6 -0.6 +drawText 15 185 "0.6" + + +resetMatrix +translate 310.8 10.8 +setRenderHint LineAntialiasing false +repeat_block drawing +translate 0 180 +setRenderHint LineAntialiasing true +repeat_block drawing +translate -0.8 -0.8 +drawText 15 185 "0.8" + + +resetMatrix +translate 371 11 +setRenderHint LineAntialiasing false +repeat_block drawing +translate 0 180 +setRenderHint LineAntialiasing true +repeat_block drawing +drawText 15 185 "1.0" + + +resetMatrix +drawText 430 95 "Aliased" +drawText 430 275 "Anti-Aliased" \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/arcs.qps b/tests/auto/lancelot/scripts/arcs.qps new file mode 100644 index 0000000..8a7a468 --- /dev/null +++ b/tests/auto/lancelot/scripts/arcs.qps @@ -0,0 +1,68 @@ +# Version: 1 +# CheckVsReference: 5 + +setRenderHint LineAntialiasing + +setPen red + +drawEllipse 0 0 600 400 + +path_moveTo arcs 300 200 +path_arcTo arcs 0 0 600 400 0 10 +path_closeSubpath arcs + +path_moveTo arcs 300 200 +path_arcTo arcs 0 0 600 400 20 30 +path_closeSubpath arcs + +path_moveTo arcs 300 200 +path_arcTo arcs 0 0 600 400 60 45 +path_closeSubpath arcs + +path_moveTo arcs 300 200 +path_arcTo arcs 0 0 600 400 115 60 +path_closeSubpath arcs + +path_moveTo arcs 300 200 +path_arcTo arcs 0 0 600 400 180 90 +path_closeSubpath arcs + +path_moveTo arcs 590 200 +path_arcTo arcs 10 10 580 380 0 360 +path_closeSubpath arcs + +path_moveTo arcs 300 200 +path_arcTo arcs 20 20 560 360 0 -10 +path_closeSubpath arcs + +path_moveTo arcs 300 200 +path_arcTo arcs 20 20 560 360 -20 -30 +path_closeSubpath arcs + +path_moveTo arcs 300 200 +path_arcTo arcs 20 20 560 360 -60 -45 +path_closeSubpath arcs + +path_moveTo arcs 300 200 +path_arcTo arcs 20 20 560 360 -115 -60 +path_closeSubpath arcs + +path_moveTo arcs 300 200 +path_arcTo arcs 20 20 560 360 -180 -90 +path_closeSubpath arcs + +setPen black 1 solidline +setBrush #3f00ff00 +drawPath arcs + +# Then again with a matrix set... +translate 200 400 +rotate 10 +scale 0.5 0.5 +setPen red +setBrush nobrush +drawEllipse 0 0 600 400 + +setPen black 1 solidline +setBrush #3f0000ff +drawPath arcs \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/arcs2.qps b/tests/auto/lancelot/scripts/arcs2.qps new file mode 100644 index 0000000..411ff08 --- /dev/null +++ b/tests/auto/lancelot/scripts/arcs2.qps @@ -0,0 +1,47 @@ +# Version: 1 +# CheckVsReference: 5 + +drawArc 100 100 100 100 0 1440 +drawArc 100 100 100 100 1440 1440 +drawArc 100 100 100 100 2880 1440 +drawArc 100 100 100 100 4320 1440 + +drawArc 100 200 100 100 0 -1440 +drawArc 100 200 100 100 -1440 -1440 +drawArc 100 200 100 100 -2880 -1440 +drawArc 100 200 100 100 -4320 -1440 + +drawArc 200 100 100 100 720 1440 +drawArc 200 100 100 100 2160 1440 +drawArc 200 100 100 100 3600 1440 +drawArc 200 100 100 100 5040 1440 + +drawArc 200 200 100 100 -720 -1440 +drawArc 200 200 100 100 -2160 -1440 +drawArc 200 200 100 100 -3600 -1440 +drawArc 200 200 100 100 -5040 -1440 + + +drawArc 300 100 100 100 3840 480 +drawArc 300 200 100 100 -3840 -480 + +drawArc 300 100 100 100 1600 1340 + +setPen black +drawArc 400 100 200 200 0 5760 +setPen white +drawArc 400 100 200 200 960 960 +drawArc 400 100 200 200 2880 960 +drawArc 400 100 200 200 4800 960 + +setPen black +drawArc 100 350 300 300 160 5760 +drawArc 100 350 300 300 320 5760 +drawArc 100 350 300 300 1920 5760 +drawArc 100 350 300 300 2080 5760 +drawArc 100 350 300 300 3680 5760 +drawArc 100 350 300 300 3840 5760 +drawArc 100 350 300 300 5440 5760 +drawArc 100 350 300 300 5600 5760 +setPen white +drawArc 100 350 300 300 0 5760 diff --git a/tests/auto/lancelot/scripts/background.qps b/tests/auto/lancelot/scripts/background.qps new file mode 100644 index 0000000..000cfcd --- /dev/null +++ b/tests/auto/lancelot/scripts/background.qps @@ -0,0 +1,136 @@ +# Version: 1 +# CheckVsReference: 5% + +translate 10 30 +setBackground 7f7fff +setBackgroundMode Transparent +setPen ff7f7f + +path_moveTo path 0 0 +path_lineTo path 25 0 +path_cubicTo path 50 0 25 25 25 50 +path_lineTo path 0 50 + +bitmap_load bitmap.png bitmap + +begin_block drawing + save + drawRect 0 0 50 50 + + translate 60 0 + drawEllipse 0 0 50 50 + + translate 60 0 + drawPolygon [0 0 50 0 25 50 25 25] + + translate 60 0 + drawPath path + + translate 60 0 + drawPie 0 0 50 50 1440 2000 + + translate 60 0 + drawChord 0 0 50 50 1440 2000 + + translate 60 0 + drawLine 0 0 50 0 + drawLine 0 0 50 50 + drawLine 0 0 0 50 + + translate 60 0 + drawPolyline [0 0 50 0 25 50 25 25] + + translate 60 0 + drawArc 0 0 50 50 1440 2000 + + translate 60 0 + drawText 0 10 "Jambi-Bambi" + + translate 80 0 + drawPixmap bitmap 0 0 + restore + + save + setRenderHint Antialiasing + translate 5 55 + drawRect 0 0 50 50 + + translate 60 0 + drawEllipse 0 0 50 50 + + translate 60 0 + drawPolygon [0 0 50 0 25 50 25 25] + + translate 60 0 + drawPath path + + translate 60 0 + drawPie 0 0 50 50 1440 2000 + + translate 60 0 + drawChord 0 0 50 50 1440 2000 + + translate 60 0 + drawLine 0 0 50 0 + drawLine 0 0 50 50 + drawLine 0 0 0 50 + + translate 60 0 + drawPolyline [0 0 50 0 25 50 25 25] + + translate 60 0 + drawArc 0 0 50 50 1440 2000 + + translate 60 0 + drawText 0 10 "Jambi-Bambi" + + translate 80 0 + drawPixmap bitmap 0 0 + restore +end_block + +translate 0 160 +setBackgroundMode Transparent +setPen ff7f7f 0 dotline flatcap beveljoin +repeat_block drawing + +translate 0 160 +setBackgroundMode Opaque +setPen ff7f7f 0 dotline flatcap beveljoin +repeat_block drawing + +translate 0 160 +setBackgroundMode Transparent +setPen ff7f7f 4 dashline flatcap beveljoin +repeat_block drawing + +translate 0 160 +setBackgroundMode OpaqueMode +setPen ff7f7f 4 dashline flatcap beveljoin +repeat_block drawing + +resetMatrix + +translate 5 5 + +setBrush nobrush +setPen black +setBackgroundMode transparent +drawText 10 15 "TransparentMode with solid 0-width pen" +drawRect 0 0 685 135 + +translate 0 160 +drawText 10 15 "TransparentMode with dotted 0-width pen" +drawRect 0 0 685 135 + +translate 0 160 +drawText 10 15 "OpaqueMode with dotted 0-width pen" +drawRect 0 0 685 135 + +translate 0 160 +drawText 10 15 "TransparentMode with dotted 4-width pen" +drawRect 0 0 685 135 + +translate 0 160 +drawText 10 15 "OpaqueMode with solid 4-width pen" +drawRect 0 0 685 135 diff --git a/tests/auto/lancelot/scripts/background_brush.qps b/tests/auto/lancelot/scripts/background_brush.qps new file mode 100644 index 0000000..ca1f944 --- /dev/null +++ b/tests/auto/lancelot/scripts/background_brush.qps @@ -0,0 +1,5 @@ +# Version: 1 +# CheckVsReference: 5% + +setBrush #00ff00 crosspattern +import "background.qps" \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/beziers.qps b/tests/auto/lancelot/scripts/beziers.qps new file mode 100644 index 0000000..9b47cd0 --- /dev/null +++ b/tests/auto/lancelot/scripts/beziers.qps @@ -0,0 +1,147 @@ +# Version: 1 +# CheckVsReference: 5% + + +setRenderHint LineAntialiasing + +translate 20 20 +path_moveTo fullSize 0 0 +path_cubicTo fullSize 200 100 -100 100 100 0 + +path_moveTo fullSize 0 200 +path_cubicTo fullSize 0 100 100 100 100 200 + +path_moveTo fullSize 0 250 +path_cubicTo fullSize 50 200 50 200 100 250 +drawPath fullSize + +translate 110 0 +scale 10 10 +path_moveTo medSize 0 0 +path_cubicTo medSize 20 10 -10 10 10 0 + +path_moveTo medSize 0 20 +path_cubicTo medSize 0 10 10 10 10 20 + +path_moveTo medSize 0 25 +path_cubicTo medSize 5 20 5 20 10 25 +drawPath medSize + +resetMatrix +translate 240 20 +scale 100 100 +path_moveTo smallSize 0 0 +path_cubicTo smallSize 2 1 -1 1 1 0 + +path_moveTo smallSize 0 2 +path_cubicTo smallSize 0 1 1 1 1 2 + +path_moveTo smallSize 0 2.5 +path_cubicTo smallSize 0.5 2 0.5 2 1 2.5 +drawPath smallSize + +resetMatrix +translate 20 300 +drawPath medSize + +resetMatrix +translate 250 -100 +path_moveTo maxSize 0 500 +path_cubicTo maxSize 1000 0 -500 0 500 500 +drawPath maxSize + +setRenderHint Antialiasing off +resetMatrix + +path_moveTo path1 0 0 +path_cubicTo path1 10 10 0 10 10 0 + +path_moveTo path2 0 0 +path_cubicTo path2 15 15 -5 15 10 0 + +path_moveTo path3 0 0 +path_cubicTo path3 20 20 -10 20 10 0 + +path_moveTo path4 0 0 +path_cubicTo path4 0 5 10 10 0 15 + +path_moveTo path5 0 10 +path_cubicTo path5 10 10 -10 20 0 0 + +path_moveTo path6 0 0 +path_cubicTo path6 10 5 -10 10 0 15 + +setPen black 2 +setBrush nobrush + +translate 10 500 +scale 3 3 +begin_block paths +save +drawPath path1 +translate 20 0 +drawPath path2 +translate 20 0 +drawPath path3 +translate 20 0 +drawPath path4 +translate 20 0 +drawPath path5 +translate 20 0 +drawPath path6 +restore +end_block + +setPen nopen +setBrush black + +translate 0 20 +repeat_block paths + +setRenderHint Antialiasing + +setPen black 2 +setBrush nobrush + +translate 120 -20 +repeat_block paths + +setPen nopen +setBrush black + +translate 0 20 +repeat_block paths + +resetMatrix +path_moveTo miterPath 20 0 +path_cubicTo miterPath 20 20 0 0 1 0 +path_lineTo miterPath -1 -0.2 + +setBrush nobrush + +translate 50 660 +scale 5 5 + +setPen black 4 solidline flatcap miterjoin +drawPath miterPath +setPen red 0 +drawPath miterPath + +path_moveTo miterPath2 21 0.2 +path_lineTo miterPath2 19 0 +path_cubicTo miterPath2 20 0 0 20 0 0 + +translate 30 0 +setPen black 4 solidline flatcap miterjoin +drawPath miterPath2 +setPen red 0 +drawPath miterPath2 + +path_moveTo wonkyPath 0 0 +path_cubicTo wonkyPath 5 15 20 0 17 0 + +translate 30 0 +setPen black 4 solidline flatcap miterjoin +drawPath wonkyPath +setPen red 0 +drawPath wonkyPath diff --git a/tests/auto/lancelot/scripts/bitmaps.qps b/tests/auto/lancelot/scripts/bitmaps.qps new file mode 100644 index 0000000..a816b9d --- /dev/null +++ b/tests/auto/lancelot/scripts/bitmaps.qps @@ -0,0 +1,166 @@ +# Version: 1 +# CheckVsReference: 5% + + +#setRenderHint SmoothPixmapTransform + +translate 10 50 +setBackground ff7f7f +setPen 3f3f9f + +bitmap_load dome_mono.png the_pixmap + +save + # Draw with opaque pen/bg in transparent/opaque mode + setBackgroundMode Transparent + drawPixmap the_pixmap 0 0 + setBackgroundMode Opaque + drawPixmap the_pixmap 110 0 + + translate 220 0 + + # Draw with alpha pen/bg in transparent/opaque mode + save + setBackground 7fff7f7f + setPen 7f3f3f9f + setBackgroundMode Transparent + drawPixmap the_pixmap 0 0 + setBackgroundMode Opaque + drawPixmap the_pixmap 110 0 + restore + + translate 220 0 + + # Draw with rotated opaque pen/bg in transparent/opaque mode + setBackgroundMode Transparent + save + translate 50 50 + rotate 10 + translate -50 -50 + drawPixmap the_pixmap 0 0 + restore + setBackgroundMode Opaque + translate 110 0 + save + translate 50 50 + rotate 10 + translate -50 -50 + drawPixmap the_pixmap 0 0 + restore +restore + +translate 0 150 + +save + setBackgroundMode Transparent + drawTiledPixmap the_pixmap 0 0 200 100 + setBackgroundMode Opaque + drawTiledPixmap the_pixmap 210 0 200 100 + + translate 440 -10 + save + rotate 10 + drawTiledPixmap the_pixmap 0 0 200 100 + restore +restore + +translate 0 150 +save + setBackgroundMode Transparent + drawTiledPixmap the_pixmap 0 0 200 100 10 20 + setBackgroundMode Opaque + drawTiledPixmap the_pixmap 210 0 200 100 10 20 + + translate 440 -10 + save + rotate 10 + drawTiledPixmap the_pixmap 0 0 200 100 10 20 + restore +restore + + +pixmap_setMask the_pixmap mask_100.png +drawPixmap the_pixmap 0 150 +setBackgroundMode Opaque +drawPixmap the_pixmap 110 150 + +translate 220 150 +save + translate 50 50 + rotate 10 + translate -50 -50 + setBackgroundMode Transparent + drawPixmap the_pixmap 0 0 +restore + +translate 110 0 +save + translate 50 50 + rotate 10 + translate -50 -50 + setBackgroundMode Opaque + drawPixmap the_pixmap 0 0 +restore + +resetMatrix +translate 10 650 +bitmap_load dome_mono.png the_bitmap +setBackgroundMode Transparent + +begin_block draw_subrected + drawPixmap the_bitmap 0 0 50 50 0 0 50 50 + drawPixmap the_bitmap 50 0 50 50 50 0 50 50 + drawPixmap the_bitmap 0 50 50 50 0 50 50 50 + drawPixmap the_bitmap 50 50 50 50 50 50 50 50 +end_block + +translate 110 0 +setBackgroundMode Opaque +repeat_block draw_subrected + +translate 110 0 +save + translate 20 -10 + rotate 10 + setBackgroundMode Transparent + repeat_block draw_subrected +restore + +translate 110 0 +save + translate 20 -10 + rotate 10 + setBackgroundMode Opaque + repeat_block draw_subrected +restore + +# Some helpful texts + +resetMatrix +setPen black +drawText 10 40 "Transparent" +drawText 120 40 "Opaque" +drawText 230 40 "Trans w/alpha" +drawText 340 40 "Opaque w/alpha" +drawText 450 40 "Trans w/xform" +drawText 560 40 "Opaque w/xform" + +drawText 10 190 "Transparent tiled" +drawText 220 190 "Opaque tiled" +drawText 440 190 "Opaque w/xform" + +drawText 10 340 "Transparent tiled w/offset" +drawText 220 340 "Opaque tiled w/offset" +drawText 440 340 "Opaque w/xform w/offset" + +drawText 10 490 "Trans masked" +drawText 120 490 "Opaque masked" +drawText 230 490 "masked w/xform" +drawText 340 490 "masked w/xform" + +drawText 10 640 "Subrected" +drawText 110 640 "Subrected opaque" +drawText 220 640 "subrect w/xform" +drawText 330 640 "subrect w/xform opaque" + + diff --git a/tests/auto/lancelot/scripts/borderimage.qps b/tests/auto/lancelot/scripts/borderimage.qps new file mode 100644 index 0000000..ebd4f4d --- /dev/null +++ b/tests/auto/lancelot/scripts/borderimage.qps @@ -0,0 +1,120 @@ +# Version: 1 +# CheckVsReference: 10% + +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" \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/brush_pens.qps b/tests/auto/lancelot/scripts/brush_pens.qps new file mode 100644 index 0000000..b9a2bc0 --- /dev/null +++ b/tests/auto/lancelot/scripts/brush_pens.qps @@ -0,0 +1,104 @@ +# Version: 1 +# CheckVsReference: 5% + +path_addRect p 0 0 75 75 +path_addEllipse p 25 25 75 75 + +translate 10 10 + +begin_block setup_gradient + gradient_clearStops + gradient_appendStop 0 red + gradient_appendStop 0.1 blue + gradient_appendStop 0.2 yellow + gradient_appendStop 0.3 cyan + gradient_appendStop 0.4 magenta + gradient_appendStop 0.5 green + gradient_appendStop 0.6 black + gradient_appendStop 0.7 indianred + gradient_appendStop 0.8 white + gradient_appendStop 0.9 orange + gradient_appendStop 1 blue + gradient_setLinear 0 0 100 100 +end_block + +setPen brush 0 +setBrush nobrush + +begin_block drawing + save + drawLine 0 0 100 100 + + translate 0 100 + drawPath p + + translate 0 110 + drawRect 0 0 100 100 + + translate 0 110 + drawPolyline [0 0 100 0 50 50] + + drawPoint 40 40 + drawPoint 41 40 + drawPoint 42 40 + drawPoint 43 40 + drawPoint 44 40 + drawPoint 45 40 + drawPoint 46 40 + drawPoint 47 40 + drawPoint 48 40 + drawPoint 49 40 + drawPoint 50 40 + + restore +end_block + +save + translate 110 0 + save + setRenderHint Antialiasing + repeat_block drawing + restore + + setBrush dome_rgb32.png + setPen brush 0 + setBrush nobrush + + translate 110 0 + repeat_block drawing + + translate 110 0 + save + setRenderHint Antialiasing + repeat_block drawing + restore +restore + +translate 0 0 + +save + repeat_block setup_gradient + setPen brush 5 + setBrush nobrush + translate 0 350 + repeat_block drawing + + translate 110 0 + save + setRenderHint Antialiasing + repeat_block drawing + restore + + setBrush dome_rgb32.png + setPen brush 5 + setBrush nobrush + + translate 110 0 + repeat_block drawing + + translate 110 0 + save + setRenderHint Antialiasing + repeat_block drawing + restore +restore \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/brushes.qps b/tests/auto/lancelot/scripts/brushes.qps new file mode 100644 index 0000000..82cbff4 --- /dev/null +++ b/tests/auto/lancelot/scripts/brushes.qps @@ -0,0 +1,79 @@ +# Version: 1 +# CheckVsReference: 5% + +# Fill the background +drawRect 0 0 width height + +setRenderHint Antialiasing +setRenderHint SmoothPixmapTransform + +translate 10 10 +# Draw all the pattern types as 40x40 rects using green, transparent background +begin_block drawrects +setBrush green Dense1Pattern +drawRect 0 0 40 40 +setBrush green Dense2Pattern +drawRect 40 0 40 40 +setBrush green Dense3Pattern +drawRect 80 0 40 40 +setBrush green Dense4Pattern +drawRect 120 0 40 40 +setBrush green Dense5Pattern +drawRect 160 0 40 40 +setBrush green Dense6Pattern +drawRect 200 0 40 40 +setBrush green Dense7Pattern +drawRect 240 0 40 40 +setBrush green HorPattern +drawRect 280 0 40 40 +setBrush green VerPattern +drawRect 320 0 40 40 +setBrush green CrossPattern +drawRect 360 0 40 40 +setBrush green BDiagPattern +drawRect 400 0 40 40 +setBrush green FDiagPattern +drawRect 440 0 40 40 +setBrush green DiagCrossPattern +drawRect 480 0 40 40 +setBrush green SolidPattern +drawRect 520 0 40 40 +setBrush green NoBrush +drawRect 560 0 40 40 +gradient_setLinear 0 0 0 40 +drawRect 600 0 40 40 +setBrush face.png +drawRect 640 0 80 40 +end_block + +# Switch to opaque mode +setBackground #7fff7f +setBackgroundMode OpaqueMode +translate 0 50 + +# Draw all the pattern types as 40x40 rects using green, opaque background +repeat_block drawrects + +translate 50 50 +rotate 10 + + +setBackgroundMode TransparentMode +repeat_block drawrects +setBackgroundMode OpaqueMode +translate 0 40 +repeat_block drawrects + + +setBrush dot.png +setPen nopen +resetMatrix +drawRect 0 200 50 50 +drawRect 50 200 50 50 + +setPen red +setBrushOrigin 0 250 +drawRect 0 250 50 50 +setBrushOrigin 50 250 +drawRect 50 250 50 50 + diff --git a/tests/auto/lancelot/scripts/clippaths.qps b/tests/auto/lancelot/scripts/clippaths.qps new file mode 100644 index 0000000..fba8978 --- /dev/null +++ b/tests/auto/lancelot/scripts/clippaths.qps @@ -0,0 +1,60 @@ +# Version: 1 +# CheckVsReference: 5% + +path_addRect hor 0 0 50 10 +path_addRect ver 0 0 10 50 + +translate 10 10 +setPen NoPen + +begin_block clipping +save + + setBrush 0x7f7fff + save + setClipPath hor + drawRect 0 0 100 100 + + setClipPath ver IntersectClip + setBrush black CrossPattern + drawRect 0 0 100 100 + restore + + translate 100 0 + save + setClipPath hor + drawRect 0 0 100 100 + + setClipPath ver ReplaceClip + setBrush black CrossPattern + drawRect 0 0 100 100 + restore + + translate 100 0 + save + setClipPath hor + drawRect 0 0 100 100 + + setClipPath ver UniteClip + setBrush black CrossPattern + drawRect 0 0 100 100 + restore + +restore +end_block + +translate 300 0 +setRenderHint Antialiasing +repeat_block clipping + +translate -300 100 +setRenderHint Antialiasing false +scale 1.2 1.2 +repeat_block clipping + +translate 300 0 +setRenderHint Antialiasing +setRenderHint SmoothPixmapTransform +repeat_block clipping + + diff --git a/tests/auto/lancelot/scripts/clipping.qps b/tests/auto/lancelot/scripts/clipping.qps new file mode 100644 index 0000000..3694ff2 --- /dev/null +++ b/tests/auto/lancelot/scripts/clipping.qps @@ -0,0 +1,182 @@ +# Version: 1 +# CheckVsReference: 5% + +region_addRect clip 50 0 90 190 +region_addRect clip 0 50 180 90 + +region_addRect clip2 30 30 60 60 + +region_addRect clip3 10 10 60 60 + +path_cubicTo path 90 0 50 50 90 90 +path_cubicTo path 0 90 50 50 0 0 + +path_addRect path2 0 0 90 90 +path_moveTo path2 90 45 +path_arcTo path2 0 0 90 90 0 -360 + +path_addRect emptypath 0 0 0 0 +region_addRect emptyregion 0 0 0 0 + +# Normal clip rect +setClipRect 0 0 50 150 +begin_block repaint +save +setBrush red +setPen nopen +resetMatrix +region_getClipRegion tmpclip +path_getClipPath tmpclippath +drawRect 0 0 width height +setBrush #3f0000ff +setClipRegion tmpclip +drawRect 0 0 width height +setClipPath tmpclippath +setBrush #3f00ff00 +drawRect 0 0 width height +restore +end_block + +# Rotated clip rect +translate 100 0 +rotate 10 +setClipRect 0 0 50 150 +repeat_block repaint + +# simple clip region +resetMatrix +translate 0 200 +setClipRegion clip +repeat_block repaint + +# simle rotated clip region +translate 250 -10 +rotate 10 +setClipRegion clip +repeat_block repaint + +# verify that clip is not xformed with painter +resetMatrix +translate 200 0 +setClipRegion clip +rotate 30 +setBrush red +setPen nopen +drawRect 0 0 width height + +resetMatrix +translate 0 400 +save +setClipRegion clip +setClipRegion clip2 IntersectClip +repeat_block repaint +translate 0 100 +rotate 10 +setClipRegion clip +setClipRegion clip2 IntersectClip +restore + +translate 100 0 +save +setClipRegion clip3 +setClipRegion clip2 UniteClip +repeat_block repaint +translate 0 100 +rotate 10 +setClipRegion clip3 +setClipRegion clip2 UniteClip +repeat_block repaint +restore + +translate 100 0 +save +setClipPath path +repeat_block repaint +translate 50 100 +rotate 45 +setClipPath path +repeat_block repaint +restore + +translate 100 0 +save +setClipPath path +setClipPath path2 IntersectClip +repeat_block repaint +translate 0 100 +rotate 10 +setClipPath path +setClipPath path2 IntersectClip +repeat_block repaint +restore + +translate 100 0 +save +setClipPath path +setClipPath path2 UniteClip +repeat_block repaint +translate 0 100 +rotate 10 +setClipPath path +setClipPath path2 UniteClip +repeat_block repaint +restore + +translate 100 0 +save +setClipPath path +setClipRegion clip3 IntersectClip +repeat_block repaint +translate 0 100 +rotate 10 +setClipRegion clip3 +setClipPath path IntersectClip +repeat_block repaint +restore + +translate 100 0 +save +setClipPath path +setClipRegion clip3 UniteClip +repeat_block repaint +translate 0 100 +rotate 10 +setClipRegion clip3 +setClipPath path UniteClip +repeat_block repaint +restore + +# test that an empty region is not drawn. +resetMatrix +setClipRegion emptyregion +setBrush #3f00ff00 +drawRect 0 0 300 300 +drawText 50 50 "Text should be clipped away by region" +setClipping false + +setClipPath emptypath +setBrush #3fffff00 +drawRect 50 50 300 300 +drawText 70 80 "Text should be clipped away by path" + +# Test that we can extract a clipregion when a matrix is set too +resetMatrix +translate 500 10 +scale 2 1 +setBrush blue +setClipping false +rotate 5 +drawRect 0 0 100 100 +setClipRect 0 0 100 100 +resetMatrix +rotate 10 +region_getClipRegion xclip +setClipRegion xclip +resetMatrix +setBrush #7f00ff00 +drawRect 0 0 width height + +# the below used to assert in debug mode +setClipRect 10 10 20 20 +setClipping false +setClipping true \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/clipping_state.qps b/tests/auto/lancelot/scripts/clipping_state.qps new file mode 100644 index 0000000..a29d373 --- /dev/null +++ b/tests/auto/lancelot/scripts/clipping_state.qps @@ -0,0 +1,47 @@ +# Version: 1 +# CheckVsReference: 5% + +path_addRect path1 10 10 50 50 +path_addRect path2 30 30 50 50 +# enable/disable a clip path +setPen nopen +setBrush red +setClipPath path1 +setClipPath path2 UniteClip +drawRect 0 0 100 100 +setClipping false +setBrush #630000ff +drawRect 0 0 100 100 +setClipping true +setBrush #6300ff00 +drawRect 0 0 100 100 +# enable/disable noclip +translate 150 0 +setClipPath path1 NoClip +setClipping false +setBrush #630000ff +drawRect 0 0 100 100 +setClipping true +setBrush #6300ff00 +drawRect 25 25 50 50 +# enable/disable full clipping +translate 150 0 +path_addRect path3 0 0 10 10 +path_addRect path4 20 20 10 10 +setClipPath path3 +setClipPath path4 IntersectClip +setClipping false +setBrush #630000ff +drawRect 0 0 100 100 +setClipping true +setBrush #6300ff00 +drawRect 25 25 50 50 +# disable clipping followed by setClipRect +translate 150 0 +setClipRect 0 0 50 50 ReplaceClip +setClipping false +setBrush #630000ff +drawRect 0 0 100 100 +setClipRect 25 25 75 75 IntersectClip +setBrush #6300ff00 +drawRect 25 25 50 50 \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/cliprects.qps b/tests/auto/lancelot/scripts/cliprects.qps new file mode 100644 index 0000000..0d28b03 --- /dev/null +++ b/tests/auto/lancelot/scripts/cliprects.qps @@ -0,0 +1,59 @@ +# Version: 1 +# CheckVsReference: 5% + + + +translate 10 10 +setPen NoPen + +begin_block clipping +save + + setBrush 0x7f7fff + save + setClipRect 0 0 50 10 + drawRect 0 0 100 100 + + setClipRect 0 0 10 50 IntersectClip + setBrush black CrossPattern + drawRect 0 0 100 100 + restore + + translate 100 0 + save + setClipRect 0 0 50 10 + drawRect 0 0 100 100 + + setClipRect 0 0 10 50 ReplaceClip + setBrush black CrossPattern + drawRect 0 0 100 100 + restore + + translate 100 0 + save + setClipRect 0 0 50 10 + drawRect 0 0 100 100 + + setClipRect 0 0 10 50 UniteClip + setBrush black CrossPattern + drawRect 0 0 100 100 + restore + +restore +end_block + +translate 300 0 +setRenderHint Antialiasing +repeat_block clipping + +translate -300 100 +setRenderHint Antialiasing false +scale 1.2 1.2 +repeat_block clipping + +translate 300 0 +setRenderHint Antialiasing +setRenderHint SmoothPixmapTransform +repeat_block clipping + + diff --git a/tests/auto/lancelot/scripts/conical_gradients.qps b/tests/auto/lancelot/scripts/conical_gradients.qps new file mode 100644 index 0000000..2e897b1 --- /dev/null +++ b/tests/auto/lancelot/scripts/conical_gradients.qps @@ -0,0 +1,85 @@ +# Version: 1 +# CheckVsReference: 5% + +path_addRect path 300 0 80 80 +path_addEllipse path 340 40 60 60 + +setRenderHint Antialiasing + +setPen black + +begin_block gradients +gradient_clearStops +gradient_appendStop 0 red +gradient_appendStop 0.25 orange +gradient_appendStop 0.5 yellow +gradient_appendStop 0.8 green +gradient_appendStop 1 cyan + +gradient_setConical 40 40 50 +drawRect 0 0 100 100 + +gradient_setConical 140 40 230 +drawEllipse 100 0 100 100 + +gradient_clearStops +gradient_appendStop 0 3f7f7fff +gradient_appendStop 0.5 dfdfffff +gradient_appendStop 1 7f00007f + +gradient_setConical 240 40 50 +drawPolygon [200 0 290 0 250 99] + +gradient_setConical 340 40 230 +drawPath path + +end_block + +translate 0 100 +scale 1 2 +repeat_block gradients + +resetMatrix +translate 0 300 +brushTranslate 30 0 +brushScale 0.9 0.9 +brushRotate 20 +repeat_block gradients + +# Some helpful info perhaps? +resetMatrix +setPen black + +drawText 410 50 "No XForm" +drawText 410 200 "scale 1x2" +drawText 410 300 "brush transform" +drawText 10 450 "50 deg" +drawText 110 450 "230 deg" +drawText 210 450 "50 deg w/alpha " +drawText 310 450 "230 deg w/alpha" + +setPen 3f000000 +setBrush nobrush + +begin_block ellipse_draw + setClipRect 0 0 100 100 + drawEllipse 35 35 11 11 + save + translate 40 40 + rotate -50 + drawLine -100 0 100 0 + restore + translate 100 0 +end_block + +repeat_block ellipse_draw +repeat_block ellipse_draw +repeat_block ellipse_draw + +resetMatrix +translate 0 100 +scale 1 2 +repeat_block ellipse_draw +repeat_block ellipse_draw +repeat_block ellipse_draw +repeat_block ellipse_draw \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/conical_gradients_perspectives.qps b/tests/auto/lancelot/scripts/conical_gradients_perspectives.qps new file mode 100644 index 0000000..a9c14f1 --- /dev/null +++ b/tests/auto/lancelot/scripts/conical_gradients_perspectives.qps @@ -0,0 +1,64 @@ +# Version: 1 +# CheckVsReference: 5% + + +setRenderHint Antialiasing + +setPen #00ff00 + +translate 10 10 +# standard draw +begin_block gradient +gradient_clearStops +gradient_appendStop 0 red +gradient_appendStop 0.25 orange +gradient_appendStop 0.5 yellow +gradient_appendStop 0.8 green +gradient_appendStop 0.9 cyan +gradient_appendStop 1 red + +gradient_setSpread PadSpread +gradient_setConical 140 140 100 +drawRect 0 0 300 300 +end_block gradient + +# Rotation w/o smooth xform +save +translate 350 0 +save + setRenderHint SmoothPixmapTransform on + mapQuadToQuad 0 0 0 300 300 300 300 0 0 50 0 200 300 300 300 0 + repeat_block gradient +restore +restore + +translate 0 320 + +save + setRenderHint SmoothPixmapTransform on + mapQuadToQuad 0 0 0 300 300 300 300 0 0 0 100 300 200 300 300 0 + repeat_block gradient +restore + +save +translate 350 0 +save + setRenderHint SmoothPixmapTransform on + mapQuadToQuad 0 0 0 300 300 300 300 0 0 0 0 300 300 250 300 50 + repeat_block gradient +restore +restore + + +resetMatrix +setPen black +translate 125 20 +drawText 0 0 "No transform" +translate 350 0 +drawText 0 0 "Left Tilted" +resetMatrix +translate 125 350 +drawText 0 0 "Bottom Tilted" +translate 350 0 +drawText 0 0 "Right Tilted" +translate 120 0 \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/dashes.qps b/tests/auto/lancelot/scripts/dashes.qps new file mode 100644 index 0000000..649f56c --- /dev/null +++ b/tests/auto/lancelot/scripts/dashes.qps @@ -0,0 +1,268 @@ +# Version: 1 +# CheckVsReference: 5% + +translate 20 20 + +begin_block draw +save + save + setPen black 1 SolidLine FlatCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 1 SolidLine SquareCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 1 SolidLine RoundCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + + setPen black 2 SolidLine FlatCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 2 SolidLine SquareCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 2 SolidLine RoundCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + + setPen black 6 SolidLine FlatCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 6 SolidLine SquareCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 6 SolidLine RoundCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + restore + + + translate 100 0 + save + setPen black 1 DotLine FlatCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 1 DotLine SquareCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 1 DotLine RoundCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + + setPen black 2 DotLine FlatCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 2 DotLine SquareCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 2 DotLine RoundCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + + setPen black 6 DotLine FlatCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 6 DotLine SquareCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 6 DotLine RoundCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + restore + + translate 100 0 + save + setPen black 1 DashLine FlatCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 1 DashLine SquareCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 1 DashLine RoundCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + + setPen black 2 DashLine FlatCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 2 DashLine SquareCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 2 DashLine RoundCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + + setPen black 6 DashLine FlatCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 6 DashLine SquareCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 6 DashLine RoundCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + restore + + translate 100 0 + + save + setPen black 1 DashDotLine FlatCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 1 DashDotLine SquareCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 1 DashDotLine RoundCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + + setPen black 2 DashDotLine FlatCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 2 DashDotLine SquareCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 2 DashDotLine RoundCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + + setPen black 6 DashDotLine FlatCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 6 DashDotLine SquareCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 6 DashDotLine RoundCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + restore + + translate 100 0 + + save + setPen black 1 DashDotDotLine FlatCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 1 DashDotDotLine SquareCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 1 DashDotDotLine RoundCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + + setPen black 2 DashDotDotLine FlatCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 2 DashDotDotLine SquareCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 2 DashDotDotLine RoundCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + + setPen black 4 DashDotDotLine FlatCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 4 DashDotDotLine SquareCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 4 DashDotDotLine RoundCap BevelJoin + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + restore + + translate 100 0 + + save + setPen black 1 SolidLine FlatCap BevelJoin + pen_setDashPattern [1 4 9 4 27 4] + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 1 SolidLine SquareCap BevelJoin + pen_setDashPattern [1 4 9 4 27 4] + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 1 SolidLine RoundCap BevelJoin + pen_setDashPattern [1 4 9 4 27 4] + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + + setPen black 2 SolidLine FlatCap BevelJoin + pen_setDashPattern [1 4 9 4 27 4] + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 2 SolidLine SquareCap BevelJoin + pen_setDashPattern [1 4 9 4 27 4] + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 2 SolidLine RoundCap BevelJoin + pen_setDashPattern [1 4 9 4 27 4] + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + + setPen black 4 SolidLine FlatCap BevelJoin + pen_setDashPattern [1 4 9 4 27 4] + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 4 SolidLine SquareCap BevelJoin + pen_setDashPattern [1 4 9 4 27 4] + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + setPen black 4 SolidLine RoundCap BevelJoin + pen_setDashPattern [1 4 9 4 27 4] + drawPolyline [0 0 80 0 80 30 40 20 0 30] + translate 0 40 + restore + +restore +end_block + +translate 0 400 +setRenderHint Antialiasing +repeat_block draw + +translate 0 -20 +drawText 30 0 "Solid" + +translate 100 0 +drawText 20 0 "DotLine" + +translate 100 0 +drawText 10 0 "DashLine" + +translate 100 0 +drawText 0 0 "DashDotLine" + +translate 100 0 +drawText 0 0 "DashDotDotLine" + +translate 100 0 +drawText 0 0 "CustomDashLine" + +resetMatrix + +translate 620 40 + +begin_block width_and_caps_texts + drawText 0 0 "Width=1, FlatCap" + translate 0 40 + drawText 0 0 "Width=1, SquareCap" + translate 0 40 + drawText 0 0 "Width=1, RoundCap" + translate 0 40 + drawText 0 0 "Width=2, FlatCap" + translate 0 40 + drawText 0 0 "Width=2, SquareCap" + translate 0 40 + drawText 0 0 "Width=2, RoundCap" + translate 0 40 + drawText 0 0 "Width=6, FlatCap" + translate 0 40 + drawText 0 0 "Width=6, SqareCap" + translate 0 40 + drawText 0 0 "Width=6, RoundCap" +end_block + +translate 0 80 +repeat_block width_and_caps_texts \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/degeneratebeziers.qps b/tests/auto/lancelot/scripts/degeneratebeziers.qps new file mode 100644 index 0000000..fb223d5 --- /dev/null +++ b/tests/auto/lancelot/scripts/degeneratebeziers.qps @@ -0,0 +1,10 @@ +# Version: 1 +# CheckVsReference: 5% + +path_moveTo degenerate 3427.0918499999997948 3872.1318999999998596 +path_cubicTo degenerate 3427.0918499999997948 3872.1318999999994048 4729.4590867905308187 5176.8613451144155988 5389.9325499999995372 5837.8072499999998399 + +scale 0.05 0.05 +translate -2500 -3000 +setPen black 800 +drawPath degenerate \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/deviceclipping.qps b/tests/auto/lancelot/scripts/deviceclipping.qps new file mode 100644 index 0000000..cedfc1e --- /dev/null +++ b/tests/auto/lancelot/scripts/deviceclipping.qps @@ -0,0 +1,48 @@ +# Version: 1 +# CheckVsReference: 5% + +setBrush 0xff7f7f +setPen 0x7f0000 + +path_moveTo path -1000000 10000 +path_cubicTo path 100 100 100 150 150 400 +path_closeSubpath path + +begin_block drawing + + drawPath ellipse + + drawLine -1000000 200 200 200 + drawLine 200 -1000000 200 200 + drawLine 200 200 1000000 200 + drawLine 200 200 200 1000000 + drawLine -1000000 -1000000 200 200 + + drawPolygon [-1000000 100 100 -1000000 100 100] + drawRect 300 -500000 1000000 1000000 + + drawPath path + +end_block + +save +translate 20 20 +setBrush #0x7f7f7fff +setPen #0x7f00007f +repeat_block drawing + +translate 20 20 +setRenderHint Antialiasing +setBrush #0x7f7fff7f +setPen #0x7f007f00 +repeat_block drawing +restore + +setPen 0x00007f 2 +setRenderHint Antialiasing + +drawLine 0 -200 200 200 + +setPen 0x007f00 10 + +drawLine 0 -200 200 0 \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/drawpoints.qps b/tests/auto/lancelot/scripts/drawpoints.qps new file mode 100644 index 0000000..c02cd85 --- /dev/null +++ b/tests/auto/lancelot/scripts/drawpoints.qps @@ -0,0 +1,101 @@ +# Version: 1 +# CheckVsReference: 5% + +#setRenderHint Antialiasing + +setPen red 0 solidline +begin_block points +drawPoint 00 00 +drawPoint 10 00 +drawPoint 20 00 +drawPoint 30 00 +drawPoint 40 00 +drawPoint 50 00 +drawPoint 00 10 +drawPoint 10 10 +drawPoint 20 10 +drawPoint 30 10 +drawPoint 40 10 +drawPoint 50 10 +drawPoint 00 20 +drawPoint 10 20 +drawPoint 20 20 +drawPoint 30 20 +drawPoint 40 20 +drawPoint 50 20 +drawPoint 00 30 +drawPoint 10 30 +drawPoint 20 30 +drawPoint 30 30 +drawPoint 40 30 +drawPoint 50 30 +drawPoint 00 40 +drawPoint 10 40 +drawPoint 20 40 +drawPoint 30 40 +drawPoint 40 40 +drawPoint 50 40 +drawPoint 00 50 +drawPoint 10 50 +drawPoint 20 50 +drawPoint 30 50 +drawPoint 40 50 +drawPoint 50 50 +end_block points + +translate 100 0 +setPen blue 1 solidline +repeat_block points + +translate 100 0 +setPen green 5 solidline roundcap +repeat_block points + +resetMatrix + +translate 0 100 +scale 3 3 +setPen red 0 solidline roundcap +repeat_block points + +translate 60 0 +setPen blue 1 solidline roundcap +repeat_block points + +translate 60 0 +setPen green 5 solidline roundcap +repeat_block points + +resetMatrix + +translate 0 300 +scale 3 3 +setPen red 0 solidline flatcap +repeat_block points + +translate 60 0 +setPen blue 1 solidline flatcap +repeat_block points + +translate 60 0 +setPen green 5 solidline flatcap +repeat_block points + +resetMatrix +translate 10 500 +setPen black 1 solidline flatcap +drawPoint 0 0 +setPen black 2 solidline flatcap +drawPoint 3 0 +setPen black 3 solidline flatcap +drawPoint 8 0 +setPen black 4 solidline flatcap +drawPoint 15 0 +setPen black 5 solidline flatcap +drawPoint 24 0 +setPen black 6 solidline flatcap +drawPoint 35 0 +setPen black 7 solidline flatcap +drawPoint 48 0 +setPen black 8 solidline flatcap +drawPoint 63 0 \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/ellipses.qps b/tests/auto/lancelot/scripts/ellipses.qps new file mode 100644 index 0000000..e2cffd7 --- /dev/null +++ b/tests/auto/lancelot/scripts/ellipses.qps @@ -0,0 +1,86 @@ +# Version: 1 +# CheckVsReference: 5% + + +surface_begin 0 0 600 600 +translate 0 50 + +setPen nopen +setBrush 0x7f000000 +gradient_clearStops +gradient_appendStop 0 red +gradient_appendStop 0.25 orange +gradient_appendStop 0.5 yellow +gradient_appendStop 0.8 green +gradient_appendStop 1 cyan + +gradient_setSpread PadSpread +gradient_setRadial 20 20 220 200 + +drawEllipse 10 10 80 80 +drawEllipse 50 50 120 90 + +translate 100 0 +brushTranslate 40 20 +brushScale 0.25 0.25 + +setPen black + +drawEllipse 10 10 80 80 +setOpacity 0.5 +setCompositionMode SourceIn +drawEllipse 50 50 120 90 +setOpacity 1.0 +setRenderHint Antialiasing +setCompositionMode Xor +brushTranslate 70 0 +translate 100 0 +drawEllipse 10 10 80 80 + +setPen nopen +drawEllipse 50 50 120 90 + +setOpacity 0.7 +setBrush red +translate 100 0 +setCompositionMode SourceOver + +drawEllipse 10 10 80 80 + +setOpacity 0.6 +setPen black 5.0 +gradient_clearStops +gradient_appendStop 0 red +gradient_appendStop 0.25 orange +gradient_appendStop 0.5 yellow +gradient_appendStop 0.8 green +gradient_appendStop 1 cyan + +gradient_setSpread PadSpread +gradient_setLinear 20 20 120 100 +drawEllipse 50 50 120 90 + + +translate 100 0 + +setOpacity 1.0 +drawEllipse 10 10 80 80 + +setCompositionMode SourceIn +setOpacity 0.7 +setPen black 3.0 +gradient_clearStops +gradient_appendStop 0 red +gradient_appendStop 0.25 orange +gradient_appendStop 0.5 yellow +gradient_appendStop 0.8 green +gradient_appendStop 1 cyan + +gradient_setSpread PadSpread +gradient_setLinear 50 50 80 90 +drawEllipse 50 50 120 90 + +surface_end + +drawText 200 220 "Testing Ellipse drawing with varios combinations" +drawText 200 240 "of features such as brushes, pens and composition modes" \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/filltest.qps b/tests/auto/lancelot/scripts/filltest.qps new file mode 100644 index 0000000..2eeba2e --- /dev/null +++ b/tests/auto/lancelot/scripts/filltest.qps @@ -0,0 +1,413 @@ +# Version: 1 +# CheckVsReference: 5% + +setPen nopen +setBrush red +translate 0 4 +begin_block polys +drawPolygon [0 0 2 -2 4 0] +drawPolygon [0 2 2 4 4 2] +end_block polys +translate 6 .5 +repeat_block polys +translate 6.5 0 +repeat_block polys +translate 6 .5 +repeat_block polys + +resetMatrix + +translate 0 12 +setPen black +drawPolygon [0 0 5 0 5 5 0 5] + +translate 10 0 +setPen nopen +drawPolygon [0 0 5 0 5 5 0 5] + +translate 10 0 +drawPolygon [0 0 5 0 5 5 0 5] + +setBrush black +path_addRect stroke -.5 -.5 6 6 +path_addRect stroke .5 .5 4 4 +drawPath stroke + +resetMatrix + +translate 0 65 + +setPen red +drawText 0 0 "path" +drawText 40 0 "rect" +drawText 80 0 "img" +drawText 120 0 "pix" +drawText 160 0 "brush" +setPen nopen + +translate 0 5 + +image_load border.png img +pixmap_load border.png pix + +path_addRect rect 0 0 10 10 +begin_block rects +drawPath rect +drawRect 40 0 10 10 +drawImage img 80 0 +drawPixmap pix 120 0 +setBrush border.png +drawRect 160 0 10 10 +setBrush black +end_block rects + +setPen red +drawText 180 10 "0.0" +setPen nopen + +translate 0.1 20 +repeat_block rects +setPen red +drawText 180 10 "0.1" +setPen nopen +translate 0.1 20 +repeat_block rects +setPen red +drawText 180 10 "0.2" +setPen nopen +translate 0.1 20 +repeat_block rects +setPen red +drawText 180 10 "0.3" +setPen nopen +translate 0.1 20 +repeat_block rects +setPen red +drawText 180 10 "0.4" +setPen nopen +translate 0.1 20 +repeat_block rects +setPen red +drawText 180 10 "0.5" +setPen nopen +translate 0.1 20 +repeat_block rects +setPen red +drawText 180 10 "0.6" +setPen nopen +translate 0.1 20 +repeat_block rects +setPen red +drawText 180 10 "0.7" +setPen nopen +translate 0.1 20 +repeat_block rects +setPen red +drawText 180 10 "0.8" +setPen nopen +translate 0.1 20 +repeat_block rects +setPen red +drawText 180 10 "0.9" +setPen nopen +translate 0.1 20 +repeat_block rects +setPen red +drawText 180 10 "1.0" +setPen nopen + +resetMatrix + +translate 0 400 + +setPen red +drawText 0 10 "path" +drawText 0 30 "rect" +drawText 0 50 "img" +drawText 0 70 "pix" +drawText 0 90 "brush" +drawText 0 110 "stroke" +drawText 0 130 "scale" +drawText 0 170 "rotate" +setPen nopen + +translate 50 0 + +begin_block rects +drawPath rect +drawRect 0 20 10 10 +drawImage img 0 40 +drawPixmap pix 0 60 +save +setBrush border.png +drawRect 0 80 10 10 +translate 0 100 +setBrush red +setPen black +drawRect 0 0 10 10 +setBrush border.png +setPen nopen +translate 0 20 +scale 2 2 +drawRect 0 0 10 10 +translate 10 20 +rotate 90 +drawRect 0 0 10 10 +restore +end_block rects + +setPen red +drawText -5 -10 "0.0" +setPen nopen + +translate 40 0.1 +repeat_block rects +setPen red +drawText -5 -10 "0.1" +setPen nopen +translate 40 0.1 +repeat_block rects +setPen red +drawText -5 -10 "0.2" +setPen nopen +translate 40 0.1 +repeat_block rects +setPen red +drawText -5 -10 "0.3" +setPen nopen +translate 40 0.1 +repeat_block rects +setPen red +drawText -5 -10 "0.4" +setPen nopen +translate 40 0.1 +repeat_block rects +setPen red +drawText -5 -10 "0.5" +setPen nopen +translate 40 0.1 +repeat_block rects +setPen red +drawText -5 -10 "0.6" +setPen nopen +translate 40 0.1 +repeat_block rects +setPen red +drawText -5 -10 "0.7" +setPen nopen +translate 40 0.1 +repeat_block rects +setPen red +drawText -5 -10 "0.8" +setPen nopen +translate 40 0.1 +repeat_block rects +setPen red +drawText -5 -10 "0.9" +setPen nopen +translate 40 0.1 +repeat_block rects +setPen red +drawText -5 -10 "1.0" +setPen nopen + +resetMatrix + +translate 0 620 + +setPen red +drawText 0 10 "path" +setPen nopen + +path_addRect rect2 -5 -5 10 10 + +translate 55 5 +drawPath rect2 + +translate 20 0 +rotate 10 +drawPath rect2 +rotate -10 +translate 20 0 +rotate 20 +drawPath rect2 +rotate -20 +translate 20 0 +rotate 30 +drawPath rect2 +rotate -30 +translate 20 0 +rotate 40 +drawPath rect2 +rotate -40 +translate 20 0 +rotate 50 +drawPath rect2 +rotate -50 +translate 20 0 +rotate 60 +drawPath rect2 +rotate -60 +translate 20 0 +rotate 70 +drawPath rect2 +rotate -70 +translate 20 0 +rotate 80 +drawPath rect2 +rotate -80 +translate 20 0 +rotate 90 +drawPath rect2 +rotate -90 + +resetMatrix + +translate 0 600 + +setPen red +drawText 0 10 "rect" +setPen nopen + +translate 55 5 +drawRect -5 -5 10 10 + +translate 20 0 +rotate 10 +drawRect -5 -5 10 10 +rotate -10 +translate 20 0 +rotate 20 +drawRect -5 -5 10 10 +rotate -20 +translate 20 0 +rotate 30 +drawRect -5 -5 10 10 +rotate -30 +translate 20 0 +rotate 40 +drawRect -5 -5 10 10 +rotate -40 +translate 20 0 +rotate 50 +drawRect -5 -5 10 10 +rotate -50 +translate 20 0 +rotate 60 +drawRect -5 -5 10 10 +rotate -60 +translate 20 0 +rotate 70 +drawRect -5 -5 10 10 +rotate -70 +translate 20 0 +rotate 80 +drawRect -5 -5 10 10 +rotate -80 +translate 20 0 +rotate 90 +drawRect -5 -5 10 10 +rotate -90 + +resetMatrix +path_addRect vertical 0.1 0.1 0.2 10 + +translate 0 320 +drawPath vertical +translate 2.2 0 +drawPath vertical +translate 2.2 0 +drawPath vertical +translate 2.2 0 +drawPath vertical +translate 2.2 0 +drawPath vertical + +resetMatrix +path_addRect horizontal 0.1 0.1 10 0.2 + +translate 0 340 +drawPath horizontal +translate 0 2.2 +drawPath horizontal +translate 0 2.2 +drawPath horizontal +translate 0 2.2 +drawPath horizontal +translate 0 2.2 +drawPath horizontal + +setOpacity 0.8 +resetMatrix + +translate 0.1 24.7 +translate 400 0 +#rotate 88.8 +rotate 89.9 +setBrush red +drawPolygon [0 0 300 0 0 173] +setBrush green +drawPolygon [0 173 300 0 300 173] + +resetMatrix + +translate 410 24 +path_lineTo left 0 273 +path_lineTo left 300 273 +path_cubicTo left 50 273 250 0 0 0 + +path_cubicTo right 250 0 50 273 300 273 +path_lineTo right 300 0 + +translate 310 0 +rotate 90 +setBrush red +drawPath left +setBrush green +drawPath right + +resetMatrix +translate 0.1 680.1 +setPen red +setOpacity 1 +drawText 115 -20 "0.1" +drawText 0 0 "pixmap w/ opacity" +setOpacity 0.6 +drawPixmap pix 120 -10 +translate 0 20 +setOpacity 1 +drawText 0 0 "image w/ opacity" +setOpacity 0.6 +drawImage img 120 -10 + +resetMatrix +path_lineTo fillpath 0 50 +path_lineTo fillpath 50 50 +path_moveTo fillpath 70 50 +path_lineTo fillpath 70 100 +path_lineTo fillpath 40 100 +translate 500 400 +drawPath fillpath + +resetMatrix +path_moveTo vectorarne 50 10 +path_lineTo vectorarne 50 50 +path_lineTo vectorarne 100 50 +path_addEllipse vectorarne 350 20 230 230 +path_moveTo vectorarne 500 500 +path_cubicTo vectorarne 20 20 250 30 50 150 +translate 500 550 +scale 0.4 0.4 +setRenderHint antialiasing +drawPath vectorarne + +resetMatrix +translate 200 730 +setRenderHint antialiasing off +setOpacity 1 +setPen red +drawText 0 0 "outline/fill consistency" +setPen red +setBrush green +translate 80 -30 +drawPolygon [13.6965 -99.1837 -71.4767 13.823 32.4596 -33.1847] \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/gradients.qps b/tests/auto/lancelot/scripts/gradients.qps new file mode 100644 index 0000000..eb3cda9 --- /dev/null +++ b/tests/auto/lancelot/scripts/gradients.qps @@ -0,0 +1,44 @@ +# Version: 1 +# CheckVsReference: 5% + +drawText 75 20 "Linear" +drawText 176 20 "Radial" +drawText 277 20 "Conical" +translate 0 30 +drawText 0 50 "AA off" +drawText 0 151 "AA on" + +setPen nopen + +gradient_clearStops +gradient_appendStop 0 0x00000000 +gradient_appendStop 0.001 red +gradient_appendStop 0.2 blue +gradient_appendStop 0.4 yellow +gradient_appendStop 0.6 cyan +gradient_appendStop 0.8 green +gradient_appendStop 0.999 red +gradient_appendStop 1 0x00000000 + +gradient_setSpread PadSpread +gradient_setCoordinateMode ObjectBoundingMode + +begin_block row +save +gradient_setLinear 0.1 0.0 0.9 0.0 +drawRect 50 0 100 100 + +gradient_setRadial 0.5 0.5 0.5 0.5 0.5 +translate 101 0 +drawRect 50 0 100 100 + +gradient_setConical 0.5 0.5 45 +translate 101 0 +drawRect 50 0 100 100 +restore +end_block row + +setRenderHint Antialiasing + +translate 0 101 +repeat_block row \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/image_formats.qps b/tests/auto/lancelot/scripts/image_formats.qps new file mode 100644 index 0000000..d817d04 --- /dev/null +++ b/tests/auto/lancelot/scripts/image_formats.qps @@ -0,0 +1,81 @@ +# Version: 1 +# CheckVsReference: 5% + + +image_load dome_argb32.png the_pixmap +image_convertToFormat the_pixmap the_pixmap ARGB32_Premultiplied + +begin_block draw_stuff + save + image_convertToFormat the_pixmap converted ARGB32_Premultiplied + drawImage converted 0 0 + translate 0 110 + + image_convertToFormat the_pixmap converted ARGB32 + drawImage converted 0 0 + translate 0 110 + + image_convertToFormat the_pixmap converted RGB32 + drawImage converted 0 0 + translate 0 110 + + image_convertToFormat the_pixmap converted Indexed8 + drawImage converted 0 0 + translate 0 110 + + image_convertToFormat the_pixmap converted MonoLSB + drawImage converted 0 0 + translate 0 110 + + image_convertToFormat the_pixmap converted Mono + drawImage converted 0 0 + translate 0 110 + restore +end_block + + +image_load dome_argb32.png the_pixmap +translate 110 0 +repeat_block draw_stuff + + +image_load dome_rgb32.png the_pixmap +translate 110 0 +repeat_block draw_stuff + +image_load dome_indexed.png the_pixmap +translate 110 0 +repeat_block draw_stuff + + +image_load dome_mono.png the_pixmap +translate 110 0 +repeat_block draw_stuff + +image_load dome_mono_palette.png the_pixmap +translate 110 0 +repeat_block draw_stuff + +image_load dome_indexed_mask.png the_pixmap +translate 110 0 +repeat_block draw_stuff + + +# helpful texts +resetMatrix +setPen black + +drawText 10 670 "ARGB32_PM" +drawText 120 670 "ARGB32" +drawText 230 670 "RGB32" +drawText 340 670 "Indexed" +drawText 450 670 "Mono" +drawText 560 670 "Mono w/lut" +drawText 670 670 "Indexed w/mask" + +drawText 770 50 "ARGB32_PM" +drawText 770 160 "ARGB32" +drawText 770 270 "RGB32" +drawText 770 380 "Indexed" +drawText 770 490 "MonoLSB" +drawText 770 600 "Mono" \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/images.qps b/tests/auto/lancelot/scripts/images.qps new file mode 100644 index 0000000..3f89240 --- /dev/null +++ b/tests/auto/lancelot/scripts/images.qps @@ -0,0 +1,106 @@ +# Version: 1 +# CheckVsReference: 5% + + +setRenderHint Antialiasing + +setPen #00ff00 + +image_load dome_argb32.png the_image +begin_block draw_stuff + +save + + # standard draw + drawImage the_image 0 0 + + # sub recting + translate 120 0 + drawImage the_image 0 0 40 40 0 0 40 40 + drawImage the_image 60 0 40 40 60 0 40 40 + drawImage the_image 0 60 40 40 0 60 40 40 + drawImage the_image 60 60 40 40 60 60 40 40 + drawImage the_image 0 40 40 20 0 40 40 20 + drawImage the_image 60 40 40 20 60 40 40 20 + drawImage the_image 40 0 20 100 40 0 20 100 + + # subrecting w/scale + translate 120 0 + drawImage the_image 0 0 50 50 0 0 25 25 + drawImage the_image 50 0 50 50 25 0 25 25 + drawImage the_image 0 50 50 50 0 25 25 25 + drawImage the_image 50 50 50 50 25 25 25 25 + + # subrecting w/scale & smooth xform + translate 120 0 + setRenderHint SmoothPixmapTransformation + drawImage the_image 0 0 50 50 0 0 25 25 + drawImage the_image 50 0 50 50 25 0 25 25 + drawImage the_image 0 50 50 50 0 25 25 25 + drawImage the_image 50 50 50 50 25 25 25 25 + + + # Rotation w/o smooth xform + translate 120 0 + save + setRenderHint SmoothPixmapTransform off + rotate 10 + drawImage the_image 0 0 + restore + + # Rotation w smooth xform + translate 120 0 + save + setRenderHint SmoothPixmapTransform + rotate 10 + drawImage the_image 0 0 + restore + +restore + +end_block + + +translate 0 120 +image_load dome_rgb32.png the_image +repeat_block draw_stuff + +translate 0 120 +image_load dome_indexed.png the_image +repeat_block draw_stuff + +translate 0 120 +image_load dome_indexed_mask.png the_image +repeat_block draw_stuff + +translate 0 120 +image_load dome_mono.png the_image +repeat_block draw_stuff + + +resetMatrix +translate 700 60 +setPen black +drawText 0 0 "32 bit w/alpha" +translate 0 120 +drawText 0 0 "32 bit w/o alpha" +translate 0 120 +drawText 0 0 "8 bit indexed" +translate 0 120 +drawText 0 0 "8 bit indexed w/mask" +translate 0 120 +drawText 0 0 "1 bit" +resetMatrix +translate 0 600 +drawText 0 0 "normal" +translate 120 0 +drawText 0 0 "subrect" +translate 120 0 +drawText 0 0 "subrect scale" +translate 120 0 +drawText 0 0 "subrect scale smooth" +translate 120 0 +drawText 0 0 "xform" +translate 120 0 +drawText 0 0 "smooth xform" +translate 120 0 \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/images2.qps b/tests/auto/lancelot/scripts/images2.qps new file mode 100644 index 0000000..5159abc --- /dev/null +++ b/tests/auto/lancelot/scripts/images2.qps @@ -0,0 +1,145 @@ +# Version: 1 +# CheckVsReference: 5% + +image_load dome_argb32.png the_image +begin_block draw_stuff + +save + # standard draw + drawImage the_image 0 0 + + # flip x + translate 220 0 + scale -1 1 + drawImage the_image 0 0 + scale -1 1 + + # flip y + translate 20 100 + scale 1 -1 + drawImage the_image 0 0 + scale 1 -1 + + # flip x and y + translate 220 0 + scale -1 -1 + drawImage the_image 0 0 + scale -1 -1 + + # flip y and scale + translate 20 10 + save + scale 1 -1.1 + drawImage the_image 0 0 + restore + + # flip y and scale + translate 220 -110 + save + scale -1.1 0.9 + drawImage the_image 0 0 + restore +restore +end_block + +setRenderHint Antialiasing + +resetMatrix +translate 0 120 +repeat_block draw_stuff + +resetMatrix +translate 720 60 +setPen black +drawText 0 0 "aliased" +translate 0 120 +drawText 0 0 "antialiased" +resetMatrix +translate 0 260 +drawText 0 0 "normal" +translate 120 0 +drawText 0 0 "flip x" +translate 120 0 +drawText 0 0 "flip y" +translate 120 0 +drawText 0 0 "flip x and y" +translate 120 0 +drawText 0 0 "flip y and scale" +translate 120 0 +drawText 0 0 "flip x and scale" +translate 120 0 + +setRenderHint SmoothPixmapTransform + +resetMatrix +translate 20 300 +drawImage border.png 0 0 100 100 1 1 8 8 +drawText 0 -5 "subrect color bleeding" +translate 0 120 +drawImage border.png 0 0 100 100 0 0 10 10 + +image_load sign.png the_image +resetMatrix +drawText 240 300 "drawImage() with varying sx/sy offsets" +translate 0 10 +drawRect 240 300 50 50 +drawImage the_image 240 300 50 50 20 0 80 80 +drawRect 300 300 50 50 +drawImage the_image 300 300 50 50 -20 0 80 80 +drawRect 240 370 50 50 +drawImage the_image 240 370 50 50 0 20 80 80 +drawRect 300 370 50 50 +drawImage the_image 300 370 50 50 0 -20 80 80 + +pixmap_load sign.png the_pixmap +translate 220 0 +translate 0 -10 +drawText 240 300 "drawPixmap() with varying sx/sy offsets" +translate 0 10 +drawRect 240 300 50 50 +drawPixmap the_pixmap 240 300 50 50 20 0 80 80 +drawRect 300 300 50 50 +drawPixmap the_pixmap 300 300 50 50 -20 0 80 80 +drawRect 240 370 50 50 +drawPixmap the_pixmap 240 370 50 50 0 20 80 80 +drawRect 300 370 50 50 +drawPixmap the_pixmap 300 370 50 50 0 -20 80 80 + + +resetMatrix +translate 0 170 +drawText 240 300 "drawImage() with varying sx/sy offsets" +translate 0 10 +drawRect 240 300 50 50 +drawImage the_image 240 300 50 50 50 0 50 50 +drawRect 300 300 50 50 +drawImage the_image 300 300 50 50 -20 0 50 50 +drawRect 240 370 50 50 +drawImage the_image 240 370 50 50 0 50 50 50 +drawRect 300 370 50 50 +drawImage the_image 300 370 50 50 0 -20 50 50 + +resetMatrix +translate 220 170 +drawText 240 300 "drawPixmap() with varying sx/sy offsets" +translate 0 10 +drawRect 240 300 50 50 +drawPixmap the_pixmap 240 300 50 50 50 0 50 50 +drawRect 300 300 50 50 +drawPixmap the_pixmap 300 300 50 50 -20 0 50 50 +drawRect 240 370 50 50 +drawPixmap the_pixmap 240 370 50 50 0 50 50 50 +drawRect 300 370 50 50 +drawPixmap the_pixmap 300 370 50 50 0 -20 50 50 + +resetMatrix +drawText 10 620 "drawImage/Pixmap() with negative x/y and sx/sy" +setPen red + +translate 20 640 +drawImage the_image -10 -10 -1 -1 -10 -10 0 0 +drawRect 0 0 80 80 + +translate 100 0 +drawPixmap the_pixmap -10 -10 -1 -1 -10 -10 0 0 +drawRect 0 0 80 80 diff --git a/tests/auto/lancelot/scripts/join_cap_styles.qps b/tests/auto/lancelot/scripts/join_cap_styles.qps new file mode 100644 index 0000000..ed823f5 --- /dev/null +++ b/tests/auto/lancelot/scripts/join_cap_styles.qps @@ -0,0 +1,63 @@ +# Version: 1 +# CheckVsReference: 5% + + +setRenderHint Antialiasing + +path_moveTo p 20 20 +path_cubicTo p 100 20 100 180 180 100 +path_lineTo p 20 180 +path_lineTo p 180 20 + +setPen black 20 solidline roundcap roundjoin +drawPath p +setPen red +drawPath p + +translate 200 0 +setPen black 20 solidline roundcap miterjoin +drawPath p +setPen red +drawPath p + +translate 200 0 +setPen black 20 solidline roundcap beveljoin +drawPath p +setPen red +drawPath p + +translate -400 200 +setPen black 20 solidline squarecap roundjoin +drawPath p +setPen red +drawPath p + +translate 200 0 +setPen black 20 solidline squarecap miterjoin +drawPath p +setPen red +drawPath p + +translate 200 0 +setPen black 20 solidline squarecap beveljoin +drawPath p +setPen red +drawPath p + +translate -400 200 +setPen black 20 solidline flatcap roundjoin +drawPath p +setPen red +drawPath p + +translate 200 0 +setPen black 20 solidline flatcap miterjoin +drawPath p +setPen red +drawPath p + +translate 200 0 +setPen black 20 solidline flatcap beveljoin +drawPath p +setPen red +drawPath p \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/join_cap_styles_duplicate_control_points.qps b/tests/auto/lancelot/scripts/join_cap_styles_duplicate_control_points.qps new file mode 100644 index 0000000..b463014 --- /dev/null +++ b/tests/auto/lancelot/scripts/join_cap_styles_duplicate_control_points.qps @@ -0,0 +1,68 @@ +# Version: 1 +# CheckVsReference: 1% (0 0 600 650) + + +setRenderHint Antialiasing + +path_moveTo p 40 70 +path_lineTo p 20 70 +path_cubicTo p 20 70 40 20 80 80 + +path_moveTo p 20 120 +path_cubicTo p 50 60 80 110 80 110 +path_lineTo p 60 110 + +scale 2 2 + +setPen black 10 solidline roundcap roundjoin +drawPath p +setPen red +drawPath p + +translate 100 0 +setPen black 10 solidline roundcap miterjoin +drawPath p +setPen red +drawPath p + +translate 100 0 +setPen black 10 solidline roundcap beveljoin +drawPath p +setPen red +drawPath p + +translate -200 100 +setPen black 10 solidline squarecap roundjoin +drawPath p +setPen red +drawPath p + +translate 100 0 +setPen black 10 solidline squarecap miterjoin +drawPath p +setPen red +drawPath p + +translate 100 0 +setPen black 10 solidline squarecap beveljoin +drawPath p +setPen red +drawPath p + +translate -200 100 +setPen black 10 solidline flatcap roundjoin +drawPath p +setPen red +drawPath p + +translate 100 0 +setPen black 10 solidline flatcap miterjoin +drawPath p +setPen red +drawPath p + +translate 100 0 +setPen black 10 solidline flatcap beveljoin +drawPath p +setPen red +drawPath p \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/linear_gradients.qps b/tests/auto/lancelot/scripts/linear_gradients.qps new file mode 100644 index 0000000..b1b8dd6 --- /dev/null +++ b/tests/auto/lancelot/scripts/linear_gradients.qps @@ -0,0 +1,144 @@ +# Version: 1 +# CheckVsReference: 2% (0 0 600 750) + +path_addRect path 400 0 80 80 +path_addEllipse path 440 40 60 60 + +setRenderHint Antialiasing + +setPen black + +begin_block gradients +gradient_clearStops +gradient_appendStop 0 red +gradient_appendStop 0.25 orange +gradient_appendStop 0.5 yellow +gradient_appendStop 0.8 green +gradient_appendStop 1 cyan + +gradient_setSpread PadSpread +gradient_setLinear 20 20 70 70 +drawRect 0 0 100 100 + +gradient_setSpread ReflectSpread +gradient_setLinear 120 20 170 70 +drawEllipse 100 0 100 100 + +gradient_setSpread RepeatSpread +gradient_setLinear 220 20 270 70 +drawRoundRect 200 0 100 100 + +gradient_clearStops +gradient_appendStop 0 3f7f7fff +gradient_appendStop 0.5 dfdfffff +gradient_appendStop 1 7f00007f + +gradient_setSpread PadSpread +gradient_setLinear 320 20 340 40 +drawPolygon [300 0 390 0 350 99] + +gradient_setSpread ReflectSpread +gradient_setLinear 420 20 440 40 +drawPath path + +gradient_setSpread RepeatSpread +gradient_setLinear 520 20 540 40 +drawPie 500 0 100 100 720 4320 +end_block + +translate 0 100 +scale 1 2 +repeat_block gradients + +resetMatrix +translate 0 300 +brushTranslate 30 0 +brushScale 0.9 0.9 +brushRotate 20 +repeat_block gradients + +# Vertical gradient tests +resetMatrix +setBrush noBrush +translate 0 400 + +begin_block vertical_gradients +gradient_clearStops +gradient_appendStop 0 red +gradient_appendStop 0.25 orange +gradient_appendStop 0.5 yellow +gradient_appendStop 0.8 green +gradient_appendStop 1 cyan + +gradient_setSpread PadSpread +gradient_setLinear 20 20 20 70 +drawRect 0 0 100 100 + +gradient_setSpread ReflectSpread +gradient_setLinear 120 20 120 70 +drawEllipse 100 0 100 100 + +gradient_setSpread RepeatSpread +gradient_setLinear 220 20 220 70 +drawRoundRect 200 0 100 100 + +gradient_clearStops +gradient_appendStop 0 3f7f7fff +gradient_appendStop 0.5 dfdfffff +gradient_appendStop 1 7f00007f + +gradient_setSpread PadSpread +gradient_setLinear 320 20 320 40 +drawPolygon [300 0 390 0 350 99] + +gradient_setSpread ReflectSpread +gradient_setLinear 420 20 420 40 +drawPath path + +gradient_setSpread RepeatSpread +gradient_setLinear 520 20 520 40 +drawPie 500 0 100 100 720 4320 +end_block + +translate 0 100 +scale 1 1.5 +repeat_block vertical_gradients + +resetMatrix +translate 0 650 +brushTranslate 30 0 +brushScale 0.9 0.9 +brushRotate 20 +repeat_block vertical_gradients + +# Some helpful info perhaps? +resetMatrix +setPen black +# gradient line indicators +drawLine 20 20 70 70 +drawLine 120 20 170 70 +drawLine 220 20 270 70 +drawLine 320 20 340 40 +drawLine 420 20 440 40 +drawLine 520 20 540 40 + +drawLine 20 140 70 240 +drawLine 120 140 170 240 +drawLine 220 140 270 240 +drawLine 320 140 340 180 +drawLine 420 140 440 180 +drawLine 520 140 540 180 + +drawText 610 50 "No XForm" +drawText 610 200 "scale 1x2" +drawText 610 350 "brush transform" +drawText 610 450 "vertical brush" +drawText 610 570 "vertical brush scale 1x1.5" +drawText 610 700 "vertical brush transform" + +drawText 10 780 "Pad" +drawText 110 780 "Reflect" +drawText 210 780 "Repeat" +drawText 310 780 "Pad w/alpha" +drawText 410 780 "Reflect w/alpha" +drawText 510 780 "Repeat w/alpha" \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/linear_gradients_perspectives.qps b/tests/auto/lancelot/scripts/linear_gradients_perspectives.qps new file mode 100644 index 0000000..3ea39fb --- /dev/null +++ b/tests/auto/lancelot/scripts/linear_gradients_perspectives.qps @@ -0,0 +1,62 @@ +# Version: 1 + + +setRenderHint Antialiasing + +setPen #00ff00 + +translate 10 10 +# standard draw +begin_block gradient +gradient_clearStops +gradient_appendStop 0 red +gradient_appendStop 0.25 orange +gradient_appendStop 0.5 yellow +gradient_appendStop 0.8 green +gradient_appendStop 1 cyan + +gradient_setSpread PadSpread +gradient_setLinear 10 10 290 290 +drawRect 0 0 300 300 +end_block gradient + +# Rotation w/o smooth xform +save +translate 350 0 +save + setRenderHint SmoothPixmapTransform on + mapQuadToQuad 0 0 0 300 300 300 300 0 0 50 0 200 300 300 300 0 + repeat_block gradient +restore +restore + +translate 0 320 + +save + setRenderHint SmoothPixmapTransform on + mapQuadToQuad 0 0 0 300 300 300 300 0 0 0 100 300 200 300 300 0 + repeat_block gradient +restore + +save +translate 350 0 +save + setRenderHint SmoothPixmapTransform on + mapQuadToQuad 0 0 0 300 300 300 300 0 0 0 0 300 300 250 300 50 + repeat_block gradient +restore +restore + + +resetMatrix +setPen black +translate 125 20 +drawText 0 0 "No transform" +translate 350 0 +drawText 0 0 "Left Tilted" +resetMatrix +translate 125 350 +drawText 0 0 "Bottom Tilted" +translate 350 0 +drawText 0 0 "Right Tilted" +translate 120 0 \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/linear_resolving_gradients.qps b/tests/auto/lancelot/scripts/linear_resolving_gradients.qps new file mode 100644 index 0000000..779760c --- /dev/null +++ b/tests/auto/lancelot/scripts/linear_resolving_gradients.qps @@ -0,0 +1,66 @@ +# Version: 2 +# CheckVsReference: 2% (0 0 500 400) + +setRenderHint Antialiasing + +setPen black + +begin_block gradients +gradient_clearStops +gradient_appendStop 0 red +gradient_appendStop 0.25 orange +gradient_appendStop 0.5 yellow +gradient_appendStop 0.8 green +gradient_appendStop 1 cyan + +gradient_setSpread PadSpread +gradient_setCoordinateMode ObjectBoundingMode +gradient_setLinear 0.2 0.2 0.7 0.7 +drawRect 0 0 100 100 + +gradient_setSpread ReflectSpread +gradient_setLinear 0.2 0.2 0.7 0.7 +drawEllipse 100 0 100 100 + +gradient_setSpread RepeatSpread +gradient_setLinear 0.2 0.2 0.7 0.7 +drawRoundRect 200 0 100 100 + +gradient_clearStops +gradient_appendStop 0 3f7f7fff +gradient_appendStop 0.5 dfdfffff +gradient_appendStop 1 7f00007f + +gradient_setSpread PadSpread +gradient_setLinear 0.2 0.2 0.8 0.4 +drawPolygon [300 0 400 0 350 100] + +gradient_setSpread RepeatSpread +gradient_setLinear 0.2 0.2 0.4 0.4 +drawPie 400 0 100 100 0 4320 +end_block + +translate 0 100 +scale 1 2 +repeat_block gradients + +resetMatrix +translate 0 300 +brushTranslate 30 0 +brushScale 0.9 0.9 +brushRotate 20 +repeat_block gradients + +# Some helpful info perhaps? +resetMatrix +setPen black + +drawText 510 50 "No XForm" +drawText 510 200 "scale 1x2" +drawText 510 350 "brush transform" + +drawText 10 450 "Pad" +drawText 110 450 "Reflect" +drawText 210 450 "Repeat" +drawText 310 450 "Pad w/alpha" +drawText 410 450 "Repeat w/alpha" \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/lineconsistency.qps b/tests/auto/lancelot/scripts/lineconsistency.qps new file mode 100644 index 0000000..0b40577 --- /dev/null +++ b/tests/auto/lancelot/scripts/lineconsistency.qps @@ -0,0 +1,72 @@ +# Version: 1 + +begin_block draw +setPen red +drawPolygon [1.1 1 3.3 30.6 23.1 39.2 38.9 6.5] +setPen black +drawLine 1.1 1 3.3 30.6 +drawLine 3.3 30.6 23.1 39.2 +drawLine 23.1 39.2 38.9 6.5 +drawLine 38.9 6.5 1.1 1 +end_block draw +drawText 0 60 "0.0 aligned" +translate 0.1 80.1 +repeat_block draw +drawText 0 60 "0.1 aligned" +translate 0.1 80.1 +repeat_block draw +drawText 0 60 "0.2 aligned" +translate 0.1 80.1 +repeat_block draw +drawText 0 60 "0.3 aligned" +translate 0.1 80.1 +repeat_block draw +drawText 0 60 "0.4 aligned" +translate 0.1 80.1 +repeat_block draw +drawText 0 60 "0.5 aligned" +translate 0.1 80.1 +repeat_block draw +drawText 0 60 "0.6 aligned" +translate 0.1 80.1 +repeat_block draw +drawText 0 60 "0.7 aligned" +translate 0.1 80.1 +repeat_block draw +drawText 0 60 "0.8 aligned" +translate 0.1 80.1 +repeat_block draw +drawText 0 60 "0.9 aligned" + +resetMatrix +translate 100 0 +setPen black +drawText 0 20 "Line and text, 0.0 aligned" +drawLine 0 21 160 21 +translate 0 40.1 +drawText 0 20 "Line and text, 0.1 aligned" +drawLine 0 21 160 21 +translate 0 40.1 +drawText 0 20 "Line and text, 0.2 aligned" +drawLine 0 21 160 21 +translate 0 40.1 +drawText 0 20 "Line and text, 0.3 aligned" +drawLine 0 21 160 21 +translate 0 40.1 +drawText 0 20 "Line and text, 0.4 aligned" +drawLine 0 21 160 21 +translate 0 40.1 +drawText 0 20 "Line and text, 0.5 aligned" +drawLine 0 21 160 21 +translate 0 40.1 +drawText 0 20 "Line and text, 0.6 aligned" +drawLine 0 21 160 21 +translate 0 40.1 +drawText 0 20 "Line and text, 0.7 aligned" +drawLine 0 21 160 21 +translate 0 40.1 +drawText 0 20 "Line and text, 0.8 aligned" +drawLine 0 21 160 21 +translate 0 40.1 +drawText 0 20 "Line and text, 0.9 aligned" +drawLine 0 21 160 21 \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/linedashes.qps b/tests/auto/lancelot/scripts/linedashes.qps new file mode 100644 index 0000000..ee7d18b --- /dev/null +++ b/tests/auto/lancelot/scripts/linedashes.qps @@ -0,0 +1,94 @@ +# Version: 1 + +translate 10 10 + +setPen 0xffff0000 0 solidline squarecap +translate 50 50 +begin_block draw_lines + save + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + restore +end_block + +setPen 0xffff0000 0 dotline squarecap +translate 100 0 +repeat_block draw_lines +setPen 0xffff0000 0 dashdotline squarecap +translate 100 0 +repeat_block draw_lines +setPen 0xffff0000 0 dashdotdotline squarecap +translate 100 0 +repeat_block draw_lines +setPen 0xffff0000 0 dashline squarecap +translate 100 0 +repeat_block draw_lines \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/linedashes2.qps b/tests/auto/lancelot/scripts/linedashes2.qps new file mode 100644 index 0000000..1dc4fd3 --- /dev/null +++ b/tests/auto/lancelot/scripts/linedashes2.qps @@ -0,0 +1,154 @@ +# Version: 1 +# CheckVsReference: 5% (0 0 800 800) + +translate -30 10 + +setPen 0xffff0000 0 dashline squarecap +pen_setDashPattern [10 5] + +save +translate 100 100 +begin_block lines +drawLine 100 100 200 100 +drawLine 100 100 200 200 +drawLine 100 100 100 200 +end_block + +setPen 0xffff0000 2 dashline squarecap +translate 150 0 +repeat_block lines +restore + +save +save +begin_block horizontal +drawLine 0 0 50 0 +drawLine 3 10 53 10 +drawLine 6 20 56 20 +drawLine 9 30 59 30 + +translate 0 50 + +drawLine 0 0 50 5 +drawLine 3 10 53 15 +drawLine 6 20 56 25 +drawLine 9 30 59 35 + +translate 0 50 + +drawLine 0 0 50 -5 +drawLine 3 10 53 5 +drawLine 6 20 56 15 +drawLine 9 30 59 25 +end_block +restore + +save +translate 80 0 +repeat_block horizontal +restore +save +translate 800 0 +repeat_block horizontal +restore + +translate 180 -40 +save +begin_block vertical +drawLine 0 0 0 50 +drawLine 10 3 10 53 +drawLine 20 6 20 56 +drawLine 30 9 30 59 + +translate 50 0 + +drawLine 0 0 5 50 +drawLine 10 3 15 53 +drawLine 20 6 25 56 +drawLine 30 9 35 59 + +translate 50 0 + +drawLine 0 0 -5 50 +drawLine 10 3 5 53 +drawLine 20 6 15 56 +drawLine 30 9 25 59 +end_block +restore + +save +translate 0 80 +repeat_block vertical +restore +translate 0 800 +repeat_block vertical +restore + +translate 0 200 + +setPen 0xffff0000 2 dashline squarecap +save +repeat_block horizontal +restore +save +translate 80 0 +repeat_block horizontal +restore +save +translate 780 0 +repeat_block horizontal +restore + +translate 360 -240 +save +repeat_block vertical +restore +save +translate 0 80 +repeat_block vertical +restore +translate 0 780 +repeat_block vertical + +resetMatrix +translate 40 400 +setPen 0xffff0000 5 dashdotline flatcap +pen_setDashPattern [1 1 4 1 1 4] +pen_setDashOffset -4 +drawLine 0 0 300 0 +translate 0 8 +pen_setDashOffset -2 +drawLine 0 0 300 0 +translate 0 8 +pen_setDashOffset 0 +drawLine 0 0 300 0 +translate 0 8 +pen_setDashOffset 2 +drawLine 0 0 300 0 +translate 0 8 +pen_setDashOffset 4 +drawLine 0 0 300 0 +translate 0 8 +pen_setDashOffset 6 +drawLine 0 0 300 0 +translate 0 8 +pen_setDashOffset 8 +drawLine 0 0 300 0 +translate 0 8 +pen_setDashOffset 10 +drawLine 0 0 300 0 +translate 0 8 +pen_setDashOffset 12 +drawLine 0 0 300 0 +translate 0 8 +pen_setDashOffset 14 +drawLine 0 0 300 0 +translate 0 8 +pen_setDashOffset 16 +drawLine 0 0 300 0 + +resetMatrix +setPen black 3 dashdotline +pen_setCosmetic true +translate 0 -150 +drawLine 500 160 500 410 \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/linedashes2_aa.qps b/tests/auto/lancelot/scripts/linedashes2_aa.qps new file mode 100644 index 0000000..c818ab6 --- /dev/null +++ b/tests/auto/lancelot/scripts/linedashes2_aa.qps @@ -0,0 +1,5 @@ +# Version: 1 +# CheckVsReference: 1% (0 0 800 800) + +setRenderHint LineAntialiasing +import "linedashes2.qps" \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/lines.qps b/tests/auto/lancelot/scripts/lines.qps new file mode 100644 index 0000000..c0daffb --- /dev/null +++ b/tests/auto/lancelot/scripts/lines.qps @@ -0,0 +1,558 @@ +# Version: 1 +# CheckVsReference: 5% (0 0 310 425) + + +translate 10 10 + +begin_block draw_lines + save + translate 50 50 + + save + setPen 0x7fff0000 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + restore + + # and then draw the lines the other direction + save + setPen 0x7f0000ff + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + rotate 10 + drawLine 50 0 10 0 + restore + + # and now with a clip + save + setClipRect -30 -30 60 60 + setPen 0x7f00ff00 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + rotate 10 + drawLine 10 0 50 0 + restore + + restore +end_block + +save + translate 100 0 + scale 2 2 + repeat_block draw_lines +restore + +translate 0 10 + +save + translate 0 200 + setRenderHint Antialiasing + repeat_block draw_lines +restore + +save + translate 100 200 + scale 2 2 + setRenderHint Antialiasing + repeat_block draw_lines +restore + +translate 320 0 + +setPen black 0 solidline squarecap + +begin_block lines + +# 0 -> 45 degress +drawLine 100 100 200 90 +drawLine 100 100 200 80 +drawLine 100 100 200 70 +drawLine 100 100 200 60 +drawLine 100 100 200 50 +drawLine 100 100 200 40 +drawLine 100 100 200 30 +drawLine 100 100 200 20 +drawLine 100 100 200 10 + +# 45 +drawLine 100 100 200 0 + +# 45 -> 90 +drawLine 100 100 190 0 +drawLine 100 100 180 0 +drawLine 100 100 170 0 +drawLine 100 100 160 0 +drawLine 100 100 150 0 +drawLine 100 100 140 0 +drawLine 100 100 130 0 +drawLine 100 100 120 0 +drawLine 100 100 110 0 + +# 90 +drawLine 100 100 100 0 + +# 90 -> 135 +drawLine 100 100 90 0 +drawLine 100 100 80 0 +drawLine 100 100 70 0 +drawLine 100 100 60 0 +drawLine 100 100 50 0 +drawLine 100 100 40 0 +drawLine 100 100 30 0 +drawLine 100 100 20 0 +drawLine 100 100 10 0 + +# 135 +drawLine 100 100 0 0 + +# 135 -> 180 degress +drawLine 100 100 0 10 +drawLine 100 100 0 20 +drawLine 100 100 0 30 +drawLine 100 100 0 40 +drawLine 100 100 0 50 +drawLine 100 100 0 60 +drawLine 100 100 0 70 +drawLine 100 100 0 80 +drawLine 100 100 0 90 + +# 180 +drawLine 100 100 0 100 + +# 180 -> 225 +drawLine 100 100 0 110 +drawLine 100 100 0 120 +drawLine 100 100 0 130 +drawLine 100 100 0 140 +drawLine 100 100 0 150 +drawLine 100 100 0 160 +drawLine 100 100 0 170 +drawLine 100 100 0 180 +drawLine 100 100 0 190 + +# 225 +drawLine 100 100 0 200 + +# 225 -> 270 +drawLine 100 100 10 200 +drawLine 100 100 20 200 +drawLine 100 100 30 200 +drawLine 100 100 40 200 +drawLine 100 100 50 200 +drawLine 100 100 60 200 +drawLine 100 100 70 200 +drawLine 100 100 80 200 +drawLine 100 100 90 200 + +# 270 +drawLine 100 100 100 200 + +# 270 -> 315 degrees +drawLine 100 100 110 200 +drawLine 100 100 120 200 +drawLine 100 100 130 200 +drawLine 100 100 140 200 +drawLine 100 100 150 200 +drawLine 100 100 160 200 +drawLine 100 100 170 200 +drawLine 100 100 180 200 +drawLine 100 100 190 200 + +# 315 +drawLine 100 100 200 200 + +# 315 -> 360 degress +drawLine 100 100 200 100 +drawLine 100 100 200 110 +drawLine 100 100 200 120 +drawLine 100 100 200 130 +drawLine 100 100 200 140 +drawLine 100 100 200 150 +drawLine 100 100 200 160 +drawLine 100 100 200 170 +drawLine 100 100 200 180 +drawLine 100 100 200 190 + +end_block + + +setRenderHint Antialiasing +setPen 0x7fff0000 +translate 0.5 0.5 +repeat_block lines + +setPen 0x000000 8 +translate 20 240 +drawText 0 0 "Steep slopes:" + +translate 0 10 + +drawLine 0 0 -8 400 +translate 20 0 +drawLine 0 0 -7 400 +translate 20 0 +drawLine 0 0 -6 400 +translate 20 0 +drawLine 0 0 -5 400 +translate 20 0 +drawLine 0 0 -4 400 +translate 20 0 +drawLine 0 0 -3 400 +translate 20 0 +drawLine 0 0 -2 400 +translate 20 0 +drawLine 0 0 -1 400 +translate 20 0 +drawLine 0 0 0 400 +translate 20 0 +drawLine 0 0 1 400 +translate 20 0 +drawLine 0 0 2 400 +translate 20 0 +drawLine 0 0 3 400 +translate 20 0 +drawLine 0 0 4 400 +translate 20 0 +drawLine 0 0 5 400 +translate 20 0 +drawLine 0 0 6 400 +translate 20 0 +drawLine 0 0 7 400 +translate 20 0 +drawLine 0 0 8 400 + +resetMatrix + +translate 20 450 + +drawText 0 0 "Zero length lines:" + +translate 0 20 +drawText 100 10 "Square cap" +save +begin_block points +setPen 0x000000 1 solidline squarecap +drawLine 0 0 0 0 +setPen 0x000000 2 solidline squarecap +drawLine 8 0 8 0 +setPen 0x000000 3 solidline squarecap +drawLine 16 0 16 0 +setPen 0x000000 4 solidline squarecap +drawLine 24 0 24 0 +setPen 0x000000 5 solidline squarecap +drawLine 32 0 32 0 +setPen 0x000000 6 solidline squarecap +drawLine 40 0 40 0 +setPen 0x000000 7 solidline squarecap +drawLine 48 0 48 0 +setPen 0x000000 8 solidline squarecap +drawLine 57 0 57 0 +setPen 0x000000 9 solidline squarecap +drawLine 67 0 67 0 +setPen 0x000000 10 solidline squarecap +drawLine 78 0 78 0 +end_block points +restore + +translate 0 12 +setRenderHint Antialiasing off +repeat_block points +setRenderHint Antialiasing + +translate 0 20 +drawText 100 10 "Round cap" +save +begin_block points2 +setPen 0x000000 1 solidline roundcap +drawLine 0 0 0 0 +setPen 0x000000 2 solidline roundcap +drawLine 8 0 8 0 +setPen 0x000000 3 solidline roundcap +drawLine 16 0 16 0 +setPen 0x000000 4 solidline roundcap +drawLine 24 0 24 0 +setPen 0x000000 5 solidline roundcap +drawLine 32 0 32 0 +setPen 0x000000 6 solidline roundcap +drawLine 40 0 40 0 +setPen 0x000000 7 solidline roundcap +drawLine 48 0 48 0 +setPen 0x000000 8 solidline roundcap +drawLine 57 0 57 0 +setPen 0x000000 9 solidline roundcap +drawLine 67 0 67 0 +setPen 0x000000 10 solidline roundcap +drawLine 78 0 78 0 +end_block points2 +restore + +translate 0 12 +setRenderHint Antialiasing off +repeat_block points2 +setRenderHint Antialiasing + +translate 0 20 +drawText 100 10 "Flat cap" +save +begin_block points3 +setPen 0x000000 1 solidline flatcap +drawLine 0 0 0 0 +setPen 0x000000 2 solidline flatcap +drawLine 8 0 8 0 +setPen 0x000000 3 solidline flatcap +drawLine 16 0 16 0 +setPen 0x000000 4 solidline flatcap +drawLine 24 0 24 0 +setPen 0x000000 5 solidline flatcap +drawLine 32 0 32 0 +setPen 0x000000 6 solidline flatcap +drawLine 40 0 40 0 +setPen 0x000000 7 solidline flatcap +drawLine 48 0 48 0 +setPen 0x000000 8 solidline flatcap +drawLine 57 0 57 0 +setPen 0x000000 9 solidline flatcap +drawLine 67 0 67 0 +setPen 0x000000 10 solidline flatcap +drawLine 78 0 78 0 +end_block points3 +restore + +translate 0 12 +setRenderHint Antialiasing off +repeat_block points3 + +resetMatrix +translate -220 667.226 +drawText 230 -80 "Task 194266 (should see only one line):" +setPen black +drawRect 230.5 -70.5 122 12 +setRenderHint Antialiasing +setPen red +drawLine 236.842105263 -63.775117299 247.368421053 -63.775437504 + +setRenderHint Antialiasing off +resetMatrix +translate 10 640 +setPen black +drawText 0 -10 "Task 207147 (should see two lines):" +drawRect 0.5 0.5 64 64 +setRenderHint Antialiasing +setPen red + +drawLine 4.5 4.5 4.5001 60.5 +drawLine 4.5 4.5 60.5 4.5001 + +setRenderHint Antialiasing off +resetMatrix +translate 10 730 +setPen black +drawText 0 -10 "Task 229459 (should see one diagonal line):" +drawRect 0.5 0.5 64 64 +setPen red 2 solidline flatcap + +setClipRect 2 2 63 63 +drawLine 1.5 1.5 33560000 33560000 \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/lines2.qps b/tests/auto/lancelot/scripts/lines2.qps new file mode 100644 index 0000000..af6ad65 --- /dev/null +++ b/tests/auto/lancelot/scripts/lines2.qps @@ -0,0 +1,179 @@ +# Version: 1 +# CheckVsReference: 5% + +translate 10 20 +drawText 0 0 "Thin lines" + +translate 60 70 + +save +begin_block lines +translate 0 -60 +translate 0 5 +setPen 0x000000 0.05 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 0.1 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 0.15 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 0.2 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 0.25 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 0.3 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 0.35 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 0.2 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 0.25 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 0.5 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 0.55 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 0.6 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 0.65 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 0.7 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 0.75 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 0.8 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 0.85 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 0.9 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 0.95 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 1 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 1.05 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 1.1 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 1.15 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 1.2 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 1.25 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 1.3 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 1.35 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 1.2 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 1.25 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 1.5 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 1.55 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 1.6 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 1.65 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 1.7 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 1.75 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 1.8 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 1.85 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 1.9 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 1.95 +drawLine -60 -2 60 2 +translate 0 5 +setPen 0x000000 2 +drawLine -60 -2 60 2 +end_block +restore + +save +translate 150 0 +scale -1 1 +repeat_block lines +restore + +save +translate 80 220 +rotate 90 +repeat_block lines +restore + +save +translate 80 370 +rotate 90 +scale -1 1 +repeat_block lines +restore + +setRenderHint Antialiasing + +translate 300 0 + +save +repeat_block lines +restore + +save +translate 150 0 +scale -1 1 +repeat_block lines +restore + +save +translate 80 220 +rotate 90 +repeat_block lines +restore + +save +translate 80 370 +rotate 90 +scale -1 1 +repeat_block lines +restore \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/pathfill.qps b/tests/auto/lancelot/scripts/pathfill.qps new file mode 100644 index 0000000..821b468 --- /dev/null +++ b/tests/auto/lancelot/scripts/pathfill.qps @@ -0,0 +1,38 @@ +# Version: 1 +# CheckVsReference: 1% (0 0 850 420) + +setPen afff0000 4 + +setBrush dome_rgb32.png +drawEllipse 10 10 200 200 + +setBrush dome_argb32.png +drawEllipse 220 10 200 200 + +setPen NoPen + +setBrush dome_rgb32.png +drawEllipse 10 220 200 200 + +setBrush dome_argb32.png +drawEllipse 220 220 200 200 + +setBrushOrigin -30 -30 + +setPen afff0000 4 +setBrush dome_rgb32.png +drawEllipse 430 10 200 200 + +setBrush dome_argb32.png +drawEllipse 640 10 200 200 + +setPen NoPen +setBrush dome_rgb32.png +drawEllipse 430 220 200 200 + +setBrush dome_argb32.png +drawEllipse 640 220 200 200 + +setPen black +drawText 150 450 "No offset RGB/ARGB" +drawText 550 450 "-30 offset RGB/ARGB" \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/paths.qps b/tests/auto/lancelot/scripts/paths.qps new file mode 100644 index 0000000..083026e --- /dev/null +++ b/tests/auto/lancelot/scripts/paths.qps @@ -0,0 +1,34 @@ +# Version: 1 + +setPen black +setBrush 7f7fff + +path_moveTo star 50 0 +path_lineTo star 30 90 +path_lineTo star 100 60 +path_lineTo star 0 20 +path_lineTo star 80 100 + +setFont "times" 50 +path_addText text 0 50 "ABCD, 1234, abcd, #¤%&" + +path_addRect rectncircle 0 0 75 75 +path_addEllipse rectncircle 25 25 75 75 +path_setFillRule rectncircle winding + +path_moveTo curve 100 0 +path_cubicTo curve 100 100 50 50 0 100 + +begin_block drawing +drawPath star +translate 100 0 +drawPath rectncircle +translate 100 0 +drawPath curve +translate -200 100 +drawPath text +end_block + +translate 50 100 +rotate 10 +repeat_block drawing diff --git a/tests/auto/lancelot/scripts/paths_aa.qps b/tests/auto/lancelot/scripts/paths_aa.qps new file mode 100644 index 0000000..4812e2f --- /dev/null +++ b/tests/auto/lancelot/scripts/paths_aa.qps @@ -0,0 +1,4 @@ +# Version: 1 + +setRenderHint LineAntialiasing +import "paths.qps" diff --git a/tests/auto/lancelot/scripts/pens.qps b/tests/auto/lancelot/scripts/pens.qps new file mode 100644 index 0000000..c72636d --- /dev/null +++ b/tests/auto/lancelot/scripts/pens.qps @@ -0,0 +1,133 @@ +# Version: 1 +# CheckVsReference: 1% (0 0 800 800) + + +translate 10 10 + +begin_block penstyles +setPen black 0 solidline flatcap +drawLine 0 0 100 0 +setPen black 0 dashline flatcap +drawLine 100 0 100 40 +setPen black 0 dotline flatcap +drawLine 100 40 200 0 +setPen black 0 dashdotline flatcap +drawLine 200 0 300 0 +setPen black 0 dashdotdotline flatcap +drawLine 300 0 400 40 + +translate 0 50 +setPen blue 2 solidline flatcap +drawLine 0 0 100 0 +setPen blue 2 dashline flatcap +drawLine 100 0 100 40 +setPen blue 2 dotline flatcap +drawLine 100 40 200 0 +setPen blue 2 dashdotline flatcap +drawLine 200 0 300 0 +setPen blue 2 dashdotdotline flatcap +drawLine 300 0 400 40 + +translate 0 50 +setPen red 5 solidline flatcap +drawLine 0 0 100 0 +setPen red 5 dashline flatcap +drawLine 100 0 100 40 +setPen red 5 dotline flatcap +drawLine 100 40 200 0 +setPen red 5 dashdotline flatcap +drawLine 200 0 300 0 +setPen red 5 dashdotdotline flatcap +drawLine 300 0 400 40 +end_block + +translate 0 50 +scale 1 2 +repeat_block penstyles + + +# Test cap styles +resetMatrix +translate 420 10 +setPen green 5 dashdotline flatcap +drawLine 0 0 200 0 +setPen green 5 dashdotline roundcap +drawLine 0 20 200 20 +setPen green 5 dashdotline squarecap +drawLine 0 40 200 40 + + +# Test join styles +resetMatrix +translate 420 80 +setBrush nobrush +begin_block joinstyles +setPen orange 10 solidline flatcap miterjoin +drawPolyline [ 0 0 80 0 80 80 0 80 ] + +translate 0 100 +setPen aquamarine 10 solidline squarecap beveljoin +drawPolyline [ 0 0 80 0 80 80 0 80 ] + +translate 0 100 +setPen purple 10 solidline roundcap roundjoin +drawPolyline [ 0 0 80 0 80 80 0 80 ] +end_block + +translate 130 -200 +scale 2 1 +rotate 1 +repeat_block joinstyles + +# transparent lines +resetMatrix +translate 10 400 +setPen #7f000000 +drawLine 0 0 50 0 +setPen #7f000000 1 SolidLine +drawLine 0 10 50 10 +setPen #7f000000 5 SolidLine +drawLine 0 20 50 20 +setPen #7f000000 10 SolidLine +drawLine 0 30 50 30 +setPen #7f000000 +drawLine 0 0 0 50 +setPen #7f000000 1 SolidLine +drawLine 10 0 10 50 +setPen #7f000000 5 SolidLine +drawLine 20 0 20 50 +setPen #7f000000 10 SolidLine +drawLine 30 0 30 50 + +# pen styles +resetMatrix +translate 0 500 +setPen black 0 DashLine +drawLine 20 20 100 20 +translate 0 10 +setPen black 0 DotLine +drawLine 20 20 100 20 +translate 0 10 +setPen black 0 DashDotLine +drawLine 20 20 100 20 +translate 0 10 +setPen black 0 DashDotDotLine +drawLine 20 20 100 20 + +# scaling ellipse +resetMatrix +setPen black 0.008 DashLine +translate 250 550 +rotate 30 +scale 250 250 +drawEllipse -0.4 -0.4 0.8 0.8 + +# scaling path +path_addEllipse star -0.3 -0.3 0.6 0.6 + +resetMatrix +setPen black 0.008 DashLine +translate 250 550 +rotate 30 +scale 250 250 +drawPath star diff --git a/tests/auto/lancelot/scripts/pens_aa.qps b/tests/auto/lancelot/scripts/pens_aa.qps new file mode 100644 index 0000000..066cac3 --- /dev/null +++ b/tests/auto/lancelot/scripts/pens_aa.qps @@ -0,0 +1,6 @@ +# Version: 1 +# CheckVsReference: 1% (0 0 800 800) + +setRenderHint LineAntialiasing + +import "pens.qps" \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/pens_cosmetic.qps b/tests/auto/lancelot/scripts/pens_cosmetic.qps new file mode 100644 index 0000000..d1a60d1 --- /dev/null +++ b/tests/auto/lancelot/scripts/pens_cosmetic.qps @@ -0,0 +1,110 @@ +# Version: 1 +# CheckVsReference: 1% (0 0 585 470) + +path_addEllipse path 22 0 7 7 +path_addRect path 25 5 4 4 + +translate 20 20 + +begin_block lines + save + drawLine 0 0 10 10 + drawLine 2 0 10 0 + drawLine 0 2 0 10 + drawPolygon [12 0 20 0 15 10] + drawPath path + drawEllipse 32 0 8 8 + drawPoint 36 4 + + translate 100 0 + save + scale 4 1 + drawLine 0 0 10 10 + drawLine 2 0 10 0 + drawLine 0 2 0 10 + drawPolygon [12 0 20 0 15 10] + drawPath path + drawEllipse 32 0 8 8 + drawPoint 36 4 + restore + + translate 200 0 + save + scale 1 4 + drawLine 0 0 10 10 + drawLine 2 0 10 0 + drawLine 0 2 0 10 + drawPolygon [12 0 20 0 15 10] + drawPath path + drawEllipse 32 0 8 8 + drawPoint 36 4 + restore + + translate 100 0 + save + scale 4 4 + drawLine 0 0 10 10 + drawLine 2 0 10 0 + drawLine 0 2 0 10 + drawPolygon [12 0 20 0 15 10] + drawPath path + drawEllipse 32 0 8 8 + drawPoint 36 4 + restore + restore +end_block + +drawText 580 15 "non-cosmetic, 0-width" +translate 0 50 + +setPen black 2 +repeat_block lines +drawText 580 15 "non-cosmetic, 2-width" + +translate 0 20 +translate 0 50 +setPen black 0 +pen_setCosmetic true +repeat_block lines +drawText 580 15 "cosmetic, 0-width" + +translate 0 50 +setPen black 2 +pen_setCosmetic true +repeat_block lines +drawText 580 15 "cosmetic, 2-width" + + +setRenderHint Antialiasing +translate 0 20 + +translate 0 50 +setPen black 0 +repeat_block lines +drawText 580 15 "non-cosmetic, 0-width" + +translate 0 50 + +setPen black 2 +repeat_block lines +drawText 580 15 "non-cosmetic, 2-width" + +translate 0 20 +translate 0 50 +setPen black 0 +pen_setCosmetic true +repeat_block lines +drawText 580 15 "cosmetic, 0-width" + +translate 0 50 +setPen black 2 +pen_setCosmetic true +repeat_block lines +drawText 580 15 "cosmetic, 2-width" + + +translate 0 70 +drawText 0 0 "scale(1, 1)" +drawText 150 0 "scale(4, 1)" +drawText 300 0 "scale(1, 4)" +drawText 450 0 "scale(4, 4)" \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/perspectives.qps b/tests/auto/lancelot/scripts/perspectives.qps new file mode 100644 index 0000000..0b903e5 --- /dev/null +++ b/tests/auto/lancelot/scripts/perspectives.qps @@ -0,0 +1,72 @@ +# Version: 1 + + +setRenderHint Antialiasing + +setPen #00ff00 + +image_load image.png the_image + +translate 10 10 +# standard draw +drawImage the_image 0 0 + +# Rotation w/o smooth xform +save +translate 350 0 +save + setRenderHint SmoothPixmapTransform on + mapQuadToQuad 0 0 0 300 300 300 300 0 0 50 0 200 300 300 300 0 + drawImage the_image 0 0 +restore +restore + +translate 0 320 + +save + setRenderHint SmoothPixmapTransform on + mapQuadToQuad 0 0 0 300 300 300 300 0 0 0 100 300 200 300 300 0 + drawImage the_image 0 0 +restore + +save +translate 350 0 +save + setRenderHint SmoothPixmapTransform on + mapQuadToQuad 0 0 0 300 300 300 300 0 0 0 0 300 300 250 300 50 + drawImage the_image 0 0 +restore +restore + +setRenderHint SmoothPixmapTransform on +setBrush red +setPen black +resetMatrix +translate 100 720 +rotate_y 85 +scale 7 0.01 +drawRect -150 -150 300 300 + +resetMatrix +setBrush gam030.png +setPen black 30 +translate 700 700 +rotate_y -85 +scale 7 0.01 +drawRect -150 -150 300 300 + +resetMatrix +setPen black +translate 125 20 +drawText 0 0 "No transform" +translate 350 0 +drawText 0 0 "Left Tilted" +resetMatrix +translate 125 350 +drawText 0 0 "Bottom Tilted" +translate 350 0 +drawText 0 0 "Right Tilted" +translate 120 0 +resetMatrix +translate 300 760 +drawText 0 0 "Perspective Clipping" \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/perspectives2.qps b/tests/auto/lancelot/scripts/perspectives2.qps new file mode 100644 index 0000000..2f6d1d6 --- /dev/null +++ b/tests/auto/lancelot/scripts/perspectives2.qps @@ -0,0 +1,309 @@ +# Version: 1 + +setRenderHint Antialiasing + +image_load zebra.png zebra_png + +image_convertToFormat zebra_png zebra ARGB32_Premultiplied + +translate 75 100 +# standard draw +begin_block row +drawImage zebra -50 -50 + +translate 90 0 +save +rotate_y 50 +drawImage zebra -50 -50 +restore + +translate 65 0 +save +rotate_y 60 +drawImage zebra -50 -50 +restore + +translate 50 0 +save +rotate_y 70 +drawImage zebra -50 -50 +restore + +translate 30 0 +save +rotate_y 80 +drawImage zebra -50 -50 +restore + +translate 24 0 +save +rotate_y 82 +drawImage zebra -50 -50 +restore + +translate 20 0 +save +rotate_y 84 +drawImage zebra -50 -50 +restore + +translate 16 0 +save +rotate_y 86 +drawImage zebra -50 -50 +restore + +translate 12 0 +save +rotate_y 87 +drawImage zebra -50 -50 +restore + +translate 8 0 +save +rotate_y 88 +drawImage zebra -50 -50 +restore + +translate 6 0 +save +rotate_y 89 +drawImage zebra -50 -50 +restore + +translate 6 0 +save +rotate_y 91 +drawImage zebra -50 -50 +restore + +translate 6 0 +save +rotate_y 92 +drawImage zebra -50 -50 +restore + +translate 8 0 +save +rotate_y 93 +drawImage zebra -50 -50 +restore + +translate 12 0 +save +rotate_y 94 +drawImage zebra -50 -50 +restore + +translate 16 0 +save +rotate_y 96 +drawImage zebra -50 -50 +restore + +translate 20 0 +save +rotate_y 98 +drawImage zebra -50 -50 +restore + +translate 24 0 +save +rotate_y 100 +drawImage zebra -50 -50 +restore + +translate 30 0 +save +rotate_y 110 +drawImage zebra -50 -50 +restore + +translate 50 0 +save +rotate_y 120 +drawImage zebra -50 -50 +restore + +translate 65 0 +save +rotate_y 130 +drawImage zebra -50 -50 +restore + +translate 90 0 +save +rotate_y 180 +drawImage zebra -50 -50 +restore +end_block + +resetMatrix +translate 75 280 +setRenderHint SmoothPixmapTransform +repeat_block row + +resetMatrix +setPen black +translate 300 20 +drawText 0 0 "Fast Pixmap Transform" +resetMatrix +translate 300 210 +drawText 0 0 "Smooth Pixmap Transform" + +resetMatrix +translate 0 400 + +image_load dome_argb32.png the_pixmap + +image_convertToFormat the_pixmap dome ARGB32 + +setRenderHint SmoothPixmapTransform false + +translate 75 100 +# standard draw +begin_block row +drawImage dome -50 -50 + +translate 90 0 +save +rotate_y 50 +drawImage dome -50 -50 +restore + +translate 65 0 +save +rotate_y 60 +drawImage dome -50 -50 +restore + +translate 50 0 +save +rotate_y 70 +drawImage dome -50 -50 +restore + +translate 30 0 +save +rotate_y 80 +drawImage dome -50 -50 +restore + +translate 24 0 +save +rotate_y 82 +drawImage dome -50 -50 +restore + +translate 20 0 +save +rotate_y 84 +drawImage dome -50 -50 +restore + +translate 16 0 +save +rotate_y 86 +drawImage dome -50 -50 +restore + +translate 12 0 +save +rotate_y 87 +drawImage dome -50 -50 +restore + +translate 8 0 +save +rotate_y 88 +drawImage dome -50 -50 +restore + +translate 6 0 +save +rotate_y 89 +drawImage dome -50 -50 +restore + +translate 6 0 +save +rotate_y 91 +drawImage dome -50 -50 +restore + +translate 6 0 +save +rotate_y 92 +drawImage dome -50 -50 +restore + +translate 8 0 +save +rotate_y 93 +drawImage dome -50 -50 +restore + +translate 12 0 +save +rotate_y 94 +drawImage dome -50 -50 +restore + +translate 16 0 +save +rotate_y 96 +drawImage dome -50 -50 +restore + +translate 20 0 +save +rotate_y 98 +drawImage dome -50 -50 +restore + +translate 24 0 +save +rotate_y 100 +drawImage dome -50 -50 +restore + +translate 30 0 +save +rotate_y 110 +drawImage dome -50 -50 +restore + +translate 50 0 +save +rotate_y 120 +drawImage dome -50 -50 +restore + +translate 65 0 +save +rotate_y 130 +drawImage dome -50 -50 +restore + +translate 90 0 +save +rotate_y 180 +drawImage dome -50 -50 +restore +end_block + +resetMatrix +translate 0 400 +translate 75 280 +setRenderHint SmoothPixmapTransform +repeat_block row + +resetMatrix +setPen black +translate 0 400 +translate 300 20 +drawText 0 0 "Fast Pixmap Transform" +resetMatrix +translate 0 400 +translate 300 210 +drawText 0 0 "Smooth Pixmap Transform" \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/pixmap_rotation.qps b/tests/auto/lancelot/scripts/pixmap_rotation.qps new file mode 100644 index 0000000..2f1ffb5 --- /dev/null +++ b/tests/auto/lancelot/scripts/pixmap_rotation.qps @@ -0,0 +1,30 @@ +# Version: 1 +# CheckVsReference: 0% (0 0 440 220) + +translate 120 120 + +begin_block drawing +save + rotate 90 + drawPixmap solid.png 0 0 + + rotate 90 + drawPixmap solid.png 0 0 + + rotate 90 + drawPixmap solid.png 0 0 + + rotate 90 + drawPixmap solid.png 0 0 +restore +end_block + +resetMatrix + +translate 340 120 +repeat_block drawing + +resetMatrix + +drawText 50 240 "Normal X form" +drawText 270 240 "Smooth xform" \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/pixmap_scaling.qps b/tests/auto/lancelot/scripts/pixmap_scaling.qps new file mode 100644 index 0000000..651896f --- /dev/null +++ b/tests/auto/lancelot/scripts/pixmap_scaling.qps @@ -0,0 +1,224 @@ +# Version: 1 +# CheckVsReference: 0% (0 30 600 70) +# CheckVsReference: 0% (290 130 280 60) +# CheckVsReference: 0% (0 180 250 90) + +# Hurra! Force line endings (?) + +translate 5 25 +setFont "arial" 8 + +save + drawText 15 0 "opaque image" + translate 50 50 + save + translate 1 1 + scale 20 20 + drawImage solid2x2.png 0 0 + restore + save + translate -1 1 + scale -20 20 + drawImage solid2x2.png 0 0 + restore + save + translate 1 -1 + scale 20 -20 + drawImage solid2x2.png 0 0 + restore + save + translate -1 -1 + scale -20 -20 + drawImage solid2x2.png 0 0 + restore + + +restore + +save + translate 150 0 + drawText 15 0 "alpha image" + translate 50 50 + save + translate 1 1 + scale 20 20 + drawImage alpha2x2.png 0 0 + restore + save + translate -1 1 + scale -20 20 + drawImage alpha2x2.png 0 0 + restore + save + translate 1 -1 + scale 20 -20 + drawImage alpha2x2.png 0 0 + restore + save + translate -1 -1 + scale -20 -20 + drawImage alpha2x2.png 0 0 + restore +restore + + +save + translate 0 150 + drawText 15 0 "solid pixmap" + translate 50 50 + save + translate 1 1 + scale 20 20 + drawPixmap solid2x2.png 0 0 + restore + save + translate -1 1 + scale -20 20 + drawPixmap solid2x2.png 0 0 + restore + save + translate 1 -1 + scale 20 -20 + drawPixmap solid2x2.png 0 0 + restore + save + translate -1 -1 + scale -20 -20 + drawPixmap solid2x2.png 0 0 + restore +restore + + +save + translate 150 150 + drawText 15 0 "alpha pixmap" + translate 50 50 + save + translate 1 1 + scale 20 20 + drawPixmap alpha2x2.png 0 0 + restore + save + translate -1 1 + scale -20 20 + drawPixmap alpha2x2.png 0 0 + restore + save + translate 1 -1 + scale 20 -20 + drawPixmap alpha2x2.png 0 0 + restore + save + translate -1 -1 + scale -20 -20 + drawPixmap alpha2x2.png 0 0 + restore +restore + + +save + translate 300 10 + save + drawText 0 -10 "subrect solid image" + drawImage solid2x2.png 0 0 50 5 0 0.0 2 0.2 + drawImage solid2x2.png 0 5 50 5 0 0.2 2 0.2 + drawImage solid2x2.png 0 10 50 5 0 0.4 2 0.2 + drawImage solid2x2.png 0 15 50 5 0 0.6 2 0.2 + drawImage solid2x2.png 0 20 50 5 0 0.8 2 0.2 + drawImage solid2x2.png 0 25 50 5 0 1.0 2 0.2 + drawImage solid2x2.png 0 30 50 5 0 1.2 2 0.2 + drawImage solid2x2.png 0 35 50 5 0 1.4 2 0.2 + drawImage solid2x2.png 0 40 50 5 0 1.6 2 0.2 + drawImage solid2x2.png 0 45 50 5 0 1.8 2 0.2 + translate 60 0 + drawImage solid2x2.png 0 0 5 50 0.0 0 0.2 2 + drawImage solid2x2.png 5 0 5 50 0.2 0 0.2 2 + drawImage solid2x2.png 10 0 5 50 0.4 0 0.2 2 + drawImage solid2x2.png 15 0 5 50 0.6 0 0.2 2 + drawImage solid2x2.png 20 0 5 50 0.8 0 0.2 2 + drawImage solid2x2.png 25 0 5 50 1.0 0 0.2 2 + drawImage solid2x2.png 30 0 5 50 1.2 0 0.2 2 + drawImage solid2x2.png 35 0 5 50 1.4 0 0.2 2 + drawImage solid2x2.png 40 0 5 50 1.6 0 0.2 2 + drawImage solid2x2.png 45 0 5 50 1.8 0 0.2 2 + restore + + save + translate 150 0 + drawText 0 -10 "subrect solid image" + drawImage alpha2x2.png 0 0 50 5 0 0.0 2 0.2 + drawImage alpha2x2.png 0 5 50 5 0 0.2 2 0.2 + drawImage alpha2x2.png 0 10 50 5 0 0.4 2 0.2 + drawImage alpha2x2.png 0 15 50 5 0 0.6 2 0.2 + drawImage alpha2x2.png 0 20 50 5 0 0.8 2 0.2 + drawImage alpha2x2.png 0 25 50 5 0 1.0 2 0.2 + drawImage alpha2x2.png 0 30 50 5 0 1.2 2 0.2 + drawImage alpha2x2.png 0 35 50 5 0 1.4 2 0.2 + drawImage alpha2x2.png 0 40 50 5 0 1.6 2 0.2 + drawImage alpha2x2.png 0 45 50 5 0 1.8 2 0.2 + translate 60 0 + drawImage alpha2x2.png 0 0 5 50 0.0 0 0.2 2 + drawImage alpha2x2.png 5 0 5 50 0.2 0 0.2 2 + drawImage alpha2x2.png 10 0 5 50 0.4 0 0.2 2 + drawImage alpha2x2.png 15 0 5 50 0.6 0 0.2 2 + drawImage alpha2x2.png 20 0 5 50 0.8 0 0.2 2 + drawImage alpha2x2.png 25 0 5 50 1.0 0 0.2 2 + drawImage alpha2x2.png 30 0 5 50 1.2 0 0.2 2 + drawImage alpha2x2.png 35 0 5 50 1.4 0 0.2 2 + drawImage alpha2x2.png 40 0 5 50 1.6 0 0.2 2 + drawImage alpha2x2.png 45 0 5 50 1.8 0 0.2 2 + restore + + save + translate 0 100 + drawText 0 -10 "subrect alpha pixmap" + drawPixmap solid2x2.png 0 0 50 5 0 0.0 2 0.2 + drawPixmap solid2x2.png 0 5 50 5 0 0.2 2 0.2 + drawPixmap solid2x2.png 0 10 50 5 0 0.4 2 0.2 + drawPixmap solid2x2.png 0 15 50 5 0 0.6 2 0.2 + drawPixmap solid2x2.png 0 20 50 5 0 0.8 2 0.2 + drawPixmap solid2x2.png 0 25 50 5 0 1.0 2 0.2 + drawPixmap solid2x2.png 0 30 50 5 0 1.2 2 0.2 + drawPixmap solid2x2.png 0 35 50 5 0 1.4 2 0.2 + drawPixmap solid2x2.png 0 40 50 5 0 1.6 2 0.2 + drawPixmap solid2x2.png 0 45 50 5 0 1.8 2 0.2 + translate 60 0 + drawPixmap solid2x2.png 0 0 5 50 0.0 0 0.2 2 + drawPixmap solid2x2.png 5 0 5 50 0.2 0 0.2 2 + drawPixmap solid2x2.png 10 0 5 50 0.4 0 0.2 2 + drawPixmap solid2x2.png 15 0 5 50 0.6 0 0.2 2 + drawPixmap solid2x2.png 20 0 5 50 0.8 0 0.2 2 + drawPixmap solid2x2.png 25 0 5 50 1.0 0 0.2 2 + drawPixmap solid2x2.png 30 0 5 50 1.2 0 0.2 2 + drawPixmap solid2x2.png 35 0 5 50 1.4 0 0.2 2 + drawPixmap solid2x2.png 40 0 5 50 1.6 0 0.2 2 + drawPixmap solid2x2.png 45 0 5 50 1.8 0 0.2 2 + restore + + save + translate 150 100 + drawText 0 -10 "subrect alpha pixmap" + drawPixmap alpha2x2.png 0 0 50 5 0 0.0 2 0.2 + drawPixmap alpha2x2.png 0 5 50 5 0 0.2 2 0.2 + drawPixmap alpha2x2.png 0 10 50 5 0 0.4 2 0.2 + drawPixmap alpha2x2.png 0 15 50 5 0 0.6 2 0.2 + drawPixmap alpha2x2.png 0 20 50 5 0 0.8 2 0.2 + drawPixmap alpha2x2.png 0 25 50 5 0 1.0 2 0.2 + drawPixmap alpha2x2.png 0 30 50 5 0 1.2 2 0.2 + drawPixmap alpha2x2.png 0 35 50 5 0 1.4 2 0.2 + drawPixmap alpha2x2.png 0 40 50 5 0 1.6 2 0.2 + drawPixmap alpha2x2.png 0 45 50 5 0 1.8 2 0.2 + translate 60 0 + drawPixmap alpha2x2.png 0 0 5 50 0.0 0 0.2 2 + drawPixmap alpha2x2.png 5 0 5 50 0.2 0 0.2 2 + drawPixmap alpha2x2.png 10 0 5 50 0.4 0 0.2 2 + drawPixmap alpha2x2.png 15 0 5 50 0.6 0 0.2 2 + drawPixmap alpha2x2.png 20 0 5 50 0.8 0 0.2 2 + drawPixmap alpha2x2.png 25 0 5 50 1.0 0 0.2 2 + drawPixmap alpha2x2.png 30 0 5 50 1.2 0 0.2 2 + drawPixmap alpha2x2.png 35 0 5 50 1.4 0 0.2 2 + drawPixmap alpha2x2.png 40 0 5 50 1.6 0 0.2 2 + drawPixmap alpha2x2.png 45 0 5 50 1.8 0 0.2 2 + restore + +restore \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/pixmap_subpixel.qps b/tests/auto/lancelot/scripts/pixmap_subpixel.qps new file mode 100644 index 0000000..908f7c3 --- /dev/null +++ b/tests/auto/lancelot/scripts/pixmap_subpixel.qps @@ -0,0 +1,117 @@ +# Version: 1 +# CheckVsReference: 5% + + +translate 50 50 + +# Pixmaps at 0.1 offset, unclipped +begin_block draw_pixmaps +save + drawPixmap border.png 0 0 + translate 20.1 0.1 + drawPixmap border.png 0 0 + translate 20.1 0.1 + drawPixmap border.png 0 0 + translate 20.1 0.1 + drawPixmap border.png 0 0 + translate 20.1 0.1 + drawPixmap border.png 0 0 + translate 20.1 0.1 + drawPixmap border.png 0 0 + translate 20.1 0.1 + drawPixmap border.png 0 0 + translate 20.1 0.1 + drawPixmap border.png 0 0 + translate 20.1 0.1 + drawPixmap border.png 0 0 + translate 20.1 0.1 + drawPixmap border.png 0 0 + translate 20.1 0.1 + + drawPixmap border.png 0 0 + translate 20.1 0.1 + drawPixmap border.png 0 0 + translate 20.1 0.1 + drawPixmap border.png 0 0 + translate 20.1 0.1 + drawPixmap border.png 0 0 + translate 20.1 0.1 + drawPixmap border.png 0 0 + translate 20.1 0.1 + drawPixmap border.png 0 0 + translate 20.1 0.1 + drawPixmap border.png 0 0 + translate 20.1 0.1 + drawPixmap border.png 0 0 + translate 20.1 0.1 + drawPixmap border.png 0 0 + translate 20.1 0.1 + drawPixmap border.png 0 0 + translate 20.1 0.1 +restore +end_block + +# Tiled pixmaps at 0.1 offsets, unclipped +translate 0 50 +begin_block draw_tiled +save + drawTiledPixmap border.png 0 0 16 16 0 0 + translate 20.1 0.1 + drawTiledPixmap border.png 0 0 16 16 0 0 + translate 20.1 0.1 + drawTiledPixmap border.png 0 0 16 16 0 0 + translate 20.1 0.1 + drawTiledPixmap border.png 0 0 16 16 0 0 + translate 20.1 0.1 + drawTiledPixmap border.png 0 0 16 16 0 0 + translate 20.1 0.1 + drawTiledPixmap border.png 0 0 16 16 0 0 + translate 20.1 0.1 + drawTiledPixmap border.png 0 0 16 16 0 0 + translate 20.1 0.1 + drawTiledPixmap border.png 0 0 16 16 0 0 + translate 20.1 0.1 + drawTiledPixmap border.png 0 0 16 16 0 0 + translate 20.1 0.1 + drawTiledPixmap border.png 0 0 16 16 0 0 + translate 20.1 0.1 + + drawTiledPixmap border.png 0 0 16 16 0 0 + translate 20.1 0.1 + drawTiledPixmap border.png 0 0 16 16 0 0 + translate 20.1 0.1 + drawTiledPixmap border.png 0 0 16 16 0 0 + translate 20.1 0.1 + drawTiledPixmap border.png 0 0 16 16 0 0 + translate 20.1 0.1 + drawTiledPixmap border.png 0 0 16 16 0 0 + translate 20.1 0.1 + drawTiledPixmap border.png 0 0 16 16 0 0 + translate 20.1 0.1 + drawTiledPixmap border.png 0 0 16 16 0 0 + translate 20.1 0.1 + drawTiledPixmap border.png 0 0 16 16 0 0 + translate 20.1 0.1 + drawTiledPixmap border.png 0 0 16 16 0 0 + translate 20.1 0.1 + drawTiledPixmap border.png 0 0 16 16 0 0 + translate 20.1 0.1 +restore +end_block + + +path_moveTo clip 0 0 +path_lineTo clip width 0 +path_lineTo clip width 400 +path_lineTo clip 0 height +setClipPath clip + +translate 0 50 +# Pixmaps at 0.1 offset, clipped +repeat_block draw_pixmaps + + +# Tiled pixmaps at 0.1 offsets... +translate 0 50 +repeat_block draw_tiled + diff --git a/tests/auto/lancelot/scripts/pixmaps.qps b/tests/auto/lancelot/scripts/pixmaps.qps new file mode 100644 index 0000000..8e60997 --- /dev/null +++ b/tests/auto/lancelot/scripts/pixmaps.qps @@ -0,0 +1,106 @@ +# Version: 1 +# CheckVsReference: 1% (0 0 690 580) + + +setRenderHint Antialiasing + +setPen #00ff00 + +pixmap_load dome_argb32.png the_pixmap +begin_block draw_stuff + +save + + # standard draw + drawPixmap the_pixmap 0 0 + + # sub recting + translate 120 0 + drawPixmap the_pixmap 0 0 40 40 0 0 40 40 + drawPixmap the_pixmap 60 0 40 40 60 0 40 40 + drawPixmap the_pixmap 0 60 40 40 0 60 40 40 + drawPixmap the_pixmap 60 60 40 40 60 60 40 40 + drawPixmap the_pixmap 0 40 40 20 0 40 40 20 + drawPixmap the_pixmap 60 40 40 20 60 40 40 20 + drawPixmap the_pixmap 40 0 20 100 40 0 20 100 + + # subrecting w/scale + translate 120 0 + drawPixmap the_pixmap 0 0 50 50 0 0 25 25 + drawPixmap the_pixmap 50 0 50 50 25 0 25 25 + drawPixmap the_pixmap 0 50 50 50 0 25 25 25 + drawPixmap the_pixmap 50 50 50 50 25 25 25 25 + + # subrecting w/scale & smooth xform + translate 120 0 + setRenderHint SmoothPixmapTransformation + drawPixmap the_pixmap 0 0 50 50 0 0 25 25 + drawPixmap the_pixmap 50 0 50 50 25 0 25 25 + drawPixmap the_pixmap 0 50 50 50 0 25 25 25 + drawPixmap the_pixmap 50 50 50 50 25 25 25 25 + + + # Rotation w/o smooth xform + translate 120 0 + save + setRenderHint SmoothPixmapTransform off + rotate 10 + drawPixmap the_pixmap 0 0 + restore + + # Rotation w smooth xform + translate 120 0 + save + setRenderHint SmoothPixmapTransform + rotate 10 + drawPixmap the_pixmap 0 0 + restore + +restore + +end_block + + +translate 0 120 +pixmap_load dome_rgb32.png the_pixmap +repeat_block draw_stuff + +translate 0 120 +pixmap_load dome_indexed.png the_pixmap +repeat_block draw_stuff + +translate 0 120 +pixmap_load dome_indexed_mask.png the_pixmap +repeat_block draw_stuff + +translate 0 120 +pixmap_load dome_mono.png the_pixmap +repeat_block draw_stuff + + +resetMatrix +translate 700 60 +setPen black +drawText 0 0 "32 bit w/alpha" +translate 0 120 +drawText 0 0 "32 bit w/o alpha" +translate 0 120 +drawText 0 0 "8 bit indexed" +translate 0 120 +drawText 0 0 "8 bit indexed w/mask" +translate 0 120 +drawText 0 0 "1 bit" +resetMatrix +translate 0 600 +drawText 0 0 "normal" +translate 120 0 +drawText 0 0 "subrect" +translate 120 0 +drawText 0 0 "subrect scale" +translate 120 0 +drawText 0 0 "subrect scale smooth" +translate 120 0 +drawText 0 0 "xform" +translate 120 0 +drawText 0 0 "smooth xform" +translate 120 0 \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/porter_duff.qps b/tests/auto/lancelot/scripts/porter_duff.qps new file mode 100644 index 0000000..166e48a --- /dev/null +++ b/tests/auto/lancelot/scripts/porter_duff.qps @@ -0,0 +1,251 @@ +# Version: 1 +# CheckVsReference: 5% + + +translate 0 50 + +surface_begin 0 0 100 100 + +begin_block predraw +setRenderHint Antialiasing +setPen nopen +setBrush 0x7f000000 +drawEllipse 10 10 80 80 +end_block + +setCompositionMode SourceOver + +begin_block postdraw + + +setBrush 0x1fff0000 +drawRect 0 0 50 50 + +setBrush 0xdf00ff00 +drawRect 50 50 50 50 + +setBrush 0x7f0000ff +drawEllipse 30 30 40 40 + +# a black rectangle around +setCompositionMode SourceOver +setPen black +setBrush nobrush +drawRect 0.5 0.5 99 99 + +end_block +surface_end + + +# Destination over +surface_begin 100 0 100 100 +repeat_block predraw +setCompositionMode DestinationOver +repeat_block postdraw +surface_end + + +# Clear +surface_begin 200 0 100 100 +repeat_block predraw +setCompositionMode Clear +repeat_block postdraw +surface_end + + +# Source +surface_begin 300 0 100 100 +repeat_block predraw +setCompositionMode Source +repeat_block postdraw +surface_end + + +# Destination +surface_begin 400 0 100 100 +repeat_block predraw +setCompositionMode Destination +repeat_block postdraw +surface_end + + +# Source In +surface_begin 500 0 100 100 +repeat_block predraw +setCompositionMode SourceIn +repeat_block postdraw +surface_end + +translate 0 50 + +# Destination In +surface_begin 0 100 100 100 +repeat_block predraw +setCompositionMode DestinationIn +repeat_block postdraw +surface_end + + +# Source Out +surface_begin 100 100 100 100 +repeat_block predraw +setCompositionMode SourceOut +repeat_block postdraw +surface_end + + +# Destination Out +surface_begin 200 100 100 100 +repeat_block predraw +setCompositionMode DestinationOut +repeat_block postdraw +surface_end + + +# SourceAtop +surface_begin 300 100 100 100 +repeat_block predraw +setCompositionMode SourceAtop +repeat_block postdraw +surface_end + + +# DestinationAtop +surface_begin 400 100 100 100 +repeat_block predraw +setCompositionMode DestinationAtop +repeat_block postdraw +surface_end + + +# Xor +surface_begin 500 100 100 100 +repeat_block predraw +setCompositionMode Xor +repeat_block postdraw +surface_end + +translate 0 50 + +# Plus +surface_begin 0 200 100 100 +repeat_block predraw +setCompositionMode Plus +repeat_block postdraw +surface_end + + +# Multiply +surface_begin 100 200 100 100 +repeat_block predraw +setCompositionMode Multiply +repeat_block postdraw +surface_end + + +# Screen +surface_begin 200 200 100 100 +repeat_block predraw +setCompositionMode Screen +repeat_block postdraw +surface_end + + +# Overlay +surface_begin 300 200 100 100 +repeat_block predraw +setCompositionMode Overlay +repeat_block postdraw +surface_end + + +# Darken +surface_begin 400 200 100 100 +repeat_block predraw +setCompositionMode Darken +repeat_block postdraw +surface_end + + +# Lighten +surface_begin 500 200 100 100 +repeat_block predraw +setCompositionMode Lighten +repeat_block postdraw +surface_end + +translate 0 50 + +# ColorDodge +surface_begin 0 300 100 100 +repeat_block predraw +setCompositionMode ColorDodge +repeat_block postdraw +surface_end + + +# Multiply +surface_begin 100 300 100 100 +repeat_block predraw +setCompositionMode ColorBurn +repeat_block postdraw +surface_end + + +# Screen +surface_begin 200 300 100 100 +repeat_block predraw +setCompositionMode HardLight +repeat_block postdraw +surface_end + + +# Overlay +surface_begin 300 300 100 100 +repeat_block predraw +setCompositionMode SoftLight +repeat_block postdraw +surface_end + + +# Darken +surface_begin 400 300 100 100 +repeat_block predraw +setCompositionMode Difference +repeat_block postdraw +surface_end + + +# Lighten +surface_begin 500 300 100 100 +repeat_block predraw +setCompositionMode Exclusion +repeat_block postdraw +surface_end + +resetMatrix + +drawText 0 50 "SourceOver" +drawText 100 50 "DestinationOver" +drawText 200 50 "Clear" +drawText 300 50 "Source" +drawText 400 50 "Destination" +drawText 500 50 "SourceIn" +drawText 0 200 "DestinationIn" +drawText 100 200 "SourceOut" +drawText 200 200 "DestinationOut" +drawText 300 200 "SourceAtop" +drawText 400 200 "DestinationAtop" +drawText 500 200 "Xor" +drawText 0 350 "Plus" +drawText 100 350 "Multiply" +drawText 200 350 "Screen" +drawText 300 350 "Overlay" +drawText 400 350 "Darken" +drawText 500 350 "Lighten" +drawText 0 500 "ColorDodge" +drawText 100 500 "ColorBurn" +drawText 200 500 "HardLight" +drawText 300 500 "SoftLight" +drawText 400 500 "Difference" +drawText 500 500 "Exclusion" \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/porter_duff2.qps b/tests/auto/lancelot/scripts/porter_duff2.qps new file mode 100644 index 0000000..a792d9b --- /dev/null +++ b/tests/auto/lancelot/scripts/porter_duff2.qps @@ -0,0 +1,261 @@ +# Version: 1 +# CheckVsReference: 1% (0 50 600 100) +# CheckVsReference: 1% (0 200 600 100) +# CheckVsReference: 1% (0 350 600 100) +# CheckVsReference: 1% (0 500 600 100) + +translate 0 50 + +surface_begin 0 0 100 100 + +begin_block predraw +setRenderHint Antialiasing +setPen nopen +gradient_clearStops +gradient_appendStop 0 efff0000 +gradient_appendStop 0.5 dfffff00 +gradient_appendStop 1 ef00ff00 + +gradient_setSpread PadSpread +gradient_setLinear 10 10 90 90 +drawEllipse 10 10 80 80 +end_block + +setCompositionMode SourceOver + +begin_block postdraw + +gradient_clearStops +gradient_appendStop 0 afff0000 +gradient_appendStop 0.5 cf0000ff +gradient_appendStop 1 bf00ff00 + +gradient_setSpread PadSpread +gradient_setLinear 0 0 100 0 +drawEllipse 10 10 30 30 +drawEllipse 10 60 30 30 +drawEllipse 60 60 30 30 +drawEllipse 60 10 30 30 +drawEllipse 35 35 30 30 + +# a black rectangle around +setCompositionMode SourceOver +setPen black +setBrush nobrush +drawRect 0.5 0.5 99 99 + +end_block +surface_end + +# Destination over +surface_begin 100 0 100 100 +repeat_block predraw +setCompositionMode DestinationOver +repeat_block postdraw +surface_end + + +# Clear +surface_begin 200 0 100 100 +repeat_block predraw +setCompositionMode Clear +repeat_block postdraw +surface_end + + +# Source +surface_begin 300 0 100 100 +repeat_block predraw +setCompositionMode Source +repeat_block postdraw +surface_end + + +# Destination +surface_begin 400 0 100 100 +repeat_block predraw +setCompositionMode Destination +repeat_block postdraw +surface_end + + +# Source In +surface_begin 500 0 100 100 +repeat_block predraw +setCompositionMode SourceIn +repeat_block postdraw +surface_end + +translate 0 50 + +# Destination In +surface_begin 0 100 100 100 +repeat_block predraw +setCompositionMode DestinationIn +repeat_block postdraw +surface_end + + +# Source Out +surface_begin 100 100 100 100 +repeat_block predraw +setCompositionMode SourceOut +repeat_block postdraw +surface_end + + +# Destination Out +surface_begin 200 100 100 100 +repeat_block predraw +setCompositionMode DestinationOut +repeat_block postdraw +surface_end + + +# SourceAtop +surface_begin 300 100 100 100 +repeat_block predraw +setCompositionMode SourceAtop +repeat_block postdraw +surface_end + + +# DestinationAtop +surface_begin 400 100 100 100 +repeat_block predraw +setCompositionMode DestinationAtop +repeat_block postdraw +surface_end + + +# Xor +surface_begin 500 100 100 100 +repeat_block predraw +setCompositionMode Xor +repeat_block postdraw +surface_end + +translate 0 50 + +# Plus +surface_begin 0 200 100 100 +repeat_block predraw +setCompositionMode Plus +repeat_block postdraw +surface_end + + +# Multiply +surface_begin 100 200 100 100 +repeat_block predraw +setCompositionMode Multiply +repeat_block postdraw +surface_end + + +# Screen +surface_begin 200 200 100 100 +repeat_block predraw +setCompositionMode Screen +repeat_block postdraw +surface_end + + +# Overlay +surface_begin 300 200 100 100 +repeat_block predraw +setCompositionMode Overlay +repeat_block postdraw +surface_end + + +# Darken +surface_begin 400 200 100 100 +repeat_block predraw +setCompositionMode Darken +repeat_block postdraw +surface_end + + +# Lighten +surface_begin 500 200 100 100 +repeat_block predraw +setCompositionMode Lighten +repeat_block postdraw +surface_end + +translate 0 50 + +# ColorDodge +surface_begin 0 300 100 100 +repeat_block predraw +setCompositionMode ColorDodge +repeat_block postdraw +surface_end + + +# Multiply +surface_begin 100 300 100 100 +repeat_block predraw +setCompositionMode ColorBurn +repeat_block postdraw +surface_end + + +# Screen +surface_begin 200 300 100 100 +repeat_block predraw +setCompositionMode HardLight +repeat_block postdraw +surface_end + + +# Overlay +surface_begin 300 300 100 100 +repeat_block predraw +setCompositionMode SoftLight +repeat_block postdraw +surface_end + + +# Darken +surface_begin 400 300 100 100 +repeat_block predraw +setCompositionMode Difference +repeat_block postdraw +surface_end + + +# Lighten +surface_begin 500 300 100 100 +repeat_block predraw +setCompositionMode Exclusion +repeat_block postdraw +surface_end + +resetMatrix + +drawText 0 50 "SourceOver" +drawText 100 50 "DestinationOver" +drawText 200 50 "Clear" +drawText 300 50 "Source" +drawText 400 50 "Destination" +drawText 500 50 "SourceIn" +drawText 0 200 "DestinationIn" +drawText 100 200 "SourceOut" +drawText 200 200 "DestinationOut" +drawText 300 200 "SourceAtop" +drawText 400 200 "DestinationAtop" +drawText 500 200 "Xor" +drawText 0 350 "Plus" +drawText 100 350 "Multiply" +drawText 200 350 "Screen" +drawText 300 350 "Overlay" +drawText 400 350 "Darken" +drawText 500 350 "Lighten" +drawText 0 500 "ColorDodge" +drawText 100 500 "ColorBurn" +drawText 200 500 "HardLight" +drawText 300 500 "SoftLight" +drawText 400 500 "Difference" +drawText 500 500 "Exclusion" \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/primitives.qps b/tests/auto/lancelot/scripts/primitives.qps new file mode 100644 index 0000000..f44ba27 --- /dev/null +++ b/tests/auto/lancelot/scripts/primitives.qps @@ -0,0 +1,184 @@ +# Version: 1#Version: 1 +# CheckVsReference: 5% + + +# CheckVsReference: 5% + +setBrush #ff7f7fff +setPen black 1 solidline +translate 20 20 +begin_block testblock +save +drawRect 0 0 10 10 +drawRect 20 0 20 10 +drawRect 0 20 10 20 +drawRect 20 20 20 20 +translate 50 0 +setPen NoPen +drawRect 0 0 10 10 +drawRect 20 0 20 10 +drawRect 0 20 10 20 +drawRect 20 20 20 20 +restore +save +translate 0 50 +drawEllipse 0 0 10 10 +drawEllipse 20 0 20 10 +drawEllipse 0 20 10 20 +drawEllipse 20 20 20 20 +translate 50 0 +setPen NoPen +drawEllipse 0 0 10 10 +drawEllipse 20 0 20 10 +drawEllipse 0 20 10 20 +drawEllipse 20 20 20 20 +restore +save +translate 0 100 +drawPolygon [ 0 0 30 0 30 30 10 30 10 10 40 10 40 40 0 40 ] +save +translate 0 50 +drawPolygon [ 0 0 30 0 30 30 10 30 10 10 40 10 40 40 0 40 ] Winding +translate 0 45 +drawPolyline [ 0 0 50 0 25 25 ] +restore +setPen NoPen +translate 50 0 +drawPolygon [ 0 0 30 0 30 30 10 30 10 10 40 10 40 40 0 40 ] +save +translate 0 50 +drawPolygon [ 0 0 30 0 30 30 10 30 10 10 40 10 40 40 0 40 ] Winding +restore +save +translate -20 100 +drawPie 0 0 50 50 0 1500 +restore +restore +end_block +setPen black 1 SolidLine FlatCap +translate 200 0 +scale 2 1 +rotate 10 +repeat_block testblock +resetMatrix +translate 0 250 +setBrush 7f7f7fff +translate 20 20 +repeat_block testblock +setPen black 1 SolidLine FlatCap +translate 200 0 +scale 2 1 +rotate 10 +repeat_block testblock +resetMatrix +save +setRenderHint LineAntialiasing +setBrush 7f7fff +translate 20 500 +repeat_block testblock +translate 200 0 +scale 2 1 +rotate 10 +repeat_block testblock +restore +setRenderHint LineAntialiasing false +translate 420 20 +begin_block lines +drawLine 0 0 100 0 +drawLine 0 0 100 10 +drawLine 0 0 100 20 +drawLine 0 0 100 30 +drawLine 0 0 100 40 +drawLine 0 0 100 50 +drawLine 0 0 100 60 +drawLine 0 0 100 70 +drawLine 0 0 100 80 +drawLine 0 0 100 90 +drawLine 0 0 100 100 +drawLine 0 0 90 100 +drawLine 0 0 80 100 +drawLine 0 0 70 100 +drawLine 0 0 60 100 +drawLine 0 0 50 100 +drawLine 0 0 40 100 +drawLine 0 0 30 100 +drawLine 0 0 20 100 +drawLine 0 0 10 100 +drawLine 0 0 0 100 +end_block +setRenderHint LineAntialiasing +translate 0 120 +repeat_block lines +translate 0 120 +scale 5 2 +repeat_block lines +resetMatrix +translate 420 500 +begin_block roundedrects +save +drawRoundedRect 0 0 50 30 5 5 +translate 60 0 +drawRoundedRect 0 0 50 30 7.5 7.5 +translate 60 0 +drawRoundedRect 0 0 50 30 10 10 +translate 60 0 +drawRoundedRect 0 0 50 30 12.5 12.5 +translate 60 0 +drawRoundedRect 0 0 50 30 15 15 +restore +save +translate 0 40 +drawRoundedRect 0 0 50 30 20 20 RelativeSize +translate 60 0 +drawRoundedRect 0 0 50 30 40 40 RelativeSize +translate 60 0 +drawRoundedRect 0 0 50 30 60 60 RelativeSize +translate 60 0 +drawRoundedRect 0 0 50 30 80 80 RelativeSize +translate 60 0 +drawRoundedRect 0 0 50 30 100 100 RelativeSize +restore +end_block +translate 0.5 80.5 +repeat_block roundedrects +translate -0.5 79.5 +setRenderHint Antialiasing off +repeat_block roundedrects +resetMatrix +setRenderHint Antialiasing off +setPen black 1 +begin_block drawShapes +translate 550.5 25 +rotate 45 +setBrush nobrush +drawEllipse -10 -10 20 20 +drawLine 10 0 50 0 +drawRect 50 -7 14 14 +resetMatrix +end_block +setPen black 2 +translate 25 0 +repeat_block drawShapes +setPen black 3 +translate 50 0 +repeat_block drawShapes +setPen black 4 +translate 75 0 +repeat_block drawShapes +resetMatrix +setRenderHint Antialiasing off +setPen nopen +translate 550 100 +setBrush #7f7f7fff +drawRect -0.5 -0.5 21 21 +setBrush red +drawEllipse 0 0 20 20 +setBrush nobrush +setPen black +drawEllipse 0 0 20 20 +translate 25 0 +setPen nopen +setBrush #7f7f7fff +drawRect 0 0 20 20 +setBrush red +drawEllipse 0 0 20 20 \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/radial_gradients.qps b/tests/auto/lancelot/scripts/radial_gradients.qps new file mode 100644 index 0000000..b55df8b --- /dev/null +++ b/tests/auto/lancelot/scripts/radial_gradients.qps @@ -0,0 +1,99 @@ +# Version: 1 +# CheckVsReference: 5% (0 0 600 400) + +path_addRect path 400 0 80 80 +path_addEllipse path 440 40 60 60 + +setRenderHint Antialiasing + +setPen black + +begin_block gradients +gradient_clearStops +gradient_appendStop 0 red +gradient_appendStop 0.25 orange +gradient_appendStop 0.5 yellow +gradient_appendStop 0.8 green +gradient_appendStop 1 cyan + +gradient_setSpread PadSpread +gradient_setRadial 20 20 50 40 40 +drawRect 0 0 100 100 + +gradient_setSpread ReflectSpread +gradient_setRadial 120 20 50 140 40 +drawEllipse 100 0 100 100 + +gradient_setSpread RepeatSpread +gradient_setRadial 220 20 50 240 40 +drawRoundRect 200 0 100 100 + +gradient_clearStops +gradient_appendStop 0 3f7f7fff +gradient_appendStop 0.5 dfdfffff +gradient_appendStop 1 7f00007f + +gradient_setSpread PadSpread +gradient_setRadial 320 20 50 340 40 +drawPolygon [300 0 390 0 350 99] + +gradient_setSpread ReflectSpread +gradient_setRadial 420 20 50 440 40 +drawPath path + +gradient_setSpread RepeatSpread +gradient_setRadial 520 20 50 540 40 +drawPie 500 0 100 100 720 4320 +end_block + +translate 0 100 +scale 1 2 +repeat_block gradients + +resetMatrix +translate 0 300 +brushTranslate 30 0 +brushScale 0.9 0.9 +brushRotate 20 +repeat_block gradients + +# Some helpful info perhaps? +resetMatrix +setPen black + +drawText 610 50 "No XForm" +drawText 610 200 "scale 1x2" +drawText 610 300 "brush transform" +drawText 10 450 "Pad" +drawText 110 450 "Reflect" +drawText 210 450 "Repeat" +drawText 310 450 "Pad w/alpha" +drawText 410 450 "Reflect w/alpha" +drawText 510 450 "Repeat w/alpha" + +# Radius and focal indicators +setPen 3f000000 +setBrush nobrush + +begin_block ellipse_draw +setClipRect 0 0 100 100 +drawEllipse -30 -30 100 100 +drawEllipse 35 35 11 11 +translate 100 0 +end_block + +repeat_block ellipse_draw +repeat_block ellipse_draw +repeat_block ellipse_draw +repeat_block ellipse_draw +repeat_block ellipse_draw + +resetMatrix +translate 0 100 +scale 1 2 +repeat_block ellipse_draw +repeat_block ellipse_draw +repeat_block ellipse_draw +repeat_block ellipse_draw +repeat_block ellipse_draw +repeat_block ellipse_draw \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/radial_gradients_perspectives.qps b/tests/auto/lancelot/scripts/radial_gradients_perspectives.qps new file mode 100644 index 0000000..4557354 --- /dev/null +++ b/tests/auto/lancelot/scripts/radial_gradients_perspectives.qps @@ -0,0 +1,62 @@ +# Version: 1 + + +setRenderHint Antialiasing + +setPen #00ff00 + +translate 10 10 +# standard draw +begin_block gradient +gradient_clearStops +gradient_appendStop 0 red +gradient_appendStop 0.25 orange +gradient_appendStop 0.5 yellow +gradient_appendStop 0.8 green +gradient_appendStop 1 cyan + +gradient_setSpread PadSpread +gradient_setRadial 110 100 230 230 240 +drawRect 0 0 300 300 +end_block gradient + +# Rotation w/o smooth xform +save +translate 350 0 +save + setRenderHint SmoothPixmapTransform on + mapQuadToQuad 0 0 0 300 300 300 300 0 0 50 0 200 300 300 300 0 + repeat_block gradient +restore +restore + +translate 0 320 + +save + setRenderHint SmoothPixmapTransform on + mapQuadToQuad 0 0 0 300 300 300 300 0 0 0 100 300 200 300 300 0 + repeat_block gradient +restore + +save +translate 350 0 +save + setRenderHint SmoothPixmapTransform on + mapQuadToQuad 0 0 0 300 300 300 300 0 0 0 0 300 300 250 300 50 + repeat_block gradient +restore +restore + + +resetMatrix +setPen black +translate 125 20 +drawText 0 0 "No transform" +translate 350 0 +drawText 0 0 "Left Tilted" +resetMatrix +translate 125 350 +drawText 0 0 "Bottom Tilted" +translate 350 0 +drawText 0 0 "Right Tilted" +translate 120 0 \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/rasterops.qps b/tests/auto/lancelot/scripts/rasterops.qps new file mode 100644 index 0000000..21f943b --- /dev/null +++ b/tests/auto/lancelot/scripts/rasterops.qps @@ -0,0 +1,87 @@ +# Version: 1 +# CheckVsReference: 5% + +setPen NoPen + +setBrush black +drawRect 10 10 60 500 + +setCompositionMode SourceOrDestination +translate 20 20 + +begin_block drawShape + setBrush 0xffff0000 + drawEllipse 5 5 30 30 + setBrush 0xff00ff00 + drawRect 0 0 20 20 + setBrush 0xff0000ff + drawRect 20 20 20 20 +end_block + +begin_block loop + setCompositionMode SourceAndDestination + translate 0 50 +repeat_block drawShape + +setCompositionMode SourceXorDestination +translate 0 50 +repeat_block drawShape + +setCompositionMode NotSourceAndNotDestination +translate 0 50 +repeat_block drawShape + +setCompositionMode NotSourceOrNotDestination +translate 0 50 +repeat_block drawShape + +setCompositionMode NotSourceXorDestination +translate 0 50 +repeat_block drawShape + +setCompositionMode NotSource +translate 0 50 +repeat_block drawShape + +setCompositionMode NotSourceAndDestination +translate 0 50 +repeat_block drawShape + +setCompositionMode SourceAndNotDestination +translate 0 50 +repeat_block drawShape +end_block + +resetMatrix +setCompositionMode Source +setBrush white +drawRect 100 10 60 500 +translate 110 20 +repeat_block loop + +resetMatrix +setCompositionMode Source +translate 190 20 +repeat_block loop + +resetMatrix +setPen black +setCompositionMode SourceOver +translate 250 45 +drawText 20 0 "Or ROP" +translate 0 50 +drawText 20 0 "And ROP" +translate 0 50 +drawText 20 0 "Xor ROP" +translate 0 50 +drawText 20 0 "Nor ROP" +translate 0 50 +drawText 20 0 "Nand ROP" +translate 0 50 +drawText 0 0 "NSrcXorDst ROP" +translate 0 50 +drawText 20 0 "NSrc ROP" +translate 0 50 +drawText 0 0 "NSrcAndDst ROP" +translate 0 50 +drawText 0 0 "SrcAndNDst ROP" \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/sizes.qps b/tests/auto/lancelot/scripts/sizes.qps new file mode 100644 index 0000000..b923881 --- /dev/null +++ b/tests/auto/lancelot/scripts/sizes.qps @@ -0,0 +1,150 @@ +# Version: 1 +# CheckVsReference: 5% + +setPen NoPen +setBrush black + +translate 10 10 + +begin_block testblock +drawRect 0 0 10 10 +drawRect 20 0 11 11 +drawRect 40 0 12 12 +drawRect 60 0 13 13 +drawRect 80 0 14 14 +drawRect 100 0 15 15 +drawRect 120 0 16 16 +drawRect 140 0 17 17 +drawRect 160 0 18 18 +drawRect 180 0 19 19 +qt3_drawRect 200 0 10 10 +qt3_drawRect 220 0 11 11 +qt3_drawRect 240 0 12 12 +qt3_drawRect 260 0 13 13 +qt3_drawRect 280 0 14 14 +qt3_drawRect 300 0 15 15 +qt3_drawRect 320 0 16 16 +qt3_drawRect 340 0 17 17 +qt3_drawRect 360 0 18 18 +qt3_drawRect 380 0 19 19 + +drawEllipse 0 20 10 10 +drawEllipse 20 20 11 11 +drawEllipse 40 20 12 12 +drawEllipse 60 20 13 13 +drawEllipse 80 20 14 14 +drawEllipse 100 20 15 15 +drawEllipse 120 20 16 16 +drawEllipse 140 20 17 17 +drawEllipse 160 20 18 18 +drawEllipse 180 20 19 19 +qt3_drawEllipse 200 20 10 10 +qt3_drawEllipse 220 20 11 11 +qt3_drawEllipse 240 20 12 12 +qt3_drawEllipse 260 20 13 13 +qt3_drawEllipse 280 20 14 14 +qt3_drawEllipse 300 20 15 15 +qt3_drawEllipse 320 20 16 16 +qt3_drawEllipse 340 20 17 17 +qt3_drawEllipse 360 20 18 18 +qt3_drawEllipse 380 20 19 19 + +drawRoundRect 0 40 10 10 +drawRoundRect 20 40 11 11 +drawRoundRect 40 40 12 12 +drawRoundRect 60 40 13 13 +drawRoundRect 80 40 14 14 +drawRoundRect 100 40 15 15 +drawRoundRect 120 40 16 16 +drawRoundRect 140 40 17 17 +drawRoundRect 160 40 18 18 +drawRoundRect 180 40 19 19 +qt3_drawRoundRect 200 40 10 10 +qt3_drawRoundRect 220 40 11 11 +qt3_drawRoundRect 240 40 12 12 +qt3_drawRoundRect 260 40 13 13 +qt3_drawRoundRect 280 40 14 14 +qt3_drawRoundRect 300 40 15 15 +qt3_drawRoundRect 320 40 16 16 +qt3_drawRoundRect 340 40 17 17 +qt3_drawRoundRect 360 40 18 18 +qt3_drawRoundRect 380 40 19 19 + +drawPie 0 60 10 10 0 4320 +drawPie 20 60 11 11 0 4320 +drawPie 40 60 12 12 0 4320 +drawPie 60 60 13 13 0 4320 +drawPie 80 60 14 14 0 4320 +drawPie 100 60 15 15 0 4320 +drawPie 120 60 16 16 0 4320 +drawPie 140 60 17 17 0 4320 +drawPie 160 60 18 18 0 4320 +drawPie 180 60 19 19 0 4320 +qt3_drawPie 200 60 10 10 0 4320 +qt3_drawPie 220 60 11 11 0 4320 +qt3_drawPie 240 60 12 12 0 4320 +qt3_drawPie 260 60 13 13 0 4320 +qt3_drawPie 280 60 14 14 0 4320 +qt3_drawPie 300 60 15 15 0 4320 +qt3_drawPie 320 60 16 16 0 4320 +qt3_drawPie 340 60 17 17 0 4320 +qt3_drawPie 360 60 18 18 0 4320 +qt3_drawPie 380 60 19 19 0 4320 + +drawArc 0 80 10 10 0 4320 +drawArc 20 80 11 11 0 4320 +drawArc 40 80 12 12 0 4320 +drawArc 60 80 13 13 0 4320 +drawArc 80 80 14 14 0 4320 +drawArc 100 80 15 15 0 4320 +drawArc 120 80 16 16 0 4320 +drawArc 140 80 17 17 0 4320 +drawArc 160 80 18 18 0 4320 +drawArc 180 80 19 19 0 4320 +qt3_drawArc 200 80 10 10 0 4320 +qt3_drawArc 220 80 11 11 0 4320 +qt3_drawArc 240 80 12 12 0 4320 +qt3_drawArc 260 80 13 13 0 4320 +qt3_drawArc 280 80 14 14 0 4320 +qt3_drawArc 300 80 15 15 0 4320 +qt3_drawArc 320 80 16 16 0 4320 +qt3_drawArc 340 80 17 17 0 4320 +qt3_drawArc 360 80 18 18 0 4320 +qt3_drawArc 380 80 19 19 0 4320 + +drawChord 0 100 10 10 0 4320 +drawChord 20 100 11 11 0 4320 +drawChord 40 100 12 12 0 4320 +drawChord 60 100 13 13 0 4320 +drawChord 80 100 14 14 0 4320 +drawChord 100 100 15 15 0 4320 +drawChord 120 100 16 16 0 4320 +drawChord 140 100 17 17 0 4320 +drawChord 160 100 18 18 0 4320 +drawChord 180 100 19 19 0 4320 +qt3_drawChord 200 100 10 10 0 4320 +qt3_drawChord 220 100 11 11 0 4320 +qt3_drawChord 240 100 12 12 0 4320 +qt3_drawChord 260 100 13 13 0 4320 +qt3_drawChord 280 100 14 14 0 4320 +qt3_drawChord 300 100 15 15 0 4320 +qt3_drawChord 320 100 16 16 0 4320 +qt3_drawChord 340 100 17 17 0 4320 +qt3_drawChord 360 100 18 18 0 4320 +qt3_drawChord 380 100 19 19 0 4320 + +end_block + +setPen red +translate 0 150 +repeat_block testblock + +setRenderHint LineAntialiasing + +setPen nopen +translate 0 150 +repeat_block testblock + +setPen red +translate 0 150 +repeat_block testblock \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/text.qps b/tests/auto/lancelot/scripts/text.qps new file mode 100644 index 0000000..d7ee832 --- /dev/null +++ b/tests/auto/lancelot/scripts/text.qps @@ -0,0 +1,124 @@ +# Version: 1 + +drawText -5 5 "Text that is drawn outside the bounds..." + +translate 20 20 +begin_block text_drawing +save + setFont "sansserif" 10 normal + drawText 0 20 "sansserif 10pt, normal" + + setFont "sansserif" 12 normal + drawText 0 40 "sansserif 12pt, normal" + + setFont "sansserif" 10 bold + drawText 0 60 "sansserif 12pt, bold" + + setFont "sansserif" 10 bold italic + drawText 0 80 "sansserif 10pt, bold italic" + + + translate 0 100 + setPen #7fff0000 + + setFont "sansserif" 10 normal + drawText 0 20 "alpha sansserif 10pt, normal" + + setFont "sansserif" 12 normal + drawText 0 40 "alpha sansserif 12pt, normal" + + setFont "sansserif" 10 bold + drawText 0 60 "alpha sansserif 12pt, bold" + + setFont "sansserif" 10 bold italic + drawText 0 80 "alpha sansserif 10pt, bold italic" + + + translate 0 100 + setPen black + save + scale 0.9 0.9 + + setFont "sansserif" 10 normal + drawText 0 20 "scaled sansserif 10pt, normal" + + setFont "sansserif" 12 normal + drawText 0 40 "scaled sansserif 12pt, normal" + + setFont "sansserif" 10 bold + drawText 0 60 "scaled sansserif 12pt, bold" + + setFont "sansserif" 10 bold italic + drawText 0 80 "scaled sansserif 10pt, bold italic" + restore + + translate 0 100 + setPen black + save + translate 200 90 + rotate 185 + + setFont "sansserif" 10 normal + drawText 0 20 "scaled sansserif 10pt, normal" + + setFont "sansserif" 12 normal + drawText 0 40 "scaled sansserif 12pt, normal" + + setFont "sansserif" 10 bold + drawText 0 60 "scaled sansserif 12pt, bold" + + setFont "sansserif" 10 bold italic + drawText 0 80 "scaled sansserif 10pt, bold italic" + restore + + translate 0 100 + gradient_appendStop 0 red + gradient_appendStop 0.5 #00ff00 + gradient_appendStop 1 blue + gradient_setLinear 0 0 200 0 + setPen brush + + setFont "sansserif" 10 normal + drawText 0 0 "gradient sansserif 10pt, normal" + + setFont "sansserif" 12 normal + drawText 0 20 "gradient sansserif 12pt, normal" + + setFont "sansserif" 10 bold + drawText 0 40 "gradient sansserif 12pt, bold" + + setFont "sansserif" 10 bold italic + drawText 0 60 "gradient sansserif 10pt, bold italic" +restore +end_block + +translate 250 0 +drawText 25 520 "clipped to rectangle" +save + setPen #3f000000 + setBrush nobrush + drawRect 20 0 100 500 + setClipRect 20 0 100 500 + setPen black + repeat_block text_drawing +restore + +translate 150 0 +drawText 25 520 "clipped to path" +save + path_moveTo clip 20 0 + path_cubicTo clip 0 200 40 400 20 400 + path_lineTo clip 30 500 + path_lineTo clip 30 0 + path_lineTo clip 40 0 + path_lineTo clip 40 500 + path_lineTo clip 120 500 + path_lineTo clip 120 0 + path_lineTo clip 20 0 + setPen #3f000000 + setBrush nobrush + drawPath clip + setClipPath clip + setPen black + repeat_block text_drawing +restore \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/text_perspectives.qps b/tests/auto/lancelot/scripts/text_perspectives.qps new file mode 100644 index 0000000..4c74306 --- /dev/null +++ b/tests/auto/lancelot/scripts/text_perspectives.qps @@ -0,0 +1,102 @@ +# Version: 1 + + +setRenderHint Antialiasing + +setPen black + +translate 10 10 +# standard draw +begin_block text +setBrush gray +drawRect 0 0 300 300 + +setFont "times" 3 +drawText 10 10 "Hello World...." + +setFont "times" 4 +drawText 10 20 "Hello World...." + +setFont "times" 5 +drawText 10 30 "Hello World...." + +setFont "times" 6 +drawText 10 40 "Hello World...." + +setFont "times" 7 +drawText 10 50 "Hello World...." + +setFont "times" 8 +drawText 10 60 "Hello World...." + +setFont "times" 9 +drawText 10 70 "Hello World...." + +setFont "times" 10 +drawText 10 80 "Hello World...." + +setFont "times" 16 +drawText 10 100 "Hello World...." + +setFont "times" 17 +drawText 10 120 "Hello World...." + +setFont "times" 18 +drawText 10 140 "Hello World...." + +setFont "times" 20 +drawText 10 160 "Hello World...." + +setFont "times" 22 +drawText 10 180 "Hello World...." + +setFont "times" 24 +drawText 10 205 "Hello World...." + +setFont "times" 26 +drawText 10 230 "Hello World...." + +setFont "times" 32 +drawText 10 260 "Hello World...." +end_block text + +# Rotation w/o smooth xform +save +translate 350 0 +save + setRenderHint SmoothPixmapTransform on + mapQuadToQuad 0 0 0 300 300 300 300 0 0 50 0 200 300 300 300 0 + repeat_block text +restore +restore + +translate 0 320 + +save + setRenderHint SmoothPixmapTransform on + mapQuadToQuad 0 0 0 300 300 300 300 0 0 0 100 300 200 300 300 0 + repeat_block text +restore + +save +translate 350 0 +save + setRenderHint SmoothPixmapTransform on + mapQuadToQuad 0 0 0 300 300 300 300 0 0 0 0 300 300 250 300 50 + repeat_block text +restore +restore + + +resetMatrix +setPen black +translate 125 20 +drawText 0 0 "No transform" +translate 350 0 +drawText 0 0 "Left Tilted" +resetMatrix +translate 125 350 +drawText 0 0 "Bottom Tilted" +translate 350 0 +drawText 0 0 "Right Tilted" +translate 120 0 \ No newline at end of file diff --git a/tests/auto/lancelot/scripts/tiled_pixmap.qps b/tests/auto/lancelot/scripts/tiled_pixmap.qps new file mode 100644 index 0000000..9cb5e0d --- /dev/null +++ b/tests/auto/lancelot/scripts/tiled_pixmap.qps @@ -0,0 +1,84 @@ +# Version: 1 +# CheckVsReference: 5% (0 0 639 638) + + +translate 0 10 +setRenderHint Antialiasing + +pixmap_load dome_argb32 the_pixmap + +begin_block draw_stuff +save + + # Standard draw + drawTiledPixmap the_pixmap 0 0 150 100 0 0 + + # Standard draw with offset + translate 160 0 + drawTiledPixmap the_pixmap 0 0 150 100 25 25 + + # xformed + translate 160 0 + save + translate 10 -10 + rotate 10 + setRenderHint SmoothPixmapTransform false + drawTiledPixmap the_pixmap 0 0 150 100 25 25 + restore + + # xformed with smooth xform + translate 160 0 + save + translate 10 -10 + rotate 10 + setRenderHint SmoothPixmapTransform + drawTiledPixmap the_pixmap 0 0 150 100 25 25 + restore +restore +end_block + +translate 0 120 +pixmap_load dome_rgb32 the_pixmap +repeat_block draw_stuff + + +translate 0 120 +pixmap_load dome_indexed the_pixmap +repeat_block draw_stuff + + +translate 0 120 +pixmap_load dome_indexed_mask the_pixmap +repeat_block draw_stuff + + +translate 0 120 +pixmap_load dome_mono the_pixmap +repeat_block draw_stuff + + +################################################################################ +# Some helpful text... +# + +resetMatrix +translate 650 80 +drawText 0 0 "32 bit w/alpha" +translate 0 120 +drawText 0 0 "32 bit w/o alpha" +translate 0 120 +drawText 0 0 "8 bit indexed" +translate 0 120 +drawText 0 0 "8 bit indexed w/mask" +translate 0 120 +drawText 0 0 "1 bit" + +resetMatrix +translate 10 630 +drawText 0 0 "normal" +translate 160 0 +drawText 0 0 "offset" +translate 160 0 +drawText 0 0 "xformed" +translate 160 0 +drawText 0 0 "smooth xformed" diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp new file mode 100644 index 0000000..1b832c6 --- /dev/null +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -0,0 +1,238 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// Generalization dimensions TBD: +// ImageFormat: Rendering to different bit formats +// Engine: Rendering with different engines +// Painter renderhints? (set in qps itself) + +#include +#include +#include +#include +#include + +#ifndef SRCDIR +#define SRCDIR "." +#endif + +static const QLatin1String scriptsDir(SRCDIR "/scripts/"); + +class tst_Lancelot : public QObject +{ +Q_OBJECT + +public: + tst_Lancelot(); + +private: + QImage getBaseline(const QString &fileName, bool *created); + QImage render(const QString &fileName); + QStringList loadScriptFile(const QString &filePath); + + QString errorMsg; + BaselineProtocol proto; + +private slots: + void initTestCase(); + void cleanupTestCase() {} + + void testRendering_data(); + void testRendering(); +}; + +tst_Lancelot::tst_Lancelot() +{ +} + +void tst_Lancelot::initTestCase() +{ +#if !defined(Q_OS_LINUX) + QSKIP("For the moment, this test is only supported on Linux.", SkipAll); +#endif + + // Check the environment here, so that we can just skip on trouble! + if (!proto.connect()) { + QWARN(qPrintable(proto.errorMessage())); + QSKIP("Communication with baseline image server failed.", SkipAll); + } + + // TBD: preload scripts, to confirm reading and generate checksums +} + +void tst_Lancelot::testRendering_data() +{ + // search the data directory for qps files and make a row for each. + // filter out those marked as blacklisted (in the file itself?) + // Rather do the above in initTestCase. Can load & split them all also. + // And baselines too? + + QTest::addColumn("fileName"); + + // ### no, don't do it like this, we want opt-in, not opt-out, for stability + QDir qpsDir(scriptsDir); + QStringList files = qpsDir.entryList(QStringList() << QLatin1String("*.qps"), QDir::Files | QDir::Readable); + files.removeOne(QLatin1String("porter_duff.qps")); + files.removeOne(QLatin1String("porter_duff2.qps")); + files.removeOne(QLatin1String("images.qps")); + files.removeOne(QLatin1String("sizes.qps")); + + if (files.isEmpty()) { + QWARN("No qps files found in " + qpsDir.path().toLatin1()); + QSKIP("Aborted due to errors.", SkipAll); + } + + foreach(QString fileName, files) { + QString baseName = fileName.section('.', 0, -2); + QTest::newRow(baseName.toLatin1()) << fileName; + } +} + + +// We treat failures because of test environment +// (e.g. script files not found) as just warnings, and not +// QFAILs, to avoid false negatives caused by environment +// or server instability + +void tst_Lancelot::testRendering() +{ + errorMsg.clear(); + QFETCH(QString, fileName); + + bool newBaselineCreated = false; + QImage baseline = getBaseline(fileName, &newBaselineCreated); + if (newBaselineCreated) + QSKIP("Baseline not found; new baseline created.", SkipSingle); + if (!errorMsg.isNull() || baseline.isNull()) { + QWARN("Error: Failed to get baseline image. " + errorMsg.toLatin1()); + QSKIP("Aborted due to errors.", SkipSingle); + } + + QImage rendered = render(fileName); + if (!errorMsg.isNull() || rendered.isNull()) { + // Indicates that it's an error in the test environment, not Qt + QWARN("Error: Failed to render image. " + errorMsg.toLatin1()); + QSKIP("Aborted due to errors.", SkipSingle); + } + + if (rendered.format() != baseline.format()) + baseline = baseline.convertToFormat(rendered.format()); + + // The actual check: + if (rendered != baseline) { + QByteArray failMsg; + proto.submitMismatch(fileName, rendered, &failMsg); + failMsg.prepend("Rendered image differs from baseline. "); + QFAIL(failMsg.constData()); + } +} + + +QImage tst_Lancelot::getBaseline(const QString &fileName, bool *created) +{ + QImage baseline; + BaselineProtocol::Command response; + if (!proto.requestBaseline(fileName, &response, &baseline)) { + errorMsg = QLatin1String("Error downloading baseline from server. ") + proto.errorMessage(); + return QImage(); + } + + if (response == BaselineProtocol::BaselineNotPresent) { + // Here: Create new baseline! + baseline = render(fileName); + if (!errorMsg.isNull() || baseline.isNull()) { + errorMsg.prepend(QLatin1String("Failed to render new baseline. ")); + return QImage(); + } + if (!proto.submitNewBaseline(fileName, baseline)) { + errorMsg = QLatin1String("Failed to submit new baseline to server. ") + proto.errorMessage(); + return QImage(); + } + if (created) + *created = true; + } + else if (response == BaselineProtocol::IgnoreCase) { + // Blacklisted or similar, signal back that this item should be skipped + // Will effectively happen with this: + errorMsg = QLatin1String("Baseline server says skip this"); + return QImage(); + } + else if (response != BaselineProtocol::AcceptBaseline) { + errorMsg = QLatin1String("Unknown response from baseline server. "); + return QImage(); + } + return baseline; +} + + +QImage tst_Lancelot::render(const QString &fileName) +{ + QString filePath = scriptsDir + fileName; + QStringList script = loadScriptFile(filePath); + if (script.isEmpty()) + return QImage(); + + QImage img(800, 800, QImage::Format_ARGB32_Premultiplied); + QPainter p(&img); + PaintCommands pcmd(script, 800, 800); + pcmd.setPainter(&p); + pcmd.setFilePath(QFileInfo(filePath).absoluteFilePath()); // eh yuck + pcmd.runCommands(); + p.end(); + + return img; +} + + +QStringList tst_Lancelot::loadScriptFile(const QString &filePath) +{ + QFile file(filePath); + if (!file.open(QFile::ReadOnly)) { + errorMsg = QLatin1String("Failed to open script file ") + filePath; + return QStringList(); + } + //# use the new readscript function instead? + QTextStream stream(&file); + return stream.readAll().split(QLatin1Char('\n'), QString::SkipEmptyParts); +} + +QTEST_MAIN(tst_Lancelot) +#include "tst_lancelot.moc" diff --git a/tests/auto/other.pro b/tests/auto/other.pro index 3c8f856..d1a7a86 100644 --- a/tests/auto/other.pro +++ b/tests/auto/other.pro @@ -4,6 +4,7 @@ TEMPLATE=subdirs SUBDIRS=\ # exceptionsafety_objects \ shouldn't enable it + lancelot \ qaccessibility \ qalgorithms \ qcombobox \ -- cgit v0.12 From 619f8eec497538a3efb6cd36b12b16c6ce02cd88 Mon Sep 17 00:00:00 2001 From: aavit Date: Wed, 25 Aug 2010 15:21:58 +0200 Subject: Use a remote test server during dev, plus some housekeeping --- tests/arthur/.gitignore | 2 ++ tests/arthur/baselineserver/.gitignore | 2 ++ tests/arthur/baselineserver/src/baselineserver.cpp | 24 +++++++++++++--------- tests/arthur/baselineserver/src/baselineserver.h | 1 + tests/arthur/common/baselineprotocol.cpp | 4 ++-- tests/auto/lancelot/.gitignore | 1 + 6 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 tests/arthur/.gitignore create mode 100644 tests/arthur/baselineserver/.gitignore create mode 100644 tests/auto/lancelot/.gitignore diff --git a/tests/arthur/.gitignore b/tests/arthur/.gitignore new file mode 100644 index 0000000..7f0c1fa --- /dev/null +++ b/tests/arthur/.gitignore @@ -0,0 +1,2 @@ +bin/shower +lance/lance diff --git a/tests/arthur/baselineserver/.gitignore b/tests/arthur/baselineserver/.gitignore new file mode 100644 index 0000000..cc513e0 --- /dev/null +++ b/tests/arthur/baselineserver/.gitignore @@ -0,0 +1,2 @@ +storage +bin/baselineserver diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp index bba2cd8..f7293a2 100644 --- a/tests/arthur/baselineserver/src/baselineserver.cpp +++ b/tests/arthur/baselineserver/src/baselineserver.cpp @@ -79,24 +79,28 @@ BaselineHandler::BaselineHandler(int socketDescriptor) proto.socket.setSocketDescriptor(socketDescriptor); } +QString BaselineHandler::logtime() +{ + return QTime::currentTime().toString(QLatin1String("mm:ss.zzz")); +} void BaselineHandler::receiveRequest() { if (!connectionEstablished) { if (!proto.acceptConnection(&plat)) { - qWarning() << runId << "Accepting new connection failed. " << proto.errorMessage(); + qWarning() << runId << logtime() << "Accepting new connection failed. " << proto.errorMessage(); QThread::currentThread()->exit(1); return; } connectionEstablished = true; - qDebug() << runId << "Connection established with" << plat.hostname << "Qt version:" << plat.qtVersion << plat.buildKey; + qDebug() << runId << logtime() << "Connection established with" << plat.hostname << "Qt version:" << plat.qtVersion << plat.buildKey; return; } QByteArray block; BaselineProtocol::Command cmd; if (!proto.receiveBlock(&cmd, &block)) { - qWarning() << runId << "Command reception failed. "<< proto.errorMessage(); + qWarning() << runId << logtime() << "Command reception failed. "<< proto.errorMessage(); QThread::currentThread()->exit(1); return; } @@ -112,7 +116,7 @@ void BaselineHandler::receiveRequest() storeImage(block, false); break; default: - qWarning() << runId << "Unknown command received. " << proto.errorMessage(); + qWarning() << runId << logtime() << "Unknown command received. " << proto.errorMessage(); QThread::currentThread()->exit(1); } } @@ -120,11 +124,11 @@ void BaselineHandler::receiveRequest() void BaselineHandler::provideBaseline(const QByteArray &caseId) { - qDebug() << runId << "Received request for baseline" << caseId; + qDebug() << runId << logtime() << "Received request for baseline" << caseId; QFile file(pathForCaseId(caseId)); if (!file.open(QIODevice::ReadOnly)) { - qDebug() << runId << "baseline not found."; + qDebug() << runId << logtime() << "baseline not found."; proto.sendBlock(BaselineProtocol::BaselineNotPresent, caseId); return; } @@ -142,13 +146,13 @@ void BaselineHandler::storeImage(const QByteArray &imageBlock, bool isBaseline) ds >> caseId; //# For futuresafeness, should make caseId FS-safe - but revertable... QFile file(pathForCaseId(caseId, isBaseline)); - qDebug() << runId << "Received" << (isBaseline ? "baseline" : "mismatched") << "image for:" << caseId << "Storing in" << file.fileName(); + qDebug() << runId << logtime() << "Received" << (isBaseline ? "baseline" : "mismatched") << "image for:" << caseId << "Storing in" << file.fileName(); QString path = file.fileName().section(QDir::separator(), 0, -2); QDir cwd; if (!cwd.exists(path)) cwd.mkpath(path); if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) { - qWarning() << runId << "Failed to store" << file.fileName(); + qWarning() << runId << logtime() << "Failed to store" << file.fileName(); return; } file.write(imageBlock.constData()+buf.pos(), imageBlock.size()-buf.pos()); @@ -159,13 +163,13 @@ void BaselineHandler::storeImage(const QByteArray &imageBlock, bool isBaseline) + QHostInfo::localDomainName().toLatin1() + ':' + QFileInfo(file).absoluteFilePath().toLatin1(); proto.sendBlock(BaselineProtocol::Ack, msg); - qDebug() << runId << "Storing done."; + qDebug() << runId << logtime() << "Storing done."; } void BaselineHandler::receiveDisconnect() { - qDebug() << runId << "Client disconnected."; + qDebug() << runId << logtime() << "Client disconnected."; QThread::currentThread()->exit(0); } diff --git a/tests/arthur/baselineserver/src/baselineserver.h b/tests/arthur/baselineserver/src/baselineserver.h index 8cd9f56..9d32e5d 100644 --- a/tests/arthur/baselineserver/src/baselineserver.h +++ b/tests/arthur/baselineserver/src/baselineserver.h @@ -64,6 +64,7 @@ private: void provideBaseline(const QByteArray &caseId); void storeImage(const QByteArray &imageBlock, bool isBaseline); QString pathForCaseId(const QByteArray &caseId, bool isBaseline = true); + QString logtime(); BaselineProtocol proto; PlatformInfo plat; diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp index fb4f06d..83b7adc 100644 --- a/tests/arthur/common/baselineprotocol.cpp +++ b/tests/arthur/common/baselineprotocol.cpp @@ -37,8 +37,8 @@ BaselineProtocol::~BaselineProtocol() bool BaselineProtocol::connect() { errMsg.clear(); - //TBD: determine server address; for now localhost - QLatin1String serverName("localhost"); + //###TBD: determine server address; for now local devhost + QLatin1String serverName("chimera.europe.nokia.com"); socket.connectToHost(serverName, ServerPort); diff --git a/tests/auto/lancelot/.gitignore b/tests/auto/lancelot/.gitignore new file mode 100644 index 0000000..0a70416 --- /dev/null +++ b/tests/auto/lancelot/.gitignore @@ -0,0 +1 @@ +tst_lancelot -- cgit v0.12 From db76fd9b3cc0acb49c7c017c85ac3326953167f5 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 26 Aug 2010 12:01:57 +0200 Subject: Oops, fix cut and paste bug in kernel.pri --- src/gui/kernel/kernel.pri | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 703a1cb..4d9110a 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -222,7 +222,7 @@ qpa { kernel/qplatformglcontext_qpa.h \ kernel/qdesktopwidget_qpa_p.h \ kernel/qplatformeventloopintegration_qpa.h \ - painting/qplatformcursor_qpa.h + kernel/qplatformcursor_qpa.h SOURCES += \ kernel/qapplication_qpa.cpp \ @@ -244,7 +244,7 @@ qpa { kernel/qplatformwindowformat_qpa.cpp \ kernel/qplatformeventloopintegration_qpa.cpp \ kernel/qplatformglcontext_qpa.cpp \ - painting/qplatformcursor_qpa.cpp + kernel/qplatformcursor_qpa.cpp contains(QT_CONFIG, glib) { SOURCES += \ -- cgit v0.12 From de66ffa4d7d057f0c782edc45374ad58322a0c4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 26 Aug 2010 09:55:31 +0200 Subject: Remove listing all platform plugins on load --- src/gui/kernel/qplatformintegrationfactory_qpa.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/kernel/qplatformintegrationfactory_qpa.cpp b/src/gui/kernel/qplatformintegrationfactory_qpa.cpp index 4f2bfa5..9122e1a 100644 --- a/src/gui/kernel/qplatformintegrationfactory_qpa.cpp +++ b/src/gui/kernel/qplatformintegrationfactory_qpa.cpp @@ -61,7 +61,6 @@ QPlatformIntegration *QPlatformIntegrationFactory::create(const QString& key) QString platform = paramList.takeFirst().toLower(); #if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) - qDebug() << loader()->keys(); if (QPlatformIntegrationFactoryInterface *factory = qobject_cast(loader()->instance(platform))) ret = factory->create(platform, paramList); #endif -- cgit v0.12 From aabb19f90c93a12a1458c96d7e6baf6632a79098 Mon Sep 17 00:00:00 2001 From: aavit Date: Fri, 27 Aug 2010 12:45:00 +0200 Subject: minor message fix --- tests/arthur/baselineserver/src/baselineserver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp index f7293a2..9f1665f 100644 --- a/tests/arthur/baselineserver/src/baselineserver.cpp +++ b/tests/arthur/baselineserver/src/baselineserver.cpp @@ -157,7 +157,7 @@ void BaselineHandler::storeImage(const QByteArray &imageBlock, bool isBaseline) } file.write(imageBlock.constData()+buf.pos(), imageBlock.size()-buf.pos()); - QByteArray msg(isBaseline ? "Mismatching" : "Baseline"); + QByteArray msg(isBaseline ? "Baseline" : "Mismatching" ); msg += " image stored in " + QHostInfo::localHostName().toLatin1() + '.' + QHostInfo::localDomainName().toLatin1() + ':' -- cgit v0.12 From ab6a22fd0d414a8c7a9c3875cf1599516c0c6ff3 Mon Sep 17 00:00:00 2001 From: aavit Date: Mon, 30 Aug 2010 09:46:10 +0200 Subject: Experiment with generating and storing the diff image also on failure --- tests/auto/lancelot/tst_lancelot.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index 1b832c6..f1c6e5c 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -160,6 +160,19 @@ void tst_Lancelot::testRendering() if (rendered != baseline) { QByteArray failMsg; proto.submitMismatch(fileName, rendered, &failMsg); + +#if 1 + // Also generate & submit the diff image + QImage diff(rendered.size(), QImage::Format_RGB32); + diff.fill(0); + QPainter p(&diff); + p.drawImage(0, 0, rendered); + p.setCompositionMode(QPainter::RasterOp_SourceXorDestination); + p.drawImage(0, 0, baseline); + p.end(); + proto.submitMismatch(fileName + QLatin1String("_diff"), diff, 0); +#endif + failMsg.prepend("Rendered image differs from baseline. "); QFAIL(failMsg.constData()); } -- cgit v0.12 From 4fe2b5d9b8dd43becf69cdf848ce7cdfca39b3bd Mon Sep 17 00:00:00 2001 From: aavit Date: Mon, 30 Aug 2010 14:46:47 +0200 Subject: Add reporting of difference score on mismatches --- tests/auto/lancelot/tst_lancelot.cpp | 72 ++++++++++++++++++++++++++++-------- 1 file changed, 57 insertions(+), 15 deletions(-) diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index f1c6e5c..5e346ff 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -67,6 +67,7 @@ private: QImage getBaseline(const QString &fileName, bool *created); QImage render(const QString &fileName); QStringList loadScriptFile(const QString &filePath); + QString computeMismatchScore(const QImage& baseline, const QImage& rendered); QString errorMsg; BaselineProtocol proto; @@ -158,27 +159,68 @@ void tst_Lancelot::testRendering() // The actual check: if (rendered != baseline) { - QByteArray failMsg; - proto.submitMismatch(fileName, rendered, &failMsg); - -#if 1 - // Also generate & submit the diff image - QImage diff(rendered.size(), QImage::Format_RGB32); - diff.fill(0); - QPainter p(&diff); - p.drawImage(0, 0, rendered); - p.setCompositionMode(QPainter::RasterOp_SourceXorDestination); - p.drawImage(0, 0, baseline); - p.end(); - proto.submitMismatch(fileName + QLatin1String("_diff"), diff, 0); -#endif + QString scoreMsg = computeMismatchScore(baseline, rendered); + QByteArray serverMsg; + proto.submitMismatch(fileName, rendered, &serverMsg); - failMsg.prepend("Rendered image differs from baseline. "); + QByteArray failMsg = QByteArray("Rendered image differs from baseline. ") + + scoreMsg.toLatin1() + '\n' + serverMsg; QFAIL(failMsg.constData()); } } +QString tst_Lancelot::computeMismatchScore(const QImage &baseline, const QImage &rendered) +{ + if (baseline.size() != rendered.size() || baseline.format() != rendered.format()) + return QLatin1String("[No score, incomparable images.]"); + if (baseline.depth() != 32) + return QLatin1String("[Score computation not implemented for format.]"); + + int w = baseline.width(); + int h = baseline.height(); + + uint ncd = 0; // number of differing color pixels + uint nad = 0; // number of differing alpha pixels + uint scd = 0; // sum of color pixel difference + uint sad = 0; // sum of alpha pixel difference + + for (int y=0; y Date: Tue, 31 Aug 2010 11:02:12 +0200 Subject: try a different image format --- tests/auto/lancelot/tst_lancelot.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index 5e346ff..5bbc575 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -211,11 +211,11 @@ QString tst_Lancelot::computeMismatchScore(const QImage &baseline, const QImage double pcd = 100.0 * ncd / (w*h); // percent of pixels that differ double acd = ncd ? double(scd) / (3*ncd) : 0; // avg. difference - QString res = QString(QLatin1String("Diffscore: %1% (Num:%2 Avg:%3.)")).arg(pcd, 0, 'g', 3).arg(ncd).arg(acd, 0, 'g', 3); + QString res = QString(QLatin1String("Diffscore: %1% (Num:%2 Avg:%3.)")).arg(pcd, 0, 'g', 2).arg(ncd).arg(acd, 0, 'g', 2); if (baseline.hasAlphaChannel()) { double pad = 100.0 * nad / (w*h); // percent of pixels that differ double aad = nad ? double(sad) / (3*nad) : 0; // avg. difference - res += QString(QLatin1String(" Alpha-diffscore: %1% (Num:%2 Avg:%3.)")).arg(pad, 0, 'g', 3).arg(nad).arg(aad, 0, 'g', 3); + res += QString(QLatin1String(" Alpha-diffscore: %1% (Num:%2 Avg:%3.)")).arg(pad, 0, 'g', 2).arg(nad).arg(aad, 0, 'g', 2); } return res; } @@ -265,7 +265,7 @@ QImage tst_Lancelot::render(const QString &fileName) if (script.isEmpty()) return QImage(); - QImage img(800, 800, QImage::Format_ARGB32_Premultiplied); + QImage img(800, 800, QImage::Format_ARGB32); QPainter p(&img); PaintCommands pcmd(script, 800, 800); pcmd.setPainter(&p); -- cgit v0.12 From 38f0e9dbf41ebc8707398279ccb7038d3927c2d8 Mon Sep 17 00:00:00 2001 From: aavit Date: Thu, 2 Sep 2010 14:48:04 +0200 Subject: Rewrite protocol (ImageItem/ImageItemList) Not finished, but core functionality is in working state. --- tests/arthur/baselineserver/src/baselineserver.cpp | 78 ++++++++---- tests/arthur/baselineserver/src/baselineserver.h | 5 +- tests/arthur/common/baselineprotocol.cpp | 78 ++++++++++-- tests/arthur/common/baselineprotocol.h | 63 ++++++++-- tests/auto/lancelot/tst_lancelot.cpp | 131 +++++++++++++-------- 5 files changed, 265 insertions(+), 90 deletions(-) diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp index 9f1665f..3087357 100644 --- a/tests/arthur/baselineserver/src/baselineserver.cpp +++ b/tests/arthur/baselineserver/src/baselineserver.cpp @@ -5,6 +5,7 @@ #include #include #include +#include QString BaselineServer::storage; @@ -106,6 +107,9 @@ void BaselineHandler::receiveRequest() } switch(cmd) { + case BaselineProtocol::RequestBaselineChecksums: + provideBaselineChecksums(block); + break; case BaselineProtocol::RequestBaseline: provideBaseline(block); break; @@ -122,40 +126,73 @@ void BaselineHandler::receiveRequest() } +void BaselineHandler::provideBaselineChecksums(const QByteArray &itemListBlock) +{ + ImageItemList itemList; + QDataStream ds(itemListBlock); + ds >> itemList; + qDebug() << runId << logtime() << "Received request for checksums for" << itemList.count() << "items"; + + for (ImageItemList::iterator i = itemList.begin(); i != itemList.end(); ++i) { + i->imageChecksum = 0; + QString prefix = pathForItem(*i, true); + QFile file(prefix + QLatin1String("metadata")); + if (file.open(QIODevice::ReadOnly)) { + QTextStream ts(&file); + ts >> i->imageChecksum; + file.close(); + i->status = ImageItem::Ok; + } + if (!i->imageChecksum) + i->status = ImageItem::BaselineNotFound; + } + + QByteArray block; + QDataStream ods(&block, QIODevice::WriteOnly); + ods << itemList; + proto.sendBlock(BaselineProtocol::Ack, block); +} + + void BaselineHandler::provideBaseline(const QByteArray &caseId) { qDebug() << runId << logtime() << "Received request for baseline" << caseId; + //### rewrite to use ImageItem + /* QFile file(pathForCaseId(caseId)); if (!file.open(QIODevice::ReadOnly)) { qDebug() << runId << logtime() << "baseline not found."; proto.sendBlock(BaselineProtocol::BaselineNotPresent, caseId); return; } + proto.sendBlock(BaselineProtocol::AcceptBaseline, file.readAll()); + */ } -void BaselineHandler::storeImage(const QByteArray &imageBlock, bool isBaseline) +void BaselineHandler::storeImage(const QByteArray &itemBlock, bool isBaseline) { - QBuffer buf; - buf.setData(imageBlock); - buf.open(QIODevice::ReadOnly); - QDataStream ds(&buf); - QByteArray caseId; - ds >> caseId; - //# For futuresafeness, should make caseId FS-safe - but revertable... - QFile file(pathForCaseId(caseId, isBaseline)); - qDebug() << runId << logtime() << "Received" << (isBaseline ? "baseline" : "mismatched") << "image for:" << caseId << "Storing in" << file.fileName(); - QString path = file.fileName().section(QDir::separator(), 0, -2); + QDataStream ds(itemBlock); + ImageItem item; + ds >> item; + + QString prefix = pathForItem(item, isBaseline); + qDebug() << runId << logtime() << "Received" << (isBaseline ? "baseline" : "mismatched") << "image for:" << item.scriptName << "Storing in" << prefix; + + QString dir = prefix.section(QDir::separator(), 0, -2); QDir cwd; - if (!cwd.exists(path)) - cwd.mkpath(path); - if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) { - qWarning() << runId << logtime() << "Failed to store" << file.fileName(); - return; - } - file.write(imageBlock.constData()+buf.pos(), imageBlock.size()-buf.pos()); + if (!cwd.exists(dir)) + cwd.mkpath(dir); + item.image.save(prefix + QLatin1String(FileFormat), FileFormat); + + //# Could use QSettings or XML or even DB, could use common file for whole dir or even whole storage - but for now, keep it simple + QFile file(prefix + QLatin1String("metadata")); + file.open(QIODevice::WriteOnly | QIODevice::Truncate); + QTextStream ts(&file); + ts << hex << showbase << item.imageChecksum << reset << endl; + file.close(); QByteArray msg(isBaseline ? "Baseline" : "Mismatching" ); msg += " image stored in " @@ -174,7 +211,7 @@ void BaselineHandler::receiveDisconnect() } -QString BaselineHandler::pathForCaseId(const QByteArray &caseId, bool isBaseline) +QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline) { QString storePath = BaselineServer::storagePath(); storePath += plat.buildKey.section(QLatin1Char(' '), 1, 1) + QLatin1String("_Qt-") @@ -183,7 +220,8 @@ QString BaselineHandler::pathForCaseId(const QByteArray &caseId, bool isBaseline storePath += QLatin1String("baselines") + QDir::separator(); else storePath += runId + QDir::separator(); - return storePath + caseId + QLatin1Char('.') + QLatin1String(FileFormat); + //#? QString itemName = item.scriptName.replace(item.scriptName.lastIndexOf('.'), '_'); + return storePath + item.scriptName + QLatin1Char('.'); } diff --git a/tests/arthur/baselineserver/src/baselineserver.h b/tests/arthur/baselineserver/src/baselineserver.h index 9d32e5d..4056ce0 100644 --- a/tests/arthur/baselineserver/src/baselineserver.h +++ b/tests/arthur/baselineserver/src/baselineserver.h @@ -11,7 +11,7 @@ #include // #seconds between update checks -#define HEARTBEAT 10 +#define HEARTBEAT 5 class BaselineServer : public QTcpServer { @@ -61,9 +61,10 @@ private slots: void receiveDisconnect(); private: + void provideBaselineChecksums(const QByteArray &itemListBlock); void provideBaseline(const QByteArray &caseId); void storeImage(const QByteArray &imageBlock, bool isBaseline); - QString pathForCaseId(const QByteArray &caseId, bool isBaseline = true); + QString pathForItem(const ImageItem &item, bool isBaseline = true); QString logtime(); BaselineProtocol proto; diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp index 83b7adc..e5545a9 100644 --- a/tests/arthur/common/baselineprotocol.cpp +++ b/tests/arthur/common/baselineprotocol.cpp @@ -26,6 +26,42 @@ QDataStream & operator>> (QDataStream& stream, PlatformInfo& pinfo) return stream; } +ImageItem &ImageItem::operator=(const ImageItem &other) +{ + scriptName = other.scriptName; + scriptChecksum = other.scriptChecksum; + status = other.status; + renderFormat = other.renderFormat; + engine = other.engine; + image = other.image; + imageChecksum = other.imageChecksum; + return *this; +} + +quint64 ImageItem::computeChecksum(const QImage &image) +{ + //### Just fake it for now + return qChecksum((const char *)image.constScanLine(50), image.bytesPerLine()); +} + +QDataStream & operator<< (QDataStream &stream, const ImageItem &ii) +{ + stream << ii.scriptName << ii.scriptChecksum << quint8(ii.status) << quint8(ii.renderFormat) + << quint8(ii.engine) << ii.image << ii.imageChecksum; + return stream; +} + +QDataStream & operator>> (QDataStream &stream, ImageItem &ii) +{ + quint8 encFormat, encStatus, encEngine; + stream >> ii.scriptName >> ii.scriptChecksum >> encStatus >> encFormat + >> encEngine >> ii.image >> ii.imageChecksum; + ii.renderFormat = QImage::Format(encFormat); + ii.status = ImageItem::ItemStatus(encStatus); + ii.engine = ImageItem::GraphicsEngine(encEngine); + return stream; +} + BaselineProtocol::~BaselineProtocol() { socket.close(); @@ -86,8 +122,28 @@ bool BaselineProtocol::acceptConnection(PlatformInfo *pi) } +bool BaselineProtocol::requestBaselineChecksums(ImageItemList *itemList) +{ + errMsg.clear(); + if (!itemList) + return false; + QByteArray block; + QDataStream ds(&block, QIODevice::ReadWrite); + ds << *itemList; + if (!sendBlock(RequestBaselineChecksums, block)) + return false; + Command cmd; + if (!receiveBlock(&cmd, &block)) + return false; + ds.device()->seek(0); + ds >> *itemList; + return true; +} + + bool BaselineProtocol::requestBaseline(const QString &caseId, Command *response, QImage *baseline) { + //### TBD: rewrite to use ImageItem errMsg.clear(); if (!sendBlock(RequestBaseline, caseId.toLatin1())) return false; @@ -115,29 +171,31 @@ bool BaselineProtocol::requestBaseline(const QString &caseId, Command *response, } -bool BaselineProtocol::submitNewBaseline(const QString &caseId, const QImage &baseline) +bool BaselineProtocol::submitNewBaseline(const ImageItem &item) +{ + return sendItem(AcceptNewBaseline, item); +} + + +bool BaselineProtocol::sendItem(Command cmd, const ImageItem &item) { errMsg.clear(); QBuffer buf; buf.open(QIODevice::WriteOnly); QDataStream ds(&buf); - ds << caseId.toLatin1(); - if (!baseline.save(&buf, FileFormat)) { - errMsg = QLatin1String("Failed to convert new baseline image to ") + QLatin1String(FileFormat); - return false; - } - if (!sendBlock(AcceptNewBaseline, buf.data())) { - errMsg.prepend(QLatin1String("Failed to submit new baseline to server. ")); + ds << item; + if (!sendBlock(cmd, buf.data())) { + errMsg.prepend(QLatin1String("Failed to submit image to server. ")); return false; } - Command cmd; - receiveBlock(&cmd, 0); // Just wait for the pong; ignore reply contents + receiveBlock(&cmd, 0); // For now, Just wait for the pong; ignore reply contents return true; } bool BaselineProtocol::submitMismatch(const QString &caseId, const QImage &mismatch, QByteArray *failMsg) { + //### TBD: rewrite to use ImageItem errMsg.clear(); QBuffer buf; buf.open(QIODevice::WriteOnly); diff --git a/tests/arthur/common/baselineprotocol.h b/tests/arthur/common/baselineprotocol.h index 8740413..b16a55b 100644 --- a/tests/arthur/common/baselineprotocol.h +++ b/tests/arthur/common/baselineprotocol.h @@ -3,19 +3,61 @@ #include #include +#include +#include #define FileFormat "png" struct PlatformInfo { -public: PlatformInfo(bool useLocal = false); QString buildKey; QString qtVersion; QString hostname; }; +QDataStream & operator<< (QDataStream &stream, const PlatformInfo &pinfo); +QDataStream & operator>> (QDataStream& stream, PlatformInfo& pinfo); +struct ImageItem +{ +public: + ImageItem() + : status(Ok), renderFormat(QImage::Format_Invalid), engine(Raster), imageChecksum(0), scriptChecksum(0) + {} + ImageItem(const ImageItem &other) + { *this = other; } + ~ImageItem() + {} + ImageItem &operator=(const ImageItem &other); + static quint64 computeChecksum(const QImage& image); + + enum ItemStatus { + Ok = 0, + BaselineNotFound = 1, + IgnoreItem = 2 + }; + + enum GraphicsEngine { + Raster = 0, + OpenGL = 1 + }; + + QString scriptName; + ItemStatus status; + QImage::Format renderFormat; + GraphicsEngine engine; + QImage image; + quint64 imageChecksum; + // tbd: add diffscore + quint16 scriptChecksum; +}; +QDataStream & operator<< (QDataStream &stream, const ImageItem &ii); +QDataStream & operator>> (QDataStream& stream, ImageItem& ii); + +Q_DECLARE_METATYPE(ImageItem); + +typedef QVector ImageItemList; class BaselineProtocol @@ -30,18 +72,21 @@ public: enum Constant { ProtocolVersion = 1, ServerPort = 54129, - Timeout = 100000 + Timeout = 10000 }; enum Command { UnknownError = 0, // Queries AcceptPlatformInfo = 1, - RequestBaseline = 2, - AcceptNewBaseline = 3, - AcceptMismatch = 4, + RequestBaselineChecksums = 2, + RequestBaseline = 3, + AcceptNewBaseline = 4, + AcceptMismatch = 5, // Responses Ack = 128, + + //#### remove these: AcceptBaseline = 129, BaselineNotPresent = 130, IgnoreCase = 131 @@ -49,8 +94,9 @@ public: // For client: bool connect(); + bool requestBaselineChecksums(ImageItemList *itemList); bool requestBaseline(const QString &caseId, Command *response, QImage *baseline); - bool submitNewBaseline(const QString &caseId, const QImage &baseline); + bool submitNewBaseline(const ImageItem &item); bool submitMismatch(const QString &caseId, const QImage &mismatch, QByteArray *failMsg); // For server: @@ -59,6 +105,8 @@ public: QString errorMessage(); private: + bool sendItem(Command cmd, const ImageItem &item); + bool sendBlock(Command cmd, const QByteArray &block); bool receiveBlock(Command *cmd, QByteArray *block); QString errMsg; @@ -69,8 +117,7 @@ private: }; -QDataStream & operator<< (QDataStream &stream, const PlatformInfo &pinfo); -QDataStream & operator>> (QDataStream& stream, PlatformInfo& pinfo); + #endif // BASELINEPROTOCOL_H diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index 5bbc575..a6bb68f 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -65,19 +65,21 @@ public: private: QImage getBaseline(const QString &fileName, bool *created); - QImage render(const QString &fileName); + QImage render(const QString &fileName, QImage::Format format); QStringList loadScriptFile(const QString &filePath); QString computeMismatchScore(const QImage& baseline, const QImage& rendered); + void runTestSuite(); QString errorMsg; BaselineProtocol proto; + ImageItemList baseList; private slots: void initTestCase(); void cleanupTestCase() {} - void testRendering_data(); - void testRendering(); + void testRasterARGB32PM_data(); + void testRasterARGB32PM(); }; tst_Lancelot::tst_Lancelot() @@ -86,85 +88,111 @@ tst_Lancelot::tst_Lancelot() void tst_Lancelot::initTestCase() { + // Check and setup the environment. We treat failures because of test environment + // (e.g. script files not found) as just warnings, and not QFAILs, to avoid false negatives + // caused by environment or server instability + #if !defined(Q_OS_LINUX) QSKIP("For the moment, this test is only supported on Linux.", SkipAll); #endif - - // Check the environment here, so that we can just skip on trouble! if (!proto.connect()) { QWARN(qPrintable(proto.errorMessage())); QSKIP("Communication with baseline image server failed.", SkipAll); } - // TBD: preload scripts, to confirm reading and generate checksums + QDir qpsDir(scriptsDir); + QStringList files = qpsDir.entryList(QStringList() << QLatin1String("*.qps"), QDir::Files | QDir::Readable); + if (files.isEmpty()) { + QWARN("No qps script files found in " + qpsDir.path().toLatin1()); + QSKIP("Aborted due to errors.", SkipAll); + } + + baseList.resize(files.count()); + int i = 0; + foreach(const QString& file, files) { + baseList[i].scriptName = file; + // tbd: also load, split and generate checksums for scripts + i++; + } } -void tst_Lancelot::testRendering_data() + +void tst_Lancelot::testRasterARGB32PM_data() { - // search the data directory for qps files and make a row for each. - // filter out those marked as blacklisted (in the file itself?) - // Rather do the above in initTestCase. Can load & split them all also. - // And baselines too? + QTest::addColumn("item"); - QTest::addColumn("fileName"); + ImageItemList itemList(baseList); - // ### no, don't do it like this, we want opt-in, not opt-out, for stability - QDir qpsDir(scriptsDir); - QStringList files = qpsDir.entryList(QStringList() << QLatin1String("*.qps"), QDir::Files | QDir::Readable); - files.removeOne(QLatin1String("porter_duff.qps")); - files.removeOne(QLatin1String("porter_duff2.qps")); - files.removeOne(QLatin1String("images.qps")); - files.removeOne(QLatin1String("sizes.qps")); + for(int i = 0; i < itemList.size(); i++) { + itemList[i].engine = ImageItem::Raster; + itemList[i].renderFormat = QImage::Format_ARGB32_Premultiplied; + } - if (files.isEmpty()) { - QWARN("No qps files found in " + qpsDir.path().toLatin1()); - QSKIP("Aborted due to errors.", SkipAll); + if (!proto.requestBaselineChecksums(&itemList)) { + QWARN(qPrintable(proto.errorMessage())); + QSKIP("Communication with baseline image server failed.", SkipAll); } - foreach(QString fileName, files) { - QString baseName = fileName.section('.', 0, -2); - QTest::newRow(baseName.toLatin1()) << fileName; + qDebug() << "items:" << itemList.count(); + foreach(const ImageItem& item, itemList) { + if (item.scriptName != QLatin1String("sizes.qps")) // Hardcoded blacklisting for this enigine/format + QTest::newRow(item.scriptName.toLatin1()) << item; } } -// We treat failures because of test environment -// (e.g. script files not found) as just warnings, and not -// QFAILs, to avoid false negatives caused by environment -// or server instability +void tst_Lancelot::testRasterARGB32PM() +{ + runTestSuite(); +} -void tst_Lancelot::testRendering() + +void tst_Lancelot::runTestSuite() { errorMsg.clear(); - QFETCH(QString, fileName); + QFETCH(ImageItem, item); + + if (item.status == ImageItem::IgnoreItem) + QSKIP("Blacklisted by baseline server.", SkipSingle); + + QImage rendered = render(item.scriptName, item.renderFormat); + if (!errorMsg.isNull() || rendered.isNull()) { // Assume an error in the test environment, not Qt + QWARN("Error: Failed to render image. " + errorMsg.toLatin1()); + QSKIP("Aborted due to errors.", SkipSingle); + } - bool newBaselineCreated = false; - QImage baseline = getBaseline(fileName, &newBaselineCreated); - if (newBaselineCreated) + quint64 checksum = ImageItem::computeChecksum(rendered); + + if (item.status == ImageItem::BaselineNotFound) { + item.image = rendered; + item.imageChecksum = checksum; + proto.submitNewBaseline(item); QSKIP("Baseline not found; new baseline created.", SkipSingle); + } + + qDebug() << "rendered" << QString::number(checksum, 16).prepend("0x") << "baseline" << QString::number(item.imageChecksum, 16).prepend("0x"); + if (checksum != item.imageChecksum) { + /* TBD + - Get baseline image + - compute diffscore + - submit mismatching + + getBaseline(...) if (!errorMsg.isNull() || baseline.isNull()) { QWARN("Error: Failed to get baseline image. " + errorMsg.toLatin1()); QSKIP("Aborted due to errors.", SkipSingle); } - QImage rendered = render(fileName); - if (!errorMsg.isNull() || rendered.isNull()) { - // Indicates that it's an error in the test environment, not Qt - QWARN("Error: Failed to render image. " + errorMsg.toLatin1()); - QSKIP("Aborted due to errors.", SkipSingle); - } if (rendered.format() != baseline.format()) - baseline = baseline.convertToFormat(rendered.format()); + rendered = rendered.convertToFormat(baseline.format()); //### depending on format - // The actual check: - if (rendered != baseline) { QString scoreMsg = computeMismatchScore(baseline, rendered); QByteArray serverMsg; proto.submitMismatch(fileName, rendered, &serverMsg); - - QByteArray failMsg = QByteArray("Rendered image differs from baseline. ") - + scoreMsg.toLatin1() + '\n' + serverMsg; + */ + QByteArray failMsg = QByteArray("Rendered image differs from baseline. "); + //+ scoreMsg.toLatin1() + '\n' + serverMsg; QFAIL(failMsg.constData()); } } @@ -211,11 +239,11 @@ QString tst_Lancelot::computeMismatchScore(const QImage &baseline, const QImage double pcd = 100.0 * ncd / (w*h); // percent of pixels that differ double acd = ncd ? double(scd) / (3*ncd) : 0; // avg. difference - QString res = QString(QLatin1String("Diffscore: %1% (Num:%2 Avg:%3.)")).arg(pcd, 0, 'g', 2).arg(ncd).arg(acd, 0, 'g', 2); + QString res = QString(QLatin1String("Diffscore: %1% (Num:%2 Avg:%3)")).arg(pcd, 0, 'g', 2).arg(ncd).arg(acd, 0, 'g', 2); if (baseline.hasAlphaChannel()) { double pad = 100.0 * nad / (w*h); // percent of pixels that differ double aad = nad ? double(sad) / (3*nad) : 0; // avg. difference - res += QString(QLatin1String(" Alpha-diffscore: %1% (Num:%2 Avg:%3.)")).arg(pad, 0, 'g', 2).arg(nad).arg(aad, 0, 'g', 2); + res += QString(QLatin1String(" Alpha-diffscore: %1% (Num:%2 Avg:%3)")).arg(pad, 0, 'g', 2).arg(nad).arg(aad, 0, 'g', 2); } return res; } @@ -224,6 +252,8 @@ QString tst_Lancelot::computeMismatchScore(const QImage &baseline, const QImage QImage tst_Lancelot::getBaseline(const QString &fileName, bool *created) { QImage baseline; + //### TBD: rewrite to use ImageItem + /* BaselineProtocol::Command response; if (!proto.requestBaseline(fileName, &response, &baseline)) { errorMsg = QLatin1String("Error downloading baseline from server. ") + proto.errorMessage(); @@ -254,18 +284,19 @@ QImage tst_Lancelot::getBaseline(const QString &fileName, bool *created) errorMsg = QLatin1String("Unknown response from baseline server. "); return QImage(); } + */ return baseline; } -QImage tst_Lancelot::render(const QString &fileName) +QImage tst_Lancelot::render(const QString &fileName, QImage::Format format) { QString filePath = scriptsDir + fileName; QStringList script = loadScriptFile(filePath); if (script.isEmpty()) return QImage(); - QImage img(800, 800, QImage::Format_ARGB32); + QImage img(800, 800, format); QPainter p(&img); PaintCommands pcmd(script, 800, 800); pcmd.setPainter(&p); -- cgit v0.12 From 5e7fdcc7a4a2bb070ad7ece920ac5db81e3e6f77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 20 Aug 2010 12:33:33 +0200 Subject: Initial pluggable fontdatabase QPlatformFontDatabase added. QPlatformIntegration now has a new virtual function: QPlatformDatabase::fontDatabase() const. Most unix platform plugins wants to follow the pattern implemented in directfb, linuxfb, vnc etc. In the pro file do: include(../fontdatabases/genericunix/genericunix.pri) In the QPlatformIntegration class do: and instansiate a QGenericFontDatabase in the constructor and return it in the getter function. --- configure | 24 + lib/fonts/dejavu_sans_11_50.qpf2 | Bin 0 -> 405944 bytes src/gui/kernel/qplatformintegration_qpa.cpp | 11 + src/gui/kernel/qplatformintegration_qpa.h | 4 + src/gui/painting/qpaintengine.h | 2 +- src/gui/painting/qpaintengine_raster.cpp | 31 +- src/gui/painting/qpdf.cpp | 2 +- src/gui/text/qfont.h | 4 +- src/gui/text/qfont_qpa.cpp | 114 ++++ src/gui/text/qfontdatabase.cpp | 67 ++- src/gui/text/qfontdatabase.h | 1 + src/gui/text/qfontdatabase_qpa.cpp | 392 +++++++++++++ src/gui/text/qfontengine.cpp | 2 +- src/gui/text/qfontengine_ft.cpp | 7 +- src/gui/text/qfontengine_ft_p.h | 16 +- src/gui/text/qfontengine_p.h | 2 +- src/gui/text/qfontengine_qpa.cpp | 650 +++++++++++++++++++++ src/gui/text/qfontengine_qpa_p.h | 262 +++++++++ src/gui/text/qplatformfontdatabase_qpa.cpp | 195 +++++++ src/gui/text/qplatformfontdatabase_qpa.h | 65 +++ src/gui/text/text.pri | 22 +- src/plugins/platforms/directfb/directfb.pro | 2 + .../platforms/directfb/qdirectfbintegration.cpp | 7 +- .../platforms/directfb/qdirectfbintegration.h | 4 +- src/plugins/platforms/eglfs/eglfs.pro | 2 + src/plugins/platforms/eglfs/qeglfsintegration.cpp | 8 + src/plugins/platforms/eglfs/qeglfsintegration.h | 3 + .../fontdatabases/basicunix/basicunix.pri | 82 +++ .../basicunix/qbasicunixfontdatabase.cpp | 281 +++++++++ .../basicunix/qbasicunixfontdatabase.h | 26 + .../fontdatabases/fontconfig/fontconfig.pri | 12 + .../fontconfig/qfontconfigdatabase.cpp | 528 +++++++++++++++++ .../fontdatabases/fontconfig/qfontconfigdatabase.h | 15 + .../fontdatabases/genericunix/genericunix.pri | 10 + .../genericunix/qgenericunixfontdatabase.h | 12 + src/plugins/platforms/linuxfb/linuxfb.pro | 1 + .../platforms/linuxfb/qlinuxfbintegration.cpp | 7 + .../platforms/linuxfb/qlinuxfbintegration.h | 3 + src/plugins/platforms/platforms.pro | 12 +- src/plugins/platforms/qvfb/qvfb.pro | 2 + src/plugins/platforms/qvfb/qvfbintegration.cpp | 8 + src/plugins/platforms/qvfb/qvfbintegration.h | 3 + .../platforms/testlite/qtestliteintegration.cpp | 8 +- .../platforms/testlite/qtestliteintegration.h | 3 + src/plugins/platforms/testlite/qtestlitewindow.cpp | 10 +- src/plugins/platforms/testlite/testlite.pro | 21 +- src/plugins/platforms/vnc/qvncintegration.cpp | 8 +- src/plugins/platforms/vnc/qvncintegration.h | 4 + src/plugins/platforms/vnc/vnc.pro | 1 + 49 files changed, 2894 insertions(+), 62 deletions(-) create mode 100644 lib/fonts/dejavu_sans_11_50.qpf2 create mode 100644 src/gui/text/qfont_qpa.cpp create mode 100644 src/gui/text/qfontdatabase_qpa.cpp create mode 100644 src/gui/text/qfontengine_qpa.cpp create mode 100644 src/gui/text/qfontengine_qpa_p.h create mode 100644 src/gui/text/qplatformfontdatabase_qpa.cpp create mode 100644 src/gui/text/qplatformfontdatabase_qpa.h create mode 100644 src/plugins/platforms/fontdatabases/basicunix/basicunix.pri create mode 100644 src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp create mode 100644 src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h create mode 100644 src/plugins/platforms/fontdatabases/fontconfig/fontconfig.pri create mode 100644 src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp create mode 100644 src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.h create mode 100644 src/plugins/platforms/fontdatabases/genericunix/genericunix.pri create mode 100644 src/plugins/platforms/fontdatabases/genericunix/qgenericunixfontdatabase.h diff --git a/configure b/configure index bdf4588..94a0c0f 100755 --- a/configure +++ b/configure @@ -6093,6 +6093,30 @@ if [ "$PLATFORM_QPA" = "yes" ]; then exit 1 fi fi + + # auto-detect FontConfig support + if [ "$CFG_FONTCONFIG" != "no" ]; then + if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists fontconfig --exists freetype2 2>/dev/null; then + QT_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig --cflags freetype2 2>/dev/null` + QT_LIBS_FONTCONFIG=`$PKG_CONFIG --libs fontconfig --libs freetype2 2>/dev/null` + else + QT_CFLAGS_FONTCONFIG= + QT_LIBS_FONTCONFIG="-lfreetype -lfontconfig" + fi + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/fontconfig "FontConfig" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS $QT_CFLAGS_FONTCONFIG $QT_LIBS_FONTCONFIG; then + QT_CONFIG="$QT_CONFIG fontconfig" + QMakeVar set QMAKE_CFLAGS_FONTCONFIG "$QT_CFLAGS_FONTCONFIG" + QMakeVar set QMAKE_LIBS_FONTCONFIG "$QT_LIBS_FONTCONFIG" + CFG_LIBFREETYPE=system + fi + fi + + # MIT_SHM is required for testlite + if [ "$CFG_MITSHM" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/mitshm "mitshm" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then + QT_CONFIG="$QT_CONFIG mitshm" + fi + fi fi diff --git a/lib/fonts/dejavu_sans_11_50.qpf2 b/lib/fonts/dejavu_sans_11_50.qpf2 new file mode 100644 index 0000000..c88d099 Binary files /dev/null and b/lib/fonts/dejavu_sans_11_50.qpf2 differ diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp index b4987f2..e2a493d 100644 --- a/src/gui/kernel/qplatformintegration_qpa.cpp +++ b/src/gui/kernel/qplatformintegration_qpa.cpp @@ -41,6 +41,8 @@ #include "qplatformintegration_qpa.h" +#include + QT_BEGIN_NAMESPACE QPixmap QPlatformIntegration::grabWindow(WId window, int x, int y, int width, int height) const @@ -63,4 +65,13 @@ bool QPlatformIntegration::hasOpenGL() const return false; } +QPlatformFontDatabase *QPlatformIntegration::fontDatabase() const +{ + static QPlatformFontDatabase *db = 0; + if (!db) { + db = new QPlatformFontDatabase; + } + return db; +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index 9460910..b1f4e5f 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -58,6 +58,7 @@ class QWindowSurface; class QBlittable; class QWidget; class QPlatformEventLoopIntegration; +class QPlatformFontDatabase; class Q_GUI_EXPORT QPlatformIntegration { @@ -75,6 +76,9 @@ public: virtual bool isVirtualDesktop() { return false; } virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const; +//Fontdatabase integration. + virtual QPlatformFontDatabase *fontDatabase() const; + // Experimental in mainthread eventloop integration // This should only be used if it is only possible to do window system event processing in // the gui thread. All of the functions in QWindowSystemInterface are thread safe. diff --git a/src/gui/painting/qpaintengine.h b/src/gui/painting/qpaintengine.h index ddb6195..ee9b457 100644 --- a/src/gui/painting/qpaintengine.h +++ b/src/gui/painting/qpaintengine.h @@ -272,7 +272,7 @@ private: friend class QProxyFontEngine; #endif #ifdef Q_WS_QPA - friend class QProxyFontEngine; + friend class QFontEngineQPA; #endif friend class QPainter; friend class QPainterPrivate; diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index df32ea8..7dee7e4 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3396,9 +3396,36 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte } #endif // Q_WS_QWS -#if (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) || defined(Q_WS_QPA)) && !defined(QT_NO_FREETYPE) +#ifdef Q_WS_QPA + if (s->matrix.type() < QTransform::TxScale) { -#if (defined(Q_WS_QWS) || defined(Q_WS_QPA)) && !defined(QT_NO_QWS_QPF2) + QVarLengthArray positions; + QVarLengthArray glyphs; + QTransform matrix = state()->transform(); + + qreal _x = qFloor(p.x() + aliasedCoordinateDelta); + qreal _y = qFloor(p.y() + aliasedCoordinateDelta); + matrix.translate(_x, _y); + + fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); + if (glyphs.size() == 0) + return; + + for(int i = 0; i < glyphs.size(); i++) { + QImage img = fontEngine->alphaMapForGlyph(glyphs[i]); + glyph_metrics_t metrics = fontEngine->boundingBox(glyphs[i]); + alphaPenBlt(img.bits(), img.bytesPerLine(), img.depth(), + qRound(positions[i].x + metrics.x), + qRound(positions[i].y + metrics.y), + img.width(), img.height()); + } + return; + } +#endif //Q_WS_QPA + +#if (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE) + +#if defined(Q_WS_QWS) && !defined(QT_NO_QWS_QPF2) if (fontEngine->type() == QFontEngine::QPF2) { QFontEngine *renderingEngine = static_cast(fontEngine)->renderingEngine(); if (renderingEngine) diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 6e02435..fdb84e0 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -916,7 +916,7 @@ const char *QPdf::paperSizeToString(QPrinter::PaperSize paperSize) } -QByteArray QPdf::stripSpecialCharacters(const QByteArray &string) +Q_GUI_EXPORT QByteArray QPdf::stripSpecialCharacters(const QByteArray &string) { QByteArray s = string; s.replace(' ', ""); diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h index fd1a2dd..2cc41e1 100644 --- a/src/gui/text/qfont.h +++ b/src/gui/text/qfont.h @@ -46,7 +46,7 @@ #include #include -#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_QPA) +#if defined(Q_WS_X11) || defined(Q_WS_QWS) typedef struct FT_FaceRec_* FT_Face; #endif @@ -236,7 +236,7 @@ public: #ifdef Q_WS_MAC quint32 macFontID() const; #endif -#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_QPA) +#if defined(Q_WS_X11) || defined(Q_WS_QWS) FT_Face freetypeFace() const; #endif diff --git a/src/gui/text/qfont_qpa.cpp b/src/gui/text/qfont_qpa.cpp new file mode 100644 index 0000000..5fed18b --- /dev/null +++ b/src/gui/text/qfont_qpa.cpp @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +QT_BEGIN_NAMESPACE + +void QFont::initialize() +{ + QApplicationPrivate::platformIntegration()->fontDatabase()->populateFontDatabase(); +} + +void QFont::cleanup() +{ + QFontCache::cleanup(); +} + + +/***************************************************************************** + QFont member functions + *****************************************************************************/ + +Qt::HANDLE QFont::handle() const +{ + return 0; +} + +QString QFont::rawName() const +{ + return QLatin1String("unknown"); +} + +void QFont::setRawName(const QString &) +{ +} + +QString QFont::defaultFamily() const +{ + QString familyName; + switch(d->request.styleHint) { + case QFont::Times: + familyName = QString::fromLatin1("times"); + case QFont::Courier: + case QFont::Monospace: + familyName = QString::fromLatin1("monospace"); + case QFont::Decorative: + familyName = QString::fromLatin1("old english"); + case QFont::Helvetica: + case QFont::System: + default: + familyName = QString::fromLatin1("helvetica"); + } + + QStringList list = QApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(familyName,QFont::StyleNormal,QUnicodeTables::Common); + if (list.size()) { + familyName = list.at(0); + } + return familyName; +} + +QString QFont::lastResortFamily() const +{ + return QString::fromLatin1("helvetica"); +} + +QString QFont::lastResortFont() const +{ + qFatal("QFont::lastResortFont: Cannot find any reasonable font"); + // Shut compiler up + return QString(); +} + + +QT_END_NAMESPACE + diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 7ece6ea..72ffb1c 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -50,13 +50,19 @@ #include "private/qunicodetables_p.h" #include "qfontengine_p.h" +#ifdef Q_WS_QPA +#include +#include +#include "qabstractfileengine.h" +#endif + #ifdef Q_WS_X11 #include #endif #include #include -#if (defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE) +#if (defined(Q_WS_QWS)|| defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE) # include # include FT_TRUETYPE_TABLES_H #endif @@ -143,7 +149,7 @@ struct QtFontEncoding uchar pitch : 8; }; -struct QtFontSize +struct QtFontSize { #ifdef Q_WS_X11 QtFontEncoding *encodings; @@ -152,10 +158,13 @@ struct QtFontSize unsigned short count : 16; #endif // Q_WS_X11 -#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) QByteArray fileName; int fileIndex; #endif // defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_QPA) + void *handle; +#endif unsigned short pixelSize : 16; }; @@ -238,9 +247,15 @@ struct QtFontStyle #ifdef Q_WS_X11 free(pixelSizes[count].encodings); #endif -#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) pixelSizes[count].fileName.~QByteArray(); #endif +#if defined (Q_WS_QPA) + QPlatformIntegration *integration = QApplicationPrivate::platformIntegration(); + if (integration) { //on shut down there will be some that we don't release. + integration->fontDatabase()->releaseHandle(pixelSizes[count].handle); + } +#endif } #endif free(pixelSizes); @@ -302,10 +317,13 @@ QtFontSize *QtFontStyle::pixelSize(unsigned short size, bool add) pixelSizes[count].count = 0; pixelSizes[count].encodings = 0; #endif -#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) new (&pixelSizes[count].fileName) QByteArray; pixelSizes[count].fileIndex = 0; #endif +#if defined(Q_WS_QPA) + pixelSizes[count].handle = 0; +#endif return pixelSizes + (count++); } @@ -362,7 +380,7 @@ QtFontStyle *QtFontFoundry::style(const QtFontStyle::Key &key, bool create) } -struct QtFontFamily +struct QtFontFamily { enum WritingSystemStatus { Unknown = 0, @@ -391,6 +409,9 @@ struct QtFontFamily #if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) , bogusWritingSystems(false) #endif +#if defined(Q_WS_QPA) + , askedForFallback(false) +#endif { memset(writingSystems, 0, sizeof(writingSystems)); } @@ -432,6 +453,9 @@ struct QtFontFamily bool bogusWritingSystems; QStringList fallbackFamilies; #endif +#if defined (Q_WS_QPA) + bool askedForFallback; +#endif unsigned char writingSystems[QFontDatabase::WritingSystemsCount]; QtFontFoundry *foundry(const QString &f, bool = false); @@ -475,7 +499,7 @@ QtFontFoundry *QtFontFamily::foundry(const QString &f, bool create) // ### copied to tools/makeqpf/qpf2.cpp -#if ((defined(Q_WS_QWS) || defined(Q_WS_QPA)) && !defined(QT_NO_FREETYPE)) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) || (defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)) +#if (defined(Q_WS_QWS) && !defined(QT_NO_FREETYPE)) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) || (defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)) // see the Unicode subset bitfields in the MSDN docs static int requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2] = { @@ -617,7 +641,7 @@ class QFontDatabasePrivate public: QFontDatabasePrivate() : count(0), families(0), reregisterAppFonts(false) -#if defined(Q_WS_QWS) || defined(Q_WS_QPA) +#if defined(Q_WS_QWS) , stream(0) #endif #if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) @@ -665,11 +689,11 @@ public: void invalidate(); -#if defined(Q_WS_QWS) || defined(Q_WS_QPA) +#if defined(Q_WS_QWS) bool loadFromCache(const QString &fontPath); void addQPF2File(const QByteArray &file); #endif // Q_WS_QWS -#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) +#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) void addFont(const QString &familyname, const char *foundryname, int weight, bool italic, int pixelSize, const QByteArray &file, int fileIndex, bool antialiased, @@ -678,12 +702,14 @@ public: QStringList addTTFile(const QByteArray &file, const QByteArray &fontData = QByteArray()); #endif // QT_NO_FREETYPE #endif -#if defined(Q_WS_QWS) || defined (Q_WS_QPA) +#if defined(Q_WS_QWS) QDataStream *stream; - QStringList fallbackFamilies; #elif defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) const QSymbianFontDatabaseExtras *symbianExtras; #endif +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) + QStringList fallbackFamilies; +#endif }; void QFontDatabasePrivate::invalidate() @@ -732,7 +758,7 @@ QtFontFamily *QFontDatabasePrivate::family(const QString &f, bool create) return families[pos]; } -#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) +#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) void QFontDatabasePrivate::addFont(const QString &familyname, const char *foundryname, int weight, bool italic, int pixelSize, const QByteArray &file, int fileIndex, bool antialiased, const QList &writingSystems) @@ -763,7 +789,7 @@ void QFontDatabasePrivate::addFont(const QString &familyname, const char *foundr size->fileName = file; size->fileIndex = fileIndex; -#if defined(Q_WS_QWS) || defined(Q_WS_QPA) +#if defined(Q_WS_QWS) if (stream) { *stream << familyname << foundry->name << weight << quint8(italic) << pixelSize << file << fileIndex << quint8(antialiased); @@ -778,7 +804,7 @@ void QFontDatabasePrivate::addFont(const QString &familyname, const char *foundr } #endif -#if (defined(Q_WS_QWS) || defined (Q_WS_QPA) || defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE) +#if (defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE) QStringList QFontDatabasePrivate::addTTFile(const QByteArray &file, const QByteArray &fontData) { QStringList families; @@ -891,7 +917,7 @@ static const int scriptForWritingSystem[] = { }; -#if defined Q_WS_QWS || defined(Q_WS_QPA) || (defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG)) || defined(Q_WS_WIN) +#if defined Q_WS_QWS || (defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG)) || defined(Q_WS_WIN) static inline bool requiresOpenType(int writingSystem) { return ((writingSystem >= QFontDatabase::Syriac && writingSystem <= QFontDatabase::Sinhala) @@ -994,7 +1020,7 @@ static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDe #endif #endif -#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) || defined(Q_WS_QPA) static void getEngineData(const QFontPrivate *d, const QFontCache::Key &key) { // look for the requested font in the engine data cache @@ -1053,8 +1079,10 @@ QT_BEGIN_INCLUDE_NAMESPACE # include "qfontdatabase_mac.cpp" #elif defined(Q_WS_WIN) # include "qfontdatabase_win.cpp" -#elif defined(Q_WS_QWS) || defined(Q_WS_QPA) +#elif defined(Q_WS_QWS) # include "qfontdatabase_qws.cpp" +#elif defined(Q_WS_QPA) +# include "qfontdatabase_qpa.cpp" #elif defined(Q_OS_SYMBIAN) # include "qfontdatabase_s60.cpp" #endif @@ -1340,6 +1368,7 @@ static void match(int script, const QFontDef &request, styleKey.stretch = request.stretch; char pitch = request.ignorePitch ? '*' : request.fixedPitch ? 'm' : 'p'; + FM_DEBUG("QFontDatabase::match\n" " request:\n" " family: %s [%s], script: %d\n" @@ -2485,7 +2514,7 @@ void QFontDatabase::createDatabase() { initializeDb(); } // used from qfontengine_ft.cpp -QByteArray qt_fontdata_from_index(int index) +Q_GUI_EXPORT QByteArray qt_fontdata_from_index(int index) { QMutexLocker locker(fontDatabaseMutex()); return privateDb()->applicationFonts.value(index).data; diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h index 6a09b77..f31c19c 100644 --- a/src/gui/text/qfontdatabase.h +++ b/src/gui/text/qfontdatabase.h @@ -167,6 +167,7 @@ private: friend class QFontEngineMultiXLFD; friend class QFontEngineMultiQWS; friend class QFontEngineMultiS60; + friend class QFontEngineMultiQPA; QFontDatabasePrivate *d; }; diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp new file mode 100644 index 0000000..53594aa --- /dev/null +++ b/src/gui/text/qfontdatabase_qpa.cpp @@ -0,0 +1,392 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qlibraryinfo.h" +#include + +#include "qfontengine_qpa_p.h" +#include "qplatformdefs.h" + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +Q_GUI_EXPORT void qt_registerFont(const QString &familyName, const QString &foundryname, int weight, + QFont::Style style, int stretch, bool antialiased, bool scalable, int pixelSize, + const QSupportedWritingSystems &writingSystems, void *handle) +{ + QFontDatabasePrivate *d = privateDb(); + // qDebug() << "Adding font" << familyname << weight << italic << pixelSize << file << fileIndex << antialiased; + QtFontStyle::Key styleKey; + styleKey.style = style; + styleKey.weight = weight; + styleKey.stretch = stretch; + QtFontFamily *f = d->family(familyName, true); + + for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) { + if (writingSystems.supported(QFontDatabase::WritingSystem(i))) { + f->writingSystems[i] = QtFontFamily::Supported; + } else { + f->writingSystems[i] = QtFontFamily::Unsupported; + } + } + + QtFontFoundry *foundry = f->foundry(foundryname, true); + QtFontStyle *fontStyle = foundry->style(styleKey, true); + fontStyle->smoothScalable = scalable; + fontStyle->antialiased = antialiased; + QtFontSize *size = fontStyle->pixelSize(pixelSize?pixelSize:SMOOTH_SCALABLE, true); + size->handle = handle; +} + +static QStringList fallbackFamilies(const QString &family, const QFont::Style &style, const QUnicodeTables::Script &script) +{ + QStringList retList = QApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,script); + QFontDatabasePrivate *db = privateDb(); + + QStringList::iterator i; + for (i = retList.begin(); i != retList.end(); ++i) { + bool contains = false; + for (int j = 0; j < db->count; j++) { + QtFontFamily *qtFamily = db->families[j]; + if (!(i->compare(qtFamily->name,Qt::CaseInsensitive))) { + contains = true; + break; + } + } + if (!contains) { + i = retList.erase(i); + i--; + } + } + return retList; +} + +static void initializeDb() +{ + static int initialized = false; + + if (!initialized) { + //init by asking for the platformfontdb for the first time :) + QApplicationPrivate::platformIntegration()->fontDatabase()->populateFontDatabase(); + initialized = true; + } +} + +#ifndef QT_NO_SETTINGS +// called from qapplication_qws.cpp +void qt_applyFontDatabaseSettings(const QSettings &settings) +{ + initializeDb(); + QFontDatabasePrivate *db = privateDb(); + for (int i = 0; i < db->count; ++i) { + QtFontFamily *family = db->families[i]; + if (settings.contains(family->name)) + family->fallbackFamilies = settings.value(family->name).toStringList(); + } + + if (settings.contains(QLatin1String("Global Fallbacks"))) + db->fallbackFamilies = settings.value(QLatin1String("Global Fallbacks")).toStringList(); +} +#endif // QT_NO_SETTINGS + +static inline void load(const QString & = QString(), int = -1) +{ + initializeDb(); +} + +static +QFontEngine *loadSingleEngine(int script, + const QFontDef &request, + QtFontFoundry *foundry, + QtFontStyle *style, QtFontSize *size) +{ + Q_UNUSED(foundry); + + Q_ASSERT(size); + int pixelSize = size->pixelSize; + if (!pixelSize || (style->smoothScalable && pixelSize == SMOOTH_SCALABLE)) + pixelSize = request.pixelSize; + + QFontDef def = request; + def.pixelSize = pixelSize; + + QFontCache::Key key(def,script); + QFontEngine *engine = QFontCache::instance()->findEngine(key); + if (!engine) { + QPlatformFontDatabase *pfdb = QApplicationPrivate::platformIntegration()->fontDatabase(); + if (size->handle) { + engine = pfdb->fontEngine(def,QUnicodeTables::Script(script),size->handle); + if (engine) { + QFontCache::Key key(def,script); + QFontCache::instance()->instance()->insertEngine(key,engine); + } + } + + } + return engine; +} + +static +QFontEngine *loadEngine(int script, const QFontDef &request, + QtFontFamily *family, QtFontFoundry *foundry, + QtFontStyle *style, QtFontSize *size) +{ + + QFontEngine *engine = loadSingleEngine(script, request, foundry, style, size); + //make sure that the db has all fallback families + if (engine + && !(request.styleStrategy & QFont::NoFontMerging) && !engine->symbol ) { + + if (family && !family->askedForFallback) { + family->fallbackFamilies = fallbackFamilies(family->name,QFont::Style(style->key.style),QUnicodeTables::Script(script)); + + family->askedForFallback = true; + } + + QStringList fallbacks = privateDb()->fallbackFamilies; + if (family && !family->fallbackFamilies.isEmpty()) + fallbacks = family->fallbackFamilies; + + engine = new QFontEngineMultiQPA(engine, script, fallbacks); + } + + return engine; +} + +static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt) +{ + QFontDatabasePrivate *db = privateDb(); + + QApplicationPrivate::platformIntegration()->fontDatabase()->addApplicationFont(fnt->data,fnt->fileName); + db->reregisterAppFonts = true; +} + +bool QFontDatabase::removeApplicationFont(int handle) +{ + QMutexLocker locker(fontDatabaseMutex()); + + QFontDatabasePrivate *db = privateDb(); + if (handle < 0 || handle >= db->applicationFonts.count()) + return false; + + db->applicationFonts[handle] = QFontDatabasePrivate::ApplicationFont(); + + db->reregisterAppFonts = true; + db->invalidate(); + return true; +} + +bool QFontDatabase::removeAllApplicationFonts() +{ + QMutexLocker locker(fontDatabaseMutex()); + + QFontDatabasePrivate *db = privateDb(); + if (db->applicationFonts.isEmpty()) + return false; + + db->applicationFonts.clear(); + db->invalidate(); + return true; +} + +bool QFontDatabase::supportsThreadedFontRendering() +{ + return true; +} + +/*! + \internal +*/ +QFontEngine * +QFontDatabase::findFont(int script, const QFontPrivate *fp, + const QFontDef &request) +{ + QMutexLocker locker(fontDatabaseMutex()); + + const int force_encoding_id = -1; + + if (!privateDb()->count) + initializeDb(); + + QFontEngine *engine; + QFontCache::Key key(request, script); + engine = QFontCache::instance()->findEngine(key); + if (engine) { + qDebug() << "Cache hit level 1"; + return engine; + } + + QString family_name, foundry_name; + + parseFontName(request.family, foundry_name, family_name); + + if (qt_enable_test_font && request.family == QLatin1String("__Qt__Box__Engine__")) { + engine =new QTestFontEngine(request.pixelSize); + engine->fontDef = request; + } + + QtFontDesc desc; + match(script, request, family_name, foundry_name, force_encoding_id, &desc); + if (desc.family != 0 && desc.foundry != 0 && desc.style != 0) { + engine = loadEngine(script, request, desc.family, desc.foundry, desc.style, desc.size); + } else { + FM_DEBUG(" NO MATCH FOUND\n"); + } + + if (engine) { + initFontDef(desc, request, &engine->fontDef); + + if (fp) { + QFontDef def = request; + if (def.family.isEmpty()) { + def.family = fp->request.family; + def.family = def.family.left(def.family.indexOf(QLatin1Char(','))); + } + } + } + + if (!engine) { + if (!request.family.isEmpty()) { + QStringList fallbacks = fallbackFamilies(request.family,QFont::Style(request.style),QUnicodeTables::Script(script)); + for (int i = 0; i < fallbacks.size(); i++) { + QFontDef def = request; + def.family = fallbacks.at(i); + QFontCache::Key key(def,script); + engine = QFontCache::instance()->findEngine(key); + if (!engine) { + QtFontDesc desc; + match(script, def, def.family, QLatin1String(""), 0, &desc); + if (desc.family == 0 && desc.foundry == 0 && desc.style == 0) { + continue; + } + engine = loadEngine(script, def, desc.family, desc.foundry, desc.style, desc.size); + if (engine) { + initFontDef(desc, def, &engine->fontDef); + break; + } + } + } + } + + if (!engine) + engine = new QFontEngineBox(request.pixelSize); + + FM_DEBUG("returning box engine"); + } + + if (fp && fp->dpi > 0) { + engine->fontDef.pointSize = qreal(double((engine->fontDef.pixelSize * 72) / fp->dpi)); + } else { + engine->fontDef.pointSize = request.pointSize; + } + + return engine; +} + +void QFontDatabase::load(const QFontPrivate *d, int script) +{ + QFontDef req = d->request; + + if (req.pixelSize == -1) { + req.pixelSize = floor(((req.pointSize * d->dpi) / 72) * 100 + 0.5) / 100; + req.pixelSize = qRound(req.pixelSize); + } + if (req.pointSize < 0) + req.pointSize = req.pixelSize*72.0/d->dpi; + if (req.weight == 0) + req.weight = QFont::Normal; + if (req.stretch == 0) + req.stretch = 100; + + QFontCache::Key key(req, script); + + if (!d->engineData) + getEngineData(d, key); + + // the cached engineData could have already loaded the engine we want + if (d->engineData->engines[script]) + return; + + QFontEngine *fe = QFontCache::instance()->findEngine(key); + + // list of families to try + QStringList family_list; + + if (!req.family.isEmpty()) { + family_list = familyList(req); + + // add the default family + QString defaultFamily = QApplication::font().family(); + if (! family_list.contains(defaultFamily)) + family_list << defaultFamily; + + } + + // null family means find the first font matching the specified script + family_list << QString(); + + QStringList::ConstIterator it = family_list.constBegin(), end = family_list.constEnd(); + for (; !fe && it != end; ++it) { + req.family = *it; + + fe = QFontDatabase::findFont(script, d, req); + if (fe && (fe->type()==QFontEngine::Box) && !req.family.isEmpty()) + fe = 0; + } + + if (fe->symbol || (d->request.styleStrategy & QFont::NoFontMerging)) { + for (int i = 0; i < QUnicodeTables::ScriptCount; ++i) { + if (!d->engineData->engines[i]) { + d->engineData->engines[i] = fe; + fe->ref.ref(); + } + } + } else { + d->engineData->engines[script] = fe; + fe->ref.ref(); + } +} + +QT_END_NAMESPACE diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index fdb86ce..1c705ae 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -481,7 +481,7 @@ static void collectSingleContour(qreal x0, qreal y0, uint *grid, int x, int y, i path->closeSubpath(); } -void qt_addBitmapToPath(qreal x0, qreal y0, const uchar *image_data, int bpl, int w, int h, QPainterPath *path) +Q_GUI_EXPORT void qt_addBitmapToPath(qreal x0, qreal y0, const uchar *image_data, int bpl, int w, int h, QPainterPath *path) { uint *grid = new uint[(w+1)*(h+1)]; // set up edges diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 2c4fbab..1ee7144 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -717,7 +717,7 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format) metrics = face->size->metrics; -#if defined(Q_WS_QWS) +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) /* TrueType fonts with embedded bitmaps may have a bitmap font specific ascent/descent in the EBLC table. There is no direct public API @@ -749,6 +749,11 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format) return true; } +void QFontEngineFT::setDefaultHintStyle(HintStyle style) +{ + default_hint_style = style; +} + QFontEngineFT::Glyph *QFontEngineFT::loadGlyphMetrics(QGlyphSet *set, uint glyph) const { Glyph *g = set->getGlyph(glyph); diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index 372ad0c..f40ce04 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -271,7 +271,7 @@ private: QGlyphSet *loadTransformedGlyphSet(const QTransform &matrix); bool loadGlyphs(QGlyphSet *gs, glyph_t *glyphs, int num_glyphs, GlyphFormat format = Format_Render); -#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) +#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) virtual void draw(QPaintEngine * /*p*/, qreal /*x*/, qreal /*y*/, const QTextItemInt & /*si*/) {} #endif @@ -282,6 +282,14 @@ private: virtual HB_Error getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints); + enum HintStyle { + HintNone, + HintLight, + HintMedium, + HintFull + }; + + void setDefaultHintStyle(HintStyle style); protected: void freeGlyphSets(); @@ -293,12 +301,6 @@ protected: QFreetypeFace *freetype; int default_load_flags; - enum HintStyle { - HintNone, - HintLight, - HintMedium, - HintFull - }; HintStyle default_hint_style; diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index fb4556b..897f76f 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -168,7 +168,7 @@ public: virtual void recalcAdvances(QGlyphLayout *, QTextEngine::ShaperFlags) const {} virtual void doKerning(QGlyphLayout *, QTextEngine::ShaperFlags) const; -#if !defined(Q_WS_X11) && !defined(Q_WS_WIN) && !defined(Q_WS_MAC) && !defined(Q_OS_SYMBIAN) +#if !defined(Q_WS_X11) && !defined(Q_WS_WIN) && !defined(Q_WS_MAC) && !defined(Q_OS_SYMBIAN) && !defined(Q_WS_QPA) virtual void draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &si) = 0; #endif virtual void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs, diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp new file mode 100644 index 0000000..910bbfe --- /dev/null +++ b/src/gui/text/qfontengine_qpa.cpp @@ -0,0 +1,650 @@ +#include "qfontengine_qpa_p.h" + +#include +#include +#include +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +//#define DEBUG_HEADER +//#define DEBUG_FONTENGINE + +static QFontEngineQPA::TagType tagTypes[QFontEngineQPA::NumTags] = { + QFontEngineQPA::StringType, // FontName + QFontEngineQPA::StringType, // FileName + QFontEngineQPA::UInt32Type, // FileIndex + QFontEngineQPA::UInt32Type, // FontRevision + QFontEngineQPA::StringType, // FreeText + QFontEngineQPA::FixedType, // Ascent + QFontEngineQPA::FixedType, // Descent + QFontEngineQPA::FixedType, // Leading + QFontEngineQPA::FixedType, // XHeight + QFontEngineQPA::FixedType, // AverageCharWidth + QFontEngineQPA::FixedType, // MaxCharWidth + QFontEngineQPA::FixedType, // LineThickness + QFontEngineQPA::FixedType, // MinLeftBearing + QFontEngineQPA::FixedType, // MinRightBearing + QFontEngineQPA::FixedType, // UnderlinePosition + QFontEngineQPA::UInt8Type, // GlyphFormat + QFontEngineQPA::UInt8Type, // PixelSize + QFontEngineQPA::UInt8Type, // Weight + QFontEngineQPA::UInt8Type, // Style + QFontEngineQPA::StringType, // EndOfHeader + QFontEngineQPA::BitFieldType// WritingSystems +}; + + +#if defined(DEBUG_HEADER) +# define DEBUG_VERIFY qDebug +#else +# define DEBUG_VERIFY if (0) qDebug +#endif + +#define READ_VERIFY(type, variable) \ + if (tagPtr + sizeof(type) > endPtr) { \ + DEBUG_VERIFY() << "read verify failed in line" << __LINE__; \ + return 0; \ + } \ + variable = qFromBigEndian(tagPtr); \ + DEBUG_VERIFY() << "read value" << variable << "of type " #type; \ + tagPtr += sizeof(type) + +template +T readValue(const uchar *&data) +{ + T value = qFromBigEndian(data); + data += sizeof(T); + return value; +} + +#define VERIFY(condition) \ + if (!(condition)) { \ + DEBUG_VERIFY() << "condition " #condition " failed in line" << __LINE__; \ + return 0; \ + } + +#define VERIFY_TAG(condition) \ + if (!(condition)) { \ + DEBUG_VERIFY() << "verifying tag condition " #condition " failed in line" << __LINE__ << "with tag" << tag; \ + return 0; \ + } + +static inline const uchar *verifyTag(const uchar *tagPtr, const uchar *endPtr) +{ + quint16 tag, length; + READ_VERIFY(quint16, tag); + READ_VERIFY(quint16, length); + if (tag == QFontEngineQPA::Tag_EndOfHeader) + return endPtr; + if (tag < QFontEngineQPA::NumTags) { + switch (tagTypes[tag]) { + case QFontEngineQPA::BitFieldType: + case QFontEngineQPA::StringType: + // can't do anything... + break; + case QFontEngineQPA::UInt32Type: + VERIFY_TAG(length == sizeof(quint32)); + break; + case QFontEngineQPA::FixedType: + VERIFY_TAG(length == sizeof(quint32)); + break; + case QFontEngineQPA::UInt8Type: + VERIFY_TAG(length == sizeof(quint8)); + break; + } +#if defined(DEBUG_HEADER) + if (length == 1) + qDebug() << "tag data" << hex << *tagPtr; + else if (length == 4) + qDebug() << "tag data" << hex << tagPtr[0] << tagPtr[1] << tagPtr[2] << tagPtr[3]; +#endif + } + return tagPtr + length; +} + +const QFontEngineQPA::Glyph *QFontEngineQPA::findGlyph(glyph_t g) const +{ + if (!g || g >= glyphMapEntries) + return 0; + const quint32 *gmapPtr = reinterpret_cast(fontData + glyphMapOffset); + quint32 glyphPos = qFromBigEndian(gmapPtr[g]); + if (glyphPos > glyphDataSize) { + if (glyphPos == 0xffffffff) + return 0; +#if defined(DEBUG_FONTENGINE) + qDebug() << "glyph" << g << "outside of glyphData, remapping font file"; +#endif + if (glyphPos > glyphDataSize) + return 0; + } + return reinterpret_cast(fontData + glyphDataOffset + glyphPos); +} + +bool QFontEngineQPA::verifyHeader(const uchar *data, int size) +{ + VERIFY(size >= int(sizeof(Header))); + const Header *header = reinterpret_cast(data); + if (header->magic[0] != 'Q' + || header->magic[1] != 'P' + || header->magic[2] != 'F' + || header->magic[3] != '2') + return false; + + VERIFY(header->majorVersion <= CurrentMajorVersion); + const quint16 dataSize = qFromBigEndian(header->dataSize); + VERIFY(size >= int(sizeof(Header)) + dataSize); + + const uchar *tagPtr = data + sizeof(Header); + const uchar *tagEndPtr = tagPtr + dataSize; + while (tagPtr < tagEndPtr - 3) { + tagPtr = verifyTag(tagPtr, tagEndPtr); + VERIFY(tagPtr); + } + + VERIFY(tagPtr <= tagEndPtr); + return true; +} + +QVariant QFontEngineQPA::extractHeaderField(const uchar *data, HeaderTag requestedTag) +{ + const Header *header = reinterpret_cast(data); + const uchar *tagPtr = data + sizeof(Header); + const uchar *endPtr = tagPtr + qFromBigEndian(header->dataSize); + while (tagPtr < endPtr - 3) { + quint16 tag = readValue(tagPtr); + quint16 length = readValue(tagPtr); + if (tag == requestedTag) { + switch (tagTypes[requestedTag]) { + case StringType: + return QVariant(QString::fromUtf8(reinterpret_cast(tagPtr), length)); + case UInt32Type: + return QVariant(readValue(tagPtr)); + case UInt8Type: + return QVariant(uint(*tagPtr)); + case FixedType: + return QVariant(QFixed::fromFixed(readValue(tagPtr)).toReal()); + case BitFieldType: + return QVariant(QByteArray(reinterpret_cast(tagPtr), length)); + } + return QVariant(); + } else if (tag == Tag_EndOfHeader) { + break; + } + tagPtr += length; + } + + return QVariant(); +} + + + +static inline unsigned int getChar(const QChar *str, int &i, const int len) +{ + unsigned int uc = str[i].unicode(); + if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) { + uint low = str[i+1].unicode(); + if (low >= 0xdc00 && low < 0xe000) { + uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000; + ++i; + } + } + return uc; +} + +QFontEngineQPA::QFontEngineQPA(const QFontDef &def, const QByteArray &data) + : fontData(reinterpret_cast(data.constData())), dataSize(data.size()) +{ + fontDef = def; + cache_cost = 100; + externalCMap = 0; + cmapOffset = 0; + cmapSize = 0; + glyphMapOffset = 0; + glyphMapEntries = 0; + glyphDataOffset = 0; + glyphDataSize = 0; + kerning_pairs_loaded = false; + readOnly = true; + +#if defined(DEBUG_FONTENGINE) + qDebug() << "QFontEngineQPA::QFontEngineQPA( fd =" << fd << ", renderingFontEngine =" << renderingFontEngine << ')'; +#endif + + if (!verifyHeader(fontData, dataSize)) { +#if defined(DEBUG_FONTENGINE) + qDebug() << "verifyHeader failed!"; +#endif + return; + } + + const Header *header = reinterpret_cast(fontData); + + readOnly = (header->lock == 0xffffffff); + + const uchar *imgData = fontData + sizeof(Header) + qFromBigEndian(header->dataSize); + const uchar *endPtr = fontData + dataSize; + while (imgData <= endPtr - 8) { + quint16 blockTag = readValue(imgData); + imgData += 2; // skip padding + quint32 blockSize = readValue(imgData); + + if (blockTag == CMapBlock) { + cmapOffset = imgData - fontData; + cmapSize = blockSize; + } else if (blockTag == GMapBlock) { + glyphMapOffset = imgData - fontData; + glyphMapEntries = blockSize / 4; + } else if (blockTag == GlyphBlock) { + glyphDataOffset = imgData - fontData; + glyphDataSize = blockSize; + } + + imgData += blockSize; + } + + face_id.filename = QFile::encodeName(extractHeaderField(fontData, Tag_FileName).toString()); + face_id.index = extractHeaderField(fontData, Tag_FileIndex).toInt(); + + // get the real cmap + if (cmapOffset) { + int tableSize = cmapSize; + const uchar *cmapPtr = getCMap(fontData + cmapOffset, tableSize, &symbol, &cmapSize); + if (cmapPtr) + cmapOffset = cmapPtr - fontData; + else + cmapOffset = 0; + } else if (externalCMap) { + int tableSize = cmapSize; + externalCMap = getCMap(externalCMap, tableSize, &symbol, &cmapSize); + } + + // verify all the positions in the glyphMap + if (glyphMapOffset) { + const quint32 *gmapPtr = reinterpret_cast(fontData + glyphMapOffset); + for (uint i = 0; i < glyphMapEntries; ++i) { + quint32 glyphDataPos = qFromBigEndian(gmapPtr[i]); + if (glyphDataPos == 0xffffffff) + continue; + if (glyphDataPos >= glyphDataSize) { + // error + glyphMapOffset = 0; + glyphMapEntries = 0; + break; + } + } + } + +#if defined(DEBUG_FONTENGINE) + if (!isValid()) + qDebug() << "fontData" << fontData << "dataSize" << dataSize + << "externalCMap" << externalCMap << "cmapOffset" << cmapOffset + << "glyphMapOffset" << glyphMapOffset << "glyphDataOffset" << glyphDataOffset + << "fd" << fd << "glyphDataSize" << glyphDataSize; +#endif +} + +QFontEngineQPA::~QFontEngineQPA() +{ +} + +bool QFontEngineQPA::getSfntTableData(uint tag, uchar *buffer, uint *length) const +{ + Q_UNUSED(tag); + Q_UNUSED(buffer); + *length = 0; + return false; +} + +bool QFontEngineQPA::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const +{ + if (*nglyphs < len) { + *nglyphs = len; + return false; + } + +#if defined(DEBUG_FONTENGINE) + QSet seenGlyphs; +#endif + + const uchar *cmap = externalCMap ? externalCMap : (fontData + cmapOffset); + + bool mirrored = flags & QTextEngine::RightToLeft; + int glyph_pos = 0; + if (symbol) { + for (int i = 0; i < len; ++i) { + unsigned int uc = getChar(str, i, len); + if (mirrored) + uc = QChar::mirroredChar(uc); + glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc); + if(!glyphs->glyphs[glyph_pos] && uc < 0x100) + glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc + 0xf000); + ++glyph_pos; + } + } else { + for (int i = 0; i < len; ++i) { + unsigned int uc = getChar(str, i, len); + if (mirrored) + uc = QChar::mirroredChar(uc); + glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc); +#if 0 && defined(DEBUG_FONTENGINE) + QChar c(uc); + if (!findGlyph(glyphs[glyph_pos].glyph) && !seenGlyphs.contains(c)) + qDebug() << "glyph for character" << c << '/' << hex << uc << "is" << dec << glyphs[glyph_pos].glyph; + + seenGlyphs.insert(c); +#endif + ++glyph_pos; + } + } + + *nglyphs = glyph_pos; + glyphs->numGlyphs = glyph_pos; + recalcAdvances(glyphs, flags); + return true; +} + +void QFontEngineQPA::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags) const +{ + for (int i = 0; i < glyphs->numGlyphs; ++i) { + const Glyph *g = findGlyph(glyphs->glyphs[i]); + if (!g) { + glyphs->glyphs[i] = 0; + continue; + } + glyphs->advances_x[i] = g->advance; + glyphs->advances_y[i] = 0; + } +} + +QImage QFontEngineQPA::alphaMapForGlyph(glyph_t g) +{ + const Glyph *glyph = findGlyph(g); + if (!glyph) + return QImage(); + + const uchar *bits = ((const uchar *) glyph) + sizeof(Glyph); + + QImage image(bits,glyph->width, glyph->height, glyph->bytesPerLine, QImage::Format_Indexed8); + + return image; +} + +void QFontEngineQPA::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) +{ + addBitmapFontToPath(x, y, glyphs, path, flags); +} + +glyph_metrics_t QFontEngineQPA::boundingBox(const QGlyphLayout &glyphs) +{ + glyph_metrics_t overall; + // initialize with line height, we get the same behaviour on all platforms + overall.y = -ascent(); + overall.height = ascent() + descent() + 1; + + QFixed ymax = 0; + QFixed xmax = 0; + for (int i = 0; i < glyphs.numGlyphs; i++) { + const Glyph *g = findGlyph(glyphs.glyphs[i]); + if (!g) + continue; + + QFixed x = overall.xoff + glyphs.offsets[i].x + g->x; + QFixed y = overall.yoff + glyphs.offsets[i].y + g->y; + overall.x = qMin(overall.x, x); + overall.y = qMin(overall.y, y); + xmax = qMax(xmax, x + g->width); + ymax = qMax(ymax, y + g->height); + overall.xoff += g->advance; + } + overall.height = qMax(overall.height, ymax - overall.y); + overall.width = xmax - overall.x; + + return overall; +} + +glyph_metrics_t QFontEngineQPA::boundingBox(glyph_t glyph) +{ + glyph_metrics_t overall; + const Glyph *g = findGlyph(glyph); + if (!g) + return overall; + overall.x = g->x; + overall.y = g->y; + overall.width = g->width; + overall.height = g->height; + overall.xoff = g->advance; + return overall; +} + +QFixed QFontEngineQPA::ascent() const +{ + return QFixed::fromReal(extractHeaderField(fontData, Tag_Ascent).value()); +} + +QFixed QFontEngineQPA::descent() const +{ + return QFixed::fromReal(extractHeaderField(fontData, Tag_Descent).value()); +} + +QFixed QFontEngineQPA::leading() const +{ + return QFixed::fromReal(extractHeaderField(fontData, Tag_Leading).value()); +} + +qreal QFontEngineQPA::maxCharWidth() const +{ + return extractHeaderField(fontData, Tag_MaxCharWidth).value(); +} + +qreal QFontEngineQPA::minLeftBearing() const +{ + return extractHeaderField(fontData, Tag_MinLeftBearing).value(); +} + +qreal QFontEngineQPA::minRightBearing() const +{ + return extractHeaderField(fontData, Tag_MinRightBearing).value(); +} + +QFixed QFontEngineQPA::underlinePosition() const +{ + return QFixed::fromReal(extractHeaderField(fontData, Tag_UnderlinePosition).value()); +} + +QFixed QFontEngineQPA::lineThickness() const +{ + return QFixed::fromReal(extractHeaderField(fontData, Tag_LineThickness).value()); +} + +QFontEngine::Type QFontEngineQPA::type() const +{ + return QFontEngine::QPF2; +} + +bool QFontEngineQPA::canRender(const QChar *string, int len) +{ + const uchar *cmap = externalCMap ? externalCMap : (fontData + cmapOffset); + + if (symbol) { + for (int i = 0; i < len; ++i) { + unsigned int uc = getChar(string, i, len); + glyph_t g = getTrueTypeGlyphIndex(cmap, uc); + if(!g && uc < 0x100) + g = getTrueTypeGlyphIndex(cmap, uc + 0xf000); + if (!g) + return false; + } + } else { + for (int i = 0; i < len; ++i) { + unsigned int uc = getChar(string, i, len); + if (!getTrueTypeGlyphIndex(cmap, uc)) + return false; + } + } + return true; +} + +bool QFontEngineQPA::isValid() const +{ + return fontData && dataSize && (cmapOffset || externalCMap) + && glyphMapOffset && glyphDataOffset && glyphDataSize > 0; +} + +void QPAGenerator::generate() +{ + writeHeader(); + writeGMap(); + writeBlock(QFontEngineQPA::GlyphBlock, QByteArray()); + + dev->seek(4); // position of header.lock + writeUInt32(0); +} + +void QPAGenerator::writeHeader() +{ + QFontEngineQPA::Header header; + + header.magic[0] = 'Q'; + header.magic[1] = 'P'; + header.magic[2] = 'F'; + header.magic[3] = '2'; + header.lock = 1; + header.majorVersion = QFontEngineQPA::CurrentMajorVersion; + header.minorVersion = QFontEngineQPA::CurrentMinorVersion; + header.dataSize = 0; + dev->write((const char *)&header, sizeof(header)); + + writeTaggedString(QFontEngineQPA::Tag_FontName, fe->fontDef.family.toUtf8()); + + QFontEngine::FaceId face = fe->faceId(); + writeTaggedString(QFontEngineQPA::Tag_FileName, face.filename); + writeTaggedUInt32(QFontEngineQPA::Tag_FileIndex, face.index); + + { + uchar data[4]; + uint len = 4; + bool ok = fe->getSfntTableData(MAKE_TAG('h', 'e', 'a', 'd'), data, &len); + if (ok) { + const quint32 revision = qFromBigEndian(data); + writeTaggedUInt32(QFontEngineQPA::Tag_FontRevision, revision); + } + } + + writeTaggedQFixed(QFontEngineQPA::Tag_Ascent, fe->ascent()); + writeTaggedQFixed(QFontEngineQPA::Tag_Descent, fe->descent()); + writeTaggedQFixed(QFontEngineQPA::Tag_Leading, fe->leading()); + writeTaggedQFixed(QFontEngineQPA::Tag_XHeight, fe->xHeight()); + writeTaggedQFixed(QFontEngineQPA::Tag_AverageCharWidth, fe->averageCharWidth()); + writeTaggedQFixed(QFontEngineQPA::Tag_MaxCharWidth, QFixed::fromReal(fe->maxCharWidth())); + writeTaggedQFixed(QFontEngineQPA::Tag_LineThickness, fe->lineThickness()); + writeTaggedQFixed(QFontEngineQPA::Tag_MinLeftBearing, QFixed::fromReal(fe->minLeftBearing())); + writeTaggedQFixed(QFontEngineQPA::Tag_MinRightBearing, QFixed::fromReal(fe->minRightBearing())); + writeTaggedQFixed(QFontEngineQPA::Tag_UnderlinePosition, fe->underlinePosition()); + writeTaggedUInt8(QFontEngineQPA::Tag_PixelSize, fe->fontDef.pixelSize); + writeTaggedUInt8(QFontEngineQPA::Tag_Weight, fe->fontDef.weight); + writeTaggedUInt8(QFontEngineQPA::Tag_Style, fe->fontDef.style); + + writeTaggedUInt8(QFontEngineQPA::Tag_GlyphFormat, QFontEngineQPA::AlphamapGlyphs); + + writeTaggedString(QFontEngineQPA::Tag_EndOfHeader, QByteArray()); + align4(); + + const quint64 size = dev->pos(); + header.dataSize = qToBigEndian(size - sizeof(header)); + dev->seek(0); + dev->write((const char *)&header, sizeof(header)); + dev->seek(size); +} + +void QPAGenerator::writeGMap() +{ + const quint16 glyphCount = fe->glyphCount(); + + writeUInt16(QFontEngineQPA::GMapBlock); + writeUInt16(0); // padding + writeUInt32(glyphCount * 4); + + QByteArray &buffer = dev->buffer(); + const int numBytes = glyphCount * sizeof(quint32); + qint64 pos = buffer.size(); + buffer.resize(pos + numBytes); + qMemSet(buffer.data() + pos, 0xff, numBytes); + dev->seek(pos + numBytes); +} + +void QPAGenerator::writeBlock(QFontEngineQPA::BlockTag tag, const QByteArray &data) +{ + writeUInt16(tag); + writeUInt16(0); // padding + const int padSize = ((data.size() + 3) / 4) * 4 - data.size(); + writeUInt32(data.size() + padSize); + dev->write(data); + for (int i = 0; i < padSize; ++i) + writeUInt8(0); +} + +void QPAGenerator::writeTaggedString(QFontEngineQPA::HeaderTag tag, const QByteArray &string) +{ + writeUInt16(tag); + writeUInt16(string.length()); + dev->write(string); +} + +void QPAGenerator::writeTaggedUInt32(QFontEngineQPA::HeaderTag tag, quint32 value) +{ + writeUInt16(tag); + writeUInt16(sizeof(value)); + writeUInt32(value); +} + +void QPAGenerator::writeTaggedUInt8(QFontEngineQPA::HeaderTag tag, quint8 value) +{ + writeUInt16(tag); + writeUInt16(sizeof(value)); + writeUInt8(value); +} + +void QPAGenerator::writeTaggedQFixed(QFontEngineQPA::HeaderTag tag, QFixed value) +{ + writeUInt16(tag); + writeUInt16(sizeof(quint32)); + writeUInt32(value.value()); +} + + +/* + Creates a new multi QPA engine. + + This function takes ownership of the QFontEngine, increasing it's refcount. +*/ +QFontEngineMultiQPA::QFontEngineMultiQPA(QFontEngine *fe, int _script, const QStringList &fallbacks) + : QFontEngineMulti(fallbacks.size() + 1), + fallbackFamilies(fallbacks), script(_script) +{ + engines[0] = fe; + fe->ref.ref(); + fontDef = engines[0]->fontDef; +} + +void QFontEngineMultiQPA::loadEngine(int at) +{ + Q_ASSERT(at < engines.size()); + Q_ASSERT(engines.at(at) == 0); + + QFontDef request = fontDef; + request.styleStrategy |= QFont::NoFontMerging; + request.family = fallbackFamilies.at(at-1); + engines[at] = QFontDatabase::findFont(script, + /*fontprivate*/0, + request); + Q_ASSERT(engines[at]); + engines[at]->ref.ref(); + engines[at]->fontDef = request; +} + +QT_END_NAMESPACE diff --git a/src/gui/text/qfontengine_qpa_p.h b/src/gui/text/qfontengine_qpa_p.h new file mode 100644 index 0000000..467fca6 --- /dev/null +++ b/src/gui/text/qfontengine_qpa_p.h @@ -0,0 +1,262 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFONTENGINE_QPA_P_H +#define QFONTENGINE_QPA_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 +#include +#include +#include + +#include "qfontengine_p.h" + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QFontEngine; +class QFreetypeFace; +class QBuffer; + +class Q_GUI_EXPORT QFontEngineQPA : public QFontEngine +{ +public: + // if you add new tags please make sure to update the tables in + // qpfutil.cpp and tools/makeqpf/qpf2.cpp + enum HeaderTag { + Tag_FontName, // 0 string + Tag_FileName, // 1 string + Tag_FileIndex, // 2 quint32 + Tag_FontRevision, // 3 quint32 + Tag_FreeText, // 4 string + Tag_Ascent, // 5 QFixed + Tag_Descent, // 6 QFixed + Tag_Leading, // 7 QFixed + Tag_XHeight, // 8 QFixed + Tag_AverageCharWidth, // 9 QFixed + Tag_MaxCharWidth, // 10 QFixed + Tag_LineThickness, // 11 QFixed + Tag_MinLeftBearing, // 12 QFixed + Tag_MinRightBearing, // 13 QFixed + Tag_UnderlinePosition, // 14 QFixed + Tag_GlyphFormat, // 15 quint8 + Tag_PixelSize, // 16 quint8 + Tag_Weight, // 17 quint8 + Tag_Style, // 18 quint8 + Tag_EndOfHeader, // 19 string + Tag_WritingSystems, // 20 bitfield + + NumTags + }; + + enum TagType { + StringType, + FixedType, + UInt8Type, + UInt32Type, + BitFieldType + }; + + struct Tag + { + quint16 tag; + quint16 size; + }; + + enum GlyphFormat { + BitmapGlyphs = 1, + AlphamapGlyphs = 8 + }; + + enum { + CurrentMajorVersion = 2, + CurrentMinorVersion = 0 + }; + + // The CMap is identical to the TrueType CMap table format + // The GMap table is a normal array with the total number of + // covered glyphs in the TrueType font + enum BlockTag { + CMapBlock, + GMapBlock, + GlyphBlock + }; + + struct Q_PACKED Header + { + char magic[4]; // 'QPF2' + quint32 lock; // values: 0 = unlocked, 0xffffffff = read-only, otherwise qws client id of locking process + quint8 majorVersion; + quint8 minorVersion; + quint16 dataSize; + }; + + struct Q_PACKED Block + { + quint16 tag; + quint16 pad; + quint32 dataSize; + }; + + struct Q_PACKED Glyph + { + quint8 width; + quint8 height; + quint8 bytesPerLine; + qint8 x; + qint8 y; + qint8 advance; + }; + + QFontEngineQPA(const QFontDef &def, const QByteArray &data); + ~QFontEngineQPA(); + + FaceId faceId() const { return face_id; } + bool getSfntTableData(uint tag, uchar *buffer, uint *length) const; + + bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const; + void recalcAdvances(QGlyphLayout *, QTextEngine::ShaperFlags) const; + + void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags); + QImage alphaMapForGlyph(glyph_t t); + + glyph_metrics_t boundingBox(const QGlyphLayout &glyphs); + glyph_metrics_t boundingBox(glyph_t glyph); + + QFixed ascent() const; + QFixed descent() const; + QFixed leading() const; + qreal maxCharWidth() const; + qreal minLeftBearing() const; + qreal minRightBearing() const; + QFixed underlinePosition() const; + QFixed lineThickness() const; + + Type type() const; + + bool canRender(const QChar *string, int len); + inline const char *name() const { return "QPF2"; } + + virtual int glyphCount() const { return glyphMapEntries; } + + bool isValid() const; + + const Glyph *findGlyph(glyph_t g) const; + + static bool verifyHeader(const uchar *data, int size); + static QVariant extractHeaderField(const uchar *data, HeaderTag tag); + +private: + + const uchar *fontData; + int dataSize; + const uchar *externalCMap; + quint32 cmapOffset; + int cmapSize; + quint32 glyphMapOffset; + quint32 glyphMapEntries; + quint32 glyphDataOffset; + quint32 glyphDataSize; + QString internalFileName; + QString encodedFileName; + bool readOnly; + + FaceId face_id; + QByteArray freetypeCMapTable; + mutable bool kerning_pairs_loaded; +}; + +struct QPAGenerator +{ + QPAGenerator(QBuffer *device, QFontEngine *engine) + : dev(device), fe(engine) {} + + void generate(); + void writeHeader(); + void writeGMap(); + void writeBlock(QFontEngineQPA::BlockTag tag, const QByteArray &data); + + void writeTaggedString(QFontEngineQPA::HeaderTag tag, const QByteArray &string); + void writeTaggedUInt32(QFontEngineQPA::HeaderTag tag, quint32 value); + void writeTaggedUInt8(QFontEngineQPA::HeaderTag tag, quint8 value); + void writeTaggedQFixed(QFontEngineQPA::HeaderTag tag, QFixed value); + + void writeUInt16(quint16 value) { value = qToBigEndian(value); dev->write((const char *)&value, sizeof(value)); } + void writeUInt32(quint32 value) { value = qToBigEndian(value); dev->write((const char *)&value, sizeof(value)); } + void writeUInt8(quint8 value) { dev->write((const char *)&value, sizeof(value)); } + void writeInt8(qint8 value) { dev->write((const char *)&value, sizeof(value)); } + + void align4() { while (dev->pos() & 3) { dev->putChar('\0'); } } + + QBuffer *dev; + QFontEngine *fe; +}; + +class QFontEngineMultiQPA : public QFontEngineMulti +{ +public: + QFontEngineMultiQPA(QFontEngine *fe, int script, const QStringList &fallbacks); + + void loadEngine(int at); + +private: + QStringList fallbackFamilies; + int script; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QFONTENGINE_QPA_P_H diff --git a/src/gui/text/qplatformfontdatabase_qpa.cpp b/src/gui/text/qplatformfontdatabase_qpa.cpp new file mode 100644 index 0000000..7bb1f9a --- /dev/null +++ b/src/gui/text/qplatformfontdatabase_qpa.cpp @@ -0,0 +1,195 @@ +#include "qplatformfontdatabase_qpa.h" +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +extern void qt_registerFont(const QString &familyname, const QString &foundryname, int weight, + QFont::Style style, int stretch, bool antialiased,bool scalable, int pixelSize, + const QSupportedWritingSystems &writingSystems, void *hanlde); + +void QPlatformFontDatabase::registerQPF2Font(const QByteArray &dataArray, void *handle) +{ + if (dataArray.size() == 0) + return; + + const uchar *data = reinterpret_cast(dataArray.constData()); + if (QFontEngineQPA::verifyHeader(data, dataArray.size())) { + QString fontName = QFontEngineQPA::extractHeaderField(data, QFontEngineQPA::Tag_FontName).toString(); + int pixelSize = QFontEngineQPA::extractHeaderField(data, QFontEngineQPA::Tag_PixelSize).toInt(); + QVariant weight = QFontEngineQPA::extractHeaderField(data, QFontEngineQPA::Tag_Weight); + QVariant style = QFontEngineQPA::extractHeaderField(data, QFontEngineQPA::Tag_Style); + QByteArray writingSystemBits = QFontEngineQPA::extractHeaderField(data, QFontEngineQPA::Tag_WritingSystems).toByteArray(); + + if (!fontName.isEmpty() && pixelSize) { + int fontWeight = 50; + if (weight.type() == QVariant::Int || weight.type() == QVariant::UInt) + fontWeight = weight.toInt(); + + QFont::Style fontStyle = static_cast(style.toInt()); + + QSupportedWritingSystems writingSystems; + for (int i = 0; i < writingSystemBits.count(); ++i) { + uchar currentByte = writingSystemBits.at(i); + for (int j = 0; j < 8; ++j) { + if (currentByte & 1) + writingSystems.setSupported(QFontDatabase::WritingSystem(i * 8 + j)); + currentByte >>= 1; + } + } + + registerFont(fontName,QString(),fontWeight,fontStyle,100,true,false,pixelSize,writingSystems,handle); + } + } else { + qDebug() << "header verification of QPF2 font failed. maybe it is corrupt?"; + } +} + +void QPlatformFontDatabase::registerFont(const QString &familyname, const QString &foundryname, int weight, + QFont::Style style, int stretch, bool antialiased, bool scalable, int pixelSize, + const QSupportedWritingSystems &writingSystems, void *usrPtr) +{ + if (scalable) + pixelSize = 0; + qt_registerFont(familyname,foundryname,weight,style,stretch,antialiased,scalable,pixelSize,writingSystems,usrPtr); +} + +class QWritingSystemsPrivate +{ +public: + QWritingSystemsPrivate() + : ref(1) + , vector(QFontDatabase::WritingSystemsCount,false) + { + } + + QWritingSystemsPrivate(const QWritingSystemsPrivate *other) + : ref(1) + , vector(other->vector) + { + } + + QAtomicInt ref; + QVector vector; +}; + +QSupportedWritingSystems::QSupportedWritingSystems() +{ + d = new QWritingSystemsPrivate; +} + +QSupportedWritingSystems::QSupportedWritingSystems(const QSupportedWritingSystems &other) +{ + d = other.d; + d->ref.ref(); +} + +QSupportedWritingSystems &QSupportedWritingSystems::operator=(const QSupportedWritingSystems &other) +{ + if (d != other.d) { + other.d->ref.ref(); + if (!d->ref.deref()) + delete d; + d = other.d; + } + return *this; +} + +QSupportedWritingSystems::~QSupportedWritingSystems() +{ + if (!d->ref.deref()) + delete d; +} + +void QSupportedWritingSystems::detach() +{ + if (d->ref != 1) { + QWritingSystemsPrivate *newd = new QWritingSystemsPrivate(d); + if (!d->ref.deref()) + delete d; + d = newd; + } +} + +void QSupportedWritingSystems::setSupported(QFontDatabase::WritingSystem writingSystem, bool support) +{ + detach(); + d->vector[writingSystem] = support; +} + +bool QSupportedWritingSystems::supported(QFontDatabase::WritingSystem writingSystem) const +{ + return d->vector.at(writingSystem); +} + +void QPlatformFontDatabase::populateFontDatabase() +{ + QString fontpath = fontDir(); + + if(!QFile::exists(fontpath)) { + qFatal("QFontDatabase: Cannot find font directory %s - is Qt installed correctly?", + qPrintable(fontpath)); + } + + QDir dir(fontpath); + dir.setNameFilters(QStringList() << QLatin1String("*.qpf2")); + dir.refresh(); + for (int i = 0; i < int(dir.count()); ++i) { + const QByteArray fileName = QFile::encodeName(dir.absoluteFilePath(dir[i])); + QFile file(QString::fromLocal8Bit(fileName)); + if (file.open(QFile::ReadOnly)) { + const QByteArray fileData = file.readAll(); + QByteArray *fileDataPtr = new QByteArray(fileData); + registerQPF2Font(fileData, fileDataPtr); + } + } +} + +QFontEngine *QPlatformFontDatabase::fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *handle) +{ + Q_UNUSED(script); + Q_UNUSED(handle); + QByteArray *fileDataPtr = static_cast(handle); + QFontEngineQPA *engine = new QFontEngineQPA(fontDef,*fileDataPtr); + qDebug() << fontDef.pixelSize << fontDef.weight << fontDef.style << fontDef.stretch << fontDef.styleHint << fontDef.styleStrategy << fontDef.family << script; + return engine; +} + +QStringList QPlatformFontDatabase::fallbacksForFamily(const QString family, const QFont::Style &style, const QUnicodeTables::Script &script) const +{ + Q_UNUSED(family); + Q_UNUSED(style); + Q_UNUSED(script); + return QStringList(); +} + +void QPlatformFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName) +{ + Q_UNUSED(fontData); + Q_UNUSED(fileName); + + qWarning("This plugin does not support application fonts"); +} + +void QPlatformFontDatabase::releaseHandle(void *handle) +{ + QByteArray *fileDataPtr = static_cast(handle); + delete fileDataPtr; +} + +QString QPlatformFontDatabase::fontDir() const +{ + QString fontpath = QString::fromLocal8Bit(qgetenv("QT_QPA_FONTDIR")); + if (fontpath.isEmpty()) { +#ifndef QT_NO_SETTINGS + fontpath = QLibraryInfo::location(QLibraryInfo::LibrariesPath); + fontpath += QLatin1String("/fonts"); +#endif + } + + return fontpath; +} + +QT_END_NAMESPACE diff --git a/src/gui/text/qplatformfontdatabase_qpa.h b/src/gui/text/qplatformfontdatabase_qpa.h new file mode 100644 index 0000000..a34033f --- /dev/null +++ b/src/gui/text/qplatformfontdatabase_qpa.h @@ -0,0 +1,65 @@ +#ifndef QPLATFORMFONTDATABASE_QPA_H +#define QPLATFORMFONTDATABASE_QPA_H + +#include +#include +#include +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QWritingSystemsPrivate; + +class Q_GUI_EXPORT QSupportedWritingSystems +{ +public: + + QSupportedWritingSystems(); + QSupportedWritingSystems(const QSupportedWritingSystems &other); + QSupportedWritingSystems &operator=(const QSupportedWritingSystems &other); + ~QSupportedWritingSystems(); + + void setSupported(QFontDatabase::WritingSystem, bool supported = true); + bool supported(QFontDatabase::WritingSystem) const; + +private: + void detach(); + + QWritingSystemsPrivate *d; + + friend Q_GUI_EXPORT bool operator==(const QSupportedWritingSystems &, const QSupportedWritingSystems &); + friend Q_GUI_EXPORT bool operator!=(const QSupportedWritingSystems &, const QSupportedWritingSystems &); +}; + +Q_GUI_EXPORT bool operator==(const QSupportedWritingSystems &, const QSupportedWritingSystems &); +Q_GUI_EXPORT bool operator!=(const QSupportedWritingSystems &, const QSupportedWritingSystems &); + +class QFontRequestPrivate; + +class Q_GUI_EXPORT QPlatformFontDatabase +{ +public: + virtual void populateFontDatabase(); + virtual QFontEngine *fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *handle); + virtual QStringList fallbacksForFamily(const QString family, const QFont::Style &style, const QUnicodeTables::Script &script) const; + virtual void addApplicationFont(const QByteArray &fontData, const QString &fileName); + virtual void releaseHandle(void *handle); + + virtual QString fontDir() const; + + //callback + static void registerQPF2Font(const QByteArray &dataArray, void *handle); + static void registerFont(const QString &familyname, const QString &foundryname, int weight, + QFont::Style style, int stetch, bool antialiased, bool scalable, int pixelSize, + const QSupportedWritingSystems &writingSystems, void *handle); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPLATFORMFONTDATABASE_QPA_H diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri index 1040ad8..8721d80 100644 --- a/src/gui/text/text.pri +++ b/src/gui/text/text.pri @@ -25,7 +25,7 @@ HEADERS += \ text/qabstracttextdocumentlayout.h \ text/qtextdocumentlayout_p.h \ text/qtextcursor.h \ - text/qtextcursor_p.h \ + text/qtextcursor_p.h \ text/qtextdocumentfragment.h \ text/qtextdocumentfragment_p.h \ text/qtextimagehandler_p.h \ @@ -39,7 +39,7 @@ HEADERS += \ text/qzipwriter_p.h \ text/qtextodfwriter_p.h \ text/qstatictext_p.h \ - text/qstatictext.h + text/qstatictext.h SOURCES += \ text/qfont.cpp \ @@ -69,7 +69,7 @@ SOURCES += \ text/qcssparser.cpp \ text/qzip.cpp \ text/qtextodfwriter.cpp \ - text/qstatictext.cpp + text/qstatictext.cpp win32 { SOURCES += \ @@ -112,15 +112,15 @@ embedded { qpa { SOURCES += \ - text/qfont_qws.cpp \ - text/qfontengine_ft.cpp \ - text/qfontengine_qpf.cpp \ - text/qabstractfontengine_qws.cpp + text/qfont_qpa.cpp \ + text/qfontengine_qpa.cpp \ + text/qplatformfontdatabase_qpa.cpp + HEADERS += \ - text/qfontengine_ft_p.h \ - text/qabstractfontengine_qws.h \ - text/qabstractfontengine_p.h + text/qplatformfontdatabase_qpa.h + DEFINES += QT_NO_FONTCONFIG + DEFINES += QT_NO_FREETYPE } symbian { @@ -142,6 +142,7 @@ symbian { } } +!qpa { contains(QT_CONFIG, freetype) { SOURCES += \ ../3rdparty/freetype/src/base/ftbase.c \ @@ -215,6 +216,7 @@ contains(QT_CONFIG, freetype) { contains(QT_CONFIG, fontconfig) { CONFIG += opentype } +}#!qpa DEFINES += QT_NO_OPENTYPE INCLUDEPATH += ../3rdparty/harfbuzz/src diff --git a/src/plugins/platforms/directfb/directfb.pro b/src/plugins/platforms/directfb/directfb.pro index f81ec31..48128fb 100644 --- a/src/plugins/platforms/directfb/directfb.pro +++ b/src/plugins/platforms/directfb/directfb.pro @@ -27,5 +27,7 @@ HEADERS = qdirectfbintegration.h \ qdirectfbinput.h \ qdirectfbcursor.h \ qdirectfbwindow.h + +include(../fontdatabases/genericunix/genericunix.pri) target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.cpp b/src/plugins/platforms/directfb/qdirectfbintegration.cpp index b19a1d9..64b98db 100644 --- a/src/plugins/platforms/directfb/qdirectfbintegration.cpp +++ b/src/plugins/platforms/directfb/qdirectfbintegration.cpp @@ -46,6 +46,8 @@ #include "qdirectfbcursor.h" #include "qdirectfbwindow.h" +#include "qgenericunixfontdatabase.h" + #include #include @@ -80,6 +82,7 @@ QDirectFbScreen::~QDirectFbScreen() } QDirectFbIntegration::QDirectFbIntegration() + : mFontDb(new QGenericUnixFontDatabase()) { const QStringList args = QCoreApplication::arguments(); int argc = args.size(); @@ -133,9 +136,9 @@ QWindowSurface *QDirectFbIntegration::createWindowSurface(QWidget *widget, WId w return new QDirectFbWindowSurface(widget,winId); } -QBlittable *QDirectFbIntegration::createBlittable(const QSize &size) const +QPlatformFontDatabase *QDirectFbIntegration::fontDatabase() const { - return new QDirectFbBlitter(size); + return mFontDb; } QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.h b/src/plugins/platforms/directfb/qdirectfbintegration.h index 27847e2..d2d8367 100644 --- a/src/plugins/platforms/directfb/qdirectfbintegration.h +++ b/src/plugins/platforms/directfb/qdirectfbintegration.h @@ -87,14 +87,16 @@ public: QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; - QBlittable *createBlittable(const QSize &size) const; QList screens() const { return mScreens; } + QPlatformFontDatabase *fontDatabase() const; + private: QList mScreens; QDirectFbInput *mInput; QThread *mInputRunner; + QPlatformFontDatabase *mFontDb; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/eglfs.pro b/src/plugins/platforms/eglfs/eglfs.pro index 5d1318a..7ad8fd9 100644 --- a/src/plugins/platforms/eglfs/eglfs.pro +++ b/src/plugins/platforms/eglfs/eglfs.pro @@ -25,5 +25,7 @@ HEADERS = qeglfsintegration.h \ qeglfswindowsurface.h \ qeglfsscreen.h +include(../fontdatabases/genericunix/genericunix.pri) + target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index 2b673ae..07605ec 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -48,11 +48,14 @@ #include #include +#include "qgenericunixfontdatabase.h" + #include QT_BEGIN_NAMESPACE QEglFSIntegration::QEglFSIntegration() + mFontDb(new QGenericUnixFontDatabase()) { m_primaryScreen = new QEglFSScreen(EGL_DEFAULT_DISPLAY); @@ -90,4 +93,9 @@ QWindowSurface *QEglFSIntegration::createWindowSurface(QWidget *widget, WId winI return new QEglFSWindowSurface(m_primaryScreen,widget); } +QPlatformFontDatabase *QEglFSIntegration::fontDatabase() const +{ + return mFontDb; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.h b/src/plugins/platforms/eglfs/qeglfsintegration.h index f15b6b2..0342539 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.h +++ b/src/plugins/platforms/eglfs/qeglfsintegration.h @@ -62,7 +62,10 @@ public: QList screens() const { return mScreens; } + QPlatformFontDatabase *fontDatabase() const; + private: + QPlatformFontDatabase *mFontDb; QList mScreens; QEglFSScreen *m_primaryScreen; }; diff --git a/src/plugins/platforms/fontdatabases/basicunix/basicunix.pri b/src/plugins/platforms/fontdatabases/basicunix/basicunix.pri new file mode 100644 index 0000000..21aedba --- /dev/null +++ b/src/plugins/platforms/fontdatabases/basicunix/basicunix.pri @@ -0,0 +1,82 @@ +DEFINES += QT_NO_FONTCONFIG +HEADERS += \ + $$QT_SOURCE_TREE/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h \ + $$QT_SOURCE_TREE/src/gui/text/qfontengine_ft_p.h + +SOURCES += \ + $$QT_SOURCE_TREE/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp \ + $$QT_SOURCE_TREE/src/gui/text/qfontengine_ft.cpp + +INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/harfbuzz/src + +INCLUDEPATH += $$QT_SOURCE_TREE/src/plugins/platforms/fontdatabases/basicunix + +CONFIG += opentype + +contains(QT_CONFIG, freetype) { + SOURCES += \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/base/ftbase.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/base/ftbbox.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/base/ftdebug.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/base/ftglyph.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/base/ftinit.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/base/ftmm.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/base/fttype1.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/base/ftsynth.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/base/ftbitmap.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/bdf/bdf.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/cache/ftcache.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/cff/cff.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/cid/type1cid.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/gzip/ftgzip.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/pcf/pcf.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/pfr/pfr.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/psaux/psaux.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/pshinter/pshinter.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/psnames/psmodule.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/raster/raster.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/sfnt/sfnt.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/smooth/smooth.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/truetype/truetype.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/type1/type1.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/type42/type42.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/winfonts/winfnt.c \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/lzw/ftlzw.c\ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/otvalid/otvalid.c\ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/otvalid/otvbase.c\ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/otvalid/otvgdef.c\ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/otvalid/otvjstf.c\ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/otvalid/otvcommn.c\ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/otvalid/otvgpos.c\ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/otvalid/otvgsub.c\ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/otvalid/otvmod.c\ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/autofit/afangles.c\ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/autofit/afglobal.c\ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/autofit/aflatin.c\ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/autofit/afmodule.c\ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/autofit/afdummy.c\ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/autofit/afhints.c\ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/autofit/afloader.c\ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/autofit/autofit.c + + symbian { + SOURCES += \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src/base/ftsystem.c + } else { + SOURCES += \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/builds/unix/ftsystem.c + INCLUDEPATH += \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/builds/unix + } + + INCLUDEPATH += \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/src \ + $$QT_SOURCE_TREE/src/3rdparty/freetype/include + + DEFINES += FT2_BUILD_LIBRARY FT_CONFIG_OPTION_SYSTEM_ZLIB + } else:contains(QT_CONFIG, system-freetype) { + # pull in the proper freetype2 include directory + include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri) + LIBS_PRIVATE += -lfreetype + } + diff --git a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp new file mode 100644 index 0000000..5b8ca63 --- /dev/null +++ b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp @@ -0,0 +1,281 @@ +#include "qbasicunixfontdatabase.h" + +#include +#include + +#include +#include +#include + +#undef QT_NO_FREETYPE +#include +#include + +#include +#include FT_TRUETYPE_TABLES_H + +#define SimplifiedChineseCsbBit 18 +#define TraditionalChineseCsbBit 20 +#define JapaneseCsbBit 17 +#define KoreanCsbBit 21 + +static int requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2] = { + // Any, + { 127, 127 }, + // Latin, + { 0, 127 }, + // Greek, + { 7, 127 }, + // Cyrillic, + { 9, 127 }, + // Armenian, + { 10, 127 }, + // Hebrew, + { 11, 127 }, + // Arabic, + { 13, 127 }, + // Syriac, + { 71, 127 }, + //Thaana, + { 72, 127 }, + //Devanagari, + { 15, 127 }, + //Bengali, + { 16, 127 }, + //Gurmukhi, + { 17, 127 }, + //Gujarati, + { 18, 127 }, + //Oriya, + { 19, 127 }, + //Tamil, + { 20, 127 }, + //Telugu, + { 21, 127 }, + //Kannada, + { 22, 127 }, + //Malayalam, + { 23, 127 }, + //Sinhala, + { 73, 127 }, + //Thai, + { 24, 127 }, + //Lao, + { 25, 127 }, + //Tibetan, + { 70, 127 }, + //Myanmar, + { 74, 127 }, + // Georgian, + { 26, 127 }, + // Khmer, + { 80, 127 }, + // SimplifiedChinese, + { 126, 127 }, + // TraditionalChinese, + { 126, 127 }, + // Japanese, + { 126, 127 }, + // Korean, + { 56, 127 }, + // Vietnamese, + { 0, 127 }, // same as latin1 + // Other, + { 126, 127 }, + // Ogham, + { 78, 127 }, + // Runic, + { 79, 127 }, + // Nko, + { 14, 127 }, +}; + +static QSupportedWritingSystems determineWritingSystemsFromTrueTypeBits(quint32 unicodeRange[4], quint32 codePageRange[2]) +{ + QSupportedWritingSystems writingSystems; + bool hasScript = false; + + int i; + for(i = 0; i < QFontDatabase::WritingSystemsCount; i++) { + int bit = requiredUnicodeBits[i][0]; + int index = bit/32; + int flag = 1 << (bit&31); + if (bit != 126 && unicodeRange[index] & flag) { + bit = requiredUnicodeBits[i][1]; + index = bit/32; + + flag = 1 << (bit&31); + if (bit == 127 || unicodeRange[index] & flag) { + writingSystems.setSupported(QFontDatabase::WritingSystem(i)); + hasScript = true; + // qDebug("font %s: index=%d, flag=%8x supports script %d", familyName.latin1(), index, flag, i); + } + } + } + if(codePageRange[0] & (1 << SimplifiedChineseCsbBit)) { + writingSystems.setSupported(QFontDatabase::SimplifiedChinese); + hasScript = true; + //qDebug("font %s supports Simplified Chinese", familyName.latin1()); + } + if(codePageRange[0] & (1 << TraditionalChineseCsbBit)) { + writingSystems.setSupported(QFontDatabase::TraditionalChinese); + hasScript = true; + //qDebug("font %s supports Traditional Chinese", familyName.latin1()); + } + if(codePageRange[0] & (1 << JapaneseCsbBit)) { + writingSystems.setSupported(QFontDatabase::Japanese); + hasScript = true; + //qDebug("font %s supports Japanese", familyName.latin1()); + } + if(codePageRange[0] & (1 << KoreanCsbBit)) { + writingSystems.setSupported(QFontDatabase::Korean); + hasScript = true; + //qDebug("font %s supports Korean", familyName.latin1()); + } + if (!hasScript) + writingSystems.setSupported(QFontDatabase::Symbol); + + return writingSystems; +} + +static inline bool scriptRequiresOpenType(int script) +{ + return ((script >= QUnicodeTables::Syriac && script <= QUnicodeTables::Sinhala) + || script == QUnicodeTables::Khmer || script == QUnicodeTables::Nko); +} + +void QBasicUnixFontDatabase::populateFontDatabase() +{ + QPlatformFontDatabase::populateFontDatabase(); + QString fontpath = fontDir(); + + if(!QFile::exists(fontpath)) { + qFatal("QFontDatabase: Cannot find font directory %s - is Qt installed correctly?", + qPrintable(fontpath)); + } + + QDir dir(fontpath); + dir.setNameFilters(QStringList() << QLatin1String("*.ttf") + << QLatin1String("*.ttc") << QLatin1String("*.pfa") + << QLatin1String("*.pfb")); + dir.refresh(); + for (int i = 0; i < int(dir.count()); ++i) { + const QByteArray file = QFile::encodeName(dir.absoluteFilePath(dir[i])); +// qDebug() << "looking at" << file; + addTTFile(QByteArray(), file); + } +} + +QFontEngine *QBasicUnixFontDatabase::fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *usrPtr) +{ + QFontEngineFT *engine; + FontFile *fontfile = static_cast (usrPtr); + QFontEngine::FaceId fid; + fid.filename = fontfile->fileName.toLocal8Bit(); + fid.index = fontfile->indexValue; + engine = new QFontEngineFT(fontDef); + + bool antialias = !(fontDef.styleStrategy & QFont::NoAntialias); + QFontEngineFT::GlyphFormat format = antialias? QFontEngineFT::Format_A8 : QFontEngineFT::Format_Mono; + if (!engine->init(fid,antialias,format)) { + delete engine; + engine = 0; + return engine; + } + if (engine->invalid()) { + delete engine; + engine = 0; + } else if (scriptRequiresOpenType(script)) { + HB_Face hbFace = engine->harfbuzzFace(); + if (!hbFace || !hbFace->supported_scripts[script]) { + delete engine; + engine = 0; + } + } + + return engine; +} + +QStringList QBasicUnixFontDatabase::fallbacksForFamily(const QString family, const QFont::Style &style, const QUnicodeTables::Script &script) const +{ + Q_UNUSED(family); + Q_UNUSED(style); + Q_UNUSED(script); + return QStringList(); +} + +void QBasicUnixFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName) +{ + addTTFile(fontData,fileName.toLocal8Bit()); +} + +void QBasicUnixFontDatabase::releaseHandle(void *handle) +{ + FontFile *file = static_cast(handle); + delete file; +} + +void QBasicUnixFontDatabase::addTTFile(const QByteArray &fontData, const QByteArray &file) +{ + extern FT_Library qt_getFreetype(); + FT_Library library = qt_getFreetype(); + + int index = 0; + int numFaces = 0; + do { + FT_Face face; + FT_Error error; + if (!fontData.isEmpty()) { + error = FT_New_Memory_Face(library, (const FT_Byte *)fontData.constData(), fontData.size(), index, &face); + } else { + error = FT_New_Face(library, file.constData(), index, &face); + } + if (error != FT_Err_Ok) { + qDebug() << "FT_New_Face failed with index" << index << ":" << hex << error; + break; + } + numFaces = face->num_faces; + + int weight = QFont::Normal; + + QFont::Style style = QFont::StyleNormal; + if (face->style_flags & FT_STYLE_FLAG_ITALIC) + style = QFont::StyleItalic; + + if (face->style_flags & FT_STYLE_FLAG_BOLD) + weight = QFont::Bold; + + QSupportedWritingSystems writingSystems; + // detect symbol fonts + for (int i = 0; i < face->num_charmaps; ++i) { + FT_CharMap cm = face->charmaps[i]; + if (cm->encoding == ft_encoding_adobe_custom + || cm->encoding == ft_encoding_symbol) { + writingSystems.setSupported(QFontDatabase::Symbol); + break; + } + } + + TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(face, ft_sfnt_os2); + if (os2) { + quint32 unicodeRange[4] = { + os2->ulUnicodeRange1, os2->ulUnicodeRange2, os2->ulUnicodeRange3, os2->ulUnicodeRange4 + }; + quint32 codePageRange[2] = { + os2->ulCodePageRange1, os2->ulCodePageRange2 + }; + + writingSystems = determineWritingSystemsFromTrueTypeBits(unicodeRange, codePageRange); + } + + QString family = QString::fromAscii(face->family_name); + FontFile *fontFile = new FontFile; + fontFile->fileName = file; + fontFile->indexValue = index; + + registerFont(family,"",weight,style,100,true,true,0,writingSystems,fontFile); + + FT_Done_Face(face); + ++index; + } while (index < numFaces); +} diff --git a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h new file mode 100644 index 0000000..401a4aa --- /dev/null +++ b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h @@ -0,0 +1,26 @@ +#ifndef QBASICUNIXFONTDATABASE_H +#define QBASICUNIXFONTDATABASE_H + +#include +#include +#include + +struct FontFile +{ + QString fileName; + int indexValue; +}; + +class QBasicUnixFontDatabase : public QPlatformFontDatabase +{ +public: + void populateFontDatabase(); + QFontEngine *fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *handle); + QStringList fallbacksForFamily(const QString family, const QFont::Style &style, const QUnicodeTables::Script &script) const; + void addApplicationFont(const QByteArray &fontData, const QString &fileName); + void releaseHandle(void *handle); + + static void addTTFile(const QByteArray &fontData, const QByteArray &file); +}; + +#endif // QBASICUNIXFONTDATABASE_H diff --git a/src/plugins/platforms/fontdatabases/fontconfig/fontconfig.pri b/src/plugins/platforms/fontdatabases/fontconfig/fontconfig.pri new file mode 100644 index 0000000..19c74ed --- /dev/null +++ b/src/plugins/platforms/fontdatabases/fontconfig/fontconfig.pri @@ -0,0 +1,12 @@ +include(../basicunix/basicunix.pri) + +HEADERS += \ + $$QT_SOURCE_TREE/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.h + +SOURCES += \ + $$QT_SOURCE_TREE/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp + +INCLUDEPATH += $$QT_SOURCE_TREE/src/plugins/platforms/fontdatabases/fontconfig +LIBS_PRIVATE += -lfontconfig + + diff --git a/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp new file mode 100644 index 0000000..562cb2d --- /dev/null +++ b/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -0,0 +1,528 @@ +#include "qfontconfigdatabase.h" + +#include +#include + +#include + +#include +#include + +#include +#include + + + +#include +#include FT_TRUETYPE_TABLES_H + +#include + +#define SimplifiedChineseCsbBit 18 +#define TraditionalChineseCsbBit 20 +#define JapaneseCsbBit 17 +#define KoreanCsbBit 21 + +static inline bool requiresOpenType(int writingSystem) +{ + return ((writingSystem >= QFontDatabase::Syriac && writingSystem <= QFontDatabase::Sinhala) + || writingSystem == QFontDatabase::Khmer || writingSystem == QFontDatabase::Nko); +} +static inline bool scriptRequiresOpenType(int script) +{ + return ((script >= QUnicodeTables::Syriac && script <= QUnicodeTables::Sinhala) + || script == QUnicodeTables::Khmer || script == QUnicodeTables::Nko); +} + +static int getFCWeight(int fc_weight) +{ + int qtweight = QFont::Black; + if (fc_weight <= (FC_WEIGHT_LIGHT + FC_WEIGHT_MEDIUM) / 2) + qtweight = QFont::Light; + else if (fc_weight <= (FC_WEIGHT_MEDIUM + FC_WEIGHT_DEMIBOLD) / 2) + qtweight = QFont::Normal; + else if (fc_weight <= (FC_WEIGHT_DEMIBOLD + FC_WEIGHT_BOLD) / 2) + qtweight = QFont::DemiBold; + else if (fc_weight <= (FC_WEIGHT_BOLD + FC_WEIGHT_BLACK) / 2) + qtweight = QFont::Bold; + + return qtweight; +} + +static const char *specialLanguages[] = { + "en", // Common + "el", // Greek + "ru", // Cyrillic + "hy", // Armenian + "he", // Hebrew + "ar", // Arabic + "syr", // Syriac + "div", // Thaana + "hi", // Devanagari + "bn", // Bengali + "pa", // Gurmukhi + "gu", // Gujarati + "or", // Oriya + "ta", // Tamil + "te", // Telugu + "kn", // Kannada + "ml", // Malayalam + "si", // Sinhala + "th", // Thai + "lo", // Lao + "bo", // Tibetan + "my", // Myanmar + "ka", // Georgian + "ko", // Hangul + "", // Ogham + "", // Runic + "km", // Khmer + "" // N'Ko +}; +enum { SpecialLanguageCount = sizeof(specialLanguages) / sizeof(const char *) }; + +static const ushort specialChars[] = { + 0, // English + 0, // Greek + 0, // Cyrillic + 0, // Armenian + 0, // Hebrew + 0, // Arabic + 0, // Syriac + 0, // Thaana + 0, // Devanagari + 0, // Bengali + 0, // Gurmukhi + 0, // Gujarati + 0, // Oriya + 0, // Tamil + 0xc15, // Telugu + 0xc95, // Kannada + 0xd15, // Malayalam + 0xd9a, // Sinhala + 0, // Thai + 0, // Lao + 0, // Tibetan + 0x1000, // Myanmar + 0, // Georgian + 0, // Hangul + 0x1681, // Ogham + 0x16a0, // Runic + 0, // Khmer + 0x7ca // N'Ko +}; +enum { SpecialCharCount = sizeof(specialChars) / sizeof(ushort) }; + +// this could become a list of all languages used for each writing +// system, instead of using the single most common language. +static const char *languageForWritingSystem[] = { + 0, // Any + "en", // Latin + "el", // Greek + "ru", // Cyrillic + "hy", // Armenian + "he", // Hebrew + "ar", // Arabic + "syr", // Syriac + "div", // Thaana + "hi", // Devanagari + "bn", // Bengali + "pa", // Gurmukhi + "gu", // Gujarati + "or", // Oriya + "ta", // Tamil + "te", // Telugu + "kn", // Kannada + "ml", // Malayalam + "si", // Sinhala + "th", // Thai + "lo", // Lao + "bo", // Tibetan + "my", // Myanmar + "ka", // Georgian + "km", // Khmer + "zh-cn", // SimplifiedChinese + "zh-tw", // TraditionalChinese + "ja", // Japanese + "ko", // Korean + "vi", // Vietnamese + 0, // Symbol + 0, // Ogham + 0, // Runic + 0 // N'Ko +}; +enum { LanguageCount = sizeof(languageForWritingSystem) / sizeof(const char *) }; + +// Unfortunately FontConfig doesn't know about some languages. We have to test these through the +// charset. The lists below contain the systems where we need to do this. +static const ushort sampleCharForWritingSystem[] = { + 0, // Any + 0, // Latin + 0, // Greek + 0, // Cyrillic + 0, // Armenian + 0, // Hebrew + 0, // Arabic + 0, // Syriac + 0, // Thaana + 0, // Devanagari + 0, // Bengali + 0, // Gurmukhi + 0, // Gujarati + 0, // Oriya + 0, // Tamil + 0xc15, // Telugu + 0xc95, // Kannada + 0xd15, // Malayalam + 0xd9a, // Sinhala + 0, // Thai + 0, // Lao + 0, // Tibetan + 0x1000, // Myanmar + 0, // Georgian + 0, // Khmer + 0, // SimplifiedChinese + 0, // TraditionalChinese + 0, // Japanese + 0, // Korean + 0, // Vietnamese + 0, // Symbol + 0x1681, // Ogham + 0x16a0, // Runic + 0x7ca // N'Ko +}; +enum { SampleCharCount = sizeof(sampleCharForWritingSystem) / sizeof(ushort) }; + +// Newer FontConfig let's us sort out fonts that contain certain glyphs, but no +// open type tables for is directly. Do this so we don't pick some strange +// pseudo unicode font +static const char *openType[] = { + 0, // Any + 0, // Latin + 0, // Greek + 0, // Cyrillic + 0, // Armenian + 0, // Hebrew + 0, // Arabic + "syrc", // Syriac + "thaa", // Thaana + "deva", // Devanagari + "beng", // Bengali + "guru", // Gurmukhi + "gurj", // Gujarati + "orya", // Oriya + "taml", // Tamil + "telu", // Telugu + "knda", // Kannada + "mlym", // Malayalam + "sinh", // Sinhala + 0, // Thai + 0, // Lao + "tibt", // Tibetan + "mymr", // Myanmar + 0, // Georgian + "khmr", // Khmer + 0, // SimplifiedChinese + 0, // TraditionalChinese + 0, // Japanese + 0, // Korean + 0, // Vietnamese + 0, // Symbol + 0, // Ogham + 0, // Runic + "nko " // N'Ko +}; + +void QFontconfigDatabase::populateFontDatabase() +{ + FcFontSet *fonts; + + QString familyName; + FcChar8 *value = 0; + int weight_value; + int slant_value; + int spacing_value; + FcChar8 *file_value; + int indexValue; + FcChar8 *foundry_value; + FcBool scalable; + FcBool antialias; + + { + FcObjectSet *os = FcObjectSetCreate(); + FcPattern *pattern = FcPatternCreate(); + const char *properties [] = { + FC_FAMILY, FC_WEIGHT, FC_SLANT, + FC_SPACING, FC_FILE, FC_INDEX, + FC_LANG, FC_CHARSET, FC_FOUNDRY, FC_SCALABLE, FC_PIXEL_SIZE, FC_WEIGHT, + FC_WIDTH, +#if FC_VERSION >= 20297 + FC_CAPABILITY, +#endif + (const char *)0 + }; + const char **p = properties; + while (*p) { + FcObjectSetAdd(os, *p); + ++p; + } + fonts = FcFontList(0, pattern, os); + FcObjectSetDestroy(os); + FcPatternDestroy(pattern); + } + + for (int i = 0; i < fonts->nfont; i++) { + if (FcPatternGetString(fonts->fonts[i], FC_FAMILY, 0, &value) != FcResultMatch) + continue; + // capitalize(value); + familyName = QString::fromUtf8((const char *)value); + slant_value = FC_SLANT_ROMAN; + weight_value = FC_WEIGHT_MEDIUM; + spacing_value = FC_PROPORTIONAL; + file_value = 0; + indexValue = 0; + scalable = FcTrue; + + + if (FcPatternGetInteger (fonts->fonts[i], FC_SLANT, 0, &slant_value) != FcResultMatch) + slant_value = FC_SLANT_ROMAN; + if (FcPatternGetInteger (fonts->fonts[i], FC_WEIGHT, 0, &weight_value) != FcResultMatch) + weight_value = FC_WEIGHT_MEDIUM; + if (FcPatternGetInteger (fonts->fonts[i], FC_SPACING, 0, &spacing_value) != FcResultMatch) + spacing_value = FC_PROPORTIONAL; + if (FcPatternGetString (fonts->fonts[i], FC_FILE, 0, &file_value) != FcResultMatch) + file_value = 0; + if (FcPatternGetInteger (fonts->fonts[i], FC_INDEX, 0, &indexValue) != FcResultMatch) + indexValue = 0; + if (FcPatternGetBool(fonts->fonts[i], FC_SCALABLE, 0, &scalable) != FcResultMatch) + scalable = FcTrue; + if (FcPatternGetString(fonts->fonts[i], FC_FOUNDRY, 0, &foundry_value) != FcResultMatch) + foundry_value = 0; + if(FcPatternGetBool(fonts->fonts[i],FC_ANTIALIAS,0,&antialias) != FcResultMatch) + antialias = true; + + QSupportedWritingSystems writingSystems; + FcLangSet *langset = 0; + FcResult res = FcPatternGetLangSet(fonts->fonts[i], FC_LANG, 0, &langset); + if (res == FcResultMatch) { + for (int i = 1; i < LanguageCount; ++i) { + const FcChar8 *lang = (const FcChar8*) languageForWritingSystem[i]; + if (lang) { + FcLangResult langRes = FcLangSetHasLang(langset, lang); + if (langRes != FcLangDifferentLang) + writingSystems.setSupported(QFontDatabase::WritingSystem(i)); + } + } + } else { + // we set Other to supported for symbol fonts. It makes no + // sense to merge these with other ones, as they are + // special in a way. + writingSystems.setSupported(QFontDatabase::Other); + } + + FcCharSet *cs = 0; + res = FcPatternGetCharSet(fonts->fonts[i], FC_CHARSET, 0, &cs); + if (res == FcResultMatch) { + // some languages are not supported by FontConfig, we rather check the + // charset to detect these + for (int i = 1; i < SampleCharCount; ++i) { + if (!sampleCharForWritingSystem[i]) + continue; + if (FcCharSetHasChar(cs, sampleCharForWritingSystem[i])) + writingSystems.setSupported(QFontDatabase::WritingSystem(i)); + } + } + +#if FC_VERSION >= 20297 + for (int j = 1; j < LanguageCount; ++j) { + if (writingSystems.supported(QFontDatabase::WritingSystem(j)) + && requiresOpenType(j) && openType[j]) { + FcChar8 *cap; + res = FcPatternGetString (fonts->fonts[i], FC_CAPABILITY, 0, &cap); + if (res != FcResultMatch || !strstr((const char *)cap, openType[j])) + writingSystems.setSupported(QFontDatabase::WritingSystem(j),false); + } + } +#endif + + FontFile *fontFile = new FontFile; + fontFile->fileName = QLatin1String((const char *)file_value); + fontFile->indexValue = indexValue; + + QFont::Style style = (slant_value == FC_SLANT_ITALIC) + ? QFont::StyleItalic + : ((slant_value == FC_SLANT_OBLIQUE) + ? QFont::StyleOblique + : QFont::StyleNormal); + int weight = getFCWeight(weight_value); + + double pixel_size = 0; + if (!scalable) { + int width = 100; + FcPatternGetInteger (fonts->fonts[i], FC_WIDTH, 0, &width); + FcPatternGetDouble (fonts->fonts[i], FC_PIXEL_SIZE, 0, &pixel_size); + } + + QPlatformFontDatabase::registerFont(familyName,QLatin1String((const char *)foundry_value),weight,style,100,antialias,scalable,pixel_size,writingSystems,fontFile); +// qDebug() << familyName << (const char *)foundry_value << weight << style << &writingSystems << scalable << true << pixel_size; + } + + FcFontSetDestroy (fonts); + + struct FcDefaultFont { + const char *qtname; + const char *rawname; + bool fixed; + }; + const FcDefaultFont defaults[] = { + { "Serif", "serif", false }, + { "Sans Serif", "sans-serif", false }, + { "Monospace", "monospace", true }, + { 0, 0, false } + }; + const FcDefaultFont *f = defaults; + // aliases only make sense for 'common', not for any of the specials + QSupportedWritingSystems ws; + ws.setSupported(QFontDatabase::Latin); + + while (f->qtname) { + registerFont(f->qtname,"",50,QFont::StyleNormal,100,true,true,0,ws,0); + registerFont(f->qtname,"",50,QFont::StyleItalic,100,true,true,0,ws,0); + registerFont(f->qtname,"",50,QFont::StyleOblique,100,true,true,0,ws,0); + ++f; + } + + const FcDefaultFont *s = defaults; + QFont font("Sans Serif"); + font.setPointSize(9); + QApplication::setFont(font); +} + +QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, QUnicodeTables::Script script, void *usrPtr) +{ + QFontDef fontDef = f; + + QFontEngineFT *engine; + FontFile *fontfile = static_cast (usrPtr); + QFontEngine::FaceId fid; + fid.filename = fontfile->fileName.toLocal8Bit(); + fid.index = fontfile->indexValue; + + //try and get the pattern + FcPattern *pattern = FcPatternCreate(); + + bool antialias = !(fontDef.styleStrategy & QFont::NoAntialias); + QFontEngineFT::GlyphFormat format = antialias? QFontEngineFT::Format_A8 : QFontEngineFT::Format_Mono; + + engine = new QFontEngineFT(fontDef); + + FcValue value; + value.type = FcTypeString; + QByteArray cs = fontDef.family.toUtf8(); + value.u.s = (const FcChar8 *)cs.data(); + FcPatternAdd(pattern,FC_FAMILY,value,true); + + + value.u.s = (const FcChar8 *)fid.filename.data(); + FcPatternAdd(pattern,FC_FILE,value,true); + + value.type = FcTypeInteger; + value.u.i = fid.index; + FcPatternAdd(pattern,FC_INDEX,value,true); + + QFontEngineFT::HintStyle default_hint_style; + + if (FcConfigSubstitute(0,pattern,FcMatchPattern)) { + + //hinting + int hint_style = 0; + if (FcPatternGetInteger (pattern, FC_HINT_STYLE, 0, &hint_style) == FcResultNoMatch) + hint_style = QFontEngineFT::HintFull; + switch (hint_style) { + case FC_HINT_NONE: + default_hint_style = QFontEngineFT::HintNone; + break; + case FC_HINT_SLIGHT: + default_hint_style = QFontEngineFT::HintLight; + break; + case FC_HINT_MEDIUM: + default_hint_style = QFontEngineFT::HintMedium; + break; + default: + default_hint_style = QFontEngineFT::HintFull; + break; + } + } + + engine->setDefaultHintStyle(default_hint_style); + if (!engine->init(fid,antialias,format)) { + delete engine; + engine = 0; + return engine; + } + if (engine->invalid()) { + delete engine; + engine = 0; + } else if (scriptRequiresOpenType(script)) { + HB_Face hbFace = engine->harfbuzzFace(); + if (!hbFace || !hbFace->supported_scripts[script]) { + delete engine; + engine = 0; + } + } + + return engine; +} + +QStringList QFontconfigDatabase::fallbacksForFamily(const QString family, const QFont::Style &style, const QUnicodeTables::Script &script) const +{ + QStringList fallbackFamilies; + FcPattern *pattern = FcPatternCreate(); + if (!pattern) + return fallbackFamilies; + + FcValue value; + value.type = FcTypeString; + QByteArray cs = family.toUtf8(); + value.u.s = (const FcChar8 *)cs.data(); + FcPatternAdd(pattern,FC_FAMILY,value,true); + + int slant_value = FC_SLANT_ROMAN; + if (style == QFont::StyleItalic) + slant_value = FC_SLANT_ITALIC; + else if (style == QFont::StyleOblique) + slant_value = FC_SLANT_OBLIQUE; + FcPatternAddInteger(pattern, FC_SLANT, slant_value); + + if (script != QUnicodeTables::Common && *specialLanguages[script] != '\0') { + Q_ASSERT(script < QUnicodeTables::ScriptCount); + FcLangSet *ls = FcLangSetCreate(); + FcLangSetAdd(ls, (const FcChar8*)specialLanguages[script]); + FcPatternAddLangSet(pattern, FC_LANG, ls); + FcLangSetDestroy(ls); + } + + FcConfigSubstitute(0, pattern, FcMatchPattern); + FcConfigSubstitute(0, pattern, FcMatchFont); + + FcResult result = FcResultMatch; + FcFontSet *fontSet = FcFontSort(0,pattern,FcFalse,0,&result); + + if (fontSet && result == FcResultMatch) + { + for (int i = 0; i < fontSet->nfont; i++) { + FcChar8 *value = 0; + if (FcPatternGetString(fontSet->fonts[i], FC_FAMILY, 0, &value) != FcResultMatch) + continue; + // capitalize(value); + QString familyName = QString::fromUtf8((const char *)value); + if (!fallbackFamilies.contains(familyName,Qt::CaseInsensitive)) { + fallbackFamilies << familyName; + } + + } + } +// qDebug() << "fallbackFamilies for:" << family << fallbackFamilies; + + return fallbackFamilies; +} diff --git a/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.h b/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.h new file mode 100644 index 0000000..5945b6e --- /dev/null +++ b/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.h @@ -0,0 +1,15 @@ +#ifndef QFONTCONFIGDATABASE_H +#define QFONTCONFIGDATABASE_H + +#include +#include "qbasicunixfontdatabase.h" + +class QFontconfigDatabase : public QBasicUnixFontDatabase +{ +public: + void populateFontDatabase(); + QFontEngine *fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *handle); + QStringList fallbacksForFamily(const QString family, const QFont::Style &style, const QUnicodeTables::Script &script) const; +}; + +#endif // QFONTCONFIGDATABASE_H diff --git a/src/plugins/platforms/fontdatabases/genericunix/genericunix.pri b/src/plugins/platforms/fontdatabases/genericunix/genericunix.pri new file mode 100644 index 0000000..dbcfbce --- /dev/null +++ b/src/plugins/platforms/fontdatabases/genericunix/genericunix.pri @@ -0,0 +1,10 @@ +contains(QT_CONFIG, fontconfig) { + include(../fontconfig/fontconfig.pri) + DEFINES += Q_FONTCONFIGDATABASE +} else { + include(../basicunix/basicunix.pri) +} + +INCLUDEPATH += $$QT_SOURCE_TREE/src/plugins/platforms/fontdatabases/genericunix +HEADERS += \ + $$QT_SOURCE_TREE/src/plugins/platforms/fontdatabases/genericunix/qgenericunixfontdatabase.h diff --git a/src/plugins/platforms/fontdatabases/genericunix/qgenericunixfontdatabase.h b/src/plugins/platforms/fontdatabases/genericunix/qgenericunixfontdatabase.h new file mode 100644 index 0000000..ec083f8 --- /dev/null +++ b/src/plugins/platforms/fontdatabases/genericunix/qgenericunixfontdatabase.h @@ -0,0 +1,12 @@ +#ifndef QGENERICUNIXFONTDATABASE_H +#define QGENERICUNIXFONTDATABASE_H + +#ifdef Q_FONTCONFIGDATABASE +#include "qfontconfigdatabase.h" +typedef QFontconfigDatabase QGenericUnixFontDatabase; +#else +#include "qbasicunixfontdatabase.h" +typedef QBasicUnixFontDatabase QGenericUnixFontDatabase; +#endif //Q_FONTCONFIGDATABASE + +#endif // QGENERICUNIXFONTDATABASE_H diff --git a/src/plugins/platforms/linuxfb/linuxfb.pro b/src/plugins/platforms/linuxfb/linuxfb.pro index 8d4b6d7..216b899 100644 --- a/src/plugins/platforms/linuxfb/linuxfb.pro +++ b/src/plugins/platforms/linuxfb/linuxfb.pro @@ -7,6 +7,7 @@ SOURCES = main.cpp qlinuxfbintegration.cpp HEADERS = qlinuxfbintegration.h include(../fb_base/fb_base.pri) +include(../fontdatabases/genericunix/genericunix.pri) target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp index 437af81..aa1d401 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp @@ -41,6 +41,7 @@ #include "qlinuxfbintegration.h" #include "../fb_base/fb_base.h" +#include "qgenericunixfontdatabase.h" #include #include // overrides QT_OPEN #include @@ -156,6 +157,7 @@ void QLinuxFbIntegrationPrivate::closeTty() } QLinuxFbIntegration::QLinuxFbIntegration() + :fontDb(new QGenericUnixFontDatabase()) { d_ptr = new QLinuxFbIntegrationPrivate(); @@ -799,6 +801,11 @@ QPlatformWindow *QLinuxFbIntegration::createPlatformWindow(QWidget *widget, WId return w; } +QPlatformFontDatabase *QLinuxFbIntegration::fontDatabase() const +{ + return fontDb; +} + QLinuxFbScreen::QLinuxFbScreen(uchar * d, int w, int h, int lstep, QImage::Format screenFormat) : compositePainter(0) { diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h index dc61df5..a5d7abd 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h @@ -82,6 +82,8 @@ public: QList screens() const { return mScreens; } + QPlatformFontDatabase *fontDatabase() const; + private: QLinuxFbScreen *mPrimaryScreen; QList mScreens; @@ -122,6 +124,7 @@ private: void setPixelFormat(struct fb_var_screeninfo); void createPalette(fb_cmap &cmap, fb_var_screeninfo &vinfo, fb_fix_screeninfo &finfo); void blank(bool on); + QPlatformFontDatabase *fontDb; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro index b68230c..3446e81 100644 --- a/src/plugins/platforms/platforms.pro +++ b/src/plugins/platforms/platforms.pro @@ -5,7 +5,15 @@ contains(QT_CONFIG, openvg):contains(QT_CONFIG, egl) { SUBDIRS += minimal -#this don't work. but leave it for now -qpa:x11 { +contains(QT_CONFIG, mitshm) { SUBDIRS += testlite } + +linux { + SUBDIRS += linuxfb +} + +unix { + SUBDIRS += vnc \ + qvfb +} diff --git a/src/plugins/platforms/qvfb/qvfb.pro b/src/plugins/platforms/qvfb/qvfb.pro index a560755..d2b332a 100644 --- a/src/plugins/platforms/qvfb/qvfb.pro +++ b/src/plugins/platforms/qvfb/qvfb.pro @@ -7,5 +7,7 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms SOURCES = main.cpp qvfbintegration.cpp qvfbwindowsurface.cpp HEADERS = qvfbintegration.h qvfbwindowsurface.h +include(../fontdatabases/genericunix/genericunix.pri) + target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target diff --git a/src/plugins/platforms/qvfb/qvfbintegration.cpp b/src/plugins/platforms/qvfb/qvfbintegration.cpp index a50763a..0cc3938 100644 --- a/src/plugins/platforms/qvfb/qvfbintegration.cpp +++ b/src/plugins/platforms/qvfb/qvfbintegration.cpp @@ -62,6 +62,8 @@ #include #include +#include "qgenericunixfontdatabase.h" + QT_BEGIN_NAMESPACE @@ -409,6 +411,7 @@ QImage *QVFbScreen::screenImage() } QVFbIntegration::QVFbIntegration(const QStringList ¶mList) + : mFontDb(new QGenericUnixFontDatabase()) { int displayId = 0; if (paramList.length() > 0) @@ -435,6 +438,11 @@ QPlatformWindow *QVFbIntegration::createPlatformWindow(QWidget *widget, WId) con return new QVFbWindow(mPrimaryScreen, widget); } +QPlatformFontDatabase *QVFbIntegration::fontDatabase() const +{ + return mFontDb; +} + QT_END_NAMESPACE #include "qvfbintegration.moc" diff --git a/src/plugins/platforms/qvfb/qvfbintegration.h b/src/plugins/platforms/qvfb/qvfbintegration.h index e46e0da..198a45c 100644 --- a/src/plugins/platforms/qvfb/qvfbintegration.h +++ b/src/plugins/platforms/qvfb/qvfbintegration.h @@ -84,9 +84,12 @@ public: QList screens() const { return mScreens; } + QPlatformFontDatabase *fontDatabase() const; + private: QVFbScreen *mPrimaryScreen; QList mScreens; + QPlatformFontDatabase *mFontDb; }; diff --git a/src/plugins/platforms/testlite/qtestliteintegration.cpp b/src/plugins/platforms/testlite/qtestliteintegration.cpp index a8e0fa7..68e9051 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.cpp +++ b/src/plugins/platforms/testlite/qtestliteintegration.cpp @@ -49,6 +49,7 @@ #include #include "qtestlitewindow.h" +#include "qgenericunixfontdatabase.h" #ifndef QT_NO_OPENGL #include @@ -84,8 +85,8 @@ public: QTestLiteIntegration::QTestLiteIntegration(bool useOpenGL) : mUseOpenGL(useOpenGL) + , mFontDb(new QGenericUnixFontDatabase()) { - xd = new MyDisplay; mPrimaryScreen = new QTestLiteScreen(); @@ -136,6 +137,11 @@ QPixmap QTestLiteIntegration::grabWindow(WId window, int x, int y, int width, in return QPixmap::fromImage(img); } +QPlatformFontDatabase *QTestLiteIntegration::fontDatabase() const +{ + return mFontDb; +} + bool QTestLiteIntegration::hasOpenGL() const { #ifndef QT_NO_OPENGL diff --git a/src/plugins/platforms/testlite/qtestliteintegration.h b/src/plugins/platforms/testlite/qtestliteintegration.h index ac10841..8286ef0 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.h +++ b/src/plugins/platforms/testlite/qtestliteintegration.h @@ -84,6 +84,8 @@ public: QList screens() const { return mScreens; } + QPlatformFontDatabase *fontDatabase() const; + bool hasOpenGL() const; MyDisplay *xd; @@ -92,6 +94,7 @@ private: bool mUseOpenGL; QTestLiteScreen *mPrimaryScreen; QList mScreens; + QPlatformFontDatabase *mFontDb; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index 1f477db..1de4b9d 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -622,7 +622,7 @@ void QTestLiteWindow::handleKeyEvent(QEvent::Type type, void *ev) int qtcode = chars.toUpper()[0]; //Not exactly right... if (modifiers & Qt::ControlModifier && qtcode < ' ') qtcode = chars[0] + '@'; - QWindowSystemInterface::handleKeyEvent(widget(), e->time, type, qtcode, modifiers, QString::fromLatin1(chars)); + QWindowSystemInterface::handleKeyEvent(0, e->time, type, qtcode, modifiers, QString::fromLatin1(chars)); } else { qWarning() << "unknown X keycode" << hex << e->keycode << keySym; } @@ -647,9 +647,9 @@ WId QTestLiteWindow::winId() const void QTestLiteWindow::setParent(const QPlatformWindow *window) { - QPoint point = widget()->mapTo(widget()->nativeParentWidget(),QPoint()); - XReparentWindow(xd->display,x_window,window->winId(),point.x(),point.y()); - XMapWindow(xd->display, x_window); + QPoint point = widget()->mapTo(widget()->nativeParentWidget(),QPoint()); + XReparentWindow(xd->display,x_window,window->winId(),point.x(),point.y()); + XMapWindow(xd->display, x_window); } void QTestLiteWindow::raise() @@ -1441,7 +1441,7 @@ bool MyDisplay::handleEvent(XEvent *xe) xw->handleMouseEvent(QEvent::MouseMove, &xe->xbutton); break; - case XKeyPress: + case XKeyPress: xw->handleKeyEvent(QEvent::KeyPress, &xe->xkey); break; diff --git a/src/plugins/platforms/testlite/testlite.pro b/src/plugins/platforms/testlite/testlite.pro index 0a5ebb2..05bd384 100644 --- a/src/plugins/platforms/testlite/testlite.pro +++ b/src/plugins/platforms/testlite/testlite.pro @@ -1,18 +1,29 @@ -TARGET = qtestlitegraphicssystem -include(../../qpluginbase.pri) +TARGET = qtestlite +include(../../qpluginbase.pri) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms -SOURCES = main.cpp qtestliteintegration.cpp qtestlitewindowsurface.cpp qtestlitewindow.cpp -HEADERS = qtestliteintegration.h qtestlitewindowsurface.h qtestlitewindow.h +SOURCES = \ + main.cpp \ + qtestliteintegration.cpp \ + qtestlitewindowsurface.cpp \ + qtestlitewindow.cpp + +HEADERS = \ + qtestliteintegration.h \ + qtestlitewindowsurface.h \ + qtestlitewindow.h + LIBS += -lX11 -lXext +include (../fontdatabases/genericunix/genericunix.pri) + contains(QT_CONFIG, opengl) { QT += opengl HEADERS += qglxintegration.h SOURCES += qglxintegration.cpp } -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target diff --git a/src/plugins/platforms/vnc/qvncintegration.cpp b/src/plugins/platforms/vnc/qvncintegration.cpp index 331c16a..b36ff33 100644 --- a/src/plugins/platforms/vnc/qvncintegration.cpp +++ b/src/plugins/platforms/vnc/qvncintegration.cpp @@ -49,6 +49,7 @@ #include #include +#include "qgenericunixfontdatabase.h" QVNCScreen::QVNCScreen(QRect screenSize, int screenId) : QFbScreen::QFbScreen() @@ -100,7 +101,7 @@ static void usage() } QVNCIntegration::QVNCIntegration(const QStringList& paramList) - : virtualDesktop(false) + : virtualDesktop(false), fontDb(new QGenericUnixFontDatabase()) { int sizeX = defaultWidth(); int sizeY = defaultHeight(); @@ -234,3 +235,8 @@ void QVNCIntegration::moveToScreen(QWidget *window, int screen) window->platformWindow()->setGeometry(window->geometry()); // this should be unified elsewhere newScreen->addWindow(static_cast(window->platformWindow())); } + +QPlatformFontDatabase *QVNCIntegration::fontDatabase() const +{ + return fontDb; +} diff --git a/src/plugins/platforms/vnc/qvncintegration.h b/src/plugins/platforms/vnc/qvncintegration.h index 241993d..dfc0e6b 100644 --- a/src/plugins/platforms/vnc/qvncintegration.h +++ b/src/plugins/platforms/vnc/qvncintegration.h @@ -45,6 +45,7 @@ #include "qvnccursor.h" #include "../fb_base/fb_base.h" #include +#include "qgenericunixfontdatabase.h" QT_BEGIN_NAMESPACE @@ -91,10 +92,13 @@ public: bool isVirtualDesktop() { return virtualDesktop; } void moveToScreen(QWidget *window, int screen); + QPlatformFontDatabase *fontDatabase() const; + private: QVNCScreen *mPrimaryScreen; QList mScreens; bool virtualDesktop; + QPlatformFontDatabase *fontDb; }; diff --git a/src/plugins/platforms/vnc/vnc.pro b/src/plugins/platforms/vnc/vnc.pro index 65824a2..6c448f5 100644 --- a/src/plugins/platforms/vnc/vnc.pro +++ b/src/plugins/platforms/vnc/vnc.pro @@ -13,6 +13,7 @@ HEADERS += qvnccursor.h SOURCES += qvnccursor.cpp include(../fb_base/fb_base.pri) +include(../fontdatabases/genericunix/genericunix.pri) target.path += $$[QT_INSTALL_PLUGINS]/platforms -- cgit v0.12 From 4e630e3af2f33a123abb58f15f95d640d9054cd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 2 Sep 2010 15:27:27 +0200 Subject: Lighthouse: Move shared context init so it is not created untill anyone asks for it. --- src/plugins/platforms/testlite/qglxintegration.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp index fbffcab..e262d5b 100644 --- a/src/plugins/platforms/testlite/qglxintegration.cpp +++ b/src/plugins/platforms/testlite/qglxintegration.cpp @@ -241,18 +241,18 @@ QGLXGLContext::QGLXGLContext(Window window, MyDisplay *xd, const QPlatformWindow , m_drawable((Drawable)window) , m_context(0) { - if (!QPlatformGLContext::defaultSharedContext()) { - if (m_defaultSharedContextMutex.tryLock()){ - createDefaultSharedContex(xd); - m_defaultSharedContextMutex.unlock(); - } else { - m_defaultSharedContextMutex.lock(); //wait to the the shared context is created - m_defaultSharedContextMutex.unlock(); - } - } QPlatformGLContext *sharePlatformContext; if (format.useDefaultSharedContext()) { + if (!QPlatformGLContext::defaultSharedContext()) { + if (m_defaultSharedContextMutex.tryLock()){ + createDefaultSharedContex(xd); + m_defaultSharedContextMutex.unlock(); + } else { + m_defaultSharedContextMutex.lock(); //wait to the the shared context is created + m_defaultSharedContextMutex.unlock(); + } + } sharePlatformContext = QPlatformGLContext::defaultSharedContext(); } else { sharePlatformContext = format.sharedGLContext(); @@ -309,9 +309,6 @@ void QGLXGLContext::createDefaultSharedContex(MyDisplay *xd) } else { qWarning("Warning no shared context created"); } - - - } void QGLXGLContext::makeCurrent() -- cgit v0.12 From c8ae543a3b649778d8f6e1b2d45faf3a4b1d4012 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 3 Sep 2010 10:03:23 +0200 Subject: Compile fix Note: the #ifdef matches the one around eglReleaseBuffer, but it may be that that should have checked for EGL instead of GL_ES --- src/opengl/qgl.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 2145001..cd3121e 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -93,6 +93,9 @@ #include "qlibrary.h" #include +#ifdef QT_OPENGL_ES +#include +#endif // #define QT_GL_CONTEXT_RESOURCE_DEBUG -- cgit v0.12 From 0d18809a78021709f024e85c5251815a5864a7e3 Mon Sep 17 00:00:00 2001 From: aavit Date: Fri, 3 Sep 2010 10:29:10 +0200 Subject: Protocol rewrite done; design cleaned up. Client no longer fetches baseline images, not even on mismatch. Bitwise comparison, mismatch score etc. will be done on server, if wanted. --- tests/arthur/baselineserver/src/baselineserver.cpp | 74 +++++--- tests/arthur/baselineserver/src/baselineserver.h | 4 +- tests/arthur/common/baselineprotocol.cpp | 58 +------ tests/arthur/common/baselineprotocol.h | 11 +- tests/auto/lancelot/tst_lancelot.cpp | 190 ++++----------------- 5 files changed, 95 insertions(+), 242 deletions(-) diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp index 3087357..0f95474 100644 --- a/tests/arthur/baselineserver/src/baselineserver.cpp +++ b/tests/arthur/baselineserver/src/baselineserver.cpp @@ -110,9 +110,6 @@ void BaselineHandler::receiveRequest() case BaselineProtocol::RequestBaselineChecksums: provideBaselineChecksums(block); break; - case BaselineProtocol::RequestBaseline: - provideBaseline(block); - break; case BaselineProtocol::AcceptNewBaseline: storeImage(block, true); break; @@ -154,24 +151,6 @@ void BaselineHandler::provideBaselineChecksums(const QByteArray &itemListBlock) } -void BaselineHandler::provideBaseline(const QByteArray &caseId) -{ - qDebug() << runId << logtime() << "Received request for baseline" << caseId; - - //### rewrite to use ImageItem - /* - QFile file(pathForCaseId(caseId)); - if (!file.open(QIODevice::ReadOnly)) { - qDebug() << runId << logtime() << "baseline not found."; - proto.sendBlock(BaselineProtocol::BaselineNotPresent, caseId); - return; - } - - proto.sendBlock(BaselineProtocol::AcceptBaseline, file.readAll()); - */ -} - - void BaselineHandler::storeImage(const QByteArray &itemBlock, bool isBaseline) { QDataStream ds(itemBlock); @@ -200,7 +179,6 @@ void BaselineHandler::storeImage(const QByteArray &itemBlock, bool isBaseline) + QHostInfo::localDomainName().toLatin1() + ':' + QFileInfo(file).absoluteFilePath().toLatin1(); proto.sendBlock(BaselineProtocol::Ack, msg); - qDebug() << runId << logtime() << "Storing done."; } @@ -225,6 +203,52 @@ QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline) } -// - transferring and comparing checksums instead of images -// - then we could now if multiple error/imgs are really the same (and just store it once) -// - e.g. using db +QString BaselineHandler::computeMismatchScore(const QImage &baseline, const QImage &rendered) +{ + if (baseline.size() != rendered.size() || baseline.format() != rendered.format()) + return QLatin1String("[No score, incomparable images.]"); + if (baseline.depth() != 32) + return QLatin1String("[Score computation not implemented for format.]"); + + int w = baseline.width(); + int h = baseline.height(); + + uint ncd = 0; // number of differing color pixels + uint nad = 0; // number of differing alpha pixels + uint scd = 0; // sum of color pixel difference + uint sad = 0; // sum of alpha pixel difference + + for (int y=0; yisNull()) { - errMsg.prepend(QLatin1String("Invalid baseline image data received. ")); - return false; - } - } - return true; - } - errMsg.prepend(QLatin1String("Unexpected reply from server on baseline request. ")); - return false; + return (sendItem(AcceptNewBaseline, item) && receiveBlock(&cmd, serverMsg) && cmd == Ack); } -bool BaselineProtocol::submitNewBaseline(const ImageItem &item) +bool BaselineProtocol::submitMismatch(const ImageItem &item, QByteArray *serverMsg) { - return sendItem(AcceptNewBaseline, item); + Command cmd; + return (sendItem(AcceptMismatch, item) && receiveBlock(&cmd, serverMsg) && cmd == Ack); } @@ -188,32 +166,6 @@ bool BaselineProtocol::sendItem(Command cmd, const ImageItem &item) errMsg.prepend(QLatin1String("Failed to submit image to server. ")); return false; } - receiveBlock(&cmd, 0); // For now, Just wait for the pong; ignore reply contents - return true; -} - - -bool BaselineProtocol::submitMismatch(const QString &caseId, const QImage &mismatch, QByteArray *failMsg) -{ - //### TBD: rewrite to use ImageItem - errMsg.clear(); - QBuffer buf; - buf.open(QIODevice::WriteOnly); - QDataStream ds(&buf); - ds << caseId.toLatin1(); - if (!mismatch.save(&buf, FileFormat)) { - errMsg = QLatin1String("Failed to convert mismatched image to ") + QLatin1String(FileFormat); - return false; - } - if (!sendBlock(AcceptMismatch, buf.data())) { - errMsg.prepend(QLatin1String("Failed to submit mismatched image to server. ")); - return false; - } - Command cmd; - if (!receiveBlock(&cmd, failMsg)) { - errMsg.prepend(QLatin1String("Failed to receive response on mismatched image from server. ")); - return false; - } return true; } diff --git a/tests/arthur/common/baselineprotocol.h b/tests/arthur/common/baselineprotocol.h index b16a55b..749b623 100644 --- a/tests/arthur/common/baselineprotocol.h +++ b/tests/arthur/common/baselineprotocol.h @@ -80,24 +80,17 @@ public: // Queries AcceptPlatformInfo = 1, RequestBaselineChecksums = 2, - RequestBaseline = 3, AcceptNewBaseline = 4, AcceptMismatch = 5, // Responses Ack = 128, - - //#### remove these: - AcceptBaseline = 129, - BaselineNotPresent = 130, - IgnoreCase = 131 }; // For client: bool connect(); bool requestBaselineChecksums(ImageItemList *itemList); - bool requestBaseline(const QString &caseId, Command *response, QImage *baseline); - bool submitNewBaseline(const ImageItem &item); - bool submitMismatch(const QString &caseId, const QImage &mismatch, QByteArray *failMsg); + bool submitNewBaseline(const ImageItem &item, QByteArray *serverMsg); + bool submitMismatch(const ImageItem &item, QByteArray *serverMsg); // For server: bool acceptConnection(PlatformInfo *pi); diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index a6bb68f..4485880 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -64,13 +64,10 @@ public: tst_Lancelot(); private: - QImage getBaseline(const QString &fileName, bool *created); - QImage render(const QString &fileName, QImage::Format format); + ImageItem render(const ImageItem &item); QStringList loadScriptFile(const QString &filePath); - QString computeMismatchScore(const QImage& baseline, const QImage& rendered); void runTestSuite(); - QString errorMsg; BaselineProtocol proto; ImageItemList baseList; @@ -108,24 +105,24 @@ void tst_Lancelot::initTestCase() } baseList.resize(files.count()); - int i = 0; + ImageItemList::iterator it = baseList.begin(); foreach(const QString& file, files) { - baseList[i].scriptName = file; + it->scriptName = file; // tbd: also load, split and generate checksums for scripts - i++; + it++; } } void tst_Lancelot::testRasterARGB32PM_data() { - QTest::addColumn("item"); + QTest::addColumn("baseline"); ImageItemList itemList(baseList); - for(int i = 0; i < itemList.size(); i++) { - itemList[i].engine = ImageItem::Raster; - itemList[i].renderFormat = QImage::Format_ARGB32_Premultiplied; + for(ImageItemList::iterator it = itemList.begin(); it != itemList.end(); it++) { + it->engine = ImageItem::Raster; + it->renderFormat = QImage::Format_ARGB32_Premultiplied; } if (!proto.requestBaselineChecksums(&itemList)) { @@ -133,9 +130,8 @@ void tst_Lancelot::testRasterARGB32PM_data() QSKIP("Communication with baseline image server failed.", SkipAll); } - qDebug() << "items:" << itemList.count(); foreach(const ImageItem& item, itemList) { - if (item.scriptName != QLatin1String("sizes.qps")) // Hardcoded blacklisting for this enigine/format + if (item.scriptName != QLatin1String("sizes.qps")) // Example of hardcoded blacklisting for this enigine/format QTest::newRow(item.scriptName.toLatin1()) << item; } } @@ -149,170 +145,58 @@ void tst_Lancelot::testRasterARGB32PM() void tst_Lancelot::runTestSuite() { - errorMsg.clear(); - QFETCH(ImageItem, item); + QFETCH(ImageItem, baseline); - if (item.status == ImageItem::IgnoreItem) + if (baseline.status == ImageItem::IgnoreItem) QSKIP("Blacklisted by baseline server.", SkipSingle); - QImage rendered = render(item.scriptName, item.renderFormat); - if (!errorMsg.isNull() || rendered.isNull()) { // Assume an error in the test environment, not Qt - QWARN("Error: Failed to render image. " + errorMsg.toLatin1()); + ImageItem rendered = render(baseline); + if (rendered.image.isNull()) { // Assume an error in the test environment, not Qt + QWARN("Error: Failed to render image."); QSKIP("Aborted due to errors.", SkipSingle); } - quint64 checksum = ImageItem::computeChecksum(rendered); - - if (item.status == ImageItem::BaselineNotFound) { - item.image = rendered; - item.imageChecksum = checksum; - proto.submitNewBaseline(item); + if (baseline.status == ImageItem::BaselineNotFound) { + proto.submitNewBaseline(rendered, 0); QSKIP("Baseline not found; new baseline created.", SkipSingle); } - qDebug() << "rendered" << QString::number(checksum, 16).prepend("0x") << "baseline" << QString::number(item.imageChecksum, 16).prepend("0x"); - if (checksum != item.imageChecksum) { - /* TBD - - Get baseline image - - compute diffscore - - submit mismatching - - getBaseline(...) - if (!errorMsg.isNull() || baseline.isNull()) { - QWARN("Error: Failed to get baseline image. " + errorMsg.toLatin1()); - QSKIP("Aborted due to errors.", SkipSingle); - } - - - if (rendered.format() != baseline.format()) - rendered = rendered.convertToFormat(baseline.format()); //### depending on format - - QString scoreMsg = computeMismatchScore(baseline, rendered); + if (rendered.imageChecksum != baseline.imageChecksum) { QByteArray serverMsg; - proto.submitMismatch(fileName, rendered, &serverMsg); - */ - QByteArray failMsg = QByteArray("Rendered image differs from baseline. "); - //+ scoreMsg.toLatin1() + '\n' + serverMsg; - QFAIL(failMsg.constData()); + if (!proto.submitMismatch(rendered, &serverMsg)) + serverMsg = "Failed to submit mismatching image to server."; + QFAIL("Rendered image differs from baseline.\n" + serverMsg); } } -QString tst_Lancelot::computeMismatchScore(const QImage &baseline, const QImage &rendered) +ImageItem tst_Lancelot::render(const ImageItem &item) { - if (baseline.size() != rendered.size() || baseline.format() != rendered.format()) - return QLatin1String("[No score, incomparable images.]"); - if (baseline.depth() != 32) - return QLatin1String("[Score computation not implemented for format.]"); - - int w = baseline.width(); - int h = baseline.height(); - - uint ncd = 0; // number of differing color pixels - uint nad = 0; // number of differing alpha pixels - uint scd = 0; // sum of color pixel difference - uint sad = 0; // sum of alpha pixel difference - - for (int y=0; y Date: Fri, 3 Sep 2010 12:33:03 +0200 Subject: Add basic OpenGL testing support. --- tests/arthur/baselineserver/src/baselineserver.cpp | 22 ++++++- tests/arthur/baselineserver/src/baselineserver.h | 1 + tests/auto/lancelot/tst_lancelot.cpp | 70 +++++++++++++++++++--- 3 files changed, 83 insertions(+), 10 deletions(-) diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp index 0f95474..430d4af 100644 --- a/tests/arthur/baselineserver/src/baselineserver.cpp +++ b/tests/arthur/baselineserver/src/baselineserver.cpp @@ -194,14 +194,30 @@ QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline) QString storePath = BaselineServer::storagePath(); storePath += plat.buildKey.section(QLatin1Char(' '), 1, 1) + QLatin1String("_Qt-") + plat.qtVersion + QDir::separator(); - if (isBaseline) - storePath += QLatin1String("baselines") + QDir::separator(); - else + if (isBaseline) { + storePath += QLatin1String("baselines") + QDir::separator() + + engineForItem(item) + QDir::separator(); + } else { storePath += runId + QDir::separator(); + } //#? QString itemName = item.scriptName.replace(item.scriptName.lastIndexOf('.'), '_'); return storePath + item.scriptName + QLatin1Char('.'); } +QString BaselineHandler::engineForItem(const ImageItem &item) +{ + switch (item.engine) { + case ImageItem::Raster: + return QLatin1String("Raster"); + break; + case ImageItem::OpenGL: + return QLatin1String("OpenGL"); + break; + default: + break; + } + return QLatin1String("Unknown"); +} QString BaselineHandler::computeMismatchScore(const QImage &baseline, const QImage &rendered) { diff --git a/tests/arthur/baselineserver/src/baselineserver.h b/tests/arthur/baselineserver/src/baselineserver.h index 337b38c..2963fd1 100644 --- a/tests/arthur/baselineserver/src/baselineserver.h +++ b/tests/arthur/baselineserver/src/baselineserver.h @@ -66,6 +66,7 @@ private: QString pathForItem(const ImageItem &item, bool isBaseline = true); QString logtime(); QString computeMismatchScore(const QImage& baseline, const QImage& rendered); + QString engineForItem(const ImageItem &item); BaselineProtocol proto; PlatformInfo plat; diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index 4485880..93b9346 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -50,6 +50,8 @@ #include #include +#include + #ifndef SRCDIR #define SRCDIR "." #endif @@ -65,6 +67,7 @@ public: private: ImageItem render(const ImageItem &item); + void paint(QPaintDevice *device, const QStringList &script, const QString &filePath); QStringList loadScriptFile(const QString &filePath); void runTestSuite(); @@ -77,6 +80,9 @@ private slots: void testRasterARGB32PM_data(); void testRasterARGB32PM(); + + void testOpenGL_data(); + void testOpenGL(); }; tst_Lancelot::tst_Lancelot() @@ -143,6 +149,36 @@ void tst_Lancelot::testRasterARGB32PM() } +void tst_Lancelot::testOpenGL_data() +{ + QTest::addColumn("item"); + + ImageItemList itemList(baseList); + + for(int i = 0; i < itemList.size(); i++) { + itemList[i].engine = ImageItem::OpenGL; + itemList[i].renderFormat = QImage::Format_RGB32; + } + + if (!proto.requestBaselineChecksums(&itemList)) { + QWARN(qPrintable(proto.errorMessage())); + QSKIP("Communication with baseline image server failed.", SkipAll); + } + + qDebug() << "items:" << itemList.count(); + foreach(const ImageItem& item, itemList) { + if (item.scriptName != QLatin1String("sizes.qps")) // Hardcoded blacklisting for this enigine/format + QTest::newRow(item.scriptName.toLatin1()) << item; + } +} + + +void tst_Lancelot::testOpenGL() +{ + runTestSuite(); +} + + void tst_Lancelot::runTestSuite() { QFETCH(ImageItem, baseline); @@ -178,20 +214,40 @@ ImageItem tst_Lancelot::render(const ImageItem &item) if (script.isEmpty()) { res.image = QImage(); res.imageChecksum = 0; - } else { + } else if (item.engine == ImageItem::Raster) { QImage img(800, 800, item.renderFormat); - QPainter p(&img); - PaintCommands pcmd(script, 800, 800); - pcmd.setPainter(&p); - pcmd.setFilePath(QFileInfo(filePath).absoluteFilePath()); // eh yuck - pcmd.runCommands(); - p.end(); + paint(&img, script, QFileInfo(filePath).absoluteFilePath()); // eh yuck (filePath stuff) res.image = img; res.imageChecksum = ImageItem::computeChecksum(img); + } else if (item.engine == ImageItem::OpenGL) { + QGLWidget glWidget; + if (!glWidget.isValid()) { + res.image = QImage(); + res.imageChecksum = 0; + return res; + } + glWidget.resize(800, 800); + glWidget.show(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&glWidget); +#endif + paint(&glWidget, script, QFileInfo(filePath).absoluteFilePath()); // eh yuck (filePath stuff) + res.image = glWidget.grabFrameBuffer().convertToFormat(item.renderFormat); + res.imageChecksum = ImageItem::computeChecksum(res.image); } + return res; } +void tst_Lancelot::paint(QPaintDevice *device, const QStringList &script, const QString &filePath) +{ + QPainter p(device); + PaintCommands pcmd(script, 800, 800); + pcmd.setPainter(&p); + pcmd.setFilePath(filePath); + pcmd.runCommands(); + p.end(); +} QStringList tst_Lancelot::loadScriptFile(const QString &filePath) { -- cgit v0.12 From bfd35cefd0a56f0faf624185330d5b9e0c9701d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Fri, 3 Sep 2010 12:50:52 +0200 Subject: Data column names have apparently changed :) --- tests/auto/lancelot/tst_lancelot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index 93b9346..7381c1d 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -151,7 +151,7 @@ void tst_Lancelot::testRasterARGB32PM() void tst_Lancelot::testOpenGL_data() { - QTest::addColumn("item"); + QTest::addColumn("baseline"); ImageItemList itemList(baseList); -- cgit v0.12 From 975490d721ca98251aefa7e7f50e6e54e63b79c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 3 Sep 2010 09:27:44 +0200 Subject: Lighthouse: Fix eventhandling for when widgets are in destructor This is a problem when you send events from a seperate thread --- src/gui/kernel/qwindowsysteminterface_qpa.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp index c49bd36..f10c038 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp +++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp @@ -61,6 +61,10 @@ extern QPointer qt_last_mouse_receiver; void QWindowSystemInterface::handleEnterEvent(QWidget *tlw) { + QWidgetData *data = qt_qwidget_data(tlw); + if (data->in_destructor) + return; + if (tlw) { QWindowSystemInterfacePrivate::EnterEvent *e = new QWindowSystemInterfacePrivate::EnterEvent(tlw); QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); @@ -69,12 +73,20 @@ void QWindowSystemInterface::handleEnterEvent(QWidget *tlw) void QWindowSystemInterface::handleLeaveEvent(QWidget *tlw) { + QWidgetData *data = qt_qwidget_data(tlw); + if (data->in_destructor) + return; + QWindowSystemInterfacePrivate::LeaveEvent *e = new QWindowSystemInterfacePrivate::LeaveEvent(tlw); QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); } void QWindowSystemInterface::handleGeometryChange(QWidget *tlw, const QRect &newRect) { + QWidgetData *data = qt_qwidget_data(tlw); + if (data->in_destructor) + return; + QWindowSystemInterfacePrivate::GeometryChangeEvent *e = new QWindowSystemInterfacePrivate::GeometryChangeEvent(tlw,newRect); QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); } @@ -102,6 +114,9 @@ void QWindowSystemInterface::handleMouseEvent(QWidget *w, const QPoint & local, void QWindowSystemInterface::handleMouseEvent(QWidget *tlw, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b) { + QWidgetData *data = qt_qwidget_data(tlw); + if (data->in_destructor) + tlw = 0; QWindowSystemInterfacePrivate::MouseEvent * e = new QWindowSystemInterfacePrivate::MouseEvent(tlw, timestamp, local, global, b); QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); @@ -114,6 +129,10 @@ void QWindowSystemInterface::handleKeyEvent(QWidget *w, QEvent::Type t, int k, Q void QWindowSystemInterface::handleKeyEvent(QWidget *tlw, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count) { + QWidgetData *data = qt_qwidget_data(tlw); + if (data->in_destructor) + tlw = 0; + QWindowSystemInterfacePrivate::KeyEvent * e = new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, t, k, mods, text, autorep, count); QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); @@ -126,6 +145,10 @@ void QWindowSystemInterface::handleWheelEvent(QWidget *w, const QPoint & local, void QWindowSystemInterface::handleWheelEvent(QWidget *tlw, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) { + QWidgetData *data = qt_qwidget_data(tlw); + if (data->in_destructor) + tlw = 0; + QWindowSystemInterfacePrivate::WheelEvent *e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, d, o); QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); -- cgit v0.12 From 136c32ddb97a12eefcbbfebf63075237c07d4cd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 3 Sep 2010 12:53:14 +0200 Subject: Lighthouse: Added QDirectFbGlContext This is untested since I have no HW to test on, but its in the public api, so that we have something to build on. --- src/plugins/platforms/directfb/directfb.pro | 6 ++- .../platforms/directfb/qdirectfbglcontext.cpp | 58 ++++++++++++++++++++++ .../platforms/directfb/qdirectfbglcontext.h | 28 +++++++++++ src/plugins/platforms/directfb/qdirectfbwindow.cpp | 23 ++++++++- src/plugins/platforms/directfb/qdirectfbwindow.h | 3 ++ 5 files changed, 115 insertions(+), 3 deletions(-) create mode 100644 src/plugins/platforms/directfb/qdirectfbglcontext.cpp create mode 100644 src/plugins/platforms/directfb/qdirectfbglcontext.h diff --git a/src/plugins/platforms/directfb/directfb.pro b/src/plugins/platforms/directfb/directfb.pro index 48128fb..65c49e3 100644 --- a/src/plugins/platforms/directfb/directfb.pro +++ b/src/plugins/platforms/directfb/directfb.pro @@ -19,14 +19,16 @@ SOURCES = main.cpp \ qdirectfbconvenience.cpp \ qdirectfbinput.cpp \ qdirectfbcursor.cpp \ - qdirectfbwindow.cpp + qdirectfbwindow.cpp \ + qdirectfbglcontext.cpp HEADERS = qdirectfbintegration.h \ qdirectfbwindowsurface.h \ qdirectfbblitter.h \ qdirectfbconvenience.h \ qdirectfbinput.h \ qdirectfbcursor.h \ - qdirectfbwindow.h + qdirectfbwindow.h \ + qdirectfbglcontext.h include(../fontdatabases/genericunix/genericunix.pri) target.path += $$[QT_INSTALL_PLUGINS]/platforms diff --git a/src/plugins/platforms/directfb/qdirectfbglcontext.cpp b/src/plugins/platforms/directfb/qdirectfbglcontext.cpp new file mode 100644 index 0000000..fe96efe --- /dev/null +++ b/src/plugins/platforms/directfb/qdirectfbglcontext.cpp @@ -0,0 +1,58 @@ +#include "qdirectfbglcontext.h" + +#include + +#include + +QDirectFbGLContext::QDirectFbGLContext(IDirectFBGL *glContext) + : m_dfbGlContext(glContext) +{ + DFBResult result; + DFBGLAttributes glAttribs; + result = m_dfbGlContext->GetAttributes(glContext, &glAttribs); + if (result == DFB_OK) { + m_windowFormat.setDepthBufferSize(glAttribs.depth_size); + m_windowFormat.setStencilBufferSize(glAttribs.stencil_size); + + m_windowFormat.setRedBufferSize(glAttribs.red_size); + m_windowFormat.setGreenBufferSize(glAttribs.green_size); + m_windowFormat.setBlueBufferSize(glAttribs.blue_size); + m_windowFormat.setAlphaBufferSize(glAttribs.alpha_size); + + m_windowFormat.setAccumBufferSize(glAttribs.accum_red_size); + m_windowFormat.setAlpha(glAttribs.accum_alpha_size); + + m_windowFormat.setDoubleBuffer(glAttribs.double_buffer); + m_windowFormat.setStereo(glAttribs.stereo); + } +} + +void QDirectFbGLContext::makeCurrent() +{ + m_dfbGlContext->Lock(m_dfbGlContext); +} + +void QDirectFbGLContext::doneCurrent() +{ + m_dfbGlContext->Unlock(m_dfbGlContext); +} + +void *QDirectFbGLContext::getProcAddress(const QString &procName) +{ + void *proc; + DFBResult result = m_dfbGlContext->GetProcAddress(m_dfbGlContext,qPrintable(procName),&proc); + if (result == DFB_OK) + return proc; + return 0; +} + +void QDirectFbGLContext::swapBuffers() +{ +// m_dfbGlContext->Unlock(m_dfbGlContext); //maybe not in doneCurrent() + qDebug() << "Swap buffers"; +} + +QPlatformWindowFormat QDirectFbGLContext::platformWindowFormat() const +{ + return m_windowFormat; +} diff --git a/src/plugins/platforms/directfb/qdirectfbglcontext.h b/src/plugins/platforms/directfb/qdirectfbglcontext.h new file mode 100644 index 0000000..037587e --- /dev/null +++ b/src/plugins/platforms/directfb/qdirectfbglcontext.h @@ -0,0 +1,28 @@ +#ifndef QDIRECTFBGLCONTEXT_H +#define QDIRECTFBGLCONTEXT_H + +#include + +#include "qdirectfbconvenience.h" + +class QDirectFbGLContext : public QPlatformGLContext +{ +public: + explicit QDirectFbGLContext(IDirectFBGL *glContext); + + void makeCurrent(); + void doneCurrent(); + void swapBuffers(); + void *getProcAddress(const QString &procName); + + QPlatformWindowFormat platformWindowFormat() const; + + +private: + IDirectFBGL *m_dfbGlContext; + + QPlatformWindowFormat m_windowFormat; + +}; + +#endif // QDIRECTFBGLCONTEXT_H diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.cpp b/src/plugins/platforms/directfb/qdirectfbwindow.cpp index 30e6f5a..f82fbd6 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindow.cpp +++ b/src/plugins/platforms/directfb/qdirectfbwindow.cpp @@ -40,13 +40,14 @@ ****************************************************************************/ #include "qdirectfbwindow.h" #include "qdirectfbinput.h" +#include "qdirectfbglcontext.h" #include #include QDirectFbWindow::QDirectFbWindow(QWidget *tlw, QDirectFbInput *inputhandler) - : QPlatformWindow(tlw), m_inputHandler(inputhandler) + : QPlatformWindow(tlw), m_inputHandler(inputhandler), m_context(0) { IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); DFBDisplayLayerConfig layerConfig; @@ -155,3 +156,23 @@ WId QDirectFbWindow::winId() const m_dfbWindow->GetID(m_dfbWindow, &id); return WId(id); } + +QPlatformGLContext *QDirectFbWindow::glContext() const +{ + if (!m_context) { + IDirectFBSurface *surface; + DFBResult result = m_dfbWindow->GetSurface(m_dfbWindow,&surface); + if (result != DFB_OK) { + qWarning("could not retrieve surface in QDirectFbWindow::glContext()"); + return 0; + } + IDirectFBGL *gl; + result = surface->GetGL(surface,&gl); + if (result != DFB_OK) { + qWarning("could not retrieve IDirectFBGL in QDirectFbWindow::glContext()"); + return 0; + } + const_cast(this)->m_context = new QDirectFbGLContext(gl); + } + return m_context; +} diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.h b/src/plugins/platforms/directfb/qdirectfbwindow.h index b512afd..eaf5173 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindow.h +++ b/src/plugins/platforms/directfb/qdirectfbwindow.h @@ -65,10 +65,13 @@ public: void lower(); WId winId() const; + QPlatformGLContext *glContext() const; + private: IDirectFBWindow *m_dfbWindow; QDirectFbInput *m_inputHandler; + QPlatformGLContext *m_context; }; QT_END_NAMESPACE -- cgit v0.12 From fe97cdb508697140ebbba8d73097fdd9e5b44bf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Fri, 3 Sep 2010 13:30:12 +0200 Subject: Move the engine->string function into ImageItem. --- tests/arthur/baselineserver/src/baselineserver.cpp | 17 +---------------- tests/arthur/common/baselineprotocol.cpp | 15 +++++++++++++++ tests/arthur/common/baselineprotocol.h | 1 + 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp index 430d4af..ec5793f 100644 --- a/tests/arthur/baselineserver/src/baselineserver.cpp +++ b/tests/arthur/baselineserver/src/baselineserver.cpp @@ -196,7 +196,7 @@ QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline) + plat.qtVersion + QDir::separator(); if (isBaseline) { storePath += QLatin1String("baselines") + QDir::separator() - + engineForItem(item) + QDir::separator(); + + item.engineAsString() + QDir::separator(); } else { storePath += runId + QDir::separator(); } @@ -204,21 +204,6 @@ QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline) return storePath + item.scriptName + QLatin1Char('.'); } -QString BaselineHandler::engineForItem(const ImageItem &item) -{ - switch (item.engine) { - case ImageItem::Raster: - return QLatin1String("Raster"); - break; - case ImageItem::OpenGL: - return QLatin1String("OpenGL"); - break; - default: - break; - } - return QLatin1String("Unknown"); -} - QString BaselineHandler::computeMismatchScore(const QImage &baseline, const QImage &rendered) { if (baseline.size() != rendered.size() || baseline.format() != rendered.format()) diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp index a6306b9..881c9cc 100644 --- a/tests/arthur/common/baselineprotocol.cpp +++ b/tests/arthur/common/baselineprotocol.cpp @@ -44,6 +44,21 @@ quint64 ImageItem::computeChecksum(const QImage &image) return qChecksum((const char *)image.constScanLine(50), image.bytesPerLine()); } +QString ImageItem::engineAsString() +{ + switch (engine) { + case Raster: + return QLatin1String("Raster"); + break; + case OpenGL: + return QLatin1String("OpenGL"); + break; + default: + break; + } + return QLatin1String("Unknown"); +} + QDataStream & operator<< (QDataStream &stream, const ImageItem &ii) { stream << ii.scriptName << ii.scriptChecksum << quint8(ii.status) << quint8(ii.renderFormat) diff --git a/tests/arthur/common/baselineprotocol.h b/tests/arthur/common/baselineprotocol.h index 749b623..70cb227 100644 --- a/tests/arthur/common/baselineprotocol.h +++ b/tests/arthur/common/baselineprotocol.h @@ -31,6 +31,7 @@ public: {} ImageItem &operator=(const ImageItem &other); static quint64 computeChecksum(const QImage& image); + QString engineAsString(); enum ItemStatus { Ok = 0, -- cgit v0.12 From 22293fb1c19e7ff7c8f3bec8c97729fb2816c96d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Fri, 3 Sep 2010 13:35:58 +0200 Subject: engineAsString() should've been const. --- tests/arthur/common/baselineprotocol.cpp | 2 +- tests/arthur/common/baselineprotocol.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp index 881c9cc..790b749 100644 --- a/tests/arthur/common/baselineprotocol.cpp +++ b/tests/arthur/common/baselineprotocol.cpp @@ -44,7 +44,7 @@ quint64 ImageItem::computeChecksum(const QImage &image) return qChecksum((const char *)image.constScanLine(50), image.bytesPerLine()); } -QString ImageItem::engineAsString() +QString ImageItem::engineAsString() const { switch (engine) { case Raster: diff --git a/tests/arthur/common/baselineprotocol.h b/tests/arthur/common/baselineprotocol.h index 70cb227..9ec1ef4 100644 --- a/tests/arthur/common/baselineprotocol.h +++ b/tests/arthur/common/baselineprotocol.h @@ -31,7 +31,7 @@ public: {} ImageItem &operator=(const ImageItem &other); static quint64 computeChecksum(const QImage& image); - QString engineAsString(); + QString engineAsString() const; enum ItemStatus { Ok = 0, -- cgit v0.12 From 5322e029863f0085c5cd58f8241d34be22231d27 Mon Sep 17 00:00:00 2001 From: aavit Date: Fri, 3 Sep 2010 14:58:30 +0200 Subject: Proper checksum function implemented --- tests/arthur/common/baselineprotocol.cpp | 32 +- tests/arthur/common/baselineprotocol.pri | 3 +- tests/arthur/common/lookup3.cpp | 745 +++++++++++++++++++++++++++++++ 3 files changed, 777 insertions(+), 3 deletions(-) create mode 100644 tests/arthur/common/lookup3.cpp diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp index a6306b9..f2b719f 100644 --- a/tests/arthur/common/baselineprotocol.cpp +++ b/tests/arthur/common/baselineprotocol.cpp @@ -38,10 +38,38 @@ ImageItem &ImageItem::operator=(const ImageItem &other) return *this; } +// Defined in lookup3.c: +void hashword2 ( +const quint32 *k, /* the key, an array of quint32 values */ +size_t length, /* the length of the key, in quint32s */ +quint32 *pc, /* IN: seed OUT: primary hash value */ +quint32 *pb); /* IN: more seed OUT: secondary hash value */ + quint64 ImageItem::computeChecksum(const QImage &image) { - //### Just fake it for now - return qChecksum((const char *)image.constScanLine(50), image.bytesPerLine()); + quint32 h1 = 0xfeedbacc; + quint32 h2 = 0x21604894; + + QImage img(image); + const int bpl = img.bytesPerLine(); + const int padBytes = bpl - (img.width() * img.depth() / 8); + if (padBytes) { + uchar *p = img.bits() + bpl - padBytes; + const int h = img.height(); + for (int y = 0; y < h; ++y) { + qMemSet(p, 0, padBytes); + p += bpl; + } + } + if (img.format() == QImage::Format_RGB32) { // Thank you, Haavard + quint32 *p = (quint32 *)img.bits(); + const quint32 *end = p + (img.byteCount()/4); + while (p + +#if Q_BYTE_ORDER == Q_BIG_ENDIAN +# define HASH_LITTLE_ENDIAN 0 +# define HASH_BIG_ENDIAN 1 +#else +# define HASH_LITTLE_ENDIAN 1 +# define HASH_BIG_ENDIAN 0 +#endif + +#define hashsize(n) ((quint32)1<<(n)) +#define hashmask(n) (hashsize(n)-1) +#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) + +/* +------------------------------------------------------------------------------- +mix -- mix 3 32-bit values reversibly. + +This is reversible, so any information in (a,b,c) before mix() is +still in (a,b,c) after mix(). + +If four pairs of (a,b,c) inputs are run through mix(), or through +mix() in reverse, there are at least 32 bits of the output that +are sometimes the same for one pair and different for another pair. +This was tested for: +* pairs that differed by one bit, by two bits, in any combination + of top bits of (a,b,c), or in any combination of bottom bits of + (a,b,c). +* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed + the output delta to a Gray code (a^(a>>1)) so a string of 1's (as + is commonly produced by subtraction) look like a single 1-bit + difference. +* the base values were pseudorandom, all zero but one bit set, or + all zero plus a counter that starts at zero. + +Some k values for my "a-=c; a^=rot(c,k); c+=b;" arrangement that +satisfy this are + 4 6 8 16 19 4 + 9 15 3 18 27 15 + 14 9 3 7 17 3 +Well, "9 15 3 18 27 15" didn't quite get 32 bits diffing +for "differ" defined as + with a one-bit base and a two-bit delta. I +used http://burtleburtle.net/bob/hash/avalanche.html to choose +the operations, constants, and arrangements of the variables. + +This does not achieve avalanche. There are input bits of (a,b,c) +that fail to affect some output bits of (a,b,c), especially of a. The +most thoroughly mixed value is c, but it doesn't really even achieve +avalanche in c. + +This allows some parallelism. Read-after-writes are good at doubling +the number of bits affected, so the goal of mixing pulls in the opposite +direction as the goal of parallelism. I did what I could. Rotates +seem to cost as much as shifts on every machine I could lay my hands +on, and rotates are much kinder to the top and bottom bits, so I used +rotates. +------------------------------------------------------------------------------- +*/ +#define mix(a,b,c) \ +{ \ + a -= c; a ^= rot(c, 4); c += b; \ + b -= a; b ^= rot(a, 6); a += c; \ + c -= b; c ^= rot(b, 8); b += a; \ + a -= c; a ^= rot(c,16); c += b; \ + b -= a; b ^= rot(a,19); a += c; \ + c -= b; c ^= rot(b, 4); b += a; \ +} + +/* +------------------------------------------------------------------------------- +final -- final mixing of 3 32-bit values (a,b,c) into c + +Pairs of (a,b,c) values differing in only a few bits will usually +produce values of c that look totally different. This was tested for +* pairs that differed by one bit, by two bits, in any combination + of top bits of (a,b,c), or in any combination of bottom bits of + (a,b,c). +* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed + the output delta to a Gray code (a^(a>>1)) so a string of 1's (as + is commonly produced by subtraction) look like a single 1-bit + difference. +* the base values were pseudorandom, all zero but one bit set, or + all zero plus a counter that starts at zero. + +These constants passed: + 14 11 25 16 4 14 24 + 12 14 25 16 4 14 24 +and these came close: + 4 8 15 26 3 22 24 + 10 8 15 26 3 22 24 + 11 8 15 26 3 22 24 +------------------------------------------------------------------------------- +*/ +#define final(a,b,c) \ +{ \ + c ^= b; c -= rot(b,14); \ + a ^= c; a -= rot(c,11); \ + b ^= a; b -= rot(a,25); \ + c ^= b; c -= rot(b,16); \ + a ^= c; a -= rot(c,4); \ + b ^= a; b -= rot(a,14); \ + c ^= b; c -= rot(b,24); \ +} + +/* +-------------------------------------------------------------------- + This works on all machines. To be useful, it requires + -- that the key be an array of quint32's, and + -- that the length be the number of quint32's in the key + + The function hashword() is identical to hashlittle() on little-endian + machines, and identical to hashbig() on big-endian machines, + except that the length has to be measured in quint32s rather than in + bytes. hashlittle() is more complicated than hashword() only because + hashlittle() has to dance around fitting the key bytes into registers. +-------------------------------------------------------------------- +*/ +quint32 hashword( +const quint32 *k, /* the key, an array of quint32 values */ +size_t length, /* the length of the key, in quint32s */ +quint32 initval) /* the previous hash, or an arbitrary value */ +{ + quint32 a,b,c; + + /* Set up the internal state */ + a = b = c = 0xdeadbeef + (((quint32)length)<<2) + initval; + + /*------------------------------------------------- handle most of the key */ + while (length > 3) + { + a += k[0]; + b += k[1]; + c += k[2]; + mix(a,b,c); + length -= 3; + k += 3; + } + + /*------------------------------------------- handle the last 3 quint32's */ + switch(length) /* all the case statements fall through */ + { + case 3 : c+=k[2]; + case 2 : b+=k[1]; + case 1 : a+=k[0]; + final(a,b,c); + case 0: /* case 0: nothing left to add */ + break; + } + /*------------------------------------------------------ report the result */ + return c; +} + + +/* +-------------------------------------------------------------------- +hashword2() -- same as hashword(), but take two seeds and return two +32-bit values. pc and pb must both be nonnull, and *pc and *pb must +both be initialized with seeds. If you pass in (*pb)==0, the output +(*pc) will be the same as the return value from hashword(). +-------------------------------------------------------------------- +*/ +void hashword2 ( +const quint32 *k, /* the key, an array of quint32 values */ +size_t length, /* the length of the key, in quint32s */ +quint32 *pc, /* IN: seed OUT: primary hash value */ +quint32 *pb) /* IN: more seed OUT: secondary hash value */ +{ + quint32 a,b,c; + + /* Set up the internal state */ + a = b = c = 0xdeadbeef + ((quint32)(length<<2)) + *pc; + c += *pb; + + /*------------------------------------------------- handle most of the key */ + while (length > 3) + { + a += k[0]; + b += k[1]; + c += k[2]; + mix(a,b,c); + length -= 3; + k += 3; + } + + /*------------------------------------------- handle the last 3 quint32's */ + switch(length) /* all the case statements fall through */ + { + case 3 : c+=k[2]; + case 2 : b+=k[1]; + case 1 : a+=k[0]; + final(a,b,c); + case 0: /* case 0: nothing left to add */ + break; + } + /*------------------------------------------------------ report the result */ + *pc=c; *pb=b; +} + + +/* +------------------------------------------------------------------------------- +hashlittle() -- hash a variable-length key into a 32-bit value + k : the key (the unaligned variable-length array of bytes) + length : the length of the key, counting by bytes + initval : can be any 4-byte value +Returns a 32-bit value. Every bit of the key affects every bit of +the return value. Two keys differing by one or two bits will have +totally different hash values. + +The best hash table sizes are powers of 2. There is no need to do +mod a prime (mod is sooo slow!). If you need less than 32 bits, +use a bitmask. For example, if you need only 10 bits, do + h = (h & hashmask(10)); +In which case, the hash table should have hashsize(10) elements. + +If you are hashing n strings (quint8 **)k, do it like this: + for (i=0, h=0; i 12) + { + a += k[0]; + b += k[1]; + c += k[2]; + mix(a,b,c); + length -= 12; + k += 3; + } + + /*----------------------------- handle the last (probably partial) block */ + /* + * "k[2]&0xffffff" actually reads beyond the end of the string, but + * then masks off the part it's not allowed to read. Because the + * string is aligned, the masked-off tail is in the same word as the + * rest of the string. Every machine with memory protection I've seen + * does it on word boundaries, so is OK with this. But VALGRIND will + * still catch it and complain. The masking trick does make the hash + * noticably faster for short strings (like English words). + */ +#ifndef VALGRIND + + switch(length) + { + case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; + case 11: c+=k[2]&0xffffff; b+=k[1]; a+=k[0]; break; + case 10: c+=k[2]&0xffff; b+=k[1]; a+=k[0]; break; + case 9 : c+=k[2]&0xff; b+=k[1]; a+=k[0]; break; + case 8 : b+=k[1]; a+=k[0]; break; + case 7 : b+=k[1]&0xffffff; a+=k[0]; break; + case 6 : b+=k[1]&0xffff; a+=k[0]; break; + case 5 : b+=k[1]&0xff; a+=k[0]; break; + case 4 : a+=k[0]; break; + case 3 : a+=k[0]&0xffffff; break; + case 2 : a+=k[0]&0xffff; break; + case 1 : a+=k[0]&0xff; break; + case 0 : return c; /* zero length strings require no mixing */ + } + +#else /* make valgrind happy */ + + const quint8 *k8 = (const quint8 *)k; + switch(length) + { + case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; + case 11: c+=((quint32)k8[10])<<16; /* fall through */ + case 10: c+=((quint32)k8[9])<<8; /* fall through */ + case 9 : c+=k8[8]; /* fall through */ + case 8 : b+=k[1]; a+=k[0]; break; + case 7 : b+=((quint32)k8[6])<<16; /* fall through */ + case 6 : b+=((quint32)k8[5])<<8; /* fall through */ + case 5 : b+=k8[4]; /* fall through */ + case 4 : a+=k[0]; break; + case 3 : a+=((quint32)k8[2])<<16; /* fall through */ + case 2 : a+=((quint32)k8[1])<<8; /* fall through */ + case 1 : a+=k8[0]; break; + case 0 : return c; + } + +#endif /* !valgrind */ + + } else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) { + const quint16 *k = (const quint16 *)key; /* read 16-bit chunks */ + const quint8 *k8; + + /*--------------- all but last block: aligned reads and different mixing */ + while (length > 12) + { + a += k[0] + (((quint32)k[1])<<16); + b += k[2] + (((quint32)k[3])<<16); + c += k[4] + (((quint32)k[5])<<16); + mix(a,b,c); + length -= 12; + k += 6; + } + + /*----------------------------- handle the last (probably partial) block */ + k8 = (const quint8 *)k; + switch(length) + { + case 12: c+=k[4]+(((quint32)k[5])<<16); + b+=k[2]+(((quint32)k[3])<<16); + a+=k[0]+(((quint32)k[1])<<16); + break; + case 11: c+=((quint32)k8[10])<<16; /* fall through */ + case 10: c+=k[4]; + b+=k[2]+(((quint32)k[3])<<16); + a+=k[0]+(((quint32)k[1])<<16); + break; + case 9 : c+=k8[8]; /* fall through */ + case 8 : b+=k[2]+(((quint32)k[3])<<16); + a+=k[0]+(((quint32)k[1])<<16); + break; + case 7 : b+=((quint32)k8[6])<<16; /* fall through */ + case 6 : b+=k[2]; + a+=k[0]+(((quint32)k[1])<<16); + break; + case 5 : b+=k8[4]; /* fall through */ + case 4 : a+=k[0]+(((quint32)k[1])<<16); + break; + case 3 : a+=((quint32)k8[2])<<16; /* fall through */ + case 2 : a+=k[0]; + break; + case 1 : a+=k8[0]; + break; + case 0 : return c; /* zero length requires no mixing */ + } + + } else { /* need to read the key one byte at a time */ + const quint8 *k = (const quint8 *)key; + + /*--------------- all but the last block: affect some 32 bits of (a,b,c) */ + while (length > 12) + { + a += k[0]; + a += ((quint32)k[1])<<8; + a += ((quint32)k[2])<<16; + a += ((quint32)k[3])<<24; + b += k[4]; + b += ((quint32)k[5])<<8; + b += ((quint32)k[6])<<16; + b += ((quint32)k[7])<<24; + c += k[8]; + c += ((quint32)k[9])<<8; + c += ((quint32)k[10])<<16; + c += ((quint32)k[11])<<24; + mix(a,b,c); + length -= 12; + k += 12; + } + + /*-------------------------------- last block: affect all 32 bits of (c) */ + switch(length) /* all the case statements fall through */ + { + case 12: c+=((quint32)k[11])<<24; + case 11: c+=((quint32)k[10])<<16; + case 10: c+=((quint32)k[9])<<8; + case 9 : c+=k[8]; + case 8 : b+=((quint32)k[7])<<24; + case 7 : b+=((quint32)k[6])<<16; + case 6 : b+=((quint32)k[5])<<8; + case 5 : b+=k[4]; + case 4 : a+=((quint32)k[3])<<24; + case 3 : a+=((quint32)k[2])<<16; + case 2 : a+=((quint32)k[1])<<8; + case 1 : a+=k[0]; + break; + case 0 : return c; + } + } + + final(a,b,c); + return c; +} + + +/* + * hashlittle2: return 2 32-bit hash values + * + * This is identical to hashlittle(), except it returns two 32-bit hash + * values instead of just one. This is good enough for hash table + * lookup with 2^^64 buckets, or if you want a second hash if you're not + * happy with the first, or if you want a probably-unique 64-bit ID for + * the key. *pc is better mixed than *pb, so use *pc first. If you want + * a 64-bit value do something like "*pc + (((uint64_t)*pb)<<32)". + */ +void hashlittle2( + const void *key, /* the key to hash */ + size_t length, /* length of the key */ + quint32 *pc, /* IN: primary initval, OUT: primary hash */ + quint32 *pb) /* IN: secondary initval, OUT: secondary hash */ +{ + quint32 a,b,c; /* internal state */ + union { const void *ptr; size_t i; } u; /* needed for Mac Powerbook G4 */ + + /* Set up the internal state */ + a = b = c = 0xdeadbeef + ((quint32)length) + *pc; + c += *pb; + + u.ptr = key; + if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) { + const quint32 *k = (const quint32 *)key; /* read 32-bit chunks */ + + /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */ + while (length > 12) + { + a += k[0]; + b += k[1]; + c += k[2]; + mix(a,b,c); + length -= 12; + k += 3; + } + + /*----------------------------- handle the last (probably partial) block */ + /* + * "k[2]&0xffffff" actually reads beyond the end of the string, but + * then masks off the part it's not allowed to read. Because the + * string is aligned, the masked-off tail is in the same word as the + * rest of the string. Every machine with memory protection I've seen + * does it on word boundaries, so is OK with this. But VALGRIND will + * still catch it and complain. The masking trick does make the hash + * noticably faster for short strings (like English words). + */ +#ifndef VALGRIND + + switch(length) + { + case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; + case 11: c+=k[2]&0xffffff; b+=k[1]; a+=k[0]; break; + case 10: c+=k[2]&0xffff; b+=k[1]; a+=k[0]; break; + case 9 : c+=k[2]&0xff; b+=k[1]; a+=k[0]; break; + case 8 : b+=k[1]; a+=k[0]; break; + case 7 : b+=k[1]&0xffffff; a+=k[0]; break; + case 6 : b+=k[1]&0xffff; a+=k[0]; break; + case 5 : b+=k[1]&0xff; a+=k[0]; break; + case 4 : a+=k[0]; break; + case 3 : a+=k[0]&0xffffff; break; + case 2 : a+=k[0]&0xffff; break; + case 1 : a+=k[0]&0xff; break; + case 0 : *pc=c; *pb=b; return; /* zero length strings require no mixing */ + } + +#else /* make valgrind happy */ + + const quint8 *k8 = (const quint8 *)k; + switch(length) + { + case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; + case 11: c+=((quint32)k8[10])<<16; /* fall through */ + case 10: c+=((quint32)k8[9])<<8; /* fall through */ + case 9 : c+=k8[8]; /* fall through */ + case 8 : b+=k[1]; a+=k[0]; break; + case 7 : b+=((quint32)k8[6])<<16; /* fall through */ + case 6 : b+=((quint32)k8[5])<<8; /* fall through */ + case 5 : b+=k8[4]; /* fall through */ + case 4 : a+=k[0]; break; + case 3 : a+=((quint32)k8[2])<<16; /* fall through */ + case 2 : a+=((quint32)k8[1])<<8; /* fall through */ + case 1 : a+=k8[0]; break; + case 0 : *pc=c; *pb=b; return; /* zero length strings require no mixing */ + } + +#endif /* !valgrind */ + + } else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) { + const quint16 *k = (const quint16 *)key; /* read 16-bit chunks */ + const quint8 *k8; + + /*--------------- all but last block: aligned reads and different mixing */ + while (length > 12) + { + a += k[0] + (((quint32)k[1])<<16); + b += k[2] + (((quint32)k[3])<<16); + c += k[4] + (((quint32)k[5])<<16); + mix(a,b,c); + length -= 12; + k += 6; + } + + /*----------------------------- handle the last (probably partial) block */ + k8 = (const quint8 *)k; + switch(length) + { + case 12: c+=k[4]+(((quint32)k[5])<<16); + b+=k[2]+(((quint32)k[3])<<16); + a+=k[0]+(((quint32)k[1])<<16); + break; + case 11: c+=((quint32)k8[10])<<16; /* fall through */ + case 10: c+=k[4]; + b+=k[2]+(((quint32)k[3])<<16); + a+=k[0]+(((quint32)k[1])<<16); + break; + case 9 : c+=k8[8]; /* fall through */ + case 8 : b+=k[2]+(((quint32)k[3])<<16); + a+=k[0]+(((quint32)k[1])<<16); + break; + case 7 : b+=((quint32)k8[6])<<16; /* fall through */ + case 6 : b+=k[2]; + a+=k[0]+(((quint32)k[1])<<16); + break; + case 5 : b+=k8[4]; /* fall through */ + case 4 : a+=k[0]+(((quint32)k[1])<<16); + break; + case 3 : a+=((quint32)k8[2])<<16; /* fall through */ + case 2 : a+=k[0]; + break; + case 1 : a+=k8[0]; + break; + case 0 : *pc=c; *pb=b; return; /* zero length strings require no mixing */ + } + + } else { /* need to read the key one byte at a time */ + const quint8 *k = (const quint8 *)key; + + /*--------------- all but the last block: affect some 32 bits of (a,b,c) */ + while (length > 12) + { + a += k[0]; + a += ((quint32)k[1])<<8; + a += ((quint32)k[2])<<16; + a += ((quint32)k[3])<<24; + b += k[4]; + b += ((quint32)k[5])<<8; + b += ((quint32)k[6])<<16; + b += ((quint32)k[7])<<24; + c += k[8]; + c += ((quint32)k[9])<<8; + c += ((quint32)k[10])<<16; + c += ((quint32)k[11])<<24; + mix(a,b,c); + length -= 12; + k += 12; + } + + /*-------------------------------- last block: affect all 32 bits of (c) */ + switch(length) /* all the case statements fall through */ + { + case 12: c+=((quint32)k[11])<<24; + case 11: c+=((quint32)k[10])<<16; + case 10: c+=((quint32)k[9])<<8; + case 9 : c+=k[8]; + case 8 : b+=((quint32)k[7])<<24; + case 7 : b+=((quint32)k[6])<<16; + case 6 : b+=((quint32)k[5])<<8; + case 5 : b+=k[4]; + case 4 : a+=((quint32)k[3])<<24; + case 3 : a+=((quint32)k[2])<<16; + case 2 : a+=((quint32)k[1])<<8; + case 1 : a+=k[0]; + break; + case 0 : *pc=c; *pb=b; return; /* zero length strings require no mixing */ + } + } + + final(a,b,c); + *pc=c; *pb=b; +} + + + +/* + * hashbig(): + * This is the same as hashword() on big-endian machines. It is different + * from hashlittle() on all machines. hashbig() takes advantage of + * big-endian byte ordering. + */ +quint32 hashbig( const void *key, size_t length, quint32 initval) +{ + quint32 a,b,c; + union { const void *ptr; size_t i; } u; /* to cast key to (size_t) happily */ + + /* Set up the internal state */ + a = b = c = 0xdeadbeef + ((quint32)length) + initval; + + u.ptr = key; + if (HASH_BIG_ENDIAN && ((u.i & 0x3) == 0)) { + const quint32 *k = (const quint32 *)key; /* read 32-bit chunks */ + + /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */ + while (length > 12) + { + a += k[0]; + b += k[1]; + c += k[2]; + mix(a,b,c); + length -= 12; + k += 3; + } + + /*----------------------------- handle the last (probably partial) block */ + /* + * "k[2]<<8" actually reads beyond the end of the string, but + * then shifts out the part it's not allowed to read. Because the + * string is aligned, the illegal read is in the same word as the + * rest of the string. Every machine with memory protection I've seen + * does it on word boundaries, so is OK with this. But VALGRIND will + * still catch it and complain. The masking trick does make the hash + * noticably faster for short strings (like English words). + */ +#ifndef VALGRIND + + switch(length) + { + case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; + case 11: c+=k[2]&0xffffff00; b+=k[1]; a+=k[0]; break; + case 10: c+=k[2]&0xffff0000; b+=k[1]; a+=k[0]; break; + case 9 : c+=k[2]&0xff000000; b+=k[1]; a+=k[0]; break; + case 8 : b+=k[1]; a+=k[0]; break; + case 7 : b+=k[1]&0xffffff00; a+=k[0]; break; + case 6 : b+=k[1]&0xffff0000; a+=k[0]; break; + case 5 : b+=k[1]&0xff000000; a+=k[0]; break; + case 4 : a+=k[0]; break; + case 3 : a+=k[0]&0xffffff00; break; + case 2 : a+=k[0]&0xffff0000; break; + case 1 : a+=k[0]&0xff000000; break; + case 0 : return c; /* zero length strings require no mixing */ + } + +#else /* make valgrind happy */ + + const quint8 *k8 = (const quint8 *)k; + switch(length) /* all the case statements fall through */ + { + case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; + case 11: c+=((quint32)k8[10])<<8; /* fall through */ + case 10: c+=((quint32)k8[9])<<16; /* fall through */ + case 9 : c+=((quint32)k8[8])<<24; /* fall through */ + case 8 : b+=k[1]; a+=k[0]; break; + case 7 : b+=((quint32)k8[6])<<8; /* fall through */ + case 6 : b+=((quint32)k8[5])<<16; /* fall through */ + case 5 : b+=((quint32)k8[4])<<24; /* fall through */ + case 4 : a+=k[0]; break; + case 3 : a+=((quint32)k8[2])<<8; /* fall through */ + case 2 : a+=((quint32)k8[1])<<16; /* fall through */ + case 1 : a+=((quint32)k8[0])<<24; break; + case 0 : return c; + } + +#endif /* !VALGRIND */ + + } else { /* need to read the key one byte at a time */ + const quint8 *k = (const quint8 *)key; + + /*--------------- all but the last block: affect some 32 bits of (a,b,c) */ + while (length > 12) + { + a += ((quint32)k[0])<<24; + a += ((quint32)k[1])<<16; + a += ((quint32)k[2])<<8; + a += ((quint32)k[3]); + b += ((quint32)k[4])<<24; + b += ((quint32)k[5])<<16; + b += ((quint32)k[6])<<8; + b += ((quint32)k[7]); + c += ((quint32)k[8])<<24; + c += ((quint32)k[9])<<16; + c += ((quint32)k[10])<<8; + c += ((quint32)k[11]); + mix(a,b,c); + length -= 12; + k += 12; + } + + /*-------------------------------- last block: affect all 32 bits of (c) */ + switch(length) /* all the case statements fall through */ + { + case 12: c+=k[11]; + case 11: c+=((quint32)k[10])<<8; + case 10: c+=((quint32)k[9])<<16; + case 9 : c+=((quint32)k[8])<<24; + case 8 : b+=k[7]; + case 7 : b+=((quint32)k[6])<<8; + case 6 : b+=((quint32)k[5])<<16; + case 5 : b+=((quint32)k[4])<<24; + case 4 : a+=k[3]; + case 3 : a+=((quint32)k[2])<<8; + case 2 : a+=((quint32)k[1])<<16; + case 1 : a+=((quint32)k[0])<<24; + break; + case 0 : return c; + } + } + + final(a,b,c); + return c; +} -- cgit v0.12 From cbbca7d2e30e7bb5411b9c7d89feaf6eae54af7e Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 6 Sep 2010 10:27:34 +0200 Subject: Switch to 32 bits per pixel --- src/plugins/platforms/eglfs/qeglfsscreen.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp index 0d72862..1b64e7e 100644 --- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp +++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE +//#define QEGL_EXTRA_DEBUG + #ifdef QEGL_EXTRA_DEBUG struct AttrInfo { EGLint attr; const char *name; }; static struct AttrInfo attrs[] = { @@ -84,7 +86,7 @@ static struct AttrInfo attrs[] = { #endif //QEGL_EXTRA_DEBUG QEglFSScreen::QEglFSScreen(EGLNativeDisplayType display) - : m_depth(16), m_format(QImage::Format_RGB16), m_platformContext(0) + : m_depth(32), m_format(QImage::Format_ARGB32_Premultiplied), m_platformContext(0) { #ifdef QEGL_EXTRA_DEBUG qWarning("QEglScreen %p\n", this); @@ -114,11 +116,11 @@ QEglFSScreen::QEglFSScreen(EGLNativeDisplayType display) qWarning("Initialized display %d %d\n", major, minor); QPlatformWindowFormat platformFormat; - platformFormat.setDepth(16); + platformFormat.setDepth(32); platformFormat.setWindowApi(QPlatformWindowFormat::OpenGL); - platformFormat.setRedBufferSize(5); - platformFormat.setGreenBufferSize(6); - platformFormat.setBlueBufferSize(5); + platformFormat.setRedBufferSize(8); + platformFormat.setGreenBufferSize(8); + platformFormat.setBlueBufferSize(8); EGLConfig config = q_configFromQPlatformWindowFormat(m_dpy, platformFormat); EGLNativeWindowType eglWindow = 0; -- cgit v0.12 From e800ada8fea5b3f5858574696b373959a8e15b43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Mon, 6 Sep 2010 14:14:59 +0200 Subject: We only want to test hw accelerated GL 2.0 implementations. --- tests/auto/lancelot/tst_lancelot.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index 7381c1d..23a5c94 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -175,7 +175,14 @@ void tst_Lancelot::testOpenGL_data() void tst_Lancelot::testOpenGL() { - runTestSuite(); + QGLWidget glWidget; + if (glWidget.isValid() && glWidget.format().directRendering() + && (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0)) + { + runTestSuite(); + } else { + QSKIP("System under test does not meet preconditions for GL testing. Skipping.", SkipAll); + } } -- cgit v0.12 From c5fe294667d9d8dfcec5c9529185a13ba5a47e91 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 6 Sep 2010 14:53:51 +0200 Subject: Send mouse release events for touch screens --- src/plugins/generic/linuxinput/qlinuxinput.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/generic/linuxinput/qlinuxinput.cpp b/src/plugins/generic/linuxinput/qlinuxinput.cpp index 32137ee..955aed9 100644 --- a/src/plugins/generic/linuxinput/qlinuxinput.cpp +++ b/src/plugins/generic/linuxinput/qlinuxinput.cpp @@ -155,6 +155,9 @@ void QLinuxInputMouseHandler::readMouseData() } } else if (data->type == EV_KEY && data->code == BTN_TOUCH) { m_buttons = data->value ? Qt::LeftButton : Qt::NoButton; + + QWindowSystemInterface::handleMouseEvent(0, QPoint(m_x, m_y), + QPoint(m_x, m_y), m_buttons); } else if (data->type == EV_KEY) { Qt::MouseButton button = Qt::NoButton; switch (data->code) { -- cgit v0.12 From 04f0d0064eb5bb42123e1519df6073c3b09442ec Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 6 Sep 2010 14:53:51 +0200 Subject: Send mouse release events for touch screens --- src/plugins/generic/linuxinput/qlinuxinput.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/generic/linuxinput/qlinuxinput.cpp b/src/plugins/generic/linuxinput/qlinuxinput.cpp index 32137ee..955aed9 100644 --- a/src/plugins/generic/linuxinput/qlinuxinput.cpp +++ b/src/plugins/generic/linuxinput/qlinuxinput.cpp @@ -155,6 +155,9 @@ void QLinuxInputMouseHandler::readMouseData() } } else if (data->type == EV_KEY && data->code == BTN_TOUCH) { m_buttons = data->value ? Qt::LeftButton : Qt::NoButton; + + QWindowSystemInterface::handleMouseEvent(0, QPoint(m_x, m_y), + QPoint(m_x, m_y), m_buttons); } else if (data->type == EV_KEY) { Qt::MouseButton button = Qt::NoButton; switch (data->code) { -- cgit v0.12 From c142da9f1573738bb0c9e4c728bab4b3c2c8f438 Mon Sep 17 00:00:00 2001 From: aavit Date: Tue, 7 Sep 2010 10:22:12 +0200 Subject: Minor style improvements --- tests/arthur/common/baselineprotocol.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp index 7a423d2..24b5b8c 100644 --- a/tests/arthur/common/baselineprotocol.cpp +++ b/tests/arthur/common/baselineprotocol.cpp @@ -1,4 +1,3 @@ - #include "baselineprotocol.h" #include #include @@ -40,16 +39,13 @@ ImageItem &ImageItem::operator=(const ImageItem &other) // Defined in lookup3.c: void hashword2 ( -const quint32 *k, /* the key, an array of quint32 values */ -size_t length, /* the length of the key, in quint32s */ -quint32 *pc, /* IN: seed OUT: primary hash value */ -quint32 *pb); /* IN: more seed OUT: secondary hash value */ +const quint32 *k, /* the key, an array of quint32 values */ +size_t length, /* the length of the key, in quint32s */ +quint32 *pc, /* IN: seed OUT: primary hash value */ +quint32 *pb); /* IN: more seed OUT: secondary hash value */ quint64 ImageItem::computeChecksum(const QImage &image) { - quint32 h1 = 0xfeedbacc; - quint32 h2 = 0x21604894; - QImage img(image); const int bpl = img.bytesPerLine(); const int padBytes = bpl - (img.width() * img.depth() / 8); @@ -68,6 +64,8 @@ quint64 ImageItem::computeChecksum(const QImage &image) *p++ &= RGB_MASK; } + quint32 h1 = 0xfeedbacc; + quint32 h2 = 0x21604894; hashword2((const quint32 *)img.constBits(), img.byteCount()/4, &h1, &h2); return (quint64(h1) << 32) | h2; } -- cgit v0.12 From b146492b9319c80bde174f1a188ece89963eae3a Mon Sep 17 00:00:00 2001 From: aavit Date: Tue, 7 Sep 2010 11:50:03 +0200 Subject: Avoid testing on Mesa --- tests/auto/lancelot/tst_lancelot.cpp | 82 +++++++++++++++++++++--------------- 1 file changed, 48 insertions(+), 34 deletions(-) diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index 23a5c94..c968473 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -70,6 +70,7 @@ private: void paint(QPaintDevice *device, const QStringList &script, const QString &filePath); QStringList loadScriptFile(const QString &filePath); void runTestSuite(); + bool setupTestSuite(ImageItem::GraphicsEngine engine, QImage::Format format, const QStringList& blacklist); BaselineProtocol proto; ImageItemList baseList; @@ -80,6 +81,8 @@ private slots: void testRasterARGB32PM_data(); void testRasterARGB32PM(); + void testRasterRGB32_data(); + void testRasterRGB32(); void testOpenGL_data(); void testOpenGL(); @@ -122,28 +125,27 @@ void tst_Lancelot::initTestCase() void tst_Lancelot::testRasterARGB32PM_data() { - QTest::addColumn("baseline"); + QStringList localBlacklist = QStringList() << QLatin1String("sizes.qps"); + if (!setupTestSuite(ImageItem::Raster, QImage::Format_ARGB32_Premultiplied, localBlacklist)) + QSKIP("Communication with baseline image server failed.", SkipAll); +} - ImageItemList itemList(baseList); - for(ImageItemList::iterator it = itemList.begin(); it != itemList.end(); it++) { - it->engine = ImageItem::Raster; - it->renderFormat = QImage::Format_ARGB32_Premultiplied; - } +void tst_Lancelot::testRasterARGB32PM() +{ + runTestSuite(); +} - if (!proto.requestBaselineChecksums(&itemList)) { - QWARN(qPrintable(proto.errorMessage())); - QSKIP("Communication with baseline image server failed.", SkipAll); - } - foreach(const ImageItem& item, itemList) { - if (item.scriptName != QLatin1String("sizes.qps")) // Example of hardcoded blacklisting for this enigine/format - QTest::newRow(item.scriptName.toLatin1()) << item; - } +void tst_Lancelot::testRasterRGB32_data() +{ + QStringList localBlacklist = QStringList() << QLatin1String("sizes.qps"); + if (!setupTestSuite(ImageItem::Raster, QImage::Format_RGB32, localBlacklist)) + QSKIP("Communication with baseline image server failed.", SkipAll); } -void tst_Lancelot::testRasterARGB32PM() +void tst_Lancelot::testRasterRGB32() { runTestSuite(); } @@ -151,38 +153,50 @@ void tst_Lancelot::testRasterARGB32PM() void tst_Lancelot::testOpenGL_data() { + QStringList localBlacklist = QStringList() << QLatin1String("sizes.qps"); + if (!setupTestSuite(ImageItem::OpenGL, QImage::Format_RGB32, localBlacklist)) + QSKIP("Communication with baseline image server failed.", SkipAll); +} + + +void tst_Lancelot::testOpenGL() +{ + bool ok = false; + QGLWidget glWidget; + if (glWidget.isValid() && glWidget.format().directRendering() + && (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0)) { + glWidget.makeCurrent(); + if (!QByteArray((const char *)glGetString(GL_RENDERER)).contains("Mesa")) + ok = true; + } + if (ok) + runTestSuite(); + else + QSKIP("System under test does not meet preconditions for GL testing. Skipping.", SkipAll); +} + + +bool tst_Lancelot::setupTestSuite(ImageItem::GraphicsEngine engine, QImage::Format format, const QStringList& blacklist) +{ QTest::addColumn("baseline"); ImageItemList itemList(baseList); - for(int i = 0; i < itemList.size(); i++) { - itemList[i].engine = ImageItem::OpenGL; - itemList[i].renderFormat = QImage::Format_RGB32; + for(ImageItemList::iterator it = itemList.begin(); it != itemList.end(); it++) { + it->engine = engine; + it->renderFormat = format; } if (!proto.requestBaselineChecksums(&itemList)) { QWARN(qPrintable(proto.errorMessage())); - QSKIP("Communication with baseline image server failed.", SkipAll); + return false; } - qDebug() << "items:" << itemList.count(); foreach(const ImageItem& item, itemList) { - if (item.scriptName != QLatin1String("sizes.qps")) // Hardcoded blacklisting for this enigine/format + if (!blacklist.contains(item.scriptName)) QTest::newRow(item.scriptName.toLatin1()) << item; } -} - - -void tst_Lancelot::testOpenGL() -{ - QGLWidget glWidget; - if (glWidget.isValid() && glWidget.format().directRendering() - && (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0)) - { - runTestSuite(); - } else { - QSKIP("System under test does not meet preconditions for GL testing. Skipping.", SkipAll); - } + return true; } -- cgit v0.12 From bf12d2047b00eb88d96f2767b07c47bbb8df6b89 Mon Sep 17 00:00:00 2001 From: aavit Date: Tue, 7 Sep 2010 12:57:38 +0200 Subject: Improve servers storage directory structure - support different pixel formats for same engine - separate baselines per hostname --- tests/arthur/baselineserver/src/baselineserver.cpp | 21 ++++++++--------- tests/arthur/common/baselineprotocol.cpp | 26 ++++++++++++++++++++++ tests/arthur/common/baselineprotocol.h | 1 + 3 files changed, 38 insertions(+), 10 deletions(-) diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp index ec5793f..685fcae 100644 --- a/tests/arthur/baselineserver/src/baselineserver.cpp +++ b/tests/arthur/baselineserver/src/baselineserver.cpp @@ -118,7 +118,7 @@ void BaselineHandler::receiveRequest() break; default: qWarning() << runId << logtime() << "Unknown command received. " << proto.errorMessage(); - QThread::currentThread()->exit(1); + proto.sendBlock(BaselineProtocol::UnknownError, QByteArray()); } } @@ -191,15 +191,16 @@ void BaselineHandler::receiveDisconnect() QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline) { - QString storePath = BaselineServer::storagePath(); - storePath += plat.buildKey.section(QLatin1Char(' '), 1, 1) + QLatin1String("_Qt-") - + plat.qtVersion + QDir::separator(); - if (isBaseline) { - storePath += QLatin1String("baselines") + QDir::separator() - + item.engineAsString() + QDir::separator(); - } else { - storePath += runId + QDir::separator(); - } + QString host = plat.hostname; + //# tbd: if "localhost", replace with smth meaningful + host.replace(QRegExp(QLatin1String("^(bq|oslo)-(.*)-\\d\\d$")), QLatin1String("vm-\\2")); + QString pathForRun = BaselineServer::storagePath() + host + QLatin1Char('/'); + + QString storePath = pathForRun; + if (isBaseline) + storePath += QString(QLatin1String("baselines_%1_%2/")).arg(item.engineAsString(), item.formatAsString()); + else + storePath += runId + QLatin1Char('/'); //#? QString itemName = item.scriptName.replace(item.scriptName.lastIndexOf('.'), '_'); return storePath + item.scriptName + QLatin1Char('.'); } diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp index 24b5b8c..417474d 100644 --- a/tests/arthur/common/baselineprotocol.cpp +++ b/tests/arthur/common/baselineprotocol.cpp @@ -85,6 +85,32 @@ QString ImageItem::engineAsString() const return QLatin1String("Unknown"); } +QString ImageItem::formatAsString() const +{ + static const int numFormats = 16; + static const char *formatNames[numFormats] = { + "Invalid", + "Mono", + "MonoLSB", + "Indexed8", + "RGB32", + "ARGB32", + "ARGB32-Premult", + "RGB16", + "ARGB8565-Premult", + "RGB666", + "ARGB6666-Premult", + "RGB555", + "ARGB8555-Premult", + "RGB888", + "RGB444", + "ARGB4444-Premult" + }; + if (renderFormat < 0 || renderFormat >= numFormats) + return QLatin1String("UnknownFormat"); + return QLatin1String(formatNames[renderFormat]); +} + QDataStream & operator<< (QDataStream &stream, const ImageItem &ii) { stream << ii.scriptName << ii.scriptChecksum << quint8(ii.status) << quint8(ii.renderFormat) diff --git a/tests/arthur/common/baselineprotocol.h b/tests/arthur/common/baselineprotocol.h index 9ec1ef4..b3e853d 100644 --- a/tests/arthur/common/baselineprotocol.h +++ b/tests/arthur/common/baselineprotocol.h @@ -32,6 +32,7 @@ public: ImageItem &operator=(const ImageItem &other); static quint64 computeChecksum(const QImage& image); QString engineAsString() const; + QString formatAsString() const; enum ItemStatus { Ok = 0, -- cgit v0.12 From f1c5c0c1580e68d28eae0373e5df2b92be437af3 Mon Sep 17 00:00:00 2001 From: aavit Date: Tue, 7 Sep 2010 14:02:30 +0200 Subject: More server storage path fixing --- tests/arthur/baselineserver/src/baselineserver.cpp | 22 +++++++++++++++------- tests/arthur/baselineserver/src/baselineserver.h | 1 + 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp index 685fcae..e7a994f 100644 --- a/tests/arthur/baselineserver/src/baselineserver.cpp +++ b/tests/arthur/baselineserver/src/baselineserver.cpp @@ -94,7 +94,7 @@ void BaselineHandler::receiveRequest() return; } connectionEstablished = true; - qDebug() << runId << logtime() << "Connection established with" << plat.hostname << "Qt version:" << plat.qtVersion << plat.buildKey; + qDebug() << runId << logtime() << "Connection established with" << plat.hostname << proto.socket.peerAddress().toString() << "Qt version:" << plat.qtVersion << plat.buildKey; return; } @@ -191,18 +191,26 @@ void BaselineHandler::receiveDisconnect() QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline) { - QString host = plat.hostname; - //# tbd: if "localhost", replace with smth meaningful - host.replace(QRegExp(QLatin1String("^(bq|oslo)-(.*)-\\d\\d$")), QLatin1String("vm-\\2")); - QString pathForRun = BaselineServer::storagePath() + host + QLatin1Char('/'); + if (pathForRun.isNull()) { + QString host = plat.hostname; + if (host == QLatin1String("localhost")) + host = proto.socket.peerAddress().toString(); + else + host.replace(QRegExp(QLatin1String("^(bq|oslo)-(.*)-\\d\\d$")), QLatin1String("vm-\\2")); + pathForRun = BaselineServer::storagePath() + host + QLatin1Char('/'); + } QString storePath = pathForRun; if (isBaseline) storePath += QString(QLatin1String("baselines_%1_%2/")).arg(item.engineAsString(), item.formatAsString()); else storePath += runId + QLatin1Char('/'); - //#? QString itemName = item.scriptName.replace(item.scriptName.lastIndexOf('.'), '_'); - return storePath + item.scriptName + QLatin1Char('.'); + + QString itemName = item.scriptName; + if (itemName.contains(QLatin1Char('.'))) + itemName.replace(itemName.lastIndexOf(QLatin1Char('.')), 1, QLatin1Char('_')); + + return storePath + itemName + QLatin1Char('.'); } QString BaselineHandler::computeMismatchScore(const QImage &baseline, const QImage &rendered) diff --git a/tests/arthur/baselineserver/src/baselineserver.h b/tests/arthur/baselineserver/src/baselineserver.h index 2963fd1..683d2fd 100644 --- a/tests/arthur/baselineserver/src/baselineserver.h +++ b/tests/arthur/baselineserver/src/baselineserver.h @@ -72,6 +72,7 @@ private: PlatformInfo plat; bool connectionEstablished; QString runId; + QString pathForRun; }; #endif // BASELINESERVER_H -- cgit v0.12 From 5e3d55cc6fc3216e0079bb9d0c835338c9ac2ef8 Mon Sep 17 00:00:00 2001 From: aavit Date: Tue, 7 Sep 2010 15:01:32 +0200 Subject: Add another format, and blacklist some more --- tests/arthur/baselineserver/src/baselineserver.cpp | 5 +++++ tests/auto/lancelot/tst_lancelot.cpp | 18 +++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp index e7a994f..5328f59 100644 --- a/tests/arthur/baselineserver/src/baselineserver.cpp +++ b/tests/arthur/baselineserver/src/baselineserver.cpp @@ -131,6 +131,11 @@ void BaselineHandler::provideBaselineChecksums(const QByteArray &itemListBlock) qDebug() << runId << logtime() << "Received request for checksums for" << itemList.count() << "items"; for (ImageItemList::iterator i = itemList.begin(); i != itemList.end(); ++i) { + if (i->scriptName.startsWith(QLatin1String("porter_duff"))) { + // Example of blacklisting on server. + i->status = ImageItem::IgnoreItem; + continue; + } i->imageChecksum = 0; QString prefix = pathForItem(*i, true); QFile file(prefix + QLatin1String("metadata")); diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index c968473..0f57c1e 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -83,6 +83,8 @@ private slots: void testRasterARGB32PM(); void testRasterRGB32_data(); void testRasterRGB32(); + void testRasterRGB16_data(); + void testRasterRGB16(); void testOpenGL_data(); void testOpenGL(); @@ -151,9 +153,23 @@ void tst_Lancelot::testRasterRGB32() } -void tst_Lancelot::testOpenGL_data() +void tst_Lancelot::testRasterRGB16_data() { QStringList localBlacklist = QStringList() << QLatin1String("sizes.qps"); + if (!setupTestSuite(ImageItem::Raster, QImage::Format_RGB16, localBlacklist)) + QSKIP("Communication with baseline image server failed.", SkipAll); +} + + +void tst_Lancelot::testRasterRGB16() +{ + runTestSuite(); +} + + +void tst_Lancelot::testOpenGL_data() +{ + QStringList localBlacklist = QStringList() << QLatin1String("sizes.qps") << QLatin1String("rasterops.qps"); if (!setupTestSuite(ImageItem::OpenGL, QImage::Format_RGB32, localBlacklist)) QSKIP("Communication with baseline image server failed.", SkipAll); } -- cgit v0.12 From a59566262ebd226a901172fc06c7bcb9023d5a33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Tue, 7 Sep 2010 15:55:27 +0200 Subject: Make it possible to have several checksums associated with one ImageItem. Also changed the meta file from being a text file to a binary file. Nothing uses the extra checksums yet, but that should be added soon. --- tests/arthur/baselineserver/src/baselineserver.cpp | 12 +++++----- tests/arthur/common/baselineprotocol.cpp | 26 +++++++++++++++++++--- tests/arthur/common/baselineprotocol.h | 8 +++++-- tests/auto/lancelot/tst_lancelot.cpp | 18 +++++++-------- 4 files changed, 44 insertions(+), 20 deletions(-) diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp index 5328f59..5a96b90 100644 --- a/tests/arthur/baselineserver/src/baselineserver.cpp +++ b/tests/arthur/baselineserver/src/baselineserver.cpp @@ -136,16 +136,16 @@ void BaselineHandler::provideBaselineChecksums(const QByteArray &itemListBlock) i->status = ImageItem::IgnoreItem; continue; } - i->imageChecksum = 0; + i->imageChecksums.clear(); QString prefix = pathForItem(*i, true); QFile file(prefix + QLatin1String("metadata")); if (file.open(QIODevice::ReadOnly)) { - QTextStream ts(&file); - ts >> i->imageChecksum; + QDataStream checkSums(&file); + checkSums >> i->imageChecksums; file.close(); i->status = ImageItem::Ok; } - if (!i->imageChecksum) + if (!i->imageChecksums.count()) i->status = ImageItem::BaselineNotFound; } @@ -174,8 +174,8 @@ void BaselineHandler::storeImage(const QByteArray &itemBlock, bool isBaseline) //# Could use QSettings or XML or even DB, could use common file for whole dir or even whole storage - but for now, keep it simple QFile file(prefix + QLatin1String("metadata")); file.open(QIODevice::WriteOnly | QIODevice::Truncate); - QTextStream ts(&file); - ts << hex << showbase << item.imageChecksum << reset << endl; + QDataStream checkSums(&file); + checkSums << item.imageChecksums; file.close(); QByteArray msg(isBaseline ? "Baseline" : "Mismatching" ); diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp index 417474d..cbead24 100644 --- a/tests/arthur/common/baselineprotocol.cpp +++ b/tests/arthur/common/baselineprotocol.cpp @@ -33,7 +33,7 @@ ImageItem &ImageItem::operator=(const ImageItem &other) renderFormat = other.renderFormat; engine = other.engine; image = other.image; - imageChecksum = other.imageChecksum; + imageChecksums = other.imageChecksums; return *this; } @@ -114,7 +114,7 @@ QString ImageItem::formatAsString() const QDataStream & operator<< (QDataStream &stream, const ImageItem &ii) { stream << ii.scriptName << ii.scriptChecksum << quint8(ii.status) << quint8(ii.renderFormat) - << quint8(ii.engine) << ii.image << ii.imageChecksum; + << quint8(ii.engine) << ii.image << ii.imageChecksums; return stream; } @@ -122,13 +122,33 @@ QDataStream & operator>> (QDataStream &stream, ImageItem &ii) { quint8 encFormat, encStatus, encEngine; stream >> ii.scriptName >> ii.scriptChecksum >> encStatus >> encFormat - >> encEngine >> ii.image >> ii.imageChecksum; + >> encEngine >> ii.image >> ii.imageChecksums; ii.renderFormat = QImage::Format(encFormat); ii.status = ImageItem::ItemStatus(encStatus); ii.engine = ImageItem::GraphicsEngine(encEngine); return stream; } +QDataStream & operator<< (QDataStream &stream, const QList &checkSumList) +{ + stream << quint32(checkSumList.count()); + foreach(quint64 checksum, checkSumList) + stream << checksum; + return stream; +} + +QDataStream & operator>> (QDataStream &stream, QList &checkSumList) +{ + quint32 numChecksums; + stream >> numChecksums; + quint64 checkSum; + for (int i=0; i<(int)numChecksums; ++i) { + stream >> checkSum; + checkSumList.append(checkSum); + } + return stream; +} + BaselineProtocol::~BaselineProtocol() { socket.close(); diff --git a/tests/arthur/common/baselineprotocol.h b/tests/arthur/common/baselineprotocol.h index b3e853d..1cd8bb6 100644 --- a/tests/arthur/common/baselineprotocol.h +++ b/tests/arthur/common/baselineprotocol.h @@ -23,7 +23,7 @@ struct ImageItem { public: ImageItem() - : status(Ok), renderFormat(QImage::Format_Invalid), engine(Raster), imageChecksum(0), scriptChecksum(0) + : status(Ok), renderFormat(QImage::Format_Invalid), engine(Raster), scriptChecksum(0) {} ImageItem(const ImageItem &other) { *this = other; } @@ -50,15 +50,19 @@ public: QImage::Format renderFormat; GraphicsEngine engine; QImage image; - quint64 imageChecksum; + QList imageChecksums; // tbd: add diffscore quint16 scriptChecksum; }; QDataStream & operator<< (QDataStream &stream, const ImageItem &ii); QDataStream & operator>> (QDataStream& stream, ImageItem& ii); + Q_DECLARE_METATYPE(ImageItem); +QDataStream & operator<< (QDataStream &stream, const QList &checkSumList); +QDataStream & operator>> (QDataStream &stream, QList &checkSumList); + typedef QVector ImageItemList; diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index 0f57c1e..0226cc6 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -234,11 +234,11 @@ void tst_Lancelot::runTestSuite() QSKIP("Baseline not found; new baseline created.", SkipSingle); } - if (rendered.imageChecksum != baseline.imageChecksum) { - QByteArray serverMsg; - if (!proto.submitMismatch(rendered, &serverMsg)) - serverMsg = "Failed to submit mismatching image to server."; - QFAIL("Rendered image differs from baseline.\n" + serverMsg); + if (!baseline.imageChecksums.contains(rendered.imageChecksums.at(0))) { + QByteArray serverMsg; + if (!proto.submitMismatch(rendered, &serverMsg)) + serverMsg = "Failed to submit mismatching image to server."; + QFAIL("Rendered image differs from baseline.\n" + serverMsg); } } @@ -250,17 +250,17 @@ ImageItem tst_Lancelot::render(const ImageItem &item) QStringList script = loadScriptFile(filePath); if (script.isEmpty()) { res.image = QImage(); - res.imageChecksum = 0; + res.imageChecksums.append(0); } else if (item.engine == ImageItem::Raster) { QImage img(800, 800, item.renderFormat); paint(&img, script, QFileInfo(filePath).absoluteFilePath()); // eh yuck (filePath stuff) res.image = img; - res.imageChecksum = ImageItem::computeChecksum(img); + res.imageChecksums.append(ImageItem::computeChecksum(img)); } else if (item.engine == ImageItem::OpenGL) { QGLWidget glWidget; if (!glWidget.isValid()) { res.image = QImage(); - res.imageChecksum = 0; + res.imageChecksums.append(0); return res; } glWidget.resize(800, 800); @@ -270,7 +270,7 @@ ImageItem tst_Lancelot::render(const ImageItem &item) #endif paint(&glWidget, script, QFileInfo(filePath).absoluteFilePath()); // eh yuck (filePath stuff) res.image = glWidget.grabFrameBuffer().convertToFormat(item.renderFormat); - res.imageChecksum = ImageItem::computeChecksum(res.image); + res.imageChecksums.append(ImageItem::computeChecksum(res.image)); } return res; -- cgit v0.12 From 296e37e29bb0b364340e1813e18c460354b74acc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Tue, 7 Sep 2010 16:13:10 +0200 Subject: It's the GL_VERSION string that usually contains the Mesa substring. This of course differs, depending on the different backends used, but so far it seems most of the Mesa implementations have Mesa mentioned in the version string. --- tests/auto/lancelot/tst_lancelot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index 0226cc6..b2d5a7b 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -182,7 +182,7 @@ void tst_Lancelot::testOpenGL() if (glWidget.isValid() && glWidget.format().directRendering() && (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0)) { glWidget.makeCurrent(); - if (!QByteArray((const char *)glGetString(GL_RENDERER)).contains("Mesa")) + if (!QByteArray((const char *)glGetString(GL_VERSION)).contains("Mesa")) ok = true; } if (ok) -- cgit v0.12 From 8a92433b5deb14a27457715241b14764c28ffb39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 3 Sep 2010 14:45:43 +0200 Subject: Make phonon gst backend build properly Only software rendering for now... also fix regression I made in QWindowSystemInterface. Its allowed to send in NULL pointers for tlw in some of the functions. So dont ask for the widget data of a NULL pointer. --- src/3rdparty/phonon/gstreamer/devicemanager.cpp | 4 +- src/3rdparty/phonon/gstreamer/videowidget.cpp | 4 ++ src/3rdparty/phonon/gstreamer/x11renderer.h | 4 -- src/gui/kernel/qwindowsysteminterface_qpa.cpp | 50 +++++++++++++--------- src/plugins/phonon/gstreamer/gstreamer.pro | 2 +- .../platforms/testlite/qtestlitewindowsurface.cpp | 2 +- 6 files changed, 38 insertions(+), 28 deletions(-) diff --git a/src/3rdparty/phonon/gstreamer/devicemanager.cpp b/src/3rdparty/phonon/gstreamer/devicemanager.cpp index c3826eb..518aa85 100644 --- a/src/3rdparty/phonon/gstreamer/devicemanager.cpp +++ b/src/3rdparty/phonon/gstreamer/devicemanager.cpp @@ -22,7 +22,9 @@ #include "videowidget.h" #include "glrenderer.h" #include "widgetrenderer.h" +#ifdef Q_WS_X11 #include "x11renderer.h" +#endif #include "artssink.h" #include "pulsesupport.h" @@ -264,7 +266,7 @@ AbstractRenderer *DeviceManager::createVideoRenderer(VideoWidget *parent) if (m_videoSinkWidget == "software") { return new WidgetRenderer(parent); } -#ifndef Q_WS_QWS +#ifdef Q_WS_X11 else if (m_videoSinkWidget == "xwindow") { return new X11Renderer(parent); } else { diff --git a/src/3rdparty/phonon/gstreamer/videowidget.cpp b/src/3rdparty/phonon/gstreamer/videowidget.cpp index e1f0ec9..a4c6f79 100644 --- a/src/3rdparty/phonon/gstreamer/videowidget.cpp +++ b/src/3rdparty/phonon/gstreamer/videowidget.cpp @@ -31,7 +31,9 @@ #include "glrenderer.h" #include "widgetrenderer.h" +#ifdef Q_WS_X11 #include "x11renderer.h" +#endif #ifndef QT_NO_PHONON_VIDEO QT_BEGIN_NAMESPACE @@ -116,10 +118,12 @@ void VideoWidget::setupVideoBin() GstPad *videopad = gst_element_get_pad (queue, "sink"); gst_element_add_pad (m_videoBin, gst_ghost_pad_new ("sink", videopad)); gst_object_unref (videopad); +#ifndef Q_WS_QPA QWidget *parentWidget = qobject_cast(parent()); if (parentWidget) parentWidget->winId(); // Due to some existing issues with alien in 4.4, // we must currently force the creation of a parent widget. +#endif m_isValid = true; //initialization ok, accept input } } diff --git a/src/3rdparty/phonon/gstreamer/x11renderer.h b/src/3rdparty/phonon/gstreamer/x11renderer.h index f7140da..8e2ea19 100644 --- a/src/3rdparty/phonon/gstreamer/x11renderer.h +++ b/src/3rdparty/phonon/gstreamer/x11renderer.h @@ -27,8 +27,6 @@ QT_BEGIN_NAMESPACE -#ifndef Q_WS_QWS - class QString; namespace Phonon @@ -61,8 +59,6 @@ private: } } //namespace Phonon::Gstreamer -#endif // Q_WS_QWS - QT_END_NAMESPACE #endif // Phonon_GSTREAMER_X11RENDERER_H diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp index f10c038..7b83fd3 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp +++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp @@ -61,11 +61,11 @@ extern QPointer qt_last_mouse_receiver; void QWindowSystemInterface::handleEnterEvent(QWidget *tlw) { - QWidgetData *data = qt_qwidget_data(tlw); - if (data->in_destructor) - return; - if (tlw) { + QWidgetData *data = qt_qwidget_data(tlw); + if (data->in_destructor) + return; + QWindowSystemInterfacePrivate::EnterEvent *e = new QWindowSystemInterfacePrivate::EnterEvent(tlw); QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); } @@ -73,20 +73,22 @@ void QWindowSystemInterface::handleEnterEvent(QWidget *tlw) void QWindowSystemInterface::handleLeaveEvent(QWidget *tlw) { - QWidgetData *data = qt_qwidget_data(tlw); - if (data->in_destructor) - return; - + if (tlw) { + QWidgetData *data = qt_qwidget_data(tlw); + if (data->in_destructor) + return; + } QWindowSystemInterfacePrivate::LeaveEvent *e = new QWindowSystemInterfacePrivate::LeaveEvent(tlw); QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); } void QWindowSystemInterface::handleGeometryChange(QWidget *tlw, const QRect &newRect) { - QWidgetData *data = qt_qwidget_data(tlw); - if (data->in_destructor) - return; - + if (tlw) { + QWidgetData *data = qt_qwidget_data(tlw); + if (data->in_destructor) + return; + } QWindowSystemInterfacePrivate::GeometryChangeEvent *e = new QWindowSystemInterfacePrivate::GeometryChangeEvent(tlw,newRect); QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); } @@ -114,9 +116,11 @@ void QWindowSystemInterface::handleMouseEvent(QWidget *w, const QPoint & local, void QWindowSystemInterface::handleMouseEvent(QWidget *tlw, ulong timestamp, const QPoint & local, const QPoint & global, Qt::MouseButtons b) { - QWidgetData *data = qt_qwidget_data(tlw); - if (data->in_destructor) - tlw = 0; + if (tlw) { + QWidgetData *data = qt_qwidget_data(tlw); + if (data->in_destructor) + tlw = 0; + } QWindowSystemInterfacePrivate::MouseEvent * e = new QWindowSystemInterfacePrivate::MouseEvent(tlw, timestamp, local, global, b); QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); @@ -129,9 +133,11 @@ void QWindowSystemInterface::handleKeyEvent(QWidget *w, QEvent::Type t, int k, Q void QWindowSystemInterface::handleKeyEvent(QWidget *tlw, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count) { - QWidgetData *data = qt_qwidget_data(tlw); - if (data->in_destructor) - tlw = 0; + if (tlw) { + QWidgetData *data = qt_qwidget_data(tlw); + if (data->in_destructor) + tlw = 0; + } QWindowSystemInterfacePrivate::KeyEvent * e = new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, t, k, mods, text, autorep, count); @@ -145,9 +151,11 @@ void QWindowSystemInterface::handleWheelEvent(QWidget *w, const QPoint & local, void QWindowSystemInterface::handleWheelEvent(QWidget *tlw, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) { - QWidgetData *data = qt_qwidget_data(tlw); - if (data->in_destructor) - tlw = 0; + if (tlw) { + QWidgetData *data = qt_qwidget_data(tlw); + if (data->in_destructor) + tlw = 0; + } QWindowSystemInterfacePrivate::WheelEvent *e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, d, o); diff --git a/src/plugins/phonon/gstreamer/gstreamer.pro b/src/plugins/phonon/gstreamer/gstreamer.pro index 1013205..02e0848 100644 --- a/src/plugins/phonon/gstreamer/gstreamer.pro +++ b/src/plugins/phonon/gstreamer/gstreamer.pro @@ -58,7 +58,7 @@ SOURCES += $$PHONON_GSTREAMER_DIR/abstractrenderer.cpp \ $$PHONON_GSTREAMER_DIR/volumefadereffect.cpp \ $$PHONON_GSTREAMER_DIR/widgetrenderer.cpp -!embedded { +x11 { HEADERS += $$PHONON_GSTREAMER_DIR/x11renderer.h SOURCES += $$PHONON_GSTREAMER_DIR/x11renderer.cpp } diff --git a/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp b/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp index 53f4791..b3232c8 100644 --- a/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp @@ -180,7 +180,7 @@ void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const } #else // Use MIT_SHM - if (image_info->image) { + if (image_info && image_info->image) { //qDebug() << "Here we go" << image_info->image->width << image_info->image->height; int x = 0; int y = 0; -- cgit v0.12 From 8fbcf5d1a93f50fa59f650468d203115f7a6965b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 7 Sep 2010 16:33:09 +0200 Subject: Lighthouse: fix reparenting from topLevel to child widget also fix Directfb with a hack so that moving windows works --- src/gui/kernel/qwidget_qpa.cpp | 18 ++++++++++-------- src/plugins/platforms/directfb/qdirectfbwindow.cpp | 8 ++++++++ .../platforms/directfb/qdirectfbwindowsurface.cpp | 2 +- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp index b3599bd..ac8b37d 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -145,12 +145,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) } } if (destroyWindow) { - QTLWExtra *topData = d->maybeTopData(); - if (topData) { - delete topData->platformWindow; - topData->platformWindow = 0; - d->data.winid = 0; - } + d->deleteTLSysExtra(); } else { if (parentWidget() && parentWidget()->testAttribute(Qt::WA_WState_Created)) { d->hide_sys(); @@ -403,9 +398,10 @@ void QWidgetPrivate::show_sys() window->setGeometry(geomRect); } if (q->isWindow()) { - if (QWindowSurface *surface = q->windowSurface()) + if (QWindowSurface *surface = q->windowSurface()) { if (windowRect.size() != geomRect.size()) { - surface->resize(geomRect.size()); + surface->resize(geomRect.size()); + } } if (window) @@ -781,6 +777,7 @@ void QWidgetPrivate::createSysExtra() void QWidgetPrivate::deleteSysExtra() { + } void QWidgetPrivate::createTLSysExtra() @@ -789,6 +786,11 @@ void QWidgetPrivate::createTLSysExtra() void QWidgetPrivate::deleteTLSysExtra() { + if (extra && extra->topextra) { + delete extra->topextra->platformWindow; + extra->topextra->platformWindow = 0; + extra->topextra->backingStore.destroy(); + } } void QWidgetPrivate::registerDropSite(bool on) diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.cpp b/src/plugins/platforms/directfb/qdirectfbwindow.cpp index f82fbd6..21eefc4 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindow.cpp +++ b/src/plugins/platforms/directfb/qdirectfbwindow.cpp @@ -44,6 +44,8 @@ #include +#include "qdirectfbwindowsurface.h" + #include QDirectFbWindow::QDirectFbWindow(QWidget *tlw, QDirectFbInput *inputhandler) @@ -95,10 +97,16 @@ QDirectFbWindow::~QDirectFbWindow() void QDirectFbWindow::setGeometry(const QRect &rect) { + bool isMoveOnly = (rect.topLeft() != geometry().topLeft()) && (rect.size() == geometry().size()); QPlatformWindow::setGeometry(rect); m_dfbWindow->SetBounds(m_dfbWindow, rect.x(),rect.y(), rect.width(), rect.height()); + //Hack. When moving since the WindowSurface of a window becomes invalid when moved + if (isMoveOnly) { //if resize then windowsurface is updated. + widget()->windowSurface()->resize(rect.size()); + widget()->update(); + } } void QDirectFbWindow::setOpacity(qreal level) diff --git a/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp b/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp index 271d061..2aef70d 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp @@ -70,7 +70,7 @@ QDirectFbWindowSurface::QDirectFbWindowSurface(QWidget *window, WId wId) QDirectFbWindowSurface::~QDirectFbWindowSurface() { - + delete m_pixmap; } QPaintDevice *QDirectFbWindowSurface::paintDevice() -- cgit v0.12 From 184a4c66165ab49940e1eae7140a6474531c5f9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 8 Sep 2010 07:40:59 +0200 Subject: Lighthouse, DFb don't show windows that Qt::WA_DontShowOnScreen --- src/plugins/platforms/directfb/qdirectfbwindow.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.cpp b/src/plugins/platforms/directfb/qdirectfbwindow.cpp index 21eefc4..74e7a72 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindow.cpp +++ b/src/plugins/platforms/directfb/qdirectfbwindow.cpp @@ -84,6 +84,8 @@ QDirectFbWindow::QDirectFbWindow(QWidget *tlw, QDirectFbInput *inputhandler) m_dfbWindow->SetOpacity(m_dfbWindow,0xff); + setVisible(widget()->isVisible()); + DFBWindowID id; m_dfbWindow->GetID(m_dfbWindow, &id); m_inputHandler->addWindow(id,tlw); @@ -99,13 +101,15 @@ void QDirectFbWindow::setGeometry(const QRect &rect) { bool isMoveOnly = (rect.topLeft() != geometry().topLeft()) && (rect.size() == geometry().size()); QPlatformWindow::setGeometry(rect); - m_dfbWindow->SetBounds(m_dfbWindow, rect.x(),rect.y(), - rect.width(), rect.height()); - - //Hack. When moving since the WindowSurface of a window becomes invalid when moved - if (isMoveOnly) { //if resize then windowsurface is updated. - widget()->windowSurface()->resize(rect.size()); - widget()->update(); + if (widget()->isVisible() && !(widget()->testAttribute(Qt::WA_DontShowOnScreen))) { + m_dfbWindow->SetBounds(m_dfbWindow, rect.x(),rect.y(), + rect.width(), rect.height()); + + //Hack. When moving since the WindowSurface of a window becomes invalid when moved + if (isMoveOnly) { //if resize then windowsurface is updated. + widget()->windowSurface()->resize(rect.size()); + widget()->update(); + } } } -- cgit v0.12 From 1743a8bea43066c52cf07f6c8a859c3d9ddb65da Mon Sep 17 00:00:00 2001 From: aavit Date: Wed, 8 Sep 2010 09:09:35 +0200 Subject: Fix: remove baseline checksums before adding rendered .. otherwise, the comparison will always yield true... Also a simplification: QList provides default datastreaming ops --- tests/arthur/common/baselineprotocol.cpp | 20 -------------------- tests/arthur/common/baselineprotocol.h | 5 ----- tests/auto/lancelot/tst_lancelot.cpp | 2 +- 3 files changed, 1 insertion(+), 26 deletions(-) diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp index cbead24..7996fff 100644 --- a/tests/arthur/common/baselineprotocol.cpp +++ b/tests/arthur/common/baselineprotocol.cpp @@ -129,26 +129,6 @@ QDataStream & operator>> (QDataStream &stream, ImageItem &ii) return stream; } -QDataStream & operator<< (QDataStream &stream, const QList &checkSumList) -{ - stream << quint32(checkSumList.count()); - foreach(quint64 checksum, checkSumList) - stream << checksum; - return stream; -} - -QDataStream & operator>> (QDataStream &stream, QList &checkSumList) -{ - quint32 numChecksums; - stream >> numChecksums; - quint64 checkSum; - for (int i=0; i<(int)numChecksums; ++i) { - stream >> checkSum; - checkSumList.append(checkSum); - } - return stream; -} - BaselineProtocol::~BaselineProtocol() { socket.close(); diff --git a/tests/arthur/common/baselineprotocol.h b/tests/arthur/common/baselineprotocol.h index 1cd8bb6..5427023 100644 --- a/tests/arthur/common/baselineprotocol.h +++ b/tests/arthur/common/baselineprotocol.h @@ -57,15 +57,10 @@ public: QDataStream & operator<< (QDataStream &stream, const ImageItem &ii); QDataStream & operator>> (QDataStream& stream, ImageItem& ii); - Q_DECLARE_METATYPE(ImageItem); -QDataStream & operator<< (QDataStream &stream, const QList &checkSumList); -QDataStream & operator>> (QDataStream &stream, QList &checkSumList); - typedef QVector ImageItemList; - class BaselineProtocol { public: diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index b2d5a7b..aba544f 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -246,11 +246,11 @@ void tst_Lancelot::runTestSuite() ImageItem tst_Lancelot::render(const ImageItem &item) { ImageItem res = item; + res.imageChecksums.clear(); QString filePath = scriptsDir + item.scriptName; QStringList script = loadScriptFile(filePath); if (script.isEmpty()) { res.image = QImage(); - res.imageChecksums.append(0); } else if (item.engine == ImageItem::Raster) { QImage img(800, 800, item.renderFormat); paint(&img, script, QFileInfo(filePath).absoluteFilePath()); // eh yuck (filePath stuff) -- cgit v0.12 From 1aa1346645c30690c46c0bec7aaeee09c8b68690 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 8 Sep 2010 11:47:50 +0200 Subject: Compile --- src/plugins/platforms/vnc/vnc.pro | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/vnc/vnc.pro b/src/plugins/platforms/vnc/vnc.pro index 65824a2..affeea0 100644 --- a/src/plugins/platforms/vnc/vnc.pro +++ b/src/plugins/platforms/vnc/vnc.pro @@ -1,6 +1,8 @@ TARGET = qvncgraphicssystem include(../../qpluginbase.pri) +QT += network + QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms SOURCES = main.cpp qvncintegration.cpp -- cgit v0.12 From 45d5811cb2b47e41d7bb0be4cd44e5aef739f804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Wed, 8 Sep 2010 11:57:22 +0200 Subject: Check the QT_LANCELOT_SERVER env var for the servername. --- tests/arthur/common/baselineprotocol.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp index 7996fff..34d1a04 100644 --- a/tests/arthur/common/baselineprotocol.cpp +++ b/tests/arthur/common/baselineprotocol.cpp @@ -141,7 +141,9 @@ bool BaselineProtocol::connect() { errMsg.clear(); //###TBD: determine server address; for now local devhost - QLatin1String serverName("chimera.europe.nokia.com"); + QByteArray serverName(qgetenv("QT_LANCELOT_SERVER")); + if (serverName.isNull()) + serverName = "chimera.europe.nokia.com"; socket.connectToHost(serverName, ServerPort); -- cgit v0.12 From 59a2ff150795e1281e6b4fea435e74d3434a5ad2 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 8 Sep 2010 12:40:36 +0200 Subject: Experimental multi-touch implementation --- src/gui/kernel/qwindowsysteminterface_qpa.h | 2 +- src/plugins/generic/linuxinput/qlinuxinput.cpp | 152 ++++++++++++++++++++++--- src/plugins/generic/linuxinput/qlinuxinput.h | 3 + 3 files changed, 143 insertions(+), 14 deletions(-) diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h index 5ff4275..1c79f2a 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa.h @@ -73,7 +73,7 @@ public: QPointF normalPosition; // touch device coordinates, (0 to 1, 0 to 1) QRectF area; // the touched area, centered at position in screen coordinates qreal pressure; // 0 to 1 - Qt::TouchPointStates state; //Qt::TouchPoint{Pressed|Moved|Stationary|Released} + Qt::TouchPointState state; //Qt::TouchPoint{Pressed|Moved|Stationary|Released} }; static void handleTouchEvent(QWidget *w, QEvent::Type type, QTouchEvent::DeviceType devType, const QList &points); diff --git a/src/plugins/generic/linuxinput/qlinuxinput.cpp b/src/plugins/generic/linuxinput/qlinuxinput.cpp index 955aed9..2b01973 100644 --- a/src/plugins/generic/linuxinput/qlinuxinput.cpp +++ b/src/plugins/generic/linuxinput/qlinuxinput.cpp @@ -64,9 +64,74 @@ QT_BEGIN_NAMESPACE + +#define QT_QPA_EXPERIMENTAL_MULTITOUCH + +#ifdef QT_QPA_EXPERIMENTAL_MULTITOUCH +class QLinuxInputMouseHandlerData +{ +public: + QLinuxInputMouseHandlerData() :seenMT(false), state(QEvent::TouchBegin), currentIdx(0) {} + + void ensureCurrentPoint() { + if (currentIdx >= touchPoints.size()) { + Q_ASSERT(currentIdx == touchPoints.size()); + QWindowSystemInterface::TouchPoint tp; + tp.id = currentIdx; + tp.isPrimary = (currentIdx == 0); + tp.pressure = 1; + tp.area = QRectF(0,0,1,1); + tp.state = Qt::TouchPointReleased; // init in neutral state + touchPoints.append(tp); + } + } + void setCurrentPoint(int i) { + currentIdx = i; + if (currentIdx < touchPoints.size()) { + currentX = int(touchPoints[currentIdx].area.left()); + currentY = int(touchPoints[currentIdx].area.top()); + } else { + currentY = currentX = -999; + } + } + void advanceCurrentPoint() { + setCurrentPoint(currentIdx + 1); + } + int currentPoint() { return currentIdx; } + void setCurrentX(int value) { + ensureCurrentPoint(); + touchPoints[currentIdx].area.moveLeft(value); + } + bool currentMoved() { + return currentX != touchPoints[currentIdx].area.left() || currentY != touchPoints[currentIdx].area.top(); + } + void updateCurrentPos() { + ensureCurrentPoint(); + touchPoints[currentIdx].area.moveTopLeft(QPointF(currentX, currentY)); + } + void setCurrentState(Qt::TouchPointState state) { + ensureCurrentPoint(); + touchPoints[currentIdx].state = state; + } + Qt::TouchPointState currentState() const { + if (currentIdx < touchPoints.size()) + return touchPoints[currentIdx].state; + return Qt::TouchPointReleased; + } + QList touchPoints; + int currentX; + int currentY; + bool seenMT; + QEvent::Type state; +private: + int currentIdx; +}; +#endif + + QLinuxInputMouseHandler::QLinuxInputMouseHandler(const QString &key, const QString &specification) - : m_notify(0), m_x(0), m_y(0), m_buttons(0) + : m_notify(0), m_x(0), m_y(0), m_buttons(0), d(0) { qDebug() << "QLinuxInputMouseHandler" << key << specification; @@ -85,7 +150,9 @@ QLinuxInputMouseHandler::QLinuxInputMouseHandler(const QString &key, qWarning("Cannot open mouse input device '%s': %s", qPrintable(dev), strerror(errno)); return; } - +#ifdef QT_QPA_EXPERIMENTAL_MULTITOUCH + d = new QLinuxInputMouseHandlerData; +#endif } @@ -93,6 +160,7 @@ QLinuxInputMouseHandler::~QLinuxInputMouseHandler() { if (m_fd >= 0) QT_CLOSE(m_fd); + delete d; } void QLinuxInputMouseHandler::readMouseData() @@ -119,7 +187,7 @@ void QLinuxInputMouseHandler::readMouseData() for (int i = 0; i < n; ++i) { struct ::input_event *data = &buffer[i]; - + //qDebug() << ">>" << hex << data->type << data->code << dec << data->value; bool unknown = false; if (data->type == EV_ABS) { if (data->code == ABS_X && m_x != data->value) { @@ -128,6 +196,28 @@ void QLinuxInputMouseHandler::readMouseData() } else if (data->code == ABS_Y && m_y != data->value) { m_y = data->value; posChanged = true; + } else if (data->code == ABS_PRESSURE) { + //ignore for now... + } else if (data->code == ABS_TOOL_WIDTH) { + //ignore for now... + } else if (data->code == ABS_HAT0X) { + //ignore for now... + } else if (data->code == ABS_HAT0Y) { + //ignore for now... +#ifdef QT_QPA_EXPERIMENTAL_MULTITOUCH + } else if (data->code == ABS_MT_POSITION_X) { + d->currentX = data->value; + d->seenMT = true; + } else if (data->code == ABS_MT_POSITION_Y) { + d->currentY = data->value; + d->seenMT = true; + } else if (data->code == ABS_MT_TOUCH_MAJOR) { + if (data->value == 0) + d->setCurrentState(Qt::TouchPointReleased); + //otherwise, ignore for now... + } else if (data->code == ABS_MT_TOUCH_MINOR) { + //ignore for now... +#endif } else { unknown = true; } @@ -158,7 +248,7 @@ void QLinuxInputMouseHandler::readMouseData() QWindowSystemInterface::handleMouseEvent(0, QPoint(m_x, m_y), QPoint(m_x, m_y), m_buttons); - } else if (data->type == EV_KEY) { + } else if (data->type == EV_KEY && data->code >= BTN_LEFT && data->code <= BTN_MIDDLE) { Qt::MouseButton button = Qt::NoButton; switch (data->code) { case BTN_LEFT: button = Qt::LeftButton; break; @@ -173,17 +263,53 @@ void QLinuxInputMouseHandler::readMouseData() QWindowSystemInterface::handleMouseEvent(0, QPoint(m_x, m_y), QPoint(m_x, m_y), m_buttons); } else if (data->type == EV_SYN && data->code == SYN_REPORT) { - if (!posChanged) - continue; - posChanged = false; - QPoint pos(m_x, m_y); - - QWindowSystemInterface::handleMouseEvent(0, pos, pos, m_buttons); + if (posChanged) { + posChanged = false; + QPoint pos(m_x, m_y); - // pos = m_handler->transform(pos); - //m_handler->limitToScreen(pos); - //m_handler->mouseChanged(pos, m_buttons); + QWindowSystemInterface::handleMouseEvent(0, pos, pos, m_buttons); + } +#ifdef QT_QPA_EXPERIMENTAL_MULTITOUCH + if (d->state == QEvent::TouchBegin && !d->seenMT) { + //no multi-touch events to send + } else { + if (!d->seenMT) + d->state = QEvent::TouchEnd; + + for (int i = d->currentPoint(); i < d->touchPoints.size(); ++i) { + d->touchPoints[i].pressure = 0; + d->touchPoints[i].state = Qt::TouchPointReleased; + } + //qDebug() << "handleTouchEvent" << d->state << d->touchPoints.size() << d->touchPoints[0].state; + QWindowSystemInterface::handleTouchEvent(0, d->state, QTouchEvent::TouchScreen, d->touchPoints); + if (d->seenMT) { + d->state = QEvent::TouchUpdate; + } else { + d->state = QEvent::TouchBegin; + d->touchPoints.clear(); + } + d->setCurrentPoint(0); + d->seenMT = false; + } + } else if (data->type == EV_SYN && data->code == SYN_MT_REPORT) { + //store data for this touch point + + if (!d->seenMT) { + d->setCurrentState(Qt::TouchPointReleased); + } else if (d->currentState() == Qt::TouchPointReleased) { + d->updateCurrentPos(); + d->setCurrentState(Qt::TouchPointPressed); + } else if (d->currentMoved()) { + d->updateCurrentPos(); + d->setCurrentState(Qt::TouchPointMoved); + } else { + d->setCurrentState(Qt::TouchPointStationary); + } + //qDebug() << "end of point" << d->currentPoint() << d->currentX << d->currentY << d->currentState(); + //advance to next tp: + d->advanceCurrentPoint(); +#endif } else if (data->type == EV_MSC && data->code == MSC_SCAN) { // kernel encountered an unmapped key - just ignore it continue; diff --git a/src/plugins/generic/linuxinput/qlinuxinput.h b/src/plugins/generic/linuxinput/qlinuxinput.h index 26ba6a7..535816d 100644 --- a/src/plugins/generic/linuxinput/qlinuxinput.h +++ b/src/plugins/generic/linuxinput/qlinuxinput.h @@ -52,6 +52,8 @@ QT_BEGIN_NAMESPACE class QSocketNotifier; +class QLinuxInputMouseHandlerData; + class QLinuxInputMouseHandler : public QObject { Q_OBJECT @@ -67,6 +69,7 @@ private: int m_fd; int m_x, m_y; Qt::MouseButtons m_buttons; + QLinuxInputMouseHandlerData *d; }; -- cgit v0.12 From 34625a376b7d08856c6de1f52179d86aaaa30f14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 8 Sep 2010 12:55:44 +0200 Subject: Lighthouse, compile fix eglfs --- src/plugins/platforms/eglfs/qeglfsintegration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index 07605ec..a48fde8 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE QEglFSIntegration::QEglFSIntegration() - mFontDb(new QGenericUnixFontDatabase()) + : mFontDb(new QGenericUnixFontDatabase()) { m_primaryScreen = new QEglFSScreen(EGL_DEFAULT_DISPLAY); -- cgit v0.12 From 6d4003b0fd742ee2be2e536091d5b65d72d01ce0 Mon Sep 17 00:00:00 2001 From: aavit Date: Wed, 8 Sep 2010 13:29:43 +0200 Subject: Shave 25% off test time by smarter qps script parsing --- tests/arthur/common/paintcommands.cpp | 27 ++++++++++++++++++++++++--- tests/arthur/common/paintcommands.h | 2 ++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/tests/arthur/common/paintcommands.cpp b/tests/arthur/common/paintcommands.cpp index 70d419e..1d7b810 100644 --- a/tests/arthur/common/paintcommands.cpp +++ b/tests/arthur/common/paintcommands.cpp @@ -185,6 +185,7 @@ int PaintCommands::translateEnum(const char *table[], const QString &pattern, in QList PaintCommands::s_commandInfoTable = QList(); QList > PaintCommands::s_enumsTable = QList >(); +QMultiHash PaintCommands::s_commandHash; #define DECL_PAINTCOMMAND(identifier, method, regexp, syntax, sample) \ s_commandInfoTable << PaintCommandInfos(QLatin1String(identifier), &PaintCommands::method, QRegExp(regexp), \ @@ -627,6 +628,15 @@ void PaintCommands::staticInit() "\n - where vertices 1 to 4 defines the source quad and 5 to 8 the destination quad", "mapQuadToQuad 0.0 0.0 1.0 1.0 0.0 0.0 -1.0 -1.0"); + // populate the command lookup hash + for (int i=0; i= 0) { + if (scriptLine.isEmpty()) { + command_noop(QRegExp()); + return; + } + if (scriptLine.startsWith('#')) { + command_comment(QRegExp()); + return; + } + QString firstWord = scriptLine.section(QRegExp("\\s"), 0, 0); + QList indices = s_commandHash.values(firstWord); + foreach(int idx, indices) { + const PaintCommandInfos &command = s_commandInfoTable.at(idx); + if (command.regExp.indexIn(scriptLine) >= 0) { (this->*(command.paintMethod))(command.regExp); return; } + } qWarning("ERROR: unknown command or argument syntax error in \"%s\"", qPrintable(scriptLine)); } diff --git a/tests/arthur/common/paintcommands.h b/tests/arthur/common/paintcommands.h index aed4840..4d966b8 100644 --- a/tests/arthur/common/paintcommands.h +++ b/tests/arthur/common/paintcommands.h @@ -48,6 +48,7 @@ #include #include #include +#include QT_FORWARD_DECLARE_CLASS(QPainter) QT_FORWARD_DECLARE_CLASS(QRegExp) @@ -329,6 +330,7 @@ public: static QList s_commandInfoTable; static QList > s_enumsTable; + static QMultiHash s_commandHash; }; #endif // PAINTCOMMANDS_H -- cgit v0.12 From 4d89a1dc2ea1f1dfbb6109d940496e924185fe13 Mon Sep 17 00:00:00 2001 From: aavit Date: Wed, 8 Sep 2010 15:20:08 +0200 Subject: Opened for running on Mac too --- tests/auto/lancelot/tst_lancelot.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index aba544f..4792aa5 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -100,8 +100,8 @@ void tst_Lancelot::initTestCase() // (e.g. script files not found) as just warnings, and not QFAILs, to avoid false negatives // caused by environment or server instability -#if !defined(Q_OS_LINUX) - QSKIP("For the moment, this test is only supported on Linux.", SkipAll); +#if !defined(Q_OS_LINUX) && !defined(Q_OS_MAC) + QSKIP("For the moment, this test is only supported on Linux & Mac.", SkipAll); #endif if (!proto.connect()) { QWARN(qPrintable(proto.errorMessage())); @@ -169,6 +169,9 @@ void tst_Lancelot::testRasterRGB16() void tst_Lancelot::testOpenGL_data() { +#if defined(Q_OS_MAC) + QSKIP("OpenGL testing not supported on this platform.", SkipAll); +#endif QStringList localBlacklist = QStringList() << QLatin1String("sizes.qps") << QLatin1String("rasterops.qps"); if (!setupTestSuite(ImageItem::OpenGL, QImage::Format_RGB32, localBlacklist)) QSKIP("Communication with baseline image server failed.", SkipAll); -- cgit v0.12 From bb5c934d3e2e07ddf3a1c299b2111d7119a01eb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 9 Sep 2010 09:26:25 +0200 Subject: Lighthouse: Various compiler warning/error fixes compliments from Vapula --- src/gui/kernel/qapplication_qpa.cpp | 1 - src/gui/kernel/qplatformcursor_qpa.cpp | 8 ++------ src/gui/kernel/qplatformcursor_qpa.h | 2 +- src/gui/kernel/qwindowsysteminterface_qpa.cpp | 2 -- src/gui/kernel/qwindowsysteminterface_qpa_p.h | 2 -- src/plugins/platforms/fb_base/fb_base.cpp | 4 ++-- src/plugins/platforms/fb_base/fb_base.h | 2 +- src/plugins/platforms/linuxfb/qlinuxfbintegration.h | 1 + 8 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp index e5b5396..d432829 100644 --- a/src/gui/kernel/qapplication_qpa.cpp +++ b/src/gui/kernel/qapplication_qpa.cpp @@ -68,7 +68,6 @@ QT_BEGIN_NAMESPACE static QString appName; -static const char *appFont = 0; // application font QWidget *qt_button_down = 0; // widget got last button-down diff --git a/src/gui/kernel/qplatformcursor_qpa.cpp b/src/gui/kernel/qplatformcursor_qpa.cpp index 6665396..ac557b9 100644 --- a/src/gui/kernel/qplatformcursor_qpa.cpp +++ b/src/gui/kernel/qplatformcursor_qpa.cpp @@ -187,10 +187,6 @@ static const uchar mcur_fdiag_bits[] = { 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x01, 0xfc, 0x00, 0xfc, 0x41, 0xfc, 0x63, 0xdc, 0x77, 0x8c, 0x7f, 0x04, 0x7f, 0x00, 0x7e, 0x00, 0x7f, 0x80, 0x7f, 0xc0, 0x7f, 0x00, 0x00 }; -static const uchar cur_blank_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; // 20 x 20 static const uchar forbidden_bits[] = { @@ -546,11 +542,11 @@ void QPlatformCursorImage::set(Qt::CursorShape id) \a hy the y coordinate of the cursor's hotspot */ -void QPlatformCursorImage::set(const QImage * image, int hx, int hy) +void QPlatformCursorImage::set(const QImage &image, int hx, int hy) { hot.setX(hx); hot.setY(hy); - cursorImage = *image; + cursorImage = image; } /*! diff --git a/src/gui/kernel/qplatformcursor_qpa.h b/src/gui/kernel/qplatformcursor_qpa.h index abdbfee..71d0e87 100644 --- a/src/gui/kernel/qplatformcursor_qpa.h +++ b/src/gui/kernel/qplatformcursor_qpa.h @@ -63,7 +63,7 @@ public: QImage * image() { return &cursorImage; } QPoint hotspot() { return hot; } void set(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); - void set(const QImage * image, int hx, int hy); + void set(const QImage &image, int hx, int hy); void set(Qt::CursorShape); private: static void createSystemCursor(int id); diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp index 7b83fd3..bb29cbf 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp +++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp @@ -207,7 +207,6 @@ void QWindowSystemInterface::handleTouchEvent(QWidget *tlw, ulong timestamp, QEv Qt::TouchPointStates states; QTouchEvent::TouchPoint p; - int primaryPoint = -1; QList::const_iterator point = points.constBegin(); QList::const_iterator end = points.constEnd(); while (point != end) { @@ -217,7 +216,6 @@ void QWindowSystemInterface::handleTouchEvent(QWidget *tlw, ulong timestamp, QEv Qt::TouchPointStates state = point->state; if (point->isPrimary) { state |= Qt::TouchPointPrimary; - primaryPoint = point->id; } p.setState(state); p.setRect(point->area); diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h index 5f3ac5d..78e1f33 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h @@ -49,8 +49,6 @@ QT_BEGIN_NAMESPACE class QWindowSystemInterfacePrivate { public: - Q_ENUMS(EventType); - enum EventType { Close, GeometryChange, diff --git a/src/plugins/platforms/fb_base/fb_base.cpp b/src/plugins/platforms/fb_base/fb_base.cpp index ef7ab02..48488d4 100644 --- a/src/plugins/platforms/fb_base/fb_base.cpp +++ b/src/plugins/platforms/fb_base/fb_base.cpp @@ -67,7 +67,7 @@ void QPlatformSoftwareCursor::setCursor(Qt::CursorShape shape) graphic->set(shape); } -void QPlatformSoftwareCursor::setCursor(const QImage * image, int hotx, int hoty) +void QPlatformSoftwareCursor::setCursor(const QImage &image, int hotx, int hoty) { graphic->set(image, hotx, hoty); } @@ -85,7 +85,7 @@ void QPlatformSoftwareCursor::changeCursor(QCursor * widgetCursor, QWidget * wid if (shape == Qt::BitmapCursor) { // application supplied cursor QPoint spot = widgetCursor->hotSpot(); - setCursor(&widgetCursor->pixmap().toImage(), spot.x(), spot.y()); + setCursor(widgetCursor->pixmap().toImage(), spot.x(), spot.y()); } else { // system cursor setCursor(shape); diff --git a/src/plugins/platforms/fb_base/fb_base.h b/src/plugins/platforms/fb_base/fb_base.h index 10f292e..e52455a 100644 --- a/src/plugins/platforms/fb_base/fb_base.h +++ b/src/plugins/platforms/fb_base/fb_base.h @@ -40,7 +40,7 @@ protected: private: void setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); void setCursor(Qt::CursorShape shape); - void setCursor(const QImage * image, int hotx, int hoty); + void setCursor(const QImage &image, int hotx, int hoty); QRect currentRect; // next place to draw the cursor QRect prevRect; // last place the cursor was drawn QRect getCurrentRect(); diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h index a5d7abd..e93495c 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h @@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE class QLinuxFbScreen : public QFbScreen { + Q_OBJECT public: QLinuxFbScreen(uchar * d, int w, int h, int lstep, QImage::Format screenFormat); void setGeometry(QRect rect); -- cgit v0.12 From 3c29f241cebf18f4927579e054e2906915328cac Mon Sep 17 00:00:00 2001 From: aavit Date: Thu, 9 Sep 2010 10:46:34 +0200 Subject: Improved server logging and more robust client connection attempt Also misc minor improvements all around --- tests/arthur/baselineserver/bin/runserver | 11 +++++++-- tests/arthur/baselineserver/src/baselineserver.cpp | 7 +++--- tests/arthur/common/baselineprotocol.cpp | 17 ++++++++++---- tests/arthur/common/baselineprotocol.h | 3 --- tests/auto/lancelot/tst_lancelot.cpp | 27 +++++++++++----------- 5 files changed, 38 insertions(+), 27 deletions(-) diff --git a/tests/arthur/baselineserver/bin/runserver b/tests/arthur/baselineserver/bin/runserver index 52feb86..48c5c1d 100755 --- a/tests/arthur/baselineserver/bin/runserver +++ b/tests/arthur/baselineserver/bin/runserver @@ -1,6 +1,13 @@ #!/bin/bash +logfile=baselineserver.log + while true; do - ./baselineserver - sleep 5 + echo >> $logfile + echo -n "***RESTARTING*** " >> $logfile + date >> $logfile + + ./baselineserver 2>&1 | tee -a $logfile + + sleep 2 done diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp index 5a96b90..2eee408 100644 --- a/tests/arthur/baselineserver/src/baselineserver.cpp +++ b/tests/arthur/baselineserver/src/baselineserver.cpp @@ -128,7 +128,8 @@ void BaselineHandler::provideBaselineChecksums(const QByteArray &itemListBlock) ImageItemList itemList; QDataStream ds(itemListBlock); ds >> itemList; - qDebug() << runId << logtime() << "Received request for checksums for" << itemList.count() << "items"; + qDebug() << runId << logtime() << "Received request for checksums for" << itemList.count() << "items, engine" + << itemList.at(0).engineAsString() << "pixel format" << itemList.at(0).formatAsString(); for (ImageItemList::iterator i = itemList.begin(); i != itemList.end(); ++i) { if (i->scriptName.startsWith(QLatin1String("porter_duff"))) { @@ -182,7 +183,7 @@ void BaselineHandler::storeImage(const QByteArray &itemBlock, bool isBaseline) msg += " image stored in " + QHostInfo::localHostName().toLatin1() + '.' + QHostInfo::localDomainName().toLatin1() + ':' - + QFileInfo(file).absoluteFilePath().toLatin1(); + + prefix.toLatin1() + FileFormat; proto.sendBlock(BaselineProtocol::Ack, msg); } @@ -209,7 +210,7 @@ QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline) if (isBaseline) storePath += QString(QLatin1String("baselines_%1_%2/")).arg(item.engineAsString(), item.formatAsString()); else - storePath += runId + QLatin1Char('/'); + storePath += QString(QLatin1String("mismatches_%1_%2/")).arg(item.engineAsString(), item.formatAsString()) + runId + QLatin1Char('/'); QString itemName = item.scriptName; if (itemName.contains(QLatin1Char('.'))) diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp index 34d1a04..01ae67a 100644 --- a/tests/arthur/common/baselineprotocol.cpp +++ b/tests/arthur/common/baselineprotocol.cpp @@ -3,6 +3,7 @@ #include #include #include +#include PlatformInfo::PlatformInfo(bool useLocal) { @@ -145,11 +146,17 @@ bool BaselineProtocol::connect() if (serverName.isNull()) serverName = "chimera.europe.nokia.com"; - socket.connectToHost(serverName, ServerPort); - - if (!socket.waitForConnected(Timeout)) { - errMsg += QLatin1String("TCP connectToHost failed. Host:") + serverName + QLatin1String(" port:") + QString::number(ServerPort); - return false; + for (int i = 0; i < 2; i++) { + socket.connectToHost(serverName, ServerPort); + if (!socket.waitForConnected(Timeout)) { + if (!i && socket.error() == QAbstractSocket::ConnectionRefusedError) { + QTest::qSleep(3000); // In case the server is just restarting, we try again + continue; + } + errMsg += QLatin1String("TCP connectToHost failed. Host:") + serverName + QLatin1String(" port:") + QString::number(ServerPort); + return false; + } + break; } PlatformInfo pi(true); diff --git a/tests/arthur/common/baselineprotocol.h b/tests/arthur/common/baselineprotocol.h index 5427023..062a99c 100644 --- a/tests/arthur/common/baselineprotocol.h +++ b/tests/arthur/common/baselineprotocol.h @@ -111,7 +111,4 @@ private: }; - - - #endif // BASELINEPROTOCOL_H diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index 4792aa5..13a20e9 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -250,30 +250,29 @@ ImageItem tst_Lancelot::render(const ImageItem &item) { ImageItem res = item; res.imageChecksums.clear(); + res.image = QImage(); QString filePath = scriptsDir + item.scriptName; QStringList script = loadScriptFile(filePath); - if (script.isEmpty()) { - res.image = QImage(); - } else if (item.engine == ImageItem::Raster) { + if (script.isEmpty()) + return res; + + if (item.engine == ImageItem::Raster) { QImage img(800, 800, item.renderFormat); paint(&img, script, QFileInfo(filePath).absoluteFilePath()); // eh yuck (filePath stuff) res.image = img; res.imageChecksums.append(ImageItem::computeChecksum(img)); } else if (item.engine == ImageItem::OpenGL) { QGLWidget glWidget; - if (!glWidget.isValid()) { - res.image = QImage(); - res.imageChecksums.append(0); - return res; - } - glWidget.resize(800, 800); - glWidget.show(); + if (glWidget.isValid()) { + glWidget.resize(800, 800); + glWidget.show(); #ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&glWidget); + qt_x11_wait_for_window_manager(&glWidget); #endif - paint(&glWidget, script, QFileInfo(filePath).absoluteFilePath()); // eh yuck (filePath stuff) - res.image = glWidget.grabFrameBuffer().convertToFormat(item.renderFormat); - res.imageChecksums.append(ImageItem::computeChecksum(res.image)); + paint(&glWidget, script, QFileInfo(filePath).absoluteFilePath()); // eh yuck (filePath stuff) + res.image = glWidget.grabFrameBuffer().convertToFormat(item.renderFormat); + res.imageChecksums.append(ImageItem::computeChecksum(res.image)); + } } return res; -- cgit v0.12 From 437ae33b11c703ef33ebdede379b32463f22a2ee Mon Sep 17 00:00:00 2001 From: aavit Date: Thu, 9 Sep 2010 10:55:03 +0200 Subject: Open up for all platforms --- tests/auto/lancelot/tst_lancelot.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index 13a20e9..40fe7f2 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -100,8 +100,8 @@ void tst_Lancelot::initTestCase() // (e.g. script files not found) as just warnings, and not QFAILs, to avoid false negatives // caused by environment or server instability -#if !defined(Q_OS_LINUX) && !defined(Q_OS_MAC) - QSKIP("For the moment, this test is only supported on Linux & Mac.", SkipAll); +#if defined(Q_OS_SOMEPLATFORM) + QSKIP("This test is not supported on this platform.", SkipAll); #endif if (!proto.connect()) { QWARN(qPrintable(proto.errorMessage())); -- cgit v0.12 From ee7afe2536c7078c0a29dd409b4317869670c170 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 9 Sep 2010 13:27:24 +0200 Subject: Lighthouse Compilefix --- src/gui/kernel/qapplication_qpa.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp index d432829..ece035c 100644 --- a/src/gui/kernel/qapplication_qpa.cpp +++ b/src/gui/kernel/qapplication_qpa.cpp @@ -68,6 +68,7 @@ QT_BEGIN_NAMESPACE static QString appName; +static QString appFont; QWidget *qt_button_down = 0; // widget got last button-down @@ -522,7 +523,7 @@ void qt_init(QApplicationPrivate *priv, int type) QByteArray arg = argv[i]; if (arg == "-fn" || arg == "-font") { if (++i < argc) - appFont = argv[i]; + appFont = QString::fromLocal8Bit(argv[i]); } else if (arg == "-platform") { if (++i < argc) platformName = QLatin1String(argv[i]); -- cgit v0.12 From 41243160f7a9fb5e2eea365ec9757f5496d0387f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 10 Sep 2010 10:22:12 +0200 Subject: Lighthouse: Fixing the openkode implementation --- .../platforms/openkode/qopenkodeintegration.cpp | 136 ++++++++------------- .../platforms/openkode/qopenkodeintegration.h | 3 +- src/plugins/platforms/openkode/qopenkodewindow.cpp | 5 +- 3 files changed, 55 insertions(+), 89 deletions(-) diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.cpp b/src/plugins/platforms/openkode/qopenkodeintegration.cpp index 8fc3862..f8b715f 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.cpp +++ b/src/plugins/platforms/openkode/qopenkodeintegration.cpp @@ -60,33 +60,13 @@ #include "GLES2/gl2ext.h" -#include - - QT_BEGIN_NAMESPACE -QOpenKODEScreen::QOpenKODEScreen() +QOpenKODEScreen::QOpenKODEScreen(KDDisplayNV *kdDisplay, KDDesktopNV *kdDesktop) : mIsFullScreen(false) { - KDDesktopNV *kdDesktop = KD_NULL; - KDDisplayNV *kdDisplay = KD_NULL; - qDebug() << "QOpenKODEScreen::QOpenKODEIntegrationScreen()"; - // Get the default desktop and display - kdDesktop = kdGetDesktopNV(KD_DEFAULT_DESKTOP_NV, KD_NULL); - if (!kdDesktop || kdDesktop == (void*)-1) { - qErrnoWarning(kdGetError(), "Could not obtain KDDesktopNV pointer"); - return; - } - - kdDisplay = kdGetDisplayNV(KD_DEFAULT_DISPLAY_NV, KD_NULL); - if (!kdDisplay || kdDisplay == (void*)-1) { - qErrnoWarning(kdGetError(), "Could not obtain KDDisplayNV pointer"); - kdReleaseDesktopNV(kdDesktop); - return; - } - KDboolean enabled = KD_TRUE; kdSetDisplayPropertybvNV(kdDisplay, KD_DISPLAYPROPERTY_ENABLED_NV, @@ -139,64 +119,64 @@ QOpenKODEScreen::QOpenKODEScreen() } -static GLuint loadShaders(const QString &vertexShader, const QString &fragmentShader) -{ - GLuint prog = 0; - GLuint vertShader; - GLuint fragShader; - - // Create the program - prog = glCreateProgram(); - - // Create the GL shader objects - vertShader = glCreateShader(GL_VERTEX_SHADER); - fragShader = glCreateShader(GL_FRAGMENT_SHADER); - - // Load shader sources into GL and compile - QFile vertexFile(vertexShader); - vertexFile.open(QFile::ReadOnly); - QByteArray vertSource = vertexFile.readAll(); - const char *vertChar = vertSource.constData(); - int vertSize = vertSource.size(); - - QFile fragFile(fragmentShader); - fragFile.open(QFile::ReadOnly); - QByteArray fragSource = fragFile.readAll(); - const char *fragChar = fragSource.constData(); - int fragSize = fragSource.size(); - - glShaderSource(vertShader, 1, (const char**)&vertChar, &vertSize); - glCompileShader(vertShader); - - glShaderSource(fragShader, 1, (const char**)&fragChar, &fragSize); - glCompileShader(fragShader); - - // Attach the shaders to the program - glAttachShader(prog, vertShader); - glAttachShader(prog, fragShader); - - // Delete the shaders - glDeleteShader(vertShader); - glDeleteShader(fragShader); - - // Link and validate the shader program - glLinkProgram(prog); - glValidateProgram(prog); - - return prog; -} - QOpenKODEIntegration::QOpenKODEIntegration() : mEventLoopIntegration(0) { if (kdInitializeNV() == KD_ENOTINITIALIZED) { qFatal("Did not manage to initialize openkode"); } - QOpenKODEScreen *mPrimaryScreen = new QOpenKODEScreen(); - - mScreens.append(mPrimaryScreen); + KDDisplaySystemNV *kdDisplaySystem = kdCreateDisplaySystemSnapshotNV(this); + KDint32 displayCount = 0; + kdGetDisplaySystemPropertyivNV(kdDisplaySystem, KD_DISPLAYPROPERTY_COUNT_NV, 0, &displayCount); + + for (int i = 0; i < displayCount; i++) { + KDchar *displayName = 0; + KDsize displayNameLength = 0; + kdGetDisplaySystemPropertycvNV(kdDisplaySystem,KD_DISPLAYPROPERTY_NAME_NV,i,0,&displayNameLength); + if (!displayNameLength) + continue; + displayName = new KDchar[displayNameLength]; + kdGetDisplaySystemPropertycvNV(kdDisplaySystem,KD_DISPLAYPROPERTY_NAME_NV,i,displayName,&displayNameLength); + + KDDisplayNV *display = kdGetDisplayNV(displayName,this); + if (!display || display == (void*)-1) { + qErrnoWarning(kdGetError(), "Could not obtain KDDisplayNV pointer"); + return; + } + if (displayNameLength) + delete displayName; + + KDchar *desktopName = 0; + KDsize desktopNameLength = 0; + bool openkodeImpDoesNotFail = false; + if (openkodeImpDoesNotFail) { + qDebug() << "printing desktopname"; + kdGetDisplayPropertycvNV(display,KD_DISPLAYPROPERTY_DESKTOP_NAME_NV,desktopName,&desktopNameLength); + if (desktopNameLength) { + desktopName = new KDchar[desktopNameLength]; + kdGetDisplayPropertycvNV(display,KD_DISPLAYPROPERTY_DESKTOP_NAME_NV,desktopName,&desktopNameLength); + } else { + desktopName = KD_DEFAULT_DESKTOP_NV; + } + } else { + desktopName = KD_DEFAULT_DESKTOP_NV; + } + + KDDesktopNV *desktop = kdGetDesktopNV(desktopName,this); + if (!desktop || desktop == (void*)-1) { + qErrnoWarning(kdGetError(), "Could not obtain KDDesktopNV pointer"); + kdReleaseDisplayNV(display); + return; + } + if (desktopNameLength) + delete desktopName; + + QOpenKODEScreen *screen = new QOpenKODEScreen(display,desktop); + mScreens.append(screen); + } } + QOpenKODEIntegration::~QOpenKODEIntegration() { delete mEventLoopIntegration; @@ -212,7 +192,7 @@ QPlatformWindow *QOpenKODEIntegration::createPlatformWindow(QWidget *tlw, WId ) return new QOpenKODEWindow(tlw); } -QWindowSurface *QOpenKODEIntegration::createWindowSurface(QWidget *widget, WId wid) const +QWindowSurface *QOpenKODEIntegration::createWindowSurface(QWidget *widget, WId) const { QWindowSurface *returnSurface = 0; switch (widget->platformWindowFormat().windowApi()) { @@ -248,17 +228,5 @@ QPlatformEventLoopIntegration *QOpenKODEIntegration::createEventLoopIntegration( return mEventLoopIntegration; } -GLuint QOpenKODEIntegration::blitterProgram() -{ - static GLuint shaderProgram = 0; - if (!shaderProgram) { - - shaderProgram = loadShaders(":/shaders/vert.glslv",":/shaders/frag.glslf"); - if (!shaderProgram) - qFatal("QOpenKodeGraphicsSystem(): Cannot load shaders!"); - } - return shaderProgram; -} - QT_END_NAMESPACE diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.h b/src/plugins/platforms/openkode/qopenkodeintegration.h index 454aa90..939cae3 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.h +++ b/src/plugins/platforms/openkode/qopenkodeintegration.h @@ -57,13 +57,14 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE struct KDDesktopNV; +struct KDDisplayNV; class QOpenKODECursor; class QOpenKODEScreen : public QPlatformScreen { Q_OBJECT public: - QOpenKODEScreen(); + QOpenKODEScreen(KDDisplayNV *kdDisplay, KDDesktopNV *kdDesktop); ~QOpenKODEScreen() {} QRect geometry() const { return mGeometry; } diff --git a/src/plugins/platforms/openkode/qopenkodewindow.cpp b/src/plugins/platforms/openkode/qopenkodewindow.cpp index 454a50f..fadf564 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.cpp +++ b/src/plugins/platforms/openkode/qopenkodewindow.cpp @@ -104,9 +104,8 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) format.setRedBufferSize(5); format.setGreenBufferSize(6); format.setBlueBufferSize(5); - tlw->setPlatformWindowFormat(format); - m_eglConfig = q_configFromQPlatformWindowFormat(screen->eglDisplay(),tlw->platformWindowFormat()); + m_eglConfig = q_configFromQPlatformWindowFormat(screen->eglDisplay(),format); m_kdWindow = kdCreateWindow(screen->eglDisplay(), m_eglConfig, @@ -169,7 +168,6 @@ QOpenKODEWindow::QOpenKODEWindow(QWidget *tlw) QOpenKODEWindow::~QOpenKODEWindow() { - qDebug() << "destroying window" << m_kdWindow; if (m_platformGlContext != QPlatformGLContext::defaultSharedContext()) { delete m_platformGlContext; } @@ -274,7 +272,6 @@ void QOpenKODEWindow::processMouseEvents(const KDEvent *event) default: buttons = Qt::NoButton; } - qDebug() << x << y; QPoint pos(x,y); QWindowSystemInterface::handleMouseEvent(0,event->timestamp,pos,pos,buttons); } -- cgit v0.12 From 738b93fd6676a24880e1ae1c603f9457b43de831 Mon Sep 17 00:00:00 2001 From: aavit Date: Fri, 10 Sep 2010 15:07:57 +0200 Subject: Improved path mapping, added test mode for it. Misc improvements. --- tests/arthur/baselineserver/src/baselineserver.cpp | 85 ++++++++++++++++------ tests/arthur/baselineserver/src/baselineserver.h | 3 +- tests/arthur/baselineserver/src/main.cpp | 7 ++ tests/arthur/common/baselineprotocol.cpp | 16 +--- tests/auto/lancelot/tst_lancelot.cpp | 7 +- 5 files changed, 82 insertions(+), 36 deletions(-) diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp index 2eee408..63b79ca 100644 --- a/tests/arthur/baselineserver/src/baselineserver.cpp +++ b/tests/arthur/baselineserver/src/baselineserver.cpp @@ -7,6 +7,9 @@ #include #include +#define QLS QLatin1String +#define QLC QLatin1Char + QString BaselineServer::storage; BaselineServer::BaselineServer(QObject *parent) @@ -24,7 +27,7 @@ QString BaselineServer::storagePath() if (storage.isEmpty()) { QDir dir(QCoreApplication::applicationDirPath()); dir.cdUp(); - storage = dir.path() + QLatin1String("/storage/"); + storage = dir.path() + QLS("/storage/"); } return storage; } @@ -73,7 +76,10 @@ void BaselineThread::run() BaselineHandler::BaselineHandler(int socketDescriptor) : QObject(), connectionEstablished(false) { - runId = QDateTime::currentDateTime().toString(QLatin1String("MMMdd-hhmmss")); + runId = QDateTime::currentDateTime().toString(QLS("MMMdd-hhmmss")); + + if (socketDescriptor == -1) + return; connect(&proto.socket, SIGNAL(readyRead()), this, SLOT(receiveRequest())); connect(&proto.socket, SIGNAL(disconnected()), this, SLOT(receiveDisconnect())); @@ -82,7 +88,7 @@ BaselineHandler::BaselineHandler(int socketDescriptor) QString BaselineHandler::logtime() { - return QTime::currentTime().toString(QLatin1String("mm:ss.zzz")); + return QTime::currentTime().toString(QLS("mm:ss.zzz")); } void BaselineHandler::receiveRequest() @@ -132,14 +138,14 @@ void BaselineHandler::provideBaselineChecksums(const QByteArray &itemListBlock) << itemList.at(0).engineAsString() << "pixel format" << itemList.at(0).formatAsString(); for (ImageItemList::iterator i = itemList.begin(); i != itemList.end(); ++i) { - if (i->scriptName.startsWith(QLatin1String("porter_duff"))) { + if (i->scriptName.startsWith(QLS("porter_duff"))) { // Example of blacklisting on server. i->status = ImageItem::IgnoreItem; continue; } i->imageChecksums.clear(); QString prefix = pathForItem(*i, true); - QFile file(prefix + QLatin1String("metadata")); + QFile file(prefix + QLS("metadata")); if (file.open(QIODevice::ReadOnly)) { QDataStream checkSums(&file); checkSums >> i->imageChecksums; @@ -170,10 +176,10 @@ void BaselineHandler::storeImage(const QByteArray &itemBlock, bool isBaseline) QDir cwd; if (!cwd.exists(dir)) cwd.mkpath(dir); - item.image.save(prefix + QLatin1String(FileFormat), FileFormat); + item.image.save(prefix + QLS(FileFormat), FileFormat); //# Could use QSettings or XML or even DB, could use common file for whole dir or even whole storage - but for now, keep it simple - QFile file(prefix + QLatin1String("metadata")); + QFile file(prefix + QLS("metadata")); file.open(QIODevice::WriteOnly | QIODevice::Truncate); QDataStream checkSums(&file); checkSums << item.imageChecksums; @@ -198,33 +204,70 @@ void BaselineHandler::receiveDisconnect() QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline) { if (pathForRun.isNull()) { - QString host = plat.hostname; - if (host == QLatin1String("localhost")) + QString host = plat.hostname.section(QLC('.'), 0, 0); // Filter away domain, if any + if (host.isEmpty() || host == QLS("localhost")) { host = proto.socket.peerAddress().toString(); - else - host.replace(QRegExp(QLatin1String("^(bq|oslo)-(.*)-\\d\\d$")), QLatin1String("vm-\\2")); - pathForRun = BaselineServer::storagePath() + host + QLatin1Char('/'); + if (host.isEmpty()) + host = QLS("Unknown"); + } else { + host.replace(QRegExp(QLS("^(bq|oslo?)-(.*)$")), QLS("\\2")); + host.replace(QRegExp(QLS("^(.*)-\\d+$")), QLS("vm-\\1")); + } + pathForRun = BaselineServer::storagePath() + host + QLC('/'); } QString storePath = pathForRun; if (isBaseline) - storePath += QString(QLatin1String("baselines_%1_%2/")).arg(item.engineAsString(), item.formatAsString()); + storePath += QString(QLS("baselines_%1_%2/")).arg(item.engineAsString(), item.formatAsString()); else - storePath += QString(QLatin1String("mismatches_%1_%2/")).arg(item.engineAsString(), item.formatAsString()) + runId + QLatin1Char('/'); + storePath += QString(QLS("mismatches_%1_%2/")).arg(item.engineAsString(), item.formatAsString()) + runId + QLC('/'); QString itemName = item.scriptName; - if (itemName.contains(QLatin1Char('.'))) - itemName.replace(itemName.lastIndexOf(QLatin1Char('.')), 1, QLatin1Char('_')); + if (itemName.contains(QLC('.'))) + itemName.replace(itemName.lastIndexOf(QLC('.')), 1, QLC('_')); + + return storePath + itemName + QLC('.'); +} - return storePath + itemName + QLatin1Char('.'); + +void BaselineHandler::testPathMapping() +{ + qDebug() << "Storeage prefix:" << BaselineServer::storagePath(); + + QStringList hosts; + hosts << QLS("bq-ubuntu910-x86-01") + << QLS("bq-ubuntu910-x86-15") + << QLS("osl-mac-master-5.test.qt.nokia.com") + << QLS("osl-mac-master-6.test.qt.nokia.com") + << QLS("sv-xp-vs-010") + << QLS("sv-xp-vs-011") + << QLS("chimera") + << QLS("localhost"); + + ImageItem item; + item.scriptName = QLS("arcs.qps"); + item.engine = ImageItem::Raster; + item.renderFormat = QImage::Format_ARGB32_Premultiplied; + item.imageChecksums << 0x0123456789abcdefULL; + item.scriptChecksum = 0x0123; + + plat.qtVersion = QLS("4.8.0"); + plat.buildKey = QLS("(nobuildkey)"); + foreach(const QString& host, hosts) { + pathForRun = QString(); + plat.hostname = host; + qDebug() << "Baseline from" << host << "->" << pathForItem(item, true).remove(BaselineServer::storagePath()); + qDebug() << "Mismatch from" << host << "->" << pathForItem(item, false).remove(BaselineServer::storagePath()); + } } + QString BaselineHandler::computeMismatchScore(const QImage &baseline, const QImage &rendered) { if (baseline.size() != rendered.size() || baseline.format() != rendered.format()) - return QLatin1String("[No score, incomparable images.]"); + return QLS("[No score, incomparable images.]"); if (baseline.depth() != 32) - return QLatin1String("[Score computation not implemented for format.]"); + return QLS("[Score computation not implemented for format.]"); int w = baseline.width(); int h = baseline.height(); @@ -260,11 +303,11 @@ QString BaselineHandler::computeMismatchScore(const QImage &baseline, const QIma double pcd = 100.0 * ncd / (w*h); // percent of pixels that differ double acd = ncd ? double(scd) / (3*ncd) : 0; // avg. difference - QString res = QString(QLatin1String("Diffscore: %1% (Num:%2 Avg:%3)")).arg(pcd, 0, 'g', 2).arg(ncd).arg(acd, 0, 'g', 2); + QString res = QString(QLS("Diffscore: %1% (Num:%2 Avg:%3)")).arg(pcd, 0, 'g', 2).arg(ncd).arg(acd, 0, 'g', 2); if (baseline.hasAlphaChannel()) { double pad = 100.0 * nad / (w*h); // percent of pixels that differ double aad = nad ? double(sad) / (3*nad) : 0; // avg. difference - res += QString(QLatin1String(" Alpha-diffscore: %1% (Num:%2 Avg:%3)")).arg(pad, 0, 'g', 2).arg(nad).arg(aad, 0, 'g', 2); + res += QString(QLS(" Alpha-diffscore: %1% (Num:%2 Avg:%3)")).arg(pad, 0, 'g', 2).arg(nad).arg(aad, 0, 'g', 2); } return res; } diff --git a/tests/arthur/baselineserver/src/baselineserver.h b/tests/arthur/baselineserver/src/baselineserver.h index 683d2fd..a4b46f6 100644 --- a/tests/arthur/baselineserver/src/baselineserver.h +++ b/tests/arthur/baselineserver/src/baselineserver.h @@ -54,7 +54,8 @@ class BaselineHandler : public QObject Q_OBJECT public: - BaselineHandler(int socketDescriptor); + BaselineHandler(int socketDescriptor = -1); + void testPathMapping(); private slots: void receiveRequest(); diff --git a/tests/arthur/baselineserver/src/main.cpp b/tests/arthur/baselineserver/src/main.cpp index 46048db..a69a5a2 100644 --- a/tests/arthur/baselineserver/src/main.cpp +++ b/tests/arthur/baselineserver/src/main.cpp @@ -1,10 +1,17 @@ #include #include "baselineserver.h" + int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); + if (a.arguments().contains(QLatin1String("-testmapping"))) { + BaselineHandler h; + h.testPathMapping(); + return 0; + } + BaselineServer server; if (!server.listen(QHostAddress::Any, BaselineProtocol::ServerPort)) { qWarning("Failed to listen!"); diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp index 01ae67a..697ce58 100644 --- a/tests/arthur/common/baselineprotocol.cpp +++ b/tests/arthur/common/baselineprotocol.cpp @@ -3,7 +3,6 @@ #include #include #include -#include PlatformInfo::PlatformInfo(bool useLocal) { @@ -146,17 +145,10 @@ bool BaselineProtocol::connect() if (serverName.isNull()) serverName = "chimera.europe.nokia.com"; - for (int i = 0; i < 2; i++) { - socket.connectToHost(serverName, ServerPort); - if (!socket.waitForConnected(Timeout)) { - if (!i && socket.error() == QAbstractSocket::ConnectionRefusedError) { - QTest::qSleep(3000); // In case the server is just restarting, we try again - continue; - } - errMsg += QLatin1String("TCP connectToHost failed. Host:") + serverName + QLatin1String(" port:") + QString::number(ServerPort); - return false; - } - break; + socket.connectToHost(serverName, ServerPort); + if (!socket.waitForConnected(Timeout)) { + errMsg += QLatin1String("TCP connectToHost failed. Host:") + serverName + QLatin1String(" port:") + QString::number(ServerPort); + return false; } PlatformInfo pi(true); diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index 40fe7f2..2b1329f 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -104,8 +104,11 @@ void tst_Lancelot::initTestCase() QSKIP("This test is not supported on this platform.", SkipAll); #endif if (!proto.connect()) { - QWARN(qPrintable(proto.errorMessage())); - QSKIP("Communication with baseline image server failed.", SkipAll); + QTest::qSleep(3000); // Wait a bit and try again, the server might just be restarting + if (!proto.connect()) { + QWARN(qPrintable(proto.errorMessage())); + QSKIP("Communication with baseline image server failed.", SkipAll); + } } QDir qpsDir(scriptsDir); -- cgit v0.12 From 0bf1b83cd7d972a69388cdbd759dbba8b1baffd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 10 Sep 2010 15:27:31 +0200 Subject: Lighthouse: Adding QGenericUnixFontDatabase to OpenKODE --- src/plugins/platforms/openkode/openkode.pro | 2 ++ src/plugins/platforms/openkode/qopenkodeintegration.cpp | 10 +++++++++- src/plugins/platforms/openkode/qopenkodeintegration.h | 4 ++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/openkode/openkode.pro b/src/plugins/platforms/openkode/openkode.pro index 5f2c1cc..c8ae415 100644 --- a/src/plugins/platforms/openkode/openkode.pro +++ b/src/plugins/platforms/openkode/openkode.pro @@ -19,6 +19,8 @@ HEADERS = qopenkodeintegration.h \ qopenkodeeventloopintegration.h \ openkodekeytranslator.h +include (../fontdatabases/genericunix/genericunix.pri) + RESOURCES = resources.qrc target.path += $$[QT_INSTALL_PLUGINS]/platforms diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.cpp b/src/plugins/platforms/openkode/qopenkodeintegration.cpp index f8b715f..0c29a33 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.cpp +++ b/src/plugins/platforms/openkode/qopenkodeintegration.cpp @@ -52,6 +52,8 @@ #include #include +#include "qgenericunixfontdatabase.h" + #include #include #include @@ -120,7 +122,7 @@ QOpenKODEScreen::QOpenKODEScreen(KDDisplayNV *kdDisplay, KDDesktopNV *kdDesktop } QOpenKODEIntegration::QOpenKODEIntegration() - : mEventLoopIntegration(0) + : mEventLoopIntegration(0), mFontDb(new QGenericUnixFontDatabase()) { if (kdInitializeNV() == KD_ENOTINITIALIZED) { qFatal("Did not manage to initialize openkode"); @@ -180,6 +182,7 @@ QOpenKODEIntegration::QOpenKODEIntegration() QOpenKODEIntegration::~QOpenKODEIntegration() { delete mEventLoopIntegration; + delete mFontDb; } QPixmapData *QOpenKODEIntegration::createPixmapData(QPixmapData::PixelType type) const @@ -228,5 +231,10 @@ QPlatformEventLoopIntegration *QOpenKODEIntegration::createEventLoopIntegration( return mEventLoopIntegration; } +QPlatformFontDatabase *QOpenKODEIntegration::fontDatabase() const +{ + return mFontDb; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.h b/src/plugins/platforms/openkode/qopenkodeintegration.h index 939cae3..907b7e2 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.h +++ b/src/plugins/platforms/openkode/qopenkodeintegration.h @@ -49,6 +49,7 @@ #include #include #include +#include #include #include @@ -97,6 +98,8 @@ public: QPlatformEventLoopIntegration *createEventLoopIntegration() const; + QPlatformFontDatabase *fontDatabase() const; + virtual QList screens() const { return mScreens; } static GLuint blitterProgram(); @@ -104,6 +107,7 @@ public: private: QList mScreens; QOpenKODEEventLoopIntegration *mEventLoopIntegration; + QPlatformFontDatabase *mFontDb; }; QT_END_NAMESPACE -- cgit v0.12 From 1ac37675969d31fb508d9f46f2e39b0e2b68dc20 Mon Sep 17 00:00:00 2001 From: aavit Date: Mon, 13 Sep 2010 14:05:31 +0200 Subject: Checksumming of the script files added. If the scripts themselves are modfied, it will not cause mismatch. --- tests/arthur/baselineserver/src/baselineserver.cpp | 4 +++- tests/auto/lancelot/tst_lancelot.cpp | 28 ++++++++-------------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp index 63b79ca..d58313f 100644 --- a/tests/arthur/baselineserver/src/baselineserver.cpp +++ b/tests/arthur/baselineserver/src/baselineserver.cpp @@ -225,6 +225,8 @@ QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline) QString itemName = item.scriptName; if (itemName.contains(QLC('.'))) itemName.replace(itemName.lastIndexOf(QLC('.')), 1, QLC('_')); + itemName.append(QLC('_')); + itemName.append(QString::number(item.scriptChecksum, 16).rightJustified(4, QLC('0'))); return storePath + itemName + QLC('.'); } @@ -232,7 +234,7 @@ QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline) void BaselineHandler::testPathMapping() { - qDebug() << "Storeage prefix:" << BaselineServer::storagePath(); + qDebug() << "Storage prefix:" << BaselineServer::storagePath(); QStringList hosts; hosts << QLS("bq-ubuntu910-x86-01") diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index 2b1329f..5ec1667 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #include @@ -68,12 +69,12 @@ public: private: ImageItem render(const ImageItem &item); void paint(QPaintDevice *device, const QStringList &script, const QString &filePath); - QStringList loadScriptFile(const QString &filePath); void runTestSuite(); bool setupTestSuite(ImageItem::GraphicsEngine engine, QImage::Format format, const QStringList& blacklist); BaselineProtocol proto; ImageItemList baseList; + QHash scripts; private slots: void initTestCase(); @@ -120,9 +121,13 @@ void tst_Lancelot::initTestCase() baseList.resize(files.count()); ImageItemList::iterator it = baseList.begin(); - foreach(const QString& file, files) { - it->scriptName = file; - // tbd: also load, split and generate checksums for scripts + foreach(const QString& fileName, files) { + QFile file(scriptsDir + fileName); + file.open(QFile::ReadOnly); + QByteArray cont = file.readAll(); + scripts.insert(fileName, QString::fromLatin1(cont).split(QLatin1Char('\n'), QString::SkipEmptyParts)); + it->scriptName = fileName; + it->scriptChecksum = qChecksum(cont.constData(), cont.size()); it++; } } @@ -255,9 +260,7 @@ ImageItem tst_Lancelot::render(const ImageItem &item) res.imageChecksums.clear(); res.image = QImage(); QString filePath = scriptsDir + item.scriptName; - QStringList script = loadScriptFile(filePath); - if (script.isEmpty()) - return res; + QStringList script = scripts.value(item.scriptName); if (item.engine == ImageItem::Raster) { QImage img(800, 800, item.renderFormat); @@ -291,16 +294,5 @@ void tst_Lancelot::paint(QPaintDevice *device, const QStringList &script, const p.end(); } -QStringList tst_Lancelot::loadScriptFile(const QString &filePath) -{ - QFile file(filePath); - if (!file.open(QFile::ReadOnly)) { - return QStringList(); - } - //# use the new readscript function instead? - QTextStream stream(&file); - return stream.readAll().split(QLatin1Char('\n'), QString::SkipEmptyParts); -} - QTEST_MAIN(tst_Lancelot) #include "tst_lancelot.moc" -- cgit v0.12 From 7eb53c4b8d9745f998694f3dbe88dab6791d0e81 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Mon, 13 Sep 2010 15:08:00 +0200 Subject: Added a QFormLayout snippet to the layout.qdoc and layouts.cpp Reviewed-by: David Boddie Tasks: QTBUG-10077 --- doc/src/snippets/layouts/layouts.cpp | 42 ++++++++++++++++++++++++++++++--- doc/src/widgets-and-layouts/layout.qdoc | 16 +++++++++++-- 2 files changed, 53 insertions(+), 5 deletions(-) diff --git a/doc/src/snippets/layouts/layouts.cpp b/doc/src/snippets/layouts/layouts.cpp index 66c9b9d..58440f5 100644 --- a/doc/src/snippets/layouts/layouts.cpp +++ b/doc/src/snippets/layouts/layouts.cpp @@ -66,7 +66,9 @@ int main(int argc, char *argv[]) layout->addWidget(button5); window->setLayout(layout); -//! [4] //! [5] +//! [4] + window->setWindowTitle("QHBoxLayout"); +//! [5] window->show(); //! [5] } @@ -93,7 +95,9 @@ int main(int argc, char *argv[]) layout->addWidget(button5); window->setLayout(layout); -//! [10] //! [11] +//! [10] + window->setWindowTitle("QVBoxLayout"); +//! [11] window->show(); //! [11] } @@ -120,10 +124,42 @@ int main(int argc, char *argv[]) layout->addWidget(button5, 2, 1); window->setLayout(layout); -//! [16] //! [17] +//! [16] + window->setWindowTitle("QGridLayout"); +//! [17] window->show(); //! [17] } + { +//! [18] + QWidget *window = new QWidget; +//! [18] +//! [19] + QPushButton *button1 = new QPushButton("One"); + QLineEdit *lineEdit1 = new QLineEdit(); +//! [19] +//! [20] + QPushButton *button2 = new QPushButton("Two"); + QLineEdit *lineEdit2 = new QLineEdit(); + QPushButton *button3 = new QPushButton("Three"); + QLineEdit *lineEdit3 = new QLineEdit(); +//! [20] +//! [21] + QFormLayout *layout = new QFormLayout; +//! [21] +//! [22] + layout->addRow(button1, lineEdit1); + layout->addRow(button2, lineEdit2); + layout->addRow(button3, lineEdit3); + + window->setLayout(layout); +//! [22] + window->setWindowTitle("QFormLayout"); +//! [23] + window->show(); +//! [23] + } + return app.exec(); } diff --git a/doc/src/widgets-and-layouts/layout.qdoc b/doc/src/widgets-and-layouts/layout.qdoc index 32dddd7..4db991a 100644 --- a/doc/src/widgets-and-layouts/layout.qdoc +++ b/doc/src/widgets-and-layouts/layout.qdoc @@ -116,7 +116,7 @@ \section2 Laying Out Widgets in Code The following code creates a QHBoxLayout that manages the geometry of five - \l{QPushButton}s, as shown on the first screenshot above: + \l{QPushButton}{QPushButtons}, as shown on the first screenshot above: \snippet doc/src/snippets/layouts/layouts.cpp 0 \snippet doc/src/snippets/layouts/layouts.cpp 1 @@ -141,7 +141,19 @@ The third QPushButton spans 2 columns. This is possible by specifying 2 as the fifth argument to QGridLayout::addWidget(). - Finally, the code for QFormLayout is .. + QFormLayout will add two widgets on a row, commonly a QLabel and a QLineEdit + to create forms. Adding a QLabel and a QLineEdit on the same row will set + the QLineEdit as the QLabel's buddy. The following code will use the + QFormLayout to place three \l{QPushButton}{QPushButtons} and a corresponding + QLineEdit on a row. + + \snippet doc/src/snippets/layouts/layouts.cpp 18 + \snippet doc/src/snippets/layouts/layouts.cpp 19 + \snippet doc/src/snippets/layouts/layouts.cpp 20 + \codeline + \snippet doc/src/snippets/layouts/layouts.cpp 21 + \snippet doc/src/snippets/layouts/layouts.cpp 22 + \snippet doc/src/snippets/layouts/layouts.cpp 23 \section2 Tips for Using Layouts -- cgit v0.12 From 3e7c69afd0c69b2fffccf4e8cb6f292366f3217f Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Tue, 14 Sep 2010 14:51:47 +0200 Subject: Added statement regarding validators and input masks on the same line edit. Reviewed-by: David Boddie Bug:QTBUG-11324 --- src/gui/widgets/qlineedit.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 981e934..a60b30d 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -139,7 +139,10 @@ void QLineEdit::initStyleOption(QStyleOptionFrame *option) const The length of the text can be constrained to maxLength(). The text can be arbitrarily constrained using a validator() or an - inputMask(), or both. + inputMask(), or both. When switching between a validator and an input mask + on the same line edit, it is best to clear the validator or input mask to + prevent undefined behavior. + A related class is QTextEdit which allows multi-line, rich text editing. -- cgit v0.12 From f7be8a1ccd69c34c1f2406be625e2c60901d8e9e Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 15 Sep 2010 11:23:20 +0200 Subject: Git says this file was changed, but it wasn't changed. --- tests/auto/qlineedit/tst_qlineedit.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index bfa9406..93bd447 100644 --- a/tests/auto/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/qlineedit/tst_qlineedit.cpp @@ -3747,15 +3747,15 @@ void tst_QLineEdit::QTBUG697_paletteCurrentColorGroup() void tst_QLineEdit::QTBUG13520_textNotVisible() { LineEdit le; - le.setAlignment( Qt::AlignRight | Qt::AlignVCenter); - le.show(); - QTest::qWaitForWindowShown(&le); - le.setText("01-ST16-01SIL-MPL001wfgsdfgsdgsdfgsdfgsdfgsdfgsdfg"); - le.setCursorPosition(0); - QTest::qWait(100); //just make sure we get he lineedit correcly painted - - QVERIFY(le.cursorRect().center().x() < le.width() / 2); - + le.setAlignment( Qt::AlignRight | Qt::AlignVCenter); + le.show(); + QTest::qWaitForWindowShown(&le); + le.setText("01-ST16-01SIL-MPL001wfgsdfgsdgsdfgsdfgsdfgsdfgsdfg"); + le.setCursorPosition(0); + QTest::qWait(100); //just make sure we get he lineedit correcly painted + + QVERIFY(le.cursorRect().center().x() < le.width() / 2); + } -- cgit v0.12 From 18e35b4764766ef8171ec30b00d0d6bc19edb0ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 16 Sep 2010 10:15:08 +0200 Subject: Lighthouse: Remove auto building platform plugins Reviewed-by: paul --- configure | 6 ------ src/plugins/platforms/platforms.pro | 17 +---------------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/configure b/configure index d252f51..0723af1 100755 --- a/configure +++ b/configure @@ -6116,12 +6116,6 @@ if [ "$PLATFORM_QPA" = "yes" ]; then fi fi - # MIT_SHM is required for testlite - if [ "$CFG_MITSHM" != "no" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/mitshm "mitshm" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then - QT_CONFIG="$QT_CONFIG mitshm" - fi - fi fi diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro index 3446e81..26ccd44 100644 --- a/src/plugins/platforms/platforms.pro +++ b/src/plugins/platforms/platforms.pro @@ -1,19 +1,4 @@ TEMPLATE = subdirs -contains(QT_CONFIG, openvg):contains(QT_CONFIG, egl) { - SUBDIRS += openvglite -} - SUBDIRS += minimal +SUBDIRS += minimal -contains(QT_CONFIG, mitshm) { - SUBDIRS += testlite -} - -linux { - SUBDIRS += linuxfb -} - -unix { - SUBDIRS += vnc \ - qvfb -} -- cgit v0.12 From 53352584bbf81b577998b9f5a7dd2f7191870754 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 16 Sep 2010 11:03:06 +0200 Subject: Doc: Cleaning up the known issues page. Pointing people to check the online resources. --- doc/src/getting-started/known-issues.qdoc | 125 ++---------------------------- 1 file changed, 5 insertions(+), 120 deletions(-) diff --git a/doc/src/getting-started/known-issues.qdoc b/doc/src/getting-started/known-issues.qdoc index 0c2d8d8..942c41d 100644 --- a/doc/src/getting-started/known-issues.qdoc +++ b/doc/src/getting-started/known-issues.qdoc @@ -29,127 +29,12 @@ \page known-issues.html \title Known Issues \ingroup platform-specific - \brief A summary of known issues in this Qt version at the time of release. + \brief Links to online resources stating known issues in this Qt version at the time of release. - An up-to-date list of known issues can be found at - \l{http://bugreports.qt.nokia.com/}{Qt Bug Tracker}. - - For a list list of known bugs, see the \l{Task Tracker} at the Qt - website. - - An overview of known issues may also be found at: - \l{http://qt.gitorious.org/qt/pages/QtKnownIssues} + \list + \o An up-to-date list of known issues can be found at \l{http://bugreports.qt.nokia.com/}{Qt Bug Tracker}. + \o For a list list of known bugs, see the \l{Task Tracker} at the Qt website. + \o An overview of known issues may also be found at: \l{http://qt.gitorious.org/qt/pages/QtKnownIssues} {Known Issues Wiki}. - - \section1 Installation Issues - - \section2 Installing the Source Package on Unix systems - - \list - - \o If you download a Zip source package, you will need to convert - Windows-style line endings (CR/LF) to Unix-style line-endings (LF) when - you uncompress the package. To do this, give the "-a" option when you - run the "unzip' command. - - \o If you fail to supply the "-a" option when unzipping the package, you - will see the following error message when you attempt to execute the - configure command: - "bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory" - - \endlist - - \section2 Installing on Mac OS X 10.6 "Snow Leopard" - - \list - - \o There are two workarounds, either disable spotlight for the target - drive during the install, or do a custom install where you deselect - documentation and examples. Run the installer again as a full - install to get the documentation and examples installed. - - \endlist - - \section1 Issues with Third Party Software - - \section2 X11 - - \list - \o There is a bug in the 169.xx NVIDIA drivers on certain GeForce 8 series - cards that is triggered by the OpenGL paint engine when using QPainter - on a QGLWidget to draw paths and polygons. Some other painting - operations that end up in the path fallback are affected as well. The - bug causes the whole X server to repeatedly hang for several seconds at - a time. - \o There is an issue with NVIDIA's 9xxx driver series on X11 that causes a - crash in cases where there are several \l{QGLContext}s and the extended - composition modes are used (the composition modes between and including - QPainter::CompositionMode_Multiply and - QPainter::CompositionMode_Exclusion). This affects the composition mode - demo in Qt 4.5, for example. The crash does not occur in newer versions - of the drivers. - \endlist - - \section2 Windows - - \list - - \o When using version 6.14.11.6921 of the NVIDIA drivers for the GeForce - 6600 GT under Windows XP, Qt applications which use drag and drop will - display reduced size drag and drop icons when run alongside - applications that use OpenGL. This problem can be worked around by - reducing the level of graphics acceleration provided by the driver, or - by disabling hardware acceleration completely. - - \o With NVIDIA GeForce 7950 GT (driver version 6.14.11.7824), a fullscreen - QGLWidget flickers when child widgets are shown/hidden. The workaround - for this is to use \l{QWidget::}{setGeometry()} with a width/height 1 - pixel bigger than your geometry and call \l{QWidget::}{show()}. - - \o A bug in the Firebird database can cause an application to crash when - \c{fbembed.dll} is unloaded. The bug is fixed in version 2.5. - - \o On Windows 7, resizing windows is slower than on Vista/Xp. This is because - the gesture initialization process (required for native gesture support) - currently calls winId() on widgets, which causes whole widget hierarchies - to use native window handles. This slows down resizing. - - \o Compile errors with Intel C++ Compiler.\br - There seems to be a bug in the Intel compiler with respect to - over-agressive inlining of code. - The problem will manifest itself during the link phase of QtGui where - it fails with the error that it cannot find QObjectData::~QObjectData(). - See \l{http://bugreports.qt.nokia.com/browse/QTBUG-5145} for updates on this - bug. - Also, due to some bugs in WebKit, the QtScript and QtWebKit modules - will not compile. - See \l{http://bugreports.qt.nokia.com/browse/QTBUG-6297} for a - workaround for QtScript. - - \o Compile errors with Microsoft Visual C++ compiler. \br - There seems to be a bug in the Microsoft compiler when compiling with O2 - optimization level in 64 bit. - This problem will result in crashes in QAbstractItemView::viewOptions(). - See \l{http://bugreports.qt.nokia.com/browse/QTBUG-11445} for updates on this - bug. - - - \endlist - - \section2 Mac OS X - - \list - - \o If a sheet is opened for a given window, clicking the title bar of that - window will cause it to flash. This behavior has been reported to Apple - (bug number 5827676). - - \endlist - - \section2 Symbian - - \list - \o Check known issues for Symbian at - \l{http://qt.gitorious.org/qt/pages/QtKnownIssues} {Known Issues Wiki}. \endlist */ -- cgit v0.12 From e28b1810ba5979dcf2146f9389007b4cfd67a31c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 16 Sep 2010 12:45:26 +0200 Subject: Lighthouse: fix QDirectFbScreen::depth to not be fixed to 32 --- src/plugins/platforms/directfb/qdirectfbintegration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.cpp b/src/plugins/platforms/directfb/qdirectfbintegration.cpp index 64b98db..1b3e035 100644 --- a/src/plugins/platforms/directfb/qdirectfbintegration.cpp +++ b/src/plugins/platforms/directfb/qdirectfbintegration.cpp @@ -71,7 +71,7 @@ QDirectFbScreen::QDirectFbScreen(int display) m_geometry = QRect(0,0,config.width,config.height); const int dpi = 72; const qreal inch = 25.4; - m_depth = 32; + m_depth = QDirectFbConvenience::colorDepthForSurface(config.pixelformat); m_physicalSize = QSize(qRound(config.width * inch / dpi), qRound(config.height *inch / dpi)); cursor = new QDirectFBCursor(this); -- cgit v0.12 From 43a3763e392f05e758085c6b06a5001d9b51aafb Mon Sep 17 00:00:00 2001 From: aavit Date: Thu, 16 Sep 2010 15:33:57 +0200 Subject: Server generation of HTML mismatch reports added --- tests/arthur/baselineserver/src/baselineserver.cpp | 33 ++++--- tests/arthur/baselineserver/src/baselineserver.h | 7 +- tests/arthur/baselineserver/src/baselineserver.pro | 6 +- tests/arthur/baselineserver/src/htmlpage.cpp | 110 +++++++++++++++++++++ tests/arthur/baselineserver/src/htmlpage.h | 34 +++++++ tests/arthur/common/baselineprotocol.h | 3 + 6 files changed, 178 insertions(+), 15 deletions(-) create mode 100644 tests/arthur/baselineserver/src/htmlpage.cpp create mode 100644 tests/arthur/baselineserver/src/htmlpage.h diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp index d58313f..c25bfc4 100644 --- a/tests/arthur/baselineserver/src/baselineserver.cpp +++ b/tests/arthur/baselineserver/src/baselineserver.cpp @@ -7,9 +7,6 @@ #include #include -#define QLS QLatin1String -#define QLC QLatin1Char - QString BaselineServer::storage; BaselineServer::BaselineServer(QObject *parent) @@ -160,6 +157,7 @@ void BaselineHandler::provideBaselineChecksums(const QByteArray &itemListBlock) QDataStream ods(&block, QIODevice::WriteOnly); ods << itemList; proto.sendBlock(BaselineProtocol::Ack, block); + report.start(BaselineServer::storagePath(), runId, plat); } @@ -172,7 +170,7 @@ void BaselineHandler::storeImage(const QByteArray &itemBlock, bool isBaseline) QString prefix = pathForItem(item, isBaseline); qDebug() << runId << logtime() << "Received" << (isBaseline ? "baseline" : "mismatched") << "image for:" << item.scriptName << "Storing in" << prefix; - QString dir = prefix.section(QDir::separator(), 0, -2); + QString dir = prefix.section(QLC('/'), 0, -2); QDir cwd; if (!cwd.exists(dir)) cwd.mkpath(dir); @@ -185,11 +183,21 @@ void BaselineHandler::storeImage(const QByteArray &itemBlock, bool isBaseline) checkSums << item.imageChecksums; file.close(); - QByteArray msg(isBaseline ? "Baseline" : "Mismatching" ); - msg += " image stored in " - + QHostInfo::localHostName().toLatin1() + '.' - + QHostInfo::localDomainName().toLatin1() + ':' - + prefix.toLatin1() + FileFormat; + if (!isBaseline) + report.addItem(pathForItem(item, true, false) + QLS(FileFormat), + pathForItem(item, false, false) + QLS(FileFormat), + item); + + QByteArray msg(isBaseline ? "New baseline image stored: " : + "Mismatch report: " ); + msg += "http://" + + QHostInfo::localHostName().toLatin1() + '.' + + QHostInfo::localDomainName().toLatin1() + '/'; + if (isBaseline) + msg += pathForItem(item, true, false).toLatin1() + FileFormat; + else + msg += report.filePath(); + proto.sendBlock(BaselineProtocol::Ack, msg); } @@ -197,11 +205,12 @@ void BaselineHandler::storeImage(const QByteArray &itemBlock, bool isBaseline) void BaselineHandler::receiveDisconnect() { qDebug() << runId << logtime() << "Client disconnected."; + report.end(); QThread::currentThread()->exit(0); } -QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline) +QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline, bool absolute) { if (pathForRun.isNull()) { QString host = plat.hostname.section(QLC('.'), 0, 0); // Filter away domain, if any @@ -213,7 +222,7 @@ QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline) host.replace(QRegExp(QLS("^(bq|oslo?)-(.*)$")), QLS("\\2")); host.replace(QRegExp(QLS("^(.*)-\\d+$")), QLS("vm-\\1")); } - pathForRun = BaselineServer::storagePath() + host + QLC('/'); + pathForRun = host + QLC('/'); } QString storePath = pathForRun; @@ -228,6 +237,8 @@ QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline) itemName.append(QLC('_')); itemName.append(QString::number(item.scriptChecksum, 16).rightJustified(4, QLC('0'))); + if (absolute) + storePath.prepend(BaselineServer::storagePath()); return storePath + itemName + QLC('.'); } diff --git a/tests/arthur/baselineserver/src/baselineserver.h b/tests/arthur/baselineserver/src/baselineserver.h index a4b46f6..8d791e0 100644 --- a/tests/arthur/baselineserver/src/baselineserver.h +++ b/tests/arthur/baselineserver/src/baselineserver.h @@ -5,11 +5,13 @@ #include #include #include -#include "baselineprotocol.h" #include #include #include +#include "baselineprotocol.h" +#include "htmlpage.h" + // #seconds between update checks #define HEARTBEAT 5 @@ -64,7 +66,7 @@ private slots: private: void provideBaselineChecksums(const QByteArray &itemListBlock); void storeImage(const QByteArray &itemBlock, bool isBaseline); - QString pathForItem(const ImageItem &item, bool isBaseline = true); + QString pathForItem(const ImageItem &item, bool isBaseline = true, bool absolute = true); QString logtime(); QString computeMismatchScore(const QImage& baseline, const QImage& rendered); QString engineForItem(const ImageItem &item); @@ -74,6 +76,7 @@ private: bool connectionEstablished; QString runId; QString pathForRun; + HTMLPage report; }; #endif // BASELINESERVER_H diff --git a/tests/arthur/baselineserver/src/baselineserver.pro b/tests/arthur/baselineserver/src/baselineserver.pro index 2065d4a..a7be03d 100644 --- a/tests/arthur/baselineserver/src/baselineserver.pro +++ b/tests/arthur/baselineserver/src/baselineserver.pro @@ -19,7 +19,9 @@ TEMPLATE = app include(../../common/baselineprotocol.pri) SOURCES += main.cpp \ - baselineserver.cpp + baselineserver.cpp \ + htmlpage.cpp HEADERS += \ - baselineserver.h + baselineserver.h \ + htmlpage.h diff --git a/tests/arthur/baselineserver/src/htmlpage.cpp b/tests/arthur/baselineserver/src/htmlpage.cpp new file mode 100644 index 0000000..3ff138f --- /dev/null +++ b/tests/arthur/baselineserver/src/htmlpage.cpp @@ -0,0 +1,110 @@ +#include "htmlpage.h" +#include "baselineprotocol.h" +#include +#include + +HTMLPage::HTMLPage() + : headerWritten(false) +{ +} + +HTMLPage::~HTMLPage() +{ + end(); +} + +QString HTMLPage::filePath() +{ + return path; +} + +void HTMLPage::start(const QString &storagepath, const QString &runId, const PlatformInfo pinfo) +{ + end(); + + id = runId; + plat = pinfo; + root = storagepath; + QString dir = root + QLS("reports/"); + QDir cwd; + if (!cwd.exists(dir)) + cwd.mkpath(dir); +} + + +void HTMLPage::writeHeader(const ImageItem &item) +{ + path = QLS("reports/") + id + QLC('_') + item.engineAsString() + + QLC('_') + item.formatAsString() + QLS(".html"); + file.setFileName(root + path); + if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) + qWarning() << "Failed to open report file" << file.fileName(); + out.setDevice(&file); + + out << "

Lancelot results from run " << id << "

\n\n"; + out << "

Host: " << plat.hostname << "

\n"; + out << "

Qt version: " << plat.qtVersion << "

\n"; + out << "

Build key: " << plat.buildKey << "

\n"; + out << "

Engine: " << item.engineAsString() << "

\n"; + out << "

Format: " << item.formatAsString() << "

\n\n"; + out << "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n\n"; +} + + +void HTMLPage::writeFooter() +{ + out << "
ScriptBaselineRenderedComparisonFuzzy ComparisonScore
\n\n"; +} + + +void HTMLPage::addItem(const QString &baseline, const QString &rendered, const ImageItem &item) +{ + if (!headerWritten) { + writeHeader(item); + headerWritten = true; + } + QString compared = generateCompared(baseline, rendered); + QString fuzzy = generateCompared(baseline, rendered, true); + + out << "\n"; + out << "" << item.scriptName << "\n"; + QStringList images = QStringList() << baseline << rendered << compared << fuzzy; + foreach(const QString& img, images) + out << "\n"; + out << "\n\n"; +} + + +void HTMLPage::end() +{ + if (file.isOpen()) { + writeFooter(); + out.flush(); + file.close(); + path.clear(); + headerWritten = false; + } +} + + +QString HTMLPage::generateCompared(const QString &baseline, const QString &rendered, bool fuzzy) +{ + QString res = rendered; + QFileInfo fi(res); + res.chop(fi.suffix().length() + 1); + res += QLS(fuzzy ? "_fuzzycompared.png" : "_compared.png"); + QStringList args; + if (fuzzy) + args << QLS("-fuzz") << QLS("5%"); + args << root+baseline << root+rendered << root+res; + QProcess::execute(QLS("compare"), args); + return res; +} diff --git a/tests/arthur/baselineserver/src/htmlpage.h b/tests/arthur/baselineserver/src/htmlpage.h new file mode 100644 index 0000000..af0e364 --- /dev/null +++ b/tests/arthur/baselineserver/src/htmlpage.h @@ -0,0 +1,34 @@ +#ifndef HTMLPAGE_H +#define HTMLPAGE_H + +#include "baselineprotocol.h" +#include +#include + +class HTMLPage +{ +public: + HTMLPage(); + ~HTMLPage(); + + void start(const QString &storagePath, const QString &runId, const PlatformInfo pinfo); + void addItem(const QString &baseline, const QString &rendered, const ImageItem &item); + void end(); + + QString filePath(); + +private: + void writeHeader(const ImageItem &item); + void writeFooter(); + QString generateCompared(const QString &baseline, const QString &rendered, bool fuzzy = false); + + QString root; + QString path; + QFile file; + QTextStream out; + QString id; + PlatformInfo plat; + bool headerWritten; +}; + +#endif // HTMLPAGE_H diff --git a/tests/arthur/common/baselineprotocol.h b/tests/arthur/common/baselineprotocol.h index 062a99c..6af4f22 100644 --- a/tests/arthur/common/baselineprotocol.h +++ b/tests/arthur/common/baselineprotocol.h @@ -6,6 +6,9 @@ #include #include +#define QLS QLatin1String +#define QLC QLatin1Char + #define FileFormat "png" struct PlatformInfo -- cgit v0.12 From a4b69e877850dc4b934f690e3451e586daffb049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Thu, 16 Sep 2010 16:30:07 +0200 Subject: Added support for turning off text drawing. Text drawing is the one thing that will always differ between different platforms. If we're going to do any x-platform testing of the raster engine we'll have to turn text drawing off.. --- tests/arthur/common/paintcommands.cpp | 2 ++ tests/arthur/common/paintcommands.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/tests/arthur/common/paintcommands.cpp b/tests/arthur/common/paintcommands.cpp index 1d7b810..a86b30a 100644 --- a/tests/arthur/common/paintcommands.cpp +++ b/tests/arthur/common/paintcommands.cpp @@ -1378,6 +1378,8 @@ void PaintCommands::command_qt3_drawArc(QRegExp re) /***************************************************************************************************/ void PaintCommands::command_drawText(QRegExp re) { + if (!m_shouldDrawText) + return; QStringList caps = re.capturedTexts(); int x = convertToInt(caps.at(1)); int y = convertToInt(caps.at(2)); diff --git a/tests/arthur/common/paintcommands.h b/tests/arthur/common/paintcommands.h index 4d966b8..ebd882b 100644 --- a/tests/arthur/common/paintcommands.h +++ b/tests/arthur/common/paintcommands.h @@ -90,6 +90,7 @@ public: , m_verboseMode(false) , m_type(WidgetType) , m_checkers_background(true) + , m_shouldDrawText(true) { staticInit(); } public: @@ -115,6 +116,7 @@ public: void setControlPoints(const QVector &points) { staticInit(); m_controlPoints = points; } void setVerboseMode(bool v) { staticInit(); m_verboseMode = v; } void insertAt(int commandIndex, const QStringList &newCommands); + void setShouldDrawText(bool drawText) { m_shouldDrawText = drawText; } // run void runCommands(); @@ -280,6 +282,7 @@ private: bool m_verboseMode; DeviceType m_type; bool m_checkers_background; + bool m_shouldDrawText; QVector m_controlPoints; -- cgit v0.12 From 9236526841d04886307eadc036b92936b47d058d Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 17 Sep 2010 16:50:45 +0200 Subject: Doc: More work on QML reference documentation. Reviewed-by: Trust Me --- doc/src/snippets/declarative/keys/keys-handler.qml | 60 ++++++++++++++++++++ doc/src/snippets/declarative/keys/keys-pressed.qml | 65 ++++++++++++++++++++++ .../graphicsitems/qdeclarativeevents.cpp | 21 ++++--- src/declarative/graphicsitems/qdeclarativeitem.cpp | 43 +++++++------- 4 files changed, 159 insertions(+), 30 deletions(-) create mode 100644 doc/src/snippets/declarative/keys/keys-handler.qml create mode 100644 doc/src/snippets/declarative/keys/keys-pressed.qml diff --git a/doc/src/snippets/declarative/keys/keys-handler.qml b/doc/src/snippets/declarative/keys/keys-handler.qml new file mode 100644 index 0000000..9e3a3b4 --- /dev/null +++ b/doc/src/snippets/declarative/keys/keys-handler.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 + +Item { + width: 400; height: 400 + +//! [key item] +Item { + anchors.fill: parent + focus: true + Keys.onLeftPressed: console.log("move left") +} +//! [key item] + +Text { + anchors.fill: parent + text: "Press a cursor key" + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter +} +} diff --git a/doc/src/snippets/declarative/keys/keys-pressed.qml b/doc/src/snippets/declarative/keys/keys-pressed.qml new file mode 100644 index 0000000..523c95b --- /dev/null +++ b/doc/src/snippets/declarative/keys/keys-pressed.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 + +Item { + width: 400; height: 400 + +//! [key item] +Item { + anchors.fill: parent + focus: true + Keys.onPressed: { + if (event.key == Qt.Key_Left) { + console.log("move left"); + event.accepted = true; + } + } +} +//! [key item] + +Text { + anchors.fill: parent + text: "Press a cursor key" + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter +} +} diff --git a/src/declarative/graphicsitems/qdeclarativeevents.cpp b/src/declarative/graphicsitems/qdeclarativeevents.cpp index dbfb3fb..61fd562 100644 --- a/src/declarative/graphicsitems/qdeclarativeevents.cpp +++ b/src/declarative/graphicsitems/qdeclarativeevents.cpp @@ -113,11 +113,13 @@ Item { \qmlclass MouseEvent QDeclarativeMouseEvent \since 4.7 \ingroup qml-event-elements - + \brief The MouseEvent object provides information about a mouse event. - The position of the mouse can be found via the x and y properties. - The button that caused the event is available via the button property. + The position of the mouse can be found via the \l x and \l y properties. + The button that caused the event is available via the \l button property. + + \sa MouseArea */ /*! @@ -129,7 +131,7 @@ Item { \qmlproperty int MouseEvent::x \qmlproperty int MouseEvent::y - These properties hold the position of the mouse event. + These properties hold the coordinates of the position supplied by the mouse event. */ @@ -186,7 +188,7 @@ Item { It contains a bitwise combination of: \list \o Qt.NoModifier - No modifier key is pressed. - \o Qt.ShiftModifier - A Shift key on the keyboard is pressed. + \o Qt.ShiftModifier - A Shift key on the keyboard is pressed. \o Qt.ControlModifier - A Ctrl key on the keyboard is pressed. \o Qt.AltModifier - An Alt key on the keyboard is pressed. \o Qt.MetaModifier - A Meta key on the keyboard is pressed. @@ -195,9 +197,12 @@ Item { For example, to react to a Shift key + Left mouse button click: \qml -MouseArea { - onClicked: { if (mouse.button == Qt.LeftButton && mouse.modifiers & Qt.ShiftModifier) doSomething(); } -} + MouseArea { + onClicked: { + if (mouse.button == Qt.LeftButton && mouse.modifiers & Qt.ShiftModifier) + doSomething(); + } + } \endqml */ diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index bd2d52c..e2123cf 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -728,41 +728,39 @@ void QDeclarativeKeyNavigationAttached::keyReleased(QKeyEvent *event, bool post) \since 4.7 \brief The Keys attached property provides key handling to Items. - All visual primitives support key handling via the \e Keys - attached property. Keys can be handled via the \e onPressed - and \e onReleased signal properties. + All visual primitives support key handling via the Keys + attached property. Keys can be handled via the onPressed + and onReleased signal properties. The signal properties have a \l KeyEvent parameter, named \e event which contains details of the event. If a key is handled \e event.accepted should be set to true to prevent the event from propagating up the item hierarchy. - \code - Item { - focus: true - Keys.onPressed: { - if (event.key == Qt.Key_Left) { - console.log("move left"); - event.accepted = true; - } - } - } - \endcode + \section1 Example Usage + + The following example shows how the general onPressed handler can + be used to test for a certain key; in this case, the left cursor + key: + + \snippet doc/src/snippets/declarative/keys/keys-pressed.qml key item Some keys may alternatively be handled via specific signal properties, for example \e onSelectPressed. These handlers automatically set \e event.accepted to true. - \code - Item { - focus: true - Keys.onLeftPressed: console.log("move left") - } - \endcode + \snippet doc/src/snippets/declarative/keys/keys-handler.qml key item + + See \l{Qt::Key}{Qt.Key} for the list of keyboard codes. - See \l {Qt::Key}{Qt.Key} for the list of keyboard codes. + \section1 Key Handling Priorities - If priority is Keys.BeforeItem (default) the order of key event processing is: + The Keys attached property can be configured to handle key events + before or after the item it is attached to. This makes it possible + to intercept events in order to override an item's default behavior, + or act as a fallback for keys not handled by the item. + + If \l priority is Keys.BeforeItem (default) the order of key event processing is: \list 1 \o Items specified in \c forwardTo @@ -773,6 +771,7 @@ void QDeclarativeKeyNavigationAttached::keyReleased(QKeyEvent *event, bool post) \endlist If priority is Keys.AfterItem the order of key event processing is: + \list 1 \o Item specific key handling, e.g. TextInput key handling \o Items specified in \c forwardTo -- cgit v0.12 From e1bdeb521fa1c53a8039fec77fad80994b394413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Mon, 20 Sep 2010 10:52:39 +0200 Subject: This should run on GL ES 2.0 as well. --- tests/auto/lancelot/tst_lancelot.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index 5ec1667..d7a675d 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -191,7 +191,9 @@ void tst_Lancelot::testOpenGL() bool ok = false; QGLWidget glWidget; if (glWidget.isValid() && glWidget.format().directRendering() - && (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0)) { + && ((QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0) + || (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0))) + { glWidget.makeCurrent(); if (!QByteArray((const char *)glGetString(GL_VERSION)).contains("Mesa")) ok = true; -- cgit v0.12 From d5f87b551f2d22f8179ce7072308f69c4eee4067 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 20 Sep 2010 13:40:16 +0200 Subject: Doc: Fixed qdoc warnings for Phonon documentation. This more or less contains the same documentation as upstream Phonon but can't be merged because we need to maintain our documentation in different files to make qdoc read it. :-( Reviewed-by: Trust Me --- doc/src/classes/phonon-api.qdoc | 77 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/doc/src/classes/phonon-api.qdoc b/doc/src/classes/phonon-api.qdoc index 6fe0223..a429e5a 100644 --- a/doc/src/classes/phonon-api.qdoc +++ b/doc/src/classes/phonon-api.qdoc @@ -4114,6 +4114,13 @@ */ /*! + \fn Phonon::VideoWidget::snapshot() + \since 4.7 + + Returns a snapshot of the current frame shown in the widget. +*/ + +/*! \enum Phonon::VideoWidget::ScaleMode The ScaleMode enum describes how to treat aspect ratio during @@ -4305,6 +4312,12 @@ */ /*! + \typedef Phonon::VideoWidgetInterfaceLatest + \inmodule Phonon + \since 4.7 +*/ + +/*! \class Phonon::PlatformPlugin \inmodule Phonon \since 4.4 @@ -5021,3 +5034,67 @@ \internal */ +/*! + \class Phonon::PulseSupport + \inmodule Phonon + \since 4.7 + \internal +*/ + +/*! + \class Phonon::AudioDataOutput + \inmodule Phonon + \since 4.7 + + \brief The AudioDataOutput class provides access to audio data. + + This class is used to obtain audio data, typically for the purpose of + visualizing it. + + Although it is not designed for realtime performance, the latencies + associated with accessing the data should be low enough for applications + that provide visualizations of the data. This class can also be used to + save the audio data for further processing. +*/ + +/*! + \enum Phonon::AudioDataOutput::Channel + + This enum describes the channel audio data belongs to. + + \value LeftChannel + \value RightChannel + \value CenterChannel + \value LeftSurroundChannel + \value RightSurroundChannel + \value SubwooferChannel +*/ + +/*! + \property Phonon::AudioDataOutput::dataSize + \brief the number of samples passed via the dataReady() signal. +*/ + +/*! + \fn Phonon::AudioDataOutput::dataReady(const QMap > &data) + + This signal is emitted whenever there is data available to read. The + \a data sent by the signal is supplied in the form of a map that holds the + data for different output channels. +*/ + +/*! + \fn Phonon::AudioDataOutputInterface::~AudioDataOutputInterface() + + Destroys the data interface. +*/ + +/*! + \fn Phonon::AudioDataOutputInterface::frontendObject() + \internal +*/ + +/*! + \fn Phonon::GlobalConfigPrivate::~GlobalConfigPrivate() + \internal +*/ -- cgit v0.12 From f32fa315dd417384db63b11e908c7b10de10ef46 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Fri, 17 Sep 2010 14:47:20 +1000 Subject: Fix QDeclarativeXmlQuery mutex locking and don't wait for new jobs if the query has already quit Task-number: QTBUG-13041 Reviewed-by: Aaron Kennedy (cherry picked from commit 0c971a9801766a6d7646d1c1c413354f74db41e4) --- src/declarative/util/qdeclarativexmllistmodel.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index 47b502d..f0ed80b 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -209,8 +209,9 @@ Q_SIGNALS: protected: void run() { + m_mutex.lock(); + while (!m_quit) { - m_mutex.lock(); if (!m_jobs.isEmpty()) m_currentJob = m_jobs.dequeue(); m_mutex.unlock(); @@ -230,12 +231,13 @@ protected: m_mutex.lock(); if (m_currentJob.queryId != -1 && m_abortQueryId != m_currentJob.queryId) emit queryCompleted(r); - if (m_jobs.isEmpty()) + if (m_jobs.isEmpty() && !m_quit) m_condition.wait(&m_mutex); m_currentJob.queryId = -1; m_abortQueryId = -1; - m_mutex.unlock(); } + + m_mutex.unlock(); } private: -- cgit v0.12 From 4b818b1d2e87dd09d3c267e8c486793033b2e1b1 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Mon, 20 Sep 2010 16:23:15 +0300 Subject: Fixed memory leak in Symbian when Options menu was launched. Task-number: QTBUG-13437 Reviewed-by: Janne Koskinen (cherry picked from commit 0cbb1a488c4199ad06b8ab63a9d6bf09fc8a6911) --- src/gui/widgets/qmenu_symbian.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index ab2bdea..83ba15a 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -168,11 +168,11 @@ static void qt_symbian_insert_action(QSymbianMenuAction* action, QListaction->menu()->actions().size() > 0) { for (int c2= 0; c2 < action->action->menu()->actions().size(); ++c2) { - QSymbianMenuAction *symbianAction2 = new QSymbianMenuAction; + QScopedPointer symbianAction2(new QSymbianMenuAction); symbianAction2->action = action->action->menu()->actions().at(c2); QMenu * menu = symbianAction2->action->menu(); symbianAction2->command = qt_symbian_menu_static_cmd_id++; - qt_symbian_insert_action(symbianAction2, &(menuItem->children)); + qt_symbian_insert_action(symbianAction2.data(), &(menuItem->children)); } } @@ -432,11 +432,11 @@ void QMenuBarPrivate::QSymbianMenuBarPrivate::removeAction(QSymbianMenuAction *a void QMenuBarPrivate::QSymbianMenuBarPrivate::insertNativeMenuItems(const QList &actions) { for (int i = 0; i symbianActionTopLevel(new QSymbianMenuAction); symbianActionTopLevel->action = actions.at(i); symbianActionTopLevel->parent = 0; symbianActionTopLevel->command = qt_symbian_menu_static_cmd_id++; - qt_symbian_insert_action(symbianActionTopLevel, &symbianMenus); + qt_symbian_insert_action(symbianActionTopLevel.data(), &symbianMenus); } } -- cgit v0.12 From 2544544fd63f49c16aa5835bd47b2c39518ebbd9 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Mon, 20 Sep 2010 12:39:27 +0200 Subject: Fixed infinite loop when loading jpeg without EOI from memory. Task-number: QTBUG-13653 Reviewed-by: aavit (cherry picked from commit 5220c371176951e12d525ac7908861d111c367d0) --- src/gui/image/qjpeghandler.cpp | 19 ++++++++----------- tests/auto/qimagereader/images/qtbug13653-no_eoi.jpg | Bin 0 -> 8250 bytes tests/auto/qimagereader/qimagereader.qrc | 1 + tests/auto/qimagereader/tst_qimagereader.cpp | 5 +++++ 4 files changed, 14 insertions(+), 11 deletions(-) create mode 100644 tests/auto/qimagereader/images/qtbug13653-no_eoi.jpg diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp index eda5efb..e685694 100644 --- a/src/gui/image/qjpeghandler.cpp +++ b/src/gui/image/qjpeghandler.cpp @@ -134,15 +134,18 @@ static void qt_init_source(j_decompress_ptr) static boolean qt_fill_input_buffer(j_decompress_ptr cinfo) { my_jpeg_source_mgr* src = (my_jpeg_source_mgr*)cinfo->src; + qint64 num_read = 0; if (src->memDevice) { src->next_input_byte = (const JOCTET *)(src->memDevice->data().constData() + src->memDevice->pos()); - src->bytes_in_buffer = (size_t)(src->memDevice->data().size() - src->memDevice->pos()); - return true; + num_read = src->memDevice->data().size() - src->memDevice->pos(); + src->device->seek(src->memDevice->data().size()); + } else { + src->next_input_byte = src->buffer; + num_read = src->device->read((char*)src->buffer, max_buf); } - src->next_input_byte = src->buffer; - int num_read = src->device->read((char*)src->buffer, max_buf); if (num_read <= 0) { // Insert a fake EOI marker - as per jpeglib recommendation + src->next_input_byte = src->buffer; src->buffer[0] = (JOCTET) 0xFF; src->buffer[1] = (JOCTET) JPEG_EOI; src->bytes_in_buffer = 2; @@ -183,13 +186,7 @@ static void qt_term_source(j_decompress_ptr cinfo) { my_jpeg_source_mgr* src = (my_jpeg_source_mgr*)cinfo->src; if (!src->device->isSequential()) - { - // read() isn't used for memDevice, so seek past everything that was used - if (src->memDevice) - src->device->seek(src->device->pos() + (src->memDevice->data().size() - src->memDevice->pos() - src->bytes_in_buffer)); - else - src->device->seek(src->device->pos() - src->bytes_in_buffer); - } + src->device->seek(src->device->pos() - src->bytes_in_buffer); } #if defined(Q_C_CALLBACKS) diff --git a/tests/auto/qimagereader/images/qtbug13653-no_eoi.jpg b/tests/auto/qimagereader/images/qtbug13653-no_eoi.jpg new file mode 100644 index 0000000..605e8a8 Binary files /dev/null and b/tests/auto/qimagereader/images/qtbug13653-no_eoi.jpg differ diff --git a/tests/auto/qimagereader/qimagereader.qrc b/tests/auto/qimagereader/qimagereader.qrc index 1acc82f..5536b38 100644 --- a/tests/auto/qimagereader/qimagereader.qrc +++ b/tests/auto/qimagereader/qimagereader.qrc @@ -63,5 +63,6 @@ images/rect.svgz images/corrupt.svg images/corrupt.svgz + images/qtbug13653-no_eoi.jpg diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp index 5b30b04..3bee5d9 100644 --- a/tests/auto/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/qimagereader/tst_qimagereader.cpp @@ -239,6 +239,7 @@ void tst_QImageReader::readImage_data() #if defined QTEST_HAVE_JPEG QTest::newRow("JPEG: beavis") << QString("beavis.jpg") << true << QByteArray("jpeg"); + QTest::newRow("JPEG: qtbug13653") << QString("qtbug13653-no_eoi.jpg") << true << QByteArray("jpeg"); #endif #if defined QTEST_HAVE_GIF QTest::newRow("GIF: earth") << QString("earth.gif") << true << QByteArray("gif"); @@ -1039,6 +1040,7 @@ void tst_QImageReader::readFromDevice_data() QTest::newRow("jpeg-1") << QString("beavis.jpg") << QByteArray("jpeg"); QTest::newRow("jpeg-2") << QString("YCbCr_cmyk.jpg") << QByteArray("jpeg"); QTest::newRow("jpeg-3") << QString("YCbCr_rgb.jpg") << QByteArray("jpeg"); + QTest::newRow("jpeg-4") << QString("qtbug13653-no_eoi.jpg") << QByteArray("jpeg"); #endif // QTEST_HAVE_JPEG #ifdef QTEST_HAVE_GIF QTest::newRow("gif-1") << QString("earth.gif") << QByteArray("gif"); @@ -1314,6 +1316,9 @@ void tst_QImageReader::readFromResources_data() QTest::newRow("YCbCr_rgb.jpg") << QString("YCbCr_rgb.jpg") << QByteArray("jpg") << QSize(75, 50) << QString(""); + QTest::newRow("qtbug13653-no_eoi.jpg") << QString("qtbug13653-no_eoi.jpg") + << QByteArray("jpg") << QSize(240, 180) + << QString(""); #endif #ifdef QTEST_HAVE_MNG QTest::newRow("corrupt.mng") << QString("corrupt.mng") -- cgit v0.12 From c13d3906af8936ab7c1f4cca16edf41822b23ac9 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 17 Sep 2010 10:31:04 +1000 Subject: Fix worker agent to emit ListModel itemsChanged() correctly when set() and setProperty() are called Task-number: QTBUG-13666 (cherry picked from commit ff075380d7ec1472fcdff06b3f39ffdc02b7f112) --- src/declarative/util/qdeclarativelistmodelworkeragent.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/util/qdeclarativelistmodelworkeragent.cpp b/src/declarative/util/qdeclarativelistmodelworkeragent.cpp index d9df169..4392bed 100644 --- a/src/declarative/util/qdeclarativelistmodelworkeragent.cpp +++ b/src/declarative/util/qdeclarativelistmodelworkeragent.cpp @@ -232,7 +232,7 @@ bool QDeclarativeListModelWorkerAgent::event(QEvent *e) emit m_orig->itemsMoved(change.index, change.to, change.count); break; case Change::Changed: - emit m_orig->itemsChanged(change.index, change.to, orig->m_roles.keys()); + emit m_orig->itemsChanged(change.index, change.count, orig->m_roles.keys()); break; } } -- cgit v0.12 From 6c1f0aeeeb589280adaec940844fc2af17cf1bd1 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 17 Sep 2010 14:53:40 +1000 Subject: PathView didn't accept mouse events, preventing it from working in a Flickable. Since it didn't accept the press it didn't get a grab, so its events were always filtered away by Flickable. Use the same implementation as Flickable, i.e. create private handler functions for mouse events and accept normal events in the mouse*Event() methods. Task-number: QTBUG-13687 Reviewed-by: Michael Brasser (cherry picked from commit a4cadd1b1fd30a1989d56f6c06deb8fed4f79882) --- .../graphicsitems/qdeclarativepathview.cpp | 183 ++++++++++++--------- .../graphicsitems/qdeclarativepathview_p_p.h | 4 + 2 files changed, 112 insertions(+), 75 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index dad547f..119ac3e 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -1033,103 +1033,138 @@ QPointF QDeclarativePathViewPrivate::pointNear(const QPointF &point, qreal *near return nearPoint; } - void QDeclarativePathView::mousePressEvent(QGraphicsSceneMouseEvent *event) { Q_D(QDeclarativePathView); - if (!d->interactive || !d->items.count()) + if (d->interactive) { + d->handleMousePressEvent(event); + event->accept(); + } else { + QDeclarativeItem::mousePressEvent(event); + } +} + +void QDeclarativePathViewPrivate::handleMousePressEvent(QGraphicsSceneMouseEvent *event) +{ + Q_Q(QDeclarativePathView); + if (!interactive || !items.count()) return; - QPointF scenePoint = mapToScene(event->pos()); + QPointF scenePoint = q->mapToScene(event->pos()); int idx = 0; - for (; idx < d->items.count(); ++idx) { - QRectF rect = d->items.at(idx)->boundingRect(); - rect = d->items.at(idx)->mapToScene(rect).boundingRect(); + for (; idx < items.count(); ++idx) { + QRectF rect = items.at(idx)->boundingRect(); + rect = items.at(idx)->mapToScene(rect).boundingRect(); if (rect.contains(scenePoint)) break; } - if (idx == d->items.count() && d->dragMargin == 0.) // didn't click on an item + if (idx == items.count() && dragMargin == 0.) // didn't click on an item return; - d->startPoint = d->pointNear(event->pos(), &d->startPc); - if (idx == d->items.count()) { - qreal distance = qAbs(event->pos().x() - d->startPoint.x()) + qAbs(event->pos().y() - d->startPoint.y()); - if (distance > d->dragMargin) + startPoint = pointNear(event->pos(), &startPc); + if (idx == items.count()) { + qreal distance = qAbs(event->pos().x() - startPoint.x()) + qAbs(event->pos().y() - startPoint.y()); + if (distance > dragMargin) return; } - if (d->tl.isActive() && d->flicking) - d->stealMouse = true; // If we've been flicked then steal the click. + if (tl.isActive() && flicking) + stealMouse = true; // If we've been flicked then steal the click. else - d->stealMouse = false; + stealMouse = false; - d->lastElapsed = 0; - d->lastDist = 0; - QDeclarativeItemPrivate::start(d->lastPosTime); - d->tl.clear(); + lastElapsed = 0; + lastDist = 0; + QDeclarativeItemPrivate::start(lastPosTime); + tl.clear(); } void QDeclarativePathView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { Q_D(QDeclarativePathView); - if (!d->interactive || !d->lastPosTime.isValid()) + if (d->interactive) { + d->handleMouseMoveEvent(event); + if (d->stealMouse) + setKeepMouseGrab(true); + event->accept(); + } else { + QDeclarativeItem::mouseMoveEvent(event); + } +} + +void QDeclarativePathViewPrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event) +{ + Q_Q(QDeclarativePathView); + if (!interactive || !lastPosTime.isValid()) return; - if (!d->stealMouse) { - QPointF delta = event->pos() - d->startPoint; + if (!stealMouse) { + QPointF delta = event->pos() - startPoint; if (qAbs(delta.x()) > QApplication::startDragDistance() || qAbs(delta.y()) > QApplication::startDragDistance()) - d->stealMouse = true; + stealMouse = true; } - if (d->stealMouse) { - d->moveReason = QDeclarativePathViewPrivate::Mouse; + if (stealMouse) { + moveReason = QDeclarativePathViewPrivate::Mouse; qreal newPc; - d->pointNear(event->pos(), &newPc); - qreal diff = (newPc - d->startPc)*d->modelCount*d->mappedRange; + pointNear(event->pos(), &newPc); + qreal diff = (newPc - startPc)*modelCount*mappedRange; if (diff) { - setOffset(d->offset + diff); + setOffset(offset + diff); - if (diff > d->modelCount/2) - diff -= d->modelCount; - else if (diff < -d->modelCount/2) - diff += d->modelCount; + if (diff > modelCount/2) + diff -= modelCount; + else if (diff < -modelCount/2) + diff += modelCount; - d->lastElapsed = QDeclarativeItemPrivate::restart(d->lastPosTime); - d->lastDist = diff; - d->startPc = newPc; + lastElapsed = QDeclarativeItemPrivate::restart(lastPosTime); + lastDist = diff; + startPc = newPc; } - if (!d->moving) { - d->moving = true; - emit movingChanged(); - emit movementStarted(); + if (!moving) { + moving = true; + emit q->movingChanged(); + emit q->movementStarted(); } } } -void QDeclarativePathView::mouseReleaseEvent(QGraphicsSceneMouseEvent *) +void QDeclarativePathView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { Q_D(QDeclarativePathView); - d->stealMouse = false; - setKeepMouseGrab(false); - if (!d->interactive || !d->lastPosTime.isValid()) + if (d->interactive) { + d->handleMouseReleaseEvent(event); + event->accept(); + ungrabMouse(); + } else { + QDeclarativeItem::mouseReleaseEvent(event); + } +} + +void QDeclarativePathViewPrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEvent *) +{ + Q_Q(QDeclarativePathView); + stealMouse = false; + q->setKeepMouseGrab(false); + if (!interactive || !lastPosTime.isValid()) return; - qreal elapsed = qreal(d->lastElapsed + QDeclarativeItemPrivate::elapsed(d->lastPosTime)) / 1000.; - qreal velocity = elapsed > 0. ? d->lastDist / elapsed : 0; - if (d->model && d->modelCount && qAbs(velocity) > 1.) { - qreal count = d->pathItems == -1 ? d->modelCount : d->pathItems; + qreal elapsed = qreal(lastElapsed + QDeclarativeItemPrivate::elapsed(lastPosTime)) / 1000.; + qreal velocity = elapsed > 0. ? lastDist / elapsed : 0; + if (model && modelCount && qAbs(velocity) > 1.) { + qreal count = pathItems == -1 ? modelCount : pathItems; if (qAbs(velocity) > count * 2) // limit velocity velocity = (velocity > 0 ? count : -count) * 2; // Calculate the distance to be travelled qreal v2 = velocity*velocity; - qreal accel = d->deceleration/10; + qreal accel = deceleration/10; // + 0.25 to encourage moving at least one item in the flick direction - qreal dist = qMin(qreal(d->modelCount-1), qreal(v2 / (accel * 2.0) + 0.25)); - if (d->haveHighlightRange && d->highlightRangeMode == QDeclarativePathView::StrictlyEnforceRange) { + qreal dist = qMin(qreal(modelCount-1), qreal(v2 / (accel * 2.0) + 0.25)); + if (haveHighlightRange && highlightRangeMode == QDeclarativePathView::StrictlyEnforceRange) { // round to nearest item. if (velocity > 0.) - dist = qRound(dist + d->offset) - d->offset; + dist = qRound(dist + offset) - offset; else - dist = qRound(dist - d->offset) + d->offset; + dist = qRound(dist - offset) + offset; // Calculate accel required to stop on item boundary if (dist <= 0.) { dist = 0.; @@ -1138,23 +1173,22 @@ void QDeclarativePathView::mouseReleaseEvent(QGraphicsSceneMouseEvent *) accel = v2 / (2.0f * qAbs(dist)); } } - d->offsetAdj = 0.0; - d->moveOffset.setValue(d->offset); - d->tl.accel(d->moveOffset, velocity, accel, dist); - d->tl.callback(QDeclarativeTimeLineCallback(&d->moveOffset, d->fixOffsetCallback, d)); - if (!d->flicking) { - d->flicking = true; - emit flickingChanged(); - emit flickStarted(); + offsetAdj = 0.0; + moveOffset.setValue(offset); + tl.accel(moveOffset, velocity, accel, dist); + tl.callback(QDeclarativeTimeLineCallback(&moveOffset, fixOffsetCallback, this)); + if (!flicking) { + flicking = true; + emit q->flickingChanged(); + emit q->flickStarted(); } } else { - d->fixOffset(); + fixOffset(); } - d->lastPosTime.invalidate(); - ungrabMouse(); - if (!d->tl.isActive()) - movementEnding(); + lastPosTime.invalidate(); + if (!tl.isActive()) + q->movementEnding(); } bool QDeclarativePathView::sendMouseEvent(QGraphicsSceneMouseEvent *event) @@ -1164,7 +1198,8 @@ bool QDeclarativePathView::sendMouseEvent(QGraphicsSceneMouseEvent *event) QRectF myRect = mapToScene(QRectF(0, 0, width(), height())).boundingRect(); QGraphicsScene *s = scene(); QDeclarativeItem *grabber = s ? qobject_cast(s->mouseGrabberItem()) : 0; - if ((d->stealMouse || myRect.contains(event->scenePos().toPoint())) && (!grabber || !grabber->keepMouseGrab())) { + bool stealThisEvent = d->stealMouse; + if ((stealThisEvent || myRect.contains(event->scenePos().toPoint())) && (!grabber || !grabber->keepMouseGrab())) { mouseEvent.setAccepted(false); for (int i = 0x1; i <= 0x10; i <<= 1) { if (event->buttons() & i) { @@ -1179,25 +1214,28 @@ bool QDeclarativePathView::sendMouseEvent(QGraphicsSceneMouseEvent *event) switch(mouseEvent.type()) { case QEvent::GraphicsSceneMouseMove: - mouseMoveEvent(&mouseEvent); + d->handleMouseMoveEvent(&mouseEvent); break; case QEvent::GraphicsSceneMousePress: - mousePressEvent(&mouseEvent); + d->handleMousePressEvent(&mouseEvent); + stealThisEvent = d->stealMouse; // Update stealThisEvent in case changed by function call above break; case QEvent::GraphicsSceneMouseRelease: - mouseReleaseEvent(&mouseEvent); + d->handleMouseReleaseEvent(&mouseEvent); break; default: break; } grabber = qobject_cast(s->mouseGrabberItem()); - if (grabber && d->stealMouse && !grabber->keepMouseGrab() && grabber != this) + if (grabber && stealThisEvent && !grabber->keepMouseGrab() && grabber != this) grabMouse(); return d->stealMouse; } else if (d->lastPosTime.isValid()) { d->lastPosTime.invalidate(); } + if (mouseEvent.type() == QEvent::GraphicsSceneMouseRelease) + d->stealMouse = false; return false; } @@ -1211,12 +1249,7 @@ bool QDeclarativePathView::sceneEventFilter(QGraphicsItem *i, QEvent *e) case QEvent::GraphicsSceneMousePress: case QEvent::GraphicsSceneMouseMove: case QEvent::GraphicsSceneMouseRelease: - { - bool ret = sendMouseEvent(static_cast(e)); - if (e->type() == QEvent::GraphicsSceneMouseRelease) - return ret; - break; - } + return sendMouseEvent(static_cast(e)); default: break; } diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h index dfebe35..b217216 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h @@ -123,6 +123,10 @@ public: return model && model->count() > 0 && model->isValid() && path; } + void handleMousePressEvent(QGraphicsSceneMouseEvent *event); + void handleMouseMoveEvent(QGraphicsSceneMouseEvent *event); + void handleMouseReleaseEvent(QGraphicsSceneMouseEvent *); + int calcCurrentIndex(); void updateCurrent(); static void fixOffsetCallback(void*); -- cgit v0.12 From e65aac1dbbeb26575554da10e2531694e8db5ac9 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 17 Sep 2010 13:46:44 +1000 Subject: Moving items in a PathView caused PathView.onPath to be set to false. Check that we no longer hold a reference to the item before setting onPath to false. Task-number: QTBUG-13689 Reviewed-by: Michael Brasser (cherry picked from commit 7e6b2b2b95bc1db77544b898ec45ea4a2683e435) --- .../graphicsitems/qdeclarativepathview.cpp | 8 +++++--- .../qdeclarativepathview/data/datamodel.qml | 1 + .../tst_qdeclarativepathview.cpp | 23 ++++++++++++++-------- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 119ac3e..d134929 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -141,11 +141,13 @@ void QDeclarativePathViewPrivate::releaseItem(QDeclarativeItem *item) { if (!item || !model) return; - if (QDeclarativePathViewAttached *att = attached(item)) - att->setOnPath(false); QDeclarativeItemPrivate *itemPrivate = static_cast(QGraphicsItemPrivate::get(item)); itemPrivate->removeItemChangeListener(this, QDeclarativeItemPrivate::Geometry); - model->release(item); + if (model->release(item) == 0) { + // item was not destroyed, and we no longer reference it. + if (QDeclarativePathViewAttached *att = attached(item)) + att->setOnPath(false); + } } QDeclarativePathViewAttached *QDeclarativePathViewPrivate::attached(QDeclarativeItem *item) diff --git a/tests/auto/declarative/qdeclarativepathview/data/datamodel.qml b/tests/auto/declarative/qdeclarativepathview/data/datamodel.qml index a5c3772..fb3c910 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/datamodel.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/datamodel.qml @@ -21,6 +21,7 @@ PathView { Rectangle { id: wrapper objectName: "wrapper" + property bool onPath: PathView.onPath width: 20; height: 20; color: name Text { objectName: "myText" diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index 74d2f0a..cbfbfbd 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -152,27 +152,27 @@ public: QString number(int index) const { return list.at(index).second; } void addItem(const QString &name, const QString &number) { - emit beginInsertRows(QModelIndex(), list.count(), list.count()); + beginInsertRows(QModelIndex(), list.count(), list.count()); list.append(QPair(name, number)); - emit endInsertRows(); + endInsertRows(); } void insertItem(int index, const QString &name, const QString &number) { - emit beginInsertRows(QModelIndex(), index, index); + beginInsertRows(QModelIndex(), index, index); list.insert(index, QPair(name, number)); - emit endInsertRows(); + endInsertRows(); } void removeItem(int index) { - emit beginRemoveRows(QModelIndex(), index, index); + beginRemoveRows(QModelIndex(), index, index); list.removeAt(index); - emit endRemoveRows(); + endRemoveRows(); } void moveItem(int from, int to) { - emit beginMoveRows(QModelIndex(), from, from, QModelIndex(), to); + beginMoveRows(QModelIndex(), from, from, QModelIndex(), to); list.move(from, to); - emit endMoveRows(); + endMoveRows(); } void modifyItem(int idx, const QString &name, const QString &number) { @@ -411,6 +411,13 @@ void tst_QDeclarativePathView::dataModel() QVERIFY(text); QCOMPARE(text->text(), model.name(3)); + model.moveItem(3, 5); + QTRY_COMPARE(findItems(pathview, "wrapper").count(), 5); + QList items = findItems(pathview, "wrapper"); + foreach (QDeclarativeItem *item, items) { + QVERIFY(item->property("onPath").toBool()); + } + delete canvas; } -- cgit v0.12 From 78f36a24500f393af53486a3cc1a63b748e982d7 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 20 Sep 2010 09:35:26 +0200 Subject: qtextcodec_symbian: Add few aliases Reviewed-by: Denis (cherry picked from commit 2b230dbc9a784e577c08fa25db3e975952849297) --- src/corelib/codecs/qtextcodec_symbian.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/codecs/qtextcodec_symbian.cpp b/src/corelib/codecs/qtextcodec_symbian.cpp index d59998f..9d7e856 100644 --- a/src/corelib/codecs/qtextcodec_symbian.cpp +++ b/src/corelib/codecs/qtextcodec_symbian.cpp @@ -122,8 +122,8 @@ static const QSymbianCodecInitData codecsData[] = { { /*271085624*/ 271085624, 114, "GB18030\0" }, { /*536929574*/ 536929574, 38, "EUC-KR\0" }, { /*536936703*/ 536936703, 0, "CP949\0" }, - { /*536936705*/ 536936705, 37, "ISO-2022-KR\0" }, - { /*536941517*/ 536941517, 36, "KS_C_5601-1987\0" } + { /*536936705*/ 536936705, 37, "ISO-2022-KR\0csISO2022KR\0" }, + { /*536941517*/ 536941517, 36, "KS_C_5601-1987\0iso-ir-149\0KS_C_5601-1989\0KSC_5601\0Korean\0csKSC56011987\0" } }; -- cgit v0.12 From c2f239dc35a01502ba6157096f4e91d7af624a5e Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 21 Sep 2010 15:22:01 +0300 Subject: Improved output of patch_capabilities.pl script More detailed output of what was patched reduces user confusion. Properly prefixed output messages can also be easily parsed by IDEs like Qt Creator. Task-number: QTBUG-13760 Reviewed-by: Janne Koskinen (cherry picked from commit 1eeec88caa45d7c3f6b8371bc84bb8d172b0b02e) --- bin/patch_capabilities.pl | 83 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 64 insertions(+), 19 deletions(-) diff --git a/bin/patch_capabilities.pl b/bin/patch_capabilities.pl index 0c0538c..a85f073 100755 --- a/bin/patch_capabilities.pl +++ b/bin/patch_capabilities.pl @@ -46,7 +46,13 @@ # ####################################################################### +# +# Note: Please make sure to output all changes done to the pkg file in a print statements +# starting with "Patching: " to ease integration into IDEs! +# + use File::Copy; +use File::Spec; sub Usage() { print("This script can be used to set capabilities of all binaries\n"); @@ -142,39 +148,56 @@ if (@ARGV) # Parse each line. while () { - # Patch pkg UID my $line = $_; my $newLine = $line; - if ($line =~ m/^\#.*\(0x[0-9|a-f|A-F]*\).*$/) + + # Patch pkg UID if it's in protected range + if ($line =~ m/^\#.*\((0x[0-7][0-9|a-f|A-F]*)\).*$/) { - $newLine =~ s/\(0x./\(0xE/; + my $oldUID = $1; + my $newUID = $oldUID; + $newUID =~ s/0x./0xE/i; + $newLine =~ s/$oldUID/$newUID/; + print ("Patching: UID $oldUID is not compatible with self-signing! Changed to: $newUID.\n"); } - # Patch embedded sis name and UID - if ($line =~ m/^@.*\.sis.*\(0x[0-9|a-f|A-F]*\).*$/) + # Patch embedded sis name and UID if UID is in protected range + if ($line =~ m/^@\"*(.*\.sis).*\((0x[0-7][0-9|a-f|A-F]*)\).*$/) { - $newLine =~ s/\(0x./\(0xE/; - if ($line !~ m/^.*_selfsigned.sis.*$/) + my $oldSisName = $1; + my $oldUID = $2; + my $newUID = $oldUID; + $newUID =~ s/0x./0xE/i; + $newLine =~ s/$oldUID/$newUID/; + print ("Patching: Embedded sis $oldSisName UID $oldUID changed to: $newUID.\n"); + + if ($oldSisName !~ m/^.*_selfsigned.sis$/i) { - $newLine =~ s/\.sis/_selfsigned\.sis/i; + my $newSisName = $oldSisName; + $newSisName =~ s/\.sis$/_selfsigned\.sis/i; + $newLine =~ s/$oldSisName/$newSisName/i; + print ("Patching: Embedded sis $oldSisName name changed to: $newSisName.\n"); } } - # Remove dependencies to known problem packages (i.e. packages that are likely to be patched, also) + # Remove dependencies to known problem packages (i.e. packages that are likely to be patched, too) # to reduce unnecessary error messages. - if ($line =~ m/^\(0x2002af5f\).*\{.*\}$/) + if ($line =~ m/^\((0x2002af5f)\).*\{.*\}$/) { - $newLine = "\n" + $newLine = "\n"; + print ("Patching: Removed dependency to sqlite3.sis ($1) to avoid installation issues in case sqlite3.sis is also patched.\n"); } - if ($line =~ m/^\(0x2001E61C\).*\{.*\}$/) + if ($line =~ m/^\((0x2001E61C)\).*\{.*\}$/) { - $newLine = "\n" + $newLine = "\n"; + print ("Patching: Removed dependency to qt.sis ($1) to avoid installation issues in case qt.sis is also patched.\n"); } # Remove manufacturer ifdef if ($line =~ m/^.*\(MANUFACTURER\)\=\(.*\).*$/) { $newLine = "\n"; + print ("Patching: Removed manufacturer check as it is usually not desirable in self-signed packages.\n"); } if ($line =~ m/^ELSEIF.*MANUFACTURER$/) @@ -240,7 +263,9 @@ if (@ARGV) foreach my $binaryPath(@binaries) { # Create the command line for setting the capabilities. + my ($binaryVolume, $binaryDirs, $binaryBaseName) = File::Spec->splitpath($binaryPath); my $commandToExecute = $baseCommandToExecute; + my $executeNeeded = 0; if (@capabilitiesSpecified) { $commandToExecute = sprintf($baseCommandToExecute, join(" ", @capabilitiesSpecified)); @@ -250,34 +275,54 @@ if (@ARGV) my $dllCaps; open($dllCaps, "elftran -dump s $binaryPath |") or die ("Could not execute elftran"); my $capsFound = 0; + my $originalVid; my @capabilitiesToSet; my $capabilitiesToAllow = join(" ", @capabilitiesToAllow); + my @capabilitiesToDrop; while (<$dllCaps>) { + if (/^Vendor ID: (.*)$/) { + $originalVid = "$1"; + } if (!$capsFound) { $capsFound = 1 if (/Capabilities:/); } else { $_ = trim($_); if ($capabilitiesToAllow =~ /$_/) { push(@capabilitiesToSet, $_); + } else { + push(@capabilitiesToDrop, $_); } } } close($dllCaps); + if ($originalVid !~ "00000000") { + print ("Patching: Vendor ID (0x$originalVid) incompatible with self-signed packages, setting it to zero for \"$binaryBaseName\".\n"); + $executeNeeded = 1; + } + if ($#capabilitiesToDrop) { + my $capsToDropStr = join("\", \"", @capabilitiesToDrop); + $capsToDropStr =~ s/\", \"$//; + + print ("Patching: The following capabilities used in \"$binaryBaseName\" are not compatible with a self-signed package and will be removed: \"$capsToDropStr\".\n"); + $executeNeeded = 1; + } $commandToExecute = sprintf($baseCommandToExecute, join(" ", @capabilitiesToSet)); } $commandToExecute .= $binaryPath; - # Actually execute the elftran command to set the capabilities. - print ("Executing ".$commandToExecute."\n"); - system ($commandToExecute." > $nullDevice"); - + if ($executeNeeded) { + # Actually execute the elftran command to set the capabilities. + print ("\n"); + system ("$commandToExecute > $nullDevice"); + } ## Create another command line to check that the set capabilities are correct. #$commandToExecute = "elftran -dump s ".$binaryPath; } print ("\n"); - print ("NOTE: A patched package may not work as expected due to reduced capabilities.\n"); - print (" Therefore it should not be used for any kind of Symbian signing or distribution!\n"); + print ("NOTE: A patched package may not work as expected due to reduced capabilities and other modifications,\n"); + print (" so it should not be used for any kind of Symbian signing or distribution!\n"); + print (" Use a proper certificate to avoid the need to patch the package.\n"); print ("\n"); } } -- cgit v0.12 From f6d61e677db6364cb6e8214531fc442931063a91 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 17 Sep 2010 11:28:23 +1000 Subject: Doc changes (cherry picked from commit ee9c9e412fd5467e82be446603e71bee620ff04b) --- src/declarative/util/qdeclarativelistmodel.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index cf2eada..f01d9b4 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -154,10 +154,10 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM handler. You must call sync() or else the changes made to the list from the external thread will not be reflected in the list model in the main thread. - \section1 Limitations + \section1 Restrictions - If a list model is to be accessed from a WorkerScript, it \bold cannot - contain list data. So, the following model cannot be used from a WorkerScript + If a list model is to be accessed from a WorkerScript, it cannot + contain list-type data. So, the following model cannot be used from a WorkerScript because of the list contained in the "attributes" property: \code @@ -174,7 +174,7 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM } \endcode - In addition, the WorkerScript cannot add any list data to the model. + In addition, the WorkerScript cannot add list-type data to the model. \sa {qmlmodels}{Data Models}, {declarative/threading/threadedlistmodel}{Threaded ListModel example}, QtDeclarative */ -- cgit v0.12 From 5ef8bc9393dcd06062bd38d6761e23837d7a86c5 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 17 Sep 2010 14:16:08 +1000 Subject: Remove duplicated move() implementations (cherry picked from commit 16013f8970471f161db9fcc728a8c263e5bb84a7) --- src/declarative/util/qdeclarativelistmodel.cpp | 60 +++++++++++--------------- 1 file changed, 26 insertions(+), 34 deletions(-) diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index f01d9b4..401e400 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -58,6 +58,28 @@ Q_DECLARE_METATYPE(QListModelInterface *) QT_BEGIN_NAMESPACE +template +void qdeclarativelistmodel_move(int from, int to, int n, T *items) +{ + if (n == 1) { + items->move(from, to); + } else { + T replaced; + int i=0; + typename T::ConstIterator it=items->begin(); it += from+n; + for (; ibegin(); it += from; + for (; ibegin(); t += from; + for (; f != replaced.end(); ++f, ++t) + *t = *f; + } +} + QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListModelData::instructions() const { return (QDeclarativeListModelParser::ListInstruction *)((char *)this + sizeof(ListModelData)); @@ -947,23 +969,7 @@ void FlatListModel::setProperty(int index, const QString& property, const QVaria void FlatListModel::move(int from, int to, int n) { - if (n == 1) { - m_values.move(from, to); - } else { - QList > replaced; - int i=0; - QList >::ConstIterator it=m_values.begin(); it += from+n; - for (; i >::ConstIterator f=replaced.begin(); - QList >::Iterator t=m_values.begin(); t += from; - for (; f != replaced.end(); ++f, ++t) - *t = *f; - } + qdeclarativelistmodel_move > >(from, to, n, &m_values); } bool FlatListModel::addValue(const QScriptValue &value, QHash *row, QList *roles) @@ -1130,23 +1136,9 @@ bool NestedListModel::insert(int index, const QScriptValue& valuemap) void NestedListModel::move(int from, int to, int n) { - if (n==1) { - _root->values.move(from,to); - } else { - QList replaced; - int i=0; - QVariantList::const_iterator it=_root->values.begin(); it += from+n; - for (; ivalues.begin(); it += from; - for (; ivalues.begin(); t += from; - for (; f != replaced.end(); ++f, ++t) - *t = *f; - } + if (!_root) + return; + qdeclarativelistmodel_move(from, to, n, &_root->values); } bool NestedListModel::append(const QScriptValue& valuemap) -- cgit v0.12 From 755a82fea47402be5857edf2f882e0135e02267a Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 17 Sep 2010 14:55:52 +1000 Subject: Make it clear that private ListModel constructor is only for worker agent. Also set up the worker list copy in the ListModel implementation instead of the agent. (cherry picked from commit c298ed31f8dfa917e5428820aecd39234b4c9097) --- src/declarative/util/qdeclarativelistmodel.cpp | 37 ++++++++++++++-------- src/declarative/util/qdeclarativelistmodel_p.h | 6 ++-- src/declarative/util/qdeclarativelistmodel_p_p.h | 2 ++ .../util/qdeclarativelistmodelworkeragent.cpp | 8 ++--- 4 files changed, 33 insertions(+), 20 deletions(-) diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 401e400..0be9122 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -217,17 +217,21 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM */ QDeclarativeListModel::QDeclarativeListModel(QObject *parent) -: QListModelInterface(parent), m_agent(0), m_nested(new NestedListModel(this)), m_flat(0), m_isWorkerCopy(false) +: QListModelInterface(parent), m_agent(0), m_nested(new NestedListModel(this)), m_flat(0) { } -QDeclarativeListModel::QDeclarativeListModel(bool workerCopy, QObject *parent) -: QListModelInterface(parent), m_agent(0), m_nested(0), m_flat(0), m_isWorkerCopy(workerCopy) +QDeclarativeListModel::QDeclarativeListModel(const QDeclarativeListModel *orig, QDeclarativeListModelWorkerAgent *parent) +: QListModelInterface(parent), m_agent(0), m_nested(0), m_flat(0) { - if (workerCopy) - m_flat = new FlatListModel(this); - else - m_nested = new NestedListModel(this); + m_flat = new FlatListModel(this); + m_flat->m_parentAgent = parent; + + if (orig->m_flat) { + m_flat->m_roles = orig->m_flat->m_roles; + m_flat->m_strings = orig->m_flat->m_strings; + m_flat->m_values = orig->m_flat->m_values; + } } QDeclarativeListModel::~QDeclarativeListModel() @@ -269,6 +273,11 @@ bool QDeclarativeListModel::flatten() return true; } +bool QDeclarativeListModel::inWorkerThread() const +{ + return m_flat && m_flat->m_parentAgent; +} + QDeclarativeListModelWorkerAgent *QDeclarativeListModel::agent() { if (m_agent) @@ -333,7 +342,7 @@ void QDeclarativeListModel::clear() else m_nested->clear(); - if (!m_isWorkerCopy) { + if (!inWorkerThread()) { emit itemsRemoved(0, cleared); emit countChanged(); } @@ -358,7 +367,7 @@ void QDeclarativeListModel::remove(int index) else m_nested->remove(index); - if (!m_isWorkerCopy) { + if (!inWorkerThread()) { emit itemsRemoved(index, 1); emit countChanged(); } @@ -392,7 +401,7 @@ void QDeclarativeListModel::insert(int index, const QScriptValue& valuemap) } bool ok = m_flat ? m_flat->insert(index, valuemap) : m_nested->insert(index, valuemap); - if (ok && !m_isWorkerCopy) { + if (ok && !inWorkerThread()) { emit itemsInserted(index, 1); emit countChanged(); } @@ -438,7 +447,7 @@ void QDeclarativeListModel::move(int from, int to, int n) else m_nested->move(from, to, n); - if (!m_isWorkerCopy) + if (!inWorkerThread()) emit itemsMoved(origfrom, origto, orign); } @@ -529,7 +538,7 @@ void QDeclarativeListModel::set(int index, const QScriptValue& valuemap) else m_nested->set(index, valuemap, &roles); - if (!m_isWorkerCopy) + if (!inWorkerThread()) emit itemsChanged(index, 1, roles); } } @@ -560,7 +569,7 @@ void QDeclarativeListModel::setProperty(int index, const QString& property, cons else m_nested->setProperty(index, property, value, &roles); - if (!m_isWorkerCopy) + if (!inWorkerThread()) emit itemsChanged(index, 1, roles); } @@ -848,7 +857,7 @@ bool QDeclarativeListModelParser::definesEmptyList(const QString &s) */ FlatListModel::FlatListModel(QDeclarativeListModel *base) - : m_scriptEngine(0), m_listModel(base) + : m_scriptEngine(0), m_listModel(base), m_parentAgent(0) { } diff --git a/src/declarative/util/qdeclarativelistmodel_p.h b/src/declarative/util/qdeclarativelistmodel_p.h index 6aff9c6..0a5e3ff 100644 --- a/src/declarative/util/qdeclarativelistmodel_p.h +++ b/src/declarative/util/qdeclarativelistmodel_p.h @@ -98,14 +98,16 @@ private: friend class QDeclarativeListModelWorkerAgent; friend struct ModelNode; + // Constructs a flat list model for a worker agent + QDeclarativeListModel(const QDeclarativeListModel *orig, QDeclarativeListModelWorkerAgent *parent); + QDeclarativeListModel(bool workerCopy, QObject *parent=0); bool flatten(); - bool modifyCheck(); + bool inWorkerThread() const; QDeclarativeListModelWorkerAgent *m_agent; NestedListModel *m_nested; FlatListModel *m_flat; - bool m_isWorkerCopy; }; // ### FIXME diff --git a/src/declarative/util/qdeclarativelistmodel_p_p.h b/src/declarative/util/qdeclarativelistmodel_p_p.h index 8231414..1e9513e 100644 --- a/src/declarative/util/qdeclarativelistmodel_p_p.h +++ b/src/declarative/util/qdeclarativelistmodel_p_p.h @@ -102,6 +102,8 @@ private: QHash m_strings; QList > m_values; QDeclarativeListModel *m_listModel; + + QDeclarativeListModelWorkerAgent *m_parentAgent; }; class NestedListModel diff --git a/src/declarative/util/qdeclarativelistmodelworkeragent.cpp b/src/declarative/util/qdeclarativelistmodelworkeragent.cpp index 4392bed..658584e 100644 --- a/src/declarative/util/qdeclarativelistmodelworkeragent.cpp +++ b/src/declarative/util/qdeclarativelistmodelworkeragent.cpp @@ -83,11 +83,11 @@ void QDeclarativeListModelWorkerAgent::Data::changedChange(int index, int count) } QDeclarativeListModelWorkerAgent::QDeclarativeListModelWorkerAgent(QDeclarativeListModel *model) -: m_engine(0), m_ref(1), m_orig(model), m_copy(new QDeclarativeListModel(true, this)) + : m_engine(0), + m_ref(1), + m_orig(model), + m_copy(new QDeclarativeListModel(m_orig, this)) { - m_copy->m_flat->m_roles = m_orig->m_flat->m_roles; - m_copy->m_flat->m_strings = m_orig->m_flat->m_strings; - m_copy->m_flat->m_values = m_orig->m_flat->m_values; } QDeclarativeListModelWorkerAgent::~QDeclarativeListModelWorkerAgent() -- cgit v0.12 From ef414bc0ac9eb0feea57a578757be894abe226c0 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 17 Sep 2010 15:15:15 +1000 Subject: Changes to objects returned from get() should emit itemsChanged() so that the view is updated (currently the model data changes but the view does not). In flat-model mode, get() now returns a QScriptClass-type object so that changes to the returned object are received, and for nested-model mode, the fix adds a QDeclarativeOpenMetaObject subclass and ModelNode::listIndex so that itemsChanged() can be emitted when the node data changes. Task-number: QTBUG-12363 (cherry picked from commit c2bbef949126826f0330c69dff1a8c96919f69a5) --- src/declarative/util/qdeclarativelistmodel.cpp | 293 ++++++++++++++++++-- src/declarative/util/qdeclarativelistmodel_p.h | 6 +- src/declarative/util/qdeclarativelistmodel_p_p.h | 121 +++++++- .../util/qdeclarativelistmodelworkeragent.cpp | 25 +- .../util/qdeclarativelistmodelworkeragent_p.h | 4 + .../tst_qdeclarativelistmodel.cpp | 307 +++++++++++++++++++-- 6 files changed, 698 insertions(+), 58 deletions(-) diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 0be9122..68e97b0 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -231,6 +231,10 @@ QDeclarativeListModel::QDeclarativeListModel(const QDeclarativeListModel *orig, m_flat->m_roles = orig->m_flat->m_roles; m_flat->m_strings = orig->m_flat->m_strings; m_flat->m_values = orig->m_flat->m_values; + + m_flat->m_nodeData.reserve(m_flat->m_values.count()); + for (int i=0; im_values.count(); i++) + m_flat->m_nodeData << 0; } } @@ -267,6 +271,10 @@ bool QDeclarativeListModel::flatten() flat->m_strings.insert(s, roles[i]); } + flat->m_nodeData.reserve(flat->m_values.count()); + for (int i=0; im_values.count(); i++) + flat->m_nodeData << 0; + m_flat = flat; delete m_nested; m_nested = 0; @@ -425,7 +433,7 @@ void QDeclarativeListModel::move(int from, int to, int n) { if (n==0 || from==to) return; - if (from+n > count() || to+n > count() || from < 0 || to < 0 || n < 0) { + if (!canMove(from, to, n)) { qmlInfo(this) << tr("move: out of range"); return; } @@ -476,11 +484,15 @@ void QDeclarativeListModel::append(const QScriptValue& valuemap) /*! \qmlmethod object ListModel::get(int index) - Returns the item at \a index in the list model. + Returns the item at \a index in the list model. This allows the item + data to be accessed or modified from JavaScript: \code - fruitModel.append({"cost": 5.95, "name":"Jackfruit"}) - fruitModel.get(0).cost + Component.onCompleted: { + fruitModel.append({"cost": 5.95, "name":"Jackfruit"}); + console.log(fruitModel.get(0).cost); + fruitModel.get(0).cost = 10.95; + } \endcode The \a index must be an element in the list. @@ -495,6 +507,9 @@ void QDeclarativeListModel::append(const QScriptValue& valuemap) fruitModel.get(0).attributes.get(1).value; // == "green" \endcode + \warning The returned object is not guaranteed to remain valid. It + should not be used in \l{Property Binding}{property bindings}. + \sa append() */ QScriptValue QDeclarativeListModel::get(int index) const @@ -736,7 +751,7 @@ void QDeclarativeListModelParser::setCustomData(QObject *obj, const QByteArray & { QDeclarativeListModel *rv = static_cast(obj); - ModelNode *root = new ModelNode; + ModelNode *root = new ModelNode(rv->m_nested); rv->m_nested->_root = root; QStack nodes; nodes << root; @@ -753,7 +768,7 @@ void QDeclarativeListModelParser::setCustomData(QObject *obj, const QByteArray & case ListInstruction::Push: { ModelNode *n = nodes.top(); - ModelNode *n2 = new ModelNode; + ModelNode *n2 = new ModelNode(rv->m_nested); n->values << qVariantFromValue(n2); nodes.push(n2); if (processingSet) @@ -792,7 +807,7 @@ void QDeclarativeListModelParser::setCustomData(QObject *obj, const QByteArray & case ListInstruction::Set: { ModelNode *n = nodes.top(); - ModelNode *n2 = new ModelNode; + ModelNode *n2 = new ModelNode(rv->m_nested); n->properties.insert(QString::fromUtf8(data + instr.dataIdx), n2); nodes.push(n2); processingSet = true; @@ -800,6 +815,13 @@ void QDeclarativeListModelParser::setCustomData(QObject *obj, const QByteArray & break; } } + + ModelNode *rootNode = rv->m_nested->_root; + for (int i=0; ivalues.count(); ++i) { + ModelNode *node = qvariant_cast(rootNode->values[i]); + node->listIndex = i; + node->updateListIndexes(); + } } bool QDeclarativeListModelParser::definesEmptyList(const QString &s) @@ -814,6 +836,7 @@ bool QDeclarativeListModelParser::definesEmptyList(const QString &s) return false; } + /*! \qmlclass ListElement QDeclarativeListElement \ingroup qml-working-with-data @@ -857,12 +880,13 @@ bool QDeclarativeListModelParser::definesEmptyList(const QString &s) */ FlatListModel::FlatListModel(QDeclarativeListModel *base) - : m_scriptEngine(0), m_listModel(base), m_parentAgent(0) + : m_scriptEngine(0), m_listModel(base), m_scriptClass(0), m_parentAgent(0) { } FlatListModel::~FlatListModel() { + qDeleteAll(m_nodeData); } QHash FlatListModel::data(int index, const QList &roles) const @@ -906,11 +930,15 @@ int FlatListModel::count() const void FlatListModel::clear() { m_values.clear(); + + qDeleteAll(m_nodeData); + m_nodeData.clear(); } void FlatListModel::remove(int index) { m_values.removeAt(index); + removedNode(index); } bool FlatListModel::append(const QScriptValue &value) @@ -927,6 +955,8 @@ bool FlatListModel::insert(int index, const QScriptValue &value) return false; m_values.insert(index, row); + insertedNode(index); + return true; } @@ -940,13 +970,17 @@ QScriptValue FlatListModel::get(int index) const if (index < 0 || index >= m_values.count()) return scriptEngine->undefinedValue(); - QScriptValue rv = scriptEngine->newObject(); + FlatListModel *that = const_cast(this); + if (!m_scriptClass) + that->m_scriptClass = new FlatListScriptClass(that, scriptEngine); - QHash row = m_values.at(index); - for (QHash::ConstIterator iter = row.begin(); iter != row.end(); ++iter) - rv.setProperty(m_roles.value(iter.key()), qScriptValueFromValue(scriptEngine, iter.value())); + FlatNodeData *data = m_nodeData.value(index); + if (!data) { + data = new FlatNodeData(index); + that->m_nodeData.replace(index, data); + } - return rv; + return QScriptDeclarativeClass::newObject(scriptEngine, m_scriptClass, new FlatNodeObjectData(data)); } void FlatListModel::set(int index, const QScriptValue &value, QList *roles) @@ -979,6 +1013,7 @@ void FlatListModel::setProperty(int index, const QString& property, const QVaria void FlatListModel::move(int from, int to, int n) { qdeclarativelistmodel_move > >(from, to, n, &m_values); + moveNodes(from, to, n); } bool FlatListModel::addValue(const QScriptValue &value, QHash *row, QList *roles) @@ -1008,6 +1043,139 @@ bool FlatListModel::addValue(const QScriptValue &value, QHash *ro return true; } +void FlatListModel::insertedNode(int index) +{ + if (index >= 0 && index <= m_values.count()) { + m_nodeData.insert(index, 0); + + for (int i=index + 1; iindex = i; + } + } +} + +void FlatListModel::removedNode(int index) +{ + if (index >= 0 && index < m_nodeData.count()) { + delete m_nodeData.takeAt(index); + + for (int i=index; iindex = i; + } + } +} + +void FlatListModel::moveNodes(int from, int to, int n) +{ + if (!m_listModel->canMove(from, to, n)) + return; + + qdeclarativelistmodel_move >(from, to, n, &m_nodeData); + + for (int i=from; iindex = i; + } +} + + + +FlatNodeData::~FlatNodeData() +{ + for (QSet::Iterator iter = objects.begin(); iter != objects.end(); ++iter) { + FlatNodeObjectData *data = *iter; + data->nodeData = 0; + } +} + +void FlatNodeData::addData(FlatNodeObjectData *data) +{ + objects.insert(data); +} + +void FlatNodeData::removeData(FlatNodeObjectData *data) +{ + objects.remove(data); +} + + +FlatListScriptClass::FlatListScriptClass(FlatListModel *model, QScriptEngine *seng) + : QScriptDeclarativeClass(seng), + m_model(model) +{ +} + +QScriptDeclarativeClass::Value FlatListScriptClass::property(Object *obj, const Identifier &name) +{ + FlatNodeObjectData *objData = static_cast(obj); + if (!objData->nodeData) // item at this index has been deleted + return QScriptDeclarativeClass::Value(engine(), engine()->undefinedValue()); + + int index = objData->nodeData->index; + QString propName = toString(name); + int role = m_model->m_strings.value(propName, -1); + + if (role >= 0 && index >=0 ) { + const QHash &row = m_model->m_values[index]; + QScriptValue sv = engine()->toScriptValue(row[role]); + return QScriptDeclarativeClass::Value(engine(), sv); + } + + return QScriptDeclarativeClass::Value(engine(), engine()->undefinedValue()); +} + +void FlatListScriptClass::setProperty(Object *obj, const Identifier &name, const QScriptValue &value) +{ + if (!value.isVariant() && !value.isRegExp() && !value.isDate() && value.isObject()) { + qmlInfo(m_model->m_listModel) << "Cannot add nested list values when modifying or after modification from a worker script"; + return; + } + + FlatNodeObjectData *objData = static_cast(obj); + if (!objData->nodeData) // item at this index has been deleted + return; + + int index = objData->nodeData->index; + QString propName = toString(name); + + int role = m_model->m_strings.value(propName, -1); + if (role >= 0 && index >= 0) { + QHash &row = m_model->m_values[index]; + row[role] = value.toVariant(); + + if (m_model->m_parentAgent) { + // This is the list in the worker thread, so tell the agent to + // emit itemsChanged() later + m_model->m_parentAgent->changedData(index, 1); + } else { + // This is the list in the main thread, so emit itemsChanged() + QList roles; + roles << role; + emit m_model->m_listModel->itemsChanged(index, 1, roles); + } + } +} + +QScriptClass::QueryFlags FlatListScriptClass::queryProperty(Object *, const Identifier &, QScriptClass::QueryFlags) +{ + return (QScriptClass::HandlesReadAccess | QScriptClass::HandlesWriteAccess); +} + +bool FlatListScriptClass::compare(Object *obj1, Object *obj2) +{ + FlatNodeObjectData *data1 = static_cast(obj1); + FlatNodeObjectData *data2 = static_cast(obj2); + + if (!data1->nodeData || !data2->nodeData) + return false; + + return data1->nodeData->index == data2->nodeData->index; +} + + + NestedListModel::NestedListModel(QDeclarativeListModel *base) : _root(0), m_ownsRoot(false), m_listModel(base), _rolesOk(false) { @@ -1133,11 +1301,12 @@ void NestedListModel::remove(int index) bool NestedListModel::insert(int index, const QScriptValue& valuemap) { if (!_root) { - _root = new ModelNode; + _root = new ModelNode(this); m_ownsRoot = true; } - ModelNode *mn = new ModelNode; + ModelNode *mn = new ModelNode(this); + mn->listIndex = index; mn->setObjectValue(valuemap); _root->values.insert(index,qVariantFromValue(mn)); return true; @@ -1153,12 +1322,11 @@ void NestedListModel::move(int from, int to, int n) bool NestedListModel::append(const QScriptValue& valuemap) { if (!_root) { - _root = new ModelNode; + _root = new ModelNode(this); m_ownsRoot = true; } - ModelNode *mn = new ModelNode; - mn->setObjectValue(valuemap); - _root->values << qVariantFromValue(mn); + + insert(count(), valuemap); return true; } @@ -1253,8 +1421,8 @@ QString NestedListModel::toString(int role) const } -ModelNode::ModelNode() -: modelCache(0), objectCache(0), isArray(false) +ModelNode::ModelNode(NestedListModel *model) +: modelCache(0), objectCache(0), isArray(false), m_model(model), listIndex(-1) { } @@ -1278,18 +1446,18 @@ void ModelNode::clear() properties.clear(); } -void ModelNode::setObjectValue(const QScriptValue& valuemap) { +void ModelNode::setObjectValue(const QScriptValue& valuemap, bool writeToCache) { QScriptValueIterator it(valuemap); while (it.hasNext()) { it.next(); - ModelNode *value = new ModelNode; + ModelNode *value = new ModelNode(m_model); QScriptValue v = it.value(); if (v.isArray()) { value->isArray = true; value->setListValue(v); } else { value->values << v.toVariant(); - if (objectCache) + if (writeToCache && objectCache) objectCache->setValue(it.name().toUtf8(), value->values.last()); } if (properties.contains(it.name())) @@ -1302,14 +1470,16 @@ void ModelNode::setListValue(const QScriptValue& valuelist) { values.clear(); int size = valuelist.property(QLatin1String("length")).toInt32(); for (int i=0; iisArray = true; value->setListValue(v); } else if (v.isObject()) { + value->listIndex = i; value->setObjectValue(v); } else { + value->listIndex = i; value->values << v.toVariant(); } values.append(qVariantFromValue(value)); @@ -1321,7 +1491,7 @@ void ModelNode::setProperty(const QString& prop, const QVariant& val) { if (it != properties.end()) { (*it)->values[0] = val; } else { - ModelNode *n = new ModelNode; + ModelNode *n = new ModelNode(m_model); n->values << val; properties.insert(prop,n); } @@ -1329,6 +1499,40 @@ void ModelNode::setProperty(const QString& prop, const QVariant& val) { objectCache->setValue(prop.toUtf8(), val); } +void ModelNode::updateListIndexes() +{ + for (QHash::ConstIterator iter = properties.begin(); iter != properties.end(); ++iter) { + ModelNode *node = iter.value(); + if (node->isArray) { + for (int i=0; ivalues.count(); ++i) { + ModelNode *subNode = qvariant_cast(node->values.at(i)); + if (subNode) + subNode->listIndex = i; + } + } + node->updateListIndexes(); + } +} + +/* + Need to call this to emit itemsChanged() for modifications outside of set() + and setProperty(), i.e. if an item returned from get() is modified +*/ +void ModelNode::changedProperty(const QString &name) const +{ + if (listIndex < 0) + return; + + m_model->checkRoles(); + QList roles; + int role = m_model->roleStrings.indexOf(name); + if (role < 0) + roles = m_model->roles(); + else + roles << role; + emit m_model->m_listModel->itemsChanged(listIndex, 1, roles); +} + void ModelNode::dump(ModelNode *node, int ind) { QByteArray indentBa(ind * 4, ' '); @@ -1350,16 +1554,47 @@ void ModelNode::dump(ModelNode *node, int ind) } } -ModelObject::ModelObject() -: _mo(new QDeclarativeOpenMetaObject(this)) +ModelObject::ModelObject(ModelNode *node, NestedListModel *model, QScriptEngine *seng) + : m_model(model), + m_node(node), + m_meta(new ModelNodeMetaObject(seng, this)) { } void ModelObject::setValue(const QByteArray &name, const QVariant &val) { - _mo->setValue(name, val); + m_meta->setValue(name, val); setProperty(name.constData(), val); } +void ModelObject::setNodeUpdatesEnabled(bool enable) +{ + m_meta->m_enabled = enable; +} + + +ModelNodeMetaObject::ModelNodeMetaObject(QScriptEngine *seng, ModelObject *object) + : QDeclarativeOpenMetaObject(object), + m_enabled(false), + m_seng(seng), + m_obj(object) +{ +} + +void ModelNodeMetaObject::propertyWritten(int index) +{ + if (!m_enabled) + return; + + QString propName = QString::fromUtf8(name(index)); + QVariant value = operator[](index); + + QScriptValue sv = m_seng->newObject(); + sv.setProperty(propName, m_seng->newVariant(value)); + m_obj->m_node->setObjectValue(sv, false); + + m_obj->m_node->changedProperty(propName); +} + QT_END_NAMESPACE diff --git a/src/declarative/util/qdeclarativelistmodel_p.h b/src/declarative/util/qdeclarativelistmodel_p.h index 0a5e3ff..fe42ef6 100644 --- a/src/declarative/util/qdeclarativelistmodel_p.h +++ b/src/declarative/util/qdeclarativelistmodel_p.h @@ -63,6 +63,7 @@ class FlatListModel; class NestedListModel; class QDeclarativeListModelWorkerAgent; struct ModelNode; +class FlatListScriptClass; class Q_DECLARATIVE_EXPORT QDeclarativeListModel : public QListModelInterface { Q_OBJECT @@ -96,15 +97,18 @@ Q_SIGNALS: private: friend class QDeclarativeListModelParser; friend class QDeclarativeListModelWorkerAgent; + friend class FlatListModel; + friend class FlatListScriptClass; friend struct ModelNode; // Constructs a flat list model for a worker agent QDeclarativeListModel(const QDeclarativeListModel *orig, QDeclarativeListModelWorkerAgent *parent); - QDeclarativeListModel(bool workerCopy, QObject *parent=0); bool flatten(); bool inWorkerThread() const; + inline bool canMove(int from, int to, int n) const { return !(from+n > count() || to+n > count() || from < 0 || to < 0 || n < 0); } + QDeclarativeListModelWorkerAgent *m_agent; NestedListModel *m_nested; FlatListModel *m_flat; diff --git a/src/declarative/util/qdeclarativelistmodel_p_p.h b/src/declarative/util/qdeclarativelistmodel_p_p.h index 1e9513e..acf4f3e 100644 --- a/src/declarative/util/qdeclarativelistmodel_p_p.h +++ b/src/declarative/util/qdeclarativelistmodel_p_p.h @@ -54,9 +54,11 @@ // #include "private/qdeclarativelistmodel_p.h" - -#include "qdeclarative.h" #include "private/qdeclarativeengine_p.h" +#include "private/qdeclarativeopenmetaobject_p.h" +#include "qdeclarative.h" + +#include QT_BEGIN_HEADER @@ -68,6 +70,8 @@ class QDeclarativeOpenMetaObject; class QScriptEngine; class QDeclarativeListModelWorkerAgent; struct ModelNode; +class FlatListScriptClass; +class FlatNodeData; class FlatListModel { @@ -94,8 +98,13 @@ public: private: friend class QDeclarativeListModelWorkerAgent; friend class QDeclarativeListModel; + friend class FlatListScriptClass; + friend class FlatNodeData; bool addValue(const QScriptValue &value, QHash *row, QList *roles); + void insertedNode(int index); + void removedNode(int index); + void moveNodes(int from, int to, int n); QScriptEngine *m_scriptEngine; QHash m_roles; @@ -103,9 +112,68 @@ private: QList > m_values; QDeclarativeListModel *m_listModel; + FlatListScriptClass *m_scriptClass; + QList m_nodeData; QDeclarativeListModelWorkerAgent *m_parentAgent; }; + +/* + Created when get() is called on a FlatListModel. This allows changes to the + object returned by get() to be tracked, and passed onto the model. +*/ +class FlatListScriptClass : public QScriptDeclarativeClass +{ +public: + FlatListScriptClass(FlatListModel *model, QScriptEngine *seng); + + Value property(Object *, const Identifier &); + void setProperty(Object *, const Identifier &name, const QScriptValue &); + QScriptClass::QueryFlags queryProperty(Object *, const Identifier &, QScriptClass::QueryFlags flags); + bool compare(Object *, Object *); + +private: + FlatListModel *m_model; +}; + +/* + FlatNodeData and FlatNodeObjectData allow objects returned by get() to still + point to the correct list index if move(), insert() or remove() are called. +*/ +struct FlatNodeObjectData; +class FlatNodeData +{ +public: + FlatNodeData(int i) + : index(i) {} + + ~FlatNodeData(); + + void addData(FlatNodeObjectData *data); + void removeData(FlatNodeObjectData *data); + + int index; + +private: + QSet objects; +}; + +struct FlatNodeObjectData : public QScriptDeclarativeClass::Object +{ + FlatNodeObjectData(FlatNodeData *data) : nodeData(data) { + nodeData->addData(this); + } + + ~FlatNodeObjectData() { + if (nodeData) + nodeData->removeData(this); + } + + FlatNodeData *nodeData; +}; + + + class NestedListModel { public: @@ -136,25 +204,50 @@ public: QDeclarativeListModel *m_listModel; private: + friend struct ModelNode; mutable QStringList roleStrings; mutable bool _rolesOk; }; +class ModelNodeMetaObject; class ModelObject : public QObject { Q_OBJECT public: - ModelObject(); + ModelObject(ModelNode *node, NestedListModel *model, QScriptEngine *seng); void setValue(const QByteArray &name, const QVariant &val); + void setNodeUpdatesEnabled(bool enable); + + NestedListModel *m_model; + ModelNode *m_node; private: - QDeclarativeOpenMetaObject *_mo; + ModelNodeMetaObject *m_meta; }; +class ModelNodeMetaObject : public QDeclarativeOpenMetaObject +{ +public: + ModelNodeMetaObject(QScriptEngine *seng, ModelObject *object); + + bool m_enabled; + +protected: + void propertyWritten(int index); + +private: + QScriptEngine *m_seng; + ModelObject *m_obj; +}; + + +/* + A ModelNode is created for each item in a NestedListModel. +*/ struct ModelNode { - ModelNode(); + ModelNode(NestedListModel *model); ~ModelNode(); QList values; @@ -167,30 +260,44 @@ struct ModelNode modelCache = new QDeclarativeListModel; QDeclarativeEngine::setContextForObject(modelCache,QDeclarativeEngine::contextForObject(model->m_listModel)); modelCache->m_nested->_root = this; // ListModel defaults to nestable model + + for (int i=0; i(values.at(i)); + if (subNode) + subNode->m_model = modelCache->m_nested; + } } return modelCache; } ModelObject *object(const NestedListModel *model) { if (!objectCache) { - objectCache = new ModelObject(); + objectCache = new ModelObject(this, + const_cast(model), + QDeclarativeEnginePrivate::getScriptEngine(qmlEngine(model->m_listModel))); QHash::iterator it; for (it = properties.begin(); it != properties.end(); ++it) { objectCache->setValue(it.key().toUtf8(), model->valueForNode(*it)); } + objectCache->setNodeUpdatesEnabled(true); } return objectCache; } - void setObjectValue(const QScriptValue& valuemap); + void setObjectValue(const QScriptValue& valuemap, bool writeToCache = true); void setListValue(const QScriptValue& valuelist); void setProperty(const QString& prop, const QVariant& val); + void changedProperty(const QString &name) const; + void updateListIndexes(); static void dump(ModelNode *node, int ind); QDeclarativeListModel *modelCache; ModelObject *objectCache; bool isArray; + + NestedListModel *m_model; + int listIndex; // only used for top-level nodes within a list }; diff --git a/src/declarative/util/qdeclarativelistmodelworkeragent.cpp b/src/declarative/util/qdeclarativelistmodelworkeragent.cpp index 658584e..6804d4a 100644 --- a/src/declarative/util/qdeclarativelistmodelworkeragent.cpp +++ b/src/declarative/util/qdeclarativelistmodelworkeragent.cpp @@ -86,7 +86,7 @@ QDeclarativeListModelWorkerAgent::QDeclarativeListModelWorkerAgent(QDeclarativeL : m_engine(0), m_ref(1), m_orig(model), - m_copy(new QDeclarativeListModel(m_orig, this)) + m_copy(new QDeclarativeListModel(model, this)) { } @@ -194,6 +194,11 @@ void QDeclarativeListModelWorkerAgent::sync() mutex.unlock(); } +void QDeclarativeListModelWorkerAgent::changedData(int index, int count) +{ + data.changedChange(index, count); +} + bool QDeclarativeListModelWorkerAgent::event(QEvent *e) { if (e->type() == QEvent::User) { @@ -216,6 +221,24 @@ bool QDeclarativeListModelWorkerAgent::event(QEvent *e) orig->m_strings = copy->m_strings; orig->m_values = copy->m_values; + // update the orig->m_nodeData list + for (int ii = 0; ii < changes.count(); ++ii) { + const Change &change = changes.at(ii); + switch (change.type) { + case Change::Inserted: + orig->insertedNode(change.index); + break; + case Change::Removed: + orig->removedNode(change.index); + break; + case Change::Moved: + orig->moveNodes(change.index, change.to, change.count); + break; + case Change::Changed: + break; + } + } + syncDone.wakeAll(); locker.unlock(); diff --git a/src/declarative/util/qdeclarativelistmodelworkeragent_p.h b/src/declarative/util/qdeclarativelistmodelworkeragent_p.h index 01da374..10c3bca 100644 --- a/src/declarative/util/qdeclarativelistmodelworkeragent_p.h +++ b/src/declarative/util/qdeclarativelistmodelworkeragent_p.h @@ -67,6 +67,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeListModel; +class FlatListScriptClass; class QDeclarativeListModelWorkerAgent : public QObject { @@ -115,6 +116,7 @@ protected: private: friend class QDeclarativeWorkerScriptEnginePrivate; + friend class FlatListScriptClass; QScriptEngine *m_engine; struct Change { @@ -141,6 +143,8 @@ private: QDeclarativeListModel *list; }; + void changedData(int index, int count); + QAtomicInt m_ref; QDeclarativeListModel *m_orig; QDeclarativeListModel *m_copy; diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index 10805b4..70ec416 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #include "../../../shared/util.h" @@ -57,6 +58,8 @@ #define SRCDIR "." #endif +Q_DECLARE_METATYPE(QList) + class tst_qdeclarativelistmodel : public QObject { Q_OBJECT @@ -64,6 +67,7 @@ public: tst_qdeclarativelistmodel() {} private: + int roleFromName(const QDeclarativeListModel *model, const QString &roleName); QScriptValue nestedListValue(QScriptEngine *eng) const; QDeclarativeItem *createWorkerTest(QDeclarativeEngine *eng, QDeclarativeComponent *component, QDeclarativeListModel *model); void waitForWorker(QDeclarativeItem *item); @@ -78,6 +82,8 @@ private slots: void dynamic(); void dynamic_worker_data(); void dynamic_worker(); + void dynamic_worker_sync_data(); + void dynamic_worker_sync(); void convertNestedToFlat_fail(); void convertNestedToFlat_fail_data(); void convertNestedToFlat_ok(); @@ -86,7 +92,23 @@ private slots: void error_data(); void error(); void set(); + void get(); + void get_data(); + void get_worker(); + void get_worker_data(); + void get_nested(); + void get_nested_data(); }; +int tst_qdeclarativelistmodel::roleFromName(const QDeclarativeListModel *model, const QString &roleName) +{ + QList roles = model->roles(); + for (int i=0; itoString(roles[i]) == roleName) + return roles[i]; + } + Q_ASSERT(false); + return -1; +} QScriptValue tst_qdeclarativelistmodel::nestedListValue(QScriptEngine *eng) const { @@ -196,6 +218,10 @@ void tst_qdeclarativelistmodel::dynamic_data() QTest::newRow("get1") << "{get(0) === undefined}" << 1 << ""; QTest::newRow("get2") << "{get(-1) === undefined}" << 1 << ""; QTest::newRow("get3") << "{append({'foo':123});get(0) != undefined}" << 1 << ""; + QTest::newRow("get4") << "{append({'foo':123});get(0).foo}" << 123 << ""; + + QTest::newRow("get-modify1") << "{append({'foo':123,'bar':456});get(0).foo = 333;get(0).foo}" << 333 << ""; + QTest::newRow("get-modify2") << "{append({'z':1});append({'foo':123,'bar':456});get(1).bar = 999;get(1).bar}" << 999 << ""; QTest::newRow("append1") << "{append({'foo':123});count}" << 1 << ""; QTest::newRow("append2") << "{append({'foo':123,'bar':456});count}" << 1 << ""; @@ -310,8 +336,12 @@ void tst_qdeclarativelistmodel::dynamic_worker() QFETCH(int, result); QFETCH(QString, warning); + if (QByteArray(QTest::currentDataTag()).startsWith("nested")) + return; + // This is same as dynamic() except it applies the test to a ListModel called - // from a WorkerScript (i.e. testing the internal NestedListModel class) + // from a WorkerScript (i.e. testing the internal FlatListModel that is created + // by the WorkerListModelAgent) QDeclarativeListModel model; QDeclarativeEngine eng; @@ -330,27 +360,62 @@ void tst_qdeclarativelistmodel::dynamic_worker() if (!warning.isEmpty()) QTest::ignoreMessage(QtWarningMsg, warning.toLatin1()); - if (operations.count() == 1) { - // test count(), get() return the correct default values in the worker list model - QVERIFY(QMetaObject::invokeMethod(item, "evalExpressionViaWorker", - Q_ARG(QVariant, operations))); - waitForWorker(item); - QCOMPARE(QDeclarativeProperty(item, "result").read().toInt(), result); - } else { - // execute a set of commands on the worker list model, then check the - // changes are reflected in the list model in the main thread - if (QByteArray(QTest::currentDataTag()).startsWith("nested")) - QTest::ignoreMessage(QtWarningMsg, ": QML ListModel: Cannot add nested list values when modifying or after modification from a worker script"); - - QVERIFY(QMetaObject::invokeMethod(item, "evalExpressionViaWorker", - Q_ARG(QVariant, operations.mid(0, operations.length()-1)))); - waitForWorker(item); - - QDeclarativeExpression e(eng.rootContext(), &model, operations.last().toString()); - if (!QByteArray(QTest::currentDataTag()).startsWith("nested")) - QCOMPARE(e.evaluate().toInt(), result); + QVERIFY(QMetaObject::invokeMethod(item, "evalExpressionViaWorker", + Q_ARG(QVariant, operations))); + waitForWorker(item); + QCOMPARE(QDeclarativeProperty(item, "result").read().toInt(), result); + + delete item; + qApp->processEvents(); +} + + + +void tst_qdeclarativelistmodel::dynamic_worker_sync_data() +{ + dynamic_data(); +} + +void tst_qdeclarativelistmodel::dynamic_worker_sync() +{ + QFETCH(QString, script); + QFETCH(int, result); + QFETCH(QString, warning); + + // This is the same as dynamic_worker() except that it executes a set of list operations + // from the worker script, calls sync(), and tests the changes are reflected in the + // list in the main thread + + QDeclarativeListModel model; + QDeclarativeEngine eng; + QDeclarativeComponent component(&eng, QUrl::fromLocalFile(SRCDIR "/data/model.qml")); + QDeclarativeItem *item = createWorkerTest(&eng, &component, &model); + QVERIFY(item != 0); + + if (script[0] == QLatin1Char('{') && script[script.length()-1] == QLatin1Char('}')) + script = script.mid(1, script.length() - 2); + QVariantList operations; + foreach (const QString &s, script.split(';')) { + if (!s.isEmpty()) + operations << s; } + if (!warning.isEmpty()) + QTest::ignoreMessage(QtWarningMsg, warning.toLatin1()); + + // execute a set of commands on the worker list model, then check the + // changes are reflected in the list model in the main thread + if (QByteArray(QTest::currentDataTag()).startsWith("nested")) + QTest::ignoreMessage(QtWarningMsg, ": QML ListModel: Cannot add nested list values when modifying or after modification from a worker script"); + + QVERIFY(QMetaObject::invokeMethod(item, "evalExpressionViaWorker", + Q_ARG(QVariant, operations.mid(0, operations.length()-1)))); + waitForWorker(item); + + QDeclarativeExpression e(eng.rootContext(), &model, operations.last().toString()); + if (!QByteArray(QTest::currentDataTag()).startsWith("nested")) + QCOMPARE(e.evaluate().toInt(), result); + delete item; qApp->processEvents(); } @@ -595,6 +660,9 @@ void tst_qdeclarativelistmodel::error() } } +/* + Test model changes from set() are available to the view +*/ void tst_qdeclarativelistmodel::set() { QDeclarativeEngine engine; @@ -618,6 +686,205 @@ void tst_qdeclarativelistmodel::set() QCOMPARE(model.data(0, model.roles()[0]), qVariantFromValue(false)); } +/* + Test model changes on values returned by get() are available to the view +*/ +void tst_qdeclarativelistmodel::get() +{ + QFETCH(QString, expression); + QFETCH(int, index); + QFETCH(QString, roleName); + QFETCH(QVariant, roleValue); + + QDeclarativeEngine eng; + QDeclarativeComponent component(&eng); + component.setData( + "import Qt 4.7\n" + "ListModel { \n" + "ListElement { roleA: 100 }\n" + "ListElement { roleA: 200; roleB: 400 } \n" + "ListElement { roleA: 200; roleB: 400 } \n" + "}", QUrl()); + QDeclarativeListModel *model = qobject_cast(component.create()); + int role = roleFromName(model, roleName); + + QSignalSpy spy(model, SIGNAL(itemsChanged(int, int, QList))); + QDeclarativeExpression expr(eng.rootContext(), model, expression); + expr.evaluate(); + QVERIFY(!expr.hasError()); + + QCOMPARE(model->data(index, role), roleValue); + QCOMPARE(spy.count(), 1); + + QList spyResult = spy.takeFirst(); + QCOMPARE(spyResult.at(0).toInt(), index); + QCOMPARE(spyResult.at(1).toInt(), 1); // only 1 item is modified at a time + QCOMPARE(spyResult.at(2).value >(), (QList() << role)); +} + +void tst_qdeclarativelistmodel::get_data() +{ + QTest::addColumn("expression"); + QTest::addColumn("index"); + QTest::addColumn("roleName"); + QTest::addColumn("roleValue"); + + QTest::newRow("simple value") << "get(0).roleA = 500" << 0 << "roleA" << QVariant(500); + QTest::newRow("simple value 2") << "get(1).roleB = 500" << 1 << "roleB" << QVariant(500); + + QVariantMap map; + map["zzz"] = 123; + QTest::newRow("object value") << "get(1).roleB = {'zzz':123}" << 1 << "roleB" << QVariant::fromValue(map); + + QVariantList list; + map.clear(); map["a"] = 50; map["b"] = 500; + list << map; + map.clear(); map["c"] = 1000; + list << map; + QTest::newRow("list of objects") << "get(2).roleB = [{'a': 50, 'b': 500}, {'c': 1000}]" << 2 << "roleB" << QVariant::fromValue(list); +} + +void tst_qdeclarativelistmodel::get_worker() +{ + QFETCH(QString, expression); + QFETCH(int, index); + QFETCH(QString, roleName); + QFETCH(QVariant, roleValue); + + QDeclarativeListModel model; + QDeclarativeEngine eng; + QDeclarativeComponent component(&eng, QUrl::fromLocalFile(SRCDIR "/data/model.qml")); + QDeclarativeItem *item = createWorkerTest(&eng, &component, &model); + QVERIFY(item != 0); + QScriptEngine *seng = QDeclarativeEnginePrivate::getScriptEngine(&eng); + + // Add some values like get() test + QScriptValue sv = seng->newObject(); + sv.setProperty(QLatin1String("roleA"), seng->newVariant(QVariant::fromValue(100))); + model.append(sv); + sv = seng->newObject(); + sv.setProperty(QLatin1String("roleA"), seng->newVariant(QVariant::fromValue(200))); + sv.setProperty(QLatin1String("roleB"), seng->newVariant(QVariant::fromValue(400))); + model.append(sv); + model.append(sv); + int role = roleFromName(&model, roleName); + + const char *warning = ": QML ListModel: Cannot add nested list values when modifying or after modification from a worker script"; + if (roleValue.type() == QVariant::List || roleValue.type() == QVariant::Map) + QTest::ignoreMessage(QtWarningMsg, warning); + QSignalSpy spy(&model, SIGNAL(itemsChanged(int, int, QList))); + + // in the worker thread, change the model data and call sync() + QVERIFY(QMetaObject::invokeMethod(item, "evalExpressionViaWorker", + Q_ARG(QVariant, QStringList(expression)))); + waitForWorker(item); + + // see if we receive the model changes in the main thread's model + if (roleValue.type() == QVariant::List || roleValue.type() == QVariant::Map) { + QVERIFY(model.data(index, role) != roleValue); + QCOMPARE(spy.count(), 0); + } else { + QCOMPARE(model.data(index, role), roleValue); + QCOMPARE(spy.count(), 1); + + QList spyResult = spy.takeFirst(); + QCOMPARE(spyResult.at(0).toInt(), index); + QCOMPARE(spyResult.at(1).toInt(), 1); // only 1 item is modified at a time + QVERIFY(spyResult.at(2).value >().contains(role)); + } +} + +void tst_qdeclarativelistmodel::get_worker_data() +{ + get_data(); +} + +/* + Test that the tests run in get() also work for nested list data +*/ +void tst_qdeclarativelistmodel::get_nested() +{ + QFETCH(QString, expression); + QFETCH(int, index); + QFETCH(QString, roleName); + QFETCH(QVariant, roleValue); + + QDeclarativeEngine eng; + QDeclarativeComponent component(&eng); + component.setData( + "import Qt 4.7\n" + "ListModel { \n" + "ListElement {\n" + "listRoleA: [\n" + "ListElement { roleA: 100 },\n" + "ListElement { roleA: 200; roleB: 400 },\n" + "ListElement { roleA: 200; roleB: 400 } \n" + "]\n" + "}\n" + "ListElement {\n" + "listRoleA: [\n" + "ListElement { roleA: 100 },\n" + "ListElement { roleA: 200; roleB: 400 },\n" + "ListElement { roleA: 200; roleB: 400 } \n" + "]\n" + "listRoleB: [\n" + "ListElement { roleA: 100 },\n" + "ListElement { roleA: 200; roleB: 400 },\n" + "ListElement { roleA: 200; roleB: 400 } \n" + "]\n" + "listRoleC: [\n" + "ListElement { roleA: 100 },\n" + "ListElement { roleA: 200; roleB: 400 },\n" + "ListElement { roleA: 200; roleB: 400 } \n" + "]\n" + "}\n" + "}", QUrl()); + QDeclarativeListModel *model = qobject_cast(component.create()); + QVERIFY(component.errorString().isEmpty()); + QDeclarativeListModel *childModel; + + // Test setting the inner list data for: + // get(0).listRoleA + // get(1).listRoleA + // get(1).listRoleB + // get(1).listRoleC + + QList > testData; + testData << qMakePair(0, QString("listRoleA")); + testData << qMakePair(1, QString("listRoleA")); + testData << qMakePair(1, QString("listRoleB")); + testData << qMakePair(1, QString("listRoleC")); + + for (int i=0; i(model->data(outerListIndex, outerListRole).value()); + QVERIFY(childModel); + + QString extendedExpression = QString("get(%1).%2.%3").arg(outerListIndex).arg(outerListRoleName).arg(expression); + QDeclarativeExpression expr(eng.rootContext(), model, extendedExpression); + + QSignalSpy spy(childModel, SIGNAL(itemsChanged(int, int, QList))); + expr.evaluate(); + QVERIFY(!expr.hasError()); + + int role = roleFromName(childModel, roleName); + QCOMPARE(childModel->data(index, role), roleValue); + QCOMPARE(spy.count(), 1); + + QList spyResult = spy.takeFirst(); + QCOMPARE(spyResult.at(0).toInt(), index); + QCOMPARE(spyResult.at(1).toInt(), 1); // only 1 item is modified at a time + QCOMPARE(spyResult.at(2).value >(), (QList() << role)); + } +} + +void tst_qdeclarativelistmodel::get_nested_data() +{ + get_data(); +} QTEST_MAIN(tst_qdeclarativelistmodel) -- cgit v0.12 From b811afd001fb89d7815c7167bea7f7814348931f Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 17 Sep 2010 15:33:22 +1000 Subject: Improve error messages (cherry picked from commit af29c555a29ebcdb1d962176912478212c9c7e65) --- src/declarative/util/qdeclarativelistmodel.cpp | 6 +++--- .../qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 68e97b0..2d8b946 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -292,7 +292,7 @@ QDeclarativeListModelWorkerAgent *QDeclarativeListModel::agent() return m_agent; if (!flatten()) { - qmlInfo(this) << "List contains nested list values and cannot be used from a worker script"; + qmlInfo(this) << "List contains list-type data and cannot be used from a worker script"; return 0; } @@ -1023,7 +1023,7 @@ bool FlatListModel::addValue(const QScriptValue &value, QHash *ro it.next(); QScriptValue value = it.value(); if (!value.isVariant() && !value.isRegExp() && !value.isDate() && value.isObject()) { - qmlInfo(m_listModel) << "Cannot add nested list values when modifying or after modification from a worker script"; + qmlInfo(m_listModel) << "Cannot add list-type data when modifying or after modification from a worker script"; return false; } @@ -1129,7 +1129,7 @@ QScriptDeclarativeClass::Value FlatListScriptClass::property(Object *obj, const void FlatListScriptClass::setProperty(Object *obj, const Identifier &name, const QScriptValue &value) { if (!value.isVariant() && !value.isRegExp() && !value.isDate() && value.isObject()) { - qmlInfo(m_model->m_listModel) << "Cannot add nested list values when modifying or after modification from a worker script"; + qmlInfo(m_model->m_listModel) << "Cannot add list-type data when modifying or after modification from a worker script"; return; } diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index 70ec416..f456778 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -406,7 +406,7 @@ void tst_qdeclarativelistmodel::dynamic_worker_sync() // execute a set of commands on the worker list model, then check the // changes are reflected in the list model in the main thread if (QByteArray(QTest::currentDataTag()).startsWith("nested")) - QTest::ignoreMessage(QtWarningMsg, ": QML ListModel: Cannot add nested list values when modifying or after modification from a worker script"); + QTest::ignoreMessage(QtWarningMsg, ": QML ListModel: Cannot add list-type data when modifying or after modification from a worker script"); QVERIFY(QMetaObject::invokeMethod(item, "evalExpressionViaWorker", Q_ARG(QVariant, operations.mid(0, operations.length()-1)))); @@ -439,7 +439,7 @@ void tst_qdeclarativelistmodel::convertNestedToFlat_fail() model.append(nestedListValue(&s_eng)); QCOMPARE(model.count(), 2); - QTest::ignoreMessage(QtWarningMsg, ": QML ListModel: List contains nested list values and cannot be used from a worker script"); + QTest::ignoreMessage(QtWarningMsg, ": QML ListModel: List contains list-type data and cannot be used from a worker script"); QVERIFY(QMetaObject::invokeMethod(item, "evalExpressionViaWorker", Q_ARG(QVariant, script))); waitForWorker(item); @@ -491,7 +491,7 @@ void tst_qdeclarativelistmodel::convertNestedToFlat_ok() QCOMPARE(model.count(), count+1); QScriptValue nested = nestedListValue(&s_eng); - const char *warning = ": QML ListModel: Cannot add nested list values when modifying or after modification from a worker script"; + const char *warning = ": QML ListModel: Cannot add list-type data when modifying or after modification from a worker script"; QTest::ignoreMessage(QtWarningMsg, warning); model.append(nested); @@ -769,7 +769,7 @@ void tst_qdeclarativelistmodel::get_worker() model.append(sv); int role = roleFromName(&model, roleName); - const char *warning = ": QML ListModel: Cannot add nested list values when modifying or after modification from a worker script"; + const char *warning = ": QML ListModel: Cannot add list-type data when modifying or after modification from a worker script"; if (roleValue.type() == QVariant::List || roleValue.type() == QVariant::Map) QTest::ignoreMessage(QtWarningMsg, warning); QSignalSpy spy(&model, SIGNAL(itemsChanged(int, int, QList))); -- cgit v0.12 From e3a5505b05b257c8cf54278f4a226ce967c9ce88 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 20 Sep 2010 10:45:13 +1000 Subject: Make build on Symbian (cherry picked from commit 68281ec913e2a69682f00bf22c291b15ea4ce542) --- src/declarative/util/qdeclarativelistmodel.cpp | 31 ++++++++++++++++++++++++ src/declarative/util/qdeclarativelistmodel_p_p.h | 31 ++---------------------- 2 files changed, 33 insertions(+), 29 deletions(-) diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 2d8b946..3263238 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -356,6 +356,37 @@ void QDeclarativeListModel::clear() } } +QDeclarativeListModel *ModelNode::model(const NestedListModel *model) +{ + if (!modelCache) { + modelCache = new QDeclarativeListModel; + QDeclarativeEngine::setContextForObject(modelCache,QDeclarativeEngine::contextForObject(model->m_listModel)); + modelCache->m_nested->_root = this; // ListModel defaults to nestable model + + for (int i=0; i(values.at(i)); + if (subNode) + subNode->m_model = modelCache->m_nested; + } + } + return modelCache; +} + +ModelObject *ModelNode::object(const NestedListModel *model) +{ + if (!objectCache) { + objectCache = new ModelObject(this, + const_cast(model), + QDeclarativeEnginePrivate::getScriptEngine(qmlEngine(model->m_listModel))); + QHash::iterator it; + for (it = properties.begin(); it != properties.end(); ++it) { + objectCache->setValue(it.key().toUtf8(), model->valueForNode(*it)); + } + objectCache->setNodeUpdatesEnabled(true); + } + return objectCache; +} + /*! \qmlmethod ListModel::remove(int index) diff --git a/src/declarative/util/qdeclarativelistmodel_p_p.h b/src/declarative/util/qdeclarativelistmodel_p_p.h index acf4f3e..d2d40ee 100644 --- a/src/declarative/util/qdeclarativelistmodel_p_p.h +++ b/src/declarative/util/qdeclarativelistmodel_p_p.h @@ -255,35 +255,8 @@ struct ModelNode void clear(); - QDeclarativeListModel *model(const NestedListModel *model) { - if (!modelCache) { - modelCache = new QDeclarativeListModel; - QDeclarativeEngine::setContextForObject(modelCache,QDeclarativeEngine::contextForObject(model->m_listModel)); - modelCache->m_nested->_root = this; // ListModel defaults to nestable model - - for (int i=0; i(values.at(i)); - if (subNode) - subNode->m_model = modelCache->m_nested; - } - } - return modelCache; - } - - ModelObject *object(const NestedListModel *model) { - if (!objectCache) { - objectCache = new ModelObject(this, - const_cast(model), - QDeclarativeEnginePrivate::getScriptEngine(qmlEngine(model->m_listModel))); - QHash::iterator it; - for (it = properties.begin(); it != properties.end(); ++it) { - objectCache->setValue(it.key().toUtf8(), model->valueForNode(*it)); - } - objectCache->setNodeUpdatesEnabled(true); - } - return objectCache; - } - + QDeclarativeListModel *model(const NestedListModel *model); + ModelObject *object(const NestedListModel *model); void setObjectValue(const QScriptValue& valuemap, bool writeToCache = true); void setListValue(const QScriptValue& valuelist); -- cgit v0.12 From cac9110ce6e0b1e1825bf8a425bed61a9ac3cb39 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 21 Sep 2010 23:49:07 +1000 Subject: Bump version to 4.7.1. Reviewed-by: Trust Me (cherry picked from commit 63394650e71f23a036edbc0df29a1b6b19366269) --- src/corelib/global/qglobal.h | 4 ++-- src/plugins/qpluginbase.pri | 2 +- src/qbase.pri | 2 +- tests/auto/selftests/expected_cmptest.txt | 2 +- tests/auto/selftests/expected_crashes_3.txt | 2 +- tests/auto/selftests/expected_longstring.txt | 2 +- tests/auto/selftests/expected_maxwarnings.txt | 2 +- tests/auto/selftests/expected_skip.txt | 2 +- tools/assistant/tools/assistant/doc/assistant.qdocconf | 2 +- tools/qdoc3/doc/files/qt.qdocconf | 8 ++++---- tools/qdoc3/test/assistant.qdocconf | 4 ++-- tools/qdoc3/test/designer.qdocconf | 4 ++-- tools/qdoc3/test/linguist.qdocconf | 4 ++-- tools/qdoc3/test/qdeclarative.qdocconf | 8 ++++---- tools/qdoc3/test/qmake.qdocconf | 4 ++-- tools/qdoc3/test/qt-build-docs.qdocconf | 8 ++++---- tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf | 8 ++++---- tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf | 8 ++++---- tools/qdoc3/test/qt.qdocconf | 8 ++++---- tools/qdoc3/test/qt_ja_JP.qdocconf | 8 ++++---- tools/qdoc3/test/qt_zh_CN.qdocconf | 8 ++++---- 21 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 8f27b03..c906a1c 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -44,11 +44,11 @@ #include -#define QT_VERSION_STR "4.7.0" +#define QT_VERSION_STR "4.7.1" /* QT_VERSION is (major << 16) + (minor << 8) + patch. */ -#define QT_VERSION 0x040700 +#define QT_VERSION 0x040701 /* can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0)) */ diff --git a/src/plugins/qpluginbase.pri b/src/plugins/qpluginbase.pri index 8b119b5..84009d8 100644 --- a/src/plugins/qpluginbase.pri +++ b/src/plugins/qpluginbase.pri @@ -1,6 +1,6 @@ TEMPLATE = lib isEmpty(QT_MAJOR_VERSION) { - VERSION=4.7.0 + VERSION=4.7.1 } else { VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} } diff --git a/src/qbase.pri b/src/qbase.pri index f6af22f..680693f 100644 --- a/src/qbase.pri +++ b/src/qbase.pri @@ -4,7 +4,7 @@ INCLUDEPATH *= $$QMAKE_INCDIR_QT/$$TARGET #just for today to have some compat isEmpty(QT_ARCH):!isEmpty(ARCH):QT_ARCH=$$ARCH #another compat that will rot for change #215700 TEMPLATE = lib isEmpty(QT_MAJOR_VERSION) { - VERSION=4.7.0 + VERSION=4.7.1 } else { VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} } diff --git a/tests/auto/selftests/expected_cmptest.txt b/tests/auto/selftests/expected_cmptest.txt index fd5b486..7f3aa9a 100644 --- a/tests/auto/selftests/expected_cmptest.txt +++ b/tests/auto/selftests/expected_cmptest.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_Cmptest ********* -Config: Using QTest library 4.7.0, Qt 4.7.0 +Config: Using QTest library 4.7.1, Qt 4.7.1 PASS : tst_Cmptest::initTestCase() PASS : tst_Cmptest::compare_boolfuncs() PASS : tst_Cmptest::compare_pointerfuncs() diff --git a/tests/auto/selftests/expected_crashes_3.txt b/tests/auto/selftests/expected_crashes_3.txt index 3aced25..7ded525 100644 --- a/tests/auto/selftests/expected_crashes_3.txt +++ b/tests/auto/selftests/expected_crashes_3.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_Crashes ********* -Config: Using QTest library 4.7.0, Qt 4.7.0 +Config: Using QTest library 4.7.1, Qt 4.7.1 PASS : tst_Crashes::initTestCase() QFATAL : tst_Crashes::crash() Received signal 11 FAIL! : tst_Crashes::crash() Received a fatal error. diff --git a/tests/auto/selftests/expected_longstring.txt b/tests/auto/selftests/expected_longstring.txt index 1461bc6..9ad6f56 100644 --- a/tests/auto/selftests/expected_longstring.txt +++ b/tests/auto/selftests/expected_longstring.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_LongString ********* -Config: Using QTest library 4.7.0, Qt 4.7.0 +Config: Using QTest library 4.7.1, Qt 4.7.1 PASS : tst_LongString::initTestCase() FAIL! : tst_LongString::failWithLongString() Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. diff --git a/tests/auto/selftests/expected_maxwarnings.txt b/tests/auto/selftests/expected_maxwarnings.txt index 908bd5d..949da13 100644 --- a/tests/auto/selftests/expected_maxwarnings.txt +++ b/tests/auto/selftests/expected_maxwarnings.txt @@ -1,5 +1,5 @@ ********* Start testing of MaxWarnings ********* -Config: Using QTest library 4.7.0, Qt 4.7.0 +Config: Using QTest library 4.7.1, Qt 4.7.1 PASS : MaxWarnings::initTestCase() QWARN : MaxWarnings::warn() 0 QWARN : MaxWarnings::warn() 1 diff --git a/tests/auto/selftests/expected_skip.txt b/tests/auto/selftests/expected_skip.txt index e5bf1ff..1f5bf7b 100644 --- a/tests/auto/selftests/expected_skip.txt +++ b/tests/auto/selftests/expected_skip.txt @@ -1,5 +1,5 @@ ********* Start testing of tst_Skip ********* -Config: Using QTest library 4.7.0, Qt 4.7.0 +Config: Using QTest library 4.7.1, Qt 4.7.1 PASS : tst_Skip::initTestCase() SKIP : tst_Skip::test() skipping all Loc: [/home/user/depot/qt-git/mainline/tests/auto/selftests/skip/tst_skip.cpp(68)] diff --git a/tools/assistant/tools/assistant/doc/assistant.qdocconf b/tools/assistant/tools/assistant/doc/assistant.qdocconf index 3b4b5f8..26cdafb 100644 --- a/tools/assistant/tools/assistant/doc/assistant.qdocconf +++ b/tools/assistant/tools/assistant/doc/assistant.qdocconf @@ -12,5 +12,5 @@ HTML.footer = "


\n" \ "\n" \ "\n" \ "\n" \ - "\n" \ + "\n" \ "
Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies)Trademarks
Qt 4.7.0
Qt 4.7.1
" diff --git a/tools/qdoc3/doc/files/qt.qdocconf b/tools/qdoc3/doc/files/qt.qdocconf index 09c112a..4546c7a 100644 --- a/tools/qdoc3/doc/files/qt.qdocconf +++ b/tools/qdoc3/doc/files/qt.qdocconf @@ -22,7 +22,7 @@ edition.DesktopLight.groups = -graphicsview-api qhp.projects = Qt qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.470 +qhp.Qt.namespace = com.trolltech.qt.471 qhp.Qt.virtualFolder = qdoc qhp.Qt.indexTitle = Qt Reference Documentation qhp.Qt.indexRoot = @@ -36,9 +36,9 @@ qhp.Qt.extraFiles = classic.css \ images/dynamiclayouts-example.png \ images/stylesheet-coffee-plastique.png -qhp.Qt.filterAttributes = qt 4.7.0 qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt 4.7.0 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.0 +qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc +qhp.Qt.customFilters.Qt.name = Qt 4.7.1 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 qhp.Qt.subprojects = classes overviews examples qhp.Qt.subprojects.classes.title = Classes qhp.Qt.subprojects.classes.indexTitle = Qt's Classes diff --git a/tools/qdoc3/test/assistant.qdocconf b/tools/qdoc3/test/assistant.qdocconf index 836c4bf..74b68df 100644 --- a/tools/qdoc3/test/assistant.qdocconf +++ b/tools/qdoc3/test/assistant.qdocconf @@ -13,7 +13,7 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = Assistant qhp.Assistant.file = assistant.qhp -qhp.Assistant.namespace = com.trolltech.assistant.470 +qhp.Assistant.namespace = com.trolltech.assistant.471 qhp.Assistant.virtualFolder = qdoc qhp.Assistant.indexTitle = Qt Assistant Manual qhp.Assistant.extraFiles = images/bg_l.png \ @@ -50,7 +50,7 @@ qhp.Assistant.extraFiles = images/bg_l.png \ style/style_ie8.css \ style/style.css -qhp.Assistant.filterAttributes = qt 4.7.0 tools assistant +qhp.Assistant.filterAttributes = qt 4.7.1 tools assistant qhp.Assistant.customFilters.Assistant.name = Qt Assistant Manual qhp.Assistant.customFilters.Assistant.filterAttributes = qt tools assistant qhp.Assistant.subprojects = manual examples diff --git a/tools/qdoc3/test/designer.qdocconf b/tools/qdoc3/test/designer.qdocconf index 9136619..ab66792 100644 --- a/tools/qdoc3/test/designer.qdocconf +++ b/tools/qdoc3/test/designer.qdocconf @@ -13,7 +13,7 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = Designer qhp.Designer.file = designer.qhp -qhp.Designer.namespace = com.trolltech.designer.470 +qhp.Designer.namespace = com.trolltech.designer.471 qhp.Designer.virtualFolder = qdoc qhp.Designer.indexTitle = Qt Designer Manual qhp.Designer.extraFiles = images/bg_l.png \ @@ -50,7 +50,7 @@ qhp.Designer.extraFiles = images/bg_l.png \ style/style_ie8.css \ style/style.css -qhp.Designer.filterAttributes = qt 4.7.0 tools designer +qhp.Designer.filterAttributes = qt 4.7.1 tools designer qhp.Designer.customFilters.Designer.name = Qt Designer Manual qhp.Designer.customFilters.Designer.filterAttributes = qt tools designer qhp.Designer.subprojects = manual examples diff --git a/tools/qdoc3/test/linguist.qdocconf b/tools/qdoc3/test/linguist.qdocconf index 696802a..0d920e2 100644 --- a/tools/qdoc3/test/linguist.qdocconf +++ b/tools/qdoc3/test/linguist.qdocconf @@ -13,7 +13,7 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = Linguist qhp.Linguist.file = linguist.qhp -qhp.Linguist.namespace = com.trolltech.linguist.470 +qhp.Linguist.namespace = com.trolltech.linguist.471 qhp.Linguist.virtualFolder = qdoc qhp.Linguist.indexTitle = Qt Linguist Manual qhp.Linguist.extraFiles = images/bg_l.png \ @@ -50,7 +50,7 @@ qhp.Linguist.extraFiles = images/bg_l.png \ style/style_ie8.css \ style/style.css -qhp.Linguist.filterAttributes = qt 4.7.0 tools linguist +qhp.Linguist.filterAttributes = qt 4.7.1 tools linguist qhp.Linguist.customFilters.Linguist.name = Qt Linguist Manual qhp.Linguist.customFilters.Linguist.filterAttributes = qt tools linguist qhp.Linguist.subprojects = manual examples diff --git a/tools/qdoc3/test/qdeclarative.qdocconf b/tools/qdoc3/test/qdeclarative.qdocconf index 45f48a6..9aaebcb 100644 --- a/tools/qdoc3/test/qdeclarative.qdocconf +++ b/tools/qdoc3/test/qdeclarative.qdocconf @@ -21,7 +21,7 @@ edition.DesktopLight.groups = -graphicsview-api qhp.projects = Qml qhp.Qml.file = qml.qhp -qhp.Qml.namespace = com.trolltech.qml.470 +qhp.Qml.namespace = com.trolltech.qml.471 qhp.Qml.virtualFolder = qdoc qhp.Qml.indexTitle = Qml Reference @@ -61,9 +61,9 @@ qhp.Qml.extraFiles = images/bg_l.png \ style/style_ie8.css \ style/style.css -qhp.Qml.filterAttributes = qt 4.7.0 qtrefdoc -qhp.Qml.customFilters.Qt.name = Qt 4.7.0 -qhp.Qml.customFilters.Qt.filterAttributes = qt 4.7.0 +qhp.Qml.filterAttributes = qt 4.7.1 qtrefdoc +qhp.Qml.customFilters.Qt.name = Qt 4.7.1 +qhp.Qml.customFilters.Qt.filterAttributes = qt 4.7.1 qhp.Qml.subprojects = classes qhp.Qml.subprojects.classes.title = Elements qhp.Qml.subprojects.classes.indexTitle = Qml Elements diff --git a/tools/qdoc3/test/qmake.qdocconf b/tools/qdoc3/test/qmake.qdocconf index 8125166..be2e9d3 100644 --- a/tools/qdoc3/test/qmake.qdocconf +++ b/tools/qdoc3/test/qmake.qdocconf @@ -13,7 +13,7 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = qmake qhp.qmake.file = qmake.qhp -qhp.qmake.namespace = com.trolltech.qmake.470 +qhp.qmake.namespace = com.trolltech.qmake.471 qhp.qmake.virtualFolder = qdoc qhp.qmake.indexTitle = QMake Manual qhp.qmake.extraFiles = images/bg_l.png \ @@ -50,7 +50,7 @@ qhp.qmake.extraFiles = images/bg_l.png \ style/style_ie8.css \ style/style.css -qhp.qmake.filterAttributes = qt 4.7.0 tools qmake +qhp.qmake.filterAttributes = qt 4.7.1 tools qmake qhp.qmake.customFilters.qmake.name = qmake Manual qhp.qmake.customFilters.qmake.filterAttributes = qt tools qmake qhp.qmake.subprojects = manual diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf index 639585c..dcabeb4 100644 --- a/tools/qdoc3/test/qt-build-docs.qdocconf +++ b/tools/qdoc3/test/qt-build-docs.qdocconf @@ -15,7 +15,7 @@ naturallanguage = en_US qhp.projects = Qt qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.470 +qhp.Qt.namespace = com.trolltech.qt.471 qhp.Qt.virtualFolder = qdoc qhp.Qt.indexTitle = Qt Reference Documentation qhp.Qt.indexRoot = @@ -59,9 +59,9 @@ qhp.Qt.extraFiles = index.html \ -qhp.Qt.filterAttributes = qt 4.7.0 qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt 4.7.0 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.0 +qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc +qhp.Qt.customFilters.Qt.name = Qt 4.7.1 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 qhp.Qt.subprojects = classes overviews examples qhp.Qt.subprojects.classes.title = Classes qhp.Qt.subprojects.classes.indexTitle = Qt's Classes diff --git a/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf b/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf index c24ddef..7e28fa2 100644 --- a/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf +++ b/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf @@ -17,15 +17,15 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = Qt qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.470 +qhp.Qt.namespace = com.trolltech.qt.471 qhp.Qt.virtualFolder = qdoc qhp.Qt.title = Qt qhp.Qt.indexTitle = Qt qhp.Qt.selectors = fake:example -qhp.Qt.filterAttributes = qt 4.7.0 qtrefdoc ja_JP -qhp.Qt.customFilters.Qt.name = Qt 4.7.0 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.0 +qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc ja_JP +qhp.Qt.customFilters.Qt.name = Qt 4.7.1 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 # Files not referenced in any qdoc file (last four are needed by qtdemo) # See also extraimages.HTML diff --git a/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf b/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf index a983faa..cfcc76d 100644 --- a/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf +++ b/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf @@ -17,15 +17,15 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index qhp.projects = Qt qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.470 +qhp.Qt.namespace = com.trolltech.qt.471 qhp.Qt.virtualFolder = qdoc qhp.Qt.title = 教程 qhp.Qt.indexTitle = 教程 qhp.Qt.selectors = fake:example -qhp.Qt.filterAttributes = qt 4.7.0 qtrefdoc zh_CN -qhp.Qt.customFilters.Qt.name = Qt 4.7.0 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.0 +qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc zh_CN +qhp.Qt.customFilters.Qt.name = Qt 4.7.1 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 # Files not referenced in any qdoc file (last four are needed by qtdemo) # See also extraimages.HTML diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf index 215e0d6..ea97205 100644 --- a/tools/qdoc3/test/qt.qdocconf +++ b/tools/qdoc3/test/qt.qdocconf @@ -17,7 +17,7 @@ naturallanguage = en_US qhp.projects = Qt qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.470 +qhp.Qt.namespace = com.trolltech.qt.471 qhp.Qt.virtualFolder = qdoc qhp.Qt.indexTitle = Qt Reference Documentation qhp.Qt.indexRoot = @@ -59,9 +59,9 @@ qhp.Qt.extraFiles = index.html \ style/style_ie8.css \ style/style.css -qhp.Qt.filterAttributes = qt 4.7.0 qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt 4.7.0 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.0 +qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc +qhp.Qt.customFilters.Qt.name = Qt 4.7.1 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 qhp.Qt.subprojects = classes overviews examples qhp.Qt.subprojects.classes.title = Classes qhp.Qt.subprojects.classes.indexTitle = Qt's Classes diff --git a/tools/qdoc3/test/qt_ja_JP.qdocconf b/tools/qdoc3/test/qt_ja_JP.qdocconf index f9ce142..32bba06 100644 --- a/tools/qdoc3/test/qt_ja_JP.qdocconf +++ b/tools/qdoc3/test/qt_ja_JP.qdocconf @@ -19,15 +19,15 @@ indexes = $QTDIR/doc/html/qt.index qhp.projects = Qt qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.470 +qhp.Qt.namespace = com.trolltech.qt.471 qhp.Qt.virtualFolder = qdoc qhp.Qt.title = Qt qhp.Qt.indexTitle = Qt qhp.Qt.selectors = fake:example -qhp.Qt.filterAttributes = qt 4.7.0 qtrefdoc ja_JP -qhp.Qt.customFilters.Qt.name = Qt 4.7.0 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.0 +qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc ja_JP +qhp.Qt.customFilters.Qt.name = Qt 4.7.1 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 # Files not referenced in any qdoc file (last four are needed by qtdemo) # See also extraimages.HTML diff --git a/tools/qdoc3/test/qt_zh_CN.qdocconf b/tools/qdoc3/test/qt_zh_CN.qdocconf index 5bf8171..40d3d5a 100644 --- a/tools/qdoc3/test/qt_zh_CN.qdocconf +++ b/tools/qdoc3/test/qt_zh_CN.qdocconf @@ -19,15 +19,15 @@ indexes = $QTDIR/doc/html/qt.index qhp.projects = Qt qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.470 +qhp.Qt.namespace = com.trolltech.qt.471 qhp.Qt.virtualFolder = qdoc qhp.Qt.title = 教程 qhp.Qt.indexTitle = 教程 qhp.Qt.selectors = fake:example -qhp.Qt.filterAttributes = qt 4.7.0 qtrefdoc zh_CN -qhp.Qt.customFilters.Qt.name = Qt 4.7.0 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.0 +qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc zh_CN +qhp.Qt.customFilters.Qt.name = Qt 4.7.1 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 # Files not referenced in any qdoc file (last four are needed by qtdemo) # See also extraimages.HTML -- cgit v0.12 From c634f8db5872790e90205ef4f41153345b9606c2 Mon Sep 17 00:00:00 2001 From: aavit Date: Tue, 21 Sep 2010 11:54:02 +0200 Subject: Avoid creating copy of an image in memory when storing as jpeg Task-number: QT-3871 Reviewed-by: Kim (cherry picked from commit 7efe816d028876487a6a44d97ed58a807da7d4d8) --- src/gui/image/qjpeghandler.cpp | 41 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp index e685694..b9eda05 100644 --- a/src/gui/image/qjpeghandler.cpp +++ b/src/gui/image/qjpeghandler.cpp @@ -515,29 +515,10 @@ inline my_jpeg_destination_mgr::my_jpeg_destination_mgr(QIODevice *device) free_in_buffer = max_buf; } -static bool can_write_format(QImage::Format fmt) -{ - switch (fmt) { - case QImage::Format_Mono: - case QImage::Format_MonoLSB: - case QImage::Format_Indexed8: - case QImage::Format_RGB888: - case QImage::Format_RGB32: - case QImage::Format_ARGB32: - case QImage::Format_ARGB32_Premultiplied: - return true; - break; - default: - break; - } - return false; -} -static bool write_jpeg_image(const QImage &sourceImage, QIODevice *device, int sourceQuality) +static bool write_jpeg_image(const QImage &image, QIODevice *device, int sourceQuality) { bool success = false; - const QImage image = can_write_format(sourceImage.format()) ? - sourceImage : sourceImage.convertToFormat(QImage::Format_RGB888); const QVector cmap = image.colorTable(); struct jpeg_compress_struct cinfo; @@ -614,7 +595,7 @@ static bool write_jpeg_image(const QImage &sourceImage, QIODevice *device, int s case QImage::Format_Mono: case QImage::Format_MonoLSB: if (gray) { - const uchar* data = image.scanLine(cinfo.next_scanline); + const uchar* data = image.constScanLine(cinfo.next_scanline); if (image.format() == QImage::Format_MonoLSB) { for (int i=0; i> 3)) & (1 << (i & 7))); @@ -627,7 +608,7 @@ static bool write_jpeg_image(const QImage &sourceImage, QIODevice *device, int s } } } else { - const uchar* data = image.scanLine(cinfo.next_scanline); + const uchar* data = image.constScanLine(cinfo.next_scanline); if (image.format() == QImage::Format_MonoLSB) { for (int i=0; i> 3)) & (1 << (i & 7))); @@ -647,13 +628,13 @@ static bool write_jpeg_image(const QImage &sourceImage, QIODevice *device, int s break; case QImage::Format_Indexed8: if (gray) { - const uchar* pix = image.scanLine(cinfo.next_scanline); + const uchar* pix = image.constScanLine(cinfo.next_scanline); for (int i=0; i Date: Wed, 22 Sep 2010 13:48:43 +0200 Subject: Doc: Fixed typos. --- src/corelib/thread/qthread.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index 2c63dfc..69b70cb 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -667,9 +667,9 @@ QThread::Priority QThread::priority() const to finish will be woken up. \warning This function is dangerous and its use is discouraged. - The thread can be terminate at any point in its code path. + The thread can be terminated at any point in its code path. Threads can be terminated while modifying data. There is no - chance for the thread to cleanup after itself, unlock any held + chance for the thread to clean up after itself, unlock any held mutexes, etc. In short, use this function only if absolutely necessary. -- cgit v0.12 From 4859880f3bac7dd819839e014a019326c8dfd5ac Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 22 Sep 2010 13:55:23 +0200 Subject: Doc: Fixed a memory leak in the undo example. Task-number: QTBUG-13705 Reviewed-by: Geir Vattekar --- examples/tools/undoframework/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tools/undoframework/mainwindow.cpp b/examples/tools/undoframework/mainwindow.cpp index b4b7ee5..90b4d3f 100644 --- a/examples/tools/undoframework/mainwindow.cpp +++ b/examples/tools/undoframework/mainwindow.cpp @@ -48,7 +48,7 @@ //! [0] MainWindow::MainWindow() { - undoStack = new QUndoStack(); + undoStack = new QUndoStack(this); createActions(); createMenus(); -- cgit v0.12 From b049dbe2efd6001f0496dffdc4fd289fa10ea25a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 17 Sep 2010 18:26:53 +0200 Subject: Fixed compilation of MeeGo graphics system without eglext.h We don't rely on this header, so there's no need to include it. Reviewed-by: Benjamin Poulain (cherry picked from commit a65f53a09c2a5950bd8b98fd791dc413bb11f9bf) --- src/plugins/graphicssystems/meego/qmeegoextensions.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/graphicssystems/meego/qmeegoextensions.h b/src/plugins/graphicssystems/meego/qmeegoextensions.h index 7f219de..f1a74f5 100644 --- a/src/plugins/graphicssystems/meego/qmeegoextensions.h +++ b/src/plugins/graphicssystems/meego/qmeegoextensions.h @@ -43,7 +43,6 @@ #define MEXTENSIONS_H #include -#include #include #include #include -- cgit v0.12 From 7ce308d589c7dbbe295f2cf2a2975a05dd4d1812 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Tue, 21 Sep 2010 12:47:00 +0200 Subject: Qt headers must be included before X11 headers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X11 symbols are conflicting with some of the Qt ones. Qt headers needs to be included before the X11 ones in order to compile on Maemo. Reviewed-by: Samuel Rødal (cherry picked from commit f1f986dfe40f82fca1a8a27f5f02e1a9f7818fd0) --- src/plugins/graphicssystems/meego/qmeegoextensions.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/graphicssystems/meego/qmeegoextensions.h b/src/plugins/graphicssystems/meego/qmeegoextensions.h index f1a74f5..ee20bd8 100644 --- a/src/plugins/graphicssystems/meego/qmeegoextensions.h +++ b/src/plugins/graphicssystems/meego/qmeegoextensions.h @@ -42,12 +42,12 @@ #ifndef MEXTENSIONS_H #define MEXTENSIONS_H -#include -#include -#include #include #include #include +#include +#include +#include /* Extensions decls */ -- cgit v0.12 From c573a69b3ff4ec2f7126a86c30c8f110a974937a Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Mon, 20 Sep 2010 17:24:39 +1000 Subject: Update QtCore bwins def file (cherry picked from commit 580fbb6a48b9cc2fbd0a011449d0c3a73c939ff9) --- src/s60installs/bwins/QtCoreu.def | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/s60installs/bwins/QtCoreu.def b/src/s60installs/bwins/QtCoreu.def index 1a79f63..0f66d72 100644 --- a/src/s60installs/bwins/QtCoreu.def +++ b/src/s60installs/bwins/QtCoreu.def @@ -1440,8 +1440,8 @@ EXPORTS ?d_func@QBuffer@@ABEPBVQBufferPrivate@@XZ @ 1439 NONAME ; class QBufferPrivate const * QBuffer::d_func(void) const ?d_func@QCoreApplication@@AAEPAVQCoreApplicationPrivate@@XZ @ 1440 NONAME ; class QCoreApplicationPrivate * QCoreApplication::d_func(void) ?d_func@QCoreApplication@@ABEPBVQCoreApplicationPrivate@@XZ @ 1441 NONAME ; class QCoreApplicationPrivate const * QCoreApplication::d_func(void) const - ?d_func@QDir@@AAEPAVQDirPrivate@@XZ @ 1442 NONAME ; class QDirPrivate * QDir::d_func(void) - ?d_func@QDir@@ABEPBVQDirPrivate@@XZ @ 1443 NONAME ; class QDirPrivate const * QDir::d_func(void) const + ?d_func@QDir@@AAEPAVQDirPrivate@@XZ @ 1442 NONAME ABSENT ; class QDirPrivate * QDir::d_func(void) + ?d_func@QDir@@ABEPBVQDirPrivate@@XZ @ 1443 NONAME ABSENT ; class QDirPrivate const * QDir::d_func(void) const ?d_func@QEventDispatcherSymbian@@AAEPAVQAbstractEventDispatcherPrivate@@XZ @ 1444 NONAME ; class QAbstractEventDispatcherPrivate * QEventDispatcherSymbian::d_func(void) ?d_func@QEventDispatcherSymbian@@ABEPBVQAbstractEventDispatcherPrivate@@XZ @ 1445 NONAME ; class QAbstractEventDispatcherPrivate const * QEventDispatcherSymbian::d_func(void) const ?d_func@QEventLoop@@AAEPAVQEventLoopPrivate@@XZ @ 1446 NONAME ; class QEventLoopPrivate * QEventLoop::d_func(void) -- cgit v0.12 From c2b8b2f7a46dc25ec1a464f72fa301b1176cec8d Mon Sep 17 00:00:00 2001 From: Lasse Holmstedt Date: Fri, 17 Sep 2010 10:13:51 +0200 Subject: Make qml debugging work with command line arguments The environment variables do not work for Symbian devices, so without this change, QML debugging cannot be done on them. In addition, configure now contains an option to disable qml debugging entirely, due to it being a major security risk. Reviewed-by: kkoehne (cherry picked from commit a9e5329168cd9113bf41293c05193d8b099494c6) --- configure | 24 +++++++++++- configure.exe | Bin 1321472 -> 1402368 bytes src/corelib/kernel/qcoreapplication.cpp | 3 +- .../debugger/qdeclarativedebugservice.cpp | 41 +++++++++++++++------ src/gui/kernel/qapplication.cpp | 6 +++ src/gui/kernel/qapplication_p.h | 2 + .../qdeclarativedebug/tst_qdeclarativedebug.cpp | 16 +++++++- .../tst_qdeclarativedebugclient.cpp | 15 +++++++- .../tst_qdeclarativedebugservice.cpp | 16 +++++++- tools/configure/configureapp.cpp | 11 ++++++ 10 files changed, 114 insertions(+), 20 deletions(-) diff --git a/configure b/configure index b933ac1..da6fb0a 100755 --- a/configure +++ b/configure @@ -685,6 +685,7 @@ CFG_MULTIMEDIA=auto CFG_AUDIO_BACKEND=auto CFG_SVG=auto CFG_DECLARATIVE=auto +CFG_DECLARATIVE_DEBUG=yes CFG_WEBKIT=auto # (yes|no|auto) CFG_JAVASCRIPTCORE_JIT=auto @@ -1997,6 +1998,17 @@ while [ "$#" -gt 0 ]; do fi fi ;; + declarative-debug) + if [ "$VAL" = "yes" ]; then + CFG_DECLARATIVE_DEBUG="yes" + else + if [ "$VAL" = "no" ]; then + CFG_DECLARATIVE_DEBUG="no" + else + UNKNOWN_OPT=yes + fi + fi + ;; webkit) if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then CFG_WEBKIT="yes" @@ -3524,7 +3536,8 @@ Usage: $relconf [-h] [-prefix ] [-prefix-install] [-bindir ] [-libdir [-no-media-backend] [-media-backend] [-no-audio-backend] [-audio-backend] [-no-openssl] [-openssl] [-openssl-linked] [-no-gtkstyle] [-gtkstyle] [-no-svg] [-svg] [-no-webkit] [-webkit] [-no-javascript-jit] [-javascript-jit] - [-no-script] [-script] [-no-scripttools] [-scripttools] [-no-declarative] [-declarative] + [-no-script] [-script] [-no-scripttools] [-scripttools] + [-no-declarative] [-declarative][-no-declarative-debug] [-declarative-debug] [additional platform specific options (see below)] @@ -3687,9 +3700,12 @@ fi -no-scripttools .... Do not build the QtScriptTools module. + -scripttools ....... Build the QtScriptTools module. - -no-declarative .....Do not build the declarative module. + -no-declarative ..... Do not build the declarative module. + -declarative ....... Build the declarative module. + -no-declarative-debug ..... Do not build the declarative debugging support. + + -declarative-debug ....... Build the declarative debugging support. + -platform target ... The operating system and compiler you are building on ($PLATFORM). @@ -7229,6 +7245,9 @@ fi if [ "$CFG_DECLARATIVE" = "yes" ]; then QT_CONFIG="$QT_CONFIG declarative" + if [ "$CFG_DECLARATIVE_DEBUG" = "no" ]; then + QCONFIG_FLAGS="$QCONFIG_FLAGS QDECLARATIVE_NO_DEBUG_PROTOCOL" + fi else QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DECLARATIVE" fi @@ -8197,6 +8216,7 @@ if [ "$CFG_WEBKIT" = "yes" ]; then fi fi echo "Declarative module ..... $CFG_DECLARATIVE" +echo "Declarative debugging ...$CFG_DECLARATIVE_DEBUG" echo "Support for S60 ........ $CFG_S60" echo "Symbian DEF files ...... $CFG_SYMBIAN_DEFFILES" echo "STL support ............ $CFG_STL" diff --git a/configure.exe b/configure.exe index 18c9004..e2f4331 100755 Binary files a/configure.exe and b/configure.exe differ diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 512e193..d3f399b 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -2091,7 +2091,8 @@ QStringList QCoreApplication::arguments() l1arg == "-stylesheet" || l1arg == "-widgetcount") ; - else if (l1arg.startsWith("-style=")) + else if (l1arg.startsWith("-style=") || + l1arg.startsWith("-qmljsdebugger=")) ; else if (l1arg == "-style" || l1arg == "-session" || diff --git a/src/declarative/debugger/qdeclarativedebugservice.cpp b/src/declarative/debugger/qdeclarativedebugservice.cpp index 1bbfcf4..1f2bf4f 100644 --- a/src/declarative/debugger/qdeclarativedebugservice.cpp +++ b/src/declarative/debugger/qdeclarativedebugservice.cpp @@ -49,6 +49,8 @@ #include #include +#include +#include QT_BEGIN_NAMESPACE @@ -147,24 +149,41 @@ bool QDeclarativeDebugServer::hasDebuggingClient() const QDeclarativeDebugServer *QDeclarativeDebugServer::instance() { - static bool envTested = false; + static bool commandLineTested = false; static QDeclarativeDebugServer *server = 0; - if (!envTested) { - envTested = true; - QByteArray env = qgetenv("QML_DEBUG_SERVER_PORT"); - QByteArray block = qgetenv("QML_DEBUG_SERVER_BLOCK"); + if (!commandLineTested) { + commandLineTested = true; +#ifndef QDECLARATIVE_NO_DEBUG_PROTOCOL + QApplicationPrivate *appD = static_cast(QObjectPrivate::get(qApp)); + // ### remove port definition when protocol is changed + int port = 0; + bool block = false; bool ok = false; - int port = env.toInt(&ok); - if (ok && port > 1024) { - server = new QDeclarativeDebugServer(port); - server->listen(); - if (!block.isEmpty()) { - server->waitForConnection(); + // format: qmljsdebugger=port:3768[,block] + if (!appD->qmljsDebugArguments.isEmpty()) { + + if (appD->qmljsDebugArguments.indexOf(QLatin1String("port:")) == 0) { + int separatorIndex = appD->qmljsDebugArguments.indexOf(QLatin1Char(',')); + port = appD->qmljsDebugArguments.mid(5, separatorIndex - 5).toInt(&ok); + } + block = appD->qmljsDebugArguments.contains(QLatin1String("block")); + + if (ok) { + server = new QDeclarativeDebugServer(port); + server->listen(); + if (block) { + server->waitForConnection(); + } + } else { + qWarning(QString("QDeclarativeDebugServer: Ignoring \"-qmljsdebugger=%1\". " + "Format is -qmljsdebugger=port:[,block]").arg( + appD->qmljsDebugArguments).toAscii().constData()); } } +#endif } return server; diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 2fd2f46..43d5772 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -494,6 +494,7 @@ bool QApplicationPrivate::fade_tooltip = false; bool QApplicationPrivate::animate_toolbox = false; bool QApplicationPrivate::widgetCount = false; bool QApplicationPrivate::load_testability = false; +QString QApplicationPrivate::qmljsDebugArguments; #ifdef QT_KEYPAD_NAVIGATION # ifdef Q_OS_SYMBIAN Qt::NavigationMode QApplicationPrivate::navigationMode = Qt::NavigationModeKeypadDirectional; @@ -565,6 +566,8 @@ void QApplicationPrivate::process_cmdline() QString s; if (arg == "-qdevel" || arg == "-qdebug") { // obsolete argument + } else if (arg.indexOf("-qmljsdebugger=", 0) != -1) { + qmljsDebugArguments = QString::fromLocal8Bit(arg.right(arg.length() - 15)); } else if (arg.indexOf("-style=", 0) != -1) { s = QString::fromLocal8Bit(arg.right(arg.length() - 7).toLower()); } else if (arg == "-style" && i < argc-1) { @@ -670,6 +673,9 @@ void QApplicationPrivate::process_cmdline() Qt::RightToLeft \o -graphicssystem, sets the backend to be used for on-screen widgets and QPixmaps. Available options are \c{raster} and \c{opengl}. + \o -qmljsdebugger=, activates the QML/JS debugger with a specified port. + The value must be of format port:1234[,block], where block is optional + and will make the application wait until a debugger connects to it. \endlist The X11 version of Qt supports some traditional X11 command line options: diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 8dc16e0..aa3a6d5 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -446,6 +446,8 @@ public: static bool animate_toolbox; static bool widgetCount; // Coupled with -widgetcount switch static bool load_testability; // Coupled with -testability switch + static QString qmljsDebugArguments; // a string containing arguments for js/qml debugging. + #ifdef Q_WS_MAC static bool native_modal_dialog_active; #endif diff --git a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp index 20ccccb..adba190 100644 --- a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp +++ b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp @@ -279,7 +279,7 @@ void tst_QDeclarativeDebug::initTestCase() qRegisterMetaType(); QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Waiting for connection on port 3768..."); - qputenv("QML_DEBUG_SERVER_PORT", "3768"); + m_engine = new QDeclarativeEngine(this); QList qml; @@ -891,6 +891,18 @@ void tst_QDeclarativeDebug::tst_QDeclarativeDebugPropertyReference() compareProperties(r, ref); } -QTEST_MAIN(tst_QDeclarativeDebug) +int main(int argc, char *argv[]) +{ + int _argc = argc + 1; + char **_argv = new char*[_argc]; + for (int i = 0; i < argc; ++i) + _argv[i] = argv[i]; + _argv[_argc - 1] = "-qmljsdebugger=port:3768"; + + QApplication app(_argc, _argv); + tst_QDeclarativeDebug tc; + return QTest::qExec(&tc, _argc, _argv); + delete _argv; +} #include "tst_qdeclarativedebug.moc" diff --git a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp index a19c2c2..7db0e60 100644 --- a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp +++ b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp @@ -76,7 +76,6 @@ void tst_QDeclarativeDebugClient::initTestCase() { QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Waiting for connection on port 3770..."); - qputenv("QML_DEBUG_SERVER_PORT", "3770"); new QDeclarativeEngine(this); m_conn = new QDeclarativeDebugConnection(this); @@ -151,7 +150,19 @@ void tst_QDeclarativeDebugClient::sendMessage() QCOMPARE(resp, msg); } -QTEST_MAIN(tst_QDeclarativeDebugClient) +int main(int argc, char *argv[]) +{ + int _argc = argc + 1; + char **_argv = new char*[_argc]; + for (int i = 0; i < argc; ++i) + _argv[i] = argv[i]; + _argv[_argc - 1] = "-qmljsdebugger=port:3770"; + + QApplication app(_argc, _argv); + tst_QDeclarativeDebugClient tc; + return QTest::qExec(&tc, _argc, _argv); + delete _argv; +} #include "tst_qdeclarativedebugclient.moc" diff --git a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp index 9ebbbaf..4683199 100644 --- a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp +++ b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp @@ -77,7 +77,6 @@ private slots: void tst_QDeclarativeDebugService::initTestCase() { QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Waiting for connection on port 3769..."); - qputenv("QML_DEBUG_SERVER_PORT", "3769"); new QDeclarativeEngine(this); m_conn = new QDeclarativeDebugConnection(this); @@ -184,6 +183,19 @@ void tst_QDeclarativeDebugService::objectToString() delete obj; } -QTEST_MAIN(tst_QDeclarativeDebugService) + +int main(int argc, char *argv[]) +{ + int _argc = argc + 1; + char **_argv = new char*[_argc]; + for (int i = 0; i < argc; ++i) + _argv[i] = argv[i]; + _argv[_argc - 1] = "-qmljsdebugger=port:3769"; + + QApplication app(_argc, _argv); + tst_QDeclarativeDebugService tc; + return QTest::qExec(&tc, _argc, _argv); + delete _argv; +} #include "tst_qdeclarativedebugservice.moc" diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 6e66742..a2c7fe9 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -279,6 +279,7 @@ Configure::Configure(int& argc, char** argv) dictionary[ "DIRECTSHOW" ] = "no"; dictionary[ "WEBKIT" ] = "auto"; dictionary[ "DECLARATIVE" ] = "auto"; + dictionary[ "DECLARATIVE_DEBUG" ]= "yes"; dictionary[ "PLUGIN_MANIFESTS" ] = "yes"; QString version; @@ -961,6 +962,10 @@ void Configure::parseCmdLine() dictionary[ "DECLARATIVE" ] = "no"; } else if (configCmdLine.at(i) == "-declarative") { dictionary[ "DECLARATIVE" ] = "yes"; + } else if (configCmdLine.at(i) == "-no-declarative-debug") { + dictionary[ "DECLARATIVE_DEBUG" ] = "no"; + } else if (configCmdLine.at(i) == "-declarative-debug") { + dictionary[ "DECLARATIVE_DEBUG" ] = "yes"; } else if (configCmdLine.at(i) == "-no-plugin-manifests") { dictionary[ "PLUGIN_MANIFESTS" ] = "no"; } else if (configCmdLine.at(i) == "-plugin-manifests") { @@ -1836,6 +1841,8 @@ bool Configure::displayHelp() desc("SCRIPTTOOLS", "yes", "-scripttools", "Build the QtScriptTools module."); desc("DECLARATIVE", "no", "-no-declarative", "Do not build the declarative module"); desc("DECLARATIVE", "yes", "-declarative", "Build the declarative module"); + desc("DECLARATIVE_DEBUG", "no", "-no-declarative-debug", "Do not build the declarative debugging support"); + desc("DECLARATIVE_DEBUG", "yes", "-declarative-debug", "Build the declarative debugging support"); desc( "-arch ", "Specify an architecture.\n" "Available values for :"); @@ -2273,6 +2280,8 @@ void Configure::autoDetection() dictionary["WEBKIT"] = checkAvailability("WEBKIT") ? "yes" : "no"; if (dictionary["DECLARATIVE"] == "auto") dictionary["DECLARATIVE"] = dictionary["SCRIPT"] == "yes" ? "yes" : "no"; + if (dictionary["DECLARATIVE_DEBUG"] == "auto") + dictionary["DECLARATIVE_DEBUG"] = dictionary["DECLARATIVE"] == "yes" ? "yes" : "no"; if (dictionary["AUDIO_BACKEND"] == "auto") dictionary["AUDIO_BACKEND"] = checkAvailability("AUDIO_BACKEND") ? "yes" : "no"; if (dictionary["WMSDK"] == "auto") @@ -3101,6 +3110,7 @@ void Configure::generateConfigfiles() if (dictionary["IPV6"] == "no") qconfigList += "QT_NO_IPV6"; if (dictionary["WEBKIT"] == "no") qconfigList += "QT_NO_WEBKIT"; if (dictionary["DECLARATIVE"] == "no") qconfigList += "QT_NO_DECLARATIVE"; + if (dictionary["DECLARATIVE_DEBUG"] == "no") qconfigList += "QDECLARATIVE_NO_DEBUG_PROTOCOL"; if (dictionary["PHONON"] == "no") qconfigList += "QT_NO_PHONON"; if (dictionary["MULTIMEDIA"] == "no") qconfigList += "QT_NO_MULTIMEDIA"; if (dictionary["XMLPATTERNS"] == "no") qconfigList += "QT_NO_XMLPATTERNS"; @@ -3398,6 +3408,7 @@ void Configure::displayConfig() cout << "QtMultimedia support........" << dictionary[ "MULTIMEDIA" ] << endl; cout << "WebKit support.............." << dictionary[ "WEBKIT" ] << endl; cout << "Declarative support........." << dictionary[ "DECLARATIVE" ] << endl; + cout << "Declarative debugging......." << dictionary[ "DECLARATIVE_DEBUG" ] << endl; cout << "QtScript support............" << dictionary[ "SCRIPT" ] << endl; cout << "QtScriptTools support......." << dictionary[ "SCRIPTTOOLS" ] << endl; cout << "Graphics System............." << dictionary[ "GRAPHICS_SYSTEM" ] << endl; -- cgit v0.12 From 5399d494eecb3286e0b3d14204607eae08937e72 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 20 Sep 2010 09:17:20 +0200 Subject: Fix Symbian def file for a9e5329168 Reviewed-by: Thomas Hartmann (cherry picked from commit a371562d870abb421682dcf83d447e5d5c9e82fa) --- src/s60installs/eabi/QtGuiu.def | 1 + 1 file changed, 1 insertion(+) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 47e893b..e6b2555 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12094,4 +12094,5 @@ EXPORTS _ZN18QTapAndHoldGesture7timeoutEv @ 12093 NONAME _ZN20QGraphicsItemPrivate26childrenBoundingRectHelperEP10QTransformP6QRectFb @ 12094 NONAME ABSENT _ZN20QGraphicsItemPrivate14children_clearEP24QDeclarativeListPropertyI15QGraphicsObjectE @ 12095 NONAME + _ZN19QApplicationPrivate19qmljsDebugArgumentsE @ 12096 NONAME DATA 4 -- cgit v0.12 From 223ef193ff9d333cbd43f8c10e2e7d7612748180 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Mon, 20 Sep 2010 17:25:01 +1000 Subject: Update QtGui def files (cherry picked from commit 36705197479337ccf341a4c39a6e5f44d3fb2322) --- src/s60installs/bwins/QtGuiu.def | 10 ++++++++-- src/s60installs/eabi/QtGuiu.def | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index f9e88d7..7805dae 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -2645,7 +2645,7 @@ EXPORTS ?childItems@QGraphicsItem@@QBE?AV?$QList@PAVQGraphicsItem@@@@XZ @ 2644 NONAME ; class QList QGraphicsItem::childItems(void) const ?children@QGraphicsItem@@QBE?AV?$QList@PAVQGraphicsItem@@@@XZ @ 2645 NONAME ; class QList QGraphicsItem::children(void) const ?childrenBoundingRect@QGraphicsItem@@QBE?AVQRectF@@XZ @ 2646 NONAME ; class QRectF QGraphicsItem::childrenBoundingRect(void) const - ?childrenBoundingRectHelper@QGraphicsItemPrivate@@QAEXPAVQTransform@@PAVQRectF@@@Z @ 2647 NONAME ; void QGraphicsItemPrivate::childrenBoundingRectHelper(class QTransform *, class QRectF *) + ?childrenBoundingRectHelper@QGraphicsItemPrivate@@QAEXPAVQTransform@@PAVQRectF@@@Z @ 2647 NONAME ABSENT ; void QGraphicsItemPrivate::childrenBoundingRectHelper(class QTransform *, class QRectF *) ?childrenCheckState@QTreeWidgetItem@@ABE?AVQVariant@@H@Z @ 2648 NONAME ; class QVariant QTreeWidgetItem::childrenCheckState(int) const ?childrenClippedToShape@QGraphicsItemPrivate@@QBE_NXZ @ 2649 NONAME ; bool QGraphicsItemPrivate::childrenClippedToShape(void) const ?childrenCollapsible@QSplitter@@QBE_NXZ @ 2650 NONAME ; bool QSplitter::childrenCollapsible(void) const @@ -4078,7 +4078,7 @@ EXPORTS ?editorEvent@QAbstractItemDelegate@@UAE_NPAVQEvent@@PAVQAbstractItemModel@@ABVQStyleOptionViewItem@@ABVQModelIndex@@@Z @ 4077 NONAME ; bool QAbstractItemDelegate::editorEvent(class QEvent *, class QAbstractItemModel *, class QStyleOptionViewItem const &, class QModelIndex const &) ?editorEvent@QItemDelegate@@MAE_NPAVQEvent@@PAVQAbstractItemModel@@ABVQStyleOptionViewItem@@ABVQModelIndex@@@Z @ 4078 NONAME ; bool QItemDelegate::editorEvent(class QEvent *, class QAbstractItemModel *, class QStyleOptionViewItem const &, class QModelIndex const &) ?editorEvent@QStyledItemDelegate@@MAE_NPAVQEvent@@PAVQAbstractItemModel@@ABVQStyleOptionViewItem@@ABVQModelIndex@@@Z @ 4079 NONAME ; bool QStyledItemDelegate::editorEvent(class QEvent *, class QAbstractItemModel *, class QStyleOptionViewItem const &, class QModelIndex const &) - ?effectiveBoundingRect@QGraphicsItemPrivate@@QBE?AVQRectF@@XZ @ 4080 NONAME ; class QRectF QGraphicsItemPrivate::effectiveBoundingRect(void) const + ?effectiveBoundingRect@QGraphicsItemPrivate@@QBE?AVQRectF@@XZ @ 4080 NONAME ABSENT ; class QRectF QGraphicsItemPrivate::effectiveBoundingRect(void) const ?effectiveOpacity@QGraphicsItem@@QBEMXZ @ 4081 NONAME ; float QGraphicsItem::effectiveOpacity(void) const ?effectiveOpacity@QGraphicsItemPrivate@@QBEMXZ @ 4082 NONAME ; float QGraphicsItemPrivate::effectiveOpacity(void) const ?effectiveRectFor@QWidgetPrivate@@QBE?AVQRect@@ABV2@@Z @ 4083 NONAME ; class QRect QWidgetPrivate::effectiveRectFor(class QRect const &) const @@ -12886,4 +12886,10 @@ EXPORTS ?flushDetachedPixmaps@QPixmapCache@@SAXXZ @ 12885 NONAME ; void QPixmapCache::flushDetachedPixmaps(void) ?replayLastMouseEvent@QGraphicsViewPrivate@@QAEXXZ @ 12886 NONAME ; void QGraphicsViewPrivate::replayLastMouseEvent(void) ?children_clear@QGraphicsItemPrivate@@SAXPAV?$QDeclarativeListProperty@VQGraphicsObject@@@@@Z @ 12887 NONAME ; void QGraphicsItemPrivate::children_clear(class QDeclarativeListProperty *) + ?timeout@QTapAndHoldGesture@@SAHXZ @ 12888 NONAME ; int QTapAndHoldGesture::timeout(void) + ?lastRightBearing@QFontEngine@@IAE?AUQFixed@@ABUQGlyphLayout@@_N@Z @ 12889 NONAME ; struct QFixed QFontEngine::lastRightBearing(struct QGlyphLayout const &, bool) + ?childrenBoundingRectHelper@QGraphicsItemPrivate@@QAEXPAVQTransform@@PAVQRectF@@PAVQGraphicsItem@@@Z @ 12890 NONAME ; void QGraphicsItemPrivate::childrenBoundingRectHelper(class QTransform *, class QRectF *, class QGraphicsItem *) + ?setTimeout@QTapAndHoldGesture@@SAXH@Z @ 12891 NONAME ; void QTapAndHoldGesture::setTimeout(int) + ?qmljsDebugArguments@QApplicationPrivate@@2VQString@@A @ 12892 NONAME ; class QString QApplicationPrivate::qmljsDebugArguments + ?effectiveBoundingRect@QGraphicsItemPrivate@@QBE?AVQRectF@@PAVQGraphicsItem@@@Z @ 12893 NONAME ; class QRectF QGraphicsItemPrivate::effectiveBoundingRect(class QGraphicsItem *) const diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index e6b2555..4442d33 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12095,4 +12095,6 @@ EXPORTS _ZN20QGraphicsItemPrivate26childrenBoundingRectHelperEP10QTransformP6QRectFb @ 12094 NONAME ABSENT _ZN20QGraphicsItemPrivate14children_clearEP24QDeclarativeListPropertyI15QGraphicsObjectE @ 12095 NONAME _ZN19QApplicationPrivate19qmljsDebugArgumentsE @ 12096 NONAME DATA 4 + _ZN20QGraphicsItemPrivate26childrenBoundingRectHelperEP10QTransformP6QRectFP13QGraphicsItem @ 12097 NONAME + _ZNK20QGraphicsItemPrivate21effectiveBoundingRectEP13QGraphicsItem @ 12098 NONAME -- cgit v0.12 From 50ab865141b97b91ebbeeae9445a4296f378882a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Tue, 21 Sep 2010 17:08:09 +0200 Subject: Fixed drawing a large number of glyphs with the same font under GL. Our glyph caching system doesn't take GL texture size limitation into account, and assumes you can create an infinitely large texture. On top of that, the cache will never create a cache that is wider than 256, or QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH, which means we'll hit the texture size limit even faster. With this patch the entire texture is utilized. However, to fix in properly we need to support having multiple texture for each font engine. That will be fixed shortly (see task QTBUG-13784). Task-number: QT-3971 Reviewed-by: Eskil (cherry picked from commit eb2926a2f9607e985b8bca54346e6fdf91343247) --- src/gui/painting/qtextureglyphcache.cpp | 20 ++++++++++++-------- src/gui/painting/qtextureglyphcache_p.h | 6 ++++++ .../gl2paintengineex/qtextureglyphcache_gl.cpp | 11 ++++++++++- .../gl2paintengineex/qtextureglyphcache_gl_p.h | 2 ++ 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 631a9cf..b609f7b 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -47,10 +47,6 @@ #include "private/qnativeimage_p.h" #include "private/qfontengine_ft_p.h" -#ifndef QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH -#define QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH 256 -#endif - QT_BEGIN_NAMESPACE // #define CACHE_DEBUG @@ -137,10 +133,18 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const m_currentRowHeight = qMax(m_currentRowHeight, c.h + margin * 2); if (m_cx + c.w > m_w) { - // no room on the current line, start new glyph strip - m_cx = 0; - m_cy += m_currentRowHeight + paddingDoubled; - m_currentRowHeight = 0; // New row + int new_width = m_w*2; + while (new_width < m_cx + c.w) + new_width *= 2; + if (new_width <= maxTextureWidth()) { + resizeTextureData(new_width, m_h); + m_w = new_width; + } else { + // no room on the current line, start new glyph strip + m_cx = 0; + m_cy += m_currentRowHeight + paddingDoubled; + m_currentRowHeight = 0; // New row + } } if (m_cy + c.h > m_h) { int new_height = m_h*2; diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h index a818978..e6d2b22 100644 --- a/src/gui/painting/qtextureglyphcache_p.h +++ b/src/gui/painting/qtextureglyphcache_p.h @@ -64,6 +64,10 @@ # undef m_type #endif +#ifndef QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH +#define QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH 256 +#endif + struct glyph_metrics_t; typedef unsigned int glyph_t; @@ -113,6 +117,8 @@ public: QHash coords; QImage textureMapForGlyph(glyph_t g) const; + virtual int maxTextureWidth() const { return QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH; } + virtual int maxTextureHeight() const { return 32768; } protected: QFontEngine *m_current_fontengine; diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index 410cf21..f353995 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -129,7 +129,7 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height) GLuint oldTexture = m_texture; createTextureData(width, height); - + if (ctx->d_ptr->workaround_brokenFBOReadBack) { QImageTextureGlyphCache::resizeTextureData(width, height); Q_ASSERT(image().depth() == 8); @@ -281,4 +281,13 @@ int QGLTextureGlyphCache::glyphPadding() const return 1; } +int QGLTextureGlyphCache::maxTextureWidth() const +{ + return ctx->d_ptr->maxTextureSize(); +} + +int QGLTextureGlyphCache::maxTextureHeight() const +{ + return ctx->d_ptr->maxTextureSize(); +} QT_END_NAMESPACE diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h index 6bcd655..eb3693c 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h @@ -73,6 +73,8 @@ public: virtual void resizeTextureData(int width, int height); virtual void fillTexture(const Coord &c, glyph_t glyph); virtual int glyphPadding() const; + virtual int maxTextureWidth() const; + virtual int maxTextureHeight() const; inline GLuint texture() const { return m_texture; } -- cgit v0.12 From c025fda36e767a74cd50df9521819dbdbc1625d8 Mon Sep 17 00:00:00 2001 From: Misha Tyutyunik Date: Wed, 22 Sep 2010 10:06:01 +0200 Subject: QNAM: Use QFileNetworkReply for qrc:/ URL schema Resources do not need network access and can be quicker loaded with QFileNetworkReply. Reviewed-by: Markus Goetz (cherry picked from commit 5120dfec47475dd37f51df4dda9a4ef8494036ab) --- src/network/access/qfilenetworkreply.cpp | 5 ++++- src/network/access/qnetworkaccessmanager.cpp | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/network/access/qfilenetworkreply.cpp b/src/network/access/qfilenetworkreply.cpp index 4ac9a8c..00bd29e 100644 --- a/src/network/access/qfilenetworkreply.cpp +++ b/src/network/access/qfilenetworkreply.cpp @@ -97,7 +97,10 @@ QFileNetworkReply::QFileNetworkReply(QObject *parent, const QNetworkRequest &req QString fileName = url.toLocalFile(); if (fileName.isEmpty()) { - fileName = url.toString(QUrl::RemoveAuthority | QUrl::RemoveFragment | QUrl::RemoveQuery); + if (url.scheme() == QLatin1String("qrc")) + fileName = QLatin1Char(':') + url.path(); + else + fileName = url.toString(QUrl::RemoveAuthority | QUrl::RemoveFragment | QUrl::RemoveQuery); } QFileInfo fi(fileName); diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index b35c318..a637474 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -946,10 +946,10 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera // fast path for GET on file:// URLs // Also if the scheme is empty we consider it a file. - // The QNetworkAccessFileBackend will right now only be used - // for PUT or qrc:// + // The QNetworkAccessFileBackend will right now only be used for PUT if ((op == QNetworkAccessManager::GetOperation || op == QNetworkAccessManager::HeadOperation) && (req.url().scheme() == QLatin1String("file") + || req.url().scheme() == QLatin1String("qrc") || req.url().scheme().isEmpty())) { return new QFileNetworkReply(this, req, op); } -- cgit v0.12 From c4d153c5a5adb78ae577a8c9484d661e39dc6125 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 21 Sep 2010 16:51:15 +0200 Subject: qmake: fix quoting of moc calls Task-number: QTBUG-13782 Reviewed-by: ossi (cherry picked from commit 36fc9e830b828b69c4df775c68c07c25c9bab4cf) --- mkspecs/features/moc.prf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mkspecs/features/moc.prf b/mkspecs/features/moc.prf index abda78f..15e7fd9 100644 --- a/mkspecs/features/moc.prf +++ b/mkspecs/features/moc.prf @@ -45,10 +45,10 @@ defineReplace(mocCmd) { if(contains(TEMPLATE, "vc.*")|contains(TEMPLATE_PREFIX, "vc")) { RET += $$mocinclude.commands } - RET += $$QMAKE_MOC $(DEFINES) @$$WIN_INCLUDETEMP $$join(QMAKE_COMPILER_DEFINES, " -D", -D) $$1 -o $$2 + RET += $$QMAKE_MOC $(DEFINES) @$$WIN_INCLUDETEMP $$join(QMAKE_COMPILER_DEFINES, " -D", -D) \"$$1\" -o $$2 return($$RET) } - return($$QMAKE_MOC $(DEFINES) $(INCPATH) $$join(QMAKE_COMPILER_DEFINES, " -D", -D) $$1 -o $$2) + return($$QMAKE_MOC $(DEFINES) $(INCPATH) $$join(QMAKE_COMPILER_DEFINES, " -D", -D) \"$$1\" -o $$2) } #moc headers -- cgit v0.12 From 28bd899cdcc7dd17be09feb20856b09af2639c0b Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Thu, 23 Sep 2010 12:46:33 +1000 Subject: Rebuild configure.exe. --- configure.exe | Bin 1402368 -> 1325568 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/configure.exe b/configure.exe index e2f4331..c36256e 100755 Binary files a/configure.exe and b/configure.exe differ -- cgit v0.12 From 6d524881d5f1125d7396b9a6e23ed65ce0a5c5eb Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Tue, 21 Sep 2010 16:25:48 +1000 Subject: Fix a crash in QDeclarativeVisualDataModel Task-number: QTBUG-13754 Reviewed-by: Martin Jones (cherry picked from commit 46e49547f8e4614cd504b0af0d52d4e2768b57c3) --- .../graphicsitems/qdeclarativevisualitemmodel.cpp | 6 +++--- .../qdeclarativelistmodel/data/multipleroles.qml | 25 ++++++++++++++++++++++ .../tst_qdeclarativelistmodel.cpp | 16 ++++++++++++++ 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativelistmodel/data/multipleroles.qml diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index a70886e..01cd652 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -621,7 +621,7 @@ QDeclarativeVisualDataModelParts::QDeclarativeVisualDataModelParts(QDeclarativeV QDeclarativeVisualDataModelPrivate::QDeclarativeVisualDataModelPrivate(QDeclarativeContext *ctxt) : m_listModelInterface(0), m_abstractItemModel(0), m_visualItemModel(0), m_delegate(0) -, m_context(ctxt), m_parts(0), m_delegateDataType(0), m_metaDataCreated(false) +, m_context(ctxt), m_modelDataPropId(-1), m_parts(0), m_delegateDataType(0), m_metaDataCreated(false) , m_metaDataCacheable(false), m_delegateValidated(false), m_completePending(false), m_listAccessor(0) { } @@ -1202,11 +1202,11 @@ void QDeclarativeVisualDataModel::_q_itemsChanged(int index, int count, qmlInfo(this) << "Changing role not present in item: " << roleName; } } - if (roles.count() == 1) { + if (d->m_roles.count() == 1) { // Handle the modelData role we add if there is just one role. int propId = data->modelDataPropertyId(); if (data->hasValue(propId)) { - int role = roles.at(0); + int role = d->m_roles.at(0); if (d->m_listModelInterface) { data->setValue(propId, d->m_listModelInterface->data(idx, QList() << role).value(role)); } else if (d->m_abstractItemModel) { diff --git a/tests/auto/declarative/qdeclarativelistmodel/data/multipleroles.qml b/tests/auto/declarative/qdeclarativelistmodel/data/multipleroles.qml new file mode 100644 index 0000000..b8f2f32 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistmodel/data/multipleroles.qml @@ -0,0 +1,25 @@ +import Qt 4.7 +ListView { + width: 100 + height: 250 + delegate: Rectangle { + width: 100 + height: 50 + color: black ? "black": "white" + } + model: ListModel { + objectName: "listModel" + ListElement { + black: false + rounded: false + } + ListElement { + black: true + rounded: false + } + ListElement { + black: true + rounded: false + } + } +} \ No newline at end of file diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index f456778..31cb545 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -98,6 +98,7 @@ private slots: void get_worker_data(); void get_nested(); void get_nested_data(); + void crash_model_with_multiple_roles(); }; int tst_qdeclarativelistmodel::roleFromName(const QDeclarativeListModel *model, const QString &roleName) { @@ -886,6 +887,21 @@ void tst_qdeclarativelistmodel::get_nested_data() get_data(); } +//QTBUG-13754 +void tst_qdeclarativelistmodel::crash_model_with_multiple_roles() +{ + QDeclarativeEngine eng; + QDeclarativeComponent component(&eng, QUrl::fromLocalFile(SRCDIR "/data/multipleroles.qml")); + QObject *rootItem = component.create(); + QVERIFY(component.errorString().isEmpty()); + QVERIFY(rootItem != 0); + QDeclarativeListModel *model = rootItem->findChild("listModel"); + QVERIFY(model != 0); + + // used to cause a crash in QDeclarativeVisualDataModel + model->setProperty(0, "black", true); +} + QTEST_MAIN(tst_qdeclarativelistmodel) #include "tst_qdeclarativelistmodel.moc" -- cgit v0.12 From 30848f7eaac221e9c8a3e0c73ce268c12ae801e5 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Fri, 17 Sep 2010 15:34:44 +1000 Subject: Autotest and small fix for QDeclarativeFontLoader. (cherry picked from commit eef26bc8521da62db0dced6796eceb7c27f64160) --- src/declarative/util/qdeclarativefontloader.cpp | 6 +-- .../qdeclarativefontloader/data/daniel.ttf | Bin 0 -> 51984 bytes .../tst_qdeclarativefontloader.cpp | 42 +++++++++++++++++++++ 3 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativefontloader/data/daniel.ttf diff --git a/src/declarative/util/qdeclarativefontloader.cpp b/src/declarative/util/qdeclarativefontloader.cpp index 91588b7..6879494 100644 --- a/src/declarative/util/qdeclarativefontloader.cpp +++ b/src/declarative/util/qdeclarativefontloader.cpp @@ -210,11 +210,7 @@ void QDeclarativeFontLoader::setSource(const QUrl &url) updateFontInfo(QString(), Error); } } else { - QDeclarativeFontObject *fo = d->fonts[d->url]; - d->name = QFontDatabase::applicationFontFamilies(fo->id).at(0); - emit nameChanged(); - d->status = QDeclarativeFontLoader::Ready; - emit statusChanged(); + updateFontInfo(QFontDatabase::applicationFontFamilies(d->fonts[d->url]->id).at(0), Ready); } } else #endif diff --git a/tests/auto/declarative/qdeclarativefontloader/data/daniel.ttf b/tests/auto/declarative/qdeclarativefontloader/data/daniel.ttf new file mode 100644 index 0000000..aae50d5 Binary files /dev/null and b/tests/auto/declarative/qdeclarativefontloader/data/daniel.ttf differ diff --git a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp index ae23017..8765426 100644 --- a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp +++ b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp @@ -39,8 +39,10 @@ ** ****************************************************************************/ #include +#include #include #include +#include #include #include "../../../shared/util.h" #include "../shared/testhttpserver.h" @@ -67,6 +69,7 @@ private slots: void webFont(); void redirWebFont(); void failWebFont(); + void changeFont(); private slots: @@ -181,6 +184,45 @@ void tst_qdeclarativefontloader::failWebFont() QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Error); } +void tst_qdeclarativefontloader::changeFont() +{ + QString componentStr = "import Qt 4.7\nFontLoader { source: font }"; + QDeclarativeContext *ctxt = engine.rootContext(); + ctxt->setContextProperty("font", QUrl::fromLocalFile(SRCDIR "/data/tarzeau_ocr_a.ttf")); + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeFontLoader *fontObject = qobject_cast(component.create()); + + QVERIFY(fontObject != 0); + + QSignalSpy nameSpy(fontObject, SIGNAL(nameChanged())); + QSignalSpy statusSpy(fontObject, SIGNAL(statusChanged())); + + QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Ready); + QCOMPARE(nameSpy.count(), 0); + QCOMPARE(statusSpy.count(), 0); + QTRY_COMPARE(fontObject->name(), QString("OCRA")); + + ctxt->setContextProperty("font", "http://localhost:14448/daniel.ttf"); + QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Loading); + QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Ready); + QCOMPARE(nameSpy.count(), 1); + QCOMPARE(statusSpy.count(), 2); + QTRY_COMPARE(fontObject->name(), QString("Daniel")); + + ctxt->setContextProperty("font", QUrl::fromLocalFile(SRCDIR "/data/tarzeau_ocr_a.ttf")); + QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Ready); + QCOMPARE(nameSpy.count(), 2); + QCOMPARE(statusSpy.count(), 2); + QTRY_COMPARE(fontObject->name(), QString("OCRA")); + + ctxt->setContextProperty("font", "http://localhost:14448/daniel.ttf"); + QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Ready); + QCOMPARE(nameSpy.count(), 3); + QCOMPARE(statusSpy.count(), 2); + QTRY_COMPARE(fontObject->name(), QString("Daniel")); +} + QTEST_MAIN(tst_qdeclarativefontloader) #include "tst_qdeclarativefontloader.moc" -- cgit v0.12 From 1d6298e369a96a2ed1d2af5baa6546bce9b304b6 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Fri, 17 Sep 2010 16:34:50 +1000 Subject: Fix example after changes to font.letterSpacing. (cherry picked from commit 5372b313127302d94c748732052dd62d0e38a1cd) --- examples/declarative/text/fonts/hello.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/declarative/text/fonts/hello.qml b/examples/declarative/text/fonts/hello.qml index a396ff3..60bd919 100644 --- a/examples/declarative/text/fonts/hello.qml +++ b/examples/declarative/text/fonts/hello.qml @@ -56,10 +56,11 @@ Rectangle { color: "white" text: "Hello world!" font.pixelSize: 60 + smooth: true SequentialAnimation on font.letterSpacing { loops: Animation.Infinite; - NumberAnimation { from: 100; to: 300; easing.type: Easing.InQuad; duration: 3000 } + NumberAnimation { from: 0; to: 150; easing.type: Easing.InQuad; duration: 3000 } ScriptAction { script: { container.y = (screen.height / 4) + (Math.random() * screen.height / 2) -- cgit v0.12 From 3e9fd27db4e97de6ba9b7d045ceb48c35e5cefac Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Mon, 20 Sep 2010 17:25:27 +1000 Subject: Update QtDeclarative def files (cherry picked from commit 90431a96ca0558ac82ccd588faf1b0aed55abbfe) --- src/s60installs/bwins/QtDeclarativeu.def | 5 ++++- src/s60installs/eabi/QtDeclarativeu.def | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/s60installs/bwins/QtDeclarativeu.def b/src/s60installs/bwins/QtDeclarativeu.def index 0193381..cf2f325 100644 --- a/src/s60installs/bwins/QtDeclarativeu.def +++ b/src/s60installs/bwins/QtDeclarativeu.def @@ -215,7 +215,7 @@ EXPORTS ?clear@QDeclarativeListReference@@QBE_NXZ @ 214 NONAME ; bool QDeclarativeListReference::clear(void) const ?parentChanged@QDeclarativeItem@@IAEXPAV1@@Z @ 215 NONAME ; void QDeclarativeItem::parentChanged(class QDeclarativeItem *) ?columnNumber@QDeclarativeDebugFileReference@@QBEHXZ @ 216 NONAME ; int QDeclarativeDebugFileReference::columnNumber(void) const - ??0QDeclarativeListModel@@AAE@_NPAVQObject@@@Z @ 217 NONAME ; QDeclarativeListModel::QDeclarativeListModel(bool, class QObject *) + ??0QDeclarativeListModel@@AAE@_NPAVQObject@@@Z @ 217 NONAME ABSENT ; QDeclarativeListModel::QDeclarativeListModel(bool, class QObject *) ?apply@QDeclarativeState@@QAEXPAVQDeclarativeStateGroup@@PAVQDeclarativeTransition@@PAV1@@Z @ 218 NONAME ; void QDeclarativeState::apply(class QDeclarativeStateGroup *, class QDeclarativeTransition *, class QDeclarativeState *) ?isValid@QDeclarativeDomProperty@@QBE_NXZ @ 219 NONAME ; bool QDeclarativeDomProperty::isValid(void) const ?trUtf8@QDeclarativeDebugExpressionQuery@@SA?AVQString@@PBD0@Z @ 220 NONAME ; class QString QDeclarativeDebugExpressionQuery::trUtf8(char const *, char const *) @@ -1712,4 +1712,7 @@ EXPORTS ?setScript@QDeclarativeScriptAction@@QAEXABVQDeclarativeScriptString@@@Z @ 1711 NONAME ; void QDeclarativeScriptAction::setScript(class QDeclarativeScriptString const &) ?metaObject@QDeclarativeScriptAction@@UBEPBUQMetaObject@@XZ @ 1712 NONAME ; struct QMetaObject const * QDeclarativeScriptAction::metaObject(void) const ?getPointer@QDeclarativeAbstractBinding@@SA?AV?$QWeakPointer@VQDeclarativeAbstractBinding@@@@PAV1@@Z @ 1713 NONAME ; class QWeakPointer QDeclarativeAbstractBinding::getPointer(class QDeclarativeAbstractBinding *) + ??0QDeclarativeListModel@@AAE@PBV0@PAVQDeclarativeListModelWorkerAgent@@@Z @ 1714 NONAME ; QDeclarativeListModel::QDeclarativeListModel(class QDeclarativeListModel const *, class QDeclarativeListModelWorkerAgent *) + ?inWorkerThread@QDeclarativeListModel@@ABE_NXZ @ 1715 NONAME ; bool QDeclarativeListModel::inWorkerThread(void) const + ?canMove@QDeclarativeListModel@@ABE_NHHH@Z @ 1716 NONAME ; bool QDeclarativeListModel::canMove(int, int, int) const diff --git a/src/s60installs/eabi/QtDeclarativeu.def b/src/s60installs/eabi/QtDeclarativeu.def index 2016ec7..11dee4d 100644 --- a/src/s60installs/eabi/QtDeclarativeu.def +++ b/src/s60installs/eabi/QtDeclarativeu.def @@ -552,9 +552,9 @@ EXPORTS _ZN21QDeclarativeListModel6removeEi @ 551 NONAME _ZN21QDeclarativeListModel7flattenEv @ 552 NONAME _ZN21QDeclarativeListModelC1EP7QObject @ 553 NONAME - _ZN21QDeclarativeListModelC1EbP7QObject @ 554 NONAME + _ZN21QDeclarativeListModelC1EbP7QObject @ 554 NONAME ABSENT _ZN21QDeclarativeListModelC2EP7QObject @ 555 NONAME - _ZN21QDeclarativeListModelC2EbP7QObject @ 556 NONAME + _ZN21QDeclarativeListModelC2EbP7QObject @ 556 NONAME ABSENT _ZN21QDeclarativeListModelD0Ev @ 557 NONAME _ZN21QDeclarativeListModelD1Ev @ 558 NONAME _ZN21QDeclarativeListModelD2Ev @ 559 NONAME @@ -1744,4 +1744,7 @@ EXPORTS _ZThn12_N24QDeclarativeScriptActionD1Ev @ 1743 NONAME _ZThn8_N24QDeclarativeScriptActionD0Ev @ 1744 NONAME _ZThn8_N24QDeclarativeScriptActionD1Ev @ 1745 NONAME + _ZN21QDeclarativeListModelC1EPKS_P32QDeclarativeListModelWorkerAgent @ 1746 NONAME + _ZN21QDeclarativeListModelC2EPKS_P32QDeclarativeListModelWorkerAgent @ 1747 NONAME + _ZNK21QDeclarativeListModel14inWorkerThreadEv @ 1748 NONAME -- cgit v0.12 From 638face91faa7b6ff8cb85e6228faa1967cc66ac Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Mon, 13 Sep 2010 16:48:39 +0200 Subject: Fix text direction handling in QLabel For QLabel, text direction should be determined by actual text (if it's a simple text label) or the textDirection() property of the defaultTextOption of corresponding QTextDocument. Task-number: QTBUG-13552 Reviewed-by: Lars Knoll (cherry picked from commit 9b20aac0ad83b917c46cc44b78dc90fb1d238fe8) --- src/gui/widgets/qlabel.cpp | 27 ++++++++++++++++----------- src/gui/widgets/qlabel_p.h | 1 + 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/gui/widgets/qlabel.cpp b/src/gui/widgets/qlabel.cpp index bdbd0b0..42be03b 100644 --- a/src/gui/widgets/qlabel.cpp +++ b/src/gui/widgets/qlabel.cpp @@ -635,7 +635,7 @@ QSize QLabelPrivate::sizeForWidth(int w) const br = movie->currentPixmap().rect(); #endif else if (isTextLabel) { - int align = QStyle::visualAlignment(q->layoutDirection(), QFlag(this->align)); + int align = QStyle::visualAlignment(textDirection(), QFlag(this->align)); // Add indentation int m = indent; @@ -1059,7 +1059,8 @@ void QLabel::paintEvent(QPaintEvent *) drawFrame(&painter); QRect cr = contentsRect(); cr.adjust(d->margin, d->margin, -d->margin, -d->margin); - int align = QStyle::visualAlignment(layoutDirection(), QFlag(d->align)); + int align = QStyle::visualAlignment(d->isTextLabel ? d->textDirection() + : layoutDirection(), QFlag(d->align)); #ifndef QT_NO_MOVIE if (d->movie) { @@ -1119,7 +1120,8 @@ void QLabel::paintEvent(QPaintEvent *) d->control->drawContents(&painter, QRectF(), this); painter.restore(); } else { - int flags = align; + int flags = align | (d->textDirection() == Qt::LeftToRight ? Qt::TextForceLeftToRight + : Qt::TextForceRightToLeft); if (d->hasShortcut) { flags |= Qt::TextShowMnemonic; if (!style->styleHint(QStyle::SH_UnderlineShortcut, &opt, this)) @@ -1447,10 +1449,6 @@ void QLabel::changeEvent(QEvent *ev) d->control->setPalette(palette()); } else if (ev->type() == QEvent::ContentsRectChange) { d->updateLabel(); - } else if (ev->type() == QEvent::LayoutDirectionChange) { - if (d->isTextLabel && d->control) { - d->sendControlEvent(ev); - } } QFrame::changeEvent(ev); } @@ -1486,6 +1484,15 @@ void QLabel::setScaledContents(bool enable) update(contentsRect()); } +Qt::LayoutDirection QLabelPrivate::textDirection() const +{ + if (control) { + QTextOption opt = control->document()->defaultTextOption(); + return opt.textDirection(); + } + + return text.isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight; +} /*! \fn void QLabel::setAlignment(Qt::AlignmentFlag flag) @@ -1503,7 +1510,8 @@ QRect QLabelPrivate::documentRect() const Q_ASSERT_X(isTextLabel, "documentRect", "document rect called for label that is not a text label!"); QRect cr = q->contentsRect(); cr.adjust(margin, margin, -margin, -margin); - const int align = QStyle::visualAlignment(q->layoutDirection(), QFlag(this->align)); + const int align = QStyle::visualAlignment(isTextLabel ? textDirection() + : q->layoutDirection(), QFlag(this->align)); int m = indent; if (m < 0 && q->frameWidth()) // no indent, but we do have a frame m = q->fontMetrics().width(QLatin1Char('x')) / 2 - margin; @@ -1564,7 +1572,6 @@ void QLabelPrivate::ensureTextLayouted() const if (!textLayoutDirty) return; ensureTextPopulated(); - Q_Q(const QLabel); if (control) { QTextDocument *doc = control->document(); QTextOption opt = doc->defaultTextOption(); @@ -1576,8 +1583,6 @@ void QLabelPrivate::ensureTextLayouted() const else opt.setWrapMode(QTextOption::ManualWrap); - opt.setTextDirection(q->layoutDirection()); - doc->setDefaultTextOption(opt); QTextFrameFormat fmt = doc->rootFrame()->frameFormat(); diff --git a/src/gui/widgets/qlabel_p.h b/src/gui/widgets/qlabel_p.h index fba7224..83624c7 100644 --- a/src/gui/widgets/qlabel_p.h +++ b/src/gui/widgets/qlabel_p.h @@ -132,6 +132,7 @@ public: QRectF layoutRect() const; QRect documentRect() const; QPoint layoutPoint(const QPoint& p) const; + Qt::LayoutDirection textDirection() const; #ifndef QT_NO_CONTEXTMENU QMenu *createStandardContextMenu(const QPoint &pos); #endif -- cgit v0.12 From 0c63d0ed5417c72056632fc5b4bfc29f889b1cc1 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Wed, 22 Sep 2010 15:10:44 +0200 Subject: Fix text direction setting in QTextBlock layout QTextControl should no longer inherit the layout direction of parent widget as its default text direction. Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Lars Knoll (cherry picked from commit 6397e5bc49f11e20a9d1838d8d8df46dd9486263) --- src/gui/text/qtextcontrol.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index 5fe0c0c..7f2c4e9 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -404,12 +404,6 @@ void QTextControlPrivate::init(Qt::TextFormat format, const QString &text, QText Q_Q(QTextControl); setContent(format, text, document); - QWidget *parentWidget = qobject_cast(parent); - if (parentWidget) { - QTextOption opt = doc->defaultTextOption(); - opt.setTextDirection(parentWidget->layoutDirection()); - doc->setDefaultTextOption(opt); - } doc->setUndoRedoEnabled(interactionFlags & Qt::TextEditable); q->setCursorWidth(-1); } -- cgit v0.12 From 9daa6ea1bc481e894c292ebc29a50cc57cd4fccc Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 23 Sep 2010 18:43:39 +0200 Subject: Doc: Fixed coding style breakage in qdoc source code. Reviewed-by: Trust Me --- tools/qdoc3/htmlgenerator.cpp | 129 +++++++++++++++++++++--------------------- 1 file changed, 64 insertions(+), 65 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 77e306a..caa4a29 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -451,7 +451,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, { int skipAhead = 0; static bool in_para = false; - + switch (atom->type()) { case Atom::AbstractLeft: break; @@ -527,18 +527,18 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << formattingRightMap()[ATOM_FORMATTING_TELETYPE]; break; case Atom::Code: - out() << "
"
+        out() << "
"
               << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),
                                                  marker,relative))
               << "
\n"; - break; + break; #ifdef QDOC_QML case Atom::Qml: - out() << "
"
+        out() << "
"
               << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),
                                                  marker,relative))
               << "
\n"; - break; + break; #endif case Atom::CodeNew: out() << "

you can rewrite it as

\n" @@ -554,7 +554,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "
"
               << trimmedTrailing(protectEnc(plainCode(indent(codeIndent,atom->string()))))
               << "
\n"; - break; + break; case Atom::FootnoteLeft: // ### For now if (in_para) { @@ -927,13 +927,13 @@ int HtmlGenerator::generateAtom(const Atom *atom, threeColumnEnumValueTable = isThreeColumnEnumValueTable(atom); if (threeColumnEnumValueTable) { out() << ""; - // << "" - if (++numTableRows % 2 == 1) - out() << ""; - else - out() << ""; + // << "" + if (++numTableRows % 2 == 1) + out() << ""; + else + out() << ""; - out() << "" + out() << "" << "" << "\n"; } @@ -1811,44 +1811,44 @@ void HtmlGenerator::generateHeader(const QString& title, out() << " \n"; out() << " \n"; - - // Adding syntax highlighter // future release - + + // Adding syntax highlighter // future release + // Setting some additional style sheet related details depending on configuration (e.g. Online/Creator) switch (application) { case Online: // Adding style and js for small windows - out() << " \n"; - out() << " "; - out() << " \n"; - out() << " \n"; + out() << " \n"; + out() << " "; + out() << " \n"; + out() << " \n"; // Browser spec styles - out() << " \n"; - out() << "\n"; - out() << "\n"; - out() << "\n"; - - out() << "\n"; - // CheckEmptyAndLoadList activating search - out() << "\n"; + out() << " \n"; + out() << "\n"; + out() << "\n"; + out() << "\n"; + + out() << "\n"; + // CheckEmptyAndLoadList activating search + out() << "\n"; break; case Creator: - out() << "\n"; - out() << "\n"; // offline narrow + out() << "\n"; + out() << "\n"; // offline narrow break; default: - out() << "\n"; - out() << "\n"; + out() << "\n"; + out() << "\n"; break; } @@ -1866,7 +1866,7 @@ void HtmlGenerator::generateHeader(const QString& title, case Creator: out() << QString(creatorPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); generateBreadCrumbs(title,node,marker); - out() << QString(creatorPostPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); + out() << QString(creatorPostPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); break; default: // default -- not used except if one forgets to set any of the above settings to true out() << QString(creatorPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); @@ -1945,8 +1945,8 @@ void HtmlGenerator::generateTitle(const QString& title, if (!title.isEmpty()) out() << "

" << protectEnc(title) << "

\n"; if (!subTitle.isEmpty()) { - out() << ""; else out() << " class=\"subtitle\">"; @@ -1979,10 +1979,10 @@ void HtmlGenerator::generateFooter(const Node *node) out() << " })();\n"; out() << " \n"; out() << "\n"; - break; + break; case Creator: out() << "\n"; - break; + break; default: out() << "\n"; } @@ -2238,20 +2238,19 @@ void HtmlGenerator::generateNavigationBar(const NavigationBar& bar, out() << "]\n"; #endif } - if (fake->name() != QString("index.html")) - { - if (bar.current.begin() != 0) { - out() << "[Home]\n"; - } - if (bar.next.begin() != 0) { - out() << "[Next: "; - generateText(Text::sectionHeading(bar.next.begin()), node, marker); - out() << "]\n"; + if (fake->name() != QString("index.html")) { + if (bar.current.begin() != 0) { + out() << "[Home]\n"; + } + if (bar.next.begin() != 0) { + out() << "[Next: "; + generateText(Text::sectionHeading(bar.next.begin()), node, marker); + out() << "]\n"; + } + out() << "

\n"; } - out() << "

\n"; - } } } #endif @@ -3283,7 +3282,7 @@ void HtmlGenerator::generateLink(const Atom* atom, inLink = false; out() << protectEnc(atom->string().mid(k)); } else if (marker->recognizeLanguage("Java")) { - // hack for Java: remove () and use when appropriate + // hack for Java: remove () and use when appropriate bool func = atom->string().endsWith("()"); bool tt = (func || atom->string().contains(camelCase)); if (tt) @@ -4065,7 +4064,7 @@ void HtmlGenerator::generateStatus(const Node *node, CodeMarker *marker) switch (node->status()) { case Node::Obsolete: if (node->isInnerNode()) - Generator::generateStatus(node, marker); + Generator::generateStatus(node, marker); break; case Node::Compat: if (node->isInnerNode()) { @@ -4225,7 +4224,7 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node, out() << "
"; else out() << ""; - + out() << "
Constant
ConstantValueDescription

"; out() << ""; @@ -4265,10 +4264,10 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node, out() << "

"; out() << ""; //out() << ""; - if (++numTableRows % 2 == 1) - out() << ""; - else - out() << ""; + if (++numTableRows % 2 == 1) + out() << ""; + else + out() << ""; out() << ""; - out() << "" + out() << "" << "" << "\n"; } -- cgit v0.12 From 31f96e8d9a90767aac385a2a9657cabe0c1f3889 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 24 Sep 2010 09:13:35 +0200 Subject: Fix dependency on the plugins rule for multimedia When configuring with -no-multimedia then the plugins rule should not be depending on multimedia, otherwise it will not try and build any plugins. Task-number: QTBUG-13912 Reviewed-by: Rohan McGovern (cherry picked from commit c52224f8010bf90732e5b2ad6cef84f9bd248787) --- src/src.pro | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/src.pro b/src/src.pro index f856a0c..9a8b70fc 100644 --- a/src/src.pro +++ b/src/src.pro @@ -110,7 +110,8 @@ src_webkit_declarative.target = sub-webkitdeclarative contains(QT_CONFIG, opengl):src_multimedia.depends += src_opengl src_tools_activeqt.depends = src_tools_idc src_gui src_declarative.depends = src_gui src_script src_network - src_plugins.depends = src_gui src_sql src_svg src_multimedia + src_plugins.depends = src_gui src_sql src_svg + contains(QT_CONFIG, multimedia):src_plugins.depends += src_multimedia src_s60installs.depends = $$TOOLS_SUBDIRS $$SRC_SUBDIRS src_s60installs.depends -= src_s60installs src_imports.depends = src_gui src_declarative -- cgit v0.12 From 01de6e56c95e43fbbc8b645afbcf37e01a385740 Mon Sep 17 00:00:00 2001 From: Lasse Holmstedt Date: Fri, 24 Sep 2010 13:13:29 +0200 Subject: QML Debugging: Documentation fixes Many things have changed with QML debugging in Qt Creator. Now docs simply refer to Qt Creator documentation. Reviewed-by: Leena Miettinen (cherry picked from commit f61d2d16310aa0a87ec1ba823f903f19575aed7c) --- doc/src/declarative/qdeclarativedebugging.qdoc | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/doc/src/declarative/qdeclarativedebugging.qdoc b/doc/src/declarative/qdeclarativedebugging.qdoc index ea21852..64c312c 100644 --- a/doc/src/declarative/qdeclarativedebugging.qdoc +++ b/doc/src/declarative/qdeclarativedebugging.qdoc @@ -79,20 +79,8 @@ QDeclarativeImportDatabase::resolveType "Rectangle" = "QDeclarativeRectangle" \section1 Debugging with Qt Creator \l{http://qt.nokia.com/products/developer-tools}{Qt Creator} provides built-in -support for QML debugging. Open a QML project in Creator and enter Debug mode, -or click the "Start Debugging" option from the menu, and Creator will -show QML debugging information and options for your application, including -object inspection, property monitoring and application frame-rate analysis. - -Creator can be used to debug both local and remote QML applications. To -enable remote debugging, start the \l {QML Viewer} -on the remote device with a debugging port defined, like this: - -\code - QML_DEBUG_SERVER_PORT=3768 qmlviewer myqmlfile.qml -\endcode - -In Creator, open the project settings pane and set the server and port -details for the remote device, then start debugging. +support for QML debugging. QML projects and standalone C++ applications that +utilize QML can be debugged on desktops as well as on remote devices. +For more information, see the Qt Creator Manual. */ -- cgit v0.12 From 6529e1df5279e44e93c7f18333103658257c92d7 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Sun, 26 Sep 2010 18:38:55 +0200 Subject: QHostInfo: Fix a crash when a new request is pushed while resolving. The loop looking for posponedLookup in the lookup thread wasn't locking the mutex before trying to access/modify the list. Reviewed-by: Andreas Kling (cherry picked from commit 45c2ac4f1e1218f595b1d21691c8dec4eaa1a021) --- src/network/kernel/qhostinfo.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp index 348b0d2..41a9512 100644 --- a/src/network/kernel/qhostinfo.cpp +++ b/src/network/kernel/qhostinfo.cpp @@ -468,14 +468,17 @@ void QHostInfoRunnable::run() resultEmitter.emitResultsReady(hostInfo); // now also iterate through the postponed ones - QMutableListIterator iterator(manager->postponedLookups); - while (iterator.hasNext()) { - QHostInfoRunnable* postponed = iterator.next(); - if (toBeLookedUp == postponed->toBeLookedUp) { - // we can now emit - iterator.remove(); - hostInfo.setLookupId(postponed->id); - postponed->resultEmitter.emitResultsReady(hostInfo); + { + QMutexLocker locker(&manager->mutex); + QMutableListIterator iterator(manager->postponedLookups); + while (iterator.hasNext()) { + QHostInfoRunnable* postponed = iterator.next(); + if (toBeLookedUp == postponed->toBeLookedUp) { + // we can now emit + iterator.remove(); + hostInfo.setLookupId(postponed->id); + postponed->resultEmitter.emitResultsReady(hostInfo); + } } } -- cgit v0.12 From f8b96e9bdc488b20aa9ba0a8eec3a7b6edc5b2dd Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 22 Sep 2010 16:32:31 +0300 Subject: Improved Symbian4 platform detection Now returns correct value for Symbian4 platforms with QSysInfo::symbianVersion(). SYMBIAN_VERSION .pro file variable should also return correct value even if it doesn't get set in environment.prf. Task-number: QTBUG-13802 Reviewed-by: Shane Kearns Reviewed-by: Janne Anttila (cherry picked from commit 0aad0d2043e061469b7139483c489dc6f823490b) --- mkspecs/common/symbian/symbian.conf | 62 ++++++++++++++++------------ src/corelib/global/global.pri | 3 ++ src/corelib/global/qglobal.cpp | 81 ++++++++++++++++++++++++------------- src/corelib/global/qglobal.h | 4 +- 4 files changed, 93 insertions(+), 57 deletions(-) diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index 679731f..cc5b788 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -132,39 +132,49 @@ exists($${EPOCROOT}epoc32/tools/qt/mkspecs/features/environment.prf) { } # Try to detect SDK version if it wasn't set by environment.prf -isEmpty(S60_VERSION) { - # The Symbian^3 PDK does not necessarily contain the required sis files. - # However, libstdcppv5 first appeared in Symbian^3 (S60 5.2), so check for that too. - exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.2.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.2.sis)|exists($${EPOCROOT}epoc32/release/armv5/lib/libstdcppv5.dso) { - S60_VERSION = 5.2 +isEmpty(SYMBIAN_VERSION) { + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/Symbianv4.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/Symbianv4.sis) { + SYMBIAN_VERSION = Symbian4 } else { - exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.1.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.1.sis) { - S60_VERSION = 5.1 + # The Symbian^3 PDK does not necessarily contain the required sis files. + # However, libstdcppv5 first appeared in Symbian^3 (S60 5.2), so check for that too. + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.2.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.2.sis)|exists($${EPOCROOT}epoc32/release/armv5/lib/libstdcppv5.dso) { + SYMBIAN_VERSION = Symbian3 } else { - exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.0.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.0.sis) { - S60_VERSION = 5.0 + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.1.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.1.sis) { + SYMBIAN_VERSION = Symbian2 } else { - exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v3.2.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v3.2.sis) { - S60_VERSION = 3.2 + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.0.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.0.sis) { + SYMBIAN_VERSION = 9.4 } else { - S60_VERSION = 3.1 + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v3.2.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v3.2.sis) { + SYMBIAN_VERSION = 9.3 + } else { + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v3.1.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v3.1.sis) { + SYMBIAN_VERSION = 9.2 + } else { + SYMBIAN_VERSION = Unknown + } + } } } } } } -isEmpty(SYMBIAN_VERSION) { - contains(S60_VERSION, "3\\.1") { - SYMBIAN_VERSION = 9.2 - } else:contains(S60_VERSION, "3\\.2") { - SYMBIAN_VERSION = 9.3 - } else:contains(S60_VERSION, "5\\.0") { - SYMBIAN_VERSION = 9.4 - } else:contains(S60_VERSION, "5\\.1") { - SYMBIAN_VERSION = Symbian2 - } else:contains(S60_VERSION, "5\\.2") { - SYMBIAN_VERSION = Symbian3 +isEmpty(S60_VERSION) { + contains(SYMBIAN_VERSION, "9\\.2") { + S60_VERSION = 3.1 + } else:contains(SYMBIAN_VERSION, "9\\.3") { + S60_VERSION = 3.2 + } else:contains(SYMBIAN_VERSION, "9\\.4") { + S60_VERSION = 5.0 + } else:contains(SYMBIAN_VERSION, "Symbian2") { + S60_VERSION = 5.1 + } else:contains(SYMBIAN_VERSION, "Symbian3") { + S60_VERSION = 5.2 + } else { + S60_VERSION = Unknown } } @@ -174,14 +184,14 @@ isEmpty(SYMBIAN_VERSION) { default_deployment.pkg_prerules += pkg_depends_webkit pkg_depends_qt pkg_platform_dependencies -# Supports S60 3.0, 3.1, 3.2, 5.0 and Symbian^3 by default +# Supports S60 3.1, 3.2, 5.0, Symbian^3, and Symbian^4 by default pkg_platform_dependencies = \ "; Default HW/platform dependencies" \ - "[0x101F7961],0,0,0,{\"S60ProductID\"}" \ "[0x102032BE],0,0,0,{\"S60ProductID\"}" \ "[0x102752AE],0,0,0,{\"S60ProductID\"}" \ "[0x1028315F],0,0,0,{\"S60ProductID\"}" \ - "[0x20022e6d],0,0,0,{\"S60ProductID\"}" \ + "[0x20022E6D],0,0,0,{\"S60ProductID\"}" \ + "[0x20032DE7],0,0,0,{\"S60ProductID\"}" \ " " DEPLOYMENT += default_deployment diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index 260ed59..4800716 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -24,3 +24,6 @@ linux*:!static:!linux-armcc:!linux-gcce { prog=$$quote(if (/program interpreter: (.*)]/) { print $1; }) DEFINES += ELF_INTERPRETER=\\\"$$system(readelf -l /bin/ls | perl -n -e \'$$prog\')\\\" } + +# Compensate for lack of platform defines in Symbian3 and Symbian4 +symbian: DEFINES += SYMBIAN_VERSION_$$upper($$replace(SYMBIAN_VERSION,\\.,_)) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 401af85..3291fe7 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -86,7 +86,8 @@ # include "private/qcore_symbian_p.h" _LIT(qt_S60Filter, "Series60v?.*.sis"); -_LIT(qt_S60SystemInstallDir, "z:\\system\\install\\"); +_LIT(qt_symbianFilter, "Symbianv*.sis"); +_LIT(qt_symbianSystemInstallDir, "z:\\system\\install\\"); #endif QT_BEGIN_NAMESPACE @@ -1813,12 +1814,12 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion() #endif #ifdef Q_OS_SYMBIAN -static QSysInfo::S60Version cachedS60Version = QSysInfo::S60Version(-1); +static QSysInfo::SymbianVersion cachedSymbianVersion = QSysInfo::SymbianVersion(-1); -QSysInfo::S60Version QSysInfo::s60Version() +QSysInfo::SymbianVersion QSysInfo::symbianVersion() { - if (cachedS60Version != -1) - return cachedS60Version; + if (cachedSymbianVersion != -1) + return cachedSymbianVersion; // Use pure Symbian code, because if done using QDir, there will be a call back // to this method, resulting doing this expensive operation twice before the cache kicks in. @@ -1826,7 +1827,22 @@ QSysInfo::S60Version QSysInfo::s60Version() RFs rfs = qt_s60GetRFs(); TFindFile fileFinder(rfs); CDir* contents; - TInt err = fileFinder.FindWildByDir(qt_S60Filter, qt_S60SystemInstallDir, contents); + + // Check for Symbian4 + TInt err = fileFinder.FindWildByDir(qt_symbianFilter, qt_symbianSystemInstallDir, contents); + if (err == KErrNone) { + QScopedPointer contentsDeleter(contents); + err = contents->Sort(EDescending|ESortByName); + if (err == KErrNone && contents->Count() > 0 && (*contents)[0].iName.Length() >= 9) { + TInt major = (*contents)[0].iName[8] - '0'; + if (major == 4) { + return cachedSymbianVersion = SV_SF_4; + } + } + } + + // Check for S60 and Symbian3 platforms, which use older .sis naming scheme + err = fileFinder.FindWildByDir(qt_S60Filter, qt_symbianSystemInstallDir, contents); if (err == KErrNone) { QScopedPointer contentsDeleter(contents); err = contents->Sort(EDescending|ESortByName); @@ -1835,19 +1851,19 @@ QSysInfo::S60Version QSysInfo::s60Version() TInt minor = (*contents)[0].iName[11] - '0'; if (major == 3) { if (minor == 1) { - return cachedS60Version = SV_S60_3_1; + return cachedSymbianVersion = SV_9_2; } else if (minor == 2) { - return cachedS60Version = SV_S60_3_2; + return cachedSymbianVersion = SV_9_3; } } else if (major == 5) { if (minor == 0) { - return cachedS60Version = SV_S60_5_0; + return cachedSymbianVersion = SV_9_4; } else if (minor == 1) { - return cachedS60Version = SV_S60_5_1; + return cachedSymbianVersion = SV_SF_2; } else if (minor == 2) { - return cachedS60Version = SV_S60_5_2; + return cachedSymbianVersion = SV_SF_3; } } } @@ -1855,33 +1871,40 @@ QSysInfo::S60Version QSysInfo::s60Version() # ifdef Q_CC_NOKIAX86 // Some emulator environments may not contain the version specific .sis files, so - // simply hardcode the version on those environments. + // simply hardcode the version on those environments. Note that can't use + // SYMBIAN_VERSION_* defines for S60 3.x/5.0 platforms, as they do not define them + // right anyway in case .sis files are not found. # if defined(__SERIES60_31__) - return cachedS60Version = SV_S60_3_1; + return cachedSymbianVersion = SV_9_2; # elif defined(__S60_32__) - return cachedS60Version = SV_S60_3_2; + return cachedSymbianVersion = SV_9_3; # elif defined(__S60_50__) - return cachedS60Version = SV_S60_5_0; + return cachedSymbianVersion = SV_9_4; +# elif defined(SYMBIAN_VERSION_SYMBIAN3) + return cachedSymbianVersion = SV_SF_3; +# elif defined(SYMBIAN_VERSION_SYMBIAN4) + return cachedSymbianVersion = SV_SF_4; # endif # endif //If reaching here, it was not possible to determine the version - return cachedS60Version = SV_S60_Unknown; + return cachedSymbianVersion = SV_Unknown; } -QSysInfo::SymbianVersion QSysInfo::symbianVersion() + +QSysInfo::S60Version QSysInfo::s60Version() { - switch (s60Version()) { - case SV_S60_3_1: - return SV_9_2; - case SV_S60_3_2: - return SV_9_3; - case SV_S60_5_0: - return SV_9_4; - case SV_S60_5_1: - return SV_SF_2; - case SV_S60_5_2: - return SV_SF_3; + switch (symbianVersion()) { + case SV_9_2: + return SV_S60_3_1; + case SV_9_3: + return SV_S60_3_2; + case SV_9_4: + return SV_S60_5_0; + case SV_SF_2: + return SV_S60_5_1; + case SV_SF_3: + return SV_S60_5_2; default: - return SV_Unknown; + return SV_S60_Unknown; } } #endif // ifdef Q_OS_SYMBIAN diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index c906a1c..3a35aa3 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1515,7 +1515,7 @@ public: #endif #ifdef Q_OS_SYMBIAN enum SymbianVersion { - SV_Unknown = 0x0000, + SV_Unknown = 1000000, // Assume unknown is something newer than what is supported //These are the Symbian Ltd versions 9.2-9.4 SV_9_2 = 10, SV_9_3 = 20, @@ -1529,7 +1529,7 @@ public: static SymbianVersion symbianVersion(); enum S60Version { SV_S60_None = 0, - SV_S60_Unknown = 1, + SV_S60_Unknown = SV_Unknown, SV_S60_3_1 = SV_9_2, SV_S60_3_2 = SV_9_3, SV_S60_5_0 = SV_9_4, -- cgit v0.12 From 7ad71b986fd9e8854a6eef049eea56cd5569e5fc Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Fri, 24 Sep 2010 11:47:36 +0200 Subject: fix RSS listing example ... by handling HTTP 30X responses and using QNetworkAccessManager instead of QHttp. The server now sends back a HTTP 302 instead of a 200. Reviewed-by: Markus Goetz Task-number: QTBUG-13892 (cherry picked from commit 15ddcea2d15b7d7731e24151b0a30990e77efe74) --- examples/xml/rsslisting/main.cpp | 1 - examples/xml/rsslisting/rsslisting.cpp | 89 +++++++++++++++++++--------------- examples/xml/rsslisting/rsslisting.h | 16 +++--- 3 files changed, 59 insertions(+), 47 deletions(-) diff --git a/examples/xml/rsslisting/main.cpp b/examples/xml/rsslisting/main.cpp index 95c8a89..71ae0eb 100644 --- a/examples/xml/rsslisting/main.cpp +++ b/examples/xml/rsslisting/main.cpp @@ -57,7 +57,6 @@ Provides the main function for the RSS news reader example. int main(int argc, char **argv) { QApplication app(argc, argv); - qWarning("The usage of QHttp is not recommended anymore, please use QNetworkAccessManager."); RSSListing *rsslisting = new RSSListing; rsslisting->show(); return app.exec(); diff --git a/examples/xml/rsslisting/rsslisting.cpp b/examples/xml/rsslisting/rsslisting.cpp index b7c9eb0..48c3062 100644 --- a/examples/xml/rsslisting/rsslisting.cpp +++ b/examples/xml/rsslisting/rsslisting.cpp @@ -65,21 +65,19 @@ its operation, and also allows very large data sources to be read. Constructs an RSSListing widget with a simple user interface, and sets up the XML reader to use a custom handler class. - The user interface consists of a line edit, two push buttons, and a + The user interface consists of a line edit, a push button, and a list view widget. The line edit is used for entering the URLs of news - sources; the push buttons start and abort the process of reading the + sources; the push button starts the process of reading the news. */ RSSListing::RSSListing(QWidget *parent) - : QWidget(parent) + : QWidget(parent), currentReply(0) { lineEdit = new QLineEdit(this); lineEdit->setText("http://labs.qt.nokia.com/blogs/feed"); fetchButton = new QPushButton(tr("Fetch"), this); - abortButton = new QPushButton(tr("Abort"), this); - abortButton->setEnabled(false); treeWidget = new QTreeWidget(this); connect(treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), @@ -89,15 +87,11 @@ RSSListing::RSSListing(QWidget *parent) treeWidget->setHeaderLabels(headerLabels); treeWidget->header()->setResizeMode(QHeaderView::ResizeToContents); - connect(&http, SIGNAL(readyRead(QHttpResponseHeader)), - this, SLOT(readData(QHttpResponseHeader))); - - connect(&http, SIGNAL(requestFinished(int,bool)), - this, SLOT(finished(int,bool))); + connect(&manager, SIGNAL(finished(QNetworkReply*)), + this, SLOT(finished(QNetworkReply*))); connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(fetch())); connect(fetchButton, SIGNAL(clicked()), this, SLOT(fetch())); - connect(abortButton, SIGNAL(clicked()), &http, SLOT(abort())); QVBoxLayout *layout = new QVBoxLayout(this); @@ -105,7 +99,6 @@ RSSListing::RSSListing(QWidget *parent) hboxLayout->addWidget(lineEdit); hboxLayout->addWidget(fetchButton); - hboxLayout->addWidget(abortButton); layout->addLayout(hboxLayout); layout->addWidget(treeWidget); @@ -115,34 +108,53 @@ RSSListing::RSSListing(QWidget *parent) } /* + Starts the network request and connects the needed signals +*/ +void RSSListing::get(const QUrl &url) +{ + QNetworkRequest request(url); + if (currentReply) { + currentReply->disconnect(this); + currentReply->deleteLater(); + } + currentReply = manager.get(request); + connect(currentReply, SIGNAL(readyRead()), this, SLOT(readyRead())); + connect(currentReply, SIGNAL(metaDataChanged()), this, SLOT(metaDataChanged())); + connect(currentReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(error(QNetworkReply::NetworkError))); +} + +/* Starts fetching data from a news source specified in the line edit widget. The line edit is made read only to prevent the user from modifying its contents during the fetch; this is only for cosmetic purposes. - The fetch button is disabled, and the abort button is enabled to allow - the user to interrupt processing. The list view is cleared, and we + The fetch button is disabled, the list view is cleared, and we define the last list view item to be 0, meaning that there are no existing items in the list. - The HTTP handler is supplied with the raw contents of the line edit and - a fetch is initiated. We keep the ID value returned by the HTTP handler - for future reference. + A URL is created with the raw contents of the line edit and + a get is initiated. */ void RSSListing::fetch() { lineEdit->setReadOnly(true); fetchButton->setEnabled(false); - abortButton->setEnabled(true); treeWidget->clear(); xml.clear(); QUrl url(lineEdit->text()); + get(url); +} - http.setHost(url.host()); - connectionId = http.get(url.path()); +void RSSListing::metaDataChanged() +{ + QUrl redirectionTarget = currentReply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl(); + if (redirectionTarget.isValid()) { + get(redirectionTarget); + } } /* @@ -150,16 +162,14 @@ void RSSListing::fetch() We read all the available data, and pass it to the XML stream reader. Then we call the XML parsing function. - - If parsing fails for any reason, we abort the fetch. */ -void RSSListing::readData(const QHttpResponseHeader &resp) +void RSSListing::readyRead() { - if (resp.statusCode() != 200) - http.abort(); - else { - xml.addData(http.readAll()); + int statusCode = currentReply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); + if (statusCode >= 200 && statusCode < 300) { + QByteArray data = currentReply->readAll(); + xml.addData(data); parseXml(); } } @@ -177,19 +187,11 @@ void RSSListing::readData(const QHttpResponseHeader &resp) user interface available to the user for further input. */ -void RSSListing::finished(int id, bool error) +void RSSListing::finished(QNetworkReply *reply) { - if (error) { - qWarning("Received error during HTTP fetch."); - lineEdit->setReadOnly(false); - abortButton->setEnabled(false); - fetchButton->setEnabled(true); - } - else if (id == connectionId) { - lineEdit->setReadOnly(false); - abortButton->setEnabled(false); - fetchButton->setEnabled(true); - } + Q_UNUSED(reply); + lineEdit->setReadOnly(false); + fetchButton->setEnabled(true); } @@ -225,7 +227,6 @@ void RSSListing::parseXml() } if (xml.error() && xml.error() != QXmlStreamReader::PrematureEndOfDocumentError) { qWarning() << "XML ERROR:" << xml.lineNumber() << ": " << xml.errorString(); - http.abort(); } } @@ -236,3 +237,11 @@ void RSSListing::itemActivated(QTreeWidgetItem * item) { QDesktopServices::openUrl(QUrl(item->text(1))); } + +void RSSListing::error(QNetworkReply::NetworkError) +{ + qWarning("error retrieving RSS feed"); + currentReply->disconnect(this); + currentReply->deleteLater(); + currentReply = 0; +} diff --git a/examples/xml/rsslisting/rsslisting.h b/examples/xml/rsslisting/rsslisting.h index 8939dfd..9387222 100644 --- a/examples/xml/rsslisting/rsslisting.h +++ b/examples/xml/rsslisting/rsslisting.h @@ -41,10 +41,12 @@ #ifndef RSSLISTING_H #define RSSLISTING_H -#include +#include +#include #include #include #include +#include QT_BEGIN_NAMESPACE class QLineEdit; @@ -61,24 +63,26 @@ public: public slots: void fetch(); - void finished(int id, bool error); - void readData(const QHttpResponseHeader &); + void finished(QNetworkReply *reply); + void readyRead(); + void metaDataChanged(); void itemActivated(QTreeWidgetItem * item); + void error(QNetworkReply::NetworkError); private: void parseXml(); + void get(const QUrl &url); QXmlStreamReader xml; QString currentTag; QString linkString; QString titleString; - QHttp http; - int connectionId; + QNetworkAccessManager manager; + QNetworkReply *currentReply; QLineEdit *lineEdit; QTreeWidget *treeWidget; - QPushButton *abortButton; QPushButton *fetchButton; }; -- cgit v0.12 From 645e0a5c1beea5049e72e095ad3b6b126ad4941a Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 22 Sep 2010 09:16:42 +0200 Subject: Mitigate private header problems in QtCreator by adding semi-private API Add a semi-private API to get QScriptEngine for a QDeclarativeEngine. So far the qmljsdebugger lib in QtCreator accessed the script engine via QDeclarativeEnginePrivate. Replace this by a minimal API that is still in a private header, where we nevertheless can make some BC checks/guarantees. Aaron Kennedy agreed with the idea. Task-number: QTCREATORBUG-2179 (cherry picked from commit 63c4c0449361ced03838e51d18e1113740f27fa9) --- src/declarative/debugger/debugger.pri | 6 +- src/declarative/debugger/qdeclarativedebug_p.h | 1 - .../debugger/qdeclarativedebughelper.cpp | 13 +++++ .../debugger/qdeclarativedebughelper_p.h | 25 ++++++++ .../private_headers/qdeclarativedebughelper_p.h | 25 ++++++++ .../qdeclarativedebughelper.pro | 5 ++ .../tst_qdeclarativedebughelper.cpp | 68 ++++++++++++++++++++++ 7 files changed, 140 insertions(+), 3 deletions(-) create mode 100644 src/declarative/debugger/qdeclarativedebughelper.cpp create mode 100644 src/declarative/debugger/qdeclarativedebughelper_p.h create mode 100644 tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h create mode 100644 tests/auto/declarative/qdeclarativedebughelper/qdeclarativedebughelper.pro create mode 100644 tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp diff --git a/src/declarative/debugger/debugger.pri b/src/declarative/debugger/debugger.pri index 33d0843..25f7687 100644 --- a/src/declarative/debugger/debugger.pri +++ b/src/declarative/debugger/debugger.pri @@ -6,7 +6,8 @@ SOURCES += \ $$PWD/qdeclarativedebugservice.cpp \ $$PWD/qdeclarativedebugclient.cpp \ $$PWD/qdeclarativedebug.cpp \ - $$PWD/qdeclarativedebugtrace.cpp + $$PWD/qdeclarativedebugtrace.cpp \ + $$PWD/qdeclarativedebughelper.cpp HEADERS += \ $$PWD/qdeclarativedebuggerstatus_p.h \ @@ -14,4 +15,5 @@ HEADERS += \ $$PWD/qdeclarativedebugservice_p.h \ $$PWD/qdeclarativedebugclient_p.h \ $$PWD/qdeclarativedebug_p.h \ - $$PWD/qdeclarativedebugtrace_p.h + $$PWD/qdeclarativedebugtrace_p.h \ + $$PWD/qdeclarativedebughelper_p.h diff --git a/src/declarative/debugger/qdeclarativedebug_p.h b/src/declarative/debugger/qdeclarativedebug_p.h index f0fc488..2b1a115 100644 --- a/src/declarative/debugger/qdeclarativedebug_p.h +++ b/src/declarative/debugger/qdeclarativedebug_p.h @@ -365,7 +365,6 @@ private: int m_queryId; QVariant m_expr; QVariant m_result; - }; QT_END_NAMESPACE diff --git a/src/declarative/debugger/qdeclarativedebughelper.cpp b/src/declarative/debugger/qdeclarativedebughelper.cpp new file mode 100644 index 0000000..99feff4 --- /dev/null +++ b/src/declarative/debugger/qdeclarativedebughelper.cpp @@ -0,0 +1,13 @@ +#include "private/qdeclarativedebughelper_p.h" +#include "private/qdeclarativeengine_p.h" + +#include + +QT_BEGIN_NAMESPACE + +QScriptEngine *QDeclarativeDebugHelper::getScriptEngine(QDeclarativeEngine *engine) +{ + return QDeclarativeEnginePrivate::getScriptEngine(engine); +} + +QT_END_NAMESPACE diff --git a/src/declarative/debugger/qdeclarativedebughelper_p.h b/src/declarative/debugger/qdeclarativedebughelper_p.h new file mode 100644 index 0000000..a403c45 --- /dev/null +++ b/src/declarative/debugger/qdeclarativedebughelper_p.h @@ -0,0 +1,25 @@ +#ifndef QDECLARATIVEDEBUGHELPER_P_H +#define QDECLARATIVEDEBUGHELPER_P_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QScriptEngine; +class QDeclarativeEngine; + +// Helper methods to access private API through a stable interface +// This is used in the qmljsdebugger library of QtCreator. +class Q_DECLARATIVE_EXPORT QDeclarativeDebugHelper +{ +public: + static QScriptEngine *getScriptEngine(QDeclarativeEngine *engine); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECLARATIVEDEBUGHELPER_P_H diff --git a/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h b/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h new file mode 100644 index 0000000..a403c45 --- /dev/null +++ b/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h @@ -0,0 +1,25 @@ +#ifndef QDECLARATIVEDEBUGHELPER_P_H +#define QDECLARATIVEDEBUGHELPER_P_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QScriptEngine; +class QDeclarativeEngine; + +// Helper methods to access private API through a stable interface +// This is used in the qmljsdebugger library of QtCreator. +class Q_DECLARATIVE_EXPORT QDeclarativeDebugHelper +{ +public: + static QScriptEngine *getScriptEngine(QDeclarativeEngine *engine); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECLARATIVEDEBUGHELPER_P_H diff --git a/tests/auto/declarative/qdeclarativedebughelper/qdeclarativedebughelper.pro b/tests/auto/declarative/qdeclarativedebughelper/qdeclarativedebughelper.pro new file mode 100644 index 0000000..c52c652 --- /dev/null +++ b/tests/auto/declarative/qdeclarativedebughelper/qdeclarativedebughelper.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += network declarative script +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativedebughelper.cpp diff --git a/tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp b/tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp new file mode 100644 index 0000000..db62455 --- /dev/null +++ b/tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include + +#include +#include + +// We have copied the header which is used in the qmljsdebugger (part of QtCreator) +// to catch BC changes. Don't update it unless you know what you are doing! +#include "private_headers/qdeclarativedebughelper_p.h" + +class tst_qdeclarativedebughelper : public QObject { + Q_OBJECT +private slots: + void getScriptEngine(); +}; + +void tst_qdeclarativedebughelper::getScriptEngine() +{ + QDeclarativeEngine engine; + + QScriptEngine *scriptEngine = QDeclarativeDebugHelper::getScriptEngine(&engine); + QVERIFY(scriptEngine); + QCOMPARE(scriptEngine, QDeclarativeEnginePrivate::getScriptEngine(&engine)); +} + +QTEST_MAIN(tst_qdeclarativedebughelper) + +#include "tst_qdeclarativedebughelper.moc" + -- cgit v0.12 From 29dbafd9b4aba15c0e5c7a6f14368c53311edce2 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 22 Sep 2010 09:16:42 +0200 Subject: Mitigate private header problems in QtCreator by adding semi-private API Add a semi-private API to get QScriptEngine for a QDeclarativeEngine. So far the qmljsdebugger lib in QtCreator accessed the script engine via QDeclarativeEnginePrivate. Replace this by a minimal API that is still in a private header, where we nevertheless can make some BC checks/guarantees. Aaron Kennedy agreed with the idea. Task-number: QTCREATORBUG-2179 (cherry picked from commit c1a7deedf1628e0dd3a5fbf92d97c4151d17fb5a) --- .../debugger/qdeclarativedebughelper.cpp | 56 ++++++++++++++++++++++ .../debugger/qdeclarativedebughelper_p.h | 42 ++++++++++++++++ .../private_headers/qdeclarativedebughelper_p.h | 42 ++++++++++++++++ .../tst_qdeclarativedebughelper.cpp | 47 ++++++++++++++++++ 4 files changed, 187 insertions(+) diff --git a/src/declarative/debugger/qdeclarativedebughelper.cpp b/src/declarative/debugger/qdeclarativedebughelper.cpp index 99feff4..ea621bf 100644 --- a/src/declarative/debugger/qdeclarativedebughelper.cpp +++ b/src/declarative/debugger/qdeclarativedebughelper.cpp @@ -3,6 +3,55 @@ #include +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "private/qdeclarativedebughelper_p.h" + +#include +#include + +#include +#include + QT_BEGIN_NAMESPACE QScriptEngine *QDeclarativeDebugHelper::getScriptEngine(QDeclarativeEngine *engine) @@ -10,4 +59,11 @@ QScriptEngine *QDeclarativeDebugHelper::getScriptEngine(QDeclarativeEngine *engi return QDeclarativeEnginePrivate::getScriptEngine(engine); } +void QDeclarativeDebugHelper::setAnimationSlowDownFactor(qreal factor) +{ + QUnifiedTimer *timer = QUnifiedTimer::instance(); + timer->setSlowModeEnabled(factor != 1.0); + timer->setSlowdownFactor(factor); +} + QT_END_NAMESPACE diff --git a/src/declarative/debugger/qdeclarativedebughelper_p.h b/src/declarative/debugger/qdeclarativedebughelper_p.h index a403c45..c9cb839 100644 --- a/src/declarative/debugger/qdeclarativedebughelper_p.h +++ b/src/declarative/debugger/qdeclarativedebughelper_p.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef QDECLARATIVEDEBUGHELPER_P_H #define QDECLARATIVEDEBUGHELPER_P_H @@ -16,6 +57,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeDebugHelper { public: static QScriptEngine *getScriptEngine(QDeclarativeEngine *engine); + static void setAnimationSlowDownFactor(qreal factor); }; QT_END_NAMESPACE diff --git a/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h b/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h index a403c45..c9cb839 100644 --- a/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h +++ b/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef QDECLARATIVEDEBUGHELPER_P_H #define QDECLARATIVEDEBUGHELPER_P_H @@ -16,6 +57,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeDebugHelper { public: static QScriptEngine *getScriptEngine(QDeclarativeEngine *engine); + static void setAnimationSlowDownFactor(qreal factor); }; QT_END_NAMESPACE diff --git a/tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp b/tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp index db62455..36f2222 100644 --- a/tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp +++ b/tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp @@ -42,6 +42,8 @@ #include #include +#include +#include // We have copied the header which is used in the qmljsdebugger (part of QtCreator) // to catch BC changes. Don't update it unless you know what you are doing! @@ -51,6 +53,21 @@ class tst_qdeclarativedebughelper : public QObject { Q_OBJECT private slots: void getScriptEngine(); + void setAnimationSlowDownFactor(); +}; + +class TestAnimation : public QAbstractAnimation { +public: + int updateCalled; + + TestAnimation() : updateCalled(0) {} + + virtual void updateCurrentTime(int /*currentTime*/) { + updateCalled++; + } + virtual int duration() const { + return 100; + } }; void tst_qdeclarativedebughelper::getScriptEngine() @@ -62,6 +79,36 @@ void tst_qdeclarativedebughelper::getScriptEngine() QCOMPARE(scriptEngine, QDeclarativeEnginePrivate::getScriptEngine(&engine)); } +void tst_qdeclarativedebughelper::setAnimationSlowDownFactor() +{ + TestAnimation animation; + + // first check whether setup works + QCOMPARE(animation.updateCalled, 0); + animation.start(); + QTest::qWait(animation.totalDuration() + 50); +#ifdef Q_OS_WIN + if (animation.state() != QAbstractAnimation::Stopped) + QEXPECT_FAIL("", "On windows, consistent timing is not working properly due to bad timer resolution", Abort); +#endif + QCOMPARE(animation.state(), QAbstractAnimation::Stopped); + QVERIFY(animation.updateCalled > 1); + + // check if we can pause all animations + animation.updateCalled = 0; + QDeclarativeDebugHelper::setAnimationSlowDownFactor(0.0); + animation.start(); + QTest::qWait(animation.totalDuration() + 50); + QVERIFY(animation.updateCalled <= 1); // updateCurrentTime seems to be called at least once + + // now run them again + animation.updateCalled = 0; + QDeclarativeDebugHelper::setAnimationSlowDownFactor(2.0); + animation.start(); + QTest::qWait(animation.totalDuration() + 50); + QVERIFY(animation.updateCalled > 1); +} + QTEST_MAIN(tst_qdeclarativedebughelper) #include "tst_qdeclarativedebughelper.moc" -- cgit v0.12 From a8d85de1d10a9cbe74d7b9a509229ee2e7570bde Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 23 Sep 2010 08:50:21 +1000 Subject: Move includes after copyright block (cherry picked from commit b750bb085029117497d26a24dcd590fbe34fe281) --- src/declarative/debugger/qdeclarativedebughelper.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/declarative/debugger/qdeclarativedebughelper.cpp b/src/declarative/debugger/qdeclarativedebughelper.cpp index ea621bf..207ad2b 100644 --- a/src/declarative/debugger/qdeclarativedebughelper.cpp +++ b/src/declarative/debugger/qdeclarativedebughelper.cpp @@ -1,8 +1,3 @@ -#include "private/qdeclarativedebughelper_p.h" -#include "private/qdeclarativeengine_p.h" - -#include - /**************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). @@ -44,6 +39,8 @@ ** ****************************************************************************/ +#include + #include "private/qdeclarativedebughelper_p.h" #include -- cgit v0.12 From 4cc98be8a3623ec899837e3e424910671c9f9920 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Mon, 27 Sep 2010 19:56:07 +1000 Subject: Update QtDeclarative .def files. --- src/s60installs/bwins/QtDeclarativeu.def | 2 ++ src/s60installs/eabi/QtDeclarativeu.def | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/s60installs/bwins/QtDeclarativeu.def b/src/s60installs/bwins/QtDeclarativeu.def index cf2f325..bd2026d 100644 --- a/src/s60installs/bwins/QtDeclarativeu.def +++ b/src/s60installs/bwins/QtDeclarativeu.def @@ -1715,4 +1715,6 @@ EXPORTS ??0QDeclarativeListModel@@AAE@PBV0@PAVQDeclarativeListModelWorkerAgent@@@Z @ 1714 NONAME ; QDeclarativeListModel::QDeclarativeListModel(class QDeclarativeListModel const *, class QDeclarativeListModelWorkerAgent *) ?inWorkerThread@QDeclarativeListModel@@ABE_NXZ @ 1715 NONAME ; bool QDeclarativeListModel::inWorkerThread(void) const ?canMove@QDeclarativeListModel@@ABE_NHHH@Z @ 1716 NONAME ; bool QDeclarativeListModel::canMove(int, int, int) const + ?getScriptEngine@QDeclarativeDebugHelper@@SAPAVQScriptEngine@@PAVQDeclarativeEngine@@@Z @ 1717 NONAME ; class QScriptEngine * QDeclarativeDebugHelper::getScriptEngine(class QDeclarativeEngine *) + ?setAnimationSlowDownFactor@QDeclarativeDebugHelper@@SAXM@Z @ 1718 NONAME ; void QDeclarativeDebugHelper::setAnimationSlowDownFactor(float) diff --git a/src/s60installs/eabi/QtDeclarativeu.def b/src/s60installs/eabi/QtDeclarativeu.def index 11dee4d..9762c55 100644 --- a/src/s60installs/eabi/QtDeclarativeu.def +++ b/src/s60installs/eabi/QtDeclarativeu.def @@ -1747,4 +1747,6 @@ EXPORTS _ZN21QDeclarativeListModelC1EPKS_P32QDeclarativeListModelWorkerAgent @ 1746 NONAME _ZN21QDeclarativeListModelC2EPKS_P32QDeclarativeListModelWorkerAgent @ 1747 NONAME _ZNK21QDeclarativeListModel14inWorkerThreadEv @ 1748 NONAME + _ZN23QDeclarativeDebugHelper15getScriptEngineEP18QDeclarativeEngine @ 1749 NONAME + _ZN23QDeclarativeDebugHelper26setAnimationSlowDownFactorEf @ 1750 NONAME -- cgit v0.12 From dc8d0961a50e28224dc36febb3530c47444f8638 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Mon, 27 Sep 2010 14:00:23 +0200 Subject: Compile when detecting ARMv5 The macro is called QT_END_INCLUDE_HEADER, not QT_END_INCLUDE_HEADERS (no trailing S). --- src/corelib/arch/qatomic_arm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/arch/qatomic_arm.h b/src/corelib/arch/qatomic_arm.h index f9d71e9..1c1c8a5 100644 --- a/src/corelib/arch/qatomic_arm.h +++ b/src/corelib/arch/qatomic_arm.h @@ -68,7 +68,7 @@ QT_END_INCLUDE_HEADER # define QT_ARCH_ARMV5 QT_BEGIN_INCLUDE_HEADER # include "QtCore/qatomic_armv5.h" -QT_END_INCLUDE_HEADERS +QT_END_INCLUDE_HEADER #endif QT_END_HEADER -- cgit v0.12 From bcdc043e357d6168663a6fbb4bf2d596d12cab77 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 24 Sep 2010 16:29:46 +0200 Subject: Updated WebKit to 6e15c3404d15a8ab72242152ec966e5e388161a2 Includes Jay's fix for the JSC memory consumption on Symbian https://bugs.webkit.org/show_bug.cgi?id=34349 See also commit 03b7a3cffba609df56b4ccadacae6b6f985e96e9 (cherry picked from commit dbf1d0339a0cfbe60e6b3e45f39e6c02aa3de0a8) --- src/3rdparty/webkit/.tag | 2 +- src/3rdparty/webkit/ChangeLog | 8 ++ src/3rdparty/webkit/JavaScriptCore/ChangeLog | 36 +++++++ .../webkit/JavaScriptCore/JavaScriptCore.pro | 1 + .../JavaScriptCore/interpreter/RegisterFile.cpp | 2 + .../JavaScriptCore/interpreter/RegisterFile.h | 33 +++++- .../wtf/symbian/RegisterFileAllocatorSymbian.cpp | 111 +++++++++++++++++++++ .../wtf/symbian/RegisterFileAllocatorSymbian.h | 69 +++++++++++++ .../JavaScriptCore/wtf/symbian/SymbianDefines.h | 42 ++++++++ src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 31 ++++++ 11 files changed, 332 insertions(+), 5 deletions(-) create mode 100644 src/3rdparty/webkit/JavaScriptCore/wtf/symbian/RegisterFileAllocatorSymbian.cpp create mode 100644 src/3rdparty/webkit/JavaScriptCore/wtf/symbian/RegisterFileAllocatorSymbian.h create mode 100644 src/3rdparty/webkit/JavaScriptCore/wtf/symbian/SymbianDefines.h diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag index ae33228..fff71f4 100644 --- a/src/3rdparty/webkit/.tag +++ b/src/3rdparty/webkit/.tag @@ -1 +1 @@ -715b53069911a31a559aa0b3d94ffc6a5ac20988 +6e15c3404d15a8ab72242152ec966e5e388161a2 diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog index 14d6da3..f438655 100644 --- a/src/3rdparty/webkit/ChangeLog +++ b/src/3rdparty/webkit/ChangeLog @@ -1,3 +1,11 @@ +2010-09-24 Romain Pokrzywka + + Reviewed by Simon Hausmann. + + [Qt] Fix the Wince build. + + * WebKit.pri: Apply msvc flags to wince, too. + 2010-07-01 Simon Hausmann Rubber-stamped by Laszlo Gombos. diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index 9922da6..c7e0fc2 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,3 +1,39 @@ +2010-06-18 Tucker Jay + + Reviewed by NOBODY (OOPS!). + + [Symbian] Lazy commit of memory required in JSC register file + https://bugs.webkit.org/show_bug.cgi?id=34349 + + * JavaScriptCore.pro: Added 1 new Symbian source file + * interpreter/RegisterFile.cpp: + (JSC::RegisterFile::~RegisterFile): + * interpreter/RegisterFile.h: + (JSC::RegisterFile::): + (JSC::RegisterFile::start): + (JSC::RegisterFile::end): + (JSC::RegisterFile::size): + (JSC::RegisterFile::setNumGlobals): + (JSC::RegisterFile::numGlobals): + (JSC::RegisterFile::maxGlobals): + (JSC::RegisterFile::lastGlobal): + (JSC::RegisterFile::markGlobals): + (JSC::RegisterFile::markCallFrames): + (JSC::isPageAligned): + (JSC::RegisterFile::RegisterFile): + (JSC::RegisterFile::shrink): + (JSC::RegisterFile::grow): + * wtf/symbian/RegisterFileAllocatorSymbian.cpp: Added. + (WTF::RegisterFileAllocator::RegisterFileAllocator): + Helper class to allocate memory required by RegisterFile + more efficiently. + (WTF::RegisterFileAllocator::~RegisterFileAllocator): + (WTF::RegisterFileAllocator::buffer): + (WTF::RegisterFileAllocator::grow): + (WTF::RegisterFileAllocator::shrink): + * wtf/symbian/RegisterFileAllocatorSymbian.h: Added. + * wtf/symbian/SymbianDefines.h: Added. + 2010-06-16 Thiago Macieira Reviewed by NOBODY (OOPS!). diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro index 3f1ac86..a805170 100644 --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro @@ -208,6 +208,7 @@ SOURCES += \ wtf/qt/ThreadingQt.cpp \ wtf/RandomNumber.cpp \ wtf/RefCountedLeakCounter.cpp \ + wtf/symbian/RegisterFileAllocatorSymbian.cpp \ wtf/symbian/BlockAllocatorSymbian.cpp \ wtf/ThreadingNone.cpp \ wtf/Threading.cpp \ diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp index 510effe..4a33c62 100644 --- a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp @@ -40,6 +40,8 @@ RegisterFile::~RegisterFile() VirtualFree(m_buffer, DWORD(m_commitEnd) - DWORD(m_buffer), MEM_DECOMMIT); #endif VirtualFree(m_buffer, 0, MEM_RELEASE); +#elif OS(SYMBIAN) + delete m_registerFileAllocator; #else fastFree(m_buffer); #endif diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h index 1fc4f82..80cf991 100644 --- a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h +++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h @@ -41,6 +41,10 @@ #include #endif +#if OS(SYMBIAN) +#include +#endif + namespace JSC { /* @@ -152,12 +156,21 @@ namespace JSC { #if HAVE(VIRTUALALLOC) Register* m_commitEnd; #endif +#if OS(SYMBIAN) + // Commits and frees a continguous chunk of memory as required + WTF::RegisterFileAllocator* m_registerFileAllocator; +#endif JSGlobalObject* m_globalObject; // The global object whose vars are currently stored in the register file. }; // FIXME: Add a generic getpagesize() to WTF, then move this function to WTF as well. - inline bool isPageAligned(size_t size) { return size != 0 && size % (8 * 1024) == 0; } + // This is still a hack that should be fixed later. We know that a Symbian page size is 4K. + #if OS(SYMBIAN) + inline bool isPageAligned(size_t size) { return size && !(size % (4 * 1024)); } + #else + inline bool isPageAligned(size_t size) { return size && !(size % (8 * 1024)); } + #endif inline RegisterFile::RegisterFile(size_t capacity, size_t maxGlobals) : m_numGlobals(0) @@ -204,7 +217,13 @@ namespace JSC { CRASH(); } m_commitEnd = reinterpret_cast(reinterpret_cast(m_buffer) + committedSize); - #else + #elif OS(SYMBIAN) + m_registerFileAllocator = new WTF::RegisterFileAllocator(bufferLength); + m_buffer = (Register*)(m_registerFileAllocator->buffer()); + // start by committing enough space to hold maxGlobals + void* newEnd = (void*)((int)m_buffer + (maxGlobals * sizeof(Register))); + m_registerFileAllocator->grow(newEnd); + #else /* * If neither MMAP nor VIRTUALALLOC are available - use fastMalloc instead. * @@ -226,8 +245,13 @@ namespace JSC { if (newEnd >= m_end) return; m_end = newEnd; - if (m_end == m_start && (m_maxUsed - m_start) > maxExcessCapacity) + if (m_end == m_start && (m_maxUsed - m_start) > maxExcessCapacity) { +#if OS(SYMBIAN) + m_registerFileAllocator->shrink(newEnd); +#endif + releaseExcessCapacity(); + } } inline bool RegisterFile::grow(Register* newEnd) @@ -252,6 +276,9 @@ namespace JSC { m_commitEnd = reinterpret_cast(reinterpret_cast(m_commitEnd) + size); } #endif +#if OS(SYMBIAN) + m_registerFileAllocator->grow((void*)newEnd); +#endif if (newEnd > m_maxUsed) m_maxUsed = newEnd; diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/RegisterFileAllocatorSymbian.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/RegisterFileAllocatorSymbian.cpp new file mode 100644 index 0000000..baa7841 --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/RegisterFileAllocatorSymbian.cpp @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if OS(SYMBIAN) + +#include "RegisterFileAllocatorSymbian.h" + +namespace WTF { + +/** Efficiently allocates memory pools of size poolSize. + * Primarily designed for JSC RegisterFile's needs. + * Not thread-safe. + */ +RegisterFileAllocator::RegisterFileAllocator(TUint32 reservationSize, TUint32 poolSize) : + m_reserved(reservationSize), m_poolSize(poolSize) +{ + // Get system's page size value. + SYMBIAN_PAGESIZE(m_pageSize); + + // We only accept multiples of system page size for both initial reservation + // and the alignment/pool size + m_reserved = SYMBIAN_ROUNDUPTOMULTIPLE(m_reserved, m_pageSize); + __ASSERT_ALWAYS(SYMBIAN_ROUNDUPTOMULTIPLE(m_poolSize, m_pageSize), + User::Panic(_L("RegisterFileAllocator1"), KErrArgument)); + + // Open a Symbian RChunk, and reserve requested virtual address range + // Any thread in this process can operate this RChunk due to EOwnerProcess access rights. + TInt ret = m_chunk.CreateDisconnectedLocal(0 , 0, (TInt)m_reserved , EOwnerProcess); + if (ret != KErrNone) + User::Panic(_L("RegisterFileAllocator2"), ret); + + m_buffer = (void*)m_chunk.Base(); + m_resEnd = (void*)(m_chunk.Base() + m_chunk.MaxSize()); + m_comEnd = m_buffer; +} + +RegisterFileAllocator::~RegisterFileAllocator() +{ + // release everything! + m_chunk.Decommit(0, m_chunk.MaxSize()); + m_chunk.Close(); +} + +void* RegisterFileAllocator::buffer() const +{ + return m_buffer; +} + +void RegisterFileAllocator::grow(void* newEnd) +{ + // trying to commit more memory than reserved! + if (newEnd > m_resEnd) + return; + + if (newEnd > m_comEnd) { + TInt nBytes = (TInt)(newEnd) - (TInt)(m_comEnd); + nBytes = SYMBIAN_ROUNDUPTOMULTIPLE(nBytes, m_poolSize); + TInt offset = (TInt)m_comEnd - (TInt)m_buffer; + + TInt ret = m_chunk.Commit(offset, nBytes); + if (ret == KErrNone) + m_comEnd = (void*)(m_chunk.Base() + m_chunk.Size()); + } +} + +void RegisterFileAllocator::shrink(void* newEnd) +{ + if (newEnd < m_comEnd) { + TInt nBytes = (TInt)newEnd - (TInt)m_comEnd; + if (nBytes >= m_poolSize) { + TInt offset = SYMBIAN_ROUNDUPTOMULTIPLE((TUint)newEnd, m_poolSize) - (TInt)m_buffer; + nBytes = (TInt)m_comEnd - offset - (TInt)m_buffer; + if (nBytes > 0) { + TInt ret = m_chunk.Decommit(offset, nBytes); + if (ret == KErrNone) + m_comEnd = (void*)(m_chunk.Base() + m_chunk.Size()); + } + } + } +} + +} // end of namespace + +#endif // SYMBIAN diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/RegisterFileAllocatorSymbian.h b/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/RegisterFileAllocatorSymbian.h new file mode 100644 index 0000000..4cfc8c5 --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/RegisterFileAllocatorSymbian.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RegisterFileAllocatorSymbian_h +#define RegisterFileAllocatorSymbian_h + +#include "SymbianDefines.h" + +namespace WTF { + +/** + * Allocates contiguous regions of size poolSize. + * poolSize must be a multiple of system page size (typically 4K on Symbian/ARM) + * + * @param reservationSize Virtual address range to be reserved upon creation of chunk (bytes). + * @param poolSize Size of a single allocation. + */ +class RegisterFileAllocator { + +public: + RegisterFileAllocator( + TUint32 reservationSize, TUint32 poolSize = SYMBIAN_REGFILEALLOC_DEFAULTPOOLSIZE); + ~RegisterFileAllocator(); + void* buffer() const; + void grow(void* newEnd); + void shrink(void* newEnd); + +private: + RChunk m_chunk; // Symbian chunk that lets us reserve/commit/decommit + + // all following values are in numbers of bytes + TInt m_pageSize; // cached value of system page size, typically 4K on Symbian + TUint32 m_reserved; // total number of reserved bytes in virtual memory + TUint32 m_poolSize; // size of one memory pool, set by default to 64K in wtf/symbian/SymbianDefines.h + + void* m_buffer; // pointer to base of the chunk + void* m_comEnd; // pointer to end of currently committed memory + void* m_resEnd; // pointer to end of reserved memory + +}; + +} // end of namespace + +#endif // RegisterFileAllocatorSymbian_h diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/SymbianDefines.h b/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/SymbianDefines.h new file mode 100644 index 0000000..43e22b3 --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/symbian/SymbianDefines.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SymbianDefines_h +#define SymbianDefines_h + +#include +#include +#include + +#define SYMBIAN_PAGESIZE(x) (HAL::Get(HALData::EMemoryPageSize, x)); +#define SYMBIAN_FREERAM(x) (HAL::Get(HALData::EMemoryRAMFree, x)); +#define SYMBIAN_ROUNDUPTOMULTIPLE(x, multipleof) ( (x + multipleof - 1) & ~(multipleof - 1) ) + +#define SYMBIAN_REGFILEALLOC_DEFAULTPOOLSIZE 65536 // 64K + +#endif // SymbianDefines_h diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index f919bdf..a270d56 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from and has the sha1 checksum - 715b53069911a31a559aa0b3d94ffc6a5ac20988 + 6e15c3404d15a8ab72242152ec966e5e388161a2 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 2d20cbd..ac698e3 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,34 @@ +2010-09-24 Romain Pokrzywka + + Reviewed by Simon Hausmann. + + [Qt] Fix the Wince build. + + * WebCore.pro: Apply msvc flags to wince, too. + +2010-09-24 Anders Bakken + + Reviewed by Simon Hausmann. + + [Qt] Enable building Qt/Webkit with debug symbols + + With this patch one can configure with -webkit-debug to build Webkit + with debug symbols without having to manually edit WebCore.pro. + + * WebCore.pro: + +2010-09-16 Thomas Zander + + Reviewed by Andreas Kling. + + https://bugs.webkit.org/show_bug.cgi?id=45878 + + [Qt] Fixed incorrect Symbian scoping. + + The missing install functionality is only true for mmp based systems. + + * WebCore.pro: limit functionality to mmp systems. + 2010-09-09 Kristian Amlie Reviewed by Andreas Kling. -- cgit v0.12 From d6da3caf5692efbf3b927c902888ea679a0ef8f1 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 27 Sep 2010 17:05:25 +1000 Subject: Connect/Disconnect requests needs to use the same dbus connection to ICD for the refcounting to work in ICD. Fixes NB#188145 - Network interface doesn't go down after last client disconnects (cherry picked from commit 4acbb418b1ad093ad848143218a10ee2957db282) --- src/plugins/bearer/icd/qnetworksession_impl.cpp | 6 ++---- src/plugins/bearer/icd/qnetworksession_impl.h | 5 ++++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp index 8013d30..787cc55 100644 --- a/src/plugins/bearer/icd/qnetworksession_impl.cpp +++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp @@ -881,7 +881,6 @@ void QNetworkSessionPrivateImpl::close() } else if (isOpen) { if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { // We will not wait any disconnect from icd as it might never come - Maemo::Icd icd; #ifdef BEARER_MANAGEMENT_DEBUG qDebug() << "closing session" << publicConfig.identifier(); #endif @@ -894,7 +893,7 @@ void QNetworkSessionPrivateImpl::close() opened = false; isOpen = false; - icd.disconnect(ICD_CONNECTION_FLAG_APPLICATION_EVENT); + m_dbusInterface->call(ICD_DBUS_API_DISCONNECT_REQ, ICD_CONNECTION_FLAG_APPLICATION_EVENT); startTime = QDateTime(); } else { opened = false; @@ -915,7 +914,6 @@ void QNetworkSessionPrivateImpl::stop() emit QNetworkSessionPrivate::error(lastError); } else { if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { - Maemo::Icd icd; #ifdef BEARER_MANAGEMENT_DEBUG qDebug() << "stopping session" << publicConfig.identifier(); #endif @@ -928,7 +926,7 @@ void QNetworkSessionPrivateImpl::stop() opened = false; isOpen = false; - icd.disconnect(ICD_CONNECTION_FLAG_APPLICATION_EVENT); + m_dbusInterface->call(ICD_DBUS_API_DISCONNECT_REQ, ICD_CONNECTION_FLAG_APPLICATION_EVENT); startTime = QDateTime(); } else { opened = false; diff --git a/src/plugins/bearer/icd/qnetworksession_impl.h b/src/plugins/bearer/icd/qnetworksession_impl.h index 390e508..a879971 100644 --- a/src/plugins/bearer/icd/qnetworksession_impl.h +++ b/src/plugins/bearer/icd/qnetworksession_impl.h @@ -58,6 +58,7 @@ #include #include +#include #include #include @@ -98,7 +99,9 @@ public: m_stopTimer.setSingleShot(true); connect(&m_stopTimer, SIGNAL(timeout()), this, SLOT(finishStopBySendingClosedSignal())); - QDBusConnection systemBus = QDBusConnection::systemBus(); + QDBusConnection systemBus = QDBusConnection::connectToBus( + QDBusConnection::SystemBus, + QUuid::createUuid().toString()); m_dbusInterface = new QDBusInterface(ICD_DBUS_API_INTERFACE, ICD_DBUS_API_PATH, -- cgit v0.12 From 45f05e32294680f15257990122ba42ef6049f13b Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 27 Sep 2010 17:07:55 +1000 Subject: Closes properly the dbus connection in icd backend (cherry picked from commit 2ff0dee1b97348a750532223f0a318596c93d412) --- src/plugins/bearer/icd/qnetworksession_impl.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/bearer/icd/qnetworksession_impl.h b/src/plugins/bearer/icd/qnetworksession_impl.h index a879971..9ef9dc3 100644 --- a/src/plugins/bearer/icd/qnetworksession_impl.h +++ b/src/plugins/bearer/icd/qnetworksession_impl.h @@ -126,6 +126,8 @@ public: ~QNetworkSessionPrivateImpl() { cleanupSession(); + + QDBusConnection::disconnectFromBus(m_dbusInterface->connection().name()); } //called by QNetworkSession constructor and ensures -- cgit v0.12 From 131327ffc04d9888ce2b820833867d5a18a6f109 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 27 Sep 2010 17:12:02 +1000 Subject: Removing libconninet 3rdparty component. The use of libconninet caused Qt to have a cyclic build dependency. Which was solved by embedding a copy as a 3rd party library. Maemo has since donated the libconninet code to Qt because (1) it was a private Maemo API and (2) the Qt ICD plugin is the only user of the library. This commit moves the relevent code from src/3rdparty/libconninet to src/plugins/bearer/icd and deletes the rest. Task-number: QT-3893 (cherry picked from commit f532d8fcd236be9933e4186a95561e1c264de277) --- src/3rdparty/libconninet.pri | 18 - src/3rdparty/libconninet/AUTHORS | 0 src/3rdparty/libconninet/COPYING | 510 -------- src/3rdparty/libconninet/ChangeLog | 0 src/3rdparty/libconninet/INSTALL | 229 ---- src/3rdparty/libconninet/NEWS | 0 src/3rdparty/libconninet/README | 0 src/3rdparty/libconninet/autogen.sh | 3 - src/3rdparty/libconninet/configure.ac | 86 -- src/3rdparty/libconninet/conninet.pc.in | 11 - src/3rdparty/libconninet/debian/changelog | 305 ----- src/3rdparty/libconninet/debian/compat | 1 - src/3rdparty/libconninet/debian/control | 39 - src/3rdparty/libconninet/debian/copyright | 19 - .../libconninet/debian/libconninet0-dev.dirs | 2 - .../libconninet/debian/libconninet0-dev.files | 4 - src/3rdparty/libconninet/debian/libconninet0.dirs | 1 - src/3rdparty/libconninet/debian/libconninet0.files | 1 - src/3rdparty/libconninet/debian/rules | 123 -- src/3rdparty/libconninet/doxygen.cfg.in | 1147 ----------------- src/3rdparty/libconninet/src/dbusdispatcher.cpp | 611 --------- src/3rdparty/libconninet/src/dbusdispatcher.h | 91 -- src/3rdparty/libconninet/src/iapconf.cpp | 299 ----- src/3rdparty/libconninet/src/iapconf.h | 84 -- src/3rdparty/libconninet/src/iapmonitor.cpp | 110 -- src/3rdparty/libconninet/src/iapmonitor.h | 48 - src/3rdparty/libconninet/src/maemo_icd.cpp | 1316 -------------------- src/3rdparty/libconninet/src/maemo_icd.h | 182 --- src/3rdparty/libconninet/src/proxyconf.cpp | 392 ------ src/3rdparty/libconninet/src/proxyconf.h | 53 - .../libconninet/tests/ut_dbusdispatcher.cpp | 191 --- src/3rdparty/libconninet/tests/ut_iapconf.cpp | 186 --- src/3rdparty/libconninet/tests/ut_iapmonitor.cpp | 118 -- src/3rdparty/libconninet/tests/ut_maemo_icd.cpp | 274 ---- src/3rdparty/libconninet/tests/ut_proxyconf.cpp | 400 ------ src/plugins/bearer/icd/dbusdispatcher.cpp | 631 ++++++++++ src/plugins/bearer/icd/dbusdispatcher.h | 111 ++ src/plugins/bearer/icd/iapconf.cpp | 245 ++++ src/plugins/bearer/icd/iapconf.h | 74 ++ src/plugins/bearer/icd/iapmonitor.cpp | 130 ++ src/plugins/bearer/icd/iapmonitor.h | 68 + src/plugins/bearer/icd/icd.pro | 16 +- src/plugins/bearer/icd/maemo_icd.cpp | 849 +++++++++++++ src/plugins/bearer/icd/maemo_icd.h | 174 +++ src/plugins/bearer/icd/proxyconf.cpp | 412 ++++++ src/plugins/bearer/icd/proxyconf.h | 73 ++ src/plugins/bearer/icd/qicdengine.cpp | 14 +- src/plugins/bearer/icd/qicdengine.h | 2 +- src/plugins/bearer/icd/qnetworksession_impl.cpp | 12 +- src/plugins/bearer/icd/wlan-utils.h | 110 ++ 50 files changed, 2915 insertions(+), 6860 deletions(-) delete mode 100644 src/3rdparty/libconninet.pri delete mode 100644 src/3rdparty/libconninet/AUTHORS delete mode 100644 src/3rdparty/libconninet/COPYING delete mode 100644 src/3rdparty/libconninet/ChangeLog delete mode 100644 src/3rdparty/libconninet/INSTALL delete mode 100644 src/3rdparty/libconninet/NEWS delete mode 100644 src/3rdparty/libconninet/README delete mode 100755 src/3rdparty/libconninet/autogen.sh delete mode 100644 src/3rdparty/libconninet/configure.ac delete mode 100644 src/3rdparty/libconninet/conninet.pc.in delete mode 100644 src/3rdparty/libconninet/debian/changelog delete mode 100644 src/3rdparty/libconninet/debian/compat delete mode 100644 src/3rdparty/libconninet/debian/control delete mode 100644 src/3rdparty/libconninet/debian/copyright delete mode 100644 src/3rdparty/libconninet/debian/libconninet0-dev.dirs delete mode 100644 src/3rdparty/libconninet/debian/libconninet0-dev.files delete mode 100644 src/3rdparty/libconninet/debian/libconninet0.dirs delete mode 100644 src/3rdparty/libconninet/debian/libconninet0.files delete mode 100755 src/3rdparty/libconninet/debian/rules delete mode 100644 src/3rdparty/libconninet/doxygen.cfg.in delete mode 100644 src/3rdparty/libconninet/src/dbusdispatcher.cpp delete mode 100644 src/3rdparty/libconninet/src/dbusdispatcher.h delete mode 100644 src/3rdparty/libconninet/src/iapconf.cpp delete mode 100644 src/3rdparty/libconninet/src/iapconf.h delete mode 100644 src/3rdparty/libconninet/src/iapmonitor.cpp delete mode 100644 src/3rdparty/libconninet/src/iapmonitor.h delete mode 100644 src/3rdparty/libconninet/src/maemo_icd.cpp delete mode 100644 src/3rdparty/libconninet/src/maemo_icd.h delete mode 100644 src/3rdparty/libconninet/src/proxyconf.cpp delete mode 100644 src/3rdparty/libconninet/src/proxyconf.h delete mode 100644 src/3rdparty/libconninet/tests/ut_dbusdispatcher.cpp delete mode 100644 src/3rdparty/libconninet/tests/ut_iapconf.cpp delete mode 100644 src/3rdparty/libconninet/tests/ut_iapmonitor.cpp delete mode 100644 src/3rdparty/libconninet/tests/ut_maemo_icd.cpp delete mode 100644 src/3rdparty/libconninet/tests/ut_proxyconf.cpp create mode 100644 src/plugins/bearer/icd/dbusdispatcher.cpp create mode 100644 src/plugins/bearer/icd/dbusdispatcher.h create mode 100644 src/plugins/bearer/icd/iapconf.cpp create mode 100644 src/plugins/bearer/icd/iapconf.h create mode 100644 src/plugins/bearer/icd/iapmonitor.cpp create mode 100644 src/plugins/bearer/icd/iapmonitor.h create mode 100644 src/plugins/bearer/icd/maemo_icd.cpp create mode 100644 src/plugins/bearer/icd/maemo_icd.h create mode 100644 src/plugins/bearer/icd/proxyconf.cpp create mode 100644 src/plugins/bearer/icd/proxyconf.h create mode 100644 src/plugins/bearer/icd/wlan-utils.h diff --git a/src/3rdparty/libconninet.pri b/src/3rdparty/libconninet.pri deleted file mode 100644 index e041e2b..0000000 --- a/src/3rdparty/libconninet.pri +++ /dev/null @@ -1,18 +0,0 @@ -INCLUDEPATH += $$PWD/libconninet/src - -QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB - -HEADERS += \ - $$PWD/libconninet/src/dbusdispatcher.h \ - $$PWD/libconninet/src/iapconf.h \ - $$PWD/libconninet/src/iapmonitor.h \ - $$PWD/libconninet/src/maemo_icd.h \ - $$PWD/libconninet/src/proxyconf.h - -SOURCES += \ - $$PWD/libconninet/src/dbusdispatcher.cpp \ - $$PWD/libconninet/src/iapconf.cpp \ - $$PWD/libconninet/src/iapmonitor.cpp \ - $$PWD/libconninet/src/maemo_icd.cpp \ - $$PWD/libconninet/src/proxyconf.cpp - diff --git a/src/3rdparty/libconninet/AUTHORS b/src/3rdparty/libconninet/AUTHORS deleted file mode 100644 index e69de29..0000000 diff --git a/src/3rdparty/libconninet/COPYING b/src/3rdparty/libconninet/COPYING deleted file mode 100644 index b124cf5..0000000 --- a/src/3rdparty/libconninet/COPYING +++ /dev/null @@ -1,510 +0,0 @@ - - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations -below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it -becomes a de-facto standard. To achieve this, non-free programs must -be allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control -compilation and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at least - three years, to give the same user the materials specified in - Subsection 6a, above, for a charge no more than the cost of - performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply, and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License -may add an explicit geographical distribution limitation excluding those -countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms -of the ordinary General Public License). - - To apply these terms, attach the following notices to the library. -It is safest to attach them to the start of each source file to most -effectively convey the exclusion of warranty; and each file should -have at least the "copyright" line and a pointer to where the full -notice is found. - - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or -your school, if any, to sign a "copyright disclaimer" for the library, -if necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James - Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/src/3rdparty/libconninet/ChangeLog b/src/3rdparty/libconninet/ChangeLog deleted file mode 100644 index e69de29..0000000 diff --git a/src/3rdparty/libconninet/INSTALL b/src/3rdparty/libconninet/INSTALL deleted file mode 100644 index 54caf7c..0000000 --- a/src/3rdparty/libconninet/INSTALL +++ /dev/null @@ -1,229 +0,0 @@ -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software -Foundation, Inc. - - This file is free documentation; the Free Software Foundation gives -unlimited permission to copy, distribute and modify it. - -Basic Installation -================== - - These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). - - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. (Caching is -disabled by default to prevent problems with accidental use of stale -cache files.) - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You only need -`configure.ac' if you want to change it or regenerate `configure' using -a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. Run `./configure --help' -for details on some of the pertinent environment variables. - - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not support the `VPATH' -variable, you have to compile the package for one architecture at a -time in the source code directory. After you have installed the -package for one architecture, use `make distclean' before reconfiguring -for another architecture. - -Installation Names -================== - - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - - There may be some features `configure' cannot figure out -automatically, but needs to determine by the type of machine the package -will run on. Usually, assuming the package is built to be run on the -_same_ architectures, `configure' can figure that out, but if it prints -a message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS KERNEL-OS - - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the `--target=TYPE' option to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Defining Variables -================== - - Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -will cause the specified gcc to be used as the C compiler (unless it is -overridden in the site shell script). - -`configure' Invocation -====================== - - `configure' recognizes the following options to control how it -operates. - -`--help' -`-h' - Print a summary of the options to `configure', and exit. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to - disable caching. - -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. - diff --git a/src/3rdparty/libconninet/NEWS b/src/3rdparty/libconninet/NEWS deleted file mode 100644 index e69de29..0000000 diff --git a/src/3rdparty/libconninet/README b/src/3rdparty/libconninet/README deleted file mode 100644 index e69de29..0000000 diff --git a/src/3rdparty/libconninet/autogen.sh b/src/3rdparty/libconninet/autogen.sh deleted file mode 100755 index a8fd885..0000000 --- a/src/3rdparty/libconninet/autogen.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -autoreconf --verbose --install --force diff --git a/src/3rdparty/libconninet/configure.ac b/src/3rdparty/libconninet/configure.ac deleted file mode 100644 index 72fa98b..0000000 --- a/src/3rdparty/libconninet/configure.ac +++ /dev/null @@ -1,86 +0,0 @@ -AC_INIT([libconninet], patsubst(esyscmd([dpkg-parsechangelog | sed -n '/^Version: \(.*\)$/ {s//\1/;p}']), [ -]), [jukka.rissanen@nokia.com]) -AM_INIT_AUTOMAKE([foreign]) - -AC_PROG_CXX -AC_PROG_LIBTOOL - -AC_ARG_ENABLE(docs, [ --enable-docs Build DOXYGEN documentation (requires Doxygen)],enable_docs=$enableval,enable_docs=auto) - -AC_PATH_PROG(DOXYGEN, doxygen, no) -AC_MSG_CHECKING([whether to build Doxygen documentation]) - -if test x$DOXYGEN = xno ; then - have_doxygen=no -else - have_doxygen=yes -fi -if test x$enable_docs = xauto ; then - if test x$have_doxygen = xno ; then - enable_docs=no - else - enable_docs=yes - fi -fi -if test x$enable_docs = xyes; then - if test x$have_doxygen = xno; then - AC_MSG_ERROR([Building Doxygen docs explicitly required, but Doxygen not found]) - else - AC_MSG_RESULT(yes) - fi -else - AC_MSG_RESULT(no) -fi - -AM_CONDITIONAL(DOXYGEN_DOCS_ENABLED, test x$enable_docs = xyes) -AC_SUBST(DOXYGEN) - -PKG_CHECK_MODULES(GLIB, glib-2.0) -AC_SUBST(GLIB_CFLAGS) -AC_SUBST(GLIB_LIBS) - -PKG_CHECK_MODULES(QTCORE, QtCore) -AC_SUBST(QTCORE_CFLAGS) -AC_SUBST(QTCORE_LIBS) - -PKG_CHECK_MODULES(QTNETWORK, QtNetwork) -AC_SUBST(QTNETWORK_CFLAGS) -AC_SUBST(QTNETWORK_LIBS) - -PKG_CHECK_MODULES(QTDBUS, QtDBus) -AC_SUBST(QTDBUS_CFLAGS) -AC_SUBST(QTDBUS_LIBS) - -PKG_CHECK_MODULES(QTTEST, QtTest) -AC_SUBST(QTTEST_CFLAGS) -AC_SUBST(QTTEST_LIBS) - -PKG_CHECK_MODULES(DBUS, dbus-glib-1) -AC_SUBST(DBUS_CFLAGS) -AC_SUBST(DBUS_LIBS) - -PKG_CHECK_MODULES(CONNSETTINGS, connsettings) -AC_SUBST(CONNSETTINGS_CFLAGS) -AC_SUBST(CONNSETTINGS_LIBS) - -PKG_CHECK_MODULES(OSSO_IC, osso-ic) -AC_SUBST(OSSO_IC_CFLAGS) -AC_SUBST(OSSO_IC_LIBS) - -PKG_CHECK_MODULES(ICD_DEV, icd2) -AC_SUBST(ICD_DEV_CFLAGS) -AC_SUBST(ICD_DEV_LIBS) - -PKG_CHECK_MODULES(GCONF, gconf-2.0) -AC_SUBST(GCONF_CFLAGS) -AC_SUBST(GCONF_LIBS) - -CONCFLAGS="-Wall -Werror -Wmissing-prototypes" -AC_SUBST(CONCFLAGS) - -AC_CONFIG_FILES([Makefile \ - src/Makefile \ - tests/Makefile \ - conninet.pc \ - doxygen.cfg]) -AC_OUTPUT diff --git a/src/3rdparty/libconninet/conninet.pc.in b/src/3rdparty/libconninet/conninet.pc.in deleted file mode 100644 index 68cdee0..0000000 --- a/src/3rdparty/libconninet/conninet.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: libconninet -Description: Internet Connectivity support library -Version: @VERSION@ -Requires: dbus-1 >= 0.60 glib-2.0 QtCore QtDBus QtGui -Libs: -lconninet -Cflags: -I${includedir}/conninet diff --git a/src/3rdparty/libconninet/debian/changelog b/src/3rdparty/libconninet/debian/changelog deleted file mode 100644 index 10e9dec..0000000 --- a/src/3rdparty/libconninet/debian/changelog +++ /dev/null @@ -1,305 +0,0 @@ -libconninet (0.45) unstable; urgency=low - - * Fixes: NB#187470 - libconninet: add automake to build-deps - - -- Markus Silvan Wed, 25 Aug 2010 09:02:55 +0300 - -libconninet (0.44) unstable; urgency=low - - * Added autoconf to build dependencies - - -- Markus Silvan Wed, 25 Aug 2010 09:02:55 +0300 - -libconninet (0.43) unstable; urgency=low - - * Fixes: NB#184824 - Getting all proxy variables from gconf in one go - which will speedup the HTTP requests done by Qt4.7 webkit - - -- Jukka Rissanen Thu, 12 Aug 2010 10:15:20 +0300 - -libconninet (0.42) unstable; urgency=low - - * Fixes: NB#180536 - Uploads to online services are not working. - This is a regression caused by fix to bug 175098, the timeout was never - expiring when waiting reply from icd. - - -- Jukka Rissanen Mon, 19 Jul 2010 12:23:30 +0300 - -libconninet (0.41) unstable; urgency=low - - * Fixes: NB#175098 - Qt4.7 Webkit crashes when bearer API QNetworkSession - constructor calls QNetworkSession::syncStateWithInterface() which in turn - calls Maemo::state() and Maemo::addrinfo() and webkit expects that event - loop is not run but those function process main loop events. - Now Maemo::state() and Maemo::addrinfo() are changed to be synchronous - and fully blocking functions. The old non-blocking versions are called - Maemo::state_non_blocking() and Maemo::addrinfo_non_blocking(). - - -- Jukka Rissanen Wed, 14 Jul 2010 10:12:47 +0300 - -libconninet (0.40) unstable; urgency=low - - * Fixes: NB#167465 - Unable to open network connection using libbearer - - -- Jukka Rissanen Tue, 11 May 2010 10:47:10 +0300 - -libconninet (0.39) unstable; urgency=low - - * Fixes: NB#167982 - initialize DBus vtable in DBusDispatcher. - - -- Aapo Makela Mon, 10 May 2010 14:42:39 +0300 - -libconninet (0.38) unstable; urgency=low - - * Changing icd2 connect_req to be synchronous as the check for - returned connect signal did not work correctly, this caused a - long timeout when connect() was called. - * Scan sometimes missed results and did not return them to caller. - * HTTP proxy settings were not set correctly. - - -- Jukka Rissanen Thu, 15 Apr 2010 11:25:06 +0300 - -libconninet (0.37) unstable; urgency=low - - * Make proxy config reference counting atomic. - - -- Jukka Rissanen Wed, 3 Mar 2010 13:23:08 +0200 - -libconninet (0.36) unstable; urgency=low - - * Fixes: NB#157586 - Cleanup dbus listener when WLAN scanning object is - deleted. - - -- Jukka Rissanen Fri, 26 Feb 2010 13:30:41 +0200 - -libconninet (0.35) unstable; urgency=low - - * Fixes: NB#156883 - libconninet fails to build under the Platform SDK (SB2) - - -- Jukka Rissanen Thu, 18 Feb 2010 12:14:40 +0200 - -libconninet (0.34) unstable; urgency=low - - * Coverity fix - - -- Jukka Rissanen Tue, 16 Feb 2010 16:38:00 +0200 - -libconninet (0.33) unstable; urgency=low - - * Added API to update Qt proxy config. - - -- Jukka Rissanen Tue, 26 Jan 2010 15:48:36 +0200 - -libconninet (0.32) unstable; urgency=low - - * Fixed IAPConf to unset value when set value is invalid. - * Updated IAPMonitor to use libconnsettings. - - -- Aapo Makela Wed, 03 Feb 2010 07:32:45 +0200 - -libconninet (0.31) unstable; urgency=low - - * Fixes: NB#154892 - Check nulls in IAPConf. - - -- Aapo Makela Mon, 01 Feb 2010 09:32:06 +0200 - -libconninet (0.30) unstable; urgency=low - - * Updated IAPConf to use libconnsettings. - - -- Aapo Makela Fri, 29 Jan 2010 12:58:03 +0200 - -libconninet (0.29) unstable; urgency=low - - * Fixed dependencies - - -- Jukka Rissanen Fri, 15 Jan 2010 10:16:07 +0200 - -libconninet (0.28) unstable; urgency=low - - * Get rid of libdui dependency - - -- Jukka Rissanen Wed, 13 Jan 2010 09:56:26 +0200 - -libconninet (0.27) unstable; urgency=low - - * Insert new pending calls to the list in DBusDispatcher. - - -- Aapo Makela Tue, 22 Dec 2009 14:27:32 +0200 - -libconninet (0.26) unstable; urgency=low - - * Added possibility to specify different signal path for DBusDispatcher. - - -- Aapo Makela Wed, 25 Nov 2009 14:27:34 +0200 - -libconninet (0.25) unstable; urgency=low - - * Fixes: NB#146450 - All scan results were not returned to the caller. - - -- Jukka Rissanen Mon, 16 Nov 2009 17:23:15 +0200 - -libconninet (0.24) unstable; urgency=low - - * Wait all scan results for all network types in Maemo::Icd::scan() - - -- Jukka Rissanen Fri, 6 Nov 2009 14:45:23 +0200 - -libconninet (0.23) unstable; urgency=low - - * Fixes: NB#143361 - Assert failure in session class for GPRS IAP. - - -- Jukka Rissanen Mon, 19 Oct 2009 16:00:14 +0300 - -libconninet (0.22) unstable; urgency=low - - * Fixed the error checking if scan returns 0 results. - - -- Jukka Rissanen Wed, 7 Oct 2009 13:50:27 +0300 - -libconninet (0.21) unstable; urgency=low - - * Support multiple DBusDispatcher classes at the same time. This is - required by Maemo::Icd class so that multiple instances of it can - be used the same time. - - -- Jukka Rissanen Mon, 5 Oct 2009 16:33:43 +0300 - -libconninet (0.20) unstable; urgency=low - - * Fixed memory leak in IAPConf::setValue() - - -- Jukka Rissanen Fri, 2 Oct 2009 13:02:21 +0300 - -libconninet (0.19) unstable; urgency=low - - * Fixed connect_req to one specific IAP in Icd class. - - -- Jukka Rissanen Tue, 29 Sep 2009 17:02:46 +0300 - -libconninet (0.18) unstable; urgency=low - - * Make sure the library will not abort in Icd class if scan does - not return any results. - - -- Jukka Rissanen Tue, 22 Sep 2009 17:00:12 +0300 - -libconninet (0.17) unstable; urgency=low - - * Added IAP monitoring support. - - -- Jukka Rissanen Mon, 21 Sep 2009 16:29:31 +0300 - -libconninet (0.16) unstable; urgency=low - - * Disabled the old osso-ic dbus interface as it is currently not used. - * Fixed the addrinfo request, now addresses are returned correctly to - the caller. - - -- Jukka Rissanen Thu, 17 Sep 2009 15:56:13 +0300 - -libconninet (0.15) unstable; urgency=low - - * Enabling state_req, statistics_req and addrinfo_req support - functions in Maemo::Icd as the corresponding DBUS API functions are - fixed in icd2 v0.89 - - -- Jukka Rissanen Fri, 24 Jul 2009 15:23:02 +0300 - -libconninet (0.14) unstable; urgency=low - - * Icd statistics support added. - * Icd address information support added. - * Icd scan method does not return the final (and empty) result any more. - * Added initial unit test implementation for Icd class. - * Some of the status functions in Icd class disabled because of issues - in icd2 and the dbus api. - - -- Jukka Rissanen Thu, 23 Jul 2009 11:03:05 +0300 - -libconninet (0.13) unstable; urgency=low - - * Added API to get all the configured IAPs. - - -- Jukka Rissanen Tue, 21 Jul 2009 09:47:18 +0300 - -libconninet (0.12) unstable; urgency=low - - * Replaced duivaluespace by Dui in pkg-config file because the - duivaluespace is deprecated. - - -- Jukka Rissanen Mon, 20 Jul 2009 16:00:10 +0300 - -libconninet (0.11) unstable; urgency=low - - * Using libdui instead of libduivaluespace because it is deprecated. - * The IAPConf::clear() uses native gconf API instead of launching gconftool - * Check that state_req call returned list and the list contains entries - before trying to access it. - - -- Jukka Rissanen Mon, 20 Jul 2009 14:55:15 +0300 - -libconninet (0.10) unstable; urgency=low - - * connect() did not return ok when connection succeeded. - - -- Jukka Rissanen Thu, 25 Jun 2009 09:31:21 +0300 - -libconninet (0.9) unstable; urgency=low - - * Connection timeout set to 2.5min, same as in fremantle. - - -- Jukka Rissanen Wed, 17 Jun 2009 13:36:40 +0300 - -libconninet (0.8) unstable; urgency=low - - * Fix state_req signal received from Icd - - -- Jukka Rissanen Thu, 11 Jun 2009 17:19:33 +0300 - -libconninet (0.7) unstable; urgency=low - - * Icd disconnect and select reqs are made synchronous as we do not - wait the return status. The previous async version was causing core - dumps if Icd class was destroyed too early. - - -- Jukka Rissanen Thu, 11 Jun 2009 11:52:36 +0300 - -libconninet (0.6) unstable; urgency=low - - * Fixed the libconninet0-dev dependencies. - - -- Jukka Rissanen Mon, 8 Jun 2009 10:47:56 +0300 - -libconninet (0.5) unstable; urgency=low - - * Fixed missing QObject connect functions. - * Fixed IAPConf to return invalid QVariant if the value does not exist. - - -- Jukka Rissanen Mon, 01 Jun 2009 13:58:53 +0300 - -libconninet (0.4) unstable; urgency=low - - * Fixed QObject signal setting for Maemo::Icd - - -- Jukka Rissanen Wed, 20 May 2009 13:51:11 +0300 - -libconninet (0.3) unstable; urgency=low - - * Refactoring classes - * Added IAPConf class. - - -- Jukka Rissanen Thu, 14 May 2009 13:24:11 +0300 - -libconninet (0.2) unstable; urgency=low - - * Fixed pkgconfig file which had wrong dependency - * Added DBus array and struct support to DBusDispatcher. - - -- Jukka Rissanen Wed, 13 May 2009 12:11:00 +0300 - -libconninet (0.1) unstable; urgency=low - - * Initial Release. - - -- Jukka Rissanen Tue, 12 May 2009 16:10:27 +0200 diff --git a/src/3rdparty/libconninet/debian/compat b/src/3rdparty/libconninet/debian/compat deleted file mode 100644 index b8626c4..0000000 --- a/src/3rdparty/libconninet/debian/compat +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/src/3rdparty/libconninet/debian/control b/src/3rdparty/libconninet/debian/control deleted file mode 100644 index a2343a0..0000000 --- a/src/3rdparty/libconninet/debian/control +++ /dev/null @@ -1,39 +0,0 @@ -Source: libconninet -Priority: optional -Maintainer: Jukka Rissanen -Build-Depends: debhelper (>= 4.0.0), autotools-dev, libglib2.0-dev (>= 2.8), - libdbus-1-dev (>= 0.60), libconnsettings0-dev (>= 0.4), icd2-osso-ic-dev, - icd2-dev, libqt4-dev, libgconf2-dev (>> 2.6.4), autoconf, automake -Standards-Version: 3.6.2 -Section: libs - -Package: libconninet0-dev -Section: libdevel -Architecture: any -Depends: libconninet0 (= ${Source-Version}), libdbus-1-dev (>= 0.60), - libglib2.0-dev (>= 2.8), libconnsettings0-dev (>= 0.4), libqt4-dev, - icd2-osso-ic-dev, icd2-dev, libgconf2-dev (>> 2.6.4) -Description: Internet Connectivity support library development files - Internet Connectivity support library (libconninet) provides common - support functions for connecting to icd2 and accessing configuration - data. - . - This package contains the header files. - -Package: libconninet0 -Section: libs -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: Internet Connectivity support library - Internet Connectivity support library (libconninet) provides common - support functions for connecting to icd2 and accessing configuration - data. - . - This package contains the shared libraries. - -Package: libconninet0-dbg -Section: libs -Architecture: any -Depends: libconninet0 (= ${Source-Version}), ${shlibs:Depends}, ${misc:Depends} -Description: Debug symbols for the Internet Connectivity support library - Internet Connectivity support library (libconninet) debug symbols. diff --git a/src/3rdparty/libconninet/debian/copyright b/src/3rdparty/libconninet/debian/copyright deleted file mode 100644 index 97e8e68..0000000 --- a/src/3rdparty/libconninet/debian/copyright +++ /dev/null @@ -1,19 +0,0 @@ -libconninet - Internet Connectivity support library - -Copyright (C) 2009 Nokia Corporation. All rights reserved. - -Contact: Jukka Rissanen - -This library is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License version 2.1 -as published by the Free Software Foundation. - -This library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -02110-1301 USA diff --git a/src/3rdparty/libconninet/debian/libconninet0-dev.dirs b/src/3rdparty/libconninet/debian/libconninet0-dev.dirs deleted file mode 100644 index 4418816..0000000 --- a/src/3rdparty/libconninet/debian/libconninet0-dev.dirs +++ /dev/null @@ -1,2 +0,0 @@ -usr/lib -usr/include diff --git a/src/3rdparty/libconninet/debian/libconninet0-dev.files b/src/3rdparty/libconninet/debian/libconninet0-dev.files deleted file mode 100644 index 78bbac8..0000000 --- a/src/3rdparty/libconninet/debian/libconninet0-dev.files +++ /dev/null @@ -1,4 +0,0 @@ -usr/include/* -usr/lib/lib*.so -usr/lib/pkgconfig/* -usr/share/pkgconfig/* diff --git a/src/3rdparty/libconninet/debian/libconninet0.dirs b/src/3rdparty/libconninet/debian/libconninet0.dirs deleted file mode 100644 index 6845771..0000000 --- a/src/3rdparty/libconninet/debian/libconninet0.dirs +++ /dev/null @@ -1 +0,0 @@ -usr/lib diff --git a/src/3rdparty/libconninet/debian/libconninet0.files b/src/3rdparty/libconninet/debian/libconninet0.files deleted file mode 100644 index d0dbfd1..0000000 --- a/src/3rdparty/libconninet/debian/libconninet0.files +++ /dev/null @@ -1 +0,0 @@ -usr/lib/lib*.so.* diff --git a/src/3rdparty/libconninet/debian/rules b/src/3rdparty/libconninet/debian/rules deleted file mode 100755 index 2a3d395..0000000 --- a/src/3rdparty/libconninet/debian/rules +++ /dev/null @@ -1,123 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - - -# These are used for cross-compiling and for saving the configure script -# from having to guess our platform (since we know it already) -DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) -DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) - - -CFLAGS = -Wall -g - -ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) - CFLAGS += -O0 -else - CFLAGS += -O2 -endif - -# shared library versions, option 1 -#version=2.0.5 -#major=2 -# option 2, assuming the library is created as src/.libs/libfoo.so.2.0.5 or so -version=`ls src/.libs/lib*.so.* | \ - awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'` -major=`ls src/.libs/lib*.so.* | \ - awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'` - -configure: configure.ac debian/changelog - -./autogen.sh - -config.status: configure - dh_testdir - # Add here commands to configure the package. - CFLAGS="$(CFLAGS)" ./configure \ - --host=$(DEB_HOST_GNU_TYPE) \ - --build=$(DEB_BUILD_GNU_TYPE) \ - --prefix=/usr \ - --mandir=\$${prefix}/share/man \ - --infodir=\$${prefix}/share/info - - -build: build-stamp -build-stamp: config.status - dh_testdir - - # Add here commands to compile the package. - $(MAKE) - - touch build-stamp - -clean: - dh_testdir - dh_testroot - rm -f build-stamp - - # Add here commands to clean up after the build process. - -$(MAKE) distclean -ifneq "$(wildcard /usr/share/misc/config.sub)" "" - cp -f /usr/share/misc/config.sub config.sub -endif -ifneq "$(wildcard /usr/share/misc/config.guess)" "" - cp -f /usr/share/misc/config.guess config.guess -endif - - - dh_clean - -install: build - dh_testdir - dh_testroot - dh_clean -k - dh_installdirs - - # Add here commands to install the package into debian/tmp - $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp - - -# Build architecture-independent files here. -binary-indep: build install -# We have nothing to do by default. - -# Build architecture-dependent files here. -binary-arch: build install - dh_testdir - dh_testroot - dh_movefiles - dh_installchangelogs ChangeLog - dh_installdocs - dh_installexamples -# dh_install -# dh_installmenu -# dh_installdebconf -# dh_installlogrotate -# dh_installemacsen -# dh_installpam -# dh_installmime -# dh_installinit -# dh_installcron -# dh_installinfo - dh_installman - dh_link - dh_strip --dbg-package=libconninet0 - dh_compress - dh_fixperms -# dh_perl -# dh_python - dh_makeshlibs - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install diff --git a/src/3rdparty/libconninet/doxygen.cfg.in b/src/3rdparty/libconninet/doxygen.cfg.in deleted file mode 100644 index 80a4c8d..0000000 --- a/src/3rdparty/libconninet/doxygen.cfg.in +++ /dev/null @@ -1,1147 +0,0 @@ -# Doxyfile 1.3.7 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = "Internet Connectivity Support Library" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = @VERSION@ - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = doc - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 2 levels of 10 sub-directories under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of source -# files, where putting all generated files in the same directory would otherwise -# cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, -# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en -# (Japanese with English messages), Korean, Korean-en, Norwegian, Polish, Portuguese, -# Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. - -OUTPUT_LANGUAGE = English - -# This tag can be used to specify the encoding used in the generated output. -# The encoding is not always determined by the language that is chosen, -# but also whether or not the output is meant for Windows or non-Windows users. -# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES -# forces the Windows encoding (this is the default for the Windows binary), -# whereas setting the tag to NO uses a Unix-style encoding (the default for -# all platforms other than Windows). - -USE_WINDOWS_ENCODING = NO - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is used -# as the annotated text. Otherwise, the brief description is used as-is. If left -# blank, the following values are used ("$name" is automatically replaced with the -# name of the entity): "The $name class" "The $name widget" "The $name file" -# "is" "provides" "specifies" "contains" "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited -# members of a class in the documentation of that class as if those members were -# ordinary class members. Constructors, destructors and assignment operators of -# the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = NO - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like the Qt-style comments (thus requiring an -# explicit @brief command for a brief description. - -JAVADOC_AUTOBRIEF = YES - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the DETAILS_AT_TOP tag is set to YES then Doxygen -# will output the detailed description near the top, like JavaDoc. -# If set to NO, the detailed description appears after the member -# documentation. - -DETAILS_AT_TOP = YES - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources -# only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources -# only. Doxygen will then generate output that is more tailored for Java. -# For instance, namespaces will be presented as packages, qualified scopes -# will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = NO - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = YES - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# users are advised to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = conic/conic.h \ - conic/conicconnection.h \ - conic/conicconnectionevent.h \ - conic/conicevent.h \ - conic/coniciap.h \ - conic/conicstatisticsevent.h - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp -# *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm - -FILE_PATTERNS = - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories -# that are symbolic links (a Unix filesystem feature) are excluded from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. - -EXCLUDE_PATTERNS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. - -INPUT_FILTER = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES (the default) -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES (the default) -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = NO - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 4 - -# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be -# generated containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, -# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are -# probably better off using the HTML help feature. - -GENERATE_TREEVIEW = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = YES - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = YES - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = YES - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = NO - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_PREDEFINED tags. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse the -# parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or -# super classes. Setting the tag to NO turns the diagrams off. Note that this -# option is superseded by the HAVE_DOT option below. This is only a fallback. It is -# recommended to install and use dot, since it yields more powerful graphs. - -CLASS_DIAGRAMS = YES - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = NO - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will -# generate a call dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable call graphs for selected -# functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found on the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. - -MAX_DOT_GRAPH_WIDTH = 1024 - -# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. - -MAX_DOT_GRAPH_HEIGHT = 1024 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes that -# lay further from the root node will be omitted. Note that setting this option to -# 1 or 2 may greatly reduce the computation time needed for large code bases. Also -# note that a graph may be further truncated if the graph's image dimensions are -# not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT). -# If 0 is used for the depth value (the default), the graph is not depth-constrained. - -MAX_DOT_GRAPH_DEPTH = 0 - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - -SEARCHENGINE = NO diff --git a/src/3rdparty/libconninet/src/dbusdispatcher.cpp b/src/3rdparty/libconninet/src/dbusdispatcher.cpp deleted file mode 100644 index 7581982..0000000 --- a/src/3rdparty/libconninet/src/dbusdispatcher.cpp +++ /dev/null @@ -1,611 +0,0 @@ -/* * This file is part of conninet * - * - * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * - * Contact: Aapo Makela - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * version 2.1 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -#include -#include -#include -#include -#include -#include -#include "dbusdispatcher.h" - -namespace Maemo { - -/*! - \class DBusDispatcher - - \brief DBusDispatcher is a class, which is able to send DBUS method call - messages and receive unicast signals from DBUS object. -*/ - -class DBusDispatcherPrivate -{ -public: - DBusDispatcherPrivate(const QString& service, - const QString& path, - const QString& interface, - const QString& signalPath) - : service(service), path(path), interface(interface), - signalPath(signalPath), connection(0) - { - memset(&signal_vtable, 0, sizeof(signal_vtable)); - } - - ~DBusDispatcherPrivate() - { - foreach(DBusPendingCall *call, pending_calls) { - dbus_pending_call_cancel(call); - dbus_pending_call_unref(call); - } - } - - QString service; - QString path; - QString interface; - QString signalPath; - struct DBusConnection *connection; - QList pending_calls; - struct DBusObjectPathVTable signal_vtable; -}; - -static bool constantVariantList(const QVariantList& variantList) { - // Special case, empty list == empty struct - if (variantList.isEmpty()) { - return false; - } else { - QVariant::Type type = variantList[0].type(); - // Iterate items in the list and check if they are same type - foreach(QVariant variant, variantList) { - if (variant.type() != type) { - return false; - } - } - } - return true; -} - -static QString variantToSignature(const QVariant& argument, - bool constantList = true) { - switch (argument.type()) { - case QVariant::Bool: - return "b"; - case QVariant::ByteArray: - return "ay"; - case QVariant::Char: - return "y"; - case QVariant::Int: - return "i"; - case QVariant::UInt: - return "u"; - case QVariant::StringList: - return "as"; - case QVariant::String: - return "s"; - case QVariant::LongLong: - return "x"; - case QVariant::ULongLong: - return "t"; - case QVariant::List: - { - QString signature; - QVariantList variantList = argument.toList(); - if (!constantList) { - signature += DBUS_STRUCT_BEGIN_CHAR_AS_STRING; - foreach(QVariant listItem, variantList) { - signature += variantToSignature(listItem); - } - signature += DBUS_STRUCT_END_CHAR_AS_STRING; - } else { - if (variantList.isEmpty()) - return ""; - signature = "a" + variantToSignature(variantList[0]); - } - - return signature; - } - default: - qDebug() << "Unsupported variant type: " << argument.type(); - break; - } - - return ""; -} - -static bool appendVariantToDBusMessage(const QVariant& argument, - DBusMessageIter *dbus_iter) { - int idx = 0; - DBusMessageIter array_iter; - QStringList str_list; - dbus_bool_t bool_data; - dbus_int32_t int32_data; - dbus_uint32_t uint32_data; - dbus_int64_t int64_data; - dbus_uint64_t uint64_data; - char *str_data; - char char_data; - - switch (argument.type()) { - - case QVariant::Bool: - bool_data = argument.toBool(); - dbus_message_iter_append_basic(dbus_iter, DBUS_TYPE_BOOLEAN, - &bool_data); - break; - - case QVariant::ByteArray: - str_data = argument.toByteArray().data(); - dbus_message_iter_open_container(dbus_iter, DBUS_TYPE_ARRAY, - DBUS_TYPE_BYTE_AS_STRING, &array_iter); - dbus_message_iter_append_fixed_array(&array_iter, - DBUS_TYPE_BYTE, - &str_data, - argument.toByteArray().size()); - dbus_message_iter_close_container(dbus_iter, &array_iter); - break; - - case QVariant::Char: - char_data = argument.toChar().toAscii(); - dbus_message_iter_append_basic(dbus_iter, DBUS_TYPE_BYTE, - &char_data); - break; - - case QVariant::Int: - int32_data = argument.toInt(); - dbus_message_iter_append_basic(dbus_iter, DBUS_TYPE_INT32, - &int32_data); - break; - - case QVariant::String: - str_data = argument.toString().toLatin1().data(); - dbus_message_iter_append_basic(dbus_iter, DBUS_TYPE_STRING, - &str_data); - break; - - case QVariant::StringList: - str_list = argument.toStringList(); - dbus_message_iter_open_container(dbus_iter, DBUS_TYPE_ARRAY, - "s", &array_iter); - for (idx = 0; idx < str_list.size(); idx++) { - str_data = str_list.at(idx).toLatin1().data(); - dbus_message_iter_append_basic(&array_iter, - DBUS_TYPE_STRING, - &str_data); - } - dbus_message_iter_close_container(dbus_iter, &array_iter); - break; - - case QVariant::UInt: - uint32_data = argument.toUInt(); - dbus_message_iter_append_basic(dbus_iter, DBUS_TYPE_UINT32, - &uint32_data); - break; - - case QVariant::ULongLong: - uint64_data = argument.toULongLong(); - dbus_message_iter_append_basic(dbus_iter, DBUS_TYPE_UINT64, - &uint64_data); - break; - - case QVariant::LongLong: - int64_data = argument.toLongLong(); - dbus_message_iter_append_basic(dbus_iter, DBUS_TYPE_INT64, - &int64_data); - break; - - case QVariant::List: - { - QVariantList variantList = argument.toList(); - bool constantList = constantVariantList(variantList); - DBusMessageIter array_iter; - - // List is mapped either as an DBUS array (all items same type) - // DBUS struct (variable types) depending on constantList - if (constantList) { - // Resolve the signature for the first item - QString signature = ""; - if (!variantList.isEmpty()) { - signature = variantToSignature( - variantList[0], - constantVariantList(variantList[0].toList())); - } - - // Mapped as DBUS array - dbus_message_iter_open_container(dbus_iter, DBUS_TYPE_ARRAY, - signature.toAscii(), - &array_iter); - - foreach(QVariant listItem, variantList) { - appendVariantToDBusMessage(listItem, &array_iter); - } - - dbus_message_iter_close_container(dbus_iter, &array_iter); - } else { - // Mapped as DBUS struct - dbus_message_iter_open_container(dbus_iter, DBUS_TYPE_STRUCT, - NULL, - &array_iter); - - foreach(QVariant listItem, variantList) { - appendVariantToDBusMessage(listItem, &array_iter); - } - - dbus_message_iter_close_container(dbus_iter, &array_iter); - } - - break; - } - default: - qDebug() << "Unsupported variant type: " << argument.type(); - break; - } - - return true; -} - -static QVariant getVariantFromDBusMessage(DBusMessageIter *iter) { - dbus_bool_t bool_data; - dbus_int32_t int32_data; - dbus_uint32_t uint32_data; - dbus_int64_t int64_data; - dbus_uint64_t uint64_data; - char *str_data; - char char_data; - int argtype = dbus_message_iter_get_arg_type(iter); - - switch (argtype) { - - case DBUS_TYPE_BOOLEAN: - { - dbus_message_iter_get_basic(iter, &bool_data); - QVariant variant((bool)bool_data); - return variant; - } - - case DBUS_TYPE_ARRAY: - { - // Handle all arrays here - int elem_type = dbus_message_iter_get_element_type(iter); - DBusMessageIter array_iter; - - dbus_message_iter_recurse(iter, &array_iter); - - if (elem_type == DBUS_TYPE_BYTE) { - QByteArray byte_array; - do { - dbus_message_iter_get_basic(&array_iter, &char_data); - byte_array.append(char_data); - } while (dbus_message_iter_next(&array_iter)); - QVariant variant(byte_array); - return variant; - } else if (elem_type == DBUS_TYPE_STRING) { - QStringList str_list; - do { - dbus_message_iter_get_basic(&array_iter, &str_data); - str_list.append(str_data); - } while (dbus_message_iter_next(&array_iter)); - QVariant variant(str_list); - return variant; - } else { - QVariantList variantList; - do { - variantList << getVariantFromDBusMessage(&array_iter); - } while (dbus_message_iter_next(&array_iter)); - QVariant variant(variantList); - return variant; - } - break; - } - - case DBUS_TYPE_BYTE: - { - dbus_message_iter_get_basic(iter, &char_data); - QChar ch(char_data); - QVariant variant(ch); - return variant; - } - - case DBUS_TYPE_INT32: - { - dbus_message_iter_get_basic(iter, &int32_data); - QVariant variant((int)int32_data); - return variant; - } - - case DBUS_TYPE_UINT32: - { - dbus_message_iter_get_basic(iter, &uint32_data); - QVariant variant((uint)uint32_data); - return variant; - } - - case DBUS_TYPE_STRING: - { - dbus_message_iter_get_basic(iter, &str_data); - QString str(str_data); - QVariant variant(str); - return variant; - } - - case DBUS_TYPE_INT64: - { - dbus_message_iter_get_basic(iter, &int64_data); - QVariant variant((qlonglong)int64_data); - return variant; - } - - case DBUS_TYPE_UINT64: - { - dbus_message_iter_get_basic(iter, &uint64_data); - QVariant variant((qulonglong)uint64_data); - return variant; - } - - case DBUS_TYPE_STRUCT: - { - // Handle all structs here - DBusMessageIter struct_iter; - dbus_message_iter_recurse(iter, &struct_iter); - - QVariantList variantList; - do { - variantList << getVariantFromDBusMessage(&struct_iter); - } while (dbus_message_iter_next(&struct_iter)); - QVariant variant(variantList); - return variant; - } - - default: - qDebug() << "Unsupported DBUS type: " << argtype; - } - - return QVariant(); -} - -static DBusHandlerResult signalHandler (DBusConnection *connection, - DBusMessage *message, - void *object_ref) { - (void)connection; - QString interface; - QString signal; - DBusDispatcher *dispatcher = (DBusDispatcher *)object_ref; - - if (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_SIGNAL) { - interface = dbus_message_get_interface(message); - signal = dbus_message_get_member(message); - - QList arglist; - DBusMessageIter dbus_iter; - - if (dbus_message_iter_init(message, &dbus_iter)) { - // Read return arguments - while (dbus_message_iter_get_arg_type (&dbus_iter) != DBUS_TYPE_INVALID) { - arglist << getVariantFromDBusMessage(&dbus_iter); - dbus_message_iter_next(&dbus_iter); - } - } - - dispatcher->emitSignalReceived(interface, signal, arglist); - return DBUS_HANDLER_RESULT_HANDLED; - } - (void)message; - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; -} - -DBusDispatcher::DBusDispatcher(const QString& service, - const QString& path, - const QString& interface, - QObject *parent) - : QObject(parent), - d_ptr(new DBusDispatcherPrivate(service, path, interface, path)) { - setupDBus(); -} - -DBusDispatcher::DBusDispatcher(const QString& service, - const QString& path, - const QString& interface, - const QString& signalPath, - QObject *parent) - : QObject(parent), - d_ptr(new DBusDispatcherPrivate(service, path, interface, signalPath)) { - setupDBus(); -} - -DBusDispatcher::~DBusDispatcher() -{ - if (d_ptr->connection) { - dbus_connection_close(d_ptr->connection); - dbus_connection_unref(d_ptr->connection); - } - delete d_ptr; -} - -void DBusDispatcher::setupDBus() -{ - d_ptr->connection = dbus_bus_get_private(DBUS_BUS_SYSTEM, NULL); - - if (d_ptr->connection == NULL) - qDebug() << "Unable to get DBUS connection!"; - else { - d_ptr->signal_vtable.message_function = signalHandler; - - dbus_connection_set_exit_on_disconnect(d_ptr->connection, FALSE); - dbus_connection_setup_with_g_main(d_ptr->connection, NULL); - dbus_connection_register_object_path(d_ptr->connection, - d_ptr->signalPath.toLatin1(), - &d_ptr->signal_vtable, - this); - } -} - -static DBusMessage *prepareDBusCall(const QString& service, - const QString& path, - const QString& interface, - const QString& method, - const QVariant& arg1 = QVariant(), - const QVariant& arg2 = QVariant(), - const QVariant& arg3 = QVariant(), - const QVariant& arg4 = QVariant(), - const QVariant& arg5 = QVariant(), - const QVariant& arg6 = QVariant(), - const QVariant& arg7 = QVariant(), - const QVariant& arg8 = QVariant()) -{ - DBusMessage *message = dbus_message_new_method_call(service.toLatin1(), - path.toLatin1(), - interface.toLatin1(), - method.toLatin1()); - DBusMessageIter dbus_iter; - - // Append variants to DBUS message - QList arglist; - if (arg1.isValid()) arglist << arg1; - if (arg2.isValid()) arglist << arg2; - if (arg3.isValid()) arglist << arg3; - if (arg4.isValid()) arglist << arg4; - if (arg5.isValid()) arglist << arg5; - if (arg6.isValid()) arglist << arg6; - if (arg7.isValid()) arglist << arg7; - if (arg8.isValid()) arglist << arg8; - - dbus_message_iter_init_append (message, &dbus_iter); - - while (!arglist.isEmpty()) { - QVariant argument = arglist.takeFirst(); - appendVariantToDBusMessage(argument, &dbus_iter); - } - - return message; -} - -QList DBusDispatcher::call(const QString& method, - const QVariant& arg1, - const QVariant& arg2, - const QVariant& arg3, - const QVariant& arg4, - const QVariant& arg5, - const QVariant& arg6, - const QVariant& arg7, - const QVariant& arg8) { - DBusMessageIter dbus_iter; - DBusMessage *message = prepareDBusCall(d_ptr->service, d_ptr->path, - d_ptr->interface, method, - arg1, arg2, arg3, arg4, arg5, - arg6, arg7, arg8); - DBusMessage *reply = dbus_connection_send_with_reply_and_block( - d_ptr->connection, - message, -1, NULL); - dbus_message_unref(message); - - QList replylist; - if (reply != NULL && dbus_message_iter_init(reply, &dbus_iter)) { - // Read return arguments - while (dbus_message_iter_get_arg_type (&dbus_iter) != DBUS_TYPE_INVALID) { - replylist << getVariantFromDBusMessage(&dbus_iter); - dbus_message_iter_next(&dbus_iter); - } - } - if (reply != NULL) dbus_message_unref(reply); - return replylist; -} - -class PendingCallInfo { -public: - QString method; - DBusDispatcher *dispatcher; - DBusDispatcherPrivate *priv; -}; - -static void freePendingCallInfo(void *memory) { - PendingCallInfo *info = (PendingCallInfo *)memory; - delete info; -} - -static void pendingCallFunction (DBusPendingCall *pending, - void *memory) { - PendingCallInfo *info = (PendingCallInfo *)memory; - QString errorStr; - QList replyList; - DBusMessage *reply = dbus_pending_call_steal_reply (pending); - - Q_ASSERT(reply != NULL); - - if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR) { - errorStr = dbus_message_get_error_name (reply); - } else { - DBusMessageIter dbus_iter; - dbus_message_iter_init(reply, &dbus_iter); - // Read return arguments - while (dbus_message_iter_get_arg_type (&dbus_iter) != DBUS_TYPE_INVALID) { - replyList << getVariantFromDBusMessage(&dbus_iter); - dbus_message_iter_next(&dbus_iter); - } - } - - info->priv->pending_calls.removeOne(pending); - info->dispatcher->emitCallReply(info->method, replyList, errorStr); - dbus_message_unref(reply); - dbus_pending_call_unref(pending); -} - -bool DBusDispatcher::callAsynchronous(const QString& method, - const QVariant& arg1, - const QVariant& arg2, - const QVariant& arg3, - const QVariant& arg4, - const QVariant& arg5, - const QVariant& arg6, - const QVariant& arg7, - const QVariant& arg8) { - DBusMessage *message = prepareDBusCall(d_ptr->service, d_ptr->path, - d_ptr->interface, method, - arg1, arg2, arg3, arg4, arg5, - arg6, arg7, arg8); - DBusPendingCall *call = NULL; - dbus_bool_t ret = dbus_connection_send_with_reply(d_ptr->connection, - message, &call, -1); - PendingCallInfo *info = new PendingCallInfo; - info->method = method; - info->dispatcher = this; - info->priv = d_ptr; - - dbus_pending_call_set_notify(call, pendingCallFunction, info, freePendingCallInfo); - d_ptr->pending_calls.append(call); - return (bool)ret; -} - -void DBusDispatcher::emitSignalReceived(const QString& interface, - const QString& signal, - const QList& args) { - emit signalReceived(interface, signal, args); } - -void DBusDispatcher::emitCallReply(const QString& method, - const QList& args, - const QString& error) { - emit callReply(method, args, error); } - -void DBusDispatcher::synchronousDispatch(int timeout_ms) -{ - dbus_connection_read_write_dispatch(d_ptr->connection, timeout_ms); -} - -} // Maemo namespace - diff --git a/src/3rdparty/libconninet/src/dbusdispatcher.h b/src/3rdparty/libconninet/src/dbusdispatcher.h deleted file mode 100644 index 2f71b6f..0000000 --- a/src/3rdparty/libconninet/src/dbusdispatcher.h +++ /dev/null @@ -1,91 +0,0 @@ -/* * This file is part of conn-dui-settings-inet * - * - * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * - * Contact: Aapo Makela - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * version 2.1 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -#ifndef DBUSDISPATCHER_H -#define DBUSDISPATCHER_H - -#include -#include - -namespace Maemo { - -class DBusDispatcherPrivate; -class DBusDispatcher : public QObject -{ - Q_OBJECT - -public: - DBusDispatcher(const QString& service, - const QString& path, - const QString& interface, - QObject *parent = 0); - DBusDispatcher(const QString& service, - const QString& path, - const QString& interface, - const QString& signalPath, - QObject *parent = 0); - ~DBusDispatcher(); - - QList call(const QString& method, - const QVariant& arg1 = QVariant(), - const QVariant& arg2 = QVariant(), - const QVariant& arg3 = QVariant(), - const QVariant& arg4 = QVariant(), - const QVariant& arg5 = QVariant(), - const QVariant& arg6 = QVariant(), - const QVariant& arg7 = QVariant(), - const QVariant& arg8 = QVariant()); - bool callAsynchronous(const QString& method, - const QVariant& arg1 = QVariant(), - const QVariant& arg2 = QVariant(), - const QVariant& arg3 = QVariant(), - const QVariant& arg4 = QVariant(), - const QVariant& arg5 = QVariant(), - const QVariant& arg6 = QVariant(), - const QVariant& arg7 = QVariant(), - const QVariant& arg8 = QVariant()); - void emitSignalReceived(const QString& interface, - const QString& signal, - const QList& args); - void emitCallReply(const QString& method, - const QList& args, - const QString& error = ""); - void synchronousDispatch(int timeout_ms); - -Q_SIGNALS: - void signalReceived(const QString& interface, - const QString& signal, - const QList& args); - void callReply(const QString& method, - const QList& args, - const QString& error); - -protected: - void setupDBus(); - -private: - DBusDispatcherPrivate *d_ptr; -}; - -} // Maemo namespace - -#endif diff --git a/src/3rdparty/libconninet/src/iapconf.cpp b/src/3rdparty/libconninet/src/iapconf.cpp deleted file mode 100644 index 2e77fa5..0000000 --- a/src/3rdparty/libconninet/src/iapconf.cpp +++ /dev/null @@ -1,299 +0,0 @@ -/* - libconninet - Internet Connectivity support library - - Copyright (C) 2009-2010 Nokia Corporation. All rights reserved. - - Contact: Aapo Makela - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License - version 2.1 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - 02110-1301 USA -*/ - -#include -#include -#include - -#include "iapconf.h" - -#define QSTRING_TO_CONST_CSTR(str) \ - str.toUtf8().constData() - -namespace Maemo { - -class IAPConfPrivate { -public: - ConnSettings *settings; - - ConnSettingsValue *variantToValue(const QVariant &variant); - QVariant valueToVariant(ConnSettingsValue *value); -}; - -ConnSettingsValue *IAPConfPrivate::variantToValue(const QVariant &variant) -{ - // Convert variant to ConnSettingsValue - ConnSettingsValue *value = conn_settings_value_new(); - if (value == 0) { - qWarning("IAPConf: Unable to create new ConnSettingsValue"); - return 0; - } - - switch(variant.type()) { - - case QVariant::Invalid: - value->type = CONN_SETTINGS_VALUE_INVALID; - break; - - case QVariant::String: { - char *valueStr = strdup(QSTRING_TO_CONST_CSTR(variant.toString())); - value->type = CONN_SETTINGS_VALUE_STRING; - value->value.string_val = valueStr; - break; - } - - case QVariant::Int: - value->type = CONN_SETTINGS_VALUE_INT; - value->value.int_val = variant.toInt(); - break; - - case QMetaType::Float: - case QVariant::Double: - value->type = CONN_SETTINGS_VALUE_DOUBLE; - value->value.double_val = variant.toDouble(); - break; - - case QVariant::Bool: - value->type = CONN_SETTINGS_VALUE_BOOL; - value->value.bool_val = variant.toBool() ? 1 : 0; - break; - - case QVariant::ByteArray: { - QByteArray array = variant.toByteArray(); - value->type = CONN_SETTINGS_VALUE_BYTE_ARRAY; - value->value.byte_array.len = array.size(); - value->value.byte_array.val = (unsigned char *)malloc(array.size()); - memcpy(value->value.byte_array.val, array.constData(), array.size()); - break; - } - - case QVariant::List: { - QVariantList list = variant.toList(); - ConnSettingsValue **list_val = (ConnSettingsValue **)malloc( - (list.size() + 1) * sizeof(ConnSettingsValue *)); - - for (int idx = 0; idx < list.size(); idx++) { - list_val[idx] = variantToValue(list.at(idx)); - } - list_val[list.size()] = 0; - - value->type = CONN_SETTINGS_VALUE_LIST; - value->value.list_val = list_val; - break; - } - - default: - qWarning("IAPConf: Can not handle QVariant of type %d", - variant.type()); - conn_settings_value_destroy(value); - return 0; - } - - return value; -} - -QVariant IAPConfPrivate::valueToVariant(ConnSettingsValue *value) -{ - if (value == 0 || value->type == CONN_SETTINGS_VALUE_INVALID) { - return QVariant(); - } - - switch(value->type) { - - case CONN_SETTINGS_VALUE_BOOL: - return QVariant(value->value.bool_val ? true : false); - - case CONN_SETTINGS_VALUE_STRING: - return QVariant(QString(value->value.string_val)); - - case CONN_SETTINGS_VALUE_DOUBLE: - return QVariant(value->value.double_val); - - case CONN_SETTINGS_VALUE_INT: - return QVariant(value->value.int_val); - - case CONN_SETTINGS_VALUE_LIST: { - // At least with GConf backend connsettings returns byte array as list - // of ints, first check for that case - if (value->value.list_val && value->value.list_val[0]) { - bool canBeConvertedToByteArray = true; - for (int idx = 0; value->value.list_val[idx]; idx++) { - ConnSettingsValue *val = value->value.list_val[idx]; - if (val->type != CONN_SETTINGS_VALUE_INT - || val->value.int_val > 255 - || val->value.int_val < 0) { - canBeConvertedToByteArray = false; - break; - } - } - - if (canBeConvertedToByteArray) { - QByteArray array; - for (int idx = 0; value->value.list_val[idx]; idx++) { - array.append(value->value.list_val[idx]->value.int_val); - } - return array; - } - - // Create normal list - QVariantList list; - for (int idx = 0; value->value.list_val[idx]; idx++) { - list.append(valueToVariant(value->value.list_val[idx])); - } - return list; - } - } - - case CONN_SETTINGS_VALUE_BYTE_ARRAY: - return QByteArray::fromRawData((char *)value->value.byte_array.val, - value->value.byte_array.len); - - default: - return QVariant(); - } -} - -// Public class implementation - -IAPConf::IAPConf(const QString &iap_id) - : d_ptr(new IAPConfPrivate) -{ - d_ptr->settings = conn_settings_open(CONN_SETTINGS_CONNECTION, - QSTRING_TO_CONST_CSTR(iap_id)); - if (d_ptr->settings == 0) { - qWarning("IAPConf: Unable to open ConnSettings for %s", - QSTRING_TO_CONST_CSTR(iap_id)); - } -} - -IAPConf::~IAPConf() -{ - conn_settings_close(d_ptr->settings); - delete d_ptr; -} - -void IAPConf::setValue(const QString& key, const QVariant& value) -{ - // Invalid value means unsetting the given key - if (!value.isValid()) { - int err = conn_settings_unset(d_ptr->settings, - QSTRING_TO_CONST_CSTR(key)); - if (err != CONN_SETTINGS_E_NO_ERROR) { - qWarning("IAPConf: unable to unset key %s: %s", - QSTRING_TO_CONST_CSTR(key), - conn_settings_error_text((ConnSettingsError)err)); - } - return; - } - - // Convert value to ConnSettingsValue - ConnSettingsValue *val = d_ptr->variantToValue(value); - if (val == 0) return; - - // Set value and handle errors - int error = conn_settings_set(d_ptr->settings, - QSTRING_TO_CONST_CSTR(key), - val); - if (error != CONN_SETTINGS_E_NO_ERROR) { - qWarning("IAPConf: error in setting key %s: %s", - QSTRING_TO_CONST_CSTR(key), - conn_settings_error_text((ConnSettingsError)error)); - } - - // Destroy value - conn_settings_value_destroy(val); - return; -} - -void IAPConf::set(const QString& key1, const QVariant& value1, - const QString& key2, const QVariant& value2, - const QString& key3, const QVariant& value3, - const QString& key4, const QVariant& value4, - const QString& key5, const QVariant& value5, - const QString& key6, const QVariant& value6, - const QString& key7, const QVariant& value7, - const QString& key8, const QVariant& value8, - const QString& key9, const QVariant& value9, - const QString& key10, const QVariant& value10) -{ - if (!key1.isEmpty()) setValue(key1, value1); - if (!key2.isEmpty()) setValue(key2, value2); - if (!key3.isEmpty()) setValue(key3, value3); - if (!key4.isEmpty()) setValue(key4, value4); - if (!key5.isEmpty()) setValue(key5, value5); - if (!key6.isEmpty()) setValue(key6, value6); - if (!key7.isEmpty()) setValue(key7, value7); - if (!key8.isEmpty()) setValue(key8, value8); - if (!key9.isEmpty()) setValue(key9, value9); - if (!key10.isEmpty()) setValue(key10, value10); -} - -QVariant IAPConf::value(const QString& key) const -{ - ConnSettingsValue *val = conn_settings_get(d_ptr->settings, - QSTRING_TO_CONST_CSTR(key)); - - QVariant variant = d_ptr->valueToVariant(val); - conn_settings_value_destroy(val); - return variant; -} - -void IAPConf::clear(const char *default_path) -{ - Q_UNUSED(default_path); // default path is unused - - int error = conn_settings_remove(d_ptr->settings); - if (error != CONN_SETTINGS_E_NO_ERROR) { - qWarning("IAPConf: Error when removing IAP: %s", - conn_settings_error_text((ConnSettingsError)error)); - } -} - -void IAPConf::clearAll() -{ - ConnSettings *settings = conn_settings_open(CONN_SETTINGS_CONNECTION, - NULL); - conn_settings_remove(settings); - conn_settings_close(settings); -} - - -void IAPConf::getAll(QList &all_iaps, bool return_path) -{ - Q_UNUSED(return_path); // We don't use return path currently - - // Go through all available connections and add them to the list - char **ids = conn_settings_list_ids(CONN_SETTINGS_CONNECTION); - if (ids == 0) { - // No ids found - nothing to do - return; - } - - for (int idx = 0; ids[idx]; idx++) { - all_iaps.append(QString(ids[idx])); - free(ids[idx]); - } - free(ids); -} - - -} // namespace Maemo diff --git a/src/3rdparty/libconninet/src/iapconf.h b/src/3rdparty/libconninet/src/iapconf.h deleted file mode 100644 index 57c0856..0000000 --- a/src/3rdparty/libconninet/src/iapconf.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - libconninet - Internet Connectivity support library - - Copyright (C) 2009 Nokia Corporation. All rights reserved. - - Contact: Aapo Makela - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License - version 2.1 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - 02110-1301 USA -*/ - -#ifndef IAPCONF_H -#define IAPCONF_H - -#include -#include - -namespace Maemo { - -class IAPConfPrivate; -class IAPConf { -public: - IAPConf(const QString &iap_id); - virtual ~IAPConf(); - - /** - Convenience method for setting multiple IAP values with one call. - */ - void set(const QString& key1, const QVariant& value1, - const QString& key2 = "", const QVariant& value2 = QVariant(), - const QString& key3 = "", const QVariant& value3 = QVariant(), - const QString& key4 = "", const QVariant& value4 = QVariant(), - const QString& key5 = "", const QVariant& value5 = QVariant(), - const QString& key6 = "", const QVariant& value6 = QVariant(), - const QString& key7 = "", const QVariant& value7 = QVariant(), - const QString& key8 = "", const QVariant& value8 = QVariant(), - const QString& key9 = "", const QVariant& value9 = QVariant(), - const QString& key10 = "", const QVariant& value10 = QVariant()); - - /** - Set one IAP value. - */ - void setValue(const QString& key, const QVariant& value); - - /** - Get one IAP value. - */ - QVariant value(const QString& key) const; - - /** - Clear this IAP from GConf - */ - void clear(const char *default_path=0); - - /** - Clear all IAP specific information from GConf (including all IAPs). - DO NOT USE THIS FUNCTION IN ANYWHERE ELSE EXCEPT IN TEST CODE! - */ - void clearAll(); - - /** - Return all the IAPs found in the system. If return_path is true, - then do not strip the IAP path away. - */ - static void getAll(QList &all_iaps, bool return_path=false); - -private: - IAPConfPrivate *d_ptr; -}; - -} // namespace Maemo - -#endif diff --git a/src/3rdparty/libconninet/src/iapmonitor.cpp b/src/3rdparty/libconninet/src/iapmonitor.cpp deleted file mode 100644 index c44cbc8..0000000 --- a/src/3rdparty/libconninet/src/iapmonitor.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - libconninet - Internet Connectivity support library - - Copyright (C) 2009-2010 Nokia Corporation. All rights reserved. - - Contact: Jukka Rissanen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License - version 2.1 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - 02110-1301 USA -*/ - -#include - -#include -#include "iapmonitor.h" - -namespace Maemo { - - -void conn_settings_notify_func (ConnSettingsType type, - const char *id, - const char *key, - ConnSettingsValue *value, - void *user_data); - -class IAPMonitorPrivate { -private: - IAPMonitor *monitor; - ConnSettings *settings; - -public: - - IAPMonitorPrivate(IAPMonitor *monitor) - : monitor(monitor) - { - settings = conn_settings_open(CONN_SETTINGS_CONNECTION, NULL); - conn_settings_add_notify( - settings, - (ConnSettingsNotifyFunc *)conn_settings_notify_func, - this); - } - - ~IAPMonitorPrivate() - { - conn_settings_del_notify(settings); - conn_settings_close(settings); - } - - void iapAdded(const QString &iap) - { - monitor->iapAdded(iap); - } - - void iapRemoved(const QString &iap) - { - monitor->iapRemoved(iap); - } -}; - -void conn_settings_notify_func (ConnSettingsType type, - const char *id, - const char *key, - ConnSettingsValue *value, - void *user_data) -{ - if (type != CONN_SETTINGS_CONNECTION) return; - IAPMonitorPrivate *priv = (IAPMonitorPrivate *)user_data; - - QString iapId(key); - iapId = iapId.split("/")[0]; - if (value != 0) { - priv->iapAdded(iapId); - } else if (iapId == QString(key)) { - // IAP is removed only when the directory gets removed - priv->iapRemoved(iapId); - } -} - -IAPMonitor::IAPMonitor() - : d_ptr(new IAPMonitorPrivate(this)) -{ -} - -IAPMonitor::~IAPMonitor() -{ - delete d_ptr; -} - -void IAPMonitor::iapAdded(const QString &id) -{ - // By default do nothing -} - -void IAPMonitor::iapRemoved(const QString &id) -{ - // By default do nothing -} - -} // namespace Maemo diff --git a/src/3rdparty/libconninet/src/iapmonitor.h b/src/3rdparty/libconninet/src/iapmonitor.h deleted file mode 100644 index 558f23e..0000000 --- a/src/3rdparty/libconninet/src/iapmonitor.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - libconninet - Internet Connectivity support library - - Copyright (C) 2009-2010 Nokia Corporation. All rights reserved. - - Contact: Jukka Rissanen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License - version 2.1 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - 02110-1301 USA -*/ - -#ifndef IAPMONITOR_H -#define IAPMONITOR_H - -#include - -namespace Maemo { - -class IAPMonitorPrivate; -class IAPMonitor { -public: - IAPMonitor(); - ~IAPMonitor(); - -protected: - virtual void iapAdded(const QString &id); - virtual void iapRemoved(const QString &id); - -private: - IAPMonitorPrivate *d_ptr; - Q_DECLARE_PRIVATE(IAPMonitor); -}; - -} // namespace Maemo - -#endif // IAPMONITOR_H - diff --git a/src/3rdparty/libconninet/src/maemo_icd.cpp b/src/3rdparty/libconninet/src/maemo_icd.cpp deleted file mode 100644 index 026241c..0000000 --- a/src/3rdparty/libconninet/src/maemo_icd.cpp +++ /dev/null @@ -1,1316 +0,0 @@ -/* - libconninet - Internet Connectivity support library - - Copyright (C) 2009 Nokia Corporation. All rights reserved. - - Contact: Jukka Rissanen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License - version 2.1 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - 02110-1301 USA -*/ - -#include -#include "maemo_icd.h" -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -namespace Maemo { - -#undef PRINT_DEBUGINFO -#ifdef PRINT_DEBUGINFO - static FILE *fdebug = NULL; -#define PDEBUG(fmt, args...) \ - do { \ - struct timeval tv; \ - gettimeofday(&tv, 0); \ - fprintf(fdebug, "DEBUG[%d]:%ld.%ld:%s:%s():%d: " fmt, \ - getpid(), \ - tv.tv_sec, tv.tv_usec, \ - __FILE__, __FUNCTION__, __LINE__, args); \ - fflush(fdebug); \ - } while(0) -#else -#define PDEBUG(fmt...) -#endif - - -/* Reference counting singleton class that creates a single connection - * to icd so that icd reference counting works as expected. This is - * needed because DBusDispatcher uses private dbus connections - * which come and go and icd cannot use that information to - * determine whether application quit or not. So we create one - * persistent connection that is only teared down when application - * quits or calls disconnect() - */ -class IcdRefCounting -{ -public: - IcdRefCounting() : first_call(true) { } - void setup(enum icd_connection_flags flag); - void cleanup(); - -private: - bool first_call; - struct DBusConnection *connection; -}; - -Q_GLOBAL_STATIC(IcdRefCounting, icdRefCounting); - - -void IcdRefCounting::setup(enum icd_connection_flags flag) -{ - if (first_call) { - DBusMessage *msg = NULL; - - connection = dbus_bus_get_private(DBUS_BUS_SYSTEM, NULL); - dbus_connection_set_exit_on_disconnect(connection, FALSE); - dbus_connection_setup_with_g_main(connection, NULL); - - msg = dbus_message_new_method_call(ICD_DBUS_API_INTERFACE, - ICD_DBUS_API_PATH, - ICD_DBUS_API_INTERFACE, - ICD_DBUS_API_CONNECT_REQ); - if (msg == NULL) - goto out; - - if (!dbus_message_append_args(msg, - DBUS_TYPE_UINT32, &flag, - DBUS_TYPE_INVALID)) - goto out; - - if (!dbus_connection_send_with_reply(connection, msg, - NULL, 60*1000)) - goto out; - - first_call = false; - return; - - out: - dbus_connection_close(connection); - dbus_connection_unref(connection); - } -} - -void IcdRefCounting::cleanup() -{ - if (!first_call) { - dbus_connection_close(connection); - dbus_connection_unref(connection); - first_call = true; - } -} - - -class IcdPrivate -{ -public: - IcdPrivate(Icd *myfriend) - { - init(10000, IcdNewDbusInterface, myfriend); - } - - IcdPrivate(unsigned int timeout, Icd *myfriend) - { - init(timeout, IcdNewDbusInterface, myfriend); - } - - IcdPrivate(unsigned int timeout, IcdDbusInterfaceVer ver, Icd *myfriend) - { - /* Note that the old Icd interface is currently disabled and - * the new one is always used. - */ - init(timeout, IcdNewDbusInterface, myfriend); - } - - ~IcdPrivate() - { - QObject::disconnect(mDBus, - SIGNAL(signalReceived(const QString&, - const QString&, - const QList&)), - icd, - SLOT(icdSignalReceived(const QString&, - const QString&, - const QList&))); - - QObject::disconnect(mDBus, - SIGNAL(callReply(const QString&, - const QList&, - const QString&)), - icd, - SLOT(icdCallReply(const QString&, - const QList&, - const QString&))); - - delete mDBus; - mDBus = 0; - } - - /* Icd2 dbus API functions */ - QStringList scan(icd_scan_request_flags flags, - QStringList &network_types, - QList& scan_results, - QString& error); - void scanCancel(); - bool connect(icd_connection_flags flags, IcdConnectResult& result); - bool connect(icd_connection_flags flags, QList& params, - IcdConnectResult& result); - bool connect(icd_connection_flags flags, QString& iap, QString& result); - void select(uint flags); - void disconnect(uint connect_flags, QString& service_type, - uint service_attrs, QString& service_id, - QString& network_type, uint network_attrs, - QByteArray& network_id); - void disconnect(uint connect_flags); - - uint state(QString& service_type, uint service_attrs, - QString& service_id, QString& network_type, - uint network_attrs, QByteArray& network_id, - IcdStateResult &state_result); - uint statistics(QString& service_type, uint service_attrs, - QString& service_id, QString& network_type, - uint network_attrs, QByteArray& network_id, - IcdStatisticsResult& stats_result); - uint addrinfo(QString& service_type, uint service_attrs, - QString& service_id, QString& network_type, - uint network_attrs, QByteArray& network_id, - IcdAddressInfoResult& addr_result); - - uint state(QList& state_results); - uint state_non_blocking(QList& state_results); - uint statistics(QList& stats_results); - uint addrinfo(QList& addr_results); - uint addrinfo_non_blocking(QList& addr_results); - - void signalReceived(const QString& interface, - const QString& signal, - const QList& args); - void callReply(const QString& method, - const QList& args, - const QString& error); - - QString error() { return mError; } - -public: - DBusDispatcher *mDBus; - QString mMethod; - QString mInterface; - QString mSignal; - QString mError; - QList mArgs; - QList receivedSignals; - unsigned int timeout; - IcdDbusInterfaceVer icd_dbus_version; - Icd *icd; - - void init(unsigned int dbus_timeout, IcdDbusInterfaceVer ver, - Icd *myfriend) - { - if (ver == IcdNewDbusInterface) { - mDBus = new DBusDispatcher(ICD_DBUS_API_INTERFACE, - ICD_DBUS_API_PATH, - ICD_DBUS_API_INTERFACE); - } else { - mDBus = new DBusDispatcher(ICD_DBUS_SERVICE, - ICD_DBUS_PATH, - ICD_DBUS_INTERFACE); - } - icd_dbus_version = ver; - - /* This connect has a side effect as it means that only one - * Icd object can exists in one time. This should be fixed! - */ - QObject::connect(mDBus, - SIGNAL(signalReceived(const QString&, - const QString&, - const QList&)), - myfriend, - SLOT(icdSignalReceived(const QString&, - const QString&, - const QList&))); - - QObject::connect(mDBus, - SIGNAL(callReply(const QString&, - const QList&, - const QString&)), - myfriend, - SLOT(icdCallReply(const QString&, - const QList&, - const QString&))); - - icd = myfriend; - timeout = dbus_timeout; - -#ifdef PRINT_DEBUGINFO - if (!fdebug) { - fdebug = fopen("/tmp/maemoicd.log", "a+"); - } - PDEBUG("created %s\n", "IcdPrivate"); -#endif - } - - void clearState() - { - mMethod.clear(); - mInterface.clear(); - mSignal.clear(); - mError.clear(); - mArgs.clear(); - receivedSignals.clear(); - } - - bool doConnect(IcdConnectResult& result); - bool doConnect(QString& result); - bool doState(); -}; - - -void IcdPrivate::signalReceived(const QString& interface, - const QString& signal, - const QList& args) -{ - // Signal handler, which simply records what has been signalled - mInterface = interface; - mSignal = signal; - mArgs = args; - - //qDebug() << "signal" << signal << "received:" << args; - receivedSignals << QVariant(interface) << QVariant(signal) << QVariant(args); -} - - -void IcdPrivate::callReply(const QString& method, - const QList& /*args*/, - const QString& error) -{ - mMethod = method; - mError = error; -} - - -static void get_scan_result(QList& args, - IcdScanResult& ret) -{ - int i=0; - - if (args.isEmpty()) - return; - - ret.status = args[i++].toUInt(); - ret.timestamp = args[i++].toUInt(); - ret.scan.service_type = args[i++].toString(); - ret.service_name = args[i++].toString(); - ret.scan.service_attrs = args[i++].toUInt(); - ret.scan.service_id = args[i++].toString(); - ret.service_priority = args[i++].toInt(); - ret.scan.network_type = args[i++].toString(); - ret.network_name = args[i++].toString(); - ret.scan.network_attrs = args[i++].toUInt(); - ret.scan.network_id = args[i++].toByteArray(); - ret.network_priority = args[i++].toInt(); - ret.signal_strength = args[i++].toInt(); - ret.station_id = args[i++].toString(); - ret.signal_dB = args[i++].toInt(); -} - - -static void get_connect_result(QList& args, - IcdConnectResult& ret) -{ - int i=0; - - if (args.isEmpty()) - return; - - ret.connect.service_type = args[i++].toString(); - ret.connect.service_attrs = args[i++].toInt(); - ret.connect.service_id = args[i++].toString(); - ret.connect.network_type = args[i++].toString(); - ret.connect.network_attrs = args[i++].toInt(); - ret.connect.network_id = args[i++].toByteArray(); - ret.status = args[i++].toInt(); -} - - -QStringList IcdPrivate::scan(icd_scan_request_flags flags, - QStringList &network_types, - QList& scan_results, - QString& error) -{ - QStringList scanned_types; - QTimer timer; - QVariant reply; - QVariantList vl; - bool last_result = false; - IcdScanResult result; - int all_waited; - - clearState(); - reply = mDBus->call(ICD_DBUS_API_SCAN_REQ, (uint)flags); - if (reply.type() != QVariant::List) - return scanned_types; - vl = reply.toList(); - if (vl.isEmpty()) { - error = "Scan did not return anything."; - return scanned_types; - } - reply = vl.first(); - scanned_types = reply.toStringList(); - //qDebug() << "Scanning:" << scanned_types; - all_waited = scanned_types.size(); - - timer.setSingleShot(true); - timer.start(timeout); - - scan_results.clear(); - while (!last_result) { - while (timer.isActive() && mInterface.isEmpty() && mError.isEmpty()) { - QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); - } - - if (!timer.isActive()) { - //qDebug() << "Timeout happened"; - break; - } - - if (mSignal != ICD_DBUS_API_SCAN_SIG) { - //qDebug() << "Received" << mSignal << "while waiting" << ICD_DBUS_API_SCAN_SIG << ", ignoring"; - mInterface.clear(); - continue; - } - - if (mError.isEmpty()) { - QString msgInterface = receivedSignals.takeFirst().toString(); - QString msgSignal = receivedSignals.takeFirst().toString(); - QList msgArgs = receivedSignals.takeFirst().toList(); - //qDebug() << "Signal" << msgSignal << "received."; - //qDebug() << "Params:" << msgArgs; - - while (!msgSignal.isEmpty()) { - get_scan_result(msgArgs, result); - -#if 0 - qDebug() << "Received: " << - "status =" << result.status << - ", timestamp =" << result.timestamp << - ", service_type =" << result.scan.service_type << - ", service_name =" << result.service_name << - ", service_attrs =" << result.scan.service_attrs << - ", service_id =" << result.scan.service_id << - ", service_priority =" << result.service_priority << - ", network_type =" << result.scan.network_type << - ", network_name =" << result.network_name << - ", network_attrs =" << result.scan.network_attrs << - ", network_id =" << "-" << - ", network_priority =" << result.network_priority << - ", signal_strength =" << result.signal_strength << - ", station_id =" << result.station_id << - ", signal_dB =" << result.signal_dB; -#endif - - if (result.status == ICD_SCAN_COMPLETE) { - //qDebug() << "waited =" << all_waited; - if (--all_waited == 0) { - last_result = true; - break; - } - } else - scan_results << result; - - if (receivedSignals.isEmpty()) - break; - - msgInterface = receivedSignals.takeFirst().toString(); - msgSignal = receivedSignals.takeFirst().toString(); - msgArgs = receivedSignals.takeFirst().toList(); - } - mInterface.clear(); - - } else { - qWarning() << "Error while scanning:" << mError; - break; - } - } - timer.stop(); - - error = mError; - return scanned_types; -} - - -void IcdPrivate::scanCancel() -{ - mDBus->call(ICD_DBUS_API_SCAN_CANCEL); -} - - -bool IcdPrivate::doConnect(IcdConnectResult& result) -{ - QTimer timer; - bool status = false; - - timer.setSingleShot(true); - timer.start(timeout); - - //qDebug() << "Waiting" << ICD_DBUS_API_CONNECT_SIG << "signal"; - - while (timer.isActive() && mInterface.isEmpty() && - mSignal != ICD_DBUS_API_CONNECT_SIG && - mError.isEmpty()) { - QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); - } - - timer.stop(); - - if (mError.isEmpty()) { - if (!mArgs.isEmpty()) { - get_connect_result(mArgs, result); - status = true; - } else - status = false; - } else - status = false; - - return status; -} - - -bool IcdPrivate::connect(icd_connection_flags flags, IcdConnectResult& result) -{ - clearState(); - //mDBus->callAsynchronous(ICD_DBUS_API_CONNECT_REQ, (uint)flags); - mDBus->call(ICD_DBUS_API_CONNECT_REQ, (uint)flags); - icdRefCounting()->setup(flags); - return doConnect(result); -} - - -bool IcdPrivate::connect(icd_connection_flags flags, QList& params, - IcdConnectResult& result) -{ - QVariantList varlist; - QVariantList varlist2; - - foreach (ConnectParams param, params) { - QVariantList items; - - items.append(QVariant(param.connect.service_type)); - items.append(QVariant(param.connect.service_attrs)); - items.append(QVariant(param.connect.service_id)); - items.append(QVariant(param.connect.network_type)); - items.append(QVariant(param.connect.network_attrs)); - items.append(QVariant(param.connect.network_id)); - - varlist.append(items); - } - - varlist2.append(QVariant(varlist)); - - clearState(); - //mDBus->callAsynchronous(ICD_DBUS_API_CONNECT_REQ, (uint)flags, varlist2); - mDBus->call(ICD_DBUS_API_CONNECT_REQ, (uint)flags, varlist2); - icdRefCounting()->setup(flags); - return doConnect(result); -} - - -bool IcdPrivate::doConnect(QString& ret) -{ - QTimer timer; - bool status = false; - - timer.setSingleShot(true); - timer.start(timeout); - - while (timer.isActive() && mInterface.isEmpty() && - mError.isEmpty()) { - QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); - } - - timer.stop(); - - if (mError.isEmpty()) { - if (!mArgs.isEmpty()) { - status = true; - //ret = mArgs[0]; // TODO correctly - } else - status = false; - } else - status = false; - - return status; -} - - -bool IcdPrivate::connect(icd_connection_flags flags, QString& iap, QString& result) -{ - clearState(); - //mDBus->callAsynchronous(ICD_CONNECT_REQ, iap, (uint)flags); - mDBus->call(ICD_CONNECT_REQ, iap, (uint)flags); - icdRefCounting()->setup(flags); - return doConnect(result); -} - - -void IcdPrivate::select(uint flags) -{ - mDBus->call(ICD_DBUS_API_SELECT_REQ, flags); -} - - -void IcdPrivate::disconnect(uint flags, QString& service_type, - uint service_attrs, QString& service_id, - QString& network_type, uint network_attrs, - QByteArray& network_id) -{ - clearState(); - mDBus->call(ICD_DBUS_API_DISCONNECT_REQ, flags, - service_type, service_attrs, service_id, - network_type, network_attrs, network_id); - icdRefCounting()->cleanup(); -} - - -void IcdPrivate::disconnect(uint flags) -{ - clearState(); - mDBus->call(ICD_DBUS_API_DISCONNECT_REQ, flags); - icdRefCounting()->cleanup(); -} - - -static void get_state_all_result(QList& args, - IcdStateResult& ret) -{ - int i=0; - - ret.params.service_type = args[i++].toString(); - ret.params.service_attrs = args[i++].toUInt(); - ret.params.service_id = args[i++].toString(); - ret.params.network_type = args[i++].toString(); - ret.params.network_attrs = args[i++].toUInt(); - ret.params.network_id = args[i++].toByteArray(); - ret.error = args[i++].toString(); - ret.state = args[i++].toInt(); -} - - -static void get_state_all_result2(QList& args, - IcdStateResult& ret) -{ - int i=0; - - ret.params.network_type = args[i++].toString(); - ret.state = args[i++].toInt(); - - // Initialize the other values so that the caller can - // notice we only returned partial status - ret.params.service_type = QString(); - ret.params.service_attrs = 0; - ret.params.service_id = QString(); - ret.params.network_attrs = 0; - ret.params.network_id = QByteArray(); - ret.error = QString(); -} - - -uint IcdPrivate::state(QString& service_type, uint service_attrs, - QString& service_id, QString& network_type, - uint network_attrs, QByteArray& network_id, - IcdStateResult& state_result) -{ - QTimer timer; - QVariant reply; - uint total_signals; - QVariantList vl; - - clearState(); - - reply = mDBus->call(ICD_DBUS_API_STATE_REQ, - service_type, service_attrs, service_id, - network_type, network_attrs, network_id); - if (reply.type() != QVariant::List) - return 0; - vl = reply.toList(); - if (vl.isEmpty()) - return 0; - reply = vl.first(); - total_signals = reply.toUInt(); - if (!total_signals) - return 0; - - timer.setSingleShot(true); - timer.start(timeout); - - mInterface.clear(); - while (timer.isActive() && mInterface.isEmpty()) { - QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); - - if (mSignal != ICD_DBUS_API_STATE_SIG) { - mInterface.clear(); - continue; - } - } - - timer.stop(); - - if (mError.isEmpty()) { - if (!mArgs.isEmpty()) { - if (mArgs.size()>2) - get_state_all_result(mArgs, state_result); - else { - // We are not connected as we did not get the status we asked - return 0; - } - } - } else { - qWarning() << "Error:" << mError; - } - - // The returned value should be one because we asked for one state - return total_signals; -} - - -uint IcdPrivate::state_non_blocking(QList& state_results) -{ - QTimer timer; - QVariant reply; - QVariantList vl; - uint signals_left, total_signals; - IcdStateResult result; - - PDEBUG("%s\n", "non blocking state"); - - clearState(); - reply = mDBus->call(ICD_DBUS_API_STATE_REQ); - if (reply.type() != QVariant::List) - return 0; - vl = reply.toList(); - if (vl.isEmpty()) - return 0; - reply = vl.first(); - signals_left = total_signals = reply.toUInt(); - if (!signals_left) - return 0; - - timer.setSingleShot(true); - timer.start(timeout); - state_results.clear(); - mError.clear(); - while (signals_left) { - mInterface.clear(); - while (timer.isActive() && mInterface.isEmpty()) { - QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); - } - - if (!timer.isActive()) { - total_signals = 0; - break; - } - - if (mSignal != ICD_DBUS_API_STATE_SIG) { - continue; - } - - if (mError.isEmpty()) { - if (!mArgs.isEmpty()) { - if (mArgs.size()==2) - get_state_all_result2(mArgs, result); - else - get_state_all_result(mArgs, result); - state_results << result; - } - signals_left--; - } else { - qWarning() << "Error:" << mError; - break; - } - } - timer.stop(); - - PDEBUG("total_signals=%d\n", total_signals); - return total_signals; -} - - -/* Special version of the state() call which does not call event loop. - * Needed in order to fix NB#175098 where Qt4.7 webkit crashes because event - * loop is run when webkit does not expect it. This function is called from - * bearer management API syncStateWithInterface() in QNetworkSession - * constructor. - */ -uint IcdPrivate::state(QList& state_results) -{ - QVariant reply; - QVariantList vl; - uint signals_left, total_signals; - IcdStateResult result; - time_t started; - int timeout_secs = timeout / 1000; - - PDEBUG("%s\n", "state_results"); - - clearState(); - reply = mDBus->call(ICD_DBUS_API_STATE_REQ); - if (reply.type() != QVariant::List) - return 0; - vl = reply.toList(); - if (vl.isEmpty()) - return 0; - reply = vl.first(); - signals_left = total_signals = reply.toUInt(); - if (!signals_left) - return 0; - - started = time(0); - state_results.clear(); - mError.clear(); - while (signals_left) { - mInterface.clear(); - while ((time(0)<=(started+timeout_secs)) && mInterface.isEmpty()) { - mDBus->synchronousDispatch(1000); - } - - if (time(0)>(started+timeout_secs)) { - total_signals = 0; - break; - } - - if (mSignal != ICD_DBUS_API_STATE_SIG) { - continue; - } - - if (mError.isEmpty()) { - if (!mArgs.isEmpty()) { - if (mArgs.size()==2) - get_state_all_result2(mArgs, result); - else - get_state_all_result(mArgs, result); - state_results << result; - } - signals_left--; - } else { - qWarning() << "Error:" << mError; - break; - } - } - - PDEBUG("total_signals=%d\n", total_signals); - return total_signals; -} - - -static void get_statistics_all_result(QList& args, - IcdStatisticsResult& ret) -{ - int i=0; - - if (args.isEmpty()) - return; - - ret.params.service_type = args[i++].toString(); - ret.params.service_attrs = args[i++].toUInt(); - ret.params.service_id = args[i++].toString(); - ret.params.network_type = args[i++].toString(); - ret.params.network_attrs = args[i++].toUInt(); - ret.params.network_id = args[i++].toByteArray(); - ret.time_active = args[i++].toUInt(); - ret.signal_strength = (enum icd_nw_levels)args[i++].toUInt(); - ret.bytes_sent = args[i++].toUInt(); - ret.bytes_received = args[i++].toUInt(); -} - - -uint IcdPrivate::statistics(QList& stats_results) -{ - QTimer timer; - QVariant reply; - QVariantList vl; - uint signals_left, total_signals; - IcdStatisticsResult result; - - clearState(); - reply = mDBus->call(ICD_DBUS_API_STATISTICS_REQ); - if (reply.type() != QVariant::List) - return 0; - vl = reply.toList(); - if (vl.isEmpty()) - return 0; - reply = vl.first(); - if (reply.type() != QVariant::UInt) - return 0; - signals_left = total_signals = reply.toUInt(); - - if (!signals_left) - return 0; - - timer.setSingleShot(true); - timer.start(timeout); - stats_results.clear(); - while (signals_left) { - mInterface.clear(); - while (timer.isActive() && mInterface.isEmpty()) { - QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); - } - - if (!timer.isActive()) { - total_signals = 0; - break; - } - - if (mSignal != ICD_DBUS_API_STATISTICS_SIG) { - continue; - } - - if (mError.isEmpty()) { - get_statistics_all_result(mArgs, result); - stats_results << result; - signals_left--; - } else { - qWarning() << "Error:" << mError; - break; - } - } - timer.stop(); - - return total_signals; -} - - -uint IcdPrivate::statistics(QString& service_type, uint service_attrs, - QString& service_id, QString& network_type, - uint network_attrs, QByteArray& network_id, - IcdStatisticsResult& stats_result) -{ - QTimer timer; - QVariant reply; - uint total_signals; - QVariantList vl; - - clearState(); - - reply = mDBus->call(ICD_DBUS_API_STATISTICS_REQ, - service_type, service_attrs, service_id, - network_type, network_attrs, network_id); - if (reply.type() != QVariant::List) - return 0; - vl = reply.toList(); - if (vl.isEmpty()) - return 0; - reply = vl.first(); - total_signals = reply.toUInt(); - if (!total_signals) - return 0; - - timer.setSingleShot(true); - timer.start(timeout); - - mInterface.clear(); - while (timer.isActive() && mInterface.isEmpty()) { - QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); - - if (mSignal != ICD_DBUS_API_STATISTICS_SIG) { - mInterface.clear(); - continue; - } - } - - timer.stop(); - - if (mError.isEmpty()) { - get_statistics_all_result(mArgs, stats_result); - } else { - qWarning() << "Error:" << mError; - } - - // The returned value should be one because we asked for one statistics - return total_signals; -} - - -static void get_addrinfo_all_result(QList& args, - IcdAddressInfoResult& ret) -{ - int i=0; - - if (args.isEmpty()) - return; - - ret.params.service_type = args[i++].toString(); - ret.params.service_attrs = args[i++].toUInt(); - ret.params.service_id = args[i++].toString(); - ret.params.network_type = args[i++].toString(); - ret.params.network_attrs = args[i++].toUInt(); - ret.params.network_id = args[i++].toByteArray(); - - QVariantList vl = args[i].toList(); - QVariant reply = vl.first(); - QList lst = reply.toList(); - for (int k=0; k& addr_results) -{ - QVariant reply; - QVariantList vl; - uint signals_left, total_signals; - IcdAddressInfoResult result; - time_t started; - int timeout_secs = timeout / 1000; - - PDEBUG("%s\n", "addr_results"); - - clearState(); - reply = mDBus->call(ICD_DBUS_API_ADDRINFO_REQ); - if (reply.type() != QVariant::List) - return 0; - vl = reply.toList(); - if (vl.isEmpty()) - return 0; - reply = vl.first(); - if (reply.type() != QVariant::UInt) - return 0; - signals_left = total_signals = reply.toUInt(); - if (!signals_left) - return 0; - - started = time(0); - addr_results.clear(); - while (signals_left) { - mInterface.clear(); - while ((time(0)<=(started+timeout_secs)) && mInterface.isEmpty()) { - mDBus->synchronousDispatch(1000); - } - - if (time(0)>(started+timeout_secs)) { - total_signals = 0; - break; - } - - if (mSignal != ICD_DBUS_API_ADDRINFO_SIG) { - continue; - } - - if (mError.isEmpty()) { - get_addrinfo_all_result(mArgs, result); - addr_results << result; - signals_left--; - } else { - qWarning() << "Error:" << mError; - break; - } - } - - PDEBUG("total_signals=%d\n", total_signals); - return total_signals; -} - -uint IcdPrivate::addrinfo_non_blocking(QList& addr_results) -{ - QTimer timer; - QVariant reply; - QVariantList vl; - uint signals_left, total_signals; - IcdAddressInfoResult result; - - PDEBUG("%s\n", "non blocking addrinfo"); - - clearState(); - reply = mDBus->call(ICD_DBUS_API_ADDRINFO_REQ); - if (reply.type() != QVariant::List) - return 0; - vl = reply.toList(); - if (vl.isEmpty()) - return 0; - reply = vl.first(); - if (reply.type() != QVariant::UInt) - return 0; - signals_left = total_signals = reply.toUInt(); - if (!signals_left) - return 0; - - timer.setSingleShot(true); - timer.start(timeout); - addr_results.clear(); - while (signals_left) { - mInterface.clear(); - while (timer.isActive() && mInterface.isEmpty()) { - QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); - } - - if (!timer.isActive()) { - total_signals = 0; - break; - } - - if (mSignal != ICD_DBUS_API_ADDRINFO_SIG) { - continue; - } - - if (mError.isEmpty()) { - get_addrinfo_all_result(mArgs, result); - addr_results << result; - signals_left--; - } else { - qWarning() << "Error:" << mError; - break; - } - } - timer.stop(); - PDEBUG("total_signals=%d\n", total_signals); - return total_signals; -} - - -uint IcdPrivate::addrinfo(QString& service_type, uint service_attrs, - QString& service_id, QString& network_type, - uint network_attrs, QByteArray& network_id, - IcdAddressInfoResult& addr_result) -{ - QTimer timer; - QVariant reply; - uint total_signals; - QVariantList vl; - - clearState(); - - reply = mDBus->call(ICD_DBUS_API_ADDRINFO_REQ, - service_type, service_attrs, service_id, - network_type, network_attrs, network_id); - if (reply.type() != QVariant::List) - return 0; - vl = reply.toList(); - if (vl.isEmpty()) - return 0; - reply = vl.first(); - total_signals = reply.toUInt(); - - if (!total_signals) - return 0; - - timer.setSingleShot(true); - timer.start(timeout); - - mInterface.clear(); - while (timer.isActive() && mInterface.isEmpty()) { - QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); - - if (mSignal != ICD_DBUS_API_ADDRINFO_SIG) { - mInterface.clear(); - continue; - } - } - - timer.stop(); - - if (mError.isEmpty()) { - get_addrinfo_all_result(mArgs, addr_result); - } else { - qWarning() << "Error:" << mError; - } - - // The returned value should be one because we asked for one addrinfo - return total_signals; -} - - -Icd::Icd(QObject *parent) - : QObject(parent), d(new IcdPrivate(this)) -{ -} - -Icd::Icd(unsigned int timeout, QObject *parent) - : QObject(parent), d(new IcdPrivate(timeout, this)) -{ -} - -Icd::Icd(unsigned int timeout, IcdDbusInterfaceVer ver, QObject *parent) - : QObject(parent), d(new IcdPrivate(timeout, ver, this)) -{ -} - -Icd::~Icd() -{ - delete d; -} - - -QStringList Icd::scan(icd_scan_request_flags flags, - QStringList &network_types, - QList& scan_results, - QString& error) -{ - return d->scan(flags, network_types, scan_results, error); -} - - -void Icd::scanCancel() -{ - d->scanCancel(); -} - - -bool Icd::connect(icd_connection_flags flags, IcdConnectResult& result) -{ - return d->connect(flags, result); -} - - -bool Icd::connect(icd_connection_flags flags, QList& params, - IcdConnectResult& result) -{ - return d->connect(flags, params, result); -} - - -bool Icd::connect(icd_connection_flags flags, QString& iap, QString& result) -{ - return d->connect(flags, iap, result); -} - - -void Icd::select(uint flags) -{ - d->select(flags); -} - - -void Icd::disconnect(uint connect_flags, QString& service_type, - uint service_attrs, QString& service_id, - QString& network_type, uint network_attrs, - QByteArray& network_id) -{ - d->disconnect(connect_flags, service_type, - service_attrs, service_id, - network_type, network_attrs, - network_id); -} - - -void Icd::disconnect(uint connect_flags) -{ - d->disconnect(connect_flags); -} - - -uint Icd::state(QString& service_type, uint service_attrs, - QString& service_id, QString& network_type, - uint network_attrs, QByteArray& network_id, - IcdStateResult &state_result) -{ - return d->state(service_type, service_attrs, service_id, - network_type, network_attrs, network_id, - state_result); -} - - -uint Icd::statistics(QString& service_type, uint service_attrs, - QString& service_id, QString& network_type, - uint network_attrs, QByteArray& network_id, - IcdStatisticsResult& stats_result) -{ - return d->statistics(service_type, service_attrs, service_id, - network_type, network_attrs, network_id, - stats_result); -} - - -uint Icd::addrinfo(QString& service_type, uint service_attrs, - QString& service_id, QString& network_type, - uint network_attrs, QByteArray& network_id, - IcdAddressInfoResult& addr_result) -{ - return d->addrinfo(service_type, service_attrs, service_id, - network_type, network_attrs, network_id, - addr_result); -} - - -uint Icd::state(QList& state_results) -{ - return d->state(state_results); -} - -uint Icd::state_non_blocking(QList& state_results) -{ - return d->state_non_blocking(state_results); -} - -uint Icd::statistics(QList& stats_results) -{ - return d->statistics(stats_results); -} - - -uint Icd::addrinfo(QList& addr_results) -{ - return d->addrinfo(addr_results); -} - -uint Icd::addrinfo_non_blocking(QList& addr_results) -{ - return d->addrinfo_non_blocking(addr_results); -} - -void Icd::icdSignalReceived(const QString& interface, - const QString& signal, - const QList& args) -{ - d->signalReceived(interface, signal, args); -} - - -void Icd::icdCallReply(const QString& method, - const QList& args, - const QString& error) -{ - d->callReply(method, args, error); -} - - -QString Icd::error() -{ - return d->error(); -} - -} // Maemo namespace - - diff --git a/src/3rdparty/libconninet/src/maemo_icd.h b/src/3rdparty/libconninet/src/maemo_icd.h deleted file mode 100644 index d7a8d5b..0000000 --- a/src/3rdparty/libconninet/src/maemo_icd.h +++ /dev/null @@ -1,182 +0,0 @@ -/* - libconninet - Internet Connectivity support library - - Copyright (C) 2009 Nokia Corporation. All rights reserved. - - Contact: Jukka Rissanen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License - version 2.1 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - 02110-1301 USA -*/ - -#ifndef MAEMO_ICD_H -#define MAEMO_ICD_H - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "dbusdispatcher.h" -#include - -#define ICD_LONG_SCAN_TIMEOUT (30*1000) /* 30sec */ -#define ICD_SHORT_SCAN_TIMEOUT (10*1000) /* 10sec */ -#define ICD_SHORT_CONNECT_TIMEOUT (10*1000) /* 10sec */ -#define ICD_LONG_CONNECT_TIMEOUT (150*1000) /* 2.5min */ - -namespace Maemo { - -struct CommonParams { - QString service_type; - uint service_attrs; - QString service_id; - QString network_type; - uint network_attrs; - QByteArray network_id; -}; - -struct ConnectParams { - struct CommonParams connect; -}; - -struct IcdScanResult { - uint status; // see #icd_scan_status - uint timestamp; // when last seen - QString service_name; - uint service_priority; // within a service type - QString network_name; - uint network_priority; - struct CommonParams scan; - uint signal_strength; // quality, 0 (none) - 10 (good) - QString station_id; // e.g. MAC address or similar id - uint signal_dB; // use signal strength above unless you know what you are doing - - IcdScanResult() { - status = timestamp = scan.service_attrs = service_priority = - scan.network_attrs = network_priority = signal_strength = - signal_dB = 0; - } -}; - -struct IcdConnectResult { - struct CommonParams connect; - uint status; -}; - -struct IcdStateResult { - struct CommonParams params; - QString error; - uint state; -}; - -struct IcdStatisticsResult { - struct CommonParams params; - uint time_active; // in seconds - enum icd_nw_levels signal_strength; // see network_api_defines.h in icd2-dev package - uint bytes_sent; - uint bytes_received; -}; - -struct IcdIPInformation { - QString address; - QString netmask; - QString default_gateway; - QString dns1; - QString dns2; - QString dns3; -}; - -struct IcdAddressInfoResult { - struct CommonParams params; - QList ip_info; -}; - -enum IcdDbusInterfaceVer { - IcdOldDbusInterface = 0, // use the old OSSO-IC interface - IcdNewDbusInterface // use the new Icd2 interface (default) -}; - - -class IcdPrivate; -class Icd : public QObject -{ - Q_OBJECT - -public: - Icd(QObject *parent = 0); - Icd(unsigned int timeout, QObject *parent = 0); - Icd(unsigned int timeout, IcdDbusInterfaceVer ver, QObject *parent = 0); - ~Icd(); - QString error(); // returns last error string - - /* Icd2 dbus API functions */ - QStringList scan(icd_scan_request_flags flags, - QStringList &network_types, - QList& scan_results, - QString& error); - void scanCancel(); - bool connect(icd_connection_flags flags, IcdConnectResult& result); - bool connect(icd_connection_flags flags, QList& params, - IcdConnectResult& result); - bool connect(icd_connection_flags flags, QString& iap, QString& result); - void select(uint flags); - void disconnect(uint connect_flags, QString& service_type, - uint service_attrs, QString& service_id, - QString& network_type, uint network_attrs, - QByteArray& network_id); - void disconnect(uint connect_flags); - - uint state(QString& service_type, uint service_attrs, - QString& service_id, QString& network_type, - uint network_attrs, QByteArray& network_id, - IcdStateResult &state_result); - uint statistics(QString& service_type, uint service_attrs, - QString& service_id, QString& network_type, - uint network_attrs, QByteArray& network_id, - IcdStatisticsResult& stats_result); - uint addrinfo(QString& service_type, uint service_attrs, - QString& service_id, QString& network_type, - uint network_attrs, QByteArray& network_id, - IcdAddressInfoResult& addr_result); - - uint state(QList& state_results); - uint state_non_blocking(QList& state_results); - uint statistics(QList& stats_results); - uint addrinfo(QList& addr_results); - uint addrinfo_non_blocking(QList& addr_results); - -private Q_SLOTS: - void icdSignalReceived(const QString& interface, - const QString& signal, - const QList& args); - void icdCallReply(const QString& method, - const QList& args, - const QString& error); - -private: - IcdPrivate *d; - friend class IcdPrivate; -}; - -} // Maemo namespace - -#endif diff --git a/src/3rdparty/libconninet/src/proxyconf.cpp b/src/3rdparty/libconninet/src/proxyconf.cpp deleted file mode 100644 index d377a31..0000000 --- a/src/3rdparty/libconninet/src/proxyconf.cpp +++ /dev/null @@ -1,392 +0,0 @@ -/* - libconninet - Internet Connectivity support library - - Copyright (C) 2010 Nokia Corporation. All rights reserved. - - Contact: Jukka Rissanen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License - version 2.1 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - 02110-1301 USA -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "proxyconf.h" - -#define CONF_PROXY "/system/proxy" -#define HTTP_PROXY "/system/http_proxy" - - -namespace Maemo { - -static QString convertKey(const char *key) -{ - return QString::fromUtf8(key); -} - -static QVariant convertValue(GConfValue *src) -{ - if (!src) { - return QVariant(); - } else { - switch (src->type) { - case GCONF_VALUE_INVALID: - return QVariant(QVariant::Invalid); - case GCONF_VALUE_BOOL: - return QVariant((bool)gconf_value_get_bool(src)); - case GCONF_VALUE_INT: - return QVariant(gconf_value_get_int(src)); - case GCONF_VALUE_FLOAT: - return QVariant(gconf_value_get_float(src)); - case GCONF_VALUE_STRING: - return QVariant(QString::fromUtf8(gconf_value_get_string(src))); - case GCONF_VALUE_LIST: - switch (gconf_value_get_list_type(src)) { - case GCONF_VALUE_STRING: - { - QStringList result; - for (GSList *elts = gconf_value_get_list(src); elts; elts = elts->next) - result.append(QString::fromUtf8(gconf_value_get_string((GConfValue *)elts->data))); - return QVariant(result); - } - default: - { - QList result; - for (GSList *elts = gconf_value_get_list(src); elts; elts = elts->next) - result.append(convertValue((GConfValue *)elts->data)); - return QVariant(result); - } - } - case GCONF_VALUE_SCHEMA: - default: - return QVariant(); - } - } -} - - -/* Fast version of GConfItem, allows reading subtree at a time */ -class GConfItemFast { -public: - GConfItemFast(const QString &k) : key(k) {} - QHash getEntries() const; - -private: - QString key; -}; - -#define withClient(c) for (GConfClient *c = gconf_client_get_default(); c; c=0) - - -QHash GConfItemFast::getEntries() const -{ - QHash children; - - withClient(client) { - QByteArray k = key.toUtf8(); - GSList *entries = gconf_client_all_entries(client, k.data(), NULL); - for (GSList *e = entries; e; e = e->next) { - char *key_name = strrchr(((GConfEntry *)e->data)->key, '/'); - if (!key_name) - key_name = ((GConfEntry *)e->data)->key; - else - key_name++; - QString key(convertKey(key_name)); - QVariant value = convertValue(((GConfEntry *)e->data)->value); - gconf_entry_unref((GConfEntry *)e->data); - //qDebug()<<"key="< queryProxy(const QNetworkProxyQuery &query = QNetworkProxyQuery()); -}; - - -QList NetworkProxyFactory::queryProxy(const QNetworkProxyQuery &query) -{ - ProxyConf proxy_conf; - - QList result = proxy_conf.flush(query); - if (result.isEmpty()) - result << QNetworkProxy::NoProxy; - - return result; -} - - -class ProxyConfPrivate { -private: - // proxy values from gconf - QString mode; - bool use_http_host; - QString autoconfig_url; - QString http_proxy; - quint16 http_port; - QList ignore_hosts; - QString secure_host; - quint16 secure_port; - QString ftp_host; - quint16 ftp_port; - QString socks_host; - quint16 socks_port; - QString rtsp_host; - quint16 rtsp_port; - - bool isHostExcluded(const QString &host); - -public: - QString prefix; - QString http_prefix; - - void readProxyData(); - QList flush(const QNetworkProxyQuery &query); -}; - - -static QHash getValues(const QString& prefix) -{ - GConfItemFast item(prefix); - return item.getEntries(); -} - -static QHash getHttpValues(const QString& prefix) -{ - GConfItemFast item(prefix); - return item.getEntries(); -} - -#define GET(var, type) \ - do { \ - QVariant v = values.value(#var); \ - if (v.isValid()) \ - var = v.to##type (); \ - } while(0) - -#define GET_HTTP(var, name, type) \ - do { \ - QVariant v = httpValues.value(#name); \ - if (v.isValid()) \ - var = v.to##type (); \ - } while(0) - - -void ProxyConfPrivate::readProxyData() -{ - QHash values = getValues(prefix); - QHash httpValues = getHttpValues(http_prefix); - - //qDebug()<<"values="< ProxyConfPrivate::flush(const QNetworkProxyQuery &query) -{ - QList result; - -#if 0 - qDebug()<<"http_proxy" << http_proxy; - qDebug()<<"http_port" << http_port; - qDebug()<<"ignore_hosts" << ignore_hosts; - qDebug()<<"use_http_host" << use_http_host; - qDebug()<<"mode" << mode; - qDebug()<<"autoconfig_url" << autoconfig_url; - qDebug()<<"secure_host" << secure_host; - qDebug()<<"secure_port" << secure_port; - qDebug()<<"ftp_host" << ftp_host; - qDebug()<<"ftp_port" << ftp_port; - qDebug()<<"socks_host" << socks_host; - qDebug()<<"socks_port" << socks_port; - qDebug()<<"rtsp_host" << rtsp_host; - qDebug()<<"rtsp_port" << rtsp_port; -#endif - - if (isHostExcluded(query.peerHostName())) - return result; // no proxy for this host - - if (mode == "auto") { - // TODO: pac currently not supported, fix me - return result; - } - - if (mode == "manual") { - bool isHttps = false; - QString protocol = query.protocolTag().toLower(); - - // try the protocol-specific proxy - QNetworkProxy protocolSpecificProxy; - - if (protocol == QLatin1String("ftp")) { - if (!ftp_host.isEmpty()) { - protocolSpecificProxy.setType(QNetworkProxy::FtpCachingProxy); - protocolSpecificProxy.setHostName(ftp_host); - protocolSpecificProxy.setPort(ftp_port); - } - } else if (protocol == QLatin1String("http")) { - if (!http_proxy.isEmpty()) { - protocolSpecificProxy.setType(QNetworkProxy::HttpProxy); - protocolSpecificProxy.setHostName(http_proxy); - protocolSpecificProxy.setPort(http_port); - } - } else if (protocol == QLatin1String("https")) { - isHttps = true; - if (!secure_host.isEmpty()) { - protocolSpecificProxy.setType(QNetworkProxy::HttpProxy); - protocolSpecificProxy.setHostName(secure_host); - protocolSpecificProxy.setPort(secure_port); - } - } - - if (protocolSpecificProxy.type() != QNetworkProxy::DefaultProxy) - result << protocolSpecificProxy; - - - if (!socks_host.isEmpty()) { - QNetworkProxy proxy; - proxy.setType(QNetworkProxy::Socks5Proxy); - proxy.setHostName(socks_host); - proxy.setPort(socks_port); - result << proxy; - } - - - // Add the HTTPS proxy if present (and if we haven't added yet) - if (!isHttps) { - QNetworkProxy https; - if (!secure_host.isEmpty()) { - https.setType(QNetworkProxy::HttpProxy); - https.setHostName(secure_host); - https.setPort(secure_port); - } - - if (https.type() != QNetworkProxy::DefaultProxy && - https != protocolSpecificProxy) - result << https; - } - } - - return result; -} - - -ProxyConf::ProxyConf() - : d_ptr(new ProxyConfPrivate) -{ - g_type_init(); - d_ptr->prefix = CONF_PROXY; - d_ptr->http_prefix = HTTP_PROXY; -} - -ProxyConf::~ProxyConf() -{ - delete d_ptr; -} - - -QList ProxyConf::flush(const QNetworkProxyQuery &query) -{ - d_ptr->readProxyData(); - return d_ptr->flush(query); -} - - -static int refcount = 0; -static QReadWriteLock lock; - -void ProxyConf::update() -{ - QWriteLocker locker(&lock); - NetworkProxyFactory *factory = new NetworkProxyFactory(); - QNetworkProxyFactory::setApplicationProxyFactory((QNetworkProxyFactory*)factory); - refcount++; -} - - -void ProxyConf::clear(void) -{ - QWriteLocker locker(&lock); - refcount--; - if (refcount == 0) - QNetworkProxyFactory::setApplicationProxyFactory(NULL); - - if (refcount<0) - refcount = 0; -} - - -} // namespace Maemo diff --git a/src/3rdparty/libconninet/src/proxyconf.h b/src/3rdparty/libconninet/src/proxyconf.h deleted file mode 100644 index 7711c49..0000000 --- a/src/3rdparty/libconninet/src/proxyconf.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - libconninet - Internet Connectivity support library - - Copyright (C) 2010 Nokia Corporation. All rights reserved. - - Contact: Jukka Rissanen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License - version 2.1 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - 02110-1301 USA -*/ - -#ifndef PROXYCONF_H -#define PROXYCONF_H - -#include -#include - -namespace Maemo { - -class ProxyConfPrivate; -class ProxyConf { -private: - ProxyConfPrivate *d_ptr; - -public: - ProxyConf(); - virtual ~ProxyConf(); - - QList flush(const QNetworkProxyQuery &query = QNetworkProxyQuery()); // read the proxies from db - - /* Note that for each update() call there should be corresponding - * clear() call because the ProxyConf class implements a reference - * counting mechanism. The factory is removed only when there is - * no one using the factory any more. - */ - static void update(void); // this builds QNetworkProxy factory - static void clear(void); // this removes QNetworkProxy factory -}; - -} // namespace Maemo - -#endif diff --git a/src/3rdparty/libconninet/tests/ut_dbusdispatcher.cpp b/src/3rdparty/libconninet/tests/ut_dbusdispatcher.cpp deleted file mode 100644 index 70deb3f..0000000 --- a/src/3rdparty/libconninet/tests/ut_dbusdispatcher.cpp +++ /dev/null @@ -1,191 +0,0 @@ -/* * This file is part of conn-dui-settings-inet * - * - * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * - * Contact: Aapo Makela - * - * This software, including documentation, is protected by copyright - * controlled by Nokia Corporation. All rights are reserved. Copying, - * including reproducing, storing, adapting or translating, any or all of - * this material requires the prior written consent of Nokia Corporation. - * This material also contains confidential information which may not be - * disclosed to others without the prior written consent of Nokia. - */ - -#include -#include -#include -#include -#include - -#include - -class Ut_DBusDispatcher : public QObject -{ - Q_OBJECT - -private Q_SLOTS: - void init(); - void cleanup(); - void initTestCase(); - void cleanupTestCase(); - - void simpleSignalReceived(const QString& interface, - const QString& signal, - const QList& args); - void simpleCallReply(const QString& method, - const QList& args, - const QString& error); - void simpleCall(); - - void complexCallReply(const QString& method, - const QList& args, - const QString& error); - void complexCall(); - -private: - Maemo::DBusDispatcher *mSubject; - QProcess *icd_stub; - - QString mMethod; - QString mInterface; - QString mSignal; - QList mArgs; -}; - -void Ut_DBusDispatcher::init() -{ - mSubject = new Maemo::DBusDispatcher("com.nokia.icd2", "/com/nokia/icd2", - "com.nokia.icd2"); - - // Start icd2 stub - icd_stub = new QProcess(this); - icd_stub->start("/usr/bin/icd2_stub.py"); - QTest::qWait(1000); -} - -void Ut_DBusDispatcher::cleanup() -{ - // Terminate icd2 stub - icd_stub->terminate(); - icd_stub->waitForFinished(); - - delete mSubject; - mSubject = 0; -} - -void Ut_DBusDispatcher::initTestCase() -{ -} - -void Ut_DBusDispatcher::cleanupTestCase() -{ -} - -void Ut_DBusDispatcher::simpleSignalReceived(const QString& interface, - const QString& signal, - const QList& args) -{ - // Signal handler, which simply records what has been signalled - mInterface = interface; - mSignal = signal; - mArgs = args; -} - -void Ut_DBusDispatcher::simpleCallReply(const QString& method, - const QList& args, - const QString& error) -{ - mMethod = method; - - // Check that method matches and at least WLAN_INFRA is returned - QVERIFY(error.isEmpty()); - QVERIFY(args[0].toStringList().contains("WLAN_INFRA")); -} - -void Ut_DBusDispatcher::simpleCall() -{ - uint flags = 0; - QList reply; - int idx = 0; - QTimer timer; - - // Connect signals - connect(mSubject, SIGNAL(signalReceived(const QString&, - const QString&, - const QList&)), - this, SLOT(simpleSignalReceived(const QString&, - const QString&, - const QList&))); - connect(mSubject, SIGNAL(callReply(const QString&, - const QList&, - const QString&)), - this, SLOT(simpleCallReply(const QString&, - const QList&, - const QString&))); - - // Request scan and verify the call starts succesfully - QVERIFY(mSubject->callAsynchronous("scan_req", flags)); - - // Wait 1st scan signal for 10 secs - timer.setSingleShot(true); - timer.start(10000); - while (timer.isActive() && mInterface.isEmpty()) { - QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); - idx++; - } - timer.stop(); - - // Sanity checks for the scan result - QVERIFY(mInterface == "com.nokia.icd2"); // interface is icd2 - QVERIFY(mMethod == "scan_req"); // method is scan_req - QVERIFY(mSignal == "scan_result_sig"); // signal is scan result - QVERIFY(mArgs[0] == QVariant(0) || - mArgs[0] == QVariant(4)); // First argument is status - // (0 == NEW, 4 == COMPLETED) - //QVERIFY(mArgs.contains(QVariant("WLAN_INFRA"))); // WLAN scan result -} - -void Ut_DBusDispatcher::complexCallReply(const QString& method, - const QList& args, - const QString& error) -{ - mMethod = method; - - // Check that method has not return arguments and error is not set - QVERIFY(error.isEmpty()); - QVERIFY(args.isEmpty()); -} - -void Ut_DBusDispatcher::complexCall() -{ - uint flags = ICD_CONNECTION_FLAG_UI_EVENT; - QList reply; - QVariantList networks; - QVariantList network1; - - network1 << "" << (uint)0 << "" << "WLAN_INFRA" << (uint)0x05000011 << QByteArray("osso@46@net"); - networks << QVariant(network1); - - // Connect signal - connect(mSubject, SIGNAL(callReply(const QString&, - const QList&, - const QString&)), - this, SLOT(complexCallReply(const QString&, - const QList&, - const QString&))); - - // Request connect and verify the call starts succesfully - QVERIFY(mSubject->callAsynchronous("connect_req", flags, networks)); - - QTest::qWait(1000); - - // Sanity checks for the scan result - QVERIFY(mInterface == "com.nokia.icd2"); // interface is icd2 - QVERIFY(mMethod == "connect_req"); // method connect_req -} - -QTEST_MAIN(Ut_DBusDispatcher) - -#include "ut_dbusdispatcher.moc" diff --git a/src/3rdparty/libconninet/tests/ut_iapconf.cpp b/src/3rdparty/libconninet/tests/ut_iapconf.cpp deleted file mode 100644 index 6a91d61..0000000 --- a/src/3rdparty/libconninet/tests/ut_iapconf.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* - libconninet - Internet Connectivity support library - - Copyright (C) 2009 Nokia Corporation. All rights reserved. - - Contact: Aapo Makela - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License - version 2.1 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - 02110-1301 USA -*/ - - -#include -#include - -#include - -class Ut_IAPConf : public QObject -{ - Q_OBJECT - -private Q_SLOTS: - void init(); - void cleanup(); - void initTestCase(); - void cleanupTestCase(); - - void setupIAP(); - void setupIAPContainingDot(); - void unsetIAPValueIsNotValid(); - void verifyAllIAPs(); - void allForEmptyConfReturnsEmptyList(); - void settingInvalidValueUnsetsKey(); - -private: - Maemo::IAPConf *mSubject; -}; - -void Ut_IAPConf::init() -{ - mSubject = new Maemo::IAPConf("test_iap"); -} - -void Ut_IAPConf::cleanup() -{ - // Clear made settings - mSubject->clear(); - - delete mSubject; - mSubject = 0; -} - -void Ut_IAPConf::initTestCase() -{ -} - -void Ut_IAPConf::cleanupTestCase() -{ -} - -void Ut_IAPConf::setupIAP() -{ - // Set bunch of values - mSubject->set("ipv4_type", "AUTO", - "wlan_wepkey1", "connt", - "wlan_wepdefkey", 1, - "wlan_ssid", QByteArray("CONNTEST-1")); - - // Set one value - mSubject->setValue("type", "WLAN_INFRA"); - - // Check all values that they were set correctly - QVERIFY(mSubject->value("ipv4_type").toString() == "AUTO"); - QVERIFY(mSubject->value("wlan_wepkey1").toString() == "connt"); - QVERIFY(mSubject->value("wlan_wepdefkey").toInt() == 1); - QVERIFY(mSubject->value("wlan_ssid").toByteArray() == QByteArray("CONNTEST-1")); - QVERIFY(mSubject->value("type").toString() == "WLAN_INFRA"); -} - -void Ut_IAPConf::setupIAPContainingDot() -{ - delete mSubject; - mSubject = new Maemo::IAPConf("test.iap"); - - // Set and check one value - mSubject->setValue("type", "DUMMY"); - QVERIFY(mSubject->value("type").toString() == "DUMMY"); -} - -void Ut_IAPConf::unsetIAPValueIsNotValid() -{ - QVariant invalidValue = mSubject->value("this_value_does_not_exist"); - QVERIFY(invalidValue.isValid() == false); -} - -void Ut_IAPConf::verifyAllIAPs() -{ - int count = 0, extras = 0; - QRegExp regexp("iap[1-3]"); - Maemo::IAPConf iap1("iap1"); - Maemo::IAPConf iap2("iap2"); - Maemo::IAPConf iap3("iap3"); - - iap1.clear(); - iap2.clear(); - iap3.clear(); - - iap1.setValue("name", "iap1"); - iap2.setValue("name", "iap2"); - iap3.setValue("name", "iap3"); - - count = extras = 0; - QList iaps; - Maemo::IAPConf::getAll(iaps, true); - foreach (QString iap_path, iaps) { - QString iap_id = iap_path.section('/', 5); /* This is the IAP id */ - if (!iap_id.contains(regexp)) { - extras++; - continue; - } - Maemo::IAPConf iap(iap_id); - QString name = iap.value("name").toString(); - QVERIFY(name == iap_id); - count++; - } - QCOMPARE(count, iaps.size()-extras); - - iap1.clear(); - iap2.clear(); - iap3.clear(); - - iap1.setValue("name", "iap1"); - iap2.setValue("name", "iap2"); - iap3.setValue("name", "iap3"); - - count = extras = 0; - Maemo::IAPConf::getAll(iaps); - foreach (QString iap_id, iaps) { - if (!iap_id.contains(regexp)) { - extras++; - continue; - } - Maemo::IAPConf iap(iap_id); - QString name = iap.value("name").toString(); - QVERIFY(name == iap_id); - count++; - } - QCOMPARE(count, iaps.size()-extras); -} - -void Ut_IAPConf::allForEmptyConfReturnsEmptyList() -{ - // Clear everything in configuration - mSubject->clearAll(); - - // Get all for a list and check that it is empty - QStringList iaps; - mSubject->getAll(iaps); - QVERIFY(iaps.isEmpty()); -} - -void Ut_IAPConf::settingInvalidValueUnsetsKey() -{ - // Setup some IAP - setupIAP(); - - // Set invalid value to unset "wlan_wepdefkey" key and verify that the - // value is unset - mSubject->setValue("wlan_wepdefkey", QVariant()); - QVERIFY(!mSubject->value("wlan_wepdefkey").isValid()); -} - -QTEST_MAIN(Ut_IAPConf) - -#include "ut_iapconf.moc" diff --git a/src/3rdparty/libconninet/tests/ut_iapmonitor.cpp b/src/3rdparty/libconninet/tests/ut_iapmonitor.cpp deleted file mode 100644 index f14f623..0000000 --- a/src/3rdparty/libconninet/tests/ut_iapmonitor.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - libconninet - Internet Connectivity support library - - Copyright (C) 2009-2010 Nokia Corporation. All rights reserved. - - Contact: Jukka Rissanen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License - version 2.1 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - 02110-1301 USA -*/ - - -#include -#include - -#include -#include - -static const char *iap_id = "test_monitor_1"; - -class TestIAPMonitor : public Maemo::IAPMonitor -{ -public: - QString addedIap; - QString removedIap; - -protected: - virtual void iapAdded(const QString &id) - { - addedIap = id; - } - - virtual void iapRemoved(const QString &id) - { - removedIap = id; - } -}; - -class Ut_IAPMonitor : public QObject -{ - Q_OBJECT - -private Q_SLOTS: - void init(); - void cleanup(); - void initTestCase(); - void cleanupTestCase(); - - void check(); - -private: - TestIAPMonitor *mon; - Maemo::IAPConf *iap; -}; - -void Ut_IAPMonitor::init() -{ - mon = new TestIAPMonitor; -} - -void Ut_IAPMonitor::cleanup() -{ - delete mon; - mon = 0; -} - -void Ut_IAPMonitor::initTestCase() -{ -} - -void Ut_IAPMonitor::cleanupTestCase() -{ -} - -void Ut_IAPMonitor::check() -{ - QVERIFY(mon->addedIap.isEmpty()); - - iap = new Maemo::IAPConf(iap_id); - iap->set("ipv4_type", "AUTO", - "wlan_wepkey1", "connt", - "wlan_wepdefkey", 1, - "wlan_ssid", QByteArray(iap_id)); - - QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); - QVERIFY(mon->addedIap == iap_id); - mon->addedIap.clear(); - - QVERIFY(mon->removedIap.isEmpty()); - - // Unset only one value and verify that IAP is not removed - iap->set("ipv4_type", QVariant()); - QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); - QVERIFY(mon->removedIap.isEmpty()); - - // Clear the whole IAP and check that it is removed - iap->clear(); - delete iap; - - QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); - - QVERIFY(mon->removedIap == iap_id); -} - -QTEST_MAIN(Ut_IAPMonitor) - -#include "ut_iapmonitor.moc" diff --git a/src/3rdparty/libconninet/tests/ut_maemo_icd.cpp b/src/3rdparty/libconninet/tests/ut_maemo_icd.cpp deleted file mode 100644 index 494829d..0000000 --- a/src/3rdparty/libconninet/tests/ut_maemo_icd.cpp +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * - * Contact: Jukka Rissanen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * version 2.1 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - - -// !!!! -// !!!! NOTE: THESE TEST DO NOT REALLY WORK YET BECAUSE OF MISSING -// !!!! FUNCTIONALITY IN ICD2 STUB. YOU HAVE BEEN WARNED. -// !!!! - - -#include -#include -#include -#include -#include - -#include "maemo_icd.h" - -class Ut_MaemoIcd : public QObject -{ - Q_OBJECT - -private Q_SLOTS: - void init(); - void cleanup(); - void initTestCase(); - void cleanupTestCase(); - - void scan_req(); - void scan_cancel_req(); - void connect_req_default(); - void state_req_all(); - void state_req(); - void statistics_req_all(); - void statistics_req(); - void addrinfo_req_all(); - void addrinfo_req(); - -private: - void disconnect_req_default(); // this is currently not run - void connect_req_specific(); // this is currently not run - QProcess *icd_stub; - bool connect_iap(Maemo::IcdConnectResult &connect_result, - QString &result, - QString &error, - QString iap=QString()); -}; - - -QString create_error_str(Maemo::Icd &icd) -{ - return icd.error(); -} - - -void Ut_MaemoIcd::init() -{ - icd_stub = new QProcess(this); - icd_stub->setStandardOutputFile("/tmp/ut_maemo_icd.log"); - icd_stub->start("/usr/bin/icd2_stub.py"); - QTest::qWait(1000); - - // Set the statistics - QProcess dbus_send; - dbus_send.start("dbus-send --type=method_call --system " - "--dest=com.nokia.icd2 /com/nokia/icd2 " - "com.nokia.icd2.testing.set_statistics " - "uint32:1024 uint32:256"); - dbus_send.waitForFinished(); - -} - -void Ut_MaemoIcd::cleanup() -{ - icd_stub->terminate(); - icd_stub->waitForFinished(); -} - -void Ut_MaemoIcd::initTestCase() -{ -} - -void Ut_MaemoIcd::cleanupTestCase() -{ -} - -void Ut_MaemoIcd::scan_req() -{ - QList scanned; - QStringList scannedNetworkTypes; - QStringList networkTypesToScan; - QString error; - Maemo::Icd icd(ICD_SHORT_SCAN_TIMEOUT); - - scannedNetworkTypes = icd.scan(ICD_SCAN_REQUEST_ACTIVE, - networkTypesToScan, - scanned, - error); - QVERIFY(error.isEmpty()); - QCOMPARE(scanned.size(), 3); - QVERIFY(scannedNetworkTypes[0] == "WLAN_INFRA"); - QVERIFY(scannedNetworkTypes[1] == "DUN_GSM_PS"); -} - -void Ut_MaemoIcd::scan_cancel_req() -{ - Maemo::Icd icd; - icd.scanCancel(); - // Not much to verify here -} - -bool Ut_MaemoIcd::connect_iap(Maemo::IcdConnectResult &connect_result, - QString &result, - QString &error, - QString iap) -{ - icd_connection_flags flags = ICD_CONNECTION_FLAG_USER_EVENT; - bool st; - Maemo::Icd icd(ICD_SHORT_CONNECT_TIMEOUT); - - if (iap.isEmpty()) { - qDebug() << "connecting to default IAP"; - st = icd.connect(flags, connect_result); - } else { - qDebug() << "connecting to" << iap; - st = icd.connect(flags, iap, result); - } - - error = create_error_str(icd); - return st; -} - -void Ut_MaemoIcd::connect_req_default() -{ - Maemo::IcdConnectResult connect_result; - QString result, error; - bool st; - st = connect_iap(connect_result, result, error); - QVERIFY2(st, error.toAscii().data()); - result = connect_result.connect.network_id.data(); - qDebug() << result; -} - - -void Ut_MaemoIcd::disconnect_req_default() -{ - icd_connection_flags flags = ICD_CONNECTION_FLAG_USER_EVENT; - bool st; - Maemo::Icd icd(ICD_SHORT_CONNECT_TIMEOUT); - icd.disconnect(flags); -} - - -void Ut_MaemoIcd::connect_req_specific() -{ - Maemo::IcdConnectResult connect_result; - QString result; - QString error; - bool st; - st = connect_iap(connect_result, result, error, "wpa2gx2.osso.net"); - QVERIFY2(st, error.toAscii().data()); - qDebug() << result; -} - - -void Ut_MaemoIcd::state_req_all() -{ - QList state_results; - Maemo::Icd icd; - int sig; - sig = icd.state(state_results); - QVERIFY2(sig==1, create_error_str(icd).toAscii().data()); -} - - -void Ut_MaemoIcd::state_req() -{ - Maemo::IcdStateResult state_result; - Maemo::Icd icd; - int sig; - QString service_type, service_id; - QString network_type("WLAN_INFRA"); - QByteArray network_id("wpa2gx2.osso.net"); - sig = icd.state(service_type, 0, service_id, - network_type, (uint)0x17a1, network_id, - state_result); - QVERIFY2(sig==1, create_error_str(icd).toAscii().data()); -} - - -void Ut_MaemoIcd::statistics_req_all() -{ - QList stats_results; - Maemo::Icd icd; - int sig; - QString err; - sig = icd.statistics(stats_results); - err = create_error_str(icd); - if (!err.isEmpty()) - QVERIFY2(sig==1, err.toAscii().data()); - else - QCOMPARE(sig, 1); - - for(int i=0; i addr_results; - Maemo::Icd icd; - int sig; - sig = icd.addrinfo(addr_results); - QVERIFY2(sig==1, create_error_str(icd).toAscii().data()); -} - - -void Ut_MaemoIcd::addrinfo_req() -{ - Maemo::IcdAddressInfoResult addr_result; - Maemo::Icd icd; - int sig; - QString service_type, service_id; - QString network_type("WLAN_INFRA"); - QByteArray network_id("wpa2gx2.osso.net"); - sig = icd.addrinfo(service_type, 0, service_id, - network_type, (uint)0x17a1, network_id, - addr_result); - QVERIFY2(sig==1, create_error_str(icd).toAscii().data()); -} - - -QTEST_MAIN(Ut_MaemoIcd) - -#include "ut_maemo_icd.moc" diff --git a/src/3rdparty/libconninet/tests/ut_proxyconf.cpp b/src/3rdparty/libconninet/tests/ut_proxyconf.cpp deleted file mode 100644 index 1f407f0..0000000 --- a/src/3rdparty/libconninet/tests/ut_proxyconf.cpp +++ /dev/null @@ -1,400 +0,0 @@ -/* - libconninet - Internet Connectivity support library - - Copyright (C) 2010 Nokia Corporation. All rights reserved. - - Contact: Jukka Rissanen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License - version 2.1 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - 02110-1301 USA -*/ - - -#include -#include -#include -#include - -#include "../src/proxyconf.h" - -class Ut_ProxyConf : public QObject -{ - Q_OBJECT - -private Q_SLOTS: - void init(); - void cleanup(); - void initTestCase(); - void cleanupTestCase(); - - // tests without the factory - void proxy_ftp_no_factory_ok_auto(); - void proxy_ftp_no_factory_ok_manual(); - void proxy_http_no_factory_ok_manual(); - void proxy_https_no_factory_ok_manual(); - void proxy_socks_no_factory_ok_manual(); - void proxy_default_no_factory_ok_manual(); - - // tests using the factory - void proxy_ftp_factory_ok_auto(); - void proxy_ftp_factory_ok_manual(); - void proxy_http_factory_ok_manual(); - void proxy_https_factory_ok_manual(); - void proxy_socks_factory_ok_manual(); - void proxy_http_factory_ok_manual_clear(); - void proxy_default_factory_ok_manual(); - void proxy_http_factory_ok_manual_ignore_list(); - void proxy_default_factory_ok_manual_system(); - -private: - Maemo::ProxyConf *pc; -}; - - -void put(QString var, QString type, QString value) -{ - QProcess gconf; - if (value.isEmpty()) - gconf.start(QString("gconftool-2 -u /system/proxy/"+var)); - else - gconf.start(QString("gconftool-2 -s /system/proxy/"+var+" -t "+type+" "+value)); - gconf.waitForFinished(); -} - -void put_http(QString var, QString type, QString value) -{ - QProcess gconf; - if (value.isEmpty()) - gconf.start(QString("gconftool-2 -u /system/http_proxy/"+var)); - else - gconf.start(QString("gconftool-2 -s /system/http_proxy/"+var+" -t "+type+" "+value)); - gconf.waitForFinished(); -} - -void put_list(QString var, QString type, QList value) -{ - QProcess gconf; - QString values = "["; - foreach (QString str, value) - values = values + str + ","; - values.chop(1); - values = values + "]"; - - gconf.start(QString("gconftool-2 -s /system/http_proxy/"+var+" -t list --list-type="+type+" "+values)); - gconf.waitForFinished(); -} - - -void Ut_ProxyConf::init() -{ - put_http("host", "string", "my.proxy.com"); - put_http("port", "int", "8080"); - - QList list; - list.append("foo.bar.com"); - list.append("192.168.19.69"); - list.append("192.168.20.0/24"); - list.append("bar.foo.com"); - put_list("ignore_hosts", "string", list); - put_http("use_http_host", "boolean", "true"); - - put("mode", "string", "auto"); - put("autoconfig_url", "string", "http://foo.bar.com/autoconf"); - put("secure_host", "string", "secure_host.com"); - put("secure_port", "int", "112"); - - put("ftp_host", "string", "ftp.nuukia.com"); - put("ftp_port", "int", "2000"); - put("socks_host", "string", "socks.host.com"); - put("socks_port", "int", "10080"); - put("rtsp_host", "string", "rtsp.voice.com"); - put("rtsp_port", "int", "1554"); - - pc = new Maemo::ProxyConf(); -} - -void Ut_ProxyConf::cleanup() -{ - delete pc; - pc = 0; -} - -void Ut_ProxyConf::initTestCase() -{ -} - -void Ut_ProxyConf::cleanupTestCase() -{ -} - - -void Ut_ProxyConf::proxy_ftp_no_factory_ok_auto() -{ - QList nplist; - QNetworkProxyQuery query = QNetworkProxyQuery(QUrl("ftp://maps.google.com/")); - - nplist = pc->flush(query); - QVERIFY(nplist.length()==0); -} - - -void Ut_ProxyConf::proxy_ftp_no_factory_ok_manual() -{ - QList nplist; - QNetworkProxyQuery query = QNetworkProxyQuery(QUrl("ftp://maps.google.com/")); - - put("mode", "string", "manual"); - - nplist = pc->flush(query); - foreach (QNetworkProxy proxy, nplist) { - qDebug() << "proxy: " << proxy.hostName() << "port" << proxy.port(); - } - QVERIFY(nplist.length()==3); - QVERIFY(nplist.first().type() == QNetworkProxy::FtpCachingProxy); -} - - -void Ut_ProxyConf::proxy_http_no_factory_ok_manual() -{ - QList nplist; - QNetworkProxyQuery query = QNetworkProxyQuery(QUrl("http://maps.google.com/")); - - put("mode", "string", "manual"); - - nplist = pc->flush(query); - foreach (QNetworkProxy proxy, nplist) { - qDebug() << "proxy: " << proxy.hostName() << "port" << proxy.port(); - } - QVERIFY(nplist.length()==3); - QVERIFY(nplist.first().type() == QNetworkProxy::HttpProxy); -} - - -void Ut_ProxyConf::proxy_https_no_factory_ok_manual() -{ - QList nplist; - QNetworkProxyQuery query = QNetworkProxyQuery(QUrl("https://maps.google.com/")); - - put("mode", "string", "manual"); - - nplist = pc->flush(query); - foreach (QNetworkProxy proxy, nplist) { - qDebug() << "proxy: " << proxy.hostName() << "port" << proxy.port(); - } - QVERIFY(nplist.length()==2); - QVERIFY(nplist.first().type() == QNetworkProxy::HttpProxy); -} - - -void Ut_ProxyConf::proxy_socks_no_factory_ok_manual() -{ - QList nplist; - QNetworkProxyQuery query = QNetworkProxyQuery(QUrl("http://maps.google.com/")); - - put("mode", "string", "manual"); - put_http("host", "string", ""); - - nplist = pc->flush(query); - foreach (QNetworkProxy proxy, nplist) { - qDebug() << "proxy: " << proxy.hostName() << "port" << proxy.port(); - } - QVERIFY(nplist.length()==2); - QVERIFY(nplist.first().type() == QNetworkProxy::Socks5Proxy); -} - - -void Ut_ProxyConf::proxy_default_no_factory_ok_manual() -{ - QList nplist; - QNetworkProxyQuery query = QNetworkProxyQuery(QUrl("foobar://maps.google.com/")); - - put("mode", "string", "manual"); - put("socks_host", "string", ""); - put("secure_host", "string", ""); - - nplist = pc->flush(query); - foreach (QNetworkProxy proxy, nplist) { - qDebug() << "proxy: " << proxy.hostName() << "port" << proxy.port(); - } - QVERIFY(nplist.length()==0); -} - - -void Ut_ProxyConf::proxy_ftp_factory_ok_auto() -{ - QNetworkProxyQuery query = QNetworkProxyQuery(QUrl("ftp://maps.google.com/")); - Maemo::ProxyConf::update(); - QList listOfProxies = QNetworkProxyFactory::proxyForQuery(query); - QVERIFY(listOfProxies.length()==1); - QVERIFY(listOfProxies.first().type() == QNetworkProxy::NoProxy); - Maemo::ProxyConf::clear(); -} - - -void Ut_ProxyConf::proxy_ftp_factory_ok_manual() -{ - QNetworkProxyQuery query = QNetworkProxyQuery(QUrl("ftp://maps.google.com/")); - Maemo::ProxyConf::update(); - - put("mode", "string", "manual"); - - QList listOfProxies = QNetworkProxyFactory::proxyForQuery(query); - - foreach (QNetworkProxy proxy, listOfProxies) { - qDebug() << "proxy: " << proxy.hostName() << "port" << proxy.port(); - } - QVERIFY(listOfProxies.length()==3); - QVERIFY(listOfProxies.first().type() == QNetworkProxy::FtpCachingProxy); - Maemo::ProxyConf::clear(); -} - - -void Ut_ProxyConf::proxy_http_factory_ok_manual() -{ - QNetworkProxyQuery query = QNetworkProxyQuery(QUrl("http://maps.google.com/")); - Maemo::ProxyConf::update(); - - put("mode", "string", "manual"); - - QList listOfProxies = QNetworkProxyFactory::proxyForQuery(query); - - foreach (QNetworkProxy proxy, listOfProxies) { - qDebug() << "proxy: " << proxy.hostName() << "port" << proxy.port(); - } - QVERIFY(listOfProxies.length()==3); - QVERIFY(listOfProxies.first().type() == QNetworkProxy::HttpProxy); - Maemo::ProxyConf::clear(); -} - - -void Ut_ProxyConf::proxy_https_factory_ok_manual() -{ - QNetworkProxyQuery query = QNetworkProxyQuery(QUrl("https://maps.google.com/")); - Maemo::ProxyConf::update(); - - put("mode", "string", "manual"); - - QList listOfProxies = QNetworkProxyFactory::proxyForQuery(query); - - foreach (QNetworkProxy proxy, listOfProxies) { - qDebug() << "proxy: " << proxy.hostName() << "port" << proxy.port(); - } - QVERIFY(listOfProxies.length()==2); - QVERIFY(listOfProxies.first().type() == QNetworkProxy::HttpProxy); - Maemo::ProxyConf::clear(); -} - - -void Ut_ProxyConf::proxy_socks_factory_ok_manual() -{ - QNetworkProxyQuery query = QNetworkProxyQuery(QUrl("http://maps.google.com/")); - Maemo::ProxyConf::update(); - - put("mode", "string", "manual"); - put_http("host", "string", ""); - - QList listOfProxies = QNetworkProxyFactory::proxyForQuery(query); - - foreach (QNetworkProxy proxy, listOfProxies) { - qDebug() << "proxy: " << proxy.hostName() << "port" << proxy.port(); - } - QVERIFY(listOfProxies.length()==2); - QVERIFY(listOfProxies.first().type() == QNetworkProxy::Socks5Proxy); - Maemo::ProxyConf::clear(); -} - - -void Ut_ProxyConf::proxy_http_factory_ok_manual_clear() -{ - QNetworkProxyQuery query = QNetworkProxyQuery(QUrl("http://maps.google.com/")); - Maemo::ProxyConf::update(); - - put("mode", "string", "manual"); - put_http("host", "string", "192.168.1.1"); - - QList listOfProxies = QNetworkProxyFactory::proxyForQuery(query); - - foreach (QNetworkProxy proxy, listOfProxies) { - qDebug() << "proxy: " << proxy.hostName() << "port" << proxy.port(); - } - QVERIFY(listOfProxies.length()==3); - QVERIFY(listOfProxies.first().type() == QNetworkProxy::HttpProxy); - - Maemo::ProxyConf::clear(); - listOfProxies = QNetworkProxyFactory::proxyForQuery(query); - QVERIFY(listOfProxies.length()==1); - QVERIFY(listOfProxies.first().type() == QNetworkProxy::NoProxy); -} - - -void Ut_ProxyConf::proxy_default_factory_ok_manual() -{ - QNetworkProxyQuery query = QNetworkProxyQuery(QUrl("foobar://maps.google.com/")); - Maemo::ProxyConf::update(); - - put("mode", "string", "manual"); - put("socks_host", "string", ""); - put("secure_host", "string", ""); - - QList listOfProxies = QNetworkProxyFactory::proxyForQuery(query); - - QVERIFY(listOfProxies.length()==1); - QVERIFY(listOfProxies.first().type() == QNetworkProxy::NoProxy); - Maemo::ProxyConf::clear(); -} - - -void Ut_ProxyConf::proxy_http_factory_ok_manual_ignore_list() -{ - QNetworkProxyQuery query = QNetworkProxyQuery(QUrl("http://192.168.19.70/")); - Maemo::ProxyConf::update(); - - put("mode", "string", "manual"); - - QList listOfProxies = QNetworkProxyFactory::proxyForQuery(query); - - foreach (QNetworkProxy proxy, listOfProxies) { - qDebug() << "proxy: " << proxy.hostName() << "port" << proxy.port(); - } - QVERIFY(listOfProxies.length()==3); - QVERIFY(listOfProxies.first().type() == QNetworkProxy::HttpProxy); - - query = QNetworkProxyQuery(QUrl("http://192.168.20.10/")); - listOfProxies = QNetworkProxyFactory::proxyForQuery(query); - QVERIFY(listOfProxies.length()==1); - QVERIFY(listOfProxies.first().type() == QNetworkProxy::NoProxy); - Maemo::ProxyConf::clear(); -} - - -void Ut_ProxyConf::proxy_default_factory_ok_manual_system() -{ - QNetworkProxyQuery query = QNetworkProxyQuery(QUrl("http://maps.google.com/")); - Maemo::ProxyConf::update(); - - put("mode", "string", "manual"); - - QList listOfProxies = QNetworkProxyFactory::systemProxyForQuery(query); - - QVERIFY(listOfProxies.length()==1); - QVERIFY(listOfProxies.first().type() == QNetworkProxy::NoProxy); - Maemo::ProxyConf::clear(); -} - - - - -QTEST_MAIN(Ut_ProxyConf) - -#include "ut_proxyconf.moc" diff --git a/src/plugins/bearer/icd/dbusdispatcher.cpp b/src/plugins/bearer/icd/dbusdispatcher.cpp new file mode 100644 index 0000000..3d588dc --- /dev/null +++ b/src/plugins/bearer/icd/dbusdispatcher.cpp @@ -0,0 +1,631 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include +#include +#include +#include +#include +#include +#include "dbusdispatcher.h" + +namespace Maemo { + +/*! + \class DBusDispatcher + + \brief DBusDispatcher is a class, which is able to send DBUS method call + messages and receive unicast signals from DBUS object. +*/ + +class DBusDispatcherPrivate +{ +public: + DBusDispatcherPrivate(const QString& service, + const QString& path, + const QString& interface, + const QString& signalPath) + : service(service), path(path), interface(interface), + signalPath(signalPath), connection(0) + { + memset(&signal_vtable, 0, sizeof(signal_vtable)); + } + + ~DBusDispatcherPrivate() + { + foreach(DBusPendingCall *call, pending_calls) { + dbus_pending_call_cancel(call); + dbus_pending_call_unref(call); + } + } + + QString service; + QString path; + QString interface; + QString signalPath; + struct DBusConnection *connection; + QList pending_calls; + struct DBusObjectPathVTable signal_vtable; +}; + +static bool constantVariantList(const QVariantList& variantList) { + // Special case, empty list == empty struct + if (variantList.isEmpty()) { + return false; + } else { + QVariant::Type type = variantList[0].type(); + // Iterate items in the list and check if they are same type + foreach(QVariant variant, variantList) { + if (variant.type() != type) { + return false; + } + } + } + return true; +} + +static QString variantToSignature(const QVariant& argument, + bool constantList = true) { + switch (argument.type()) { + case QVariant::Bool: + return "b"; + case QVariant::ByteArray: + return "ay"; + case QVariant::Char: + return "y"; + case QVariant::Int: + return "i"; + case QVariant::UInt: + return "u"; + case QVariant::StringList: + return "as"; + case QVariant::String: + return "s"; + case QVariant::LongLong: + return "x"; + case QVariant::ULongLong: + return "t"; + case QVariant::List: + { + QString signature; + QVariantList variantList = argument.toList(); + if (!constantList) { + signature += DBUS_STRUCT_BEGIN_CHAR_AS_STRING; + foreach(QVariant listItem, variantList) { + signature += variantToSignature(listItem); + } + signature += DBUS_STRUCT_END_CHAR_AS_STRING; + } else { + if (variantList.isEmpty()) + return ""; + signature = "a" + variantToSignature(variantList[0]); + } + + return signature; + } + default: + qDebug() << "Unsupported variant type: " << argument.type(); + break; + } + + return ""; +} + +static bool appendVariantToDBusMessage(const QVariant& argument, + DBusMessageIter *dbus_iter) { + int idx = 0; + DBusMessageIter array_iter; + QStringList str_list; + dbus_bool_t bool_data; + dbus_int32_t int32_data; + dbus_uint32_t uint32_data; + dbus_int64_t int64_data; + dbus_uint64_t uint64_data; + char *str_data; + char char_data; + + switch (argument.type()) { + + case QVariant::Bool: + bool_data = argument.toBool(); + dbus_message_iter_append_basic(dbus_iter, DBUS_TYPE_BOOLEAN, + &bool_data); + break; + + case QVariant::ByteArray: + str_data = argument.toByteArray().data(); + dbus_message_iter_open_container(dbus_iter, DBUS_TYPE_ARRAY, + DBUS_TYPE_BYTE_AS_STRING, &array_iter); + dbus_message_iter_append_fixed_array(&array_iter, + DBUS_TYPE_BYTE, + &str_data, + argument.toByteArray().size()); + dbus_message_iter_close_container(dbus_iter, &array_iter); + break; + + case QVariant::Char: + char_data = argument.toChar().toAscii(); + dbus_message_iter_append_basic(dbus_iter, DBUS_TYPE_BYTE, + &char_data); + break; + + case QVariant::Int: + int32_data = argument.toInt(); + dbus_message_iter_append_basic(dbus_iter, DBUS_TYPE_INT32, + &int32_data); + break; + + case QVariant::String: + str_data = argument.toString().toLatin1().data(); + dbus_message_iter_append_basic(dbus_iter, DBUS_TYPE_STRING, + &str_data); + break; + + case QVariant::StringList: + str_list = argument.toStringList(); + dbus_message_iter_open_container(dbus_iter, DBUS_TYPE_ARRAY, + "s", &array_iter); + for (idx = 0; idx < str_list.size(); idx++) { + str_data = str_list.at(idx).toLatin1().data(); + dbus_message_iter_append_basic(&array_iter, + DBUS_TYPE_STRING, + &str_data); + } + dbus_message_iter_close_container(dbus_iter, &array_iter); + break; + + case QVariant::UInt: + uint32_data = argument.toUInt(); + dbus_message_iter_append_basic(dbus_iter, DBUS_TYPE_UINT32, + &uint32_data); + break; + + case QVariant::ULongLong: + uint64_data = argument.toULongLong(); + dbus_message_iter_append_basic(dbus_iter, DBUS_TYPE_UINT64, + &uint64_data); + break; + + case QVariant::LongLong: + int64_data = argument.toLongLong(); + dbus_message_iter_append_basic(dbus_iter, DBUS_TYPE_INT64, + &int64_data); + break; + + case QVariant::List: + { + QVariantList variantList = argument.toList(); + bool constantList = constantVariantList(variantList); + DBusMessageIter array_iter; + + // List is mapped either as an DBUS array (all items same type) + // DBUS struct (variable types) depending on constantList + if (constantList) { + // Resolve the signature for the first item + QString signature = ""; + if (!variantList.isEmpty()) { + signature = variantToSignature( + variantList[0], + constantVariantList(variantList[0].toList())); + } + + // Mapped as DBUS array + dbus_message_iter_open_container(dbus_iter, DBUS_TYPE_ARRAY, + signature.toAscii(), + &array_iter); + + foreach(QVariant listItem, variantList) { + appendVariantToDBusMessage(listItem, &array_iter); + } + + dbus_message_iter_close_container(dbus_iter, &array_iter); + } else { + // Mapped as DBUS struct + dbus_message_iter_open_container(dbus_iter, DBUS_TYPE_STRUCT, + NULL, + &array_iter); + + foreach(QVariant listItem, variantList) { + appendVariantToDBusMessage(listItem, &array_iter); + } + + dbus_message_iter_close_container(dbus_iter, &array_iter); + } + + break; + } + default: + qDebug() << "Unsupported variant type: " << argument.type(); + break; + } + + return true; +} + +static QVariant getVariantFromDBusMessage(DBusMessageIter *iter) { + dbus_bool_t bool_data; + dbus_int32_t int32_data; + dbus_uint32_t uint32_data; + dbus_int64_t int64_data; + dbus_uint64_t uint64_data; + char *str_data; + char char_data; + int argtype = dbus_message_iter_get_arg_type(iter); + + switch (argtype) { + + case DBUS_TYPE_BOOLEAN: + { + dbus_message_iter_get_basic(iter, &bool_data); + QVariant variant((bool)bool_data); + return variant; + } + + case DBUS_TYPE_ARRAY: + { + // Handle all arrays here + int elem_type = dbus_message_iter_get_element_type(iter); + DBusMessageIter array_iter; + + dbus_message_iter_recurse(iter, &array_iter); + + if (elem_type == DBUS_TYPE_BYTE) { + QByteArray byte_array; + do { + dbus_message_iter_get_basic(&array_iter, &char_data); + byte_array.append(char_data); + } while (dbus_message_iter_next(&array_iter)); + QVariant variant(byte_array); + return variant; + } else if (elem_type == DBUS_TYPE_STRING) { + QStringList str_list; + do { + dbus_message_iter_get_basic(&array_iter, &str_data); + str_list.append(str_data); + } while (dbus_message_iter_next(&array_iter)); + QVariant variant(str_list); + return variant; + } else { + QVariantList variantList; + do { + variantList << getVariantFromDBusMessage(&array_iter); + } while (dbus_message_iter_next(&array_iter)); + QVariant variant(variantList); + return variant; + } + break; + } + + case DBUS_TYPE_BYTE: + { + dbus_message_iter_get_basic(iter, &char_data); + QChar ch(char_data); + QVariant variant(ch); + return variant; + } + + case DBUS_TYPE_INT32: + { + dbus_message_iter_get_basic(iter, &int32_data); + QVariant variant((int)int32_data); + return variant; + } + + case DBUS_TYPE_UINT32: + { + dbus_message_iter_get_basic(iter, &uint32_data); + QVariant variant((uint)uint32_data); + return variant; + } + + case DBUS_TYPE_STRING: + { + dbus_message_iter_get_basic(iter, &str_data); + QString str(str_data); + QVariant variant(str); + return variant; + } + + case DBUS_TYPE_INT64: + { + dbus_message_iter_get_basic(iter, &int64_data); + QVariant variant((qlonglong)int64_data); + return variant; + } + + case DBUS_TYPE_UINT64: + { + dbus_message_iter_get_basic(iter, &uint64_data); + QVariant variant((qulonglong)uint64_data); + return variant; + } + + case DBUS_TYPE_STRUCT: + { + // Handle all structs here + DBusMessageIter struct_iter; + dbus_message_iter_recurse(iter, &struct_iter); + + QVariantList variantList; + do { + variantList << getVariantFromDBusMessage(&struct_iter); + } while (dbus_message_iter_next(&struct_iter)); + QVariant variant(variantList); + return variant; + } + + default: + qDebug() << "Unsupported DBUS type: " << argtype; + } + + return QVariant(); +} + +static DBusHandlerResult signalHandler (DBusConnection *connection, + DBusMessage *message, + void *object_ref) { + (void)connection; + QString interface; + QString signal; + DBusDispatcher *dispatcher = (DBusDispatcher *)object_ref; + + if (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_SIGNAL) { + interface = dbus_message_get_interface(message); + signal = dbus_message_get_member(message); + + QList arglist; + DBusMessageIter dbus_iter; + + if (dbus_message_iter_init(message, &dbus_iter)) { + // Read return arguments + while (dbus_message_iter_get_arg_type (&dbus_iter) != DBUS_TYPE_INVALID) { + arglist << getVariantFromDBusMessage(&dbus_iter); + dbus_message_iter_next(&dbus_iter); + } + } + + dispatcher->emitSignalReceived(interface, signal, arglist); + return DBUS_HANDLER_RESULT_HANDLED; + } + (void)message; + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; +} + +DBusDispatcher::DBusDispatcher(const QString& service, + const QString& path, + const QString& interface, + QObject *parent) + : QObject(parent), + d_ptr(new DBusDispatcherPrivate(service, path, interface, path)) { + setupDBus(); +} + +DBusDispatcher::DBusDispatcher(const QString& service, + const QString& path, + const QString& interface, + const QString& signalPath, + QObject *parent) + : QObject(parent), + d_ptr(new DBusDispatcherPrivate(service, path, interface, signalPath)) { + setupDBus(); +} + +DBusDispatcher::~DBusDispatcher() +{ + if (d_ptr->connection) { + dbus_connection_close(d_ptr->connection); + dbus_connection_unref(d_ptr->connection); + } + delete d_ptr; +} + +void DBusDispatcher::setupDBus() +{ + d_ptr->connection = dbus_bus_get_private(DBUS_BUS_SYSTEM, NULL); + + if (d_ptr->connection == NULL) + qDebug() << "Unable to get DBUS connection!"; + else { + d_ptr->signal_vtable.message_function = signalHandler; + + dbus_connection_set_exit_on_disconnect(d_ptr->connection, FALSE); + dbus_connection_setup_with_g_main(d_ptr->connection, NULL); + dbus_connection_register_object_path(d_ptr->connection, + d_ptr->signalPath.toLatin1(), + &d_ptr->signal_vtable, + this); + } +} + +static DBusMessage *prepareDBusCall(const QString& service, + const QString& path, + const QString& interface, + const QString& method, + const QVariant& arg1 = QVariant(), + const QVariant& arg2 = QVariant(), + const QVariant& arg3 = QVariant(), + const QVariant& arg4 = QVariant(), + const QVariant& arg5 = QVariant(), + const QVariant& arg6 = QVariant(), + const QVariant& arg7 = QVariant(), + const QVariant& arg8 = QVariant()) +{ + DBusMessage *message = dbus_message_new_method_call(service.toLatin1(), + path.toLatin1(), + interface.toLatin1(), + method.toLatin1()); + DBusMessageIter dbus_iter; + + // Append variants to DBUS message + QList arglist; + if (arg1.isValid()) arglist << arg1; + if (arg2.isValid()) arglist << arg2; + if (arg3.isValid()) arglist << arg3; + if (arg4.isValid()) arglist << arg4; + if (arg5.isValid()) arglist << arg5; + if (arg6.isValid()) arglist << arg6; + if (arg7.isValid()) arglist << arg7; + if (arg8.isValid()) arglist << arg8; + + dbus_message_iter_init_append (message, &dbus_iter); + + while (!arglist.isEmpty()) { + QVariant argument = arglist.takeFirst(); + appendVariantToDBusMessage(argument, &dbus_iter); + } + + return message; +} + +QList DBusDispatcher::call(const QString& method, + const QVariant& arg1, + const QVariant& arg2, + const QVariant& arg3, + const QVariant& arg4, + const QVariant& arg5, + const QVariant& arg6, + const QVariant& arg7, + const QVariant& arg8) { + DBusMessageIter dbus_iter; + DBusMessage *message = prepareDBusCall(d_ptr->service, d_ptr->path, + d_ptr->interface, method, + arg1, arg2, arg3, arg4, arg5, + arg6, arg7, arg8); + DBusMessage *reply = dbus_connection_send_with_reply_and_block( + d_ptr->connection, + message, -1, NULL); + dbus_message_unref(message); + + QList replylist; + if (reply != NULL && dbus_message_iter_init(reply, &dbus_iter)) { + // Read return arguments + while (dbus_message_iter_get_arg_type (&dbus_iter) != DBUS_TYPE_INVALID) { + replylist << getVariantFromDBusMessage(&dbus_iter); + dbus_message_iter_next(&dbus_iter); + } + } + if (reply != NULL) dbus_message_unref(reply); + return replylist; +} + +class PendingCallInfo { +public: + QString method; + DBusDispatcher *dispatcher; + DBusDispatcherPrivate *priv; +}; + +static void freePendingCallInfo(void *memory) { + PendingCallInfo *info = (PendingCallInfo *)memory; + delete info; +} + +static void pendingCallFunction (DBusPendingCall *pending, + void *memory) { + PendingCallInfo *info = (PendingCallInfo *)memory; + QString errorStr; + QList replyList; + DBusMessage *reply = dbus_pending_call_steal_reply (pending); + + Q_ASSERT(reply != NULL); + + if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR) { + errorStr = dbus_message_get_error_name (reply); + } else { + DBusMessageIter dbus_iter; + dbus_message_iter_init(reply, &dbus_iter); + // Read return arguments + while (dbus_message_iter_get_arg_type (&dbus_iter) != DBUS_TYPE_INVALID) { + replyList << getVariantFromDBusMessage(&dbus_iter); + dbus_message_iter_next(&dbus_iter); + } + } + + info->priv->pending_calls.removeOne(pending); + info->dispatcher->emitCallReply(info->method, replyList, errorStr); + dbus_message_unref(reply); + dbus_pending_call_unref(pending); +} + +bool DBusDispatcher::callAsynchronous(const QString& method, + const QVariant& arg1, + const QVariant& arg2, + const QVariant& arg3, + const QVariant& arg4, + const QVariant& arg5, + const QVariant& arg6, + const QVariant& arg7, + const QVariant& arg8) { + DBusMessage *message = prepareDBusCall(d_ptr->service, d_ptr->path, + d_ptr->interface, method, + arg1, arg2, arg3, arg4, arg5, + arg6, arg7, arg8); + DBusPendingCall *call = NULL; + dbus_bool_t ret = dbus_connection_send_with_reply(d_ptr->connection, + message, &call, -1); + PendingCallInfo *info = new PendingCallInfo; + info->method = method; + info->dispatcher = this; + info->priv = d_ptr; + + dbus_pending_call_set_notify(call, pendingCallFunction, info, freePendingCallInfo); + d_ptr->pending_calls.append(call); + return (bool)ret; +} + +void DBusDispatcher::emitSignalReceived(const QString& interface, + const QString& signal, + const QList& args) { + emit signalReceived(interface, signal, args); } + +void DBusDispatcher::emitCallReply(const QString& method, + const QList& args, + const QString& error) { + emit callReply(method, args, error); } + +void DBusDispatcher::synchronousDispatch(int timeout_ms) +{ + dbus_connection_read_write_dispatch(d_ptr->connection, timeout_ms); +} + +} // Maemo namespace + diff --git a/src/plugins/bearer/icd/dbusdispatcher.h b/src/plugins/bearer/icd/dbusdispatcher.h new file mode 100644 index 0000000..6f2f347 --- /dev/null +++ b/src/plugins/bearer/icd/dbusdispatcher.h @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef DBUSDISPATCHER_H +#define DBUSDISPATCHER_H + +#include +#include + +namespace Maemo { + +class DBusDispatcherPrivate; +class DBusDispatcher : public QObject +{ + Q_OBJECT + +public: + DBusDispatcher(const QString& service, + const QString& path, + const QString& interface, + QObject *parent = 0); + DBusDispatcher(const QString& service, + const QString& path, + const QString& interface, + const QString& signalPath, + QObject *parent = 0); + ~DBusDispatcher(); + + QList call(const QString& method, + const QVariant& arg1 = QVariant(), + const QVariant& arg2 = QVariant(), + const QVariant& arg3 = QVariant(), + const QVariant& arg4 = QVariant(), + const QVariant& arg5 = QVariant(), + const QVariant& arg6 = QVariant(), + const QVariant& arg7 = QVariant(), + const QVariant& arg8 = QVariant()); + bool callAsynchronous(const QString& method, + const QVariant& arg1 = QVariant(), + const QVariant& arg2 = QVariant(), + const QVariant& arg3 = QVariant(), + const QVariant& arg4 = QVariant(), + const QVariant& arg5 = QVariant(), + const QVariant& arg6 = QVariant(), + const QVariant& arg7 = QVariant(), + const QVariant& arg8 = QVariant()); + void emitSignalReceived(const QString& interface, + const QString& signal, + const QList& args); + void emitCallReply(const QString& method, + const QList& args, + const QString& error = ""); + void synchronousDispatch(int timeout_ms); + +Q_SIGNALS: + void signalReceived(const QString& interface, + const QString& signal, + const QList& args); + void callReply(const QString& method, + const QList& args, + const QString& error); + +protected: + void setupDBus(); + +private: + DBusDispatcherPrivate *d_ptr; +}; + +} // Maemo namespace + +#endif diff --git a/src/plugins/bearer/icd/iapconf.cpp b/src/plugins/bearer/icd/iapconf.cpp new file mode 100644 index 0000000..ddd9fc2 --- /dev/null +++ b/src/plugins/bearer/icd/iapconf.cpp @@ -0,0 +1,245 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include +#include +#include + +#include "iapconf.h" + +#define QSTRING_TO_CONST_CSTR(str) \ + str.toUtf8().constData() + +namespace Maemo { + +class IAPConfPrivate { +public: + ConnSettings *settings; + + ConnSettingsValue *variantToValue(const QVariant &variant); + QVariant valueToVariant(ConnSettingsValue *value); +}; + +ConnSettingsValue *IAPConfPrivate::variantToValue(const QVariant &variant) +{ + // Convert variant to ConnSettingsValue + ConnSettingsValue *value = conn_settings_value_new(); + if (value == 0) { + qWarning("IAPConf: Unable to create new ConnSettingsValue"); + return 0; + } + + switch(variant.type()) { + + case QVariant::Invalid: + value->type = CONN_SETTINGS_VALUE_INVALID; + break; + + case QVariant::String: { + char *valueStr = strdup(QSTRING_TO_CONST_CSTR(variant.toString())); + value->type = CONN_SETTINGS_VALUE_STRING; + value->value.string_val = valueStr; + break; + } + + case QVariant::Int: + value->type = CONN_SETTINGS_VALUE_INT; + value->value.int_val = variant.toInt(); + break; + + case QMetaType::Float: + case QVariant::Double: + value->type = CONN_SETTINGS_VALUE_DOUBLE; + value->value.double_val = variant.toDouble(); + break; + + case QVariant::Bool: + value->type = CONN_SETTINGS_VALUE_BOOL; + value->value.bool_val = variant.toBool() ? 1 : 0; + break; + + case QVariant::ByteArray: { + QByteArray array = variant.toByteArray(); + value->type = CONN_SETTINGS_VALUE_BYTE_ARRAY; + value->value.byte_array.len = array.size(); + value->value.byte_array.val = (unsigned char *)malloc(array.size()); + memcpy(value->value.byte_array.val, array.constData(), array.size()); + break; + } + + case QVariant::List: { + QVariantList list = variant.toList(); + ConnSettingsValue **list_val = (ConnSettingsValue **)malloc( + (list.size() + 1) * sizeof(ConnSettingsValue *)); + + for (int idx = 0; idx < list.size(); idx++) { + list_val[idx] = variantToValue(list.at(idx)); + } + list_val[list.size()] = 0; + + value->type = CONN_SETTINGS_VALUE_LIST; + value->value.list_val = list_val; + break; + } + + default: + qWarning("IAPConf: Can not handle QVariant of type %d", + variant.type()); + conn_settings_value_destroy(value); + return 0; + } + + return value; +} + +QVariant IAPConfPrivate::valueToVariant(ConnSettingsValue *value) +{ + if (value == 0 || value->type == CONN_SETTINGS_VALUE_INVALID) { + return QVariant(); + } + + switch(value->type) { + + case CONN_SETTINGS_VALUE_BOOL: + return QVariant(value->value.bool_val ? true : false); + + case CONN_SETTINGS_VALUE_STRING: + return QVariant(QString(value->value.string_val)); + + case CONN_SETTINGS_VALUE_DOUBLE: + return QVariant(value->value.double_val); + + case CONN_SETTINGS_VALUE_INT: + return QVariant(value->value.int_val); + + case CONN_SETTINGS_VALUE_LIST: { + // At least with GConf backend connsettings returns byte array as list + // of ints, first check for that case + if (value->value.list_val && value->value.list_val[0]) { + bool canBeConvertedToByteArray = true; + for (int idx = 0; value->value.list_val[idx]; idx++) { + ConnSettingsValue *val = value->value.list_val[idx]; + if (val->type != CONN_SETTINGS_VALUE_INT + || val->value.int_val > 255 + || val->value.int_val < 0) { + canBeConvertedToByteArray = false; + break; + } + } + + if (canBeConvertedToByteArray) { + QByteArray array; + for (int idx = 0; value->value.list_val[idx]; idx++) { + array.append(value->value.list_val[idx]->value.int_val); + } + return array; + } + + // Create normal list + QVariantList list; + for (int idx = 0; value->value.list_val[idx]; idx++) { + list.append(valueToVariant(value->value.list_val[idx])); + } + return list; + } + } + + case CONN_SETTINGS_VALUE_BYTE_ARRAY: + return QByteArray::fromRawData((char *)value->value.byte_array.val, + value->value.byte_array.len); + + default: + return QVariant(); + } +} + +// Public class implementation + +IAPConf::IAPConf(const QString &iap_id) + : d_ptr(new IAPConfPrivate) +{ + d_ptr->settings = conn_settings_open(CONN_SETTINGS_CONNECTION, + QSTRING_TO_CONST_CSTR(iap_id)); + if (d_ptr->settings == 0) { + qWarning("IAPConf: Unable to open ConnSettings for %s", + QSTRING_TO_CONST_CSTR(iap_id)); + } +} + +IAPConf::~IAPConf() +{ + conn_settings_close(d_ptr->settings); + delete d_ptr; +} + + +QVariant IAPConf::value(const QString& key) const +{ + ConnSettingsValue *val = conn_settings_get(d_ptr->settings, + QSTRING_TO_CONST_CSTR(key)); + + QVariant variant = d_ptr->valueToVariant(val); + conn_settings_value_destroy(val); + return variant; +} + + +void IAPConf::getAll(QList &all_iaps, bool return_path) +{ + Q_UNUSED(return_path); // We don't use return path currently + + // Go through all available connections and add them to the list + char **ids = conn_settings_list_ids(CONN_SETTINGS_CONNECTION); + if (ids == 0) { + // No ids found - nothing to do + return; + } + + for (int idx = 0; ids[idx]; idx++) { + all_iaps.append(QString(ids[idx])); + free(ids[idx]); + } + free(ids); +} + + +} // namespace Maemo diff --git a/src/plugins/bearer/icd/iapconf.h b/src/plugins/bearer/icd/iapconf.h new file mode 100644 index 0000000..9c4ddcb --- /dev/null +++ b/src/plugins/bearer/icd/iapconf.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef IAPCONF_H +#define IAPCONF_H + +#include +#include + +namespace Maemo { + +class IAPConfPrivate; +class IAPConf { +public: + IAPConf(const QString &iap_id); + virtual ~IAPConf(); + + /** + Get one IAP value. + */ + QVariant value(const QString& key) const; + + /** + Return all the IAPs found in the system. If return_path is true, + then do not strip the IAP path away. + */ + static void getAll(QList &all_iaps, bool return_path=false); + +private: + IAPConfPrivate *d_ptr; +}; + +} // namespace Maemo + +#endif diff --git a/src/plugins/bearer/icd/iapmonitor.cpp b/src/plugins/bearer/icd/iapmonitor.cpp new file mode 100644 index 0000000..6138e7b --- /dev/null +++ b/src/plugins/bearer/icd/iapmonitor.cpp @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include + +#include +#include "iapmonitor.h" + +namespace Maemo { + + +void conn_settings_notify_func (ConnSettingsType type, + const char *id, + const char *key, + ConnSettingsValue *value, + void *user_data); + +class IAPMonitorPrivate { +private: + IAPMonitor *monitor; + ConnSettings *settings; + +public: + + IAPMonitorPrivate(IAPMonitor *monitor) + : monitor(monitor) + { + settings = conn_settings_open(CONN_SETTINGS_CONNECTION, NULL); + conn_settings_add_notify( + settings, + (ConnSettingsNotifyFunc *)conn_settings_notify_func, + this); + } + + ~IAPMonitorPrivate() + { + conn_settings_del_notify(settings); + conn_settings_close(settings); + } + + void iapAdded(const QString &iap) + { + monitor->iapAdded(iap); + } + + void iapRemoved(const QString &iap) + { + monitor->iapRemoved(iap); + } +}; + +void conn_settings_notify_func (ConnSettingsType type, + const char *id, + const char *key, + ConnSettingsValue *value, + void *user_data) +{ + if (type != CONN_SETTINGS_CONNECTION) return; + IAPMonitorPrivate *priv = (IAPMonitorPrivate *)user_data; + + QString iapId(key); + iapId = iapId.split("/")[0]; + if (value != 0) { + priv->iapAdded(iapId); + } else if (iapId == QString(key)) { + // IAP is removed only when the directory gets removed + priv->iapRemoved(iapId); + } +} + +IAPMonitor::IAPMonitor() + : d_ptr(new IAPMonitorPrivate(this)) +{ +} + +IAPMonitor::~IAPMonitor() +{ + delete d_ptr; +} + +void IAPMonitor::iapAdded(const QString &id) +{ + // By default do nothing +} + +void IAPMonitor::iapRemoved(const QString &id) +{ + // By default do nothing +} + +} // namespace Maemo diff --git a/src/plugins/bearer/icd/iapmonitor.h b/src/plugins/bearer/icd/iapmonitor.h new file mode 100644 index 0000000..21ad3bc --- /dev/null +++ b/src/plugins/bearer/icd/iapmonitor.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef IAPMONITOR_H +#define IAPMONITOR_H + +#include + +namespace Maemo { + +class IAPMonitorPrivate; +class IAPMonitor { +public: + IAPMonitor(); + ~IAPMonitor(); + +protected: + virtual void iapAdded(const QString &id); + virtual void iapRemoved(const QString &id); + +private: + IAPMonitorPrivate *d_ptr; + Q_DECLARE_PRIVATE(IAPMonitor); +}; + +} // namespace Maemo + +#endif // IAPMONITOR_H + diff --git a/src/plugins/bearer/icd/icd.pro b/src/plugins/bearer/icd/icd.pro index b2c58e9..464cc1c 100644 --- a/src/plugins/bearer/icd/icd.pro +++ b/src/plugins/bearer/icd/icd.pro @@ -7,15 +7,25 @@ QMAKE_CXXFLAGS *= $$QT_CFLAGS_DBUS $$QT_CFLAGS_CONNSETTINGS LIBS += $$QT_LIBS_CONNSETTINGS HEADERS += qicdengine.h \ - qnetworksession_impl.h + qnetworksession_impl.h \ + dbusdispatcher.h \ + iapconf.h \ + iapmonitor.h \ + maemo_icd.h \ + proxyconf.h \ + wlan-utils.h SOURCES += main.cpp \ qicdengine.cpp \ - qnetworksession_impl.cpp + qnetworksession_impl.cpp \ + dbusdispatcher.cpp \ + iapmonitor.cpp \ + iapconf.cpp \ + maemo_icd.cpp \ + proxyconf.cpp #DEFINES += BEARER_MANAGEMENT_DEBUG -include(../../../3rdparty/libconninet.pri) include(../../../3rdparty/libgq.pri) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer diff --git a/src/plugins/bearer/icd/maemo_icd.cpp b/src/plugins/bearer/icd/maemo_icd.cpp new file mode 100644 index 0000000..eb093fe --- /dev/null +++ b/src/plugins/bearer/icd/maemo_icd.cpp @@ -0,0 +1,849 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include "maemo_icd.h" +#include "dbusdispatcher.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace Maemo { + +#undef PRINT_DEBUGINFO +#ifdef PRINT_DEBUGINFO + static FILE *fdebug = NULL; +#define PDEBUG(fmt, args...) \ + do { \ + struct timeval tv; \ + gettimeofday(&tv, 0); \ + fprintf(fdebug, "DEBUG[%d]:%ld.%ld:%s:%s():%d: " fmt, \ + getpid(), \ + tv.tv_sec, tv.tv_usec, \ + __FILE__, __FUNCTION__, __LINE__, args); \ + fflush(fdebug); \ + } while(0) +#else +#define PDEBUG(fmt...) +#endif + + +class IcdPrivate +{ +public: + IcdPrivate(Icd *myfriend) + { + init(10000, IcdNewDbusInterface, myfriend); + } + + IcdPrivate(unsigned int timeout, Icd *myfriend) + { + init(timeout, IcdNewDbusInterface, myfriend); + } + + IcdPrivate(unsigned int timeout, IcdDbusInterfaceVer ver, Icd *myfriend) + { + /* Note that the old Icd interface is currently disabled and + * the new one is always used. + */ + init(timeout, IcdNewDbusInterface, myfriend); + } + + ~IcdPrivate() + { + QObject::disconnect(mDBus, + SIGNAL(signalReceived(const QString&, + const QString&, + const QList&)), + icd, + SLOT(icdSignalReceived(const QString&, + const QString&, + const QList&))); + + QObject::disconnect(mDBus, + SIGNAL(callReply(const QString&, + const QList&, + const QString&)), + icd, + SLOT(icdCallReply(const QString&, + const QList&, + const QString&))); + + delete mDBus; + mDBus = 0; + } + + /* Icd2 dbus API functions */ + QStringList scan(icd_scan_request_flags flags, + QStringList &network_types, + QList& scan_results, + QString& error); + + uint state(QString& service_type, uint service_attrs, + QString& service_id, QString& network_type, + uint network_attrs, QByteArray& network_id, + IcdStateResult &state_result); + + uint addrinfo(QString& service_type, uint service_attrs, + QString& service_id, QString& network_type, + uint network_attrs, QByteArray& network_id, + IcdAddressInfoResult& addr_result); + + uint state(QList& state_results); + uint statistics(QList& stats_results); + uint addrinfo(QList& addr_results); + + void signalReceived(const QString& interface, + const QString& signal, + const QList& args); + void callReply(const QString& method, + const QList& args, + const QString& error); + +public: + DBusDispatcher *mDBus; + QString mMethod; + QString mInterface; + QString mSignal; + QString mError; + QList mArgs; + QList receivedSignals; + unsigned int timeout; + IcdDbusInterfaceVer icd_dbus_version; + Icd *icd; + + void init(unsigned int dbus_timeout, IcdDbusInterfaceVer ver, + Icd *myfriend) + { + if (ver == IcdNewDbusInterface) { + mDBus = new DBusDispatcher(ICD_DBUS_API_INTERFACE, + ICD_DBUS_API_PATH, + ICD_DBUS_API_INTERFACE); + } else { + mDBus = new DBusDispatcher(ICD_DBUS_SERVICE, + ICD_DBUS_PATH, + ICD_DBUS_INTERFACE); + } + icd_dbus_version = ver; + + /* This connect has a side effect as it means that only one + * Icd object can exists in one time. This should be fixed! + */ + QObject::connect(mDBus, + SIGNAL(signalReceived(const QString&, + const QString&, + const QList&)), + myfriend, + SLOT(icdSignalReceived(const QString&, + const QString&, + const QList&))); + + QObject::connect(mDBus, + SIGNAL(callReply(const QString&, + const QList&, + const QString&)), + myfriend, + SLOT(icdCallReply(const QString&, + const QList&, + const QString&))); + + icd = myfriend; + timeout = dbus_timeout; + +#ifdef PRINT_DEBUGINFO + if (!fdebug) { + fdebug = fopen("/tmp/maemoicd.log", "a+"); + } + PDEBUG("created %s\n", "IcdPrivate"); +#endif + } + + void clearState() + { + mMethod.clear(); + mInterface.clear(); + mSignal.clear(); + mError.clear(); + mArgs.clear(); + receivedSignals.clear(); + } + + bool doState(); +}; + + +void IcdPrivate::signalReceived(const QString& interface, + const QString& signal, + const QList& args) +{ + // Signal handler, which simply records what has been signalled + mInterface = interface; + mSignal = signal; + mArgs = args; + + //qDebug() << "signal" << signal << "received:" << args; + receivedSignals << QVariant(interface) << QVariant(signal) << QVariant(args); +} + + +void IcdPrivate::callReply(const QString& method, + const QList& /*args*/, + const QString& error) +{ + mMethod = method; + mError = error; +} + + +static void get_scan_result(QList& args, + IcdScanResult& ret) +{ + int i=0; + + if (args.isEmpty()) + return; + + ret.status = args[i++].toUInt(); + ret.timestamp = args[i++].toUInt(); + ret.scan.service_type = args[i++].toString(); + ret.service_name = args[i++].toString(); + ret.scan.service_attrs = args[i++].toUInt(); + ret.scan.service_id = args[i++].toString(); + ret.service_priority = args[i++].toInt(); + ret.scan.network_type = args[i++].toString(); + ret.network_name = args[i++].toString(); + ret.scan.network_attrs = args[i++].toUInt(); + ret.scan.network_id = args[i++].toByteArray(); + ret.network_priority = args[i++].toInt(); + ret.signal_strength = args[i++].toInt(); + ret.station_id = args[i++].toString(); + ret.signal_dB = args[i++].toInt(); +} + + +QStringList IcdPrivate::scan(icd_scan_request_flags flags, + QStringList &network_types, + QList& scan_results, + QString& error) +{ + QStringList scanned_types; + QTimer timer; + QVariant reply; + QVariantList vl; + bool last_result = false; + IcdScanResult result; + int all_waited; + + clearState(); + reply = mDBus->call(ICD_DBUS_API_SCAN_REQ, (uint)flags); + if (reply.type() != QVariant::List) + return scanned_types; + vl = reply.toList(); + if (vl.isEmpty()) { + error = "Scan did not return anything."; + return scanned_types; + } + reply = vl.first(); + scanned_types = reply.toStringList(); + //qDebug() << "Scanning:" << scanned_types; + all_waited = scanned_types.size(); + + timer.setSingleShot(true); + timer.start(timeout); + + scan_results.clear(); + while (!last_result) { + while (timer.isActive() && mInterface.isEmpty() && mError.isEmpty()) { + QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); + } + + if (!timer.isActive()) { + //qDebug() << "Timeout happened"; + break; + } + + if (mSignal != ICD_DBUS_API_SCAN_SIG) { + //qDebug() << "Received" << mSignal << "while waiting" << ICD_DBUS_API_SCAN_SIG << ", ignoring"; + mInterface.clear(); + continue; + } + + if (mError.isEmpty()) { + QString msgInterface = receivedSignals.takeFirst().toString(); + QString msgSignal = receivedSignals.takeFirst().toString(); + QList msgArgs = receivedSignals.takeFirst().toList(); + //qDebug() << "Signal" << msgSignal << "received."; + //qDebug() << "Params:" << msgArgs; + + while (!msgSignal.isEmpty()) { + get_scan_result(msgArgs, result); + +#if 0 + qDebug() << "Received: " << + "status =" << result.status << + ", timestamp =" << result.timestamp << + ", service_type =" << result.scan.service_type << + ", service_name =" << result.service_name << + ", service_attrs =" << result.scan.service_attrs << + ", service_id =" << result.scan.service_id << + ", service_priority =" << result.service_priority << + ", network_type =" << result.scan.network_type << + ", network_name =" << result.network_name << + ", network_attrs =" << result.scan.network_attrs << + ", network_id =" << "-" << + ", network_priority =" << result.network_priority << + ", signal_strength =" << result.signal_strength << + ", station_id =" << result.station_id << + ", signal_dB =" << result.signal_dB; +#endif + + if (result.status == ICD_SCAN_COMPLETE) { + //qDebug() << "waited =" << all_waited; + if (--all_waited == 0) { + last_result = true; + break; + } + } else + scan_results << result; + + if (receivedSignals.isEmpty()) + break; + + msgInterface = receivedSignals.takeFirst().toString(); + msgSignal = receivedSignals.takeFirst().toString(); + msgArgs = receivedSignals.takeFirst().toList(); + } + mInterface.clear(); + + } else { + qWarning() << "Error while scanning:" << mError; + break; + } + } + timer.stop(); + + error = mError; + return scanned_types; +} + + +static void get_state_all_result(QList& args, + IcdStateResult& ret) +{ + int i=0; + + ret.params.service_type = args[i++].toString(); + ret.params.service_attrs = args[i++].toUInt(); + ret.params.service_id = args[i++].toString(); + ret.params.network_type = args[i++].toString(); + ret.params.network_attrs = args[i++].toUInt(); + ret.params.network_id = args[i++].toByteArray(); + ret.error = args[i++].toString(); + ret.state = args[i++].toInt(); +} + + +static void get_state_all_result2(QList& args, + IcdStateResult& ret) +{ + int i=0; + + ret.params.network_type = args[i++].toString(); + ret.state = args[i++].toInt(); + + // Initialize the other values so that the caller can + // notice we only returned partial status + ret.params.service_type = QString(); + ret.params.service_attrs = 0; + ret.params.service_id = QString(); + ret.params.network_attrs = 0; + ret.params.network_id = QByteArray(); + ret.error = QString(); +} + + +uint IcdPrivate::state(QString& service_type, uint service_attrs, + QString& service_id, QString& network_type, + uint network_attrs, QByteArray& network_id, + IcdStateResult& state_result) +{ + QTimer timer; + QVariant reply; + uint total_signals; + QVariantList vl; + + clearState(); + + reply = mDBus->call(ICD_DBUS_API_STATE_REQ, + service_type, service_attrs, service_id, + network_type, network_attrs, network_id); + if (reply.type() != QVariant::List) + return 0; + vl = reply.toList(); + if (vl.isEmpty()) + return 0; + reply = vl.first(); + total_signals = reply.toUInt(); + if (!total_signals) + return 0; + + timer.setSingleShot(true); + timer.start(timeout); + + mInterface.clear(); + while (timer.isActive() && mInterface.isEmpty()) { + QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); + + if (mSignal != ICD_DBUS_API_STATE_SIG) { + mInterface.clear(); + continue; + } + } + + timer.stop(); + + if (mError.isEmpty()) { + if (!mArgs.isEmpty()) { + if (mArgs.size()>2) + get_state_all_result(mArgs, state_result); + else { + // We are not connected as we did not get the status we asked + return 0; + } + } + } else { + qWarning() << "Error:" << mError; + } + + // The returned value should be one because we asked for one state + return total_signals; +} + + +/* Special version of the state() call which does not call event loop. + * Needed in order to fix NB#175098 where Qt4.7 webkit crashes because event + * loop is run when webkit does not expect it. This function is called from + * bearer management API syncStateWithInterface() in QNetworkSession + * constructor. + */ +uint IcdPrivate::state(QList& state_results) +{ + QVariant reply; + QVariantList vl; + uint signals_left, total_signals; + IcdStateResult result; + time_t started; + int timeout_secs = timeout / 1000; + + PDEBUG("%s\n", "state_results"); + + clearState(); + reply = mDBus->call(ICD_DBUS_API_STATE_REQ); + if (reply.type() != QVariant::List) + return 0; + vl = reply.toList(); + if (vl.isEmpty()) + return 0; + reply = vl.first(); + signals_left = total_signals = reply.toUInt(); + if (!signals_left) + return 0; + + started = time(0); + state_results.clear(); + mError.clear(); + while (signals_left) { + mInterface.clear(); + while ((time(0)<=(started+timeout_secs)) && mInterface.isEmpty()) { + mDBus->synchronousDispatch(1000); + } + + if (time(0)>(started+timeout_secs)) { + total_signals = 0; + break; + } + + if (mSignal != ICD_DBUS_API_STATE_SIG) { + continue; + } + + if (mError.isEmpty()) { + if (!mArgs.isEmpty()) { + if (mArgs.size()==2) + get_state_all_result2(mArgs, result); + else + get_state_all_result(mArgs, result); + state_results << result; + } + signals_left--; + } else { + qWarning() << "Error:" << mError; + break; + } + } + + PDEBUG("total_signals=%d\n", total_signals); + return total_signals; +} + + +static void get_statistics_all_result(QList& args, + IcdStatisticsResult& ret) +{ + int i=0; + + if (args.isEmpty()) + return; + + ret.params.service_type = args[i++].toString(); + ret.params.service_attrs = args[i++].toUInt(); + ret.params.service_id = args[i++].toString(); + ret.params.network_type = args[i++].toString(); + ret.params.network_attrs = args[i++].toUInt(); + ret.params.network_id = args[i++].toByteArray(); + ret.time_active = args[i++].toUInt(); + ret.signal_strength = (enum icd_nw_levels)args[i++].toUInt(); + ret.bytes_sent = args[i++].toUInt(); + ret.bytes_received = args[i++].toUInt(); +} + + +uint IcdPrivate::statistics(QList& stats_results) +{ + QTimer timer; + QVariant reply; + QVariantList vl; + uint signals_left, total_signals; + IcdStatisticsResult result; + + clearState(); + reply = mDBus->call(ICD_DBUS_API_STATISTICS_REQ); + if (reply.type() != QVariant::List) + return 0; + vl = reply.toList(); + if (vl.isEmpty()) + return 0; + reply = vl.first(); + if (reply.type() != QVariant::UInt) + return 0; + signals_left = total_signals = reply.toUInt(); + + if (!signals_left) + return 0; + + timer.setSingleShot(true); + timer.start(timeout); + stats_results.clear(); + while (signals_left) { + mInterface.clear(); + while (timer.isActive() && mInterface.isEmpty()) { + QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); + } + + if (!timer.isActive()) { + total_signals = 0; + break; + } + + if (mSignal != ICD_DBUS_API_STATISTICS_SIG) { + continue; + } + + if (mError.isEmpty()) { + get_statistics_all_result(mArgs, result); + stats_results << result; + signals_left--; + } else { + qWarning() << "Error:" << mError; + break; + } + } + timer.stop(); + + return total_signals; +} + + +static void get_addrinfo_all_result(QList& args, + IcdAddressInfoResult& ret) +{ + int i=0; + + if (args.isEmpty()) + return; + + ret.params.service_type = args[i++].toString(); + ret.params.service_attrs = args[i++].toUInt(); + ret.params.service_id = args[i++].toString(); + ret.params.network_type = args[i++].toString(); + ret.params.network_attrs = args[i++].toUInt(); + ret.params.network_id = args[i++].toByteArray(); + + QVariantList vl = args[i].toList(); + QVariant reply = vl.first(); + QList lst = reply.toList(); + for (int k=0; k& addr_results) +{ + QVariant reply; + QVariantList vl; + uint signals_left, total_signals; + IcdAddressInfoResult result; + time_t started; + int timeout_secs = timeout / 1000; + + PDEBUG("%s\n", "addr_results"); + + clearState(); + reply = mDBus->call(ICD_DBUS_API_ADDRINFO_REQ); + if (reply.type() != QVariant::List) + return 0; + vl = reply.toList(); + if (vl.isEmpty()) + return 0; + reply = vl.first(); + if (reply.type() != QVariant::UInt) + return 0; + signals_left = total_signals = reply.toUInt(); + if (!signals_left) + return 0; + + started = time(0); + addr_results.clear(); + while (signals_left) { + mInterface.clear(); + while ((time(0)<=(started+timeout_secs)) && mInterface.isEmpty()) { + mDBus->synchronousDispatch(1000); + } + + if (time(0)>(started+timeout_secs)) { + total_signals = 0; + break; + } + + if (mSignal != ICD_DBUS_API_ADDRINFO_SIG) { + continue; + } + + if (mError.isEmpty()) { + get_addrinfo_all_result(mArgs, result); + addr_results << result; + signals_left--; + } else { + qWarning() << "Error:" << mError; + break; + } + } + + PDEBUG("total_signals=%d\n", total_signals); + return total_signals; +} + + +uint IcdPrivate::addrinfo(QString& service_type, uint service_attrs, + QString& service_id, QString& network_type, + uint network_attrs, QByteArray& network_id, + IcdAddressInfoResult& addr_result) +{ + QTimer timer; + QVariant reply; + uint total_signals; + QVariantList vl; + + clearState(); + + reply = mDBus->call(ICD_DBUS_API_ADDRINFO_REQ, + service_type, service_attrs, service_id, + network_type, network_attrs, network_id); + if (reply.type() != QVariant::List) + return 0; + vl = reply.toList(); + if (vl.isEmpty()) + return 0; + reply = vl.first(); + total_signals = reply.toUInt(); + + if (!total_signals) + return 0; + + timer.setSingleShot(true); + timer.start(timeout); + + mInterface.clear(); + while (timer.isActive() && mInterface.isEmpty()) { + QCoreApplication::processEvents(QEventLoop::AllEvents, 1000); + + if (mSignal != ICD_DBUS_API_ADDRINFO_SIG) { + mInterface.clear(); + continue; + } + } + + timer.stop(); + + if (mError.isEmpty()) { + get_addrinfo_all_result(mArgs, addr_result); + } else { + qWarning() << "Error:" << mError; + } + + // The returned value should be one because we asked for one addrinfo + return total_signals; +} + + +Icd::Icd(QObject *parent) + : QObject(parent), d(new IcdPrivate(this)) +{ +} + +Icd::Icd(unsigned int timeout, QObject *parent) + : QObject(parent), d(new IcdPrivate(timeout, this)) +{ +} + +Icd::Icd(unsigned int timeout, IcdDbusInterfaceVer ver, QObject *parent) + : QObject(parent), d(new IcdPrivate(timeout, ver, this)) +{ +} + +Icd::~Icd() +{ + delete d; +} + + +QStringList Icd::scan(icd_scan_request_flags flags, + QStringList &network_types, + QList& scan_results, + QString& error) +{ + return d->scan(flags, network_types, scan_results, error); +} + + +uint Icd::state(QString& service_type, uint service_attrs, + QString& service_id, QString& network_type, + uint network_attrs, QByteArray& network_id, + IcdStateResult &state_result) +{ + return d->state(service_type, service_attrs, service_id, + network_type, network_attrs, network_id, + state_result); +} + + +uint Icd::addrinfo(QString& service_type, uint service_attrs, + QString& service_id, QString& network_type, + uint network_attrs, QByteArray& network_id, + IcdAddressInfoResult& addr_result) +{ + return d->addrinfo(service_type, service_attrs, service_id, + network_type, network_attrs, network_id, + addr_result); +} + + +uint Icd::state(QList& state_results) +{ + return d->state(state_results); +} + + +uint Icd::statistics(QList& stats_results) +{ + return d->statistics(stats_results); +} + + +uint Icd::addrinfo(QList& addr_results) +{ + return d->addrinfo(addr_results); +} + + +void Icd::icdSignalReceived(const QString& interface, + const QString& signal, + const QList& args) +{ + d->signalReceived(interface, signal, args); +} + + +void Icd::icdCallReply(const QString& method, + const QList& args, + const QString& error) +{ + d->callReply(method, args, error); +} + +} // Maemo namespace + + diff --git a/src/plugins/bearer/icd/maemo_icd.h b/src/plugins/bearer/icd/maemo_icd.h new file mode 100644 index 0000000..156316a --- /dev/null +++ b/src/plugins/bearer/icd/maemo_icd.h @@ -0,0 +1,174 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef MAEMO_ICD_H +#define MAEMO_ICD_H + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#define ICD_LONG_SCAN_TIMEOUT (30*1000) /* 30sec */ +#define ICD_SHORT_SCAN_TIMEOUT (10*1000) /* 10sec */ +#define ICD_SHORT_CONNECT_TIMEOUT (10*1000) /* 10sec */ +#define ICD_LONG_CONNECT_TIMEOUT (150*1000) /* 2.5min */ + +namespace Maemo { + +struct CommonParams { + QString service_type; + uint service_attrs; + QString service_id; + QString network_type; + uint network_attrs; + QByteArray network_id; +}; + +struct IcdScanResult { + uint status; // see #icd_scan_status + uint timestamp; // when last seen + QString service_name; + uint service_priority; // within a service type + QString network_name; + uint network_priority; + struct CommonParams scan; + uint signal_strength; // quality, 0 (none) - 10 (good) + QString station_id; // e.g. MAC address or similar id + uint signal_dB; // use signal strength above unless you know what you are doing + + IcdScanResult() { + status = timestamp = scan.service_attrs = service_priority = + scan.network_attrs = network_priority = signal_strength = + signal_dB = 0; + } +}; + +struct IcdStateResult { + struct CommonParams params; + QString error; + uint state; +}; + +struct IcdStatisticsResult { + struct CommonParams params; + uint time_active; // in seconds + enum icd_nw_levels signal_strength; // see network_api_defines.h in icd2-dev package + uint bytes_sent; + uint bytes_received; +}; + +struct IcdIPInformation { + QString address; + QString netmask; + QString default_gateway; + QString dns1; + QString dns2; + QString dns3; +}; + +struct IcdAddressInfoResult { + struct CommonParams params; + QList ip_info; +}; + +enum IcdDbusInterfaceVer { + IcdOldDbusInterface = 0, // use the old OSSO-IC interface + IcdNewDbusInterface // use the new Icd2 interface (default) +}; + + +class IcdPrivate; +class Icd : public QObject +{ + Q_OBJECT + +public: + Icd(QObject *parent = 0); + Icd(unsigned int timeout, QObject *parent = 0); + Icd(unsigned int timeout, IcdDbusInterfaceVer ver, QObject *parent = 0); + ~Icd(); + + /* Icd2 dbus API functions */ + QStringList scan(icd_scan_request_flags flags, + QStringList &network_types, + QList& scan_results, + QString& error); + + uint state(QString& service_type, uint service_attrs, + QString& service_id, QString& network_type, + uint network_attrs, QByteArray& network_id, + IcdStateResult &state_result); + + uint addrinfo(QString& service_type, uint service_attrs, + QString& service_id, QString& network_type, + uint network_attrs, QByteArray& network_id, + IcdAddressInfoResult& addr_result); + + uint state(QList& state_results); + uint statistics(QList& stats_results); + uint addrinfo(QList& addr_results); + +private Q_SLOTS: + void icdSignalReceived(const QString& interface, + const QString& signal, + const QList& args); + void icdCallReply(const QString& method, + const QList& args, + const QString& error); + +private: + IcdPrivate *d; + friend class IcdPrivate; +}; + +} // Maemo namespace + +#endif diff --git a/src/plugins/bearer/icd/proxyconf.cpp b/src/plugins/bearer/icd/proxyconf.cpp new file mode 100644 index 0000000..e5c8f4e --- /dev/null +++ b/src/plugins/bearer/icd/proxyconf.cpp @@ -0,0 +1,412 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include "proxyconf.h" + +#define CONF_PROXY "/system/proxy" +#define HTTP_PROXY "/system/http_proxy" + + +namespace Maemo { + +static QString convertKey(const char *key) +{ + return QString::fromUtf8(key); +} + +static QVariant convertValue(GConfValue *src) +{ + if (!src) { + return QVariant(); + } else { + switch (src->type) { + case GCONF_VALUE_INVALID: + return QVariant(QVariant::Invalid); + case GCONF_VALUE_BOOL: + return QVariant((bool)gconf_value_get_bool(src)); + case GCONF_VALUE_INT: + return QVariant(gconf_value_get_int(src)); + case GCONF_VALUE_FLOAT: + return QVariant(gconf_value_get_float(src)); + case GCONF_VALUE_STRING: + return QVariant(QString::fromUtf8(gconf_value_get_string(src))); + case GCONF_VALUE_LIST: + switch (gconf_value_get_list_type(src)) { + case GCONF_VALUE_STRING: + { + QStringList result; + for (GSList *elts = gconf_value_get_list(src); elts; elts = elts->next) + result.append(QString::fromUtf8(gconf_value_get_string((GConfValue *)elts->data))); + return QVariant(result); + } + default: + { + QList result; + for (GSList *elts = gconf_value_get_list(src); elts; elts = elts->next) + result.append(convertValue((GConfValue *)elts->data)); + return QVariant(result); + } + } + case GCONF_VALUE_SCHEMA: + default: + return QVariant(); + } + } +} + + +/* Fast version of GConfItem, allows reading subtree at a time */ +class GConfItemFast { +public: + GConfItemFast(const QString &k) : key(k) {} + QHash getEntries() const; + +private: + QString key; +}; + +#define withClient(c) for (GConfClient *c = gconf_client_get_default(); c; c=0) + + +QHash GConfItemFast::getEntries() const +{ + QHash children; + + withClient(client) { + QByteArray k = key.toUtf8(); + GSList *entries = gconf_client_all_entries(client, k.data(), NULL); + for (GSList *e = entries; e; e = e->next) { + char *key_name = strrchr(((GConfEntry *)e->data)->key, '/'); + if (!key_name) + key_name = ((GConfEntry *)e->data)->key; + else + key_name++; + QString key(convertKey(key_name)); + QVariant value = convertValue(((GConfEntry *)e->data)->value); + gconf_entry_unref((GConfEntry *)e->data); + //qDebug()<<"key="< queryProxy(const QNetworkProxyQuery &query = QNetworkProxyQuery()); +}; + + +QList NetworkProxyFactory::queryProxy(const QNetworkProxyQuery &query) +{ + ProxyConf proxy_conf; + + QList result = proxy_conf.flush(query); + if (result.isEmpty()) + result << QNetworkProxy::NoProxy; + + return result; +} + + +class ProxyConfPrivate { +private: + // proxy values from gconf + QString mode; + bool use_http_host; + QString autoconfig_url; + QString http_proxy; + quint16 http_port; + QList ignore_hosts; + QString secure_host; + quint16 secure_port; + QString ftp_host; + quint16 ftp_port; + QString socks_host; + quint16 socks_port; + QString rtsp_host; + quint16 rtsp_port; + + bool isHostExcluded(const QString &host); + +public: + QString prefix; + QString http_prefix; + + void readProxyData(); + QList flush(const QNetworkProxyQuery &query); +}; + + +static QHash getValues(const QString& prefix) +{ + GConfItemFast item(prefix); + return item.getEntries(); +} + +static QHash getHttpValues(const QString& prefix) +{ + GConfItemFast item(prefix); + return item.getEntries(); +} + +#define GET(var, type) \ + do { \ + QVariant v = values.value(#var); \ + if (v.isValid()) \ + var = v.to##type (); \ + } while(0) + +#define GET_HTTP(var, name, type) \ + do { \ + QVariant v = httpValues.value(#name); \ + if (v.isValid()) \ + var = v.to##type (); \ + } while(0) + + +void ProxyConfPrivate::readProxyData() +{ + QHash values = getValues(prefix); + QHash httpValues = getHttpValues(http_prefix); + + //qDebug()<<"values="< ProxyConfPrivate::flush(const QNetworkProxyQuery &query) +{ + QList result; + +#if 0 + qDebug()<<"http_proxy" << http_proxy; + qDebug()<<"http_port" << http_port; + qDebug()<<"ignore_hosts" << ignore_hosts; + qDebug()<<"use_http_host" << use_http_host; + qDebug()<<"mode" << mode; + qDebug()<<"autoconfig_url" << autoconfig_url; + qDebug()<<"secure_host" << secure_host; + qDebug()<<"secure_port" << secure_port; + qDebug()<<"ftp_host" << ftp_host; + qDebug()<<"ftp_port" << ftp_port; + qDebug()<<"socks_host" << socks_host; + qDebug()<<"socks_port" << socks_port; + qDebug()<<"rtsp_host" << rtsp_host; + qDebug()<<"rtsp_port" << rtsp_port; +#endif + + if (isHostExcluded(query.peerHostName())) + return result; // no proxy for this host + + if (mode == "auto") { + // TODO: pac currently not supported, fix me + return result; + } + + if (mode == "manual") { + bool isHttps = false; + QString protocol = query.protocolTag().toLower(); + + // try the protocol-specific proxy + QNetworkProxy protocolSpecificProxy; + + if (protocol == QLatin1String("ftp")) { + if (!ftp_host.isEmpty()) { + protocolSpecificProxy.setType(QNetworkProxy::FtpCachingProxy); + protocolSpecificProxy.setHostName(ftp_host); + protocolSpecificProxy.setPort(ftp_port); + } + } else if (protocol == QLatin1String("http")) { + if (!http_proxy.isEmpty()) { + protocolSpecificProxy.setType(QNetworkProxy::HttpProxy); + protocolSpecificProxy.setHostName(http_proxy); + protocolSpecificProxy.setPort(http_port); + } + } else if (protocol == QLatin1String("https")) { + isHttps = true; + if (!secure_host.isEmpty()) { + protocolSpecificProxy.setType(QNetworkProxy::HttpProxy); + protocolSpecificProxy.setHostName(secure_host); + protocolSpecificProxy.setPort(secure_port); + } + } + + if (protocolSpecificProxy.type() != QNetworkProxy::DefaultProxy) + result << protocolSpecificProxy; + + + if (!socks_host.isEmpty()) { + QNetworkProxy proxy; + proxy.setType(QNetworkProxy::Socks5Proxy); + proxy.setHostName(socks_host); + proxy.setPort(socks_port); + result << proxy; + } + + + // Add the HTTPS proxy if present (and if we haven't added yet) + if (!isHttps) { + QNetworkProxy https; + if (!secure_host.isEmpty()) { + https.setType(QNetworkProxy::HttpProxy); + https.setHostName(secure_host); + https.setPort(secure_port); + } + + if (https.type() != QNetworkProxy::DefaultProxy && + https != protocolSpecificProxy) + result << https; + } + } + + return result; +} + + +ProxyConf::ProxyConf() + : d_ptr(new ProxyConfPrivate) +{ + g_type_init(); + d_ptr->prefix = CONF_PROXY; + d_ptr->http_prefix = HTTP_PROXY; +} + +ProxyConf::~ProxyConf() +{ + delete d_ptr; +} + + +QList ProxyConf::flush(const QNetworkProxyQuery &query) +{ + d_ptr->readProxyData(); + return d_ptr->flush(query); +} + + +static int refcount = 0; +static QReadWriteLock lock; + +void ProxyConf::update() +{ + QWriteLocker locker(&lock); + NetworkProxyFactory *factory = new NetworkProxyFactory(); + QNetworkProxyFactory::setApplicationProxyFactory((QNetworkProxyFactory*)factory); + refcount++; +} + + +void ProxyConf::clear(void) +{ + QWriteLocker locker(&lock); + refcount--; + if (refcount == 0) + QNetworkProxyFactory::setApplicationProxyFactory(NULL); + + if (refcount<0) + refcount = 0; +} + + +} // namespace Maemo diff --git a/src/plugins/bearer/icd/proxyconf.h b/src/plugins/bearer/icd/proxyconf.h new file mode 100644 index 0000000..884cc5c --- /dev/null +++ b/src/plugins/bearer/icd/proxyconf.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef PROXYCONF_H +#define PROXYCONF_H + +#include +#include + +namespace Maemo { + +class ProxyConfPrivate; +class ProxyConf { +private: + ProxyConfPrivate *d_ptr; + +public: + ProxyConf(); + virtual ~ProxyConf(); + + QList flush(const QNetworkProxyQuery &query = QNetworkProxyQuery()); // read the proxies from db + + /* Note that for each update() call there should be corresponding + * clear() call because the ProxyConf class implements a reference + * counting mechanism. The factory is removed only when there is + * no one using the factory any more. + */ + static void update(void); // this builds QNetworkProxy factory + static void clear(void); // this removes QNetworkProxy factory +}; + +} // namespace Maemo + +#endif diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp index 3264f15..bdf4e2e 100644 --- a/src/plugins/bearer/icd/qicdengine.cpp +++ b/src/plugins/bearer/icd/qicdengine.cpp @@ -43,7 +43,7 @@ #include "qnetworksession_impl.h" #include -#include +#include #include #include @@ -67,6 +67,10 @@ QString IcdNetworkConfigurationPrivate::bearerTypeName() const return iap_type; } +/******************************************************************************/ +/** IapAddTimer specific */ +/******************************************************************************/ + /* The IapAddTimer is a helper class that makes sure we update * the configuration only after all db additions to certain * iap are finished (after a certain timeout) @@ -162,6 +166,9 @@ void IapAddTimer::del(QString& iap_id) } } +/******************************************************************************/ +/** IAPMonitor specific */ +/******************************************************************************/ class IapMonitor : public Maemo::IAPMonitor { @@ -216,6 +223,11 @@ void IapMonitor::iapRemoved(const QString &iap_id) d->deleteConfiguration(id); } + +/******************************************************************************/ +/** QIcdEngine implementation */ +/******************************************************************************/ + QIcdEngine::QIcdEngine(QObject *parent) : QBearerEngine(parent), iapMonitor(0), m_dbusInterface(0), firstUpdate(true), m_scanGoingOn(false) diff --git a/src/plugins/bearer/icd/qicdengine.h b/src/plugins/bearer/icd/qicdengine.h index 0d5ba27..d528f15 100644 --- a/src/plugins/bearer/icd/qicdengine.h +++ b/src/plugins/bearer/icd/qicdengine.h @@ -46,7 +46,7 @@ #include -#include +#include "maemo_icd.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp index 787cc55..2ed0b88 100644 --- a/src/plugins/bearer/icd/qnetworksession_impl.cpp +++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp @@ -60,13 +60,16 @@ QDBusArgument &operator<<(QDBusArgument &argument, const ICd2DetailsDBusStruct &icd2) { argument.beginStructure(); + argument << icd2.serviceType; argument << icd2.serviceAttributes; argument << icd2.setviceId; argument << icd2.networkType; argument << icd2.networkAttributes; argument << icd2.networkId; + argument.endStructure(); + return argument; } @@ -74,13 +77,16 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, ICd2DetailsDBusStruct &icd2) { argument.beginStructure(); + argument >> icd2.serviceType; argument >> icd2.serviceAttributes; argument >> icd2.setviceId; argument >> icd2.networkType; argument >> icd2.networkAttributes; argument >> icd2.networkId; + argument.endStructure(); + return argument; } @@ -104,9 +110,12 @@ QDBusArgument &operator<<(QDBusArgument &argument, const ICd2DetailsList &detailsList) { argument.beginArray(qMetaTypeId()); + for (int i = 0; i < detailsList.count(); ++i) argument << detailsList[i]; + argument.endArray(); + return argument; } @@ -144,7 +153,8 @@ void QNetworkSessionPrivateImpl::iapStateChanged(const QString& iapid, uint icd_ void QNetworkSessionPrivateImpl::cleanupSession(void) { - QObject::disconnect(q, SIGNAL(stateChanged(QNetworkSession::State)), this, SLOT(updateProxies(QNetworkSession::State))); + QObject::disconnect(q, SIGNAL(stateChanged(QNetworkSession::State)), + this, SLOT(updateProxies(QNetworkSession::State))); } diff --git a/src/plugins/bearer/icd/wlan-utils.h b/src/plugins/bearer/icd/wlan-utils.h new file mode 100644 index 0000000..1d9e89d --- /dev/null +++ b/src/plugins/bearer/icd/wlan-utils.h @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef WLAN_UTILS_H +#define WLAN_UTILS_H + +/** Originally taken from: libicd-network-wlan-dev.h*/ + +#include +#include +#include +#include + +/* capability bits inside network attributes var */ +#define NWATTR_WPS_MASK 0x0000F000 +#define NWATTR_ALGORITHM_MASK 0x00000F00 +#define NWATTR_WPA2_MASK 0x00000080 +#define NWATTR_METHOD_MASK 0x00000078 +#define NWATTR_MODE_MASK 0x00000007 + +#define CAP_LOCALMASK 0x0FFFE008 + +/* how much to shift between capability and network attributes var */ +#define CAP_SHIFT_WPS 3 +#define CAP_SHIFT_ALGORITHM 20 +#define CAP_SHIFT_WPA2 1 +#define CAP_SHIFT_METHOD 1 +#define CAP_SHIFT_MODE 0 +#define CAP_SHIFT_ALWAYS_ONLINE 26 + +/* ------------------------------------------------------------------------- */ +/* From combined to capability */ +static inline dbus_uint32_t nwattr2cap(guint nwattrs, dbus_uint32_t *cap) +{ + guint oldval = *cap; + + *cap &= CAP_LOCALMASK; /* clear old capabilities */ + *cap |= + ((nwattrs & ICD_NW_ATTR_ALWAYS_ONLINE) >> CAP_SHIFT_ALWAYS_ONLINE) | + ((nwattrs & NWATTR_WPS_MASK) >> CAP_SHIFT_WPS) | + ((nwattrs & NWATTR_ALGORITHM_MASK) << CAP_SHIFT_ALGORITHM) | + ((nwattrs & NWATTR_WPA2_MASK) << CAP_SHIFT_WPA2) | + ((nwattrs & NWATTR_METHOD_MASK) << CAP_SHIFT_METHOD) | + (nwattrs & NWATTR_MODE_MASK); + + return oldval; +} + + +/* ------------------------------------------------------------------------- */ +/* From capability to combined */ +static inline guint cap2nwattr(dbus_uint32_t cap, guint *nwattrs) +{ + guint oldval = *nwattrs; + + *nwattrs &= ~ICD_NW_ATTR_LOCALMASK; /* clear old capabilities */ + *nwattrs |= +#ifdef WLANCOND_WPS_MASK + ((cap & WLANCOND_WPS_MASK) << CAP_SHIFT_WPS) | +#endif + ((cap & (WLANCOND_ENCRYPT_ALG_MASK | + WLANCOND_ENCRYPT_GROUP_ALG_MASK)) >> CAP_SHIFT_ALGORITHM)| + ((cap & WLANCOND_ENCRYPT_WPA2_MASK) >> CAP_SHIFT_WPA2) | + ((cap & WLANCOND_ENCRYPT_METHOD_MASK) >> CAP_SHIFT_METHOD) | + (cap & WLANCOND_MODE_MASK); + + return oldval; +} + + +#endif -- cgit v0.12 From 83e6bc232e687bab93c9eddaf0b4479462c8414c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 20 Sep 2010 14:54:30 +0200 Subject: Fixed scaled point drawing with square cap in raster paint engine. With a large pen width and a small scale, due to the hacky way we draw points (stroking a line from (x, y) to (x + tiny_amount, y)), we some times end up snapping these two points to the same in rasterizeLine(). If we instead apply the SquareCap before we do clipping / snapping we don't get this problem. Task-number: QTBUG-13429 Reviewed-by: Trond (cherry picked from commit 7c673a4cf64ba043bb27f90287517bdcdd7a21db) --- src/gui/painting/qrasterizer.cpp | 41 +++++++++++++++--------------------- tests/auto/qpainter/tst_qpainter.cpp | 22 +++++++++++++++++++ 2 files changed, 39 insertions(+), 24 deletions(-) diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp index f8f8afb..61ed12e 100644 --- a/src/gui/painting/qrasterizer.cpp +++ b/src/gui/painting/qrasterizer.cpp @@ -718,17 +718,21 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, QPointF pa = a; QPointF pb = b; - QPointF offs = QPointF(qAbs(b.y() - a.y()), qAbs(b.x() - a.x())) * width * 0.5; - if (squareCap) - offs += QPointF(offs.y(), offs.x()); + if (squareCap) { + QPointF delta = pb - pa; + pa -= (0.5f * width) * delta; + pb += (0.5f * width) * delta; + } + + QPointF offs = QPointF(qAbs(b.y() - a.y()), qAbs(b.x() - a.x())) * width * 0.5; const QRectF clip(d->clipRect.topLeft() - offs, d->clipRect.bottomRight() + QPoint(1, 1) + offs); - if (!clip.contains(a) || !clip.contains(b)) { + if (!clip.contains(pa) || !clip.contains(pb)) { qreal t1 = 0; qreal t2 = 1; - const qreal o[2] = { a.x(), a.y() }; - const qreal d[2] = { b.x() - a.x(), b.y() - a.y() }; + const qreal o[2] = { pa.x(), pa.y() }; + const qreal d[2] = { pb.x() - pa.x(), pb.y() - pa.y() }; const qreal low[2] = { clip.left(), clip.top() }; const qreal high[2] = { clip.right(), clip.bottom() }; @@ -751,8 +755,12 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, if (t1 >= t2) return; } - pa = a + (b - a) * t1; - pb = a + (b - a) * t2; + + QPointF npa = pa + (pb - pa) * t1; + QPointF npb = pa + (pb - pa) * t2; + + pa = npa; + pb = npb; } if (!d->antialiased) { @@ -799,12 +807,7 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, pa = QPointF(x, y - dy); pb = QPointF(x, y + dy); - if (squareCap) - width = 1 / width + 1.0f; - else - width = 1 / width; - - squareCap = false; + width = 1 / width; } if (q16Dot16Compare(pa.x(), pb.x())) { @@ -814,11 +817,6 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, const qreal dy = pb.y() - pa.y(); const qreal halfWidth = 0.5f * width * dy; - if (squareCap) { - pa.ry() -= halfWidth; - pb.ry() += halfWidth; - } - qreal left = pa.x() - halfWidth; qreal right = pa.x() + halfWidth; @@ -899,11 +897,6 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, delta *= 0.5f * width; const QPointF perp(delta.y(), -delta.x()); - if (squareCap) { - pa -= delta; - pb += delta; - } - QPointF top; QPointF left; QPointF right; diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index f358681..a94c300 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -252,6 +252,8 @@ private slots: void QTBUG5939_attachPainterPrivate(); + void drawPointScaled(); + private: void fillData(); void setPenColor(QPainter& p); @@ -4522,6 +4524,26 @@ void tst_QPainter::QTBUG5939_attachPainterPrivate() QCOMPARE(widget->deviceTransform, proxy->deviceTransform); } +void tst_QPainter::drawPointScaled() +{ + QImage image(32, 32, QImage::Format_RGB32); + image.fill(0xffffffff); + + QPainter p(&image); + + p.scale(0.1, 0.1); + + QPen pen; + pen.setWidth(1000); + pen.setColor(Qt::red); + + p.setPen(pen); + p.drawPoint(0, 0); + p.end(); + + QCOMPARE(image.pixel(16, 16), 0xffff0000); +} + QTEST_MAIN(tst_QPainter) #include "tst_qpainter.moc" -- cgit v0.12 From e8d9e657509be4d8fea62a73c8dd51305951f1c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 23 Sep 2010 10:04:39 +0200 Subject: Fixed floating point overflow issues in QRasterizer::rasterizeLine Change 7c673a4cf64ba04 introduced some autotest failures in the fpe_steepSlopes test in QPainter. Since the other rasterizers all deal in a 26.6 fixed point coordinate space we should snap the line vertices to this to prevent floating point overflows due to very steep slopes. This also necessitates keeping track of four different slope / inverse slope increments for each of the four edges. This also fixes a previously QEXPECT_FAIL'ed test case. Task-number: QTBUG-13429 Reviewed-by: Trond (cherry picked from commit 93199a5b7082fd484b7f21ad4825d71693ecead2) --- src/gui/painting/qrasterizer.cpp | 139 ++++++++++++++++++++--------------- tests/auto/qpainter/tst_qpainter.cpp | 1 - 2 files changed, 79 insertions(+), 61 deletions(-) diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp index 61ed12e..4fded1f 100644 --- a/src/gui/painting/qrasterizer.cpp +++ b/src/gui/painting/qrasterizer.cpp @@ -65,6 +65,12 @@ typedef int Q16Dot16; #define COORD_ROUNDING 1 // 0: round up, 1: round down #define COORD_OFFSET 32 // 26.6, 32 is half a pixel +static inline QT_FT_Vector PointToVector(const QPointF &p) +{ + QT_FT_Vector result = { QT_FT_Pos(p.x() * 64), QT_FT_Pos(p.y() * 64) }; + return result; +} + class QSpanBuffer { public: QSpanBuffer(ProcessSpans blend, void *data, const QRect &clipRect) @@ -693,9 +699,9 @@ static Q16Dot16 intersectPixelFP(int x, Q16Dot16 top, Q16Dot16 bottom, Q16Dot16 } } -static inline bool q16Dot16Compare(qreal p1, qreal p2) +static inline bool q26Dot6Compare(qreal p1, qreal p2) { - return FloatToQ16Dot16(p2 - p1) == 0; + return int((p2 - p1) * 64.) == 0; } static inline qreal qFloorF(qreal v) @@ -708,6 +714,12 @@ static inline qreal qFloorF(qreal v) return floor(v); } +static inline QPointF snapTo26Dot6Grid(const QPointF &p) +{ + return QPointF(qFloorF(p.x() * 64) * (1 / qreal(64)), + qFloorF(p.y() * 64) * (1 / qreal(64))); +} + void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, bool squareCap) { if (a == b || width == 0 || d->clipRect.isEmpty()) @@ -771,15 +783,6 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, } { - const qreal gridResolution = 64; - const qreal reciprocal = 1 / gridResolution; - - // snap to grid to prevent large slopes - pa.rx() = qFloorF(pa.rx() * gridResolution) * reciprocal; - pa.ry() = qFloorF(pa.ry() * gridResolution) * reciprocal; - pb.rx() = qFloorF(pb.rx() * gridResolution) * reciprocal; - pb.ry() = qFloorF(pb.ry() * gridResolution) * reciprocal; - // old delta const QPointF d0 = a - b; const qreal w0 = d0.x() * d0.x() + d0.y() * d0.y(); @@ -797,7 +800,7 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, QSpanBuffer buffer(d->blend, d->data, d->clipRect); - if (q16Dot16Compare(pa.y(), pb.y())) { + if (q26Dot6Compare(pa.y(), pb.y())) { const qreal x = (pa.x() + pb.x()) * 0.5f; const qreal dx = qAbs(pb.x() - pa.x()) * 0.5f; @@ -810,7 +813,7 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, width = 1 / width; } - if (q16Dot16Compare(pa.x(), pb.x())) { + if (q26Dot6Compare(pa.x(), pb.x())) { if (pa.y() > pb.y()) qSwap(pa, pb); @@ -826,7 +829,7 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, pa.ry() = qBound(qreal(d->clipRect.top()), pa.y(), qreal(d->clipRect.bottom() + 1)); pb.ry() = qBound(qreal(d->clipRect.top()), pb.y(), qreal(d->clipRect.bottom() + 1)); - if (q16Dot16Compare(left, right) || q16Dot16Compare(pa.y(), pb.y())) + if (q26Dot6Compare(left, right) || q26Dot6Compare(pa.y(), pb.y())) return; if (d->antialiased) { @@ -914,14 +917,36 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, bottom = pb + perp; } + top = snapTo26Dot6Grid(top); + bottom = snapTo26Dot6Grid(bottom); + left = snapTo26Dot6Grid(left); + right = snapTo26Dot6Grid(right); + const qreal topBound = qBound(qreal(d->clipRect.top()), top.y(), qreal(d->clipRect.bottom())); const qreal bottomBound = qBound(qreal(d->clipRect.top()), bottom.y(), qreal(d->clipRect.bottom())); - const qreal leftSlope = (left.x() - top.x()) / (left.y() - top.y()); - const qreal rightSlope = -1.0f / leftSlope; + const QPointF topLeftEdge = left - top; + const QPointF topRightEdge = right - top; + const QPointF bottomLeftEdge = bottom - left; + const QPointF bottomRightEdge = bottom - right; - const Q16Dot16 leftSlopeFP = FloatToQ16Dot16(leftSlope); - const Q16Dot16 rightSlopeFP = FloatToQ16Dot16(rightSlope); + const qreal topLeftSlope = topLeftEdge.x() / topLeftEdge.y(); + const qreal bottomLeftSlope = bottomLeftEdge.x() / bottomLeftEdge.y(); + + const qreal topRightSlope = topRightEdge.x() / topRightEdge.y(); + const qreal bottomRightSlope = bottomRightEdge.x() / bottomRightEdge.y(); + + const Q16Dot16 topLeftSlopeFP = FloatToQ16Dot16(topLeftSlope); + const Q16Dot16 topRightSlopeFP = FloatToQ16Dot16(topRightSlope); + + const Q16Dot16 bottomLeftSlopeFP = FloatToQ16Dot16(bottomLeftSlope); + const Q16Dot16 bottomRightSlopeFP = FloatToQ16Dot16(bottomRightSlope); + + const Q16Dot16 invTopLeftSlopeFP = FloatToQ16Dot16(1 / topLeftSlope); + const Q16Dot16 invTopRightSlopeFP = FloatToQ16Dot16(1 / topRightSlope); + + const Q16Dot16 invBottomLeftSlopeFP = FloatToQ16Dot16(1 / bottomLeftSlope); + const Q16Dot16 invBottomRightSlopeFP = FloatToQ16Dot16(1 / bottomRightSlope); if (d->antialiased) { const Q16Dot16 iTopFP = IntToQ16Dot16(int(topBound)); @@ -929,16 +954,16 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, const Q16Dot16 iRightFP = IntToQ16Dot16(int(right.y())); const Q16Dot16 iBottomFP = IntToQ16Dot16(int(bottomBound)); - Q16Dot16 leftIntersectAf = FloatToQ16Dot16(top.x() + (int(topBound) - top.y()) * leftSlope); - Q16Dot16 rightIntersectAf = FloatToQ16Dot16(top.x() + (int(topBound) - top.y()) * rightSlope); + Q16Dot16 leftIntersectAf = FloatToQ16Dot16(top.x() + (int(topBound) - top.y()) * topLeftSlope); + Q16Dot16 rightIntersectAf = FloatToQ16Dot16(top.x() + (int(topBound) - top.y()) * topRightSlope); Q16Dot16 leftIntersectBf = 0; Q16Dot16 rightIntersectBf = 0; if (iLeftFP < iTopFP) - leftIntersectBf = FloatToQ16Dot16(left.x() + (int(topBound) - left.y()) * rightSlope); + leftIntersectBf = FloatToQ16Dot16(left.x() + (int(topBound) - left.y()) * bottomLeftSlope); if (iRightFP < iTopFP) - rightIntersectBf = FloatToQ16Dot16(right.x() + (int(topBound) - right.y()) * leftSlope); + rightIntersectBf = FloatToQ16Dot16(right.x() + (int(topBound) - right.y()) * bottomRightSlope); Q16Dot16 rowTop, rowBottomLeft, rowBottomRight, rowTopLeft, rowTopRight, rowBottom; Q16Dot16 topLeftIntersectAf, topLeftIntersectBf, topRightIntersectAf, topRightIntersectBf; @@ -953,9 +978,9 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, rowTop = qMax(iTopFP, yTopFP); topLeftIntersectAf = leftIntersectAf + - Q16Dot16Multiply(leftSlopeFP, rowTop - iTopFP); + Q16Dot16Multiply(topLeftSlopeFP, rowTop - iTopFP); topRightIntersectAf = rightIntersectAf + - Q16Dot16Multiply(rightSlopeFP, rowTop - iTopFP); + Q16Dot16Multiply(topRightSlopeFP, rowTop - iTopFP); Q16Dot16 yFP = iTopFP; while (yFP <= iBottomFP) { @@ -967,30 +992,30 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, if (yFP == iLeftFP) { const int y = Q16Dot16ToInt(yFP); - leftIntersectBf = FloatToQ16Dot16(left.x() + (y - left.y()) * rightSlope); - topLeftIntersectBf = leftIntersectBf + Q16Dot16Multiply(rightSlopeFP, rowTopLeft - yFP); - bottomLeftIntersectAf = leftIntersectAf + Q16Dot16Multiply(leftSlopeFP, rowBottomLeft - yFP); + leftIntersectBf = FloatToQ16Dot16(left.x() + (y - left.y()) * bottomLeftSlope); + topLeftIntersectBf = leftIntersectBf + Q16Dot16Multiply(bottomLeftSlopeFP, rowTopLeft - yFP); + bottomLeftIntersectAf = leftIntersectAf + Q16Dot16Multiply(topLeftSlopeFP, rowBottomLeft - yFP); } else { topLeftIntersectBf = leftIntersectBf; - bottomLeftIntersectAf = leftIntersectAf + leftSlopeFP; + bottomLeftIntersectAf = leftIntersectAf + topLeftSlopeFP; } if (yFP == iRightFP) { const int y = Q16Dot16ToInt(yFP); - rightIntersectBf = FloatToQ16Dot16(right.x() + (y - right.y()) * leftSlope); - topRightIntersectBf = rightIntersectBf + Q16Dot16Multiply(leftSlopeFP, rowTopRight - yFP); - bottomRightIntersectAf = rightIntersectAf + Q16Dot16Multiply(rightSlopeFP, rowBottomRight - yFP); + rightIntersectBf = FloatToQ16Dot16(right.x() + (y - right.y()) * bottomRightSlope); + topRightIntersectBf = rightIntersectBf + Q16Dot16Multiply(bottomRightSlopeFP, rowTopRight - yFP); + bottomRightIntersectAf = rightIntersectAf + Q16Dot16Multiply(topRightSlopeFP, rowBottomRight - yFP); } else { topRightIntersectBf = rightIntersectBf; - bottomRightIntersectAf = rightIntersectAf + rightSlopeFP; + bottomRightIntersectAf = rightIntersectAf + topRightSlopeFP; } if (yFP == iBottomFP) { - bottomLeftIntersectBf = leftIntersectBf + Q16Dot16Multiply(rightSlopeFP, rowBottom - yFP); - bottomRightIntersectBf = rightIntersectBf + Q16Dot16Multiply(leftSlopeFP, rowBottom - yFP); + bottomLeftIntersectBf = leftIntersectBf + Q16Dot16Multiply(bottomLeftSlopeFP, rowBottom - yFP); + bottomRightIntersectBf = rightIntersectBf + Q16Dot16Multiply(bottomRightSlopeFP, rowBottom - yFP); } else { - bottomLeftIntersectBf = leftIntersectBf + rightSlopeFP; - bottomRightIntersectBf = rightIntersectBf + leftSlopeFP; + bottomLeftIntersectBf = leftIntersectBf + bottomLeftSlopeFP; + bottomRightIntersectBf = rightIntersectBf + bottomRightSlopeFP; } if (yFP < iLeftFP) { @@ -1035,21 +1060,21 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, if (yFP <= iLeftFP) excluded += intersectPixelFP(x, rowTop, rowBottomLeft, bottomLeftIntersectAf, topLeftIntersectAf, - leftSlopeFP, -rightSlopeFP); + topLeftSlopeFP, invTopLeftSlopeFP); if (yFP >= iLeftFP) excluded += intersectPixelFP(x, rowTopLeft, rowBottom, topLeftIntersectBf, bottomLeftIntersectBf, - rightSlopeFP, -leftSlopeFP); + bottomLeftSlopeFP, invBottomLeftSlopeFP); if (x >= rightMin) { if (yFP <= iRightFP) excluded += (rowBottomRight - rowTop) - intersectPixelFP(x, rowTop, rowBottomRight, topRightIntersectAf, bottomRightIntersectAf, - rightSlopeFP, -leftSlopeFP); + topRightSlopeFP, invTopRightSlopeFP); if (yFP >= iRightFP) excluded += (rowBottom - rowTopRight) - intersectPixelFP(x, rowTopRight, rowBottom, bottomRightIntersectBf, topRightIntersectBf, - leftSlopeFP, -rightSlopeFP); + bottomRightSlopeFP, invBottomRightSlopeFP); } Q16Dot16 coverage = rowHeight - excluded; @@ -1067,11 +1092,11 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, if (yFP <= iRightFP) excluded += (rowBottomRight - rowTop) - intersectPixelFP(x, rowTop, rowBottomRight, topRightIntersectAf, bottomRightIntersectAf, - rightSlopeFP, -leftSlopeFP); + topRightSlopeFP, invTopRightSlopeFP); if (yFP >= iRightFP) excluded += (rowBottom - rowTopRight) - intersectPixelFP(x, rowTopRight, rowBottom, bottomRightIntersectBf, topRightIntersectBf, - leftSlopeFP, -rightSlopeFP); + bottomRightSlopeFP, invBottomRightSlopeFP); Q16Dot16 coverage = rowHeight - excluded; buffer.addSpan(x, 1, Q16Dot16ToInt(yFP), @@ -1079,10 +1104,10 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, ++x; } - leftIntersectAf += leftSlopeFP; - leftIntersectBf += rightSlopeFP; - rightIntersectAf += rightSlopeFP; - rightIntersectBf += leftSlopeFP; + leftIntersectAf += topLeftSlopeFP; + leftIntersectBf += bottomLeftSlopeFP; + rightIntersectAf += topRightSlopeFP; + rightIntersectBf += bottomRightSlopeFP; topLeftIntersectAf = leftIntersectAf; topRightIntersectAf = rightIntersectAf; @@ -1096,10 +1121,10 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, int iBottom = bottom.y() < 0.5f? -1 : int(bottom.y() - 0.5f); int iMiddle = qMin(iLeft, iRight); - Q16Dot16 leftIntersectAf = FloatToQ16Dot16(top.x() + 0.5f + (iTop + 0.5f - top.y()) * leftSlope); - Q16Dot16 leftIntersectBf = FloatToQ16Dot16(left.x() + 0.5f + (iLeft + 1.5f - left.y()) * rightSlope); - Q16Dot16 rightIntersectAf = FloatToQ16Dot16(top.x() - 0.5f + (iTop + 0.5f - top.y()) * rightSlope); - Q16Dot16 rightIntersectBf = FloatToQ16Dot16(right.x() - 0.5f + (iRight + 1.5f - right.y()) * leftSlope); + Q16Dot16 leftIntersectAf = FloatToQ16Dot16(top.x() + 0.5f + (iTop + 0.5f - top.y()) * topLeftSlope); + Q16Dot16 leftIntersectBf = FloatToQ16Dot16(left.x() + 0.5f + (iLeft + 1.5f - left.y()) * bottomLeftSlope); + Q16Dot16 rightIntersectAf = FloatToQ16Dot16(top.x() - 0.5f + (iTop + 0.5f - top.y()) * topRightSlope); + Q16Dot16 rightIntersectBf = FloatToQ16Dot16(right.x() - 0.5f + (iRight + 1.5f - right.y()) * bottomRightSlope); int ny; int y = iTop; @@ -1121,10 +1146,10 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, ri += rs; \ } - DO_SEGMENT(iMiddle, leftIntersectAf, rightIntersectAf, leftSlopeFP, rightSlopeFP) - DO_SEGMENT(iRight, leftIntersectBf, rightIntersectAf, rightSlopeFP, rightSlopeFP) - DO_SEGMENT(iLeft, leftIntersectAf, rightIntersectBf, leftSlopeFP, leftSlopeFP) - DO_SEGMENT(iBottom, leftIntersectBf, rightIntersectBf, rightSlopeFP, leftSlopeFP) + DO_SEGMENT(iMiddle, leftIntersectAf, rightIntersectAf, topLeftSlopeFP, topRightSlopeFP) + DO_SEGMENT(iRight, leftIntersectBf, rightIntersectAf, bottomLeftSlopeFP, topRightSlopeFP) + DO_SEGMENT(iLeft, leftIntersectAf, rightIntersectBf, topLeftSlopeFP, bottomRightSlopeFP); + DO_SEGMENT(iBottom, leftIntersectBf, rightIntersectBf, bottomLeftSlopeFP, bottomRightSlopeFP); #undef DO_SEGMENT } } @@ -1176,12 +1201,6 @@ void QRasterizer::rasterize(const QT_FT_Outline *outline, Qt::FillRule fillRule) d->scanConverter.end(); } -static inline QT_FT_Vector PointToVector(const QPointF &p) -{ - QT_FT_Vector result = { QT_FT_Pos(p.x() * 64), QT_FT_Pos(p.y() * 64) }; - return result; -} - void QRasterizer::rasterize(const QPainterPath &path, Qt::FillRule fillRule) { if (path.isEmpty()) diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index a94c300..45f5c3e 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -3172,7 +3172,6 @@ void fpe_steepSlopes() p.setRenderHint(QPainter::Antialiasing, antialiased); p.setTransform(transform); - QEXPECT_FAIL("steep line 3 aa", "needs to be fixed", Continue); p.drawLine(line); } -- cgit v0.12 From ee550b73ca47eeee2b2d745eaa28c8d0069190e5 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 27 Sep 2010 14:47:21 +0200 Subject: Fix assert when placing a .qml file inside $QTDIR/imports The assert "Internal error: Plugin imported previously with different uri" happens on Windows. $QTDIR\imports, which is prefixed to the search path, is still written with backslashes. Unify this to forward slashes for all paths. Task-number:QTBUG-13994 Reviewed-by: mae (cherry picked from commit 0aa6360b7648ddeb8a905960265eb46d8c12448f) --- src/declarative/qml/qdeclarativeimport.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp index 8f95e26..fe4ed48 100644 --- a/src/declarative/qml/qdeclarativeimport.cpp +++ b/src/declarative/qml/qdeclarativeimport.cpp @@ -876,6 +876,7 @@ void QDeclarativeImportDatabase::addImportPath(const QString& path) cPath = dir.canonicalPath(); } else { cPath = path; + cPath.replace(QLatin1Char('\\'), QLatin1Char('/')); } if (!cPath.isEmpty() -- cgit v0.12 From d7e92cd6d44b6d0bc5157ba0dfd98e6627d45ed6 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 27 Sep 2010 16:15:40 +0300 Subject: Fixed incorrect snippet in BLD_INF_RULES documentation Task-number: QTBUG-13988 Reviewed-by: TrustMe (cherry picked from commit 1e4f736c2825c8c36ec74719efbc723f6374d072) --- doc/src/development/qmake-manual.qdoc | 2 +- doc/src/snippets/code/doc_src_qmake-manual.qdoc | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index f4becf8..9f569e9 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -1088,7 +1088,7 @@ For example: - \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 146 + \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 152 This will add the specified statements to the \c prj_exports section of the generated \c bld.inf file. diff --git a/doc/src/snippets/code/doc_src_qmake-manual.qdoc b/doc/src/snippets/code/doc_src_qmake-manual.qdoc index 4ac7d5e..8c35c3f 100644 --- a/doc/src/snippets/code/doc_src_qmake-manual.qdoc +++ b/doc/src/snippets/code/doc_src_qmake-manual.qdoc @@ -1002,3 +1002,10 @@ symbian { RSS_RULES.service_list += "uid = 0x12345678; datatype_list = \{\}; opaque_data = r_my_icon;" RSS_RULES.footer +="RESOURCE CAPTION_AND_ICON_INFO r_my_icon \{ icon_file =\"$$PWD/my_icon.svg\"; \}" //! [151] + +//! [152] +my_exports = \ + "foo.h /epoc32/include/mylib/foo.h" \ + "bar.h /epoc32/include/mylib/bar.h" +BLD_INF_RULES.prj_exports += my_exports +//! [152] -- cgit v0.12 From 5197ca2a89ce942a8991ceec50f7be89ff72455f Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 27 Sep 2010 15:39:18 +0300 Subject: Streamlined smart installer package creation Previously manual editing of the pkg file was required to publish application using smart installer. Now a proper app_installer.pkg will be created as long as application has protected range UID. Also changed "make installer_sis" to always generate the application sis as publishing process supports signing both application and its smart installer wrapper packages in single step. Task-number: QTBUG-13991 Reviewed-by: axis (cherry picked from commit bc8409b9d04be54d98ca97d96c32473039f58a80) --- mkspecs/features/symbian/sis_targets.prf | 4 ++-- qmake/generators/symbian/symbiancommon.cpp | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/mkspecs/features/symbian/sis_targets.prf b/mkspecs/features/symbian/sis_targets.prf index 800a04c..673127e 100644 --- a/mkspecs/features/symbian/sis_targets.prf +++ b/mkspecs/features/symbian/sis_targets.prf @@ -67,7 +67,7 @@ equals(GENERATE_SIS_TARGETS, true) { , \ $(MAKE) -f $(MAKEFILE) fail_sis_nopkg \ ) - installer_sis_target.depends = $${baseTarget}.sis + installer_sis_target.depends = sis ok_installer_sis_target.target = ok_installer_sis ok_installer_sis_target.commands = createpackage.bat $(QT_SIS_OPTIONS) $${baseTarget}_installer.pkg - \ @@ -154,7 +154,7 @@ equals(GENERATE_SIS_TARGETS, true) { installer_sis_target.target = installer_sis installer_sis_target.commands = $$QMAKE_CREATEPACKAGE $(QT_SIS_OPTIONS) $${baseTarget}_installer.pkg - \ $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE) - installer_sis_target.depends = $${sis_destdir}/$${baseTarget}.sis + installer_sis_target.depends = sis !isEmpty(sis_destdir):!equals(sis_destdir, "."):!equals(sis_destdir, "./") { sis_target.commands += && $$QMAKE_MOVE $${baseTarget}.sis $$sis_destdir diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp index a60ae07..9af3fe4 100644 --- a/qmake/generators/symbian/symbiancommon.cpp +++ b/qmake/generators/symbian/symbiancommon.cpp @@ -178,8 +178,15 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB QTextStream ts(&stubPkgFile); QString installerSisHeader = project->values("DEPLOYMENT.installer_header").join("\n"); - if (installerSisHeader.isEmpty()) - installerSisHeader = "0xA000D7CE"; // Use default self-signable UID if not defined + if (installerSisHeader.isEmpty()) { + // Use correct protected UID for publishing if application UID is in protected range, + // otherwise use self-signable test UID. + QRegExp protUidMatcher("0[xX][0-7].*"); + if (protUidMatcher.exactMatch(uid3)) + installerSisHeader = QLatin1String("0x2002CCCF"); + else + installerSisHeader = QLatin1String("0xA000D7CE"); // Use default self-signable UID + } QString wrapperStreamBuffer; QTextStream tw(&wrapperStreamBuffer); @@ -531,7 +538,7 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB // Wrapped files deployment QString currentPath = qmake_getpwd(); QString sisName = QString("%1.sis").arg(fixedTarget); - twf << "\"" << currentPath << "/" << sisName << "\" - \"c:\\private\\2002CCCE\\import\\" << sisName << "\"" << endl; + twf << "\"" << currentPath << "/" << sisName << "\" - \"!:\\private\\2002CCCE\\import\\" << sisName << "\"" << endl; QString bootStrapPath = QLibraryInfo::location(QLibraryInfo::PrefixPath); bootStrapPath.append("/smartinstaller.sis"); -- cgit v0.12 From 534d22fd647f79b9fde08329a6b9e355c6611132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 30 Sep 2010 13:29:28 +0200 Subject: Lighthouse: Make application fonts work Reviewed-by:paul --- src/gui/text/qfontdatabase_qpa.cpp | 3 ++- src/gui/text/qplatformfontdatabase_qpa.cpp | 7 ++++++- src/gui/text/qplatformfontdatabase_qpa.h | 2 +- .../fontdatabases/basicunix/qbasicunixfontdatabase.cpp | 10 +++++++--- .../platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h | 4 ++-- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp index 53594aa..19ce1be 100644 --- a/src/gui/text/qfontdatabase_qpa.cpp +++ b/src/gui/text/qfontdatabase_qpa.cpp @@ -199,7 +199,8 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt) { QFontDatabasePrivate *db = privateDb(); - QApplicationPrivate::platformIntegration()->fontDatabase()->addApplicationFont(fnt->data,fnt->fileName); + fnt->families = QApplicationPrivate::platformIntegration()->fontDatabase()->addApplicationFont(fnt->data,fnt->fileName); + db->reregisterAppFonts = true; } diff --git a/src/gui/text/qplatformfontdatabase_qpa.cpp b/src/gui/text/qplatformfontdatabase_qpa.cpp index 7bb1f9a..26f4faa 100644 --- a/src/gui/text/qplatformfontdatabase_qpa.cpp +++ b/src/gui/text/qplatformfontdatabase_qpa.cpp @@ -165,12 +165,17 @@ QStringList QPlatformFontDatabase::fallbacksForFamily(const QString family, cons return QStringList(); } -void QPlatformFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName) +/*! + Adds an application font. Returns a list of family names, or an empty list if the font could + not be added +*/ +QStringList QPlatformFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName) { Q_UNUSED(fontData); Q_UNUSED(fileName); qWarning("This plugin does not support application fonts"); + return QStringList(); } void QPlatformFontDatabase::releaseHandle(void *handle) diff --git a/src/gui/text/qplatformfontdatabase_qpa.h b/src/gui/text/qplatformfontdatabase_qpa.h index a34033f..adaa4cb 100644 --- a/src/gui/text/qplatformfontdatabase_qpa.h +++ b/src/gui/text/qplatformfontdatabase_qpa.h @@ -46,7 +46,7 @@ public: virtual void populateFontDatabase(); virtual QFontEngine *fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *handle); virtual QStringList fallbacksForFamily(const QString family, const QFont::Style &style, const QUnicodeTables::Script &script) const; - virtual void addApplicationFont(const QByteArray &fontData, const QString &fileName); + virtual QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName); virtual void releaseHandle(void *handle); virtual QString fontDir() const; diff --git a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp index 5b8ca63..5b6f69a 100644 --- a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp +++ b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp @@ -204,9 +204,9 @@ QStringList QBasicUnixFontDatabase::fallbacksForFamily(const QString family, con return QStringList(); } -void QBasicUnixFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName) +QStringList QBasicUnixFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName) { - addTTFile(fontData,fileName.toLocal8Bit()); + return addTTFile(fontData,fileName.toLocal8Bit()); } void QBasicUnixFontDatabase::releaseHandle(void *handle) @@ -215,13 +215,14 @@ void QBasicUnixFontDatabase::releaseHandle(void *handle) delete file; } -void QBasicUnixFontDatabase::addTTFile(const QByteArray &fontData, const QByteArray &file) +QStringList QBasicUnixFontDatabase::addTTFile(const QByteArray &fontData, const QByteArray &file) { extern FT_Library qt_getFreetype(); FT_Library library = qt_getFreetype(); int index = 0; int numFaces = 0; + QStringList families; do { FT_Face face; FT_Error error; @@ -275,7 +276,10 @@ void QBasicUnixFontDatabase::addTTFile(const QByteArray &fontData, const QByteAr registerFont(family,"",weight,style,100,true,true,0,writingSystems,fontFile); + families.append(family); + FT_Done_Face(face); ++index; } while (index < numFaces); + return families; } diff --git a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h index 401a4aa..95015df 100644 --- a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h +++ b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h @@ -17,10 +17,10 @@ public: void populateFontDatabase(); QFontEngine *fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *handle); QStringList fallbacksForFamily(const QString family, const QFont::Style &style, const QUnicodeTables::Script &script) const; - void addApplicationFont(const QByteArray &fontData, const QString &fileName); + QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName); void releaseHandle(void *handle); - static void addTTFile(const QByteArray &fontData, const QByteArray &file); + static QStringList addTTFile(const QByteArray &fontData, const QByteArray &file); }; #endif // QBASICUNIXFONTDATABASE_H -- cgit v0.12 From d9f42e554c1da7aafad59881e1d143ff8672b833 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 30 Sep 2010 14:19:46 +0200 Subject: Lighthouse: make QFontconfigDatabase not override application font --- .../fontdatabases/fontconfig/qfontconfigdatabase.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp index 562cb2d..85515ed 100644 --- a/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -392,10 +392,13 @@ void QFontconfigDatabase::populateFontDatabase() ++f; } - const FcDefaultFont *s = defaults; - QFont font("Sans Serif"); - font.setPointSize(9); - QApplication::setFont(font); + //Lighthouse has very lazy population of the font db. We want it to be initialized when + //QApplication is constructed, so that the population procedure can do something like this to + //set the default font +// const FcDefaultFont *s = defaults; +// QFont font("Sans Serif"); +// font.setPointSize(9); +// QApplication::setFont(font); } QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, QUnicodeTables::Script script, void *usrPtr) -- cgit v0.12 From 41f8b74b2c133ddc79962c75fd22e335caec0f0f Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 30 Sep 2010 16:12:24 +0200 Subject: Doc: Shorten lists of basic QML types. --- doc/src/declarative/extending-tutorial.qdoc | 14 ++++---------- doc/src/declarative/extending.qdoc | 19 +++++++------------ 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/doc/src/declarative/extending-tutorial.qdoc b/doc/src/declarative/extending-tutorial.qdoc index 349ac30..1e5441b 100644 --- a/doc/src/declarative/extending-tutorial.qdoc +++ b/doc/src/declarative/extending-tutorial.qdoc @@ -290,19 +290,13 @@ enum-type property to store a display mode for each chart: \endcode We can also use various other property types. QML has built-in support for the following -types: +types listed in the \l{Extending Types from QML} document, including the following: \list -\o bool -\o unsigned int, int -\o float, double, qreal -\o QString -\o QUrl -\o QColor +\o bool, unsigned int, int, float, double, qreal +\o QString, QUrl, QColor \o QDate, QTime, QDateTime -\o QPoint, QPointF -\o QSize, QSizeF -\o QRect, QRectF +\o QPoint, QPointF, QSize, QSizeF, QRect, QRectF \o QVariant \endlist diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index 0cc989d..0c41c93 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -80,19 +80,14 @@ Types can be registered by libraries, application code, or by plugins Once registered, all \l {Qt's Property System}{properties} of the supported types are available in QML. QML has intrinsic support for -properties of these types: +properties of the types listed in the \l{Extending Types from QML} +document, including the following: \list -\o bool -\o unsigned int, int -\o float, double, qreal -\o QString -\o QUrl -\o QColor +\o bool, unsigned int, int, float, double, qreal +\o QString, QUrl, QColor \o QDate, QTime, QDateTime -\o QPoint, QPointF -\o QSize, QSizeF -\o QRect, QRectF +\o QPoint, QPointF, QSize, QSizeF, QRect, QRectF \o QVariant \endlist @@ -432,7 +427,7 @@ onChanged, regardless of the name used for the NOTIFY signal in C++. We recommend using Changed() for the NOTIFY signal in C++. -See also \l {Extending types from QML}. +See also \l {Extending Types from QML}. \section1 Methods @@ -640,7 +635,7 @@ public: /*! \page qml-extending-types.html -\title Extending types from QML +\title Extending Types from QML Many of the elements available for use in QML are implemented in \l {Extending QML in C++}{C++}. These types are know as "core types". QML -- cgit v0.12 From 72b1a614748add429f301ea156760fafc01a5128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Thu, 30 Sep 2010 17:11:09 +0200 Subject: Added support for updating the baselines via the generated HTML reports. The baselineserver can now run as a CGI binary if it detects that the QUERY_STRING variable is set. Currently it only handles commands for updating the baselines for failed tests. For this to work properly the baselineserver binary needs to have the setuid bit set, so that when it's run as a CGI binary, it will have the proper rights to move files around. The server currently assumes the CGI binary is a link to the baselineserver executable named 'server.cgi' in the configured 'cgi-bin' directory. --- tests/arthur/baselineserver/src/baselineserver.cpp | 70 +++++++++++++++++++++- tests/arthur/baselineserver/src/baselineserver.h | 5 ++ tests/arthur/baselineserver/src/htmlpage.cpp | 36 +++++++++++ tests/arthur/baselineserver/src/htmlpage.h | 3 +- tests/arthur/baselineserver/src/main.cpp | 8 ++- 5 files changed, 117 insertions(+), 5 deletions(-) diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp index c25bfc4..41e48eb 100644 --- a/tests/arthur/baselineserver/src/baselineserver.cpp +++ b/tests/arthur/baselineserver/src/baselineserver.cpp @@ -6,6 +6,7 @@ #include #include #include +#include QString BaselineServer::storage; @@ -29,6 +30,13 @@ QString BaselineServer::storagePath() return storage; } +QString BaselineServer::baseUrl() +{ + return QLS("http://") + + QHostInfo::localHostName().toLatin1() + '.' + + QHostInfo::localDomainName().toLatin1() + '/'; +} + void BaselineServer::incomingConnection(int socketDescriptor) { qDebug() << "Server: New connection!"; @@ -190,9 +198,7 @@ void BaselineHandler::storeImage(const QByteArray &itemBlock, bool isBaseline) QByteArray msg(isBaseline ? "New baseline image stored: " : "Mismatch report: " ); - msg += "http://" - + QHostInfo::localHostName().toLatin1() + '.' - + QHostInfo::localDomainName().toLatin1() + '/'; + msg += BaselineServer::baseUrl(); if (isBaseline) msg += pathForItem(item, true, false).toLatin1() + FileFormat; else @@ -243,6 +249,64 @@ QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline, boo } +QString BaselineHandler::updateAllBaselines(const QString &host, const QString &id, + const QString &engine, const QString &format) +{ + QString basePath(BaselineServer::storagePath()); + QString srcDir(basePath + host + QLC('/') + + QString(QLS("mismatches_%1_%2/")).arg(engine, format) + + id); + QString dstDir(basePath + host + QLC('/') + + QString(QLS("baselines_%1_%2/")).arg(engine, format)); + + QDir dir(srcDir); + QStringList nameFilter; + nameFilter << "*.metadata" << "*.png"; + QStringList fileList = dir.entryList(nameFilter, QDir::Files | QDir::NoDotAndDotDot); + + // remove the generated _fuzzycompared.png and _compared.png files from the list + QMutableStringListIterator it(fileList); + while (it.hasNext()) { + it.next(); + if (it.value().endsWith(QLS("compared.png"))) + it.remove(); + } + + QString res; + QProcess proc; + proc.setWorkingDirectory(srcDir); + proc.setProcessChannelMode(QProcess::MergedChannels); + proc.start(QLS("cp"), QStringList() << QLS("-f") << fileList << dstDir); + proc.waitForFinished(); + if (proc.exitCode() == 0) + res = QLS("Successfully updated baseline for all failed tests."); + else + res = QString("Error updating baseline: %1
" + "Command output:
%2
").arg(proc.errorString(), proc.readAll().constData()); + + return res; +} + +QString BaselineHandler::updateSingleBaseline(const QString &oldBaseline, const QString &newBaseline) +{ + QString res; + QString basePath(BaselineServer::storagePath()); + QString srcBase(basePath + newBaseline.left(newBaseline.length() - 3)); + QString dstDir(basePath + oldBaseline.left(oldBaseline.lastIndexOf(QLC('/')))); + + QProcess proc; + proc.setProcessChannelMode(QProcess::MergedChannels); + proc.start(QLS("cp"), QStringList() << QLS("-f") << srcBase + QLS("png") << srcBase + QLS("metadata") << dstDir); + proc.waitForFinished(); + if (proc.exitCode() == 0) + res = QString("Successfully updated '%1'").arg(oldBaseline + QLS("/metadata")); + else + res = QString("Error updating baseline: %1
" + "Command output:
%2
").arg(proc.errorString(), proc.readAll().constData()); + + return res; +} + void BaselineHandler::testPathMapping() { qDebug() << "Storage prefix:" << BaselineServer::storagePath(); diff --git a/tests/arthur/baselineserver/src/baselineserver.h b/tests/arthur/baselineserver/src/baselineserver.h index 8d791e0..b77bc09 100644 --- a/tests/arthur/baselineserver/src/baselineserver.h +++ b/tests/arthur/baselineserver/src/baselineserver.h @@ -23,6 +23,7 @@ public: BaselineServer(QObject *parent = 0); static QString storagePath(); + static QString baseUrl(); protected: void incomingConnection(int socketDescriptor); @@ -59,6 +60,10 @@ public: BaselineHandler(int socketDescriptor = -1); void testPathMapping(); + static QString updateAllBaselines(const QString &host, const QString &id, + const QString &engine, const QString &format); + static QString updateSingleBaseline(const QString &oldBaseline, const QString &newBaseline); + private slots: void receiveRequest(); void receiveDisconnect(); diff --git a/tests/arthur/baselineserver/src/htmlpage.cpp b/tests/arthur/baselineserver/src/htmlpage.cpp index 3ff138f..4f53c67 100644 --- a/tests/arthur/baselineserver/src/htmlpage.cpp +++ b/tests/arthur/baselineserver/src/htmlpage.cpp @@ -1,7 +1,9 @@ #include "htmlpage.h" #include "baselineprotocol.h" +#include "baselineserver.h" #include #include +#include HTMLPage::HTMLPage() : headerWritten(false) @@ -36,6 +38,9 @@ void HTMLPage::writeHeader(const ImageItem &item) { path = QLS("reports/") + id + QLC('_') + item.engineAsString() + QLC('_') + item.formatAsString() + QLS(".html"); + + QString pageUrl = BaselineServer::baseUrl() + path; + file.setFileName(root + path); if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) qWarning() << "Failed to open report file" << file.fileName(); @@ -47,6 +52,10 @@ void HTMLPage::writeHeader(const ImageItem &item) out << "

Build key: " << plat.buildKey << "

\n"; out << "

Engine: " << item.engineAsString() << "

\n"; out << "

Format: " << item.formatAsString() << "

\n\n"; + out << "

Update all baselines

\n\n"; out << "

"; out() << ""; generateSynopsis(qmn,relative,marker,CodeMarker::Detailed,false); -- cgit v0.12 From b255a070907cca8a7f6857e24019ea49093a4d36 Mon Sep 17 00:00:00 2001 From: Frank Reininghaus Date: Wed, 22 Sep 2010 10:19:59 +0200 Subject: QTreeView: do not scroll to top if last item is removed When the last item is the current item and is removed, QTreeViewPrivate::updateScrollBars() is called after QTreeViewPrivate's viewItems member is cleared. This commit makes sure that viewItems is restored by calling QTreeView::doItemsLayout() in this case, preventing that the scroll bar range is set to zero temporarily and the view is scrolled to the top unexpectedly (this was a regression in 4.7.0: QTBUG-13567). Merge-request: 2481 Reviewed-by: Olivier Goffart (cherry picked from commit 6da6b7099d4e0b49329793e4b90703ec3d868048) --- src/gui/itemviews/qtreeview.cpp | 4 ++++ tests/auto/qtreeview/tst_qtreeview.cpp | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index b797776..40b51fe 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -3435,6 +3435,10 @@ void QTreeViewPrivate::updateScrollBars() if (!viewportSize.isValid()) viewportSize = QSize(0, 0); + if (viewItems.isEmpty()) { + q->doItemsLayout(); + } + int itemsInViewport = 0; if (uniformRowHeights) { if (defaultItemHeight <= 0) diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index 7e2e800..c7b53e9 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -240,6 +240,7 @@ private slots: void taskQTBUG_6450_selectAllWith1stColumnHidden(); void taskQTBUG_9216_setSizeAndUniformRowHeightsWrongRepaint(); void taskQTBUG_11466_keyboardNavigationRegression(); + void taskQTBUG_13567_removeLastItemRegression(); }; class QtTestModel: public QAbstractItemModel @@ -3910,5 +3911,26 @@ void tst_QTreeView::taskQTBUG_11466_keyboardNavigationRegression() QTRY_COMPARE(treeView.currentIndex(), treeView.selectionModel()->selection().indexes().first()); } +void tst_QTreeView::taskQTBUG_13567_removeLastItemRegression() +{ + QtTestModel model(200, 1); + + QTreeView view; + view.setSelectionMode(QAbstractItemView::ExtendedSelection); + view.setModel(&model); + view.show(); + QTest::qWaitForWindowShown(&view); + + view.scrollToBottom(); + QTest::qWait(10); + CHECK_VISIBLE(199, 0); + + view.setCurrentIndex(model.index(199, 0)); + model.removeLastRow(); + QTest::qWait(10); + QCOMPARE(view.currentIndex(), model.index(198, 0)); + CHECK_VISIBLE(198, 0); +} + QTEST_MAIN(tst_QTreeView) #include "tst_qtreeview.moc" -- cgit v0.12 From 6fd33c5028632d279646dcd2f6857f0602a07fe5 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 22 Sep 2010 11:35:39 +0200 Subject: Fix a crash with D&d on mingw The Drag&Drop callbacks need to be correctly aligned to not crash in the graphics SSE code. Task-number: QTBUG-13787 Reviewed-by: benjamin poulain (cherry picked from commit a7c28aa588417c0a75f82d55019814443f889340) --- src/gui/kernel/qdnd_win.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qdnd_win.cpp b/src/gui/kernel/qdnd_win.cpp index a164c2a..7083886 100644 --- a/src/gui/kernel/qdnd_win.cpp +++ b/src/gui/kernel/qdnd_win.cpp @@ -515,7 +515,7 @@ static inline Qt::MouseButtons keystate_to_mousebutton(DWORD grfKeyState) //--------------------------------------------------------------------- // IDropSource Methods //--------------------------------------------------------------------- -STDMETHODIMP +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QOleDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState) { #ifdef QDND_DEBUG @@ -545,7 +545,7 @@ QOleDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState) } } -STDMETHODIMP +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QOleDropSource::GiveFeedback(DWORD dwEffect) { Qt::DropAction action = translateToQDragDropAction(dwEffect); @@ -626,7 +626,7 @@ QOleDropTarget::Release(void) // IDropTarget Methods //--------------------------------------------------------------------- -STDMETHODIMP +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QOleDropTarget::DragEnter(LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) { #ifdef QDND_DEBUG @@ -688,7 +688,7 @@ void QOleDropTarget::sendDragEnterEvent(QWidget *dragEnterWidget, DWORD grfKeySt } -STDMETHODIMP +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QOleDropTarget::DragOver(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) { #ifdef QDND_DEBUG @@ -758,7 +758,7 @@ QOleDropTarget::DragOver(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) return NOERROR; } -STDMETHODIMP +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QOleDropTarget::DragLeave() { #ifdef QDND_DEBUG @@ -785,7 +785,7 @@ QOleDropTarget::DragLeave() #define KEY_STATE_BUTTON_MASK (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON) -STDMETHODIMP +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QOleDropTarget::Drop(LPDATAOBJECT /*pDataObj*/, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) { #ifdef QDND_DEBUG -- cgit v0.12 From 3c68304a73e52a2cca5bfc0e43b379d2857bd92a Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Thu, 23 Sep 2010 13:43:26 +0200 Subject: Incorrect translations for application menu items on Mac OS X. This is a regression fron 4.6 release. Menu entries with some specific roles are automatically merged to the application menu. They are now translated based on the context "MAC_APPLICATION_MENU" instead of "QMenuBar" context. This patch eanbles the use for both contexts. Task-number: QTBUG-13878 Reviewed-by: Richard Moe Gustavsen (cherry picked from commit 7d878ba53909157cf1911c30ce973378589c2cc0) --- src/gui/kernel/qapplication.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 43d5772..185af9a 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -2397,8 +2397,13 @@ static const char *application_menu_strings[] = { }; QString qt_mac_applicationmenu_string(int type) { - return qApp->translate("MAC_APPLICATION_MENU", - application_menu_strings[type]); + QString menuString = QString::fromLatin1(application_menu_strings[type]); + QString translated = qApp->translate("QMenuBar", application_menu_strings[type]); + if (translated != menuString) + return translated; + else + return qApp->translate("MAC_APPLICATION_MENU", + application_menu_strings[type]); } #endif #endif -- cgit v0.12 From a0dc929adce57da459a27927d66c05c2f22b3560 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Wed, 22 Sep 2010 15:41:40 +0200 Subject: Avoid OpenVG rendering errors when stroking an aliased path. Stroking a path can sometimes result in inconsistent rendering especially when combined with a clip. For example, if the logical edge of a clip rect coincides with the logical edge of a path then it can happen that the edge is not painted correctly because the stroke lies outside the bounds of the clip rect. To workaround this problem, we add the 'aliasedCoordinateDelta' such that the rounding will err on the side of caution. This improves the correctness when using the raster engine as a reference. Task-number: QTBUG-13165 Reviewed-by: Samuel (cherry picked from commit 74f09c794d5fdcb8f4b547b1c55bcd512ef07b95) --- src/openvg/qpaintengine_vg.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 3c2fd3d..74395a2 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -248,7 +248,11 @@ public: inline void ensurePathTransform() { if (!pathTransformSet) { - setTransform(VG_MATRIX_PATH_USER_TO_SURFACE, pathTransform); + QTransform aliasedTransform = pathTransform; + if (renderingQuality == VG_RENDERING_QUALITY_NONANTIALIASED && currentPen != Qt::NoPen) + aliasedTransform = aliasedTransform + * QTransform::fromTranslate(aliasedCoordinateDelta, -aliasedCoordinateDelta); + setTransform(VG_MATRIX_PATH_USER_TO_SURFACE, aliasedTransform); pathTransformSet = true; } } @@ -306,6 +310,7 @@ inline void QVGPaintEnginePrivate::setRenderingQuality(VGRenderingQuality mode) if (renderingQuality != mode) { vgSeti(VG_RENDERING_QUALITY, mode); renderingQuality = mode; + pathTransformSet = false; // need to tweak transform for aliased stroking } } -- cgit v0.12 From 6700a9f41692912f221fac55e4cae1809549fa13 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 24 Sep 2010 18:55:45 +0200 Subject: Doc: Fixed non-well-formed table output. Reviewed-by: Trust Me --- tools/qdoc3/htmlgenerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index caa4a29..8d39acf 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -933,7 +933,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, else out() << "

ConstantConstantValueDescription
\n" "\n" "\n" @@ -55,6 +64,7 @@ void HTMLPage::writeHeader(const ImageItem &item) "\n" "\n" "\n" + "\n" "\n\n"; } @@ -73,12 +83,15 @@ void HTMLPage::addItem(const QString &baseline, const QString &rendered, const I } QString compared = generateCompared(baseline, rendered); QString fuzzy = generateCompared(baseline, rendered, true); + QString pageUrl = BaselineServer::baseUrl() + path; out << "\n"; out << "\n"; QStringList images = QStringList() << baseline << rendered << compared << fuzzy; foreach(const QString& img, images) out << "\n"; + out << "\n"; out << "\n\n"; } @@ -108,3 +121,26 @@ QString HTMLPage::generateCompared(const QString &baseline, const QString &rende QProcess::execute(QLS("compare"), args); return res; } + + +void HTMLPage::handleCGIQuery(const QString &query) +{ + QUrl cgiUrl(QLS("http://dummy/cgi-bin/dummy.cgi?") + query); + QTextStream s(stdout); + s << "Content-Type: text/html\r\n\r\n" + << ""; +// << "Contents of QUERY_STRING:
" +// << "Full string = " << query << "
"; + + if (cgiUrl.queryItemValue(QLS("update")) == QLS("single")) { + s << BaselineHandler::updateSingleBaseline(cgiUrl.queryItemValue(QLS("oldBaseline")), + cgiUrl.queryItemValue(QLS("newBaseline"))); + } else { + s << BaselineHandler::updateAllBaselines(cgiUrl.queryItemValue(QLS("host")), + cgiUrl.queryItemValue(QLS("id")), + cgiUrl.queryItemValue(QLS("engine")), + cgiUrl.queryItemValue(QLS("format"))); + } + s << "

Back to report"; + s << ""; +} diff --git a/tests/arthur/baselineserver/src/htmlpage.h b/tests/arthur/baselineserver/src/htmlpage.h index af0e364..29b4ff5 100644 --- a/tests/arthur/baselineserver/src/htmlpage.h +++ b/tests/arthur/baselineserver/src/htmlpage.h @@ -14,9 +14,10 @@ public: void start(const QString &storagePath, const QString &runId, const PlatformInfo pinfo); void addItem(const QString &baseline, const QString &rendered, const ImageItem &item); void end(); - QString filePath(); + static void handleCGIQuery(const QString &query); + private: void writeHeader(const ImageItem &item); void writeFooter(); diff --git a/tests/arthur/baselineserver/src/main.cpp b/tests/arthur/baselineserver/src/main.cpp index a69a5a2..0e15a60 100644 --- a/tests/arthur/baselineserver/src/main.cpp +++ b/tests/arthur/baselineserver/src/main.cpp @@ -1,11 +1,17 @@ #include #include "baselineserver.h" - int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); + QString queryString(qgetenv("QUERY_STRING")); + if (!queryString.isEmpty()) { + // run as CGI script + HTMLPage::handleCGIQuery(queryString); + return 0; + } + if (a.arguments().contains(QLatin1String("-testmapping"))) { BaselineHandler h; h.testPathMapping(); -- cgit v0.12 From f9312fec1c44097a2093b3075aa68901327eb9c5 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 29 Sep 2010 14:02:10 +0200 Subject: Fixes cursor shape when widget becomes native on X11. When a native window handle is created for a widget that has override cursor set, we should reset the cursor on the parent and set the cursor on the new window handle. Task-number: QTBUG-6185 Reviewed-by: Olivier Goffart (cherry picked from commit 9e9a7bc29319d52c3e563bc2c5282cb7e6890eba) --- src/gui/kernel/qwidget_x11.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index e01489f..8d80e10 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -889,8 +889,10 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO q->setWindowOpacity(maybeTopData()->opacity/255.); } - } else if (q->testAttribute(Qt::WA_SetCursor) && q->internalWinId()) { + } else if (q->internalWinId()) { qt_x11_enforce_cursor(q); + if (QWidget *p = q->parentWidget()) // reset the cursor on the native parent + qt_x11_enforce_cursor(p); } if (extra && !extra->mask.isEmpty() && q->internalWinId()) -- cgit v0.12 From 5efa6ff7ca33d2dca14418ac8ffb49b69e2e2452 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Thu, 30 Sep 2010 13:45:00 +0200 Subject: QAxBase::dynamicCall() returns invalid QVariant Starting from 4.7.0, QVariant is recognized as a standard type by the meta type system. ActiveQt needs to consider this while converting COM VARIANT types to a QVariant. Task-number: QTBUG-13845 Reviewed-by: Volker Hilsheimer Reviewed-by: Olivier Goffart (cherry picked from commit fc50d7ecaacfbfef1dbefd6ffdc083cb66c5633c) --- src/activeqt/shared/qaxtypes.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/activeqt/shared/qaxtypes.cpp b/src/activeqt/shared/qaxtypes.cpp index 957733e..ff21a9f 100644 --- a/src/activeqt/shared/qaxtypes.cpp +++ b/src/activeqt/shared/qaxtypes.cpp @@ -1376,8 +1376,10 @@ QVariant VARIANTToQVariant(const VARIANT &arg, const QByteArray &typeName, uint } QVariant::Type proptype = (QVariant::Type)type; - if (proptype == QVariant::Invalid && !typeName.isEmpty()) - proptype = QVariant::nameToType(typeName); + if (proptype == QVariant::Invalid && !typeName.isEmpty()) { + if (typeName != "QVariant") + proptype = QVariant::nameToType(typeName); + } if (proptype != QVariant::LastType && proptype != QVariant::Invalid && var.type() != proptype) { if (var.canConvert(proptype)) { QVariant oldvar = var; -- cgit v0.12 From bb0d20406d5d1b473b9f8d9c1284d310405fcd47 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 28 Sep 2010 13:55:04 +1000 Subject: Fix crash when trying to append a null transform to QDeclarativeItem. Task-number: QTBUG-13893 (cherry picked from commit 085a121cb1ebba38d62c924500dbc71806b29b3c) --- src/declarative/graphicsitems/qdeclarativeitem.cpp | 2 +- .../declarative/qdeclarativeitem/data/transformCrash.qml | 13 +++++++++++++ .../declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp | 12 ++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 tests/auto/declarative/qdeclarativeitem/data/transformCrash.qml diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index e9da4f7..230169d 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -1705,7 +1705,7 @@ int QDeclarativeItemPrivate::transform_count(QDeclarativeListProperty *list, QGraphicsTransform *item) { QGraphicsObject *object = qobject_cast(list->object); - if (object) // QGraphicsItem applies the list in the wrong order, so we prepend. + if (object && item) // QGraphicsItem applies the list in the wrong order, so we prepend. QGraphicsItemPrivate::get(object)->prependGraphicsTransform(item); } diff --git a/tests/auto/declarative/qdeclarativeitem/data/transformCrash.qml b/tests/auto/declarative/qdeclarativeitem/data/transformCrash.qml new file mode 100644 index 0000000..ab7fa84 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeitem/data/transformCrash.qml @@ -0,0 +1,13 @@ +import Qt 4.7 + +Item { + id: wrapper + width: 200 + height: 200 + + QtObject { + id: object + } + + Component.onCompleted: wrapper.transform = object +} diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp index 25ca157..6b28c53 100644 --- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp @@ -81,6 +81,8 @@ private slots: void resourcesProperty(); void mouseFocus(); + void transformCrash(); + private: template T *findItem(QGraphicsObject *parent, const QString &objectName); @@ -792,6 +794,16 @@ void tst_QDeclarativeItem::childrenRectBug3() delete canvas; } +// QTBUG-13893 +void tst_QDeclarativeItem::transformCrash() +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/transformCrash.qml")); + canvas->show(); + + delete canvas; +} + template T *tst_QDeclarativeItem::findItem(QGraphicsObject *parent, const QString &objectName) { -- cgit v0.12 From 916cc3ac7dde877ae8dd605f217699ecf9da06c6 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 30 Sep 2010 16:11:43 +0300 Subject: Added support for unsigned smart installer package creation in Symbian Make target "unsigned_installer_sis" can now be used to create unsigned smart installer sis. The contained application sis will also be unsigned. Task-number: QTBUG-13902 Reviewed-by: axis (cherry picked from commit 6d5309c2fbdbf15948b430de103f393c5af5b7cd) --- bin/createpackage.pl | 27 +++++++++++++++++++++++++-- doc/src/platforms/symbian-introduction.qdoc | 2 ++ mkspecs/features/symbian/sis_targets.prf | 24 ++++++++++++++++++++++-- 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/bin/createpackage.pl b/bin/createpackage.pl index cce0b54..72c61f6 100755 --- a/bin/createpackage.pl +++ b/bin/createpackage.pl @@ -148,6 +148,10 @@ my $certfilepath = abs_path(dirname($certfile)); my $templatepkg = $ARGV[0]; my $targetplatform = lc $ARGV[1]; +if ($targetplatform eq "") { + $targetplatform = "-"; +} + my @tmpvalues = split('-', $targetplatform); my $target; $target = $tmpvalues[0] or $target = ""; @@ -179,11 +183,11 @@ $passphrase = $ARGV[4] or $passphrase = ""; my $pkgoutputbasename = $templatepkg; my $preservePkgOutput = ""; $pkgoutputbasename =~ s/_template/_$targetplatform/g; +$pkgoutputbasename =~ s/_installer\.pkg/_installer___temp\.pkg/g; if ($pkgoutputbasename eq $templatepkg) { $preservePkgOutput = "1"; } $pkgoutputbasename =~ s/\.pkg//g; -$pkgoutputbasename = $pkgoutputbasename; # Store output file names to variables my $pkgoutput = $pkgoutputbasename.".pkg"; @@ -191,6 +195,7 @@ my $sisoutputbasename; if ($signed_sis_name eq "") { $sisoutputbasename = $pkgoutputbasename; $sisoutputbasename =~ s/_$targetplatform//g; + $sisoutputbasename =~ s/_installer___temp/_installer/g; $signed_sis_name = $sisoutputbasename.".sis"; } else { $sisoutputbasename = $signed_sis_name; @@ -201,6 +206,16 @@ if ($signed_sis_name eq "") { } } +my $installer_unsigned_app_sis_name = ""; +my $installer_app_sis_name = ""; + +if ($templatepkg =~ m/_installer\.pkg$/i && $onlyUnsigned) { + $installer_unsigned_app_sis_name = $templatepkg; + $installer_unsigned_app_sis_name =~ s/_installer.pkg$/_unsigned.sis/i; + $installer_app_sis_name = $installer_unsigned_app_sis_name; + $installer_app_sis_name =~ s/_unsigned.sis$/.sis/; +} + my $unsigned_sis_name = $sisoutputbasename."_unsigned.sis"; my $stub_sis_name = $sisoutputbasename.".sis"; @@ -271,7 +286,9 @@ if (length($certfile)) { # Remove any existing .sis packages unlink $unsigned_sis_name; -unlink $signed_sis_name; +if (!$onlyUnsigned) { + unlink $signed_sis_name; +} if (!$preservePkgOutput) { unlink $pkgoutput; } @@ -296,6 +313,10 @@ if (m/\$\(PLATFORM\)/) { s/\$\(PLATFORM\)/$platform/gm; s/\$\(TARGET\)/$target/gm; +if ($installer_unsigned_app_sis_name ne "") { + s/$installer_app_sis_name\"/$installer_unsigned_app_sis_name\"/; +} + #write the output open( OUTPUT, ">$pkgoutput" ) or die "Error '$pkgoutput' $!\n"; print OUTPUT $_; @@ -347,6 +368,7 @@ if($stub) { if (!$preservePkgOutput) { unlink $pkgoutput; } + print ("\n"); exit; } @@ -388,6 +410,7 @@ if($stub) { # Lets leave the generated PKG for problem solving purposes print ("\nSIS creation failed!\n"); } + print ("\n"); } #end of file diff --git a/doc/src/platforms/symbian-introduction.qdoc b/doc/src/platforms/symbian-introduction.qdoc index fafe007..9bf5c72 100644 --- a/doc/src/platforms/symbian-introduction.qdoc +++ b/doc/src/platforms/symbian-introduction.qdoc @@ -144,6 +144,8 @@ Smart installer will attempt to download missing dependencies in addition to just installing the application. + \row \o \c unsigned_installer_sis \o Create unsigned \l{Smart Installer}{smart installer} + \c .sis file for project. \row \o \c stub_sis \o Create a stub sis to allow upgradability of projects that are deployed in ROM \endtable diff --git a/mkspecs/features/symbian/sis_targets.prf b/mkspecs/features/symbian/sis_targets.prf index 673127e..b145263 100644 --- a/mkspecs/features/symbian/sis_targets.prf +++ b/mkspecs/features/symbian/sis_targets.prf @@ -73,6 +73,17 @@ equals(GENERATE_SIS_TARGETS, true) { ok_installer_sis_target.commands = createpackage.bat $(QT_SIS_OPTIONS) $${baseTarget}_installer.pkg - \ $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE) + unsigned_installer_sis_target.target = unsigned_installer_sis + unsigned_installer_sis_target.commands = $(if $(wildcard $${baseTarget}_installer.pkg), \ + $(MAKE) -f $(MAKEFILE) ok_unsigned_installer_sis \ + , \ + $(MAKE) -f $(MAKEFILE) fail_sis_nopkg \ + ) + unsigned_installer_sis_target.depends = unsigned_sis + + ok_unsigned_installer_sis_target.target = ok_unsigned_installer_sis + ok_unsigned_installer_sis_target.commands = createpackage $(QT_SIS_OPTIONS) -o $${baseTarget}_installer.pkg + fail_sis_nopkg_target.target = fail_sis_nopkg fail_sis_nopkg_target.commands = "$(error PKG file does not exist, 'sis' and 'installer_sis' target are only supported for executables or projects with DEPLOYMENT statement)" @@ -105,6 +116,8 @@ equals(GENERATE_SIS_TARGETS, true) { target_sis_target \ installer_sis_target \ ok_installer_sis_target \ + unsigned_installer_sis_target \ + ok_unsigned_installer_sis_target \ fail_sis_nopkg_target \ fail_sis_nocache_target \ stub_sis_target \ @@ -156,15 +169,22 @@ equals(GENERATE_SIS_TARGETS, true) { $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE) installer_sis_target.depends = sis + unsigned_installer_sis_target.target = unsigned_installer_sis + unsigned_installer_sis_target.commands = $$QMAKE_CREATEPACKAGE $(QT_SIS_OPTIONS) -o $${baseTarget}_installer.pkg + unsigned_installer_sis_target.depends = unsigned_sis + !isEmpty(sis_destdir):!equals(sis_destdir, "."):!equals(sis_destdir, "./") { sis_target.commands += && $$QMAKE_MOVE $${baseTarget}.sis $$sis_destdir - installer_sis_target.commands += && $$QMAKE_MOVE $${baseTarget}.sis $$sis_destdir + unsigned_sis_target.commands += && $$QMAKE_MOVE $${baseTarget}_unsigned.sis $$sis_destdir + installer_sis_target.commands += && $$QMAKE_MOVE $${baseTarget}_installer.sis $$sis_destdir + unsigned_installer_sis_target.commands += && $$QMAKE_MOVE $${baseTarget}_unsigned_installer.sis $$sis_destdir } QMAKE_EXTRA_TARGETS += sis_target \ unsigned_sis_target \ target_sis_target \ - installer_sis_target + installer_sis_target \ + unsigned_installer_sis_target QMAKE_DISTCLEAN += $${sis_destdir}/$${baseTarget}.sis } -- cgit v0.12 From 664fc515072b58765bb35da0920ab4858cf478aa Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 27 Sep 2010 10:56:00 +0200 Subject: QDeclarativeDebugService: Add bc autotest Although it's a private header we use qdeclarativedebugservice_p.h in creator / qmljsdebugger library. Working with a copy of the header in the autotest hopefully catches some bc breakages. (cherry picked from commit 31dcf2b4028b1f76301fc69fccff0a9474a0a135) --- .../private_headers/qdeclarativedebugservice_p.h | 92 ++++++++++++++++++++++ .../qdeclarativedebugservice.pro | 3 +- .../tst_qdeclarativedebugservice.cpp | 2 +- 3 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativedebugservice/private_headers/qdeclarativedebugservice_p.h diff --git a/tests/auto/declarative/qdeclarativedebugservice/private_headers/qdeclarativedebugservice_p.h b/tests/auto/declarative/qdeclarativedebugservice/private_headers/qdeclarativedebugservice_p.h new file mode 100644 index 0000000..0cadbe5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativedebugservice/private_headers/qdeclarativedebugservice_p.h @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEDEBUGSERVICE_H +#define QDECLARATIVEDEBUGSERVICE_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QDeclarativeDebugServicePrivate; +class Q_DECLARATIVE_EXPORT QDeclarativeDebugService : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QDeclarativeDebugService) + Q_DISABLE_COPY(QDeclarativeDebugService) + +public: + explicit QDeclarativeDebugService(const QString &, QObject *parent = 0); + ~QDeclarativeDebugService(); + + QString name() const; + + enum Status { NotConnected, Unavailable, Enabled }; + Status status() const; + + void sendMessage(const QByteArray &); + + static int idForObject(QObject *); + static QObject *objectForId(int); + + static QString objectToString(QObject *obj); + + static bool isDebuggingEnabled(); + static bool hasDebuggingClient(); + +protected: + virtual void statusChanged(Status); + virtual void messageReceived(const QByteArray &); + +private: + friend class QDeclarativeDebugServer; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECLARATIVEDEBUGSERVICE_H + diff --git a/tests/auto/declarative/qdeclarativedebugservice/qdeclarativedebugservice.pro b/tests/auto/declarative/qdeclarativedebugservice/qdeclarativedebugservice.pro index a62e148..83bcadb 100644 --- a/tests/auto/declarative/qdeclarativedebugservice/qdeclarativedebugservice.pro +++ b/tests/auto/declarative/qdeclarativedebugservice/qdeclarativedebugservice.pro @@ -2,7 +2,8 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += network declarative macx:CONFIG -= app_bundle -HEADERS += ../shared/debugutil_p.h +HEADERS += ../shared/debugutil_p.h \ + private_headers/qdeclarativedebugservice_p.h SOURCES += tst_qdeclarativedebugservice.cpp \ ../shared/debugutil.cpp diff --git a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp index 4683199..70679b9 100644 --- a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp +++ b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp @@ -50,8 +50,8 @@ #include #include #include -#include +#include "private_headers/qdeclarativedebugservice_p.h" #include "../../../shared/util.h" #include "../shared/debugutil_p.h" -- cgit v0.12 From bc93f0cb3af281957101b1427635044ac94dac5d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 28 Sep 2010 14:53:44 +0200 Subject: fix moc argument quoting on mingw for some bizarre reason, mingw doesn't like double quotes. so instead of building some more elaborate custom quoting, just let qmake do it for us. Reviewed-by: mariusSO (cherry picked from commit fa5c83003db5dea46fc045b2fd90e6308a0d8911) --- mkspecs/features/moc.prf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mkspecs/features/moc.prf b/mkspecs/features/moc.prf index 15e7fd9..89e9b40 100644 --- a/mkspecs/features/moc.prf +++ b/mkspecs/features/moc.prf @@ -39,22 +39,22 @@ win32:count($$list($$INCLUDEPATH), 40, >) { } } -defineReplace(mocCmd) { +defineReplace(mocCmdBase) { !isEmpty(WIN_INCLUDETEMP) { RET = if(contains(TEMPLATE, "vc.*")|contains(TEMPLATE_PREFIX, "vc")) { RET += $$mocinclude.commands } - RET += $$QMAKE_MOC $(DEFINES) @$$WIN_INCLUDETEMP $$join(QMAKE_COMPILER_DEFINES, " -D", -D) \"$$1\" -o $$2 + RET += $$QMAKE_MOC $(DEFINES) @$$WIN_INCLUDETEMP $$join(QMAKE_COMPILER_DEFINES, " -D", -D) return($$RET) } - return($$QMAKE_MOC $(DEFINES) $(INCPATH) $$join(QMAKE_COMPILER_DEFINES, " -D", -D) \"$$1\" -o $$2) + return($$QMAKE_MOC $(DEFINES) $(INCPATH) $$join(QMAKE_COMPILER_DEFINES, " -D", -D)) } #moc headers moc_header.CONFIG = moc_verify moc_header.dependency_type = TYPE_C -moc_header.commands = ${QMAKE_FUNC_mocCmd} +moc_header.commands = ${QMAKE_FUNC_mocCmdBase} ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} moc_header.output = $$MOC_DIR/$${QMAKE_H_MOD_MOC}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_CPP)} moc_header.input = HEADERS moc_header.variable_out = SOURCES @@ -69,7 +69,7 @@ INCREDIBUILD_XGE += moc_header #moc sources moc_source.CONFIG = no_link moc_verify moc_source.dependency_type = TYPE_C -moc_source.commands = ${QMAKE_FUNC_mocCmd} +moc_source.commands = ${QMAKE_FUNC_mocCmdBase} ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} moc_source.output = $$MOC_DIR/$${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}$${QMAKE_EXT_CPP_MOC} moc_source.input = SOURCES OBJECTIVE_SOURCES moc_source.name = MOC ${QMAKE_FILE_IN} -- cgit v0.12 From 89f383cdd9aa9d928341b15f99ecd9396b2f43cb Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 30 Sep 2010 10:42:21 +0300 Subject: Fix QApplication::desktop()->availableGeometry() for Symbian Since screen geometry changes before client area geometry is changed in Eikon, we need to send two resize events, one for screen area change and one for client area change. Note that the correct way to detect client area change in applications is to connect to QApplication::desktop() signal workAreaResized(int) instead of filtering for resize events meant for QDesktopWidget. Task-number: QTBUG-14058 Reviewed-by: Jason Barron (cherry picked from commit 0725abc4607755833a1eb7cb9e083add48d03a88) --- src/gui/kernel/qapplication_s60.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index e937918..988823b 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -673,6 +673,9 @@ void QSymbianControl::HandleStatusPaneSizeChange() { QS60MainAppUi *s60AppUi = static_cast(S60->appUi()); s60AppUi->HandleStatusPaneSizeChange(); + // Send resize event to trigger desktopwidget workAreaResized signal + QResizeEvent e(qt_desktopWidget->size(), qt_desktopWidget->size()); + QApplication::sendEvent(qt_desktopWidget, &e); } #endif -- cgit v0.12 From 4175e45658abd6913b5152a7637f8a23477b7c2d Mon Sep 17 00:00:00 2001 From: axis Date: Mon, 27 Sep 2010 13:37:14 +0200 Subject: Fixed regression when typing in QTextControl based widgets on Symbian The bug was that when querying for the maximum text length, the case where an invalid QVariant was returned (which is allowed) was not handled properly. This would lead to input being blocked by the input context when it shouldn't. RevBy: Sami Merila (cherry picked from commit 3bb3af84bef3c0472ca8ed0d5c6bb3c82320956d) --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 6 +- tests/auto/qinputcontext/tst_qinputcontext.cpp | 257 +++++++++++++++++++----- 2 files changed, 208 insertions(+), 55 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index af86d77..4a1b9b9 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -238,8 +238,10 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event) } QString widgetText = focusWidget()->inputMethodQuery(Qt::ImSurroundingText).toString(); - int maxLength = focusWidget()->inputMethodQuery(Qt::ImMaximumTextLength).toInt(); - if (!keyEvent->text().isEmpty() && widgetText.size() + m_preeditString.size() >= maxLength) { + bool validLength; + int maxLength = focusWidget()->inputMethodQuery(Qt::ImMaximumTextLength).toInt(&validLength); + if (!keyEvent->text().isEmpty() && validLength + && widgetText.size() + m_preeditString.size() >= maxLength) { // Don't send key events with string content if the widget is "full". return true; } diff --git a/tests/auto/qinputcontext/tst_qinputcontext.cpp b/tests/auto/qinputcontext/tst_qinputcontext.cpp index d077bc1..700a49b 100644 --- a/tests/auto/qinputcontext/tst_qinputcontext.cpp +++ b/tests/auto/qinputcontext/tst_qinputcontext.cpp @@ -67,6 +67,8 @@ public: tst_QInputContext() : m_phoneIsQwerty(false) {} virtual ~tst_QInputContext() {} + template void symbianTestCoeFepInputContext_addData(); + public slots: void initTestCase(); void cleanupTestCase() {} @@ -467,6 +469,7 @@ void tst_QInputContext::focusProxy() void tst_QInputContext::symbianTestCoeFepInputContext_data() { #ifdef Q_OS_SYMBIAN + QTest::addColumn ("editwidget"); QTest::addColumn ("inputMethodEnabled"); QTest::addColumn ("inputMethodHints"); QTest::addColumn ("maxLength"); // Zero for no limit @@ -474,7 +477,23 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() QTest::addColumn > ("keyEvents"); QTest::addColumn ("finalString"); QTest::addColumn ("preeditString"); + + symbianTestCoeFepInputContext_addData(); + symbianTestCoeFepInputContext_addData(); + symbianTestCoeFepInputContext_addData(); +#endif +} + +Q_DECLARE_METATYPE(QWidget *) +Q_DECLARE_METATYPE(QLineEdit *) +Q_DECLARE_METATYPE(QPlainTextEdit *) +Q_DECLARE_METATYPE(QTextEdit *) + +template +void tst_QInputContext::symbianTestCoeFepInputContext_addData() +{ QList events; + QWidget *editwidget; events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); @@ -487,7 +506,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); events << FepReplayEvent('2', '2', 0, 0); events << FepReplayEvent('1', '1', 0, 0); - QTest::newRow("Numbers (no FEP)") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Numbers (no FEP)").toLocal8Bit()) + << editwidget << false << Qt::InputMethodHints(Qt::ImhNone) << 0 @@ -495,7 +517,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("521") << QString(""); - QTest::newRow("Numbers and password mode (no FEP)") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Numbers and password mode (no FEP)").toLocal8Bit()) + << editwidget << false << Qt::InputMethodHints(Qt::ImhNone) << 0 @@ -503,7 +528,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("521") << QString(""); - QTest::newRow("Numbers") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Numbers").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhDigitsOnly) << 0 @@ -511,7 +539,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("521") << QString(""); - QTest::newRow("Numbers max length (no FEP)") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Numbers max length (no FEP)").toLocal8Bit()) + << editwidget << false << Qt::InputMethodHints(Qt::ImhNone) << 2 @@ -519,7 +550,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("21") << QString(""); - QTest::newRow("Numbers max length") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Numbers max length").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhDigitsOnly) << 2 @@ -534,7 +568,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() events << FepReplayEvent(EEventKey, '5', '5', 0, 1); events << FepReplayEvent(EEventKey, '5', '5', 0, 1); events << FepReplayEvent(EEventKeyUp, '5', 0, 0, 0); - QTest::newRow("Numbers and autorepeat (no FEP)") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Numbers and autorepeat (no FEP)").toLocal8Bit()) + << editwidget << false << Qt::InputMethodHints(Qt::ImhNone) << 0 @@ -552,7 +589,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() events << FepReplayEvent('5', '5', 0, 0); events << FepReplayEvent('5', '5', 0, 0); events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); - QTest::newRow("Multitap") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText) << 0 @@ -560,7 +600,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("Adh") << QString(""); - QTest::newRow("Multitap with no auto uppercase") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap with no auto uppercase").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhNoAutoUppercase) << 0 @@ -568,7 +611,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("adh") << QString(""); - QTest::newRow("Multitap with uppercase") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap with uppercase").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhPreferUppercase) << 0 @@ -576,7 +622,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("ADH") << QString(""); - QTest::newRow("Multitap with lowercase") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap with lowercase").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase) << 0 @@ -584,7 +633,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("adh") << QString(""); - QTest::newRow("Multitap with forced uppercase") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap with forced uppercase").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhUppercaseOnly) << 0 @@ -592,7 +644,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("ADH") << QString(""); - QTest::newRow("Multitap with forced lowercase") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap with forced lowercase").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhLowercaseOnly) << 0 @@ -611,7 +666,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() events << FepReplayEvent('5', '5', 0, 0); events << FepReplayEvent('5', '5', 0, 0); events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); - QTest::newRow("Multitap with mode switch") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap with mode switch").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText) << 0 @@ -626,7 +684,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() events << FepReplayEvent('8', '8', 0, 0); events << FepReplayEvent('9', '9', 0, 0); events << FepReplayEvent('9', '9', 0, 0); - QTest::newRow("Multitap with unfinished text") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap with unfinished text").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText) << 0 @@ -635,7 +696,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << QString("Qt") << QString("x"); events << FepReplayEvent(2000); - QTest::newRow("Multitap with committed text") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap with committed text").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText) << 0 @@ -671,7 +735,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() events << FepReplayEvent('8', '8', 0, 0); events << FepReplayEvent(2000); events << FepReplayEvent(EStdKeyDevice3, EKeyDevice3, 0, 0); // Select key - QTest::newRow("Multitap and numbers") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap and numbers").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText) << 0 @@ -679,7 +746,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("H778wmt") << QString(""); - QTest::newRow("T9 and numbers") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9 and numbers").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhPreferLowercase) << 0 @@ -692,7 +762,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() events << FepReplayEvent('4', '4', 0, 0); events << FepReplayEvent('4', '4', 0, 0); events << FepReplayEvent(EStdKeyDevice3, EKeyDevice3, 0, 0); // Select key - QTest::newRow("T9") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhPreferLowercase) << 0 @@ -700,7 +773,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("hi") << QString(""); - QTest::newRow("T9 with uppercase") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9 with uppercase").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhPreferUppercase) << 0 @@ -708,7 +784,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("HI") << QString(""); - QTest::newRow("T9 with forced lowercase") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9 with forced lowercase").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhLowercaseOnly) << 0 @@ -716,7 +795,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("hi") << QString(""); - QTest::newRow("T9 with forced uppercase") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9 with forced uppercase").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhUppercaseOnly) << 0 @@ -724,7 +806,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("HI") << QString(""); - QTest::newRow("T9 with maxlength") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9 with maxlength").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhLowercaseOnly) << 1 @@ -746,7 +831,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() events << FepReplayEvent(EStdKeyRightArrow, EKeyRightArrow, 0, 0); events << FepReplayEvent('8', '8', 0, 0); events << FepReplayEvent('8', '8', 0, 0); - QTest::newRow("T9 with movement and unfinished text") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9 with movement and unfinished text").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhPreferLowercase) << 0 @@ -754,7 +842,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("you hi") << QString("tv"); - QTest::newRow("T9 with movement, password and unfinished text") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9 with movement, password and unfinished text").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhPreferLowercase) << 0 @@ -762,7 +853,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("wmt h") << QString("u"); - QTest::newRow("T9 with movement, maxlength, password and unfinished text") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9 with movement, maxlength, password and unfinished text").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhPreferLowercase) << 2 @@ -770,7 +864,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("wh") << QString(""); - QTest::newRow("T9 with movement, maxlength and unfinished text") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9 with movement, maxlength and unfinished text").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhPreferLowercase) << 2 @@ -778,7 +875,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("hi") << QString(""); - QTest::newRow("Multitap with movement and unfinished text") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap with movement and unfinished text").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase) << 0 @@ -786,7 +886,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("wmt h") << QString("u"); - QTest::newRow("Multitap with movement, maxlength and unfinished text") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap with movement, maxlength and unfinished text").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase) << 2 @@ -794,7 +897,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("wh") << QString(""); - QTest::newRow("Numbers with movement") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Numbers with movement").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhDigitsOnly) << 0 @@ -802,7 +908,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("96804488") << QString(""); - QTest::newRow("Numbers with movement and maxlength") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Numbers with movement and maxlength").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhDigitsOnly) << 2 @@ -810,7 +919,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("44") << QString(""); - QTest::newRow("Numbers with movement, password and unfinished text") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Numbers with movement, password and unfinished text").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhDigitsOnly) << 0 @@ -818,7 +930,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("9680448") << QString("8"); - QTest::newRow("Numbers with movement, maxlength, password and unfinished text") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Numbers with movement, maxlength, password and unfinished text").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhDigitsOnly) << 2 @@ -827,7 +942,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << QString("44") << QString(""); events << FepReplayEvent(EStdKeyRightArrow, EKeyRightArrow, 0, 0); - QTest::newRow("T9 with movement") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9 with movement").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhPreferLowercase) << 0 @@ -835,7 +953,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("you htvi") << QString(""); - QTest::newRow("T9 with movement and password") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9 with movement and password").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhPreferLowercase) << 0 @@ -843,7 +964,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("wmt hu") << QString(""); - QTest::newRow("T9 with movement, maxlength and password") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": T9 with movement, maxlength and password").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhPreferLowercase) << 2 @@ -851,7 +975,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("wh") << QString(""); - QTest::newRow("Multitap with movement") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap with movement").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase) << 0 @@ -859,7 +986,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("wmt hu") << QString(""); - QTest::newRow("Multitap with movement and maxlength") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Multitap with movement and maxlength").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase) << 2 @@ -867,7 +997,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("wh") << QString(""); - QTest::newRow("Numbers with movement and password") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Numbers with movement and password").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhDigitsOnly) << 0 @@ -875,7 +1008,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("96804488") << QString(""); - QTest::newRow("Numbers with movement, maxlength and password") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Numbers with movement, maxlength and password").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhDigitsOnly) << 2 @@ -888,7 +1024,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() // Test that the symbol key successfully does nothing when in number-only mode. events << FepReplayEvent(EEventKeyDown, EStdKeyLeftFunc, 0, 0, 0); events << FepReplayEvent(EEventKeyUp, EStdKeyLeftFunc, 0, 0, 0); - QTest::newRow("Dead symbols key") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Dead symbols key").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhDigitsOnly) << 0 @@ -896,7 +1035,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << events << QString("") << QString(""); - QTest::newRow("Dead symbols key and password") + editwidget = new WidgetType; + QTest::newRow(QString(QString::fromLatin1(editwidget->metaObject()->className()) + + ": Dead symbols key and password").toLocal8Bit()) + << editwidget << true << Qt::InputMethodHints(Qt::ImhDigitsOnly) << 0 @@ -905,7 +1047,6 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << QString("") << QString(""); events.clear(); -#endif } void tst_QInputContext::symbianTestCoeFepInputContext() @@ -918,6 +1059,7 @@ void tst_QInputContext::symbianTestCoeFepInputContext() QSKIP("coefep is not the active input context; skipping test", SkipAll); } + QFETCH(QWidget *, editwidget); QFETCH(bool, inputMethodEnabled); QFETCH(Qt::InputMethodHints, inputMethodHints); QFETCH(int, maxLength); @@ -933,30 +1075,39 @@ void tst_QInputContext::symbianTestCoeFepInputContext() QWidget w; QLayout *layout = new QVBoxLayout; w.setLayout(layout); - QLineEdit *lineedit = new QLineEdit; - layout->addWidget(lineedit); - lineedit->setFocus(); + + layout->addWidget(editwidget); + editwidget->setFocus(); #ifdef QT_KEYPAD_NAVIGATION - lineedit->setEditFocus(true); + editwidget->setEditFocus(true); #endif w.show(); - lineedit->setAttribute(Qt::WA_InputMethodEnabled, inputMethodEnabled); - lineedit->setInputMethodHints(inputMethodHints); - if (maxLength > 0) - lineedit->setMaxLength(maxLength); - lineedit->setEchoMode(echoMode); + editwidget->setAttribute(Qt::WA_InputMethodEnabled, inputMethodEnabled); + editwidget->setInputMethodHints(inputMethodHints); + QLineEdit *lineedit = qobject_cast(editwidget); + if (lineedit) { + if (maxLength > 0) + lineedit->setMaxLength(maxLength); + lineedit->setEchoMode(echoMode); + } else if (maxLength > 0 || echoMode != QLineEdit::Normal) { + // Only QLineEdits support these features so don't attempt any tests using those + // on other widgets. + return; + } QTest::qWait(200); foreach(FepReplayEvent event, keyEvents) { - event.replay(lineedit); + event.replay(editwidget); } QApplication::processEvents(); - QCOMPARE(lineedit->text(), finalString); + QCOMPARE(editwidget->inputMethodQuery(Qt::ImSurroundingText).toString(), finalString); QCOMPARE(ic->m_preeditString, preeditString); + + delete editwidget; #endif } -- cgit v0.12 From 2548104448577f7e87d10c827ef464a62e6d8fc6 Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 28 Sep 2010 08:21:13 +0200 Subject: Fixed compile error on non-Symbian platforms. (cherry picked from commit 3e3ce984b54a0b199bf5d4f5e3dcb0a9d5b5bd79) --- tests/auto/qinputcontext/tst_qinputcontext.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qinputcontext/tst_qinputcontext.cpp b/tests/auto/qinputcontext/tst_qinputcontext.cpp index 700a49b..7811a53 100644 --- a/tests/auto/qinputcontext/tst_qinputcontext.cpp +++ b/tests/auto/qinputcontext/tst_qinputcontext.cpp @@ -492,6 +492,7 @@ Q_DECLARE_METATYPE(QTextEdit *) template void tst_QInputContext::symbianTestCoeFepInputContext_addData() { +#ifdef Q_OS_SYMBIAN QList events; QWidget *editwidget; @@ -1047,6 +1048,7 @@ void tst_QInputContext::symbianTestCoeFepInputContext_addData() << QString("") << QString(""); events.clear(); +#endif } void tst_QInputContext::symbianTestCoeFepInputContext() -- cgit v0.12 From 837e4024556c74a031acad87e9dd5972d5ef81ef Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 28 Sep 2010 18:50:18 +1000 Subject: If a type is registered under several names, share the attached property object Task-number: QTBUG-13799 (cherry picked from commit 746954581f06e0bca98f25eb95dca09c663d47bf) --- .../qml/qdeclarativecompiledbindings.cpp | 10 ++++----- src/declarative/qml/qdeclarativecompiler.cpp | 2 +- src/declarative/qml/qdeclarativemetatype.cpp | 25 +++++++++++++++++++++- src/declarative/qml/qdeclarativemetatype_p.h | 1 + src/declarative/qml/qdeclarativeproperty.cpp | 4 ++-- .../qml/qdeclarativetypenamescriptclass.cpp | 2 +- .../data/sharedAttachedObject.qml | 16 ++++++++++++++ .../qdeclarativeecmascript/testtypes.cpp | 1 + .../tst_qdeclarativeecmascript.cpp | 11 ++++++++++ 9 files changed, 62 insertions(+), 10 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/sharedAttachedObject.qml diff --git a/src/declarative/qml/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp index 9402596..5f0fd56 100644 --- a/src/declarative/qml/qdeclarativecompiledbindings.cpp +++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp @@ -438,7 +438,7 @@ struct Instr { qint8 output; qint8 reg; quint8 exceptionId; - quint32 index; + quint32 id; } attached; struct { QML_INSTR_HEADER @@ -988,7 +988,7 @@ static void dumpInstruction(const Instr *instr) qWarning().nospace() << "\t" << "LoadRoot" << "\t\t" << instr->load.index << "\t" << instr->load.reg; break; case Instr::LoadAttached: - qWarning().nospace() << "\t" << "LoadAttached" << "\t\t" << instr->attached.output << "\t" << instr->attached.reg << "\t" << instr->attached.index; + qWarning().nospace() << "\t" << "LoadAttached" << "\t\t" << instr->attached.output << "\t" << instr->attached.reg << "\t" << instr->attached.id; break; case Instr::ConvertIntToReal: qWarning().nospace() << "\t" << "ConvertIntToReal" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src; @@ -1225,7 +1225,7 @@ void QDeclarativeCompiledBindingsPrivate::run(int instrIndex, output.setUndefined(); } else { QObject *attached = - qmlAttachedPropertiesObjectById(instr->attached.index, + qmlAttachedPropertiesObjectById(instr->attached.id, registers[instr->attached.reg].getQObject(), true); Q_ASSERT(attached); @@ -1895,7 +1895,7 @@ bool QDeclarativeBindingCompilerPrivate::parseName(AST::Node *node, Result &type attach.common.type = Instr::LoadAttached; attach.attached.output = reg; attach.attached.reg = reg; - attach.attached.index = attachType->index(); + attach.attached.id = attachType->attachedPropertiesId(); attach.attached.exceptionId = exceptionId(nameNodes.at(ii)); bytecode << attach; @@ -2011,7 +2011,7 @@ bool QDeclarativeBindingCompilerPrivate::parseName(AST::Node *node, Result &type attach.common.type = Instr::LoadAttached; attach.attached.output = reg; attach.attached.reg = reg; - attach.attached.index = attachType->index(); + attach.attached.id = attachType->attachedPropertiesId(); bytecode << attach; absType = 0; diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index e55dc92..8c5fd3a 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -1407,7 +1407,7 @@ bool QDeclarativeCompiler::buildProperty(QDeclarativeParser::Property *prop, COMPILE_EXCEPTION(prop, tr("Invalid attached object assignment")); Q_ASSERT(type->attachedPropertiesFunction()); - prop->index = type->index(); + prop->index = type->attachedPropertiesId(); prop->value->metatype = type->attachedPropertiesType(); } else { // Setup regular property data diff --git a/src/declarative/qml/qdeclarativemetatype.cpp b/src/declarative/qml/qdeclarativemetatype.cpp index a5c878f..7a78a1f 100644 --- a/src/declarative/qml/qdeclarativemetatype.cpp +++ b/src/declarative/qml/qdeclarativemetatype.cpp @@ -146,6 +146,7 @@ public: const QMetaObject *m_baseMetaObject; QDeclarativeAttachedPropertiesFunc m_attachedPropertiesFunc; const QMetaObject *m_attachedPropertiesType; + int m_attachedPropertiesId; int m_parserStatusCast; int m_propertyValueSourceCast; int m_propertyValueInterceptorCast; @@ -155,8 +156,12 @@ public: QDeclarativeCustomParser *m_customParser; mutable volatile bool m_isSetup:1; mutable QList m_metaObjects; + + static QHash m_attachedPropertyIds; }; +QHash QDeclarativeTypePrivate::m_attachedPropertyIds; + QDeclarativeTypePrivate::QDeclarativeTypePrivate() : m_isInterface(false), m_iid(0), m_typeId(0), m_listId(0), m_allocationSize(0), m_newFunc(0), m_baseMetaObject(0), m_attachedPropertiesFunc(0), m_attachedPropertiesType(0), @@ -198,6 +203,14 @@ QDeclarativeType::QDeclarativeType(int index, const QDeclarativePrivate::Registe d->m_baseMetaObject = type.metaObject; d->m_attachedPropertiesFunc = type.attachedPropertiesFunction; d->m_attachedPropertiesType = type.attachedPropertiesMetaObject; + if (d->m_attachedPropertiesType) { + QHash::Iterator iter = d->m_attachedPropertyIds.find(d->m_baseMetaObject); + if (iter == d->m_attachedPropertyIds.end()) + iter = d->m_attachedPropertyIds.insert(d->m_baseMetaObject, index); + d->m_attachedPropertiesId = *iter; + } else { + d->m_attachedPropertiesId = -1; + } d->m_parserStatusCast = type.parserStatusCast; d->m_propertyValueSourceCast = type.valueSourceCast; d->m_propertyValueInterceptorCast = type.valueInterceptorCast; @@ -461,6 +474,16 @@ const QMetaObject *QDeclarativeType::attachedPropertiesType() const return d->m_attachedPropertiesType; } +/* +This is the id passed to qmlAttachedPropertiesById(). This is different from the index +for the case that a single class is registered under two or more names (eg. Item in +Qt 4.7 and QtQuick 1.0). +*/ +int QDeclarativeType::attachedPropertiesId() const +{ + return d->m_attachedPropertiesId; +} + int QDeclarativeType::parserStatusCast() const { return d->m_parserStatusCast; @@ -662,7 +685,7 @@ int QDeclarativeMetaType::attachedPropertiesFuncId(const QMetaObject *mo) QDeclarativeType *type = data->metaObjectToType.value(mo); if (type && type->attachedPropertiesFunction()) - return type->index(); + return type->attachedPropertiesId(); else return -1; } diff --git a/src/declarative/qml/qdeclarativemetatype_p.h b/src/declarative/qml/qdeclarativemetatype_p.h index f410547..382abd2 100644 --- a/src/declarative/qml/qdeclarativemetatype_p.h +++ b/src/declarative/qml/qdeclarativemetatype_p.h @@ -137,6 +137,7 @@ public: QDeclarativeAttachedPropertiesFunc attachedPropertiesFunction() const; const QMetaObject *attachedPropertiesType() const; + int attachedPropertiesId() const; int parserStatusCast() const; QVariant fromObject(QObject *) const; diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp index d0dd2e8..bc20bff 100644 --- a/src/declarative/qml/qdeclarativeproperty.cpp +++ b/src/declarative/qml/qdeclarativeproperty.cpp @@ -220,7 +220,7 @@ void QDeclarativePropertyPrivate::initProperty(QObject *obj, const QString &name QDeclarativeAttachedPropertiesFunc func = data->type->attachedPropertiesFunction(); if (!func) return; // Not an attachable type - currentObject = qmlAttachedPropertiesObjectById(data->type->index(), currentObject); + currentObject = qmlAttachedPropertiesObjectById(data->type->attachedPropertiesId(), currentObject); if (!currentObject) return; // Something is broken with the attachable type } else { Q_ASSERT(data->typeNamespace); @@ -232,7 +232,7 @@ void QDeclarativePropertyPrivate::initProperty(QObject *obj, const QString &name QDeclarativeAttachedPropertiesFunc func = data->type->attachedPropertiesFunction(); if (!func) return; // Not an attachable type - currentObject = qmlAttachedPropertiesObjectById(data->type->index(), currentObject); + currentObject = qmlAttachedPropertiesObjectById(data->type->attachedPropertiesId(), currentObject); if (!currentObject) return; // Something is broken with the attachable type } } else { diff --git a/src/declarative/qml/qdeclarativetypenamescriptclass.cpp b/src/declarative/qml/qdeclarativetypenamescriptclass.cpp index 764a8db..cba7b4a 100644 --- a/src/declarative/qml/qdeclarativetypenamescriptclass.cpp +++ b/src/declarative/qml/qdeclarativetypenamescriptclass.cpp @@ -129,7 +129,7 @@ QDeclarativeTypeNameScriptClass::queryProperty(Object *obj, const Identifier &na return 0; } else if (data->object) { // Must be an attached property - object = qmlAttachedPropertiesObjectById(data->type->index(), data->object); + object = qmlAttachedPropertiesObjectById(data->type->attachedPropertiesId(), data->object); if (!object) return 0; return ep->objectClass->queryProperty(object, name, flags, 0); } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/sharedAttachedObject.qml b/tests/auto/declarative/qdeclarativeecmascript/data/sharedAttachedObject.qml new file mode 100644 index 0000000..817391d --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/sharedAttachedObject.qml @@ -0,0 +1,16 @@ +import Qt.test 1.0 +import Qt 4.7 + +MyQmlObject { + id: root + property bool test1: false + property bool test2: false + + MyQmlObject.value2: 7 + + Component.onCompleted: { + test1 = root.MyQmlObject.value2 == 7; + test2 = root.MyQmlObjectAlias.value2 == 7; + } +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp index 8a4605a..810a0f7 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp @@ -102,6 +102,7 @@ public: void registerTypes() { + qmlRegisterType("Qt.test", 1,0, "MyQmlObjectAlias"); qmlRegisterType("Qt.test", 1,0, "MyQmlObject"); qmlRegisterType("Qt.test", 1,0, "MyDeferredObject"); qmlRegisterType("Qt.test", 1,0, "MyQmlContainer"); diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index c10a110..4feb630 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -161,6 +161,7 @@ private slots: void nonscriptable(); void deleteLater(); void in(); + void sharedAttachedObject(); void include(); @@ -2583,6 +2584,16 @@ void tst_qdeclarativeecmascript::in() delete o; } +void tst_qdeclarativeecmascript::sharedAttachedObject() +{ + QDeclarativeComponent component(&engine, TEST_FILE("sharedAttachedObject.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + QCOMPARE(o->property("test1").toBool(), true); + QCOMPARE(o->property("test2").toBool(), true); + delete o; +} + QTEST_MAIN(tst_qdeclarativeecmascript) #include "tst_qdeclarativeecmascript.moc" -- cgit v0.12 From 94aa8a639de93861cfafef2e195616cb8ee52093 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 29 Sep 2010 11:13:18 +1000 Subject: Register QtQuick 1.0 module. Qt 4.7 is still supported, but deprecated. Reviewed-by: Martin Jones Task-number: QTBUG-13799 (cherry picked from commit 4fcf055f66cc23c9e60a7add489e394420e71914) --- .../graphicsitems/qdeclarativeitemsmodule.cpp | 98 +++++++++++++++++----- src/declarative/qml/qdeclarativeengine.cpp | 12 ++- src/declarative/qml/qdeclarativevaluetype.cpp | 12 ++- src/declarative/util/qdeclarativeutilmodule.cpp | 54 +++++++++++- tools/qml/qmlruntime.cpp | 1 + 5 files changed, 146 insertions(+), 31 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index 783eff1..52703c2 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -97,7 +97,84 @@ void QDeclarativeItemModule::defineModule() { QDeclarativePrivate::RegisterAutoParent autoparent = { 0, &qgraphicsobject_autoParent }; QDeclarativePrivate::qmlregister(QDeclarativePrivate::AutoParentRegistration, &autoparent); +#ifdef QT_NO_MOVIE + qmlRegisterTypeNotAvailable("QtQuick",1,0,"AnimatedImage", + qApp->translate("QDeclarativeAnimatedImage","Qt was built without support for QMovie")); +#else + qmlRegisterType("QtQuick",1,0,"AnimatedImage"); +#endif + qmlRegisterType("QtQuick",1,0,"BorderImage"); + qmlRegisterType("QtQuick",1,0,"Column"); + qmlRegisterType("QtQuick",1,0,"Drag"); + qmlRegisterType("QtQuick",1,0,"Flickable"); + qmlRegisterType("QtQuick",1,0,"Flipable"); + qmlRegisterType("QtQuick",1,0,"Flow"); + qmlRegisterType("QtQuick",1,0,"FocusPanel"); + qmlRegisterType("QtQuick",1,0,"FocusScope"); + qmlRegisterType("QtQuick",1,0,"Gradient"); + qmlRegisterType("QtQuick",1,0,"GradientStop"); + qmlRegisterType("QtQuick",1,0,"Grid"); + qmlRegisterType("QtQuick",1,0,"GridView"); + qmlRegisterType("QtQuick",1,0,"Image"); + qmlRegisterType("QtQuick",1,0,"Item"); + qmlRegisterType("QtQuick",1,0,"LayoutItem"); + qmlRegisterType("QtQuick",1,0,"ListView"); + qmlRegisterType("QtQuick",1,0,"Loader"); + qmlRegisterType("QtQuick",1,0,"MouseArea"); + qmlRegisterType("QtQuick",1,0,"Path"); + qmlRegisterType("QtQuick",1,0,"PathAttribute"); + qmlRegisterType("QtQuick",1,0,"PathCubic"); + qmlRegisterType("QtQuick",1,0,"PathLine"); + qmlRegisterType("QtQuick",1,0,"PathPercent"); + qmlRegisterType("QtQuick",1,0,"PathQuad"); + qmlRegisterType("QtQuick",1,0,"PathView"); +#ifndef QT_NO_VALIDATOR + qmlRegisterType("QtQuick",1,0,"IntValidator"); + qmlRegisterType("QtQuick",1,0,"DoubleValidator"); + qmlRegisterType("QtQuick",1,0,"RegExpValidator"); +#endif + qmlRegisterType("QtQuick",1,0,"Rectangle"); + qmlRegisterType("QtQuick",1,0,"Repeater"); + qmlRegisterType("QtQuick",1,0,"Rotation"); + qmlRegisterType("QtQuick",1,0,"Row"); + qmlRegisterType("QtQuick",1,0,"Translate"); + qmlRegisterType("QtQuick",1,0,"Scale"); + qmlRegisterType("QtQuick",1,0,"Text"); + qmlRegisterType("QtQuick",1,0,"TextEdit"); +#ifndef QT_NO_LINEEDIT + qmlRegisterType("QtQuick",1,0,"TextInput"); +#endif + qmlRegisterType("QtQuick",1,0,"ViewSection"); + qmlRegisterType("QtQuick",1,0,"VisualDataModel"); + qmlRegisterType("QtQuick",1,0,"VisualItemModel"); + qmlRegisterType(); + qmlRegisterType(); + qmlRegisterType(); + qmlRegisterType(); + qmlRegisterType("QtQuick",1,0,"QGraphicsWidget"); + qmlRegisterExtendedType("QtQuick",1,0,"QGraphicsWidget"); + qmlRegisterType(); + qmlRegisterType(); + qmlRegisterType(); + qmlRegisterType(); +#ifndef QT_NO_VALIDATOR + qmlRegisterType(); +#endif + qmlRegisterType(); +#ifndef QT_NO_ACTION + qmlRegisterType(); +#endif + qmlRegisterType(); + qmlRegisterType(); +#ifndef QT_NO_GRAPHICSEFFECT + qmlRegisterType(); +#endif + + qmlRegisterUncreatableType("QtQuick",1,0,"KeyNavigation",QDeclarativeKeyNavigationAttached::tr("KeyNavigation is only available via attached properties")); + qmlRegisterUncreatableType("QtQuick",1,0,"Keys",QDeclarativeKeysAttached::tr("Keys is only available via attached properties")); + +#ifndef QT_NO_IMPORT_QT47_QML #ifdef QT_NO_MOVIE qmlRegisterTypeNotAvailable("Qt",4,7,"AnimatedImage", qApp->translate("QDeclarativeAnimatedImage","Qt was built without support for QMovie")); @@ -149,29 +226,10 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType("Qt",4,7,"VisualDataModel"); qmlRegisterType("Qt",4,7,"VisualItemModel"); - qmlRegisterType(); - qmlRegisterType(); - qmlRegisterType(); - qmlRegisterType(); qmlRegisterType("Qt",4,7,"QGraphicsWidget"); qmlRegisterExtendedType("Qt",4,7,"QGraphicsWidget"); - qmlRegisterType(); - qmlRegisterType(); - qmlRegisterType(); - qmlRegisterType(); -#ifndef QT_NO_VALIDATOR - qmlRegisterType(); -#endif - qmlRegisterType(); -#ifndef QT_NO_ACTION - qmlRegisterType(); -#endif - qmlRegisterType(); - qmlRegisterType(); -#ifndef QT_NO_GRAPHICSEFFECT - qmlRegisterType(); -#endif qmlRegisterUncreatableType("Qt",4,7,"KeyNavigation",QDeclarativeKeyNavigationAttached::tr("KeyNavigation is only available via attached properties")); qmlRegisterUncreatableType("Qt",4,7,"Keys",QDeclarativeKeysAttached::tr("Keys is only available via attached properties")); +#endif } diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 80db230..bfed22c 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -141,7 +141,7 @@ QT_BEGIN_NAMESPACE \qml // MyRect.qml - import Qt 4.7 + import QtQuick 1.0 Item { width: 200; height: 200 @@ -177,9 +177,15 @@ static bool qt_QmlQtModule_registered = false; void QDeclarativeEnginePrivate::defineModule() { + qmlRegisterType("QtQuick",1,0,"Component"); + qmlRegisterType("QtQuick",1,0,"QtObject"); + qmlRegisterType("QtQuick",1,0,"WorkerScript"); + +#ifndef QT_NO_IMPORT_QT47_QML qmlRegisterType("Qt",4,7,"Component"); qmlRegisterType("Qt",4,7,"QtObject"); qmlRegisterType("Qt",4,7,"WorkerScript"); +#endif qmlRegisterType(); } @@ -198,7 +204,7 @@ with enums and functions. To use it, call the members of the global \c Qt objec For example: \qml -import Qt 4.7 +import QtQuick 1.0 Text { color: Qt.rgba(255, 0, 0, 1) @@ -510,7 +516,7 @@ QDeclarativeWorkerScriptEngine *QDeclarativeEnginePrivate::getWorkerScriptEngine \code QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData("import Qt 4.7\nText { text: \"Hello world!\" }", QUrl()); + component.setData("import QtQuick 1.0\nText { text: \"Hello world!\" }", QUrl()); QDeclarativeItem *item = qobject_cast(component.create()); //add item to view, etc diff --git a/src/declarative/qml/qdeclarativevaluetype.cpp b/src/declarative/qml/qdeclarativevaluetype.cpp index fda62ee..b9e9cec 100644 --- a/src/declarative/qml/qdeclarativevaluetype.cpp +++ b/src/declarative/qml/qdeclarativevaluetype.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE Q_GUI_EXPORT int qt_defaultDpi(); template -int qmlRegisterValueTypeEnums(const char *qmlName) +int qmlRegisterValueTypeEnums(const char *uri, int versionMajor, int versionMinor, const char *qmlName) { QByteArray name(T::staticMetaObject.className()); @@ -63,7 +63,7 @@ int qmlRegisterValueTypeEnums(const char *qmlName) QString(), - "Qt", 4, 7, qmlName, &T::staticMetaObject, + uri, versionMajor, versionMinor, qmlName, &T::staticMetaObject, 0, 0, @@ -99,8 +99,12 @@ bool QDeclarativeValueTypeFactory::isValueType(int idx) void QDeclarativeValueTypeFactory::registerValueTypes() { - qmlRegisterValueTypeEnums("Easing"); - qmlRegisterValueTypeEnums("Font"); + qmlRegisterValueTypeEnums("QtQuick",1,0,"Easing"); + qmlRegisterValueTypeEnums("QtQuick",1,0,"Font"); +#ifndef QT_NO_IMPORT_QT47_QML + qmlRegisterValueTypeEnums("Qt",4,7,"Easing"); + qmlRegisterValueTypeEnums("Qt",4,7,"Font"); +#endif } QDeclarativeValueType *QDeclarativeValueTypeFactory::valueType(int t) diff --git a/src/declarative/util/qdeclarativeutilmodule.cpp b/src/declarative/util/qdeclarativeutilmodule.cpp index c5bfebd..0544f22 100644 --- a/src/declarative/util/qdeclarativeutilmodule.cpp +++ b/src/declarative/util/qdeclarativeutilmodule.cpp @@ -75,6 +75,55 @@ void QDeclarativeUtilModule::defineModule() { + qmlRegisterType("QtQuick",1,0,"AnchorAnimation"); + qmlRegisterType("QtQuick",1,0,"AnchorChanges"); + qmlRegisterType("QtQuick",1,0,"Behavior"); + qmlRegisterType("QtQuick",1,0,"Binding"); + qmlRegisterType("QtQuick",1,0,"ColorAnimation"); + qmlRegisterType("QtQuick",1,0,"Connections"); + qmlRegisterType("QtQuick",1,0,"SmoothedAnimation"); + qmlRegisterType("QtQuick",1,0,"FontLoader"); + qmlRegisterType("QtQuick",1,0,"ListElement"); + qmlRegisterType("QtQuick",1,0,"NumberAnimation"); + qmlRegisterType("QtQuick",1,0,"Package"); + qmlRegisterType("QtQuick",1,0,"ParallelAnimation"); + qmlRegisterType("QtQuick",1,0,"ParentAnimation"); + qmlRegisterType("QtQuick",1,0,"ParentChange"); + qmlRegisterType("QtQuick",1,0,"PauseAnimation"); + qmlRegisterType("QtQuick",1,0,"PropertyAction"); + qmlRegisterType("QtQuick",1,0,"PropertyAnimation"); + qmlRegisterType("QtQuick",1,0,"RotationAnimation"); + qmlRegisterType("QtQuick",1,0,"ScriptAction"); + qmlRegisterType("QtQuick",1,0,"SequentialAnimation"); + qmlRegisterType("QtQuick",1,0,"SpringAnimation"); + qmlRegisterType("QtQuick",1,0,"StateChangeScript"); + qmlRegisterType("QtQuick",1,0,"StateGroup"); + qmlRegisterType("QtQuick",1,0,"State"); + qmlRegisterType("QtQuick",1,0,"SystemPalette"); + qmlRegisterType("QtQuick",1,0,"Timer"); + qmlRegisterType("QtQuick",1,0,"Transition"); + qmlRegisterType("QtQuick",1,0,"Vector3dAnimation"); +#ifdef QT_NO_XMLPATTERNS + qmlRegisterTypeNotAvailable("QtQuick",1,0,"XmlListModel", + qApp->translate("QDeclarativeXmlListModel","Qt was built without support for xmlpatterns")); + qmlRegisterTypeNotAvailable("QtQuick",1,0,"XmlRole", + qApp->translate("QDeclarativeXmlListModel","Qt was built without support for xmlpatterns")); +#else + qmlRegisterType("QtQuick",1,0,"XmlListModel"); + qmlRegisterType("QtQuick",1,0,"XmlRole"); +#endif + + qmlRegisterType(); + qmlRegisterType(); + qmlRegisterType(); + + qmlRegisterUncreatableType("QtQuick",1,0,"Animation",QDeclarativeAbstractAnimation::tr("Animation is an abstract class")); + + qmlRegisterCustomType("QtQuick",1,0,"ListModel", new QDeclarativeListModelParser); + qmlRegisterCustomType("QtQuick",1,0,"PropertyChanges", new QDeclarativePropertyChangesParser); + qmlRegisterCustomType("QtQuick",1,0,"Connections", new QDeclarativeConnectionsParser); + +#ifndef QT_NO_IMPORT_QT47_QML qmlRegisterType("Qt",4,7,"AnchorAnimation"); qmlRegisterType("Qt",4,7,"AnchorChanges"); qmlRegisterType("Qt",4,7,"Behavior"); @@ -113,13 +162,10 @@ void QDeclarativeUtilModule::defineModule() qmlRegisterType("Qt",4,7,"XmlRole"); #endif - qmlRegisterType(); - qmlRegisterType(); - qmlRegisterType(); - qmlRegisterUncreatableType("Qt",4,7,"Animation",QDeclarativeAbstractAnimation::tr("Animation is an abstract class")); qmlRegisterCustomType("Qt", 4,7, "ListModel", new QDeclarativeListModelParser); qmlRegisterCustomType("Qt", 4, 7, "PropertyChanges", new QDeclarativePropertyChangesParser); qmlRegisterCustomType("Qt", 4, 7, "Connections", new QDeclarativeConnectionsParser); +#endif } diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index c59621a..5e169d8 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -1532,6 +1532,7 @@ void QDeclarativeViewer::registerTypes() if (!registered) { // registering only for exposing the DeviceOrientation::Orientation enum qmlRegisterUncreatableType("Qt",4,7,"Orientation",""); + qmlRegisterUncreatableType("QtQuick",1,0,"Orientation",""); registered = true; } } -- cgit v0.12 From dcc5c7ea047513ceb6fc75aac526b17ad6629d4c Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Fri, 1 Oct 2010 15:28:48 +1000 Subject: Replace all occurances of "Qt 4.7" with "QtQuick 1.0" Task-number: QTBUG-13799 Reviewed-by: Martin Jones (cherry picked from commit 49452ad6b22e080b1dfdfde38c21c48bb910a1ae) Conflicts: tests/auto/declarative/qdeclarativeconnection/data/error-object.qml tests/auto/declarative/qdeclarativeconnection/data/error-property.qml tests/auto/declarative/qdeclarativeconnection/data/error-property2.qml tests/auto/declarative/qdeclarativeconnection/data/error-syntax.qml tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp tests/auto/declarative/qdeclarativeqt/data/quit.qml tests/auto/declarative/qdeclarativeview/data/error1.qml --- demos/declarative/calculator/Core/Button.qml | 2 +- demos/declarative/calculator/Core/Display.qml | 2 +- demos/declarative/calculator/calculator.qml | 2 +- demos/declarative/flickr/common/Progress.qml | 2 +- demos/declarative/flickr/common/RssModel.qml | 2 +- demos/declarative/flickr/common/ScrollBar.qml | 2 +- demos/declarative/flickr/common/Slider.qml | 2 +- demos/declarative/flickr/flickr-90.qml | 2 +- demos/declarative/flickr/flickr.qml | 2 +- demos/declarative/flickr/mobile/Button.qml | 2 +- demos/declarative/flickr/mobile/GridDelegate.qml | 2 +- demos/declarative/flickr/mobile/ImageDetails.qml | 2 +- demos/declarative/flickr/mobile/ListDelegate.qml | 2 +- demos/declarative/flickr/mobile/TitleBar.qml | 2 +- demos/declarative/flickr/mobile/ToolBar.qml | 2 +- .../minehunt/MinehuntCore/Explosion.qml | 2 +- demos/declarative/minehunt/MinehuntCore/Tile.qml | 2 +- demos/declarative/minehunt/minehunt.qml | 2 +- .../photoviewer/PhotoViewerCore/AlbumDelegate.qml | 2 +- .../photoviewer/PhotoViewerCore/BusyIndicator.qml | 2 +- .../photoviewer/PhotoViewerCore/Button.qml | 2 +- .../photoviewer/PhotoViewerCore/EditableButton.qml | 2 +- .../photoviewer/PhotoViewerCore/PhotoDelegate.qml | 2 +- .../photoviewer/PhotoViewerCore/ProgressBar.qml | 2 +- .../photoviewer/PhotoViewerCore/RssModel.qml | 2 +- .../photoviewer/PhotoViewerCore/Tag.qml | 2 +- demos/declarative/photoviewer/photoviewer.qml | 2 +- .../declarative/rssnews/content/BusyIndicator.qml | 2 +- .../rssnews/content/CategoryDelegate.qml | 2 +- demos/declarative/rssnews/content/NewsDelegate.qml | 2 +- demos/declarative/rssnews/content/RssFeeds.qml | 2 +- demos/declarative/rssnews/content/ScrollBar.qml | 2 +- demos/declarative/rssnews/rssnews.qml | 2 +- .../samegame/SamegameCore/BoomBlock.qml | 2 +- demos/declarative/samegame/SamegameCore/Button.qml | 2 +- demos/declarative/samegame/SamegameCore/Dialog.qml | 2 +- demos/declarative/samegame/samegame.qml | 2 +- demos/declarative/snake/content/Button.qml | 2 +- demos/declarative/snake/content/Cookie.qml | 2 +- demos/declarative/snake/content/HighScoreModel.qml | 2 +- demos/declarative/snake/content/Link.qml | 2 +- demos/declarative/snake/content/Skull.qml | 2 +- demos/declarative/snake/snake.qml | 2 +- demos/declarative/twitter/TwitterCore/Button.qml | 2 +- .../twitter/TwitterCore/FatDelegate.qml | 2 +- demos/declarative/twitter/TwitterCore/Input.qml | 2 +- demos/declarative/twitter/TwitterCore/Loading.qml | 2 +- .../twitter/TwitterCore/MultiTitleBar.qml | 2 +- demos/declarative/twitter/TwitterCore/RssModel.qml | 2 +- .../declarative/twitter/TwitterCore/SearchView.qml | 2 +- demos/declarative/twitter/TwitterCore/TitleBar.qml | 2 +- demos/declarative/twitter/TwitterCore/ToolBar.qml | 2 +- .../declarative/twitter/TwitterCore/UserModel.qml | 2 +- demos/declarative/twitter/twitter.qml | 2 +- demos/declarative/webbrowser/content/Button.qml | 2 +- .../webbrowser/content/FlickableWebView.qml | 2 +- demos/declarative/webbrowser/content/Header.qml | 2 +- demos/declarative/webbrowser/content/ScrollBar.qml | 2 +- demos/declarative/webbrowser/content/UrlInput.qml | 2 +- demos/declarative/webbrowser/webbrowser.qml | 2 +- demos/qtdemo/qmlShell.qml | 2 +- doc/src/declarative/modules.qdoc | 8 +- doc/src/declarative/qdeclarativedebugging.qdoc | 2 +- doc/src/declarative/qdeclarativedocument.qdoc | 2 +- doc/src/declarative/qdeclarativei18n.qdoc | 2 +- doc/src/declarative/qdeclarativeintro.qdoc | 2 +- doc/src/declarative/qmlruntime.qdoc | 2 +- doc/src/declarative/qmlviewer.qdoc | 8 +- doc/src/declarative/qtbinding.qdoc | 2 +- doc/src/declarative/scope.qdoc | 10 +- doc/src/getting-started/gettingstartedqml.qdoc | 4 +- .../snippets/declarative/SelfDestroyingRect.qml | 2 +- doc/src/snippets/declarative/Sprite.qml | 2 +- doc/src/snippets/declarative/anchoranimation.qml | 2 +- doc/src/snippets/declarative/anchorchanges.qml | 2 +- doc/src/snippets/declarative/animatedimage.qml | 2 +- .../snippets/declarative/animation-behavioral.qml | 2 +- doc/src/snippets/declarative/animation-easing.qml | 2 +- .../snippets/declarative/animation-elements.qml | 2 +- doc/src/snippets/declarative/animation-groups.qml | 2 +- .../declarative/animation-propertyvaluesource.qml | 2 +- .../declarative/animation-signalhandler.qml | 2 +- .../snippets/declarative/animation-standalone.qml | 2 +- .../snippets/declarative/animation-transitions.qml | 2 +- doc/src/snippets/declarative/behavior.qml | 2 +- .../declarative/borderimage/borderimage-scaled.qml | 2 +- .../declarative/borderimage/borderimage-tiled.qml | 2 +- .../declarative/borderimage/normal-image.qml | 2 +- .../codingconventions/dotproperties.qml | 2 +- .../codingconventions/javascript-imports.qml | 2 +- .../declarative/codingconventions/javascript.qml | 2 +- .../declarative/codingconventions/lists.qml | 2 +- .../declarative/codingconventions/photo.qml | 2 +- doc/src/snippets/declarative/coloranimation.qml | 2 +- doc/src/snippets/declarative/column/column.qml | 2 +- .../column/vertical-positioner-transition.qml | 2 +- .../declarative/column/vertical-positioner.qml | 2 +- doc/src/snippets/declarative/comments.qml | 2 +- doc/src/snippets/declarative/component.qml | 2 +- .../declarative/createComponent-simple.qml | 2 +- doc/src/snippets/declarative/createComponent.qml | 2 +- doc/src/snippets/declarative/createQmlObject.qml | 4 +- .../declarative/dynamicObjects-destroy.qml | 2 +- doc/src/snippets/declarative/flickable.qml | 2 +- .../snippets/declarative/flickableScrollbar.qml | 2 +- doc/src/snippets/declarative/flipable/flipable.qml | 2 +- doc/src/snippets/declarative/flow-diagram.qml | 2 +- doc/src/snippets/declarative/flow.qml | 2 +- doc/src/snippets/declarative/focusscopes.qml | 2 +- doc/src/snippets/declarative/folderlistmodel.qml | 2 +- doc/src/snippets/declarative/gradient.qml | 2 +- doc/src/snippets/declarative/grid/grid-items.qml | 2 +- .../snippets/declarative/grid/grid-no-spacing.qml | 2 +- doc/src/snippets/declarative/grid/grid-spacing.qml | 2 +- doc/src/snippets/declarative/grid/grid.qml | 2 +- .../snippets/declarative/gridview/ContactModel.qml | 2 +- doc/src/snippets/declarative/gridview/gridview.qml | 2 +- doc/src/snippets/declarative/image.qml | 2 +- doc/src/snippets/declarative/listmodel-modify.qml | 2 +- doc/src/snippets/declarative/listmodel-nested.qml | 2 +- doc/src/snippets/declarative/listmodel-simple.qml | 2 +- doc/src/snippets/declarative/listmodel.qml | 2 +- .../snippets/declarative/listview/ContactModel.qml | 2 +- .../declarative/listview/listview-snippet.qml | 2 +- doc/src/snippets/declarative/listview/listview.qml | 2 +- doc/src/snippets/declarative/loader/KeyReader.qml | 2 +- doc/src/snippets/declarative/loader/MyItem.qml | 2 +- .../snippets/declarative/loader/connections.qml | 2 +- doc/src/snippets/declarative/loader/focus.qml | 2 +- doc/src/snippets/declarative/loader/simple.qml | 2 +- .../declarative/mousearea/mousearea-snippet.qml | 2 +- .../snippets/declarative/mousearea/mousearea.qml | 2 +- .../declarative/mousearea/mouseareadragfilter.qml | 2 +- doc/src/snippets/declarative/numberanimation.qml | 2 +- doc/src/snippets/declarative/parallelanimation.qml | 2 +- doc/src/snippets/declarative/parentanimation.qml | 2 +- doc/src/snippets/declarative/parentchange.qml | 2 +- .../snippets/declarative/pathview/ContactModel.qml | 2 +- .../declarative/pathview/pathattributes.qml | 2 +- doc/src/snippets/declarative/pathview/pathview.qml | 2 +- doc/src/snippets/declarative/propertyaction.qml | 2 +- doc/src/snippets/declarative/propertyanimation.qml | 2 +- doc/src/snippets/declarative/propertychanges.qml | 2 +- .../qml-data-models/dynamic-listmodel.qml | 2 +- .../declarative/qml-data-models/listelements.qml | 2 +- .../qml-data-models/listmodel-listview.qml | 2 +- .../declarative/qml-documents/inline-component.qml | 2 +- .../qml-documents/inline-text-component.qml | 2 +- .../declarative/qml-documents/non-trivial.qml | 2 +- .../declarative/qml-documents/qmldocuments.qml | 2 +- .../snippets/declarative/qml-intro/anchors1.qml | 2 +- .../snippets/declarative/qml-intro/anchors2.qml | 2 +- .../snippets/declarative/qml-intro/anchors3.qml | 2 +- .../declarative/qml-intro/hello-world1.qml | 2 +- .../declarative/qml-intro/hello-world2.qml | 2 +- .../declarative/qml-intro/hello-world3.qml | 2 +- .../declarative/qml-intro/hello-world4.qml | 2 +- .../declarative/qml-intro/hello-world5.qml | 2 +- .../declarative/qml-intro/number-animation1.qml | 2 +- .../declarative/qml-intro/number-animation2.qml | 2 +- .../snippets/declarative/qml-intro/rectangle.qml | 2 +- .../qml-intro/sequential-animation1.qml | 2 +- .../qml-intro/sequential-animation2.qml | 2 +- .../qml-intro/sequential-animation3.qml | 4 +- doc/src/snippets/declarative/qml-intro/states1.qml | 2 +- .../declarative/qml-intro/transformations1.qml | 2 +- .../qtbinding/contextproperties/main.qml | 2 +- .../declarative/qtbinding/custompalette/main.qml | 2 +- .../declarative/qtbinding/resources/main.qml | 2 +- .../declarative/qtbinding/stopwatch/main.qml | 2 +- doc/src/snippets/declarative/qtobject.qml | 2 +- .../declarative/rectangle/rect-border-width.qml | 2 +- .../declarative/rectangle/rectangle-colors.qml | 2 +- .../declarative/rectangle/rectangle-gradient.qml | 2 +- .../declarative/rectangle/rectangle-smooth.qml | 2 +- .../snippets/declarative/rectangle/rectangle.qml | 2 +- .../declarative/repeaters/repeater-grid-index.qml | 2 +- .../snippets/declarative/repeaters/repeater.qml | 2 +- doc/src/snippets/declarative/rotation.qml | 2 +- doc/src/snippets/declarative/rotationanimation.qml | 2 +- doc/src/snippets/declarative/row.qml | 2 +- doc/src/snippets/declarative/row/row.qml | 2 +- .../snippets/declarative/sequentialanimation.qml | 2 +- doc/src/snippets/declarative/smoothedanimation.qml | 2 +- doc/src/snippets/declarative/springanimation.qml | 2 +- doc/src/snippets/declarative/state-when.qml | 2 +- doc/src/snippets/declarative/state.qml | 2 +- doc/src/snippets/declarative/states.qml | 2 +- doc/src/snippets/declarative/systempalette.qml | 2 +- .../snippets/declarative/text/onLinkActivated.qml | 2 +- doc/src/snippets/declarative/texteditor.qml | 2 +- .../snippets/declarative/transition-from-to.qml | 2 +- .../snippets/declarative/transition-reversible.qml | 2 +- doc/src/snippets/declarative/transition.qml | 2 +- doc/src/snippets/declarative/visualdatamodel.qml | 2 +- .../declarative/visualdatamodel_rootindex/view.qml | 2 +- doc/src/snippets/declarative/workerscript.qml | 2 +- doc/src/snippets/declarative/xmlrole.qml | 2 +- .../animation/basics/color-animation.qml | 2 +- .../animation/basics/property-animation.qml | 2 +- .../declarative/animation/behaviors/SideRect.qml | 2 +- .../animation/behaviors/behavior-example.qml | 2 +- .../animation/easing/content/QuitButton.qml | 4 +- examples/declarative/animation/easing/easing.qml | 2 +- examples/declarative/animation/states/states.qml | 2 +- .../declarative/animation/states/transitions.qml | 2 +- .../imageprovider/imageprovider-example.qml | 2 +- .../networkaccessmanagerfactory/view.qml | 2 +- .../plugins/com/nokia/TimeExample/Clock.qml | 2 +- .../qgraphicslayouts/layoutitem/layoutitem.qml | 2 +- .../qgraphicsgridlayout/qgraphicsgridlayout.qml | 2 +- .../qgraphicslinearlayout.qml | 2 +- .../cppextensions/qwidgets/qwidgets.qml | 2 +- .../referenceexamples/methods/example.qml | 2 +- examples/declarative/i18n/i18n.qml | 2 +- .../imageelements/borderimage/borderimage.qml | 2 +- .../borderimage/content/MyBorderImage.qml | 2 +- .../borderimage/content/ShadowRectangle.qml | 2 +- .../imageelements/borderimage/shadows.qml | 2 +- .../declarative/imageelements/image/ImageCell.qml | 2 +- examples/declarative/imageelements/image/image.qml | 2 +- .../keyinteraction/focus/Core/ContextMenu.qml | 2 +- .../keyinteraction/focus/Core/GridMenu.qml | 2 +- .../keyinteraction/focus/Core/ListMenu.qml | 2 +- .../keyinteraction/focus/Core/ListViewDelegate.qml | 2 +- .../declarative/keyinteraction/focus/focus.qml | 2 +- .../modelviews/abstractitemmodel/view.qml | 2 +- .../modelviews/gridview/gridview-example.qml | 2 +- .../modelviews/listview/content/PetsModel.qml | 2 +- .../listview/content/PressAndHoldButton.qml | 2 +- .../modelviews/listview/content/RecipesModel.qml | 2 +- .../modelviews/listview/content/TextButton.qml | 2 +- .../modelviews/listview/dynamiclist.qml | 2 +- .../modelviews/listview/expandingdelegates.qml | 2 +- .../declarative/modelviews/listview/highlight.qml | 2 +- .../modelviews/listview/highlightranges.qml | 2 +- .../declarative/modelviews/listview/sections.qml | 2 +- .../modelviews/objectlistmodel/view.qml | 2 +- .../declarative/modelviews/package/Delegate.qml | 2 +- examples/declarative/modelviews/package/view.qml | 2 +- .../declarative/modelviews/parallax/parallax.qml | 2 +- .../modelviews/parallax/qml/ParallaxView.qml | 2 +- .../declarative/modelviews/parallax/qml/Smiley.qml | 2 +- .../modelviews/pathview/pathview-example.qml | 2 +- .../modelviews/stringlistmodel/view.qml | 2 +- .../modelviews/visualitemmodel/visualitemmodel.qml | 2 +- examples/declarative/modelviews/webview/alerts.qml | 2 +- .../declarative/modelviews/webview/autosize.qml | 2 +- .../modelviews/webview/content/Mapping/Map.qml | 2 +- .../declarative/modelviews/webview/googlemaps.qml | 2 +- .../declarative/modelviews/webview/inlinehtml.qml | 2 +- .../declarative/modelviews/webview/newwindows.qml | 2 +- examples/declarative/positioners/Button.qml | 2 +- examples/declarative/positioners/positioners.qml | 2 +- .../declarative/screenorientation/Core/Bubble.qml | 4 +- .../declarative/screenorientation/Core/Button.qml | 2 +- .../screenorientation/screenorientation.qml | 2 +- examples/declarative/sqllocalstorage/hello.qml | 2 +- examples/declarative/text/fonts/availableFonts.qml | 2 +- examples/declarative/text/fonts/banner.qml | 2 +- examples/declarative/text/fonts/fonts.qml | 2 +- examples/declarative/text/fonts/hello.qml | 2 +- .../text/textselection/textselection.qml | 2 +- .../threading/threadedlistmodel/timedisplay.qml | 2 +- .../threading/workerscript/workerscript.qml | 2 +- .../gestures/experimental-gestures.qml | 2 +- .../mousearea/mousearea-example.qml | 2 +- examples/declarative/toys/clocks/clocks.qml | 2 +- examples/declarative/toys/clocks/content/Clock.qml | 2 +- .../declarative/toys/clocks/content/QuitButton.qml | 4 +- examples/declarative/toys/corkboards/Day.qml | 2 +- .../declarative/toys/corkboards/corkboards.qml | 2 +- .../declarative/toys/dynamicscene/dynamicscene.qml | 4 +- .../declarative/toys/dynamicscene/qml/Button.qml | 2 +- .../toys/dynamicscene/qml/GenericSceneItem.qml | 2 +- .../toys/dynamicscene/qml/PaletteItem.qml | 2 +- .../toys/dynamicscene/qml/PerspectiveItem.qml | 2 +- examples/declarative/toys/dynamicscene/qml/Sun.qml | 2 +- .../toys/tic-tac-toe/content/Button.qml | 2 +- .../toys/tic-tac-toe/content/TicTac.qml | 2 +- .../declarative/toys/tic-tac-toe/tic-tac-toe.qml | 2 +- examples/declarative/toys/tvtennis/tvtennis.qml | 2 +- .../tutorials/extending/chapter1-basics/app.qml | 2 +- .../tutorials/extending/chapter2-methods/app.qml | 2 +- .../tutorials/extending/chapter3-bindings/app.qml | 2 +- .../extending/chapter4-customPropertyTypes/app.qml | 2 +- .../extending/chapter5-listproperties/app.qml | 2 +- .../tutorials/extending/chapter6-plugins/app.qml | 2 +- examples/declarative/tutorials/helloworld/Cell.qml | 2 +- .../declarative/tutorials/helloworld/tutorial1.qml | 2 +- .../declarative/tutorials/helloworld/tutorial2.qml | 2 +- .../declarative/tutorials/helloworld/tutorial3.qml | 2 +- .../tutorials/samegame/samegame1/Block.qml | 2 +- .../tutorials/samegame/samegame1/Button.qml | 2 +- .../tutorials/samegame/samegame1/samegame.qml | 2 +- .../tutorials/samegame/samegame2/Block.qml | 2 +- .../tutorials/samegame/samegame2/Button.qml | 2 +- .../tutorials/samegame/samegame2/samegame.qml | 2 +- .../tutorials/samegame/samegame3/Block.qml | 2 +- .../tutorials/samegame/samegame3/Button.qml | 2 +- .../tutorials/samegame/samegame3/Dialog.qml | 2 +- .../tutorials/samegame/samegame3/samegame.qml | 2 +- .../samegame/samegame4/content/BoomBlock.qml | 2 +- .../samegame/samegame4/content/Button.qml | 2 +- .../samegame/samegame4/content/Dialog.qml | 2 +- .../tutorials/samegame/samegame4/samegame.qml | 2 +- .../ui-components/dialcontrol/content/Dial.qml | 2 +- .../dialcontrol/content/QuitButton.qml | 4 +- .../ui-components/dialcontrol/dialcontrol.qml | 2 +- .../ui-components/flipable/content/Card.qml | 2 +- .../ui-components/flipable/flipable.qml | 2 +- .../progressbar/content/ProgressBar.qml | 2 +- .../declarative/ui-components/progressbar/main.qml | 2 +- .../ui-components/scrollbar/ScrollBar.qml | 2 +- .../declarative/ui-components/scrollbar/main.qml | 2 +- .../ui-components/searchbox/SearchBox.qml | 2 +- .../declarative/ui-components/searchbox/main.qml | 2 +- .../ui-components/slideswitch/content/Switch.qml | 2 +- .../ui-components/slideswitch/slideswitch.qml | 2 +- .../ui-components/spinner/content/Spinner.qml | 2 +- .../declarative/ui-components/spinner/main.qml | 2 +- .../ui-components/tabwidget/TabWidget.qml | 2 +- .../declarative/ui-components/tabwidget/main.qml | 2 +- .../xml/xmlhttprequest/xmlhttprequest-example.qml | 2 +- .../tutorials/gettingStarted/gsQml/core/button.qml | 4 +- .../gettingStarted/gsQml/core/editMenu.qml | 4 +- .../gettingStarted/gsQml/core/fileDialog.qml | 4 +- .../gettingStarted/gsQml/core/fileMenu.qml | 2 +- .../gettingStarted/gsQml/core/menuBar.qml | 2 +- .../gettingStarted/gsQml/core/textArea.qml | 4 +- .../tutorials/gettingStarted/gsQml/texteditor.qml | 2 +- src/declarative/graphicsitems/qdeclarativeitem.cpp | 2 +- .../graphicsitems/qdeclarativetextedit.cpp | 4 +- .../graphicsitems/qdeclarativetextinput.cpp | 6 +- .../graphicsitems/qdeclarativevisualitemmodel.cpp | 2 +- src/declarative/qml/qdeclarativecompiler.cpp | 2 +- src/declarative/qml/qdeclarativecomponent.cpp | 2 +- src/declarative/qml/qdeclarativecontext.cpp | 4 +- src/declarative/qml/qdeclarativedom.cpp | 2 +- src/declarative/qml/qdeclarativeexpression.cpp | 2 +- src/declarative/util/qdeclarativefontloader.cpp | 2 +- src/declarative/util/qdeclarativetimer.cpp | 2 +- src/declarative/util/qdeclarativexmllistmodel.cpp | 2 +- src/imports/particles/qdeclarativeparticles.cpp | 2 +- .../declarative/parserstress/tst_parserstress.cpp | 2 +- .../qdeclarativeanchors/data/anchors.qml | 2 +- .../data/anchorsqgraphicswidget.qml | 2 +- .../qdeclarativeanchors/data/centerin.qml | 2 +- .../qdeclarativeanchors/data/crash1.qml | 2 +- .../declarative/qdeclarativeanchors/data/fill.qml | 2 +- .../qdeclarativeanchors/data/hvCenter.qml | 2 +- .../declarative/qdeclarativeanchors/data/loop1.qml | 2 +- .../declarative/qdeclarativeanchors/data/loop2.qml | 2 +- .../qdeclarativeanchors/data/margins.qml | 2 +- .../tst_qdeclarativeanchors.cpp | 2 +- .../qdeclarativeanimatedimage/data/colors.qml | 2 +- .../qdeclarativeanimatedimage/data/stickman.qml | 2 +- .../data/stickmanerror1.qml | 2 +- .../data/stickmanpause.qml | 2 +- .../data/stickmanscaled.qml | 2 +- .../data/stickmanstopped.qml | 2 +- .../tst_qdeclarativeanimatedimage.cpp | 2 +- .../qdeclarativeanimations/data/attached.qml | 2 +- .../qdeclarativeanimations/data/badproperty1.qml | 2 +- .../qdeclarativeanimations/data/badproperty2.qml | 2 +- .../qdeclarativeanimations/data/badtype1.qml | 2 +- .../qdeclarativeanimations/data/badtype2.qml | 2 +- .../qdeclarativeanimations/data/badtype3.qml | 2 +- .../qdeclarativeanimations/data/badtype4.qml | 2 +- .../qdeclarativeanimations/data/dontAutoStart.qml | 2 +- .../qdeclarativeanimations/data/dontStart.qml | 2 +- .../qdeclarativeanimations/data/dontStart2.qml | 2 +- .../qdeclarativeanimations/data/dotproperty.qml | 2 +- .../qdeclarativeanimations/data/mixedtype1.qml | 2 +- .../qdeclarativeanimations/data/mixedtype2.qml | 2 +- .../data/nonTransitionBug.qml | 2 +- .../qdeclarativeanimations/data/properties.qml | 2 +- .../qdeclarativeanimations/data/properties2.qml | 2 +- .../qdeclarativeanimations/data/properties3.qml | 2 +- .../qdeclarativeanimations/data/properties4.qml | 2 +- .../qdeclarativeanimations/data/properties5.qml | 2 +- .../data/propertiesTransition.qml | 2 +- .../data/propertiesTransition2.qml | 2 +- .../data/propertiesTransition3.qml | 2 +- .../data/propertiesTransition4.qml | 2 +- .../data/propertiesTransition5.qml | 2 +- .../data/propertiesTransition6.qml | 2 +- .../data/propertiesTransition7.qml | 2 +- .../qdeclarativeanimations/data/rotation.qml | 2 +- .../qdeclarativeanimations/data/runningTrueBug.qml | 2 +- .../qdeclarativeanimations/data/valuesource.qml | 2 +- .../qdeclarativeanimations/data/valuesource2.qml | 2 +- .../tst_qdeclarativeanimations.cpp | 8 +- .../qdeclarativebehaviors/data/binding.qml | 2 +- .../qdeclarativebehaviors/data/color.qml | 2 +- .../qdeclarativebehaviors/data/cpptrigger.qml | 2 +- .../qdeclarativebehaviors/data/disabled.qml | 2 +- .../qdeclarativebehaviors/data/dontStart.qml | 2 +- .../qdeclarativebehaviors/data/empty.qml | 2 +- .../qdeclarativebehaviors/data/explicit.qml | 2 +- .../qdeclarativebehaviors/data/groupProperty.qml | 2 +- .../qdeclarativebehaviors/data/groupProperty2.qml | 2 +- .../data/groupedPropertyCrash.qml | 2 +- .../qdeclarativebehaviors/data/loop.qml | 2 +- .../qdeclarativebehaviors/data/nonSelecting2.qml | 2 +- .../qdeclarativebehaviors/data/parent.qml | 2 +- .../qdeclarativebehaviors/data/qtbug12295.qml | 2 +- .../data/reassignedAnimation.qml | 2 +- .../qdeclarativebehaviors/data/runningTrue.qml | 2 +- .../qdeclarativebehaviors/data/scripttrigger.qml | 2 +- .../qdeclarativebehaviors/data/simple.qml | 2 +- .../qdeclarativebehaviors/data/startup.qml | 2 +- .../qdeclarativebehaviors/data/startup2.qml | 2 +- .../qdeclarativebinding/data/test-binding.qml | 2 +- .../qdeclarativebinding/data/test-binding2.qml | 2 +- .../tst_qdeclarativeborderimage.cpp | 20 +-- .../qdeclarativecomponent/data/createObject.qml | 2 +- .../data/connection-targetchange.qml | 2 +- .../data/connection-unknownsignals-ignored.qml | 2 +- .../data/connection-unknownsignals-notarget.qml | 2 +- .../data/connection-unknownsignals-parent.qml | 2 +- .../data/connection-unknownsignals.qml | 2 +- .../data/test-connection.qml | 2 +- .../data/test-connection2.qml | 2 +- .../data/test-connection3.qml | 2 +- .../qdeclarativeconnection/data/trimming.qml | 2 +- .../tst_qdeclarativecontext.cpp | 18 +-- .../qdeclarativedebug/tst_qdeclarativedebug.cpp | 6 +- .../qdeclarativedom/data/MyComponent.qml | 2 +- .../declarative/qdeclarativedom/data/MyItem.qml | 2 +- .../qdeclarativedom/data/import/Bar.qml | 2 +- .../qdeclarativedom/data/importlib/sublib/Foo.qml | 2 +- .../auto/declarative/qdeclarativedom/data/top.qml | 2 +- .../qdeclarativedom/tst_qdeclarativedom.cpp | 162 ++++++++++----------- .../qdeclarativeecmascript/data/CustomObject.qml | 2 +- .../qdeclarativeecmascript/data/MethodsObject.qml | 2 +- .../data/NestedTypeTransientErrors.qml | 2 +- .../qdeclarativeecmascript/data/ScopeObject.qml | 2 +- .../data/SpuriousWarning.qml | 2 +- .../data/aliasPropertyAndBinding.qml | 2 +- .../data/assignBasicTypes.qml | 2 +- .../data/attachedPropertyScope.qml | 2 +- .../qdeclarativeecmascript/data/bug.1.qml | 2 +- .../data/canAssignNullToQObject.2.qml | 2 +- .../qdeclarativeecmascript/data/compiled.qml | 2 +- .../data/compositePropertyType.qml | 2 +- .../data/deferredPropertiesErrors.qml | 2 +- .../qdeclarativeecmascript/data/deleteLater.qml | 2 +- .../qdeclarativeecmascript/data/deletedEngine.qml | 2 +- .../qdeclarativeecmascript/data/deletedObject.qml | 2 +- .../qdeclarativeecmascript/data/eval.qml | 2 +- .../data/exceptionProducesWarning.qml | 2 +- .../data/exceptionProducesWarning2.qml | 2 +- .../data/extendedObjectPropertyLookup.qml | 2 +- .../data/extensionObjects.qml | 2 +- .../qdeclarativeecmascript/data/function.qml | 2 +- .../qdeclarativeecmascript/data/functionErrors.qml | 2 +- .../data/idShortcutInvalidates.1.qml | 2 +- .../data/idShortcutInvalidates.qml | 2 +- .../declarative/qdeclarativeecmascript/data/in.qml | 2 +- .../qdeclarativeecmascript/data/include.qml | 2 +- .../data/include_callback.qml | 2 +- .../qdeclarativeecmascript/data/include_pragma.qml | 2 +- .../qdeclarativeecmascript/data/include_remote.qml | 2 +- .../data/include_remote_missing.qml | 2 +- .../qdeclarativeecmascript/data/include_shared.qml | 2 +- .../data/invokableObjectArg.qml | 2 +- .../data/invokableObjectRet.qml | 2 +- .../qdeclarativeecmascript/data/jsObject.qml | 2 +- .../data/libraryScriptAssert.qml | 2 +- .../qdeclarativeecmascript/data/listProperties.qml | 2 +- .../qdeclarativeecmascript/data/listToVariant.qml | 2 +- .../qdeclarativeecmascript/data/methods.3.qml | 2 +- .../qdeclarativeecmascript/data/methods.4.qml | 2 +- .../qdeclarativeecmascript/data/methods.5.qml | 2 +- .../data/multiEngineObject.qml | 2 +- .../data/noSpuriousWarningsAtShutdown.2.qml | 2 +- .../data/noSpuriousWarningsAtShutdown.qml | 2 +- .../qdeclarativeecmascript/data/nonscriptable.qml | 2 +- .../data/nullObjectBinding.qml | 2 +- .../data/objectsCompareAsEqual.qml | 2 +- .../qdeclarativeecmascript/data/ownership.qml | 2 +- .../data/propertyAssignmentErrors.qml | 2 +- .../data/qlistqobjectMethods.qml | 2 +- .../qdeclarativeecmascript/data/qtbug_10696.qml | 2 +- .../qdeclarativeecmascript/data/qtbug_11600.qml | 2 +- .../qdeclarativeecmascript/data/qtbug_11606.qml | 2 +- .../data/qtcreatorbug_1289.qml | 2 +- .../qdeclarativeecmascript/data/scope.2.qml | 2 +- .../qdeclarativeecmascript/data/scope.3.qml | 2 +- .../qdeclarativeecmascript/data/scope.qml | 2 +- .../data/scriptConnect.1.qml | 2 +- .../data/scriptConnect.2.qml | 2 +- .../data/scriptConnect.3.qml | 2 +- .../data/scriptConnect.4.qml | 2 +- .../data/scriptConnect.5.qml | 2 +- .../data/scriptConnect.6.qml | 2 +- .../data/scriptDisconnect.1.qml | 2 +- .../data/scriptDisconnect.2.qml | 2 +- .../data/scriptDisconnect.3.qml | 2 +- .../data/scriptDisconnect.4.qml | 2 +- .../data/sharedAttachedObject.qml | 2 +- .../qdeclarativeecmascript/data/shutdownErrors.qml | 2 +- .../data/signalTriggeredBindings.qml | 2 +- .../qdeclarativeecmascript/data/strictlyEquals.qml | 2 +- .../data/transientErrors.2.qml | 2 +- .../data/transientErrors.qml | 2 +- .../data/variantsAssignedUndefined.qml | 2 +- .../qdeclarativeengine/tst_qdeclarativeengine.cpp | 8 +- .../qdeclarativeflickable/data/flickable01.qml | 2 +- .../qdeclarativeflickable/data/flickable02.qml | 2 +- .../qdeclarativeflickable/data/flickable03.qml | 2 +- .../qdeclarativeflickable/data/flickable04.qml | 2 +- .../data/flickableqgraphicswidget.qml | 2 +- .../tst_qdeclarativeflickable.cpp | 10 +- .../qdeclarativeflipable/data/crash.qml | 2 +- .../qdeclarativeflipable/data/flipable-abort.qml | 2 +- .../qdeclarativeflipable/data/test-flipable.qml | 2 +- .../qdeclarativefocusscope/data/chain.qml | 2 +- .../qdeclarativefocusscope/data/forcefocus.qml | 2 +- .../qdeclarativefocusscope/data/signalEmission.qml | 2 +- .../qdeclarativefocusscope/data/test.qml | 2 +- .../qdeclarativefocusscope/data/test2.qml | 2 +- .../qdeclarativefocusscope/data/test3.qml | 2 +- .../qdeclarativefocusscope/data/test4.qml | 2 +- .../qdeclarativefocusscope/data/test5.qml | 2 +- .../tst_qdeclarativefontloader.cpp | 16 +- .../qdeclarativegridview/data/displaygrid.qml | 2 +- .../qdeclarativegridview/data/footer.qml | 2 +- .../data/gridview-enforcerange.qml | 2 +- .../data/gridview-initCurrent.qml | 2 +- .../qdeclarativegridview/data/gridview1.qml | 2 +- .../qdeclarativegridview/data/gridview2.qml | 2 +- .../qdeclarativegridview/data/gridview3.qml | 2 +- .../qdeclarativegridview/data/manual-highlight.qml | 2 +- .../data/propertychangestest.qml | 2 +- .../qdeclarativegridview/data/setindex.qml | 2 +- .../tst_qdeclarativegridview.cpp | 4 +- .../qdeclarativeimage/data/aspectratio.qml | 2 +- .../declarative/qdeclarativeimage/data/tiling.qml | 2 +- .../qdeclarativeimage/tst_qdeclarativeimage.cpp | 16 +- .../tst_qdeclarativeimageprovider.cpp | 8 +- .../qdeclarativeinfo/data/NestedObject.qml | 2 +- .../qdeclarativeinfo/data/nestedQmlObject.qml | 2 +- .../qdeclarativeinfo/data/qmlObject.qml | 2 +- .../qdeclarativeitem/data/childrenProperty.qml | 2 +- .../qdeclarativeitem/data/childrenRect.qml | 2 +- .../qdeclarativeitem/data/childrenRectBug.qml | 2 +- .../qdeclarativeitem/data/childrenRectBug2.qml | 2 +- .../qdeclarativeitem/data/childrenRectBug3.qml | 2 +- .../qdeclarativeitem/data/keynavigationtest.qml | 2 +- .../qdeclarativeitem/data/keyspriority.qml | 2 +- .../declarative/qdeclarativeitem/data/keystest.qml | 2 +- .../qdeclarativeitem/data/mapCoordinates.qml | 2 +- .../qdeclarativeitem/data/mouseFocus.qml | 2 +- .../qdeclarativeitem/data/propertychanges.qml | 2 +- .../qdeclarativeitem/data/resourcesProperty.qml | 2 +- .../qdeclarativeitem/tst_qdeclarativeitem.cpp | 6 +- .../qdeclarativelanguage/data/Alias.qml | 2 +- .../qdeclarativelanguage/data/Alias2.qml | 2 +- .../qdeclarativelanguage/data/Alias3.qml | 2 +- .../qdeclarativelanguage/data/Alias4.qml | 2 +- .../data/ComponentComposite.qml | 2 +- .../qdeclarativelanguage/data/CompositeType.qml | 2 +- .../qdeclarativelanguage/data/CompositeType3.qml | 2 +- .../data/DynamicPropertiesNestedType.qml | 2 +- .../qdeclarativelanguage/data/HelperAlias.qml | 2 +- .../qdeclarativelanguage/data/LocalLast.qml | 2 +- .../qdeclarativelanguage/data/NestedAlias.qml | 2 +- .../qdeclarativelanguage/data/NestedErrorsType.qml | 2 +- .../qdeclarativelanguage/data/OnCompletedType.qml | 2 +- .../data/OnDestructionType.qml | 2 +- .../qdeclarativelanguage/data/alias.1.qml | 2 +- .../qdeclarativelanguage/data/alias.3.qml | 2 +- .../qdeclarativelanguage/data/alias.5.qml | 2 +- .../qdeclarativelanguage/data/alias.6.qml | 2 +- .../qdeclarativelanguage/data/alias.7.qml | 2 +- .../qdeclarativelanguage/data/alias.8.qml | 2 +- .../qdeclarativelanguage/data/alias.9.qml | 2 +- .../data/aliasPropertiesAndSignals.qml | 2 +- .../data/assignCompositeToType.qml | 2 +- .../data/assignLiteralToVariant.qml | 2 +- .../data/assignObjectToVariant.qml | 2 +- .../data/assignToNamespace.qml | 2 +- .../data/attachedProperties.qml | 2 +- .../qdeclarativelanguage/data/component.1.qml | 2 +- .../qdeclarativelanguage/data/component.2.qml | 2 +- .../qdeclarativelanguage/data/component.3.qml | 2 +- .../qdeclarativelanguage/data/component.4.qml | 2 +- .../qdeclarativelanguage/data/component.5.qml | 2 +- .../qdeclarativelanguage/data/component.6.qml | 2 +- .../qdeclarativelanguage/data/component.7.qml | 2 +- .../qdeclarativelanguage/data/component.8.qml | 2 +- .../qdeclarativelanguage/data/component.9.qml | 2 +- .../data/componentCompositeType.qml | 2 +- .../qdeclarativelanguage/data/crash2.qml | 2 +- .../qdeclarativelanguage/data/customOnProperty.qml | 2 +- .../data/customParserIdNotAllowed.qml | 2 +- .../data/customParserTypes.qml | 2 +- .../data/declaredPropertyValues.qml | 2 +- .../qdeclarativelanguage/data/defaultGrouped.qml | 2 +- .../data/defaultPropertyListOrder.qml | 2 +- .../qdeclarativelanguage/data/destroyedSignal.qml | 2 +- .../data/dontDoubleCallClassBegin.qml | 2 +- .../qdeclarativelanguage/data/dynamicMeta.1.qml | 2 +- .../qdeclarativelanguage/data/dynamicMeta.2.qml | 2 +- .../qdeclarativelanguage/data/dynamicMeta.3.qml | 2 +- .../qdeclarativelanguage/data/dynamicMeta.4.qml | 2 +- .../qdeclarativelanguage/data/dynamicMeta.5.qml | 2 +- .../qdeclarativelanguage/data/dynamicObject.1.qml | 2 +- .../data/dynamicObjectProperties.2.qml | 4 +- .../data/dynamicObjectProperties.qml | 4 +- .../data/dynamicProperties.qml | 2 +- .../data/dynamicPropertiesNested.qml | 2 +- .../data/dynamicSignalsAndSlots.qml | 2 +- .../qdeclarativelanguage/data/enumTypes.qml | 2 +- .../data/importNamespaceConflict.qml | 2 +- .../qdeclarativelanguage/data/importNonExist.qml | 2 +- .../data/inlineQmlComponents.qml | 2 +- .../data/interfaceProperty.qml | 2 +- .../qdeclarativelanguage/data/invalidAlias.1.qml | 2 +- .../qdeclarativelanguage/data/invalidAlias.2.qml | 2 +- .../data/invalidAttachedProperty.1.qml | 2 +- .../data/invalidAttachedProperty.10.qml | 2 +- .../data/invalidAttachedProperty.11.qml | 2 +- .../data/invalidAttachedProperty.2.qml | 2 +- .../data/invalidAttachedProperty.3.qml | 2 +- .../data/invalidAttachedProperty.4.qml | 2 +- .../data/invalidAttachedProperty.5.qml | 2 +- .../data/invalidAttachedProperty.6.qml | 2 +- .../data/invalidAttachedProperty.7.qml | 2 +- .../data/invalidAttachedProperty.8.qml | 2 +- .../data/invalidAttachedProperty.9.qml | 2 +- .../data/invalidGroupedProperty.1.qml | 2 +- .../data/invalidGroupedProperty.2.qml | 2 +- .../data/invalidImportID.errors.txt | 2 +- .../qdeclarativelanguage/data/invalidImportID.qml | 4 +- .../qdeclarativelanguage/data/invalidProperty.qml | 2 +- .../lib/com/nokia/installedtest/InstalledTest.qml | 2 +- .../lib/com/nokia/installedtest/InstalledTest2.qml | 2 +- .../data/lib/com/nokia/installedtest/LocalLast.qml | 2 +- .../lib/com/nokia/installedtest/PrivateType.qml | 2 +- .../lib/com/nokia/installedtest0/InstalledTest.qml | 2 +- .../com/nokia/installedtest0/InstalledTest2.qml | 2 +- .../qdeclarativelanguage/data/listAssignment.1.qml | 2 +- .../data/listItemDeleteSelf.qml | 2 +- .../qdeclarativelanguage/data/listProperties.qml | 2 +- .../qdeclarativelanguage/data/method.1.qml | 2 +- .../qdeclarativelanguage/data/missingSignal.qml | 2 +- .../qdeclarativelanguage/data/nestedErrors.qml | 2 +- .../qdeclarativelanguage/data/noCreation.qml | 2 +- .../qdeclarativelanguage/data/onCompleted.qml | 2 +- .../qdeclarativelanguage/data/onDestruction.qml | 2 +- .../qdeclarativelanguage/data/property.1.qml | 2 +- .../qdeclarativelanguage/data/property.2.qml | 2 +- .../qdeclarativelanguage/data/property.3.qml | 2 +- .../qdeclarativelanguage/data/property.4.qml | 2 +- .../qdeclarativelanguage/data/property.5.qml | 2 +- .../qdeclarativelanguage/data/property.6.qml | 2 +- .../qdeclarativelanguage/data/property.7.qml | 2 +- .../data/qmlAttachedPropertiesObjectMethod.1.qml | 2 +- .../data/qmlAttachedPropertiesObjectMethod.2.qml | 2 +- .../qdeclarativelanguage/data/readOnly.3.qml | 2 +- .../qdeclarativelanguage/data/signal.1.qml | 2 +- .../qdeclarativelanguage/data/signal.2.qml | 2 +- .../qdeclarativelanguage/data/signal.3.qml | 2 +- .../qdeclarativelanguage/data/signal.4.qml | 2 +- .../qdeclarativelanguage/data/subdir/Test.qml | 2 +- .../data/subdir/subsubdir/SubTest.qml | 2 +- .../qdeclarativelanguage/data/variantNotify.qml | 2 +- .../qdeclarativelanguage/data/wrongType.16.qml | 2 +- .../declarative/qmllanguage/LocalInternal.qml | 2 +- .../qtest/declarative/qmllanguage/Test.qml | 2 +- .../declarative/qmllanguage/UndeclaredLocal.qml | 2 +- .../declarative/qmllanguage/subdir/SubTest.qml | 2 +- .../tst_qdeclarativelanguage.cpp | 14 +- .../qdeclarativelayoutitem/data/layoutItem.qml | 2 +- .../qdeclarativelistmodel/data/enumerate.qml | 2 +- .../qdeclarativelistmodel/data/model.qml | 2 +- .../qdeclarativelistmodel/data/multipleroles.qml | 4 +- .../tst_qdeclarativelistmodel.cpp | 32 ++-- .../qdeclarativelistreference/data/MyType.qml | 2 +- .../qdeclarativelistreference/data/engineTypes.qml | 2 +- .../data/variantToList.qml | 2 +- .../qdeclarativelistview/data/displaylist.qml | 2 +- .../qdeclarativelistview/data/footer.qml | 2 +- .../qdeclarativelistview/data/itemlist.qml | 2 +- .../data/listview-enforcerange.qml | 2 +- .../data/listview-initCurrent.qml | 2 +- .../data/listview-sections.qml | 2 +- .../qdeclarativelistview/data/listviewtest.qml | 2 +- .../qdeclarativelistview/data/manual-highlight.qml | 2 +- .../data/propertychangestest.qml | 2 +- .../data/strictlyenforcerange.qml | 2 +- .../tst_qdeclarativelistview.cpp | 4 +- .../qdeclarativeloader/data/AnchoredLoader.qml | 2 +- .../qdeclarativeloader/data/BlueRect.qml | 2 +- .../data/GraphicsWidget250x250.qml | 2 +- .../qdeclarativeloader/data/GreenRect.qml | 2 +- .../qdeclarativeloader/data/NoResize.qml | 2 +- .../data/NoResizeGraphicsWidget.qml | 2 +- .../qdeclarativeloader/data/Rect120x60.qml | 2 +- .../qdeclarativeloader/data/SetSourceComponent.qml | 2 +- .../data/SizeGraphicsWidgetToLoader.qml | 2 +- .../data/SizeLoaderToGraphicsWidget.qml | 2 +- .../qdeclarativeloader/data/SizeToItem.qml | 2 +- .../qdeclarativeloader/data/SizeToLoader.qml | 2 +- .../qdeclarativeloader/data/VmeError.qml | 2 +- .../declarative/qdeclarativeloader/data/crash.qml | 2 +- .../qdeclarativeloader/data/differentorigin.qml | 2 +- .../qdeclarativeloader/data/nonItem.qml | 2 +- .../qdeclarativeloader/data/sameorigin-load.qml | 2 +- .../qdeclarativeloader/data/sameorigin.qml | 2 +- .../qdeclarativeloader/data/vmeErrors.qml | 2 +- .../qdeclarativeloader/tst_qdeclarativeloader.cpp | 14 +- .../qdeclarativemousearea/data/clickandhold.qml | 2 +- .../qdeclarativemousearea/data/doubleclick.qml | 2 +- .../qdeclarativemousearea/data/dragging.qml | 2 +- .../qdeclarativemousearea/data/dragproperties.qml | 2 +- .../qdeclarativemousearea/data/dragreset.qml | 2 +- .../qdeclarativemousearea/data/rejectEvent.qml | 2 +- .../data/updateMousePosOnClick.qml | 2 +- .../data/updateMousePosOnResize.qml | 2 +- .../data/particlemotiontest.qml | 2 +- .../qdeclarativeparticles/data/particlestest.qml | 2 +- .../qdeclarativepathview/data/datamodel.qml | 2 +- .../qdeclarativepathview/data/displaypath.qml | 2 +- .../qdeclarativepathview/data/emptymodel.qml | 2 +- .../data/pathUpdateOnStartChanged.qml | 2 +- .../qdeclarativepathview/data/pathtest.qml | 2 +- .../qdeclarativepathview/data/pathview0.qml | 2 +- .../qdeclarativepathview/data/pathview1.qml | 2 +- .../qdeclarativepathview/data/pathview2.qml | 2 +- .../qdeclarativepathview/data/pathview3.qml | 2 +- .../qdeclarativepathview/data/pathview_package.qml | 2 +- .../qdeclarativepathview/data/propertychanges.qml | 2 +- .../tst_qdeclarativepathview.cpp | 2 +- .../data/flow-testimplicitsize.qml | 4 +- .../qdeclarativepositioners/data/flowtest.qml | 2 +- .../qdeclarativepositioners/data/grid-animated.qml | 2 +- .../qdeclarativepositioners/data/grid-spacing.qml | 2 +- .../data/grid-toptobottom.qml | 2 +- .../qdeclarativepositioners/data/gridtest.qml | 2 +- .../data/gridzerocolumns.qml | 2 +- .../data/horizontal-animated.qml | 2 +- .../data/horizontal-spacing.qml | 2 +- .../qdeclarativepositioners/data/horizontal.qml | 2 +- .../data/propertychangestest.qml | 2 +- .../qdeclarativepositioners/data/repeatertest.qml | 2 +- .../data/vertical-animated.qml | 2 +- .../data/vertical-spacing.qml | 2 +- .../qdeclarativepositioners/data/vertical.qml | 2 +- .../data/verticalqgraphicswidget.qml | 2 +- .../tst_qdeclarativepositioners.cpp | 28 ++-- .../qdeclarativeproperty/data/TestType.qml | 2 +- .../data/readSynthesizedObject.qml | 2 +- .../tst_qdeclarativepropertymap.cpp | 4 +- .../auto/declarative/qdeclarativeqt/data/atob.qml | 2 +- .../auto/declarative/qdeclarativeqt/data/btoa.qml | 2 +- .../declarative/qdeclarativeqt/data/consoleLog.qml | 2 +- .../qdeclarativeqt/data/createComponent.qml | 2 +- .../qdeclarativeqt/data/createComponentData.qml | 2 +- .../qdeclarativeqt/data/createComponent_lib.qml | 2 +- .../qdeclarativeqt/data/createQmlObject.qml | 16 +- .../declarative/qdeclarativeqt/data/darker.qml | 2 +- .../auto/declarative/qdeclarativeqt/data/enums.qml | 2 +- .../qdeclarativeqt/data/fontFamilies.qml | 2 +- .../declarative/qdeclarativeqt/data/formatting.qml | 2 +- .../auto/declarative/qdeclarativeqt/data/hsla.qml | 2 +- .../declarative/qdeclarativeqt/data/isQtObject.qml | 2 +- .../declarative/qdeclarativeqt/data/lighter.qml | 2 +- tests/auto/declarative/qdeclarativeqt/data/md5.qml | 2 +- .../qdeclarativeqt/data/openUrlExternally.qml | 2 +- .../auto/declarative/qdeclarativeqt/data/point.qml | 2 +- .../auto/declarative/qdeclarativeqt/data/rect.qml | 2 +- .../auto/declarative/qdeclarativeqt/data/rgba.qml | 2 +- .../auto/declarative/qdeclarativeqt/data/size.qml | 2 +- .../auto/declarative/qdeclarativeqt/data/tint.qml | 2 +- .../declarative/qdeclarativeqt/data/vector.qml | 2 +- .../qdeclarativerepeater/data/intmodel.qml | 2 +- .../qdeclarativerepeater/data/itemlist.qml | 2 +- .../qdeclarativerepeater/data/objlist.qml | 2 +- .../qdeclarativerepeater/data/properties.qml | 2 +- .../qdeclarativerepeater/data/repeater1.qml | 2 +- .../qdeclarativerepeater/data/repeater2.qml | 2 +- .../tst_qdeclarativerepeater.cpp | 2 +- .../data/backtrace1.qml | 2 +- .../data/smoothedanimation1.qml | 2 +- .../data/smoothedanimation2.qml | 2 +- .../data/smoothedanimation3.qml | 2 +- .../data/smoothedanimationBehavior.qml | 2 +- .../data/smoothedanimationValueSource.qml | 2 +- .../data/springanimation1.qml | 2 +- .../data/springanimation2.qml | 2 +- .../data/springanimation3.qml | 2 +- .../tst_qdeclarativesqldatabase.cpp | 2 +- .../qdeclarativestates/data/ExtendedRectangle.qml | 2 +- .../data/Implementation/MyType.qml | 2 +- .../qdeclarativestates/data/anchorChanges1.qml | 2 +- .../qdeclarativestates/data/anchorChanges2.qml | 2 +- .../qdeclarativestates/data/anchorChanges3.qml | 2 +- .../qdeclarativestates/data/anchorChanges4.qml | 2 +- .../qdeclarativestates/data/anchorChanges5.qml | 2 +- .../qdeclarativestates/data/anchorChangesCrash.qml | 2 +- .../qdeclarativestates/data/anchorRewindBug.qml | 4 +- .../qdeclarativestates/data/anchorRewindBug2.qml | 2 +- .../data/attachedPropertyChanges.qml | 2 +- .../data/autoStateAtStartupRestoreBug.qml | 2 +- .../qdeclarativestates/data/basicBinding.qml | 2 +- .../qdeclarativestates/data/basicBinding2.qml | 2 +- .../qdeclarativestates/data/basicBinding3.qml | 2 +- .../qdeclarativestates/data/basicBinding4.qml | 2 +- .../qdeclarativestates/data/basicChanges.qml | 2 +- .../qdeclarativestates/data/basicChanges2.qml | 2 +- .../qdeclarativestates/data/basicChanges3.qml | 2 +- .../qdeclarativestates/data/basicChanges4.qml | 2 +- .../qdeclarativestates/data/basicExtension.qml | 2 +- .../qdeclarativestates/data/deleting.qml | 2 +- .../qdeclarativestates/data/deletingState.qml | 2 +- .../qdeclarativestates/data/editProperties.qml | 2 +- .../qdeclarativestates/data/explicit.qml | 2 +- .../qdeclarativestates/data/extendsBug.qml | 2 +- .../qdeclarativestates/data/fakeExtension.qml | 2 +- .../qdeclarativestates/data/illegalObj.qml | 2 +- .../qdeclarativestates/data/illegalTempState.qml | 2 +- .../qdeclarativestates/data/legalTempState.qml | 2 +- .../qdeclarativestates/data/nonExistantProp.qml | 2 +- .../qdeclarativestates/data/parentChange1.qml | 2 +- .../qdeclarativestates/data/parentChange2.qml | 2 +- .../qdeclarativestates/data/parentChange3.qml | 2 +- .../qdeclarativestates/data/parentChange4.qml | 2 +- .../qdeclarativestates/data/parentChange5.qml | 2 +- .../qdeclarativestates/data/parentChange6.qml | 2 +- .../qdeclarativestates/data/propertyErrors.qml | 2 +- .../declarative/qdeclarativestates/data/reset.qml | 2 +- .../qdeclarativestates/data/restoreEntryValues.qml | 2 +- .../qdeclarativestates/data/returnToBase.qml | 2 +- .../declarative/qdeclarativestates/data/script.qml | 2 +- .../qdeclarativestates/data/signalOverride.qml | 2 +- .../qdeclarativestates/data/signalOverride2.qml | 2 +- .../data/signalOverrideCrash.qml | 2 +- .../data/signalOverrideCrash2.qml | 2 +- .../qdeclarativestates/data/unnamedWhen.qml | 2 +- .../qdeclarativestates/data/urlResolution.qml | 2 +- .../qdeclarativestates/data/whenOrdering.qml | 2 +- .../tst_qdeclarativesystempalette.cpp | 8 +- .../qdeclarativetext/data/alignments.qml | 2 +- .../qdeclarativetext/data/embeddedImagesLocal.qml | 2 +- .../data/embeddedImagesLocalError.qml | 2 +- .../qdeclarativetext/data/embeddedImagesRemote.qml | 2 +- .../data/embeddedImagesRemoteError.qml | 2 +- .../declarative/qdeclarativetext/data/rotated.qml | 2 +- .../qdeclarativetext/tst_qdeclarativetext.cpp | 110 +++++++------- .../qdeclarativetextedit/data/alignments.qml | 2 +- .../qdeclarativetextedit/data/cursorTest.qml | 2 +- .../qdeclarativetextedit/data/geometrySignals.qml | 2 +- .../qdeclarativetextedit/data/http/ErrItem.qml | 2 +- .../qdeclarativetextedit/data/http/NormItem.qml | 2 +- .../data/http/cursorHttpTest.qml | 2 +- .../data/http/cursorHttpTestFail1.qml | 2 +- .../data/http/cursorHttpTestFail2.qml | 2 +- .../data/http/cursorHttpTestPass.qml | 2 +- .../data/httpfail/FailItem.qml | 2 +- .../data/httpslow/WaitItem.qml | 2 +- .../qdeclarativetextedit/data/inputmethodhints.qml | 2 +- .../data/mouseselection_default.qml | 2 +- .../data/mouseselection_false.qml | 2 +- .../data/mouseselection_true.qml | 2 +- .../qdeclarativetextedit/data/navigation.qml | 2 +- .../qdeclarativetextedit/data/readOnly.qml | 2 +- .../tst_qdeclarativetextedit.cpp | 64 ++++---- .../qdeclarativetextinput/data/cursorTest.qml | 2 +- .../qdeclarativetextinput/data/echoMode.qml | 2 +- .../qdeclarativetextinput/data/geometrySignals.qml | 2 +- .../data/horizontalAlignment.qml | 2 +- .../qdeclarativetextinput/data/inputmethods.qml | 2 +- .../qdeclarativetextinput/data/masks.qml | 2 +- .../qdeclarativetextinput/data/maxLength.qml | 2 +- .../qdeclarativetextinput/data/navigation.qml | 2 +- .../qdeclarativetextinput/data/positionAt.qml | 2 +- .../qdeclarativetextinput/data/readOnly.qml | 2 +- .../qdeclarativetextinput/data/validators.qml | 2 +- .../tst_qdeclarativetextinput.cpp | 34 ++--- .../qdeclarativetimer/tst_qdeclarativetimer.cpp | 18 +-- .../qdeclarativevaluetypes/data/conflicting.1.qml | 2 +- .../qdeclarativevaluetypes/data/conflicting.2.qml | 2 +- .../qdeclarativevaluetypes/data/conflicting.3.qml | 2 +- .../qdeclarativevaluetypes/data/deletedObject.qml | 2 +- .../qdeclarativevaluetypes/data/enums.3.qml | 2 +- .../qdeclarativevaluetypes/data/enums.4.qml | 2 +- .../qdeclarativevaluetypes/data/enums.5.qml | 2 +- .../qdeclarativevaluetypes/data/font_write.5.qml | 2 +- .../qdeclarativevaluetypes/data/returnValues.qml | 2 +- .../qdeclarativevaluetypes/data/scriptAccess.qml | 2 +- .../data/sizereadonly_writeerror4.qml | 2 +- .../qdeclarativevaluetypes/data/varAssignment.qml | 2 +- .../data/resizemodedeclarativeitem.qml | 2 +- .../data/resizemodegraphicswidget.qml | 2 +- .../qdeclarativeviewer/data/orientation.qml | 2 +- .../qdeclarativevisualdatamodel/data/datalist.qml | 2 +- .../data/objectlist.qml | 2 +- .../data/singlerole1.qml | 2 +- .../data/singlerole2.qml | 2 +- .../data/visualdatamodel.qml | 2 +- .../declarative/qdeclarativewebview/data/basic.qml | 2 +- .../qdeclarativewebview/data/elements.qml | 2 +- .../qdeclarativewebview/data/javaScript.qml | 2 +- .../qdeclarativewebview/data/loadError.qml | 2 +- .../qdeclarativewebview/data/newwindows.qml | 2 +- .../qdeclarativewebview/data/propertychanges.qml | 2 +- .../qdeclarativewebview/data/sethtml.qml | 2 +- .../tst_qdeclarativewebview.cpp | 2 +- .../qdeclarativeworkerscript/data/BaseWorker.qml | 2 +- .../qdeclarativeworkerscript/data/worker.qml | 2 +- .../data/worker_pragma.qml | 2 +- .../qdeclarativexmlhttprequest/data/abort.qml | 2 +- .../data/abort_opened.qml | 2 +- .../data/abort_unsent.qml | 2 +- .../qdeclarativexmlhttprequest/data/attr.qml | 2 +- .../data/callbackException.qml | 2 +- .../qdeclarativexmlhttprequest/data/cdata.qml | 2 +- .../data/constructor.qml | 2 +- .../data/defaultState.qml | 2 +- .../qdeclarativexmlhttprequest/data/document.qml | 2 +- .../data/domExceptionCodes.qml | 2 +- .../qdeclarativexmlhttprequest/data/element.qml | 2 +- .../data/getAllResponseHeaders.qml | 2 +- .../data/getAllResponseHeaders_args.qml | 2 +- .../data/getAllResponseHeaders_sent.qml | 2 +- .../data/getAllResponseHeaders_unsent.qml | 2 +- .../data/getResponseHeader.qml | 2 +- .../data/getResponseHeader_args.qml | 2 +- .../data/getResponseHeader_sent.qml | 2 +- .../data/getResponseHeader_unsent.qml | 2 +- .../data/instanceStateValues.qml | 2 +- .../data/invalidMethodUsage.qml | 2 +- .../qdeclarativexmlhttprequest/data/open.qml | 2 +- .../data/open_arg_count.1.qml | 2 +- .../data/open_arg_count.2.qml | 2 +- .../data/open_invalid_method.qml | 2 +- .../qdeclarativexmlhttprequest/data/open_sync.qml | 2 +- .../qdeclarativexmlhttprequest/data/open_user.qml | 2 +- .../data/open_username.qml | 2 +- .../data/redirectError.qml | 2 +- .../data/redirectRecur.qml | 2 +- .../qdeclarativexmlhttprequest/data/redirects.qml | 2 +- .../data/responseText.qml | 2 +- .../data/responseXML_invalid.qml | 2 +- .../data/send_alreadySent.qml | 2 +- .../data/send_data.1.qml | 2 +- .../data/send_data.2.qml | 2 +- .../data/send_data.3.qml | 2 +- .../data/send_data.4.qml | 2 +- .../data/send_data.5.qml | 2 +- .../data/send_data.6.qml | 2 +- .../data/send_data.7.qml | 2 +- .../data/send_ignoreData.qml | 2 +- .../data/send_unsent.qml | 2 +- .../data/setRequestHeader.qml | 2 +- .../data/setRequestHeader_args.qml | 2 +- .../data/setRequestHeader_illegalName.qml | 2 +- .../data/setRequestHeader_sent.qml | 2 +- .../data/setRequestHeader_unsent.qml | 2 +- .../data/staticStateValues.qml | 2 +- .../qdeclarativexmlhttprequest/data/status.qml | 2 +- .../qdeclarativexmlhttprequest/data/statusText.qml | 2 +- .../qdeclarativexmlhttprequest/data/text.qml | 2 +- .../qdeclarativexmlhttprequest/data/utf16.qml | 2 +- .../qdeclarativexmllistmodel/data/model.qml | 2 +- .../qdeclarativexmllistmodel/data/model2.qml | 2 +- .../data/propertychanges.qml | 2 +- .../qdeclarativexmllistmodel/data/recipes.qml | 2 +- .../qdeclarativexmllistmodel/data/roleErrors.qml | 2 +- .../qdeclarativexmllistmodel/data/roleKeys.qml | 2 +- .../qdeclarativexmllistmodel/data/unique.qml | 2 +- .../auto/declarative/qmlvisual/ListView/basic1.qml | 2 +- .../auto/declarative/qmlvisual/ListView/basic2.qml | 2 +- .../auto/declarative/qmlvisual/ListView/basic3.qml | 2 +- .../auto/declarative/qmlvisual/ListView/basic4.qml | 2 +- .../declarative/qmlvisual/ListView/itemlist.qml | 2 +- .../declarative/qmlvisual/ListView/listview.qml | 2 +- .../qmlvisual/Package_Views/packageviews.qml | 2 +- .../bindinganimation/bindinganimation.qml | 2 +- .../colorAnimation/colorAnimation-visual.qml | 2 +- .../qmlvisual/animation/easing/easing.qml | 2 +- .../declarative/qmlvisual/animation/loop/loop.qml | 2 +- .../parallelAnimation/parallelAnimation-visual.qml | 2 +- .../parentAnimation/parentAnimation-visual.qml | 2 +- .../parentAnimation2/parentAnimation2.qml | 2 +- .../pauseAnimation/pauseAnimation-visual.qml | 2 +- .../propertyAction/propertyAction-visual.qml | 2 +- .../qmlvisual/animation/qtbug10586/qtbug10586.qml | 2 +- .../qmlvisual/animation/qtbug13398/qtbug13398.qml | 2 +- .../qmlvisual/animation/reanchor/reanchor.qml | 2 +- .../animation/scriptAction/scriptAction-visual.qml | 2 +- .../declarative/qmlvisual/fillmode/fillmode.qml | 2 +- .../auto/declarative/qmlvisual/focusscope/test.qml | 2 +- .../declarative/qmlvisual/focusscope/test2.qml | 2 +- .../declarative/qmlvisual/focusscope/test3.qml | 2 +- .../qdeclarativeborderimage/animated-smooth.qml | 2 +- .../qmlvisual/qdeclarativeborderimage/animated.qml | 2 +- .../qmlvisual/qdeclarativeborderimage/borders.qml | 2 +- .../content/MyBorderImage.qml | 2 +- .../qdeclarativeflickable/flickable-horizontal.qml | 2 +- .../qdeclarativeflickable/flickable-vertical.qml | 2 +- .../qdeclarativeflipable/test-flipable.qml | 2 +- .../qdeclarativeflipable/test_flipable_resize.qml | 2 +- .../qmlvisual/qdeclarativegridview/gridview.qml | 2 +- .../qmlvisual/qdeclarativegridview/gridview2.qml | 2 +- .../qmlvisual/qdeclarativemousearea/drag.qml | 2 +- .../qdeclarativemousearea/mousearea-flickable.qml | 2 +- .../qdeclarativemousearea/mousearea-visual.qml | 2 +- .../qmlvisual/qdeclarativeparticles/particles.qml | 2 +- .../qdeclarativepathview/test-pathview-2.qml | 2 +- .../qdeclarativepathview/test-pathview.qml | 2 +- .../qmlvisual/qdeclarativepositioners/dynamic.qml | 2 +- .../qdeclarativepositioners/usingRepeater.qml | 2 +- .../smoothedanimation.qml | 2 +- .../smoothedfollow.qml | 2 +- .../qmlvisual/qdeclarativespringfollow/clock.qml | 2 +- .../qmlvisual/qdeclarativespringfollow/follow.qml | 2 +- .../qdeclarativetext/baseline/parentanchor.qml | 2 +- .../qmlvisual/qdeclarativetext/elide/elide.qml | 2 +- .../qmlvisual/qdeclarativetext/elide/elide2.qml | 2 +- .../qdeclarativetext/elide/multilength.qml | 2 +- .../qmlvisual/qdeclarativetext/font/plaintext.qml | 2 +- .../qmlvisual/qdeclarativetext/font/richtext.qml | 2 +- .../qdeclarativetextedit/MultilineEdit.qml | 2 +- .../qdeclarativetextedit/cursorDelegate.qml | 2 +- .../qmlvisual/qdeclarativetextedit/qt-669.qml | 2 +- .../qdeclarativetextedit/usingMultilineEdit.qml | 2 +- .../qmlvisual/qdeclarativetextedit/wrap.qml | 2 +- .../qmlvisual/qdeclarativetextinput/LineEdit.qml | 2 +- .../qdeclarativetextinput/cursorDelegate.qml | 2 +- .../qmlvisual/qdeclarativetextinput/echoMode.qml | 2 +- .../qmlvisual/qdeclarativetextinput/hAlign.qml | 2 +- .../qdeclarativetextinput/usingLineEdit.qml | 2 +- .../declarative/qmlvisual/rect/GradientRect.qml | 2 +- tests/auto/declarative/qmlvisual/rect/MyRect.qml | 2 +- .../declarative/qmlvisual/rect/rect-painting.qml | 2 +- .../auto/declarative/qmlvisual/repeater/basic1.qml | 2 +- .../auto/declarative/qmlvisual/repeater/basic2.qml | 2 +- .../auto/declarative/qmlvisual/repeater/basic3.qml | 2 +- .../auto/declarative/qmlvisual/repeater/basic4.qml | 2 +- .../selftest_noimages/selftest_noimages.qml | 2 +- .../qmlvisual/webview/autosize/autosize.qml | 2 +- .../webview/javascript/evaluateJavaScript.qml | 2 +- .../qmlvisual/webview/javascript/windowObjects.qml | 2 +- .../qmlvisual/webview/settings/fontFamily.qml | 2 +- .../qmlvisual/webview/settings/fontSize.qml | 2 +- .../webview/settings/noAutoLoadImages.qml | 2 +- .../qmlvisual/webview/settings/setFontFamily.qml | 2 +- .../qmlvisual/webview/zooming/pageWidth.qml | 2 +- .../qmlvisual/webview/zooming/renderControl.qml | 2 +- .../qmlvisual/webview/zooming/resolution.qml | 2 +- .../qmlvisual/webview/zooming/zoomTextOnly.qml | 2 +- .../qmlvisual/webview/zooming/zooming.qml | 2 +- .../lupdate/testdata/good/parseqml/main.qml | 2 +- .../declarative/compilation/data/BoomBlock.qml | 2 +- .../benchmarks/declarative/creation/data/item.qml | 2 +- .../declarative/creation/data/qobject.qml | 2 +- .../declarative/creation/tst_creation.cpp | 2 +- .../qdeclarativecomponent/data/object.qml | 2 +- .../qdeclarativecomponent/data/object_id.qml | 2 +- .../data/samegame/BoomBlock.qml | 2 +- .../data/synthesized_properties.2.qml | 2 +- .../data/synthesized_properties.qml | 2 +- .../qdeclarativemetaproperty/data/object.qml | 2 +- .../data/synthesized_object.qml | 2 +- tests/benchmarks/declarative/qmltime/example.qml | 2 +- .../declarative/qmltime/tests/anchors/empty.qml | 2 +- .../declarative/qmltime/tests/anchors/fill.qml | 2 +- .../declarative/qmltime/tests/anchors/null.qml | 2 +- .../declarative/qmltime/tests/animation/large.qml | 2 +- .../qmltime/tests/animation/largeNoProps.qml | 2 +- .../qmltime/tests/item_creation/children.qml | 2 +- .../qmltime/tests/item_creation/data.qml | 2 +- .../qmltime/tests/item_creation/no_creation.qml | 2 +- .../qmltime/tests/item_creation/resources.qml | 2 +- .../declarative/qmltime/tests/loader/Loaded.qml | 2 +- .../qmltime/tests/loader/component_loader.qml | 2 +- .../qmltime/tests/loader/empty_loader.qml | 2 +- .../declarative/qmltime/tests/loader/no_loader.qml | 2 +- .../qmltime/tests/loader/source_loader.qml | 2 +- .../tests/positioner_creation/no_positioner.qml | 2 +- .../tests/positioner_creation/null_positioner.qml | 2 +- .../tests/positioner_creation/positioner.qml | 2 +- .../qmltime/tests/vmemetaobject/null.qml | 2 +- .../qmltime/tests/vmemetaobject/property.qml | 2 +- .../declarative/script/data/CustomObject.qml | 2 +- tests/benchmarks/declarative/script/data/block.qml | 2 +- .../declarative/script/data/global_prop.qml | 2 +- tools/qml/browser/Browser.qml | 2 +- tools/qml/startup/Logo.qml | 2 +- tools/qml/startup/startup.qml | 2 +- 1095 files changed, 1417 insertions(+), 1417 deletions(-) diff --git a/demos/declarative/calculator/Core/Button.qml b/demos/declarative/calculator/Core/Button.qml index 7b19feb..f37de48 100644 --- a/demos/declarative/calculator/Core/Button.qml +++ b/demos/declarative/calculator/Core/Button.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 BorderImage { id: button diff --git a/demos/declarative/calculator/Core/Display.qml b/demos/declarative/calculator/Core/Display.qml index 53f74c9..f928d3a 100644 --- a/demos/declarative/calculator/Core/Display.qml +++ b/demos/declarative/calculator/Core/Display.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 BorderImage { id: image diff --git a/demos/declarative/calculator/calculator.qml b/demos/declarative/calculator/calculator.qml index 68c922b..3e1c650 100644 --- a/demos/declarative/calculator/calculator.qml +++ b/demos/declarative/calculator/calculator.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "Core" import "Core/calculator.js" as CalcEngine diff --git a/demos/declarative/flickr/common/Progress.qml b/demos/declarative/flickr/common/Progress.qml index 23bffb9..b928554 100644 --- a/demos/declarative/flickr/common/Progress.qml +++ b/demos/declarative/flickr/common/Progress.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { property variant progress: 0 diff --git a/demos/declarative/flickr/common/RssModel.qml b/demos/declarative/flickr/common/RssModel.qml index b4ea3ce..0c1c834 100644 --- a/demos/declarative/flickr/common/RssModel.qml +++ b/demos/declarative/flickr/common/RssModel.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 XmlListModel { property string tags : "" diff --git a/demos/declarative/flickr/common/ScrollBar.qml b/demos/declarative/flickr/common/ScrollBar.qml index 1574915..dfe3cbf 100644 --- a/demos/declarative/flickr/common/ScrollBar.qml +++ b/demos/declarative/flickr/common/ScrollBar.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: container diff --git a/demos/declarative/flickr/common/Slider.qml b/demos/declarative/flickr/common/Slider.qml index faa2e5f..edccc7d 100644 --- a/demos/declarative/flickr/common/Slider.qml +++ b/demos/declarative/flickr/common/Slider.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: slider; width: 400; height: 16 diff --git a/demos/declarative/flickr/flickr-90.qml b/demos/declarative/flickr/flickr-90.qml index 3db44de..31b1d91 100644 --- a/demos/declarative/flickr/flickr-90.qml +++ b/demos/declarative/flickr/flickr-90.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { width: 480; height: 320 diff --git a/demos/declarative/flickr/flickr.qml b/demos/declarative/flickr/flickr.qml index 152f9f9..1533c04 100644 --- a/demos/declarative/flickr/flickr.qml +++ b/demos/declarative/flickr/flickr.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "common" as Common import "mobile" as Mobile diff --git a/demos/declarative/flickr/mobile/Button.qml b/demos/declarative/flickr/mobile/Button.qml index 6228606..74a7dbb 100644 --- a/demos/declarative/flickr/mobile/Button.qml +++ b/demos/declarative/flickr/mobile/Button.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: container diff --git a/demos/declarative/flickr/mobile/GridDelegate.qml b/demos/declarative/flickr/mobile/GridDelegate.qml index c368e95..8f01292 100644 --- a/demos/declarative/flickr/mobile/GridDelegate.qml +++ b/demos/declarative/flickr/mobile/GridDelegate.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: wrapper; width: GridView.view.cellWidth; height: GridView.view.cellHeight diff --git a/demos/declarative/flickr/mobile/ImageDetails.qml b/demos/declarative/flickr/mobile/ImageDetails.qml index 6408fc6..5dd3b4e 100644 --- a/demos/declarative/flickr/mobile/ImageDetails.qml +++ b/demos/declarative/flickr/mobile/ImageDetails.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "../common" as Common Flipable { diff --git a/demos/declarative/flickr/mobile/ListDelegate.qml b/demos/declarative/flickr/mobile/ListDelegate.qml index 9ec02e1..0773547 100644 --- a/demos/declarative/flickr/mobile/ListDelegate.qml +++ b/demos/declarative/flickr/mobile/ListDelegate.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Component { Item { diff --git a/demos/declarative/flickr/mobile/TitleBar.qml b/demos/declarative/flickr/mobile/TitleBar.qml index 60ca4dc..f283307 100644 --- a/demos/declarative/flickr/mobile/TitleBar.qml +++ b/demos/declarative/flickr/mobile/TitleBar.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: titleBar diff --git a/demos/declarative/flickr/mobile/ToolBar.qml b/demos/declarative/flickr/mobile/ToolBar.qml index b9cb915..55f19d2 100644 --- a/demos/declarative/flickr/mobile/ToolBar.qml +++ b/demos/declarative/flickr/mobile/ToolBar.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: toolbar diff --git a/demos/declarative/minehunt/MinehuntCore/Explosion.qml b/demos/declarative/minehunt/MinehuntCore/Explosion.qml index b2644ff..f04d033 100644 --- a/demos/declarative/minehunt/MinehuntCore/Explosion.qml +++ b/demos/declarative/minehunt/MinehuntCore/Explosion.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.particles 1.0 Item { diff --git a/demos/declarative/minehunt/MinehuntCore/Tile.qml b/demos/declarative/minehunt/MinehuntCore/Tile.qml index 64dd63c..1853ed9 100644 --- a/demos/declarative/minehunt/MinehuntCore/Tile.qml +++ b/demos/declarative/minehunt/MinehuntCore/Tile.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Flipable { id: flipable diff --git a/demos/declarative/minehunt/minehunt.qml b/demos/declarative/minehunt/minehunt.qml index 4accb52..eb67b06 100644 --- a/demos/declarative/minehunt/minehunt.qml +++ b/demos/declarative/minehunt/minehunt.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "MinehuntCore" 1.0 Item { diff --git a/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml b/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml index 0df8155..9001033 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Component { id: albumDelegate diff --git a/demos/declarative/photoviewer/PhotoViewerCore/BusyIndicator.qml b/demos/declarative/photoviewer/PhotoViewerCore/BusyIndicator.qml index e55bf17..7b28930 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/BusyIndicator.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/BusyIndicator.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Image { id: container diff --git a/demos/declarative/photoviewer/PhotoViewerCore/Button.qml b/demos/declarative/photoviewer/PhotoViewerCore/Button.qml index 47b90c8..29f2bb7 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/Button.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/Button.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: container diff --git a/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml b/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml index decc0fe..06f8062 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: container diff --git a/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml b/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml index dadb409..5948b5d 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "script/script.js" as Script Package { diff --git a/demos/declarative/photoviewer/PhotoViewerCore/ProgressBar.qml b/demos/declarative/photoviewer/PhotoViewerCore/ProgressBar.qml index 779d342..a0756ae 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/ProgressBar.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/ProgressBar.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: container diff --git a/demos/declarative/photoviewer/PhotoViewerCore/RssModel.qml b/demos/declarative/photoviewer/PhotoViewerCore/RssModel.qml index 29bad52..15bb67f 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/RssModel.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/RssModel.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 XmlListModel { property string tags : "" diff --git a/demos/declarative/photoviewer/PhotoViewerCore/Tag.qml b/demos/declarative/photoviewer/PhotoViewerCore/Tag.qml index 5e93046..9358975 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/Tag.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/Tag.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Flipable { id: flipable diff --git a/demos/declarative/photoviewer/photoviewer.qml b/demos/declarative/photoviewer/photoviewer.qml index 3072ea2..0f59c64 100644 --- a/demos/declarative/photoviewer/photoviewer.qml +++ b/demos/declarative/photoviewer/photoviewer.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "PhotoViewerCore" Rectangle { diff --git a/demos/declarative/rssnews/content/BusyIndicator.qml b/demos/declarative/rssnews/content/BusyIndicator.qml index 13f54f2..e305cbe 100644 --- a/demos/declarative/rssnews/content/BusyIndicator.qml +++ b/demos/declarative/rssnews/content/BusyIndicator.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Image { id: container diff --git a/demos/declarative/rssnews/content/CategoryDelegate.qml b/demos/declarative/rssnews/content/CategoryDelegate.qml index edfb4bb..c4fa8cc 100644 --- a/demos/declarative/rssnews/content/CategoryDelegate.qml +++ b/demos/declarative/rssnews/content/CategoryDelegate.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: delegate diff --git a/demos/declarative/rssnews/content/NewsDelegate.qml b/demos/declarative/rssnews/content/NewsDelegate.qml index cfe9b00..cf88f4e 100644 --- a/demos/declarative/rssnews/content/NewsDelegate.qml +++ b/demos/declarative/rssnews/content/NewsDelegate.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: delegate diff --git a/demos/declarative/rssnews/content/RssFeeds.qml b/demos/declarative/rssnews/content/RssFeeds.qml index 62e7f14..37c4b69 100644 --- a/demos/declarative/rssnews/content/RssFeeds.qml +++ b/demos/declarative/rssnews/content/RssFeeds.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 ListModel { id: rssFeeds diff --git a/demos/declarative/rssnews/content/ScrollBar.qml b/demos/declarative/rssnews/content/ScrollBar.qml index e0214d2..f20f0aa 100644 --- a/demos/declarative/rssnews/content/ScrollBar.qml +++ b/demos/declarative/rssnews/content/ScrollBar.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: container diff --git a/demos/declarative/rssnews/rssnews.qml b/demos/declarative/rssnews/rssnews.qml index fb5b5a3..f6fe188 100644 --- a/demos/declarative/rssnews/rssnews.qml +++ b/demos/declarative/rssnews/rssnews.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "content" Rectangle { diff --git a/demos/declarative/samegame/SamegameCore/BoomBlock.qml b/demos/declarative/samegame/SamegameCore/BoomBlock.qml index 43050af..afda29c 100644 --- a/demos/declarative/samegame/SamegameCore/BoomBlock.qml +++ b/demos/declarative/samegame/SamegameCore/BoomBlock.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.particles 1.0 Item { diff --git a/demos/declarative/samegame/SamegameCore/Button.qml b/demos/declarative/samegame/SamegameCore/Button.qml index d5979b2..7fb7b65 100644 --- a/demos/declarative/samegame/SamegameCore/Button.qml +++ b/demos/declarative/samegame/SamegameCore/Button.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: container diff --git a/demos/declarative/samegame/SamegameCore/Dialog.qml b/demos/declarative/samegame/SamegameCore/Dialog.qml index 7e64bd6..e1f3900 100644 --- a/demos/declarative/samegame/SamegameCore/Dialog.qml +++ b/demos/declarative/samegame/SamegameCore/Dialog.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: page diff --git a/demos/declarative/samegame/samegame.qml b/demos/declarative/samegame/samegame.qml index 3e9c505..f66c40e 100644 --- a/demos/declarative/samegame/samegame.qml +++ b/demos/declarative/samegame/samegame.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "SamegameCore" import "SamegameCore/samegame.js" as Logic diff --git a/demos/declarative/snake/content/Button.qml b/demos/declarative/snake/content/Button.qml index 5d9eebe..cf4519d 100644 --- a/demos/declarative/snake/content/Button.qml +++ b/demos/declarative/snake/content/Button.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: container diff --git a/demos/declarative/snake/content/Cookie.qml b/demos/declarative/snake/content/Cookie.qml index eb57fd2..b4af9fe 100644 --- a/demos/declarative/snake/content/Cookie.qml +++ b/demos/declarative/snake/content/Cookie.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.particles 1.0 Item { diff --git a/demos/declarative/snake/content/HighScoreModel.qml b/demos/declarative/snake/content/HighScoreModel.qml index 42482f8..e3a4704 100644 --- a/demos/declarative/snake/content/HighScoreModel.qml +++ b/demos/declarative/snake/content/HighScoreModel.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 // Models a high score table. // diff --git a/demos/declarative/snake/content/Link.qml b/demos/declarative/snake/content/Link.qml index 942008d..16b6e1e 100644 --- a/demos/declarative/snake/content/Link.qml +++ b/demos/declarative/snake/content/Link.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.particles 1.0 Item { id:link diff --git a/demos/declarative/snake/content/Skull.qml b/demos/declarative/snake/content/Skull.qml index 0cc6186..1a3ff7e 100644 --- a/demos/declarative/snake/content/Skull.qml +++ b/demos/declarative/snake/content/Skull.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Image { property bool spawned: false diff --git a/demos/declarative/snake/snake.qml b/demos/declarative/snake/snake.qml index 4d989df..5b69217 100644 --- a/demos/declarative/snake/snake.qml +++ b/demos/declarative/snake/snake.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "content" as Content import "content/snake.js" as Logic diff --git a/demos/declarative/twitter/TwitterCore/Button.qml b/demos/declarative/twitter/TwitterCore/Button.qml index 437b013..a1fc2a2 100644 --- a/demos/declarative/twitter/TwitterCore/Button.qml +++ b/demos/declarative/twitter/TwitterCore/Button.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: container diff --git a/demos/declarative/twitter/TwitterCore/FatDelegate.qml b/demos/declarative/twitter/TwitterCore/FatDelegate.qml index 27dd300..896abbe 100644 --- a/demos/declarative/twitter/TwitterCore/FatDelegate.qml +++ b/demos/declarative/twitter/TwitterCore/FatDelegate.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Component { id: listDelegate diff --git a/demos/declarative/twitter/TwitterCore/Input.qml b/demos/declarative/twitter/TwitterCore/Input.qml index a33a995..b15f0d5 100644 --- a/demos/declarative/twitter/TwitterCore/Input.qml +++ b/demos/declarative/twitter/TwitterCore/Input.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 FocusScope { id:container diff --git a/demos/declarative/twitter/TwitterCore/Loading.qml b/demos/declarative/twitter/TwitterCore/Loading.qml index b979291..afeafa0 100644 --- a/demos/declarative/twitter/TwitterCore/Loading.qml +++ b/demos/declarative/twitter/TwitterCore/Loading.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Image { id: loading; source: "images/loading.png" diff --git a/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml b/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml index 29b7713..bc8e0de 100644 --- a/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml +++ b/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { TitleBar { id: titleBar; width: parent.width; height: 60; diff --git a/demos/declarative/twitter/TwitterCore/RssModel.qml b/demos/declarative/twitter/TwitterCore/RssModel.qml index d03cdb3..276df62 100644 --- a/demos/declarative/twitter/TwitterCore/RssModel.qml +++ b/demos/declarative/twitter/TwitterCore/RssModel.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: wrapper property variant model: xmlModel diff --git a/demos/declarative/twitter/TwitterCore/SearchView.qml b/demos/declarative/twitter/TwitterCore/SearchView.qml index 22df374..effab30 100644 --- a/demos/declarative/twitter/TwitterCore/SearchView.qml +++ b/demos/declarative/twitter/TwitterCore/SearchView.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 FocusScope { id: wrapper diff --git a/demos/declarative/twitter/TwitterCore/TitleBar.qml b/demos/declarative/twitter/TwitterCore/TitleBar.qml index 70de81d..19da491 100644 --- a/demos/declarative/twitter/TwitterCore/TitleBar.qml +++ b/demos/declarative/twitter/TwitterCore/TitleBar.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: titleBar diff --git a/demos/declarative/twitter/TwitterCore/ToolBar.qml b/demos/declarative/twitter/TwitterCore/ToolBar.qml index e18f5c6..4ef92ff 100644 --- a/demos/declarative/twitter/TwitterCore/ToolBar.qml +++ b/demos/declarative/twitter/TwitterCore/ToolBar.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: toolbar diff --git a/demos/declarative/twitter/TwitterCore/UserModel.qml b/demos/declarative/twitter/TwitterCore/UserModel.qml index d8ca804..013b827 100644 --- a/demos/declarative/twitter/TwitterCore/UserModel.qml +++ b/demos/declarative/twitter/TwitterCore/UserModel.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 //This "model" gets the user information about the searched user. Mainly for the icon. diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml index 6d224a2..4495523 100644 --- a/demos/declarative/twitter/twitter.qml +++ b/demos/declarative/twitter/twitter.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "TwitterCore" 1.0 as Twitter Item { diff --git a/demos/declarative/webbrowser/content/Button.qml b/demos/declarative/webbrowser/content/Button.qml index 2a2e7ef..2da1c11 100644 --- a/demos/declarative/webbrowser/content/Button.qml +++ b/demos/declarative/webbrowser/content/Button.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { property alias image: icon.source diff --git a/demos/declarative/webbrowser/content/FlickableWebView.qml b/demos/declarative/webbrowser/content/FlickableWebView.qml index fb479d2..6f4e09c 100644 --- a/demos/declarative/webbrowser/content/FlickableWebView.qml +++ b/demos/declarative/webbrowser/content/FlickableWebView.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import QtWebKit 1.0 Flickable { diff --git a/demos/declarative/webbrowser/content/Header.qml b/demos/declarative/webbrowser/content/Header.qml index d3ccae3..88e3000 100644 --- a/demos/declarative/webbrowser/content/Header.qml +++ b/demos/declarative/webbrowser/content/Header.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Image { id: header diff --git a/demos/declarative/webbrowser/content/ScrollBar.qml b/demos/declarative/webbrowser/content/ScrollBar.qml index d3f272c..19309fa 100644 --- a/demos/declarative/webbrowser/content/ScrollBar.qml +++ b/demos/declarative/webbrowser/content/ScrollBar.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: container diff --git a/demos/declarative/webbrowser/content/UrlInput.qml b/demos/declarative/webbrowser/content/UrlInput.qml index 4f49821..0468b64 100644 --- a/demos/declarative/webbrowser/content/UrlInput.qml +++ b/demos/declarative/webbrowser/content/UrlInput.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: container diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml index 3bff0fe..a21fa0b 100644 --- a/demos/declarative/webbrowser/webbrowser.qml +++ b/demos/declarative/webbrowser/webbrowser.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import QtWebKit 1.0 import "content" diff --git a/demos/qtdemo/qmlShell.qml b/demos/qtdemo/qmlShell.qml index 24c12ae..2764865 100644 --- a/demos/qtdemo/qmlShell.qml +++ b/demos/qtdemo/qmlShell.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: main diff --git a/doc/src/declarative/modules.qdoc b/doc/src/declarative/modules.qdoc index 467b7d0..044c1e7 100644 --- a/doc/src/declarative/modules.qdoc +++ b/doc/src/declarative/modules.qdoc @@ -52,7 +52,7 @@ An \c import statement includes the module name, and possibly a version number. This can be seen in the snippet commonly found at the top of QML files: \qml - import Qt 4.7 + import QtQuick 1.0 \endqml This imports version 4.7 of the "Qt" module into the global namespace. (The QML @@ -126,7 +126,7 @@ application code. When importing an installed module, an un-quoted URI is used, with a mandatory version number: \code - import Qt 4.7 + import QtQuick 1.0 import com.nokia.qml.mymodule 1.0 \endcode @@ -181,7 +181,7 @@ By default, when a module is imported, its contents are imported into the global To import a module into a specific namespace, use the \e as keyword: \qml - import Qt 4.7 as QtLibrary + import QtQuick 1.0 as QtLibrary import "../MyComponents" as MyComponents import com.nokia.qml.mymodule 1.0 as MyModule \endqml @@ -199,7 +199,7 @@ Types from these modules can then only be used when qualified by the namespace: Multiple modules can be imported into the same namespace in the same way that multiple modules can be imported into the global namespace: \qml - import Qt 4.7 as Nokia + import QtQuick 1.0 as Nokia import Ovi 1.0 as Nokia \endqml diff --git a/doc/src/declarative/qdeclarativedebugging.qdoc b/doc/src/declarative/qdeclarativedebugging.qdoc index 64c312c..26d3b38 100644 --- a/doc/src/declarative/qdeclarativedebugging.qdoc +++ b/doc/src/declarative/qdeclarativedebugging.qdoc @@ -59,7 +59,7 @@ from QML's import loading mechanisms. For example, for a simple QML file like this: \qml -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 100; height: 100 } \endqml diff --git a/doc/src/declarative/qdeclarativedocument.qdoc b/doc/src/declarative/qdeclarativedocument.qdoc index 8ca6c11..b6af90b 100644 --- a/doc/src/declarative/qdeclarativedocument.qdoc +++ b/doc/src/declarative/qdeclarativedocument.qdoc @@ -82,7 +82,7 @@ Each instance is created with a different value for its \c text property: \o \snippet doc/src/snippets/declarative/qml-documents/qmldocuments.qml document \o \qml -import Qt 4.7 +import QtQuick 1.0 Column { spacing: 10 diff --git a/doc/src/declarative/qdeclarativei18n.qdoc b/doc/src/declarative/qdeclarativei18n.qdoc index 70a3587..620b902 100644 --- a/doc/src/declarative/qdeclarativei18n.qdoc +++ b/doc/src/declarative/qdeclarativei18n.qdoc @@ -58,7 +58,7 @@ that needs to be translated is enclosed in a call to \c qsTr(). hello.qml: \qml -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 200; height: 200 diff --git a/doc/src/declarative/qdeclarativeintro.qdoc b/doc/src/declarative/qdeclarativeintro.qdoc index fa42f59..9d89edf 100644 --- a/doc/src/declarative/qdeclarativeintro.qdoc +++ b/doc/src/declarative/qdeclarativeintro.qdoc @@ -46,7 +46,7 @@ technologies like HTML and CSS, but it's not required. QML looks like this: \code -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 200 diff --git a/doc/src/declarative/qmlruntime.qdoc b/doc/src/declarative/qmlruntime.qdoc index 9a84237..51f9e4d 100644 --- a/doc/src/declarative/qmlruntime.qdoc +++ b/doc/src/declarative/qmlruntime.qdoc @@ -60,7 +60,7 @@ QDeclarativeView is a QWidget-based class that is able to load QML files. For example, if there is a QML file, \c application.qml, like this: \qml - import Qt 4.7 + import QtQuick 1.0 Rectangle { width: 100; height: 100; color: "red" } \endqml diff --git a/doc/src/declarative/qmlviewer.qdoc b/doc/src/declarative/qmlviewer.qdoc index 41c4c80..81ad218 100644 --- a/doc/src/declarative/qmlviewer.qdoc +++ b/doc/src/declarative/qmlviewer.qdoc @@ -118,7 +118,7 @@ For example, this QML document refers to a \c lottoNumbers property which does not actually exist within the document: \qml -import Qt 4.7 +import QtQuick 1.0 ListView { width: 200; height: 300 @@ -131,7 +131,7 @@ If within the document's directory, there is a "dummydata" directory which contains a \c lottoNumbers.qml file like this: \qml -import Qt 4.7 +import QtQuick 1.0 ListModel { ListElement { number: 23 } @@ -146,7 +146,7 @@ Child properties are included when loaded from dummy data. The following documen refers to a \c clock.time property: \qml -import Qt 4.7 +import QtQuick 1.0 Text { text: clock.time } \endqml @@ -154,7 +154,7 @@ The text value could be filled by a \c dummydata/clock.qml file with a \c time property in the root context: \qml -import Qt 4.7 +import QtQuick 1.0 QtObject { property int time: 54321 } \endqml diff --git a/doc/src/declarative/qtbinding.qdoc b/doc/src/declarative/qtbinding.qdoc index 6eade18..35a05d2 100644 --- a/doc/src/declarative/qtbinding.qdoc +++ b/doc/src/declarative/qtbinding.qdoc @@ -188,7 +188,7 @@ is to have a "running" property in \c main.qml. This leads to much nicer QML co \o \code // main.qml -import Qt 4.7 +import QtQuick 1.0 Rectangle { MouseArea { diff --git a/doc/src/declarative/scope.qdoc b/doc/src/declarative/scope.qdoc index 363ba8d..5501242 100644 --- a/doc/src/declarative/scope.qdoc +++ b/doc/src/declarative/scope.qdoc @@ -112,7 +112,7 @@ following example shows a simple QML file that accesses some enumeration values and calls an imported JavaScript function. \code -import Qt 4.7 +import QtQuick 1.0 import "code.js" as Code ListView { @@ -253,7 +253,7 @@ is used, the \c title property may resolve differently. \code // TitlePage.qml -import Qt 4.7 +import QtQuick 1.0 Item { property string title @@ -269,7 +269,7 @@ Item { } // TitleText.qml -import Qt 4.7 +import QtQuick 1.0 Text { property int size text: "" + title + "" @@ -285,7 +285,7 @@ to use property interfaces, like this: \code // TitlePage.qml -import Qt 4.7 +import QtQuick 1.0 Item { id: root property string title @@ -304,7 +304,7 @@ Item { } // TitleText.qml -import Qt 4.7 +import QtQuick 1.0 Text { property string title property int size diff --git a/doc/src/getting-started/gettingstartedqml.qdoc b/doc/src/getting-started/gettingstartedqml.qdoc index a5e45d9..e2d6e72 100644 --- a/doc/src/getting-started/gettingstartedqml.qdoc +++ b/doc/src/getting-started/gettingstartedqml.qdoc @@ -73,7 +73,7 @@ \snippet examples/tutorials/gettingStarted/gsQml/part0/Button.qml document - First, the \c { import Qt 4.7 } allows the qmlviewer tool to import the QML elements + First, the \c { import QtQuick 1.0 } allows the qmlviewer tool to import the QML elements we will later use. This line must exist for every QML file. Notice that the version of Qt modules is included in the import statement. @@ -209,7 +209,7 @@ \c FileMenu.qml. \code - import Qt 4.7 \\import the main Qt QML module + import QtQuick 1.0 \\import the main Qt QML module import "folderName" \\import the contents of the folder import "script.js" as Script \\import a Javascript file and name it as Script \endcode diff --git a/doc/src/snippets/declarative/SelfDestroyingRect.qml b/doc/src/snippets/declarative/SelfDestroyingRect.qml index 413c04e..f89588b 100644 --- a/doc/src/snippets/declarative/SelfDestroyingRect.qml +++ b/doc/src/snippets/declarative/SelfDestroyingRect.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: rect diff --git a/doc/src/snippets/declarative/Sprite.qml b/doc/src/snippets/declarative/Sprite.qml index 3928c4d..3bcd599 100644 --- a/doc/src/snippets/declarative/Sprite.qml +++ b/doc/src/snippets/declarative/Sprite.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 80; height: 50; color: "red" } //![0] diff --git a/doc/src/snippets/declarative/anchoranimation.qml b/doc/src/snippets/declarative/anchoranimation.qml index f149326..d8235f6 100644 --- a/doc/src/snippets/declarative/anchoranimation.qml +++ b/doc/src/snippets/declarative/anchoranimation.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Item { id: container diff --git a/doc/src/snippets/declarative/anchorchanges.qml b/doc/src/snippets/declarative/anchorchanges.qml index 19356d7..66c31c5 100644 --- a/doc/src/snippets/declarative/anchorchanges.qml +++ b/doc/src/snippets/declarative/anchorchanges.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: window diff --git a/doc/src/snippets/declarative/animatedimage.qml b/doc/src/snippets/declarative/animatedimage.qml index 66abbae..a9b58c5 100644 --- a/doc/src/snippets/declarative/animatedimage.qml +++ b/doc/src/snippets/declarative/animatedimage.qml @@ -42,7 +42,7 @@ // examples/declarative/imageelements/animatedimage //! [document] -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: animation.width; height: animation.height + 8 diff --git a/doc/src/snippets/declarative/animation-behavioral.qml b/doc/src/snippets/declarative/animation-behavioral.qml index a4fa648..0462e9a 100644 --- a/doc/src/snippets/declarative/animation-behavioral.qml +++ b/doc/src/snippets/declarative/animation-behavioral.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Item { width: 100; height: 100 diff --git a/doc/src/snippets/declarative/animation-easing.qml b/doc/src/snippets/declarative/animation-easing.qml index 97f6e60..3438737 100644 --- a/doc/src/snippets/declarative/animation-easing.qml +++ b/doc/src/snippets/declarative/animation-easing.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 100; height: 100 diff --git a/doc/src/snippets/declarative/animation-elements.qml b/doc/src/snippets/declarative/animation-elements.qml index a65bd67..7843b75 100644 --- a/doc/src/snippets/declarative/animation-elements.qml +++ b/doc/src/snippets/declarative/animation-elements.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Row { diff --git a/doc/src/snippets/declarative/animation-groups.qml b/doc/src/snippets/declarative/animation-groups.qml index ba546c9..57cc8c2 100644 --- a/doc/src/snippets/declarative/animation-groups.qml +++ b/doc/src/snippets/declarative/animation-groups.qml @@ -37,7 +37,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Row { diff --git a/doc/src/snippets/declarative/animation-propertyvaluesource.qml b/doc/src/snippets/declarative/animation-propertyvaluesource.qml index 366505c..ba56afd 100644 --- a/doc/src/snippets/declarative/animation-propertyvaluesource.qml +++ b/doc/src/snippets/declarative/animation-propertyvaluesource.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 100; height: 100 diff --git a/doc/src/snippets/declarative/animation-signalhandler.qml b/doc/src/snippets/declarative/animation-signalhandler.qml index 492c007..16f27c6 100644 --- a/doc/src/snippets/declarative/animation-signalhandler.qml +++ b/doc/src/snippets/declarative/animation-signalhandler.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: rect diff --git a/doc/src/snippets/declarative/animation-standalone.qml b/doc/src/snippets/declarative/animation-standalone.qml index c847d02..1ff4073 100644 --- a/doc/src/snippets/declarative/animation-standalone.qml +++ b/doc/src/snippets/declarative/animation-standalone.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: rect diff --git a/doc/src/snippets/declarative/animation-transitions.qml b/doc/src/snippets/declarative/animation-transitions.qml index 5b0bb84..025fc90 100644 --- a/doc/src/snippets/declarative/animation-transitions.qml +++ b/doc/src/snippets/declarative/animation-transitions.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: rect diff --git a/doc/src/snippets/declarative/behavior.qml b/doc/src/snippets/declarative/behavior.qml index 7f66e5a..7e2d1e7 100644 --- a/doc/src/snippets/declarative/behavior.qml +++ b/doc/src/snippets/declarative/behavior.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: rect diff --git a/doc/src/snippets/declarative/borderimage/borderimage-scaled.qml b/doc/src/snippets/declarative/borderimage/borderimage-scaled.qml index 0ed9943..ba30491 100644 --- a/doc/src/snippets/declarative/borderimage/borderimage-scaled.qml +++ b/doc/src/snippets/declarative/borderimage/borderimage-scaled.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: page diff --git a/doc/src/snippets/declarative/borderimage/borderimage-tiled.qml b/doc/src/snippets/declarative/borderimage/borderimage-tiled.qml index 680709d..98a4175 100644 --- a/doc/src/snippets/declarative/borderimage/borderimage-tiled.qml +++ b/doc/src/snippets/declarative/borderimage/borderimage-tiled.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: page diff --git a/doc/src/snippets/declarative/borderimage/normal-image.qml b/doc/src/snippets/declarative/borderimage/normal-image.qml index 85a7f52..f8e3c60 100644 --- a/doc/src/snippets/declarative/borderimage/normal-image.qml +++ b/doc/src/snippets/declarative/borderimage/normal-image.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: page diff --git a/doc/src/snippets/declarative/codingconventions/dotproperties.qml b/doc/src/snippets/declarative/codingconventions/dotproperties.qml index 8a173cd..98cb09c 100644 --- a/doc/src/snippets/declarative/codingconventions/dotproperties.qml +++ b/doc/src/snippets/declarative/codingconventions/dotproperties.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { diff --git a/doc/src/snippets/declarative/codingconventions/javascript-imports.qml b/doc/src/snippets/declarative/codingconventions/javascript-imports.qml index 391bf27..931349f 100644 --- a/doc/src/snippets/declarative/codingconventions/javascript-imports.qml +++ b/doc/src/snippets/declarative/codingconventions/javascript-imports.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 //![0] import "myscript.js" as Script diff --git a/doc/src/snippets/declarative/codingconventions/javascript.qml b/doc/src/snippets/declarative/codingconventions/javascript.qml index 90790b9..6c94626 100644 --- a/doc/src/snippets/declarative/codingconventions/javascript.qml +++ b/doc/src/snippets/declarative/codingconventions/javascript.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { diff --git a/doc/src/snippets/declarative/codingconventions/lists.qml b/doc/src/snippets/declarative/codingconventions/lists.qml index 8d2bdbc..a7f3c8f 100644 --- a/doc/src/snippets/declarative/codingconventions/lists.qml +++ b/doc/src/snippets/declarative/codingconventions/lists.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { Item { diff --git a/doc/src/snippets/declarative/codingconventions/photo.qml b/doc/src/snippets/declarative/codingconventions/photo.qml index 359a756..2eba035 100644 --- a/doc/src/snippets/declarative/codingconventions/photo.qml +++ b/doc/src/snippets/declarative/codingconventions/photo.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 //! [0] Rectangle { diff --git a/doc/src/snippets/declarative/coloranimation.qml b/doc/src/snippets/declarative/coloranimation.qml index d904721..452599e 100644 --- a/doc/src/snippets/declarative/coloranimation.qml +++ b/doc/src/snippets/declarative/coloranimation.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 100; height: 100 diff --git a/doc/src/snippets/declarative/column/column.qml b/doc/src/snippets/declarative/column/column.qml index 6d378bb..45c6822 100644 --- a/doc/src/snippets/declarative/column/column.qml +++ b/doc/src/snippets/declarative/column/column.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Item { width: 310; height: 170 diff --git a/doc/src/snippets/declarative/column/vertical-positioner-transition.qml b/doc/src/snippets/declarative/column/vertical-positioner-transition.qml index 7785776..cd2fdcc 100644 --- a/doc/src/snippets/declarative/column/vertical-positioner-transition.qml +++ b/doc/src/snippets/declarative/column/vertical-positioner-transition.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 //! [document] Column { diff --git a/doc/src/snippets/declarative/column/vertical-positioner.qml b/doc/src/snippets/declarative/column/vertical-positioner.qml index 86ecc55..693734b 100644 --- a/doc/src/snippets/declarative/column/vertical-positioner.qml +++ b/doc/src/snippets/declarative/column/vertical-positioner.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 //! [document] Column { diff --git a/doc/src/snippets/declarative/comments.qml b/doc/src/snippets/declarative/comments.qml index aa034c6..a8e47ad 100644 --- a/doc/src/snippets/declarative/comments.qml +++ b/doc/src/snippets/declarative/comments.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 //![0] Text { diff --git a/doc/src/snippets/declarative/component.qml b/doc/src/snippets/declarative/component.qml index 84c063f..ed55803 100644 --- a/doc/src/snippets/declarative/component.qml +++ b/doc/src/snippets/declarative/component.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Item { width: 100; height: 100 diff --git a/doc/src/snippets/declarative/createComponent-simple.qml b/doc/src/snippets/declarative/createComponent-simple.qml index f4c240d..f052529 100644 --- a/doc/src/snippets/declarative/createComponent-simple.qml +++ b/doc/src/snippets/declarative/createComponent-simple.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Item { id: container diff --git a/doc/src/snippets/declarative/createComponent.qml b/doc/src/snippets/declarative/createComponent.qml index f1a7436..619c02d 100644 --- a/doc/src/snippets/declarative/createComponent.qml +++ b/doc/src/snippets/declarative/createComponent.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 import "componentCreation.js" as MyScript Rectangle { diff --git a/doc/src/snippets/declarative/createQmlObject.qml b/doc/src/snippets/declarative/createQmlObject.qml index 6a4eae8..cfcffe1 100644 --- a/doc/src/snippets/declarative/createQmlObject.qml +++ b/doc/src/snippets/declarative/createQmlObject.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: parentItem @@ -48,7 +48,7 @@ Rectangle { function createIt() { //![0] -var newObject = Qt.createQmlObject('import Qt 4.7; Rectangle {color: "red"; width: 20; height: 20}', +var newObject = Qt.createQmlObject('import QtQuick 1.0; Rectangle {color: "red"; width: 20; height: 20}', parentItem, "dynamicSnippet1"); //![0] diff --git a/doc/src/snippets/declarative/dynamicObjects-destroy.qml b/doc/src/snippets/declarative/dynamicObjects-destroy.qml index b4ae80c..665f631 100644 --- a/doc/src/snippets/declarative/dynamicObjects-destroy.qml +++ b/doc/src/snippets/declarative/dynamicObjects-destroy.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Item { id: container diff --git a/doc/src/snippets/declarative/flickable.qml b/doc/src/snippets/declarative/flickable.qml index a283e9a..80e7301 100644 --- a/doc/src/snippets/declarative/flickable.qml +++ b/doc/src/snippets/declarative/flickable.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Flickable { width: 200; height: 200 diff --git a/doc/src/snippets/declarative/flickableScrollbar.qml b/doc/src/snippets/declarative/flickableScrollbar.qml index fc06f63..18ea45a 100644 --- a/doc/src/snippets/declarative/flickableScrollbar.qml +++ b/doc/src/snippets/declarative/flickableScrollbar.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 //![0] Rectangle { diff --git a/doc/src/snippets/declarative/flipable/flipable.qml b/doc/src/snippets/declarative/flipable/flipable.qml index eaf367a..cd5da4b 100644 --- a/doc/src/snippets/declarative/flipable/flipable.qml +++ b/doc/src/snippets/declarative/flipable/flipable.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [0] -import Qt 4.7 +import QtQuick 1.0 Flipable { id: flipable diff --git a/doc/src/snippets/declarative/flow-diagram.qml b/doc/src/snippets/declarative/flow-diagram.qml index f34e3fd..c970164 100644 --- a/doc/src/snippets/declarative/flow-diagram.qml +++ b/doc/src/snippets/declarative/flow-diagram.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "lightblue" diff --git a/doc/src/snippets/declarative/flow.qml b/doc/src/snippets/declarative/flow.qml index 809627e..167cbdb 100644 --- a/doc/src/snippets/declarative/flow.qml +++ b/doc/src/snippets/declarative/flow.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "lightblue" diff --git a/doc/src/snippets/declarative/focusscopes.qml b/doc/src/snippets/declarative/focusscopes.qml index da6a850..4713c0c 100644 --- a/doc/src/snippets/declarative/focusscopes.qml +++ b/doc/src/snippets/declarative/focusscopes.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 //![0] Rectangle { diff --git a/doc/src/snippets/declarative/folderlistmodel.qml b/doc/src/snippets/declarative/folderlistmodel.qml index a5e0071..d1cd34b 100644 --- a/doc/src/snippets/declarative/folderlistmodel.qml +++ b/doc/src/snippets/declarative/folderlistmodel.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.folderlistmodel 1.0 ListView { diff --git a/doc/src/snippets/declarative/gradient.qml b/doc/src/snippets/declarative/gradient.qml index 4c8bd40..47165a4 100644 --- a/doc/src/snippets/declarative/gradient.qml +++ b/doc/src/snippets/declarative/gradient.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 //![code] Rectangle { diff --git a/doc/src/snippets/declarative/grid/grid-items.qml b/doc/src/snippets/declarative/grid/grid-items.qml index 2382d38..62a444d 100644 --- a/doc/src/snippets/declarative/grid/grid-items.qml +++ b/doc/src/snippets/declarative/grid/grid-items.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 112; height: 112 diff --git a/doc/src/snippets/declarative/grid/grid-no-spacing.qml b/doc/src/snippets/declarative/grid/grid-no-spacing.qml index 6318165..a6ca305 100644 --- a/doc/src/snippets/declarative/grid/grid-no-spacing.qml +++ b/doc/src/snippets/declarative/grid/grid-no-spacing.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 112; height: 112 diff --git a/doc/src/snippets/declarative/grid/grid-spacing.qml b/doc/src/snippets/declarative/grid/grid-spacing.qml index fb3822c..c03cdad 100644 --- a/doc/src/snippets/declarative/grid/grid-spacing.qml +++ b/doc/src/snippets/declarative/grid/grid-spacing.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 112; height: 112 diff --git a/doc/src/snippets/declarative/grid/grid.qml b/doc/src/snippets/declarative/grid/grid.qml index 4599806..837ae60 100644 --- a/doc/src/snippets/declarative/grid/grid.qml +++ b/doc/src/snippets/declarative/grid/grid.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Grid { columns: 3 diff --git a/doc/src/snippets/declarative/gridview/ContactModel.qml b/doc/src/snippets/declarative/gridview/ContactModel.qml index 9fdeb4a..c3c3962 100644 --- a/doc/src/snippets/declarative/gridview/ContactModel.qml +++ b/doc/src/snippets/declarative/gridview/ContactModel.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 ListModel { diff --git a/doc/src/snippets/declarative/gridview/gridview.qml b/doc/src/snippets/declarative/gridview/gridview.qml index cbebb0a..73e58ec 100644 --- a/doc/src/snippets/declarative/gridview/gridview.qml +++ b/doc/src/snippets/declarative/gridview/gridview.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![import] -import Qt 4.7 +import QtQuick 1.0 //![import] Rectangle { diff --git a/doc/src/snippets/declarative/image.qml b/doc/src/snippets/declarative/image.qml index 228e83a..4c66ec1 100644 --- a/doc/src/snippets/declarative/image.qml +++ b/doc/src/snippets/declarative/image.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Image { source: "pics/qtlogo.png" diff --git a/doc/src/snippets/declarative/listmodel-modify.qml b/doc/src/snippets/declarative/listmodel-modify.qml index f08137f..d85da6c 100644 --- a/doc/src/snippets/declarative/listmodel-modify.qml +++ b/doc/src/snippets/declarative/listmodel-modify.qml @@ -37,7 +37,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 200; height: 200 diff --git a/doc/src/snippets/declarative/listmodel-nested.qml b/doc/src/snippets/declarative/listmodel-nested.qml index c38ee2d..36c5d66 100644 --- a/doc/src/snippets/declarative/listmodel-nested.qml +++ b/doc/src/snippets/declarative/listmodel-nested.qml @@ -37,7 +37,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 200; height: 200 diff --git a/doc/src/snippets/declarative/listmodel-simple.qml b/doc/src/snippets/declarative/listmodel-simple.qml index e561284..c8e83eb 100644 --- a/doc/src/snippets/declarative/listmodel-simple.qml +++ b/doc/src/snippets/declarative/listmodel-simple.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 200; height: 200 diff --git a/doc/src/snippets/declarative/listmodel.qml b/doc/src/snippets/declarative/listmodel.qml index 20f2074..f5b6cd6 100644 --- a/doc/src/snippets/declarative/listmodel.qml +++ b/doc/src/snippets/declarative/listmodel.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 ListModel { id: fruitModel diff --git a/doc/src/snippets/declarative/listview/ContactModel.qml b/doc/src/snippets/declarative/listview/ContactModel.qml index f48f84f..d421ffc 100644 --- a/doc/src/snippets/declarative/listview/ContactModel.qml +++ b/doc/src/snippets/declarative/listview/ContactModel.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 ListModel { ListElement { diff --git a/doc/src/snippets/declarative/listview/listview-snippet.qml b/doc/src/snippets/declarative/listview/listview-snippet.qml index d81bcbb..f2a260d 100644 --- a/doc/src/snippets/declarative/listview/listview-snippet.qml +++ b/doc/src/snippets/declarative/listview/listview-snippet.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 ListView { width: 50; height: 200 diff --git a/doc/src/snippets/declarative/listview/listview.qml b/doc/src/snippets/declarative/listview/listview.qml index 2945b2f..8ba47a8 100644 --- a/doc/src/snippets/declarative/listview/listview.qml +++ b/doc/src/snippets/declarative/listview/listview.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![import] -import Qt 4.7 +import QtQuick 1.0 //![import] Item { diff --git a/doc/src/snippets/declarative/loader/KeyReader.qml b/doc/src/snippets/declarative/loader/KeyReader.qml index 66a74fa..e53700c 100644 --- a/doc/src/snippets/declarative/loader/KeyReader.qml +++ b/doc/src/snippets/declarative/loader/KeyReader.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Item { Item { diff --git a/doc/src/snippets/declarative/loader/MyItem.qml b/doc/src/snippets/declarative/loader/MyItem.qml index 22c3fd3..199c64a 100644 --- a/doc/src/snippets/declarative/loader/MyItem.qml +++ b/doc/src/snippets/declarative/loader/MyItem.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myItem diff --git a/doc/src/snippets/declarative/loader/connections.qml b/doc/src/snippets/declarative/loader/connections.qml index a1cdce2..18f4259 100644 --- a/doc/src/snippets/declarative/loader/connections.qml +++ b/doc/src/snippets/declarative/loader/connections.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Item { width: 100; height: 100 diff --git a/doc/src/snippets/declarative/loader/focus.qml b/doc/src/snippets/declarative/loader/focus.qml index 4b4c940..4b3042a 100644 --- a/doc/src/snippets/declarative/loader/focus.qml +++ b/doc/src/snippets/declarative/loader/focus.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 200; height: 200 diff --git a/doc/src/snippets/declarative/loader/simple.qml b/doc/src/snippets/declarative/loader/simple.qml index bb06ffc..556ce60 100644 --- a/doc/src/snippets/declarative/loader/simple.qml +++ b/doc/src/snippets/declarative/loader/simple.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Item { width: 200; height: 200 diff --git a/doc/src/snippets/declarative/mousearea/mousearea-snippet.qml b/doc/src/snippets/declarative/mousearea/mousearea-snippet.qml index 85071f1..e2a4ee9 100644 --- a/doc/src/snippets/declarative/mousearea/mousearea-snippet.qml +++ b/doc/src/snippets/declarative/mousearea/mousearea-snippet.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 100; height: 100 diff --git a/doc/src/snippets/declarative/mousearea/mousearea.qml b/doc/src/snippets/declarative/mousearea/mousearea.qml index e7764f9..7cd0a77 100644 --- a/doc/src/snippets/declarative/mousearea/mousearea.qml +++ b/doc/src/snippets/declarative/mousearea/mousearea.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [import] -import Qt 4.7 +import QtQuick 1.0 //! [import] Rectangle { diff --git a/doc/src/snippets/declarative/mousearea/mouseareadragfilter.qml b/doc/src/snippets/declarative/mousearea/mouseareadragfilter.qml index fa0682e..8f9fd47 100644 --- a/doc/src/snippets/declarative/mousearea/mouseareadragfilter.qml +++ b/doc/src/snippets/declarative/mousearea/mouseareadragfilter.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [dragfilter] -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 480 diff --git a/doc/src/snippets/declarative/numberanimation.qml b/doc/src/snippets/declarative/numberanimation.qml index 19c0b0d..8f64493 100644 --- a/doc/src/snippets/declarative/numberanimation.qml +++ b/doc/src/snippets/declarative/numberanimation.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 100; height: 100 diff --git a/doc/src/snippets/declarative/parallelanimation.qml b/doc/src/snippets/declarative/parallelanimation.qml index caf4e01..0badc03 100644 --- a/doc/src/snippets/declarative/parallelanimation.qml +++ b/doc/src/snippets/declarative/parallelanimation.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: rect diff --git a/doc/src/snippets/declarative/parentanimation.qml b/doc/src/snippets/declarative/parentanimation.qml index b8a4c00..fa49d7a 100644 --- a/doc/src/snippets/declarative/parentanimation.qml +++ b/doc/src/snippets/declarative/parentanimation.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Item { width: 200; height: 100 diff --git a/doc/src/snippets/declarative/parentchange.qml b/doc/src/snippets/declarative/parentchange.qml index 72932b2..e73bbb3 100644 --- a/doc/src/snippets/declarative/parentchange.qml +++ b/doc/src/snippets/declarative/parentchange.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Item { width: 200; height: 100 diff --git a/doc/src/snippets/declarative/pathview/ContactModel.qml b/doc/src/snippets/declarative/pathview/ContactModel.qml index 62daf3d..07db8dc 100644 --- a/doc/src/snippets/declarative/pathview/ContactModel.qml +++ b/doc/src/snippets/declarative/pathview/ContactModel.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 ListModel { ListElement { diff --git a/doc/src/snippets/declarative/pathview/pathattributes.qml b/doc/src/snippets/declarative/pathview/pathattributes.qml index a45f15a..d6dacdb 100644 --- a/doc/src/snippets/declarative/pathview/pathattributes.qml +++ b/doc/src/snippets/declarative/pathview/pathattributes.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 240; height: 200 diff --git a/doc/src/snippets/declarative/pathview/pathview.qml b/doc/src/snippets/declarative/pathview/pathview.qml index e03c615..93298c4 100644 --- a/doc/src/snippets/declarative/pathview/pathview.qml +++ b/doc/src/snippets/declarative/pathview/pathview.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 240; height: 200 diff --git a/doc/src/snippets/declarative/propertyaction.qml b/doc/src/snippets/declarative/propertyaction.qml index 696c9ef..acb5c43 100644 --- a/doc/src/snippets/declarative/propertyaction.qml +++ b/doc/src/snippets/declarative/propertyaction.qml @@ -37,7 +37,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Row { diff --git a/doc/src/snippets/declarative/propertyanimation.qml b/doc/src/snippets/declarative/propertyanimation.qml index 24efd60..1f1cbaf 100644 --- a/doc/src/snippets/declarative/propertyanimation.qml +++ b/doc/src/snippets/declarative/propertyanimation.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Row { diff --git a/doc/src/snippets/declarative/propertychanges.qml b/doc/src/snippets/declarative/propertychanges.qml index 06a3fae..00f6bfe 100644 --- a/doc/src/snippets/declarative/propertychanges.qml +++ b/doc/src/snippets/declarative/propertychanges.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //![import] -import Qt 4.7 +import QtQuick 1.0 //![import] Column { diff --git a/doc/src/snippets/declarative/qml-data-models/dynamic-listmodel.qml b/doc/src/snippets/declarative/qml-data-models/dynamic-listmodel.qml index 48f2bdb..4aa318c 100644 --- a/doc/src/snippets/declarative/qml-data-models/dynamic-listmodel.qml +++ b/doc/src/snippets/declarative/qml-data-models/dynamic-listmodel.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { width: 200; height: 250 diff --git a/doc/src/snippets/declarative/qml-data-models/listelements.qml b/doc/src/snippets/declarative/qml-data-models/listelements.qml index 2d12567..44fb056 100644 --- a/doc/src/snippets/declarative/qml-data-models/listelements.qml +++ b/doc/src/snippets/declarative/qml-data-models/listelements.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Item { width: 200; height: 250 diff --git a/doc/src/snippets/declarative/qml-data-models/listmodel-listview.qml b/doc/src/snippets/declarative/qml-data-models/listmodel-listview.qml index 69533c9..53f844a 100644 --- a/doc/src/snippets/declarative/qml-data-models/listmodel-listview.qml +++ b/doc/src/snippets/declarative/qml-data-models/listmodel-listview.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Item { width: 200; height: 250 diff --git a/doc/src/snippets/declarative/qml-documents/inline-component.qml b/doc/src/snippets/declarative/qml-documents/inline-component.qml index 45d7eb4..eef68a3 100644 --- a/doc/src/snippets/declarative/qml-documents/inline-component.qml +++ b/doc/src/snippets/declarative/qml-documents/inline-component.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 240; height: 320; diff --git a/doc/src/snippets/declarative/qml-documents/inline-text-component.qml b/doc/src/snippets/declarative/qml-documents/inline-text-component.qml index 1f3af33..593862d 100644 --- a/doc/src/snippets/declarative/qml-documents/inline-text-component.qml +++ b/doc/src/snippets/declarative/qml-documents/inline-text-component.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 240; height: 320; diff --git a/doc/src/snippets/declarative/qml-documents/non-trivial.qml b/doc/src/snippets/declarative/qml-documents/non-trivial.qml index e9cba98..ba567b5 100644 --- a/doc/src/snippets/declarative/qml-documents/non-trivial.qml +++ b/doc/src/snippets/declarative/qml-documents/non-trivial.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 240; height: 320; diff --git a/doc/src/snippets/declarative/qml-documents/qmldocuments.qml b/doc/src/snippets/declarative/qml-documents/qmldocuments.qml index a4b5589..20efc35 100644 --- a/doc/src/snippets/declarative/qml-documents/qmldocuments.qml +++ b/doc/src/snippets/declarative/qml-documents/qmldocuments.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Rectangle { property alias text: textItem.text diff --git a/doc/src/snippets/declarative/qml-intro/anchors1.qml b/doc/src/snippets/declarative/qml-intro/anchors1.qml index ba6f928..077eab2 100644 --- a/doc/src/snippets/declarative/qml-intro/anchors1.qml +++ b/doc/src/snippets/declarative/qml-intro/anchors1.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myWin diff --git a/doc/src/snippets/declarative/qml-intro/anchors2.qml b/doc/src/snippets/declarative/qml-intro/anchors2.qml index ac60e1b..79f180d 100644 --- a/doc/src/snippets/declarative/qml-intro/anchors2.qml +++ b/doc/src/snippets/declarative/qml-intro/anchors2.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myWin diff --git a/doc/src/snippets/declarative/qml-intro/anchors3.qml b/doc/src/snippets/declarative/qml-intro/anchors3.qml index ab74670..db42e6b 100644 --- a/doc/src/snippets/declarative/qml-intro/anchors3.qml +++ b/doc/src/snippets/declarative/qml-intro/anchors3.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myWin diff --git a/doc/src/snippets/declarative/qml-intro/hello-world1.qml b/doc/src/snippets/declarative/qml-intro/hello-world1.qml index 55b39c6..176f4f4 100644 --- a/doc/src/snippets/declarative/qml-intro/hello-world1.qml +++ b/doc/src/snippets/declarative/qml-intro/hello-world1.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRectangle diff --git a/doc/src/snippets/declarative/qml-intro/hello-world2.qml b/doc/src/snippets/declarative/qml-intro/hello-world2.qml index c537528..98f04ec 100644 --- a/doc/src/snippets/declarative/qml-intro/hello-world2.qml +++ b/doc/src/snippets/declarative/qml-intro/hello-world2.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRectangle diff --git a/doc/src/snippets/declarative/qml-intro/hello-world3.qml b/doc/src/snippets/declarative/qml-intro/hello-world3.qml index 794c406..abf684c 100644 --- a/doc/src/snippets/declarative/qml-intro/hello-world3.qml +++ b/doc/src/snippets/declarative/qml-intro/hello-world3.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRectangle diff --git a/doc/src/snippets/declarative/qml-intro/hello-world4.qml b/doc/src/snippets/declarative/qml-intro/hello-world4.qml index 7ea4bed..de794ca 100644 --- a/doc/src/snippets/declarative/qml-intro/hello-world4.qml +++ b/doc/src/snippets/declarative/qml-intro/hello-world4.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRectangle diff --git a/doc/src/snippets/declarative/qml-intro/hello-world5.qml b/doc/src/snippets/declarative/qml-intro/hello-world5.qml index 3345882..95ec6c8 100644 --- a/doc/src/snippets/declarative/qml-intro/hello-world5.qml +++ b/doc/src/snippets/declarative/qml-intro/hello-world5.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRectangle diff --git a/doc/src/snippets/declarative/qml-intro/number-animation1.qml b/doc/src/snippets/declarative/qml-intro/number-animation1.qml index 64ebe7a..aa5c109 100644 --- a/doc/src/snippets/declarative/qml-intro/number-animation1.qml +++ b/doc/src/snippets/declarative/qml-intro/number-animation1.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: mainRec diff --git a/doc/src/snippets/declarative/qml-intro/number-animation2.qml b/doc/src/snippets/declarative/qml-intro/number-animation2.qml index 7905002..9c6a4bc 100644 --- a/doc/src/snippets/declarative/qml-intro/number-animation2.qml +++ b/doc/src/snippets/declarative/qml-intro/number-animation2.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: mainRec diff --git a/doc/src/snippets/declarative/qml-intro/rectangle.qml b/doc/src/snippets/declarative/qml-intro/rectangle.qml index 1ce0a04..ccfa514 100644 --- a/doc/src/snippets/declarative/qml-intro/rectangle.qml +++ b/doc/src/snippets/declarative/qml-intro/rectangle.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 // This is a comment. And below myRectangle is defined. Rectangle { diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml index a1a1af9..3ff1905 100644 --- a/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml +++ b/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: mainRec diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml index f83c224..47c8d6a 100644 --- a/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml +++ b/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: mainRec diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml index 32bf59c..530907a 100644 --- a/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml +++ b/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml @@ -38,10 +38,10 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 //! [document] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: mainRec diff --git a/doc/src/snippets/declarative/qml-intro/states1.qml b/doc/src/snippets/declarative/qml-intro/states1.qml index 6e7bab1..e63551a 100644 --- a/doc/src/snippets/declarative/qml-intro/states1.qml +++ b/doc/src/snippets/declarative/qml-intro/states1.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: mainRectangle diff --git a/doc/src/snippets/declarative/qml-intro/transformations1.qml b/doc/src/snippets/declarative/qml-intro/transformations1.qml index 7ca3aee..2fea733 100644 --- a/doc/src/snippets/declarative/qml-intro/transformations1.qml +++ b/doc/src/snippets/declarative/qml-intro/transformations1.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myWin diff --git a/doc/src/snippets/declarative/qtbinding/contextproperties/main.qml b/doc/src/snippets/declarative/qtbinding/contextproperties/main.qml index 341765a..425346d 100644 --- a/doc/src/snippets/declarative/qtbinding/contextproperties/main.qml +++ b/doc/src/snippets/declarative/qtbinding/contextproperties/main.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 300 diff --git a/doc/src/snippets/declarative/qtbinding/custompalette/main.qml b/doc/src/snippets/declarative/qtbinding/custompalette/main.qml index ea8464c..a20d9e0 100644 --- a/doc/src/snippets/declarative/qtbinding/custompalette/main.qml +++ b/doc/src/snippets/declarative/qtbinding/custompalette/main.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 240 diff --git a/doc/src/snippets/declarative/qtbinding/resources/main.qml b/doc/src/snippets/declarative/qtbinding/resources/main.qml index b12af9e..644d963 100644 --- a/doc/src/snippets/declarative/qtbinding/resources/main.qml +++ b/doc/src/snippets/declarative/qtbinding/resources/main.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Image { source: "images/background.png" diff --git a/doc/src/snippets/declarative/qtbinding/stopwatch/main.qml b/doc/src/snippets/declarative/qtbinding/stopwatch/main.qml index 75c0831..f894f71 100644 --- a/doc/src/snippets/declarative/qtbinding/stopwatch/main.qml +++ b/doc/src/snippets/declarative/qtbinding/stopwatch/main.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 300 diff --git a/doc/src/snippets/declarative/qtobject.qml b/doc/src/snippets/declarative/qtobject.qml index 581af16..e6e98c2 100644 --- a/doc/src/snippets/declarative/qtobject.qml +++ b/doc/src/snippets/declarative/qtobject.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Item { QtObject { diff --git a/doc/src/snippets/declarative/rectangle/rect-border-width.qml b/doc/src/snippets/declarative/rectangle/rect-border-width.qml index 3cf0831..3b2a4e5 100644 --- a/doc/src/snippets/declarative/rectangle/rect-border-width.qml +++ b/doc/src/snippets/declarative/rectangle/rect-border-width.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 //![0] Rectangle { diff --git a/doc/src/snippets/declarative/rectangle/rectangle-colors.qml b/doc/src/snippets/declarative/rectangle/rectangle-colors.qml index 8f306f6..df364bc 100644 --- a/doc/src/snippets/declarative/rectangle/rectangle-colors.qml +++ b/doc/src/snippets/declarative/rectangle/rectangle-colors.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { width: 100; height: 200 diff --git a/doc/src/snippets/declarative/rectangle/rectangle-gradient.qml b/doc/src/snippets/declarative/rectangle/rectangle-gradient.qml index aff5849..d727e84 100644 --- a/doc/src/snippets/declarative/rectangle/rectangle-gradient.qml +++ b/doc/src/snippets/declarative/rectangle/rectangle-gradient.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { width: 100; height: 300 diff --git a/doc/src/snippets/declarative/rectangle/rectangle-smooth.qml b/doc/src/snippets/declarative/rectangle/rectangle-smooth.qml index e1d6980..4cb1050 100644 --- a/doc/src/snippets/declarative/rectangle/rectangle-smooth.qml +++ b/doc/src/snippets/declarative/rectangle/rectangle-smooth.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400; height: 200 diff --git a/doc/src/snippets/declarative/rectangle/rectangle.qml b/doc/src/snippets/declarative/rectangle/rectangle.qml index a464cb9..7bb7c58 100644 --- a/doc/src/snippets/declarative/rectangle/rectangle.qml +++ b/doc/src/snippets/declarative/rectangle/rectangle.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 100 diff --git a/doc/src/snippets/declarative/repeaters/repeater-grid-index.qml b/doc/src/snippets/declarative/repeaters/repeater-grid-index.qml index dbf24ae..4835cfe 100644 --- a/doc/src/snippets/declarative/repeaters/repeater-grid-index.qml +++ b/doc/src/snippets/declarative/repeaters/repeater-grid-index.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400; height: 400; color: "black" diff --git a/doc/src/snippets/declarative/repeaters/repeater.qml b/doc/src/snippets/declarative/repeaters/repeater.qml index db606d0..f3a5505 100644 --- a/doc/src/snippets/declarative/repeaters/repeater.qml +++ b/doc/src/snippets/declarative/repeaters/repeater.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [import] -import Qt 4.7 +import QtQuick 1.0 //! [import] Row { diff --git a/doc/src/snippets/declarative/rotation.qml b/doc/src/snippets/declarative/rotation.qml index 4db8b4a..7366775 100644 --- a/doc/src/snippets/declarative/rotation.qml +++ b/doc/src/snippets/declarative/rotation.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //! [0] -import Qt 4.7 +import QtQuick 1.0 Row { x: 10; y: 10 diff --git a/doc/src/snippets/declarative/rotationanimation.qml b/doc/src/snippets/declarative/rotationanimation.qml index 2309d0a..c907287 100644 --- a/doc/src/snippets/declarative/rotationanimation.qml +++ b/doc/src/snippets/declarative/rotationanimation.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Item { width: 300; height: 300 diff --git a/doc/src/snippets/declarative/row.qml b/doc/src/snippets/declarative/row.qml index efb6190..4e4bdd3 100644 --- a/doc/src/snippets/declarative/row.qml +++ b/doc/src/snippets/declarative/row.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 320; height: 110 diff --git a/doc/src/snippets/declarative/row/row.qml b/doc/src/snippets/declarative/row/row.qml index 8096c0f..b19bdc2 100644 --- a/doc/src/snippets/declarative/row/row.qml +++ b/doc/src/snippets/declarative/row/row.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [document] -import Qt 4.7 +import QtQuick 1.0 Row { spacing: 2 diff --git a/doc/src/snippets/declarative/sequentialanimation.qml b/doc/src/snippets/declarative/sequentialanimation.qml index 1a17ae9..c8788ac 100644 --- a/doc/src/snippets/declarative/sequentialanimation.qml +++ b/doc/src/snippets/declarative/sequentialanimation.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: rect diff --git a/doc/src/snippets/declarative/smoothedanimation.qml b/doc/src/snippets/declarative/smoothedanimation.qml index edc33db..06e1555 100644 --- a/doc/src/snippets/declarative/smoothedanimation.qml +++ b/doc/src/snippets/declarative/smoothedanimation.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 800; height: 600 diff --git a/doc/src/snippets/declarative/springanimation.qml b/doc/src/snippets/declarative/springanimation.qml index fe5aeb8..2051dbe 100644 --- a/doc/src/snippets/declarative/springanimation.qml +++ b/doc/src/snippets/declarative/springanimation.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Item { width: 300; height: 300 diff --git a/doc/src/snippets/declarative/state-when.qml b/doc/src/snippets/declarative/state-when.qml index 6dbd099..583f3ba 100644 --- a/doc/src/snippets/declarative/state-when.qml +++ b/doc/src/snippets/declarative/state-when.qml @@ -37,7 +37,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 //![0] Rectangle { id: myRect diff --git a/doc/src/snippets/declarative/state.qml b/doc/src/snippets/declarative/state.qml index 8597314..07fd21b 100644 --- a/doc/src/snippets/declarative/state.qml +++ b/doc/src/snippets/declarative/state.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRect diff --git a/doc/src/snippets/declarative/states.qml b/doc/src/snippets/declarative/states.qml index be483af..ee110aa 100644 --- a/doc/src/snippets/declarative/states.qml +++ b/doc/src/snippets/declarative/states.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRect diff --git a/doc/src/snippets/declarative/systempalette.qml b/doc/src/snippets/declarative/systempalette.qml index 5e540b9..53410a1 100644 --- a/doc/src/snippets/declarative/systempalette.qml +++ b/doc/src/snippets/declarative/systempalette.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { SystemPalette { id: myPalette; colorGroup: SystemPalette.Active } diff --git a/doc/src/snippets/declarative/text/onLinkActivated.qml b/doc/src/snippets/declarative/text/onLinkActivated.qml index 0fb236a..e9fd431 100644 --- a/doc/src/snippets/declarative/text/onLinkActivated.qml +++ b/doc/src/snippets/declarative/text/onLinkActivated.qml @@ -37,7 +37,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 700; height: 400 diff --git a/doc/src/snippets/declarative/texteditor.qml b/doc/src/snippets/declarative/texteditor.qml index 55438f4..5596140 100644 --- a/doc/src/snippets/declarative/texteditor.qml +++ b/doc/src/snippets/declarative/texteditor.qml @@ -37,7 +37,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 //![0] Flickable { diff --git a/doc/src/snippets/declarative/transition-from-to.qml b/doc/src/snippets/declarative/transition-from-to.qml index 73bf880..4fe39c5 100644 --- a/doc/src/snippets/declarative/transition-from-to.qml +++ b/doc/src/snippets/declarative/transition-from-to.qml @@ -37,7 +37,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 //![0] Rectangle { diff --git a/doc/src/snippets/declarative/transition-reversible.qml b/doc/src/snippets/declarative/transition-reversible.qml index b64cf37..e3fec2f 100644 --- a/doc/src/snippets/declarative/transition-reversible.qml +++ b/doc/src/snippets/declarative/transition-reversible.qml @@ -37,7 +37,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 //![0] Rectangle { diff --git a/doc/src/snippets/declarative/transition.qml b/doc/src/snippets/declarative/transition.qml index 6a8a2f5..9154c3c 100644 --- a/doc/src/snippets/declarative/transition.qml +++ b/doc/src/snippets/declarative/transition.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: rect diff --git a/doc/src/snippets/declarative/visualdatamodel.qml b/doc/src/snippets/declarative/visualdatamodel.qml index 67f9b6b..e9ad800 100644 --- a/doc/src/snippets/declarative/visualdatamodel.qml +++ b/doc/src/snippets/declarative/visualdatamodel.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 200; height: 100 diff --git a/doc/src/snippets/declarative/visualdatamodel_rootindex/view.qml b/doc/src/snippets/declarative/visualdatamodel_rootindex/view.qml index 10bcfe8..bceaac8 100644 --- a/doc/src/snippets/declarative/visualdatamodel_rootindex/view.qml +++ b/doc/src/snippets/declarative/visualdatamodel_rootindex/view.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 ListView { id: view diff --git a/doc/src/snippets/declarative/workerscript.qml b/doc/src/snippets/declarative/workerscript.qml index 434a90e..95e787c 100644 --- a/doc/src/snippets/declarative/workerscript.qml +++ b/doc/src/snippets/declarative/workerscript.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 300; height: 300 diff --git a/doc/src/snippets/declarative/xmlrole.qml b/doc/src/snippets/declarative/xmlrole.qml index 9c8af89..efa59eb 100644 --- a/doc/src/snippets/declarative/xmlrole.qml +++ b/doc/src/snippets/declarative/xmlrole.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 300; height: 200 diff --git a/examples/declarative/animation/basics/color-animation.qml b/examples/declarative/animation/basics/color-animation.qml index 182bb54..809f391 100644 --- a/examples/declarative/animation/basics/color-animation.qml +++ b/examples/declarative/animation/basics/color-animation.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.particles 1.0 Item { diff --git a/examples/declarative/animation/basics/property-animation.qml b/examples/declarative/animation/basics/property-animation.qml index 5149f5b..0a5b353 100644 --- a/examples/declarative/animation/basics/property-animation.qml +++ b/examples/declarative/animation/basics/property-animation.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: window diff --git a/examples/declarative/animation/behaviors/SideRect.qml b/examples/declarative/animation/behaviors/SideRect.qml index eba0817..9517421 100644 --- a/examples/declarative/animation/behaviors/SideRect.qml +++ b/examples/declarative/animation/behaviors/SideRect.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRect diff --git a/examples/declarative/animation/behaviors/behavior-example.qml b/examples/declarative/animation/behaviors/behavior-example.qml index 268d6e5..3e050ab 100644 --- a/examples/declarative/animation/behaviors/behavior-example.qml +++ b/examples/declarative/animation/behaviors/behavior-example.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 600; height: 400 diff --git a/examples/declarative/animation/easing/content/QuitButton.qml b/examples/declarative/animation/easing/content/QuitButton.qml index 9dfe9bd..cbbf916 100644 --- a/examples/declarative/animation/easing/content/QuitButton.qml +++ b/examples/declarative/animation/easing/content/QuitButton.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Image { source: "quit.png" scale: quitMouse.pressed ? 0.8 : 1.0 @@ -49,4 +49,4 @@ Image { anchors.margins: -10 onClicked: Qt.quit() } -} \ No newline at end of file +} diff --git a/examples/declarative/animation/easing/easing.qml b/examples/declarative/animation/easing/easing.qml index ffb129d..c748c23 100644 --- a/examples/declarative/animation/easing/easing.qml +++ b/examples/declarative/animation/easing/easing.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "content" Rectangle { diff --git a/examples/declarative/animation/states/states.qml b/examples/declarative/animation/states/states.qml index 4f3e28c..a9046eb 100644 --- a/examples/declarative/animation/states/states.qml +++ b/examples/declarative/animation/states/states.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: page diff --git a/examples/declarative/animation/states/transitions.qml b/examples/declarative/animation/states/transitions.qml index 6efcdba..ea73b82 100644 --- a/examples/declarative/animation/states/transitions.qml +++ b/examples/declarative/animation/states/transitions.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 /* This is exactly the same as states.qml, except that we have appended diff --git a/examples/declarative/cppextensions/imageprovider/imageprovider-example.qml b/examples/declarative/cppextensions/imageprovider/imageprovider-example.qml index 58536bf..eda9a43 100644 --- a/examples/declarative/cppextensions/imageprovider/imageprovider-example.qml +++ b/examples/declarative/cppextensions/imageprovider/imageprovider-example.qml @@ -37,7 +37,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "ImageProviderCore" // import the plugin that registers the color image provider //![0] diff --git a/examples/declarative/cppextensions/networkaccessmanagerfactory/view.qml b/examples/declarative/cppextensions/networkaccessmanagerfactory/view.qml index 439740a..07c2f5a 100644 --- a/examples/declarative/cppextensions/networkaccessmanagerfactory/view.qml +++ b/examples/declarative/cppextensions/networkaccessmanagerfactory/view.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Image { width: 100 diff --git a/examples/declarative/cppextensions/plugins/com/nokia/TimeExample/Clock.qml b/examples/declarative/cppextensions/plugins/com/nokia/TimeExample/Clock.qml index c7d2757..f416c8b 100644 --- a/examples/declarative/cppextensions/plugins/com/nokia/TimeExample/Clock.qml +++ b/examples/declarative/cppextensions/plugins/com/nokia/TimeExample/Clock.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: clock diff --git a/examples/declarative/cppextensions/qgraphicslayouts/layoutitem/layoutitem.qml b/examples/declarative/cppextensions/qgraphicslayouts/layoutitem/layoutitem.qml index 571e427..5f442af 100644 --- a/examples/declarative/cppextensions/qgraphicslayouts/layoutitem/layoutitem.qml +++ b/examples/declarative/cppextensions/qgraphicslayouts/layoutitem/layoutitem.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 LayoutItem { //Sized by the layout id: resizable diff --git a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/qgraphicsgridlayout.qml b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/qgraphicsgridlayout.qml index fd3aa03..5a83937 100644 --- a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/qgraphicsgridlayout.qml +++ b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/qgraphicsgridlayout.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import GridLayouts 4.7 Item { diff --git a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/qgraphicslinearlayout.qml b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/qgraphicslinearlayout.qml index 24992d5..becbbfa 100644 --- a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/qgraphicslinearlayout.qml +++ b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/qgraphicslinearlayout.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import LinearLayouts 4.7 Item { diff --git a/examples/declarative/cppextensions/qwidgets/qwidgets.qml b/examples/declarative/cppextensions/qwidgets/qwidgets.qml index 16e9227..6ad937b 100644 --- a/examples/declarative/cppextensions/qwidgets/qwidgets.qml +++ b/examples/declarative/cppextensions/qwidgets/qwidgets.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "QWidgets" 1.0 Rectangle { diff --git a/examples/declarative/cppextensions/referenceexamples/methods/example.qml b/examples/declarative/cppextensions/referenceexamples/methods/example.qml index ea3fa5f..f3616c7 100644 --- a/examples/declarative/cppextensions/referenceexamples/methods/example.qml +++ b/examples/declarative/cppextensions/referenceexamples/methods/example.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import People 1.0 // ![0] diff --git a/examples/declarative/i18n/i18n.qml b/examples/declarative/i18n/i18n.qml index fcf24c2..8dac88d 100644 --- a/examples/declarative/i18n/i18n.qml +++ b/examples/declarative/i18n/i18n.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 // // The QML runtime automatically loads a translation from the i18n subdirectory of the root diff --git a/examples/declarative/imageelements/borderimage/borderimage.qml b/examples/declarative/imageelements/borderimage/borderimage.qml index bbe113c..53e35f9 100644 --- a/examples/declarative/imageelements/borderimage/borderimage.qml +++ b/examples/declarative/imageelements/borderimage/borderimage.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "content" Rectangle { diff --git a/examples/declarative/imageelements/borderimage/content/MyBorderImage.qml b/examples/declarative/imageelements/borderimage/content/MyBorderImage.qml index b8f8a70..96495cb 100644 --- a/examples/declarative/imageelements/borderimage/content/MyBorderImage.qml +++ b/examples/declarative/imageelements/borderimage/content/MyBorderImage.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: container diff --git a/examples/declarative/imageelements/borderimage/content/ShadowRectangle.qml b/examples/declarative/imageelements/borderimage/content/ShadowRectangle.qml index 73eb040..839ecf1 100644 --- a/examples/declarative/imageelements/borderimage/content/ShadowRectangle.qml +++ b/examples/declarative/imageelements/borderimage/content/ShadowRectangle.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { property alias color : rectangle.color diff --git a/examples/declarative/imageelements/borderimage/shadows.qml b/examples/declarative/imageelements/borderimage/shadows.qml index 4cb7c65..d547f63 100644 --- a/examples/declarative/imageelements/borderimage/shadows.qml +++ b/examples/declarative/imageelements/borderimage/shadows.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "content" Rectangle { diff --git a/examples/declarative/imageelements/image/ImageCell.qml b/examples/declarative/imageelements/image/ImageCell.qml index f8973c8..e8a6c55 100644 --- a/examples/declarative/imageelements/image/ImageCell.qml +++ b/examples/declarative/imageelements/image/ImageCell.qml @@ -37,7 +37,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { property alias mode: image.fillMode diff --git a/examples/declarative/imageelements/image/image.qml b/examples/declarative/imageelements/image/image.qml index 719d544..f00fc18 100644 --- a/examples/declarative/imageelements/image/image.qml +++ b/examples/declarative/imageelements/image/image.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 490 diff --git a/examples/declarative/keyinteraction/focus/Core/ContextMenu.qml b/examples/declarative/keyinteraction/focus/Core/ContextMenu.qml index be32386..79273ad 100644 --- a/examples/declarative/keyinteraction/focus/Core/ContextMenu.qml +++ b/examples/declarative/keyinteraction/focus/Core/ContextMenu.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 FocusScope { id: container diff --git a/examples/declarative/keyinteraction/focus/Core/GridMenu.qml b/examples/declarative/keyinteraction/focus/Core/GridMenu.qml index 8cdec3e..263adad 100644 --- a/examples/declarative/keyinteraction/focus/Core/GridMenu.qml +++ b/examples/declarative/keyinteraction/focus/Core/GridMenu.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 FocusScope { property alias interactive: gridView.interactive diff --git a/examples/declarative/keyinteraction/focus/Core/ListMenu.qml b/examples/declarative/keyinteraction/focus/Core/ListMenu.qml index ca2e206..cefc9a3 100644 --- a/examples/declarative/keyinteraction/focus/Core/ListMenu.qml +++ b/examples/declarative/keyinteraction/focus/Core/ListMenu.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 FocusScope { clip: true diff --git a/examples/declarative/keyinteraction/focus/Core/ListViewDelegate.qml b/examples/declarative/keyinteraction/focus/Core/ListViewDelegate.qml index 95164f8..7b63cd8 100644 --- a/examples/declarative/keyinteraction/focus/Core/ListViewDelegate.qml +++ b/examples/declarative/keyinteraction/focus/Core/ListViewDelegate.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: container diff --git a/examples/declarative/keyinteraction/focus/focus.qml b/examples/declarative/keyinteraction/focus/focus.qml index da2c30d..e2115d8 100644 --- a/examples/declarative/keyinteraction/focus/focus.qml +++ b/examples/declarative/keyinteraction/focus/focus.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "Core" Rectangle { diff --git a/examples/declarative/modelviews/abstractitemmodel/view.qml b/examples/declarative/modelviews/abstractitemmodel/view.qml index 2fb4885..d1ab302 100644 --- a/examples/declarative/modelviews/abstractitemmodel/view.qml +++ b/examples/declarative/modelviews/abstractitemmodel/view.qml @@ -37,7 +37,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 //![0] ListView { diff --git a/examples/declarative/modelviews/gridview/gridview-example.qml b/examples/declarative/modelviews/gridview/gridview-example.qml index aea34ff..85fefda 100644 --- a/examples/declarative/modelviews/gridview/gridview-example.qml +++ b/examples/declarative/modelviews/gridview/gridview-example.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 300; height: 400 diff --git a/examples/declarative/modelviews/listview/content/PetsModel.qml b/examples/declarative/modelviews/listview/content/PetsModel.qml index beeed1a..5220763 100644 --- a/examples/declarative/modelviews/listview/content/PetsModel.qml +++ b/examples/declarative/modelviews/listview/content/PetsModel.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 ListModel { ListElement { diff --git a/examples/declarative/modelviews/listview/content/PressAndHoldButton.qml b/examples/declarative/modelviews/listview/content/PressAndHoldButton.qml index ad6230e..d6808a4 100644 --- a/examples/declarative/modelviews/listview/content/PressAndHoldButton.qml +++ b/examples/declarative/modelviews/listview/content/PressAndHoldButton.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Image { id: container diff --git a/examples/declarative/modelviews/listview/content/RecipesModel.qml b/examples/declarative/modelviews/listview/content/RecipesModel.qml index 812cf77..6056b90 100644 --- a/examples/declarative/modelviews/listview/content/RecipesModel.qml +++ b/examples/declarative/modelviews/listview/content/RecipesModel.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 ListModel { ListElement { diff --git a/examples/declarative/modelviews/listview/content/TextButton.qml b/examples/declarative/modelviews/listview/content/TextButton.qml index 0270fdc..f26d775 100644 --- a/examples/declarative/modelviews/listview/content/TextButton.qml +++ b/examples/declarative/modelviews/listview/content/TextButton.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: container diff --git a/examples/declarative/modelviews/listview/dynamiclist.qml b/examples/declarative/modelviews/listview/dynamiclist.qml index 27ef6e0..f25f0fa 100644 --- a/examples/declarative/modelviews/listview/dynamiclist.qml +++ b/examples/declarative/modelviews/listview/dynamiclist.qml @@ -37,7 +37,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "content" // This example shows how items can be dynamically added to and removed from diff --git a/examples/declarative/modelviews/listview/expandingdelegates.qml b/examples/declarative/modelviews/listview/expandingdelegates.qml index 2dec769..bd3d3a9 100644 --- a/examples/declarative/modelviews/listview/expandingdelegates.qml +++ b/examples/declarative/modelviews/listview/expandingdelegates.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "content" // This example illustrates expanding a list item to show a more detailed view. diff --git a/examples/declarative/modelviews/listview/highlight.qml b/examples/declarative/modelviews/listview/highlight.qml index 5646e9f..249c73b 100644 --- a/examples/declarative/modelviews/listview/highlight.qml +++ b/examples/declarative/modelviews/listview/highlight.qml @@ -42,7 +42,7 @@ // that uses a SpringAnimation to provide custom movement when the // highlight bar is moved between items. -import Qt 4.7 +import QtQuick 1.0 import "content" Rectangle { diff --git a/examples/declarative/modelviews/listview/highlightranges.qml b/examples/declarative/modelviews/listview/highlightranges.qml index 711463a..2716ee5 100644 --- a/examples/declarative/modelviews/listview/highlightranges.qml +++ b/examples/declarative/modelviews/listview/highlightranges.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "content" Rectangle { diff --git a/examples/declarative/modelviews/listview/sections.qml b/examples/declarative/modelviews/listview/sections.qml index a9ec538..3248899 100644 --- a/examples/declarative/modelviews/listview/sections.qml +++ b/examples/declarative/modelviews/listview/sections.qml @@ -41,7 +41,7 @@ // This example shows how a ListView can be separated into sections using // the ListView.section attached property. -import Qt 4.7 +import QtQuick 1.0 //! [0] Rectangle { diff --git a/examples/declarative/modelviews/objectlistmodel/view.qml b/examples/declarative/modelviews/objectlistmodel/view.qml index 7e7c68a..fd9d149 100644 --- a/examples/declarative/modelviews/objectlistmodel/view.qml +++ b/examples/declarative/modelviews/objectlistmodel/view.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 //![0] ListView { diff --git a/examples/declarative/modelviews/package/Delegate.qml b/examples/declarative/modelviews/package/Delegate.qml index a38727c..57048f4 100644 --- a/examples/declarative/modelviews/package/Delegate.qml +++ b/examples/declarative/modelviews/package/Delegate.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 //![0] Package { diff --git a/examples/declarative/modelviews/package/view.qml b/examples/declarative/modelviews/package/view.qml index 38cc047..cbe8f06 100644 --- a/examples/declarative/modelviews/package/view.qml +++ b/examples/declarative/modelviews/package/view.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "white" diff --git a/examples/declarative/modelviews/parallax/parallax.qml b/examples/declarative/modelviews/parallax/parallax.qml index 3d7d091..0d07522 100644 --- a/examples/declarative/modelviews/parallax/parallax.qml +++ b/examples/declarative/modelviews/parallax/parallax.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "../../toys/clocks/content" // for loading the Clock element import "qml" diff --git a/examples/declarative/modelviews/parallax/qml/ParallaxView.qml b/examples/declarative/modelviews/parallax/qml/ParallaxView.qml index 724d7e0..96e3db9 100644 --- a/examples/declarative/modelviews/parallax/qml/ParallaxView.qml +++ b/examples/declarative/modelviews/parallax/qml/ParallaxView.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: root diff --git a/examples/declarative/modelviews/parallax/qml/Smiley.qml b/examples/declarative/modelviews/parallax/qml/Smiley.qml index 959c85c..cac0a17 100644 --- a/examples/declarative/modelviews/parallax/qml/Smiley.qml +++ b/examples/declarative/modelviews/parallax/qml/Smiley.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 // This is taken from the declarative animation/basics/property-animation.qml // example diff --git a/examples/declarative/modelviews/pathview/pathview-example.qml b/examples/declarative/modelviews/pathview/pathview-example.qml index 8777291..baf7575 100644 --- a/examples/declarative/modelviews/pathview/pathview-example.qml +++ b/examples/declarative/modelviews/pathview/pathview-example.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400; height: 240 diff --git a/examples/declarative/modelviews/stringlistmodel/view.qml b/examples/declarative/modelviews/stringlistmodel/view.qml index 1751a7a..0a90ee6 100644 --- a/examples/declarative/modelviews/stringlistmodel/view.qml +++ b/examples/declarative/modelviews/stringlistmodel/view.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 //![0] ListView { diff --git a/examples/declarative/modelviews/visualitemmodel/visualitemmodel.qml b/examples/declarative/modelviews/visualitemmodel/visualitemmodel.qml index 344ce62..15f2f11 100644 --- a/examples/declarative/modelviews/visualitemmodel/visualitemmodel.qml +++ b/examples/declarative/modelviews/visualitemmodel/visualitemmodel.qml @@ -41,7 +41,7 @@ // This example demonstrates placing items in a view using // a VisualItemModel -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "lightgray" diff --git a/examples/declarative/modelviews/webview/alerts.qml b/examples/declarative/modelviews/webview/alerts.qml index 68f7a5c..4aa4a3b 100644 --- a/examples/declarative/modelviews/webview/alerts.qml +++ b/examples/declarative/modelviews/webview/alerts.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import QtWebKit 1.0 WebView { diff --git a/examples/declarative/modelviews/webview/autosize.qml b/examples/declarative/modelviews/webview/autosize.qml index 91550c1..7e10403 100644 --- a/examples/declarative/modelviews/webview/autosize.qml +++ b/examples/declarative/modelviews/webview/autosize.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import QtWebKit 1.0 // The WebView size is determined by the width, height, diff --git a/examples/declarative/modelviews/webview/content/Mapping/Map.qml b/examples/declarative/modelviews/webview/content/Mapping/Map.qml index ab549b5..9a86579 100644 --- a/examples/declarative/modelviews/webview/content/Mapping/Map.qml +++ b/examples/declarative/modelviews/webview/content/Mapping/Map.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import QtWebKit 1.0 Item { diff --git a/examples/declarative/modelviews/webview/googlemaps.qml b/examples/declarative/modelviews/webview/googlemaps.qml index bc9a0e3..aed0ddd 100644 --- a/examples/declarative/modelviews/webview/googlemaps.qml +++ b/examples/declarative/modelviews/webview/googlemaps.qml @@ -45,7 +45,7 @@ // API, but users from QML don't need to understand the implementation in // order to create a Map. -import Qt 4.7 +import QtQuick 1.0 import QtWebKit 1.0 import "content/Mapping" diff --git a/examples/declarative/modelviews/webview/inlinehtml.qml b/examples/declarative/modelviews/webview/inlinehtml.qml index afc8418..afc1fa9 100644 --- a/examples/declarative/modelviews/webview/inlinehtml.qml +++ b/examples/declarative/modelviews/webview/inlinehtml.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import QtWebKit 1.0 // Inline HTML with loose formatting can be diff --git a/examples/declarative/modelviews/webview/newwindows.qml b/examples/declarative/modelviews/webview/newwindows.qml index 5762321..52f7a0b 100644 --- a/examples/declarative/modelviews/webview/newwindows.qml +++ b/examples/declarative/modelviews/webview/newwindows.qml @@ -43,7 +43,7 @@ // Note that to open windows from JavaScript, you will need to // allow it on WebView with settings.javascriptCanOpenWindows: true -import Qt 4.7 +import QtQuick 1.0 import QtWebKit 1.0 Grid { diff --git a/examples/declarative/positioners/Button.qml b/examples/declarative/positioners/Button.qml index 4709aa6..32e5993 100644 --- a/examples/declarative/positioners/Button.qml +++ b/examples/declarative/positioners/Button.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: page diff --git a/examples/declarative/positioners/positioners.qml b/examples/declarative/positioners/positioners.qml index 26b9ccd..6ae265e 100644 --- a/examples/declarative/positioners/positioners.qml +++ b/examples/declarative/positioners/positioners.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: page diff --git a/examples/declarative/screenorientation/Core/Bubble.qml b/examples/declarative/screenorientation/Core/Bubble.qml index 58bd13c..dea1e19 100644 --- a/examples/declarative/screenorientation/Core/Bubble.qml +++ b/examples/declarative/screenorientation/Core/Bubble.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { property bool rising: false @@ -88,4 +88,4 @@ Rectangle { } } } -} \ No newline at end of file +} diff --git a/examples/declarative/screenorientation/Core/Button.qml b/examples/declarative/screenorientation/Core/Button.qml index 11117c9..bc73118 100644 --- a/examples/declarative/screenorientation/Core/Button.qml +++ b/examples/declarative/screenorientation/Core/Button.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: button signal clicked diff --git a/examples/declarative/screenorientation/screenorientation.qml b/examples/declarative/screenorientation/screenorientation.qml index 4387266..6c3f929 100644 --- a/examples/declarative/screenorientation/screenorientation.qml +++ b/examples/declarative/screenorientation/screenorientation.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "Core" import "Core/screenorientation.js" as ScreenOrientation diff --git a/examples/declarative/sqllocalstorage/hello.qml b/examples/declarative/sqllocalstorage/hello.qml index cbfc14a..5f9b9e0 100644 --- a/examples/declarative/sqllocalstorage/hello.qml +++ b/examples/declarative/sqllocalstorage/hello.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "white" diff --git a/examples/declarative/text/fonts/availableFonts.qml b/examples/declarative/text/fonts/availableFonts.qml index 312bc38..4966a41 100644 --- a/examples/declarative/text/fonts/availableFonts.qml +++ b/examples/declarative/text/fonts/availableFonts.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 480; height: 640; color: "steelblue" diff --git a/examples/declarative/text/fonts/banner.qml b/examples/declarative/text/fonts/banner.qml index 41bc997..d722468 100644 --- a/examples/declarative/text/fonts/banner.qml +++ b/examples/declarative/text/fonts/banner.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: screen diff --git a/examples/declarative/text/fonts/fonts.qml b/examples/declarative/text/fonts/fonts.qml index 743ee79..ae48f24 100644 --- a/examples/declarative/text/fonts/fonts.qml +++ b/examples/declarative/text/fonts/fonts.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { property string myText: "The quick brown fox jumps over the lazy dog." diff --git a/examples/declarative/text/fonts/hello.qml b/examples/declarative/text/fonts/hello.qml index 60bd919..3aaf0fe 100644 --- a/examples/declarative/text/fonts/hello.qml +++ b/examples/declarative/text/fonts/hello.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: screen diff --git a/examples/declarative/text/textselection/textselection.qml b/examples/declarative/text/textselection/textselection.qml index aa958e6..f343be5 100644 --- a/examples/declarative/text/textselection/textselection.qml +++ b/examples/declarative/text/textselection/textselection.qml @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: editor diff --git a/examples/declarative/threading/threadedlistmodel/timedisplay.qml b/examples/declarative/threading/threadedlistmodel/timedisplay.qml index b1cce05..01411f4 100644 --- a/examples/declarative/threading/threadedlistmodel/timedisplay.qml +++ b/examples/declarative/threading/threadedlistmodel/timedisplay.qml @@ -39,7 +39,7 @@ ****************************************************************************/ // ![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "white" diff --git a/examples/declarative/threading/workerscript/workerscript.qml b/examples/declarative/threading/workerscript/workerscript.qml index e224bf1..2b03233 100644 --- a/examples/declarative/threading/workerscript/workerscript.qml +++ b/examples/declarative/threading/workerscript/workerscript.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 480; height: 320 diff --git a/examples/declarative/touchinteraction/gestures/experimental-gestures.qml b/examples/declarative/touchinteraction/gestures/experimental-gestures.qml index 500a909..6a4cb3d 100644 --- a/examples/declarative/touchinteraction/gestures/experimental-gestures.qml +++ b/examples/declarative/touchinteraction/gestures/experimental-gestures.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.gestures 1.0 // Only works on platforms with Touch support. diff --git a/examples/declarative/touchinteraction/mousearea/mousearea-example.qml b/examples/declarative/touchinteraction/mousearea/mousearea-example.qml index 492ffc6..8dacc05 100644 --- a/examples/declarative/touchinteraction/mousearea/mousearea-example.qml +++ b/examples/declarative/touchinteraction/mousearea/mousearea-example.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: box diff --git a/examples/declarative/toys/clocks/clocks.qml b/examples/declarative/toys/clocks/clocks.qml index 9002fac..3354f11 100644 --- a/examples/declarative/toys/clocks/clocks.qml +++ b/examples/declarative/toys/clocks/clocks.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "content" Rectangle { diff --git a/examples/declarative/toys/clocks/content/Clock.qml b/examples/declarative/toys/clocks/content/Clock.qml index 9c732f9..09e8393 100644 --- a/examples/declarative/toys/clocks/content/Clock.qml +++ b/examples/declarative/toys/clocks/content/Clock.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: clock diff --git a/examples/declarative/toys/clocks/content/QuitButton.qml b/examples/declarative/toys/clocks/content/QuitButton.qml index 9dfe9bd..cbbf916 100644 --- a/examples/declarative/toys/clocks/content/QuitButton.qml +++ b/examples/declarative/toys/clocks/content/QuitButton.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Image { source: "quit.png" scale: quitMouse.pressed ? 0.8 : 1.0 @@ -49,4 +49,4 @@ Image { anchors.margins: -10 onClicked: Qt.quit() } -} \ No newline at end of file +} diff --git a/examples/declarative/toys/corkboards/Day.qml b/examples/declarative/toys/corkboards/Day.qml index f406f7b..78591bb 100644 --- a/examples/declarative/toys/corkboards/Day.qml +++ b/examples/declarative/toys/corkboards/Day.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Component { Item { diff --git a/examples/declarative/toys/corkboards/corkboards.qml b/examples/declarative/toys/corkboards/corkboards.qml index 9b764c9..14bc5f0 100644 --- a/examples/declarative/toys/corkboards/corkboards.qml +++ b/examples/declarative/toys/corkboards/corkboards.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 800; height: 480 diff --git a/examples/declarative/toys/dynamicscene/dynamicscene.qml b/examples/declarative/toys/dynamicscene/dynamicscene.qml index ad18698..5f14e1d 100644 --- a/examples/declarative/toys/dynamicscene/dynamicscene.qml +++ b/examples/declarative/toys/dynamicscene/dynamicscene.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.particles 1.0 import "qml" @@ -188,7 +188,7 @@ Item { font.pixelSize: 14 wrapMode: TextEdit.WordWrap - text: "import Qt 4.7\nImage {\n id: smile\n x: 360 * Math.random()\n y: 180 * Math.random() \n source: 'images/face-smile.png'\n NumberAnimation on opacity { \n to: 0; duration: 1500\n }\n Component.onCompleted: smile.destroy(1500);\n}" + text: "import QtQuick 1.0\nImage {\n id: smile\n x: 360 * Math.random()\n y: 180 * Math.random() \n source: 'images/face-smile.png'\n NumberAnimation on opacity { \n to: 0; duration: 1500\n }\n Component.onCompleted: smile.destroy(1500);\n}" } } diff --git a/examples/declarative/toys/dynamicscene/qml/Button.qml b/examples/declarative/toys/dynamicscene/qml/Button.qml index 7bb0ddf..8da799e 100644 --- a/examples/declarative/toys/dynamicscene/qml/Button.qml +++ b/examples/declarative/toys/dynamicscene/qml/Button.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: container diff --git a/examples/declarative/toys/dynamicscene/qml/GenericSceneItem.qml b/examples/declarative/toys/dynamicscene/qml/GenericSceneItem.qml index fa976c1..7391412 100644 --- a/examples/declarative/toys/dynamicscene/qml/GenericSceneItem.qml +++ b/examples/declarative/toys/dynamicscene/qml/GenericSceneItem.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Image { property bool created: false diff --git a/examples/declarative/toys/dynamicscene/qml/PaletteItem.qml b/examples/declarative/toys/dynamicscene/qml/PaletteItem.qml index 1c31f71..cf5395f 100644 --- a/examples/declarative/toys/dynamicscene/qml/PaletteItem.qml +++ b/examples/declarative/toys/dynamicscene/qml/PaletteItem.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "itemCreation.js" as Code Image { diff --git a/examples/declarative/toys/dynamicscene/qml/PerspectiveItem.qml b/examples/declarative/toys/dynamicscene/qml/PerspectiveItem.qml index 9b6f243..6536df3 100644 --- a/examples/declarative/toys/dynamicscene/qml/PerspectiveItem.qml +++ b/examples/declarative/toys/dynamicscene/qml/PerspectiveItem.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Image { id: rootItem diff --git a/examples/declarative/toys/dynamicscene/qml/Sun.qml b/examples/declarative/toys/dynamicscene/qml/Sun.qml index eb24285..5b28b39 100644 --- a/examples/declarative/toys/dynamicscene/qml/Sun.qml +++ b/examples/declarative/toys/dynamicscene/qml/Sun.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Image { id: sun diff --git a/examples/declarative/toys/tic-tac-toe/content/Button.qml b/examples/declarative/toys/tic-tac-toe/content/Button.qml index 2d30a03..403d587 100644 --- a/examples/declarative/toys/tic-tac-toe/content/Button.qml +++ b/examples/declarative/toys/tic-tac-toe/content/Button.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: container diff --git a/examples/declarative/toys/tic-tac-toe/content/TicTac.qml b/examples/declarative/toys/tic-tac-toe/content/TicTac.qml index 0ca5350..7e50736 100644 --- a/examples/declarative/toys/tic-tac-toe/content/TicTac.qml +++ b/examples/declarative/toys/tic-tac-toe/content/TicTac.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { signal clicked diff --git a/examples/declarative/toys/tic-tac-toe/tic-tac-toe.qml b/examples/declarative/toys/tic-tac-toe/tic-tac-toe.qml index 12b0fda..4c1ad51 100644 --- a/examples/declarative/toys/tic-tac-toe/tic-tac-toe.qml +++ b/examples/declarative/toys/tic-tac-toe/tic-tac-toe.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "content" import "content/tic-tac-toe.js" as Logic diff --git a/examples/declarative/toys/tvtennis/tvtennis.qml b/examples/declarative/toys/tvtennis/tvtennis.qml index 53c95c0..805666d 100644 --- a/examples/declarative/toys/tvtennis/tvtennis.qml +++ b/examples/declarative/toys/tvtennis/tvtennis.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: page diff --git a/examples/declarative/tutorials/extending/chapter1-basics/app.qml b/examples/declarative/tutorials/extending/chapter1-basics/app.qml index 826bea9..85bd779 100644 --- a/examples/declarative/tutorials/extending/chapter1-basics/app.qml +++ b/examples/declarative/tutorials/extending/chapter1-basics/app.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] import Charts 1.0 -import Qt 4.7 +import QtQuick 1.0 Item { width: 300; height: 200 diff --git a/examples/declarative/tutorials/extending/chapter2-methods/app.qml b/examples/declarative/tutorials/extending/chapter2-methods/app.qml index 50051b6..185b830 100644 --- a/examples/declarative/tutorials/extending/chapter2-methods/app.qml +++ b/examples/declarative/tutorials/extending/chapter2-methods/app.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] import Charts 1.0 -import Qt 4.7 +import QtQuick 1.0 Item { width: 300; height: 200 diff --git a/examples/declarative/tutorials/extending/chapter3-bindings/app.qml b/examples/declarative/tutorials/extending/chapter3-bindings/app.qml index e183b27..a4822d3 100644 --- a/examples/declarative/tutorials/extending/chapter3-bindings/app.qml +++ b/examples/declarative/tutorials/extending/chapter3-bindings/app.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] import Charts 1.0 -import Qt 4.7 +import QtQuick 1.0 Item { width: 300; height: 200 diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml index 6e5d3b4..80af476 100644 --- a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml +++ b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] import Charts 1.0 -import Qt 4.7 +import QtQuick 1.0 Item { width: 300; height: 200 diff --git a/examples/declarative/tutorials/extending/chapter5-listproperties/app.qml b/examples/declarative/tutorials/extending/chapter5-listproperties/app.qml index 483332c..58b099f 100644 --- a/examples/declarative/tutorials/extending/chapter5-listproperties/app.qml +++ b/examples/declarative/tutorials/extending/chapter5-listproperties/app.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] import Charts 1.0 -import Qt 4.7 +import QtQuick 1.0 Item { width: 300; height: 200 diff --git a/examples/declarative/tutorials/extending/chapter6-plugins/app.qml b/examples/declarative/tutorials/extending/chapter6-plugins/app.qml index 097da7e..639da94 100644 --- a/examples/declarative/tutorials/extending/chapter6-plugins/app.qml +++ b/examples/declarative/tutorials/extending/chapter6-plugins/app.qml @@ -37,7 +37,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { width: 300; height: 200 diff --git a/examples/declarative/tutorials/helloworld/Cell.qml b/examples/declarative/tutorials/helloworld/Cell.qml index e64aa7e..76055ab 100644 --- a/examples/declarative/tutorials/helloworld/Cell.qml +++ b/examples/declarative/tutorials/helloworld/Cell.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 //![1] Item { diff --git a/examples/declarative/tutorials/helloworld/tutorial1.qml b/examples/declarative/tutorials/helloworld/tutorial1.qml index e6c4122..83b57b8 100644 --- a/examples/declarative/tutorials/helloworld/tutorial1.qml +++ b/examples/declarative/tutorials/helloworld/tutorial1.qml @@ -40,7 +40,7 @@ //![0] //![3] -import Qt 4.7 +import QtQuick 1.0 //![3] //![1] diff --git a/examples/declarative/tutorials/helloworld/tutorial2.qml b/examples/declarative/tutorials/helloworld/tutorial2.qml index 1ffde57..1bfab92 100644 --- a/examples/declarative/tutorials/helloworld/tutorial2.qml +++ b/examples/declarative/tutorials/helloworld/tutorial2.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: page diff --git a/examples/declarative/tutorials/helloworld/tutorial3.qml b/examples/declarative/tutorials/helloworld/tutorial3.qml index af2d5d2..cc06865 100644 --- a/examples/declarative/tutorials/helloworld/tutorial3.qml +++ b/examples/declarative/tutorials/helloworld/tutorial3.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: page diff --git a/examples/declarative/tutorials/samegame/samegame1/Block.qml b/examples/declarative/tutorials/samegame/samegame1/Block.qml index db1245d..b4c4399 100644 --- a/examples/declarative/tutorials/samegame/samegame1/Block.qml +++ b/examples/declarative/tutorials/samegame/samegame1/Block.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Item { id: block diff --git a/examples/declarative/tutorials/samegame/samegame1/Button.qml b/examples/declarative/tutorials/samegame/samegame1/Button.qml index 72b18bc..a3df028 100644 --- a/examples/declarative/tutorials/samegame/samegame1/Button.qml +++ b/examples/declarative/tutorials/samegame/samegame1/Button.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: container diff --git a/examples/declarative/tutorials/samegame/samegame1/samegame.qml b/examples/declarative/tutorials/samegame/samegame1/samegame.qml index 01396fa..5cc13fd 100644 --- a/examples/declarative/tutorials/samegame/samegame1/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame1/samegame.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: screen diff --git a/examples/declarative/tutorials/samegame/samegame2/Block.qml b/examples/declarative/tutorials/samegame/samegame2/Block.qml index c271cf7..804c30f 100644 --- a/examples/declarative/tutorials/samegame/samegame2/Block.qml +++ b/examples/declarative/tutorials/samegame/samegame2/Block.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: block diff --git a/examples/declarative/tutorials/samegame/samegame2/Button.qml b/examples/declarative/tutorials/samegame/samegame2/Button.qml index 3bd3099..cbf1b54 100644 --- a/examples/declarative/tutorials/samegame/samegame2/Button.qml +++ b/examples/declarative/tutorials/samegame/samegame2/Button.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: container diff --git a/examples/declarative/tutorials/samegame/samegame2/samegame.qml b/examples/declarative/tutorials/samegame/samegame2/samegame.qml index ae1916e..11f6229 100644 --- a/examples/declarative/tutorials/samegame/samegame2/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame2/samegame.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 //![2] import "samegame.js" as SameGame //![2] diff --git a/examples/declarative/tutorials/samegame/samegame3/Block.qml b/examples/declarative/tutorials/samegame/samegame3/Block.qml index 673007e..784a6f4 100644 --- a/examples/declarative/tutorials/samegame/samegame3/Block.qml +++ b/examples/declarative/tutorials/samegame/samegame3/Block.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Item { id: block diff --git a/examples/declarative/tutorials/samegame/samegame3/Button.qml b/examples/declarative/tutorials/samegame/samegame3/Button.qml index 3bd3099..cbf1b54 100644 --- a/examples/declarative/tutorials/samegame/samegame3/Button.qml +++ b/examples/declarative/tutorials/samegame/samegame3/Button.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: container diff --git a/examples/declarative/tutorials/samegame/samegame3/Dialog.qml b/examples/declarative/tutorials/samegame/samegame3/Dialog.qml index ed17e5f..8554d86 100644 --- a/examples/declarative/tutorials/samegame/samegame3/Dialog.qml +++ b/examples/declarative/tutorials/samegame/samegame3/Dialog.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: container diff --git a/examples/declarative/tutorials/samegame/samegame3/samegame.qml b/examples/declarative/tutorials/samegame/samegame3/samegame.qml index 2c49adc..972b778 100644 --- a/examples/declarative/tutorials/samegame/samegame3/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame3/samegame.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 import "samegame.js" as SameGame Rectangle { diff --git a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml index 8e3ca96..326b1b8 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.particles 1.0 Item { diff --git a/examples/declarative/tutorials/samegame/samegame4/content/Button.qml b/examples/declarative/tutorials/samegame/samegame4/content/Button.qml index 3bd3099..cbf1b54 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/Button.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/Button.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: container diff --git a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml index 5c81929..c390202 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 //![0] Rectangle { diff --git a/examples/declarative/tutorials/samegame/samegame4/samegame.qml b/examples/declarative/tutorials/samegame/samegame4/samegame.qml index 4fec71b..e830635 100644 --- a/examples/declarative/tutorials/samegame/samegame4/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame4/samegame.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "content" import "content/samegame.js" as SameGame diff --git a/examples/declarative/ui-components/dialcontrol/content/Dial.qml b/examples/declarative/ui-components/dialcontrol/content/Dial.qml index ed1b04d..2f1d27a 100644 --- a/examples/declarative/ui-components/dialcontrol/content/Dial.qml +++ b/examples/declarative/ui-components/dialcontrol/content/Dial.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: root diff --git a/examples/declarative/ui-components/dialcontrol/content/QuitButton.qml b/examples/declarative/ui-components/dialcontrol/content/QuitButton.qml index 9dfe9bd..cbbf916 100644 --- a/examples/declarative/ui-components/dialcontrol/content/QuitButton.qml +++ b/examples/declarative/ui-components/dialcontrol/content/QuitButton.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Image { source: "quit.png" scale: quitMouse.pressed ? 0.8 : 1.0 @@ -49,4 +49,4 @@ Image { anchors.margins: -10 onClicked: Qt.quit() } -} \ No newline at end of file +} diff --git a/examples/declarative/ui-components/dialcontrol/dialcontrol.qml b/examples/declarative/ui-components/dialcontrol/dialcontrol.qml index ed8c7d6..c66dcdd 100644 --- a/examples/declarative/ui-components/dialcontrol/dialcontrol.qml +++ b/examples/declarative/ui-components/dialcontrol/dialcontrol.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //! [imports] -import Qt 4.7 +import QtQuick 1.0 import "content" //! [imports] diff --git a/examples/declarative/ui-components/flipable/content/Card.qml b/examples/declarative/ui-components/flipable/content/Card.qml index d22fa7d..32c4ed1 100644 --- a/examples/declarative/ui-components/flipable/content/Card.qml +++ b/examples/declarative/ui-components/flipable/content/Card.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Flipable { id: container diff --git a/examples/declarative/ui-components/flipable/flipable.qml b/examples/declarative/ui-components/flipable/flipable.qml index 0f775e5..51867f9 100644 --- a/examples/declarative/ui-components/flipable/flipable.qml +++ b/examples/declarative/ui-components/flipable/flipable.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "content" Rectangle { diff --git a/examples/declarative/ui-components/progressbar/content/ProgressBar.qml b/examples/declarative/ui-components/progressbar/content/ProgressBar.qml index f830f95..e92342a 100644 --- a/examples/declarative/ui-components/progressbar/content/ProgressBar.qml +++ b/examples/declarative/ui-components/progressbar/content/ProgressBar.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: progressbar diff --git a/examples/declarative/ui-components/progressbar/main.qml b/examples/declarative/ui-components/progressbar/main.qml index c92e586..a805a7e 100644 --- a/examples/declarative/ui-components/progressbar/main.qml +++ b/examples/declarative/ui-components/progressbar/main.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "content" Rectangle { diff --git a/examples/declarative/ui-components/scrollbar/ScrollBar.qml b/examples/declarative/ui-components/scrollbar/ScrollBar.qml index ee8e9fa..faa501a 100644 --- a/examples/declarative/ui-components/scrollbar/ScrollBar.qml +++ b/examples/declarative/ui-components/scrollbar/ScrollBar.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: scrollBar diff --git a/examples/declarative/ui-components/scrollbar/main.qml b/examples/declarative/ui-components/scrollbar/main.qml index 930c3b8..b5c1a8f 100644 --- a/examples/declarative/ui-components/scrollbar/main.qml +++ b/examples/declarative/ui-components/scrollbar/main.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 640 diff --git a/examples/declarative/ui-components/searchbox/SearchBox.qml b/examples/declarative/ui-components/searchbox/SearchBox.qml index 60fa799..685552a 100644 --- a/examples/declarative/ui-components/searchbox/SearchBox.qml +++ b/examples/declarative/ui-components/searchbox/SearchBox.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 FocusScope { id: focusScope diff --git a/examples/declarative/ui-components/searchbox/main.qml b/examples/declarative/ui-components/searchbox/main.qml index 513c298..09b1829 100644 --- a/examples/declarative/ui-components/searchbox/main.qml +++ b/examples/declarative/ui-components/searchbox/main.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: page diff --git a/examples/declarative/ui-components/slideswitch/content/Switch.qml b/examples/declarative/ui-components/slideswitch/content/Switch.qml index 9632fd6..06d7a2b 100644 --- a/examples/declarative/ui-components/slideswitch/content/Switch.qml +++ b/examples/declarative/ui-components/slideswitch/content/Switch.qml @@ -39,7 +39,7 @@ ****************************************************************************/ //![0] -import Qt 4.7 +import QtQuick 1.0 Item { id: toggleswitch diff --git a/examples/declarative/ui-components/slideswitch/slideswitch.qml b/examples/declarative/ui-components/slideswitch/slideswitch.qml index a0a0eb2..0472f9f 100644 --- a/examples/declarative/ui-components/slideswitch/slideswitch.qml +++ b/examples/declarative/ui-components/slideswitch/slideswitch.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "content" Rectangle { diff --git a/examples/declarative/ui-components/spinner/content/Spinner.qml b/examples/declarative/ui-components/spinner/content/Spinner.qml index 910efb9..853c787 100644 --- a/examples/declarative/ui-components/spinner/content/Spinner.qml +++ b/examples/declarative/ui-components/spinner/content/Spinner.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Image { property alias model: view.model diff --git a/examples/declarative/ui-components/spinner/main.qml b/examples/declarative/ui-components/spinner/main.qml index a196e72..416950f 100644 --- a/examples/declarative/ui-components/spinner/main.qml +++ b/examples/declarative/ui-components/spinner/main.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "content" Rectangle { diff --git a/examples/declarative/ui-components/tabwidget/TabWidget.qml b/examples/declarative/ui-components/tabwidget/TabWidget.qml index 30eba68..f066fd2 100644 --- a/examples/declarative/ui-components/tabwidget/TabWidget.qml +++ b/examples/declarative/ui-components/tabwidget/TabWidget.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { id: tabWidget diff --git a/examples/declarative/ui-components/tabwidget/main.qml b/examples/declarative/ui-components/tabwidget/main.qml index b9ca2a1..842ef1a 100644 --- a/examples/declarative/ui-components/tabwidget/main.qml +++ b/examples/declarative/ui-components/tabwidget/main.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 TabWidget { id: tabs diff --git a/examples/declarative/xml/xmlhttprequest/xmlhttprequest-example.qml b/examples/declarative/xml/xmlhttprequest/xmlhttprequest-example.qml index f77e1de..78f93b5 100644 --- a/examples/declarative/xml/xmlhttprequest/xmlhttprequest-example.qml +++ b/examples/declarative/xml/xmlhttprequest/xmlhttprequest-example.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 350; height: 400 diff --git a/examples/tutorials/gettingStarted/gsQml/core/button.qml b/examples/tutorials/gettingStarted/gsQml/core/button.qml index dd5dcad..0b42bd1 100644 --- a/examples/tutorials/gettingStarted/gsQml/core/button.qml +++ b/examples/tutorials/gettingStarted/gsQml/core/button.qml @@ -39,7 +39,7 @@ ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { //identifier of the item @@ -105,4 +105,4 @@ Rectangle { //Animate the scale property change Behavior on scale { NumberAnimation{ duration: 55 } } -} \ No newline at end of file +} diff --git a/examples/tutorials/gettingStarted/gsQml/core/editMenu.qml b/examples/tutorials/gettingStarted/gsQml/core/editMenu.qml index 7f47d9f..5cf8472 100644 --- a/examples/tutorials/gettingStarted/gsQml/core/editMenu.qml +++ b/examples/tutorials/gettingStarted/gsQml/core/editMenu.qml @@ -39,7 +39,7 @@ ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: editMenu @@ -102,4 +102,4 @@ Rectangle { } } } -} \ No newline at end of file +} diff --git a/examples/tutorials/gettingStarted/gsQml/core/fileDialog.qml b/examples/tutorials/gettingStarted/gsQml/core/fileDialog.qml index 425f717..7004b63 100644 --- a/examples/tutorials/gettingStarted/gsQml/core/fileDialog.qml +++ b/examples/tutorials/gettingStarted/gsQml/core/fileDialog.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id:dialog @@ -160,4 +160,4 @@ Rectangle { GradientStop { position: 1.0; color: "#03333333" } } } -} \ No newline at end of file +} diff --git a/examples/tutorials/gettingStarted/gsQml/core/fileMenu.qml b/examples/tutorials/gettingStarted/gsQml/core/fileMenu.qml index afe48c7..517c1811 100644 --- a/examples/tutorials/gettingStarted/gsQml/core/fileMenu.qml +++ b/examples/tutorials/gettingStarted/gsQml/core/fileMenu.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: fileMenu diff --git a/examples/tutorials/gettingStarted/gsQml/core/menuBar.qml b/examples/tutorials/gettingStarted/gsQml/core/menuBar.qml index 0695772..bcab2fb 100644 --- a/examples/tutorials/gettingStarted/gsQml/core/menuBar.qml +++ b/examples/tutorials/gettingStarted/gsQml/core/menuBar.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: menuBar diff --git a/examples/tutorials/gettingStarted/gsQml/core/textArea.qml b/examples/tutorials/gettingStarted/gsQml/core/textArea.qml index 6d3d214..2b327fc 100644 --- a/examples/tutorials/gettingStarted/gsQml/core/textArea.qml +++ b/examples/tutorials/gettingStarted/gsQml/core/textArea.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id:textArea @@ -84,4 +84,4 @@ Rectangle { selectByMouse: true } } -} \ No newline at end of file +} diff --git a/examples/tutorials/gettingStarted/gsQml/texteditor.qml b/examples/tutorials/gettingStarted/gsQml/texteditor.qml index 5a75e0b..b50dc25 100644 --- a/examples/tutorials/gettingStarted/gsQml/texteditor.qml +++ b/examples/tutorials/gettingStarted/gsQml/texteditor.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "core" Rectangle { diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 230169d..3c2f0a8 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -101,7 +101,7 @@ QT_BEGIN_NAMESPACE The following example moves the Y axis of the \l Rectangle elements while still allowing the \l Row element to lay the items out as if they had not been transformed: \qml - import Qt 4.7 + import QtQuick 1.0 Row { Rectangle { diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 3ac095c..6f5608a 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -1422,7 +1422,7 @@ void QDeclarativeTextEditPrivate::updateDefaultTextOption() Only relevant on platforms, which provide virtual keyboards. \code - import Qt 4.7 + import QtQuick 1.0 TextEdit { id: textEdit text: "Hello world!" @@ -1473,7 +1473,7 @@ void QDeclarativeTextEdit::openSoftwareInputPanel() Only relevant on platforms, which provide virtual keyboards. \code - import Qt 4.7 + import QtQuick 1.0 TextEdit { id: textEdit text: "Hello world!" diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 5604b82..4817999 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -651,7 +651,7 @@ void QDeclarativeTextInput::setAutoScroll(bool b) input of integers between 11 and 31 into the text input: \code - import Qt 4.7 + import QtQuick 1.0 TextInput{ validator: IntValidator{bottom: 11; top: 31;} focus: true @@ -1334,7 +1334,7 @@ void QDeclarativeTextInput::moveCursorSelection(int position) Only relevant on platforms, which provide virtual keyboards. \qml - import Qt 4.7 + import QtQuick 1.0 TextInput { id: textInput text: "Hello world!" @@ -1385,7 +1385,7 @@ void QDeclarativeTextInput::openSoftwareInputPanel() Only relevant on platforms, which provide virtual keyboards. \qml - import Qt 4.7 + import QtQuick 1.0 TextInput { id: textInput text: "Hello world!" diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 01cd652..bbd6e11 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -142,7 +142,7 @@ public: The example below places three colored rectangles in a ListView. \code - import Qt 4.7 + import QtQuick 1.0 Rectangle { VisualItemModel { diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 8c5fd3a..90d38b3 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -1286,7 +1286,7 @@ bool QDeclarativeCompiler::buildSubObject(Object *obj, const BindingContext &ctx int QDeclarativeCompiler::componentTypeRef() { - QDeclarativeType *t = QDeclarativeMetaType::qmlType("Qt/Component",4,7); + QDeclarativeType *t = QDeclarativeMetaType::qmlType("QtQuick/Component",1,0); for (int ii = output->types.count() - 1; ii >= 0; --ii) { if (output->types.at(ii).type == t) return ii; diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index 7f58166..b532b0c 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -78,7 +78,7 @@ class QByteArray; For example, if there is a \c main.qml file like this: \qml - import Qt 4.7 + import QtQuick 1.0 Item { width: 200 diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp index de45a95..59d5cfa 100644 --- a/src/declarative/qml/qdeclarativecontext.cpp +++ b/src/declarative/qml/qdeclarativecontext.cpp @@ -85,7 +85,7 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() context->setContextProperty("myModel", &modelData); QDeclarativeComponent component(&engine); - component.setData("import Qt 4.7\nListView { model: myModel }", QUrl()); + component.setData("import QtQuick 1.0\nListView { model: myModel }", QUrl()); component.create(context); \endcode @@ -112,7 +112,7 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() context->setContextObject(&myDataSet); QDeclarativeComponent component(&engine); - component.setData("import Qt 4.7\nListView { model: myModel }", QUrl()); + component.setData("import QtQuick 1.0\nListView { model: myModel }", QUrl()); component.create(context); \endcode diff --git a/src/declarative/qml/qdeclarativedom.cpp b/src/declarative/qml/qdeclarativedom.cpp index 1a9b501..fa79425 100644 --- a/src/declarative/qml/qdeclarativedom.cpp +++ b/src/declarative/qml/qdeclarativedom.cpp @@ -896,7 +896,7 @@ QByteArray QDeclarativeDomObject::customTypeData() const */ bool QDeclarativeDomObject::isComponent() const { - return (d->object && d->object->typeName == "Qt/Component"); + return (d->object && (d->object->typeName == "Qt/Component" || d->object->typeName == "QtQuick/Component")); } /*! diff --git a/src/declarative/qml/qdeclarativeexpression.cpp b/src/declarative/qml/qdeclarativeexpression.cpp index 6fc4df0..77a1ba4 100644 --- a/src/declarative/qml/qdeclarativeexpression.cpp +++ b/src/declarative/qml/qdeclarativeexpression.cpp @@ -202,7 +202,7 @@ QScriptValue QDeclarativeExpressionPrivate::evalInObjectScope(QDeclarativeContex For example, given a file \c main.qml like this: \qml - import Qt 4.7 + import QtQuick 1.0 Item { width: 200; height: 200 diff --git a/src/declarative/util/qdeclarativefontloader.cpp b/src/declarative/util/qdeclarativefontloader.cpp index 6879494..3e4a81a 100644 --- a/src/declarative/util/qdeclarativefontloader.cpp +++ b/src/declarative/util/qdeclarativefontloader.cpp @@ -157,7 +157,7 @@ QHash QDeclarativeFontLoaderPrivate::fonts; For example: \qml - import Qt 4.7 + import QtQuick 1.0 Column { FontLoader { id: fixedFont; name: "Courier" } diff --git a/src/declarative/util/qdeclarativetimer.cpp b/src/declarative/util/qdeclarativetimer.cpp index 56320e6..c240f22 100644 --- a/src/declarative/util/qdeclarativetimer.cpp +++ b/src/declarative/util/qdeclarativetimer.cpp @@ -82,7 +82,7 @@ public: object to access the current time. \qml - import Qt 4.7 + import QtQuick 1.0 Item { Timer { diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index f0ed80b..24edc89 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -531,7 +531,7 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty(animationComponent.create()); @@ -685,7 +685,7 @@ void tst_qdeclarativeanimations::easingProperties() { QDeclarativeEngine engine; - QString componentStr = "import Qt 4.7\nPropertyAnimation { easing.type: \"OutBounce\"; easing.amplitude: 5.0 }"; + QString componentStr = "import QtQuick 1.0\nPropertyAnimation { easing.type: \"OutBounce\"; easing.amplitude: 5.0 }"; QDeclarativeComponent animationComponent(&engine); animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativePropertyAnimation *animObject = qobject_cast(animationComponent.create()); @@ -697,7 +697,7 @@ void tst_qdeclarativeanimations::easingProperties() { QDeclarativeEngine engine; - QString componentStr = "import Qt 4.7\nPropertyAnimation { easing.type: \"OutElastic\"; easing.amplitude: 5.0; easing.period: 3.0}"; + QString componentStr = "import QtQuick 1.0\nPropertyAnimation { easing.type: \"OutElastic\"; easing.amplitude: 5.0; easing.period: 3.0}"; QDeclarativeComponent animationComponent(&engine); animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativePropertyAnimation *animObject = qobject_cast(animationComponent.create()); @@ -710,7 +710,7 @@ void tst_qdeclarativeanimations::easingProperties() { QDeclarativeEngine engine; - QString componentStr = "import Qt 4.7\nPropertyAnimation { easing.type: \"InOutBack\"; easing.overshoot: 2 }"; + QString componentStr = "import QtQuick 1.0\nPropertyAnimation { easing.type: \"InOutBack\"; easing.overshoot: 2 }"; QDeclarativeComponent animationComponent(&engine); animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativePropertyAnimation *animObject = qobject_cast(animationComponent.create()); diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml b/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml index 62e6be5..a452447 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400 height: 400 diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/color.qml b/tests/auto/declarative/qdeclarativebehaviors/data/color.qml index e075bd0..c4b783a 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/color.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/color.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400 height: 400 diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/cpptrigger.qml b/tests/auto/declarative/qdeclarativebehaviors/data/cpptrigger.qml index c766f42..88ddfaa 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/cpptrigger.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/cpptrigger.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400 height: 400 diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/disabled.qml b/tests/auto/declarative/qdeclarativebehaviors/data/disabled.qml index e1f4699..f6cfa5e 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/disabled.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/disabled.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400 height: 400 diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/dontStart.qml b/tests/auto/declarative/qdeclarativebehaviors/data/dontStart.qml index c0f4eac..e318dd2 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/dontStart.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/dontStart.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: wrapper diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/empty.qml b/tests/auto/declarative/qdeclarativebehaviors/data/empty.qml index b58e332..6c78a84 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/empty.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/empty.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400 height: 400 diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/explicit.qml b/tests/auto/declarative/qdeclarativebehaviors/data/explicit.qml index 0b5d00b..3baa1ac 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/explicit.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/explicit.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400 height: 400 diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty.qml b/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty.qml index 6eb0729..ddb5bbd 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400 height: 400 diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty2.qml b/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty2.qml index 42b80a5..c0b71cd 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty2.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400 height: 400 diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/groupedPropertyCrash.qml b/tests/auto/declarative/qdeclarativebehaviors/data/groupedPropertyCrash.qml index c052366..8aa590b 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/groupedPropertyCrash.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/groupedPropertyCrash.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 200 diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/loop.qml b/tests/auto/declarative/qdeclarativebehaviors/data/loop.qml index 9e328d6..76379c0 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/loop.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/loop.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400 height: 400 diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/nonSelecting2.qml b/tests/auto/declarative/qdeclarativebehaviors/data/nonSelecting2.qml index 5857c4d..c5c78d1 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/nonSelecting2.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/nonSelecting2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400 height: 400 diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/parent.qml b/tests/auto/declarative/qdeclarativebehaviors/data/parent.qml index e3fd77d..d19da29 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/parent.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/parent.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400 height: 400 diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml b/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml index d41add3..03b5421 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 200 diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml b/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml index 4528cce..9fca5c3 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400 height: 400 diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/runningTrue.qml b/tests/auto/declarative/qdeclarativebehaviors/data/runningTrue.qml index d439875..25cdf10 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/runningTrue.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/runningTrue.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: root diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml b/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml index f2f6352..c05cdaa 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400 height: 400 diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/simple.qml b/tests/auto/declarative/qdeclarativebehaviors/data/simple.qml index de27f69..6ba0118 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/simple.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/simple.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400 height: 400 diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/startup.qml b/tests/auto/declarative/qdeclarativebehaviors/data/startup.qml index f3ff620..fca416c 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/startup.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/startup.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400 diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/startup2.qml b/tests/auto/declarative/qdeclarativebehaviors/data/startup2.qml index 1911cc4..eb62761 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/startup2.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/startup2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 800; diff --git a/tests/auto/declarative/qdeclarativebinding/data/test-binding.qml b/tests/auto/declarative/qdeclarativebinding/data/test-binding.qml index 9c619e6..9449736 100644 --- a/tests/auto/declarative/qdeclarativebinding/data/test-binding.qml +++ b/tests/auto/declarative/qdeclarativebinding/data/test-binding.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: screen diff --git a/tests/auto/declarative/qdeclarativebinding/data/test-binding2.qml b/tests/auto/declarative/qdeclarativebinding/data/test-binding2.qml index e0f1811..3e99e2b 100644 --- a/tests/auto/declarative/qdeclarativebinding/data/test-binding2.qml +++ b/tests/auto/declarative/qdeclarativebinding/data/test-binding2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: screen diff --git a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp index c77d395..2f00f60 100644 --- a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp +++ b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp @@ -94,7 +94,7 @@ tst_qdeclarativeborderimage::tst_qdeclarativeborderimage() void tst_qdeclarativeborderimage::noSource() { - QString componentStr = "import Qt 4.7\nBorderImage { source: \"\" }"; + QString componentStr = "import QtQuick 1.0\nBorderImage { source: \"\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast(component.create()); @@ -138,7 +138,7 @@ void tst_qdeclarativeborderimage::imageSource() if (!error.isEmpty()) QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); - QString componentStr = "import Qt 4.7\nBorderImage { source: \"" + source + "\" }"; + QString componentStr = "import QtQuick 1.0\nBorderImage { source: \"" + source + "\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast(component.create()); @@ -165,7 +165,7 @@ void tst_qdeclarativeborderimage::imageSource() void tst_qdeclarativeborderimage::clearSource() { - QString componentStr = "import Qt 4.7\nBorderImage { source: srcImage }"; + QString componentStr = "import QtQuick 1.0\nBorderImage { source: srcImage }"; QDeclarativeContext *ctxt = engine.rootContext(); ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png")); QDeclarativeComponent component(&engine); @@ -185,7 +185,7 @@ void tst_qdeclarativeborderimage::clearSource() void tst_qdeclarativeborderimage::resized() { - QString componentStr = "import Qt 4.7\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() + "\"; width: 300; height: 300 }"; + QString componentStr = "import QtQuick 1.0\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() + "\"; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast(component.create()); @@ -200,7 +200,7 @@ void tst_qdeclarativeborderimage::resized() void tst_qdeclarativeborderimage::smooth() { - QString componentStr = "import Qt 4.7\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; + QString componentStr = "import QtQuick 1.0\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast(component.create()); @@ -217,7 +217,7 @@ void tst_qdeclarativeborderimage::smooth() void tst_qdeclarativeborderimage::tileModes() { { - QString componentStr = "import Qt 4.7\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 100; height: 300; horizontalTileMode: BorderImage.Repeat; verticalTileMode: BorderImage.Repeat }"; + QString componentStr = "import QtQuick 1.0\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 100; height: 300; horizontalTileMode: BorderImage.Repeat; verticalTileMode: BorderImage.Repeat }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast(component.create()); @@ -230,7 +230,7 @@ void tst_qdeclarativeborderimage::tileModes() delete obj; } { - QString componentStr = "import Qt 4.7\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 150; horizontalTileMode: BorderImage.Round; verticalTileMode: BorderImage.Round }"; + QString componentStr = "import QtQuick 1.0\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 150; horizontalTileMode: BorderImage.Round; verticalTileMode: BorderImage.Round }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast(component.create()); @@ -257,7 +257,7 @@ void tst_qdeclarativeborderimage::sciSource() server->serveDirectory(SRCDIR "/data"); } - QString componentStr = "import Qt 4.7\nBorderImage { source: \"" + source + "\"; width: 300; height: 300 }"; + QString componentStr = "import QtQuick 1.0\nBorderImage { source: \"" + source + "\"; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast(component.create()); @@ -302,7 +302,7 @@ void tst_qdeclarativeborderimage::invalidSciFile() QTest::ignoreMessage(QtWarningMsg, "QDeclarativeGridScaledImage: Invalid tile rule specified. Using Stretch."); // for "Roun" QTest::ignoreMessage(QtWarningMsg, "QDeclarativeGridScaledImage: Invalid tile rule specified. Using Stretch."); // for "Repea" - QString componentStr = "import Qt 4.7\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/invalid.sci").toString() +"\"; width: 300; height: 300 }"; + QString componentStr = "import QtQuick 1.0\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/invalid.sci").toString() +"\"; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast(component.create()); @@ -320,7 +320,7 @@ void tst_qdeclarativeborderimage::pendingRemoteRequest() { QFETCH(QString, source); - QString componentStr = "import Qt 4.7\nBorderImage { source: \"" + source + "\" }"; + QString componentStr = "import QtQuick 1.0\nBorderImage { source: \"" + source + "\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast(component.create()); diff --git a/tests/auto/declarative/qdeclarativecomponent/data/createObject.qml b/tests/auto/declarative/qdeclarativecomponent/data/createObject.qml index 4ee1e75..4a06791 100644 --- a/tests/auto/declarative/qdeclarativecomponent/data/createObject.qml +++ b/tests/auto/declarative/qdeclarativecomponent/data/createObject.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item{ id: root diff --git a/tests/auto/declarative/qdeclarativeconnection/data/connection-targetchange.qml b/tests/auto/declarative/qdeclarativeconnection/data/connection-targetchange.qml index bb9a3bc..dd92cb9 100644 --- a/tests/auto/declarative/qdeclarativeconnection/data/connection-targetchange.qml +++ b/tests/auto/declarative/qdeclarativeconnection/data/connection-targetchange.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { Component { diff --git a/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals-ignored.qml b/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals-ignored.qml index 764d5ab..459c346 100644 --- a/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals-ignored.qml +++ b/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals-ignored.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { id: screen diff --git a/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals-notarget.qml b/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals-notarget.qml index 09e7812..8eddf43 100644 --- a/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals-notarget.qml +++ b/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals-notarget.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { id: screen diff --git a/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals-parent.qml b/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals-parent.qml index 478503d..953347a 100644 --- a/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals-parent.qml +++ b/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals-parent.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { id: screen diff --git a/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals.qml b/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals.qml index d4e8d7e..3702bdb 100644 --- a/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals.qml +++ b/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { id: screen diff --git a/tests/auto/declarative/qdeclarativeconnection/data/test-connection.qml b/tests/auto/declarative/qdeclarativeconnection/data/test-connection.qml index 954ca97..c599083 100644 --- a/tests/auto/declarative/qdeclarativeconnection/data/test-connection.qml +++ b/tests/auto/declarative/qdeclarativeconnection/data/test-connection.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { id: screen; width: 50 diff --git a/tests/auto/declarative/qdeclarativeconnection/data/test-connection2.qml b/tests/auto/declarative/qdeclarativeconnection/data/test-connection2.qml index 9e5a99c..f0dbaba 100644 --- a/tests/auto/declarative/qdeclarativeconnection/data/test-connection2.qml +++ b/tests/auto/declarative/qdeclarativeconnection/data/test-connection2.qml @@ -1,3 +1,3 @@ -import Qt 4.7 +import QtQuick 1.0 Connections { id: connection; target: connection; onTargetChanged: 1 == 1 } diff --git a/tests/auto/declarative/qdeclarativeconnection/data/test-connection3.qml b/tests/auto/declarative/qdeclarativeconnection/data/test-connection3.qml index 51efde6..94c9c7c 100644 --- a/tests/auto/declarative/qdeclarativeconnection/data/test-connection3.qml +++ b/tests/auto/declarative/qdeclarativeconnection/data/test-connection3.qml @@ -1,3 +1,3 @@ -import Qt 4.7 +import QtQuick 1.0 Connections {} diff --git a/tests/auto/declarative/qdeclarativeconnection/data/trimming.qml b/tests/auto/declarative/qdeclarativeconnection/data/trimming.qml index 361474c..00507d9 100644 --- a/tests/auto/declarative/qdeclarativeconnection/data/trimming.qml +++ b/tests/auto/declarative/qdeclarativeconnection/data/trimming.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { id: screen; width: 50 diff --git a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp index 605cf8e..100224b 100644 --- a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp +++ b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp @@ -233,7 +233,7 @@ private: #define TEST_CONTEXT_PROPERTY(ctxt, name, value) \ { \ QDeclarativeComponent component(&engine); \ - component.setData("import Qt 4.7; QtObject { property variant test: " #name " }", QUrl()); \ + component.setData("import QtQuick 1.0; QtObject { property variant test: " #name " }", QUrl()); \ \ QObject *obj = component.create(ctxt); \ \ @@ -283,7 +283,7 @@ void tst_qdeclarativecontext::setContextProperty() // Changes in context properties { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.7; QtObject { property variant test: a }", QUrl()); + component.setData("import QtQuick 1.0; QtObject { property variant test: a }", QUrl()); QObject *obj = component.create(&ctxt2); @@ -295,7 +295,7 @@ void tst_qdeclarativecontext::setContextProperty() } { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.7; QtObject { property variant test: b }", QUrl()); + component.setData("import QtQuick 1.0; QtObject { property variant test: b }", QUrl()); QObject *obj = component.create(&ctxt2); @@ -309,7 +309,7 @@ void tst_qdeclarativecontext::setContextProperty() } { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.7; QtObject { property variant test: e.a }", QUrl()); + component.setData("import QtQuick 1.0; QtObject { property variant test: e.a }", QUrl()); QObject *obj = component.create(&ctxt2); @@ -323,7 +323,7 @@ void tst_qdeclarativecontext::setContextProperty() // New context properties { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.7; QtObject { property variant test: a }", QUrl()); + component.setData("import QtQuick 1.0; QtObject { property variant test: a }", QUrl()); QObject *obj = component.create(&ctxt2); @@ -337,7 +337,7 @@ void tst_qdeclarativecontext::setContextProperty() // Setting an object-variant context property { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.7; QtObject { id: root; property int a: 10; property int test: ctxtProp.a; property variant obj: root; }", QUrl()); + component.setData("import QtQuick 1.0; QtObject { id: root; property int a: 10; property int test: ctxtProp.a; property variant obj: root; }", QUrl()); QDeclarativeContext ctxt(engine.rootContext()); ctxt.setContextProperty("ctxtProp", QVariant()); @@ -385,7 +385,7 @@ void tst_qdeclarativecontext::setContextObject() // Changes in context properties { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.7; QtObject { property variant test: a }", QUrl()); + component.setData("import QtQuick 1.0; QtObject { property variant test: a }", QUrl()); QObject *obj = component.create(&ctxt); @@ -417,7 +417,7 @@ void tst_qdeclarativecontext::destruction() void tst_qdeclarativecontext::idAsContextProperty() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.7; QtObject { property variant a; a: QtObject { id: myObject } }", QUrl()); + component.setData("import QtQuick 1.0; QtObject { property variant a; a: QtObject { id: myObject } }", QUrl()); QObject *obj = component.create(); QVERIFY(obj); @@ -437,7 +437,7 @@ void tst_qdeclarativecontext::idAsContextProperty() void tst_qdeclarativecontext::readOnlyContexts() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.7; QtObject { id: me }", QUrl()); + component.setData("import QtQuick 1.0; QtObject { id: me }", QUrl()); QObject *obj = component.create(); QVERIFY(obj); diff --git a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp index adba190..4a5bdf2 100644 --- a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp +++ b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp @@ -283,7 +283,7 @@ void tst_QDeclarativeDebug::initTestCase() m_engine = new QDeclarativeEngine(this); QList qml; - qml << "import Qt 4.7\n" + qml << "import QtQuick 1.0\n" "Item {" "width: 10; height: 20; scale: blueRect.scale;" "Rectangle { id: blueRect; width: 500; height: 600; color: \"blue\"; }" @@ -294,11 +294,11 @@ void tst_QDeclarativeDebug::initTestCase() "}"; // add second component to test multiple root contexts - qml << "import Qt 4.7\n" + qml << "import QtQuick 1.0\n" "Item {}"; // and a third to test methods - qml << "import Qt 4.7\n" + qml << "import QtQuick 1.0\n" "Item {" "function myMethodNoArgs() { return 3; }\n" "function myMethod(a) { return a + 9; }\n" diff --git a/tests/auto/declarative/qdeclarativedom/data/MyComponent.qml b/tests/auto/declarative/qdeclarativedom/data/MyComponent.qml index dd9e9ea..f6760b6 100644 --- a/tests/auto/declarative/qdeclarativedom/data/MyComponent.qml +++ b/tests/auto/declarative/qdeclarativedom/data/MyComponent.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { } diff --git a/tests/auto/declarative/qdeclarativedom/data/MyItem.qml b/tests/auto/declarative/qdeclarativedom/data/MyItem.qml index dd9e9ea..f6760b6 100644 --- a/tests/auto/declarative/qdeclarativedom/data/MyItem.qml +++ b/tests/auto/declarative/qdeclarativedom/data/MyItem.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { } diff --git a/tests/auto/declarative/qdeclarativedom/data/import/Bar.qml b/tests/auto/declarative/qdeclarativedom/data/import/Bar.qml index d26b299..86a7176 100644 --- a/tests/auto/declarative/qdeclarativedom/data/import/Bar.qml +++ b/tests/auto/declarative/qdeclarativedom/data/import/Bar.qml @@ -1,2 +1,2 @@ -import Qt 4.7 +import QtQuick 1.0 diff --git a/tests/auto/declarative/qdeclarativedom/data/importlib/sublib/Foo.qml b/tests/auto/declarative/qdeclarativedom/data/importlib/sublib/Foo.qml index d26b299..86a7176 100644 --- a/tests/auto/declarative/qdeclarativedom/data/importlib/sublib/Foo.qml +++ b/tests/auto/declarative/qdeclarativedom/data/importlib/sublib/Foo.qml @@ -1,2 +1,2 @@ -import Qt 4.7 +import QtQuick 1.0 diff --git a/tests/auto/declarative/qdeclarativedom/data/top.qml b/tests/auto/declarative/qdeclarativedom/data/top.qml index 6405cd2..56ea9df 100644 --- a/tests/auto/declarative/qdeclarativedom/data/top.qml +++ b/tests/auto/declarative/qdeclarativedom/data/top.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 MyComponent { width: 100 diff --git a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp index dca5205..c61be55 100644 --- a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp +++ b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp @@ -86,7 +86,7 @@ private: void tst_qdeclarativedom::loadSimple() { - QByteArray qml = "import Qt 4.7\n" + QByteArray qml = "import QtQuick 1.0\n" "Item {}"; QDeclarativeDomDocument document; @@ -97,15 +97,15 @@ void tst_qdeclarativedom::loadSimple() QVERIFY(rootObject.isValid()); QVERIFY(!rootObject.isComponent()); QVERIFY(!rootObject.isCustomType()); - QVERIFY(rootObject.objectType() == "Qt/Item"); - QVERIFY(rootObject.objectTypeMajorVersion() == 4); - QVERIFY(rootObject.objectTypeMinorVersion() == 7); + QVERIFY(rootObject.objectType() == "QtQuick/Item"); + QVERIFY(rootObject.objectTypeMajorVersion() == 1); + QVERIFY(rootObject.objectTypeMinorVersion() == 0); } // Test regular properties void tst_qdeclarativedom::loadProperties() { - QByteArray qml = "import Qt 4.7\n" + QByteArray qml = "import QtQuick 1.0\n" "Item { id : item; x : 300; visible : true }"; QDeclarativeDomDocument document; @@ -120,7 +120,7 @@ void tst_qdeclarativedom::loadProperties() QVERIFY(xProperty.propertyName() == "x"); QCOMPARE(xProperty.propertyNameParts().count(), 1); QVERIFY(xProperty.propertyNameParts().at(0) == "x"); - QCOMPARE(xProperty.position(), 32); + QCOMPARE(xProperty.position(), 37); QCOMPARE(xProperty.length(), 1); QVERIFY(xProperty.value().isLiteral()); QVERIFY(xProperty.value().toLiteral().literal() == "300"); @@ -129,7 +129,7 @@ void tst_qdeclarativedom::loadProperties() QVERIFY(visibleProperty.propertyName() == "visible"); QCOMPARE(visibleProperty.propertyNameParts().count(), 1); QVERIFY(visibleProperty.propertyNameParts().at(0) == "visible"); - QCOMPARE(visibleProperty.position(), 41); + QCOMPARE(visibleProperty.position(), 46); QCOMPARE(visibleProperty.length(), 7); QVERIFY(visibleProperty.value().isLiteral()); QVERIFY(visibleProperty.value().toLiteral().literal() == "true"); @@ -139,7 +139,7 @@ void tst_qdeclarativedom::loadProperties() void tst_qdeclarativedom::loadGroupedProperties() { { - QByteArray qml = "import Qt 4.7\n" + QByteArray qml = "import QtQuick 1.0\n" "Item { anchors.left: parent.left; anchors.right: parent.right }"; QDeclarativeDomDocument document; @@ -166,7 +166,7 @@ void tst_qdeclarativedom::loadGroupedProperties() QCOMPARE(leftProperty.propertyNameParts().count(), 2); QVERIFY(leftProperty.propertyNameParts().at(0) == "anchors"); QVERIFY(leftProperty.propertyNameParts().at(1) == "left"); - QCOMPARE(leftProperty.position(), 21); + QCOMPARE(leftProperty.position(), 26); QCOMPARE(leftProperty.length(), 12); QVERIFY(leftProperty.value().isBinding()); QVERIFY(leftProperty.value().toBinding().binding() == "parent.left"); @@ -175,14 +175,14 @@ void tst_qdeclarativedom::loadGroupedProperties() QCOMPARE(rightProperty.propertyNameParts().count(), 2); QVERIFY(rightProperty.propertyNameParts().at(0) == "anchors"); QVERIFY(rightProperty.propertyNameParts().at(1) == "right"); - QCOMPARE(rightProperty.position(), 48); + QCOMPARE(rightProperty.position(), 53); QCOMPARE(rightProperty.length(), 13); QVERIFY(rightProperty.value().isBinding()); QVERIFY(rightProperty.value().toBinding().binding() == "parent.right"); } { - QByteArray qml = "import Qt 4.7\n" + QByteArray qml = "import QtQuick 1.0\n" "Item { \n" " anchors {\n" " left: parent.left\n" @@ -214,7 +214,7 @@ void tst_qdeclarativedom::loadGroupedProperties() QCOMPARE(leftProperty.propertyNameParts().count(), 2); QVERIFY(leftProperty.propertyNameParts().at(0) == "anchors"); QVERIFY(leftProperty.propertyNameParts().at(1) == "left"); - QCOMPARE(leftProperty.position(), 44); + QCOMPARE(leftProperty.position(), 49); QCOMPARE(leftProperty.length(), 4); QVERIFY(leftProperty.value().isBinding()); QVERIFY(leftProperty.value().toBinding().binding() == "parent.left"); @@ -223,7 +223,7 @@ void tst_qdeclarativedom::loadGroupedProperties() QCOMPARE(rightProperty.propertyNameParts().count(), 2); QVERIFY(rightProperty.propertyNameParts().at(0) == "anchors"); QVERIFY(rightProperty.propertyNameParts().at(1) == "right"); - QCOMPARE(rightProperty.position(), 70); + QCOMPARE(rightProperty.position(), 75); QCOMPARE(rightProperty.length(), 5); QVERIFY(rightProperty.value().isBinding()); QVERIFY(rightProperty.value().toBinding().binding() == "parent.right"); @@ -233,7 +233,7 @@ void tst_qdeclarativedom::loadGroupedProperties() void tst_qdeclarativedom::loadChildObject() { - QByteArray qml = "import Qt 4.7\n" + QByteArray qml = "import QtQuick 1.0\n" "Item { Item {} }"; QDeclarativeDomDocument document; @@ -252,7 +252,7 @@ void tst_qdeclarativedom::loadChildObject() QDeclarativeDomObject childItem = list.values().first().toObject(); QVERIFY(childItem.isValid()); - QVERIFY(childItem.objectType() == "Qt/Item"); + QVERIFY(childItem.objectType() == "QtQuick/Item"); } void tst_qdeclarativedom::loadComposite() @@ -278,7 +278,7 @@ void tst_qdeclarativedom::loadComposite() void tst_qdeclarativedom::testValueSource() { - QByteArray qml = "import Qt 4.7\n" + QByteArray qml = "import QtQuick 1.0\n" "Rectangle { SpringAnimation on height { spring: 1.4; damping: .15; to: Math.min(Math.max(-130, value*2.2 - 130), 133); }}"; QDeclarativeEngine freshEngine; @@ -295,7 +295,7 @@ void tst_qdeclarativedom::testValueSource() QDeclarativeDomObject valueSourceObject = valueSource.object(); QVERIFY(valueSourceObject.isValid()); - QVERIFY(valueSourceObject.objectType() == "Qt/SpringAnimation"); + QVERIFY(valueSourceObject.objectType() == "QtQuick/SpringAnimation"); const QDeclarativeDomValue springValue = valueSourceObject.property("spring").value(); QVERIFY(!springValue.isInvalid()); @@ -310,7 +310,7 @@ void tst_qdeclarativedom::testValueSource() void tst_qdeclarativedom::testValueInterceptor() { - QByteArray qml = "import Qt 4.7\n" + QByteArray qml = "import QtQuick 1.0\n" "Rectangle { Behavior on height { NumberAnimation { duration: 100 } } }"; QDeclarativeEngine freshEngine; @@ -327,7 +327,7 @@ void tst_qdeclarativedom::testValueInterceptor() QDeclarativeDomObject valueInterceptorObject = valueInterceptor.object(); QVERIFY(valueInterceptorObject.isValid()); - QVERIFY(valueInterceptorObject.objectType() == "Qt/Behavior"); + QVERIFY(valueInterceptorObject.objectType() == "QtQuick/Behavior"); const QDeclarativeDomValue animationValue = valueInterceptorObject.property("animation").value(); QVERIFY(!animationValue.isInvalid()); @@ -337,7 +337,7 @@ void tst_qdeclarativedom::testValueInterceptor() // Test QDeclarativeDomDocument::imports() void tst_qdeclarativedom::loadImports() { - QByteArray qml = "import Qt 4.7\n" + QByteArray qml = "import QtQuick 1.0\n" "import importlib.sublib 1.1\n" "import importlib.sublib 1.0 as NewFoo\n" "import 'import'\n" @@ -353,9 +353,9 @@ void tst_qdeclarativedom::loadImports() QDeclarativeDomImport import = document.imports().at(0); QCOMPARE(import.type(), QDeclarativeDomImport::Library); - QCOMPARE(import.uri(), QLatin1String("Qt")); + QCOMPARE(import.uri(), QLatin1String("QtQuick")); QCOMPARE(import.qualifier(), QString()); - QCOMPARE(import.version(), QLatin1String("4.7")); + QCOMPARE(import.version(), QLatin1String("1.0")); import = document.imports().at(1); QCOMPARE(import.type(), QDeclarativeDomImport::Library); @@ -385,7 +385,7 @@ void tst_qdeclarativedom::loadImports() // Test loading a file with errors void tst_qdeclarativedom::loadErrors() { - QByteArray qml = "import Qt 4.7\n" + QByteArray qml = "import QtQuick 1.0\n" "Item {\n" " foo: 12\n" "}"; @@ -405,7 +405,7 @@ void tst_qdeclarativedom::loadErrors() // Test loading a file with syntax errors void tst_qdeclarativedom::loadSyntaxErrors() { - QByteArray qml = "import Qt 4.7\n" + QByteArray qml = "import QtQuick 1.0\n" "asdf"; QDeclarativeDomDocument document; @@ -423,7 +423,7 @@ void tst_qdeclarativedom::loadSyntaxErrors() // Test attempting to load a file with remote references void tst_qdeclarativedom::loadRemoteErrors() { - QByteArray qml = "import Qt 4.7\n" + QByteArray qml = "import QtQuick 1.0\n" "import \"http://localhost/exampleQmlScript.js\" as Script\n" "Item {\n" "}"; @@ -443,7 +443,7 @@ void tst_qdeclarativedom::loadRemoteErrors() void tst_qdeclarativedom::loadDynamicProperty() { { - QByteArray qml = "import Qt 4.7\n" + QByteArray qml = "import QtQuick 1.0\n" "Item {\n" " property int a\n" " property bool b\n" @@ -478,20 +478,20 @@ void tst_qdeclarativedom::loadDynamicProperty() QCOMPARE(d.length(), test_length); \ } \ - DP_TEST(0, a, QVariant::Int, 25, 14, "int"); - DP_TEST(1, b, QVariant::Bool, 44, 15, "bool"); - DP_TEST(2, c, QMetaType::QReal, 64, 17, "double"); - DP_TEST(3, d, QMetaType::QReal, 86, 15, "real"); - DP_TEST(4, e, QVariant::String, 106, 17, "string"); - DP_TEST(5, f, QVariant::Url, 128, 14, "url"); - DP_TEST(6, g, QVariant::Color, 147, 16, "color"); - DP_TEST(7, h, QVariant::DateTime, 168, 15, "date"); - DP_TEST(8, i, qMetaTypeId(), 188, 18, "variant"); - DP_TEST(9, j, -1, 211, 19, "QtObject"); + DP_TEST(0, a, QVariant::Int, 30, 14, "int"); + DP_TEST(1, b, QVariant::Bool, 49, 15, "bool"); + DP_TEST(2, c, QMetaType::QReal, 69, 17, "double"); + DP_TEST(3, d, QMetaType::QReal, 91, 15, "real"); + DP_TEST(4, e, QVariant::String, 111, 17, "string"); + DP_TEST(5, f, QVariant::Url, 133, 14, "url"); + DP_TEST(6, g, QVariant::Color, 152, 16, "color"); + DP_TEST(7, h, QVariant::DateTime, 173, 15, "date"); + DP_TEST(8, i, qMetaTypeId(), 193, 18, "variant"); + DP_TEST(9, j, -1, 216, 19, "QtObject"); } { - QByteArray qml = "import Qt 4.7\n" + QByteArray qml = "import QtQuick 1.0\n" "Item {\n" " property int a: 12\n" " property int b: a + 6\n" @@ -535,7 +535,7 @@ void tst_qdeclarativedom::loadComponent() { // Explicit component { - QByteArray qml = "import Qt 4.7\n" + QByteArray qml = "import QtQuick 1.0\n" "Item {\n" " Component {\n" " id: myComponent\n" @@ -564,9 +564,9 @@ void tst_qdeclarativedom::loadComponent() QDeclarativeDomComponent component = componentObject.toComponent(); QVERIFY(component.isValid()); - QVERIFY(component.objectType() == "Qt/Component"); - QVERIFY(component.objectTypeMajorVersion() == 4); - QVERIFY(component.objectTypeMinorVersion() == 7); + QVERIFY(component.objectType() == "QtQuick/Component"); + QVERIFY(component.objectTypeMajorVersion() == 1); + QVERIFY(component.objectTypeMinorVersion() == 0); QVERIFY(component.objectClassName() == "Component"); QVERIFY(component.objectId() == "myComponent"); QVERIFY(component.properties().isEmpty()); @@ -574,7 +574,7 @@ void tst_qdeclarativedom::loadComponent() QVERIFY(component.isCustomType() == false); QVERIFY(component.customTypeData() == ""); QVERIFY(component.isComponent()); - QCOMPARE(component.position(), 25); + QCOMPARE(component.position(), 30); QCOMPARE(component.length(), 57); QVERIFY(component.componentRoot().isValid()); @@ -583,7 +583,7 @@ void tst_qdeclarativedom::loadComponent() // Implicit component { - QByteArray qml = "import Qt 4.7\n" + QByteArray qml = "import QtQuick 1.0\n" "ListView {\n" " delegate: Item {}\n" "}"; @@ -604,7 +604,7 @@ void tst_qdeclarativedom::loadComponent() QDeclarativeDomComponent component = componentObject.toComponent(); QVERIFY(component.isValid()); - QVERIFY(component.objectType() == "Qt/Component"); + QVERIFY(component.objectType() == "QtQuick/Component"); QVERIFY(component.objectClassName() == "Component"); QVERIFY(component.objectId() == ""); QVERIFY(component.properties().isEmpty()); @@ -612,7 +612,7 @@ void tst_qdeclarativedom::loadComponent() QVERIFY(component.isCustomType() == false); QVERIFY(component.customTypeData() == ""); QVERIFY(component.isComponent()); - QCOMPARE(component.position(), 39); + QCOMPARE(component.position(), 44); QCOMPARE(component.length(), 7); QVERIFY(component.componentRoot().isValid()); @@ -633,7 +633,7 @@ void tst_qdeclarativedom::object_dynamicProperty() // Valid object, no dynamic properties { - QByteArray qml = "import Qt 4.7\n" + QByteArray qml = "import QtQuick 1.0\n" "Item {}"; QDeclarativeDomDocument document; @@ -648,7 +648,7 @@ void tst_qdeclarativedom::object_dynamicProperty() // Valid object, dynamic properties { - QByteArray qml = "import Qt 4.7\n" + QByteArray qml = "import QtQuick 1.0\n" "Item {\n" " property int a\n" "}"; @@ -668,7 +668,7 @@ void tst_qdeclarativedom::object_dynamicProperty() QVERIFY(p.propertyType() == QVariant::Int); QVERIFY(p.propertyTypeName() == "int"); QVERIFY(p.isDefaultProperty() == false); - QCOMPARE(p.position(), 25); + QCOMPARE(p.position(), 30); QCOMPARE(p.length(), 14); } @@ -686,7 +686,7 @@ void tst_qdeclarativedom::object_property() // Valid object - no default { - QByteArray qml = "import Qt 4.7\n" + QByteArray qml = "import QtQuick 1.0\n" "Item {\n" " x: 10\n" " y: 12\n" @@ -709,7 +709,7 @@ void tst_qdeclarativedom::object_property() QVERIFY(x.isDefaultProperty() == false); QVERIFY(x.value().isLiteral()); QVERIFY(x.value().toLiteral().literal() == "10"); - QCOMPARE(x.position(), 25); + QCOMPARE(x.position(), 30); QCOMPARE(x.length(), 1); QDeclarativeDomProperty y = rootObject.property("y"); @@ -720,13 +720,13 @@ void tst_qdeclarativedom::object_property() QVERIFY(y.isDefaultProperty() == false); QVERIFY(y.value().isLiteral()); QVERIFY(y.value().toLiteral().literal() == "12"); - QCOMPARE(y.position(), 35); + QCOMPARE(y.position(), 40); QCOMPARE(y.length(), 1); } // Valid object - with default { - QByteArray qml = "import Qt 4.7\n" + QByteArray qml = "import QtQuick 1.0\n" "Item {\n" " x: 10\n" " y: 12\n" @@ -750,7 +750,7 @@ void tst_qdeclarativedom::object_property() QVERIFY(x.isDefaultProperty() == false); QVERIFY(x.value().isLiteral()); QVERIFY(x.value().toLiteral().literal() == "10"); - QCOMPARE(x.position(), 25); + QCOMPARE(x.position(), 30); QCOMPARE(x.length(), 1); QDeclarativeDomProperty y = rootObject.property("y"); @@ -761,7 +761,7 @@ void tst_qdeclarativedom::object_property() QVERIFY(y.isDefaultProperty() == false); QVERIFY(y.value().isLiteral()); QVERIFY(y.value().toLiteral().literal() == "12"); - QCOMPARE(y.position(), 35); + QCOMPARE(y.position(), 40); QCOMPARE(y.length(), 1); QDeclarativeDomProperty data = rootObject.property("data"); @@ -771,7 +771,7 @@ void tst_qdeclarativedom::object_property() QVERIFY(data.propertyNameParts().at(0) == "data"); QVERIFY(data.isDefaultProperty() == true); QVERIFY(data.value().isList()); - QCOMPARE(data.position(), 45); + QCOMPARE(data.position(), 50); QCOMPARE(data.length(), 0); } } @@ -787,7 +787,7 @@ void tst_qdeclarativedom::object_url() // Valid builtin object { - QByteArray qml = "import Qt 4.7\n" + QByteArray qml = "import QtQuick 1.0\n" "Item {}"; QDeclarativeDomDocument document; @@ -800,7 +800,7 @@ void tst_qdeclarativedom::object_url() // Valid composite object { - QByteArray qml = "import Qt 4.7\n" + QByteArray qml = "import QtQuick 1.0\n" "MyItem {}"; QUrl myUrl = QUrl::fromLocalFile(SRCDIR "/data/main.qml"); @@ -818,7 +818,7 @@ void tst_qdeclarativedom::object_url() // Test copy constructors and operators void tst_qdeclarativedom::copy() { - QByteArray qml = "import Qt 4.7\n" + QByteArray qml = "import QtQuick 1.0\n" "MyItem {\n" " id: myItem\n" " property int a: 10\n" @@ -1193,7 +1193,7 @@ void tst_qdeclarativedom::copy() // Tests the position/length of various elements void tst_qdeclarativedom::position() { - QByteArray qml = "import Qt 4.7\n" + QByteArray qml = "import QtQuick 1.0\n" "Item {\n" " id: myItem\n" " property int a: 10\n" @@ -1215,32 +1215,32 @@ void tst_qdeclarativedom::position() // All QDeclarativeDomDynamicProperty QDeclarativeDomDynamicProperty dynProp = root.dynamicProperty("a"); - QCOMPARE(dynProp.position(), 40); + QCOMPARE(dynProp.position(), 45); QCOMPARE(dynProp.length(), 18); // All QDeclarativeDomProperty QDeclarativeDomProperty x = root.property("x"); - QCOMPARE(x.position(), 63); + QCOMPARE(x.position(), 68); QCOMPARE(x.length(), 1); QDeclarativeDomProperty y = root.property("y"); - QCOMPARE(y.position(), 73); + QCOMPARE(y.position(), 78); QCOMPARE(y.length(), 1); QDeclarativeDomProperty z = root.property("z"); - QCOMPARE(z.position(), 106); + QCOMPARE(z.position(), 111); QCOMPARE(z.length(), 1); QDeclarativeDomProperty opacity = root.property("opacity"); - QCOMPARE(opacity.position(), 127); + QCOMPARE(opacity.position(), 132); QCOMPARE(opacity.length(), 7); QDeclarativeDomProperty data = root.property("data"); - QCOMPARE(data.position(), 142); + QCOMPARE(data.position(), 147); QCOMPARE(data.length(), 0); QDeclarativeDomProperty children = root.property("children"); - QCOMPARE(children.position(), 179); + QCOMPARE(children.position(), 184); QCOMPARE(children.length(), 8); QDeclarativeDomList dataList = data.value().toList(); @@ -1249,64 +1249,64 @@ void tst_qdeclarativedom::position() QCOMPARE(childrenList.values().count(), 2); // All QDeclarativeDomObject - QCOMPARE(root.position(), 14); + QCOMPARE(root.position(), 19); QCOMPARE(root.length(), 195); QDeclarativeDomObject numberAnimation = z.value().toValueSource().object(); - QCOMPARE(numberAnimation.position(), 87); + QCOMPARE(numberAnimation.position(), 92); QCOMPARE(numberAnimation.length(), 23); QDeclarativeDomObject behavior = opacity.value().toValueInterceptor().object(); - QCOMPARE(behavior.position(), 115); + QCOMPARE(behavior.position(), 120); QCOMPARE(behavior.length(), 22); QDeclarativeDomObject component = dataList.values().at(0).toObject(); - QCOMPARE(component.position(), 142); + QCOMPARE(component.position(), 147); QCOMPARE(component.length(), 32); QDeclarativeDomObject componentRoot = component.toComponent().componentRoot(); - QCOMPARE(componentRoot.position(), 162); + QCOMPARE(componentRoot.position(), 167); QCOMPARE(componentRoot.length(), 6); QDeclarativeDomObject child1 = childrenList.values().at(0).toObject(); - QCOMPARE(child1.position(), 191); + QCOMPARE(child1.position(), 196); QCOMPARE(child1.length(), 6); QDeclarativeDomObject child2 = childrenList.values().at(1).toObject(); - QCOMPARE(child2.position(), 199); + QCOMPARE(child2.position(), 204); QCOMPARE(child2.length(), 6); // All QDeclarativeDomValue QDeclarativeDomValue xValue = x.value(); - QCOMPARE(xValue.position(), 66); + QCOMPARE(xValue.position(), 71); QCOMPARE(xValue.length(), 2); QDeclarativeDomValue yValue = y.value(); - QCOMPARE(yValue.position(), 76); + QCOMPARE(yValue.position(), 81); QCOMPARE(yValue.length(), 6); QDeclarativeDomValue zValue = z.value(); - QCOMPARE(zValue.position(), 87); + QCOMPARE(zValue.position(), 92); QCOMPARE(zValue.length(), 23); QDeclarativeDomValue opacityValue = opacity.value(); - QCOMPARE(opacityValue.position(), 115); + QCOMPARE(opacityValue.position(), 120); QCOMPARE(opacityValue.length(), 22); QDeclarativeDomValue dataValue = data.value(); - QCOMPARE(dataValue.position(), 142); + QCOMPARE(dataValue.position(), 147); QCOMPARE(dataValue.length(), 32); QDeclarativeDomValue child1Value = childrenList.values().at(0); - QCOMPARE(child1Value.position(), 191); + QCOMPARE(child1Value.position(), 196); QCOMPARE(child1Value.length(), 6); QDeclarativeDomValue child2Value = childrenList.values().at(1); - QCOMPARE(child2Value.position(), 199); + QCOMPARE(child2Value.position(), 204); QCOMPARE(child2Value.length(), 6); // All QDeclarativeDomList - QCOMPARE(childrenList.position(), 189); + QCOMPARE(childrenList.position(), 194); QCOMPARE(childrenList.length(), 18); } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/CustomObject.qml b/tests/auto/declarative/qdeclarativeecmascript/data/CustomObject.qml index 170d027..4a42518 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/CustomObject.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/CustomObject.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string greeting: "hello world" diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/MethodsObject.qml b/tests/auto/declarative/qdeclarativeecmascript/data/MethodsObject.qml index e9a41ed..829d405 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/MethodsObject.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/MethodsObject.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { function testFunction() { return 19; } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/NestedTypeTransientErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/NestedTypeTransientErrors.qml index 6e50b10..f542c64 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/NestedTypeTransientErrors.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/NestedTypeTransientErrors.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property int b: obj.prop.a diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/ScopeObject.qml b/tests/auto/declarative/qdeclarativeecmascript/data/ScopeObject.qml index fe0492f..df494af 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/ScopeObject.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/ScopeObject.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { property int a: 3 diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/SpuriousWarning.qml b/tests/auto/declarative/qdeclarativeecmascript/data/SpuriousWarning.qml index e144de7..3427a3b 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/SpuriousWarning.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/SpuriousWarning.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { property int children: root.children.length diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/aliasPropertyAndBinding.qml b/tests/auto/declarative/qdeclarativeecmascript/data/aliasPropertyAndBinding.qml index 515f80f..da6c795 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/aliasPropertyAndBinding.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/aliasPropertyAndBinding.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import Qt.test 1.0 MyQmlObject { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.qml b/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.qml index 1cd78a5..9443c01 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyTypeObject { Component.onCompleted: { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/attachedPropertyScope.qml b/tests/auto/declarative/qdeclarativeecmascript/data/attachedPropertyScope.qml index f31f142..c66ef69 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/attachedPropertyScope.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/attachedPropertyScope.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import Qt.test 1.0 QtObject { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/bug.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/bug.1.qml index 88740dc..68dbcfa 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/bug.1.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/bug.1.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property int a: 10 diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/canAssignNullToQObject.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/canAssignNullToQObject.2.qml index 7530396..0f23297 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/canAssignNullToQObject.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/canAssignNullToQObject.2.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyQmlObject { objectProperty: MyQmlObject {} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml b/tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml index 1655905..58b7adb 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { //real diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/compositePropertyType.qml b/tests/auto/declarative/qdeclarativeecmascript/data/compositePropertyType.qml index 1dc0ada..1af77d5 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/compositePropertyType.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/compositePropertyType.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property CustomObject myObject diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/deferredPropertiesErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/deferredPropertiesErrors.qml index 9c46c3f..18a57ba 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/deferredPropertiesErrors.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/deferredPropertiesErrors.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyDeferredObject { value: undefined // error is resolved before complete diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/deleteLater.qml b/tests/auto/declarative/qdeclarativeecmascript/data/deleteLater.qml index 6d23e5f7..131fa6f 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/deleteLater.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/deleteLater.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { id: root diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/deletedEngine.qml b/tests/auto/declarative/qdeclarativeecmascript/data/deletedEngine.qml index 6fc1211..4de405d 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/deletedEngine.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/deletedEngine.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { function calculate() { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/deletedObject.qml b/tests/auto/declarative/qdeclarativeecmascript/data/deletedObject.qml index 2337e44..7ba51ef 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/deletedObject.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/deletedObject.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import Qt.test 1.0 QtObject { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/eval.qml b/tests/auto/declarative/qdeclarativeecmascript/data/eval.qml index aab39be..661cd5c 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/eval.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/eval.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool test1: false; diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/exceptionProducesWarning.qml b/tests/auto/declarative/qdeclarativeecmascript/data/exceptionProducesWarning.qml index 14046f0..2102821 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/exceptionProducesWarning.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/exceptionProducesWarning.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import Qt.test 1.0 MyQmlObject { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/exceptionProducesWarning2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/exceptionProducesWarning2.qml index 146f6f1..c197ef8 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/exceptionProducesWarning2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/exceptionProducesWarning2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import Qt.test 1.0 MyQmlObject { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/extendedObjectPropertyLookup.qml b/tests/auto/declarative/qdeclarativeecmascript/data/extendedObjectPropertyLookup.qml index dc78cd8..9738d2c 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/extendedObjectPropertyLookup.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/extendedObjectPropertyLookup.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -import Qt 4.7 +import QtQuick 1.0 QtObject { property MyExtendedObject a; diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/extensionObjects.qml b/tests/auto/declarative/qdeclarativeecmascript/data/extensionObjects.qml index c57e5f8..b0e897e 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/extensionObjects.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/extensionObjects.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyExtendedObject { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/function.qml b/tests/auto/declarative/qdeclarativeecmascript/data/function.qml index 80d6ef4..6cd8751 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/function.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/function.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool test1: false; diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/functionErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/functionErrors.qml index a893fb0..2ba02d1 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/functionErrors.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/functionErrors.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { function myFunction() { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.1.qml index e3b29ae..6dcdefc 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.1.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.1.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyQmlObject { objectProperty: if(1) otherObject diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.qml b/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.qml index 4746f3f..32b8611 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyQmlObject { objectProperty: otherObject diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/in.qml b/tests/auto/declarative/qdeclarativeecmascript/data/in.qml index 0b5b0ba..f9cccb5 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/in.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/in.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { id: root diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include.qml b/tests/auto/declarative/qdeclarativeecmascript/data/include.qml index 18543b2..61b0461 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/include.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import "include.js" as IncludeTest QtObject { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_callback.qml b/tests/auto/declarative/qdeclarativeecmascript/data/include_callback.qml index a39e821..1633eba 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/include_callback.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_callback.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import "include_callback.js" as IncludeTest QtObject { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma.qml b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma.qml index 67b8cfd..a6489694 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import "include_pragma_outer.js" as Script Item { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_remote.qml b/tests/auto/declarative/qdeclarativeecmascript/data/include_remote.qml index 06bd174..0dfc74f 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/include_remote.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_remote.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import "include_remote.js" as IncludeTest QtObject { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_remote_missing.qml b/tests/auto/declarative/qdeclarativeecmascript/data/include_remote_missing.qml index 8e486b2..05a7399 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/include_remote_missing.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_remote_missing.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import "include_remote_missing.js" as IncludeTest QtObject { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_shared.qml b/tests/auto/declarative/qdeclarativeecmascript/data/include_shared.qml index e957018..e9f1c89 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/include_shared.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_shared.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import "include_shared.js" as IncludeTest QtObject { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectArg.qml b/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectArg.qml index d5d3329..6ab25f2 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectArg.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectArg.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyQmlObject { id: root diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectRet.qml b/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectRet.qml index 29d7d01..87b2d7e 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectRet.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectRet.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyQmlObject { id: root diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/jsObject.qml b/tests/auto/declarative/qdeclarativeecmascript/data/jsObject.qml index fb4fa4d..e93007a 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/jsObject.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/jsObject.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property int test diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/libraryScriptAssert.qml b/tests/auto/declarative/qdeclarativeecmascript/data/libraryScriptAssert.qml index a945a16..c078942 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/libraryScriptAssert.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/libraryScriptAssert.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import "libraryScriptAssert.js" as Test QtObject { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/listProperties.qml b/tests/auto/declarative/qdeclarativeecmascript/data/listProperties.qml index 3ba4183..7b94075 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/listProperties.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/listProperties.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyQmlObject { id: root diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/listToVariant.qml b/tests/auto/declarative/qdeclarativeecmascript/data/listToVariant.qml index 697530f..7940ab8 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/listToVariant.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/listToVariant.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property variant test: children diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/methods.3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/methods.3.qml index 269bd83..1090b48 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/methods.3.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/methods.3.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { function testFunction() { return 19; } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/methods.4.qml b/tests/auto/declarative/qdeclarativeecmascript/data/methods.4.qml index 2ea9cdb..34c50d6 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/methods.4.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/methods.4.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 MethodsObject { function testFunction2() { return 17; } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/methods.5.qml b/tests/auto/declarative/qdeclarativeecmascript/data/methods.5.qml index 0065add..bebdf3d 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/methods.5.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/methods.5.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { property alias blah: item.x diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/multiEngineObject.qml b/tests/auto/declarative/qdeclarativeecmascript/data/multiEngineObject.qml index a8cb50e..d9c63e6 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/multiEngineObject.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/multiEngineObject.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string test: thing.stringProperty diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/noSpuriousWarningsAtShutdown.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/noSpuriousWarningsAtShutdown.2.qml index 8be2d5b..9e0bcf0 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/noSpuriousWarningsAtShutdown.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/noSpuriousWarningsAtShutdown.2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { id: root diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/noSpuriousWarningsAtShutdown.qml b/tests/auto/declarative/qdeclarativeecmascript/data/noSpuriousWarningsAtShutdown.qml index daa9b0b..7e7da8d 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/noSpuriousWarningsAtShutdown.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/noSpuriousWarningsAtShutdown.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { id: root diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/nonscriptable.qml b/tests/auto/declarative/qdeclarativeecmascript/data/nonscriptable.qml index 024d82e..e86cc96 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/nonscriptable.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/nonscriptable.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyQmlObject { id: root diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/nullObjectBinding.qml b/tests/auto/declarative/qdeclarativeecmascript/data/nullObjectBinding.qml index 11472a0..cbd2d3e 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/nullObjectBinding.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/nullObjectBinding.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property QtObject test diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/objectsCompareAsEqual.qml b/tests/auto/declarative/qdeclarativeecmascript/data/objectsCompareAsEqual.qml index 4b51109..ef0e304 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/objectsCompareAsEqual.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/objectsCompareAsEqual.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { id: root diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/ownership.qml b/tests/auto/declarative/qdeclarativeecmascript/data/ownership.qml index 231c9e5..53427b7 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/ownership.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/ownership.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { Component.onCompleted: { var a = getObject(); a = null; } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml index bef40fd..a778dcc 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { id: root diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qlistqobjectMethods.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qlistqobjectMethods.qml index 22c4f0b..2e9e173 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/qlistqobjectMethods.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/qlistqobjectMethods.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property int test: getObjects().length diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_10696.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_10696.qml index cb5c4c9..02357d4 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_10696.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_10696.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string test: "aaaa" diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11600.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11600.qml index 56e7885..b7bb366 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11600.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11600.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import "qtbug_11600.js" as Test QtObject { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11606.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11606.qml index 6efb9c1..05c482c 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11606.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_11606.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool test: false diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qtcreatorbug_1289.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qtcreatorbug_1289.qml index b6d31d5..e531efc 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/qtcreatorbug_1289.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/qtcreatorbug_1289.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { id: root diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scope.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scope.2.qml index d4d7eb2..95f34d8 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scope.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scope.2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { property int a: 0 diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml index 2548005..0b0770e 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import Qt.test 1.0 MyQmlObject { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scope.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scope.qml index 7f895ff..63dba2f 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scope.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scope.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { id: root diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.1.qml index 5d8e29e..65697d9 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.1.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.1.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -import Qt 4.7 +import QtQuick 1.0 import "scriptConnect.1.js" as Script MyQmlObject { property bool test: false diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.2.qml index 5681907..86ff798 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.2.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -import Qt 4.7 +import QtQuick 1.0 import "scriptConnect.2.js" as Script MyQmlObject { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.3.qml index 40d8079..db2f005 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.3.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.3.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyQmlObject { property bool test: false diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.4.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.4.qml index 0356650..a2d90ff 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.4.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.4.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyQmlObject { property bool test: false diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.5.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.5.qml index 661f28e..21fac15 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.5.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.5.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyQmlObject { property bool test: false diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.6.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.6.qml index 36655ee..4053091 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.6.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.6.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -import Qt 4.7 +import QtQuick 1.0 import "scriptConnect.6.js" as Script MyQmlObject { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.1.qml index 0cb4d79..bbe7024 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.1.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.1.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -import Qt 4.7 +import QtQuick 1.0 import "scriptDisconnect.1.js" as Script MyQmlObject { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.2.qml index 05ca7a4..8a166f4 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.2.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -import Qt 4.7 +import QtQuick 1.0 import "scriptDisconnect.1.js" as Script MyQmlObject { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.3.qml index 2a66bed..548f2a1 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.3.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.3.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -import Qt 4.7 +import QtQuick 1.0 import "scriptDisconnect.1.js" as Script MyQmlObject { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.4.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.4.qml index 7beb84e..11b22d7 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.4.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.4.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -import Qt 4.7 +import QtQuick 1.0 import "scriptDisconnect.1.js" as Script MyQmlObject { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/sharedAttachedObject.qml b/tests/auto/declarative/qdeclarativeecmascript/data/sharedAttachedObject.qml index 817391d..2d090b8 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/sharedAttachedObject.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/sharedAttachedObject.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyQmlObject { id: root diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/shutdownErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/shutdownErrors.qml index 823096b..7a6aba7 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/shutdownErrors.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/shutdownErrors.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { property int test: myObject.object.a diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/signalTriggeredBindings.qml b/tests/auto/declarative/qdeclarativeecmascript/data/signalTriggeredBindings.qml index a2fb4d0..8410d33 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/signalTriggeredBindings.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/signalTriggeredBindings.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyQmlObject { property real base: 50 diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/strictlyEquals.qml b/tests/auto/declarative/qdeclarativeecmascript/data/strictlyEquals.qml index ec49a95..2932c778 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/strictlyEquals.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/strictlyEquals.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool test1: (a === true) diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/transientErrors.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/transientErrors.2.qml index a36b4c0..1e5afdf 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/transientErrors.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/transientErrors.2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { id: root diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/transientErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/transientErrors.qml index 26d9596..60d39fa 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/transientErrors.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/transientErrors.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property variant obj: nested diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/variantsAssignedUndefined.qml b/tests/auto/declarative/qdeclarativeecmascript/data/variantsAssignedUndefined.qml index 46e18e5..849dfad 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/variantsAssignedUndefined.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/variantsAssignedUndefined.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool runTest: false diff --git a/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp b/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp index 56ebd73..092c83e 100644 --- a/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp +++ b/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp @@ -200,7 +200,7 @@ void tst_qdeclarativeengine::clearComponentCache() { QFile file("temp.qml"); QVERIFY(file.open(QIODevice::WriteOnly)); - file.write("import Qt 4.7\nQtObject {\nproperty int test: 10\n}\n"); + file.write("import QtQuick 1.0\nQtObject {\nproperty int test: 10\n}\n"); file.close(); } @@ -217,7 +217,7 @@ void tst_qdeclarativeengine::clearComponentCache() { QFile file("temp.qml"); QVERIFY(file.open(QIODevice::WriteOnly)); - file.write("import Qt 4.7\nQtObject {\nproperty int test: 11\n}\n"); + file.write("import QtQuick 1.0\nQtObject {\nproperty int test: 11\n}\n"); file.close(); } @@ -256,7 +256,7 @@ void tst_qdeclarativeengine::outputWarningsToStandardError() QCOMPARE(engine.outputWarningsToStandardError(), true); QDeclarativeComponent c(&engine); - c.setData("import Qt 4.7; QtObject { property int a: undefined }", QUrl()); + c.setData("import QtQuick 1.0; QtObject { property int a: undefined }", QUrl()); QVERIFY(c.isReady() == true); @@ -313,7 +313,7 @@ void tst_qdeclarativeengine::objectOwnership() { QDeclarativeEngine engine; QDeclarativeComponent c(&engine); - c.setData("import Qt 4.7; QtObject { property QtObject object: QtObject {} }", QUrl()); + c.setData("import QtQuick 1.0; QtObject { property QtObject object: QtObject {} }", QUrl()); QObject *o = c.create(); QVERIFY(o != 0); diff --git a/tests/auto/declarative/qdeclarativeflickable/data/flickable01.qml b/tests/auto/declarative/qdeclarativeflickable/data/flickable01.qml index 45272e3..c53ae3f 100644 --- a/tests/auto/declarative/qdeclarativeflickable/data/flickable01.qml +++ b/tests/auto/declarative/qdeclarativeflickable/data/flickable01.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Flickable { } diff --git a/tests/auto/declarative/qdeclarativeflickable/data/flickable02.qml b/tests/auto/declarative/qdeclarativeflickable/data/flickable02.qml index 2550fcc..98925ae 100644 --- a/tests/auto/declarative/qdeclarativeflickable/data/flickable02.qml +++ b/tests/auto/declarative/qdeclarativeflickable/data/flickable02.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Flickable { width: 100; height: 100 diff --git a/tests/auto/declarative/qdeclarativeflickable/data/flickable03.qml b/tests/auto/declarative/qdeclarativeflickable/data/flickable03.qml index 27fe653..a3e92fe 100644 --- a/tests/auto/declarative/qdeclarativeflickable/data/flickable03.qml +++ b/tests/auto/declarative/qdeclarativeflickable/data/flickable03.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Flickable { width: 100; height: 100 diff --git a/tests/auto/declarative/qdeclarativeflickable/data/flickable04.qml b/tests/auto/declarative/qdeclarativeflickable/data/flickable04.qml index a840a01..fcc683a 100644 --- a/tests/auto/declarative/qdeclarativeflickable/data/flickable04.qml +++ b/tests/auto/declarative/qdeclarativeflickable/data/flickable04.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Flickable { property bool ok: false diff --git a/tests/auto/declarative/qdeclarativeflickable/data/flickableqgraphicswidget.qml b/tests/auto/declarative/qdeclarativeflickable/data/flickableqgraphicswidget.qml index 8e95a94..6cbf12c 100644 --- a/tests/auto/declarative/qdeclarativeflickable/data/flickableqgraphicswidget.qml +++ b/tests/auto/declarative/qdeclarativeflickable/data/flickableqgraphicswidget.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Flickable { width: 100; height: 100 diff --git a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp index e7ded8a..25edb36 100644 --- a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp +++ b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp @@ -162,7 +162,7 @@ void tst_qdeclarativeflickable::properties() void tst_qdeclarativeflickable::boundsBehavior() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.7; Flickable { boundsBehavior: Flickable.StopAtBounds }", QUrl::fromLocalFile("")); + component.setData("import QtQuick 1.0; Flickable { boundsBehavior: Flickable.StopAtBounds }", QUrl::fromLocalFile("")); QDeclarativeFlickable *flickable = qobject_cast(component.create()); QSignalSpy spy(flickable, SIGNAL(boundsBehaviorChanged())); @@ -191,7 +191,7 @@ void tst_qdeclarativeflickable::boundsBehavior() void tst_qdeclarativeflickable::maximumFlickVelocity() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.7; Flickable { maximumFlickVelocity: 1.0; }", QUrl::fromLocalFile("")); + component.setData("import QtQuick 1.0; Flickable { maximumFlickVelocity: 1.0; }", QUrl::fromLocalFile("")); QDeclarativeFlickable *flickable = qobject_cast(component.create()); QSignalSpy spy(flickable, SIGNAL(maximumFlickVelocityChanged())); @@ -208,7 +208,7 @@ void tst_qdeclarativeflickable::maximumFlickVelocity() void tst_qdeclarativeflickable::flickDeceleration() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.7; Flickable { flickDeceleration: 1.0; }", QUrl::fromLocalFile("")); + component.setData("import QtQuick 1.0; Flickable { flickDeceleration: 1.0; }", QUrl::fromLocalFile("")); QDeclarativeFlickable *flickable = qobject_cast(component.create()); QSignalSpy spy(flickable, SIGNAL(flickDecelerationChanged())); @@ -225,7 +225,7 @@ void tst_qdeclarativeflickable::flickDeceleration() void tst_qdeclarativeflickable::pressDelay() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.7; Flickable { pressDelay: 100; }", QUrl::fromLocalFile("")); + component.setData("import QtQuick 1.0; Flickable { pressDelay: 100; }", QUrl::fromLocalFile("")); QDeclarativeFlickable *flickable = qobject_cast(component.create()); QSignalSpy spy(flickable, SIGNAL(pressDelayChanged())); @@ -242,7 +242,7 @@ void tst_qdeclarativeflickable::pressDelay() void tst_qdeclarativeflickable::flickableDirection() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.7; Flickable { flickableDirection: Flickable.VerticalFlick; }", QUrl::fromLocalFile("")); + component.setData("import QtQuick 1.0; Flickable { flickableDirection: Flickable.VerticalFlick; }", QUrl::fromLocalFile("")); QDeclarativeFlickable *flickable = qobject_cast(component.create()); QSignalSpy spy(flickable, SIGNAL(flickableDirectionChanged())); diff --git a/tests/auto/declarative/qdeclarativeflipable/data/crash.qml b/tests/auto/declarative/qdeclarativeflipable/data/crash.qml index fb369a6..bc5229b 100644 --- a/tests/auto/declarative/qdeclarativeflipable/data/crash.qml +++ b/tests/auto/declarative/qdeclarativeflipable/data/crash.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Flipable { transform: Rotation { diff --git a/tests/auto/declarative/qdeclarativeflipable/data/flipable-abort.qml b/tests/auto/declarative/qdeclarativeflipable/data/flipable-abort.qml index 41463fe..69ff4a2 100644 --- a/tests/auto/declarative/qdeclarativeflipable/data/flipable-abort.qml +++ b/tests/auto/declarative/qdeclarativeflipable/data/flipable-abort.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { Flipable { diff --git a/tests/auto/declarative/qdeclarativeflipable/data/test-flipable.qml b/tests/auto/declarative/qdeclarativeflipable/data/test-flipable.qml index 5ddf09d..02b69e0 100644 --- a/tests/auto/declarative/qdeclarativeflipable/data/test-flipable.qml +++ b/tests/auto/declarative/qdeclarativeflipable/data/test-flipable.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Flipable { id: flipable diff --git a/tests/auto/declarative/qdeclarativefocusscope/data/chain.qml b/tests/auto/declarative/qdeclarativefocusscope/data/chain.qml index 42b50cf..a40bc2c 100644 --- a/tests/auto/declarative/qdeclarativefocusscope/data/chain.qml +++ b/tests/auto/declarative/qdeclarativefocusscope/data/chain.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: root diff --git a/tests/auto/declarative/qdeclarativefocusscope/data/forcefocus.qml b/tests/auto/declarative/qdeclarativefocusscope/data/forcefocus.qml index 9144854..708e899 100644 --- a/tests/auto/declarative/qdeclarativefocusscope/data/forcefocus.qml +++ b/tests/auto/declarative/qdeclarativefocusscope/data/forcefocus.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 800; height: 600 diff --git a/tests/auto/declarative/qdeclarativefocusscope/data/signalEmission.qml b/tests/auto/declarative/qdeclarativefocusscope/data/signalEmission.qml index 07601c7..5850791 100644 --- a/tests/auto/declarative/qdeclarativefocusscope/data/signalEmission.qml +++ b/tests/auto/declarative/qdeclarativefocusscope/data/signalEmission.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 200 diff --git a/tests/auto/declarative/qdeclarativefocusscope/data/test.qml b/tests/auto/declarative/qdeclarativefocusscope/data/test.qml index 55be103..5983c19 100644 --- a/tests/auto/declarative/qdeclarativefocusscope/data/test.qml +++ b/tests/auto/declarative/qdeclarativefocusscope/data/test.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "white" diff --git a/tests/auto/declarative/qdeclarativefocusscope/data/test2.qml b/tests/auto/declarative/qdeclarativefocusscope/data/test2.qml index 5ed701d..8c0b3b4 100644 --- a/tests/auto/declarative/qdeclarativefocusscope/data/test2.qml +++ b/tests/auto/declarative/qdeclarativefocusscope/data/test2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "white" diff --git a/tests/auto/declarative/qdeclarativefocusscope/data/test3.qml b/tests/auto/declarative/qdeclarativefocusscope/data/test3.qml index c6d112f..2e025cb 100644 --- a/tests/auto/declarative/qdeclarativefocusscope/data/test3.qml +++ b/tests/auto/declarative/qdeclarativefocusscope/data/test3.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "white" diff --git a/tests/auto/declarative/qdeclarativefocusscope/data/test4.qml b/tests/auto/declarative/qdeclarativefocusscope/data/test4.qml index 3c6d3bd..7192dee 100644 --- a/tests/auto/declarative/qdeclarativefocusscope/data/test4.qml +++ b/tests/auto/declarative/qdeclarativefocusscope/data/test4.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "white" diff --git a/tests/auto/declarative/qdeclarativefocusscope/data/test5.qml b/tests/auto/declarative/qdeclarativefocusscope/data/test5.qml index 4417d5f..01dada5 100644 --- a/tests/auto/declarative/qdeclarativefocusscope/data/test5.qml +++ b/tests/auto/declarative/qdeclarativefocusscope/data/test5.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "white" diff --git a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp index 8765426..158ee51 100644 --- a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp +++ b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp @@ -87,7 +87,7 @@ tst_qdeclarativefontloader::tst_qdeclarativefontloader() : void tst_qdeclarativefontloader::noFont() { - QString componentStr = "import Qt 4.7\nFontLoader { }"; + QString componentStr = "import QtQuick 1.0\nFontLoader { }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeFontLoader *fontObject = qobject_cast(component.create()); @@ -102,7 +102,7 @@ void tst_qdeclarativefontloader::noFont() void tst_qdeclarativefontloader::namedFont() { - QString componentStr = "import Qt 4.7\nFontLoader { name: \"Helvetica\" }"; + QString componentStr = "import QtQuick 1.0\nFontLoader { name: \"Helvetica\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeFontLoader *fontObject = qobject_cast(component.create()); @@ -115,7 +115,7 @@ void tst_qdeclarativefontloader::namedFont() void tst_qdeclarativefontloader::localFont() { - QString componentStr = "import Qt 4.7\nFontLoader { source: \"" SRCDIR "/data/tarzeau_ocr_a.ttf\" }"; + QString componentStr = "import QtQuick 1.0\nFontLoader { source: \"" SRCDIR "/data/tarzeau_ocr_a.ttf\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeFontLoader *fontObject = qobject_cast(component.create()); @@ -128,7 +128,7 @@ void tst_qdeclarativefontloader::localFont() void tst_qdeclarativefontloader::failLocalFont() { - QString componentStr = "import Qt 4.7\nFontLoader { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\" }"; + QString componentStr = "import QtQuick 1.0\nFontLoader { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\" }"; QTest::ignoreMessage(QtWarningMsg, QString("file::2:1: QML FontLoader: Cannot load font: \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\"").toUtf8().constData()); QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -142,7 +142,7 @@ void tst_qdeclarativefontloader::failLocalFont() void tst_qdeclarativefontloader::webFont() { - QString componentStr = "import Qt 4.7\nFontLoader { source: \"http://localhost:14448/tarzeau_ocr_a.ttf\" }"; + QString componentStr = "import QtQuick 1.0\nFontLoader { source: \"http://localhost:14448/tarzeau_ocr_a.ttf\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -158,7 +158,7 @@ void tst_qdeclarativefontloader::redirWebFont() { server.addRedirect("olddir/oldname.ttf","../tarzeau_ocr_a.ttf"); - QString componentStr = "import Qt 4.7\nFontLoader { source: \"http://localhost:14448/olddir/oldname.ttf\" }"; + QString componentStr = "import QtQuick 1.0\nFontLoader { source: \"http://localhost:14448/olddir/oldname.ttf\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -172,7 +172,7 @@ void tst_qdeclarativefontloader::redirWebFont() void tst_qdeclarativefontloader::failWebFont() { - QString componentStr = "import Qt 4.7\nFontLoader { source: \"http://localhost:14448/nonexist.ttf\" }"; + QString componentStr = "import QtQuick 1.0\nFontLoader { source: \"http://localhost:14448/nonexist.ttf\" }"; QTest::ignoreMessage(QtWarningMsg, "file::2:1: QML FontLoader: Cannot load font: \"http://localhost:14448/nonexist.ttf\""); QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -186,7 +186,7 @@ void tst_qdeclarativefontloader::failWebFont() void tst_qdeclarativefontloader::changeFont() { - QString componentStr = "import Qt 4.7\nFontLoader { source: font }"; + QString componentStr = "import QtQuick 1.0\nFontLoader { source: font }"; QDeclarativeContext *ctxt = engine.rootContext(); ctxt->setContextProperty("font", QUrl::fromLocalFile(SRCDIR "/data/tarzeau_ocr_a.ttf")); QDeclarativeComponent component(&engine); diff --git a/tests/auto/declarative/qdeclarativegridview/data/displaygrid.qml b/tests/auto/declarative/qdeclarativegridview/data/displaygrid.qml index 9c3c847..93f39ff 100644 --- a/tests/auto/declarative/qdeclarativegridview/data/displaygrid.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/displaygrid.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 240 diff --git a/tests/auto/declarative/qdeclarativegridview/data/footer.qml b/tests/auto/declarative/qdeclarativegridview/data/footer.qml index 170b2b5..ad69a25 100644 --- a/tests/auto/declarative/qdeclarativegridview/data/footer.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/footer.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 240 diff --git a/tests/auto/declarative/qdeclarativegridview/data/gridview-enforcerange.qml b/tests/auto/declarative/qdeclarativegridview/data/gridview-enforcerange.qml index 2fe173f..5719f43 100644 --- a/tests/auto/declarative/qdeclarativegridview/data/gridview-enforcerange.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/gridview-enforcerange.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 240 diff --git a/tests/auto/declarative/qdeclarativegridview/data/gridview-initCurrent.qml b/tests/auto/declarative/qdeclarativegridview/data/gridview-initCurrent.qml index a5d651d..421f810 100644 --- a/tests/auto/declarative/qdeclarativegridview/data/gridview-initCurrent.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/gridview-initCurrent.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { property int current: grid.currentIndex diff --git a/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml b/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml index 3d826dd..77c94ba 100644 --- a/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: root diff --git a/tests/auto/declarative/qdeclarativegridview/data/gridview2.qml b/tests/auto/declarative/qdeclarativegridview/data/gridview2.qml index 772255d..7559a7f 100644 --- a/tests/auto/declarative/qdeclarativegridview/data/gridview2.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/gridview2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 GridView { anchors.fill: parent diff --git a/tests/auto/declarative/qdeclarativegridview/data/gridview3.qml b/tests/auto/declarative/qdeclarativegridview/data/gridview3.qml index f108e3d..ab4ceeb 100644 --- a/tests/auto/declarative/qdeclarativegridview/data/gridview3.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/gridview3.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 GridView { anchors.fill: parent diff --git a/tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml b/tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml index 510fcc5..7bb2c95 100644 --- a/tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { diff --git a/tests/auto/declarative/qdeclarativegridview/data/propertychangestest.qml b/tests/auto/declarative/qdeclarativegridview/data/propertychangestest.qml index 8e4e178..10df234 100644 --- a/tests/auto/declarative/qdeclarativegridview/data/propertychangestest.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/propertychangestest.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 360; height: 120; color: "white" diff --git a/tests/auto/declarative/qdeclarativegridview/data/setindex.qml b/tests/auto/declarative/qdeclarativegridview/data/setindex.qml index 93ef69b..36bf67d 100644 --- a/tests/auto/declarative/qdeclarativegridview/data/setindex.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/setindex.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 200 diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index 5fd373c..975cf8f 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -852,10 +852,10 @@ void tst_QDeclarativeGridView::componentChanges() QTRY_VERIFY(gridView); QDeclarativeComponent component(canvas->engine()); - component.setData("import Qt 4.7; Rectangle { color: \"blue\"; }", QUrl::fromLocalFile("")); + component.setData("import QtQuick 1.0; Rectangle { color: \"blue\"; }", QUrl::fromLocalFile("")); QDeclarativeComponent delegateComponent(canvas->engine()); - delegateComponent.setData("import Qt 4.7; Text { text: 'Name: ' + name }", QUrl::fromLocalFile("")); + delegateComponent.setData("import QtQuick 1.0; Text { text: 'Name: ' + name }", QUrl::fromLocalFile("")); QSignalSpy highlightSpy(gridView, SIGNAL(highlightChanged())); QSignalSpy delegateSpy(gridView, SIGNAL(delegateChanged())); diff --git a/tests/auto/declarative/qdeclarativeimage/data/aspectratio.qml b/tests/auto/declarative/qdeclarativeimage/data/aspectratio.qml index 402d33e..739299d 100644 --- a/tests/auto/declarative/qdeclarativeimage/data/aspectratio.qml +++ b/tests/auto/declarative/qdeclarativeimage/data/aspectratio.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Image { source: "heart.png" diff --git a/tests/auto/declarative/qdeclarativeimage/data/tiling.qml b/tests/auto/declarative/qdeclarativeimage/data/tiling.qml index 32839bb..49715ab 100644 --- a/tests/auto/declarative/qdeclarativeimage/data/tiling.qml +++ b/tests/auto/declarative/qdeclarativeimage/data/tiling.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 800; height: 600 diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index 2686127..6fce2ad 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -97,7 +97,7 @@ tst_qdeclarativeimage::tst_qdeclarativeimage() void tst_qdeclarativeimage::noSource() { - QString componentStr = "import Qt 4.7\nImage { source: \"\" }"; + QString componentStr = "import QtQuick 1.0\nImage { source: \"\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast(component.create()); @@ -154,7 +154,7 @@ void tst_qdeclarativeimage::imageSource() if (!error.isEmpty()) QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); - QString componentStr = "import Qt 4.7\nImage { source: \"" + source + "\"; asynchronous: " + QString componentStr = "import QtQuick 1.0\nImage { source: \"" + source + "\"; asynchronous: " + (async ? QLatin1String("true") : QLatin1String("false")) + " }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -184,7 +184,7 @@ void tst_qdeclarativeimage::imageSource() void tst_qdeclarativeimage::clearSource() { - QString componentStr = "import Qt 4.7\nImage { source: srcImage }"; + QString componentStr = "import QtQuick 1.0\nImage { source: srcImage }"; QDeclarativeContext *ctxt = engine.rootContext(); ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png")); QDeclarativeComponent component(&engine); @@ -206,7 +206,7 @@ void tst_qdeclarativeimage::clearSource() void tst_qdeclarativeimage::resized() { - QString componentStr = "import Qt 4.7\nImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 300 }"; + QString componentStr = "import QtQuick 1.0\nImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast(component.create()); @@ -241,7 +241,7 @@ void tst_qdeclarativeimage::preserveAspectRatio() void tst_qdeclarativeimage::smooth() { - QString componentStr = "import Qt 4.7\nImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; + QString componentStr = "import QtQuick 1.0\nImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast(component.create()); @@ -257,7 +257,7 @@ void tst_qdeclarativeimage::smooth() void tst_qdeclarativeimage::svg() { QString src = QUrl::fromLocalFile(SRCDIR "/data/heart.svg").toString(); - QString componentStr = "import Qt 4.7\nImage { source: \"" + src + "\"; sourceSize.width: 300; sourceSize.height: 300 }"; + QString componentStr = "import QtQuick 1.0\nImage { source: \"" + src + "\"; sourceSize.width: 300; sourceSize.height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast(component.create()); @@ -292,7 +292,7 @@ void tst_qdeclarativeimage::big() // have to build a 400 MB image. That would be a bug in the JPEG loader. QString src = QUrl::fromLocalFile(SRCDIR "/data/big.jpeg").toString(); - QString componentStr = "import Qt 4.7\nImage { source: \"" + src + "\"; width: 100; sourceSize.height: 256 }"; + QString componentStr = "import QtQuick 1.0\nImage { source: \"" + src + "\"; width: 100; sourceSize.height: 256 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -354,7 +354,7 @@ void tst_qdeclarativeimage::noLoading() server.serveDirectory(SRCDIR "/data"); server.addRedirect("oldcolors.png", SERVER_ADDR "/colors.png"); - QString componentStr = "import Qt 4.7\nImage { source: srcImage }"; + QString componentStr = "import QtQuick 1.0\nImage { source: srcImage }"; QDeclarativeContext *ctxt = engine.rootContext(); ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/heart.png")); QDeclarativeComponent component(&engine); diff --git a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp index d38160d..cd12e3a 100644 --- a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp +++ b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp @@ -192,7 +192,7 @@ void tst_qdeclarativeimageprovider::runTest(bool async, QDeclarativeImageProvide engine.addImageProvider("test", provider); QVERIFY(engine.imageProvider("test") != 0); - QString componentStr = "import Qt 4.7\nImage { source: \"" + source + "\"; " + QString componentStr = "import QtQuick 1.0\nImage { source: \"" + source + "\"; " + (async ? "asynchronous: true; " : "") + properties + " }"; QDeclarativeComponent component(&engine); @@ -271,7 +271,7 @@ void tst_qdeclarativeimageprovider::requestPixmap_async() QVERIFY(engine.imageProvider("test") != 0); // pixmaps are loaded synchronously regardless of 'asynchronous' value - QString componentStr = "import Qt 4.7\nImage { asynchronous: true; source: \"image://test/pixmap-async-test.png\" }"; + QString componentStr = "import QtQuick 1.0\nImage { asynchronous: true; source: \"image://test/pixmap-async-test.png\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast(component.create()); @@ -298,7 +298,7 @@ void tst_qdeclarativeimageprovider::removeProvider() QVERIFY(engine.imageProvider("test") != 0); // add provider, confirm it works - QString componentStr = "import Qt 4.7\nImage { source: \"" + newImageFileName() + "\" }"; + QString componentStr = "import QtQuick 1.0\nImage { source: \"" + newImageFileName() + "\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast(component.create()); @@ -359,7 +359,7 @@ void tst_qdeclarativeimageprovider::threadTest() engine.addImageProvider("test_thread", provider); QVERIFY(engine.imageProvider("test_thread") != 0); - QString componentStr = "import Qt 4.7\nItem { \n" + QString componentStr = "import QtQuick 1.0\nItem { \n" "Image { source: \"image://test_thread/blue\"; asynchronous: true; }\n" "Image { source: \"image://test_thread/red\"; asynchronous: true; }\n" "Image { source: \"image://test_thread/green\"; asynchronous: true; }\n" diff --git a/tests/auto/declarative/qdeclarativeinfo/data/NestedObject.qml b/tests/auto/declarative/qdeclarativeinfo/data/NestedObject.qml index 30e8274..a2afb61 100644 --- a/tests/auto/declarative/qdeclarativeinfo/data/NestedObject.qml +++ b/tests/auto/declarative/qdeclarativeinfo/data/NestedObject.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property variant nested diff --git a/tests/auto/declarative/qdeclarativeinfo/data/nestedQmlObject.qml b/tests/auto/declarative/qdeclarativeinfo/data/nestedQmlObject.qml index 9bd8571..f3516c6 100644 --- a/tests/auto/declarative/qdeclarativeinfo/data/nestedQmlObject.qml +++ b/tests/auto/declarative/qdeclarativeinfo/data/nestedQmlObject.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property variant nested diff --git a/tests/auto/declarative/qdeclarativeinfo/data/qmlObject.qml b/tests/auto/declarative/qdeclarativeinfo/data/qmlObject.qml index 9bb6be7..937cd64 100644 --- a/tests/auto/declarative/qdeclarativeinfo/data/qmlObject.qml +++ b/tests/auto/declarative/qdeclarativeinfo/data/qmlObject.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property variant nested diff --git a/tests/auto/declarative/qdeclarativeitem/data/childrenProperty.qml b/tests/auto/declarative/qdeclarativeitem/data/childrenProperty.qml index 5958004..fab2367 100644 --- a/tests/auto/declarative/qdeclarativeitem/data/childrenProperty.qml +++ b/tests/auto/declarative/qdeclarativeitem/data/childrenProperty.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { id: root diff --git a/tests/auto/declarative/qdeclarativeitem/data/childrenRect.qml b/tests/auto/declarative/qdeclarativeitem/data/childrenRect.qml index f351b53..84f362f 100644 --- a/tests/auto/declarative/qdeclarativeitem/data/childrenRect.qml +++ b/tests/auto/declarative/qdeclarativeitem/data/childrenRect.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400 diff --git a/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug.qml b/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug.qml index 4a2f056..2ab73a1 100644 --- a/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug.qml +++ b/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400 diff --git a/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug2.qml b/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug2.qml index 225d8d4..d67ad0e 100644 --- a/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug2.qml +++ b/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width:360; diff --git a/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug3.qml b/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug3.qml index 54b5b68..9d8e1e8 100644 --- a/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug3.qml +++ b/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug3.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 300 diff --git a/tests/auto/declarative/qdeclarativeitem/data/keynavigationtest.qml b/tests/auto/declarative/qdeclarativeitem/data/keynavigationtest.qml index 87e64c5..229f969 100644 --- a/tests/auto/declarative/qdeclarativeitem/data/keynavigationtest.qml +++ b/tests/auto/declarative/qdeclarativeitem/data/keynavigationtest.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Grid { columns: 2 diff --git a/tests/auto/declarative/qdeclarativeitem/data/keyspriority.qml b/tests/auto/declarative/qdeclarativeitem/data/keyspriority.qml index 171536b..375a6b6 100644 --- a/tests/auto/declarative/qdeclarativeitem/data/keyspriority.qml +++ b/tests/auto/declarative/qdeclarativeitem/data/keyspriority.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import Test 1.0 KeyTestItem { diff --git a/tests/auto/declarative/qdeclarativeitem/data/keystest.qml b/tests/auto/declarative/qdeclarativeitem/data/keystest.qml index 8ff3e87..aedccd9 100644 --- a/tests/auto/declarative/qdeclarativeitem/data/keystest.qml +++ b/tests/auto/declarative/qdeclarativeitem/data/keystest.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { focus: true diff --git a/tests/auto/declarative/qdeclarativeitem/data/mapCoordinates.qml b/tests/auto/declarative/qdeclarativeitem/data/mapCoordinates.qml index 4a92e9d..bb20ecc 100644 --- a/tests/auto/declarative/qdeclarativeitem/data/mapCoordinates.qml +++ b/tests/auto/declarative/qdeclarativeitem/data/mapCoordinates.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { id: root; objectName: "root" diff --git a/tests/auto/declarative/qdeclarativeitem/data/mouseFocus.qml b/tests/auto/declarative/qdeclarativeitem/data/mouseFocus.qml index a562b8b..afa5397 100644 --- a/tests/auto/declarative/qdeclarativeitem/data/mouseFocus.qml +++ b/tests/auto/declarative/qdeclarativeitem/data/mouseFocus.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QGraphicsWidget { size: "200x100" diff --git a/tests/auto/declarative/qdeclarativeitem/data/propertychanges.qml b/tests/auto/declarative/qdeclarativeitem/data/propertychanges.qml index dd86453..f1ea933 100644 --- a/tests/auto/declarative/qdeclarativeitem/data/propertychanges.qml +++ b/tests/auto/declarative/qdeclarativeitem/data/propertychanges.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { Item { diff --git a/tests/auto/declarative/qdeclarativeitem/data/resourcesProperty.qml b/tests/auto/declarative/qdeclarativeitem/data/resourcesProperty.qml index 852f242..e82cd02 100644 --- a/tests/auto/declarative/qdeclarativeitem/data/resourcesProperty.qml +++ b/tests/auto/declarative/qdeclarativeitem/data/resourcesProperty.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { id: root diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp index 6b28c53..e9dad6b 100644 --- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp @@ -436,7 +436,7 @@ void tst_QDeclarativeItem::keyNavigation() void tst_QDeclarativeItem::smooth() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.7; Item { smooth: false; }", QUrl::fromLocalFile("")); + component.setData("import QtQuick 1.0; Item { smooth: false; }", QUrl::fromLocalFile("")); QDeclarativeItem *item = qobject_cast(component.create()); QSignalSpy spy(item, SIGNAL(smoothChanged(bool))); @@ -465,7 +465,7 @@ void tst_QDeclarativeItem::smooth() void tst_QDeclarativeItem::clip() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.7\nItem { clip: false\n }", QUrl::fromLocalFile("")); + component.setData("import QtQuick 1.0\nItem { clip: false\n }", QUrl::fromLocalFile("")); QDeclarativeItem *item = qobject_cast(component.create()); QSignalSpy spy(item, SIGNAL(clipChanged(bool))); @@ -572,7 +572,7 @@ void tst_QDeclarativeItem::transforms() QFETCH(QByteArray, qml); QFETCH(QMatrix, matrix); QDeclarativeComponent component(&engine); - component.setData("import Qt 4.7\nItem { transform: "+qml+"}", QUrl::fromLocalFile("")); + component.setData("import QtQuick 1.0\nItem { transform: "+qml+"}", QUrl::fromLocalFile("")); QDeclarativeItem *item = qobject_cast(component.create()); QVERIFY(item); QCOMPARE(item->sceneMatrix(), matrix); diff --git a/tests/auto/declarative/qdeclarativelanguage/data/Alias.qml b/tests/auto/declarative/qdeclarativelanguage/data/Alias.qml index deb84a8..6a33def 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/Alias.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/Alias.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { id: root diff --git a/tests/auto/declarative/qdeclarativelanguage/data/Alias2.qml b/tests/auto/declarative/qdeclarativelanguage/data/Alias2.qml index db205f1..919f5d8 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/Alias2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/Alias2.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 QtObject { property variant other diff --git a/tests/auto/declarative/qdeclarativelanguage/data/Alias3.qml b/tests/auto/declarative/qdeclarativelanguage/data/Alias3.qml index 04f5ba3..3f73538 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/Alias3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/Alias3.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 QtObject { property alias obj : otherObj diff --git a/tests/auto/declarative/qdeclarativelanguage/data/Alias4.qml b/tests/auto/declarative/qdeclarativelanguage/data/Alias4.qml index 80414ac..428790d 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/Alias4.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/Alias4.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 Alias3 {} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/ComponentComposite.qml b/tests/auto/declarative/qdeclarativelanguage/data/ComponentComposite.qml index 4c78cd7..9349a93 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/ComponentComposite.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/ComponentComposite.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Component { QtObject {} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/CompositeType.qml b/tests/auto/declarative/qdeclarativelanguage/data/CompositeType.qml index 61e6146..cf32b45 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/CompositeType.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/CompositeType.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/CompositeType3.qml b/tests/auto/declarative/qdeclarativelanguage/data/CompositeType3.qml index 0275e21..0687ce3 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/CompositeType3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/CompositeType3.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property int a diff --git a/tests/auto/declarative/qdeclarativelanguage/data/DynamicPropertiesNestedType.qml b/tests/auto/declarative/qdeclarativelanguage/data/DynamicPropertiesNestedType.qml index 9746ab0..5de8a4a 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/DynamicPropertiesNestedType.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/DynamicPropertiesNestedType.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property int super_a: 10 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/HelperAlias.qml b/tests/auto/declarative/qdeclarativelanguage/data/HelperAlias.qml index 23d6ed9..3a7022b 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/HelperAlias.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/HelperAlias.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 QtObject { property variant child diff --git a/tests/auto/declarative/qdeclarativelanguage/data/LocalLast.qml b/tests/auto/declarative/qdeclarativelanguage/data/LocalLast.qml index 8c953cb..f63283e 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/LocalLast.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/LocalLast.qml @@ -1,2 +1,2 @@ -import Qt 4.7 +import QtQuick 1.0 Text {} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/NestedAlias.qml b/tests/auto/declarative/qdeclarativelanguage/data/NestedAlias.qml index fdf4800..8aaddac 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/NestedAlias.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/NestedAlias.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property QtObject o1 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/NestedErrorsType.qml b/tests/auto/declarative/qdeclarativelanguage/data/NestedErrorsType.qml index ee02335..0ba4bd6 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/NestedErrorsType.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/NestedErrorsType.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { x: "You can't assign a string to a real!" diff --git a/tests/auto/declarative/qdeclarativelanguage/data/OnCompletedType.qml b/tests/auto/declarative/qdeclarativelanguage/data/OnCompletedType.qml index 5373959..c2ac5c8 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/OnCompletedType.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/OnCompletedType.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyQmlObject { property int a: Math.max(10, 9) diff --git a/tests/auto/declarative/qdeclarativelanguage/data/OnDestructionType.qml b/tests/auto/declarative/qdeclarativelanguage/data/OnDestructionType.qml index d5c6979..c3d0e1e 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/OnDestructionType.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/OnDestructionType.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyQmlObject { property int a: Math.max(10, 9) diff --git a/tests/auto/declarative/qdeclarativelanguage/data/alias.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.1.qml index 291d47a..44167af 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/alias.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.1.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 QtObject { id: root diff --git a/tests/auto/declarative/qdeclarativelanguage/data/alias.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.3.qml index 787eb77..7e5559a 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/alias.3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.3.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property variant other diff --git a/tests/auto/declarative/qdeclarativelanguage/data/alias.5.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.5.qml index bbd1901..0c839ee 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/alias.5.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.5.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import Test 1.0 QtObject { diff --git a/tests/auto/declarative/qdeclarativelanguage/data/alias.6.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.6.qml index 2d99b64..663e8d0 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/alias.6.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.6.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property QtObject o; diff --git a/tests/auto/declarative/qdeclarativelanguage/data/alias.7.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.7.qml index 4ceff3d..ec5536e 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/alias.7.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.7.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property QtObject object diff --git a/tests/auto/declarative/qdeclarativelanguage/data/alias.8.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.8.qml index 5bf8702..d480611 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/alias.8.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.8.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property variant other diff --git a/tests/auto/declarative/qdeclarativelanguage/data/alias.9.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.9.qml index b8c71e1..0a49ad5 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/alias.9.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.9.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property variant other diff --git a/tests/auto/declarative/qdeclarativelanguage/data/aliasPropertiesAndSignals.qml b/tests/auto/declarative/qdeclarativelanguage/data/aliasPropertiesAndSignals.qml index 59afe58..f04b1f6 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/aliasPropertiesAndSignals.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/aliasPropertiesAndSignals.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { id: root diff --git a/tests/auto/declarative/qdeclarativelanguage/data/assignCompositeToType.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignCompositeToType.qml index 1009df7..ed214ff 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/assignCompositeToType.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/assignCompositeToType.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import Test 1.0 QtObject { diff --git a/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml index bac704e..ab6f3df 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property variant test1: 1 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/assignObjectToVariant.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignObjectToVariant.qml index 2b1ef76..aab7ed2 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/assignObjectToVariant.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/assignObjectToVariant.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 QtObject { property variant a; diff --git a/tests/auto/declarative/qdeclarativelanguage/data/assignToNamespace.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignToNamespace.qml index 2f49418..3cde2e8 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/assignToNamespace.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/assignToNamespace.qml @@ -1,4 +1,4 @@ -import Qt 4.7 as Qt47 +import QtQuick 1.0 as Qt47 Qt47.QtObject { Qt47: 10 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml b/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml index 3a78170..1e93225 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml @@ -1,6 +1,6 @@ import Test 1.0 import Test 1.0 as Namespace -import Qt 4.7 +import QtQuick 1.0 QtObject { MyQmlObject.value: 10 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/component.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/component.1.qml index 730fffd..f4f66dd 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/component.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/component.1.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Component { } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/component.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/component.2.qml index 7e7dd0f..7d677b5 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/component.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/component.2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { id: myId diff --git a/tests/auto/declarative/qdeclarativelanguage/data/component.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/component.3.qml index f0d5f71..1b9af8b 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/component.3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/component.3.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { Component { diff --git a/tests/auto/declarative/qdeclarativelanguage/data/component.4.qml b/tests/auto/declarative/qdeclarativelanguage/data/component.4.qml index 521adbc..806613c 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/component.4.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/component.4.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Component { QtObject {} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/component.5.qml b/tests/auto/declarative/qdeclarativelanguage/data/component.5.qml index 9c3938b..e94022a 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/component.5.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/component.5.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Component { x: 10 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/component.6.qml b/tests/auto/declarative/qdeclarativelanguage/data/component.6.qml index 9208722..8f81a5a 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/component.6.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/component.6.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Component { id: QtObject {} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/component.7.qml b/tests/auto/declarative/qdeclarativelanguage/data/component.7.qml index b81e0c3..94bf189 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/component.7.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/component.7.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Component { property int a diff --git a/tests/auto/declarative/qdeclarativelanguage/data/component.8.qml b/tests/auto/declarative/qdeclarativelanguage/data/component.8.qml index 0b00890..69990ca 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/component.8.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/component.8.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Component { signal a diff --git a/tests/auto/declarative/qdeclarativelanguage/data/component.9.qml b/tests/auto/declarative/qdeclarativelanguage/data/component.9.qml index c5f93c9..5db9815 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/component.9.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/component.9.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Component { function a() {} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/componentCompositeType.qml b/tests/auto/declarative/qdeclarativelanguage/data/componentCompositeType.qml index 725069e..d04da62 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/componentCompositeType.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/componentCompositeType.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property variant test diff --git a/tests/auto/declarative/qdeclarativelanguage/data/crash2.qml b/tests/auto/declarative/qdeclarativelanguage/data/crash2.qml index f11abd9..6ac71ee 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/crash2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/crash2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { objectName: "Hello" + "World" diff --git a/tests/auto/declarative/qdeclarativelanguage/data/customOnProperty.qml b/tests/auto/declarative/qdeclarativelanguage/data/customOnProperty.qml index 438e8e9..c1e4790 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/customOnProperty.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/customOnProperty.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property int on diff --git a/tests/auto/declarative/qdeclarativelanguage/data/customParserIdNotAllowed.qml b/tests/auto/declarative/qdeclarativelanguage/data/customParserIdNotAllowed.qml index 902b598..50bc2ae 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/customParserIdNotAllowed.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/customParserIdNotAllowed.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 ListModel { ListElement { a: 10 } ListElement { id: foo; a: 12 } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/customParserTypes.qml b/tests/auto/declarative/qdeclarativelanguage/data/customParserTypes.qml index 3230e49..4cf6827 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/customParserTypes.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/customParserTypes.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 ListModel { ListElement { a: 10 } ListElement { a: 12 } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/declaredPropertyValues.qml b/tests/auto/declarative/qdeclarativelanguage/data/declaredPropertyValues.qml index c241861..f15373f 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/declaredPropertyValues.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/declaredPropertyValues.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property int a: 10 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/defaultGrouped.qml b/tests/auto/declarative/qdeclarativelanguage/data/defaultGrouped.qml index 0cd0338..d98dfdb 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/defaultGrouped.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/defaultGrouped.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyTypeObject { grouped { diff --git a/tests/auto/declarative/qdeclarativelanguage/data/defaultPropertyListOrder.qml b/tests/auto/declarative/qdeclarativelanguage/data/defaultPropertyListOrder.qml index b4203b5..87dc3d3 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/defaultPropertyListOrder.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/defaultPropertyListOrder.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyContainer { QtObject { diff --git a/tests/auto/declarative/qdeclarativelanguage/data/destroyedSignal.qml b/tests/auto/declarative/qdeclarativelanguage/data/destroyedSignal.qml index 54d080a..ba65d78 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/destroyedSignal.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/destroyedSignal.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { onDestroyed: print("Hello World!") diff --git a/tests/auto/declarative/qdeclarativelanguage/data/dontDoubleCallClassBegin.qml b/tests/auto/declarative/qdeclarativelanguage/data/dontDoubleCallClassBegin.qml index df048cc..0cdbdd7 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/dontDoubleCallClassBegin.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/dontDoubleCallClassBegin.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { property QtObject object: DontDoubleCallClassBeginItem {} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.1.qml index c0ed52c..2b6dd5d 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.1.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { default property QtObject a diff --git a/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.2.qml index 1f46b96..7d11d99 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property int a diff --git a/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.3.qml index cf49062..b0f2828 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.3.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { signal a diff --git a/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.4.qml b/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.4.qml index a14ec4c..e28cad3 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.4.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.4.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { function a() {} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.5.qml b/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.5.qml index ea77cfd..8e4acc0 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.5.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/dynamicMeta.5.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property UnknownType a diff --git a/tests/auto/declarative/qdeclarativelanguage/data/dynamicObject.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/dynamicObject.1.qml index a1be43a..cdad72b 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/dynamicObject.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/dynamicObject.1.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyCustomParserType { propa: a + 10 propb: Math.min(a, 10) diff --git a/tests/auto/declarative/qdeclarativelanguage/data/dynamicObjectProperties.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/dynamicObjectProperties.2.qml index df3de20..c03ec49 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/dynamicObjectProperties.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/dynamicObjectProperties.2.qml @@ -1,5 +1,5 @@ -import Qt 4.7 -import Qt 4.7 as Qt47 +import QtQuick 1.0 +import QtQuick 1.0 as Qt47 Qt.QtObject { property Qt47.QtObject objectProperty diff --git a/tests/auto/declarative/qdeclarativelanguage/data/dynamicObjectProperties.qml b/tests/auto/declarative/qdeclarativelanguage/data/dynamicObjectProperties.qml index c997356..ed25c4b 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/dynamicObjectProperties.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/dynamicObjectProperties.qml @@ -1,6 +1,6 @@ import Test 1.0 -import Qt 4.7 -import Qt 4.7 as Qt47 +import QtQuick 1.0 +import QtQuick 1.0 as Qt47 QtObject { property QtObject objectProperty diff --git a/tests/auto/declarative/qdeclarativelanguage/data/dynamicProperties.qml b/tests/auto/declarative/qdeclarativelanguage/data/dynamicProperties.qml index 6bcae0f..782adef 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/dynamicProperties.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/dynamicProperties.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 QtObject { default property int intProperty : 10 property bool boolProperty: false diff --git a/tests/auto/declarative/qdeclarativelanguage/data/dynamicPropertiesNested.qml b/tests/auto/declarative/qdeclarativelanguage/data/dynamicPropertiesNested.qml index cceb44b..64848fe 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/dynamicPropertiesNested.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/dynamicPropertiesNested.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 DynamicPropertiesNestedType { property int a: 13 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/dynamicSignalsAndSlots.qml b/tests/auto/declarative/qdeclarativelanguage/data/dynamicSignalsAndSlots.qml index 9aa5e86..78978db 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/dynamicSignalsAndSlots.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/dynamicSignalsAndSlots.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { signal signal1 function slot1() {} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/enumTypes.qml b/tests/auto/declarative/qdeclarativelanguage/data/enumTypes.qml index 6b5b451..3eda661 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/enumTypes.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/enumTypes.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Font { } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importNamespaceConflict.qml b/tests/auto/declarative/qdeclarativelanguage/data/importNamespaceConflict.qml index 3b80f0b..39e3846 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/importNamespaceConflict.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/importNamespaceConflict.qml @@ -1,4 +1,4 @@ import Test 1.0 as Rectangle -import Qt 4.7 +import QtQuick 1.0 Rectangle { } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importNonExist.qml b/tests/auto/declarative/qdeclarativelanguage/data/importNonExist.qml index 483cfec..9589692 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/importNonExist.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/importNonExist.qml @@ -1,5 +1,5 @@ // imports... import "will-not-be-found" -import Qt 4.7 +import QtQuick 1.0 Rectangle { } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/inlineQmlComponents.qml b/tests/auto/declarative/qdeclarativelanguage/data/inlineQmlComponents.qml index 1ebec1b..a52bd23 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/inlineQmlComponents.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/inlineQmlComponents.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyContainer { Component { id: myComponent diff --git a/tests/auto/declarative/qdeclarativelanguage/data/interfaceProperty.qml b/tests/auto/declarative/qdeclarativelanguage/data/interfaceProperty.qml index 6a47536..444e234 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/interfaceProperty.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/interfaceProperty.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyQmlObject { interfaceProperty: MyQmlObject {} } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.1.qml index 985fb94..13bdb12 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.1.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property alias a diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.2.qml index a2ac91c..b6378c3 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property alias a: 10 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.1.qml index 84d39df..c6dc44c 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.1.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 QtObject { MyQmlObject.foo: 10 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.10.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.10.qml index 40e3926..4942c21 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.10.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.10.qml @@ -1,5 +1,5 @@ import Test 1.0 as Namespace -import Qt 4.7 +import QtQuick 1.0 QtObject { Namespace.MadeUpClass.foo: 10 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.11.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.11.qml index 28f8220..e1fc8c1 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.11.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.11.qml @@ -1,5 +1,5 @@ import Test 1.0 as Namespace -import Qt 4.7 +import QtQuick 1.0 QtObject { Namespace.madeUpClass.foo: 10 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.2.qml index f45f88f..6938122 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.2.qml @@ -1,5 +1,5 @@ import Test 1.0 as Namespace -import Qt 4.7 +import QtQuick 1.0 QtObject { Namespace.MyQmlObject.foo: 10 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.3.qml index 64bc8bd..842600f 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.3.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 QtObject { MyQmlObject: 10 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.4.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.4.qml index ee3dedb..6f372a6 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.4.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.4.qml @@ -1,5 +1,5 @@ import Test 1.0 as Namespace -import Qt 4.7 +import QtQuick 1.0 QtObject { Namespace.MyQmlObject: 10 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.5.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.5.qml index 66cad2d..07eb6f3 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.5.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.5.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 QtObject { MyQmlObject: QtObject {} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.6.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.6.qml index 90d80bc..b725674 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.6.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.6.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 QtObject { Test.MyQmlObject: QtObject {} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.7.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.7.qml index 5293d55..50004ed 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.7.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.7.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 QtObject { MyTypeObject.foo: 10 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.8.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.8.qml index 6f319c1..7cdf5cd 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.8.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.8.qml @@ -1,5 +1,5 @@ import Test 1.0 as Namespace -import Qt 4.7 +import QtQuick 1.0 QtObject { Namespace.MyTypeObject.foo: 10 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.9.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.9.qml index b7e1302..503e9fa 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.9.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.9.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 QtObject { MadeUpClass.foo: 10 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.1.qml index 671f5ab..94afb16 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.1.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property variant o; diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.2.qml index f897cc8..d4fbf42 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property int o; diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidImportID.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidImportID.errors.txt index a65f5fd..034e937 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidImportID.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidImportID.errors.txt @@ -1 +1 @@ -2:18:Invalid import qualifier ID +2:23:Invalid import qualifier ID diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidImportID.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidImportID.qml index 00fc81b..580a0f3 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidImportID.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidImportID.qml @@ -1,4 +1,4 @@ -import Qt 4.7 -import Qt 4.7 as qt +import QtQuick 1.0 +import QtQuick 1.0 as qt QtObject {} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidProperty.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidProperty.qml index 6077de4..bd26bc5 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidProperty.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidProperty.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property int parseInt diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/InstalledTest.qml b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/InstalledTest.qml index 303b5a5..9985d33 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/InstalledTest.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/InstalledTest.qml @@ -1,2 +1,2 @@ -import Qt 4.7 as Qt47 +import QtQuick 1.0 as Qt47 Qt47.Rectangle {} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/InstalledTest2.qml b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/InstalledTest2.qml index 8c953cb..f63283e 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/InstalledTest2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/InstalledTest2.qml @@ -1,2 +1,2 @@ -import Qt 4.7 +import QtQuick 1.0 Text {} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/LocalLast.qml b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/LocalLast.qml index d09dea7..7f491eb 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/LocalLast.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/LocalLast.qml @@ -1,2 +1,2 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle {} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/PrivateType.qml b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/PrivateType.qml index 62e41a9..03bf25b 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/PrivateType.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/PrivateType.qml @@ -1,2 +1,2 @@ -import Qt 4.7 +import QtQuick 1.0 Image {} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/InstalledTest.qml b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/InstalledTest.qml index 303b5a5..9985d33 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/InstalledTest.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/InstalledTest.qml @@ -1,2 +1,2 @@ -import Qt 4.7 as Qt47 +import QtQuick 1.0 as Qt47 Qt47.Rectangle {} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/InstalledTest2.qml b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/InstalledTest2.qml index 8c953cb..f63283e 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/InstalledTest2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest0/InstalledTest2.qml @@ -1,2 +1,2 @@ -import Qt 4.7 +import QtQuick 1.0 Text {} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/listAssignment.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/listAssignment.1.qml index 6c628e4..c02dd33 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/listAssignment.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/listAssignment.1.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyContainer { containerChildren: QtObject {} } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/listItemDeleteSelf.qml b/tests/auto/declarative/qdeclarativelanguage/data/listItemDeleteSelf.qml index 0393382..85abbdc 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/listItemDeleteSelf.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/listItemDeleteSelf.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { ListModel { diff --git a/tests/auto/declarative/qdeclarativelanguage/data/listProperties.qml b/tests/auto/declarative/qdeclarativelanguage/data/listProperties.qml index 3027722..1f60951 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/listProperties.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/listProperties.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property list listProperty diff --git a/tests/auto/declarative/qdeclarativelanguage/data/method.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/method.1.qml index a2d8799..a3f97f8 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/method.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/method.1.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { function MyMethod() {} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/missingSignal.qml b/tests/auto/declarative/qdeclarativelanguage/data/missingSignal.qml index 1a417a9..e0e8442 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/missingSignal.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/missingSignal.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 QtObject { onClicked: console.log("Hello world!") } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.qml b/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.qml index 0aa3405..bbd05a1 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { NestedErrorsType {} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/noCreation.qml b/tests/auto/declarative/qdeclarativelanguage/data/noCreation.qml index 077abe1..548b7b8 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/noCreation.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/noCreation.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Keys { } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/onCompleted.qml b/tests/auto/declarative/qdeclarativelanguage/data/onCompleted.qml index 71a7d26..e75f904 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/onCompleted.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/onCompleted.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyTypeObject { // We set a and b to ensure that onCompleted is executed after bindings and diff --git a/tests/auto/declarative/qdeclarativelanguage/data/onDestruction.qml b/tests/auto/declarative/qdeclarativelanguage/data/onDestruction.qml index 1b1eef9..77fe2ff 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/onDestruction.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/onDestruction.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyTypeObject { // We set a and b to ensure that onCompleted is executed after bindings and diff --git a/tests/auto/declarative/qdeclarativelanguage/data/property.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/property.1.qml index b3384d4..0b46ceb 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/property.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/property.1.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property blah a; diff --git a/tests/auto/declarative/qdeclarativelanguage/data/property.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/property.2.qml index 1ba9b17..3ff1686 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/property.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/property.2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property invalidmodifier a; diff --git a/tests/auto/declarative/qdeclarativelanguage/data/property.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/property.3.qml index 261e7e3..b219120 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/property.3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/property.3.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property invalidmodifier a; diff --git a/tests/auto/declarative/qdeclarativelanguage/data/property.4.qml b/tests/auto/declarative/qdeclarativelanguage/data/property.4.qml index 0a0f969..bfadc9d 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/property.4.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/property.4.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { readonly property int a diff --git a/tests/auto/declarative/qdeclarativelanguage/data/property.5.qml b/tests/auto/declarative/qdeclarativelanguage/data/property.5.qml index 0340f79..1bb4850 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/property.5.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/property.5.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { readonly property int a: value diff --git a/tests/auto/declarative/qdeclarativelanguage/data/property.6.qml b/tests/auto/declarative/qdeclarativelanguage/data/property.6.qml index aad9e07..b5b3f42 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/property.6.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/property.6.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property int Hello diff --git a/tests/auto/declarative/qdeclarativelanguage/data/property.7.qml b/tests/auto/declarative/qdeclarativelanguage/data/property.7.qml index 0246b2f..f9ec68a 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/property.7.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/property.7.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property int Hello: 10 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/qmlAttachedPropertiesObjectMethod.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/qmlAttachedPropertiesObjectMethod.1.qml index d038ba3..dea52c9 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/qmlAttachedPropertiesObjectMethod.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/qmlAttachedPropertiesObjectMethod.1.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 QtObject { } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/qmlAttachedPropertiesObjectMethod.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/qmlAttachedPropertiesObjectMethod.2.qml index 1eab9f6..18c65c3 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/qmlAttachedPropertiesObjectMethod.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/qmlAttachedPropertiesObjectMethod.2.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 QtObject { MyQmlObject.value: 10 } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/readOnly.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/readOnly.3.qml index cfe255a..c70a55c 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/readOnly.3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/readOnly.3.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 QtObject { property variant child diff --git a/tests/auto/declarative/qdeclarativelanguage/data/signal.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/signal.1.qml index 63fd74f..7d1a9db 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/signal.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/signal.1.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { signal mySignal(nontype a) diff --git a/tests/auto/declarative/qdeclarativelanguage/data/signal.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/signal.2.qml index c11ce17..e7780a0 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/signal.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/signal.2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { signal mySignal(,) diff --git a/tests/auto/declarative/qdeclarativelanguage/data/signal.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/signal.3.qml index 771ea50..4289bce 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/signal.3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/signal.3.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { signal mySignal(a) diff --git a/tests/auto/declarative/qdeclarativelanguage/data/signal.4.qml b/tests/auto/declarative/qdeclarativelanguage/data/signal.4.qml index 37c938a..6ce417d 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/signal.4.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/signal.4.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { signal MySignal diff --git a/tests/auto/declarative/qdeclarativelanguage/data/subdir/Test.qml b/tests/auto/declarative/qdeclarativelanguage/data/subdir/Test.qml index 1421361..0b054d0 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/subdir/Test.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/subdir/Test.qml @@ -1,2 +1,2 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/subdir/subsubdir/SubTest.qml b/tests/auto/declarative/qdeclarativelanguage/data/subdir/subsubdir/SubTest.qml index 1421361..0b054d0 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/subdir/subsubdir/SubTest.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/subdir/subsubdir/SubTest.qml @@ -1,2 +1,2 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/variantNotify.qml b/tests/auto/declarative/qdeclarativelanguage/data/variantNotify.qml index e7aaf16..cc3f1c2 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/variantNotify.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/variantNotify.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property int notifyCount: 0 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/wrongType.16.qml b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.16.qml index 1ddccc0..0699d67 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/wrongType.16.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.16.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyQmlObject { qmlobjectProperty: QtObject {} } diff --git a/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/LocalInternal.qml b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/LocalInternal.qml index d5a61ae..289cd21 100644 --- a/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/LocalInternal.qml +++ b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/LocalInternal.qml @@ -1,3 +1,3 @@ -import Qt 4.7 +import QtQuick 1.0 Image { source: "pics/blue.png" } diff --git a/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/Test.qml b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/Test.qml index 1421361..0b054d0 100644 --- a/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/Test.qml +++ b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/Test.qml @@ -1,2 +1,2 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { } diff --git a/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/UndeclaredLocal.qml b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/UndeclaredLocal.qml index d5a61ae..289cd21 100644 --- a/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/UndeclaredLocal.qml +++ b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/UndeclaredLocal.qml @@ -1,3 +1,3 @@ -import Qt 4.7 +import QtQuick 1.0 Image { source: "pics/blue.png" } diff --git a/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/subdir/SubTest.qml b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/subdir/SubTest.qml index 43aeb74..76d11dc 100644 --- a/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/subdir/SubTest.qml +++ b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/subdir/SubTest.qml @@ -1,3 +1,3 @@ -import Qt 4.7 +import QtQuick 1.0 Text {} diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 1825991..f811555 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -1384,12 +1384,12 @@ void tst_qdeclarativelanguage::importsLocal_data() << "QDeclarativeRectangle" << ""; QTest::newRow("local import second") - << "import Qt 4.7\nimport \"subdir\"\n" + << "import QtQuick 1.0\nimport \"subdir\"\n" "Test {}" << "QDeclarativeRectangle" << ""; QTest::newRow("local import subsubdir") - << "import Qt 4.7\nimport \"subdir/subsubdir\"\n" + << "import QtQuick 1.0\nimport \"subdir/subsubdir\"\n" "SubTest {}" << "QDeclarativeRectangle" << ""; @@ -1603,24 +1603,24 @@ void tst_qdeclarativelanguage::importsOrder_data() QTest::newRow("installed import versus builtin 1") << "import com.nokia.installedtest 1.5\n" - "import Qt 4.7\n" + "import QtQuick 1.0\n" "Rectangle {}" << (!qmlCheckTypes()?"QDeclarativeRectangle":"") << (!qmlCheckTypes()?"":"Rectangle is ambiguous. Found in Qt and in lib/com/nokia/installedtest"); QTest::newRow("installed import versus builtin 2") << - "import Qt 4.7\n" + "import QtQuick 1.0\n" "import com.nokia.installedtest 1.5\n" "Rectangle {}" << (!qmlCheckTypes()?"QDeclarativeText":"") << (!qmlCheckTypes()?"":"Rectangle is ambiguous. Found in lib/com/nokia/installedtest and in Qt"); QTest::newRow("namespaces cannot be overridden by types 1") << - "import Qt 4.7 as Rectangle\n" + "import QtQuick 1.0 as Rectangle\n" "import com.nokia.installedtest 1.5\n" "Rectangle {}" << "" << "Namespace Rectangle cannot be used as a type"; QTest::newRow("namespaces cannot be overridden by types 2") << - "import Qt 4.7 as Rectangle\n" + "import QtQuick 1.0 as Rectangle\n" "import com.nokia.installedtest 1.5\n" "Rectangle.Image {}" << "QDeclarativeImage" @@ -1675,7 +1675,7 @@ void tst_qdeclarativelanguage::qmlAttachedPropertiesObjectMethod() void tst_qdeclarativelanguage::crash1() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.7\nComponent {}", QUrl()); + component.setData("import QtQuick 1.0\nComponent {}", QUrl()); } void tst_qdeclarativelanguage::crash2() diff --git a/tests/auto/declarative/qdeclarativelayoutitem/data/layoutItem.qml b/tests/auto/declarative/qdeclarativelayoutitem/data/layoutItem.qml index ee881a2..3497133 100644 --- a/tests/auto/declarative/qdeclarativelayoutitem/data/layoutItem.qml +++ b/tests/auto/declarative/qdeclarativelayoutitem/data/layoutItem.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 LayoutItem {//Sized by the layout id: resizable diff --git a/tests/auto/declarative/qdeclarativelistmodel/data/enumerate.qml b/tests/auto/declarative/qdeclarativelistmodel/data/enumerate.qml index 296cb9c..93697f3 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/data/enumerate.qml +++ b/tests/auto/declarative/qdeclarativelistmodel/data/enumerate.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { property string result diff --git a/tests/auto/declarative/qdeclarativelistmodel/data/model.qml b/tests/auto/declarative/qdeclarativelistmodel/data/model.qml index f8a9175..bfd547e 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/data/model.qml +++ b/tests/auto/declarative/qdeclarativelistmodel/data/model.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { id: item diff --git a/tests/auto/declarative/qdeclarativelistmodel/data/multipleroles.qml b/tests/auto/declarative/qdeclarativelistmodel/data/multipleroles.qml index b8f2f32..cc6d9de 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/data/multipleroles.qml +++ b/tests/auto/declarative/qdeclarativelistmodel/data/multipleroles.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 ListView { width: 100 height: 250 @@ -22,4 +22,4 @@ ListView { rounded: false } } -} \ No newline at end of file +} diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index 31cb545..b433570 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -149,7 +149,7 @@ void tst_qdeclarativelistmodel::static_i18n() { QString expect = QString::fromUtf8("na\303\257ve"); - QString componentStr = "import Qt 4.7\nListModel { ListElement { prop1: \""+expect+"\"; prop2: QT_TR_NOOP(\""+expect+"\") } }"; + QString componentStr = "import QtQuick 1.0\nListModel { ListElement { prop1: \""+expect+"\"; prop2: QT_TR_NOOP(\""+expect+"\") } }"; QDeclarativeEngine engine; QDeclarativeComponent component(&engine); component.setData(componentStr.toUtf8(), QUrl::fromLocalFile("")); @@ -172,7 +172,7 @@ void tst_qdeclarativelistmodel::static_nestedElements() QString elementsStr = elements.join(",\n") + "\n"; QString componentStr = - "import Qt 4.7\n" + "import QtQuick 1.0\n" "ListModel {\n" " ListElement {\n" " attributes: [\n"; @@ -549,7 +549,7 @@ void tst_qdeclarativelistmodel::static_types() QFETCH(QString, qml); QFETCH(QVariant, value); - qml = "import Qt 4.7\nListModel { " + qml + " }"; + qml = "import QtQuick 1.0\nListModel { " + qml + " }"; QDeclarativeEngine engine; QDeclarativeComponent component(&engine); @@ -598,47 +598,47 @@ void tst_qdeclarativelistmodel::error_data() QTest::addColumn("error"); QTest::newRow("id not allowed in ListElement") - << "import Qt 4.7\nListModel { ListElement { id: fred } }" + << "import QtQuick 1.0\nListModel { ListElement { id: fred } }" << "ListElement: cannot use reserved \"id\" property"; QTest::newRow("id allowed in ListModel") - << "import Qt 4.7\nListModel { id:model }" + << "import QtQuick 1.0\nListModel { id:model }" << ""; QTest::newRow("random properties not allowed in ListModel") - << "import Qt 4.7\nListModel { foo:123 }" + << "import QtQuick 1.0\nListModel { foo:123 }" << "ListModel: undefined property 'foo'"; QTest::newRow("random properties allowed in ListElement") - << "import Qt 4.7\nListModel { ListElement { foo:123 } }" + << "import QtQuick 1.0\nListModel { ListElement { foo:123 } }" << ""; QTest::newRow("bindings not allowed in ListElement") - << "import Qt 4.7\nRectangle { id: rect; ListModel { ListElement { foo: rect.color } } }" + << "import QtQuick 1.0\nRectangle { id: rect; ListModel { ListElement { foo: rect.color } } }" << "ListElement: cannot use script for property value"; QTest::newRow("random object list properties allowed in ListElement") - << "import Qt 4.7\nListModel { ListElement { foo: [ ListElement { bar: 123 } ] } }" + << "import QtQuick 1.0\nListModel { ListElement { foo: [ ListElement { bar: 123 } ] } }" << ""; QTest::newRow("default properties not allowed in ListElement") - << "import Qt 4.7\nListModel { ListElement { Item { } } }" + << "import QtQuick 1.0\nListModel { ListElement { Item { } } }" << "ListElement: cannot contain nested elements"; QTest::newRow("QML elements not allowed in ListElement") - << "import Qt 4.7\nListModel { ListElement { a: Item { } } }" + << "import QtQuick 1.0\nListModel { ListElement { a: Item { } } }" << "ListElement: cannot contain nested elements"; QTest::newRow("qualified ListElement supported") - << "import Qt 4.7 as Foo\nFoo.ListModel { Foo.ListElement { a: 123 } }" + << "import QtQuick 1.0 as Foo\nFoo.ListModel { Foo.ListElement { a: 123 } }" << ""; QTest::newRow("qualified ListElement required") - << "import Qt 4.7 as Foo\nFoo.ListModel { ListElement { a: 123 } }" + << "import QtQuick 1.0 as Foo\nFoo.ListModel { ListElement { a: 123 } }" << "ListElement is not a type"; QTest::newRow("unknown qualified ListElement not allowed") - << "import Qt 4.7\nListModel { Foo.ListElement { a: 123 } }" + << "import QtQuick 1.0\nListModel { Foo.ListElement { a: 123 } }" << "Foo.ListElement - Foo is not a namespace"; } @@ -700,7 +700,7 @@ void tst_qdeclarativelistmodel::get() QDeclarativeEngine eng; QDeclarativeComponent component(&eng); component.setData( - "import Qt 4.7\n" + "import QtQuick 1.0\n" "ListModel { \n" "ListElement { roleA: 100 }\n" "ListElement { roleA: 200; roleB: 400 } \n" @@ -813,7 +813,7 @@ void tst_qdeclarativelistmodel::get_nested() QDeclarativeEngine eng; QDeclarativeComponent component(&eng); component.setData( - "import Qt 4.7\n" + "import QtQuick 1.0\n" "ListModel { \n" "ListElement {\n" "listRoleA: [\n" diff --git a/tests/auto/declarative/qdeclarativelistreference/data/MyType.qml b/tests/auto/declarative/qdeclarativelistreference/data/MyType.qml index 0275e21..0687ce3 100644 --- a/tests/auto/declarative/qdeclarativelistreference/data/MyType.qml +++ b/tests/auto/declarative/qdeclarativelistreference/data/MyType.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property int a diff --git a/tests/auto/declarative/qdeclarativelistreference/data/engineTypes.qml b/tests/auto/declarative/qdeclarativelistreference/data/engineTypes.qml index 1ab5692..9ddc763 100644 --- a/tests/auto/declarative/qdeclarativelistreference/data/engineTypes.qml +++ b/tests/auto/declarative/qdeclarativelistreference/data/engineTypes.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property list myList diff --git a/tests/auto/declarative/qdeclarativelistreference/data/variantToList.qml b/tests/auto/declarative/qdeclarativelistreference/data/variantToList.qml index 13de975..39a49e8 100644 --- a/tests/auto/declarative/qdeclarativelistreference/data/variantToList.qml +++ b/tests/auto/declarative/qdeclarativelistreference/data/variantToList.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property list myList; diff --git a/tests/auto/declarative/qdeclarativelistview/data/displaylist.qml b/tests/auto/declarative/qdeclarativelistview/data/displaylist.qml index defd13e..487b70e 100644 --- a/tests/auto/declarative/qdeclarativelistview/data/displaylist.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/displaylist.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 240 diff --git a/tests/auto/declarative/qdeclarativelistview/data/footer.qml b/tests/auto/declarative/qdeclarativelistview/data/footer.qml index 11cbe16..4cbd33b 100644 --- a/tests/auto/declarative/qdeclarativelistview/data/footer.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/footer.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 240 diff --git a/tests/auto/declarative/qdeclarativelistview/data/itemlist.qml b/tests/auto/declarative/qdeclarativelistview/data/itemlist.qml index 9ea5953..fca2901 100644 --- a/tests/auto/declarative/qdeclarativelistview/data/itemlist.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/itemlist.qml @@ -1,7 +1,7 @@ // This example demonstrates placing items in a view using // a VisualItemModel -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "lightgray" diff --git a/tests/auto/declarative/qdeclarativelistview/data/listview-enforcerange.qml b/tests/auto/declarative/qdeclarativelistview/data/listview-enforcerange.qml index 939a4d5..49dbcb3 100644 --- a/tests/auto/declarative/qdeclarativelistview/data/listview-enforcerange.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/listview-enforcerange.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 240 diff --git a/tests/auto/declarative/qdeclarativelistview/data/listview-initCurrent.qml b/tests/auto/declarative/qdeclarativelistview/data/listview-initCurrent.qml index f3c2910..2c4cfab 100644 --- a/tests/auto/declarative/qdeclarativelistview/data/listview-initCurrent.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/listview-initCurrent.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { property int current: list.currentIndex diff --git a/tests/auto/declarative/qdeclarativelistview/data/listview-sections.qml b/tests/auto/declarative/qdeclarativelistview/data/listview-sections.qml index 9a5ea55..283678b 100644 --- a/tests/auto/declarative/qdeclarativelistview/data/listview-sections.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/listview-sections.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 240 diff --git a/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml b/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml index d5d3365..534540f 100644 --- a/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 240 diff --git a/tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml b/tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml index 4913ebe..d8cfd9a 100644 --- a/tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { diff --git a/tests/auto/declarative/qdeclarativelistview/data/propertychangestest.qml b/tests/auto/declarative/qdeclarativelistview/data/propertychangestest.qml index 300fcb5..04bec59 100644 --- a/tests/auto/declarative/qdeclarativelistview/data/propertychangestest.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/propertychangestest.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 180; height: 120; color: "white" diff --git a/tests/auto/declarative/qdeclarativelistview/data/strictlyenforcerange.qml b/tests/auto/declarative/qdeclarativelistview/data/strictlyenforcerange.qml index 6fc41fa..bb77a77 100644 --- a/tests/auto/declarative/qdeclarativelistview/data/strictlyenforcerange.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/strictlyenforcerange.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 ListView { id: list diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index cd17fad..6452bae 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -1416,10 +1416,10 @@ void tst_QDeclarativeListView::componentChanges() QTRY_VERIFY(listView); QDeclarativeComponent component(canvas->engine()); - component.setData("import Qt 4.7; Rectangle { color: \"blue\"; }", QUrl::fromLocalFile("")); + component.setData("import QtQuick 1.0; Rectangle { color: \"blue\"; }", QUrl::fromLocalFile("")); QDeclarativeComponent delegateComponent(canvas->engine()); - delegateComponent.setData("import Qt 4.7; Text { text: 'Name: ' + name }", QUrl::fromLocalFile("")); + delegateComponent.setData("import QtQuick 1.0; Text { text: 'Name: ' + name }", QUrl::fromLocalFile("")); QSignalSpy highlightSpy(listView, SIGNAL(highlightChanged())); QSignalSpy delegateSpy(listView, SIGNAL(delegateChanged())); diff --git a/tests/auto/declarative/qdeclarativeloader/data/AnchoredLoader.qml b/tests/auto/declarative/qdeclarativeloader/data/AnchoredLoader.qml index 5d02dae..7654c07 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/AnchoredLoader.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/AnchoredLoader.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 300 diff --git a/tests/auto/declarative/qdeclarativeloader/data/BlueRect.qml b/tests/auto/declarative/qdeclarativeloader/data/BlueRect.qml index f202fc8..d2da64d 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/BlueRect.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/BlueRect.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { objectName: "blue" diff --git a/tests/auto/declarative/qdeclarativeloader/data/GraphicsWidget250x250.qml b/tests/auto/declarative/qdeclarativeloader/data/GraphicsWidget250x250.qml index 3b851c1..139657b 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/GraphicsWidget250x250.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/GraphicsWidget250x250.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QGraphicsWidget { size: "250x250" diff --git a/tests/auto/declarative/qdeclarativeloader/data/GreenRect.qml b/tests/auto/declarative/qdeclarativeloader/data/GreenRect.qml index 9b8f770..5aeb81e 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/GreenRect.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/GreenRect.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 100; height: 100 diff --git a/tests/auto/declarative/qdeclarativeloader/data/NoResize.qml b/tests/auto/declarative/qdeclarativeloader/data/NoResize.qml index 72cd3b9..bb1030e 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/NoResize.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/NoResize.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { width: 200; height: 80 diff --git a/tests/auto/declarative/qdeclarativeloader/data/NoResizeGraphicsWidget.qml b/tests/auto/declarative/qdeclarativeloader/data/NoResizeGraphicsWidget.qml index 0cff506..5a31eff 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/NoResizeGraphicsWidget.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/NoResizeGraphicsWidget.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { width: 200 diff --git a/tests/auto/declarative/qdeclarativeloader/data/Rect120x60.qml b/tests/auto/declarative/qdeclarativeloader/data/Rect120x60.qml index d808c51..5a35284 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/Rect120x60.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/Rect120x60.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 120 diff --git a/tests/auto/declarative/qdeclarativeloader/data/SetSourceComponent.qml b/tests/auto/declarative/qdeclarativeloader/data/SetSourceComponent.qml index d99dd01..fa2d3cb 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/SetSourceComponent.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/SetSourceComponent.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { function clear() { diff --git a/tests/auto/declarative/qdeclarativeloader/data/SizeGraphicsWidgetToLoader.qml b/tests/auto/declarative/qdeclarativeloader/data/SizeGraphicsWidgetToLoader.qml index 81610ad..a855947 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/SizeGraphicsWidgetToLoader.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/SizeGraphicsWidgetToLoader.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Loader { width: 200 diff --git a/tests/auto/declarative/qdeclarativeloader/data/SizeLoaderToGraphicsWidget.qml b/tests/auto/declarative/qdeclarativeloader/data/SizeLoaderToGraphicsWidget.qml index a801a42..b6fd57f 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/SizeLoaderToGraphicsWidget.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/SizeLoaderToGraphicsWidget.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Loader { source: "GraphicsWidget250x250.qml" diff --git a/tests/auto/declarative/qdeclarativeloader/data/SizeToItem.qml b/tests/auto/declarative/qdeclarativeloader/data/SizeToItem.qml index 77aa8d9..36ce991 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/SizeToItem.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/SizeToItem.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Loader { source: "Rect120x60.qml" diff --git a/tests/auto/declarative/qdeclarativeloader/data/SizeToLoader.qml b/tests/auto/declarative/qdeclarativeloader/data/SizeToLoader.qml index 0098927..4fa945b 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/SizeToLoader.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/SizeToLoader.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Loader { width: 200; height: 80 diff --git a/tests/auto/declarative/qdeclarativeloader/data/VmeError.qml b/tests/auto/declarative/qdeclarativeloader/data/VmeError.qml index 633f03d..a36c246 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/VmeError.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/VmeError.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 100; height: 100; color: "red" diff --git a/tests/auto/declarative/qdeclarativeloader/data/crash.qml b/tests/auto/declarative/qdeclarativeloader/data/crash.qml index db9abca..c7a4407 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/crash.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/crash.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400 diff --git a/tests/auto/declarative/qdeclarativeloader/data/differentorigin.qml b/tests/auto/declarative/qdeclarativeloader/data/differentorigin.qml index b32558b..043ce55 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/differentorigin.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/differentorigin.qml @@ -1,3 +1,3 @@ -import Qt 4.7 +import QtQuick 1.0 Loader { source: "http://evil.place/evil.qml" } diff --git a/tests/auto/declarative/qdeclarativeloader/data/nonItem.qml b/tests/auto/declarative/qdeclarativeloader/data/nonItem.qml index 5ce003d..1d0ab5c 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/nonItem.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/nonItem.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Loader { sourceComponent: QtObject {} diff --git a/tests/auto/declarative/qdeclarativeloader/data/sameorigin-load.qml b/tests/auto/declarative/qdeclarativeloader/data/sameorigin-load.qml index 812c1be..dbea969 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/sameorigin-load.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/sameorigin-load.qml @@ -1,3 +1,3 @@ -import Qt 4.7 +import QtQuick 1.0 Item { } diff --git a/tests/auto/declarative/qdeclarativeloader/data/sameorigin.qml b/tests/auto/declarative/qdeclarativeloader/data/sameorigin.qml index 91732a1..8ba13a0 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/sameorigin.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/sameorigin.qml @@ -1,3 +1,3 @@ -import Qt 4.7 +import QtQuick 1.0 Loader { source: "sameorigin-load.qml" } diff --git a/tests/auto/declarative/qdeclarativeloader/data/vmeErrors.qml b/tests/auto/declarative/qdeclarativeloader/data/vmeErrors.qml index ae33e00..cfced31 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/vmeErrors.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/vmeErrors.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Loader { source: "VmeError.qml" diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp index b62392d..8d04616 100644 --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp @@ -102,7 +102,7 @@ tst_QDeclarativeLoader::tst_QDeclarativeLoader() void tst_QDeclarativeLoader::url() { QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.7\nLoader { property int did_load: 0; onLoaded: did_load=123; source: \"Rect120x60.qml\" }"), TEST_FILE("")); + component.setData(QByteArray("import QtQuick 1.0\nLoader { property int did_load: 0; onLoaded: did_load=123; source: \"Rect120x60.qml\" }"), TEST_FILE("")); QDeclarativeLoader *loader = qobject_cast(component.create()); QVERIFY(loader != 0); QVERIFY(loader->item()); @@ -140,7 +140,7 @@ void tst_QDeclarativeLoader::invalidUrl() QTest::ignoreMessage(QtWarningMsg, QString(QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml").toString() + ": File not found").toUtf8().constData()); QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.7\nLoader { source: \"IDontExist.qml\" }"), TEST_FILE("")); + component.setData(QByteArray("import QtQuick 1.0\nLoader { source: \"IDontExist.qml\" }"), TEST_FILE("")); QDeclarativeLoader *loader = qobject_cast(component.create()); QVERIFY(loader != 0); QVERIFY(loader->item() == 0); @@ -156,7 +156,7 @@ void tst_QDeclarativeLoader::clear() { QDeclarativeComponent component(&engine); component.setData(QByteArray( - "import Qt 4.7\n" + "import QtQuick 1.0\n" " Loader { id: loader\n" " source: 'Rect120x60.qml'\n" " Timer { interval: 200; running: true; onTriggered: loader.source = '' }\n" @@ -220,7 +220,7 @@ void tst_QDeclarativeLoader::clear() void tst_QDeclarativeLoader::urlToComponent() { QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.7\n" + component.setData(QByteArray("import QtQuick 1.0\n" "Loader {\n" " id: loader\n" " Component { id: myComp; Rectangle { width: 10; height: 10 } }\n" @@ -445,7 +445,7 @@ void tst_QDeclarativeLoader::networkRequestUrl() server.serveDirectory(SRCDIR "/data"); QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.7\nLoader { property int did_load : 0; source: \"http://127.0.0.1:14450/Rect120x60.qml\"; onLoaded: did_load=123 }"), QUrl::fromLocalFile(SRCDIR "/dummy.qml")); + component.setData(QByteArray("import QtQuick 1.0\nLoader { property int did_load : 0; source: \"http://127.0.0.1:14450/Rect120x60.qml\"; onLoaded: did_load=123 }"), QUrl::fromLocalFile(SRCDIR "/dummy.qml")); if (component.isError()) qDebug() << component.errors(); QDeclarativeLoader *loader = qobject_cast(component.create()); @@ -470,7 +470,7 @@ void tst_QDeclarativeLoader::networkComponent() QDeclarativeComponent component(&engine); component.setData(QByteArray( - "import Qt 4.7\n" + "import QtQuick 1.0\n" "import \"http://127.0.0.1:14450/\" as NW\n" "Item {\n" " Component { id: comp; NW.SlowRect {} }\n" @@ -502,7 +502,7 @@ void tst_QDeclarativeLoader::failNetworkRequest() QTest::ignoreMessage(QtWarningMsg, "http://127.0.0.1:14450/IDontExist.qml: File not found"); QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.7\nLoader { property int did_load: 123; source: \"http://127.0.0.1:14450/IDontExist.qml\"; onLoaded: did_load=456 }"), QUrl::fromLocalFile("http://127.0.0.1:14450/dummy.qml")); + component.setData(QByteArray("import QtQuick 1.0\nLoader { property int did_load: 123; source: \"http://127.0.0.1:14450/IDontExist.qml\"; onLoaded: did_load=456 }"), QUrl::fromLocalFile("http://127.0.0.1:14450/dummy.qml")); QDeclarativeLoader *loader = qobject_cast(component.create()); QVERIFY(loader != 0); diff --git a/tests/auto/declarative/qdeclarativemousearea/data/clickandhold.qml b/tests/auto/declarative/qdeclarativemousearea/data/clickandhold.qml index f926daa..a6409e2 100644 --- a/tests/auto/declarative/qdeclarativemousearea/data/clickandhold.qml +++ b/tests/auto/declarative/qdeclarativemousearea/data/clickandhold.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { id: root diff --git a/tests/auto/declarative/qdeclarativemousearea/data/doubleclick.qml b/tests/auto/declarative/qdeclarativemousearea/data/doubleclick.qml index 9cddf1b..2348444 100644 --- a/tests/auto/declarative/qdeclarativemousearea/data/doubleclick.qml +++ b/tests/auto/declarative/qdeclarativemousearea/data/doubleclick.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { id: root diff --git a/tests/auto/declarative/qdeclarativemousearea/data/dragging.qml b/tests/auto/declarative/qdeclarativemousearea/data/dragging.qml index a28f049..dd89efb 100644 --- a/tests/auto/declarative/qdeclarativemousearea/data/dragging.qml +++ b/tests/auto/declarative/qdeclarativemousearea/data/dragging.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: whiteRect width: 200 diff --git a/tests/auto/declarative/qdeclarativemousearea/data/dragproperties.qml b/tests/auto/declarative/qdeclarativemousearea/data/dragproperties.qml index ba15250..7baefd5 100644 --- a/tests/auto/declarative/qdeclarativemousearea/data/dragproperties.qml +++ b/tests/auto/declarative/qdeclarativemousearea/data/dragproperties.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: whiteRect width: 200 diff --git a/tests/auto/declarative/qdeclarativemousearea/data/dragreset.qml b/tests/auto/declarative/qdeclarativemousearea/data/dragreset.qml index 789125b..c6d2e20 100644 --- a/tests/auto/declarative/qdeclarativemousearea/data/dragreset.qml +++ b/tests/auto/declarative/qdeclarativemousearea/data/dragreset.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: whiteRect width: 200 diff --git a/tests/auto/declarative/qdeclarativemousearea/data/rejectEvent.qml b/tests/auto/declarative/qdeclarativemousearea/data/rejectEvent.qml index c01e938..fc8292d 100644 --- a/tests/auto/declarative/qdeclarativemousearea/data/rejectEvent.qml +++ b/tests/auto/declarative/qdeclarativemousearea/data/rejectEvent.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: root diff --git a/tests/auto/declarative/qdeclarativemousearea/data/updateMousePosOnClick.qml b/tests/auto/declarative/qdeclarativemousearea/data/updateMousePosOnClick.qml index 6008499..b77f743 100644 --- a/tests/auto/declarative/qdeclarativemousearea/data/updateMousePosOnClick.qml +++ b/tests/auto/declarative/qdeclarativemousearea/data/updateMousePosOnClick.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "#ffffff" diff --git a/tests/auto/declarative/qdeclarativemousearea/data/updateMousePosOnResize.qml b/tests/auto/declarative/qdeclarativemousearea/data/updateMousePosOnResize.qml index 2a2b905..6571d8b 100644 --- a/tests/auto/declarative/qdeclarativemousearea/data/updateMousePosOnResize.qml +++ b/tests/auto/declarative/qdeclarativemousearea/data/updateMousePosOnResize.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "#ffffff" diff --git a/tests/auto/declarative/qdeclarativeparticles/data/particlemotiontest.qml b/tests/auto/declarative/qdeclarativeparticles/data/particlemotiontest.qml index ec8f452..dad9746 100644 --- a/tests/auto/declarative/qdeclarativeparticles/data/particlemotiontest.qml +++ b/tests/auto/declarative/qdeclarativeparticles/data/particlemotiontest.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.particles 1.0 Rectangle { diff --git a/tests/auto/declarative/qdeclarativeparticles/data/particlestest.qml b/tests/auto/declarative/qdeclarativeparticles/data/particlestest.qml index af15665..c76fe9b 100644 --- a/tests/auto/declarative/qdeclarativeparticles/data/particlestest.qml +++ b/tests/auto/declarative/qdeclarativeparticles/data/particlestest.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.particles 1.0 Rectangle{ diff --git a/tests/auto/declarative/qdeclarativepathview/data/datamodel.qml b/tests/auto/declarative/qdeclarativepathview/data/datamodel.qml index fb3c910..1322025 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/datamodel.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/datamodel.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 PathView { id: pathview diff --git a/tests/auto/declarative/qdeclarativepathview/data/displaypath.qml b/tests/auto/declarative/qdeclarativepathview/data/displaypath.qml index c82914f..88dfc57 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/displaypath.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/displaypath.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 240 diff --git a/tests/auto/declarative/qdeclarativepathview/data/emptymodel.qml b/tests/auto/declarative/qdeclarativepathview/data/emptymodel.qml index 177c405..4deb45f 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/emptymodel.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/emptymodel.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 PathView { model: emptyModel diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathUpdateOnStartChanged.qml b/tests/auto/declarative/qdeclarativepathview/data/pathUpdateOnStartChanged.qml index ce0f0c9..bd732ab 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/pathUpdateOnStartChanged.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/pathUpdateOnStartChanged.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 800 diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathtest.qml b/tests/auto/declarative/qdeclarativepathview/data/pathtest.qml index caa1586..b13c006 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/pathtest.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/pathtest.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Path { startX: 120; startY: 100 diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathview0.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview0.qml index ff6f224..04c7717 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/pathview0.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/pathview0.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: root diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathview1.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview1.qml index c3d2f91..d1ac517 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/pathview1.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/pathview1.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 PathView { } diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathview2.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview2.qml index 2ce66a2..1e1e893 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/pathview2.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/pathview2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 PathView { id: photoPathView diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml index 066c531..cd1ba03 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 PathView { id: photoPathView diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathview_package.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview_package.qml index 082da13..f9157bd 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/pathview_package.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/pathview_package.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { width: 800; height: 600 diff --git a/tests/auto/declarative/qdeclarativepathview/data/propertychanges.qml b/tests/auto/declarative/qdeclarativepathview/data/propertychanges.qml index 6cc9d2a..c0cc855 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/propertychanges.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/propertychanges.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 350; height: 220; color: "white" diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index cbfbfbd..3b5d438 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -687,7 +687,7 @@ void tst_QDeclarativePathView::componentChanges() QVERIFY(pathView); QDeclarativeComponent delegateComponent(canvas->engine()); - delegateComponent.setData("import Qt 4.7; Text { text: 'Name: ' + name }", QUrl::fromLocalFile("")); + delegateComponent.setData("import QtQuick 1.0; Text { text: 'Name: ' + name }", QUrl::fromLocalFile("")); QSignalSpy delegateSpy(pathView, SIGNAL(delegateChanged())); diff --git a/tests/auto/declarative/qdeclarativepositioners/data/flow-testimplicitsize.qml b/tests/auto/declarative/qdeclarativepositioners/data/flow-testimplicitsize.qml index 6dd108e..51c8134 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/flow-testimplicitsize.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/flow-testimplicitsize.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 300; height: 200; @@ -13,4 +13,4 @@ Rectangle { Rectangle { color: "red"; width: 100; height: 50 } Rectangle { color: "blue"; width: 100; height: 50 } } -} \ No newline at end of file +} diff --git a/tests/auto/declarative/qdeclarativepositioners/data/flowtest.qml b/tests/auto/declarative/qdeclarativepositioners/data/flowtest.qml index 3ba015d..2810234 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/flowtest.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/flowtest.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { width: 90 diff --git a/tests/auto/declarative/qdeclarativepositioners/data/grid-animated.qml b/tests/auto/declarative/qdeclarativepositioners/data/grid-animated.qml index 3a56be6..e13f078 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/grid-animated.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/grid-animated.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { width: 640 diff --git a/tests/auto/declarative/qdeclarativepositioners/data/grid-spacing.qml b/tests/auto/declarative/qdeclarativepositioners/data/grid-spacing.qml index e098812..f037330 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/grid-spacing.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/grid-spacing.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { width: 640 diff --git a/tests/auto/declarative/qdeclarativepositioners/data/grid-toptobottom.qml b/tests/auto/declarative/qdeclarativepositioners/data/grid-toptobottom.qml index 8799366..5d4c337 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/grid-toptobottom.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/grid-toptobottom.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { width: 640 diff --git a/tests/auto/declarative/qdeclarativepositioners/data/gridtest.qml b/tests/auto/declarative/qdeclarativepositioners/data/gridtest.qml index ab7238a..f3b17dd 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/gridtest.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/gridtest.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { width: 640 diff --git a/tests/auto/declarative/qdeclarativepositioners/data/gridzerocolumns.qml b/tests/auto/declarative/qdeclarativepositioners/data/gridzerocolumns.qml index 8e11f4e..169f974 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/gridzerocolumns.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/gridzerocolumns.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { width: 640 diff --git a/tests/auto/declarative/qdeclarativepositioners/data/horizontal-animated.qml b/tests/auto/declarative/qdeclarativepositioners/data/horizontal-animated.qml index 20a6258..5b064cd 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/horizontal-animated.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/horizontal-animated.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { width: 640 diff --git a/tests/auto/declarative/qdeclarativepositioners/data/horizontal-spacing.qml b/tests/auto/declarative/qdeclarativepositioners/data/horizontal-spacing.qml index 0e368c1..2b46bca 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/horizontal-spacing.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/horizontal-spacing.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { width: 640 diff --git a/tests/auto/declarative/qdeclarativepositioners/data/horizontal.qml b/tests/auto/declarative/qdeclarativepositioners/data/horizontal.qml index 71ad6ec..919cecc 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/horizontal.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/horizontal.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { width: 640 diff --git a/tests/auto/declarative/qdeclarativepositioners/data/propertychangestest.qml b/tests/auto/declarative/qdeclarativepositioners/data/propertychangestest.qml index a53ff82..3c95c4c 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/propertychangestest.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/propertychangestest.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Grid { id: myGrid diff --git a/tests/auto/declarative/qdeclarativepositioners/data/repeatertest.qml b/tests/auto/declarative/qdeclarativepositioners/data/repeatertest.qml index 531d716..1cba598 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/repeatertest.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/repeatertest.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { width: 640 diff --git a/tests/auto/declarative/qdeclarativepositioners/data/vertical-animated.qml b/tests/auto/declarative/qdeclarativepositioners/data/vertical-animated.qml index 1499c1e..8899ac8 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/vertical-animated.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/vertical-animated.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { width: 640 diff --git a/tests/auto/declarative/qdeclarativepositioners/data/vertical-spacing.qml b/tests/auto/declarative/qdeclarativepositioners/data/vertical-spacing.qml index f7e853a..5578961 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/vertical-spacing.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/vertical-spacing.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { width: 640 diff --git a/tests/auto/declarative/qdeclarativepositioners/data/vertical.qml b/tests/auto/declarative/qdeclarativepositioners/data/vertical.qml index 9e3d6ab..310d791 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/vertical.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/vertical.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { width: 640 diff --git a/tests/auto/declarative/qdeclarativepositioners/data/verticalqgraphicswidget.qml b/tests/auto/declarative/qdeclarativepositioners/data/verticalqgraphicswidget.qml index c9c8607..c320714 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/verticalqgraphicswidget.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/verticalqgraphicswidget.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { width: 640 diff --git a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp index 887be50..57a8354 100644 --- a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp +++ b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp @@ -694,80 +694,80 @@ void tst_QDeclarativePositioners::test_conflictinganchors() QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData("import Qt 4.7\nColumn { Item {} }", QUrl::fromLocalFile("")); + component.setData("import QtQuick 1.0\nColumn { Item {} }", QUrl::fromLocalFile("")); QDeclarativeItem *item = qobject_cast(component.create()); QVERIFY(item); QVERIFY(warningMessage.isEmpty()); - component.setData("import Qt 4.7\nRow { Item {} }", QUrl::fromLocalFile("")); + component.setData("import QtQuick 1.0\nRow { Item {} }", QUrl::fromLocalFile("")); item = qobject_cast(component.create()); QVERIFY(item); QVERIFY(warningMessage.isEmpty()); - component.setData("import Qt 4.7\nGrid { Item {} }", QUrl::fromLocalFile("")); + component.setData("import QtQuick 1.0\nGrid { Item {} }", QUrl::fromLocalFile("")); item = qobject_cast(component.create()); QVERIFY(item); QVERIFY(warningMessage.isEmpty()); - component.setData("import Qt 4.7\nFlow { Item {} }", QUrl::fromLocalFile("")); + component.setData("import QtQuick 1.0\nFlow { Item {} }", QUrl::fromLocalFile("")); item = qobject_cast(component.create()); QVERIFY(item); QVERIFY(warningMessage.isEmpty()); - component.setData("import Qt 4.7\nColumn { Item { anchors.top: parent.top } }", QUrl::fromLocalFile("")); + component.setData("import QtQuick 1.0\nColumn { Item { anchors.top: parent.top } }", QUrl::fromLocalFile("")); item = qobject_cast(component.create()); QVERIFY(item); QCOMPARE(warningMessage, QString("file::2:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column")); warningMessage.clear(); - component.setData("import Qt 4.7\nColumn { Item { anchors.centerIn: parent } }", QUrl::fromLocalFile("")); + component.setData("import QtQuick 1.0\nColumn { Item { anchors.centerIn: parent } }", QUrl::fromLocalFile("")); item = qobject_cast(component.create()); QVERIFY(item); QCOMPARE(warningMessage, QString("file::2:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column")); warningMessage.clear(); - component.setData("import Qt 4.7\nColumn { Item { anchors.left: parent.left } }", QUrl::fromLocalFile("")); + component.setData("import QtQuick 1.0\nColumn { Item { anchors.left: parent.left } }", QUrl::fromLocalFile("")); item = qobject_cast(component.create()); QVERIFY(item); QVERIFY(warningMessage.isEmpty()); warningMessage.clear(); - component.setData("import Qt 4.7\nRow { Item { anchors.left: parent.left } }", QUrl::fromLocalFile("")); + component.setData("import QtQuick 1.0\nRow { Item { anchors.left: parent.left } }", QUrl::fromLocalFile("")); item = qobject_cast(component.create()); QVERIFY(item); QCOMPARE(warningMessage, QString("file::2:1: QML Row: Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row")); warningMessage.clear(); - component.setData("import Qt 4.7\nRow { Item { anchors.fill: parent } }", QUrl::fromLocalFile("")); + component.setData("import QtQuick 1.0\nRow { Item { anchors.fill: parent } }", QUrl::fromLocalFile("")); item = qobject_cast(component.create()); QVERIFY(item); QCOMPARE(warningMessage, QString("file::2:1: QML Row: Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row")); warningMessage.clear(); - component.setData("import Qt 4.7\nRow { Item { anchors.top: parent.top } }", QUrl::fromLocalFile("")); + component.setData("import QtQuick 1.0\nRow { Item { anchors.top: parent.top } }", QUrl::fromLocalFile("")); item = qobject_cast(component.create()); QVERIFY(item); QVERIFY(warningMessage.isEmpty()); warningMessage.clear(); - component.setData("import Qt 4.7\nGrid { Item { anchors.horizontalCenter: parent.horizontalCenter } }", QUrl::fromLocalFile("")); + component.setData("import QtQuick 1.0\nGrid { Item { anchors.horizontalCenter: parent.horizontalCenter } }", QUrl::fromLocalFile("")); item = qobject_cast(component.create()); QVERIFY(item); QCOMPARE(warningMessage, QString("file::2:1: QML Grid: Cannot specify anchors for items inside Grid")); warningMessage.clear(); - component.setData("import Qt 4.7\nGrid { Item { anchors.centerIn: parent } }", QUrl::fromLocalFile("")); + component.setData("import QtQuick 1.0\nGrid { Item { anchors.centerIn: parent } }", QUrl::fromLocalFile("")); item = qobject_cast(component.create()); QVERIFY(item); QCOMPARE(warningMessage, QString("file::2:1: QML Grid: Cannot specify anchors for items inside Grid")); warningMessage.clear(); - component.setData("import Qt 4.7\nFlow { Item { anchors.verticalCenter: parent.verticalCenter } }", QUrl::fromLocalFile("")); + component.setData("import QtQuick 1.0\nFlow { Item { anchors.verticalCenter: parent.verticalCenter } }", QUrl::fromLocalFile("")); item = qobject_cast(component.create()); QVERIFY(item); QCOMPARE(warningMessage, QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow")); - component.setData("import Qt 4.7\nFlow { Item { anchors.fill: parent } }", QUrl::fromLocalFile("")); + component.setData("import QtQuick 1.0\nFlow { Item { anchors.fill: parent } }", QUrl::fromLocalFile("")); item = qobject_cast(component.create()); QVERIFY(item); QCOMPARE(warningMessage, QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow")); diff --git a/tests/auto/declarative/qdeclarativeproperty/data/TestType.qml b/tests/auto/declarative/qdeclarativeproperty/data/TestType.qml index 2177ae2..cef86b4 100644 --- a/tests/auto/declarative/qdeclarativeproperty/data/TestType.qml +++ b/tests/auto/declarative/qdeclarativeproperty/data/TestType.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property int a: 10 diff --git a/tests/auto/declarative/qdeclarativeproperty/data/readSynthesizedObject.qml b/tests/auto/declarative/qdeclarativeproperty/data/readSynthesizedObject.qml index 0918e86..a91d3ed 100644 --- a/tests/auto/declarative/qdeclarativeproperty/data/readSynthesizedObject.qml +++ b/tests/auto/declarative/qdeclarativeproperty/data/readSynthesizedObject.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property TestType test diff --git a/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp b/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp index f1d3bf0..c825e85 100644 --- a/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp +++ b/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp @@ -138,7 +138,7 @@ void tst_QDeclarativePropertyMap::changed() QDeclarativeContext *ctxt = engine.rootContext(); ctxt->setContextProperty(QLatin1String("testdata"), &map); QDeclarativeComponent component(&engine); - component.setData("import Qt 4.7\nText { text: { testdata.key1 = 'Hello World'; 'X' } }", + component.setData("import QtQuick 1.0\nText { text: { testdata.key1 = 'Hello World'; 'X' } }", QUrl::fromLocalFile("")); QVERIFY(component.isReady()); QDeclarativeText *txt = qobject_cast(component.create()); @@ -179,7 +179,7 @@ void tst_QDeclarativePropertyMap::crashBug() context.setContextProperty("map", &map); QDeclarativeComponent c(&engine); - c.setData("import Qt 4.7\nBinding { target: map; property: \"myProp\"; value: 10 + 23 }",QUrl()); + c.setData("import QtQuick 1.0\nBinding { target: map; property: \"myProp\"; value: 10 + 23 }",QUrl()); QObject *obj = c.create(&context); delete obj; } diff --git a/tests/auto/declarative/qdeclarativeqt/data/atob.qml b/tests/auto/declarative/qdeclarativeqt/data/atob.qml index 8355fa5..f74aae8 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/atob.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/atob.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string test1: Qt.atob() diff --git a/tests/auto/declarative/qdeclarativeqt/data/btoa.qml b/tests/auto/declarative/qdeclarativeqt/data/btoa.qml index c2993ff..63b58c0 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/btoa.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/btoa.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string test1: Qt.btoa() diff --git a/tests/auto/declarative/qdeclarativeqt/data/consoleLog.qml b/tests/auto/declarative/qdeclarativeqt/data/consoleLog.qml index aa9e92a..fe47f3f 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/consoleLog.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/consoleLog.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { Component.onCompleted: { diff --git a/tests/auto/declarative/qdeclarativeqt/data/createComponent.qml b/tests/auto/declarative/qdeclarativeqt/data/createComponent.qml index f966931..9d0dd34 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/createComponent.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/createComponent.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool emptyArg: false diff --git a/tests/auto/declarative/qdeclarativeqt/data/createComponentData.qml b/tests/auto/declarative/qdeclarativeqt/data/createComponentData.qml index dc3e0d3..6ac470e 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/createComponentData.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/createComponentData.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property int test: 1913 diff --git a/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml index 33203c7..5b8c1b1 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import "createComponent_lib.js" as Test Item { diff --git a/tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml b/tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml index ca3ff22..8c35ebf 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml @@ -1,14 +1,14 @@ -import Qt 4.7 +import QtQuick 1.0 Item { id: root // errors resulting in exceptions property QtObject incorrectArgCount1: Qt.createQmlObject() - property QtObject incorrectArgCount2: Qt.createQmlObject("import Qt 4.7\nQtObject{}", root, "main.qml", 10) - property QtObject noParent: Qt.createQmlObject("import Qt 4.7\nQtObject{\nproperty int test: 13}", 0) - property QtObject notAvailable: Qt.createQmlObject("import Qt 4.7\nQtObject{Blah{}}", root) - property QtObject errors: Qt.createQmlObject("import Qt 4.7\nQtObject{\nproperty int test: 13\nproperty int test: 13\n}", root, "main.qml") + property QtObject incorrectArgCount2: Qt.createQmlObject("import QtQuick 1.0\nQtObject{}", root, "main.qml", 10) + property QtObject noParent: Qt.createQmlObject("import QtQuick 1.0\nQtObject{\nproperty int test: 13}", 0) + property QtObject notAvailable: Qt.createQmlObject("import QtQuick 1.0\nQtObject{Blah{}}", root) + property QtObject errors: Qt.createQmlObject("import QtQuick 1.0\nQtObject{\nproperty int test: 13\nproperty int test: 13\n}", root, "main.qml") property bool emptyArg: false @@ -18,14 +18,14 @@ Item { // errors resulting in nulls emptyArg = (Qt.createQmlObject("", root) == null); try { - Qt.createQmlObject("import Qt 4.7\nQtObject{property int test\nonTestChanged: QtObject{}\n}", root) + Qt.createQmlObject("import QtQuick 1.0\nQtObject{property int test\nonTestChanged: QtObject{}\n}", root) } catch (error) { console.log("RunTimeError: ",error.message); } - var o = Qt.createQmlObject("import Qt 4.7\nQtObject{\nproperty int test: 13\n}", root); + var o = Qt.createQmlObject("import QtQuick 1.0\nQtObject{\nproperty int test: 13\n}", root); success = (o.test == 13); - Qt.createQmlObject("import Qt 4.7\nItem {}\n", root); + Qt.createQmlObject("import QtQuick 1.0\nItem {}\n", root); } } diff --git a/tests/auto/declarative/qdeclarativeqt/data/darker.qml b/tests/auto/declarative/qdeclarativeqt/data/darker.qml index 738095d..d2ef866 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/darker.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/darker.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property variant test1: Qt.darker(Qt.rgba(1, 0.8, 0.3)) diff --git a/tests/auto/declarative/qdeclarativeqt/data/enums.qml b/tests/auto/declarative/qdeclarativeqt/data/enums.qml index a0190cc..aec6f63 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/enums.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/enums.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property int test1: Qt.Key_Escape diff --git a/tests/auto/declarative/qdeclarativeqt/data/fontFamilies.qml b/tests/auto/declarative/qdeclarativeqt/data/fontFamilies.qml index e66c7be..c9f50d4 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/fontFamilies.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/fontFamilies.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property variant test1: Qt.fontFamilies(10) diff --git a/tests/auto/declarative/qdeclarativeqt/data/formatting.qml b/tests/auto/declarative/qdeclarativeqt/data/formatting.qml index 7f48639..35c6a29 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/formatting.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/formatting.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property date date1: "2008-12-24" diff --git a/tests/auto/declarative/qdeclarativeqt/data/hsla.qml b/tests/auto/declarative/qdeclarativeqt/data/hsla.qml index 4ca67a3..3bcc791 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/hsla.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/hsla.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property color test1: Qt.hsla(1, 0, 0, 0.8); diff --git a/tests/auto/declarative/qdeclarativeqt/data/isQtObject.qml b/tests/auto/declarative/qdeclarativeqt/data/isQtObject.qml index 0f573c4..37b952d 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/isQtObject.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/isQtObject.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { id: root diff --git a/tests/auto/declarative/qdeclarativeqt/data/lighter.qml b/tests/auto/declarative/qdeclarativeqt/data/lighter.qml index ddaf78d..67f0d0f 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/lighter.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/lighter.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property variant test1: Qt.lighter(Qt.rgba(1, 0.8, 0.3)) diff --git a/tests/auto/declarative/qdeclarativeqt/data/md5.qml b/tests/auto/declarative/qdeclarativeqt/data/md5.qml index 07f719b..32e90c0 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/md5.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/md5.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string test1: Qt.md5() diff --git a/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally.qml b/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally.qml index 3ceb05d..c9fb25e 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { Component.onCompleted: Qt.openUrlExternally("test:url") diff --git a/tests/auto/declarative/qdeclarativeqt/data/point.qml b/tests/auto/declarative/qdeclarativeqt/data/point.qml index 0ada2d5..8b0188e 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/point.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/point.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property variant test1: Qt.point(19, 34); diff --git a/tests/auto/declarative/qdeclarativeqt/data/rect.qml b/tests/auto/declarative/qdeclarativeqt/data/rect.qml index fd38628..872bf50 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/rect.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/rect.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property variant test1: Qt.rect(10, 13, 100, 109) diff --git a/tests/auto/declarative/qdeclarativeqt/data/rgba.qml b/tests/auto/declarative/qdeclarativeqt/data/rgba.qml index 16606cd..bbafc6d 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/rgba.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/rgba.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property color test1: Qt.rgba(1, 0, 0, 0.8); diff --git a/tests/auto/declarative/qdeclarativeqt/data/size.qml b/tests/auto/declarative/qdeclarativeqt/data/size.qml index afcfb62..8e102eb 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/size.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/size.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property variant test1: Qt.size(19, 34); diff --git a/tests/auto/declarative/qdeclarativeqt/data/tint.qml b/tests/auto/declarative/qdeclarativeqt/data/tint.qml index 25e7051..f873886 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/tint.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/tint.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property color test1: Qt.tint("red", "blue"); diff --git a/tests/auto/declarative/qdeclarativeqt/data/vector.qml b/tests/auto/declarative/qdeclarativeqt/data/vector.qml index b7708f5..f494fe0 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/vector.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/vector.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property variant test1: Qt.vector3d(1, 0, 0.9); diff --git a/tests/auto/declarative/qdeclarativerepeater/data/intmodel.qml b/tests/auto/declarative/qdeclarativerepeater/data/intmodel.qml index 9cd03c4..85e1608 100644 --- a/tests/auto/declarative/qdeclarativerepeater/data/intmodel.qml +++ b/tests/auto/declarative/qdeclarativerepeater/data/intmodel.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: container diff --git a/tests/auto/declarative/qdeclarativerepeater/data/itemlist.qml b/tests/auto/declarative/qdeclarativerepeater/data/itemlist.qml index 4810736..590a9cd 100644 --- a/tests/auto/declarative/qdeclarativerepeater/data/itemlist.qml +++ b/tests/auto/declarative/qdeclarativerepeater/data/itemlist.qml @@ -1,7 +1,7 @@ // This example demonstrates placing items in a view using // a VisualItemModel -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: root diff --git a/tests/auto/declarative/qdeclarativerepeater/data/objlist.qml b/tests/auto/declarative/qdeclarativerepeater/data/objlist.qml index e1bd2e2..b47b042 100644 --- a/tests/auto/declarative/qdeclarativerepeater/data/objlist.qml +++ b/tests/auto/declarative/qdeclarativerepeater/data/objlist.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: container diff --git a/tests/auto/declarative/qdeclarativerepeater/data/properties.qml b/tests/auto/declarative/qdeclarativerepeater/data/properties.qml index 34bbde0..689a103 100644 --- a/tests/auto/declarative/qdeclarativerepeater/data/properties.qml +++ b/tests/auto/declarative/qdeclarativerepeater/data/properties.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Row { Repeater { diff --git a/tests/auto/declarative/qdeclarativerepeater/data/repeater1.qml b/tests/auto/declarative/qdeclarativerepeater/data/repeater1.qml index 3047435..2456b6d 100644 --- a/tests/auto/declarative/qdeclarativerepeater/data/repeater1.qml +++ b/tests/auto/declarative/qdeclarativerepeater/data/repeater1.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: container diff --git a/tests/auto/declarative/qdeclarativerepeater/data/repeater2.qml b/tests/auto/declarative/qdeclarativerepeater/data/repeater2.qml index 7f2f85a..02ef810 100644 --- a/tests/auto/declarative/qdeclarativerepeater/data/repeater2.qml +++ b/tests/auto/declarative/qdeclarativerepeater/data/repeater2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 240 diff --git a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp index 360d90f..91a4d68 100644 --- a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp +++ b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp @@ -397,7 +397,7 @@ void tst_QDeclarativeRepeater::properties() QSignalSpy delegateSpy(repeater, SIGNAL(delegateChanged())); QDeclarativeComponent rectComponent(&engine); - rectComponent.setData("import Qt 4.7; Rectangle {}", QUrl::fromLocalFile("")); + rectComponent.setData("import QtQuick 1.0; Rectangle {}", QUrl::fromLocalFile("")); repeater->setDelegate(&rectComponent); QCOMPARE(delegateSpy.count(),1); diff --git a/tests/auto/declarative/qdeclarativescriptdebugging/data/backtrace1.qml b/tests/auto/declarative/qdeclarativescriptdebugging/data/backtrace1.qml index ad627ef..9096c32 100644 --- a/tests/auto/declarative/qdeclarativescriptdebugging/data/backtrace1.qml +++ b/tests/auto/declarative/qdeclarativescriptdebugging/data/backtrace1.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import Qt.test 1.0 import "backtrace1.js" as Script diff --git a/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimation1.qml b/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimation1.qml index 1de5f16..3a2c4e3 100644 --- a/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimation1.qml +++ b/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimation1.qml @@ -1,3 +1,3 @@ -import Qt 4.7 +import QtQuick 1.0 SmoothedAnimation {} diff --git a/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimation2.qml b/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimation2.qml index 544e7e9..47935d4 100644 --- a/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimation2.qml +++ b/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimation2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 SmoothedAnimation { to: 10; duration: 300; reversingMode: SmoothedAnimation.Immediate diff --git a/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimation3.qml b/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimation3.qml index c1f3af0..fe44cce 100644 --- a/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimation3.qml +++ b/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimation3.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 SmoothedAnimation { to: 10; velocity: 250; reversingMode: SmoothedAnimation.Sync diff --git a/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimationBehavior.qml b/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimationBehavior.qml index 3afeb7b..6561122 100644 --- a/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimationBehavior.qml +++ b/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimationBehavior.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400; height: 400; color: "blue" diff --git a/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimationValueSource.qml b/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimationValueSource.qml index 53429e2..5036d5f 100644 --- a/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimationValueSource.qml +++ b/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimationValueSource.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 300; height: 300; diff --git a/tests/auto/declarative/qdeclarativespringanimation/data/springanimation1.qml b/tests/auto/declarative/qdeclarativespringanimation/data/springanimation1.qml index 07587bd..8890a78 100644 --- a/tests/auto/declarative/qdeclarativespringanimation/data/springanimation1.qml +++ b/tests/auto/declarative/qdeclarativespringanimation/data/springanimation1.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 SpringAnimation { } diff --git a/tests/auto/declarative/qdeclarativespringanimation/data/springanimation2.qml b/tests/auto/declarative/qdeclarativespringanimation/data/springanimation2.qml index 562f44a..de75bb0 100644 --- a/tests/auto/declarative/qdeclarativespringanimation/data/springanimation2.qml +++ b/tests/auto/declarative/qdeclarativespringanimation/data/springanimation2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 SpringAnimation { to: 1.44; velocity: 0.9 diff --git a/tests/auto/declarative/qdeclarativespringanimation/data/springanimation3.qml b/tests/auto/declarative/qdeclarativespringanimation/data/springanimation3.qml index 9f70bf4..b68d769 100644 --- a/tests/auto/declarative/qdeclarativespringanimation/data/springanimation3.qml +++ b/tests/auto/declarative/qdeclarativespringanimation/data/springanimation3.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 SpringAnimation { to: 1.44; velocity: 0.9 diff --git a/tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp b/tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp index f92d7e8..b71ed91 100644 --- a/tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp +++ b/tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp @@ -201,7 +201,7 @@ void tst_qdeclarativesqldatabase::testQml() QFETCH(QString, jsfile); QString qml= - "import Qt 4.7\n" + "import QtQuick 1.0\n" "import \""+jsfile+"\" as JS\n" "Text { text: JS.test() }"; diff --git a/tests/auto/declarative/qdeclarativestates/data/ExtendedRectangle.qml b/tests/auto/declarative/qdeclarativestates/data/ExtendedRectangle.qml index 28e083c..d91f504 100644 --- a/tests/auto/declarative/qdeclarativestates/data/ExtendedRectangle.qml +++ b/tests/auto/declarative/qdeclarativestates/data/ExtendedRectangle.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: extendedRect objectName: "extendedRect" diff --git a/tests/auto/declarative/qdeclarativestates/data/Implementation/MyType.qml b/tests/auto/declarative/qdeclarativestates/data/Implementation/MyType.qml index 1872de8..6ad3b4a 100644 --- a/tests/auto/declarative/qdeclarativestates/data/Implementation/MyType.qml +++ b/tests/auto/declarative/qdeclarativestates/data/Implementation/MyType.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { Column { diff --git a/tests/auto/declarative/qdeclarativestates/data/anchorChanges1.qml b/tests/auto/declarative/qdeclarativestates/data/anchorChanges1.qml index e9c9d67..fad2708 100644 --- a/tests/auto/declarative/qdeclarativestates/data/anchorChanges1.qml +++ b/tests/auto/declarative/qdeclarativestates/data/anchorChanges1.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: container diff --git a/tests/auto/declarative/qdeclarativestates/data/anchorChanges2.qml b/tests/auto/declarative/qdeclarativestates/data/anchorChanges2.qml index cee2ce5..e1d4d66 100644 --- a/tests/auto/declarative/qdeclarativestates/data/anchorChanges2.qml +++ b/tests/auto/declarative/qdeclarativestates/data/anchorChanges2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 200; height: 200 diff --git a/tests/auto/declarative/qdeclarativestates/data/anchorChanges3.qml b/tests/auto/declarative/qdeclarativestates/data/anchorChanges3.qml index 54dc34b..116b844 100644 --- a/tests/auto/declarative/qdeclarativestates/data/anchorChanges3.qml +++ b/tests/auto/declarative/qdeclarativestates/data/anchorChanges3.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: container diff --git a/tests/auto/declarative/qdeclarativestates/data/anchorChanges4.qml b/tests/auto/declarative/qdeclarativestates/data/anchorChanges4.qml index 885c3ce..eaff373 100644 --- a/tests/auto/declarative/qdeclarativestates/data/anchorChanges4.qml +++ b/tests/auto/declarative/qdeclarativestates/data/anchorChanges4.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 200; height: 200 diff --git a/tests/auto/declarative/qdeclarativestates/data/anchorChanges5.qml b/tests/auto/declarative/qdeclarativestates/data/anchorChanges5.qml index c3db72e..ea7b251 100644 --- a/tests/auto/declarative/qdeclarativestates/data/anchorChanges5.qml +++ b/tests/auto/declarative/qdeclarativestates/data/anchorChanges5.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 200; height: 200 diff --git a/tests/auto/declarative/qdeclarativestates/data/anchorChangesCrash.qml b/tests/auto/declarative/qdeclarativestates/data/anchorChangesCrash.qml index 861ef8f..ca96da8 100644 --- a/tests/auto/declarative/qdeclarativestates/data/anchorChangesCrash.qml +++ b/tests/auto/declarative/qdeclarativestates/data/anchorChangesCrash.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: container diff --git a/tests/auto/declarative/qdeclarativestates/data/anchorRewindBug.qml b/tests/auto/declarative/qdeclarativestates/data/anchorRewindBug.qml index e6b6020..6277111 100644 --- a/tests/auto/declarative/qdeclarativestates/data/anchorRewindBug.qml +++ b/tests/auto/declarative/qdeclarativestates/data/anchorRewindBug.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: container color: "red" @@ -34,4 +34,4 @@ Rectangle { opacity: 0 } } -} \ No newline at end of file +} diff --git a/tests/auto/declarative/qdeclarativestates/data/anchorRewindBug2.qml b/tests/auto/declarative/qdeclarativestates/data/anchorRewindBug2.qml index 4ed2815..d8b02e9 100644 --- a/tests/auto/declarative/qdeclarativestates/data/anchorRewindBug2.qml +++ b/tests/auto/declarative/qdeclarativestates/data/anchorRewindBug2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: root diff --git a/tests/auto/declarative/qdeclarativestates/data/attachedPropertyChanges.qml b/tests/auto/declarative/qdeclarativestates/data/attachedPropertyChanges.qml index e17823b..2cad050 100644 --- a/tests/auto/declarative/qdeclarativestates/data/attachedPropertyChanges.qml +++ b/tests/auto/declarative/qdeclarativestates/data/attachedPropertyChanges.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -import Qt 4.7 +import QtQuick 1.0 Item { id: item diff --git a/tests/auto/declarative/qdeclarativestates/data/autoStateAtStartupRestoreBug.qml b/tests/auto/declarative/qdeclarativestates/data/autoStateAtStartupRestoreBug.qml index 37e1e5a..ccd126f 100644 --- a/tests/auto/declarative/qdeclarativestates/data/autoStateAtStartupRestoreBug.qml +++ b/tests/auto/declarative/qdeclarativestates/data/autoStateAtStartupRestoreBug.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { id: root diff --git a/tests/auto/declarative/qdeclarativestates/data/basicBinding.qml b/tests/auto/declarative/qdeclarativestates/data/basicBinding.qml index d559691..2060f03 100644 --- a/tests/auto/declarative/qdeclarativestates/data/basicBinding.qml +++ b/tests/auto/declarative/qdeclarativestates/data/basicBinding.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRectangle diff --git a/tests/auto/declarative/qdeclarativestates/data/basicBinding2.qml b/tests/auto/declarative/qdeclarativestates/data/basicBinding2.qml index a429b24..a329da3 100644 --- a/tests/auto/declarative/qdeclarativestates/data/basicBinding2.qml +++ b/tests/auto/declarative/qdeclarativestates/data/basicBinding2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRectangle diff --git a/tests/auto/declarative/qdeclarativestates/data/basicBinding3.qml b/tests/auto/declarative/qdeclarativestates/data/basicBinding3.qml index 26405d9..cb054d2 100644 --- a/tests/auto/declarative/qdeclarativestates/data/basicBinding3.qml +++ b/tests/auto/declarative/qdeclarativestates/data/basicBinding3.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRectangle diff --git a/tests/auto/declarative/qdeclarativestates/data/basicBinding4.qml b/tests/auto/declarative/qdeclarativestates/data/basicBinding4.qml index 153a2c1..7a740e5 100644 --- a/tests/auto/declarative/qdeclarativestates/data/basicBinding4.qml +++ b/tests/auto/declarative/qdeclarativestates/data/basicBinding4.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRectangle diff --git a/tests/auto/declarative/qdeclarativestates/data/basicChanges.qml b/tests/auto/declarative/qdeclarativestates/data/basicChanges.qml index fca7916..08ce787 100644 --- a/tests/auto/declarative/qdeclarativestates/data/basicChanges.qml +++ b/tests/auto/declarative/qdeclarativestates/data/basicChanges.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRectangle width: 100; height: 100 diff --git a/tests/auto/declarative/qdeclarativestates/data/basicChanges2.qml b/tests/auto/declarative/qdeclarativestates/data/basicChanges2.qml index 72bd23e..ab97ba1 100644 --- a/tests/auto/declarative/qdeclarativestates/data/basicChanges2.qml +++ b/tests/auto/declarative/qdeclarativestates/data/basicChanges2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRectangle width: 100; height: 100 diff --git a/tests/auto/declarative/qdeclarativestates/data/basicChanges3.qml b/tests/auto/declarative/qdeclarativestates/data/basicChanges3.qml index 4fb1274..73ac34d 100644 --- a/tests/auto/declarative/qdeclarativestates/data/basicChanges3.qml +++ b/tests/auto/declarative/qdeclarativestates/data/basicChanges3.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRectangle width: 100; height: 100 diff --git a/tests/auto/declarative/qdeclarativestates/data/basicChanges4.qml b/tests/auto/declarative/qdeclarativestates/data/basicChanges4.qml index b2f02c9..b5df922 100644 --- a/tests/auto/declarative/qdeclarativestates/data/basicChanges4.qml +++ b/tests/auto/declarative/qdeclarativestates/data/basicChanges4.qml @@ -1,5 +1,5 @@ import Qt.test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyRectangle { id: rect diff --git a/tests/auto/declarative/qdeclarativestates/data/basicExtension.qml b/tests/auto/declarative/qdeclarativestates/data/basicExtension.qml index abfe71a..58c9fbe 100644 --- a/tests/auto/declarative/qdeclarativestates/data/basicExtension.qml +++ b/tests/auto/declarative/qdeclarativestates/data/basicExtension.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRectangle width: 100; height: 100 diff --git a/tests/auto/declarative/qdeclarativestates/data/deleting.qml b/tests/auto/declarative/qdeclarativestates/data/deleting.qml index a8a66cb..d1b3fd3 100644 --- a/tests/auto/declarative/qdeclarativestates/data/deleting.qml +++ b/tests/auto/declarative/qdeclarativestates/data/deleting.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRectangle width: 100; height: 100 diff --git a/tests/auto/declarative/qdeclarativestates/data/deletingState.qml b/tests/auto/declarative/qdeclarativestates/data/deletingState.qml index fadb7d9..654e09c 100644 --- a/tests/auto/declarative/qdeclarativestates/data/deletingState.qml +++ b/tests/auto/declarative/qdeclarativestates/data/deletingState.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRectangle width: 100; height: 100 diff --git a/tests/auto/declarative/qdeclarativestates/data/editProperties.qml b/tests/auto/declarative/qdeclarativestates/data/editProperties.qml index 4cb1ddd..08d0209 100644 --- a/tests/auto/declarative/qdeclarativestates/data/editProperties.qml +++ b/tests/auto/declarative/qdeclarativestates/data/editProperties.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRectangle diff --git a/tests/auto/declarative/qdeclarativestates/data/explicit.qml b/tests/auto/declarative/qdeclarativestates/data/explicit.qml index 718b169..4267319 100644 --- a/tests/auto/declarative/qdeclarativestates/data/explicit.qml +++ b/tests/auto/declarative/qdeclarativestates/data/explicit.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRectangle property color sourceColor: "blue" diff --git a/tests/auto/declarative/qdeclarativestates/data/extendsBug.qml b/tests/auto/declarative/qdeclarativestates/data/extendsBug.qml index a3c4827..a4b77b1 100644 --- a/tests/auto/declarative/qdeclarativestates/data/extendsBug.qml +++ b/tests/auto/declarative/qdeclarativestates/data/extendsBug.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 200 diff --git a/tests/auto/declarative/qdeclarativestates/data/fakeExtension.qml b/tests/auto/declarative/qdeclarativestates/data/fakeExtension.qml index 44397b5..a98c96b 100644 --- a/tests/auto/declarative/qdeclarativestates/data/fakeExtension.qml +++ b/tests/auto/declarative/qdeclarativestates/data/fakeExtension.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRectangle width: 100; height: 100 diff --git a/tests/auto/declarative/qdeclarativestates/data/illegalObj.qml b/tests/auto/declarative/qdeclarativestates/data/illegalObj.qml index 26d0f50..e644432 100644 --- a/tests/auto/declarative/qdeclarativestates/data/illegalObj.qml +++ b/tests/auto/declarative/qdeclarativestates/data/illegalObj.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myItem diff --git a/tests/auto/declarative/qdeclarativestates/data/illegalTempState.qml b/tests/auto/declarative/qdeclarativestates/data/illegalTempState.qml index 13cab18..c04b03c 100644 --- a/tests/auto/declarative/qdeclarativestates/data/illegalTempState.qml +++ b/tests/auto/declarative/qdeclarativestates/data/illegalTempState.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: card diff --git a/tests/auto/declarative/qdeclarativestates/data/legalTempState.qml b/tests/auto/declarative/qdeclarativestates/data/legalTempState.qml index f757da0..4d500d9 100644 --- a/tests/auto/declarative/qdeclarativestates/data/legalTempState.qml +++ b/tests/auto/declarative/qdeclarativestates/data/legalTempState.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: card diff --git a/tests/auto/declarative/qdeclarativestates/data/nonExistantProp.qml b/tests/auto/declarative/qdeclarativestates/data/nonExistantProp.qml index db9b017..4973b82c 100644 --- a/tests/auto/declarative/qdeclarativestates/data/nonExistantProp.qml +++ b/tests/auto/declarative/qdeclarativestates/data/nonExistantProp.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRectangle diff --git a/tests/auto/declarative/qdeclarativestates/data/parentChange1.qml b/tests/auto/declarative/qdeclarativestates/data/parentChange1.qml index 8b0e3bf..2f7e80e 100644 --- a/tests/auto/declarative/qdeclarativestates/data/parentChange1.qml +++ b/tests/auto/declarative/qdeclarativestates/data/parentChange1.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400; height: 400 diff --git a/tests/auto/declarative/qdeclarativestates/data/parentChange2.qml b/tests/auto/declarative/qdeclarativestates/data/parentChange2.qml index 3a14dbe..bdd0c6c 100644 --- a/tests/auto/declarative/qdeclarativestates/data/parentChange2.qml +++ b/tests/auto/declarative/qdeclarativestates/data/parentChange2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: newParent diff --git a/tests/auto/declarative/qdeclarativestates/data/parentChange3.qml b/tests/auto/declarative/qdeclarativestates/data/parentChange3.qml index 17c07e8..55f3ead 100644 --- a/tests/auto/declarative/qdeclarativestates/data/parentChange3.qml +++ b/tests/auto/declarative/qdeclarativestates/data/parentChange3.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400; height: 400 diff --git a/tests/auto/declarative/qdeclarativestates/data/parentChange4.qml b/tests/auto/declarative/qdeclarativestates/data/parentChange4.qml index 11d0831..ae05b05 100644 --- a/tests/auto/declarative/qdeclarativestates/data/parentChange4.qml +++ b/tests/auto/declarative/qdeclarativestates/data/parentChange4.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400; height: 400 diff --git a/tests/auto/declarative/qdeclarativestates/data/parentChange5.qml b/tests/auto/declarative/qdeclarativestates/data/parentChange5.qml index 329d277..32a0b91 100644 --- a/tests/auto/declarative/qdeclarativestates/data/parentChange5.qml +++ b/tests/auto/declarative/qdeclarativestates/data/parentChange5.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400; height: 400 diff --git a/tests/auto/declarative/qdeclarativestates/data/parentChange6.qml b/tests/auto/declarative/qdeclarativestates/data/parentChange6.qml index be92aba..70ad894 100644 --- a/tests/auto/declarative/qdeclarativestates/data/parentChange6.qml +++ b/tests/auto/declarative/qdeclarativestates/data/parentChange6.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400; height: 400 diff --git a/tests/auto/declarative/qdeclarativestates/data/propertyErrors.qml b/tests/auto/declarative/qdeclarativestates/data/propertyErrors.qml index 8f9a7f2..3ab3c32 100644 --- a/tests/auto/declarative/qdeclarativestates/data/propertyErrors.qml +++ b/tests/auto/declarative/qdeclarativestates/data/propertyErrors.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRectangle width: 100; height: 100 diff --git a/tests/auto/declarative/qdeclarativestates/data/reset.qml b/tests/auto/declarative/qdeclarativestates/data/reset.qml index 5725320..8799c97 100644 --- a/tests/auto/declarative/qdeclarativestates/data/reset.qml +++ b/tests/auto/declarative/qdeclarativestates/data/reset.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 640 diff --git a/tests/auto/declarative/qdeclarativestates/data/restoreEntryValues.qml b/tests/auto/declarative/qdeclarativestates/data/restoreEntryValues.qml index 621adf0..dfd7c17 100644 --- a/tests/auto/declarative/qdeclarativestates/data/restoreEntryValues.qml +++ b/tests/auto/declarative/qdeclarativestates/data/restoreEntryValues.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRectangle width: 100; height: 100 diff --git a/tests/auto/declarative/qdeclarativestates/data/returnToBase.qml b/tests/auto/declarative/qdeclarativestates/data/returnToBase.qml index e342331..a0d053c 100644 --- a/tests/auto/declarative/qdeclarativestates/data/returnToBase.qml +++ b/tests/auto/declarative/qdeclarativestates/data/returnToBase.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: theRect diff --git a/tests/auto/declarative/qdeclarativestates/data/script.qml b/tests/auto/declarative/qdeclarativestates/data/script.qml index cdb6be1..630aaf0 100644 --- a/tests/auto/declarative/qdeclarativestates/data/script.qml +++ b/tests/auto/declarative/qdeclarativestates/data/script.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRectangle width: 100; height: 100 diff --git a/tests/auto/declarative/qdeclarativestates/data/signalOverride.qml b/tests/auto/declarative/qdeclarativestates/data/signalOverride.qml index c4ab96c..0eaf547 100644 --- a/tests/auto/declarative/qdeclarativestates/data/signalOverride.qml +++ b/tests/auto/declarative/qdeclarativestates/data/signalOverride.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import Qt.test 1.0 MyRectangle { diff --git a/tests/auto/declarative/qdeclarativestates/data/signalOverride2.qml b/tests/auto/declarative/qdeclarativestates/data/signalOverride2.qml index 65a8cea..ef26ff1 100644 --- a/tests/auto/declarative/qdeclarativestates/data/signalOverride2.qml +++ b/tests/auto/declarative/qdeclarativestates/data/signalOverride2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import Qt.test 1.0 MyRectangle { diff --git a/tests/auto/declarative/qdeclarativestates/data/signalOverrideCrash.qml b/tests/auto/declarative/qdeclarativestates/data/signalOverrideCrash.qml index 8a0b51a..8e9b698 100644 --- a/tests/auto/declarative/qdeclarativestates/data/signalOverrideCrash.qml +++ b/tests/auto/declarative/qdeclarativestates/data/signalOverrideCrash.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import Qt.test 1.0 MyRectangle { diff --git a/tests/auto/declarative/qdeclarativestates/data/signalOverrideCrash2.qml b/tests/auto/declarative/qdeclarativestates/data/signalOverrideCrash2.qml index 2215ee4..74df943 100644 --- a/tests/auto/declarative/qdeclarativestates/data/signalOverrideCrash2.qml +++ b/tests/auto/declarative/qdeclarativestates/data/signalOverrideCrash2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myRect diff --git a/tests/auto/declarative/qdeclarativestates/data/unnamedWhen.qml b/tests/auto/declarative/qdeclarativestates/data/unnamedWhen.qml index a70840c..4425b4d 100644 --- a/tests/auto/declarative/qdeclarativestates/data/unnamedWhen.qml +++ b/tests/auto/declarative/qdeclarativestates/data/unnamedWhen.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: theRect diff --git a/tests/auto/declarative/qdeclarativestates/data/urlResolution.qml b/tests/auto/declarative/qdeclarativestates/data/urlResolution.qml index 8995b56..743f540 100644 --- a/tests/auto/declarative/qdeclarativestates/data/urlResolution.qml +++ b/tests/auto/declarative/qdeclarativestates/data/urlResolution.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import "Implementation" Rectangle { diff --git a/tests/auto/declarative/qdeclarativestates/data/whenOrdering.qml b/tests/auto/declarative/qdeclarativestates/data/whenOrdering.qml index 08d0795..48aef5a 100644 --- a/tests/auto/declarative/qdeclarativestates/data/whenOrdering.qml +++ b/tests/auto/declarative/qdeclarativestates/data/whenOrdering.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { property bool condition1: false diff --git a/tests/auto/declarative/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp b/tests/auto/declarative/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp index dd1fd7a..b8f5851 100644 --- a/tests/auto/declarative/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp +++ b/tests/auto/declarative/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp @@ -75,7 +75,7 @@ tst_qdeclarativesystempalette::tst_qdeclarativesystempalette() void tst_qdeclarativesystempalette::activePalette() { - QString componentStr = "import Qt 4.7\nSystemPalette { }"; + QString componentStr = "import QtQuick 1.0\nSystemPalette { }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeSystemPalette *object = qobject_cast(component.create()); @@ -104,7 +104,7 @@ void tst_qdeclarativesystempalette::activePalette() void tst_qdeclarativesystempalette::inactivePalette() { - QString componentStr = "import Qt 4.7\nSystemPalette { colorGroup: SystemPalette.Inactive }"; + QString componentStr = "import QtQuick 1.0\nSystemPalette { colorGroup: SystemPalette.Inactive }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeSystemPalette *object = qobject_cast(component.create()); @@ -134,7 +134,7 @@ void tst_qdeclarativesystempalette::inactivePalette() void tst_qdeclarativesystempalette::disabledPalette() { - QString componentStr = "import Qt 4.7\nSystemPalette { colorGroup: SystemPalette.Disabled }"; + QString componentStr = "import QtQuick 1.0\nSystemPalette { colorGroup: SystemPalette.Disabled }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeSystemPalette *object = qobject_cast(component.create()); @@ -164,7 +164,7 @@ void tst_qdeclarativesystempalette::disabledPalette() void tst_qdeclarativesystempalette::paletteChanged() { - QString componentStr = "import Qt 4.7\nSystemPalette { }"; + QString componentStr = "import QtQuick 1.0\nSystemPalette { }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeSystemPalette *object = qobject_cast(component.create()); diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments.qml b/tests/auto/declarative/qdeclarativetext/data/alignments.qml index 762e2b6..25105f6 100644 --- a/tests/auto/declarative/qdeclarativetext/data/alignments.qml +++ b/tests/auto/declarative/qdeclarativetext/data/alignments.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: top diff --git a/tests/auto/declarative/qdeclarativetext/data/embeddedImagesLocal.qml b/tests/auto/declarative/qdeclarativetext/data/embeddedImagesLocal.qml index 877222f..ee9b95a 100644 --- a/tests/auto/declarative/qdeclarativetext/data/embeddedImagesLocal.qml +++ b/tests/auto/declarative/qdeclarativetext/data/embeddedImagesLocal.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Text { text: "" diff --git a/tests/auto/declarative/qdeclarativetext/data/embeddedImagesLocalError.qml b/tests/auto/declarative/qdeclarativetext/data/embeddedImagesLocalError.qml index abc7077..4dc0d3e 100644 --- a/tests/auto/declarative/qdeclarativetext/data/embeddedImagesLocalError.qml +++ b/tests/auto/declarative/qdeclarativetext/data/embeddedImagesLocalError.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Text { text: "" diff --git a/tests/auto/declarative/qdeclarativetext/data/embeddedImagesRemote.qml b/tests/auto/declarative/qdeclarativetext/data/embeddedImagesRemote.qml index b6ca3e3..438f4a0 100644 --- a/tests/auto/declarative/qdeclarativetext/data/embeddedImagesRemote.qml +++ b/tests/auto/declarative/qdeclarativetext/data/embeddedImagesRemote.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Text { text: "" diff --git a/tests/auto/declarative/qdeclarativetext/data/embeddedImagesRemoteError.qml b/tests/auto/declarative/qdeclarativetext/data/embeddedImagesRemoteError.qml index fbfce9a..c24bf24 100644 --- a/tests/auto/declarative/qdeclarativetext/data/embeddedImagesRemoteError.qml +++ b/tests/auto/declarative/qdeclarativetext/data/embeddedImagesRemoteError.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Text { text: "" diff --git a/tests/auto/declarative/qdeclarativetext/data/rotated.qml b/tests/auto/declarative/qdeclarativetext/data/rotated.qml index 01eec44..1e893b9 100644 --- a/tests/auto/declarative/qdeclarativetext/data/rotated.qml +++ b/tests/auto/declarative/qdeclarativetext/data/rotated.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width : 200 diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index f683d98..d6c37ae 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -184,7 +184,7 @@ void tst_qdeclarativetext::text() { { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.7\nText { text: \"\" }", QUrl::fromLocalFile("")); + textComponent.setData("import QtQuick 1.0\nText { text: \"\" }", QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -196,7 +196,7 @@ void tst_qdeclarativetext::text() for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.7\nText { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nText { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -209,7 +209,7 @@ void tst_qdeclarativetext::text() for (int i = 0; i < richText.size(); i++) { - QString componentStr = "import Qt 4.7\nText { text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nText { text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -226,7 +226,7 @@ void tst_qdeclarativetext::width() // uses Font metrics to find the width for standard and document to find the width for rich { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.7\nText { text: \"\" }", QUrl::fromLocalFile("")); + textComponent.setData("import QtQuick 1.0\nText { text: \"\" }", QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -242,7 +242,7 @@ void tst_qdeclarativetext::width() qreal metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width(); metricWidth = qCeil(metricWidth); - QString componentStr = "import Qt 4.7\nText { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nText { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -263,7 +263,7 @@ void tst_qdeclarativetext::width() int documentWidth = document.idealWidth(); - QString componentStr = "import Qt 4.7\nText { text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nText { text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -280,7 +280,7 @@ void tst_qdeclarativetext::wrap() // for specified width and wrap set true { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.7\nText { text: \"Hello\"; wrapMode: Text.WordWrap; width: 300 }", QUrl::fromLocalFile("")); + textComponent.setData("import QtQuick 1.0\nText { text: \"Hello\"; wrapMode: Text.WordWrap; width: 300 }", QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); textHeight = textObject->height(); @@ -291,7 +291,7 @@ void tst_qdeclarativetext::wrap() for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.7\nText { wrapMode: Text.WordWrap; width: 30; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nText { wrapMode: Text.WordWrap; width: 30; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -307,7 +307,7 @@ void tst_qdeclarativetext::wrap() for (int i = 0; i < richText.size(); i++) { - QString componentStr = "import Qt 4.7\nText { wrapMode: Text.WordWrap; width: 30; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nText { wrapMode: Text.WordWrap; width: 30; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -324,7 +324,7 @@ void tst_qdeclarativetext::wrap() // richtext again with a fixed height for (int i = 0; i < richText.size(); i++) { - QString componentStr = "import Qt 4.7\nText { wrapMode: Text.WordWrap; width: 30; height: 50; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nText { wrapMode: Text.WordWrap; width: 30; height: 50; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -349,7 +349,7 @@ void tst_qdeclarativetext::elide() { QDeclarativeComponent textComponent(&engine); - textComponent.setData(("import Qt 4.7\nText { text: \"\"; "+elide+" width: 100 }").toLatin1(), QUrl::fromLocalFile("")); + textComponent.setData(("import QtQuick 1.0\nText { text: \"\"; "+elide+" width: 100 }").toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->elideMode(), m); @@ -358,7 +358,7 @@ void tst_qdeclarativetext::elide() for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.7\nText { "+elide+" width: 100; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nText { "+elide+" width: 100; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -370,7 +370,7 @@ void tst_qdeclarativetext::elide() // richtext - does nothing for (int i = 0; i < richText.size(); i++) { - QString componentStr = "import Qt 4.7\nText { "+elide+" width: 100; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nText { "+elide+" width: 100; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -385,7 +385,7 @@ void tst_qdeclarativetext::textFormat() { { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.7\nText { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); + textComponent.setData("import QtQuick 1.0\nText { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -393,7 +393,7 @@ void tst_qdeclarativetext::textFormat() } { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.7\nText { text: \"Hello\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); + textComponent.setData("import QtQuick 1.0\nText { text: \"Hello\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -471,7 +471,7 @@ void tst_qdeclarativetext::horizontalAlignment() { for (int j=0; j < horizontalAlignmentmentStrings.size(); j++) { - QString componentStr = "import Qt 4.7\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -484,7 +484,7 @@ void tst_qdeclarativetext::horizontalAlignment() { for (int j=0; j < horizontalAlignmentmentStrings.size(); j++) { - QString componentStr = "import Qt 4.7\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -503,7 +503,7 @@ void tst_qdeclarativetext::verticalAlignment() { for (int j=0; j < verticalAlignmentmentStrings.size(); j++) { - QString componentStr = "import Qt 4.7\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -517,7 +517,7 @@ void tst_qdeclarativetext::verticalAlignment() { for (int j=0; j < verticalAlignmentmentStrings.size(); j++) { - QString componentStr = "import Qt 4.7\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -533,7 +533,7 @@ void tst_qdeclarativetext::font() { //test size, then bold, then italic, then family { - QString componentStr = "import Qt 4.7\nText { font.pointSize: 40; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nText { font.pointSize: 40; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -544,7 +544,7 @@ void tst_qdeclarativetext::font() } { - QString componentStr = "import Qt 4.7\nText { font.pixelSize: 40; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nText { font.pixelSize: 40; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -555,7 +555,7 @@ void tst_qdeclarativetext::font() } { - QString componentStr = "import Qt 4.7\nText { font.bold: true; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nText { font.bold: true; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -565,7 +565,7 @@ void tst_qdeclarativetext::font() } { - QString componentStr = "import Qt 4.7\nText { font.italic: true; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nText { font.italic: true; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -575,7 +575,7 @@ void tst_qdeclarativetext::font() } { - QString componentStr = "import Qt 4.7\nText { font.family: \"Helvetica\"; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nText { font.family: \"Helvetica\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -586,7 +586,7 @@ void tst_qdeclarativetext::font() } { - QString componentStr = "import Qt 4.7\nText { font.family: \"\"; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nText { font.family: \"\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -600,7 +600,7 @@ void tst_qdeclarativetext::style() //test style for (int i = 0; i < styles.size(); i++) { - QString componentStr = "import Qt 4.7\nText { style: \"" + styleStrings.at(i) + "\"; styleColor: \"white\"; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nText { style: \"" + styleStrings.at(i) + "\"; styleColor: \"white\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -608,7 +608,7 @@ void tst_qdeclarativetext::style() QCOMPARE((int)textObject->style(), (int)styles.at(i)); QCOMPARE(textObject->styleColor(), QColor("white")); } - QString componentStr = "import Qt 4.7\nText { text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nText { text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -626,7 +626,7 @@ void tst_qdeclarativetext::color() //test style for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.7\nText { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nText { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -637,7 +637,7 @@ void tst_qdeclarativetext::color() for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.7\nText { styleColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nText { styleColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -651,7 +651,7 @@ void tst_qdeclarativetext::color() { for (int j = 0; j < colorStrings.size(); j++) { - QString componentStr = "import Qt 4.7\nText { color: \"" + colorStrings.at(i) + "\"; styleColor: \"" + colorStrings.at(j) + "\"; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nText { color: \"" + colorStrings.at(i) + "\"; styleColor: \"" + colorStrings.at(j) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -665,7 +665,7 @@ void tst_qdeclarativetext::color() QColor testColor("#001234"); testColor.setAlpha(170); - QString componentStr = "import Qt 4.7\nText { color: \"" + colorStr + "\"; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nText { color: \"" + colorStr + "\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -679,14 +679,14 @@ void tst_qdeclarativetext::smooth() for (int i = 0; i < standard.size(); i++) { { - QString componentStr = "import Qt 4.7\nText { smooth: true; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nText { smooth: true; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->smooth(), true); } { - QString componentStr = "import Qt 4.7\nText { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nText { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -696,14 +696,14 @@ void tst_qdeclarativetext::smooth() for (int i = 0; i < richText.size(); i++) { { - QString componentStr = "import Qt 4.7\nText { smooth: true; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nText { smooth: true; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->smooth(), true); } { - QString componentStr = "import Qt 4.7\nText { text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nText { text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -715,7 +715,7 @@ void tst_qdeclarativetext::smooth() void tst_qdeclarativetext::weight() { { - QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; + QString componentStr = "import QtQuick 1.0\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -724,7 +724,7 @@ void tst_qdeclarativetext::weight() QCOMPARE((int)textObject->font().weight(), (int)QDeclarativeFontValueType::Normal); } { - QString componentStr = "import Qt 4.7\nText { font.weight: \"Bold\"; text: \"Hello world!\" }"; + QString componentStr = "import QtQuick 1.0\nText { font.weight: \"Bold\"; text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -737,7 +737,7 @@ void tst_qdeclarativetext::weight() void tst_qdeclarativetext::underline() { { - QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; + QString componentStr = "import QtQuick 1.0\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -746,7 +746,7 @@ void tst_qdeclarativetext::underline() QCOMPARE(textObject->font().underline(), false); } { - QString componentStr = "import Qt 4.7\nText { font.underline: true; text: \"Hello world!\" }"; + QString componentStr = "import QtQuick 1.0\nText { font.underline: true; text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -759,7 +759,7 @@ void tst_qdeclarativetext::underline() void tst_qdeclarativetext::overline() { { - QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; + QString componentStr = "import QtQuick 1.0\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -768,7 +768,7 @@ void tst_qdeclarativetext::overline() QCOMPARE(textObject->font().overline(), false); } { - QString componentStr = "import Qt 4.7\nText { font.overline: true; text: \"Hello world!\" }"; + QString componentStr = "import QtQuick 1.0\nText { font.overline: true; text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -781,7 +781,7 @@ void tst_qdeclarativetext::overline() void tst_qdeclarativetext::strikeout() { { - QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; + QString componentStr = "import QtQuick 1.0\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -790,7 +790,7 @@ void tst_qdeclarativetext::strikeout() QCOMPARE(textObject->font().strikeOut(), false); } { - QString componentStr = "import Qt 4.7\nText { font.strikeout: true; text: \"Hello world!\" }"; + QString componentStr = "import QtQuick 1.0\nText { font.strikeout: true; text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -803,7 +803,7 @@ void tst_qdeclarativetext::strikeout() void tst_qdeclarativetext::capitalization() { { - QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; + QString componentStr = "import QtQuick 1.0\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -812,7 +812,7 @@ void tst_qdeclarativetext::capitalization() QCOMPARE((int)textObject->font().capitalization(), (int)QDeclarativeFontValueType::MixedCase); } { - QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.capitalization: \"AllUppercase\" }"; + QString componentStr = "import QtQuick 1.0\nText { text: \"Hello world!\"; font.capitalization: \"AllUppercase\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -821,7 +821,7 @@ void tst_qdeclarativetext::capitalization() QCOMPARE((int)textObject->font().capitalization(), (int)QDeclarativeFontValueType::AllUppercase); } { - QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.capitalization: \"AllLowercase\" }"; + QString componentStr = "import QtQuick 1.0\nText { text: \"Hello world!\"; font.capitalization: \"AllLowercase\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -830,7 +830,7 @@ void tst_qdeclarativetext::capitalization() QCOMPARE((int)textObject->font().capitalization(), (int)QDeclarativeFontValueType::AllLowercase); } { - QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.capitalization: \"SmallCaps\" }"; + QString componentStr = "import QtQuick 1.0\nText { text: \"Hello world!\"; font.capitalization: \"SmallCaps\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -839,7 +839,7 @@ void tst_qdeclarativetext::capitalization() QCOMPARE((int)textObject->font().capitalization(), (int)QDeclarativeFontValueType::SmallCaps); } { - QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.capitalization: \"Capitalize\" }"; + QString componentStr = "import QtQuick 1.0\nText { text: \"Hello world!\"; font.capitalization: \"Capitalize\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -852,7 +852,7 @@ void tst_qdeclarativetext::capitalization() void tst_qdeclarativetext::letterSpacing() { { - QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; + QString componentStr = "import QtQuick 1.0\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -861,7 +861,7 @@ void tst_qdeclarativetext::letterSpacing() QCOMPARE(textObject->font().letterSpacing(), 0.0); } { - QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.letterSpacing: -2 }"; + QString componentStr = "import QtQuick 1.0\nText { text: \"Hello world!\"; font.letterSpacing: -2 }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -870,7 +870,7 @@ void tst_qdeclarativetext::letterSpacing() QCOMPARE(textObject->font().letterSpacing(), -2.); } { - QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.letterSpacing: 3 }"; + QString componentStr = "import QtQuick 1.0\nText { text: \"Hello world!\"; font.letterSpacing: 3 }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -883,7 +883,7 @@ void tst_qdeclarativetext::letterSpacing() void tst_qdeclarativetext::wordSpacing() { { - QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; + QString componentStr = "import QtQuick 1.0\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -892,7 +892,7 @@ void tst_qdeclarativetext::wordSpacing() QCOMPARE(textObject->font().wordSpacing(), 0.0); } { - QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.wordSpacing: -50 }"; + QString componentStr = "import QtQuick 1.0\nText { text: \"Hello world!\"; font.wordSpacing: -50 }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -901,7 +901,7 @@ void tst_qdeclarativetext::wordSpacing() QCOMPARE(textObject->font().wordSpacing(), -50.); } { - QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.wordSpacing: 200 }"; + QString componentStr = "import QtQuick 1.0\nText { text: \"Hello world!\"; font.wordSpacing: 200 }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -949,7 +949,7 @@ public slots: void tst_qdeclarativetext::clickLink() { { - QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; + QString componentStr = "import QtQuick 1.0\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); diff --git a/tests/auto/declarative/qdeclarativetextedit/data/alignments.qml b/tests/auto/declarative/qdeclarativetextedit/data/alignments.qml index 9281a06..bc977fc 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/alignments.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/alignments.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: top diff --git a/tests/auto/declarative/qdeclarativetextedit/data/cursorTest.qml b/tests/auto/declarative/qdeclarativetextedit/data/cursorTest.qml index 586e606..c7c21fc 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/cursorTest.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/cursorTest.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 300; height: 300; color: "white" TextEdit { text: "Hello world!"; id: textEditObject; objectName: "textEditObject" diff --git a/tests/auto/declarative/qdeclarativetextedit/data/geometrySignals.qml b/tests/auto/declarative/qdeclarativetextedit/data/geometrySignals.qml index b39ba5b..fe2ae12 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/geometrySignals.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/geometrySignals.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { width: 400; height: 500; diff --git a/tests/auto/declarative/qdeclarativetextedit/data/http/ErrItem.qml b/tests/auto/declarative/qdeclarativetextedit/data/http/ErrItem.qml index b5c807e..fa7dbd1 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/http/ErrItem.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/http/ErrItem.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item{ Fungus{ diff --git a/tests/auto/declarative/qdeclarativetextedit/data/http/NormItem.qml b/tests/auto/declarative/qdeclarativetextedit/data/http/NormItem.qml index df843d8..4989193 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/http/NormItem.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/http/NormItem.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { objectName: "delegateOkay" diff --git a/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTest.qml b/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTest.qml index 1b41f8f..724c058 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTest.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTest.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 300; height: 300; color: "white" resources: [ diff --git a/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestFail1.qml b/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestFail1.qml index 51be3cf..6dcf785 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestFail1.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestFail1.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 300; height: 300; color: "white" resources: [ diff --git a/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestFail2.qml b/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestFail2.qml index 30c3fbd..5f441d0 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestFail2.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestFail2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 300; height: 300; color: "white" resources: [ diff --git a/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestPass.qml b/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestPass.qml index a1ca58a..95f5d87 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestPass.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestPass.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 300; height: 300; color: "white" resources: [ diff --git a/tests/auto/declarative/qdeclarativetextedit/data/httpfail/FailItem.qml b/tests/auto/declarative/qdeclarativetextedit/data/httpfail/FailItem.qml index 8dfac48..466eb9d 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/httpfail/FailItem.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/httpfail/FailItem.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { Rectangle { } diff --git a/tests/auto/declarative/qdeclarativetextedit/data/httpslow/WaitItem.qml b/tests/auto/declarative/qdeclarativetextedit/data/httpslow/WaitItem.qml index 8dfac48..466eb9d 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/httpslow/WaitItem.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/httpslow/WaitItem.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { Rectangle { } diff --git a/tests/auto/declarative/qdeclarativetextedit/data/inputmethodhints.qml b/tests/auto/declarative/qdeclarativetextedit/data/inputmethodhints.qml index 8067edb..7df17f2 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/inputmethodhints.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/inputmethodhints.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 TextEdit { text: "Hello world!" diff --git a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_default.qml b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_default.qml index f1cf86c..22a9871 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_default.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_default.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 TextEdit { focus: true diff --git a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false.qml b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false.qml index f1cf86c..22a9871 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 TextEdit { focus: true diff --git a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true.qml b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true.qml index 90383b9..d61da46 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 TextEdit { focus: true diff --git a/tests/auto/declarative/qdeclarativetextedit/data/navigation.qml b/tests/auto/declarative/qdeclarativetextedit/data/navigation.qml index 7772687..9ee8a93 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/navigation.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/navigation.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { property variant myInput: input diff --git a/tests/auto/declarative/qdeclarativetextedit/data/readOnly.qml b/tests/auto/declarative/qdeclarativetextedit/data/readOnly.qml index a68e4b4..36177d3 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/readOnly.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/readOnly.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { property variant myInput: input diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 84f4230..472c5ef 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -184,7 +184,7 @@ void tst_qdeclarativetextedit::text() { { QDeclarativeComponent texteditComponent(&engine); - texteditComponent.setData("import Qt 4.7\nTextEdit { text: \"\" }", QUrl()); + texteditComponent.setData("import QtQuick 1.0\nTextEdit { text: \"\" }", QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -193,7 +193,7 @@ void tst_qdeclarativetextedit::text() for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.7\nTextEdit { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -204,7 +204,7 @@ void tst_qdeclarativetextedit::text() for (int i = 0; i < richText.size(); i++) { - QString componentStr = "import Qt 4.7\nTextEdit { text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -224,7 +224,7 @@ void tst_qdeclarativetextedit::width() // uses Font metrics to find the width for standard and document to find the width for rich { QDeclarativeComponent texteditComponent(&engine); - texteditComponent.setData("import Qt 4.7\nTextEdit { text: \"\" }", QUrl()); + texteditComponent.setData("import QtQuick 1.0\nTextEdit { text: \"\" }", QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -238,7 +238,7 @@ void tst_qdeclarativetextedit::width() qreal metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width(); metricWidth = ceil(metricWidth); - QString componentStr = "import Qt 4.7\nTextEdit { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -255,7 +255,7 @@ void tst_qdeclarativetextedit::width() int documentWidth = ceil(document.idealWidth()); - QString componentStr = "import Qt 4.7\nTextEdit { text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -270,7 +270,7 @@ void tst_qdeclarativetextedit::wrap() // for specified width and wrap set true { QDeclarativeComponent texteditComponent(&engine); - texteditComponent.setData("import Qt 4.7\nTextEdit { text: \"\"; wrapMode: TextEdit.WordWrap; width: 300 }", QUrl()); + texteditComponent.setData("import QtQuick 1.0\nTextEdit { text: \"\"; wrapMode: TextEdit.WordWrap; width: 300 }", QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -279,7 +279,7 @@ void tst_qdeclarativetextedit::wrap() for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.7\nTextEdit { wrapMode: TextEdit.WordWrap; width: 300; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { wrapMode: TextEdit.WordWrap; width: 300; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -290,7 +290,7 @@ void tst_qdeclarativetextedit::wrap() for (int i = 0; i < richText.size(); i++) { - QString componentStr = "import Qt 4.7\nTextEdit { wrapMode: TextEdit.WordWrap; width: 300; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { wrapMode: TextEdit.WordWrap; width: 300; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -305,7 +305,7 @@ void tst_qdeclarativetextedit::textFormat() { { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.7\nTextEdit { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); + textComponent.setData("import QtQuick 1.0\nTextEdit { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); QDeclarativeTextEdit *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -313,7 +313,7 @@ void tst_qdeclarativetextedit::textFormat() } { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.7\nTextEdit { text: \"Hello\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); + textComponent.setData("import QtQuick 1.0\nTextEdit { text: \"Hello\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); QDeclarativeTextEdit *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -381,7 +381,7 @@ void tst_qdeclarativetextedit::hAlign() { for (int j=0; j < hAlignmentStrings.size(); j++) { - QString componentStr = "import Qt 4.7\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -395,7 +395,7 @@ void tst_qdeclarativetextedit::hAlign() { for (int j=0; j < hAlignmentStrings.size(); j++) { - QString componentStr = "import Qt 4.7\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -415,7 +415,7 @@ void tst_qdeclarativetextedit::vAlign() { for (int j=0; j < vAlignmentStrings.size(); j++) { - QString componentStr = "import Qt 4.7\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -429,7 +429,7 @@ void tst_qdeclarativetextedit::vAlign() { for (int j=0; j < vAlignmentStrings.size(); j++) { - QString componentStr = "import Qt 4.7\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -445,7 +445,7 @@ void tst_qdeclarativetextedit::font() { //test size, then bold, then italic, then family { - QString componentStr = "import Qt 4.7\nTextEdit { font.pointSize: 40; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { font.pointSize: 40; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -457,7 +457,7 @@ void tst_qdeclarativetextedit::font() } { - QString componentStr = "import Qt 4.7\nTextEdit { font.bold: true; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { font.bold: true; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -468,7 +468,7 @@ void tst_qdeclarativetextedit::font() } { - QString componentStr = "import Qt 4.7\nTextEdit { font.italic: true; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { font.italic: true; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -479,7 +479,7 @@ void tst_qdeclarativetextedit::font() } { - QString componentStr = "import Qt 4.7\nTextEdit { font.family: \"Helvetica\"; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { font.family: \"Helvetica\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -491,7 +491,7 @@ void tst_qdeclarativetextedit::font() } { - QString componentStr = "import Qt 4.7\nTextEdit { font.family: \"\"; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { font.family: \"\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -505,7 +505,7 @@ void tst_qdeclarativetextedit::color() { //test initial color { - QString componentStr = "import Qt 4.7\nTextEdit { text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -523,7 +523,7 @@ void tst_qdeclarativetextedit::color() //test normal for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.7\nTextEdit { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -535,7 +535,7 @@ void tst_qdeclarativetextedit::color() //test selection for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.7\nTextEdit { selectionColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { selectionColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -546,7 +546,7 @@ void tst_qdeclarativetextedit::color() //test selected text for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.7\nTextEdit { selectedTextColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { selectedTextColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -559,7 +559,7 @@ void tst_qdeclarativetextedit::color() QColor testColor("#001234"); testColor.setAlpha(170); - QString componentStr = "import Qt 4.7\nTextEdit { color: \"" + colorStr + "\"; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { color: \"" + colorStr + "\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -572,7 +572,7 @@ void tst_qdeclarativetextedit::color() void tst_qdeclarativetextedit::textMargin() { for(qreal i=0; i<=10; i+=0.3){ - QString componentStr = "import Qt 4.7\nTextEdit { textMargin: " + QString::number(i) + "; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { textMargin: " + QString::number(i) + "; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -584,7 +584,7 @@ void tst_qdeclarativetextedit::textMargin() void tst_qdeclarativetextedit::persistentSelection() { { - QString componentStr = "import Qt 4.7\nTextEdit { persistentSelection: true; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { persistentSelection: true; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -593,7 +593,7 @@ void tst_qdeclarativetextedit::persistentSelection() } { - QString componentStr = "import Qt 4.7\nTextEdit { persistentSelection: false; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { persistentSelection: false; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -605,7 +605,7 @@ void tst_qdeclarativetextedit::persistentSelection() void tst_qdeclarativetextedit::focusOnPress() { { - QString componentStr = "import Qt 4.7\nTextEdit { activeFocusOnPress: true; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { activeFocusOnPress: true; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -614,7 +614,7 @@ void tst_qdeclarativetextedit::focusOnPress() } { - QString componentStr = "import Qt 4.7\nTextEdit { activeFocusOnPress: false; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { activeFocusOnPress: false; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -626,7 +626,7 @@ void tst_qdeclarativetextedit::focusOnPress() void tst_qdeclarativetextedit::selection() { QString testStr = standard[0];//TODO: What should happen for multiline/rich text? - QString componentStr = "import Qt 4.7\nTextEdit { text: \""+ testStr +"\"; }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { text: \""+ testStr +"\"; }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -866,7 +866,7 @@ void tst_qdeclarativetextedit::copyAndPaste() { } #endif - QString componentStr = "import Qt 4.7\nTextEdit { text: \"Hello world!\" }"; + QString componentStr = "import QtQuick 1.0\nTextEdit { text: \"Hello world!\" }"; QDeclarativeComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEdit = qobject_cast(textEditComponent.create()); diff --git a/tests/auto/declarative/qdeclarativetextinput/data/cursorTest.qml b/tests/auto/declarative/qdeclarativetextinput/data/cursorTest.qml index f0d1be5..73085c1 100644 --- a/tests/auto/declarative/qdeclarativetextinput/data/cursorTest.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/cursorTest.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 300; height: 300; color: "white" TextInput { text: "Hello world!"; id: textInputObject; objectName: "textInputObject" diff --git a/tests/auto/declarative/qdeclarativetextinput/data/echoMode.qml b/tests/auto/declarative/qdeclarativetextinput/data/echoMode.qml index 66a2017..0320872 100644 --- a/tests/auto/declarative/qdeclarativetextinput/data/echoMode.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/echoMode.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { property QtObject myInput: input diff --git a/tests/auto/declarative/qdeclarativetextinput/data/geometrySignals.qml b/tests/auto/declarative/qdeclarativetextinput/data/geometrySignals.qml index a9b50fe..353d0e2 100644 --- a/tests/auto/declarative/qdeclarativetextinput/data/geometrySignals.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/geometrySignals.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { width: 400; height: 500; diff --git a/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment.qml b/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment.qml index b97f18e..3114c48 100644 --- a/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: top diff --git a/tests/auto/declarative/qdeclarativetextinput/data/inputmethods.qml b/tests/auto/declarative/qdeclarativetextinput/data/inputmethods.qml index 405ee22..5063892 100644 --- a/tests/auto/declarative/qdeclarativetextinput/data/inputmethods.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/inputmethods.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 TextInput { text: "Hello world!" diff --git a/tests/auto/declarative/qdeclarativetextinput/data/masks.qml b/tests/auto/declarative/qdeclarativetextinput/data/masks.qml index 141c243..c75764a 100644 --- a/tests/auto/declarative/qdeclarativetextinput/data/masks.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/masks.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 TextInput{ focus: true diff --git a/tests/auto/declarative/qdeclarativetextinput/data/maxLength.qml b/tests/auto/declarative/qdeclarativetextinput/data/maxLength.qml index c3d5994..95902bb 100644 --- a/tests/auto/declarative/qdeclarativetextinput/data/maxLength.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/maxLength.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 TextInput{ focus: true diff --git a/tests/auto/declarative/qdeclarativetextinput/data/navigation.qml b/tests/auto/declarative/qdeclarativetextinput/data/navigation.qml index 58866b7..af1b140 100644 --- a/tests/auto/declarative/qdeclarativetextinput/data/navigation.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/navigation.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { property variant myInput: input diff --git a/tests/auto/declarative/qdeclarativetextinput/data/positionAt.qml b/tests/auto/declarative/qdeclarativetextinput/data/positionAt.qml index 2800351..cbbf33d 100644 --- a/tests/auto/declarative/qdeclarativetextinput/data/positionAt.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/positionAt.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 TextInput{ focus: true diff --git a/tests/auto/declarative/qdeclarativetextinput/data/readOnly.qml b/tests/auto/declarative/qdeclarativetextinput/data/readOnly.qml index b10ea81..f173649 100644 --- a/tests/auto/declarative/qdeclarativetextinput/data/readOnly.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/readOnly.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { property variant myInput: input diff --git a/tests/auto/declarative/qdeclarativetextinput/data/validators.qml b/tests/auto/declarative/qdeclarativetextinput/data/validators.qml index 4b1ba27..e26bcb3 100644 --- a/tests/auto/declarative/qdeclarativetextinput/data/validators.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/validators.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { property variant intInput: intInput diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 7450d35..76e0102 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -144,7 +144,7 @@ void tst_qdeclarativetextinput::text() { { QDeclarativeComponent textinputComponent(&engine); - textinputComponent.setData("import Qt 4.7\nTextInput { text: \"\" }", QUrl()); + textinputComponent.setData("import QtQuick 1.0\nTextInput { text: \"\" }", QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); @@ -155,7 +155,7 @@ void tst_qdeclarativetextinput::text() for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.7\nTextInput { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nTextInput { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); @@ -173,7 +173,7 @@ void tst_qdeclarativetextinput::width() // uses Font metrics to find the width for standard { QDeclarativeComponent textinputComponent(&engine); - textinputComponent.setData("import Qt 4.7\nTextInput { text: \"\" }", QUrl()); + textinputComponent.setData("import QtQuick 1.0\nTextInput { text: \"\" }", QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); @@ -188,7 +188,7 @@ void tst_qdeclarativetextinput::width() QFontMetricsF fm(f); qreal metricWidth = fm.width(standard.at(i)); - QString componentStr = "import Qt 4.7\nTextInput { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import QtQuick 1.0\nTextInput { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); @@ -205,7 +205,7 @@ void tst_qdeclarativetextinput::font() { //test size, then bold, then italic, then family { - QString componentStr = "import Qt 4.7\nTextInput { font.pointSize: 40; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nTextInput { font.pointSize: 40; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); @@ -219,7 +219,7 @@ void tst_qdeclarativetextinput::font() } { - QString componentStr = "import Qt 4.7\nTextInput { font.bold: true; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nTextInput { font.bold: true; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); @@ -232,7 +232,7 @@ void tst_qdeclarativetextinput::font() } { - QString componentStr = "import Qt 4.7\nTextInput { font.italic: true; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nTextInput { font.italic: true; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); @@ -245,7 +245,7 @@ void tst_qdeclarativetextinput::font() } { - QString componentStr = "import Qt 4.7\nTextInput { font.family: \"Helvetica\"; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nTextInput { font.family: \"Helvetica\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); @@ -259,7 +259,7 @@ void tst_qdeclarativetextinput::font() } { - QString componentStr = "import Qt 4.7\nTextInput { font.family: \"\"; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nTextInput { font.family: \"\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); @@ -276,7 +276,7 @@ void tst_qdeclarativetextinput::color() //test color for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.7\nTextInput { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nTextInput { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); @@ -289,7 +289,7 @@ void tst_qdeclarativetextinput::color() //test selection color for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.7\nTextInput { selectionColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nTextInput { selectionColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); @@ -302,7 +302,7 @@ void tst_qdeclarativetextinput::color() //test selected text color for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.7\nTextInput { selectedTextColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nTextInput { selectedTextColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); @@ -317,7 +317,7 @@ void tst_qdeclarativetextinput::color() QColor testColor("#001234"); testColor.setAlpha(170); - QString componentStr = "import Qt 4.7\nTextInput { color: \"" + colorStr + "\"; text: \"Hello World\" }"; + QString componentStr = "import QtQuick 1.0\nTextInput { color: \"" + colorStr + "\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); @@ -332,7 +332,7 @@ void tst_qdeclarativetextinput::color() void tst_qdeclarativetextinput::selection() { QString testStr = standard[0]; - QString componentStr = "import Qt 4.7\nTextInput { text: \""+ testStr +"\"; }"; + QString componentStr = "import QtQuick 1.0\nTextInput { text: \""+ testStr +"\"; }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); @@ -509,7 +509,7 @@ void tst_qdeclarativetextinput::maxLength() void tst_qdeclarativetextinput::masks() { //Not a comprehensive test of the possible masks, that's done elsewhere (QLineEdit) - //QString componentStr = "import Qt 4.7\nTextInput { inputMask: 'HHHHhhhh'; }"; + //QString componentStr = "import QtQuick 1.0\nTextInput { inputMask: 'HHHHhhhh'; }"; QDeclarativeView *canvas = createView(SRCDIR "/data/masks.qml"); canvas->show(); canvas->setFocus(); @@ -713,7 +713,7 @@ void tst_qdeclarativetextinput::copyAndPaste() { } #endif - QString componentStr = "import Qt 4.7\nTextInput { text: \"Hello world!\" }"; + QString componentStr = "import QtQuick 1.0\nTextInput { text: \"Hello world!\" }"; QDeclarativeComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textInput = qobject_cast(textInputComponent.create()); @@ -771,7 +771,7 @@ void tst_qdeclarativetextinput::copyAndPaste() { void tst_qdeclarativetextinput::passwordCharacter() { - QString componentStr = "import Qt 4.7\nTextInput { text: \"Hello world!\"; font.family: \"Helvetica\"; echoMode: TextInput.Password }"; + QString componentStr = "import QtQuick 1.0\nTextInput { text: \"Hello world!\"; font.family: \"Helvetica\"; echoMode: TextInput.Password }"; QDeclarativeComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textInput = qobject_cast(textInputComponent.create()); diff --git a/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp b/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp index f49cbd0..8c3e618 100644 --- a/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp +++ b/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp @@ -100,7 +100,7 @@ void tst_qdeclarativetimer::notRepeating() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.7\nTimer { interval: 100; running: true }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import QtQuick 1.0\nTimer { interval: 100; running: true }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast(component.create()); QVERIFY(timer != 0); QVERIFY(timer->isRunning()); @@ -121,7 +121,7 @@ void tst_qdeclarativetimer::notRepeatingStart() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.7\nTimer { interval: 100 }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import QtQuick 1.0\nTimer { interval: 100 }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast(component.create()); QVERIFY(timer != 0); QVERIFY(!timer->isRunning()); @@ -146,7 +146,7 @@ void tst_qdeclarativetimer::repeat() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.7\nTimer { interval: 100; repeat: true; running: true }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import QtQuick 1.0\nTimer { interval: 100; repeat: true; running: true }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast(component.create()); QVERIFY(timer != 0); @@ -188,7 +188,7 @@ void tst_qdeclarativetimer::triggeredOnStart() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.7\nTimer { interval: 100; running: true; triggeredOnStart: true }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import QtQuick 1.0\nTimer { interval: 100; running: true; triggeredOnStart: true }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast(component.create()); QVERIFY(timer != 0); QVERIFY(timer->triggeredOnStart()); @@ -223,7 +223,7 @@ void tst_qdeclarativetimer::triggeredOnStartRepeat() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.7\nTimer { interval: 100; running: true; triggeredOnStart: true; repeat: true }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import QtQuick 1.0\nTimer { interval: 100; running: true; triggeredOnStart: true; repeat: true }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast(component.create()); QVERIFY(timer != 0); @@ -247,7 +247,7 @@ void tst_qdeclarativetimer::noTriggerIfNotRunning() QDeclarativeEngine engine; QDeclarativeComponent component(&engine); component.setData(QByteArray( - "import Qt 4.7\n" + "import QtQuick 1.0\n" "Item { property bool ok: true\n" "Timer { id: t1; interval: 100; repeat: true; running: true; onTriggered: if (!running) ok=false }" "Timer { interval: 10; running: true; onTriggered: t1.running=false }" @@ -265,7 +265,7 @@ void tst_qdeclarativetimer::changeDuration() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.7\nTimer { interval: 200; repeat: true; running: true }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import QtQuick 1.0\nTimer { interval: 200; repeat: true; running: true }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast(component.create()); QVERIFY(timer != 0); @@ -301,7 +301,7 @@ void tst_qdeclarativetimer::restart() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.7\nTimer { interval: 500; repeat: true; running: true }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import QtQuick 1.0\nTimer { interval: 500; repeat: true; running: true }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast(component.create()); QVERIFY(timer != 0); @@ -328,7 +328,7 @@ void tst_qdeclarativetimer::parentProperty() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.7\nItem { Timer { objectName: \"timer\"; running: parent.visible } }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import QtQuick 1.0\nItem { Timer { objectName: \"timer\"; running: parent.visible } }"), QUrl::fromLocalFile("")); QDeclarativeItem *item = qobject_cast(component.create()); QVERIFY(item != 0); QDeclarativeTimer *timer = item->findChild("timer"); diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.1.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.1.qml index 52591b1..e2e6962 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.1.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.1.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: root diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.2.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.2.qml index 35005fe..0e09ff9 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.2.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: root diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.3.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.3.qml index 4ae45a4..1f6646e 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.3.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.3.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: root diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.qml index 69b5bfd..391caba 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 import "deletedObject.js" as JS MyTypeObject { diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/enums.3.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/enums.3.qml index b6767b0..082aed1 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/enums.3.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/enums.3.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyTypeObject { font.capitalization: Font.AllUppercase diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/enums.4.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/enums.4.qml index 4227ebf..e5d9ab2 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/enums.4.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/enums.4.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 as MyQt +import QtQuick 1.0 as MyQt MyTypeObject { font.capitalization: MyQt.Font.AllUppercase diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/enums.5.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/enums.5.qml index a66e9d6..8ec508c 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/enums.5.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/enums.5.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 as MyQt +import QtQuick 1.0 as MyQt MyTypeObject { MyQt.Component.onCompleted: { diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.5.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.5.qml index cc51c31..2fdfddb 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.5.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.5.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import Test 1.0 Item { diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/returnValues.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/returnValues.qml index 0615300..f1c1855 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/returnValues.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/returnValues.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyTypeObject { property bool test1: false; diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/scriptAccess.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/scriptAccess.qml index e962ab0..9299c8b 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/scriptAccess.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/scriptAccess.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import Test 1.0 MyTypeObject { diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror4.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror4.qml index 045fc51..fc41ecf 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror4.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror4.qml @@ -1,5 +1,5 @@ import Test 1.0 -import Qt 4.7 +import QtQuick 1.0 MyTypeObject { Component.onCompleted: { diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/varAssignment.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/varAssignment.qml index e4715ab..ff80ff8 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/varAssignment.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/varAssignment.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property int x; diff --git a/tests/auto/declarative/qdeclarativeview/data/resizemodedeclarativeitem.qml b/tests/auto/declarative/qdeclarativeview/data/resizemodedeclarativeitem.qml index 27c8454..e5501a1 100644 --- a/tests/auto/declarative/qdeclarativeview/data/resizemodedeclarativeitem.qml +++ b/tests/auto/declarative/qdeclarativeview/data/resizemodedeclarativeitem.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { width: 200 height: 200 diff --git a/tests/auto/declarative/qdeclarativeview/data/resizemodegraphicswidget.qml b/tests/auto/declarative/qdeclarativeview/data/resizemodegraphicswidget.qml index 964810c..f270908 100644 --- a/tests/auto/declarative/qdeclarativeview/data/resizemodegraphicswidget.qml +++ b/tests/auto/declarative/qdeclarativeview/data/resizemodegraphicswidget.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QGraphicsWidget { width: 200 height: 200 diff --git a/tests/auto/declarative/qdeclarativeviewer/data/orientation.qml b/tests/auto/declarative/qdeclarativeviewer/data/orientation.qml index 57db82d..fb34312 100644 --- a/tests/auto/declarative/qdeclarativeviewer/data/orientation.qml +++ b/tests/auto/declarative/qdeclarativeviewer/data/orientation.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "black" width: (runtime.orientation == Orientation.Landscape || runtime.orientation == Orientation.LandscapeInverted) ? 300 : 200 diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/data/datalist.qml b/tests/auto/declarative/qdeclarativevisualdatamodel/data/datalist.qml index c5e945a..ebf1eea 100644 --- a/tests/auto/declarative/qdeclarativevisualdatamodel/data/datalist.qml +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/data/datalist.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 ListView { width: 100 diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/data/objectlist.qml b/tests/auto/declarative/qdeclarativevisualdatamodel/data/objectlist.qml index d030222..4134259 100644 --- a/tests/auto/declarative/qdeclarativevisualdatamodel/data/objectlist.qml +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/data/objectlist.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 ListView { width: 100 diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/data/singlerole1.qml b/tests/auto/declarative/qdeclarativevisualdatamodel/data/singlerole1.qml index 7ea74f2..d72e128 100644 --- a/tests/auto/declarative/qdeclarativevisualdatamodel/data/singlerole1.qml +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/data/singlerole1.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 ListView { width: 100 diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/data/singlerole2.qml b/tests/auto/declarative/qdeclarativevisualdatamodel/data/singlerole2.qml index 6654d6b..b9e666c 100644 --- a/tests/auto/declarative/qdeclarativevisualdatamodel/data/singlerole2.qml +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/data/singlerole2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 ListView { width: 100 diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/data/visualdatamodel.qml b/tests/auto/declarative/qdeclarativevisualdatamodel/data/visualdatamodel.qml index d70f82b..a5c44d0 100644 --- a/tests/auto/declarative/qdeclarativevisualdatamodel/data/visualdatamodel.qml +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/data/visualdatamodel.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 VisualDataModel { function setRoot() { diff --git a/tests/auto/declarative/qdeclarativewebview/data/basic.qml b/tests/auto/declarative/qdeclarativewebview/data/basic.qml index ff5d3fd..73330cd 100644 --- a/tests/auto/declarative/qdeclarativewebview/data/basic.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/basic.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import QtWebKit 1.0 WebView { diff --git a/tests/auto/declarative/qdeclarativewebview/data/elements.qml b/tests/auto/declarative/qdeclarativewebview/data/elements.qml index 3adfff8..b86dd9d 100644 --- a/tests/auto/declarative/qdeclarativewebview/data/elements.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/elements.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import QtWebKit 1.0 WebView { diff --git a/tests/auto/declarative/qdeclarativewebview/data/javaScript.qml b/tests/auto/declarative/qdeclarativewebview/data/javaScript.qml index 9f07a51..527e3b9 100644 --- a/tests/auto/declarative/qdeclarativewebview/data/javaScript.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/javaScript.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import QtWebKit 1.0 WebView { diff --git a/tests/auto/declarative/qdeclarativewebview/data/loadError.qml b/tests/auto/declarative/qdeclarativewebview/data/loadError.qml index a0cc4c8..baab1a0 100644 --- a/tests/auto/declarative/qdeclarativewebview/data/loadError.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/loadError.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import QtWebKit 1.0 WebView { diff --git a/tests/auto/declarative/qdeclarativewebview/data/newwindows.qml b/tests/auto/declarative/qdeclarativewebview/data/newwindows.qml index e5967b5..e66631d 100644 --- a/tests/auto/declarative/qdeclarativewebview/data/newwindows.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/newwindows.qml @@ -1,6 +1,6 @@ // Demonstrates opening new WebViews from HTML -import Qt 4.7 +import QtQuick 1.0 import QtWebKit 1.0 Grid { diff --git a/tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml b/tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml index 569f4a5..db06887 100644 --- a/tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import QtWebKit 1.0 Item { diff --git a/tests/auto/declarative/qdeclarativewebview/data/sethtml.qml b/tests/auto/declarative/qdeclarativewebview/data/sethtml.qml index 1edd436..7889704 100644 --- a/tests/auto/declarative/qdeclarativewebview/data/sethtml.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/sethtml.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import QtWebKit 1.0 WebView { diff --git a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp index 2bded6b..1f460a3 100644 --- a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp +++ b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp @@ -454,7 +454,7 @@ void tst_qdeclarativewebview::newWindowComponent() QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); QDeclarativeComponent substituteComponent(&engine); - substituteComponent.setData("import Qt 4.7; WebView { objectName: 'newWebView'; url: 'basic.html'; }", QUrl::fromLocalFile("")); + substituteComponent.setData("import QtQuick 1.0; WebView { objectName: 'newWebView'; url: 'basic.html'; }", QUrl::fromLocalFile("")); QSignalSpy newWindowComponentSpy(wv, SIGNAL(newWindowComponentChanged())); wv->setProperty("newWindowComponent", QVariant::fromValue(&substituteComponent)); diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/BaseWorker.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/BaseWorker.qml index e06afa2..b419c83 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/data/BaseWorker.qml +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/BaseWorker.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 WorkerScript { id: worker diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml index 1a20098..0c439c4 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 BaseWorker { source: "script.js" diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/worker_pragma.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/worker_pragma.qml index 3b720ef..a8800ad 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/data/worker_pragma.qml +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/worker_pragma.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 BaseWorker { source: "script_pragma.js" diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.qml index 24e4071..0196586 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string urlDummy diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_opened.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_opened.qml index e78ce63..aeea278 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_opened.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_opened.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string url: "testdocument.html" diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_unsent.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_unsent.qml index 79d1355..fffc3d9 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_unsent.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_unsent.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string url: "testdocument.html" diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/attr.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/attr.qml index 81d8e1d..5d5dd12 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/attr.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/attr.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool xmlTest: false diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/callbackException.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/callbackException.qml index cee07d6..ec6902d 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/callbackException.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/callbackException.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { id: obj diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/cdata.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/cdata.qml index 49bfebd..be60664 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/cdata.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/cdata.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool xmlTest: false diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/constructor.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/constructor.qml index ab033a5..0050f91 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/constructor.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/constructor.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool calledAsConstructor diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/defaultState.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/defaultState.qml index d66f283..77b2b94 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/defaultState.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/defaultState.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property int readyState diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/document.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/document.qml index 1df43ef..faf3af0 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/document.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/document.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool xmlTest: false diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/domExceptionCodes.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/domExceptionCodes.qml index 827ff3f..0f32a64 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/domExceptionCodes.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/domExceptionCodes.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property int index_size_err: DOMException.INDEX_SIZE_ERR diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/element.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/element.qml index e7a3fb4..daec950 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/element.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/element.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool xmlTest: false diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders.qml index 157ae81..686e7e5 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string url diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders_args.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders_args.qml index 7008224..e8b7b77 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders_args.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders_args.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool exceptionThrown: false diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders_sent.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders_sent.qml index ff58710..1d4883e 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders_sent.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders_sent.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool test: false diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders_unsent.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders_unsent.qml index d6256ed..360286d 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders_unsent.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders_unsent.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool test: false diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.qml index 0f3cdef..f37545e 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string url diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader_args.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader_args.qml index a7a8bba..61ce9c6 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader_args.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader_args.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool exceptionThrown: false diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader_sent.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader_sent.qml index fc0f757..7cd91a2 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader_sent.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader_sent.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool test: false diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader_unsent.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader_unsent.qml index c5507a8..983ea1b 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader_unsent.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader_unsent.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool test: false diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/instanceStateValues.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/instanceStateValues.qml index d3cc845..79e06d4 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/instanceStateValues.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/instanceStateValues.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property int unsent diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/invalidMethodUsage.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/invalidMethodUsage.qml index 8c603a4..68f22f5 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/invalidMethodUsage.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/invalidMethodUsage.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool onreadystatechange: false diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open.qml index 24bde60..4bb5b1d 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string url diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_arg_count.1.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_arg_count.1.qml index 86a6ac9..da6eb14 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_arg_count.1.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_arg_count.1.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool exceptionThrown: false diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_arg_count.2.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_arg_count.2.qml index 198219c..f003292 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_arg_count.2.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_arg_count.2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool exceptionThrown: false diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_invalid_method.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_invalid_method.qml index dacc484..b87823d 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_invalid_method.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_invalid_method.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool exceptionThrown: false diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_sync.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_sync.qml index d38380b..9f8f309 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_sync.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_sync.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool exceptionThrown: false diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_user.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_user.qml index 2c072e4..2bec344 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_user.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_user.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string url diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_username.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_username.qml index 825ad60..70f2fa6 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_username.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_username.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string url diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/redirectError.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/redirectError.qml index cb8f869..f009ab7 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/redirectError.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/redirectError.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string url diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/redirectRecur.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/redirectRecur.qml index f895a8c..86337c4 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/redirectRecur.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/redirectRecur.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string url diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/redirects.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/redirects.qml index 268966e..cd125ad 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/redirects.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/redirects.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string url diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/responseText.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/responseText.qml index 22a9b96..da229f6 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/responseText.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/responseText.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string url diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/responseXML_invalid.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/responseXML_invalid.qml index d754921..393ff09 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/responseXML_invalid.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/responseXML_invalid.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool xmlNull: false diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_alreadySent.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_alreadySent.qml index 8f69a94..fd1c424 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_alreadySent.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_alreadySent.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool dataOK: false diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.qml index 7ab53d3..3dd851e 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string url diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.2.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.2.qml index 3a48e28..fb18936 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.2.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string url diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.3.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.3.qml index c68b821..9f2383e 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.3.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.3.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string url diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.qml index 8fee2cd..410820e 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string url diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.5.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.5.qml index ea214fa..f56c51b 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.5.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.5.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string url diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.qml index 524622c..d44864c 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string url diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.7.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.7.qml index a4828cd..427d9f4 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.7.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.7.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string url diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.qml index a1f46e2..c98555c 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string reqType diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_unsent.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_unsent.qml index 0efa40a..badd729 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_unsent.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_unsent.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool test: false diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.qml index b252f4a..5afab09 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string url diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_args.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_args.qml index e83cb72..4558f0e 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_args.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_args.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool exceptionThrown: false diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_illegalName.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_illegalName.qml index 3f9041c..b15318c 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_illegalName.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_illegalName.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string url diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_sent.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_sent.qml index b15b404..3b9a91e 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_sent.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_sent.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string url diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_unsent.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_unsent.qml index aadc580..327fa7f 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_unsent.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_unsent.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool test: false diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/staticStateValues.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/staticStateValues.qml index 97d42ac..bc22d87 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/staticStateValues.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/staticStateValues.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property int unsent: XMLHttpRequest.UNSENT diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.qml index e28add2..7aa0874 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string url diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/statusText.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/statusText.qml index a44c6ba..d42e0cc 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/statusText.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/statusText.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property string url diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/text.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/text.qml index 63bfb08..e8c8731 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/text.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/text.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool xmlTest: false diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/utf16.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/utf16.qml index 85bff29..0f9da30 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/utf16.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/utf16.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { property bool dataOK: false diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/data/model.qml b/tests/auto/declarative/qdeclarativexmllistmodel/data/model.qml index 8354193..fdacb6c 100644 --- a/tests/auto/declarative/qdeclarativexmllistmodel/data/model.qml +++ b/tests/auto/declarative/qdeclarativexmllistmodel/data/model.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 XmlListModel { source: "model.xml" diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/data/model2.qml b/tests/auto/declarative/qdeclarativexmllistmodel/data/model2.qml index 09077b6..e56aafa 100644 --- a/tests/auto/declarative/qdeclarativexmllistmodel/data/model2.qml +++ b/tests/auto/declarative/qdeclarativexmllistmodel/data/model2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 XmlListModel { source: "model.xml" diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/data/propertychanges.qml b/tests/auto/declarative/qdeclarativexmllistmodel/data/propertychanges.qml index b014aa3..ed674ce 100644 --- a/tests/auto/declarative/qdeclarativexmllistmodel/data/propertychanges.qml +++ b/tests/auto/declarative/qdeclarativexmllistmodel/data/propertychanges.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 XmlListModel { source: "model.xml" diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/data/recipes.qml b/tests/auto/declarative/qdeclarativexmllistmodel/data/recipes.qml index 59b8ddc..6345101 100644 --- a/tests/auto/declarative/qdeclarativexmllistmodel/data/recipes.qml +++ b/tests/auto/declarative/qdeclarativexmllistmodel/data/recipes.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 XmlListModel { source: "recipes.xml" diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/data/roleErrors.qml b/tests/auto/declarative/qdeclarativexmllistmodel/data/roleErrors.qml index a905963..a0d846f 100644 --- a/tests/auto/declarative/qdeclarativexmllistmodel/data/roleErrors.qml +++ b/tests/auto/declarative/qdeclarativexmllistmodel/data/roleErrors.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 XmlListModel { source: "model.xml" diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/data/roleKeys.qml b/tests/auto/declarative/qdeclarativexmllistmodel/data/roleKeys.qml index eaf5f0a..d90cd61 100644 --- a/tests/auto/declarative/qdeclarativexmllistmodel/data/roleKeys.qml +++ b/tests/auto/declarative/qdeclarativexmllistmodel/data/roleKeys.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 XmlListModel { query: "/data/item" diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/data/unique.qml b/tests/auto/declarative/qdeclarativexmllistmodel/data/unique.qml index 3aa7b1f3..dab8ffa 100644 --- a/tests/auto/declarative/qdeclarativexmllistmodel/data/unique.qml +++ b/tests/auto/declarative/qdeclarativexmllistmodel/data/unique.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 XmlListModel { source: "model.xml" diff --git a/tests/auto/declarative/qmlvisual/ListView/basic1.qml b/tests/auto/declarative/qmlvisual/ListView/basic1.qml index c67aaaa..d55c997 100644 --- a/tests/auto/declarative/qmlvisual/ListView/basic1.qml +++ b/tests/auto/declarative/qmlvisual/ListView/basic1.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "blue" diff --git a/tests/auto/declarative/qmlvisual/ListView/basic2.qml b/tests/auto/declarative/qmlvisual/ListView/basic2.qml index 73c1b9a..31c802d 100644 --- a/tests/auto/declarative/qmlvisual/ListView/basic2.qml +++ b/tests/auto/declarative/qmlvisual/ListView/basic2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "blue" diff --git a/tests/auto/declarative/qmlvisual/ListView/basic3.qml b/tests/auto/declarative/qmlvisual/ListView/basic3.qml index 44f74a5..be39ca1 100644 --- a/tests/auto/declarative/qmlvisual/ListView/basic3.qml +++ b/tests/auto/declarative/qmlvisual/ListView/basic3.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "blue" diff --git a/tests/auto/declarative/qmlvisual/ListView/basic4.qml b/tests/auto/declarative/qmlvisual/ListView/basic4.qml index e5d097b..906af63 100644 --- a/tests/auto/declarative/qmlvisual/ListView/basic4.qml +++ b/tests/auto/declarative/qmlvisual/ListView/basic4.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "blue" diff --git a/tests/auto/declarative/qmlvisual/ListView/itemlist.qml b/tests/auto/declarative/qmlvisual/ListView/itemlist.qml index 2a00397..7e5d634 100644 --- a/tests/auto/declarative/qmlvisual/ListView/itemlist.qml +++ b/tests/auto/declarative/qmlvisual/ListView/itemlist.qml @@ -1,7 +1,7 @@ // This example demonstrates placing items in a view using // a VisualItemModel -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "lightgray" diff --git a/tests/auto/declarative/qmlvisual/ListView/listview.qml b/tests/auto/declarative/qmlvisual/ListView/listview.qml index 6e0b47a..341311d 100644 --- a/tests/auto/declarative/qmlvisual/ListView/listview.qml +++ b/tests/auto/declarative/qmlvisual/ListView/listview.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 600; height: 300; color: "white" diff --git a/tests/auto/declarative/qmlvisual/Package_Views/packageviews.qml b/tests/auto/declarative/qmlvisual/Package_Views/packageviews.qml index 9db0f0d..99379f1 100644 --- a/tests/auto/declarative/qmlvisual/Package_Views/packageviews.qml +++ b/tests/auto/declarative/qmlvisual/Package_Views/packageviews.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: root diff --git a/tests/auto/declarative/qmlvisual/animation/bindinganimation/bindinganimation.qml b/tests/auto/declarative/qmlvisual/animation/bindinganimation/bindinganimation.qml index 406e10b..611eaf5 100644 --- a/tests/auto/declarative/qmlvisual/animation/bindinganimation/bindinganimation.qml +++ b/tests/auto/declarative/qmlvisual/animation/bindinganimation/bindinganimation.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "blue" diff --git a/tests/auto/declarative/qmlvisual/animation/colorAnimation/colorAnimation-visual.qml b/tests/auto/declarative/qmlvisual/animation/colorAnimation/colorAnimation-visual.qml index 49730fc..235ad9d 100644 --- a/tests/auto/declarative/qmlvisual/animation/colorAnimation/colorAnimation-visual.qml +++ b/tests/auto/declarative/qmlvisual/animation/colorAnimation/colorAnimation-visual.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: mainrect diff --git a/tests/auto/declarative/qmlvisual/animation/easing/easing.qml b/tests/auto/declarative/qmlvisual/animation/easing/easing.qml index d42f069..35b568a 100644 --- a/tests/auto/declarative/qmlvisual/animation/easing/easing.qml +++ b/tests/auto/declarative/qmlvisual/animation/easing/easing.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: item diff --git a/tests/auto/declarative/qmlvisual/animation/loop/loop.qml b/tests/auto/declarative/qmlvisual/animation/loop/loop.qml index 78fbc68..6f62582 100644 --- a/tests/auto/declarative/qmlvisual/animation/loop/loop.qml +++ b/tests/auto/declarative/qmlvisual/animation/loop/loop.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: wrapper diff --git a/tests/auto/declarative/qmlvisual/animation/parallelAnimation/parallelAnimation-visual.qml b/tests/auto/declarative/qmlvisual/animation/parallelAnimation/parallelAnimation-visual.qml index 7e0374c..9a75763 100644 --- a/tests/auto/declarative/qmlvisual/animation/parallelAnimation/parallelAnimation-visual.qml +++ b/tests/auto/declarative/qmlvisual/animation/parallelAnimation/parallelAnimation-visual.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 /* This test verifies that a single animation animating two properties is visually the same as two diff --git a/tests/auto/declarative/qmlvisual/animation/parentAnimation/parentAnimation-visual.qml b/tests/auto/declarative/qmlvisual/animation/parentAnimation/parentAnimation-visual.qml index b30281d..42cec3a 100644 --- a/tests/auto/declarative/qmlvisual/animation/parentAnimation/parentAnimation-visual.qml +++ b/tests/auto/declarative/qmlvisual/animation/parentAnimation/parentAnimation-visual.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 /* This test shows a green rectangle moving and growing from the upper-left corner diff --git a/tests/auto/declarative/qmlvisual/animation/parentAnimation2/parentAnimation2.qml b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/parentAnimation2.qml index dfab108..f497943 100644 --- a/tests/auto/declarative/qmlvisual/animation/parentAnimation2/parentAnimation2.qml +++ b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/parentAnimation2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 /* Blue rect fills (with 10px margin) screen, then red, then green, then screen again. diff --git a/tests/auto/declarative/qmlvisual/animation/pauseAnimation/pauseAnimation-visual.qml b/tests/auto/declarative/qmlvisual/animation/pauseAnimation/pauseAnimation-visual.qml index cc9a639..1b315b2 100644 --- a/tests/auto/declarative/qmlvisual/animation/pauseAnimation/pauseAnimation-visual.qml +++ b/tests/auto/declarative/qmlvisual/animation/pauseAnimation/pauseAnimation-visual.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 /* This test shows a bouncing logo. diff --git a/tests/auto/declarative/qmlvisual/animation/propertyAction/propertyAction-visual.qml b/tests/auto/declarative/qmlvisual/animation/propertyAction/propertyAction-visual.qml index 89c2c5b..6c3e52d 100644 --- a/tests/auto/declarative/qmlvisual/animation/propertyAction/propertyAction-visual.qml +++ b/tests/auto/declarative/qmlvisual/animation/propertyAction/propertyAction-visual.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 /* This test starts with a red rectangle at 0,0. It should animate a color change to blue, diff --git a/tests/auto/declarative/qmlvisual/animation/qtbug10586/qtbug10586.qml b/tests/auto/declarative/qmlvisual/animation/qtbug10586/qtbug10586.qml index f1a3ef7..9ccebfa 100644 --- a/tests/auto/declarative/qmlvisual/animation/qtbug10586/qtbug10586.qml +++ b/tests/auto/declarative/qmlvisual/animation/qtbug10586/qtbug10586.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 200 diff --git a/tests/auto/declarative/qmlvisual/animation/qtbug13398/qtbug13398.qml b/tests/auto/declarative/qmlvisual/animation/qtbug13398/qtbug13398.qml index 8f388bc..93ecd2e 100644 --- a/tests/auto/declarative/qmlvisual/animation/qtbug13398/qtbug13398.qml +++ b/tests/auto/declarative/qmlvisual/animation/qtbug13398/qtbug13398.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { width: 300 diff --git a/tests/auto/declarative/qmlvisual/animation/reanchor/reanchor.qml b/tests/auto/declarative/qmlvisual/animation/reanchor/reanchor.qml index 7a10db1..e0a5a6d 100644 --- a/tests/auto/declarative/qmlvisual/animation/reanchor/reanchor.qml +++ b/tests/auto/declarative/qmlvisual/animation/reanchor/reanchor.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: container diff --git a/tests/auto/declarative/qmlvisual/animation/scriptAction/scriptAction-visual.qml b/tests/auto/declarative/qmlvisual/animation/scriptAction/scriptAction-visual.qml index 5008356..1427c9d 100644 --- a/tests/auto/declarative/qmlvisual/animation/scriptAction/scriptAction-visual.qml +++ b/tests/auto/declarative/qmlvisual/animation/scriptAction/scriptAction-visual.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 /* This test starts with a red rectangle at 0,0. It should animate moving 50 pixels right, diff --git a/tests/auto/declarative/qmlvisual/fillmode/fillmode.qml b/tests/auto/declarative/qmlvisual/fillmode/fillmode.qml index 817ccc0..2ac98da 100644 --- a/tests/auto/declarative/qmlvisual/fillmode/fillmode.qml +++ b/tests/auto/declarative/qmlvisual/fillmode/fillmode.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 /* This is a static display test of the various Image fill modes. See the png file in the data diff --git a/tests/auto/declarative/qmlvisual/focusscope/test.qml b/tests/auto/declarative/qmlvisual/focusscope/test.qml index 24b4b99..6b2ee25 100644 --- a/tests/auto/declarative/qmlvisual/focusscope/test.qml +++ b/tests/auto/declarative/qmlvisual/focusscope/test.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "white" diff --git a/tests/auto/declarative/qmlvisual/focusscope/test2.qml b/tests/auto/declarative/qmlvisual/focusscope/test2.qml index 19c8bed..4df75cf 100644 --- a/tests/auto/declarative/qmlvisual/focusscope/test2.qml +++ b/tests/auto/declarative/qmlvisual/focusscope/test2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "white" diff --git a/tests/auto/declarative/qmlvisual/focusscope/test3.qml b/tests/auto/declarative/qmlvisual/focusscope/test3.qml index 7535c31..184763a 100644 --- a/tests/auto/declarative/qmlvisual/focusscope/test3.qml +++ b/tests/auto/declarative/qmlvisual/focusscope/test3.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "white" diff --git a/tests/auto/declarative/qmlvisual/qdeclarativeborderimage/animated-smooth.qml b/tests/auto/declarative/qmlvisual/qdeclarativeborderimage/animated-smooth.qml index fdb4da3..8c21cee 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativeborderimage/animated-smooth.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativeborderimage/animated-smooth.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import "content" Rectangle { diff --git a/tests/auto/declarative/qmlvisual/qdeclarativeborderimage/animated.qml b/tests/auto/declarative/qmlvisual/qdeclarativeborderimage/animated.qml index 730aeca..fb5cac0 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativeborderimage/animated.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativeborderimage/animated.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import "content" Rectangle { diff --git a/tests/auto/declarative/qmlvisual/qdeclarativeborderimage/borders.qml b/tests/auto/declarative/qmlvisual/qdeclarativeborderimage/borders.qml index 8956128..1a8b7a5 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativeborderimage/borders.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativeborderimage/borders.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: page diff --git a/tests/auto/declarative/qmlvisual/qdeclarativeborderimage/content/MyBorderImage.qml b/tests/auto/declarative/qmlvisual/qdeclarativeborderimage/content/MyBorderImage.qml index ce0c38c..f4ead54 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativeborderimage/content/MyBorderImage.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativeborderimage/content/MyBorderImage.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { property alias horizontalMode: image.horizontalTileMode diff --git a/tests/auto/declarative/qmlvisual/qdeclarativeflickable/flickable-horizontal.qml b/tests/auto/declarative/qmlvisual/qdeclarativeflickable/flickable-horizontal.qml index 175a891..8aa2389 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativeflickable/flickable-horizontal.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativeflickable/flickable-horizontal.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "lightSteelBlue" diff --git a/tests/auto/declarative/qmlvisual/qdeclarativeflickable/flickable-vertical.qml b/tests/auto/declarative/qmlvisual/qdeclarativeflickable/flickable-vertical.qml index d845353..5f43f95 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativeflickable/flickable-vertical.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativeflickable/flickable-vertical.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "lightSteelBlue" diff --git a/tests/auto/declarative/qmlvisual/qdeclarativeflipable/test-flipable.qml b/tests/auto/declarative/qmlvisual/qdeclarativeflipable/test-flipable.qml index da76ff9..8a178b3 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativeflipable/test-flipable.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativeflipable/test-flipable.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400; height: 240 diff --git a/tests/auto/declarative/qmlvisual/qdeclarativeflipable/test_flipable_resize.qml b/tests/auto/declarative/qmlvisual/qdeclarativeflipable/test_flipable_resize.qml index fa68753..8aeb6c8 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativeflipable/test_flipable_resize.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativeflipable/test_flipable_resize.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { //realWindow width: 370 height: 480 diff --git a/tests/auto/declarative/qmlvisual/qdeclarativegridview/gridview.qml b/tests/auto/declarative/qmlvisual/qdeclarativegridview/gridview.qml index 1b0bd65..c79e19f 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativegridview/gridview.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativegridview/gridview.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 300; height: 400; color: "black" diff --git a/tests/auto/declarative/qmlvisual/qdeclarativegridview/gridview2.qml b/tests/auto/declarative/qmlvisual/qdeclarativegridview/gridview2.qml index 30e2424..811e0e4 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativegridview/gridview2.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativegridview/gridview2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 300; height: 400; color: "black" diff --git a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/drag.qml b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/drag.qml index 6762645..99c898e 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/drag.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/drag.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 /* this test shows a blue box being dragged around -- first roughly tracing the diff --git a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/mousearea-flickable.qml b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/mousearea-flickable.qml index e223f5e..70ea78c 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/mousearea-flickable.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/mousearea-flickable.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 400; height: 480 diff --git a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/mousearea-visual.qml b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/mousearea-visual.qml index a686188..540866f 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/mousearea-visual.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/mousearea-visual.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 /* This test displays 6 red rects -- 4 in the top row, 2 in the bottom. diff --git a/tests/auto/declarative/qmlvisual/qdeclarativeparticles/particles.qml b/tests/auto/declarative/qmlvisual/qdeclarativeparticles/particles.qml index 1b64376..b36a220 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativeparticles/particles.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativeparticles/particles.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.particles 1.0 Rectangle { diff --git a/tests/auto/declarative/qmlvisual/qdeclarativepathview/test-pathview-2.qml b/tests/auto/declarative/qmlvisual/qdeclarativepathview/test-pathview-2.qml index aed6380..38368d4 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativepathview/test-pathview-2.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativepathview/test-pathview-2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 800; height: 450 diff --git a/tests/auto/declarative/qmlvisual/qdeclarativepathview/test-pathview.qml b/tests/auto/declarative/qmlvisual/qdeclarativepathview/test-pathview.qml index e6e1a70..ce516ac 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativepathview/test-pathview.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativepathview/test-pathview.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 800; height: 450 diff --git a/tests/auto/declarative/qmlvisual/qdeclarativepositioners/dynamic.qml b/tests/auto/declarative/qmlvisual/qdeclarativepositioners/dynamic.qml index 5981b12..8da3602 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativepositioners/dynamic.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativepositioners/dynamic.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { width: 400; height: 400; diff --git a/tests/auto/declarative/qmlvisual/qdeclarativepositioners/usingRepeater.qml b/tests/auto/declarative/qmlvisual/qdeclarativepositioners/usingRepeater.qml index 91895c2..c318a99 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativepositioners/usingRepeater.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativepositioners/usingRepeater.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item{ width: 200; height: 600 diff --git a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedanimation.qml b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedanimation.qml index d17233e..ac0c141 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedanimation.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedanimation.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 800; height: 240; color: "gray" diff --git a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml index 63dba47..720d2e6 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 800; height: 720; color: "gray" diff --git a/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/clock.qml b/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/clock.qml index c64497a..44c4dcd 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/clock.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/clock.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: clock diff --git a/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/follow.qml b/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/follow.qml index 05b93df..0097449 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/follow.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/follow.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "#ffffff" diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/baseline/parentanchor.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/baseline/parentanchor.qml index f04aa66..ec1f8b3 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetext/baseline/parentanchor.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/baseline/parentanchor.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: s; width: 600; height: 100; color: "lightsteelblue" diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/elide/elide.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/elide/elide.qml index a4bf452..b96ecb3 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetext/elide/elide.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/elide/elide.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: childrenRect.width diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/elide/elide2.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/elide/elide2.qml index 1058b04..edf0cb5 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetext/elide/elide2.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/elide/elide2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 500 diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/elide/multilength.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/elide/multilength.qml index 2b9c85c..6698421 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetext/elide/multilength.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/elide/multilength.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 500 diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml index e268a60..25db179 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: s; width: 800; height: 1000; color: "lightsteelblue" diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml index a883b9c..31b0e69 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: s; width: 800; height: 1000; color: "lightsteelblue" diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/MultilineEdit.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/MultilineEdit.qml index 53538cb..c987568 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/MultilineEdit.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/MultilineEdit.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { id:lineedit diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/cursorDelegate.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/cursorDelegate.qml index 686dd2c..c0eeb82 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/cursorDelegate.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/cursorDelegate.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { resources: [ Component { id: cursorA diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/qt-669.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/qt-669.qml index 277b9fc..b5bb102 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/qt-669.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/qt-669.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { Component { id: testableCursor diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/usingMultilineEdit.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/usingMultilineEdit.qml index 47b48d8..4cf7e97 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/usingMultilineEdit.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/usingMultilineEdit.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle{ width: 600 diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/wrap.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/wrap.qml index a1dc5bf..4afe417 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/wrap.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/wrap.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { height:400 diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/LineEdit.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/LineEdit.qml index e863262..74c16e2 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/LineEdit.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/LineEdit.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { id:lineedit diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/cursorDelegate.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/cursorDelegate.qml index 1de2f4f..973462a 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/cursorDelegate.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/cursorDelegate.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { resources: [ Component { id: cursorA diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/echoMode.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/echoMode.qml index 5a12e2e..5d11403 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/echoMode.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/echoMode.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item{ height: 50; width: 200 diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/hAlign.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/hAlign.qml index 08df173..17e13fd 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/hAlign.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/hAlign.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item{ width:600; diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/usingLineEdit.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/usingLineEdit.qml index 2465866..318af0f 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/usingLineEdit.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/usingLineEdit.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle{ width: 600 diff --git a/tests/auto/declarative/qmlvisual/rect/GradientRect.qml b/tests/auto/declarative/qmlvisual/rect/GradientRect.qml index 0272f84..dea5377 100644 --- a/tests/auto/declarative/qmlvisual/rect/GradientRect.qml +++ b/tests/auto/declarative/qmlvisual/rect/GradientRect.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { id: rect diff --git a/tests/auto/declarative/qmlvisual/rect/MyRect.qml b/tests/auto/declarative/qmlvisual/rect/MyRect.qml index 7a315e8..a595f7d 100644 --- a/tests/auto/declarative/qmlvisual/rect/MyRect.qml +++ b/tests/auto/declarative/qmlvisual/rect/MyRect.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { id: rect diff --git a/tests/auto/declarative/qmlvisual/rect/rect-painting.qml b/tests/auto/declarative/qmlvisual/rect/rect-painting.qml index 6abb03d..3c5d90c 100644 --- a/tests/auto/declarative/qmlvisual/rect/rect-painting.qml +++ b/tests/auto/declarative/qmlvisual/rect/rect-painting.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 900; height: 500 diff --git a/tests/auto/declarative/qmlvisual/repeater/basic1.qml b/tests/auto/declarative/qmlvisual/repeater/basic1.qml index 3d31324..7f1ba84 100644 --- a/tests/auto/declarative/qmlvisual/repeater/basic1.qml +++ b/tests/auto/declarative/qmlvisual/repeater/basic1.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "blue" diff --git a/tests/auto/declarative/qmlvisual/repeater/basic2.qml b/tests/auto/declarative/qmlvisual/repeater/basic2.qml index 9cad9eb..b10420c 100644 --- a/tests/auto/declarative/qmlvisual/repeater/basic2.qml +++ b/tests/auto/declarative/qmlvisual/repeater/basic2.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "blue" diff --git a/tests/auto/declarative/qmlvisual/repeater/basic3.qml b/tests/auto/declarative/qmlvisual/repeater/basic3.qml index 6346412..a296801 100644 --- a/tests/auto/declarative/qmlvisual/repeater/basic3.qml +++ b/tests/auto/declarative/qmlvisual/repeater/basic3.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "blue" diff --git a/tests/auto/declarative/qmlvisual/repeater/basic4.qml b/tests/auto/declarative/qmlvisual/repeater/basic4.qml index 817d438..fa85835 100644 --- a/tests/auto/declarative/qmlvisual/repeater/basic4.qml +++ b/tests/auto/declarative/qmlvisual/repeater/basic4.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Rectangle { color: "blue" diff --git a/tests/auto/declarative/qmlvisual/selftest_noimages/selftest_noimages.qml b/tests/auto/declarative/qmlvisual/selftest_noimages/selftest_noimages.qml index cd4dab1..3ef2a66 100644 --- a/tests/auto/declarative/qmlvisual/selftest_noimages/selftest_noimages.qml +++ b/tests/auto/declarative/qmlvisual/selftest_noimages/selftest_noimages.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Text { property string error: "not pressed" text: (new Date()).valueOf() diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/autosize.qml b/tests/auto/declarative/qmlvisual/webview/autosize/autosize.qml index c4a502e..b6280a6 100644 --- a/tests/auto/declarative/qmlvisual/webview/autosize/autosize.qml +++ b/tests/auto/declarative/qmlvisual/webview/autosize/autosize.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import org.webkit 1.0 // The WebView size is determined by the width, height, diff --git a/tests/auto/declarative/qmlvisual/webview/javascript/evaluateJavaScript.qml b/tests/auto/declarative/qmlvisual/webview/javascript/evaluateJavaScript.qml index 4a72d7f..bee2618 100644 --- a/tests/auto/declarative/qmlvisual/webview/javascript/evaluateJavaScript.qml +++ b/tests/auto/declarative/qmlvisual/webview/javascript/evaluateJavaScript.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import org.webkit 1.0 Column { diff --git a/tests/auto/declarative/qmlvisual/webview/javascript/windowObjects.qml b/tests/auto/declarative/qmlvisual/webview/javascript/windowObjects.qml index 4006b47..9e22e20 100644 --- a/tests/auto/declarative/qmlvisual/webview/javascript/windowObjects.qml +++ b/tests/auto/declarative/qmlvisual/webview/javascript/windowObjects.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import org.webkit 1.0 Column { diff --git a/tests/auto/declarative/qmlvisual/webview/settings/fontFamily.qml b/tests/auto/declarative/qmlvisual/webview/settings/fontFamily.qml index 2f68f24..68acced 100644 --- a/tests/auto/declarative/qmlvisual/webview/settings/fontFamily.qml +++ b/tests/auto/declarative/qmlvisual/webview/settings/fontFamily.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import org.webkit 1.0 WebView { diff --git a/tests/auto/declarative/qmlvisual/webview/settings/fontSize.qml b/tests/auto/declarative/qmlvisual/webview/settings/fontSize.qml index c017cd9..4a0db01 100644 --- a/tests/auto/declarative/qmlvisual/webview/settings/fontSize.qml +++ b/tests/auto/declarative/qmlvisual/webview/settings/fontSize.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import org.webkit 1.0 Grid { diff --git a/tests/auto/declarative/qmlvisual/webview/settings/noAutoLoadImages.qml b/tests/auto/declarative/qmlvisual/webview/settings/noAutoLoadImages.qml index 4f8d3b2..3d50664 100644 --- a/tests/auto/declarative/qmlvisual/webview/settings/noAutoLoadImages.qml +++ b/tests/auto/declarative/qmlvisual/webview/settings/noAutoLoadImages.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import org.webkit 1.0 Grid { diff --git a/tests/auto/declarative/qmlvisual/webview/settings/setFontFamily.qml b/tests/auto/declarative/qmlvisual/webview/settings/setFontFamily.qml index 42220e4..ae5ddd2 100644 --- a/tests/auto/declarative/qmlvisual/webview/settings/setFontFamily.qml +++ b/tests/auto/declarative/qmlvisual/webview/settings/setFontFamily.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import org.webkit 1.0 WebView { diff --git a/tests/auto/declarative/qmlvisual/webview/zooming/pageWidth.qml b/tests/auto/declarative/qmlvisual/webview/zooming/pageWidth.qml index c9e3c02..1617bda 100644 --- a/tests/auto/declarative/qmlvisual/webview/zooming/pageWidth.qml +++ b/tests/auto/declarative/qmlvisual/webview/zooming/pageWidth.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import org.webkit 1.0 WebView { diff --git a/tests/auto/declarative/qmlvisual/webview/zooming/renderControl.qml b/tests/auto/declarative/qmlvisual/webview/zooming/renderControl.qml index 8174606..e46f726 100644 --- a/tests/auto/declarative/qmlvisual/webview/zooming/renderControl.qml +++ b/tests/auto/declarative/qmlvisual/webview/zooming/renderControl.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import org.webkit 1.0 Rectangle { diff --git a/tests/auto/declarative/qmlvisual/webview/zooming/resolution.qml b/tests/auto/declarative/qmlvisual/webview/zooming/resolution.qml index b2638f9..e9189db 100644 --- a/tests/auto/declarative/qmlvisual/webview/zooming/resolution.qml +++ b/tests/auto/declarative/qmlvisual/webview/zooming/resolution.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import org.webkit 1.0 WebView { diff --git a/tests/auto/declarative/qmlvisual/webview/zooming/zoomTextOnly.qml b/tests/auto/declarative/qmlvisual/webview/zooming/zoomTextOnly.qml index bf7f9ff..52222be 100644 --- a/tests/auto/declarative/qmlvisual/webview/zooming/zoomTextOnly.qml +++ b/tests/auto/declarative/qmlvisual/webview/zooming/zoomTextOnly.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import org.webkit 1.0 WebView { diff --git a/tests/auto/declarative/qmlvisual/webview/zooming/zooming.qml b/tests/auto/declarative/qmlvisual/webview/zooming/zooming.qml index 5b4dd7a..dc973c2 100644 --- a/tests/auto/declarative/qmlvisual/webview/zooming/zooming.qml +++ b/tests/auto/declarative/qmlvisual/webview/zooming/zooming.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 import org.webkit 1.0 // Note that zooming is better done using zoomFactor and careful diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml b/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml index 172bd65..768a4e2 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml +++ b/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QtObject { function translate() { diff --git a/tests/benchmarks/declarative/compilation/data/BoomBlock.qml b/tests/benchmarks/declarative/compilation/data/BoomBlock.qml index 3f43579..b757900 100644 --- a/tests/benchmarks/declarative/compilation/data/BoomBlock.qml +++ b/tests/benchmarks/declarative/compilation/data/BoomBlock.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.particles 1.0 Item { diff --git a/tests/benchmarks/declarative/creation/data/item.qml b/tests/benchmarks/declarative/creation/data/item.qml index f1a7dbc..a6223d0 100644 --- a/tests/benchmarks/declarative/creation/data/item.qml +++ b/tests/benchmarks/declarative/creation/data/item.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { Item {} diff --git a/tests/benchmarks/declarative/creation/data/qobject.qml b/tests/benchmarks/declarative/creation/data/qobject.qml index bc6b152..33aeb57 100644 --- a/tests/benchmarks/declarative/creation/data/qobject.qml +++ b/tests/benchmarks/declarative/creation/data/qobject.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 QtObject { } diff --git a/tests/benchmarks/declarative/creation/tst_creation.cpp b/tests/benchmarks/declarative/creation/tst_creation.cpp index 94a67fd..6bf7943 100644 --- a/tests/benchmarks/declarative/creation/tst_creation.cpp +++ b/tests/benchmarks/declarative/creation/tst_creation.cpp @@ -130,7 +130,7 @@ void tst_creation::qobject_cpp() void tst_creation::qobject_qml() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.7\nQtObject {}", QUrl()); + component.setData("import QtQuick 1.0\nQtObject {}", QUrl()); QObject *obj = component.create(); delete obj; diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/data/object.qml b/tests/benchmarks/declarative/qdeclarativecomponent/data/object.qml index df0d5b2..e484ef7 100644 --- a/tests/benchmarks/declarative/qdeclarativecomponent/data/object.qml +++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/object.qml @@ -39,6 +39,6 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 QtObject {} diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/data/object_id.qml b/tests/benchmarks/declarative/qdeclarativecomponent/data/object_id.qml index 399aa78..3ce3296 100644 --- a/tests/benchmarks/declarative/qdeclarativecomponent/data/object_id.qml +++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/object_id.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 QtObject { id: blah diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml index 4b1d81c..073ed90 100644 --- a/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml +++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.particles 1.0 Item { id:block diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/data/synthesized_properties.2.qml b/tests/benchmarks/declarative/qdeclarativecomponent/data/synthesized_properties.2.qml index 5d67d25..6cf304c 100644 --- a/tests/benchmarks/declarative/qdeclarativecomponent/data/synthesized_properties.2.qml +++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/synthesized_properties.2.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 QtObject { property int a diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/data/synthesized_properties.qml b/tests/benchmarks/declarative/qdeclarativecomponent/data/synthesized_properties.qml index a22ba25..c4fc05c 100644 --- a/tests/benchmarks/declarative/qdeclarativecomponent/data/synthesized_properties.qml +++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/synthesized_properties.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 QtObject { property int a diff --git a/tests/benchmarks/declarative/qdeclarativemetaproperty/data/object.qml b/tests/benchmarks/declarative/qdeclarativemetaproperty/data/object.qml index 8c2f46b..90145e8 100644 --- a/tests/benchmarks/declarative/qdeclarativemetaproperty/data/object.qml +++ b/tests/benchmarks/declarative/qdeclarativemetaproperty/data/object.qml @@ -39,6 +39,6 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item {} diff --git a/tests/benchmarks/declarative/qdeclarativemetaproperty/data/synthesized_object.qml b/tests/benchmarks/declarative/qdeclarativemetaproperty/data/synthesized_object.qml index 45748f5..29dfbe5 100644 --- a/tests/benchmarks/declarative/qdeclarativemetaproperty/data/synthesized_object.qml +++ b/tests/benchmarks/declarative/qdeclarativemetaproperty/data/synthesized_object.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { property int blah diff --git a/tests/benchmarks/declarative/qmltime/example.qml b/tests/benchmarks/declarative/qmltime/example.qml index dca1429..4b6de1d 100644 --- a/tests/benchmarks/declarative/qmltime/example.qml +++ b/tests/benchmarks/declarative/qmltime/example.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import QmlTime 1.0 as QmlTime Item { diff --git a/tests/benchmarks/declarative/qmltime/tests/anchors/empty.qml b/tests/benchmarks/declarative/qmltime/tests/anchors/empty.qml index 6d8be03..f9418f8 100644 --- a/tests/benchmarks/declarative/qmltime/tests/anchors/empty.qml +++ b/tests/benchmarks/declarative/qmltime/tests/anchors/empty.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import QmlTime 1.0 as QmlTime Item { diff --git a/tests/benchmarks/declarative/qmltime/tests/anchors/fill.qml b/tests/benchmarks/declarative/qmltime/tests/anchors/fill.qml index 5371c3d..ef6839f 100644 --- a/tests/benchmarks/declarative/qmltime/tests/anchors/fill.qml +++ b/tests/benchmarks/declarative/qmltime/tests/anchors/fill.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import QmlTime 1.0 as QmlTime Item { diff --git a/tests/benchmarks/declarative/qmltime/tests/anchors/null.qml b/tests/benchmarks/declarative/qmltime/tests/anchors/null.qml index bb43dc6..b719001 100644 --- a/tests/benchmarks/declarative/qmltime/tests/anchors/null.qml +++ b/tests/benchmarks/declarative/qmltime/tests/anchors/null.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import QmlTime 1.0 as QmlTime Item { diff --git a/tests/benchmarks/declarative/qmltime/tests/animation/large.qml b/tests/benchmarks/declarative/qmltime/tests/animation/large.qml index 11bb6ba..d109313 100644 --- a/tests/benchmarks/declarative/qmltime/tests/animation/large.qml +++ b/tests/benchmarks/declarative/qmltime/tests/animation/large.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import QmlTime 1.0 as QmlTime Item { diff --git a/tests/benchmarks/declarative/qmltime/tests/animation/largeNoProps.qml b/tests/benchmarks/declarative/qmltime/tests/animation/largeNoProps.qml index d40627f..6c055dc 100644 --- a/tests/benchmarks/declarative/qmltime/tests/animation/largeNoProps.qml +++ b/tests/benchmarks/declarative/qmltime/tests/animation/largeNoProps.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import QmlTime 1.0 as QmlTime Item { diff --git a/tests/benchmarks/declarative/qmltime/tests/item_creation/children.qml b/tests/benchmarks/declarative/qmltime/tests/item_creation/children.qml index 0499201..eed5339 100644 --- a/tests/benchmarks/declarative/qmltime/tests/item_creation/children.qml +++ b/tests/benchmarks/declarative/qmltime/tests/item_creation/children.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import QmlTime 1.0 as QmlTime Item { diff --git a/tests/benchmarks/declarative/qmltime/tests/item_creation/data.qml b/tests/benchmarks/declarative/qmltime/tests/item_creation/data.qml index 9064bc2..cc27f04 100644 --- a/tests/benchmarks/declarative/qmltime/tests/item_creation/data.qml +++ b/tests/benchmarks/declarative/qmltime/tests/item_creation/data.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import QmlTime 1.0 as QmlTime Item { diff --git a/tests/benchmarks/declarative/qmltime/tests/item_creation/no_creation.qml b/tests/benchmarks/declarative/qmltime/tests/item_creation/no_creation.qml index d27b2b6..7f8909d 100644 --- a/tests/benchmarks/declarative/qmltime/tests/item_creation/no_creation.qml +++ b/tests/benchmarks/declarative/qmltime/tests/item_creation/no_creation.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import QmlTime 1.0 as QmlTime Item { diff --git a/tests/benchmarks/declarative/qmltime/tests/item_creation/resources.qml b/tests/benchmarks/declarative/qmltime/tests/item_creation/resources.qml index 0867d0b..05e287b 100644 --- a/tests/benchmarks/declarative/qmltime/tests/item_creation/resources.qml +++ b/tests/benchmarks/declarative/qmltime/tests/item_creation/resources.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import QmlTime 1.0 as QmlTime Item { diff --git a/tests/benchmarks/declarative/qmltime/tests/loader/Loaded.qml b/tests/benchmarks/declarative/qmltime/tests/loader/Loaded.qml index 416e0ea..7199a50 100644 --- a/tests/benchmarks/declarative/qmltime/tests/loader/Loaded.qml +++ b/tests/benchmarks/declarative/qmltime/tests/loader/Loaded.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { Rectangle {} diff --git a/tests/benchmarks/declarative/qmltime/tests/loader/component_loader.qml b/tests/benchmarks/declarative/qmltime/tests/loader/component_loader.qml index f610eb0..a668423 100644 --- a/tests/benchmarks/declarative/qmltime/tests/loader/component_loader.qml +++ b/tests/benchmarks/declarative/qmltime/tests/loader/component_loader.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import QmlTime 1.0 as QmlTime Item { diff --git a/tests/benchmarks/declarative/qmltime/tests/loader/empty_loader.qml b/tests/benchmarks/declarative/qmltime/tests/loader/empty_loader.qml index 334e1b4..7070d91 100644 --- a/tests/benchmarks/declarative/qmltime/tests/loader/empty_loader.qml +++ b/tests/benchmarks/declarative/qmltime/tests/loader/empty_loader.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import QmlTime 1.0 as QmlTime Item { diff --git a/tests/benchmarks/declarative/qmltime/tests/loader/no_loader.qml b/tests/benchmarks/declarative/qmltime/tests/loader/no_loader.qml index 507ed34..7bf14de 100644 --- a/tests/benchmarks/declarative/qmltime/tests/loader/no_loader.qml +++ b/tests/benchmarks/declarative/qmltime/tests/loader/no_loader.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import QmlTime 1.0 as QmlTime Item { diff --git a/tests/benchmarks/declarative/qmltime/tests/loader/source_loader.qml b/tests/benchmarks/declarative/qmltime/tests/loader/source_loader.qml index 1092a9f..2b95d60 100644 --- a/tests/benchmarks/declarative/qmltime/tests/loader/source_loader.qml +++ b/tests/benchmarks/declarative/qmltime/tests/loader/source_loader.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import QmlTime 1.0 as QmlTime Item { diff --git a/tests/benchmarks/declarative/qmltime/tests/positioner_creation/no_positioner.qml b/tests/benchmarks/declarative/qmltime/tests/positioner_creation/no_positioner.qml index a125c54..417ec94 100644 --- a/tests/benchmarks/declarative/qmltime/tests/positioner_creation/no_positioner.qml +++ b/tests/benchmarks/declarative/qmltime/tests/positioner_creation/no_positioner.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import QmlTime 1.0 as QmlTime Item { diff --git a/tests/benchmarks/declarative/qmltime/tests/positioner_creation/null_positioner.qml b/tests/benchmarks/declarative/qmltime/tests/positioner_creation/null_positioner.qml index 18c8fb4..3e9a076 100644 --- a/tests/benchmarks/declarative/qmltime/tests/positioner_creation/null_positioner.qml +++ b/tests/benchmarks/declarative/qmltime/tests/positioner_creation/null_positioner.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import QmlTime 1.0 as QmlTime Item { diff --git a/tests/benchmarks/declarative/qmltime/tests/positioner_creation/positioner.qml b/tests/benchmarks/declarative/qmltime/tests/positioner_creation/positioner.qml index 2668c4c..d87aa32 100644 --- a/tests/benchmarks/declarative/qmltime/tests/positioner_creation/positioner.qml +++ b/tests/benchmarks/declarative/qmltime/tests/positioner_creation/positioner.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import QmlTime 1.0 as QmlTime Item { diff --git a/tests/benchmarks/declarative/qmltime/tests/vmemetaobject/null.qml b/tests/benchmarks/declarative/qmltime/tests/vmemetaobject/null.qml index 424f768..dc2fcb4 100644 --- a/tests/benchmarks/declarative/qmltime/tests/vmemetaobject/null.qml +++ b/tests/benchmarks/declarative/qmltime/tests/vmemetaobject/null.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import QmlTime 1.0 as QmlTime Item { diff --git a/tests/benchmarks/declarative/qmltime/tests/vmemetaobject/property.qml b/tests/benchmarks/declarative/qmltime/tests/vmemetaobject/property.qml index f803b82..3adefbc 100644 --- a/tests/benchmarks/declarative/qmltime/tests/vmemetaobject/property.qml +++ b/tests/benchmarks/declarative/qmltime/tests/vmemetaobject/property.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import QmlTime 1.0 as QmlTime Item { diff --git a/tests/benchmarks/declarative/script/data/CustomObject.qml b/tests/benchmarks/declarative/script/data/CustomObject.qml index 1656453..97f6d39 100644 --- a/tests/benchmarks/declarative/script/data/CustomObject.qml +++ b/tests/benchmarks/declarative/script/data/CustomObject.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 QtObject { property real prop1: 0 diff --git a/tests/benchmarks/declarative/script/data/block.qml b/tests/benchmarks/declarative/script/data/block.qml index f7b2ab3..4575050 100644 --- a/tests/benchmarks/declarative/script/data/block.qml +++ b/tests/benchmarks/declarative/script/data/block.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { width: 200; height: 200 diff --git a/tests/benchmarks/declarative/script/data/global_prop.qml b/tests/benchmarks/declarative/script/data/global_prop.qml index 4fb7ee7..29bbb7d 100644 --- a/tests/benchmarks/declarative/script/data/global_prop.qml +++ b/tests/benchmarks/declarative/script/data/global_prop.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import "global.js" as Program Rectangle { diff --git a/tools/qml/browser/Browser.qml b/tools/qml/browser/Browser.qml index ff2bb47..45fe84c 100644 --- a/tools/qml/browser/Browser.qml +++ b/tools/qml/browser/Browser.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 import Qt.labs.folderlistmodel 1.0 Rectangle { diff --git a/tools/qml/startup/Logo.qml b/tools/qml/startup/Logo.qml index 8d9708d..aa5648f 100644 --- a/tools/qml/startup/Logo.qml +++ b/tools/qml/startup/Logo.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: myApp diff --git a/tools/qml/startup/startup.qml b/tools/qml/startup/startup.qml index ddc7217..9ca50a3 100644 --- a/tools/qml/startup/startup.qml +++ b/tools/qml/startup/startup.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Rectangle { id: treatsApp -- cgit v0.12 From c2c367ebeb039c42cb4fec50b2b6495624837978 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 29 Sep 2010 12:14:44 +1000 Subject: Add test for Qt 4.7 module Task-number: QTBUG-13799 Reviewed-by: Martin Jones (cherry picked from commit 6f35701275ab0cd80daec45b3407725b10571693) --- tests/auto/declarative/declarative.pro | 3 +- .../declarative/moduleqt47/data/importqt47.qml | 80 ++++++++++++++++++++++ tests/auto/declarative/moduleqt47/moduleqt47.pro | 16 +++++ .../auto/declarative/moduleqt47/tst_moduleqt47.cpp | 79 +++++++++++++++++++++ .../tst_qdeclarativelanguage.cpp | 6 ++ 5 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 tests/auto/declarative/moduleqt47/data/importqt47.qml create mode 100644 tests/auto/declarative/moduleqt47/moduleqt47.pro create mode 100644 tests/auto/declarative/moduleqt47/tst_moduleqt47.cpp diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index a7fb3b8..f0fcfa9 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -69,7 +69,8 @@ SUBDIRS += \ qdeclarativexmlhttprequest \ qdeclarativexmllistmodel \ qmlvisual \ - qpacketprotocol + qpacketprotocol \ + moduleqt47 contains(QT_CONFIG, webkit) { SUBDIRS += \ diff --git a/tests/auto/declarative/moduleqt47/data/importqt47.qml b/tests/auto/declarative/moduleqt47/data/importqt47.qml new file mode 100644 index 0000000..0a1b533 --- /dev/null +++ b/tests/auto/declarative/moduleqt47/data/importqt47.qml @@ -0,0 +1,80 @@ +import Qt 4.7 + +Item { + QtObject {} + + Component { Item {} } + + // Util + states: [ + State { + name: "bob" + AnchorChanges {} + ParentChange {} + StateChangeScript {} + PropertyChanges {} + } + ] + transitions: [ + Transition { + AnchorAnimation {} + ColorAnimation {} + SmoothedAnimation {} + NumberAnimation {} + ParallelAnimation {} + ParentAnimation {} + PauseAnimation {} + PropertyAnimation {} + RotationAnimation {} + ScriptAction {} + SequentialAnimation {} + SpringAnimation {} + Vector3dAnimation {} + } + ] + + Behavior on x {} + Binding {} + Connections {} + FontLoader {} + ListModel { ListElement {} } + SystemPalette {} + Timer {} + + // graphic items + BorderImage {} + Column {} + MouseArea {} + Flickable {} + Flipable {} + Flow {} + FocusPanel {} + FocusScope {} + Rectangle { gradient: Gradient { GradientStop {} } } + Grid {} + GridView {} + Image {} + ListView {} + Loader {} + PathView { + path: Path { + PathLine {} + PathCubic {} + PathPercent {} + PathQuad {} + PathAttribute {} + } + } + Repeater {} + Rotation {} + Row {} + Translate {} + Scale {} + Text {} + TextEdit {} + TextInput {} + VisualItemModel {} + VisualDataModel {} + + Keys.onPressed: console.log("Press") +} diff --git a/tests/auto/declarative/moduleqt47/moduleqt47.pro b/tests/auto/declarative/moduleqt47/moduleqt47.pro new file mode 100644 index 0000000..4ee634e --- /dev/null +++ b/tests/auto/declarative/moduleqt47/moduleqt47.pro @@ -0,0 +1,16 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + +SOURCES += tst_moduleqt47.cpp + +symbian: { + importFiles.sources = data + importFiles.path = . + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/moduleqt47/tst_moduleqt47.cpp b/tests/auto/declarative/moduleqt47/tst_moduleqt47.cpp new file mode 100644 index 0000000..c1896a7 --- /dev/null +++ b/tests/auto/declarative/moduleqt47/tst_moduleqt47.cpp @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include +#include + +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + +class tst_moduleqt47 : public QObject +{ + Q_OBJECT +public: + tst_moduleqt47(); + +private slots: + void create(); + +private: + QDeclarativeEngine engine; +}; + +tst_moduleqt47::tst_moduleqt47() +{ +} + +void tst_moduleqt47::create() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/importqt47.qml")); + QObject *obj = qobject_cast(c.create()); + + QVERIFY(obj != 0); + delete obj; +} + +QTEST_MAIN(tst_moduleqt47) + +#include "tst_moduleqt47.moc" diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index f811555..c6b2302 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -1715,6 +1715,9 @@ void tst_qdeclarativelanguage::initTestCase() { registerTypes(); + // Registering the TestType class in other modules should have no adverse effects + qmlRegisterType("com.nokia.TestPre", 1, 0, "Test"); + qmlRegisterType("com.nokia.Test", 0, 0, "TestTP"); qmlRegisterType("com.nokia.Test", 1, 0, "Test"); qmlRegisterType("com.nokia.Test", 1, 5, "Test"); @@ -1722,6 +1725,9 @@ void tst_qdeclarativelanguage::initTestCase() qmlRegisterType("com.nokia.Test", 1, 9, "OldTest"); qmlRegisterType("com.nokia.Test", 1, 12, "Test"); + // Registering the TestType class in other modules should have no adverse effects + qmlRegisterType("com.nokia.TestPost", 1, 0, "Test"); + // Create locale-specific file // For POSIX, this will just be data/I18nType.qml, since POSIX is 7-bit // For iso8859-1 locale, this will just be data/I18nType?????.qml where ????? is 5 8-bit characters -- cgit v0.12 From 6fd7f7933f12414979b19e34bad1bf17c4b6e2bf Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 29 Sep 2010 12:19:37 +1000 Subject: Replace "import Qt 4.7" with "import QtQuick 1.0" Task-number: QTBUG-13799 (cherry picked from commit 1f43e68c4ca5b28444b046deff1658b1b4b1923d) --- tests/auto/declarative/qdeclarativeitem/data/transformCrash.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/declarative/qdeclarativeitem/data/transformCrash.qml b/tests/auto/declarative/qdeclarativeitem/data/transformCrash.qml index ab7fa84..35c1a9a 100644 --- a/tests/auto/declarative/qdeclarativeitem/data/transformCrash.qml +++ b/tests/auto/declarative/qdeclarativeitem/data/transformCrash.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { id: wrapper -- cgit v0.12 From 75c41435a05b383ca96647ae45df9ceca3fa3852 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 29 Sep 2010 13:48:42 +1000 Subject: Document "import QtQuick 1.0" change Task-number: QTBUG-13799 (cherry picked from commit 1ab457d5db184c53d9857a7b425051e5aa5ff2e0) --- doc/src/declarative/declarativeui.qdoc | 1 + doc/src/declarative/whatsnew.qdoc | 55 ++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 doc/src/declarative/whatsnew.qdoc diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc index cb326a3..a8df4b1 100644 --- a/doc/src/declarative/declarativeui.qdoc +++ b/doc/src/declarative/declarativeui.qdoc @@ -73,6 +73,7 @@ Module. \section1 Getting Started \list +\o \l{What's new in Qt Quick} \o \l{Introduction to the QML language} \o \l{QML for Qt Programmers} \o \l{Getting Started Programming with QML} diff --git a/doc/src/declarative/whatsnew.qdoc b/doc/src/declarative/whatsnew.qdoc new file mode 100644 index 0000000..f8d1d0e --- /dev/null +++ b/doc/src/declarative/whatsnew.qdoc @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in a +** written agreement between you and Nokia. +** +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of this +** file. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\title What's new in Qt Quick +\page qtquick-whatsnew.html + +\section1 4.7.1 + +\section2 QtQuick namespace + +In prior Qt releases, all the Qt Quick elements were available in the \e Qt namespace. +Starting with Qt 4.7.1, the elements are also available in the \e QtQuick namespace, +which improves naming consistency, and allows the development of Qt Quick to occur at +a faster rate than Qt's usual minor release schedule. + +The change for developers is very simple - where you previously wrote \e {import Qt 4.7}, +just replace it with \e {import QtQuick 1.0}, like this: + +\code +import QtQuick 1.0 + +Text { + text: "Welcome to QtQuick 1.0!" +} +\endcode + +\e {import Qt 4.7} continues to work so existing applications wont break even if they +aren't updated, but it is recommended that all import statements be modified to the new +form. +*/ -- cgit v0.12 From c39da05c8d8b97141bf03507f6d0412e6371863c Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 29 Sep 2010 14:16:27 +1000 Subject: Autotest that new "import Qt 4.7"s aren't added accidentally Task-number: QTBUG-13799 (cherry picked from commit f7a439a0a00b0bdd6ebeff8bfd5ee2285eab1398) --- .../auto/declarative/moduleqt47/tst_moduleqt47.cpp | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/tests/auto/declarative/moduleqt47/tst_moduleqt47.cpp b/tests/auto/declarative/moduleqt47/tst_moduleqt47.cpp index c1896a7..feae417 100644 --- a/tests/auto/declarative/moduleqt47/tst_moduleqt47.cpp +++ b/tests/auto/declarative/moduleqt47/tst_moduleqt47.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ #include +#include #include #include @@ -56,12 +57,20 @@ public: private slots: void create(); + void accidentalImport_data(); + void accidentalImport(); + private: + QStringList findFiles(const QDir &d); + QDeclarativeEngine engine; + QStringList excludedFiles; }; tst_moduleqt47::tst_moduleqt47() { + excludedFiles << "tests/auto/declarative/moduleqt47/data/importqt47.qml" + << "doc/src/declarative/whatsnew.qdoc"; } void tst_moduleqt47::create() @@ -74,6 +83,54 @@ void tst_moduleqt47::create() delete obj; } +QStringList tst_moduleqt47::findFiles(const QDir &d) +{ + QStringList rv; + + QStringList files = d.entryList(QStringList() << QLatin1String("*.qml") << QLatin1String("*.qdoc"), QDir::Files); + foreach (const QString &file, files) { + + QString absFile = d.absoluteFilePath(file); + + bool skip = false; + for (int ii = 0; !skip && ii < excludedFiles.count(); ++ii) + skip = (absFile.endsWith(excludedFiles.at(ii))); + + if (!skip) + rv << absFile; + } + + QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks); + foreach (const QString &dir, dirs) { + QDir sub = d; + sub.cd(dir); + rv << findFiles(sub); + } + + return rv; +} + +void tst_moduleqt47::accidentalImport_data() +{ + QTest::addColumn("file"); + QStringList files = findFiles(QDir(SRCDIR "/../../../../")); + + foreach(const QString &file, files) + QTest::newRow(qPrintable(file)) << file; +} + +void tst_moduleqt47::accidentalImport() +{ + QFETCH(QString, file); + + QFile f(file); + if (!f.open(QIODevice::ReadOnly)) + return; + QByteArray data = f.readAll(); + + QVERIFY(!data.contains("import Qt 4")); +} + QTEST_MAIN(tst_moduleqt47) #include "tst_moduleqt47.moc" -- cgit v0.12 From 39f6657f74d78e5b856121310cf060a02bc1c352 Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Mon, 27 Sep 2010 16:10:52 +0200 Subject: Add export to QDeclarativeBasePositioner Bauhaus needs this export to manage layouts. (cherry picked from commit 858469445ceb745c70dad9cd4f913acc34683e15) --- src/declarative/graphicsitems/qdeclarativepositioners_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p.h index f9ecc0a..15b91e5 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners_p.h +++ b/src/declarative/graphicsitems/qdeclarativepositioners_p.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeBasePositionerPrivate; -class Q_AUTOTEST_EXPORT QDeclarativeBasePositioner : public QDeclarativeItem +class Q_DECLARATIVE_EXPORT QDeclarativeBasePositioner : public QDeclarativeItem { Q_OBJECT -- cgit v0.12 From 0d31b86d1fd0fdbcc95c80ce91f505a2c8b0bc26 Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Thu, 30 Sep 2010 17:23:27 +0200 Subject: Use setParentItem() instead of setParentItemHelper if componentComplete is true This ensures that if the component has already been completed, itemChange() is called. This is required to modify QDeclarativePositions in the visual editor, while keeping a legal state. Without this patch notifications are missing and the Positioner keeps track of already deleted children. This resulted in a crash. Reviewed-by: Thomas Hartmann (cherry picked from commit 1f8bb573f06234a3d13fb57de5eb644824d5024f) --- .../graphicsitems/qdeclarativeflickable.cpp | 24 +++++++++++++++++----- src/declarative/graphicsitems/qdeclarativeitem.cpp | 19 +++++++++++++---- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 84b0ccf..29879fe 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -1046,10 +1046,16 @@ void QDeclarativeFlickable::cancelFlick() void QDeclarativeFlickablePrivate::data_append(QDeclarativeListProperty *prop, QObject *o) { QGraphicsObject *i = qobject_cast(o); - if (i) - i->setParentItem(static_cast(prop->data)->contentItem); - else + if (i) { + QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(i); + if (static_cast(d)->componentComplete) { + i->setParentItem(static_cast(prop->data)->contentItem); + } else { + d->setParentItemHelper(static_cast(prop->data)->contentItem, 0, 0); + } + } else { o->setParent(prop->object); + } } static inline int children_count_helper(QGraphicsObject *object) @@ -1071,8 +1077,16 @@ static inline void children_clear_helper(QGraphicsObject *object) { QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(object); int childCount = d->children.count(); - for (int index = 0 ;index < childCount; index++) - QGraphicsItemPrivate::get(d->children.at(0))->setParentItemHelper(0, /*newParentVariant=*/0, /*thisPointerVariant=*/0); + if (static_cast(d)->componentComplete) { + for (int index = 0 ;index < childCount; index++) { + d->children.at(0)->setParentItem(0); + } + } else { + for (int index = 0 ;index < childCount; index++) { + QGraphicsItemPrivate::get(d->children.at(0))->setParentItemHelper(0, /*newParentVariant=*/0, /*thisPointerVariant=*/0); + } + } + } int QDeclarativeFlickablePrivate::data_count(QDeclarativeListProperty *prop) diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 3c2f0a8..830f8e3 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -1614,7 +1614,13 @@ void QDeclarativeItemPrivate::data_append(QDeclarativeListProperty *pro while (mo && mo != &QGraphicsObject::staticMetaObject) mo = mo->d.superdata; if (mo) { - QGraphicsItemPrivate::get(static_cast(o))->setParentItemHelper(that, 0, 0); + QGraphicsObject *graphicsObject = static_cast(o); + QDeclarativeItemPrivate *contentItemPrivate = static_cast(QGraphicsItemPrivate::get(graphicsObject)); + if (contentItemPrivate->componentComplete) { + graphicsObject->setParentItem(that); + } else { + contentItemPrivate->setParentItemHelper(that, /*newParentVariant=*/0, /*thisPointerVariant=*/0); + } } else { o->setParent(that); } @@ -1637,10 +1643,15 @@ static inline QObject *children_at_helper(QDeclarativeListProperty *pro static inline void children_clear_helper(QDeclarativeListProperty *prop) { - QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(static_cast(prop->object)); + QDeclarativeItemPrivate *d = static_cast(QGraphicsItemPrivate::get(static_cast(prop->object))); int childCount = d->children.count(); - for (int index = 0 ;index < childCount; index++) - QGraphicsItemPrivate::get(d->children.at(0))->setParentItemHelper(0, /*newParentVariant=*/0, /*thisPointerVariant=*/0); + if (d->componentComplete) { + for (int index = 0 ;index < childCount; index++) + d->children.at(0)->setParentItem(0); + } else { + for (int index = 0 ;index < childCount; index++) + QGraphicsItemPrivate::get(d->children.at(0))->setParentItemHelper(0, /*newParentVariant=*/0, /*thisPointerVariant=*/0); + } } int QDeclarativeItemPrivate::data_count(QDeclarativeListProperty *prop) -- cgit v0.12 From 8ece6273489f8fe032ad3da30468ee65fe55573f Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Thu, 30 Sep 2010 16:27:25 +0200 Subject: Add sendParentChangeNotification to QGraphicsItem Fixes crash in creator. If flag is true notifications are sent. It is important that positioners work correctly and don't leak. Reviewed-By: Alexis Menard (cherry picked from commit 3b43389b78925ce87d660c343c925fa280b91e11) --- src/gui/graphicsview/qgraphicsitem.cpp | 16 +++++++++++++--- src/gui/graphicsview/qgraphicsitem_p.h | 4 +++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index b404692..3b18c31 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -7669,7 +7669,12 @@ void QGraphicsObject::updateMicroFocus() void QGraphicsItemPrivate::children_append(QDeclarativeListProperty *list, QGraphicsObject *item) { - QGraphicsItemPrivate::get(item)->setParentItemHelper(static_cast(list->object), /*newParentVariant=*/0, /*thisPointerVariant=*/0); + QGraphicsObject *graphicsObject = static_cast(list->object); + if (QGraphicsItemPrivate::get(graphicsObject)->sendParentChangeNotification) { + item->setParentItem(graphicsObject); + } else { + QGraphicsItemPrivate::get(item)->setParentItemHelper(graphicsObject, 0, 0); + } } int QGraphicsItemPrivate::children_count(QDeclarativeListProperty *list) @@ -7691,8 +7696,13 @@ void QGraphicsItemPrivate::children_clear(QDeclarativeListProperty(list->object)); int childCount = d->children.count(); - for (int index = 0; index < childCount; index++) - QGraphicsItemPrivate::get(d->children.at(0))->setParentItemHelper(0, /*newParentVariant=*/0, /*thisPointerVariant=*/0); + if (d->sendParentChangeNotification) { + for (int index = 0; index < childCount; index++) + d->children.at(0)->setParentItem(0); + } else { + for (int index = 0; index < childCount; index++) + QGraphicsItemPrivate::get(d->children.at(0))->setParentItemHelper(0, 0, 0); + } } /*! diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 77e4054..c8a7699 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -238,6 +238,7 @@ public: pendingPolish(0), mayHaveChildWithGraphicsEffect(0), isDeclarativeItem(0), + sendParentChangeNotification(0), globalStackingOrder(-1), q_ptr(0) { @@ -584,7 +585,8 @@ public: quint32 pendingPolish : 1; quint32 mayHaveChildWithGraphicsEffect : 1; quint32 isDeclarativeItem : 1; - quint32 padding : 23; + quint32 sendParentChangeNotification : 1; + quint32 padding : 22; // Optional stacking order int globalStackingOrder; -- cgit v0.12 From ed1d7b364640d5d937a865bffdeb8db3808b86dc Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Wed, 4 Aug 2010 14:15:35 +0200 Subject: Add breakpad support Breakpad is a portable crash handler. It sends the raw crash information to a server for analysis. This analysis needs debug information. Consequently, we compile with debug info even in release mode if qt-breakpad integration is requested (via an environment variable). Reviewed-by: ossi (cherry picked from commit 1a99cdbb36334e17c34b38dd5df1bdd70167b42a) --- mkspecs/common/g++.conf | 2 + mkspecs/common/mac-g++.conf | 3 ++ mkspecs/features/default_post.prf | 88 +++++++++++++++++++++++++++++++++++++++ mkspecs/win32-msvc2003/qmake.conf | 3 ++ mkspecs/win32-msvc2005/qmake.conf | 3 ++ mkspecs/win32-msvc2008/qmake.conf | 3 ++ mkspecs/win32-msvc2010/qmake.conf | 3 ++ 7 files changed, 105 insertions(+) diff --git a/mkspecs/common/g++.conf b/mkspecs/common/g++.conf index d3db24a..0d511fc 100644 --- a/mkspecs/common/g++.conf +++ b/mkspecs/common/g++.conf @@ -8,6 +8,7 @@ QMAKE_CFLAGS_DEPS += -M QMAKE_CFLAGS_WARN_ON += -Wall -W QMAKE_CFLAGS_WARN_OFF += -w QMAKE_CFLAGS_RELEASE += -O2 +QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -g QMAKE_CFLAGS_DEBUG += -g QMAKE_CFLAGS_SHLIB += -fPIC QMAKE_CFLAGS_STATIC_LIB += -fPIC @@ -22,6 +23,7 @@ QMAKE_CXXFLAGS_DEPS += $$QMAKE_CFLAGS_DEPS QMAKE_CXXFLAGS_WARN_ON += $$QMAKE_CFLAGS_WARN_ON QMAKE_CXXFLAGS_WARN_OFF += $$QMAKE_CFLAGS_WARN_OFF QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE +QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO QMAKE_CXXFLAGS_DEBUG += $$QMAKE_CFLAGS_DEBUG QMAKE_CXXFLAGS_SHLIB += $$QMAKE_CFLAGS_SHLIB QMAKE_CXXFLAGS_STATIC_LIB += $$QMAKE_CFLAGS_STATIC_LIB diff --git a/mkspecs/common/mac-g++.conf b/mkspecs/common/mac-g++.conf index 446547d..29b7408 100644 --- a/mkspecs/common/mac-g++.conf +++ b/mkspecs/common/mac-g++.conf @@ -10,6 +10,7 @@ QMAKE_CFLAGS_DEPS += -M QMAKE_CFLAGS_WARN_ON += -Wall -W QMAKE_CFLAGS_WARN_OFF += -w QMAKE_CFLAGS_RELEASE += -O2 +QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -g -gdwarf-2 QMAKE_CFLAGS_DEBUG += -g QMAKE_CFLAGS_SHLIB += -fPIC QMAKE_CFLAGS_STATIC_LIB += -fPIC @@ -33,6 +34,7 @@ QMAKE_CXXFLAGS_DEPS += $$QMAKE_CFLAGS_DEPS QMAKE_CXXFLAGS_WARN_ON += $$QMAKE_CFLAGS_WARN_ON QMAKE_CXXFLAGS_WARN_OFF += $$QMAKE_CFLAGS_WARN_OFF QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE +QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO QMAKE_CXXFLAGS_DEBUG += $$QMAKE_CFLAGS_DEBUG QMAKE_CXXFLAGS_SHLIB += $$QMAKE_CFLAGS_SHLIB QMAKE_CXXFLAGS_STATIC_LIB += $$QMAKE_CFLAGS_STATIC_LIB @@ -52,6 +54,7 @@ QMAKE_LINK_C = $$QMAKE_CC QMAKE_LINK_C_SHLIB = $$QMAKE_CC QMAKE_LFLAGS += -headerpad_max_install_names QMAKE_LFLAGS_RELEASE += +QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO += -g -gdwarf-2 QMAKE_LFLAGS_DEBUG += QMAKE_LFLAGS_APP += QMAKE_LFLAGS_SHLIB += -single_module -dynamiclib diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf index d844385..59a5e86 100644 --- a/mkspecs/features/default_post.prf +++ b/mkspecs/features/default_post.prf @@ -1,3 +1,15 @@ +QT_BREAKPAD_ROOT_PATH = $$(QT_BREAKPAD_ROOT_PATH) +!isEmpty(QT_BREAKPAD_ROOT_PATH): \ # quick test first whether requested ... + !staticlib:!static:CONFIG(release, debug|release):contains(TEMPLATE, .*(app|lib)): \ # is it applicable? + !contains(TARGET, .*phony_target.*): \ # monster hack, you don't really see this here, right? ;) + system($$QT_BREAKPAD_ROOT_PATH/qtbreakpadsymbols --breakpad-exists) { # do we really have it? + CONFIG += breakpad + CONFIG -= no_debug_info separate_debug_info + QMAKE_CFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO + QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO + QMAKE_LFLAGS_RELEASE = $$QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO +} + CONFIG(debug, debug|release):load(debug) else:load(release) debug_and_release:load(debug_and_release) @@ -6,6 +18,82 @@ incredibuild_xge { CONFIG = incredibuild_xge $$CONFIG } +breakpad { + !contains(DESTDIR, (/|.:[/\\\\]).*):TARGET_BASEPATH = $${OUT_PWD}/ + !isEmpty(DESTDIR):TARGET_BASEPATH = $${TARGET_BASEPATH}$${DESTDIR}/ + + win32 { + TARGET_BASEPATH ~= s,/,\\, + contains(TEMPLATE, .*lib) { + isEmpty(TARGET_VERSION_EXT):!isEmpty(VERSION) { + TARGET_VERSION_EXT = $$section(VERSION, ., 0, 0) + isEqual(TARGET_VERSION_EXT, 0):unset(TARGET_VERSION_EXT) + } + TARGET_EXT = .dll + } else { + TARGET_EXT = .exe + } + + DEBUGFILENAME = $${TARGET_BASEPATH}$${TARGET}$${TARGET_VERSION_EXT}$${TARGET_EXT} + PDBFILENAME = $${TARGET_BASEPATH}$${TARGET}$${TARGET_VERSION_EXT}.pdb + DEBUGFILENAME ~= s,/,\\, + PDBFILENAME ~= s,/,\\, + QMAKE_CLEAN += $$PDBFILENAME # for the debug case it is hardcoded in qmake + } else { + contains(TEMPLATE, .*lib):LIBPREFIX = lib + + macx { + equals(TEMPLATE, lib) { + lib_bundle { + TARGET_FILENAME = $${TARGET_BASEPATH}$${TARGET}.framework/$${TARGET} + } else { + TARGET_FILENAME = $${TARGET_BASEPATH}$${LIBPREFIX}$${TARGET} + !plugin { + TEMP_VERSION = $$section(VERSION, ., 0, 0) + isEmpty(TEMP_VERSION):TEMP_VERSION = 1 + TARGET_FILENAME = $${TARGET_FILENAME}.$${TEMP_VERSION} + } + TARGET_FILENAME = $${TARGET_FILENAME}.$${QMAKE_EXTENSION_SHLIB} + } + } else { + app_bundle { + TARGET_FILENAME = $${TARGET_BASEPATH}$${TARGET}.app/Contents/MacOS/$${TARGET} + } else { + TARGET_FILENAME = $${TARGET_BASEPATH}$${TARGET} + } + } + DEBUGFILENAME = $$TARGET_FILENAME + } else { + equals(TEMPLATE, lib) { + plugin { + TARGET_FILENAME = $${TARGET_BASEPATH}$${LIBPREFIX}$${TARGET}.so + } else { + TEMP_VERSION = $$VERSION + isEmpty(TEMP_VERSION):TEMP_VERSION = 1.0.0 + TARGET_FILENAME = $${TARGET_BASEPATH}$${LIBPREFIX}$${TARGET}.so.$${TEMP_VERSION} + } + } else { + TARGET_BASEPATH = $${TARGET_BASEPATH}$${TARGET} + } + DEBUGFILENAME = $$TARGET_BASEPATH + } + } + + PROJECTPATH = $$OUT_PWD + win32:PROJECTPATH ~= s,/,\\, + + !isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$QMAKE_POST_LINK$$escape_expand(\\n\\t) + QMAKE_POST_LINK += $$quote($${QT_BREAKPAD_ROOT_PATH}$${DIR_SEPARATOR}qtbreakpadsymbols \"$$DEBUGFILENAME\" \"$$PROJECTPATH\") + !isEmpty(QMAKE_STRIP):QMAKE_POST_LINK = $$quote($$QMAKE_POST_LINK$$escape_expand(\\n\\t)$$QMAKE_STRIP \"$$DEBUGFILENAME\") + + unset(TARGET_BASEPATH) + unset(TARGET_FILENAME) + unset(SYMBOLFILENAME) + unset(TARGET_EXT) + unset(TARGET_VERSION_EXT) + unset(TEMP_VERSION) +} + QMAKE_INCDIR += $$QMAKE_INCDIR_POST QMAKE_LIBDIR += $$QMAKE_LIBDIR_POST diff --git a/mkspecs/win32-msvc2003/qmake.conf b/mkspecs/win32-msvc2003/qmake.conf index 0230b30..63d1ffd 100644 --- a/mkspecs/win32-msvc2003/qmake.conf +++ b/mkspecs/win32-msvc2003/qmake.conf @@ -20,6 +20,7 @@ QMAKE_CFLAGS = -nologo -Zm300 QMAKE_CFLAGS_WARN_ON = -W3 QMAKE_CFLAGS_WARN_OFF = -W0 QMAKE_CFLAGS_RELEASE = -O2 -MD +QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi QMAKE_CFLAGS_DEBUG = -Zi -MDd QMAKE_CFLAGS_YACC = @@ -28,6 +29,7 @@ QMAKE_CXXFLAGS = $$QMAKE_CFLAGS QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -w34100 -w34189 QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE +QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC QMAKE_CXXFLAGS_STL_ON = -EHsc @@ -51,6 +53,7 @@ QMAKE_RUN_CXX_IMP_BATCH = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ @<< QMAKE_LINK = link QMAKE_LFLAGS = /NOLOGO QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO +QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO = /INCREMENTAL:NO /DEBUG QMAKE_LFLAGS_DEBUG = /DEBUG QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS diff --git a/mkspecs/win32-msvc2005/qmake.conf b/mkspecs/win32-msvc2005/qmake.conf index 0406fd0..265d028 100644 --- a/mkspecs/win32-msvc2005/qmake.conf +++ b/mkspecs/win32-msvc2005/qmake.conf @@ -20,6 +20,7 @@ QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t- QMAKE_CFLAGS_WARN_ON = -W3 QMAKE_CFLAGS_WARN_OFF = -W0 QMAKE_CFLAGS_RELEASE = -O2 -MD +QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi QMAKE_CFLAGS_DEBUG = -Zi -MDd QMAKE_CFLAGS_YACC = QMAKE_CFLAGS_LTCG = -GL @@ -29,6 +30,7 @@ QMAKE_CXXFLAGS = $$QMAKE_CFLAGS QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -w34100 -w34189 QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE +QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG @@ -53,6 +55,7 @@ QMAKE_RUN_CXX_IMP_BATCH = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ @<< QMAKE_LINK = link QMAKE_LFLAGS = /NOLOGO QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO +QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO = /INCREMENTAL:NO /DEBUG QMAKE_LFLAGS_DEBUG = /DEBUG QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS \"/MANIFESTDEPENDENCY:type=\'win32\' name=\'Microsoft.Windows.Common-Controls\' version=\'6.0.0.0\' publicKeyToken=\'6595b64144ccf1df\' language=\'*\' processorArchitecture=\'*\'\" diff --git a/mkspecs/win32-msvc2008/qmake.conf b/mkspecs/win32-msvc2008/qmake.conf index 9a69aaa..1432645 100644 --- a/mkspecs/win32-msvc2008/qmake.conf +++ b/mkspecs/win32-msvc2008/qmake.conf @@ -20,6 +20,7 @@ QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t- QMAKE_CFLAGS_WARN_ON = -W3 QMAKE_CFLAGS_WARN_OFF = -W0 QMAKE_CFLAGS_RELEASE = -O2 -MD +QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi QMAKE_CFLAGS_DEBUG = -Zi -MDd QMAKE_CFLAGS_YACC = QMAKE_CFLAGS_LTCG = -GL @@ -30,6 +31,7 @@ QMAKE_CXXFLAGS = $$QMAKE_CFLAGS QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -w34100 -w34189 QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE +QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG @@ -55,6 +57,7 @@ QMAKE_RUN_CXX_IMP_BATCH = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ @<< QMAKE_LINK = link QMAKE_LFLAGS = /NOLOGO QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO +QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO = /INCREMENTAL:NO /DEBUG QMAKE_LFLAGS_DEBUG = /DEBUG QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS \"/MANIFESTDEPENDENCY:type=\'win32\' name=\'Microsoft.Windows.Common-Controls\' version=\'6.0.0.0\' publicKeyToken=\'6595b64144ccf1df\' language=\'*\' processorArchitecture=\'*\'\" diff --git a/mkspecs/win32-msvc2010/qmake.conf b/mkspecs/win32-msvc2010/qmake.conf index 8331c14..84086e2 100644 --- a/mkspecs/win32-msvc2010/qmake.conf +++ b/mkspecs/win32-msvc2010/qmake.conf @@ -20,6 +20,7 @@ QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t- QMAKE_CFLAGS_WARN_ON = -W3 QMAKE_CFLAGS_WARN_OFF = -W0 QMAKE_CFLAGS_RELEASE = -O2 -MD +QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi QMAKE_CFLAGS_DEBUG = -Zi -MDd QMAKE_CFLAGS_YACC = QMAKE_CFLAGS_LTCG = -GL @@ -30,6 +31,7 @@ QMAKE_CXXFLAGS = $$QMAKE_CFLAGS QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -w34100 -w34189 QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE +QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG @@ -55,6 +57,7 @@ QMAKE_RUN_CXX_IMP_BATCH = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ @<< QMAKE_LINK = link QMAKE_LFLAGS = /NOLOGO QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO +QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO = /INCREMENTAL:NO /DEBUG QMAKE_LFLAGS_DEBUG = /DEBUG QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS \"/MANIFESTDEPENDENCY:type=\'win32\' name=\'Microsoft.Windows.Common-Controls\' version=\'6.0.0.0\' publicKeyToken=\'6595b64144ccf1df\' language=\'*\' processorArchitecture=\'*\'\" -- cgit v0.12 From c0a6aede4d259ac6c998fb3067b09a80f037483e Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Wed, 22 Sep 2010 19:58:18 +0200 Subject: Qmake: Fix wrong path in the breakpad post link step Reviewed-By: Oswald Buddenhagen (cherry picked from commit 7412ac5b38d83b627a372a525f271c225f9c1f70) --- mkspecs/features/default_post.prf | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf index 59a5e86..09c6587 100644 --- a/mkspecs/features/default_post.prf +++ b/mkspecs/features/default_post.prf @@ -45,32 +45,32 @@ breakpad { macx { equals(TEMPLATE, lib) { lib_bundle { - TARGET_FILENAME = $${TARGET_BASEPATH}$${TARGET}.framework/$${TARGET} + TARGET_BASEPATH = $${TARGET_BASEPATH}$${TARGET}.framework/$${TARGET} } else { - TARGET_FILENAME = $${TARGET_BASEPATH}$${LIBPREFIX}$${TARGET} + TARGET_BASEPATH = $${TARGET_BASEPATH}$${LIBPREFIX}$${TARGET} !plugin { TEMP_VERSION = $$section(VERSION, ., 0, 0) isEmpty(TEMP_VERSION):TEMP_VERSION = 1 - TARGET_FILENAME = $${TARGET_FILENAME}.$${TEMP_VERSION} + TARGET_BASEPATH = $${TARGET_BASEPATH}.$${TEMP_VERSION} } - TARGET_FILENAME = $${TARGET_FILENAME}.$${QMAKE_EXTENSION_SHLIB} + TARGET_BASEPATH = $${TARGET_BASEPATH}.$${QMAKE_EXTENSION_SHLIB} } } else { app_bundle { - TARGET_FILENAME = $${TARGET_BASEPATH}$${TARGET}.app/Contents/MacOS/$${TARGET} + TARGET_BASEPATH = $${TARGET_BASEPATH}$${TARGET}.app/Contents/MacOS/$${TARGET} } else { - TARGET_FILENAME = $${TARGET_BASEPATH}$${TARGET} + TARGET_BASEPATH = $${TARGET_BASEPATH}$${TARGET} } } - DEBUGFILENAME = $$TARGET_FILENAME + DEBUGFILENAME = $$TARGET_BASEPATH } else { equals(TEMPLATE, lib) { plugin { - TARGET_FILENAME = $${TARGET_BASEPATH}$${LIBPREFIX}$${TARGET}.so + TARGET_BASEPATH = $${TARGET_BASEPATH}$${LIBPREFIX}$${TARGET}.so } else { TEMP_VERSION = $$VERSION isEmpty(TEMP_VERSION):TEMP_VERSION = 1.0.0 - TARGET_FILENAME = $${TARGET_BASEPATH}$${LIBPREFIX}$${TARGET}.so.$${TEMP_VERSION} + TARGET_BASEPATH = $${TARGET_BASEPATH}$${LIBPREFIX}$${TARGET}.so.$${TEMP_VERSION} } } else { TARGET_BASEPATH = $${TARGET_BASEPATH}$${TARGET} @@ -87,7 +87,6 @@ breakpad { !isEmpty(QMAKE_STRIP):QMAKE_POST_LINK = $$quote($$QMAKE_POST_LINK$$escape_expand(\\n\\t)$$QMAKE_STRIP \"$$DEBUGFILENAME\") unset(TARGET_BASEPATH) - unset(TARGET_FILENAME) unset(SYMBOLFILENAME) unset(TARGET_EXT) unset(TARGET_VERSION_EXT) -- cgit v0.12 From ac0eeca641214a60b13dcabb8749b92bad155fc8 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 21 Sep 2010 13:00:02 +0200 Subject: Add exports for Bauhaus The QmlDesigner(Bauhaus) should not rely on -nokia-developer Reviewed-by: Marco Bubke (cherry picked from commit 8ad396891f2a4966ad3cf943f99e208211e956bb) --- src/declarative/util/qdeclarativeanimation_p.h | 2 +- src/declarative/util/qdeclarativetimer_p.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/util/qdeclarativeanimation_p.h b/src/declarative/util/qdeclarativeanimation_p.h index cdd5041..8cb17e4 100644 --- a/src/declarative/util/qdeclarativeanimation_p.h +++ b/src/declarative/util/qdeclarativeanimation_p.h @@ -63,7 +63,7 @@ QT_MODULE(Declarative) class QDeclarativeAbstractAnimationPrivate; class QDeclarativeAnimationGroup; -class Q_AUTOTEST_EXPORT QDeclarativeAbstractAnimation : public QObject, public QDeclarativePropertyValueSource, public QDeclarativeParserStatus +class Q_DECLARATIVE_EXPORT QDeclarativeAbstractAnimation : public QObject, public QDeclarativePropertyValueSource, public QDeclarativeParserStatus { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeAbstractAnimation) diff --git a/src/declarative/util/qdeclarativetimer_p.h b/src/declarative/util/qdeclarativetimer_p.h index 93b0965..08c3d4e 100644 --- a/src/declarative/util/qdeclarativetimer_p.h +++ b/src/declarative/util/qdeclarativetimer_p.h @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeTimerPrivate; -class Q_AUTOTEST_EXPORT QDeclarativeTimer : public QObject, public QDeclarativeParserStatus +class Q_DECLARATIVE_EXPORT QDeclarativeTimer : public QObject, public QDeclarativeParserStatus { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeTimer) -- cgit v0.12 From a506b183332f313a9a197d5fd7359153eb1728c8 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 22 Sep 2010 21:03:57 +0200 Subject: Make QmlDebug protocol more robust The protocol so far was client->server only. That is, there was no sane way for a client to check whether a plugin on the server (service) was available or not. E.g. calling Client::setEnabled(true) 'succeeded', without a check whether there is actually a service to talk to. The new protocol replaces this shortcoming by a service discovery mechanism: Both client & service announce their available plugins at handshake time, and later on if there are changes. The status is reflected in Client::status() and Service::Status() , which are either NotConnected - no network connection, or not registered properly Unavailable - TCP/IP connection works, but no plugin with the same name on the other side Enabled - You can connect to plugin on other side The status changes happen automatically (no setEnabled() anymore). Furthermore a version ID was added to the handshake, so that we can extend the protocol further in the future :) (cherry picked from commit fd9771c29d401d88779ab7c5d7715c9ca41dd723) --- src/declarative/debugger/qdeclarativedebug.cpp | 56 ++++-- src/declarative/debugger/qdeclarativedebug_p.h | 7 +- .../debugger/qdeclarativedebugclient.cpp | 199 +++++++++++++++------ .../debugger/qdeclarativedebugclient_p.h | 10 +- .../debugger/qdeclarativedebugservice.cpp | 126 ++++++++++--- .../debugger/qdeclarativedebugservice_p.h | 9 +- .../debugger/qdeclarativedebugtrace.cpp | 8 +- .../qdeclarativedebug/tst_qdeclarativedebug.cpp | 5 +- .../tst_qdeclarativedebugclient.cpp | 60 +++---- .../tst_qdeclarativedebugservice.cpp | 41 ++--- tests/auto/declarative/shared/debugutil.cpp | 13 +- tests/auto/declarative/shared/debugutil_p.h | 8 +- 12 files changed, 362 insertions(+), 180 deletions(-) diff --git a/src/declarative/debugger/qdeclarativedebug.cpp b/src/declarative/debugger/qdeclarativedebug.cpp index 1ffe441..7a5e5f6 100644 --- a/src/declarative/debugger/qdeclarativedebug.cpp +++ b/src/declarative/debugger/qdeclarativedebug.cpp @@ -55,10 +55,12 @@ public: QDeclarativeEngineDebugClient(QDeclarativeDebugConnection *client, QDeclarativeEngineDebugPrivate *p); protected: + virtual void statusChanged(Status status); virtual void messageReceived(const QByteArray &); private: QDeclarativeEngineDebugPrivate *priv; + friend class QDeclarativeEngineDebugPrivate; }; class QDeclarativeEngineDebugPrivate : public QObjectPrivate @@ -66,7 +68,9 @@ class QDeclarativeEngineDebugPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QDeclarativeEngineDebug) public: QDeclarativeEngineDebugPrivate(QDeclarativeDebugConnection *); + ~QDeclarativeEngineDebugPrivate(); + void statusChanged(QDeclarativeEngineDebug::Status status); void message(const QByteArray &); QDeclarativeEngineDebugClient *client; @@ -93,12 +97,18 @@ QDeclarativeEngineDebugClient::QDeclarativeEngineDebugClient(QDeclarativeDebugCo QDeclarativeEngineDebugPrivate *p) : QDeclarativeDebugClient(QLatin1String("QDeclarativeEngine"), client), priv(p) { - setEnabled(true); +} + +void QDeclarativeEngineDebugClient::statusChanged(Status status) +{ + if (priv) + priv->statusChanged(static_cast(status)); } void QDeclarativeEngineDebugClient::messageReceived(const QByteArray &data) { - priv->message(data); + if (priv) + priv->message(data); } QDeclarativeEngineDebugPrivate::QDeclarativeEngineDebugPrivate(QDeclarativeDebugConnection *c) @@ -106,6 +116,12 @@ QDeclarativeEngineDebugPrivate::QDeclarativeEngineDebugPrivate(QDeclarativeDebug { } +QDeclarativeEngineDebugPrivate::~QDeclarativeEngineDebugPrivate() +{ + if (client) + client->priv = 0; +} + int QDeclarativeEngineDebugPrivate::getId() { return nextId++; @@ -228,6 +244,11 @@ void QDeclarativeEngineDebugPrivate::decode(QDataStream &ds, QDeclarativeDebugCo } } +void QDeclarativeEngineDebugPrivate::statusChanged(QDeclarativeEngineDebug::Status status) +{ + emit q_func()->statusChanged(status); +} + void QDeclarativeEngineDebugPrivate::message(const QByteArray &data) { QDataStream ds(data); @@ -350,12 +371,19 @@ QDeclarativeEngineDebug::QDeclarativeEngineDebug(QDeclarativeDebugConnection *cl { } +QDeclarativeEngineDebug::Status QDeclarativeEngineDebug::status() const +{ + Q_D(const QDeclarativeEngineDebug); + + return static_cast(d->client->status()); +} + QDeclarativeDebugPropertyWatch *QDeclarativeEngineDebug::addWatch(const QDeclarativeDebugPropertyReference &property, QObject *parent) { Q_D(QDeclarativeEngineDebug); QDeclarativeDebugPropertyWatch *watch = new QDeclarativeDebugPropertyWatch(parent); - if (d->client->isConnected()) { + if (d->client->status() == QDeclarativeDebugClient::Enabled) { int queryId = d->getId(); watch->m_queryId = queryId; watch->m_client = this; @@ -384,7 +412,7 @@ QDeclarativeDebugObjectExpressionWatch *QDeclarativeEngineDebug::addWatch(const { Q_D(QDeclarativeEngineDebug); QDeclarativeDebugObjectExpressionWatch *watch = new QDeclarativeDebugObjectExpressionWatch(parent); - if (d->client->isConnected()) { + if (d->client->status() == QDeclarativeDebugClient::Enabled) { int queryId = d->getId(); watch->m_queryId = queryId; watch->m_client = this; @@ -407,7 +435,7 @@ QDeclarativeDebugWatch *QDeclarativeEngineDebug::addWatch(const QDeclarativeDebu Q_D(QDeclarativeEngineDebug); QDeclarativeDebugWatch *watch = new QDeclarativeDebugWatch(parent); - if (d->client->isConnected()) { + if (d->client->status() == QDeclarativeDebugClient::Enabled) { int queryId = d->getId(); watch->m_queryId = queryId; watch->m_client = this; @@ -443,7 +471,7 @@ void QDeclarativeEngineDebug::removeWatch(QDeclarativeDebugWatch *watch) d->watched.remove(watch->queryId()); - if (d->client && d->client->isConnected()) { + if (d->client && d->client->status() == QDeclarativeDebugClient::Enabled) { QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); ds << QByteArray("NO_WATCH") << watch->queryId(); @@ -456,7 +484,7 @@ QDeclarativeDebugEnginesQuery *QDeclarativeEngineDebug::queryAvailableEngines(QO Q_D(QDeclarativeEngineDebug); QDeclarativeDebugEnginesQuery *query = new QDeclarativeDebugEnginesQuery(parent); - if (d->client->isConnected()) { + if (d->client->status() == QDeclarativeDebugClient::Enabled) { query->m_client = this; int queryId = d->getId(); query->m_queryId = queryId; @@ -478,7 +506,7 @@ QDeclarativeDebugRootContextQuery *QDeclarativeEngineDebug::queryRootContexts(co Q_D(QDeclarativeEngineDebug); QDeclarativeDebugRootContextQuery *query = new QDeclarativeDebugRootContextQuery(parent); - if (d->client->isConnected() && engine.debugId() != -1) { + if (d->client->status() == QDeclarativeDebugClient::Enabled && engine.debugId() != -1) { query->m_client = this; int queryId = d->getId(); query->m_queryId = queryId; @@ -500,7 +528,7 @@ QDeclarativeDebugObjectQuery *QDeclarativeEngineDebug::queryObject(const QDeclar Q_D(QDeclarativeEngineDebug); QDeclarativeDebugObjectQuery *query = new QDeclarativeDebugObjectQuery(parent); - if (d->client->isConnected() && object.debugId() != -1) { + if (d->client->status() == QDeclarativeDebugClient::Enabled && object.debugId() != -1) { query->m_client = this; int queryId = d->getId(); query->m_queryId = queryId; @@ -523,7 +551,7 @@ QDeclarativeDebugObjectQuery *QDeclarativeEngineDebug::queryObjectRecursive(cons Q_D(QDeclarativeEngineDebug); QDeclarativeDebugObjectQuery *query = new QDeclarativeDebugObjectQuery(parent); - if (d->client->isConnected() && object.debugId() != -1) { + if (d->client->status() == QDeclarativeDebugClient::Enabled && object.debugId() != -1) { query->m_client = this; int queryId = d->getId(); query->m_queryId = queryId; @@ -546,7 +574,7 @@ QDeclarativeDebugExpressionQuery *QDeclarativeEngineDebug::queryExpressionResult Q_D(QDeclarativeEngineDebug); QDeclarativeDebugExpressionQuery *query = new QDeclarativeDebugExpressionQuery(parent); - if (d->client->isConnected() && objectDebugId != -1) { + if (d->client->status() == QDeclarativeDebugClient::Enabled && objectDebugId != -1) { query->m_client = this; query->m_expr = expr; int queryId = d->getId(); @@ -570,7 +598,7 @@ bool QDeclarativeEngineDebug::setBindingForObject(int objectDebugId, const QStri { Q_D(QDeclarativeEngineDebug); - if (d->client->isConnected() && objectDebugId != -1) { + if (d->client->status() == QDeclarativeDebugClient::Enabled && objectDebugId != -1) { QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); ds << QByteArray("SET_BINDING") << objectDebugId << propertyName << bindingExpression << isLiteralValue; @@ -585,7 +613,7 @@ bool QDeclarativeEngineDebug::resetBindingForObject(int objectDebugId, const QSt { Q_D(QDeclarativeEngineDebug); - if (d->client->isConnected() && objectDebugId != -1) { + if (d->client->status() == QDeclarativeDebugClient::Enabled && objectDebugId != -1) { QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); ds << QByteArray("RESET_BINDING") << objectDebugId << propertyName; @@ -601,7 +629,7 @@ bool QDeclarativeEngineDebug::setMethodBody(int objectDebugId, const QString &me { Q_D(QDeclarativeEngineDebug); - if (d->client->isConnected() && objectDebugId != -1) { + if (d->client->status() == QDeclarativeDebugClient::Enabled && objectDebugId != -1) { QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); ds << QByteArray("SET_METHOD_BODY") << objectDebugId << methodName << methodBody; diff --git a/src/declarative/debugger/qdeclarativedebug_p.h b/src/declarative/debugger/qdeclarativedebug_p.h index 2b1a115..3d83e8a 100644 --- a/src/declarative/debugger/qdeclarativedebug_p.h +++ b/src/declarative/debugger/qdeclarativedebug_p.h @@ -69,7 +69,11 @@ class Q_DECLARATIVE_EXPORT QDeclarativeEngineDebug : public QObject { Q_OBJECT public: - QDeclarativeEngineDebug(QDeclarativeDebugConnection *, QObject * = 0); + enum Status { NotConnected, Unavailable, Enabled }; + + explicit QDeclarativeEngineDebug(QDeclarativeDebugConnection *, QObject * = 0); + + Status status() const; QDeclarativeDebugPropertyWatch *addWatch(const QDeclarativeDebugPropertyReference &, QObject *parent = 0); @@ -101,6 +105,7 @@ public: Q_SIGNALS: void newObjects(); + void statusChanged(Status status); private: Q_DECLARE_PRIVATE(QDeclarativeEngineDebug) diff --git a/src/declarative/debugger/qdeclarativedebugclient.cpp b/src/declarative/debugger/qdeclarativedebugclient.cpp index 2e52b40..f7d7243 100644 --- a/src/declarative/debugger/qdeclarativedebugclient.cpp +++ b/src/declarative/debugger/qdeclarativedebugclient.cpp @@ -50,6 +50,20 @@ QT_BEGIN_NAMESPACE +const int protocolVersion = 1; +const QString serverId = QLatin1String("QDeclarativeDebugServer"); +const QString clientId = QLatin1String("QDeclarativeDebugClient"); + +class QDeclarativeDebugClientPrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QDeclarativeDebugClient) +public: + QDeclarativeDebugClientPrivate(); + + QString name; + QDeclarativeDebugConnection *client; +}; + class QDeclarativeDebugConnectionPrivate : public QObject { Q_OBJECT @@ -58,40 +72,123 @@ public: QDeclarativeDebugConnection *q; QPacketProtocol *protocol; - QStringList enabled; + bool gotHello; + QStringList serverPlugins; QHash plugins; + + void advertisePlugins(); + public Q_SLOTS: void connected(); void readyRead(); }; QDeclarativeDebugConnectionPrivate::QDeclarativeDebugConnectionPrivate(QDeclarativeDebugConnection *c) -: QObject(c), q(c), protocol(0) +: QObject(c), q(c), protocol(0), gotHello(false) { protocol = new QPacketProtocol(q, this); QObject::connect(c, SIGNAL(connected()), this, SLOT(connected())); QObject::connect(protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); } +void QDeclarativeDebugConnectionPrivate::advertisePlugins() +{ + if (!q->isConnected() || !gotHello) + return; + + QPacket pack; + pack << serverId << 1 << plugins.keys(); + protocol->send(pack); +} + void QDeclarativeDebugConnectionPrivate::connected() { QPacket pack; - pack << QString(QLatin1String("QDeclarativeDebugServer")) << enabled; + pack << serverId << 0 << protocolVersion << plugins.keys(); protocol->send(pack); } void QDeclarativeDebugConnectionPrivate::readyRead() { - QPacket pack = protocol->read(); - QString name; QByteArray message; - pack >> name >> message; + if (!gotHello) { + QPacket pack = protocol->read(); + QString name; + + pack >> name; + + bool validHello = false; + if (name == clientId) { + int op = -1; + pack >> op; + if (op == 0) { + int version = -1; + pack >> version; + if (version == protocolVersion) { + pack >> serverPlugins; + validHello = true; + } + } + } - QHash::Iterator iter = - plugins.find(name); - if (iter == plugins.end()) { - qWarning() << "QDeclarativeDebugConnection: Message received for missing plugin" << name; - } else { - (*iter)->messageReceived(message); + if (!validHello) { + qWarning("QDeclarativeDebugConnection: Invalid hello message"); + QObject::disconnect(protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); + return; + } + + qDebug() << "Available server side plugins: " << serverPlugins; + + QHash::Iterator iter = plugins.begin(); + for (; iter != plugins.end(); ++iter) { + QDeclarativeDebugClient::Status newStatus = QDeclarativeDebugClient::Unavailable; + if (serverPlugins.contains(iter.key())) + newStatus = QDeclarativeDebugClient::Enabled; + iter.value()->statusChanged(newStatus); + } + gotHello = true; + } + + while (protocol->packetsAvailable()) { + QPacket pack = protocol->read(); + QString name; + pack >> name; + + if (name == clientId) { + int op = -1; + pack >> op; + + if (op == 1) { + // Service Discovery + QStringList oldServerPlugins = serverPlugins; + pack >> serverPlugins; + + QHash::Iterator iter = plugins.begin(); + for (; iter != plugins.end(); ++iter) { + const QString pluginName = iter.key(); + QDeclarativeDebugClient::Status newStatus = QDeclarativeDebugClient::Unavailable; + if (serverPlugins.contains(pluginName)) + newStatus = QDeclarativeDebugClient::Enabled; + + if (oldServerPlugins.contains(pluginName) + != serverPlugins.contains(pluginName)) { + iter.value()->statusChanged(newStatus); + } + } + } else { + qWarning() << "QDeclarativeDebugConnection: Unknown control message id" << op; + } + } else { + QByteArray message; + pack >> message; + + QHash::Iterator iter = + plugins.find(name); + if (iter == plugins.end()) { + qWarning() << "QDeclarativeDebugConnection: Message received for missing plugin" << name; + } else { + (*iter)->messageReceived(message); + } + } } } @@ -100,24 +197,22 @@ QDeclarativeDebugConnection::QDeclarativeDebugConnection(QObject *parent) { } -bool QDeclarativeDebugConnection::isConnected() const +QDeclarativeDebugConnection::~QDeclarativeDebugConnection() { - return state() == ConnectedState; + QHash::iterator iter = d->plugins.begin(); + for (; iter != d->plugins.end(); ++iter) { + iter.value()->d_func()->client = 0; + iter.value()->statusChanged(QDeclarativeDebugClient::NotConnected); + } } -class QDeclarativeDebugClientPrivate : public QObjectPrivate +bool QDeclarativeDebugConnection::isConnected() const { - Q_DECLARE_PUBLIC(QDeclarativeDebugClient) -public: - QDeclarativeDebugClientPrivate(); - - QString name; - QDeclarativeDebugConnection *client; - bool enabled; -}; + return state() == ConnectedState; +} QDeclarativeDebugClientPrivate::QDeclarativeDebugClientPrivate() -: client(0), enabled(false) +: client(0) { } @@ -137,60 +232,44 @@ QDeclarativeDebugClient::QDeclarativeDebugClient(const QString &name, d->client = 0; } else { d->client->d->plugins.insert(name, this); + d->client->d->advertisePlugins(); } } -QString QDeclarativeDebugClient::name() const +QDeclarativeDebugClient::~QDeclarativeDebugClient() { Q_D(const QDeclarativeDebugClient); - return d->name; + if (d->client && d->client->d) { + d->client->d->plugins.remove(d->name); + d->client->d->advertisePlugins(); + } } -bool QDeclarativeDebugClient::isEnabled() const +QString QDeclarativeDebugClient::name() const { Q_D(const QDeclarativeDebugClient); - return d->enabled; -} - -void QDeclarativeDebugClient::setEnabled(bool e) -{ - Q_D(QDeclarativeDebugClient); - if (e == d->enabled) - return; - - d->enabled = e; - - if (d->client) { - if (e) - d->client->d->enabled.append(d->name); - else - d->client->d->enabled.removeAll(d->name); - - if (d->client->state() == QTcpSocket::ConnectedState) { - QPacket pack; - pack << QString(QLatin1String("QDeclarativeDebugServer")); - if (e) pack << (int)1; - else pack << (int)2; - pack << d->name; - d->client->d->protocol->send(pack); - } - } + return d->name; } -bool QDeclarativeDebugClient::isConnected() const +QDeclarativeDebugClient::Status QDeclarativeDebugClient::status() const { Q_D(const QDeclarativeDebugClient); + if (!d->client + || !d->client->isConnected() + || !d->client->d->gotHello) + return NotConnected; - if (!d->client) - return false; - return d->client->isConnected(); + if (d->client->d->serverPlugins.contains(d->name)) + return Enabled; + + return Unavailable; } void QDeclarativeDebugClient::sendMessage(const QByteArray &message) { Q_D(QDeclarativeDebugClient); - if (!d->client || !d->client->isConnected()) + if (status() != Enabled) return; QPacket pack; @@ -198,6 +277,10 @@ void QDeclarativeDebugClient::sendMessage(const QByteArray &message) d->client->d->protocol->send(pack); } +void QDeclarativeDebugClient::statusChanged(Status status) +{ +} + void QDeclarativeDebugClient::messageReceived(const QByteArray &) { } diff --git a/src/declarative/debugger/qdeclarativedebugclient_p.h b/src/declarative/debugger/qdeclarativedebugclient_p.h index 4144a66..8d1706d 100644 --- a/src/declarative/debugger/qdeclarativedebugclient_p.h +++ b/src/declarative/debugger/qdeclarativedebugclient_p.h @@ -57,6 +57,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeDebugConnection : public QTcpSocket Q_DISABLE_COPY(QDeclarativeDebugConnection) public: QDeclarativeDebugConnection(QObject * = 0); + ~QDeclarativeDebugConnection(); bool isConnected() const; private: @@ -73,18 +74,19 @@ class Q_DECLARATIVE_EXPORT QDeclarativeDebugClient : public QObject Q_DISABLE_COPY(QDeclarativeDebugClient) public: + enum Status { NotConnected, Unavailable, Enabled }; + QDeclarativeDebugClient(const QString &, QDeclarativeDebugConnection *parent); + ~QDeclarativeDebugClient(); QString name() const; - bool isEnabled() const; - void setEnabled(bool); - - bool isConnected() const; + Status status() const; void sendMessage(const QByteArray &); protected: + virtual void statusChanged(Status); virtual void messageReceived(const QByteArray &); private: diff --git a/src/declarative/debugger/qdeclarativedebugservice.cpp b/src/declarative/debugger/qdeclarativedebugservice.cpp index 1f2bf4f..0fbc1e3 100644 --- a/src/declarative/debugger/qdeclarativedebugservice.cpp +++ b/src/declarative/debugger/qdeclarativedebugservice.cpp @@ -54,6 +54,30 @@ QT_BEGIN_NAMESPACE +/* + QDeclarativeDebug Protocol (Version 1): + + handshake: + 1. Client sends + "QDeclarativeDebugServer" 0 version pluginNames + version: an int representing the highest protocol version the client knows + pluginNames: plugins available on client side + 2. Server sends + "QDeclarativeDebugClient" 0 version pluginNames + version: an int representing the highest protocol version the client & server know + pluginNames: plugins available on server side. plugins both in the client and server message are enabled. + client plugin advertisement + 1. Client sends + "QDeclarativeDebugServer" 1 pluginNames + server plugin advertisement + 1. Server sends + "QDeclarativeDebugClient" 1 pluginNames + plugin communication: + Everything send with a header different to "QDeclarativeDebugServer" is sent to the appropriate plugin. + */ + +const int protocolVersion = 1; + class QDeclarativeDebugServerPrivate; class QDeclarativeDebugServer : public QObject { @@ -82,11 +106,13 @@ class QDeclarativeDebugServerPrivate : public QObjectPrivate public: QDeclarativeDebugServerPrivate(); + void advertisePlugins(); + int port; QTcpSocket *connection; QPacketProtocol *protocol; QHash plugins; - QStringList enabledPlugins; + QStringList clientPlugins; QTcpServer *tcpServer; bool gotHello; }; @@ -106,6 +132,18 @@ QDeclarativeDebugServerPrivate::QDeclarativeDebugServerPrivate() { } +void QDeclarativeDebugServerPrivate::advertisePlugins() +{ + if (!connection + || connection->state() != QTcpSocket::ConnectedState + || !gotHello) + return; + + QPacket pack; + pack << QString(QLatin1String("QDeclarativeDebugClient")) << 1 << plugins.keys(); + protocol->send(pack); +} + void QDeclarativeDebugServer::listen() { Q_D(QDeclarativeDebugServer); @@ -202,9 +240,13 @@ void QDeclarativeDebugServer::readyRead() if (!d->gotHello) { QPacket hello = d->protocol->read(); - QString name; - hello >> name >> d->enabledPlugins; - if (name != QLatin1String("QDeclarativeDebugServer")) { + + QString name; + int op; + hello >> name >> op; + + if (name != QLatin1String("QDeclarativeDebugServer") + || op != 0) { qWarning("QDeclarativeDebugServer: Invalid hello message"); QObject::disconnect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); d->protocol->deleteLater(); @@ -213,6 +255,23 @@ void QDeclarativeDebugServer::readyRead() d->connection = 0; return; } + + int version; + hello >> version >> d->clientPlugins; + + QHash::Iterator iter = d->plugins.begin(); + for (; iter != d->plugins.end(); ++iter) { + QDeclarativeDebugService::Status newStatus = QDeclarativeDebugService::Unavailable; + if (d->clientPlugins.contains(iter.key())) + newStatus = QDeclarativeDebugService::Enabled; + iter.value()->statusChanged(newStatus); + } + + QPacket helloAnswer; + helloAnswer << QString(QLatin1String("QDeclarativeDebugClient")) << 0 << protocolVersion << d->plugins.keys(); + d->protocol->send(helloAnswer); + d->connection->flush(); + d->gotHello = true; qWarning("QDeclarativeDebugServer: Connection established"); } @@ -226,32 +285,29 @@ void QDeclarativeDebugServer::readyRead() pack >> name; if (name == debugServer) { - int op = -1; QString plugin; - pack >> op >> plugin; + int op = -1; + pack >> op; if (op == 1) { - // Enable - if (!d->enabledPlugins.contains(plugin)) { - d->enabledPlugins.append(plugin); - QHash::Iterator iter = - d->plugins.find(plugin); - if (iter != d->plugins.end()) - (*iter)->enabledChanged(true); - } - - } else if (op == 2) { - // Disable - if (d->enabledPlugins.contains(plugin)) { - d->enabledPlugins.removeAll(plugin); - QHash::Iterator iter = - d->plugins.find(plugin); - if (iter != d->plugins.end()) - (*iter)->enabledChanged(false); + // Service Discovery + QStringList oldClientPlugins = d->clientPlugins; + pack >> d->clientPlugins; + + QHash::Iterator iter = d->plugins.begin(); + for (; iter != d->plugins.end(); ++iter) { + const QString pluginName = iter.key(); + QDeclarativeDebugService::Status newStatus = QDeclarativeDebugService::Unavailable; + if (d->clientPlugins.contains(pluginName)) + newStatus = QDeclarativeDebugService::Enabled; + + if (oldClientPlugins.contains(pluginName) + != d->clientPlugins.contains(pluginName)) { + iter.value()->statusChanged(newStatus); + } } } else { qWarning("QDeclarativeDebugServer: Invalid control message %d", op); } - } else { QByteArray message; pack >> message; @@ -287,6 +343,16 @@ QDeclarativeDebugService::QDeclarativeDebugService(const QString &name, QObject d->server = 0; } else { d->server->d_func()->plugins.insert(name, this); + d->server->d_func()->advertisePlugins(); + } +} + +QDeclarativeDebugService::~QDeclarativeDebugService() +{ + Q_D(const QDeclarativeDebugService); + if (d->server) { + d->server->d_func()->plugins.remove(d->name); + d->server->d_func()->advertisePlugins(); } } @@ -296,10 +362,16 @@ QString QDeclarativeDebugService::name() const return d->name; } -bool QDeclarativeDebugService::isEnabled() const +QDeclarativeDebugService::Status QDeclarativeDebugService::status() const { Q_D(const QDeclarativeDebugService); - return (d->server && d->server->d_func()->enabledPlugins.contains(d->name)); + if (!d->server + || !d->server->hasDebuggingClient()) + return NotConnected; + if (d->server->d_func()->clientPlugins.contains(d->name)) + return Enabled; + + return Unavailable; } namespace { @@ -422,7 +494,7 @@ void QDeclarativeDebugService::sendMessage(const QByteArray &message) d->server->d_func()->connection->flush(); } -void QDeclarativeDebugService::enabledChanged(bool) +void QDeclarativeDebugService::statusChanged(Status) { } diff --git a/src/declarative/debugger/qdeclarativedebugservice_p.h b/src/declarative/debugger/qdeclarativedebugservice_p.h index c461ddf..0cadbe5 100644 --- a/src/declarative/debugger/qdeclarativedebugservice_p.h +++ b/src/declarative/debugger/qdeclarativedebugservice_p.h @@ -56,12 +56,15 @@ class Q_DECLARATIVE_EXPORT QDeclarativeDebugService : public QObject Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeDebugService) Q_DISABLE_COPY(QDeclarativeDebugService) + public: - QDeclarativeDebugService(const QString &, QObject *parent = 0); + explicit QDeclarativeDebugService(const QString &, QObject *parent = 0); + ~QDeclarativeDebugService(); QString name() const; - bool isEnabled() const; + enum Status { NotConnected, Unavailable, Enabled }; + Status status() const; void sendMessage(const QByteArray &); @@ -74,7 +77,7 @@ public: static bool hasDebuggingClient(); protected: - virtual void enabledChanged(bool); + virtual void statusChanged(Status); virtual void messageReceived(const QByteArray &); private: diff --git a/src/declarative/debugger/qdeclarativedebugtrace.cpp b/src/declarative/debugger/qdeclarativedebugtrace.cpp index b2b0c8a..03e2d56 100644 --- a/src/declarative/debugger/qdeclarativedebugtrace.cpp +++ b/src/declarative/debugger/qdeclarativedebugtrace.cpp @@ -78,7 +78,7 @@ void QDeclarativeDebugTrace::endRange(RangeType t) void QDeclarativeDebugTrace::addEventImpl(EventType event) { - if (!isEnabled()) + if (status() != Enabled) return; QByteArray data; @@ -89,7 +89,7 @@ void QDeclarativeDebugTrace::addEventImpl(EventType event) void QDeclarativeDebugTrace::startRangeImpl(RangeType range) { - if (!isEnabled()) + if (status() != Enabled) return; QByteArray data; @@ -100,7 +100,7 @@ void QDeclarativeDebugTrace::startRangeImpl(RangeType range) void QDeclarativeDebugTrace::rangeDataImpl(RangeType range, const QUrl &u) { - if (!isEnabled()) + if (status() != Enabled) return; QByteArray data; @@ -111,7 +111,7 @@ void QDeclarativeDebugTrace::rangeDataImpl(RangeType range, const QUrl &u) void QDeclarativeDebugTrace::endRangeImpl(RangeType range) { - if (!isEnabled()) + if (status() != Enabled) return; QByteArray data; diff --git a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp index 4a5bdf2..e6a81b8 100644 --- a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp +++ b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp @@ -324,13 +324,16 @@ void tst_QDeclarativeDebug::initTestCase() bool ok = m_conn->waitForConnected(); Q_ASSERT(ok); QTRY_VERIFY(QDeclarativeDebugService::hasDebuggingClient()); - m_dbg = new QDeclarativeEngineDebug(m_conn, this); + QTRY_VERIFY(m_dbg->status() == QDeclarativeEngineDebug::Enabled); } void tst_QDeclarativeDebug::cleanupTestCase() { + delete m_dbg; + delete m_conn; qDeleteAll(m_components); + delete m_engine; } void tst_QDeclarativeDebug::setMethodBody() diff --git a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp index 7db0e60..72af3eb 100644 --- a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp +++ b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp @@ -66,9 +66,7 @@ private slots: void initTestCase(); void name(); - void isEnabled(); - void setEnabled(); - void isConnected(); + void status(); void sendMessage(); }; @@ -96,46 +94,33 @@ void tst_QDeclarativeDebugClient::name() QCOMPARE(client.name(), name); } -void tst_QDeclarativeDebugClient::isEnabled() +void tst_QDeclarativeDebugClient::status() { - QDeclarativeDebugClient client("tst_QDeclarativeDebugClient::isEnabled()", m_conn); - QCOMPARE(client.isEnabled(), false); -} + { + QDeclarativeDebugConnection dummyConn; + QDeclarativeDebugClient client("tst_QDeclarativeDebugClient::status()", &dummyConn); + QCOMPARE(client.status(), QDeclarativeDebugClient::NotConnected); + } -void tst_QDeclarativeDebugClient::setEnabled() -{ - QDeclarativeDebugTestService service("tst_QDeclarativeDebugClient::setEnabled()"); - QDeclarativeDebugTestClient client("tst_QDeclarativeDebugClient::setEnabled()", m_conn); + QDeclarativeDebugTestClient client("tst_QDeclarativeDebugClient::status()", m_conn); + QCOMPARE(client.status(), QDeclarativeDebugClient::Unavailable); - QCOMPARE(service.isEnabled(), false); + { + QDeclarativeDebugTestService service("tst_QDeclarativeDebugClient::status()"); + QDeclarativeDebugTest::waitForSignal(&client, SIGNAL(statusHasChanged())); + QCOMPARE(client.status(), QDeclarativeDebugClient::Enabled); + } + QDeclarativeDebugTest::waitForSignal(&client, SIGNAL(statusHasChanged())); - client.setEnabled(true); - QCOMPARE(client.isEnabled(), true); - QDeclarativeDebugTest::waitForSignal(&service, SIGNAL(enabledStateChanged())); - QCOMPARE(service.isEnabled(), true); - - client.setEnabled(false); - QCOMPARE(client.isEnabled(), false); - QDeclarativeDebugTest::waitForSignal(&service, SIGNAL(enabledStateChanged())); - QCOMPARE(service.isEnabled(), false); -} - -void tst_QDeclarativeDebugClient::isConnected() -{ - QDeclarativeDebugClient client1("tst_QDeclarativeDebugClient::isConnected() A", m_conn); - QCOMPARE(client1.isConnected(), true); - - QDeclarativeDebugConnection conn; - QDeclarativeDebugClient client2("tst_QDeclarativeDebugClient::isConnected() B", &conn); - QCOMPARE(client2.isConnected(), false); - - QDeclarativeDebugClient client3("tst_QDeclarativeDebugClient::isConnected() C", 0); - QCOMPARE(client3.isConnected(), false); + QCOMPARE(client.status(), QDeclarativeDebugClient::Unavailable); // duplicate plugin name - QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugClient: Conflicting plugin name \"tst_QDeclarativeDebugClient::isConnected() A\" "); - QDeclarativeDebugClient client4("tst_QDeclarativeDebugClient::isConnected() A", m_conn); - QCOMPARE(client4.isConnected(), false); + QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugClient: Conflicting plugin name \"tst_QDeclarativeDebugClient::status()\" "); + QDeclarativeDebugClient client2("tst_QDeclarativeDebugClient::status()", m_conn); + QCOMPARE(client2.status(), QDeclarativeDebugClient::NotConnected); + + QDeclarativeDebugClient client3("tst_QDeclarativeDebugClient::status3()", 0); + QCOMPARE(client3.status(), QDeclarativeDebugClient::NotConnected); } void tst_QDeclarativeDebugClient::sendMessage() @@ -145,6 +130,7 @@ void tst_QDeclarativeDebugClient::sendMessage() QByteArray msg = "hello!"; + QDeclarativeDebugTest::waitForSignal(&client, SIGNAL(statusHasChanged())); client.sendMessage(msg); QByteArray resp = client.waitForResponse(); QCOMPARE(resp, msg); diff --git a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp index 70679b9..945823a 100644 --- a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp +++ b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp @@ -66,8 +66,7 @@ private slots: void initTestCase(); void name(); - void isEnabled(); - void enabledChanged(); + void status(); void sendMessage(); void idForObject(); void objectForId(); @@ -97,31 +96,24 @@ void tst_QDeclarativeDebugService::name() QCOMPARE(service.name(), name); } -void tst_QDeclarativeDebugService::isEnabled() +void tst_QDeclarativeDebugService::status() { - QDeclarativeDebugTestService service("tst_QDeclarativeDebugService::isEnabled()", m_conn); - QCOMPARE(service.isEnabled(), false); + QDeclarativeDebugTestService service("tst_QDeclarativeDebugService::status()"); + QCOMPARE(service.status(), QDeclarativeDebugService::Unavailable); - QDeclarativeDebugTestClient client("tst_QDeclarativeDebugService::isEnabled()", m_conn); - client.setEnabled(true); - QDeclarativeDebugTest::waitForSignal(&service, SIGNAL(enabledStateChanged())); - QCOMPARE(service.isEnabled(), true); + { + QDeclarativeDebugTestClient client("tst_QDeclarativeDebugService::status()", m_conn); + QDeclarativeDebugTest::waitForSignal(&service, SIGNAL(statusHasChanged())); + QCOMPARE(service.status(), QDeclarativeDebugService::Enabled); + } - QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugService: Conflicting plugin name \"tst_QDeclarativeDebugService::isEnabled()\" "); - QDeclarativeDebugService duplicate("tst_QDeclarativeDebugService::isEnabled()", m_conn); - QCOMPARE(duplicate.isEnabled(), false); -} - -void tst_QDeclarativeDebugService::enabledChanged() -{ - QDeclarativeDebugTestService service("tst_QDeclarativeDebugService::enabledChanged()"); - QDeclarativeDebugTestClient client("tst_QDeclarativeDebugService::enabledChanged()", m_conn); + QDeclarativeDebugTest::waitForSignal(&service, SIGNAL(statusHasChanged())); + QCOMPARE(service.status(), QDeclarativeDebugService::Unavailable); - QCOMPARE(service.enabled, false); + QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugService: Conflicting plugin name \"tst_QDeclarativeDebugService::status()\" "); - client.setEnabled(true); - QDeclarativeDebugTest::waitForSignal(&service, SIGNAL(enabledStateChanged())); - QCOMPARE(service.enabled, true); + QDeclarativeDebugService duplicate("tst_QDeclarativeDebugService::status()"); + QCOMPARE(duplicate.status(), QDeclarativeDebugService::NotConnected); } void tst_QDeclarativeDebugService::sendMessage() @@ -131,6 +123,11 @@ void tst_QDeclarativeDebugService::sendMessage() QByteArray msg = "hello!"; + if (service.status() != QDeclarativeDebugService::Enabled) + QDeclarativeDebugTest::waitForSignal(&service, SIGNAL(statusHasChanged())); + if (client.status() != QDeclarativeDebugClient::Enabled) + QDeclarativeDebugTest::waitForSignal(&client, SIGNAL(statusHasChanged())); + client.sendMessage(msg); QByteArray resp = client.waitForResponse(); QCOMPARE(resp, msg); diff --git a/tests/auto/declarative/shared/debugutil.cpp b/tests/auto/declarative/shared/debugutil.cpp index c0c3eca..5f68e44 100644 --- a/tests/auto/declarative/shared/debugutil.cpp +++ b/tests/auto/declarative/shared/debugutil.cpp @@ -60,7 +60,7 @@ bool QDeclarativeDebugTest::waitForSignal(QObject *receiver, const char *member, } QDeclarativeDebugTestService::QDeclarativeDebugTestService(const QString &s, QObject *parent) - : QDeclarativeDebugService(s, parent), enabled(false) + : QDeclarativeDebugService(s, parent) { } @@ -69,10 +69,9 @@ void QDeclarativeDebugTestService::messageReceived(const QByteArray &ba) sendMessage(ba); } -void QDeclarativeDebugTestService::enabledChanged(bool e) +void QDeclarativeDebugTestService::statusChanged(Status) { - enabled = e; - emit enabledStateChanged(); + emit statusHasChanged(); } @@ -92,9 +91,13 @@ QByteArray QDeclarativeDebugTestClient::waitForResponse() return lastMsg; } +void QDeclarativeDebugTestClient::statusChanged(Status status) +{ + emit statusHasChanged(); +} + void QDeclarativeDebugTestClient::messageReceived(const QByteArray &ba) { lastMsg = ba; emit serverMessage(ba); } - diff --git a/tests/auto/declarative/shared/debugutil_p.h b/tests/auto/declarative/shared/debugutil_p.h index e6bb7ad..434e053 100644 --- a/tests/auto/declarative/shared/debugutil_p.h +++ b/tests/auto/declarative/shared/debugutil_p.h @@ -62,15 +62,13 @@ class QDeclarativeDebugTestService : public QDeclarativeDebugService Q_OBJECT public: QDeclarativeDebugTestService(const QString &s, QObject *parent = 0); - bool enabled; signals: - void enabledStateChanged(); + void statusHasChanged(); protected: virtual void messageReceived(const QByteArray &ba); - - virtual void enabledChanged(bool e); + virtual void statusChanged(Status status); }; class QDeclarativeDebugTestClient : public QDeclarativeDebugClient @@ -82,9 +80,11 @@ public: QByteArray waitForResponse(); signals: + void statusHasChanged(); void serverMessage(const QByteArray &); protected: + virtual void statusChanged(Status status); virtual void messageReceived(const QByteArray &ba); private: -- cgit v0.12 From 69a39d7b48ef239248d1039a2d8f2f0dbf560b34 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 28 Sep 2010 12:24:55 +0200 Subject: QmlDebugService: Check that there is a receiver before sending messages Reviewed-by: Christiaan Janssen (cherry picked from commit 30959e88498b2c8591145e30c8b497a76c12d8f6) --- src/declarative/debugger/qdeclarativedebugservice.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/declarative/debugger/qdeclarativedebugservice.cpp b/src/declarative/debugger/qdeclarativedebugservice.cpp index 0fbc1e3..62f2f39 100644 --- a/src/declarative/debugger/qdeclarativedebugservice.cpp +++ b/src/declarative/debugger/qdeclarativedebugservice.cpp @@ -182,7 +182,9 @@ void QDeclarativeDebugServer::newConnection() bool QDeclarativeDebugServer::hasDebuggingClient() const { Q_D(const QDeclarativeDebugServer); - return d->gotHello; + return d->connection + && (d->connection->state() == QTcpSocket::ConnectedState) + && d->gotHello; } QDeclarativeDebugServer *QDeclarativeDebugServer::instance() @@ -485,7 +487,7 @@ void QDeclarativeDebugService::sendMessage(const QByteArray &message) { Q_D(QDeclarativeDebugService); - if (!d->server || !d->server->d_func()->connection) + if (status() != Enabled) return; QPacket pack; -- cgit v0.12 From b4ccec4309f9d384056e743e9c0caf91097a57b4 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 28 Sep 2010 12:48:13 +0200 Subject: QDeclarativeDebugClient: Fix gcc warning (cherry picked from commit 9caae83e1f2b9c56ee86b8523391e6a83ea724c5) --- src/declarative/debugger/qdeclarativedebugclient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/debugger/qdeclarativedebugclient.cpp b/src/declarative/debugger/qdeclarativedebugclient.cpp index f7d7243..ce3faf6 100644 --- a/src/declarative/debugger/qdeclarativedebugclient.cpp +++ b/src/declarative/debugger/qdeclarativedebugclient.cpp @@ -277,7 +277,7 @@ void QDeclarativeDebugClient::sendMessage(const QByteArray &message) d->client->d->protocol->send(pack); } -void QDeclarativeDebugClient::statusChanged(Status status) +void QDeclarativeDebugClient::statusChanged(Status) { } -- cgit v0.12 From 000a95629a4dd07b600b5ae4d463654f8d2267af Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 30 Sep 2010 15:26:05 +0200 Subject: QDeclarativeDebugClient: Make sure status is consistent When statusChanged() is called during handsake state() was not the same as the argument passed. Fix this by setting gotHello = true _before_ notifying the clients. Reviewed-by: Christiaan Janssen Task-number: QTBUG-14087 (cherry picked from commit a1f050fe4217d3a642ab7f4df8e50c21aa51689c) --- src/declarative/debugger/qdeclarativedebugclient.cpp | 3 +-- .../qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp | 5 +++++ tests/auto/declarative/shared/debugutil.cpp | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/declarative/debugger/qdeclarativedebugclient.cpp b/src/declarative/debugger/qdeclarativedebugclient.cpp index ce3faf6..5baaf70 100644 --- a/src/declarative/debugger/qdeclarativedebugclient.cpp +++ b/src/declarative/debugger/qdeclarativedebugclient.cpp @@ -136,7 +136,7 @@ void QDeclarativeDebugConnectionPrivate::readyRead() return; } - qDebug() << "Available server side plugins: " << serverPlugins; + gotHello = true; QHash::Iterator iter = plugins.begin(); for (; iter != plugins.end(); ++iter) { @@ -145,7 +145,6 @@ void QDeclarativeDebugConnectionPrivate::readyRead() newStatus = QDeclarativeDebugClient::Enabled; iter.value()->statusChanged(newStatus); } - gotHello = true; } while (protocol->packetsAvailable()) { diff --git a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp index 72af3eb..a5f9846 100644 --- a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp +++ b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp @@ -77,6 +77,10 @@ void tst_QDeclarativeDebugClient::initTestCase() new QDeclarativeEngine(this); m_conn = new QDeclarativeDebugConnection(this); + + QDeclarativeDebugTestClient client("tst_QDeclarativeDebugClient::handshake()", m_conn); + QDeclarativeDebugTestService service("tst_QDeclarativeDebugClient::handshake()"); + m_conn->connectToHost("127.0.0.1", 3770); QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Connection established"); @@ -84,6 +88,7 @@ void tst_QDeclarativeDebugClient::initTestCase() Q_ASSERT(ok); QTRY_VERIFY(QDeclarativeDebugService::hasDebuggingClient()); + QTRY_COMPARE(client.status(), QDeclarativeDebugClient::Enabled); } void tst_QDeclarativeDebugClient::name() diff --git a/tests/auto/declarative/shared/debugutil.cpp b/tests/auto/declarative/shared/debugutil.cpp index 5f68e44..cbd055b 100644 --- a/tests/auto/declarative/shared/debugutil.cpp +++ b/tests/auto/declarative/shared/debugutil.cpp @@ -91,8 +91,9 @@ QByteArray QDeclarativeDebugTestClient::waitForResponse() return lastMsg; } -void QDeclarativeDebugTestClient::statusChanged(Status status) +void QDeclarativeDebugTestClient::statusChanged(Status stat) { + QCOMPARE(stat, status()); emit statusHasChanged(); } -- cgit v0.12 From c249db933aeb4b44b935924f3ff67669f3d94707 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 30 Sep 2010 17:49:19 +0200 Subject: QDeclarativeDebug: Make autotests more robust Always flush sockets after sending data, and make autotests more robust by using busy wait. Reviewed-by: Christiaan Janssen (cherry picked from commit cfe198948f1e4867918176df38b3e0b49757a4b8) --- src/declarative/debugger/qdeclarativedebugclient.cpp | 3 +++ src/declarative/debugger/qdeclarativedebugservice.cpp | 1 + .../tst_qdeclarativedebugclient.cpp | 9 ++++----- .../tst_qdeclarativedebugservice.cpp | 14 ++++++-------- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/declarative/debugger/qdeclarativedebugclient.cpp b/src/declarative/debugger/qdeclarativedebugclient.cpp index 5baaf70..977e58e 100644 --- a/src/declarative/debugger/qdeclarativedebugclient.cpp +++ b/src/declarative/debugger/qdeclarativedebugclient.cpp @@ -99,6 +99,7 @@ void QDeclarativeDebugConnectionPrivate::advertisePlugins() QPacket pack; pack << serverId << 1 << plugins.keys(); protocol->send(pack); + q->flush(); } void QDeclarativeDebugConnectionPrivate::connected() @@ -106,6 +107,7 @@ void QDeclarativeDebugConnectionPrivate::connected() QPacket pack; pack << serverId << 0 << protocolVersion << plugins.keys(); protocol->send(pack); + q->flush(); } void QDeclarativeDebugConnectionPrivate::readyRead() @@ -274,6 +276,7 @@ void QDeclarativeDebugClient::sendMessage(const QByteArray &message) QPacket pack; pack << d->name << message; d->client->d->protocol->send(pack); + d->client->d->q->flush(); } void QDeclarativeDebugClient::statusChanged(Status) diff --git a/src/declarative/debugger/qdeclarativedebugservice.cpp b/src/declarative/debugger/qdeclarativedebugservice.cpp index 62f2f39..d2ef00d 100644 --- a/src/declarative/debugger/qdeclarativedebugservice.cpp +++ b/src/declarative/debugger/qdeclarativedebugservice.cpp @@ -142,6 +142,7 @@ void QDeclarativeDebugServerPrivate::advertisePlugins() QPacket pack; pack << QString(QLatin1String("QDeclarativeDebugClient")) << 1 << plugins.keys(); protocol->send(pack); + connection->flush(); } void QDeclarativeDebugServer::listen() diff --git a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp index a5f9846..80241ba 100644 --- a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp +++ b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp @@ -112,12 +112,10 @@ void tst_QDeclarativeDebugClient::status() { QDeclarativeDebugTestService service("tst_QDeclarativeDebugClient::status()"); - QDeclarativeDebugTest::waitForSignal(&client, SIGNAL(statusHasChanged())); - QCOMPARE(client.status(), QDeclarativeDebugClient::Enabled); + QTRY_COMPARE(client.status(), QDeclarativeDebugClient::Enabled); } - QDeclarativeDebugTest::waitForSignal(&client, SIGNAL(statusHasChanged())); - QCOMPARE(client.status(), QDeclarativeDebugClient::Unavailable); + QTRY_COMPARE(client.status(), QDeclarativeDebugClient::Unavailable); // duplicate plugin name QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugClient: Conflicting plugin name \"tst_QDeclarativeDebugClient::status()\" "); @@ -135,7 +133,8 @@ void tst_QDeclarativeDebugClient::sendMessage() QByteArray msg = "hello!"; - QDeclarativeDebugTest::waitForSignal(&client, SIGNAL(statusHasChanged())); + QTRY_COMPARE(client.status(), QDeclarativeDebugClient::Enabled); + client.sendMessage(msg); QByteArray resp = client.waitForResponse(); QCOMPARE(resp, msg); diff --git a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp index 945823a..653515a 100644 --- a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp +++ b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp @@ -103,12 +103,12 @@ void tst_QDeclarativeDebugService::status() { QDeclarativeDebugTestClient client("tst_QDeclarativeDebugService::status()", m_conn); - QDeclarativeDebugTest::waitForSignal(&service, SIGNAL(statusHasChanged())); - QCOMPARE(service.status(), QDeclarativeDebugService::Enabled); + QTRY_COMPARE(client.status(), QDeclarativeDebugClient::Enabled); + QTRY_COMPARE(service.status(), QDeclarativeDebugService::Enabled); } - QDeclarativeDebugTest::waitForSignal(&service, SIGNAL(statusHasChanged())); - QCOMPARE(service.status(), QDeclarativeDebugService::Unavailable); + + QTRY_COMPARE(service.status(), QDeclarativeDebugService::Unavailable); QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugService: Conflicting plugin name \"tst_QDeclarativeDebugService::status()\" "); @@ -123,10 +123,8 @@ void tst_QDeclarativeDebugService::sendMessage() QByteArray msg = "hello!"; - if (service.status() != QDeclarativeDebugService::Enabled) - QDeclarativeDebugTest::waitForSignal(&service, SIGNAL(statusHasChanged())); - if (client.status() != QDeclarativeDebugClient::Enabled) - QDeclarativeDebugTest::waitForSignal(&client, SIGNAL(statusHasChanged())); + QTRY_COMPARE(client.status(), QDeclarativeDebugClient::Enabled); + QTRY_COMPARE(service.status(), QDeclarativeDebugService::Enabled); client.sendMessage(msg); QByteArray resp = client.waitForResponse(); -- cgit v0.12 From 5b2a4581bda34e20875402aac2a235fbee7e1222 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 30 Sep 2010 11:40:39 +0200 Subject: Revert "Fix (implement!) hfw/wfh in QGridLayoutEngine" This reverts commit 62b5ef3cc1306e46a4042b14867f2f92d9a110f3. The implementation of hfw from this patch is unfortunately not robust enough. It doesn't manage correctly the constraints on the layouts and the cell spans. It caused bad behaviour or regressions seen in tasks: QTBUG-13547, QTBUG-13067, QTBUG-13549, and more Reviewed-By: ogoffart (cherry picked from commit 5bd6f7eb5c7d87c08539b6c2df416990cc417ec7) --- src/gui/graphicsview/qgraphicslayoutitem.cpp | 51 +-- src/gui/graphicsview/qgraphicslayoutitem_p.h | 6 - src/gui/graphicsview/qgridlayoutengine.cpp | 251 +------------- src/gui/graphicsview/qgridlayoutengine_p.h | 23 +- .../tst_qgraphicsgridlayout.cpp | 364 +-------------------- 5 files changed, 17 insertions(+), 678 deletions(-) diff --git a/src/gui/graphicsview/qgraphicslayoutitem.cpp b/src/gui/graphicsview/qgraphicslayoutitem.cpp index 634f68c..ad4b2b5 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem.cpp +++ b/src/gui/graphicsview/qgraphicslayoutitem.cpp @@ -48,7 +48,6 @@ #include "qgraphicslayoutitem.h" #include "qgraphicslayoutitem_p.h" #include "qwidget.h" -#include "qgraphicswidget.h" #include @@ -140,11 +139,9 @@ QSizeF *QGraphicsLayoutItemPrivate::effectiveSizeHints(const QSizeF &constraint) if (!sizeHintCacheDirty && cachedConstraint == constraint) return cachedSizeHints; - const bool hasConstraint = constraint.width() >= 0 || constraint.height() >= 0; - for (int i = 0; i < Qt::NSizeHints; ++i) { cachedSizeHints[i] = constraint; - if (userSizeHints && !hasConstraint) + if (userSizeHints) combineSize(cachedSizeHints[i], userSizeHints[i]); } @@ -262,52 +259,6 @@ void QGraphicsLayoutItemPrivate::setSizeComponent( q->updateGeometry(); } - -bool QGraphicsLayoutItemPrivate::hasHeightForWidth() const -{ - Q_Q(const QGraphicsLayoutItem); - if (isLayout) { - const QGraphicsLayout *l = static_cast(q); - for (int i = l->count() - 1; i >= 0; --i) { - if (QGraphicsLayoutItemPrivate::get(l->itemAt(i))->hasHeightForWidth()) - return true; - } - } else if (QGraphicsItem *item = q->graphicsItem()) { - if (item->isWidget()) { - QGraphicsWidget *w = static_cast(item); - if (w->layout()) { - return QGraphicsLayoutItemPrivate::get(w->layout())->hasHeightForWidth(); - } - } - } - return q->sizePolicy().hasHeightForWidth(); -} - -bool QGraphicsLayoutItemPrivate::hasWidthForHeight() const -{ - // enable this code when we add QSizePolicy::hasWidthForHeight() (For 4.8) -#if 1 - return false; -#else - Q_Q(const QGraphicsLayoutItem); - if (isLayout) { - const QGraphicsLayout *l = static_cast(q); - for (int i = l->count() - 1; i >= 0; --i) { - if (QGraphicsLayoutItemPrivate::get(l->itemAt(i))->hasWidthForHeight()) - return true; - } - } else if (QGraphicsItem *item = q->graphicsItem()) { - if (item->isWidget()) { - QGraphicsWidget *w = static_cast(item); - if (w->layout()) { - return QGraphicsLayoutItemPrivate::get(w->layout())->hasWidthForHeight(); - } - } - } - return q->sizePolicy().hasWidthForHeight(); -#endif -} - /*! \class QGraphicsLayoutItem \brief The QGraphicsLayoutItem class can be inherited to allow your custom diff --git a/src/gui/graphicsview/qgraphicslayoutitem_p.h b/src/gui/graphicsview/qgraphicslayoutitem_p.h index b752e03..15cc7a5 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem_p.h +++ b/src/gui/graphicsview/qgraphicslayoutitem_p.h @@ -65,9 +65,6 @@ class Q_AUTOTEST_EXPORT QGraphicsLayoutItemPrivate public: virtual ~QGraphicsLayoutItemPrivate(); QGraphicsLayoutItemPrivate(QGraphicsLayoutItem *parent, bool isLayout); - static QGraphicsLayoutItemPrivate *get(QGraphicsLayoutItem *q) { return q->d_func();} - static const QGraphicsLayoutItemPrivate *get(const QGraphicsLayoutItem *q) { return q->d_func();} - void init(); QSizeF *effectiveSizeHints(const QSizeF &constraint) const; QGraphicsItem *parentItem() const; @@ -76,9 +73,6 @@ public: enum SizeComponent { Width, Height }; void setSizeComponent(Qt::SizeHint which, SizeComponent component, qreal value); - bool hasHeightForWidth() const; - bool hasWidthForHeight() const; - QSizePolicy sizePolicy; QGraphicsLayoutItem *parent; diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp index f3b2026..4fba5ff 100644 --- a/src/gui/graphicsview/qgridlayoutengine.cpp +++ b/src/gui/graphicsview/qgridlayoutengine.cpp @@ -546,24 +546,6 @@ QSizePolicy::Policy QGridLayoutItem::sizePolicy(Qt::Orientation orientation) con : sizePolicy.verticalPolicy(); } -/* - returns true if the size policy returns true for either hasHeightForWidth() - or hasWidthForHeight() - */ -bool QGridLayoutItem::hasDynamicConstraint() const -{ - return QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth() - || QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasWidthForHeight(); -} - -Qt::Orientation QGridLayoutItem::dynamicConstraintOrientation() const -{ - if (QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth()) - return Qt::Vertical; - else //if (QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasWidthForHeight()) - return Qt::Horizontal; -} - QSizePolicy::ControlTypes QGridLayoutItem::controlTypes(LayoutSide /* side */) const { return q_layoutItem->sizePolicy().controlType(); @@ -632,14 +614,7 @@ QRectF QGridLayoutItem::geometryWithin(qreal x, qreal y, qreal width, qreal heig qreal cellWidth = width; qreal cellHeight = height; - QSize constraint; - if (hasDynamicConstraint()) { - if (dynamicConstraintOrientation() == Qt::Vertical) - constraint.setWidth(cellWidth); - else - constraint.setHeight(cellHeight); - } - QSizeF size = effectiveMaxSize(constraint).boundedTo(QSizeF(cellWidth, cellHeight)); + QSizeF size = effectiveMaxSize().boundedTo(QSizeF(cellWidth, cellHeight)); width = size.width(); height = size.height(); @@ -701,13 +676,13 @@ void QGridLayoutItem::insertOrRemoveRows(int row, int delta, Qt::Orientation ori Note that effectiveSizeHint does not take sizePolicy into consideration, (since it only evaluates the hints, as the name implies) */ -QSizeF QGridLayoutItem::effectiveMaxSize(const QSizeF &constraint) const +QSizeF QGridLayoutItem::effectiveMaxSize() const { - QSizeF size = constraint; + QSizeF size; bool vGrow = (sizePolicy(Qt::Vertical) & QSizePolicy::GrowFlag) == QSizePolicy::GrowFlag; bool hGrow = (sizePolicy(Qt::Horizontal) & QSizePolicy::GrowFlag) == QSizePolicy::GrowFlag; if (!vGrow || !hGrow) { - QSizeF pref = layoutItem()->effectiveSizeHint(Qt::PreferredSize, constraint); + QSizeF pref = layoutItem()->effectiveSizeHint(Qt::PreferredSize); if (!vGrow) size.setHeight(pref.height()); if (!hGrow) @@ -715,7 +690,7 @@ QSizeF QGridLayoutItem::effectiveMaxSize(const QSizeF &constraint) const } if (!size.isValid()) { - QSizeF maxSize = layoutItem()->effectiveSizeHint(Qt::MaximumSize, constraint); + QSizeF maxSize = layoutItem()->effectiveSizeHint(Qt::MaximumSize); if (size.width() == -1) size.setWidth(maxSize.width()); if (size.height() == -1) @@ -1036,7 +1011,6 @@ void QGridLayoutEngine::invalidate() q_cachedEffectiveLastRows[Ver] = -1; q_cachedDataForStyleInfo.invalidate(); q_cachedSize = QSizeF(); - q_cachedConstraintOrientation = UnknownConstraint; } static void visualRect(QRectF *geom, Qt::LayoutDirection dir, const QRectF &contentsRect) @@ -1101,13 +1075,10 @@ QRectF QGridLayoutEngine::cellRect(const QLayoutStyleInfo &styleInfo, } QSizeF QGridLayoutEngine::sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHint which, - const QSizeF &constraint) const + const QSizeF & /* constraint */) const { ensureColumnAndRowData(styleInfo); - if (hasDynamicConstraint()) - return dynamicallyConstrainedSizeHint(which, constraint); - switch (which) { case Qt::MinimumSize: return QSizeF(q_totalBoxes[Hor].q_minimumSize, q_totalBoxes[Ver].q_minimumSize); @@ -1405,11 +1376,7 @@ void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData, const QLayoutSt box = &multiCell.q_box; multiCell.q_stretch = itemStretch; } - // Items with constraints are not included in the orientation that - // they are constrained (since it depends on the hfw/constraint function). - // They must be combined at a later stage. - if (!item->hasDynamicConstraint() || orientation != item->dynamicConstraintOrientation()) - box->combine(item->box(orientation)); + box->combine(item->box(orientation)); if (effectiveRowSpan == 1) { QSizePolicy::ControlTypes controls = item->controlTypes(top); @@ -1566,138 +1533,6 @@ void QGridLayoutEngine::ensureColumnAndRowData(const QLayoutStyleInfo &styleInfo q_cachedDataForStyleInfo = styleInfo; } -QSizeF QGridLayoutEngine::dynamicallyConstrainedSizeHint(Qt::SizeHint which, - const QSizeF &constraint) const -{ - Q_ASSERT(hasDynamicConstraint()); - if (constraint.width() < 0 && constraint.height() < 0) { - // Process the hfw / wfh items that we did not process in fillRowData() - const Qt::Orientation constraintOrient = constraintOrientation(); - - QGridLayoutRowData rowData = constraintOrient == Qt::Vertical ? q_rowData : q_columnData; - for (int i = q_items.count() - 1; i >= 0; --i) { - QGridLayoutItem *item = q_items.at(i); - if (item->hasDynamicConstraint()) { - QGridLayoutBox box = item->box(constraintOrient); - QGridLayoutBox &rowBox = rowData.boxes[item->firstRow(constraintOrient)]; - rowBox.combine(box); - } - } - - QGridLayoutBox totalBoxes[2]; - if (constraintOrient == Qt::Vertical) { - totalBoxes[Hor] = q_columnData.totalBox(0, columnCount()); - totalBoxes[Ver] = rowData.totalBox(0, rowCount()); - } else { - totalBoxes[Hor] = rowData.totalBox(0, columnCount()); - totalBoxes[Ver] = q_rowData.totalBox(0, rowCount()); - } - return QSizeF(totalBoxes[Hor].q_sizes(which), totalBoxes[Ver].q_sizes(which)); - } - - - Q_ASSERT(constraint.width() >= 0 || constraint.height() >= 0); - q_xx.resize(columnCount()); - q_yy.resize(rowCount()); - q_widths.resize(columnCount()); - q_heights.resize(rowCount()); - q_descents.resize(rowCount()); - - - const Qt::Orientation orientation = constraintOrientation(); - QGridLayoutRowData *colData; - QGridLayoutRowData constrainedRowData; - QGridLayoutBox *totalBox; - qreal *sizes; - qreal *pos; - qreal *descents; - qreal targetSize; - qreal cCount; - qreal rCount; - - if (orientation == Qt::Vertical) { - // height for width - colData = &q_columnData; - totalBox = &q_totalBoxes[Hor]; - sizes = q_widths.data(); - pos = q_xx.data(); - descents = 0; - targetSize = constraint.width(); - cCount = columnCount(); - rCount = rowCount(); - constrainedRowData = q_rowData; - } else { - // width for height - colData = &q_rowData; - totalBox = &q_totalBoxes[Ver]; - sizes = q_heights.data(); - pos = q_yy.data(); - descents = q_descents.data(); - targetSize = constraint.height(); - cCount = rowCount(); - rCount = columnCount(); - constrainedRowData = q_columnData; - } - colData->calculateGeometries(0, cCount, targetSize, pos, sizes, descents, *totalBox); - for (int i = q_items.count() - 1; i >= 0; --i) { - QGridLayoutItem *item = q_items.at(i); - - if (item->hasDynamicConstraint()) { - const qreal size = sizes[item->firstColumn(orientation)]; - QGridLayoutBox box = item->box(orientation, size); - QGridLayoutBox &rowBox = constrainedRowData.boxes[item->firstRow(orientation)]; - rowBox.combine(box); - } - } - const qreal newSize = constrainedRowData.totalBox(0, rCount).q_sizes(which); - - return (orientation == Qt::Vertical) ? QSizeF(targetSize, newSize) : QSizeF(newSize, targetSize); -} - - -/** - returns false if the layout has contradicting constraints (i.e. some items with a horizontal - constraint and other items with a vertical constraint) - */ -bool QGridLayoutEngine::ensureDynamicConstraint() const -{ - if (q_cachedConstraintOrientation == UnknownConstraint) { - for (int i = q_items.count() - 1; i >= 0; --i) { - QGridLayoutItem *item = q_items.at(i); - if (item->hasDynamicConstraint()) { - Qt::Orientation itemConstraintOrientation = item->dynamicConstraintOrientation(); - if (q_cachedConstraintOrientation == UnknownConstraint) { - q_cachedConstraintOrientation = itemConstraintOrientation; - } else if (q_cachedConstraintOrientation != itemConstraintOrientation) { - q_cachedConstraintOrientation = UnfeasibleConstraint; - qWarning("QGridLayoutEngine: Unfeasible, cannot mix horizontal and" - " vertical constraint in the same layout"); - return false; - } - } - } - if (q_cachedConstraintOrientation == UnknownConstraint) - q_cachedConstraintOrientation = NoConstraint; - } - return true; -} - -bool QGridLayoutEngine::hasDynamicConstraint() const -{ - if (!ensureDynamicConstraint()) - return false; - return q_cachedConstraintOrientation != NoConstraint; -} - -/* - * return value is only valid if hasConstraint() returns true - */ -Qt::Orientation QGridLayoutEngine::constraintOrientation() const -{ - (void)ensureDynamicConstraint(); - return (Qt::Orientation)q_cachedConstraintOrientation; -} - void QGridLayoutEngine::ensureGeometries(const QLayoutStyleInfo &styleInfo, const QSizeF &size) const { @@ -1710,74 +1545,10 @@ void QGridLayoutEngine::ensureGeometries(const QLayoutStyleInfo &styleInfo, q_widths.resize(columnCount()); q_heights.resize(rowCount()); q_descents.resize(rowCount()); - - - Qt::Orientation orientation = Qt::Vertical; - if (hasDynamicConstraint()) - orientation = constraintOrientation(); - - /* - In order to do hfw we need to first distribute the columns, then the rows. - In order to do wfh we need to first distribute the rows, then the columns. - - If there is no constraint, the order of distributing the rows or columns first is irrelevant. - We choose horizontal just to keep the same behaviour as before (however, there shouldn't - be any behaviour difference). - */ - - QGridLayoutRowData *colData; - QGridLayoutRowData rowData; - qreal *widths; - qreal *heights; - qreal *xx; - qreal *yy; - qreal *xdescents = 0; - qreal *ydescents = 0; - qreal cCount; - qreal rCount; - QSizeF oSize = size; - if (orientation == Qt::Vertical) { - // height for width - colData = &q_columnData; - rowData = q_rowData; - widths = q_widths.data(); - heights = q_heights.data(); - xx = q_xx.data(); - yy = q_yy.data(); - cCount = columnCount(); - rCount = rowCount(); - ydescents = q_descents.data(); - } else { - // width for height - colData = &q_rowData; - rowData = q_columnData; - widths = q_heights.data(); - heights = q_widths.data(); - xx = q_yy.data(); - yy = q_xx.data(); - cCount = rowCount(); - rCount = columnCount(); - xdescents = q_descents.data(); - oSize.transpose(); - } - - colData->calculateGeometries(0, cCount, oSize.width(), xx, widths, - xdescents, q_totalBoxes[orientation == Qt::Horizontal]); - for (int i = q_items.count() - 1; i >= 0; --i) { - QGridLayoutItem *item = q_items.at(i); - const int col = item->firstColumn(orientation); - const int row = item->firstRow(orientation); - if (item->hasDynamicConstraint()) { - const qreal sz = widths[col]; - QGridLayoutBox box = item->box(orientation, sz); - rowData.boxes[row].combine(box); - } - } - - QGridLayoutBox &totalBox = q_totalBoxes[orientation == Qt::Vertical]; - totalBox = rowData.totalBox(0, rCount); - rowData.calculateGeometries(0, rCount, oSize.height(), yy, heights, - ydescents, totalBox); + q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(), + 0, q_totalBoxes[Hor]); + q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(), + q_descents.data(), q_totalBoxes[Ver]); q_cachedSize = size; } diff --git a/src/gui/graphicsview/qgridlayoutengine_p.h b/src/gui/graphicsview/qgridlayoutengine_p.h index 580af7e..9ac9a8e 100644 --- a/src/gui/graphicsview/qgridlayoutengine_p.h +++ b/src/gui/graphicsview/qgridlayoutengine_p.h @@ -91,14 +91,6 @@ enum LayoutSide { Bottom }; -enum { - NoConstraint, - HorizontalConstraint, - VerticalConstraint, - UnknownConstraint, // need to update cache - UnfeasibleConstraint // not feasible, it be has some items with Vertical and others with Horizontal constraints -}; - template class QLayoutParameter { @@ -278,10 +270,6 @@ public: inline void setAlignment(Qt::Alignment alignment) { q_alignment = alignment; } QSizePolicy::Policy sizePolicy(Qt::Orientation orientation) const; - - bool hasDynamicConstraint() const; - Qt::Orientation dynamicConstraintOrientation() const; - QSizePolicy::ControlTypes controlTypes(LayoutSide side) const; QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; QGridLayoutBox box(Qt::Orientation orientation, qreal constraint = -1.0) const; @@ -292,7 +280,7 @@ public: void setGeometry(const QRectF &rect); void transpose(); void insertOrRemoveRows(int row, int delta, Qt::Orientation orientation = Qt::Vertical); - QSizeF effectiveMaxSize(const QSizeF &constraint) const; + QSizeF effectiveMaxSize() const; #ifdef QT_DEBUG void dump(int indent = 0) const; @@ -384,14 +372,6 @@ public: int column, int rowSpan, int columnSpan) const; QSizeF sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHint which, const QSizeF &constraint) const; - - // heightForWidth / widthForHeight support - QSizeF dynamicallyConstrainedSizeHint(Qt::SizeHint which, const QSizeF &constraint) const; - bool ensureDynamicConstraint() const; - bool hasDynamicConstraint() const; - Qt::Orientation constraintOrientation() const; - - QSizePolicy::ControlTypes controlTypes(LayoutSide side) const; void transpose(); void setVisualDirection(Qt::LayoutDirection direction); @@ -425,7 +405,6 @@ private: // Lazily computed from the above user input mutable int q_cachedEffectiveFirstRows[NOrientations]; mutable int q_cachedEffectiveLastRows[NOrientations]; - mutable quint8 q_cachedConstraintOrientation : 2; // Layout item input mutable QLayoutStyleInfo q_cachedDataForStyleInfo; diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp index 03c1d5b..5b03767 100644 --- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp +++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp @@ -107,13 +107,12 @@ private slots: void avoidRecursionInInsertItem(); void styleInfoLeak(); void task236367_maxSizeHint(); - void heightForWidth(); }; class RectWidget : public QGraphicsWidget { public: - RectWidget(QGraphicsItem *parent = 0) : QGraphicsWidget(parent), m_fnConstraint(0) {} + RectWidget(QGraphicsItem *parent = 0) : QGraphicsWidget(parent){} void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { @@ -126,12 +125,9 @@ public: QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const { - if (constraint.width() < 0 && constraint.height() < 0 && m_sizeHints[which].isValid()) { + if (m_sizeHints[which].isValid()) { return m_sizeHints[which]; } - if (m_fnConstraint) { - return m_fnConstraint(which, constraint); - } return QGraphicsWidget::sizeHint(which, constraint); } @@ -140,13 +136,7 @@ public: updateGeometry(); } - void setConstraintFunction(QSizeF (*fnConstraint)(Qt::SizeHint, const QSizeF &)) { - m_fnConstraint = fnConstraint; - } - QSizeF m_sizeHints[Qt::NSizeHints]; - QSizeF (*m_fnConstraint)(Qt::SizeHint, const QSizeF &); - }; struct ItemDesc @@ -156,8 +146,7 @@ struct ItemDesc m_rowSpan(1), m_colSpan(1), m_sizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred)), - m_align(0), - m_fnConstraint(0) + m_align(0) { } @@ -224,20 +213,8 @@ struct ItemDesc return (*this); } - ItemDesc &heightForWidth(QSizeF (*fnConstraint)(Qt::SizeHint, const QSizeF &)) { - m_fnConstraint = fnConstraint; - m_constraintOrientation = Qt::Vertical; - return (*this); - } - void apply(QGraphicsGridLayout *layout, QGraphicsWidget *item) { - QSizePolicy sp = m_sizePolicy; - if (m_fnConstraint) { - sp.setHeightForWidth(m_constraintOrientation == Qt::Vertical); - //sp.setWidthForHeight(m_constraintOrientation == Qt::Horizontal); - } - - item->setSizePolicy(sp); + item->setSizePolicy(m_sizePolicy); for (int i = 0; i < Qt::NSizeHints; ++i) { if (!m_sizes[i].isValid()) continue; @@ -256,7 +233,6 @@ struct ItemDesc break; } } - layout->addItem(item, m_pos.first, m_pos.second, m_rowSpan, m_colSpan); layout->setAlignment(item, m_align); } @@ -264,7 +240,6 @@ struct ItemDesc void apply(QGraphicsGridLayout *layout, RectWidget *item) { for (int i = 0; i < Qt::NSizeHints; ++i) item->setSizeHint((Qt::SizeHint)i, m_sizeHints[i]); - item->setConstraintFunction(m_fnConstraint); apply(layout, static_cast(item)); } @@ -276,9 +251,6 @@ struct ItemDesc QSizeF m_sizeHints[Qt::NSizeHints]; QSizeF m_sizes[Qt::NSizeHints]; Qt::Alignment m_align; - - Qt::Orientation m_constraintOrientation; - QSizeF (*m_fnConstraint)(Qt::SizeHint, const QSizeF &); }; typedef QList ItemList; @@ -2144,17 +2116,6 @@ void tst_QGraphicsGridLayout::alignment2() delete widget; } -static QSizeF hfw1(Qt::SizeHint, const QSizeF &constraint) -{ - QSizeF result(constraint); - if (constraint.width() < 0 && constraint.height() < 0) { - return QSizeF(50, 400); - } else if (constraint.width() >= 0) { - result.setHeight(20000./constraint.width()); - } - return result; -} - void tst_QGraphicsGridLayout::geometries_data() { @@ -2184,186 +2145,6 @@ void tst_QGraphicsGridLayout::geometries_data() << QRectF(0, 0, 60,10) << QRectF(0, 10, 60,10) ); - // change layout height and verify - QTest::newRow("hfw-h401") << (ItemList() - << ItemDesc(0,0) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(0,1) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(1,0) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(1,1) - .minSize(QSizeF(40,40)) - .preferredSize(QSizeF(50,400)) - .maxSize(QSizeF(500, 500)) - .heightForWidth(hfw1) - ) - << QSizeF(100, 401) - << (RectList() - << QRectF(0, 0, 50, 1) << QRectF(50, 0, 50, 1) - << QRectF(0, 1, 50,100) << QRectF(50, 1, 50,400) - ); - - - QTest::newRow("hfw-h408") << (ItemList() - << ItemDesc(0,0) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(0,1) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(1,0) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(1,1) - .minSize(QSizeF(40,40)) - .preferredSize(QSizeF(50,400)) - .maxSize(QSizeF(500, 500)) - .heightForWidth(hfw1) - ) - << QSizeF(100, 408) - << (RectList() - << QRectF(0, 0, 50, 8) << QRectF(50, 0, 50, 8) - << QRectF(0, 8, 50,100) << QRectF(50, 8, 50,400) - ); - - QTest::newRow("hfw-h410") << (ItemList() - << ItemDesc(0,0) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(0,1) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(1,0) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(1,1) - .minSize(QSizeF(40,40)) - .preferredSize(QSizeF(50,400)) - .maxSize(QSizeF(500, 500)) - .heightForWidth(hfw1) - ) - << QSizeF(100, 410) - << (RectList() - << QRectF(0, 0, 50,10) << QRectF(50, 0, 50,10) - << QRectF(0, 10, 50,100) << QRectF(50, 10, 50,400) - ); - - QTest::newRow("hfw-h470") << (ItemList() - << ItemDesc(0,0) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(0,1) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(1,0) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(1,1) - .minSize(QSizeF(40,40)) - .preferredSize(QSizeF(50,400)) - .maxSize(QSizeF(500, 500)) - .heightForWidth(hfw1) - ) - << QSizeF(100, 470) - << (RectList() - << QRectF(0, 0, 50,70) << QRectF(50, 0, 50,70) - << QRectF(0, 70, 50,100) << QRectF(50, 70, 50,400) - ); - - - // change layout width and verify - QTest::newRow("hfw-w100") << (ItemList() - << ItemDesc(0,0) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(0,1) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(1,0) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(1,1) - .minSize(QSizeF(40,40)) - .preferredSize(QSizeF(50,400)) - .maxSize(QSizeF(5000, 5000)) - .heightForWidth(hfw1) - ) - << QSizeF(100, 401) - << (RectList() - << QRectF( 0, 0, 50, 1) << QRectF( 50, 0, 50, 1) - << QRectF( 0, 1, 50, 100) << QRectF( 50, 1, 50, 400) - ); - - QTest::newRow("hfw-w160") << (ItemList() - << ItemDesc(0,0) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(0,1) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(1,0) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(1,1) - .minSize(QSizeF(40,40)) - .preferredSize(QSizeF(50,400)) - .maxSize(QSizeF(5000, 5000)) - .heightForWidth(hfw1) - ) - << QSizeF(160, 401) - << (RectList() - << QRectF( 0, 0, 80, 100) << QRectF( 80, 0, 80, 100) - << QRectF( 0, 100, 80, 100) << QRectF( 80, 100, 80, 250) - ); - - - QTest::newRow("hfw-w500") << (ItemList() - << ItemDesc(0,0) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(0,1) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(1,0) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(1,1) - .minSize(QSizeF(40,40)) - .preferredSize(QSizeF(50,400)) - .maxSize(QSizeF(5000, 5000)) - .heightForWidth(hfw1) - ) - << QSizeF(500, 401) - << (RectList() - << QRectF( 0, 0, 100, 100) << QRectF(100, 0, 100, 100) - << QRectF( 0, 100, 100, 100) << QRectF(100, 100, 400, 50) - ); - } void tst_QGraphicsGridLayout::geometries() @@ -2434,143 +2215,6 @@ void tst_QGraphicsGridLayout::task236367_maxSizeHint() QCOMPARE(widget->size(), QSizeF(w, h)); } -/* -static qreal hfw(qreal w) -{ - if (w == 0) - return 20000; - return 20000/w; -} -*/ -static QSizeF hfw(Qt::SizeHint /*which*/, const QSizeF &constraint) -{ - QSizeF result(constraint); - const qreal cw = constraint.width(); - const qreal ch = constraint.height(); - if (cw < 0 && ch < 0) { - return QSizeF(200, 100); - } else if (cw >= 0) { - result.setHeight(20000./cw); - } else if (cw == 0) { - result.setHeight(20000); - } else if (ch >= 0) { - result.setWidth(20000./ch); - } else if (ch == 0) { - result.setWidth(20000); - } - - return result; -} - -static qreal growthFactorBelowPreferredSize(qreal desired, qreal sumAvailable, qreal sumDesired) -{ - Q_ASSERT(sumDesired != 0.0); - return desired * qPow(sumAvailable / sumDesired, desired / sumDesired); -} - -static void expectedWidth(qreal minSize1, qreal prefSize1, - qreal minSize2, qreal prefSize2, - qreal targetSize, qreal *width1, qreal *width2) -{ - qreal sumAvail,factor1,factor2; - // stretch behaviour is different below and above preferred size... - if (targetSize < prefSize1 + prefSize2) { - sumAvail = targetSize - minSize1 - minSize2; - const qreal desired1 = prefSize1 - minSize1; - const qreal desired2 = prefSize2 - minSize2; - const qreal sumDesired = desired1 + desired2; - factor1 = growthFactorBelowPreferredSize(desired1, sumAvail, sumDesired); - factor2 = growthFactorBelowPreferredSize(desired2, sumAvail, sumDesired); - const qreal sumFactors = factor1 + factor2; - *width1 = sumAvail*factor1/sumFactors + minSize1; - *width2 = sumAvail*factor2/sumFactors + minSize2; - } else { - sumAvail = targetSize - prefSize1 - prefSize2; - factor1 = prefSize1; - factor2 = prefSize2; - const qreal sumFactors = factor1 + factor2; - *width1 = sumAvail*factor1/sumFactors + prefSize1; - *width2 = sumAvail*factor2/sumFactors + prefSize2; - } -} - - -bool qFuzzyCompare(const QSizeF &a, const QSizeF &b) -{ - return qFuzzyCompare(a.width(), b.width()) && qFuzzyCompare(a.height(), b.height()); -} - -void tst_QGraphicsGridLayout::heightForWidth() -{ - QGraphicsWidget *widget = new QGraphicsWidget; - QGraphicsGridLayout *layout = new QGraphicsGridLayout; - widget->setLayout(layout); - layout->setContentsMargins(0, 0, 0, 0); - layout->setSpacing(0); - RectWidget *w00 = new RectWidget; - w00->setSizeHint(Qt::MinimumSize, QSizeF(1,1)); - w00->setSizeHint(Qt::PreferredSize, QSizeF(10,10)); - w00->setSizeHint(Qt::MaximumSize, QSizeF(100,100)); - layout->addItem(w00, 0, 0); - - RectWidget *w01 = new RectWidget; - w01->setSizeHint(Qt::MinimumSize, QSizeF(1,1)); - w01->setSizeHint(Qt::PreferredSize, QSizeF(10,10)); - w01->setSizeHint(Qt::MaximumSize, QSizeF(100,100)); - layout->addItem(w01, 0, 1); - - RectWidget *w10 = new RectWidget; - w10->setSizeHint(Qt::MinimumSize, QSizeF(1,1)); - w10->setSizeHint(Qt::PreferredSize, QSizeF(10,10)); - w10->setSizeHint(Qt::MaximumSize, QSizeF(100,100)); - layout->addItem(w10, 1, 0); - - RectWidget *w11 = new RectWidget; - w11->setSizeHint(Qt::MinimumSize, QSizeF(1,1)); - w11->setSizeHint(Qt::MaximumSize, QSizeF(30000,30000)); - w11->setConstraintFunction(hfw); - QSizePolicy sp(QSizePolicy::Preferred, QSizePolicy::Preferred); - sp.setHeightForWidth(true); - w11->setSizePolicy(sp); - layout->addItem(w11, 1, 1); - - QSizeF prefSize = layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(-1, -1)); - QCOMPARE(prefSize, QSizeF(10+200, 10+100)); - - QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(2, -1)), QSizeF(2, 20001)); - QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(2, -1)), QSizeF(2, 20010)); - QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(2, -1)), QSizeF(2, 20100)); - qreal width1; - qreal width2; - expectedWidth(1, 10, 1, 200, 20, &width1, &width2); - QSizeF expectedSize = hfw(Qt::MinimumSize, QSizeF(width2, -1)) + QSizeF(width1, 1); - QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(20, -1)), expectedSize); - expectedSize.rheight()+=9; - QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(20, -1)), expectedSize); - expectedSize.rheight()+=90; - QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(20, -1)), expectedSize); - - expectedWidth(1, 10, 1, 200, 300, &width1, &width2); - expectedSize = hfw(Qt::MinimumSize, QSizeF(width2, -1)) + QSizeF(width1, 1); - QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(300, -1)), expectedSize); - expectedSize.rheight()+=9; - QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(300, -1)), expectedSize); - // the height of the hfw widget is shorter than the one to the left, which is 100, so - // the total height of the last row is 100 (which leaves the layout height to be 200) - QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(300, -1)), QSizeF(300, 200)); - - // the hfw item is shorter than the item to the left - expectedWidth(1, 10, 1, 200, 500, &width1, &width2); - expectedSize = hfw(Qt::MinimumSize, QSizeF(width2, -1)) + QSizeF(width1, 1); - QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(500, -1)), expectedSize); - expectedSize.rheight()+=9; - QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(500, -1)), expectedSize); - // the height of the hfw widget is shorter than the one to the left, which is 100, so - // the total height of the last row is 100 (which leaves the layout height to be 200) - QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(500, -1)), QSizeF(500, 200)); - -} - QTEST_MAIN(tst_QGraphicsGridLayout) #include "tst_qgraphicsgridlayout.moc" -- cgit v0.12 From 8683e35e958fe5363e6ebc22f76042525151a40b Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Wed, 29 Sep 2010 18:41:38 +0200 Subject: Fixed parsing of SVGs with absolute font sizes. Task-number: QTBUG-14070 Reviewed-by: Gunnar (cherry picked from commit 4cd4160d85dc1e158a545422cac895792b14eda6) --- src/svg/qsvghandler.cpp | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index bf19a88..c17ca7a 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -1282,8 +1282,39 @@ static void parseFont(QSvgNode *node, fontStyle->setFamily(attributes.fontFamily.toString().trimmed()); if (!attributes.fontSize.isEmpty() && attributes.fontSize != QT_INHERIT) { + // TODO: Support relative sizes 'larger' and 'smaller'. QSvgHandler::LengthType dummy; // should always be pixel size - fontStyle->setSize(parseLength(attributes.fontSize.toString(), dummy, handler)); + qreal size = 0; + static const qreal sizeTable[] = { qreal(6.9), qreal(8.3), qreal(10.0), qreal(12.0), qreal(14.4), qreal(17.3), qreal(20.7) }; + enum AbsFontSize { XXSmall, XSmall, Small, Medium, Large, XLarge, XXLarge }; + switch (attributes.fontSize.at(0).unicode()) { + case 'x': + if (attributes.fontSize == QLatin1String("xx-small")) + size = sizeTable[XXSmall]; + else if (attributes.fontSize == QLatin1String("x-small")) + size = sizeTable[XSmall]; + else if (attributes.fontSize == QLatin1String("x-large")) + size = sizeTable[XLarge]; + else if (attributes.fontSize == QLatin1String("xx-large")) + size = sizeTable[XXLarge]; + break; + case 's': + if (attributes.fontSize == QLatin1String("small")) + size = sizeTable[Small]; + break; + case 'm': + if (attributes.fontSize == QLatin1String("medium")) + size = sizeTable[Medium]; + break; + case 'l': + if (attributes.fontSize == QLatin1String("large")) + size = sizeTable[Large]; + break; + default: + size = parseLength(attributes.fontSize.toString(), dummy, handler); + break; + } + fontStyle->setSize(size); } if (!attributes.fontStyle.isEmpty() && attributes.fontStyle != QT_INHERIT) { -- cgit v0.12 From 6c53410d8104064b53beccb1f2014c980735aefb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 27 Sep 2010 13:02:47 +0200 Subject: Fixed performance regression in curve stroking. Change c46688b8a88da made us use m_curve_threshold for both QBezier::shifted and QBezier::toPolygon, and adjusted the threshold dynamically based on the painter scale. Since the threshold in shifted was already relative to the pen width, it is independent from the painter scale. Instead, we need to set a separate threshold for dashing. Also, in several places we were calling setCurveThresholdForTransform with the painter matrix even though we were transforming the points into device coordinate space before stroking. Task-number: QTBUG-13894 Reviewed-by: Gunnar Sletta (cherry picked from commit d60dc7cba21794866c9382f83080fab1a129eb08) --- src/gui/painting/qpaintengineex.cpp | 2 +- src/gui/painting/qstroker.cpp | 9 +++++---- src/gui/painting/qstroker_p.h | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 1e857e4..c1e3d66 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -517,7 +517,7 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) QPainterPath painterPath = state()->matrix.map(path.convertToPainterPath()); d->activeStroker->strokePath(painterPath, d->strokeHandler, QTransform()); } else { - d->activeStroker->setCurveThresholdFromTransform(state()->matrix); + d->activeStroker->setCurveThresholdFromTransform(QTransform()); d->activeStroker->begin(d->strokeHandler); if (types) { while (points < lastPoint) { diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp index 9cff339..9decf41 100644 --- a/src/gui/painting/qstroker.cpp +++ b/src/gui/painting/qstroker.cpp @@ -190,6 +190,7 @@ static inline qreal adapted_angle_on_x(const QLineF &line) QStrokerOps::QStrokerOps() : m_elements(0) , m_curveThreshold(qt_real_to_fixed(0.25)) + , m_dashThreshold(qt_real_to_fixed(0.25)) , m_customData(0) , m_moveTo(0) , m_lineTo(0) @@ -243,7 +244,7 @@ void QStrokerOps::strokePath(const QPainterPath &path, void *customData, const Q if (path.isEmpty()) return; - setCurveThresholdFromTransform(matrix); + setCurveThresholdFromTransform(QTransform()); begin(customData); int count = path.elementCount(); if (matrix.isIdentity()) { @@ -315,7 +316,7 @@ void QStrokerOps::strokePolygon(const QPointF *points, int pointCount, bool impl if (!pointCount) return; - setCurveThresholdFromTransform(matrix); + setCurveThresholdFromTransform(QTransform()); begin(data); if (matrix.isIdentity()) { moveTo(qt_real_to_fixed(points[0].x()), qt_real_to_fixed(points[0].y())); @@ -356,7 +357,7 @@ void QStrokerOps::strokeEllipse(const QRectF &rect, void *data, const QTransform } } - setCurveThresholdFromTransform(matrix); + setCurveThresholdFromTransform(QTransform()); begin(data); moveTo(qt_real_to_fixed(start.x()), qt_real_to_fixed(start.y())); for (int i=0; i<12; i+=3) { @@ -1142,7 +1143,7 @@ void QDashStroker::processCurrentSubpath() QPainterPath dashPath; - QSubpathFlatIterator it(&m_elements, m_curveThreshold); + QSubpathFlatIterator it(&m_elements, m_dashThreshold); qfixed2d prev = it.next(); bool clipping = !m_clip_rect.isEmpty(); diff --git a/src/gui/painting/qstroker_p.h b/src/gui/painting/qstroker_p.h index d646135..5607a8e 100644 --- a/src/gui/painting/qstroker_p.h +++ b/src/gui/painting/qstroker_p.h @@ -168,7 +168,7 @@ public: { qreal scale; qt_scaleForTransform(transform, &scale); - setCurveThreshold(scale == 0 ? qreal(0.5) : (qreal(0.5) / scale)); + m_dashThreshold = scale == 0 ? qreal(0.5) : (qreal(0.5) / scale); } void setCurveThreshold(qfixed threshold) { m_curveThreshold = threshold; } @@ -184,6 +184,7 @@ protected: QRectF m_clip_rect; qfixed m_curveThreshold; + qfixed m_dashThreshold; void *m_customData; qStrokerMoveToHook m_moveTo; -- cgit v0.12 From acc1dc498ea733bab2a1f5ef9983829adbbf5735 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 29 Sep 2010 12:56:38 +0200 Subject: Fix double painting when adding an item into a linear layout the problem was that the item is first painted at its default position, then moved by the layout and finally repainted. We now made sure the item is laid out before the first paint event occurs. Task-number: QTBUG-13865 Reviewed-by: bnilsen (cherry picked from commit 33f525e636ef8fa64a15d3e66c56adaea0075bda) --- src/gui/graphicsview/qgraphicslinearlayout.cpp | 8 +++-- tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp | 40 ++++++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicslinearlayout.cpp b/src/gui/graphicsview/qgraphicslinearlayout.cpp index 1588364..7e8d19f 100644 --- a/src/gui/graphicsview/qgraphicslinearlayout.cpp +++ b/src/gui/graphicsview/qgraphicslinearlayout.cpp @@ -275,13 +275,17 @@ void QGraphicsLinearLayout::insertItem(int index, QGraphicsLayoutItem *item) qWarning("QGraphicsLinearLayout::insertItem: cannot insert itself"); return; } + Q_ASSERT(item); + + //the order of the following instructions is very important because + //invalidating the layout before adding the child item will make the layout happen + //before we try to paint the item + invalidate(); d->addChildLayoutItem(item); - Q_ASSERT(item); d->fixIndex(&index); d->engine.insertRow(index, d->orientation); new QGridLayoutItem(&d->engine, item, d->gridRow(index), d->gridColumn(index), 1, 1, 0, index); - invalidate(); } /*! diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index ddc4f73..7f24ddc 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -184,6 +184,7 @@ private slots: void task250119_shortcutContext(); void QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems(); void QT_BUG_12056_tabFocusFirstUnsetWhenRemovingItems(); + void QT_BUG_13865_doublePaintWhenAddingASubItem(); }; @@ -3321,6 +3322,45 @@ void tst_QGraphicsWidget::QT_BUG_12056_tabFocusFirstUnsetWhenRemovingItems() //This should not crash } + +struct GreenWidget : public QGraphicsWidget +{ + GreenWidget() : count(0) + { + } + + void paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * ) + { + count++; + painter->setPen(Qt::green); + painter->drawRect(option->rect.adjusted(0,0,-1,-1)); + } + + int count; +}; + +void tst_QGraphicsWidget::QT_BUG_13865_doublePaintWhenAddingASubItem() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + QGraphicsWidget *widget = new QGraphicsWidget; + widget->resize(100, 100); + scene.addItem(widget); + QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(widget); + + view.show(); + QTest::qWaitForWindowShown(&view); + + + GreenWidget *sub = new GreenWidget; + layout->addItem(sub); + + QTest::qWait(100); + QCOMPARE(sub->count, 1); //it should only be painted once + +} + + QTEST_MAIN(tst_QGraphicsWidget) #include "tst_qgraphicswidget.moc" -- cgit v0.12 From a808b5e596bdd2a0f9801e4acf726066d7b9aafd Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 27 Sep 2010 11:39:05 +0200 Subject: Doc update for the support of MSVC 2010 64-bit MS has released a hotfix for the support of MSVC 2010 64-bit. It fixes the optimizer that could generate code that crashes. Reviewed-by: Trust-Me Task-number: QTBUG-11445 (cherry picked from commit ce2a273bab9b9094a1f0f3f60309797e11e59404) --- doc/src/platforms/compiler-notes.qdoc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/src/platforms/compiler-notes.qdoc b/doc/src/platforms/compiler-notes.qdoc index 3870e8f..bcf7cb4 100644 --- a/doc/src/platforms/compiler-notes.qdoc +++ b/doc/src/platforms/compiler-notes.qdoc @@ -267,8 +267,9 @@ for more information. There currently is a problem when compiling Qt with Visual Studio 2010 for 64-bit. - Its optimizer causes trouble and crashes for the release builds and it is not supported - in that configuration. See task http://bugreports.qt.nokia.com/browse/QTBUG-11445. + Its optimizer causes trouble and generates code that crashes for the release builds. + To avoid the crashes, You need to apply the hotfix in the following article + http://support.microsoft.com/kb/2280741. \section1 IBM xlC (AIX) -- cgit v0.12 From 9dc4889b8ae8c598a671c0fab3b71cf128cd7311 Mon Sep 17 00:00:00 2001 From: Leandro Melo Date: Thu, 30 Sep 2010 11:43:10 +0200 Subject: Build fix for -qtnamespace. Reviewed-by: Thiago Macieira (cherry picked from commit b8089f0b7a0fef9318070aea9c8344bfe987bac9) --- src/corelib/plugin/qsystemlibrary.cpp | 5 +++++ src/corelib/plugin/qsystemlibrary_p.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/corelib/plugin/qsystemlibrary.cpp b/src/corelib/plugin/qsystemlibrary.cpp index eeb142b..1b8d8fe 100644 --- a/src/corelib/plugin/qsystemlibrary.cpp +++ b/src/corelib/plugin/qsystemlibrary.cpp @@ -77,6 +77,9 @@ in the documentation for LoadLibrary for Windows CE at MSDN. (http://msdn.microsoft.com/en-us/library/ms886736.aspx) */ + +QT_BEGIN_NAMESPACE + #if defined(Q_OS_WINCE) HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirectory /* = true */) { @@ -134,3 +137,5 @@ HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirect } #endif //Q_OS_WINCE + +QT_END_NAMESPACE diff --git a/src/corelib/plugin/qsystemlibrary_p.h b/src/corelib/plugin/qsystemlibrary_p.h index 3251a3c..8000a61 100644 --- a/src/corelib/plugin/qsystemlibrary_p.h +++ b/src/corelib/plugin/qsystemlibrary_p.h @@ -47,6 +47,8 @@ #include #include +QT_BEGIN_NAMESPACE + class QSystemLibrary { public: @@ -101,6 +103,8 @@ private: bool m_didLoad; }; +QT_END_NAMESPACE + #endif //Q_OS_WIN #endif //QSYSTEMLIBRARY_P_H -- cgit v0.12 From e5b34afef72154c017fe6d97eb7eda620754f6a2 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 4 Oct 2010 13:42:47 +0200 Subject: Doc: Removed a superfluous comment. Related to the rejected, but valid merge request: http://qt.gitorious.org/qt/qt/merge_requests/809 --- tools/qdoc3/htmlgenerator.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 8d39acf..c804d09 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -927,7 +927,6 @@ int HtmlGenerator::generateAtom(const Atom *atom, threeColumnEnumValueTable = isThreeColumnEnumValueTable(atom); if (threeColumnEnumValueTable) { out() << "

ScriptComparisonFuzzy ComparisonScoreUpdate
" << item.scriptName << "Update baseline
"; - // << "" if (++numTableRows % 2 == 1) out() << ""; else -- cgit v0.12 From 95f52ed1f9a1b3049e6862cb466754931c1d760d Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 4 Oct 2010 13:45:46 +0200 Subject: Doc: Made a number of fixes to the documentation. --- doc/src/bughowto.qdoc | 2 +- doc/src/examples/customtypesending.qdoc | 17 ++++++++---- doc/src/examples/qml-examples.qdoc | 31 ++++++++++++++++++++++ doc/src/frameworks-technologies/threads.qdoc | 4 --- doc/src/modules.qdoc | 4 +++ doc/src/snippets/code/doc_src_linguist-manual.qdoc | 10 +++++++ doc/src/snippets/sqldatabase/sqldatabase.cpp | 2 +- src/corelib/plugin/qsystemlibrary.cpp | 4 +-- src/gui/kernel/qwidget.cpp | 10 +++---- 9 files changed, 66 insertions(+), 18 deletions(-) diff --git a/doc/src/bughowto.qdoc b/doc/src/bughowto.qdoc index a833e00..568c34e 100644 --- a/doc/src/bughowto.qdoc +++ b/doc/src/bughowto.qdoc @@ -51,7 +51,7 @@ compiled with \o Reliable and clear description on how to reproduce the problem \endlist - + If possible, please provide a test written using the QtTest module as this will improve the procedure of reproducing your problem and allow the developers to address the issue in a more efficient way. diff --git a/doc/src/examples/customtypesending.qdoc b/doc/src/examples/customtypesending.qdoc index 2c32154..c4f262b 100644 --- a/doc/src/examples/customtypesending.qdoc +++ b/doc/src/examples/customtypesending.qdoc @@ -34,10 +34,6 @@ \image customtypesending-example.png - Contents: - - \tableofcontents - \section1 Overview In the \l{Custom Type Example}, we showed how to integrate custom types @@ -51,7 +47,7 @@ a \c Window class containing signals and slots whose signatures include \c Message arguments. - \section1 The Window Class Definition + \section1 The Window and Message Class Definitions We define a simple \c Window class with a signal and public slot that allow a \c Message object to be sent via a signal-slot connection: @@ -64,6 +60,17 @@ instance in the \c thisMessage private variable which holds the actual message to be sent. + The \c Message class is defined in the following way: + + \snippet examples/tools/customtypesending/message.h custom type definition + + The type is declared to the meta-type system with the Q_DECLARE_METATYPE() + macro: + + \snippet examples/tools/customtypesending/message.h custom type meta-type declaration + + This will make the type available for use in direct signal-slot connections. + \section1 The Window Class Implementation The \c Window constructor sets up a user interface containing a text diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc index 745baa3..2985e0a 100644 --- a/doc/src/examples/qml-examples.qdoc +++ b/doc/src/examples/qml-examples.qdoc @@ -236,6 +236,37 @@ This example shows how to enable text translation in QML. \image qml-i18n-example.png + + \section1 Introduction + + The QML runtime automatically loads a translation from the i18n subdirectory + of the root QML file, based on the system language. The translations are + held in QM files that must be generated from TS files. + + \section1 Updating Translations + + The \c{.ts} files are created and updated by running: + + \code + lupdate i18n.qml -ts i18n/base.ts + \endcode + + If no translation file exists, one will be created. If a file already exists, + it will be updated to contain the latest strings from the QML file. + + Translations for new languages are created by copying \c{i18n/base.ts} to + \c{i18n/qml_.ts} The TS files can then be edited with + \l{Qt Linguist Manual}{Qt Linguist}: + + \code + linguist i18n/qml_fr.ts + \endcode + + The run-time translation files are then generated by running: + + \code + lrelease i18n/*.ts + \endcode */ /*! diff --git a/doc/src/frameworks-technologies/threads.qdoc b/doc/src/frameworks-technologies/threads.qdoc index 405997a..4f7c7bf 100644 --- a/doc/src/frameworks-technologies/threads.qdoc +++ b/doc/src/frameworks-technologies/threads.qdoc @@ -324,10 +324,6 @@ post events to objects that "live" in other threads. This is possible because each thread is allowed to have its own event loop. - - Topics: - - \tableofcontents \section1 QObject Reentrancy diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc index d3c33d9..11b50c3 100644 --- a/doc/src/modules.qdoc +++ b/doc/src/modules.qdoc @@ -665,6 +665,10 @@ \brief The QtHelp module provides classes for integrating online documentation in applications. + The classes and tools supplied with Qt to enable developers to include + online help and documentation in their applications are described in + more detail in \l{The Qt Help Framework} overview document. + To include the definitions of the module's classes, use the following directive: diff --git a/doc/src/snippets/code/doc_src_linguist-manual.qdoc b/doc/src/snippets/code/doc_src_linguist-manual.qdoc index db99120..294afe0 100644 --- a/doc/src/snippets/code/doc_src_linguist-manual.qdoc +++ b/doc/src/snippets/code/doc_src_linguist-manual.qdoc @@ -92,8 +92,15 @@ Options: Usage: lrelease [options] project-file lrelease [options] ts-files [-qm qm-file] + +lrelease is part of Qt's Linguist tool chain. It can be used as a +stand-alone tool to convert XML-based translations files in the TS +format into the 'compiled' QM format used by QTranslator objects. + Options: -help Display this information and exit + -idbased + Use IDs instead of source strings for message keying -compress Compress the QM files -nounfinished @@ -101,6 +108,9 @@ Options: -removeidentical If the translated text is the same as the source text, do not include the message + -markuntranslated + If a message has no real translation, use the source text + prefixed with the given string instead -silent Do not explain what is being done -version diff --git a/doc/src/snippets/sqldatabase/sqldatabase.cpp b/doc/src/snippets/sqldatabase/sqldatabase.cpp index abe2a67..a027a84 100644 --- a/doc/src/snippets/sqldatabase/sqldatabase.cpp +++ b/doc/src/snippets/sqldatabase/sqldatabase.cpp @@ -280,7 +280,7 @@ QVariant MyModel::data(const QModelIndex &item, int role) const void QSqlTableModel_snippets() { //! [24] - QSqlTableModel *model = new QSqlTableModel; + QSqlTableModel *model = new QSqlTableModel(parentObject, database); model->setTable("employee"); model->setEditStrategy(QSqlTableModel::OnManualSubmit); model->select(); diff --git a/src/corelib/plugin/qsystemlibrary.cpp b/src/corelib/plugin/qsystemlibrary.cpp index eeb142b..568b398 100644 --- a/src/corelib/plugin/qsystemlibrary.cpp +++ b/src/corelib/plugin/qsystemlibrary.cpp @@ -57,8 +57,8 @@ The search order is the same as the order in DLL Safe search mode Windows, except that we don't search: * The current directory - * The 16-bit system directory. (normally c:\windows\system) - * The Windows directory. (normally c:\windows) + * The 16-bit system directory. (normally \c{c:\windows\system}) + * The Windows directory. (normally \c{c:\windows}) This means that the effective search order is: 1. Application path. diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index dc0dbf4..2f85cd0 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -728,9 +728,9 @@ void QWidget::setAutoFillBackground(bool enabled) \list \i mouseMoveEvent() is called whenever the mouse moves while a mouse button is held down. This can be useful during drag and drop - operations. If you call setMouseTracking(true), you get mouse move - events even when no buttons are held down. (See also the \l{Drag - and Drop} guide.) + operations. If you call \l{setMouseTracking()}{setMouseTracking}(true), + you get mouse move events even when no buttons are held down. + (See also the \l{Drag and Drop} guide.) \i keyReleaseEvent() is called whenever a key is released and while it is held down (if the key is auto-repeating). In that case, the widget will receive a pair of key release and key press event for @@ -8664,8 +8664,8 @@ bool QWidget::event(QEvent *event) /*! This event handler can be reimplemented to handle state changes. - The state being changed in this event can be retrieved through event \a - event. + The state being changed in this event can be retrieved through the \a event + supplied. Change events include: QEvent::ToolBarChange, QEvent::ActivationChange, QEvent::EnabledChange, QEvent::FontChange, -- cgit v0.12 From d04664b9da6356d3c97e632fb35e27c6822e0dc9 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 4 Oct 2010 13:53:53 +0200 Subject: doc: Changed \i to \e. Don\t use \i for italics. Use \e. Task: QTBUG-14133 --- src/network/bearer/qnetworksession.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index 65de539..226c3c5 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -489,15 +489,15 @@ QString QNetworkSession::errorString() const configuration resolved to when \l open() was called; otherwise an empty string. The purpose of this key is to determine the real QNetworkConfiguration that the - session is using. This key is different to \i ActiveConfiguration in that + session is using. This key is different from \e ActiveConfiguration in that this key may return an identifier for either a \l {QNetworkConfiguration::ServiceNetwork}{service network} or a - \l {QNetworkConfiguration::InternetAccessPoint}{Internet access points} configurations - whereas \i ActiveConfiguration always returns identifiers to + \l {QNetworkConfiguration::InternetAccessPoint}{Internet access points} configurations, + whereas \e ActiveConfiguration always returns identifiers to \l {QNetworkConfiguration::InternetAccessPoint}{Internet access points} configurations. \row \o ConnectInBackground - \o Setting this property to \i true before calling \l open() implies that the connection attempt + \o Setting this property to \e true before calling \l open() implies that the connection attempt is made but if no connection can be established, the user is not connsulted and asked to select a suitable connection. This property is not set by default and support for it depends on the platform. -- cgit v0.12 From 43e6ec9f01693044f7bc1c3954e2d6bcd70dc148 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 4 Oct 2010 14:30:09 +0200 Subject: Doc: Made documentation for Qt::TextLongestVariant public. Reported by David Faure on #qt-labs. --- src/corelib/global/qnamespace.qdoc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 5cd7f0e..b0c0e34 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -461,14 +461,17 @@ \value TextWordWrap Breaks lines at appropriate points, e.g. at word boundaries. \value TextWrapAnywhere Breaks lines anywhere, even within words. - \value TextHideMnemonic Same as Qt::TextShowMnemonic but doesn't draw the underlines. - \value TextDontPrint Treat this text as "hidden" and don't print - it. - \value IncludeTrailingSpaces When this option is set, QTextLine::naturalTextWidth() and naturalTextRect() will - return a value that includes the width of trailing spaces in the text; otherwise - this width is excluded. + \value TextHideMnemonic Same as Qt::TextShowMnemonic but doesn't draw + the underlines. + \value TextDontPrint Treat this text as "hidden" and don't print it. + \value IncludeTrailingSpaces When this option is set, + QTextLine::naturalTextWidth() and naturalTextRect() will + return a value that includes the width of trailing spaces in the + text; otherwise this width is excluded. \value TextIncludeTrailingSpaces Same as IncludeTrailingSpaces \value TextJustificationForced Ensures that text lines are justified. + \value TextLongestVariant Ensures that the longest variant is always used + when computing the size of a multi-variant string. \omitvalue TextBypassShaping \omitvalue BreakAnywhere @@ -482,7 +485,6 @@ \omitvalue WordBreak \omitvalue TextForceLeftToRight \omitvalue TextForceRightToLeft - \omitvalue TextLongestVariant Always use the longest variant when computing the size of a multi-variant string. You can use as many modifier flags as you want, except that Qt::TextSingleLine and Qt::TextWordWrap cannot be combined. -- cgit v0.12 From 8c054ec17ac04bf56052e0c163afe7922bf2a361 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 4 Oct 2010 14:39:56 +0200 Subject: Doc: Fixed the in-repository licenses for the documentation. In the repository, we should always use the No Commercial license alongside the GNU Free Documentation License for documentation files. --- demos/textedit/textedit.qdoc | 10 +++++----- doc/src/bughowto.qdoc | 10 +++++----- doc/src/classes.qdoc | 10 +++++----- doc/src/classes/exportedfunctions.qdoc | 10 +++++----- doc/src/classes/phonon-namespace.qdoc | 10 +++++----- doc/src/credits.qdoc | 10 +++++----- doc/src/declarative/advtutorial.qdoc | 10 +++++----- doc/src/declarative/anchor-layout.qdoc | 10 +++++----- doc/src/declarative/animation.qdoc | 10 +++++----- doc/src/declarative/basictypes.qdoc | 10 +++++----- doc/src/declarative/codingconventions.qdoc | 10 +++++----- doc/src/declarative/declarativeui.qdoc | 10 +++++----- doc/src/declarative/dynamicobjects.qdoc | 10 +++++----- doc/src/declarative/elements.qdoc | 10 +++++----- doc/src/declarative/example-slideswitch.qdoc | 10 +++++----- doc/src/declarative/examples.qdoc | 10 +++++----- doc/src/declarative/extending-tutorial.qdoc | 10 +++++----- doc/src/declarative/extending.qdoc | 10 +++++----- doc/src/declarative/focus.qdoc | 10 +++++----- doc/src/declarative/globalobject.qdoc | 10 +++++----- doc/src/declarative/integrating.qdoc | 10 +++++----- doc/src/declarative/javascriptblocks.qdoc | 10 +++++----- doc/src/declarative/modules.qdoc | 10 +++++----- doc/src/declarative/network.qdoc | 10 +++++----- doc/src/declarative/positioners.qdoc | 10 +++++----- doc/src/declarative/propertybinding.qdoc | 10 +++++----- doc/src/declarative/qdeclarativedebugging.qdoc | 10 +++++----- doc/src/declarative/qdeclarativedocument.qdoc | 10 +++++----- doc/src/declarative/qdeclarativei18n.qdoc | 10 +++++----- doc/src/declarative/qdeclarativeintro.qdoc | 10 +++++----- doc/src/declarative/qdeclarativemodels.qdoc | 10 +++++----- doc/src/declarative/qdeclarativeperformance.qdoc | 10 +++++----- doc/src/declarative/qdeclarativereference.qdoc | 10 +++++----- doc/src/declarative/qdeclarativesecurity.qdoc | 10 +++++----- doc/src/declarative/qdeclarativestates.qdoc | 10 +++++----- doc/src/declarative/qml-intro.qdoc | 10 +++++----- doc/src/declarative/qmlruntime.qdoc | 10 +++++----- doc/src/declarative/qmlviewer.qdoc | 10 +++++----- doc/src/declarative/qtbinding.qdoc | 10 +++++----- doc/src/declarative/qtdeclarative.qdoc | 10 +++++----- doc/src/declarative/qtprogrammers.qdoc | 10 +++++----- doc/src/declarative/scope.qdoc | 10 +++++----- doc/src/declarative/tutorial.qdoc | 10 +++++----- doc/src/demos/affine.qdoc | 10 +++++----- doc/src/demos/anomaly.qdoc | 10 +++++----- doc/src/demos/arthurplugin.qdoc | 10 +++++----- doc/src/demos/books.qdoc | 10 +++++----- doc/src/demos/boxes.qdoc | 10 +++++----- doc/src/demos/browser.qdoc | 10 +++++----- doc/src/demos/chip.qdoc | 10 +++++----- doc/src/demos/composition.qdoc | 10 +++++----- doc/src/demos/deform.qdoc | 10 +++++----- doc/src/demos/desktopservices.qdoc | 10 +++++----- doc/src/demos/digiflip.qdoc | 10 +++++----- doc/src/demos/embeddeddialogs.qdoc | 10 +++++----- doc/src/demos/embeddedsvgviewer.qdoc | 10 +++++----- doc/src/demos/flickable.qdoc | 10 +++++----- doc/src/demos/flightinfo.qdoc | 10 +++++----- doc/src/demos/fluidlauncher.qdoc | 10 +++++----- doc/src/demos/gradients.qdoc | 10 +++++----- doc/src/demos/interview.qdoc | 10 +++++----- doc/src/demos/lightmaps.qdoc | 10 +++++----- doc/src/demos/macmainwindow.qdoc | 10 +++++----- doc/src/demos/mainwindow.qdoc | 10 +++++----- doc/src/demos/mediaplayer.qdoc | 10 +++++----- doc/src/demos/pathstroke.qdoc | 10 +++++----- doc/src/demos/qtdemo.qdoc | 10 +++++----- doc/src/demos/raycasting.qdoc | 10 +++++----- doc/src/demos/spectrum.qdoc | 10 +++++----- doc/src/demos/spreadsheet.qdoc | 10 +++++----- doc/src/demos/sqlbrowser.qdoc | 10 +++++----- doc/src/demos/styledemo.qdoc | 10 +++++----- doc/src/demos/sub-attaq.qdoc | 10 +++++----- doc/src/demos/textedit.qdoc | 10 +++++----- doc/src/demos/undo.qdoc | 10 +++++----- doc/src/demos/weatherinfo.qdoc | 10 +++++----- doc/src/deployment/deployment-plugins.qdoc | 10 +++++----- doc/src/deployment/deployment.qdoc | 10 +++++----- doc/src/deployment/qt-conf.qdoc | 10 +++++----- doc/src/deployment/qtconfig.qdoc | 10 +++++----- doc/src/development/activeqt-dumpcpp.qdoc | 10 +++++----- doc/src/development/activeqt-dumpdoc.qdoc | 10 +++++----- doc/src/development/activeqt-idc.qdoc | 10 +++++----- doc/src/development/activeqt-testcon.qdoc | 10 +++++----- doc/src/development/assistant-manual.qdoc | 10 +++++----- doc/src/development/debug.qdoc | 10 +++++----- doc/src/development/designer-manual.qdoc | 10 +++++----- doc/src/development/developing-on-mac.qdoc | 10 +++++----- doc/src/development/developing-with-qt.qdoc | 10 +++++----- doc/src/development/moc.qdoc | 10 +++++----- doc/src/development/qmake-manual.qdoc | 10 +++++----- doc/src/development/qmsdev.qdoc | 10 +++++----- doc/src/development/qtestlib.qdoc | 10 +++++----- doc/src/development/rcc.qdoc | 10 +++++----- doc/src/development/tools-list.qdoc | 10 +++++----- doc/src/development/uic.qdoc | 10 +++++----- doc/src/examples/2dpainting.qdoc | 10 +++++----- doc/src/examples/activeqt/comapp.qdoc | 10 +++++----- doc/src/examples/activeqt/dotnet.qdoc | 10 +++++----- doc/src/examples/activeqt/hierarchy.qdoc | 10 +++++----- doc/src/examples/activeqt/menus.qdoc | 10 +++++----- doc/src/examples/activeqt/multiple.qdoc | 10 +++++----- doc/src/examples/activeqt/opengl.qdoc | 10 +++++----- doc/src/examples/activeqt/qutlook.qdoc | 10 +++++----- doc/src/examples/activeqt/simple.qdoc | 10 +++++----- doc/src/examples/activeqt/webbrowser.qdoc | 10 +++++----- doc/src/examples/activeqt/wrapper.qdoc | 10 +++++----- doc/src/examples/addressbook.qdoc | 10 +++++----- doc/src/examples/analogclock.qdoc | 10 +++++----- doc/src/examples/animatedtiles.qdoc | 10 +++++----- doc/src/examples/appchooser.qdoc | 10 +++++----- doc/src/examples/application.qdoc | 10 +++++----- doc/src/examples/arrowpad.qdoc | 10 +++++----- doc/src/examples/audiodevices.qdoc | 10 +++++----- doc/src/examples/audioinput.qdoc | 10 +++++----- doc/src/examples/audiooutput.qdoc | 10 +++++----- doc/src/examples/basicdrawing.qdoc | 10 +++++----- doc/src/examples/basicgraphicslayouts.qdoc | 10 +++++----- doc/src/examples/basiclayouts.qdoc | 10 +++++----- doc/src/examples/basicsortfiltermodel.qdoc | 10 +++++----- doc/src/examples/bearercloud.qdoc | 10 +++++----- doc/src/examples/bearermonitor.qdoc | 10 +++++----- doc/src/examples/blockingfortuneclient.qdoc | 10 +++++----- doc/src/examples/blurpicker.qdoc | 10 +++++----- doc/src/examples/borderlayout.qdoc | 10 +++++----- doc/src/examples/broadcastreceiver.qdoc | 10 +++++----- doc/src/examples/broadcastsender.qdoc | 10 +++++----- doc/src/examples/cachedtable.qdoc | 10 +++++----- doc/src/examples/calculator.qdoc | 10 +++++----- doc/src/examples/calculatorbuilder.qdoc | 10 +++++----- doc/src/examples/calculatorform.qdoc | 10 +++++----- doc/src/examples/calendar.qdoc | 10 +++++----- doc/src/examples/calendarwidget.qdoc | 10 +++++----- doc/src/examples/capabilitiesexample.qdoc | 10 +++++----- doc/src/examples/charactermap.qdoc | 10 +++++----- doc/src/examples/chart.qdoc | 10 +++++----- doc/src/examples/classwizard.qdoc | 10 +++++----- doc/src/examples/codecs.qdoc | 10 +++++----- doc/src/examples/codeeditor.qdoc | 10 +++++----- doc/src/examples/collidingmice-example.qdoc | 10 +++++----- doc/src/examples/coloreditorfactory.qdoc | 10 +++++----- doc/src/examples/combowidgetmapper.qdoc | 10 +++++----- doc/src/examples/completer.qdoc | 10 +++++----- doc/src/examples/complexpingpong.qdoc | 10 +++++----- doc/src/examples/concentriccircles.qdoc | 10 +++++----- doc/src/examples/configdialog.qdoc | 10 +++++----- doc/src/examples/containerextension.qdoc | 10 +++++----- doc/src/examples/context2d.qdoc | 10 +++++----- doc/src/examples/contextsensitivehelp.qdoc | 10 +++++----- doc/src/examples/contiguouscache.qdoc | 10 +++++----- doc/src/examples/customcompleter.qdoc | 10 +++++----- doc/src/examples/customsortfiltermodel.qdoc | 10 +++++----- doc/src/examples/customtype.qdoc | 10 +++++----- doc/src/examples/customtypesending.qdoc | 10 +++++----- doc/src/examples/customwidgetplugin.qdoc | 10 +++++----- doc/src/examples/dbscreen.qdoc | 10 +++++----- doc/src/examples/dbus-chat.qdoc | 10 +++++----- doc/src/examples/dbus-listnames.qdoc | 10 +++++----- doc/src/examples/dbus-pingpong.qdoc | 10 +++++----- doc/src/examples/dbus-remotecontrolledcar.qdoc | 10 +++++----- doc/src/examples/defaultprototypes.qdoc | 10 +++++----- doc/src/examples/delayedencoding.qdoc | 10 +++++----- doc/src/examples/diagramscene.qdoc | 10 +++++----- doc/src/examples/digitalclock.qdoc | 10 +++++----- doc/src/examples/dirview.qdoc | 10 +++++----- doc/src/examples/dockwidgets.qdoc | 10 +++++----- doc/src/examples/dombookmarks.qdoc | 10 +++++----- doc/src/examples/domtraversal.qdoc | 10 +++++----- doc/src/examples/draganddroppuzzle.qdoc | 10 +++++----- doc/src/examples/dragdroprobot.qdoc | 10 +++++----- doc/src/examples/draggableicons.qdoc | 10 +++++----- doc/src/examples/draggabletext.qdoc | 10 +++++----- doc/src/examples/drilldown.qdoc | 10 +++++----- doc/src/examples/dropsite.qdoc | 10 +++++----- doc/src/examples/dynamiclayouts.qdoc | 10 +++++----- doc/src/examples/easing.qdoc | 10 +++++----- doc/src/examples/echoplugin.qdoc | 10 +++++----- doc/src/examples/editabletreemodel.qdoc | 10 +++++----- doc/src/examples/elasticnodes.qdoc | 10 +++++----- doc/src/examples/eventtransitions.qdoc | 10 +++++----- doc/src/examples/extension.qdoc | 10 +++++----- doc/src/examples/factorial.qdoc | 10 +++++----- doc/src/examples/fademessage.qdoc | 10 +++++----- doc/src/examples/fancybrowser.qdoc | 10 +++++----- doc/src/examples/fetchmore.qdoc | 10 +++++----- doc/src/examples/filetree.qdoc | 10 +++++----- doc/src/examples/findfiles.qdoc | 10 +++++----- doc/src/examples/fingerpaint.qdoc | 10 +++++----- doc/src/examples/flowlayout.qdoc | 10 +++++----- doc/src/examples/fontsampler.qdoc | 10 +++++----- doc/src/examples/formextractor.qdoc | 10 +++++----- doc/src/examples/fortuneclient.qdoc | 10 +++++----- doc/src/examples/fortuneserver.qdoc | 10 +++++----- doc/src/examples/framebufferobject.qdoc | 10 +++++----- doc/src/examples/framebufferobject2.qdoc | 10 +++++----- doc/src/examples/fridgemagnets.qdoc | 10 +++++----- doc/src/examples/frozencolumn.qdoc | 10 +++++----- doc/src/examples/ftp.qdoc | 10 +++++----- doc/src/examples/globalVariables.qdoc | 10 +++++----- doc/src/examples/googlechat.qdoc | 10 +++++----- doc/src/examples/googlesuggest.qdoc | 10 +++++----- doc/src/examples/grabber.qdoc | 10 +++++----- doc/src/examples/graphicsview-anchorlayout.qdoc | 10 +++++----- doc/src/examples/graphicsview-flowlayout.qdoc | 10 +++++----- doc/src/examples/graphicsview-simpleanchorlayout.qdoc | 10 +++++----- doc/src/examples/graphicsview-weatheranchorlayout.qdoc | 10 +++++----- doc/src/examples/groupbox.qdoc | 10 +++++----- doc/src/examples/hellogl.qdoc | 10 +++++----- doc/src/examples/hellogl_es.qdoc | 10 +++++----- doc/src/examples/helloscript.qdoc | 10 +++++----- doc/src/examples/hellotr.qdoc | 10 +++++----- doc/src/examples/htmlinfo.qdoc | 10 +++++----- doc/src/examples/http.qdoc | 10 +++++----- doc/src/examples/i18n.qdoc | 10 +++++----- doc/src/examples/icons.qdoc | 10 +++++----- doc/src/examples/imagecomposition.qdoc | 10 +++++----- doc/src/examples/imagegestures.qdoc | 10 +++++----- doc/src/examples/imageviewer.qdoc | 10 +++++----- doc/src/examples/inputpanel.qdoc | 10 +++++----- doc/src/examples/itemviewspuzzle.qdoc | 10 +++++----- doc/src/examples/licensewizard.qdoc | 10 +++++----- doc/src/examples/lighting.qdoc | 10 +++++----- doc/src/examples/lineedits.qdoc | 10 +++++----- doc/src/examples/localfortuneclient.qdoc | 10 +++++----- doc/src/examples/localfortuneserver.qdoc | 10 +++++----- doc/src/examples/loopback.qdoc | 10 +++++----- doc/src/examples/mandelbrot.qdoc | 10 +++++----- doc/src/examples/masterdetail.qdoc | 10 +++++----- doc/src/examples/mdi.qdoc | 10 +++++----- doc/src/examples/menus.qdoc | 10 +++++----- doc/src/examples/mousecalibration.qdoc | 10 +++++----- doc/src/examples/moveblocks.qdoc | 10 +++++----- doc/src/examples/movie.qdoc | 10 +++++----- doc/src/examples/multipleinheritance.qdoc | 10 +++++----- doc/src/examples/musicplayerexample.qdoc | 10 +++++----- doc/src/examples/network-chat.qdoc | 10 +++++----- doc/src/examples/network-download.qdoc | 10 +++++----- doc/src/examples/network-downloadmanager.qdoc | 10 +++++----- doc/src/examples/openvg-star.qdoc | 10 +++++----- doc/src/examples/orderform.qdoc | 10 +++++----- doc/src/examples/overpainting.qdoc | 10 +++++----- doc/src/examples/padnavigator.qdoc | 10 +++++----- doc/src/examples/painterpaths.qdoc | 10 +++++----- doc/src/examples/pbuffers.qdoc | 10 +++++----- doc/src/examples/pbuffers2.qdoc | 10 +++++----- doc/src/examples/pinchzoom.qdoc | 10 +++++----- doc/src/examples/pingpong.qdoc | 10 +++++----- doc/src/examples/pixelator.qdoc | 10 +++++----- doc/src/examples/plugandpaint.qdoc | 10 +++++----- doc/src/examples/portedasteroids.qdoc | 10 +++++----- doc/src/examples/portedcanvas.qdoc | 10 +++++----- doc/src/examples/previewer.qdoc | 10 +++++----- doc/src/examples/qml-calculator.qdoc | 10 +++++----- doc/src/examples/qml-examples.qdoc | 10 +++++----- doc/src/examples/qml-extending.qdoc | 10 +++++----- doc/src/examples/qml-flickr.qdoc | 10 +++++----- doc/src/examples/qml-folderlistmodel.qdoc | 10 +++++----- doc/src/examples/qml-minehunt.qdoc | 10 +++++----- doc/src/examples/qml-photoviewer.qdoc | 10 +++++----- doc/src/examples/qml-rssnews.qdoc | 10 +++++----- doc/src/examples/qml-samegame.qdoc | 10 +++++----- doc/src/examples/qml-snake.qdoc | 10 +++++----- doc/src/examples/qml-twitter.qdoc | 10 +++++----- doc/src/examples/qml-webbrowser.qdoc | 10 +++++----- doc/src/examples/qobjectxmlmodel.qdoc | 10 +++++----- doc/src/examples/qtconcurrent-imagescaling.qdoc | 10 +++++----- doc/src/examples/qtconcurrent-map.qdoc | 10 +++++----- doc/src/examples/qtconcurrent-progressdialog.qdoc | 10 +++++----- doc/src/examples/qtconcurrent-runfunction.qdoc | 10 +++++----- doc/src/examples/qtconcurrent-wordcount.qdoc | 10 +++++----- doc/src/examples/qtscriptcalculator.qdoc | 10 +++++----- doc/src/examples/qtscriptcustomclass.qdoc | 10 +++++----- doc/src/examples/qtscripttetrix.qdoc | 10 +++++----- doc/src/examples/querymodel.qdoc | 10 +++++----- doc/src/examples/queuedcustomtype.qdoc | 10 +++++----- doc/src/examples/qxmlstreambookmarks.qdoc | 10 +++++----- doc/src/examples/recentfiles.qdoc | 10 +++++----- doc/src/examples/recipes.qdoc | 10 +++++----- doc/src/examples/regexp.qdoc | 10 +++++----- doc/src/examples/relationaltablemodel.qdoc | 10 +++++----- doc/src/examples/remotecontrol.qdoc | 10 +++++----- doc/src/examples/rogue.qdoc | 10 +++++----- doc/src/examples/rsslisting.qdoc | 10 +++++----- doc/src/examples/samplebuffers.qdoc | 10 +++++----- doc/src/examples/saxbookmarks.qdoc | 10 +++++----- doc/src/examples/schema.qdoc | 10 +++++----- doc/src/examples/screenshot.qdoc | 10 +++++----- doc/src/examples/scribble.qdoc | 10 +++++----- doc/src/examples/script-marshal.qdoc | 10 +++++----- doc/src/examples/script-qscript.qdoc | 10 +++++----- doc/src/examples/script-qsdbg.qdoc | 10 +++++----- doc/src/examples/sdi.qdoc | 10 +++++----- doc/src/examples/securesocketclient.qdoc | 10 +++++----- doc/src/examples/semaphores.qdoc | 10 +++++----- doc/src/examples/settingseditor.qdoc | 10 +++++----- doc/src/examples/shapedclock.qdoc | 10 +++++----- doc/src/examples/sharedmemory.qdoc | 10 +++++----- doc/src/examples/simpledecoration.qdoc | 10 +++++----- doc/src/examples/simpledommodel.qdoc | 10 +++++----- doc/src/examples/simpleselector.qdoc | 10 +++++----- doc/src/examples/simpletextviewer.qdoc | 10 +++++----- doc/src/examples/simpletreemodel.qdoc | 10 +++++----- doc/src/examples/simplewidgetmapper.qdoc | 10 +++++----- doc/src/examples/sipdialog.qdoc | 10 +++++----- doc/src/examples/sliders.qdoc | 10 +++++----- doc/src/examples/spinboxdelegate.qdoc | 10 +++++----- doc/src/examples/spinboxes.qdoc | 10 +++++----- doc/src/examples/sqlwidgetmapper.qdoc | 10 +++++----- doc/src/examples/standarddialogs.qdoc | 10 +++++----- doc/src/examples/stardelegate.qdoc | 10 +++++----- doc/src/examples/states.qdoc | 10 +++++----- doc/src/examples/stickman.qdoc | 10 +++++----- doc/src/examples/styleplugin.qdoc | 10 +++++----- doc/src/examples/styles.qdoc | 10 +++++----- doc/src/examples/stylesheet.qdoc | 10 +++++----- doc/src/examples/svgalib.qdoc | 10 +++++----- doc/src/examples/svggenerator.qdoc | 10 +++++----- doc/src/examples/svgviewer.qdoc | 10 +++++----- doc/src/examples/syntaxhighlighter.qdoc | 10 +++++----- doc/src/examples/systray.qdoc | 10 +++++----- doc/src/examples/tabdialog.qdoc | 10 +++++----- doc/src/examples/tablemodel.qdoc | 10 +++++----- doc/src/examples/tablet.qdoc | 10 +++++----- doc/src/examples/taskmenuextension.qdoc | 10 +++++----- doc/src/examples/tetrix.qdoc | 10 +++++----- doc/src/examples/textfinder.qdoc | 10 +++++----- doc/src/examples/textobject.qdoc | 10 +++++----- doc/src/examples/textures.qdoc | 10 +++++----- doc/src/examples/threadedfortuneserver.qdoc | 10 +++++----- doc/src/examples/tooltips.qdoc | 10 +++++----- doc/src/examples/torrent.qdoc | 10 +++++----- doc/src/examples/touch-dials.qdoc | 10 +++++----- doc/src/examples/touch-knobs.qdoc | 10 +++++----- doc/src/examples/trafficinfo.qdoc | 10 +++++----- doc/src/examples/trafficlight.qdoc | 10 +++++----- doc/src/examples/transformations.qdoc | 10 +++++----- doc/src/examples/treemodelcompleter.qdoc | 10 +++++----- doc/src/examples/trivialwizard.qdoc | 10 +++++----- doc/src/examples/trollprint.qdoc | 10 +++++----- doc/src/examples/twowaybutton.qdoc | 10 +++++----- doc/src/examples/undoframework.qdoc | 10 +++++----- doc/src/examples/videographicsitem.qdoc | 10 +++++----- doc/src/examples/videowidget.qdoc | 10 +++++----- doc/src/examples/waitconditions.qdoc | 10 +++++----- doc/src/examples/webkit-framecapture.qdoc | 10 +++++----- doc/src/examples/widgets-softkeys.qdoc | 10 +++++----- doc/src/examples/widgets-validators.qdoc | 10 +++++----- doc/src/examples/wiggly.qdoc | 10 +++++----- doc/src/examples/windowflags.qdoc | 10 +++++----- doc/src/examples/worldtimeclockbuilder.qdoc | 10 +++++----- doc/src/examples/worldtimeclockplugin.qdoc | 10 +++++----- doc/src/examples/xmlstreamlint.qdoc | 10 +++++----- doc/src/external-resources.qdoc | 10 +++++----- doc/src/files-and-resources/datastreamformat.qdoc | 10 +++++----- doc/src/files-and-resources/resources.qdoc | 10 +++++----- doc/src/frameworks-technologies/accessible.qdoc | 10 +++++----- doc/src/frameworks-technologies/activeqt-container.qdoc | 10 +++++----- doc/src/frameworks-technologies/activeqt-server.qdoc | 10 +++++----- doc/src/frameworks-technologies/activeqt.qdoc | 10 +++++----- doc/src/frameworks-technologies/animation.qdoc | 10 +++++----- doc/src/frameworks-technologies/containers.qdoc | 10 +++++----- doc/src/frameworks-technologies/dbus-adaptors.qdoc | 10 +++++----- doc/src/frameworks-technologies/dbus-intro.qdoc | 10 +++++----- doc/src/frameworks-technologies/desktop-integration.qdoc | 10 +++++----- doc/src/frameworks-technologies/dnd.qdoc | 10 +++++----- doc/src/frameworks-technologies/eventsandfilters.qdoc | 10 +++++----- doc/src/frameworks-technologies/gestures.qdoc | 10 +++++----- doc/src/frameworks-technologies/graphicsview.qdoc | 10 +++++----- doc/src/frameworks-technologies/implicit-sharing.qdoc | 10 +++++----- doc/src/frameworks-technologies/ipc.qdoc | 10 +++++----- doc/src/frameworks-technologies/model-view-programming.qdoc | 10 +++++----- doc/src/frameworks-technologies/phonon.qdoc | 10 +++++----- doc/src/frameworks-technologies/plugins-howto.qdoc | 10 +++++----- doc/src/frameworks-technologies/qthelp.qdoc | 10 +++++----- doc/src/frameworks-technologies/qundo.qdoc | 10 +++++----- doc/src/frameworks-technologies/richtext.qdoc | 10 +++++----- doc/src/frameworks-technologies/statemachine.qdoc | 10 +++++----- doc/src/frameworks-technologies/templates.qdoc | 10 +++++----- doc/src/frameworks-technologies/threads.qdoc | 10 +++++----- doc/src/frameworks-technologies/unicode.qdoc | 10 +++++----- doc/src/getting-started/demos.qdoc | 10 +++++----- doc/src/getting-started/examples.qdoc | 10 +++++----- doc/src/getting-started/gettingstarted.qdoc | 10 +++++----- doc/src/getting-started/gettingstartedqml.qdoc | 10 +++++----- doc/src/getting-started/gettingstartedqt.qdoc | 10 +++++----- doc/src/getting-started/how-to-learn-qt.qdoc | 10 +++++----- doc/src/getting-started/installation.qdoc | 10 +++++----- doc/src/getting-started/known-issues.qdoc | 10 +++++----- doc/src/getting-started/tutorials.qdoc | 10 +++++----- doc/src/howtos/HWacceleration.qdoc | 10 +++++----- doc/src/howtos/accelerators.qdoc | 10 +++++----- doc/src/howtos/appicon.qdoc | 10 +++++----- doc/src/howtos/custom-types.qdoc | 10 +++++----- doc/src/howtos/exceptionsafety.qdoc | 10 +++++----- doc/src/howtos/guibooks.qdoc | 10 +++++----- doc/src/howtos/openvg.qdoc | 10 +++++----- doc/src/howtos/qtdesigner.qdoc | 10 +++++----- doc/src/howtos/restoring-geometry.qdoc | 10 +++++----- doc/src/howtos/session.qdoc | 10 +++++----- doc/src/howtos/sharedlibrary.qdoc | 10 +++++----- doc/src/howtos/timers.qdoc | 10 +++++----- doc/src/howtos/unix-signal-handlers.qdoc | 10 +++++----- doc/src/index.qdoc | 10 +++++----- doc/src/internationalization/i18n.qdoc | 10 +++++----- doc/src/internationalization/linguist-manual.qdoc | 10 +++++----- doc/src/ja_JP/development/designer-manual.qdoc | 10 +++++----- doc/src/ja_JP/development/qmake-manual.qdoc | 10 +++++----- doc/src/ja_JP/development/qtestlib.qdoc | 10 +++++----- doc/src/ja_JP/examples/arrowpad.qdoc | 10 +++++----- doc/src/ja_JP/examples/hellotr.qdoc | 10 +++++----- doc/src/ja_JP/examples/trollprint.qdoc | 10 +++++----- doc/src/ja_JP/getting-started/tutorials.qdoc | 10 +++++----- doc/src/ja_JP/tutorials/addressbook.qdoc | 10 +++++----- doc/src/ja_JP/tutorials/widgets-tutorial.qdoc | 10 +++++----- doc/src/legal/3rdparty.qdoc | 10 +++++----- doc/src/legal/commercialeditions.qdoc | 10 +++++----- doc/src/legal/editions.qdoc | 10 +++++----- doc/src/legal/gpl.qdoc | 10 +++++----- doc/src/legal/licenses.qdoc | 10 +++++----- doc/src/legal/opensourceedition.qdoc | 10 +++++----- doc/src/legal/trademarks.qdoc | 10 +++++----- doc/src/modules.qdoc | 10 +++++----- doc/src/network-programming/bearermanagement.qdoc | 10 +++++----- doc/src/network-programming/qtnetwork.qdoc | 10 +++++----- doc/src/network-programming/ssl.qdoc | 10 +++++----- doc/src/objectmodel/metaobjects.qdoc | 10 +++++----- doc/src/objectmodel/object.qdoc | 10 +++++----- doc/src/objectmodel/objecttrees.qdoc | 10 +++++----- doc/src/objectmodel/properties.qdoc | 10 +++++----- doc/src/objectmodel/signalsandslots.qdoc | 10 +++++----- doc/src/overviews.qdoc | 10 +++++----- doc/src/painting-and-printing/coordsys.qdoc | 10 +++++----- doc/src/painting-and-printing/paintsystem.qdoc | 10 +++++----- doc/src/painting-and-printing/printing.qdoc | 10 +++++----- doc/src/platforms/atomic-operations.qdoc | 10 +++++----- doc/src/platforms/compiler-notes.qdoc | 10 +++++----- doc/src/platforms/emb-HwAcc-LinuxEmbedded.qdoc | 10 +++++----- doc/src/platforms/emb-HwAcc-WinCE.qdoc | 10 +++++----- doc/src/platforms/emb-accel.qdoc | 10 +++++----- doc/src/platforms/emb-architecture.qdoc | 10 +++++----- doc/src/platforms/emb-charinput.qdoc | 10 +++++----- doc/src/platforms/emb-crosscompiling.qdoc | 10 +++++----- doc/src/platforms/emb-deployment.qdoc | 10 +++++----- doc/src/platforms/emb-differences.qdoc | 10 +++++----- doc/src/platforms/emb-directfb-EmbLinux.qdoc | 10 +++++----- doc/src/platforms/emb-displaymanagement.qdoc | 10 +++++----- doc/src/platforms/emb-envvars.qdoc | 10 +++++----- doc/src/platforms/emb-features.qdoc | 10 +++++----- doc/src/platforms/emb-fonts.qdoc | 10 +++++----- doc/src/platforms/emb-framebuffer-howto.qdoc | 10 +++++----- doc/src/platforms/emb-install.qdoc | 10 +++++----- doc/src/platforms/emb-kmap2qmap.qdoc | 10 +++++----- doc/src/platforms/emb-makeqpf.qdoc | 10 +++++----- doc/src/platforms/emb-opengl-EmbLinux.qdoc | 10 +++++----- doc/src/platforms/emb-openvg-EmbLinux.qdoc | 10 +++++----- doc/src/platforms/emb-performance.qdoc | 10 +++++----- doc/src/platforms/emb-pointer.qdoc | 10 +++++----- doc/src/platforms/emb-porting.qdoc | 10 +++++----- doc/src/platforms/emb-qvfb.qdoc | 10 +++++----- doc/src/platforms/emb-running.qdoc | 10 +++++----- doc/src/platforms/emb-vnc.qdoc | 10 +++++----- doc/src/platforms/mac-differences.qdoc | 10 +++++----- doc/src/platforms/platform-notes-rtos.qdoc | 10 +++++----- doc/src/platforms/platform-notes.qdoc | 10 +++++----- doc/src/platforms/qt-embedded-linux.qdoc | 10 +++++----- doc/src/platforms/qt-embedded.qdoc | 10 +++++----- doc/src/platforms/qtmac-as-native.qdoc | 10 +++++----- doc/src/platforms/supported-platforms.qdoc | 10 +++++----- doc/src/platforms/symbian-exceptionsafety.qdoc | 10 +++++----- doc/src/platforms/symbian-introduction.qdoc | 10 +++++----- doc/src/platforms/wince-customization.qdoc | 10 +++++----- doc/src/platforms/wince-introduction.qdoc | 10 +++++----- doc/src/platforms/wince-opengl.qdoc | 10 +++++----- doc/src/platforms/wince-openvg.qdoc | 10 +++++----- doc/src/platforms/wince-signing.qdoc | 10 +++++----- doc/src/platforms/winsystem.qdoc | 10 +++++----- doc/src/platforms/x11overlays.qdoc | 10 +++++----- doc/src/porting/porting-qsa.qdoc | 10 +++++----- doc/src/porting/porting4-canvas.qdoc | 10 +++++----- doc/src/porting/porting4-designer.qdoc | 10 +++++----- doc/src/porting/porting4-dnd.qdoc | 10 +++++----- doc/src/porting/porting4-overview.qdoc | 10 +++++----- doc/src/porting/porting4.qdoc | 10 +++++----- doc/src/porting/qt3to4.qdoc | 10 +++++----- doc/src/porting/qt4-accessibility.qdoc | 10 +++++----- doc/src/porting/qt4-arthur.qdoc | 10 +++++----- doc/src/porting/qt4-designer.qdoc | 10 +++++----- doc/src/porting/qt4-interview.qdoc | 10 +++++----- doc/src/porting/qt4-mainwindow.qdoc | 10 +++++----- doc/src/porting/qt4-network.qdoc | 10 +++++----- doc/src/porting/qt4-scribe.qdoc | 10 +++++----- doc/src/porting/qt4-sql.qdoc | 10 +++++----- doc/src/porting/qt4-styles.qdoc | 10 +++++----- doc/src/porting/qt4-threads.qdoc | 10 +++++----- doc/src/porting/qt4-tulip.qdoc | 10 +++++----- doc/src/qt-resources.qdoc | 10 +++++----- doc/src/qt-webpages.qdoc | 10 +++++----- doc/src/qt4-intro.qdoc | 10 +++++----- doc/src/scripting/ecmascript.qdoc | 10 +++++----- doc/src/scripting/qtscriptdebugger-manual.qdoc | 10 +++++----- doc/src/scripting/qtscriptextensions.qdoc | 10 +++++----- doc/src/scripting/scripting.qdoc | 10 +++++----- doc/src/sql-programming/qsqldatatype-table.qdoc | 10 +++++----- doc/src/sql-programming/sql-driver.qdoc | 10 +++++----- doc/src/sql-programming/sql-programming.qdoc | 10 +++++----- doc/src/tutorials/addressbook-fr.qdoc | 10 +++++----- doc/src/tutorials/addressbook.qdoc | 10 +++++----- doc/src/tutorials/modelview.qdoc | 10 +++++----- doc/src/tutorials/widgets-tutorial.qdoc | 10 +++++----- doc/src/widgets-and-layouts/focus.qdoc | 10 +++++----- doc/src/widgets-and-layouts/gallery-cde.qdoc | 10 +++++----- doc/src/widgets-and-layouts/gallery-cleanlooks.qdoc | 10 +++++----- doc/src/widgets-and-layouts/gallery-gtk.qdoc | 10 +++++----- doc/src/widgets-and-layouts/gallery-macintosh.qdoc | 10 +++++----- doc/src/widgets-and-layouts/gallery-motif.qdoc | 10 +++++----- doc/src/widgets-and-layouts/gallery-plastique.qdoc | 10 +++++----- doc/src/widgets-and-layouts/gallery-windows.qdoc | 10 +++++----- doc/src/widgets-and-layouts/gallery-windowsvista.qdoc | 10 +++++----- doc/src/widgets-and-layouts/gallery-windowsxp.qdoc | 10 +++++----- doc/src/widgets-and-layouts/gallery.qdoc | 10 +++++----- doc/src/widgets-and-layouts/layout.qdoc | 10 +++++----- doc/src/widgets-and-layouts/styles.qdoc | 10 +++++----- doc/src/widgets-and-layouts/stylesheet.qdoc | 10 +++++----- doc/src/widgets-and-layouts/widgets.qdoc | 10 +++++----- doc/src/windows-and-dialogs/dialogs.qdoc | 10 +++++----- doc/src/windows-and-dialogs/mainwindow.qdoc | 10 +++++----- doc/src/xml-processing/xml-patterns.qdoc | 10 +++++----- doc/src/xml-processing/xml-processing.qdoc | 10 +++++----- doc/src/xml-processing/xquery-introduction.qdoc | 10 +++++----- doc/src/zh_CN/bughowto.qdoc | 10 +++++----- doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc | 10 +++++----- doc/src/zh_CN/getting-started/tutorials.qdoc | 10 +++++----- doc/src/zh_CN/tutorials/addressbook.qdoc | 10 +++++----- doc/src/zh_CN/tutorials/widgets-tutorial.qdoc | 10 +++++----- header.FDL | 10 +++++----- src/corelib/codecs/codecs.qdoc | 10 +++++----- src/corelib/global/qendian.qdoc | 10 +++++----- src/corelib/global/qnamespace.qdoc | 10 +++++----- src/corelib/kernel/qmath.qdoc | 10 +++++----- src/corelib/plugin/qplugin.qdoc | 10 +++++----- src/corelib/thread/qwaitcondition.qdoc | 10 +++++----- src/corelib/tools/qalgorithms.qdoc | 10 +++++----- src/corelib/tools/qcache.qdoc | 10 +++++----- src/corelib/tools/qiterator.qdoc | 10 +++++----- src/corelib/tools/qpair.qdoc | 10 +++++----- src/corelib/tools/qset.qdoc | 10 +++++----- src/corelib/tools/qvarlengtharray.qdoc | 10 +++++----- src/gui/dialogs/qprintdialog.qdoc | 10 +++++----- src/gui/kernel/qdesktopwidget.qdoc | 10 +++++----- src/gui/kernel/qsizepolicy.qdoc | 10 +++++----- src/gui/painting/qcolormap.qdoc | 10 +++++----- src/gui/painting/qpaintdevice.qdoc | 10 +++++----- src/gui/painting/qprinterinfo.qdoc | 10 +++++----- src/gui/styles/qmacstyle.qdoc | 10 +++++----- src/qt3support/sql/q3sqlfieldinfo.qdoc | 10 +++++----- src/qt3support/sql/q3sqlrecordinfo.qdoc | 10 +++++----- src/qt3support/tools/q3asciicache.qdoc | 10 +++++----- src/qt3support/tools/q3asciidict.qdoc | 10 +++++----- src/qt3support/tools/q3cache.qdoc | 10 +++++----- src/qt3support/tools/q3dict.qdoc | 10 +++++----- src/qt3support/tools/q3intcache.qdoc | 10 +++++----- src/qt3support/tools/q3intdict.qdoc | 10 +++++----- src/qt3support/tools/q3memarray.qdoc | 10 +++++----- src/qt3support/tools/q3ptrdict.qdoc | 10 +++++----- src/qt3support/tools/q3ptrlist.qdoc | 10 +++++----- src/qt3support/tools/q3ptrqueue.qdoc | 10 +++++----- src/qt3support/tools/q3ptrstack.qdoc | 10 +++++----- src/qt3support/tools/q3ptrvector.qdoc | 10 +++++----- src/qt3support/tools/q3valuelist.qdoc | 10 +++++----- src/qt3support/tools/q3valuestack.qdoc | 10 +++++----- src/qt3support/tools/q3valuevector.qdoc | 10 +++++----- src/sql/kernel/qsql.qdoc | 10 +++++----- src/testlib/qsignalspy.qdoc | 10 +++++----- src/testlib/qtestevent.qdoc | 10 +++++----- tools/assistant/tools/assistant/doc/assistant.qdoc | 10 +++++----- tools/designer/src/lib/sdk/abstractdnditem.qdoc | 10 +++++----- tools/designer/src/lib/sdk/abstracticoncache.qdoc | 10 +++++----- tools/designer/src/lib/sdk/dynamicpropertysheet.qdoc | 10 +++++----- tools/designer/src/lib/sdk/layoutdecoration.qdoc | 10 +++++----- tools/designer/src/lib/sdk/membersheet.qdoc | 10 +++++----- tools/designer/src/lib/sdk/propertysheet.qdoc | 10 +++++----- tools/designer/src/lib/sdk/taskmenu.qdoc | 10 +++++----- tools/designer/src/lib/uilib/container.qdoc | 10 +++++----- tools/designer/src/lib/uilib/customwidget.qdoc | 10 +++++----- tools/qdoc3/doc/qdoc-manual.qdoc | 10 +++++----- util/qlalr/doc/src/qlalr.qdoc | 10 +++++----- 586 files changed, 2930 insertions(+), 2930 deletions(-) diff --git a/demos/textedit/textedit.qdoc b/demos/textedit/textedit.qdoc index f3ba4d7..c27589e 100644 --- a/demos/textedit/textedit.qdoc +++ b/demos/textedit/textedit.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/bughowto.qdoc b/doc/src/bughowto.qdoc index 568c34e..a7b5569 100644 --- a/doc/src/bughowto.qdoc +++ b/doc/src/bughowto.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/classes.qdoc b/doc/src/classes.qdoc index b3f8869..66009f5 100644 --- a/doc/src/classes.qdoc +++ b/doc/src/classes.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/classes/exportedfunctions.qdoc b/doc/src/classes/exportedfunctions.qdoc index b3fd5a0..ac6a970 100644 --- a/doc/src/classes/exportedfunctions.qdoc +++ b/doc/src/classes/exportedfunctions.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/classes/phonon-namespace.qdoc b/doc/src/classes/phonon-namespace.qdoc index 282c96f..c53f69b 100644 --- a/doc/src/classes/phonon-namespace.qdoc +++ b/doc/src/classes/phonon-namespace.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/credits.qdoc b/doc/src/credits.qdoc index 2f1d76e..20aa366 100644 --- a/doc/src/credits.qdoc +++ b/doc/src/credits.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/advtutorial.qdoc b/doc/src/declarative/advtutorial.qdoc index 1341bbb..1954dd4 100644 --- a/doc/src/declarative/advtutorial.qdoc +++ b/doc/src/declarative/advtutorial.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/anchor-layout.qdoc b/doc/src/declarative/anchor-layout.qdoc index 99f7777..b77ce36 100644 --- a/doc/src/declarative/anchor-layout.qdoc +++ b/doc/src/declarative/anchor-layout.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/animation.qdoc b/doc/src/declarative/animation.qdoc index 53a0c55..208a1c4 100644 --- a/doc/src/declarative/animation.qdoc +++ b/doc/src/declarative/animation.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/basictypes.qdoc b/doc/src/declarative/basictypes.qdoc index e327d4a..9a616ea 100644 --- a/doc/src/declarative/basictypes.qdoc +++ b/doc/src/declarative/basictypes.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/codingconventions.qdoc b/doc/src/declarative/codingconventions.qdoc index aa4feef..ba789e0 100644 --- a/doc/src/declarative/codingconventions.qdoc +++ b/doc/src/declarative/codingconventions.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc index cb326a3..f64da96 100644 --- a/doc/src/declarative/declarativeui.qdoc +++ b/doc/src/declarative/declarativeui.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/dynamicobjects.qdoc b/doc/src/declarative/dynamicobjects.qdoc index e735bce..3921d3e 100644 --- a/doc/src/declarative/dynamicobjects.qdoc +++ b/doc/src/declarative/dynamicobjects.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc index 252b964..a0eb95d 100644 --- a/doc/src/declarative/elements.qdoc +++ b/doc/src/declarative/elements.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/example-slideswitch.qdoc b/doc/src/declarative/example-slideswitch.qdoc index 1a40f14..a62f670 100644 --- a/doc/src/declarative/example-slideswitch.qdoc +++ b/doc/src/declarative/example-slideswitch.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc index 3f075bb..224d346 100644 --- a/doc/src/declarative/examples.qdoc +++ b/doc/src/declarative/examples.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/extending-tutorial.qdoc b/doc/src/declarative/extending-tutorial.qdoc index 1e5441b..3b2fe3b 100644 --- a/doc/src/declarative/extending-tutorial.qdoc +++ b/doc/src/declarative/extending-tutorial.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index 0c41c93..a52cb94 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/focus.qdoc b/doc/src/declarative/focus.qdoc index 56ea165..8c1906e 100644 --- a/doc/src/declarative/focus.qdoc +++ b/doc/src/declarative/focus.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc index a9aee2f..ffc84f9 100644 --- a/doc/src/declarative/globalobject.qdoc +++ b/doc/src/declarative/globalobject.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/integrating.qdoc b/doc/src/declarative/integrating.qdoc index 2586009..682f792 100644 --- a/doc/src/declarative/integrating.qdoc +++ b/doc/src/declarative/integrating.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/javascriptblocks.qdoc b/doc/src/declarative/javascriptblocks.qdoc index d290690..b6fad5b 100644 --- a/doc/src/declarative/javascriptblocks.qdoc +++ b/doc/src/declarative/javascriptblocks.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/modules.qdoc b/doc/src/declarative/modules.qdoc index 467b7d0..2339d66 100644 --- a/doc/src/declarative/modules.qdoc +++ b/doc/src/declarative/modules.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/network.qdoc b/doc/src/declarative/network.qdoc index 60359de..a19ca6b 100644 --- a/doc/src/declarative/network.qdoc +++ b/doc/src/declarative/network.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/positioners.qdoc b/doc/src/declarative/positioners.qdoc index 8c9b8b7..9265732 100644 --- a/doc/src/declarative/positioners.qdoc +++ b/doc/src/declarative/positioners.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/propertybinding.qdoc b/doc/src/declarative/propertybinding.qdoc index 314bf67..3ee72bd 100644 --- a/doc/src/declarative/propertybinding.qdoc +++ b/doc/src/declarative/propertybinding.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/qdeclarativedebugging.qdoc b/doc/src/declarative/qdeclarativedebugging.qdoc index 64c312c..0a3050e 100644 --- a/doc/src/declarative/qdeclarativedebugging.qdoc +++ b/doc/src/declarative/qdeclarativedebugging.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/qdeclarativedocument.qdoc b/doc/src/declarative/qdeclarativedocument.qdoc index 8ca6c11..5717d87 100644 --- a/doc/src/declarative/qdeclarativedocument.qdoc +++ b/doc/src/declarative/qdeclarativedocument.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/qdeclarativei18n.qdoc b/doc/src/declarative/qdeclarativei18n.qdoc index 70a3587..b26a903 100644 --- a/doc/src/declarative/qdeclarativei18n.qdoc +++ b/doc/src/declarative/qdeclarativei18n.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/qdeclarativeintro.qdoc b/doc/src/declarative/qdeclarativeintro.qdoc index fa42f59..3e45098 100644 --- a/doc/src/declarative/qdeclarativeintro.qdoc +++ b/doc/src/declarative/qdeclarativeintro.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index 7548c96..e11cd56 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/qdeclarativeperformance.qdoc b/doc/src/declarative/qdeclarativeperformance.qdoc index be8c029..456197b 100644 --- a/doc/src/declarative/qdeclarativeperformance.qdoc +++ b/doc/src/declarative/qdeclarativeperformance.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/qdeclarativereference.qdoc b/doc/src/declarative/qdeclarativereference.qdoc index 8c5811b..c2c5e91 100644 --- a/doc/src/declarative/qdeclarativereference.qdoc +++ b/doc/src/declarative/qdeclarativereference.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/qdeclarativesecurity.qdoc b/doc/src/declarative/qdeclarativesecurity.qdoc index 199e2da..836f990 100644 --- a/doc/src/declarative/qdeclarativesecurity.qdoc +++ b/doc/src/declarative/qdeclarativesecurity.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/qdeclarativestates.qdoc b/doc/src/declarative/qdeclarativestates.qdoc index 274040a..d5d7a96 100644 --- a/doc/src/declarative/qdeclarativestates.qdoc +++ b/doc/src/declarative/qdeclarativestates.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/qml-intro.qdoc b/doc/src/declarative/qml-intro.qdoc index b77611c..193d17b 100644 --- a/doc/src/declarative/qml-intro.qdoc +++ b/doc/src/declarative/qml-intro.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/qmlruntime.qdoc b/doc/src/declarative/qmlruntime.qdoc index 9a84237..131c738 100644 --- a/doc/src/declarative/qmlruntime.qdoc +++ b/doc/src/declarative/qmlruntime.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/qmlviewer.qdoc b/doc/src/declarative/qmlviewer.qdoc index 41c4c80..dc08d7b 100644 --- a/doc/src/declarative/qmlviewer.qdoc +++ b/doc/src/declarative/qmlviewer.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/qtbinding.qdoc b/doc/src/declarative/qtbinding.qdoc index 6eade18..bc17bde 100644 --- a/doc/src/declarative/qtbinding.qdoc +++ b/doc/src/declarative/qtbinding.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc index 5232841..7ecdc53 100644 --- a/doc/src/declarative/qtdeclarative.qdoc +++ b/doc/src/declarative/qtdeclarative.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/qtprogrammers.qdoc b/doc/src/declarative/qtprogrammers.qdoc index c0639db..1615157 100644 --- a/doc/src/declarative/qtprogrammers.qdoc +++ b/doc/src/declarative/qtprogrammers.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/scope.qdoc b/doc/src/declarative/scope.qdoc index 363ba8d..c702c91 100644 --- a/doc/src/declarative/scope.qdoc +++ b/doc/src/declarative/scope.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/declarative/tutorial.qdoc b/doc/src/declarative/tutorial.qdoc index f913d44..8467478 100644 --- a/doc/src/declarative/tutorial.qdoc +++ b/doc/src/declarative/tutorial.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/affine.qdoc b/doc/src/demos/affine.qdoc index b4bd5d6..f8b3fd2 100644 --- a/doc/src/demos/affine.qdoc +++ b/doc/src/demos/affine.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/anomaly.qdoc b/doc/src/demos/anomaly.qdoc index ab00757..403a516 100644 --- a/doc/src/demos/anomaly.qdoc +++ b/doc/src/demos/anomaly.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/arthurplugin.qdoc b/doc/src/demos/arthurplugin.qdoc index 2345fdd..1c28bfe 100644 --- a/doc/src/demos/arthurplugin.qdoc +++ b/doc/src/demos/arthurplugin.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/books.qdoc b/doc/src/demos/books.qdoc index 8fbeb0a..f712fb2 100644 --- a/doc/src/demos/books.qdoc +++ b/doc/src/demos/books.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/boxes.qdoc b/doc/src/demos/boxes.qdoc index bae6a70..67657ce 100644 --- a/doc/src/demos/boxes.qdoc +++ b/doc/src/demos/boxes.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/browser.qdoc b/doc/src/demos/browser.qdoc index 722e28b..6286f76 100644 --- a/doc/src/demos/browser.qdoc +++ b/doc/src/demos/browser.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/chip.qdoc b/doc/src/demos/chip.qdoc index bfe9cec..7573b2e 100644 --- a/doc/src/demos/chip.qdoc +++ b/doc/src/demos/chip.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/composition.qdoc b/doc/src/demos/composition.qdoc index 7bf0caa..b642abc 100644 --- a/doc/src/demos/composition.qdoc +++ b/doc/src/demos/composition.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/deform.qdoc b/doc/src/demos/deform.qdoc index e516c2b..6e7938f 100644 --- a/doc/src/demos/deform.qdoc +++ b/doc/src/demos/deform.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/desktopservices.qdoc b/doc/src/demos/desktopservices.qdoc index b281bdf..1da3244 100644 --- a/doc/src/demos/desktopservices.qdoc +++ b/doc/src/demos/desktopservices.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/digiflip.qdoc b/doc/src/demos/digiflip.qdoc index f275797..174c337 100644 --- a/doc/src/demos/digiflip.qdoc +++ b/doc/src/demos/digiflip.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/embeddeddialogs.qdoc b/doc/src/demos/embeddeddialogs.qdoc index db331dd..3be0e65 100644 --- a/doc/src/demos/embeddeddialogs.qdoc +++ b/doc/src/demos/embeddeddialogs.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/embeddedsvgviewer.qdoc b/doc/src/demos/embeddedsvgviewer.qdoc index 9df35a8..a866ef5 100644 --- a/doc/src/demos/embeddedsvgviewer.qdoc +++ b/doc/src/demos/embeddedsvgviewer.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/flickable.qdoc b/doc/src/demos/flickable.qdoc index 9b2db8c..1e1cb33 100644 --- a/doc/src/demos/flickable.qdoc +++ b/doc/src/demos/flickable.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/flightinfo.qdoc b/doc/src/demos/flightinfo.qdoc index af4448b..f31d298 100644 --- a/doc/src/demos/flightinfo.qdoc +++ b/doc/src/demos/flightinfo.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/fluidlauncher.qdoc b/doc/src/demos/fluidlauncher.qdoc index eabeaaa..9619077 100644 --- a/doc/src/demos/fluidlauncher.qdoc +++ b/doc/src/demos/fluidlauncher.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/gradients.qdoc b/doc/src/demos/gradients.qdoc index 7552c54..de79b8c 100644 --- a/doc/src/demos/gradients.qdoc +++ b/doc/src/demos/gradients.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/interview.qdoc b/doc/src/demos/interview.qdoc index 40e6369..ea4ff9f 100644 --- a/doc/src/demos/interview.qdoc +++ b/doc/src/demos/interview.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/lightmaps.qdoc b/doc/src/demos/lightmaps.qdoc index 2234893..02a3362 100644 --- a/doc/src/demos/lightmaps.qdoc +++ b/doc/src/demos/lightmaps.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/macmainwindow.qdoc b/doc/src/demos/macmainwindow.qdoc index 28ccf7c..dd95530 100644 --- a/doc/src/demos/macmainwindow.qdoc +++ b/doc/src/demos/macmainwindow.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/mainwindow.qdoc b/doc/src/demos/mainwindow.qdoc index 9bd301c..97ebf84 100644 --- a/doc/src/demos/mainwindow.qdoc +++ b/doc/src/demos/mainwindow.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/mediaplayer.qdoc b/doc/src/demos/mediaplayer.qdoc index 8d2fc9a..b20cb5d 100644 --- a/doc/src/demos/mediaplayer.qdoc +++ b/doc/src/demos/mediaplayer.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/pathstroke.qdoc b/doc/src/demos/pathstroke.qdoc index deaa660..ecb442d 100644 --- a/doc/src/demos/pathstroke.qdoc +++ b/doc/src/demos/pathstroke.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/qtdemo.qdoc b/doc/src/demos/qtdemo.qdoc index 04fd548..65afa51 100644 --- a/doc/src/demos/qtdemo.qdoc +++ b/doc/src/demos/qtdemo.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/raycasting.qdoc b/doc/src/demos/raycasting.qdoc index 9ad4ca5..5cbf55d 100644 --- a/doc/src/demos/raycasting.qdoc +++ b/doc/src/demos/raycasting.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/spectrum.qdoc b/doc/src/demos/spectrum.qdoc index d5a3f85..0d3823b 100644 --- a/doc/src/demos/spectrum.qdoc +++ b/doc/src/demos/spectrum.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/spreadsheet.qdoc b/doc/src/demos/spreadsheet.qdoc index 496425d..a77ba9e 100644 --- a/doc/src/demos/spreadsheet.qdoc +++ b/doc/src/demos/spreadsheet.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/sqlbrowser.qdoc b/doc/src/demos/sqlbrowser.qdoc index 88eead6..57e7bc2 100644 --- a/doc/src/demos/sqlbrowser.qdoc +++ b/doc/src/demos/sqlbrowser.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/styledemo.qdoc b/doc/src/demos/styledemo.qdoc index 1a6ba9c..21e2381 100644 --- a/doc/src/demos/styledemo.qdoc +++ b/doc/src/demos/styledemo.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/sub-attaq.qdoc b/doc/src/demos/sub-attaq.qdoc index 42b6b45..1d53a18 100644 --- a/doc/src/demos/sub-attaq.qdoc +++ b/doc/src/demos/sub-attaq.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/textedit.qdoc b/doc/src/demos/textedit.qdoc index e7b628f..40410c7 100644 --- a/doc/src/demos/textedit.qdoc +++ b/doc/src/demos/textedit.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/undo.qdoc b/doc/src/demos/undo.qdoc index fd31ba1..c66def9 100644 --- a/doc/src/demos/undo.qdoc +++ b/doc/src/demos/undo.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/demos/weatherinfo.qdoc b/doc/src/demos/weatherinfo.qdoc index bc43a97..8e7bd67 100644 --- a/doc/src/demos/weatherinfo.qdoc +++ b/doc/src/demos/weatherinfo.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/deployment/deployment-plugins.qdoc b/doc/src/deployment/deployment-plugins.qdoc index 7bb14ff..0885163 100644 --- a/doc/src/deployment/deployment-plugins.qdoc +++ b/doc/src/deployment/deployment-plugins.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/deployment/deployment.qdoc b/doc/src/deployment/deployment.qdoc index f2908bd..664f002 100644 --- a/doc/src/deployment/deployment.qdoc +++ b/doc/src/deployment/deployment.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/deployment/qt-conf.qdoc b/doc/src/deployment/qt-conf.qdoc index 48d688b..920eba6 100644 --- a/doc/src/deployment/qt-conf.qdoc +++ b/doc/src/deployment/qt-conf.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/deployment/qtconfig.qdoc b/doc/src/deployment/qtconfig.qdoc index 8c3658c..e429599 100644 --- a/doc/src/deployment/qtconfig.qdoc +++ b/doc/src/deployment/qtconfig.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/development/activeqt-dumpcpp.qdoc b/doc/src/development/activeqt-dumpcpp.qdoc index 5d689eb..843d40d 100644 --- a/doc/src/development/activeqt-dumpcpp.qdoc +++ b/doc/src/development/activeqt-dumpcpp.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/development/activeqt-dumpdoc.qdoc b/doc/src/development/activeqt-dumpdoc.qdoc index 3ecc2c9..26450e3 100644 --- a/doc/src/development/activeqt-dumpdoc.qdoc +++ b/doc/src/development/activeqt-dumpdoc.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/development/activeqt-idc.qdoc b/doc/src/development/activeqt-idc.qdoc index 60ac079..7a0ff66 100644 --- a/doc/src/development/activeqt-idc.qdoc +++ b/doc/src/development/activeqt-idc.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/development/activeqt-testcon.qdoc b/doc/src/development/activeqt-testcon.qdoc index 35fe5df..86d4097 100644 --- a/doc/src/development/activeqt-testcon.qdoc +++ b/doc/src/development/activeqt-testcon.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/development/assistant-manual.qdoc b/doc/src/development/assistant-manual.qdoc index d25a4b3..6924767 100644 --- a/doc/src/development/assistant-manual.qdoc +++ b/doc/src/development/assistant-manual.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/development/debug.qdoc b/doc/src/development/debug.qdoc index 9e881d1..91a83cf 100644 --- a/doc/src/development/debug.qdoc +++ b/doc/src/development/debug.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/development/designer-manual.qdoc b/doc/src/development/designer-manual.qdoc index 01229ad..b30a700 100644 --- a/doc/src/development/designer-manual.qdoc +++ b/doc/src/development/designer-manual.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/development/developing-on-mac.qdoc b/doc/src/development/developing-on-mac.qdoc index ab2ed70..5ea4d22 100644 --- a/doc/src/development/developing-on-mac.qdoc +++ b/doc/src/development/developing-on-mac.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/development/developing-with-qt.qdoc b/doc/src/development/developing-with-qt.qdoc index b88fe3f..3972b59 100644 --- a/doc/src/development/developing-with-qt.qdoc +++ b/doc/src/development/developing-with-qt.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/development/moc.qdoc b/doc/src/development/moc.qdoc index bbcaf3f..6ecaf09 100644 --- a/doc/src/development/moc.qdoc +++ b/doc/src/development/moc.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index 754b8ad..f340525 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/development/qmsdev.qdoc b/doc/src/development/qmsdev.qdoc index ab99719..07b77cf 100644 --- a/doc/src/development/qmsdev.qdoc +++ b/doc/src/development/qmsdev.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/development/qtestlib.qdoc b/doc/src/development/qtestlib.qdoc index a83c27e..23d6670 100644 --- a/doc/src/development/qtestlib.qdoc +++ b/doc/src/development/qtestlib.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/development/rcc.qdoc b/doc/src/development/rcc.qdoc index 5b3c6c7..2bbac6a 100644 --- a/doc/src/development/rcc.qdoc +++ b/doc/src/development/rcc.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/development/tools-list.qdoc b/doc/src/development/tools-list.qdoc index 4f6945d..c362bdf 100644 --- a/doc/src/development/tools-list.qdoc +++ b/doc/src/development/tools-list.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/development/uic.qdoc b/doc/src/development/uic.qdoc index edeb64a..ec8b3d6 100644 --- a/doc/src/development/uic.qdoc +++ b/doc/src/development/uic.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/2dpainting.qdoc b/doc/src/examples/2dpainting.qdoc index b349c83..079fa13 100644 --- a/doc/src/examples/2dpainting.qdoc +++ b/doc/src/examples/2dpainting.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/activeqt/comapp.qdoc b/doc/src/examples/activeqt/comapp.qdoc index 1355cb5..f1884ef 100644 --- a/doc/src/examples/activeqt/comapp.qdoc +++ b/doc/src/examples/activeqt/comapp.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/activeqt/dotnet.qdoc b/doc/src/examples/activeqt/dotnet.qdoc index f523830..55853d9 100644 --- a/doc/src/examples/activeqt/dotnet.qdoc +++ b/doc/src/examples/activeqt/dotnet.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/activeqt/hierarchy.qdoc b/doc/src/examples/activeqt/hierarchy.qdoc index 71e21cf..7905e8a 100644 --- a/doc/src/examples/activeqt/hierarchy.qdoc +++ b/doc/src/examples/activeqt/hierarchy.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/activeqt/menus.qdoc b/doc/src/examples/activeqt/menus.qdoc index 7310e97..ed91a3e 100644 --- a/doc/src/examples/activeqt/menus.qdoc +++ b/doc/src/examples/activeqt/menus.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/activeqt/multiple.qdoc b/doc/src/examples/activeqt/multiple.qdoc index aae93b0..036f80e 100644 --- a/doc/src/examples/activeqt/multiple.qdoc +++ b/doc/src/examples/activeqt/multiple.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/activeqt/opengl.qdoc b/doc/src/examples/activeqt/opengl.qdoc index caf9361..2c55e1e 100644 --- a/doc/src/examples/activeqt/opengl.qdoc +++ b/doc/src/examples/activeqt/opengl.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/activeqt/qutlook.qdoc b/doc/src/examples/activeqt/qutlook.qdoc index 9ceb6b6..845305f 100644 --- a/doc/src/examples/activeqt/qutlook.qdoc +++ b/doc/src/examples/activeqt/qutlook.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/activeqt/simple.qdoc b/doc/src/examples/activeqt/simple.qdoc index 72f99e8..9860326 100644 --- a/doc/src/examples/activeqt/simple.qdoc +++ b/doc/src/examples/activeqt/simple.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/activeqt/webbrowser.qdoc b/doc/src/examples/activeqt/webbrowser.qdoc index 051a26f..3b66c57 100644 --- a/doc/src/examples/activeqt/webbrowser.qdoc +++ b/doc/src/examples/activeqt/webbrowser.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/activeqt/wrapper.qdoc b/doc/src/examples/activeqt/wrapper.qdoc index 2cb0981..4bf7901 100644 --- a/doc/src/examples/activeqt/wrapper.qdoc +++ b/doc/src/examples/activeqt/wrapper.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/addressbook.qdoc b/doc/src/examples/addressbook.qdoc index 18211e9..8de1778 100644 --- a/doc/src/examples/addressbook.qdoc +++ b/doc/src/examples/addressbook.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/analogclock.qdoc b/doc/src/examples/analogclock.qdoc index fe39cda..45e78c3 100644 --- a/doc/src/examples/analogclock.qdoc +++ b/doc/src/examples/analogclock.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/animatedtiles.qdoc b/doc/src/examples/animatedtiles.qdoc index 329f3fb..5a99d21 100644 --- a/doc/src/examples/animatedtiles.qdoc +++ b/doc/src/examples/animatedtiles.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/appchooser.qdoc b/doc/src/examples/appchooser.qdoc index 940b207..f9c4a8d 100644 --- a/doc/src/examples/appchooser.qdoc +++ b/doc/src/examples/appchooser.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/application.qdoc b/doc/src/examples/application.qdoc index 699d40c..b69009f 100644 --- a/doc/src/examples/application.qdoc +++ b/doc/src/examples/application.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/arrowpad.qdoc b/doc/src/examples/arrowpad.qdoc index 0fa7c40..647f20e 100644 --- a/doc/src/examples/arrowpad.qdoc +++ b/doc/src/examples/arrowpad.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/audiodevices.qdoc b/doc/src/examples/audiodevices.qdoc index 4bf65ee..aa04f60 100644 --- a/doc/src/examples/audiodevices.qdoc +++ b/doc/src/examples/audiodevices.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/audioinput.qdoc b/doc/src/examples/audioinput.qdoc index d224423..b7f390b 100644 --- a/doc/src/examples/audioinput.qdoc +++ b/doc/src/examples/audioinput.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/audiooutput.qdoc b/doc/src/examples/audiooutput.qdoc index 429cff2..618db27 100644 --- a/doc/src/examples/audiooutput.qdoc +++ b/doc/src/examples/audiooutput.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/basicdrawing.qdoc b/doc/src/examples/basicdrawing.qdoc index 0e8cc69..d0b5294 100644 --- a/doc/src/examples/basicdrawing.qdoc +++ b/doc/src/examples/basicdrawing.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/basicgraphicslayouts.qdoc b/doc/src/examples/basicgraphicslayouts.qdoc index 335506a..5951873 100644 --- a/doc/src/examples/basicgraphicslayouts.qdoc +++ b/doc/src/examples/basicgraphicslayouts.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/basiclayouts.qdoc b/doc/src/examples/basiclayouts.qdoc index 03cd590..1ecf394 100644 --- a/doc/src/examples/basiclayouts.qdoc +++ b/doc/src/examples/basiclayouts.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/basicsortfiltermodel.qdoc b/doc/src/examples/basicsortfiltermodel.qdoc index 176a77d..8d00e03 100644 --- a/doc/src/examples/basicsortfiltermodel.qdoc +++ b/doc/src/examples/basicsortfiltermodel.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/bearercloud.qdoc b/doc/src/examples/bearercloud.qdoc index 7a61bac..bf5da41 100644 --- a/doc/src/examples/bearercloud.qdoc +++ b/doc/src/examples/bearercloud.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/bearermonitor.qdoc b/doc/src/examples/bearermonitor.qdoc index 5295488..1a15bc3 100644 --- a/doc/src/examples/bearermonitor.qdoc +++ b/doc/src/examples/bearermonitor.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/blockingfortuneclient.qdoc b/doc/src/examples/blockingfortuneclient.qdoc index 9545823..be8a9ba 100644 --- a/doc/src/examples/blockingfortuneclient.qdoc +++ b/doc/src/examples/blockingfortuneclient.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/blurpicker.qdoc b/doc/src/examples/blurpicker.qdoc index 0edcfdd..7be5863 100644 --- a/doc/src/examples/blurpicker.qdoc +++ b/doc/src/examples/blurpicker.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/borderlayout.qdoc b/doc/src/examples/borderlayout.qdoc index 47414f7..5ccc95f 100644 --- a/doc/src/examples/borderlayout.qdoc +++ b/doc/src/examples/borderlayout.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/broadcastreceiver.qdoc b/doc/src/examples/broadcastreceiver.qdoc index b40f7c0..13555e7 100644 --- a/doc/src/examples/broadcastreceiver.qdoc +++ b/doc/src/examples/broadcastreceiver.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/broadcastsender.qdoc b/doc/src/examples/broadcastsender.qdoc index 0e88a88..b7140b9 100644 --- a/doc/src/examples/broadcastsender.qdoc +++ b/doc/src/examples/broadcastsender.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/cachedtable.qdoc b/doc/src/examples/cachedtable.qdoc index efbcee1..31cc40f 100644 --- a/doc/src/examples/cachedtable.qdoc +++ b/doc/src/examples/cachedtable.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/calculator.qdoc b/doc/src/examples/calculator.qdoc index bda369b..a85e0b0 100644 --- a/doc/src/examples/calculator.qdoc +++ b/doc/src/examples/calculator.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/calculatorbuilder.qdoc b/doc/src/examples/calculatorbuilder.qdoc index dae70be..03acb93 100644 --- a/doc/src/examples/calculatorbuilder.qdoc +++ b/doc/src/examples/calculatorbuilder.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/calculatorform.qdoc b/doc/src/examples/calculatorform.qdoc index 5c36589..9ee6e3c 100644 --- a/doc/src/examples/calculatorform.qdoc +++ b/doc/src/examples/calculatorform.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/calendar.qdoc b/doc/src/examples/calendar.qdoc index 27ef538..1395a3f 100644 --- a/doc/src/examples/calendar.qdoc +++ b/doc/src/examples/calendar.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/calendarwidget.qdoc b/doc/src/examples/calendarwidget.qdoc index 3338f22..a65145f 100644 --- a/doc/src/examples/calendarwidget.qdoc +++ b/doc/src/examples/calendarwidget.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/capabilitiesexample.qdoc b/doc/src/examples/capabilitiesexample.qdoc index 59a30e5..2eab2c0 100644 --- a/doc/src/examples/capabilitiesexample.qdoc +++ b/doc/src/examples/capabilitiesexample.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/charactermap.qdoc b/doc/src/examples/charactermap.qdoc index 9dd69ca..b9dd0c0 100644 --- a/doc/src/examples/charactermap.qdoc +++ b/doc/src/examples/charactermap.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/chart.qdoc b/doc/src/examples/chart.qdoc index 78b3295..4021d46 100644 --- a/doc/src/examples/chart.qdoc +++ b/doc/src/examples/chart.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/classwizard.qdoc b/doc/src/examples/classwizard.qdoc index d81084f..18da08e 100644 --- a/doc/src/examples/classwizard.qdoc +++ b/doc/src/examples/classwizard.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/codecs.qdoc b/doc/src/examples/codecs.qdoc index a0699bf..fc948e8 100644 --- a/doc/src/examples/codecs.qdoc +++ b/doc/src/examples/codecs.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/codeeditor.qdoc b/doc/src/examples/codeeditor.qdoc index 9dc176c..6c7b914 100644 --- a/doc/src/examples/codeeditor.qdoc +++ b/doc/src/examples/codeeditor.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/collidingmice-example.qdoc b/doc/src/examples/collidingmice-example.qdoc index 7a19575..af364ff 100644 --- a/doc/src/examples/collidingmice-example.qdoc +++ b/doc/src/examples/collidingmice-example.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/coloreditorfactory.qdoc b/doc/src/examples/coloreditorfactory.qdoc index 2229869..5a419e4 100644 --- a/doc/src/examples/coloreditorfactory.qdoc +++ b/doc/src/examples/coloreditorfactory.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/combowidgetmapper.qdoc b/doc/src/examples/combowidgetmapper.qdoc index 3621419..3a396c9 100644 --- a/doc/src/examples/combowidgetmapper.qdoc +++ b/doc/src/examples/combowidgetmapper.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/completer.qdoc b/doc/src/examples/completer.qdoc index 0237475..d56f4e6 100644 --- a/doc/src/examples/completer.qdoc +++ b/doc/src/examples/completer.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/complexpingpong.qdoc b/doc/src/examples/complexpingpong.qdoc index c99095f..a49568d 100644 --- a/doc/src/examples/complexpingpong.qdoc +++ b/doc/src/examples/complexpingpong.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/concentriccircles.qdoc b/doc/src/examples/concentriccircles.qdoc index 3594736..03fb5ec 100644 --- a/doc/src/examples/concentriccircles.qdoc +++ b/doc/src/examples/concentriccircles.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/configdialog.qdoc b/doc/src/examples/configdialog.qdoc index d05fd81..1c936b9 100644 --- a/doc/src/examples/configdialog.qdoc +++ b/doc/src/examples/configdialog.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/containerextension.qdoc b/doc/src/examples/containerextension.qdoc index c4c108f..64c607e 100644 --- a/doc/src/examples/containerextension.qdoc +++ b/doc/src/examples/containerextension.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/context2d.qdoc b/doc/src/examples/context2d.qdoc index d9b30ea..9501cc0 100644 --- a/doc/src/examples/context2d.qdoc +++ b/doc/src/examples/context2d.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/contextsensitivehelp.qdoc b/doc/src/examples/contextsensitivehelp.qdoc index d88356c..79baf3c 100644 --- a/doc/src/examples/contextsensitivehelp.qdoc +++ b/doc/src/examples/contextsensitivehelp.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/contiguouscache.qdoc b/doc/src/examples/contiguouscache.qdoc index 2236fc4..cb8bd08 100644 --- a/doc/src/examples/contiguouscache.qdoc +++ b/doc/src/examples/contiguouscache.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/customcompleter.qdoc b/doc/src/examples/customcompleter.qdoc index 415abaa..9f49780 100644 --- a/doc/src/examples/customcompleter.qdoc +++ b/doc/src/examples/customcompleter.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/customsortfiltermodel.qdoc b/doc/src/examples/customsortfiltermodel.qdoc index 16b3bb6..98fcd05 100644 --- a/doc/src/examples/customsortfiltermodel.qdoc +++ b/doc/src/examples/customsortfiltermodel.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/customtype.qdoc b/doc/src/examples/customtype.qdoc index e003129..1033038 100644 --- a/doc/src/examples/customtype.qdoc +++ b/doc/src/examples/customtype.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/customtypesending.qdoc b/doc/src/examples/customtypesending.qdoc index c4f262b..83f0e85 100644 --- a/doc/src/examples/customtypesending.qdoc +++ b/doc/src/examples/customtypesending.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/customwidgetplugin.qdoc b/doc/src/examples/customwidgetplugin.qdoc index 05a2255..c0c6180 100644 --- a/doc/src/examples/customwidgetplugin.qdoc +++ b/doc/src/examples/customwidgetplugin.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/dbscreen.qdoc b/doc/src/examples/dbscreen.qdoc index c3c4def..36c7bde 100644 --- a/doc/src/examples/dbscreen.qdoc +++ b/doc/src/examples/dbscreen.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/dbus-chat.qdoc b/doc/src/examples/dbus-chat.qdoc index 593a340..1627593 100644 --- a/doc/src/examples/dbus-chat.qdoc +++ b/doc/src/examples/dbus-chat.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/dbus-listnames.qdoc b/doc/src/examples/dbus-listnames.qdoc index b163910..0f634d3 100644 --- a/doc/src/examples/dbus-listnames.qdoc +++ b/doc/src/examples/dbus-listnames.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/dbus-pingpong.qdoc b/doc/src/examples/dbus-pingpong.qdoc index e1aea2a..47f624d 100644 --- a/doc/src/examples/dbus-pingpong.qdoc +++ b/doc/src/examples/dbus-pingpong.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/dbus-remotecontrolledcar.qdoc b/doc/src/examples/dbus-remotecontrolledcar.qdoc index b7ffd08..93179e6 100644 --- a/doc/src/examples/dbus-remotecontrolledcar.qdoc +++ b/doc/src/examples/dbus-remotecontrolledcar.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/defaultprototypes.qdoc b/doc/src/examples/defaultprototypes.qdoc index c3c056a..d4075db 100644 --- a/doc/src/examples/defaultprototypes.qdoc +++ b/doc/src/examples/defaultprototypes.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/delayedencoding.qdoc b/doc/src/examples/delayedencoding.qdoc index e3f00dc..f674dcb 100644 --- a/doc/src/examples/delayedencoding.qdoc +++ b/doc/src/examples/delayedencoding.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/diagramscene.qdoc b/doc/src/examples/diagramscene.qdoc index 7c643c2..98bc983 100644 --- a/doc/src/examples/diagramscene.qdoc +++ b/doc/src/examples/diagramscene.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/digitalclock.qdoc b/doc/src/examples/digitalclock.qdoc index 7495b7d..e550a52 100644 --- a/doc/src/examples/digitalclock.qdoc +++ b/doc/src/examples/digitalclock.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/dirview.qdoc b/doc/src/examples/dirview.qdoc index 0fdebf5..b36d81f 100644 --- a/doc/src/examples/dirview.qdoc +++ b/doc/src/examples/dirview.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/dockwidgets.qdoc b/doc/src/examples/dockwidgets.qdoc index 8ded28c..1f31a12 100644 --- a/doc/src/examples/dockwidgets.qdoc +++ b/doc/src/examples/dockwidgets.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/dombookmarks.qdoc b/doc/src/examples/dombookmarks.qdoc index 1ff0e03..5cb6777 100644 --- a/doc/src/examples/dombookmarks.qdoc +++ b/doc/src/examples/dombookmarks.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/domtraversal.qdoc b/doc/src/examples/domtraversal.qdoc index 83c79e7..66546df 100644 --- a/doc/src/examples/domtraversal.qdoc +++ b/doc/src/examples/domtraversal.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/draganddroppuzzle.qdoc b/doc/src/examples/draganddroppuzzle.qdoc index 0038b5d..8f99c93 100644 --- a/doc/src/examples/draganddroppuzzle.qdoc +++ b/doc/src/examples/draganddroppuzzle.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/dragdroprobot.qdoc b/doc/src/examples/dragdroprobot.qdoc index 59d9f10..7e4c06f 100644 --- a/doc/src/examples/dragdroprobot.qdoc +++ b/doc/src/examples/dragdroprobot.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/draggableicons.qdoc b/doc/src/examples/draggableicons.qdoc index 7d5a936..589ba27 100644 --- a/doc/src/examples/draggableicons.qdoc +++ b/doc/src/examples/draggableicons.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/draggabletext.qdoc b/doc/src/examples/draggabletext.qdoc index f1cf63b..2195a8f 100644 --- a/doc/src/examples/draggabletext.qdoc +++ b/doc/src/examples/draggabletext.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/drilldown.qdoc b/doc/src/examples/drilldown.qdoc index 56ac538..8160bed 100644 --- a/doc/src/examples/drilldown.qdoc +++ b/doc/src/examples/drilldown.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/dropsite.qdoc b/doc/src/examples/dropsite.qdoc index 2767a35..7145c0e 100644 --- a/doc/src/examples/dropsite.qdoc +++ b/doc/src/examples/dropsite.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/dynamiclayouts.qdoc b/doc/src/examples/dynamiclayouts.qdoc index 46a996c..f691321 100644 --- a/doc/src/examples/dynamiclayouts.qdoc +++ b/doc/src/examples/dynamiclayouts.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/easing.qdoc b/doc/src/examples/easing.qdoc index 70237fe..8116791 100644 --- a/doc/src/examples/easing.qdoc +++ b/doc/src/examples/easing.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/echoplugin.qdoc b/doc/src/examples/echoplugin.qdoc index a3c3772..dec85be 100644 --- a/doc/src/examples/echoplugin.qdoc +++ b/doc/src/examples/echoplugin.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/editabletreemodel.qdoc b/doc/src/examples/editabletreemodel.qdoc index c6cd824..fc0743a 100644 --- a/doc/src/examples/editabletreemodel.qdoc +++ b/doc/src/examples/editabletreemodel.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/elasticnodes.qdoc b/doc/src/examples/elasticnodes.qdoc index bdc807f..c33a4a1 100644 --- a/doc/src/examples/elasticnodes.qdoc +++ b/doc/src/examples/elasticnodes.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/eventtransitions.qdoc b/doc/src/examples/eventtransitions.qdoc index b07b227..cf59e1b 100644 --- a/doc/src/examples/eventtransitions.qdoc +++ b/doc/src/examples/eventtransitions.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/extension.qdoc b/doc/src/examples/extension.qdoc index daa4433..23c1eb4 100644 --- a/doc/src/examples/extension.qdoc +++ b/doc/src/examples/extension.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/factorial.qdoc b/doc/src/examples/factorial.qdoc index f4ea022..085d469 100644 --- a/doc/src/examples/factorial.qdoc +++ b/doc/src/examples/factorial.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/fademessage.qdoc b/doc/src/examples/fademessage.qdoc index 5735a54..15f7ce4 100644 --- a/doc/src/examples/fademessage.qdoc +++ b/doc/src/examples/fademessage.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/fancybrowser.qdoc b/doc/src/examples/fancybrowser.qdoc index ae8e7fa..44683a3 100644 --- a/doc/src/examples/fancybrowser.qdoc +++ b/doc/src/examples/fancybrowser.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/fetchmore.qdoc b/doc/src/examples/fetchmore.qdoc index 85040f3..8781d61 100644 --- a/doc/src/examples/fetchmore.qdoc +++ b/doc/src/examples/fetchmore.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/filetree.qdoc b/doc/src/examples/filetree.qdoc index b0e947a..11492e6 100644 --- a/doc/src/examples/filetree.qdoc +++ b/doc/src/examples/filetree.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/findfiles.qdoc b/doc/src/examples/findfiles.qdoc index e10329e..a46dda0 100644 --- a/doc/src/examples/findfiles.qdoc +++ b/doc/src/examples/findfiles.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/fingerpaint.qdoc b/doc/src/examples/fingerpaint.qdoc index 4b62570..264a226 100644 --- a/doc/src/examples/fingerpaint.qdoc +++ b/doc/src/examples/fingerpaint.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/flowlayout.qdoc b/doc/src/examples/flowlayout.qdoc index c9ab554..c786b13 100644 --- a/doc/src/examples/flowlayout.qdoc +++ b/doc/src/examples/flowlayout.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/fontsampler.qdoc b/doc/src/examples/fontsampler.qdoc index 1b05f77..7b38f58 100644 --- a/doc/src/examples/fontsampler.qdoc +++ b/doc/src/examples/fontsampler.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/formextractor.qdoc b/doc/src/examples/formextractor.qdoc index af5977a..b199b70 100644 --- a/doc/src/examples/formextractor.qdoc +++ b/doc/src/examples/formextractor.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/fortuneclient.qdoc b/doc/src/examples/fortuneclient.qdoc index ecfb4be..fa75e3e 100644 --- a/doc/src/examples/fortuneclient.qdoc +++ b/doc/src/examples/fortuneclient.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/fortuneserver.qdoc b/doc/src/examples/fortuneserver.qdoc index 92c67ca..3708146 100644 --- a/doc/src/examples/fortuneserver.qdoc +++ b/doc/src/examples/fortuneserver.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/framebufferobject.qdoc b/doc/src/examples/framebufferobject.qdoc index 9f2d984..9f5d2dc 100644 --- a/doc/src/examples/framebufferobject.qdoc +++ b/doc/src/examples/framebufferobject.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/framebufferobject2.qdoc b/doc/src/examples/framebufferobject2.qdoc index f8936ba..0b2dbe9 100644 --- a/doc/src/examples/framebufferobject2.qdoc +++ b/doc/src/examples/framebufferobject2.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/fridgemagnets.qdoc b/doc/src/examples/fridgemagnets.qdoc index 2ba5cc7..ac67b55 100644 --- a/doc/src/examples/fridgemagnets.qdoc +++ b/doc/src/examples/fridgemagnets.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/frozencolumn.qdoc b/doc/src/examples/frozencolumn.qdoc index 4ee0ef6..e8deddd 100644 --- a/doc/src/examples/frozencolumn.qdoc +++ b/doc/src/examples/frozencolumn.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/ftp.qdoc b/doc/src/examples/ftp.qdoc index 30746a4..087ac5a 100644 --- a/doc/src/examples/ftp.qdoc +++ b/doc/src/examples/ftp.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/globalVariables.qdoc b/doc/src/examples/globalVariables.qdoc index 18363fb..8468abb 100644 --- a/doc/src/examples/globalVariables.qdoc +++ b/doc/src/examples/globalVariables.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/googlechat.qdoc b/doc/src/examples/googlechat.qdoc index 9a6999c..a751ae5 100644 --- a/doc/src/examples/googlechat.qdoc +++ b/doc/src/examples/googlechat.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/googlesuggest.qdoc b/doc/src/examples/googlesuggest.qdoc index 579124b..63fabf8 100644 --- a/doc/src/examples/googlesuggest.qdoc +++ b/doc/src/examples/googlesuggest.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/grabber.qdoc b/doc/src/examples/grabber.qdoc index 7555f08..19501a5 100644 --- a/doc/src/examples/grabber.qdoc +++ b/doc/src/examples/grabber.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/graphicsview-anchorlayout.qdoc b/doc/src/examples/graphicsview-anchorlayout.qdoc index dbf512c..61e7f55 100644 --- a/doc/src/examples/graphicsview-anchorlayout.qdoc +++ b/doc/src/examples/graphicsview-anchorlayout.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/graphicsview-flowlayout.qdoc b/doc/src/examples/graphicsview-flowlayout.qdoc index 5b9d763..6320780 100644 --- a/doc/src/examples/graphicsview-flowlayout.qdoc +++ b/doc/src/examples/graphicsview-flowlayout.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/graphicsview-simpleanchorlayout.qdoc b/doc/src/examples/graphicsview-simpleanchorlayout.qdoc index 22192a0..c8d332b 100644 --- a/doc/src/examples/graphicsview-simpleanchorlayout.qdoc +++ b/doc/src/examples/graphicsview-simpleanchorlayout.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/graphicsview-weatheranchorlayout.qdoc b/doc/src/examples/graphicsview-weatheranchorlayout.qdoc index de0ebac..f77e3f5 100644 --- a/doc/src/examples/graphicsview-weatheranchorlayout.qdoc +++ b/doc/src/examples/graphicsview-weatheranchorlayout.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/groupbox.qdoc b/doc/src/examples/groupbox.qdoc index 28af11c..f8a1ffd 100644 --- a/doc/src/examples/groupbox.qdoc +++ b/doc/src/examples/groupbox.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/hellogl.qdoc b/doc/src/examples/hellogl.qdoc index 97410c7..c8b82b3 100644 --- a/doc/src/examples/hellogl.qdoc +++ b/doc/src/examples/hellogl.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/hellogl_es.qdoc b/doc/src/examples/hellogl_es.qdoc index 4a38b2a..d96d3de 100644 --- a/doc/src/examples/hellogl_es.qdoc +++ b/doc/src/examples/hellogl_es.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/helloscript.qdoc b/doc/src/examples/helloscript.qdoc index 2e7b60f..842e393 100644 --- a/doc/src/examples/helloscript.qdoc +++ b/doc/src/examples/helloscript.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/hellotr.qdoc b/doc/src/examples/hellotr.qdoc index 5cd9743..5d794c6 100644 --- a/doc/src/examples/hellotr.qdoc +++ b/doc/src/examples/hellotr.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/htmlinfo.qdoc b/doc/src/examples/htmlinfo.qdoc index d25219b..a4e11bd 100644 --- a/doc/src/examples/htmlinfo.qdoc +++ b/doc/src/examples/htmlinfo.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/http.qdoc b/doc/src/examples/http.qdoc index 087a7e5..2c86edd 100644 --- a/doc/src/examples/http.qdoc +++ b/doc/src/examples/http.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/i18n.qdoc b/doc/src/examples/i18n.qdoc index 361123d..0698dbe 100644 --- a/doc/src/examples/i18n.qdoc +++ b/doc/src/examples/i18n.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/icons.qdoc b/doc/src/examples/icons.qdoc index e445374..21a308d 100644 --- a/doc/src/examples/icons.qdoc +++ b/doc/src/examples/icons.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/imagecomposition.qdoc b/doc/src/examples/imagecomposition.qdoc index 3bf6e7f..f2b6083 100644 --- a/doc/src/examples/imagecomposition.qdoc +++ b/doc/src/examples/imagecomposition.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/imagegestures.qdoc b/doc/src/examples/imagegestures.qdoc index 3d4e467..8bdfaf4 100644 --- a/doc/src/examples/imagegestures.qdoc +++ b/doc/src/examples/imagegestures.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/imageviewer.qdoc b/doc/src/examples/imageviewer.qdoc index 3d1dc6f..8cf16d7 100644 --- a/doc/src/examples/imageviewer.qdoc +++ b/doc/src/examples/imageviewer.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/inputpanel.qdoc b/doc/src/examples/inputpanel.qdoc index fe6c665..ea83171 100644 --- a/doc/src/examples/inputpanel.qdoc +++ b/doc/src/examples/inputpanel.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/itemviewspuzzle.qdoc b/doc/src/examples/itemviewspuzzle.qdoc index 0a3f3cd..ed5e736 100644 --- a/doc/src/examples/itemviewspuzzle.qdoc +++ b/doc/src/examples/itemviewspuzzle.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/licensewizard.qdoc b/doc/src/examples/licensewizard.qdoc index 3719a4c..b29abb7 100644 --- a/doc/src/examples/licensewizard.qdoc +++ b/doc/src/examples/licensewizard.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/lighting.qdoc b/doc/src/examples/lighting.qdoc index 6277c1f..3e222e1 100644 --- a/doc/src/examples/lighting.qdoc +++ b/doc/src/examples/lighting.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/lineedits.qdoc b/doc/src/examples/lineedits.qdoc index 8d94ee3..fc38bf9 100644 --- a/doc/src/examples/lineedits.qdoc +++ b/doc/src/examples/lineedits.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/localfortuneclient.qdoc b/doc/src/examples/localfortuneclient.qdoc index 33f40d7..295b8c8 100644 --- a/doc/src/examples/localfortuneclient.qdoc +++ b/doc/src/examples/localfortuneclient.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/localfortuneserver.qdoc b/doc/src/examples/localfortuneserver.qdoc index 7ee36cf..4bfc20c 100644 --- a/doc/src/examples/localfortuneserver.qdoc +++ b/doc/src/examples/localfortuneserver.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/loopback.qdoc b/doc/src/examples/loopback.qdoc index b58b786..0e2e808 100644 --- a/doc/src/examples/loopback.qdoc +++ b/doc/src/examples/loopback.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/mandelbrot.qdoc b/doc/src/examples/mandelbrot.qdoc index d4c17aa..44e8e66 100644 --- a/doc/src/examples/mandelbrot.qdoc +++ b/doc/src/examples/mandelbrot.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/masterdetail.qdoc b/doc/src/examples/masterdetail.qdoc index b3a673f..5bfdb4d 100644 --- a/doc/src/examples/masterdetail.qdoc +++ b/doc/src/examples/masterdetail.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/mdi.qdoc b/doc/src/examples/mdi.qdoc index 9e42ba2..ea388db 100644 --- a/doc/src/examples/mdi.qdoc +++ b/doc/src/examples/mdi.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/menus.qdoc b/doc/src/examples/menus.qdoc index d925745..9e82da3 100644 --- a/doc/src/examples/menus.qdoc +++ b/doc/src/examples/menus.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/mousecalibration.qdoc b/doc/src/examples/mousecalibration.qdoc index 71eecf3..bb9301c 100644 --- a/doc/src/examples/mousecalibration.qdoc +++ b/doc/src/examples/mousecalibration.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/moveblocks.qdoc b/doc/src/examples/moveblocks.qdoc index 48d6d60..eee5ac3 100644 --- a/doc/src/examples/moveblocks.qdoc +++ b/doc/src/examples/moveblocks.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/movie.qdoc b/doc/src/examples/movie.qdoc index 4d7b3e0..478104ef 100644 --- a/doc/src/examples/movie.qdoc +++ b/doc/src/examples/movie.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/multipleinheritance.qdoc b/doc/src/examples/multipleinheritance.qdoc index 83a4d29..54c2ba4 100644 --- a/doc/src/examples/multipleinheritance.qdoc +++ b/doc/src/examples/multipleinheritance.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/musicplayerexample.qdoc b/doc/src/examples/musicplayerexample.qdoc index eaee747..9805bbb 100644 --- a/doc/src/examples/musicplayerexample.qdoc +++ b/doc/src/examples/musicplayerexample.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/network-chat.qdoc b/doc/src/examples/network-chat.qdoc index ba78f79..c5dba3f 100644 --- a/doc/src/examples/network-chat.qdoc +++ b/doc/src/examples/network-chat.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/network-download.qdoc b/doc/src/examples/network-download.qdoc index c1ab652..ecd45e6 100644 --- a/doc/src/examples/network-download.qdoc +++ b/doc/src/examples/network-download.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/network-downloadmanager.qdoc b/doc/src/examples/network-downloadmanager.qdoc index 6013e56..fbd3bca 100644 --- a/doc/src/examples/network-downloadmanager.qdoc +++ b/doc/src/examples/network-downloadmanager.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/openvg-star.qdoc b/doc/src/examples/openvg-star.qdoc index f3eee57..7b6193e 100644 --- a/doc/src/examples/openvg-star.qdoc +++ b/doc/src/examples/openvg-star.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/orderform.qdoc b/doc/src/examples/orderform.qdoc index b287f96..e78790a 100644 --- a/doc/src/examples/orderform.qdoc +++ b/doc/src/examples/orderform.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/overpainting.qdoc b/doc/src/examples/overpainting.qdoc index 36002ed..f930d6b 100644 --- a/doc/src/examples/overpainting.qdoc +++ b/doc/src/examples/overpainting.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/padnavigator.qdoc b/doc/src/examples/padnavigator.qdoc index 9f471a8..2bdad8d 100644 --- a/doc/src/examples/padnavigator.qdoc +++ b/doc/src/examples/padnavigator.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/painterpaths.qdoc b/doc/src/examples/painterpaths.qdoc index 981a30e..dbc3563 100644 --- a/doc/src/examples/painterpaths.qdoc +++ b/doc/src/examples/painterpaths.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/pbuffers.qdoc b/doc/src/examples/pbuffers.qdoc index 331a194..a8257e1 100644 --- a/doc/src/examples/pbuffers.qdoc +++ b/doc/src/examples/pbuffers.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/pbuffers2.qdoc b/doc/src/examples/pbuffers2.qdoc index 230bf27..5a0bba3 100644 --- a/doc/src/examples/pbuffers2.qdoc +++ b/doc/src/examples/pbuffers2.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/pinchzoom.qdoc b/doc/src/examples/pinchzoom.qdoc index 198cbb3..60fac29 100644 --- a/doc/src/examples/pinchzoom.qdoc +++ b/doc/src/examples/pinchzoom.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/pingpong.qdoc b/doc/src/examples/pingpong.qdoc index fc0580f..2b27db7 100644 --- a/doc/src/examples/pingpong.qdoc +++ b/doc/src/examples/pingpong.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/pixelator.qdoc b/doc/src/examples/pixelator.qdoc index f631b0b..d40316e 100644 --- a/doc/src/examples/pixelator.qdoc +++ b/doc/src/examples/pixelator.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/plugandpaint.qdoc b/doc/src/examples/plugandpaint.qdoc index 0bd3edb..19053da 100644 --- a/doc/src/examples/plugandpaint.qdoc +++ b/doc/src/examples/plugandpaint.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/portedasteroids.qdoc b/doc/src/examples/portedasteroids.qdoc index 17f9ccf..6307931 100644 --- a/doc/src/examples/portedasteroids.qdoc +++ b/doc/src/examples/portedasteroids.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/portedcanvas.qdoc b/doc/src/examples/portedcanvas.qdoc index acfca12..9e4b004 100644 --- a/doc/src/examples/portedcanvas.qdoc +++ b/doc/src/examples/portedcanvas.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/previewer.qdoc b/doc/src/examples/previewer.qdoc index 61660da..c7140f7 100644 --- a/doc/src/examples/previewer.qdoc +++ b/doc/src/examples/previewer.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/qml-calculator.qdoc b/doc/src/examples/qml-calculator.qdoc index 5c52575..1bc5f79 100644 --- a/doc/src/examples/qml-calculator.qdoc +++ b/doc/src/examples/qml-calculator.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc index 2985e0a..ca24c66 100644 --- a/doc/src/examples/qml-examples.qdoc +++ b/doc/src/examples/qml-examples.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/qml-extending.qdoc b/doc/src/examples/qml-extending.qdoc index 21ec3bb..789b8f6 100644 --- a/doc/src/examples/qml-extending.qdoc +++ b/doc/src/examples/qml-extending.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/qml-flickr.qdoc b/doc/src/examples/qml-flickr.qdoc index 5ebd1ea..6d47675 100644 --- a/doc/src/examples/qml-flickr.qdoc +++ b/doc/src/examples/qml-flickr.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/qml-folderlistmodel.qdoc b/doc/src/examples/qml-folderlistmodel.qdoc index 666d2dd..1592d7b 100644 --- a/doc/src/examples/qml-folderlistmodel.qdoc +++ b/doc/src/examples/qml-folderlistmodel.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/qml-minehunt.qdoc b/doc/src/examples/qml-minehunt.qdoc index e1ff22f..6e7ce4f 100644 --- a/doc/src/examples/qml-minehunt.qdoc +++ b/doc/src/examples/qml-minehunt.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/qml-photoviewer.qdoc b/doc/src/examples/qml-photoviewer.qdoc index e54d4af..032284e 100644 --- a/doc/src/examples/qml-photoviewer.qdoc +++ b/doc/src/examples/qml-photoviewer.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/qml-rssnews.qdoc b/doc/src/examples/qml-rssnews.qdoc index 5a6696c..e7da263 100644 --- a/doc/src/examples/qml-rssnews.qdoc +++ b/doc/src/examples/qml-rssnews.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/qml-samegame.qdoc b/doc/src/examples/qml-samegame.qdoc index 1248fc1..588a51c 100644 --- a/doc/src/examples/qml-samegame.qdoc +++ b/doc/src/examples/qml-samegame.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/qml-snake.qdoc b/doc/src/examples/qml-snake.qdoc index eaea128..c4c1125 100644 --- a/doc/src/examples/qml-snake.qdoc +++ b/doc/src/examples/qml-snake.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/qml-twitter.qdoc b/doc/src/examples/qml-twitter.qdoc index c3182a0..73e3f49 100644 --- a/doc/src/examples/qml-twitter.qdoc +++ b/doc/src/examples/qml-twitter.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/qml-webbrowser.qdoc b/doc/src/examples/qml-webbrowser.qdoc index a3cef66..a7d543f 100644 --- a/doc/src/examples/qml-webbrowser.qdoc +++ b/doc/src/examples/qml-webbrowser.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/qobjectxmlmodel.qdoc b/doc/src/examples/qobjectxmlmodel.qdoc index 8054ae2..cddc1d1 100644 --- a/doc/src/examples/qobjectxmlmodel.qdoc +++ b/doc/src/examples/qobjectxmlmodel.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/qtconcurrent-imagescaling.qdoc b/doc/src/examples/qtconcurrent-imagescaling.qdoc index df6d84b..4ee7e75 100644 --- a/doc/src/examples/qtconcurrent-imagescaling.qdoc +++ b/doc/src/examples/qtconcurrent-imagescaling.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/qtconcurrent-map.qdoc b/doc/src/examples/qtconcurrent-map.qdoc index b605137..ee4608a 100644 --- a/doc/src/examples/qtconcurrent-map.qdoc +++ b/doc/src/examples/qtconcurrent-map.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/qtconcurrent-progressdialog.qdoc b/doc/src/examples/qtconcurrent-progressdialog.qdoc index b5e9dde..b5e01ed 100644 --- a/doc/src/examples/qtconcurrent-progressdialog.qdoc +++ b/doc/src/examples/qtconcurrent-progressdialog.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/qtconcurrent-runfunction.qdoc b/doc/src/examples/qtconcurrent-runfunction.qdoc index 33fbb38..5b431cf 100644 --- a/doc/src/examples/qtconcurrent-runfunction.qdoc +++ b/doc/src/examples/qtconcurrent-runfunction.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/qtconcurrent-wordcount.qdoc b/doc/src/examples/qtconcurrent-wordcount.qdoc index a5df4a9..b02017e 100644 --- a/doc/src/examples/qtconcurrent-wordcount.qdoc +++ b/doc/src/examples/qtconcurrent-wordcount.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/qtscriptcalculator.qdoc b/doc/src/examples/qtscriptcalculator.qdoc index a35ea4b..590f56c 100644 --- a/doc/src/examples/qtscriptcalculator.qdoc +++ b/doc/src/examples/qtscriptcalculator.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/qtscriptcustomclass.qdoc b/doc/src/examples/qtscriptcustomclass.qdoc index 3918ba9..71d0ace 100644 --- a/doc/src/examples/qtscriptcustomclass.qdoc +++ b/doc/src/examples/qtscriptcustomclass.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/qtscripttetrix.qdoc b/doc/src/examples/qtscripttetrix.qdoc index 3bab93b..c308b1b 100644 --- a/doc/src/examples/qtscripttetrix.qdoc +++ b/doc/src/examples/qtscripttetrix.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/querymodel.qdoc b/doc/src/examples/querymodel.qdoc index 2aa1c2e..ff538dc 100644 --- a/doc/src/examples/querymodel.qdoc +++ b/doc/src/examples/querymodel.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/queuedcustomtype.qdoc b/doc/src/examples/queuedcustomtype.qdoc index ed65bda..fec1600 100644 --- a/doc/src/examples/queuedcustomtype.qdoc +++ b/doc/src/examples/queuedcustomtype.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/qxmlstreambookmarks.qdoc b/doc/src/examples/qxmlstreambookmarks.qdoc index 87258d1..e3c5ccb 100644 --- a/doc/src/examples/qxmlstreambookmarks.qdoc +++ b/doc/src/examples/qxmlstreambookmarks.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/recentfiles.qdoc b/doc/src/examples/recentfiles.qdoc index 5bd8fd3..501d12e 100644 --- a/doc/src/examples/recentfiles.qdoc +++ b/doc/src/examples/recentfiles.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/recipes.qdoc b/doc/src/examples/recipes.qdoc index e47e2f0..f01eaf4 100644 --- a/doc/src/examples/recipes.qdoc +++ b/doc/src/examples/recipes.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/regexp.qdoc b/doc/src/examples/regexp.qdoc index d160172..1759394 100644 --- a/doc/src/examples/regexp.qdoc +++ b/doc/src/examples/regexp.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/relationaltablemodel.qdoc b/doc/src/examples/relationaltablemodel.qdoc index f4883f2..68c2d37 100644 --- a/doc/src/examples/relationaltablemodel.qdoc +++ b/doc/src/examples/relationaltablemodel.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/remotecontrol.qdoc b/doc/src/examples/remotecontrol.qdoc index a2241d4..f148cb2 100644 --- a/doc/src/examples/remotecontrol.qdoc +++ b/doc/src/examples/remotecontrol.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/rogue.qdoc b/doc/src/examples/rogue.qdoc index a1c41e9..5b49a50 100644 --- a/doc/src/examples/rogue.qdoc +++ b/doc/src/examples/rogue.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/rsslisting.qdoc b/doc/src/examples/rsslisting.qdoc index 95e579a..878ad49 100644 --- a/doc/src/examples/rsslisting.qdoc +++ b/doc/src/examples/rsslisting.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/samplebuffers.qdoc b/doc/src/examples/samplebuffers.qdoc index cab66a2..a000f06 100644 --- a/doc/src/examples/samplebuffers.qdoc +++ b/doc/src/examples/samplebuffers.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/saxbookmarks.qdoc b/doc/src/examples/saxbookmarks.qdoc index 7656846..6b8aa02 100644 --- a/doc/src/examples/saxbookmarks.qdoc +++ b/doc/src/examples/saxbookmarks.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/schema.qdoc b/doc/src/examples/schema.qdoc index 47171ac..abe0f63 100644 --- a/doc/src/examples/schema.qdoc +++ b/doc/src/examples/schema.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/screenshot.qdoc b/doc/src/examples/screenshot.qdoc index 878f959..1bc5092 100644 --- a/doc/src/examples/screenshot.qdoc +++ b/doc/src/examples/screenshot.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/scribble.qdoc b/doc/src/examples/scribble.qdoc index d827e0e..cfb36e6 100644 --- a/doc/src/examples/scribble.qdoc +++ b/doc/src/examples/scribble.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/script-marshal.qdoc b/doc/src/examples/script-marshal.qdoc index 1dba23c..279036d 100644 --- a/doc/src/examples/script-marshal.qdoc +++ b/doc/src/examples/script-marshal.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/script-qscript.qdoc b/doc/src/examples/script-qscript.qdoc index caf2bce..0ec0d01 100644 --- a/doc/src/examples/script-qscript.qdoc +++ b/doc/src/examples/script-qscript.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/script-qsdbg.qdoc b/doc/src/examples/script-qsdbg.qdoc index bc95fdb..50b52f7 100644 --- a/doc/src/examples/script-qsdbg.qdoc +++ b/doc/src/examples/script-qsdbg.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/sdi.qdoc b/doc/src/examples/sdi.qdoc index 30bd89a..75c063f 100644 --- a/doc/src/examples/sdi.qdoc +++ b/doc/src/examples/sdi.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/securesocketclient.qdoc b/doc/src/examples/securesocketclient.qdoc index 69f444b..2356e86 100644 --- a/doc/src/examples/securesocketclient.qdoc +++ b/doc/src/examples/securesocketclient.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/semaphores.qdoc b/doc/src/examples/semaphores.qdoc index 6f749d2..d315c19 100644 --- a/doc/src/examples/semaphores.qdoc +++ b/doc/src/examples/semaphores.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/settingseditor.qdoc b/doc/src/examples/settingseditor.qdoc index 9f99f28..8429bcd 100644 --- a/doc/src/examples/settingseditor.qdoc +++ b/doc/src/examples/settingseditor.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/shapedclock.qdoc b/doc/src/examples/shapedclock.qdoc index 769c9eb..adb4441 100644 --- a/doc/src/examples/shapedclock.qdoc +++ b/doc/src/examples/shapedclock.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/sharedmemory.qdoc b/doc/src/examples/sharedmemory.qdoc index 6e13b96..6fd0947 100644 --- a/doc/src/examples/sharedmemory.qdoc +++ b/doc/src/examples/sharedmemory.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/simpledecoration.qdoc b/doc/src/examples/simpledecoration.qdoc index 021a4d3..74d6c0e 100644 --- a/doc/src/examples/simpledecoration.qdoc +++ b/doc/src/examples/simpledecoration.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/simpledommodel.qdoc b/doc/src/examples/simpledommodel.qdoc index d10f6a7..82ecac5 100644 --- a/doc/src/examples/simpledommodel.qdoc +++ b/doc/src/examples/simpledommodel.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/simpleselector.qdoc b/doc/src/examples/simpleselector.qdoc index 1e68699..f66ced5 100644 --- a/doc/src/examples/simpleselector.qdoc +++ b/doc/src/examples/simpleselector.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/simpletextviewer.qdoc b/doc/src/examples/simpletextviewer.qdoc index e5c887a..50ced54 100644 --- a/doc/src/examples/simpletextviewer.qdoc +++ b/doc/src/examples/simpletextviewer.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/simpletreemodel.qdoc b/doc/src/examples/simpletreemodel.qdoc index 7d1f8fe..c09c216 100644 --- a/doc/src/examples/simpletreemodel.qdoc +++ b/doc/src/examples/simpletreemodel.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/simplewidgetmapper.qdoc b/doc/src/examples/simplewidgetmapper.qdoc index 413ad2b..686263a 100644 --- a/doc/src/examples/simplewidgetmapper.qdoc +++ b/doc/src/examples/simplewidgetmapper.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/sipdialog.qdoc b/doc/src/examples/sipdialog.qdoc index 25ae7eb..16081f0 100644 --- a/doc/src/examples/sipdialog.qdoc +++ b/doc/src/examples/sipdialog.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/sliders.qdoc b/doc/src/examples/sliders.qdoc index f44fabb..5d878fe 100644 --- a/doc/src/examples/sliders.qdoc +++ b/doc/src/examples/sliders.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/spinboxdelegate.qdoc b/doc/src/examples/spinboxdelegate.qdoc index 44308ca..61eff51 100644 --- a/doc/src/examples/spinboxdelegate.qdoc +++ b/doc/src/examples/spinboxdelegate.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/spinboxes.qdoc b/doc/src/examples/spinboxes.qdoc index 34a95c7..865335e 100644 --- a/doc/src/examples/spinboxes.qdoc +++ b/doc/src/examples/spinboxes.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/sqlwidgetmapper.qdoc b/doc/src/examples/sqlwidgetmapper.qdoc index db48f9c..d642909 100644 --- a/doc/src/examples/sqlwidgetmapper.qdoc +++ b/doc/src/examples/sqlwidgetmapper.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/standarddialogs.qdoc b/doc/src/examples/standarddialogs.qdoc index 368b713..dbe21b9 100644 --- a/doc/src/examples/standarddialogs.qdoc +++ b/doc/src/examples/standarddialogs.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/stardelegate.qdoc b/doc/src/examples/stardelegate.qdoc index 6e5e371..c895667 100644 --- a/doc/src/examples/stardelegate.qdoc +++ b/doc/src/examples/stardelegate.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/states.qdoc b/doc/src/examples/states.qdoc index 24362a2..573cda0 100644 --- a/doc/src/examples/states.qdoc +++ b/doc/src/examples/states.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/stickman.qdoc b/doc/src/examples/stickman.qdoc index 08450aa..46301a8 100644 --- a/doc/src/examples/stickman.qdoc +++ b/doc/src/examples/stickman.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/styleplugin.qdoc b/doc/src/examples/styleplugin.qdoc index 85cad0f..9d84a14 100644 --- a/doc/src/examples/styleplugin.qdoc +++ b/doc/src/examples/styleplugin.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/styles.qdoc b/doc/src/examples/styles.qdoc index fc243e7..b9f48da 100644 --- a/doc/src/examples/styles.qdoc +++ b/doc/src/examples/styles.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/stylesheet.qdoc b/doc/src/examples/stylesheet.qdoc index 348e3f3..d08c2a4 100644 --- a/doc/src/examples/stylesheet.qdoc +++ b/doc/src/examples/stylesheet.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/svgalib.qdoc b/doc/src/examples/svgalib.qdoc index 86681e6..3e3e4d5 100644 --- a/doc/src/examples/svgalib.qdoc +++ b/doc/src/examples/svgalib.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/svggenerator.qdoc b/doc/src/examples/svggenerator.qdoc index 622cbbe..ae968b9 100644 --- a/doc/src/examples/svggenerator.qdoc +++ b/doc/src/examples/svggenerator.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/svgviewer.qdoc b/doc/src/examples/svgviewer.qdoc index 674b796..e528054 100644 --- a/doc/src/examples/svgviewer.qdoc +++ b/doc/src/examples/svgviewer.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/syntaxhighlighter.qdoc b/doc/src/examples/syntaxhighlighter.qdoc index 2162702..722dcca 100644 --- a/doc/src/examples/syntaxhighlighter.qdoc +++ b/doc/src/examples/syntaxhighlighter.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/systray.qdoc b/doc/src/examples/systray.qdoc index 469642a..8b9de81 100644 --- a/doc/src/examples/systray.qdoc +++ b/doc/src/examples/systray.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/tabdialog.qdoc b/doc/src/examples/tabdialog.qdoc index 3db9caa..da447c4 100644 --- a/doc/src/examples/tabdialog.qdoc +++ b/doc/src/examples/tabdialog.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/tablemodel.qdoc b/doc/src/examples/tablemodel.qdoc index 9934023..04a13cc 100644 --- a/doc/src/examples/tablemodel.qdoc +++ b/doc/src/examples/tablemodel.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/tablet.qdoc b/doc/src/examples/tablet.qdoc index adc49bf..58af376 100644 --- a/doc/src/examples/tablet.qdoc +++ b/doc/src/examples/tablet.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/taskmenuextension.qdoc b/doc/src/examples/taskmenuextension.qdoc index 8d9d843..d89b68c 100644 --- a/doc/src/examples/taskmenuextension.qdoc +++ b/doc/src/examples/taskmenuextension.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/tetrix.qdoc b/doc/src/examples/tetrix.qdoc index 177f592..ec46507 100644 --- a/doc/src/examples/tetrix.qdoc +++ b/doc/src/examples/tetrix.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/textfinder.qdoc b/doc/src/examples/textfinder.qdoc index ead950d..a04df00 100644 --- a/doc/src/examples/textfinder.qdoc +++ b/doc/src/examples/textfinder.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/textobject.qdoc b/doc/src/examples/textobject.qdoc index ce7431f..e655206 100644 --- a/doc/src/examples/textobject.qdoc +++ b/doc/src/examples/textobject.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/textures.qdoc b/doc/src/examples/textures.qdoc index 03e481e..d18268b 100644 --- a/doc/src/examples/textures.qdoc +++ b/doc/src/examples/textures.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/threadedfortuneserver.qdoc b/doc/src/examples/threadedfortuneserver.qdoc index cb18872..c0c4815 100644 --- a/doc/src/examples/threadedfortuneserver.qdoc +++ b/doc/src/examples/threadedfortuneserver.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/tooltips.qdoc b/doc/src/examples/tooltips.qdoc index 351eaf9..f7737b9 100644 --- a/doc/src/examples/tooltips.qdoc +++ b/doc/src/examples/tooltips.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/torrent.qdoc b/doc/src/examples/torrent.qdoc index 8488787..3c0d108 100644 --- a/doc/src/examples/torrent.qdoc +++ b/doc/src/examples/torrent.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/touch-dials.qdoc b/doc/src/examples/touch-dials.qdoc index 552d752..c6fc326 100644 --- a/doc/src/examples/touch-dials.qdoc +++ b/doc/src/examples/touch-dials.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/touch-knobs.qdoc b/doc/src/examples/touch-knobs.qdoc index deb4c28..08c2d0c 100644 --- a/doc/src/examples/touch-knobs.qdoc +++ b/doc/src/examples/touch-knobs.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/trafficinfo.qdoc b/doc/src/examples/trafficinfo.qdoc index bc06178..e60c1cd 100644 --- a/doc/src/examples/trafficinfo.qdoc +++ b/doc/src/examples/trafficinfo.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/trafficlight.qdoc b/doc/src/examples/trafficlight.qdoc index f1498a9..3d381d9 100644 --- a/doc/src/examples/trafficlight.qdoc +++ b/doc/src/examples/trafficlight.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/transformations.qdoc b/doc/src/examples/transformations.qdoc index 3c949b7..e60ab39 100644 --- a/doc/src/examples/transformations.qdoc +++ b/doc/src/examples/transformations.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/treemodelcompleter.qdoc b/doc/src/examples/treemodelcompleter.qdoc index 17bbd2c..b473831 100644 --- a/doc/src/examples/treemodelcompleter.qdoc +++ b/doc/src/examples/treemodelcompleter.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/trivialwizard.qdoc b/doc/src/examples/trivialwizard.qdoc index 2632560..381d969 100644 --- a/doc/src/examples/trivialwizard.qdoc +++ b/doc/src/examples/trivialwizard.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/trollprint.qdoc b/doc/src/examples/trollprint.qdoc index b9c9c56..d08b047 100644 --- a/doc/src/examples/trollprint.qdoc +++ b/doc/src/examples/trollprint.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/twowaybutton.qdoc b/doc/src/examples/twowaybutton.qdoc index bcecbd5..5fffe6d 100644 --- a/doc/src/examples/twowaybutton.qdoc +++ b/doc/src/examples/twowaybutton.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/undoframework.qdoc b/doc/src/examples/undoframework.qdoc index ef6a6a0..c497acc 100644 --- a/doc/src/examples/undoframework.qdoc +++ b/doc/src/examples/undoframework.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/videographicsitem.qdoc b/doc/src/examples/videographicsitem.qdoc index 587298c..3bb1f9a 100644 --- a/doc/src/examples/videographicsitem.qdoc +++ b/doc/src/examples/videographicsitem.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/videowidget.qdoc b/doc/src/examples/videowidget.qdoc index 66c2555..ab1a1c1 100644 --- a/doc/src/examples/videowidget.qdoc +++ b/doc/src/examples/videowidget.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/waitconditions.qdoc b/doc/src/examples/waitconditions.qdoc index 15565e9..75f60bd 100644 --- a/doc/src/examples/waitconditions.qdoc +++ b/doc/src/examples/waitconditions.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/webkit-framecapture.qdoc b/doc/src/examples/webkit-framecapture.qdoc index a3d9f1b..96e70d5 100644 --- a/doc/src/examples/webkit-framecapture.qdoc +++ b/doc/src/examples/webkit-framecapture.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/widgets-softkeys.qdoc b/doc/src/examples/widgets-softkeys.qdoc index dde1778..1958872 100644 --- a/doc/src/examples/widgets-softkeys.qdoc +++ b/doc/src/examples/widgets-softkeys.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/widgets-validators.qdoc b/doc/src/examples/widgets-validators.qdoc index 78054bb..c6b3711 100644 --- a/doc/src/examples/widgets-validators.qdoc +++ b/doc/src/examples/widgets-validators.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/wiggly.qdoc b/doc/src/examples/wiggly.qdoc index bd02900..1b3f1ff 100644 --- a/doc/src/examples/wiggly.qdoc +++ b/doc/src/examples/wiggly.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/windowflags.qdoc b/doc/src/examples/windowflags.qdoc index bc4f979..cfee598 100644 --- a/doc/src/examples/windowflags.qdoc +++ b/doc/src/examples/windowflags.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/worldtimeclockbuilder.qdoc b/doc/src/examples/worldtimeclockbuilder.qdoc index a70cbe7..27d846f 100644 --- a/doc/src/examples/worldtimeclockbuilder.qdoc +++ b/doc/src/examples/worldtimeclockbuilder.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/worldtimeclockplugin.qdoc b/doc/src/examples/worldtimeclockplugin.qdoc index 0157b68..d485ec3 100644 --- a/doc/src/examples/worldtimeclockplugin.qdoc +++ b/doc/src/examples/worldtimeclockplugin.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/examples/xmlstreamlint.qdoc b/doc/src/examples/xmlstreamlint.qdoc index 3e25dbe..fa05874 100644 --- a/doc/src/examples/xmlstreamlint.qdoc +++ b/doc/src/examples/xmlstreamlint.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/external-resources.qdoc b/doc/src/external-resources.qdoc index 61620f5..3041046 100644 --- a/doc/src/external-resources.qdoc +++ b/doc/src/external-resources.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/files-and-resources/datastreamformat.qdoc b/doc/src/files-and-resources/datastreamformat.qdoc index 060aee6..d014f20 100644 --- a/doc/src/files-and-resources/datastreamformat.qdoc +++ b/doc/src/files-and-resources/datastreamformat.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/files-and-resources/resources.qdoc b/doc/src/files-and-resources/resources.qdoc index f0cb130..0376d0c 100644 --- a/doc/src/files-and-resources/resources.qdoc +++ b/doc/src/files-and-resources/resources.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/frameworks-technologies/accessible.qdoc b/doc/src/frameworks-technologies/accessible.qdoc index cbc1558..eb14310 100644 --- a/doc/src/frameworks-technologies/accessible.qdoc +++ b/doc/src/frameworks-technologies/accessible.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/frameworks-technologies/activeqt-container.qdoc b/doc/src/frameworks-technologies/activeqt-container.qdoc index 736bca3..4e11abd 100644 --- a/doc/src/frameworks-technologies/activeqt-container.qdoc +++ b/doc/src/frameworks-technologies/activeqt-container.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/frameworks-technologies/activeqt-server.qdoc b/doc/src/frameworks-technologies/activeqt-server.qdoc index 924856f..0f683f7 100644 --- a/doc/src/frameworks-technologies/activeqt-server.qdoc +++ b/doc/src/frameworks-technologies/activeqt-server.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/frameworks-technologies/activeqt.qdoc b/doc/src/frameworks-technologies/activeqt.qdoc index e3fb3a7..c49dcad 100644 --- a/doc/src/frameworks-technologies/activeqt.qdoc +++ b/doc/src/frameworks-technologies/activeqt.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/frameworks-technologies/animation.qdoc b/doc/src/frameworks-technologies/animation.qdoc index 3763cb3..f78162d 100644 --- a/doc/src/frameworks-technologies/animation.qdoc +++ b/doc/src/frameworks-technologies/animation.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/frameworks-technologies/containers.qdoc b/doc/src/frameworks-technologies/containers.qdoc index cf5fe73..aa618d6 100644 --- a/doc/src/frameworks-technologies/containers.qdoc +++ b/doc/src/frameworks-technologies/containers.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/frameworks-technologies/dbus-adaptors.qdoc b/doc/src/frameworks-technologies/dbus-adaptors.qdoc index f193a67..3132d2d 100644 --- a/doc/src/frameworks-technologies/dbus-adaptors.qdoc +++ b/doc/src/frameworks-technologies/dbus-adaptors.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/frameworks-technologies/dbus-intro.qdoc b/doc/src/frameworks-technologies/dbus-intro.qdoc index 9d4cd95..2f7fa12 100644 --- a/doc/src/frameworks-technologies/dbus-intro.qdoc +++ b/doc/src/frameworks-technologies/dbus-intro.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/frameworks-technologies/desktop-integration.qdoc b/doc/src/frameworks-technologies/desktop-integration.qdoc index 6c117e8..d48f8c7 100644 --- a/doc/src/frameworks-technologies/desktop-integration.qdoc +++ b/doc/src/frameworks-technologies/desktop-integration.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/frameworks-technologies/dnd.qdoc b/doc/src/frameworks-technologies/dnd.qdoc index ebfa39e..56b461e 100644 --- a/doc/src/frameworks-technologies/dnd.qdoc +++ b/doc/src/frameworks-technologies/dnd.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/frameworks-technologies/eventsandfilters.qdoc b/doc/src/frameworks-technologies/eventsandfilters.qdoc index fb14a3b..fb51976 100644 --- a/doc/src/frameworks-technologies/eventsandfilters.qdoc +++ b/doc/src/frameworks-technologies/eventsandfilters.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/frameworks-technologies/gestures.qdoc b/doc/src/frameworks-technologies/gestures.qdoc index f7c8312..06d3431 100644 --- a/doc/src/frameworks-technologies/gestures.qdoc +++ b/doc/src/frameworks-technologies/gestures.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/frameworks-technologies/graphicsview.qdoc b/doc/src/frameworks-technologies/graphicsview.qdoc index 20bb750..21d3f42 100644 --- a/doc/src/frameworks-technologies/graphicsview.qdoc +++ b/doc/src/frameworks-technologies/graphicsview.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/frameworks-technologies/implicit-sharing.qdoc b/doc/src/frameworks-technologies/implicit-sharing.qdoc index d62824e..fcfcf7f 100644 --- a/doc/src/frameworks-technologies/implicit-sharing.qdoc +++ b/doc/src/frameworks-technologies/implicit-sharing.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/frameworks-technologies/ipc.qdoc b/doc/src/frameworks-technologies/ipc.qdoc index 775243a..e73f649 100644 --- a/doc/src/frameworks-technologies/ipc.qdoc +++ b/doc/src/frameworks-technologies/ipc.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/frameworks-technologies/model-view-programming.qdoc b/doc/src/frameworks-technologies/model-view-programming.qdoc index 7a1fb40..6de567c 100644 --- a/doc/src/frameworks-technologies/model-view-programming.qdoc +++ b/doc/src/frameworks-technologies/model-view-programming.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/frameworks-technologies/phonon.qdoc b/doc/src/frameworks-technologies/phonon.qdoc index 5119638..83afb91 100644 --- a/doc/src/frameworks-technologies/phonon.qdoc +++ b/doc/src/frameworks-technologies/phonon.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/frameworks-technologies/plugins-howto.qdoc b/doc/src/frameworks-technologies/plugins-howto.qdoc index 5103bdc..8e4cbe4 100644 --- a/doc/src/frameworks-technologies/plugins-howto.qdoc +++ b/doc/src/frameworks-technologies/plugins-howto.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/frameworks-technologies/qthelp.qdoc b/doc/src/frameworks-technologies/qthelp.qdoc index 2342e40..14874ef 100644 --- a/doc/src/frameworks-technologies/qthelp.qdoc +++ b/doc/src/frameworks-technologies/qthelp.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/frameworks-technologies/qundo.qdoc b/doc/src/frameworks-technologies/qundo.qdoc index bc050d8..08ed0e4 100644 --- a/doc/src/frameworks-technologies/qundo.qdoc +++ b/doc/src/frameworks-technologies/qundo.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/frameworks-technologies/richtext.qdoc b/doc/src/frameworks-technologies/richtext.qdoc index a9ee0b2..f065531 100644 --- a/doc/src/frameworks-technologies/richtext.qdoc +++ b/doc/src/frameworks-technologies/richtext.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/frameworks-technologies/statemachine.qdoc b/doc/src/frameworks-technologies/statemachine.qdoc index 714483a..a0cd005 100644 --- a/doc/src/frameworks-technologies/statemachine.qdoc +++ b/doc/src/frameworks-technologies/statemachine.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/frameworks-technologies/templates.qdoc b/doc/src/frameworks-technologies/templates.qdoc index 97b5a87..346f043 100644 --- a/doc/src/frameworks-technologies/templates.qdoc +++ b/doc/src/frameworks-technologies/templates.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/frameworks-technologies/threads.qdoc b/doc/src/frameworks-technologies/threads.qdoc index 4f7c7bf..3ef617c 100644 --- a/doc/src/frameworks-technologies/threads.qdoc +++ b/doc/src/frameworks-technologies/threads.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/frameworks-technologies/unicode.qdoc b/doc/src/frameworks-technologies/unicode.qdoc index 2ad8947..061b61e 100644 --- a/doc/src/frameworks-technologies/unicode.qdoc +++ b/doc/src/frameworks-technologies/unicode.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/getting-started/demos.qdoc b/doc/src/getting-started/demos.qdoc index f52fc92..2fe39a2 100644 --- a/doc/src/getting-started/demos.qdoc +++ b/doc/src/getting-started/demos.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index a5f3446..bfe7be9 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/getting-started/gettingstarted.qdoc b/doc/src/getting-started/gettingstarted.qdoc index e58305a..162dba1 100644 --- a/doc/src/getting-started/gettingstarted.qdoc +++ b/doc/src/getting-started/gettingstarted.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/getting-started/gettingstartedqml.qdoc b/doc/src/getting-started/gettingstartedqml.qdoc index a5e45d9..5e4a94f 100644 --- a/doc/src/getting-started/gettingstartedqml.qdoc +++ b/doc/src/getting-started/gettingstartedqml.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/getting-started/gettingstartedqt.qdoc b/doc/src/getting-started/gettingstartedqt.qdoc index 25d0ccd..945d7c3 100644 --- a/doc/src/getting-started/gettingstartedqt.qdoc +++ b/doc/src/getting-started/gettingstartedqt.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/getting-started/how-to-learn-qt.qdoc b/doc/src/getting-started/how-to-learn-qt.qdoc index 8ca1735..e9f462c 100644 --- a/doc/src/getting-started/how-to-learn-qt.qdoc +++ b/doc/src/getting-started/how-to-learn-qt.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index bc0128c..3eb761d 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/getting-started/known-issues.qdoc b/doc/src/getting-started/known-issues.qdoc index 942c41d..d0044f3 100644 --- a/doc/src/getting-started/known-issues.qdoc +++ b/doc/src/getting-started/known-issues.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/getting-started/tutorials.qdoc b/doc/src/getting-started/tutorials.qdoc index 46a5808..2c5ebaf 100644 --- a/doc/src/getting-started/tutorials.qdoc +++ b/doc/src/getting-started/tutorials.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/howtos/HWacceleration.qdoc b/doc/src/howtos/HWacceleration.qdoc index 1932b6d..3eb1e74 100644 --- a/doc/src/howtos/HWacceleration.qdoc +++ b/doc/src/howtos/HWacceleration.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/howtos/accelerators.qdoc b/doc/src/howtos/accelerators.qdoc index 2aae38a..68d2a85 100644 --- a/doc/src/howtos/accelerators.qdoc +++ b/doc/src/howtos/accelerators.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/howtos/appicon.qdoc b/doc/src/howtos/appicon.qdoc index 55524d8..9b9fedc 100644 --- a/doc/src/howtos/appicon.qdoc +++ b/doc/src/howtos/appicon.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/howtos/custom-types.qdoc b/doc/src/howtos/custom-types.qdoc index 9910f2e..086a1d7 100644 --- a/doc/src/howtos/custom-types.qdoc +++ b/doc/src/howtos/custom-types.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/howtos/exceptionsafety.qdoc b/doc/src/howtos/exceptionsafety.qdoc index bf85c2a..49d99de 100644 --- a/doc/src/howtos/exceptionsafety.qdoc +++ b/doc/src/howtos/exceptionsafety.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/howtos/guibooks.qdoc b/doc/src/howtos/guibooks.qdoc index 515f81f..d74f08f 100644 --- a/doc/src/howtos/guibooks.qdoc +++ b/doc/src/howtos/guibooks.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/howtos/openvg.qdoc b/doc/src/howtos/openvg.qdoc index dc7a34a..de3c1e1 100644 --- a/doc/src/howtos/openvg.qdoc +++ b/doc/src/howtos/openvg.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/howtos/qtdesigner.qdoc b/doc/src/howtos/qtdesigner.qdoc index 7fd008f..ab7e26b 100644 --- a/doc/src/howtos/qtdesigner.qdoc +++ b/doc/src/howtos/qtdesigner.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/howtos/restoring-geometry.qdoc b/doc/src/howtos/restoring-geometry.qdoc index 0f82182..c6b7e37 100644 --- a/doc/src/howtos/restoring-geometry.qdoc +++ b/doc/src/howtos/restoring-geometry.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/howtos/session.qdoc b/doc/src/howtos/session.qdoc index b48a591..7980cde 100644 --- a/doc/src/howtos/session.qdoc +++ b/doc/src/howtos/session.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/howtos/sharedlibrary.qdoc b/doc/src/howtos/sharedlibrary.qdoc index 6980a41..04364eb 100644 --- a/doc/src/howtos/sharedlibrary.qdoc +++ b/doc/src/howtos/sharedlibrary.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/howtos/timers.qdoc b/doc/src/howtos/timers.qdoc index 585e53b..22270c1 100644 --- a/doc/src/howtos/timers.qdoc +++ b/doc/src/howtos/timers.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/howtos/unix-signal-handlers.qdoc b/doc/src/howtos/unix-signal-handlers.qdoc index 2893439..fe01772 100644 --- a/doc/src/howtos/unix-signal-handlers.qdoc +++ b/doc/src/howtos/unix-signal-handlers.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc index 77856ec..e42dfca 100644 --- a/doc/src/index.qdoc +++ b/doc/src/index.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/internationalization/i18n.qdoc b/doc/src/internationalization/i18n.qdoc index 8b6e337..c58cc91 100644 --- a/doc/src/internationalization/i18n.qdoc +++ b/doc/src/internationalization/i18n.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/internationalization/linguist-manual.qdoc b/doc/src/internationalization/linguist-manual.qdoc index fa992af..57b98b8 100644 --- a/doc/src/internationalization/linguist-manual.qdoc +++ b/doc/src/internationalization/linguist-manual.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/ja_JP/development/designer-manual.qdoc b/doc/src/ja_JP/development/designer-manual.qdoc index e90e056..f71da3c 100644 --- a/doc/src/ja_JP/development/designer-manual.qdoc +++ b/doc/src/ja_JP/development/designer-manual.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/ja_JP/development/qmake-manual.qdoc b/doc/src/ja_JP/development/qmake-manual.qdoc index 217814b..699fa93 100644 --- a/doc/src/ja_JP/development/qmake-manual.qdoc +++ b/doc/src/ja_JP/development/qmake-manual.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/ja_JP/development/qtestlib.qdoc b/doc/src/ja_JP/development/qtestlib.qdoc index b7bb066..f0ff60d 100644 --- a/doc/src/ja_JP/development/qtestlib.qdoc +++ b/doc/src/ja_JP/development/qtestlib.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/ja_JP/examples/arrowpad.qdoc b/doc/src/ja_JP/examples/arrowpad.qdoc index bbeb7fe..3cb798b 100644 --- a/doc/src/ja_JP/examples/arrowpad.qdoc +++ b/doc/src/ja_JP/examples/arrowpad.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/ja_JP/examples/hellotr.qdoc b/doc/src/ja_JP/examples/hellotr.qdoc index 8c33584..b0ed8e8 100644 --- a/doc/src/ja_JP/examples/hellotr.qdoc +++ b/doc/src/ja_JP/examples/hellotr.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/ja_JP/examples/trollprint.qdoc b/doc/src/ja_JP/examples/trollprint.qdoc index 66d9fa3..b0397a3 100644 --- a/doc/src/ja_JP/examples/trollprint.qdoc +++ b/doc/src/ja_JP/examples/trollprint.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/ja_JP/getting-started/tutorials.qdoc b/doc/src/ja_JP/getting-started/tutorials.qdoc index cc4fb13..fc461ba 100644 --- a/doc/src/ja_JP/getting-started/tutorials.qdoc +++ b/doc/src/ja_JP/getting-started/tutorials.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/ja_JP/tutorials/addressbook.qdoc b/doc/src/ja_JP/tutorials/addressbook.qdoc index 238ecb1..522aeb2 100644 --- a/doc/src/ja_JP/tutorials/addressbook.qdoc +++ b/doc/src/ja_JP/tutorials/addressbook.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/ja_JP/tutorials/widgets-tutorial.qdoc b/doc/src/ja_JP/tutorials/widgets-tutorial.qdoc index 42f6687..a5c3e18 100644 --- a/doc/src/ja_JP/tutorials/widgets-tutorial.qdoc +++ b/doc/src/ja_JP/tutorials/widgets-tutorial.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/legal/3rdparty.qdoc b/doc/src/legal/3rdparty.qdoc index db6ff7c..8b3d5f2 100644 --- a/doc/src/legal/3rdparty.qdoc +++ b/doc/src/legal/3rdparty.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/legal/commercialeditions.qdoc b/doc/src/legal/commercialeditions.qdoc index 8a2583d..c3a5d60 100644 --- a/doc/src/legal/commercialeditions.qdoc +++ b/doc/src/legal/commercialeditions.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/legal/editions.qdoc b/doc/src/legal/editions.qdoc index 60a8736..7be33b3 100644 --- a/doc/src/legal/editions.qdoc +++ b/doc/src/legal/editions.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/legal/gpl.qdoc b/doc/src/legal/gpl.qdoc index 504b451..31a8855 100644 --- a/doc/src/legal/gpl.qdoc +++ b/doc/src/legal/gpl.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/legal/licenses.qdoc b/doc/src/legal/licenses.qdoc index 12aca6b..631ff40 100644 --- a/doc/src/legal/licenses.qdoc +++ b/doc/src/legal/licenses.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/legal/opensourceedition.qdoc b/doc/src/legal/opensourceedition.qdoc index c02fde7..e3a3e27 100644 --- a/doc/src/legal/opensourceedition.qdoc +++ b/doc/src/legal/opensourceedition.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/legal/trademarks.qdoc b/doc/src/legal/trademarks.qdoc index f6ffae1..42cb7a9 100644 --- a/doc/src/legal/trademarks.qdoc +++ b/doc/src/legal/trademarks.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc index 11b50c3..f781f81 100644 --- a/doc/src/modules.qdoc +++ b/doc/src/modules.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/network-programming/bearermanagement.qdoc b/doc/src/network-programming/bearermanagement.qdoc index bc016df..98de5bf 100644 --- a/doc/src/network-programming/bearermanagement.qdoc +++ b/doc/src/network-programming/bearermanagement.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/network-programming/qtnetwork.qdoc b/doc/src/network-programming/qtnetwork.qdoc index dcee1b8..8b84dcb 100644 --- a/doc/src/network-programming/qtnetwork.qdoc +++ b/doc/src/network-programming/qtnetwork.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/network-programming/ssl.qdoc b/doc/src/network-programming/ssl.qdoc index 3586971..85ea7ef 100644 --- a/doc/src/network-programming/ssl.qdoc +++ b/doc/src/network-programming/ssl.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/objectmodel/metaobjects.qdoc b/doc/src/objectmodel/metaobjects.qdoc index 0597cd6..1fd3f52 100644 --- a/doc/src/objectmodel/metaobjects.qdoc +++ b/doc/src/objectmodel/metaobjects.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/objectmodel/object.qdoc b/doc/src/objectmodel/object.qdoc index 5bb39d6..95492e6 100644 --- a/doc/src/objectmodel/object.qdoc +++ b/doc/src/objectmodel/object.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/objectmodel/objecttrees.qdoc b/doc/src/objectmodel/objecttrees.qdoc index 3a4aef7..ef20694 100644 --- a/doc/src/objectmodel/objecttrees.qdoc +++ b/doc/src/objectmodel/objecttrees.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/objectmodel/properties.qdoc b/doc/src/objectmodel/properties.qdoc index 2cb7c04..c960366 100644 --- a/doc/src/objectmodel/properties.qdoc +++ b/doc/src/objectmodel/properties.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/objectmodel/signalsandslots.qdoc b/doc/src/objectmodel/signalsandslots.qdoc index c12ca78..01f42f6 100644 --- a/doc/src/objectmodel/signalsandslots.qdoc +++ b/doc/src/objectmodel/signalsandslots.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/overviews.qdoc b/doc/src/overviews.qdoc index 2dd44f6..7b02f1a 100644 --- a/doc/src/overviews.qdoc +++ b/doc/src/overviews.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/painting-and-printing/coordsys.qdoc b/doc/src/painting-and-printing/coordsys.qdoc index 07ced35..0bae71b 100644 --- a/doc/src/painting-and-printing/coordsys.qdoc +++ b/doc/src/painting-and-printing/coordsys.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/painting-and-printing/paintsystem.qdoc b/doc/src/painting-and-printing/paintsystem.qdoc index deb9c8b..0aaca46 100644 --- a/doc/src/painting-and-printing/paintsystem.qdoc +++ b/doc/src/painting-and-printing/paintsystem.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/painting-and-printing/printing.qdoc b/doc/src/painting-and-printing/printing.qdoc index 97cd92f..6750864 100644 --- a/doc/src/painting-and-printing/printing.qdoc +++ b/doc/src/painting-and-printing/printing.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/atomic-operations.qdoc b/doc/src/platforms/atomic-operations.qdoc index 4d3499e..6a6dde2 100644 --- a/doc/src/platforms/atomic-operations.qdoc +++ b/doc/src/platforms/atomic-operations.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/compiler-notes.qdoc b/doc/src/platforms/compiler-notes.qdoc index 3870e8f..5d0eda1 100644 --- a/doc/src/platforms/compiler-notes.qdoc +++ b/doc/src/platforms/compiler-notes.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/emb-HwAcc-LinuxEmbedded.qdoc b/doc/src/platforms/emb-HwAcc-LinuxEmbedded.qdoc index b9dc151..2cde4ba 100644 --- a/doc/src/platforms/emb-HwAcc-LinuxEmbedded.qdoc +++ b/doc/src/platforms/emb-HwAcc-LinuxEmbedded.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/emb-HwAcc-WinCE.qdoc b/doc/src/platforms/emb-HwAcc-WinCE.qdoc index 00f85a1..5dda1c3 100644 --- a/doc/src/platforms/emb-HwAcc-WinCE.qdoc +++ b/doc/src/platforms/emb-HwAcc-WinCE.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/emb-accel.qdoc b/doc/src/platforms/emb-accel.qdoc index 8d7f029..c8854f7 100644 --- a/doc/src/platforms/emb-accel.qdoc +++ b/doc/src/platforms/emb-accel.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/emb-architecture.qdoc b/doc/src/platforms/emb-architecture.qdoc index f75beee..dcaa319 100644 --- a/doc/src/platforms/emb-architecture.qdoc +++ b/doc/src/platforms/emb-architecture.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/emb-charinput.qdoc b/doc/src/platforms/emb-charinput.qdoc index 5a94267..03cc340 100644 --- a/doc/src/platforms/emb-charinput.qdoc +++ b/doc/src/platforms/emb-charinput.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/emb-crosscompiling.qdoc b/doc/src/platforms/emb-crosscompiling.qdoc index 13ccb65..f28ea7a 100644 --- a/doc/src/platforms/emb-crosscompiling.qdoc +++ b/doc/src/platforms/emb-crosscompiling.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/emb-deployment.qdoc b/doc/src/platforms/emb-deployment.qdoc index 473cafc..6b22ba4 100644 --- a/doc/src/platforms/emb-deployment.qdoc +++ b/doc/src/platforms/emb-deployment.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/emb-differences.qdoc b/doc/src/platforms/emb-differences.qdoc index 642738e..e9aa0eb 100644 --- a/doc/src/platforms/emb-differences.qdoc +++ b/doc/src/platforms/emb-differences.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/emb-directfb-EmbLinux.qdoc b/doc/src/platforms/emb-directfb-EmbLinux.qdoc index f416819..dbe6c14 100644 --- a/doc/src/platforms/emb-directfb-EmbLinux.qdoc +++ b/doc/src/platforms/emb-directfb-EmbLinux.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/emb-displaymanagement.qdoc b/doc/src/platforms/emb-displaymanagement.qdoc index 6ed2c49..bba594f 100644 --- a/doc/src/platforms/emb-displaymanagement.qdoc +++ b/doc/src/platforms/emb-displaymanagement.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/emb-envvars.qdoc b/doc/src/platforms/emb-envvars.qdoc index 2421da9..1d109b4 100644 --- a/doc/src/platforms/emb-envvars.qdoc +++ b/doc/src/platforms/emb-envvars.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/emb-features.qdoc b/doc/src/platforms/emb-features.qdoc index 1e7b585..a362867 100644 --- a/doc/src/platforms/emb-features.qdoc +++ b/doc/src/platforms/emb-features.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/emb-fonts.qdoc b/doc/src/platforms/emb-fonts.qdoc index f7fed13..04aa4e4 100644 --- a/doc/src/platforms/emb-fonts.qdoc +++ b/doc/src/platforms/emb-fonts.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/emb-framebuffer-howto.qdoc b/doc/src/platforms/emb-framebuffer-howto.qdoc index ab00b88..f8b7ff9 100644 --- a/doc/src/platforms/emb-framebuffer-howto.qdoc +++ b/doc/src/platforms/emb-framebuffer-howto.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/emb-install.qdoc b/doc/src/platforms/emb-install.qdoc index 26b6475..11392b4 100644 --- a/doc/src/platforms/emb-install.qdoc +++ b/doc/src/platforms/emb-install.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/emb-kmap2qmap.qdoc b/doc/src/platforms/emb-kmap2qmap.qdoc index 23c3c92..91983ef 100644 --- a/doc/src/platforms/emb-kmap2qmap.qdoc +++ b/doc/src/platforms/emb-kmap2qmap.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/emb-makeqpf.qdoc b/doc/src/platforms/emb-makeqpf.qdoc index 6cf9d26..af24d7e 100644 --- a/doc/src/platforms/emb-makeqpf.qdoc +++ b/doc/src/platforms/emb-makeqpf.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/emb-opengl-EmbLinux.qdoc b/doc/src/platforms/emb-opengl-EmbLinux.qdoc index 649349d..c53c3af 100644 --- a/doc/src/platforms/emb-opengl-EmbLinux.qdoc +++ b/doc/src/platforms/emb-opengl-EmbLinux.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/emb-openvg-EmbLinux.qdoc b/doc/src/platforms/emb-openvg-EmbLinux.qdoc index 16dd51e..267eada 100644 --- a/doc/src/platforms/emb-openvg-EmbLinux.qdoc +++ b/doc/src/platforms/emb-openvg-EmbLinux.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/emb-performance.qdoc b/doc/src/platforms/emb-performance.qdoc index e6edf59..368b06e 100644 --- a/doc/src/platforms/emb-performance.qdoc +++ b/doc/src/platforms/emb-performance.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/emb-pointer.qdoc b/doc/src/platforms/emb-pointer.qdoc index b8ec167..22935b4 100644 --- a/doc/src/platforms/emb-pointer.qdoc +++ b/doc/src/platforms/emb-pointer.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/emb-porting.qdoc b/doc/src/platforms/emb-porting.qdoc index b7640ef..8b1f5f0 100644 --- a/doc/src/platforms/emb-porting.qdoc +++ b/doc/src/platforms/emb-porting.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/emb-qvfb.qdoc b/doc/src/platforms/emb-qvfb.qdoc index 5a35bc9..4be2f64 100644 --- a/doc/src/platforms/emb-qvfb.qdoc +++ b/doc/src/platforms/emb-qvfb.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/emb-running.qdoc b/doc/src/platforms/emb-running.qdoc index 20893c9..269f4f3 100644 --- a/doc/src/platforms/emb-running.qdoc +++ b/doc/src/platforms/emb-running.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/emb-vnc.qdoc b/doc/src/platforms/emb-vnc.qdoc index 47e8dcd..45b47d9 100644 --- a/doc/src/platforms/emb-vnc.qdoc +++ b/doc/src/platforms/emb-vnc.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/mac-differences.qdoc b/doc/src/platforms/mac-differences.qdoc index 2501656..dfcecca 100644 --- a/doc/src/platforms/mac-differences.qdoc +++ b/doc/src/platforms/mac-differences.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/platform-notes-rtos.qdoc b/doc/src/platforms/platform-notes-rtos.qdoc index 41b6ae7..4a34ece 100644 --- a/doc/src/platforms/platform-notes-rtos.qdoc +++ b/doc/src/platforms/platform-notes-rtos.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/platform-notes.qdoc b/doc/src/platforms/platform-notes.qdoc index 6f533ae..dff1b5b 100644 --- a/doc/src/platforms/platform-notes.qdoc +++ b/doc/src/platforms/platform-notes.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/qt-embedded-linux.qdoc b/doc/src/platforms/qt-embedded-linux.qdoc index 988472d..553c4b1 100644 --- a/doc/src/platforms/qt-embedded-linux.qdoc +++ b/doc/src/platforms/qt-embedded-linux.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/qt-embedded.qdoc b/doc/src/platforms/qt-embedded.qdoc index a3d11c6..8beb59d 100644 --- a/doc/src/platforms/qt-embedded.qdoc +++ b/doc/src/platforms/qt-embedded.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/qtmac-as-native.qdoc b/doc/src/platforms/qtmac-as-native.qdoc index 5bb0d10..61acebb 100644 --- a/doc/src/platforms/qtmac-as-native.qdoc +++ b/doc/src/platforms/qtmac-as-native.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/supported-platforms.qdoc b/doc/src/platforms/supported-platforms.qdoc index 83cd89b..e7de4c3 100644 --- a/doc/src/platforms/supported-platforms.qdoc +++ b/doc/src/platforms/supported-platforms.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/symbian-exceptionsafety.qdoc b/doc/src/platforms/symbian-exceptionsafety.qdoc index 03d223b..ffbf117 100644 --- a/doc/src/platforms/symbian-exceptionsafety.qdoc +++ b/doc/src/platforms/symbian-exceptionsafety.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/symbian-introduction.qdoc b/doc/src/platforms/symbian-introduction.qdoc index fafe007..8cc93ba 100644 --- a/doc/src/platforms/symbian-introduction.qdoc +++ b/doc/src/platforms/symbian-introduction.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/wince-customization.qdoc b/doc/src/platforms/wince-customization.qdoc index 5509d44..a674350 100644 --- a/doc/src/platforms/wince-customization.qdoc +++ b/doc/src/platforms/wince-customization.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/wince-introduction.qdoc b/doc/src/platforms/wince-introduction.qdoc index b3de5fe..cd66242 100644 --- a/doc/src/platforms/wince-introduction.qdoc +++ b/doc/src/platforms/wince-introduction.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/wince-opengl.qdoc b/doc/src/platforms/wince-opengl.qdoc index f9921f5..a33e9f6 100644 --- a/doc/src/platforms/wince-opengl.qdoc +++ b/doc/src/platforms/wince-opengl.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/wince-openvg.qdoc b/doc/src/platforms/wince-openvg.qdoc index aebd5ef..c15b1bd 100644 --- a/doc/src/platforms/wince-openvg.qdoc +++ b/doc/src/platforms/wince-openvg.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/wince-signing.qdoc b/doc/src/platforms/wince-signing.qdoc index d1fa6da..49e11a0 100644 --- a/doc/src/platforms/wince-signing.qdoc +++ b/doc/src/platforms/wince-signing.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/winsystem.qdoc b/doc/src/platforms/winsystem.qdoc index 71c93a5..2919bb7 100644 --- a/doc/src/platforms/winsystem.qdoc +++ b/doc/src/platforms/winsystem.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/platforms/x11overlays.qdoc b/doc/src/platforms/x11overlays.qdoc index 949a500..7a35cd2 100644 --- a/doc/src/platforms/x11overlays.qdoc +++ b/doc/src/platforms/x11overlays.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/porting/porting-qsa.qdoc b/doc/src/porting/porting-qsa.qdoc index 153f015..93a83f4 100644 --- a/doc/src/porting/porting-qsa.qdoc +++ b/doc/src/porting/porting-qsa.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/porting/porting4-canvas.qdoc b/doc/src/porting/porting4-canvas.qdoc index 4031917..d9e58ba 100644 --- a/doc/src/porting/porting4-canvas.qdoc +++ b/doc/src/porting/porting4-canvas.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/porting/porting4-designer.qdoc b/doc/src/porting/porting4-designer.qdoc index aa42b68..0de6cf0 100644 --- a/doc/src/porting/porting4-designer.qdoc +++ b/doc/src/porting/porting4-designer.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/porting/porting4-dnd.qdoc b/doc/src/porting/porting4-dnd.qdoc index 1828ebc..66403d0 100644 --- a/doc/src/porting/porting4-dnd.qdoc +++ b/doc/src/porting/porting4-dnd.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/porting/porting4-overview.qdoc b/doc/src/porting/porting4-overview.qdoc index 39a7cb9..f949460 100644 --- a/doc/src/porting/porting4-overview.qdoc +++ b/doc/src/porting/porting4-overview.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/porting/porting4.qdoc b/doc/src/porting/porting4.qdoc index 7b80e13..8b03187 100644 --- a/doc/src/porting/porting4.qdoc +++ b/doc/src/porting/porting4.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/porting/qt3to4.qdoc b/doc/src/porting/qt3to4.qdoc index e833b57..26eeee4 100644 --- a/doc/src/porting/qt3to4.qdoc +++ b/doc/src/porting/qt3to4.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/porting/qt4-accessibility.qdoc b/doc/src/porting/qt4-accessibility.qdoc index 0abcfed..634dda4 100644 --- a/doc/src/porting/qt4-accessibility.qdoc +++ b/doc/src/porting/qt4-accessibility.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/porting/qt4-arthur.qdoc b/doc/src/porting/qt4-arthur.qdoc index f657c83..1d6819d 100644 --- a/doc/src/porting/qt4-arthur.qdoc +++ b/doc/src/porting/qt4-arthur.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/porting/qt4-designer.qdoc b/doc/src/porting/qt4-designer.qdoc index 36881df..fff3e89 100644 --- a/doc/src/porting/qt4-designer.qdoc +++ b/doc/src/porting/qt4-designer.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/porting/qt4-interview.qdoc b/doc/src/porting/qt4-interview.qdoc index f2dab2f..973740a 100644 --- a/doc/src/porting/qt4-interview.qdoc +++ b/doc/src/porting/qt4-interview.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/porting/qt4-mainwindow.qdoc b/doc/src/porting/qt4-mainwindow.qdoc index b160d63..73c9b2b 100644 --- a/doc/src/porting/qt4-mainwindow.qdoc +++ b/doc/src/porting/qt4-mainwindow.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/porting/qt4-network.qdoc b/doc/src/porting/qt4-network.qdoc index f622b5a..52afb6a 100644 --- a/doc/src/porting/qt4-network.qdoc +++ b/doc/src/porting/qt4-network.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/porting/qt4-scribe.qdoc b/doc/src/porting/qt4-scribe.qdoc index 0a9596e..0ab1edf 100644 --- a/doc/src/porting/qt4-scribe.qdoc +++ b/doc/src/porting/qt4-scribe.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/porting/qt4-sql.qdoc b/doc/src/porting/qt4-sql.qdoc index 36ca4ef..b2de58f 100644 --- a/doc/src/porting/qt4-sql.qdoc +++ b/doc/src/porting/qt4-sql.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/porting/qt4-styles.qdoc b/doc/src/porting/qt4-styles.qdoc index d52a9ce..4eb06c9 100644 --- a/doc/src/porting/qt4-styles.qdoc +++ b/doc/src/porting/qt4-styles.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/porting/qt4-threads.qdoc b/doc/src/porting/qt4-threads.qdoc index b389c6c..3dd3594 100644 --- a/doc/src/porting/qt4-threads.qdoc +++ b/doc/src/porting/qt4-threads.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/porting/qt4-tulip.qdoc b/doc/src/porting/qt4-tulip.qdoc index 333af84..48d2a9e 100644 --- a/doc/src/porting/qt4-tulip.qdoc +++ b/doc/src/porting/qt4-tulip.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/qt-resources.qdoc b/doc/src/qt-resources.qdoc index 9a6637f..70a8c79 100644 --- a/doc/src/qt-resources.qdoc +++ b/doc/src/qt-resources.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/qt-webpages.qdoc b/doc/src/qt-webpages.qdoc index 5d9b41b..9947d7b 100644 --- a/doc/src/qt-webpages.qdoc +++ b/doc/src/qt-webpages.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc index 919bb88..7d55f82 100644 --- a/doc/src/qt4-intro.qdoc +++ b/doc/src/qt4-intro.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/scripting/ecmascript.qdoc b/doc/src/scripting/ecmascript.qdoc index 508bf3b..b08c3ae 100644 --- a/doc/src/scripting/ecmascript.qdoc +++ b/doc/src/scripting/ecmascript.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/scripting/qtscriptdebugger-manual.qdoc b/doc/src/scripting/qtscriptdebugger-manual.qdoc index 0b1f0f4..a19d8d4 100644 --- a/doc/src/scripting/qtscriptdebugger-manual.qdoc +++ b/doc/src/scripting/qtscriptdebugger-manual.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/scripting/qtscriptextensions.qdoc b/doc/src/scripting/qtscriptextensions.qdoc index 8aa8b4f..5825c0a 100644 --- a/doc/src/scripting/qtscriptextensions.qdoc +++ b/doc/src/scripting/qtscriptextensions.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/scripting/scripting.qdoc b/doc/src/scripting/scripting.qdoc index 70a17cf..a5f3d76 100644 --- a/doc/src/scripting/scripting.qdoc +++ b/doc/src/scripting/scripting.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/sql-programming/qsqldatatype-table.qdoc b/doc/src/sql-programming/qsqldatatype-table.qdoc index 45ee944..3ec2fea 100644 --- a/doc/src/sql-programming/qsqldatatype-table.qdoc +++ b/doc/src/sql-programming/qsqldatatype-table.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/sql-programming/sql-driver.qdoc b/doc/src/sql-programming/sql-driver.qdoc index 350777a..21b106a 100644 --- a/doc/src/sql-programming/sql-driver.qdoc +++ b/doc/src/sql-programming/sql-driver.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/sql-programming/sql-programming.qdoc b/doc/src/sql-programming/sql-programming.qdoc index 35b286c..3624d1e 100644 --- a/doc/src/sql-programming/sql-programming.qdoc +++ b/doc/src/sql-programming/sql-programming.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/tutorials/addressbook-fr.qdoc b/doc/src/tutorials/addressbook-fr.qdoc index d40d939..fe27488 100644 --- a/doc/src/tutorials/addressbook-fr.qdoc +++ b/doc/src/tutorials/addressbook-fr.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/tutorials/addressbook.qdoc b/doc/src/tutorials/addressbook.qdoc index d39a804..1c71f97 100644 --- a/doc/src/tutorials/addressbook.qdoc +++ b/doc/src/tutorials/addressbook.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/tutorials/modelview.qdoc b/doc/src/tutorials/modelview.qdoc index e47fe83..a355e43 100644 --- a/doc/src/tutorials/modelview.qdoc +++ b/doc/src/tutorials/modelview.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/tutorials/widgets-tutorial.qdoc b/doc/src/tutorials/widgets-tutorial.qdoc index a708311..df911a5 100644 --- a/doc/src/tutorials/widgets-tutorial.qdoc +++ b/doc/src/tutorials/widgets-tutorial.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/widgets-and-layouts/focus.qdoc b/doc/src/widgets-and-layouts/focus.qdoc index f1ff2f8..9948782 100644 --- a/doc/src/widgets-and-layouts/focus.qdoc +++ b/doc/src/widgets-and-layouts/focus.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/widgets-and-layouts/gallery-cde.qdoc b/doc/src/widgets-and-layouts/gallery-cde.qdoc index e52f77c..c783399 100644 --- a/doc/src/widgets-and-layouts/gallery-cde.qdoc +++ b/doc/src/widgets-and-layouts/gallery-cde.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/widgets-and-layouts/gallery-cleanlooks.qdoc b/doc/src/widgets-and-layouts/gallery-cleanlooks.qdoc index dfc498d..d03adc8 100644 --- a/doc/src/widgets-and-layouts/gallery-cleanlooks.qdoc +++ b/doc/src/widgets-and-layouts/gallery-cleanlooks.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/widgets-and-layouts/gallery-gtk.qdoc b/doc/src/widgets-and-layouts/gallery-gtk.qdoc index 503c5c5..b3a6372 100644 --- a/doc/src/widgets-and-layouts/gallery-gtk.qdoc +++ b/doc/src/widgets-and-layouts/gallery-gtk.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/widgets-and-layouts/gallery-macintosh.qdoc b/doc/src/widgets-and-layouts/gallery-macintosh.qdoc index 1319ac1..30a78ca 100644 --- a/doc/src/widgets-and-layouts/gallery-macintosh.qdoc +++ b/doc/src/widgets-and-layouts/gallery-macintosh.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/widgets-and-layouts/gallery-motif.qdoc b/doc/src/widgets-and-layouts/gallery-motif.qdoc index 455b824..861c22a 100644 --- a/doc/src/widgets-and-layouts/gallery-motif.qdoc +++ b/doc/src/widgets-and-layouts/gallery-motif.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/widgets-and-layouts/gallery-plastique.qdoc b/doc/src/widgets-and-layouts/gallery-plastique.qdoc index cd8e382..0ea62ee 100644 --- a/doc/src/widgets-and-layouts/gallery-plastique.qdoc +++ b/doc/src/widgets-and-layouts/gallery-plastique.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/widgets-and-layouts/gallery-windows.qdoc b/doc/src/widgets-and-layouts/gallery-windows.qdoc index ff4aa99..d3464a0 100644 --- a/doc/src/widgets-and-layouts/gallery-windows.qdoc +++ b/doc/src/widgets-and-layouts/gallery-windows.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/widgets-and-layouts/gallery-windowsvista.qdoc b/doc/src/widgets-and-layouts/gallery-windowsvista.qdoc index c719409..00afd52 100644 --- a/doc/src/widgets-and-layouts/gallery-windowsvista.qdoc +++ b/doc/src/widgets-and-layouts/gallery-windowsvista.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/widgets-and-layouts/gallery-windowsxp.qdoc b/doc/src/widgets-and-layouts/gallery-windowsxp.qdoc index 2399114..60c8ff0 100644 --- a/doc/src/widgets-and-layouts/gallery-windowsxp.qdoc +++ b/doc/src/widgets-and-layouts/gallery-windowsxp.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/widgets-and-layouts/gallery.qdoc b/doc/src/widgets-and-layouts/gallery.qdoc index 11132fd..201817b 100644 --- a/doc/src/widgets-and-layouts/gallery.qdoc +++ b/doc/src/widgets-and-layouts/gallery.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/widgets-and-layouts/layout.qdoc b/doc/src/widgets-and-layouts/layout.qdoc index 4db991a..10077f9 100644 --- a/doc/src/widgets-and-layouts/layout.qdoc +++ b/doc/src/widgets-and-layouts/layout.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/widgets-and-layouts/styles.qdoc b/doc/src/widgets-and-layouts/styles.qdoc index 180260b..cd0b86d 100644 --- a/doc/src/widgets-and-layouts/styles.qdoc +++ b/doc/src/widgets-and-layouts/styles.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/widgets-and-layouts/stylesheet.qdoc b/doc/src/widgets-and-layouts/stylesheet.qdoc index cc36fa2..6343e6a 100644 --- a/doc/src/widgets-and-layouts/stylesheet.qdoc +++ b/doc/src/widgets-and-layouts/stylesheet.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/widgets-and-layouts/widgets.qdoc b/doc/src/widgets-and-layouts/widgets.qdoc index fbce744..6d1d5ee 100644 --- a/doc/src/widgets-and-layouts/widgets.qdoc +++ b/doc/src/widgets-and-layouts/widgets.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/windows-and-dialogs/dialogs.qdoc b/doc/src/windows-and-dialogs/dialogs.qdoc index bcf9c0e..fef728f 100644 --- a/doc/src/windows-and-dialogs/dialogs.qdoc +++ b/doc/src/windows-and-dialogs/dialogs.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/windows-and-dialogs/mainwindow.qdoc b/doc/src/windows-and-dialogs/mainwindow.qdoc index 9d50495..9d3ac30 100644 --- a/doc/src/windows-and-dialogs/mainwindow.qdoc +++ b/doc/src/windows-and-dialogs/mainwindow.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/xml-processing/xml-patterns.qdoc b/doc/src/xml-processing/xml-patterns.qdoc index d0c8709..2a38302 100644 --- a/doc/src/xml-processing/xml-patterns.qdoc +++ b/doc/src/xml-processing/xml-patterns.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/xml-processing/xml-processing.qdoc b/doc/src/xml-processing/xml-processing.qdoc index dcdd8d1..85f3c7b 100644 --- a/doc/src/xml-processing/xml-processing.qdoc +++ b/doc/src/xml-processing/xml-processing.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/xml-processing/xquery-introduction.qdoc b/doc/src/xml-processing/xquery-introduction.qdoc index b5356f7..5f9743a 100644 --- a/doc/src/xml-processing/xquery-introduction.qdoc +++ b/doc/src/xml-processing/xquery-introduction.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/zh_CN/bughowto.qdoc b/doc/src/zh_CN/bughowto.qdoc index 05c8403..13f5c70 100644 --- a/doc/src/zh_CN/bughowto.qdoc +++ b/doc/src/zh_CN/bughowto.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc b/doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc index b43b53e..d942ee6 100644 --- a/doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc +++ b/doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/zh_CN/getting-started/tutorials.qdoc b/doc/src/zh_CN/getting-started/tutorials.qdoc index d674175..b9ff7dd 100644 --- a/doc/src/zh_CN/getting-started/tutorials.qdoc +++ b/doc/src/zh_CN/getting-started/tutorials.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/zh_CN/tutorials/addressbook.qdoc b/doc/src/zh_CN/tutorials/addressbook.qdoc index c1c9717..cbd02d7 100644 --- a/doc/src/zh_CN/tutorials/addressbook.qdoc +++ b/doc/src/zh_CN/tutorials/addressbook.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/doc/src/zh_CN/tutorials/widgets-tutorial.qdoc b/doc/src/zh_CN/tutorials/widgets-tutorial.qdoc index ba4433e..66e6c10 100644 --- a/doc/src/zh_CN/tutorials/widgets-tutorial.qdoc +++ b/doc/src/zh_CN/tutorials/widgets-tutorial.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/header.FDL b/header.FDL index 4f99540..264a1ff 100644 --- a/header.FDL +++ b/header.FDL @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/corelib/codecs/codecs.qdoc b/src/corelib/codecs/codecs.qdoc index b88f016..3171f58 100644 --- a/src/corelib/codecs/codecs.qdoc +++ b/src/corelib/codecs/codecs.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/corelib/global/qendian.qdoc b/src/corelib/global/qendian.qdoc index 795ff81..ecdaf9f 100644 --- a/src/corelib/global/qendian.qdoc +++ b/src/corelib/global/qendian.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 5cd7f0e..af16d24 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/corelib/kernel/qmath.qdoc b/src/corelib/kernel/qmath.qdoc index 48f74b6..2c03b9a 100644 --- a/src/corelib/kernel/qmath.qdoc +++ b/src/corelib/kernel/qmath.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/corelib/plugin/qplugin.qdoc b/src/corelib/plugin/qplugin.qdoc index b02cfbf..9183350 100644 --- a/src/corelib/plugin/qplugin.qdoc +++ b/src/corelib/plugin/qplugin.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/corelib/thread/qwaitcondition.qdoc b/src/corelib/thread/qwaitcondition.qdoc index b21285e..aaed420 100644 --- a/src/corelib/thread/qwaitcondition.qdoc +++ b/src/corelib/thread/qwaitcondition.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/corelib/tools/qalgorithms.qdoc b/src/corelib/tools/qalgorithms.qdoc index 4a4f592..898f940 100644 --- a/src/corelib/tools/qalgorithms.qdoc +++ b/src/corelib/tools/qalgorithms.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/corelib/tools/qcache.qdoc b/src/corelib/tools/qcache.qdoc index 71e0483..0a3c971 100644 --- a/src/corelib/tools/qcache.qdoc +++ b/src/corelib/tools/qcache.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/corelib/tools/qiterator.qdoc b/src/corelib/tools/qiterator.qdoc index 1e7637b..9cec7ec 100644 --- a/src/corelib/tools/qiterator.qdoc +++ b/src/corelib/tools/qiterator.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/corelib/tools/qpair.qdoc b/src/corelib/tools/qpair.qdoc index d49c09e..4ef151e 100644 --- a/src/corelib/tools/qpair.qdoc +++ b/src/corelib/tools/qpair.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/corelib/tools/qset.qdoc b/src/corelib/tools/qset.qdoc index d1aca4c..0bc2d2d 100644 --- a/src/corelib/tools/qset.qdoc +++ b/src/corelib/tools/qset.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc index cbd81c7..6f91bcc 100644 --- a/src/corelib/tools/qvarlengtharray.qdoc +++ b/src/corelib/tools/qvarlengtharray.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/gui/dialogs/qprintdialog.qdoc b/src/gui/dialogs/qprintdialog.qdoc index bd406c1..b75fe2e 100644 --- a/src/gui/dialogs/qprintdialog.qdoc +++ b/src/gui/dialogs/qprintdialog.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/gui/kernel/qdesktopwidget.qdoc b/src/gui/kernel/qdesktopwidget.qdoc index 2d72bf9..c550082 100644 --- a/src/gui/kernel/qdesktopwidget.qdoc +++ b/src/gui/kernel/qdesktopwidget.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/gui/kernel/qsizepolicy.qdoc b/src/gui/kernel/qsizepolicy.qdoc index 7cd05c5..1bb13fe 100644 --- a/src/gui/kernel/qsizepolicy.qdoc +++ b/src/gui/kernel/qsizepolicy.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/gui/painting/qcolormap.qdoc b/src/gui/painting/qcolormap.qdoc index ec3d2ba..96fd6a0 100644 --- a/src/gui/painting/qcolormap.qdoc +++ b/src/gui/painting/qcolormap.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/gui/painting/qpaintdevice.qdoc b/src/gui/painting/qpaintdevice.qdoc index 38a1575..5290766 100644 --- a/src/gui/painting/qpaintdevice.qdoc +++ b/src/gui/painting/qpaintdevice.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/gui/painting/qprinterinfo.qdoc b/src/gui/painting/qprinterinfo.qdoc index 7374675..9193213 100644 --- a/src/gui/painting/qprinterinfo.qdoc +++ b/src/gui/painting/qprinterinfo.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/gui/styles/qmacstyle.qdoc b/src/gui/styles/qmacstyle.qdoc index a86f2ed..3efabe1 100644 --- a/src/gui/styles/qmacstyle.qdoc +++ b/src/gui/styles/qmacstyle.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/qt3support/sql/q3sqlfieldinfo.qdoc b/src/qt3support/sql/q3sqlfieldinfo.qdoc index 2ba9f70..a4c5619 100644 --- a/src/qt3support/sql/q3sqlfieldinfo.qdoc +++ b/src/qt3support/sql/q3sqlfieldinfo.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/qt3support/sql/q3sqlrecordinfo.qdoc b/src/qt3support/sql/q3sqlrecordinfo.qdoc index bbe46e4..1d89893 100644 --- a/src/qt3support/sql/q3sqlrecordinfo.qdoc +++ b/src/qt3support/sql/q3sqlrecordinfo.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/qt3support/tools/q3asciicache.qdoc b/src/qt3support/tools/q3asciicache.qdoc index 87a8b6b..df82c13 100644 --- a/src/qt3support/tools/q3asciicache.qdoc +++ b/src/qt3support/tools/q3asciicache.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/qt3support/tools/q3asciidict.qdoc b/src/qt3support/tools/q3asciidict.qdoc index b73e5d6..8ab87c9 100644 --- a/src/qt3support/tools/q3asciidict.qdoc +++ b/src/qt3support/tools/q3asciidict.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/qt3support/tools/q3cache.qdoc b/src/qt3support/tools/q3cache.qdoc index f1a2f3a..0ee1167 100644 --- a/src/qt3support/tools/q3cache.qdoc +++ b/src/qt3support/tools/q3cache.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/qt3support/tools/q3dict.qdoc b/src/qt3support/tools/q3dict.qdoc index 993345e..0736bb4 100644 --- a/src/qt3support/tools/q3dict.qdoc +++ b/src/qt3support/tools/q3dict.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/qt3support/tools/q3intcache.qdoc b/src/qt3support/tools/q3intcache.qdoc index 81b2227..78c6a82 100644 --- a/src/qt3support/tools/q3intcache.qdoc +++ b/src/qt3support/tools/q3intcache.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/qt3support/tools/q3intdict.qdoc b/src/qt3support/tools/q3intdict.qdoc index 7d9338e..27c37a0 100644 --- a/src/qt3support/tools/q3intdict.qdoc +++ b/src/qt3support/tools/q3intdict.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/qt3support/tools/q3memarray.qdoc b/src/qt3support/tools/q3memarray.qdoc index a8f62bf..13b1c2f 100644 --- a/src/qt3support/tools/q3memarray.qdoc +++ b/src/qt3support/tools/q3memarray.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/qt3support/tools/q3ptrdict.qdoc b/src/qt3support/tools/q3ptrdict.qdoc index 247067f..5fb8706 100644 --- a/src/qt3support/tools/q3ptrdict.qdoc +++ b/src/qt3support/tools/q3ptrdict.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/qt3support/tools/q3ptrlist.qdoc b/src/qt3support/tools/q3ptrlist.qdoc index 247a6b3..294e4ba 100644 --- a/src/qt3support/tools/q3ptrlist.qdoc +++ b/src/qt3support/tools/q3ptrlist.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/qt3support/tools/q3ptrqueue.qdoc b/src/qt3support/tools/q3ptrqueue.qdoc index 3c6881d..2c41cf5 100644 --- a/src/qt3support/tools/q3ptrqueue.qdoc +++ b/src/qt3support/tools/q3ptrqueue.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/qt3support/tools/q3ptrstack.qdoc b/src/qt3support/tools/q3ptrstack.qdoc index c58dcb8..8128a7f 100644 --- a/src/qt3support/tools/q3ptrstack.qdoc +++ b/src/qt3support/tools/q3ptrstack.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/qt3support/tools/q3ptrvector.qdoc b/src/qt3support/tools/q3ptrvector.qdoc index 689f21c..586b6e4 100644 --- a/src/qt3support/tools/q3ptrvector.qdoc +++ b/src/qt3support/tools/q3ptrvector.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/qt3support/tools/q3valuelist.qdoc b/src/qt3support/tools/q3valuelist.qdoc index 30d1e68..554e0f5 100644 --- a/src/qt3support/tools/q3valuelist.qdoc +++ b/src/qt3support/tools/q3valuelist.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/qt3support/tools/q3valuestack.qdoc b/src/qt3support/tools/q3valuestack.qdoc index 7960950..6e2ccbb 100644 --- a/src/qt3support/tools/q3valuestack.qdoc +++ b/src/qt3support/tools/q3valuestack.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/qt3support/tools/q3valuevector.qdoc b/src/qt3support/tools/q3valuevector.qdoc index a10b36e..afe7f9c 100644 --- a/src/qt3support/tools/q3valuevector.qdoc +++ b/src/qt3support/tools/q3valuevector.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/sql/kernel/qsql.qdoc b/src/sql/kernel/qsql.qdoc index c842e11..65a8594 100644 --- a/src/sql/kernel/qsql.qdoc +++ b/src/sql/kernel/qsql.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/testlib/qsignalspy.qdoc b/src/testlib/qsignalspy.qdoc index 0e8a4c0..7018c09 100644 --- a/src/testlib/qsignalspy.qdoc +++ b/src/testlib/qsignalspy.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/src/testlib/qtestevent.qdoc b/src/testlib/qtestevent.qdoc index a76c782..7ca9eb7 100644 --- a/src/testlib/qtestevent.qdoc +++ b/src/testlib/qtestevent.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/tools/assistant/tools/assistant/doc/assistant.qdoc b/tools/assistant/tools/assistant/doc/assistant.qdoc index 129e60d..eda2063 100644 --- a/tools/assistant/tools/assistant/doc/assistant.qdoc +++ b/tools/assistant/tools/assistant/doc/assistant.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/tools/designer/src/lib/sdk/abstractdnditem.qdoc b/tools/designer/src/lib/sdk/abstractdnditem.qdoc index bdae59c..0d63954 100644 --- a/tools/designer/src/lib/sdk/abstractdnditem.qdoc +++ b/tools/designer/src/lib/sdk/abstractdnditem.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/tools/designer/src/lib/sdk/abstracticoncache.qdoc b/tools/designer/src/lib/sdk/abstracticoncache.qdoc index 6eb6b13..467eca2 100644 --- a/tools/designer/src/lib/sdk/abstracticoncache.qdoc +++ b/tools/designer/src/lib/sdk/abstracticoncache.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/tools/designer/src/lib/sdk/dynamicpropertysheet.qdoc b/tools/designer/src/lib/sdk/dynamicpropertysheet.qdoc index b813c16..93690cd 100644 --- a/tools/designer/src/lib/sdk/dynamicpropertysheet.qdoc +++ b/tools/designer/src/lib/sdk/dynamicpropertysheet.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/tools/designer/src/lib/sdk/layoutdecoration.qdoc b/tools/designer/src/lib/sdk/layoutdecoration.qdoc index 1b38975..1dacbb2 100644 --- a/tools/designer/src/lib/sdk/layoutdecoration.qdoc +++ b/tools/designer/src/lib/sdk/layoutdecoration.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/tools/designer/src/lib/sdk/membersheet.qdoc b/tools/designer/src/lib/sdk/membersheet.qdoc index 7185579..f9d76cf 100644 --- a/tools/designer/src/lib/sdk/membersheet.qdoc +++ b/tools/designer/src/lib/sdk/membersheet.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/tools/designer/src/lib/sdk/propertysheet.qdoc b/tools/designer/src/lib/sdk/propertysheet.qdoc index 8c49087..ab2477b 100644 --- a/tools/designer/src/lib/sdk/propertysheet.qdoc +++ b/tools/designer/src/lib/sdk/propertysheet.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/tools/designer/src/lib/sdk/taskmenu.qdoc b/tools/designer/src/lib/sdk/taskmenu.qdoc index 23ea1b2..68854b3 100644 --- a/tools/designer/src/lib/sdk/taskmenu.qdoc +++ b/tools/designer/src/lib/sdk/taskmenu.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/tools/designer/src/lib/uilib/container.qdoc b/tools/designer/src/lib/uilib/container.qdoc index a3bbcc6..cea5a45 100644 --- a/tools/designer/src/lib/uilib/container.qdoc +++ b/tools/designer/src/lib/uilib/container.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/tools/designer/src/lib/uilib/customwidget.qdoc b/tools/designer/src/lib/uilib/customwidget.qdoc index cdbdfa2..88c169a 100644 --- a/tools/designer/src/lib/uilib/customwidget.qdoc +++ b/tools/designer/src/lib/uilib/customwidget.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/tools/qdoc3/doc/qdoc-manual.qdoc b/tools/qdoc3/doc/qdoc-manual.qdoc index c3ab731..b557ad9 100644 --- a/tools/qdoc3/doc/qdoc-manual.qdoc +++ b/tools/qdoc3/doc/qdoc-manual.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free diff --git a/util/qlalr/doc/src/qlalr.qdoc b/util/qlalr/doc/src/qlalr.qdoc index dffef5a..0d5fbb9 100644 --- a/util/qlalr/doc/src/qlalr.qdoc +++ b/util/qlalr/doc/src/qlalr.qdoc @@ -7,11 +7,11 @@ ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in a -** written agreement between you and Nokia. +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Free Documentation License ** Alternatively, this file may be used under the terms of the GNU Free -- cgit v0.12 From 8540ceb8c98fa225394385b6147b662adb67b58c Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Mon, 4 Oct 2010 15:55:39 +0200 Subject: Corrected doc about ASCII string. Task-number: QTBUG-13414 Reviewed-by: David Boddie --- src/corelib/tools/qstring.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 5be885b..d1060d2 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -3891,7 +3891,7 @@ QString QString::fromLocal8Bit(const char *str, int size) /*! Returns a QString initialized with the first \a size characters - of the 8-bit string \a str. + from the string \a str. If \a size is -1 (default), it is taken to be qstrlen(\a str). -- cgit v0.12 From f3817bc1a7bc3df360af9116dfd96f3181816472 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Mon, 4 Oct 2010 16:43:21 +0200 Subject: Added the QtWebKit bridge Image Analyzer example. Originally written by Jervey Kong. Task-number: QTBUG-14154 Reviewed-by: David Boddie --- doc/src/examples/webkit-bridge-imageanalyzer.qdoc | 155 ++++++++++++++ doc/src/getting-started/examples.qdoc | 7 +- doc/src/images/webkit-imageanalyzer-complete.png | Bin 0 -> 10257 bytes doc/src/images/webkit-imageanalyzer-progress.png | Bin 0 -> 18240 bytes doc/src/images/webkit-imageanalyzer-screenshot.png | Bin 0 -> 190353 bytes examples/webkit/imageanalyzer/README | 20 ++ examples/webkit/imageanalyzer/imageanalyzer.cpp | 222 +++++++++++++++++++++ examples/webkit/imageanalyzer/imageanalyzer.h | 96 +++++++++ examples/webkit/imageanalyzer/imageanalyzer.pro | 14 ++ examples/webkit/imageanalyzer/main.cpp | 53 +++++ examples/webkit/imageanalyzer/mainwindow.cpp | 80 ++++++++ examples/webkit/imageanalyzer/mainwindow.h | 63 ++++++ .../webkit/imageanalyzer/resources/images/README | 2 + .../imageanalyzer/resources/images/bellaCoola.jpg | Bin 0 -> 129886 bytes .../imageanalyzer/resources/images/flower.jpg | Bin 0 -> 67126 bytes .../imageanalyzer/resources/images/mtRainier.jpg | Bin 0 -> 104090 bytes .../imageanalyzer/resources/images/seaShell.jpg | Bin 0 -> 82690 bytes .../imageanalyzer/resources/images/trees.jpg | Bin 0 -> 98630 bytes examples/webkit/webkit.pro | 1 + 19 files changed, 711 insertions(+), 2 deletions(-) create mode 100644 doc/src/examples/webkit-bridge-imageanalyzer.qdoc create mode 100644 doc/src/images/webkit-imageanalyzer-complete.png create mode 100644 doc/src/images/webkit-imageanalyzer-progress.png create mode 100644 doc/src/images/webkit-imageanalyzer-screenshot.png create mode 100644 examples/webkit/imageanalyzer/README create mode 100644 examples/webkit/imageanalyzer/imageanalyzer.cpp create mode 100644 examples/webkit/imageanalyzer/imageanalyzer.h create mode 100644 examples/webkit/imageanalyzer/imageanalyzer.pro create mode 100644 examples/webkit/imageanalyzer/main.cpp create mode 100644 examples/webkit/imageanalyzer/mainwindow.cpp create mode 100644 examples/webkit/imageanalyzer/mainwindow.h create mode 100644 examples/webkit/imageanalyzer/resources/images/README create mode 100644 examples/webkit/imageanalyzer/resources/images/bellaCoola.jpg create mode 100644 examples/webkit/imageanalyzer/resources/images/flower.jpg create mode 100644 examples/webkit/imageanalyzer/resources/images/mtRainier.jpg create mode 100644 examples/webkit/imageanalyzer/resources/images/seaShell.jpg create mode 100644 examples/webkit/imageanalyzer/resources/images/trees.jpg diff --git a/doc/src/examples/webkit-bridge-imageanalyzer.qdoc b/doc/src/examples/webkit-bridge-imageanalyzer.qdoc new file mode 100644 index 0000000..efc5623 --- /dev/null +++ b/doc/src/examples/webkit-bridge-imageanalyzer.qdoc @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of this +** file. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ +/*! + \example webkit/imageanalyzer + \startpage {index.html} {Qt Reference Documentation} + \title The Webkit Bridge Tutorial - Hybrid Client Application + + In this example, we will show how to write a hybrid application using +\l{The QtWebKit Bridge}{QtWebKit Bridge}, which distinguishes itself from a +thin client in that it performs heavy calculations on the client side in C++, +like a native application, but presents nothing more than a \c QWebView for its +user interface, displaying web content written in HTML/JavaScript. The +application uses QtConcurrent to distribute its work across as many CPU cores as +are available from the system, so it can process each image in parallel. + +Initially, you will see a user interface with an empty list of images. Clicking +on some of the images in the lower pane below adds them to the list view above, +as shown in the screenshot below. + + \image webkit-imageanalyzer-screenshot.png + +Now, we can click on \bold Analyze, and each image is analyzed using some +computationally intensive C++ function, in parallel and on different cores. +Progress is shown while the analysis is proceeding. + + \image webkit-imageanalyzer-progress.png + +and in the end, we will see something like this, where the average RGB values of +each image are shown. + + \image webkit-imageanalyzer-complete.png + +The MainWindow is defined in C++, and creates a \c QNetworkCache and a +\c QWebView, and tells the \c QWebView to load the starting page, providing us +with a user interface for the client. + + \snippet examples/webkit/imageanalyzer/mainwindow.cpp MainWindow - constructor + +In this example, the sample content is addressed with the \tt qrc:/index.html +URL. \tt qrc:/ indicates that the file is stored as a Qt resource (attached to +the executable). In a real-world application, the content and images would +likely be retrieved from the network rather than from resources. + +We wish to initialize an object reference in the JavaScript web page to point +to our \tt ImageAnalyzer before any other scripts are run. To do this, we +connect the \c javaScriptWindowObjectCleared() signal to a slot which does the +object creation and handoff to JavaScript. + + \snippet examples/webkit/imageanalyzer/mainwindow.cpp MainWindow - addJSObject + +The ImageAnalyzer object is created and added to a JavaScript object on the web +page's mainFrame with \c addToJavaScriptWindowObject(). + + The start page is resources/index.html. + In one of its
regions, we have images, each + with an \c onClick() handler that calls \c addImage(). + + \snippet examples/webkit/imageanalyzer/resources/index.html sample images + + Clicking an image adds it to an images list. + + \snippet examples/webkit/imageanalyzer/resources/index.html addImage + +The \bold {Analyze} button at the bottom of the image list is clicked when we +want to start the analysis: + + \snippet examples/webkit/imageanalyzer/resources/index.html images list + +When the user clicks the \bold {Analyze} button, \c analyzeImages() is called, +another regular JavaScript method, shown below. +Notice it assumes the \c imageAnalyzer object is already defined and initialized +in JavaScript space, but we guaranteed that by connecting our setup slot to the +appropriate signal, \c javaScriptWindowObjectCleared(). + + \snippet examples/webkit/imageanalyzer/resources/index.html analyzeImages + +The only methods on \c ImageAnalyzer that we can or do call from JavaScript are +those which are exposed through Qt's MetaObject system: property getter/setter +methods, +\c public \c slots, \c signals, and other \c Q_INVOKABLE functions. + +\snippet examples/webkit/imageanalyzer/imageanalyzer.h ImageAnalyzer - public interface +\dots +\snippet examples/webkit/imageanalyzer/imageanalyzer.h ImageAnalyzer - private members + +Most of the members are set up in the constructor: + +\snippet examples/webkit/imageanalyzer/imageanalyzer.cpp ImageAnalyzer - Constructor + +Back on the JavaScript side, we want to connect signals from this object to +JavaScript functions on our web page, after the web page is loaded, but before +the images are analyzed. + +From \c connectSlots(), we can see how to connect signals from the imageAnalyzer +object to regular JavaScript functions, which can also behave like slots. We use +this to monitor and display progress from the C++ side. + + \snippet examples/webkit/imageanalyzer/resources/index.html connect slots + +The only public slot is \c startAnalysis(), called to place +a list of URLs into the image analyzer's QtConcurrent processing queue +from JavaScript space. + +\snippet examples/webkit/imageanalyzer/imageanalyzer.cpp ImageAnalyzer - startAnalysis + +The images need to be loaded again now, which is why fetchURLs first checks the +cache to see if we can save an extra network get. + +\snippet examples/webkit/imageanalyzer/imageanalyzer.cpp ImageAnalyzer - fetchURLs + +For the images that were not in the cache, \c handleReply() +will load them into a QImage when the data is ready. + +\snippet examples/webkit/imageanalyzer/imageanalyzer.cpp ImageAnalyzer - handleReply + +After the images are loaded, they are queued up in preparation to be +sent in a batch for analysis to a \c QFutureWatcher, which will distribute the +processing across multiple threads and cores, depending on how many are available. + +\snippet examples/webkit/imageanalyzer/imageanalyzer.cpp ImageAnalyzer - queueImage + +The function that gets performed on each image is \c averageRGB(), +as specified in argument 2 to the \c QtConcurrent::mapped() function. +Notice it repeats the same calculations 100 times on each pixel to keep the CPU +very busy. This is done only for the purposes of the demo so that the analysis +takes a noticeable time to complete. + +\snippet examples/webkit/imageanalyzer/imageanalyzer.cpp ImageAnalyzer - averageRGB + +*/ + diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index bfe7be9..398eee8 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -32,7 +32,7 @@ Qt includes a set of examples that cover nearly every aspect of Qt development. They aren't meant to be impressive when you run them, but in each case the source code has been carefully written to - illustrate one or more best Qt programming practices. + illustrate one or more best Qt programming practices. You can run the examples from the \l{Examples and Demos Launcher} application (except see \l{QML Examples and Demos} {QML Examples} @@ -764,6 +764,9 @@ \row \o \l{webkit/googlechat}{Google Chat} \o A real-world example that shows how an existing Web-based service can be accessed using QtWebKit. + \row \o \l{webkit/imageanalyzer}{Image Analyzer}\raisedaster + \o A \l{The QtWebKit Bridge}{QtWebKit bridge} application which contains a + web interface and client-side processing. \row \o \l{webkit/previewer}{Previewer}\raisedaster \o Shows how to make a simple Web page previewer by using Qt's text input widgets together with a QWebView widget. @@ -776,7 +779,7 @@ */ /*! - \page examples-helpsystem.html + \page examples-helpsystem.html \ingroup all-examples \title Help System Examples \brief Adding interactive help to your Qt application. diff --git a/doc/src/images/webkit-imageanalyzer-complete.png b/doc/src/images/webkit-imageanalyzer-complete.png new file mode 100644 index 0000000..47c0ee1 Binary files /dev/null and b/doc/src/images/webkit-imageanalyzer-complete.png differ diff --git a/doc/src/images/webkit-imageanalyzer-progress.png b/doc/src/images/webkit-imageanalyzer-progress.png new file mode 100644 index 0000000..5bab890 Binary files /dev/null and b/doc/src/images/webkit-imageanalyzer-progress.png differ diff --git a/doc/src/images/webkit-imageanalyzer-screenshot.png b/doc/src/images/webkit-imageanalyzer-screenshot.png new file mode 100644 index 0000000..987f8a2 Binary files /dev/null and b/doc/src/images/webkit-imageanalyzer-screenshot.png differ diff --git a/examples/webkit/imageanalyzer/README b/examples/webkit/imageanalyzer/README new file mode 100644 index 0000000..9415b57 --- /dev/null +++ b/examples/webkit/imageanalyzer/README @@ -0,0 +1,20 @@ +This example demonstrates the use of Qt WebKit to make a hybrid application. + +Build instructions: + + On Mac OS X: + In this directory: + qmake -spec macx-g++ + make clean all + open imageanalyzer.app + On Linux/Unix: + In this directory: + qmake + make clean all + ./imageanalyzer + + On Windows: + In this directory: + qmake + nmake clean all + debug\imageanalyzer.exe diff --git a/examples/webkit/imageanalyzer/imageanalyzer.cpp b/examples/webkit/imageanalyzer/imageanalyzer.cpp new file mode 100644 index 0000000..c663cf3 --- /dev/null +++ b/examples/webkit/imageanalyzer/imageanalyzer.cpp @@ -0,0 +1,222 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include +#include +#include +#include +#include "imageanalyzer.h" + +/*! + * This class operates as follows: + * Parent calls the slot startAnalysis which shoves a list of QStrings into URLQueue and then calls fetchURLs. + * FetchURLs sends out HTTP GETs for each image it can't get out of the cache. + * As the responses come in, handleReply trys to create an image out of each and pushes those images into imageQueue. + * On the last (detected by no outstandingFetches and URLQueue.isEmpty()) call to queueImage (from handleReply) + * a thread is forked to process all the images. When it finishes, it emits a finished signal that is received + * by our JavaScript code. + */ + +//! [ ImageAnalyzer - Constructor ] +ImageAnalyzer::ImageAnalyzer(QNetworkDiskCache* netcache, QObject* parent) +: QObject(parent), m_cache(netcache), m_outstandingFetches(0) +{ + /* ImageAnalyzer only wants to receive http responses + for requests that it makes, so that's why it has its own + QNetworkAccessManager. */ + m_network = new QNetworkAccessManager(this); + m_watcher = new QFutureWatcher(this); + /* We want to share a cache with the web browser, + in case it has some images we want: */ + m_network->setCache(m_cache); + + QObject::connect(m_network, SIGNAL(finished(QNetworkReply*)), + this, SLOT(handleReply(QNetworkReply*))); + QObject::connect(m_watcher, SIGNAL(finished()), + this, SLOT(doneProcessing())); + QObject::connect(m_watcher, SIGNAL(progressValueChanged(int)), + this, SLOT(progressStatus(int))); +} +//! [ ImageAnalyzer - Constructor ] +ImageAnalyzer::~ImageAnalyzer() +{ + delete(m_watcher); +} + + +QRgb ImageAnalyzer::lastResults() +{ + int rTot = 0; + int bTot = 0; + int gTot = 0; + int count = m_watcher->future().results().size(); + foreach(const QRgb & triplet, m_watcher->future().results()) + { + rTot += qRed(triplet); + bTot += qBlue(triplet); + gTot += qGreen(triplet); + } + return qRgb(rTot/count, bTot/count, gTot/count); +} + +float ImageAnalyzer::lastRed() { return qRed(lastResults())/2.55; } +float ImageAnalyzer::lastGreen() { return qGreen(lastResults())/2.55; } +float ImageAnalyzer::lastBlue() { return qBlue(lastResults())/2.55; } + +void ImageAnalyzer::progressStatus(int newstat) +{ + emit updateProgress(newstat, m_watcher->progressMaximum()); +} + + +bool ImageAnalyzer::isBusy() +{ + return m_watcher->isRunning(); +} + + +//! [ ImageAnalyzer - startAnalysis ] +void ImageAnalyzer::startAnalysis(const QStringList & urls) +{ + m_URLQueue = urls; + fetchURLs(); +} +//! [ ImageAnalyzer - startAnalysis ] + +/*! + * Analyzes the entire queue - just starts all our http GETs. + */ +//! [ ImageAnalyzer - fetchURLs ] +void ImageAnalyzer::fetchURLs() +{ + while (!m_URLQueue.isEmpty()) + { + QString url = m_URLQueue.takeFirst(); + QUrl URL = QUrl(url); + QIODevice * pData = m_cache->data(URL); + // Is image already loaded in cache? + if (pData == 0) { + // HTTP Get image over network. + m_outstandingFetches++; + QNetworkRequest request = QNetworkRequest(URL); + request.setRawHeader("User-Agent", "Nokia - Custom QT app"); + m_network->get(request); + } else { + // Get image from cache + QImage image; + image.load(pData, 0); + if (!image.isNull()) + queueImage(image); + delete(pData); + } + } +} +//! [ ImageAnalyzer - fetchURLs ] +/* + * Slot to handle the incoming responses from our http GETs + */ +//! [ ImageAnalyzer - handleReply ] +void ImageAnalyzer::handleReply(QNetworkReply * pReply) +{ + m_outstandingFetches--; + if (pReply->error()) { + qDebug() << "Error code" << pReply->error(); + qDebug() << "Http code" << pReply->attribute(QNetworkRequest::HttpStatusCodeAttribute); + return; + } + QImage image; + image.load(pReply, 0); + pReply->deleteLater(); + if (image.isNull()) { + qDebug() << "bad image"; + qDebug() << pReply->rawHeaderList(); + foreach(QByteArray element, pReply->rawHeaderList()) { + qDebug() << element << " = " << pReply->rawHeader(element); + } + return; + } + queueImage(image); +} +//! [ ImageAnalyzer - handleReply ] + +void ImageAnalyzer::doneProcessing() +{ + m_imageQueue = QList(); + emit finishedAnalysis(); +} +//! [ ImageAnalyzer - queueImage ] +void ImageAnalyzer::queueImage(QImage img) +{ + if (!img.isNull()) + m_imageQueue << img; + + if (m_outstandingFetches == 0 && m_URLQueue.isEmpty()) { + m_watcher->setFuture(QtConcurrent::mapped(m_imageQueue, averageRGB)); + } +} +//! [ ImageAnalyzer - queueImage ] + +//! [ ImageAnalyzer - averageRGB ] +QRgb averageRGB(const QImage &img) +{ + int pixelCount = img.width() * img.height(); + int rAvg, gAvg, bAvg; + + // We waste some time here: + for (int timeWaster=0; timeWaster < 100; timeWaster++) { + quint64 rTot = 0; + quint64 gTot = 0; + quint64 bTot = 0; + for (int i=0; i < img.width(); i++) { + for (int j=0; j < img.height(); j++) { + QRgb pixel = img.pixel(i,j); + rTot += qRed(pixel); + gTot += qGreen(pixel); + bTot += qBlue(pixel); + } + } + rAvg = (rTot)/(pixelCount); + gAvg = (gTot)/(pixelCount); + bAvg = (bTot)/(pixelCount); + } + return qRgb(rAvg, gAvg, bAvg); +} +//! [ ImageAnalyzer - averageRGB ] diff --git a/examples/webkit/imageanalyzer/imageanalyzer.h b/examples/webkit/imageanalyzer/imageanalyzer.h new file mode 100644 index 0000000..f228c0e --- /dev/null +++ b/examples/webkit/imageanalyzer/imageanalyzer.h @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef IMAGEANALYZER_H +#define IMAGEANALYZER_H +#include +#include + +class QNetworkAccessManager; +class QNetworkReply; +class QNetworkDiskCache; +//! [ ImageAnalyzer - public interface ] +class ImageAnalyzer : public QObject +{ + Q_OBJECT + public: + ImageAnalyzer(QNetworkDiskCache * netcache, QObject * parent=0); + + QRgb lastResults(); + float lastRed(); + float lastGreen(); + float lastBlue(); + bool isBusy(); + Q_PROPERTY(bool busy READ isBusy); + Q_PROPERTY(float red READ lastRed); + Q_PROPERTY(float green READ lastGreen); + Q_PROPERTY(float blue READ lastBlue); + ~ImageAnalyzer(); + public slots: + /*! initiates analysis of all the urls in the list */ + void startAnalysis(const QStringList & urls); + signals: + void finishedAnalysis(); + void updateProgress(int completed, int total); +//! [ ImageAnalyzer - public interface ] + private slots: + void handleReply(QNetworkReply*); + void doneProcessing(); + void progressStatus(int); +private: + QRgb processImages(); + void fetchURLs(); + void queueImage(QImage img); + +//! [ ImageAnalyzer - private members ] +private: + QNetworkAccessManager* m_network; + QNetworkDiskCache* m_cache; + QStringList m_URLQueue; + QList m_imageQueue; + int m_outstandingFetches; + QFutureWatcher * m_watcher; +//! [ ImageAnalyzer - private members ] +}; + +QRgb averageRGB(const QImage &img); + +#endif diff --git a/examples/webkit/imageanalyzer/imageanalyzer.pro b/examples/webkit/imageanalyzer/imageanalyzer.pro new file mode 100644 index 0000000..c9a0ed1 --- /dev/null +++ b/examples/webkit/imageanalyzer/imageanalyzer.pro @@ -0,0 +1,14 @@ +TEMPLATE = app +HEADERS = imageanalyzer.h \ + mainwindow.h +SOURCES = imageanalyzer.cpp \ + main.cpp \ + mainwindow.cpp + +QT += network webkit + +RESOURCES = resources/imageanalyzer.qrc + +OTHER_FILES += html/index.html README ../webkit-bridge-tutorial.qdoc outline.txt + + diff --git a/examples/webkit/imageanalyzer/main.cpp b/examples/webkit/imageanalyzer/main.cpp new file mode 100644 index 0000000..c3f04de --- /dev/null +++ b/examples/webkit/imageanalyzer/main.cpp @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include "imageanalyzer.h" +#include "mainwindow.h" + +int main(int argc, char* argv[]) +{ + QApplication app(argc, argv); + + MainWin win; + win.show(); + return app.exec(); +} + diff --git a/examples/webkit/imageanalyzer/mainwindow.cpp b/examples/webkit/imageanalyzer/mainwindow.cpp new file mode 100644 index 0000000..d89098e --- /dev/null +++ b/examples/webkit/imageanalyzer/mainwindow.cpp @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "mainwindow.h" +#include "imageanalyzer.h" + +#include +#include +#include + +/* + * Default Constructor + */ +//! [MainWindow - constructor] +MainWin::MainWin(QWidget * parent) : QWebView(parent) +{ + m_network = new QNetworkAccessManager(this); + m_cache = new QNetworkDiskCache(this); + m_cache->setCacheDirectory(QDesktopServices::storageLocation(QDesktopServices::CacheLocation) + "/imageanalyzer"); + m_cache->setMaximumCacheSize(1000000); //set the cache to 10megs + m_network->setCache(m_cache); + page()->setNetworkAccessManager(m_network); + + //! The object we will expose to JavaScript engine: + m_analyzer = new ImageAnalyzer(m_cache, this); + + // Signal is emitted before frame loads any web content: + QObject::connect(page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), + this, SLOT(addJSObject())); + + // qrc:// URLs refer to resources. See imagenalayzer.qrc + QUrl startURL = QUrl("qrc:/index.html"); + + // Load web content now! + setUrl(startURL); +} +//! [MainWindow - constructor] + +//! [MainWindow - addJSObject] +void MainWin::addJSObject() { + // Add pAnalyzer to JavaScript Frame as member "imageAnalyzer". + page()->mainFrame()->addToJavaScriptWindowObject(QString("imageAnalyzer"), m_analyzer); +} +//! [MainWindow - addJSObject] diff --git a/examples/webkit/imageanalyzer/mainwindow.h b/examples/webkit/imageanalyzer/mainwindow.h new file mode 100644 index 0000000..4c6b950 --- /dev/null +++ b/examples/webkit/imageanalyzer/mainwindow.h @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H +#include + + +class ImageAnalyzer; +class QNetworkDiskCache; + +class MainWin : public QWebView +{ + Q_OBJECT + + public: + explicit MainWin(QWidget * parent = 0); + private: + ImageAnalyzer * m_analyzer; + QNetworkAccessManager * m_network; + QNetworkDiskCache * m_cache; + private slots: + void addJSObject(); +}; +#endif diff --git a/examples/webkit/imageanalyzer/resources/images/README b/examples/webkit/imageanalyzer/resources/images/README new file mode 100644 index 0000000..176a1da --- /dev/null +++ b/examples/webkit/imageanalyzer/resources/images/README @@ -0,0 +1,2 @@ +The images are under public domain and were obtained from +http://publicdomainpictures.net diff --git a/examples/webkit/imageanalyzer/resources/images/bellaCoola.jpg b/examples/webkit/imageanalyzer/resources/images/bellaCoola.jpg new file mode 100644 index 0000000..f90ed54 Binary files /dev/null and b/examples/webkit/imageanalyzer/resources/images/bellaCoola.jpg differ diff --git a/examples/webkit/imageanalyzer/resources/images/flower.jpg b/examples/webkit/imageanalyzer/resources/images/flower.jpg new file mode 100644 index 0000000..6b7f6be Binary files /dev/null and b/examples/webkit/imageanalyzer/resources/images/flower.jpg differ diff --git a/examples/webkit/imageanalyzer/resources/images/mtRainier.jpg b/examples/webkit/imageanalyzer/resources/images/mtRainier.jpg new file mode 100644 index 0000000..d09a3f2 Binary files /dev/null and b/examples/webkit/imageanalyzer/resources/images/mtRainier.jpg differ diff --git a/examples/webkit/imageanalyzer/resources/images/seaShell.jpg b/examples/webkit/imageanalyzer/resources/images/seaShell.jpg new file mode 100644 index 0000000..c5005a9 Binary files /dev/null and b/examples/webkit/imageanalyzer/resources/images/seaShell.jpg differ diff --git a/examples/webkit/imageanalyzer/resources/images/trees.jpg b/examples/webkit/imageanalyzer/resources/images/trees.jpg new file mode 100644 index 0000000..083b26d Binary files /dev/null and b/examples/webkit/imageanalyzer/resources/images/trees.jpg differ diff --git a/examples/webkit/webkit.pro b/examples/webkit/webkit.pro index 76c8801..6a1d8f8 100644 --- a/examples/webkit/webkit.pro +++ b/examples/webkit/webkit.pro @@ -4,6 +4,7 @@ SUBDIRS += domtraversal \ previewer \ fancybrowser \ simpleselector \ + imageanalyzer \ framecapture contains(QT_CONFIG, openssl):SUBDIRS += googlechat -- cgit v0.12 From fb439760468f55d7884f5b14172fff9cc0a2107f Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 30 Sep 2010 11:38:14 +0200 Subject: Fixed a layout issue where you could get NaN as dimensions The problem is that with empty layouts we could sometimes divide by 0. Note: This doesn't fix the whole task... Task-number: QTBUG-13547 Reviewed-by: ogoffart (cherry picked from commit c1f9978c9d61bcbdb2f280185a3abdea13d7f532) --- src/gui/graphicsview/qgridlayoutengine.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp index 4fba5ff..ae5bf90 100644 --- a/src/gui/graphicsview/qgridlayoutengine.cpp +++ b/src/gui/graphicsview/qgridlayoutengine.cpp @@ -306,20 +306,19 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz ultimatePreferredSize = ultimatePreferredSize * 3 / 2; ultimateSumPreferredSizes = ultimateSumPreferredSizes * 3 / 2; - qreal ultimateFactor = (stretch * ultimateSumPreferredSizes - / sumStretches) - - (box.q_preferredSize); - qreal transitionalFactor = sumCurrentAvailable - * (ultimatePreferredSize - box.q_preferredSize) - / (ultimateSumPreferredSizes - - sumPreferredSizes); - - qreal alpha = qMin(sumCurrentAvailable, - ultimateSumPreferredSizes - sumPreferredSizes); qreal beta = ultimateSumPreferredSizes - sumPreferredSizes; + if (!beta) { + factors[i] = 1; + } else { + qreal alpha = qMin(sumCurrentAvailable, beta); + qreal ultimateFactor = (stretch * ultimateSumPreferredSizes / sumStretches) + - (box.q_preferredSize); + qreal transitionalFactor = sumCurrentAvailable * (ultimatePreferredSize - box.q_preferredSize) / beta; + + factors[i] = ((alpha * ultimateFactor) + + ((beta - alpha) * transitionalFactor)) / beta; + } - factors[i] = ((alpha * ultimateFactor) - + ((beta - alpha) * transitionalFactor)) / beta; } sumFactors += factors[i]; if (desired < sumCurrentAvailable) -- cgit v0.12 From 8eccccd6306bc5ec8cbe30243e7e96f5367f0acb Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 5 Oct 2010 20:11:47 +1000 Subject: Update .def files for recent cherry-picks. --- src/s60installs/bwins/QtDeclarativeu.def | 131 ++++++++++++++++++++++++++-- src/s60installs/bwins/QtGuiu.def | 2 + src/s60installs/eabi/QtDeclarativeu.def | 144 +++++++++++++++++++++++++++++-- 3 files changed, 267 insertions(+), 10 deletions(-) diff --git a/src/s60installs/bwins/QtDeclarativeu.def b/src/s60installs/bwins/QtDeclarativeu.def index bd2026d..581c3b8 100644 --- a/src/s60installs/bwins/QtDeclarativeu.def +++ b/src/s60installs/bwins/QtDeclarativeu.def @@ -142,7 +142,7 @@ EXPORTS ?setEnumOrFlag@QMetaPropertyBuilder@@QAEX_N@Z @ 141 NONAME ; void QMetaPropertyBuilder::setEnumOrFlag(bool) ?getStaticMetaObject@QDeclarativeRectangle@@SAABUQMetaObject@@XZ @ 142 NONAME ; struct QMetaObject const & QDeclarativeRectangle::getStaticMetaObject(void) ?isValid@QDeclarativeProperty@@QBE_NXZ @ 143 NONAME ; bool QDeclarativeProperty::isValid(void) const - ?isConnected@QDeclarativeDebugClient@@QBE_NXZ @ 144 NONAME ; bool QDeclarativeDebugClient::isConnected(void) const + ?isConnected@QDeclarativeDebugClient@@QBE_NXZ @ 144 NONAME ABSENT ; bool QDeclarativeDebugClient::isConnected(void) const ?enabled@QDeclarativeBinding@@QBE_NXZ @ 145 NONAME ; bool QDeclarativeBinding::enabled(void) const ?setSource@QDeclarativeView@@QAEXABVQUrl@@@Z @ 146 NONAME ; void QDeclarativeView::setSource(class QUrl const &) ??_EQDeclarativeDebugService@@UAE@I@Z @ 147 NONAME ; QDeclarativeDebugService::~QDeclarativeDebugService(unsigned int) @@ -461,7 +461,7 @@ EXPORTS ?qt_metacall@QDeclarativeContext@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 460 NONAME ; int QDeclarativeContext::qt_metacall(enum QMetaObject::Call, int, void * *) ??_EQDeclarativeValueType@@UAE@I@Z @ 461 NONAME ; QDeclarativeValueType::~QDeclarativeValueType(unsigned int) ?qt_metacall@QDeclarativeState@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 462 NONAME ; int QDeclarativeState::qt_metacall(enum QMetaObject::Call, int, void * *) - ?isEnabled@QDeclarativeDebugService@@QBE_NXZ @ 463 NONAME ; bool QDeclarativeDebugService::isEnabled(void) const + ?isEnabled@QDeclarativeDebugService@@QBE_NXZ @ 463 NONAME ABSENT ; bool QDeclarativeDebugService::isEnabled(void) const ?stateChanged@QDeclarativeDebugWatch@@IAEXW4State@1@@Z @ 464 NONAME ; void QDeclarativeDebugWatch::stateChanged(enum QDeclarativeDebugWatch::State) ??0QMetaMethodBuilder@@AAE@PBVQMetaObjectBuilder@@H@Z @ 465 NONAME ; QMetaMethodBuilder::QMetaMethodBuilder(class QMetaObjectBuilder const *, int) ??4QDeclarativeListReference@@QAEAAV0@ABV0@@Z @ 466 NONAME ; class QDeclarativeListReference & QDeclarativeListReference::operator=(class QDeclarativeListReference const &) @@ -1028,7 +1028,7 @@ EXPORTS ?qmlInfo@@YA?AVQDeclarativeInfo@@PBVQObject@@ABVQDeclarativeError@@@Z @ 1027 NONAME ; class QDeclarativeInfo qmlInfo(class QObject const *, class QDeclarativeError const &) ?staticMetaObject@QDeclarativeText@@2UQMetaObject@@B @ 1028 NONAME ; struct QMetaObject const QDeclarativeText::staticMetaObject ?color@QDeclarativeRectangle@@QBE?AVQColor@@XZ @ 1029 NONAME ; class QColor QDeclarativeRectangle::color(void) const - ?isEnabled@QDeclarativeDebugClient@@QBE_NXZ @ 1030 NONAME ; bool QDeclarativeDebugClient::isEnabled(void) const + ?isEnabled@QDeclarativeDebugClient@@QBE_NXZ @ 1030 NONAME ABSENT ; bool QDeclarativeDebugClient::isEnabled(void) const ?send@QPacketProtocol@@QAEXABVQPacket@@@Z @ 1031 NONAME ; void QPacketProtocol::send(class QPacket const &) ?width@QDeclarativePixmap@@QBEHXZ @ 1032 NONAME ; int QDeclarativePixmap::width(void) const ?error@QDeclarativeCustomParser@@IAEXABVQDeclarativeCustomParserNode@@ABVQString@@@Z @ 1033 NONAME ; void QDeclarativeCustomParser::error(class QDeclarativeCustomParserNode const &, class QString const &) @@ -1147,7 +1147,7 @@ EXPORTS ?removeNotifySignal@QMetaPropertyBuilder@@QAEXXZ @ 1146 NONAME ; void QMetaPropertyBuilder::removeNotifySignal(void) ?trUtf8@QDeclarativeDebugService@@SA?AVQString@@PBD0@Z @ 1147 NONAME ; class QString QDeclarativeDebugService::trUtf8(char const *, char const *) ?setImportPathList@QDeclarativeEngine@@QAEXABVQStringList@@@Z @ 1148 NONAME ; void QDeclarativeEngine::setImportPathList(class QStringList const &) - ?enabledChanged@QDeclarativeDebugService@@MAEX_N@Z @ 1149 NONAME ; void QDeclarativeDebugService::enabledChanged(bool) + ?enabledChanged@QDeclarativeDebugService@@MAEX_N@Z @ 1149 NONAME ABSENT ; void QDeclarativeDebugService::enabledChanged(bool) ?addWatch@QDeclarativeEngineDebug@@QAEPAVQDeclarativeDebugWatch@@ABVQDeclarativeDebugObjectReference@@PAVQObject@@@Z @ 1150 NONAME ; class QDeclarativeDebugWatch * QDeclarativeEngineDebug::addWatch(class QDeclarativeDebugObjectReference const &, class QObject *) ?asAST@Variant@QDeclarativeParser@@QBEPAVNode@AST@QDeclarativeJS@@XZ @ 1151 NONAME ; class QDeclarativeJS::AST::Node * QDeclarativeParser::Variant::asAST(void) const ?indexOfClassInfo@QMetaObjectBuilder@@QAEHABVQByteArray@@@Z @ 1152 NONAME ; int QMetaObjectBuilder::indexOfClassInfo(class QByteArray const &) @@ -1386,7 +1386,7 @@ EXPORTS ?qmlTypes@QDeclarativeMetaType@@SA?AV?$QList@PAVQDeclarativeType@@@@XZ @ 1385 NONAME ; class QList QDeclarativeMetaType::qmlTypes(void) ?valueTypeCoreIndex@QDeclarativePropertyPrivate@@SAHABVQDeclarativeProperty@@@Z @ 1386 NONAME ; int QDeclarativePropertyPrivate::valueTypeCoreIndex(class QDeclarativeProperty const &) ?writeEnumProperty@QDeclarativePropertyPrivate@@SA_NABVQMetaProperty@@HPAVQObject@@ABVQVariant@@H@Z @ 1387 NONAME ; bool QDeclarativePropertyPrivate::writeEnumProperty(class QMetaProperty const &, int, class QObject *, class QVariant const &, int) - ?setEnabled@QDeclarativeDebugClient@@QAEX_N@Z @ 1388 NONAME ; void QDeclarativeDebugClient::setEnabled(bool) + ?setEnabled@QDeclarativeDebugClient@@QAEX_N@Z @ 1388 NONAME ABSENT ; void QDeclarativeDebugClient::setEnabled(bool) ??1QMetaObjectBuilder@@UAE@XZ @ 1389 NONAME ; QMetaObjectBuilder::~QMetaObjectBuilder(void) ?tr@QDeclarativeStateOperation@@SA?AVQString@@PBD0@Z @ 1390 NONAME ; class QString QDeclarativeStateOperation::tr(char const *, char const *) ?clear@QPacket@@QAEXXZ @ 1391 NONAME ; void QPacket::clear(void) @@ -1717,4 +1717,125 @@ EXPORTS ?canMove@QDeclarativeListModel@@ABE_NHHH@Z @ 1716 NONAME ; bool QDeclarativeListModel::canMove(int, int, int) const ?getScriptEngine@QDeclarativeDebugHelper@@SAPAVQScriptEngine@@PAVQDeclarativeEngine@@@Z @ 1717 NONAME ; class QScriptEngine * QDeclarativeDebugHelper::getScriptEngine(class QDeclarativeEngine *) ?setAnimationSlowDownFactor@QDeclarativeDebugHelper@@SAXM@Z @ 1718 NONAME ; void QDeclarativeDebugHelper::setAnimationSlowDownFactor(float) + ?add@QDeclarativeBasePositioner@@QBEPAVQDeclarativeTransition@@XZ @ 1719 NONAME ; class QDeclarativeTransition * QDeclarativeBasePositioner::add(void) const + ?setLoops@QDeclarativeAbstractAnimation@@QAEXH@Z @ 1720 NONAME ; void QDeclarativeAbstractAnimation::setLoops(int) + ?trUtf8@QDeclarativeAbstractAnimation@@SA?AVQString@@PBD0@Z @ 1721 NONAME ; class QString QDeclarativeAbstractAnimation::trUtf8(char const *, char const *) + ?tr@QDeclarativeBasePositioner@@SA?AVQString@@PBD0@Z @ 1722 NONAME ; class QString QDeclarativeBasePositioner::tr(char const *, char const *) + ?staticMetaObject@QDeclarativeAbstractAnimation@@2UQMetaObject@@B @ 1723 NONAME ; struct QMetaObject const QDeclarativeAbstractAnimation::staticMetaObject + ?setMove@QDeclarativeBasePositioner@@QAEXPAVQDeclarativeTransition@@@Z @ 1724 NONAME ; void QDeclarativeBasePositioner::setMove(class QDeclarativeTransition *) + ?setRunning@QDeclarativeTimer@@QAEX_N@Z @ 1725 NONAME ; void QDeclarativeTimer::setRunning(bool) + ?tr@QDeclarativeTimer@@SA?AVQString@@PBD0@Z @ 1726 NONAME ; class QString QDeclarativeTimer::tr(char const *, char const *) + ?qt_metacall@QDeclarativeTimer@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1727 NONAME ; int QDeclarativeTimer::qt_metacall(enum QMetaObject::Call, int, void * *) + ?setPaused@QDeclarativeAbstractAnimation@@QAEX_N@Z @ 1728 NONAME ; void QDeclarativeAbstractAnimation::setPaused(bool) + ?d_func@QDeclarativeBasePositioner@@ABEPBVQDeclarativeBasePositionerPrivate@@XZ @ 1729 NONAME ; class QDeclarativeBasePositionerPrivate const * QDeclarativeBasePositioner::d_func(void) const + ?setRepeating@QDeclarativeTimer@@QAEX_N@Z @ 1730 NONAME ; void QDeclarativeTimer::setRepeating(bool) + ?interval@QDeclarativeTimer@@QBEHXZ @ 1731 NONAME ; int QDeclarativeTimer::interval(void) const + ?start@QDeclarativeTimer@@QAEXXZ @ 1732 NONAME ; void QDeclarativeTimer::start(void) + ?transition@QDeclarativeAbstractAnimation@@UAEXAAV?$QList@VQDeclarativeAction@@@@AAV?$QList@VQDeclarativeProperty@@@@W4TransitionDirection@1@@Z @ 1733 NONAME ; void QDeclarativeAbstractAnimation::transition(class QList &, class QList &, enum QDeclarativeAbstractAnimation::TransitionDirection) + ?componentComplete@QDeclarativeAbstractAnimation@@UAEXXZ @ 1734 NONAME ; void QDeclarativeAbstractAnimation::componentComplete(void) + ?statusChanged@QDeclarativeDebugService@@MAEXW4Status@1@@Z @ 1735 NONAME ; void QDeclarativeDebugService::statusChanged(enum QDeclarativeDebugService::Status) + ?runningChanged@QDeclarativeAbstractAnimation@@IAEX_N@Z @ 1736 NONAME ; void QDeclarativeAbstractAnimation::runningChanged(bool) + ?trUtf8@QDeclarativeAbstractAnimation@@SA?AVQString@@PBD0H@Z @ 1737 NONAME ; class QString QDeclarativeAbstractAnimation::trUtf8(char const *, char const *, int) + ??_EQDeclarativeBasePositioner@@UAE@I@Z @ 1738 NONAME ; QDeclarativeBasePositioner::~QDeclarativeBasePositioner(unsigned int) + ?metaObject@QDeclarativeTimer@@UBEPBUQMetaObject@@XZ @ 1739 NONAME ; struct QMetaObject const * QDeclarativeTimer::metaObject(void) const + ?setGroup@QDeclarativeAbstractAnimation@@QAEXPAVQDeclarativeAnimationGroup@@@Z @ 1740 NONAME ; void QDeclarativeAbstractAnimation::setGroup(class QDeclarativeAnimationGroup *) + ?isRepeating@QDeclarativeTimer@@QBE_NXZ @ 1741 NONAME ; bool QDeclarativeTimer::isRepeating(void) const + ?setTriggeredOnStart@QDeclarativeTimer@@QAEX_N@Z @ 1742 NONAME ; void QDeclarativeTimer::setTriggeredOnStart(bool) + ?currentTime@QDeclarativeAbstractAnimation@@QAEHXZ @ 1743 NONAME ; int QDeclarativeAbstractAnimation::currentTime(void) + ?status@QDeclarativeEngineDebug@@QBE?AW4Status@1@XZ @ 1744 NONAME ; enum QDeclarativeEngineDebug::Status QDeclarativeEngineDebug::status(void) const + ??1QDeclarativeAbstractAnimation@@UAE@XZ @ 1745 NONAME ; QDeclarativeAbstractAnimation::~QDeclarativeAbstractAnimation(void) + ?triggered@QDeclarativeTimer@@IAEXXZ @ 1746 NONAME ; void QDeclarativeTimer::triggered(void) + ?getStaticMetaObject@QDeclarativeBasePositioner@@SAABUQMetaObject@@XZ @ 1747 NONAME ; struct QMetaObject const & QDeclarativeBasePositioner::getStaticMetaObject(void) + ?finished@QDeclarativeTimer@@AAEXXZ @ 1748 NONAME ; void QDeclarativeTimer::finished(void) + ?pausedChanged@QDeclarativeAbstractAnimation@@IAEX_N@Z @ 1749 NONAME ; void QDeclarativeAbstractAnimation::pausedChanged(bool) + ?complete@QDeclarativeAbstractAnimation@@QAEXXZ @ 1750 NONAME ; void QDeclarativeAbstractAnimation::complete(void) + ?setRunning@QDeclarativeAbstractAnimation@@QAEX_N@Z @ 1751 NONAME ; void QDeclarativeAbstractAnimation::setRunning(bool) + ?trUtf8@QDeclarativeBasePositioner@@SA?AVQString@@PBD0H@Z @ 1752 NONAME ; class QString QDeclarativeBasePositioner::trUtf8(char const *, char const *, int) + ?trUtf8@QDeclarativeBasePositioner@@SA?AVQString@@PBD0@Z @ 1753 NONAME ; class QString QDeclarativeBasePositioner::trUtf8(char const *, char const *) + ?completed@QDeclarativeAbstractAnimation@@IAEXXZ @ 1754 NONAME ; void QDeclarativeAbstractAnimation::completed(void) + ?trUtf8@QDeclarativeTimer@@SA?AVQString@@PBD0@Z @ 1755 NONAME ; class QString QDeclarativeTimer::trUtf8(char const *, char const *) + ?loopCountChanged@QDeclarativeAbstractAnimation@@IAEXH@Z @ 1756 NONAME ; void QDeclarativeAbstractAnimation::loopCountChanged(int) + ?repeatChanged@QDeclarativeTimer@@IAEXXZ @ 1757 NONAME ; void QDeclarativeTimer::repeatChanged(void) + ?setDisableUserControl@QDeclarativeAbstractAnimation@@QAEXXZ @ 1758 NONAME ; void QDeclarativeAbstractAnimation::setDisableUserControl(void) + ?componentComplete@QDeclarativeBasePositioner@@MAEXXZ @ 1759 NONAME ; void QDeclarativeBasePositioner::componentComplete(void) + ?setDefaultTarget@QDeclarativeAbstractAnimation@@QAEXABVQDeclarativeProperty@@@Z @ 1760 NONAME ; void QDeclarativeAbstractAnimation::setDefaultTarget(class QDeclarativeProperty const &) + ?staticMetaObject@QDeclarativeBasePositioner@@2UQMetaObject@@B @ 1761 NONAME ; struct QMetaObject const QDeclarativeBasePositioner::staticMetaObject + ?triggeredOnStart@QDeclarativeTimer@@QBE_NXZ @ 1762 NONAME ; bool QDeclarativeTimer::triggeredOnStart(void) const + ?notifyRunningChanged@QDeclarativeAbstractAnimation@@AAEX_N@Z @ 1763 NONAME ; void QDeclarativeAbstractAnimation::notifyRunningChanged(bool) + ?statusChanged@QDeclarativeDebugClient@@MAEXW4Status@1@@Z @ 1764 NONAME ; void QDeclarativeDebugClient::statusChanged(enum QDeclarativeDebugClient::Status) + ??0QDeclarativeBasePositioner@@IAE@AAVQDeclarativeBasePositionerPrivate@@W4PositionerType@0@PAVQDeclarativeItem@@@Z @ 1765 NONAME ; QDeclarativeBasePositioner::QDeclarativeBasePositioner(class QDeclarativeBasePositionerPrivate &, enum QDeclarativeBasePositioner::PositionerType, class QDeclarativeItem *) + ?componentComplete@QDeclarativeTimer@@MAEXXZ @ 1766 NONAME ; void QDeclarativeTimer::componentComplete(void) + ?tr@QDeclarativeAbstractAnimation@@SA?AVQString@@PBD0@Z @ 1767 NONAME ; class QString QDeclarativeAbstractAnimation::tr(char const *, char const *) + ?isRunning@QDeclarativeAbstractAnimation@@QBE_NXZ @ 1768 NONAME ; bool QDeclarativeAbstractAnimation::isRunning(void) const + ?d_func@QDeclarativeAbstractAnimation@@ABEPBVQDeclarativeAbstractAnimationPrivate@@XZ @ 1769 NONAME ; class QDeclarativeAbstractAnimationPrivate const * QDeclarativeAbstractAnimation::d_func(void) const + ??_EQDeclarativeAbstractAnimation@@UAE@I@Z @ 1770 NONAME ; QDeclarativeAbstractAnimation::~QDeclarativeAbstractAnimation(unsigned int) + ??0QDeclarativeBasePositioner@@QAE@W4PositionerType@0@PAVQDeclarativeItem@@@Z @ 1771 NONAME ; QDeclarativeBasePositioner::QDeclarativeBasePositioner(enum QDeclarativeBasePositioner::PositionerType, class QDeclarativeItem *) + ?qt_metacall@QDeclarativeBasePositioner@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1772 NONAME ; int QDeclarativeBasePositioner::qt_metacall(enum QMetaObject::Call, int, void * *) + ?status@QDeclarativeDebugClient@@QBE?AW4Status@1@XZ @ 1773 NONAME ; enum QDeclarativeDebugClient::Status QDeclarativeDebugClient::status(void) const + ?prePositioning@QDeclarativeBasePositioner@@IAEXXZ @ 1774 NONAME ; void QDeclarativeBasePositioner::prePositioning(void) + ?finishApplyTransitions@QDeclarativeBasePositioner@@IAEXXZ @ 1775 NONAME ; void QDeclarativeBasePositioner::finishApplyTransitions(void) + ?d_func@QDeclarativeAbstractAnimation@@AAEPAVQDeclarativeAbstractAnimationPrivate@@XZ @ 1776 NONAME ; class QDeclarativeAbstractAnimationPrivate * QDeclarativeAbstractAnimation::d_func(void) + ?componentFinalized@QDeclarativeAbstractAnimation@@AAEXXZ @ 1777 NONAME ; void QDeclarativeAbstractAnimation::componentFinalized(void) + ??_EQDeclarativeTimer@@UAE@I@Z @ 1778 NONAME ; QDeclarativeTimer::~QDeclarativeTimer(unsigned int) + ?pause@QDeclarativeAbstractAnimation@@QAEXXZ @ 1779 NONAME ; void QDeclarativeAbstractAnimation::pause(void) + ?stop@QDeclarativeTimer@@QAEXXZ @ 1780 NONAME ; void QDeclarativeTimer::stop(void) + ?timelineComplete@QDeclarativeAbstractAnimation@@AAEXXZ @ 1781 NONAME ; void QDeclarativeAbstractAnimation::timelineComplete(void) + ?d_func@QDeclarativeBasePositioner@@AAEPAVQDeclarativeBasePositionerPrivate@@XZ @ 1782 NONAME ; class QDeclarativeBasePositionerPrivate * QDeclarativeBasePositioner::d_func(void) + ?setAlwaysRunToEnd@QDeclarativeAbstractAnimation@@QAEX_N@Z @ 1783 NONAME ; void QDeclarativeAbstractAnimation::setAlwaysRunToEnd(bool) + ?classBegin@QDeclarativeAbstractAnimation@@UAEXXZ @ 1784 NONAME ; void QDeclarativeAbstractAnimation::classBegin(void) + ?d_func@QDeclarativeTimer@@AAEPAVQDeclarativeTimerPrivate@@XZ @ 1785 NONAME ; class QDeclarativeTimerPrivate * QDeclarativeTimer::d_func(void) + ?spacing@QDeclarativeBasePositioner@@QBEHXZ @ 1786 NONAME ; int QDeclarativeBasePositioner::spacing(void) const + ??0QDeclarativeAbstractAnimation@@QAE@PAVQObject@@@Z @ 1787 NONAME ; QDeclarativeAbstractAnimation::QDeclarativeAbstractAnimation(class QObject *) + ?metaObject@QDeclarativeAbstractAnimation@@UBEPBUQMetaObject@@XZ @ 1788 NONAME ; struct QMetaObject const * QDeclarativeAbstractAnimation::metaObject(void) const + ?tr@QDeclarativeAbstractAnimation@@SA?AVQString@@PBD0H@Z @ 1789 NONAME ; class QString QDeclarativeAbstractAnimation::tr(char const *, char const *, int) + ?started@QDeclarativeAbstractAnimation@@IAEXXZ @ 1790 NONAME ; void QDeclarativeAbstractAnimation::started(void) + ?setInterval@QDeclarativeTimer@@QAEXH@Z @ 1791 NONAME ; void QDeclarativeTimer::setInterval(int) + ?statusChanged@QDeclarativeEngineDebug@@IAEXW4Status@1@@Z @ 1792 NONAME ; void QDeclarativeEngineDebug::statusChanged(enum QDeclarativeEngineDebug::Status) + ?d_func@QDeclarativeTimer@@ABEPBVQDeclarativeTimerPrivate@@XZ @ 1793 NONAME ; class QDeclarativeTimerPrivate const * QDeclarativeTimer::d_func(void) const + ?setSpacing@QDeclarativeBasePositioner@@QAEXH@Z @ 1794 NONAME ; void QDeclarativeBasePositioner::setSpacing(int) + ?staticMetaObject@QDeclarativeTimer@@2UQMetaObject@@B @ 1795 NONAME ; struct QMetaObject const QDeclarativeTimer::staticMetaObject + ?positionY@QDeclarativeBasePositioner@@IAEXHABVPositionedItem@1@@Z @ 1796 NONAME ; void QDeclarativeBasePositioner::positionY(int, class QDeclarativeBasePositioner::PositionedItem const &) + ?qt_metacast@QDeclarativeAbstractAnimation@@UAEPAXPBD@Z @ 1797 NONAME ; void * QDeclarativeAbstractAnimation::qt_metacast(char const *) + ?setAdd@QDeclarativeBasePositioner@@QAEXPAVQDeclarativeTransition@@@Z @ 1798 NONAME ; void QDeclarativeBasePositioner::setAdd(class QDeclarativeTransition *) + ?setCurrentTime@QDeclarativeAbstractAnimation@@QAEXH@Z @ 1799 NONAME ; void QDeclarativeAbstractAnimation::setCurrentTime(int) + ?attachedPropertiesId@QDeclarativeType@@QBEHXZ @ 1800 NONAME ; int QDeclarativeType::attachedPropertiesId(void) const + ?positionX@QDeclarativeBasePositioner@@IAEXHABVPositionedItem@1@@Z @ 1801 NONAME ; void QDeclarativeBasePositioner::positionX(int, class QDeclarativeBasePositioner::PositionedItem const &) + ?restart@QDeclarativeAbstractAnimation@@QAEXXZ @ 1802 NONAME ; void QDeclarativeAbstractAnimation::restart(void) + ?itemChange@QDeclarativeBasePositioner@@MAE?AVQVariant@@W4GraphicsItemChange@QGraphicsItem@@ABV2@@Z @ 1803 NONAME ; class QVariant QDeclarativeBasePositioner::itemChange(enum QGraphicsItem::GraphicsItemChange, class QVariant const &) + ??0QDeclarativeAbstractAnimation@@IAE@AAVQDeclarativeAbstractAnimationPrivate@@PAVQObject@@@Z @ 1804 NONAME ; QDeclarativeAbstractAnimation::QDeclarativeAbstractAnimation(class QDeclarativeAbstractAnimationPrivate &, class QObject *) + ?resume@QDeclarativeAbstractAnimation@@QAEXXZ @ 1805 NONAME ; void QDeclarativeAbstractAnimation::resume(void) + ?runningChanged@QDeclarativeTimer@@IAEXXZ @ 1806 NONAME ; void QDeclarativeTimer::runningChanged(void) + ?ticked@QDeclarativeTimer@@AAEXXZ @ 1807 NONAME ; void QDeclarativeTimer::ticked(void) + ?graphicsWidgetGeometryChanged@QDeclarativeBasePositioner@@IAEXXZ @ 1808 NONAME ; void QDeclarativeBasePositioner::graphicsWidgetGeometryChanged(void) + ?trUtf8@QDeclarativeTimer@@SA?AVQString@@PBD0H@Z @ 1809 NONAME ; class QString QDeclarativeTimer::trUtf8(char const *, char const *, int) + ??0QDeclarativeTimer@@QAE@PAVQObject@@@Z @ 1810 NONAME ; QDeclarativeTimer::QDeclarativeTimer(class QObject *) + ?loops@QDeclarativeAbstractAnimation@@QBEHXZ @ 1811 NONAME ; int QDeclarativeAbstractAnimation::loops(void) const + ?setTarget@QDeclarativeAbstractAnimation@@EAEXABVQDeclarativeProperty@@@Z @ 1812 NONAME ; void QDeclarativeAbstractAnimation::setTarget(class QDeclarativeProperty const &) + ?alwaysRunToEnd@QDeclarativeAbstractAnimation@@QBE_NXZ @ 1813 NONAME ; bool QDeclarativeAbstractAnimation::alwaysRunToEnd(void) const + ?tr@QDeclarativeTimer@@SA?AVQString@@PBD0H@Z @ 1814 NONAME ; class QString QDeclarativeTimer::tr(char const *, char const *, int) + ?status@QDeclarativeDebugService@@QBE?AW4Status@1@XZ @ 1815 NONAME ; enum QDeclarativeDebugService::Status QDeclarativeDebugService::status(void) const + ?intervalChanged@QDeclarativeTimer@@IAEXXZ @ 1816 NONAME ; void QDeclarativeTimer::intervalChanged(void) + ?isPaused@QDeclarativeAbstractAnimation@@QBE_NXZ @ 1817 NONAME ; bool QDeclarativeAbstractAnimation::isPaused(void) const + ?getStaticMetaObject@QDeclarativeAbstractAnimation@@SAABUQMetaObject@@XZ @ 1818 NONAME ; struct QMetaObject const & QDeclarativeAbstractAnimation::getStaticMetaObject(void) + ?group@QDeclarativeAbstractAnimation@@QBEPAVQDeclarativeAnimationGroup@@XZ @ 1819 NONAME ; class QDeclarativeAnimationGroup * QDeclarativeAbstractAnimation::group(void) const + ?classBegin@QDeclarativeTimer@@MAEXXZ @ 1820 NONAME ; void QDeclarativeTimer::classBegin(void) + ?restart@QDeclarativeTimer@@QAEXXZ @ 1821 NONAME ; void QDeclarativeTimer::restart(void) + ?move@QDeclarativeBasePositioner@@QBEPAVQDeclarativeTransition@@XZ @ 1822 NONAME ; class QDeclarativeTransition * QDeclarativeBasePositioner::move(void) const + ?spacingChanged@QDeclarativeBasePositioner@@IAEXXZ @ 1823 NONAME ; void QDeclarativeBasePositioner::spacingChanged(void) + ?qt_metacast@QDeclarativeBasePositioner@@UAEPAXPBD@Z @ 1824 NONAME ; void * QDeclarativeBasePositioner::qt_metacast(char const *) + ??1QDeclarativeTimer@@UAE@XZ @ 1825 NONAME ; QDeclarativeTimer::~QDeclarativeTimer(void) + ?getStaticMetaObject@QDeclarativeTimer@@SAABUQMetaObject@@XZ @ 1826 NONAME ; struct QMetaObject const & QDeclarativeTimer::getStaticMetaObject(void) + ?tr@QDeclarativeBasePositioner@@SA?AVQString@@PBD0H@Z @ 1827 NONAME ; class QString QDeclarativeBasePositioner::tr(char const *, char const *, int) + ??1QDeclarativeBasePositioner@@UAE@XZ @ 1828 NONAME ; QDeclarativeBasePositioner::~QDeclarativeBasePositioner(void) + ?moveChanged@QDeclarativeBasePositioner@@IAEXXZ @ 1829 NONAME ; void QDeclarativeBasePositioner::moveChanged(void) + ?qt_metacast@QDeclarativeTimer@@UAEPAXPBD@Z @ 1830 NONAME ; void * QDeclarativeTimer::qt_metacast(char const *) + ?metaObject@QDeclarativeBasePositioner@@UBEPBUQMetaObject@@XZ @ 1831 NONAME ; struct QMetaObject const * QDeclarativeBasePositioner::metaObject(void) const + ?alwaysRunToEndChanged@QDeclarativeAbstractAnimation@@IAEX_N@Z @ 1832 NONAME ; void QDeclarativeAbstractAnimation::alwaysRunToEndChanged(bool) + ?triggeredOnStartChanged@QDeclarativeTimer@@IAEXXZ @ 1833 NONAME ; void QDeclarativeTimer::triggeredOnStartChanged(void) + ?isRunning@QDeclarativeTimer@@QBE_NXZ @ 1834 NONAME ; bool QDeclarativeTimer::isRunning(void) const + ?update@QDeclarativeTimer@@AAEXXZ @ 1835 NONAME ; void QDeclarativeTimer::update(void) + ?stop@QDeclarativeAbstractAnimation@@QAEXXZ @ 1836 NONAME ; void QDeclarativeAbstractAnimation::stop(void) + ?addChanged@QDeclarativeBasePositioner@@IAEXXZ @ 1837 NONAME ; void QDeclarativeBasePositioner::addChanged(void) + ?start@QDeclarativeAbstractAnimation@@QAEXXZ @ 1838 NONAME ; void QDeclarativeAbstractAnimation::start(void) + ?qt_metacall@QDeclarativeAbstractAnimation@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1839 NONAME ; int QDeclarativeAbstractAnimation::qt_metacall(enum QMetaObject::Call, int, void * *) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 7805dae..aacc03a 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -12892,4 +12892,6 @@ EXPORTS ?setTimeout@QTapAndHoldGesture@@SAXH@Z @ 12891 NONAME ; void QTapAndHoldGesture::setTimeout(int) ?qmljsDebugArguments@QApplicationPrivate@@2VQString@@A @ 12892 NONAME ; class QString QApplicationPrivate::qmljsDebugArguments ?effectiveBoundingRect@QGraphicsItemPrivate@@QBE?AVQRectF@@PAVQGraphicsItem@@@Z @ 12893 NONAME ; class QRectF QGraphicsItemPrivate::effectiveBoundingRect(class QGraphicsItem *) const + ?maxTextureHeight@QTextureGlyphCache@@UBEHXZ @ 12894 NONAME ; int QTextureGlyphCache::maxTextureHeight(void) const + ?maxTextureWidth@QTextureGlyphCache@@UBEHXZ @ 12895 NONAME ; int QTextureGlyphCache::maxTextureWidth(void) const diff --git a/src/s60installs/eabi/QtDeclarativeu.def b/src/s60installs/eabi/QtDeclarativeu.def index 9762c55..b3bb7f5 100644 --- a/src/s60installs/eabi/QtDeclarativeu.def +++ b/src/s60installs/eabi/QtDeclarativeu.def @@ -673,7 +673,7 @@ EXPORTS _ZN22QDeclarativeTransitionD0Ev @ 672 NONAME _ZN22QDeclarativeTransitionD1Ev @ 673 NONAME _ZN22QDeclarativeTransitionD2Ev @ 674 NONAME - _ZN23QDeclarativeDebugClient10setEnabledEb @ 675 NONAME + _ZN23QDeclarativeDebugClient10setEnabledEb @ 675 NONAME ABSENT _ZN23QDeclarativeDebugClient11qt_metacallEN11QMetaObject4CallEiPPv @ 676 NONAME _ZN23QDeclarativeDebugClient11qt_metacastEPKc @ 677 NONAME _ZN23QDeclarativeDebugClient11sendMessageERK10QByteArray @ 678 NONAME @@ -766,7 +766,7 @@ EXPORTS _ZN24QDeclarativeDebugService11qt_metacallEN11QMetaObject4CallEiPPv @ 765 NONAME _ZN24QDeclarativeDebugService11qt_metacastEPKc @ 766 NONAME _ZN24QDeclarativeDebugService11sendMessageERK10QByteArray @ 767 NONAME - _ZN24QDeclarativeDebugService14enabledChangedEb @ 768 NONAME + _ZN24QDeclarativeDebugService14enabledChangedEb @ 768 NONAME ABSENT _ZN24QDeclarativeDebugService14objectToStringEP7QObject @ 769 NONAME _ZN24QDeclarativeDebugService15messageReceivedERK10QByteArray @ 770 NONAME _ZN24QDeclarativeDebugService16staticMetaObjectE @ 771 NONAME DATA 16 @@ -1390,9 +1390,9 @@ EXPORTS _ZNK22QDeclarativeTransition7toStateEv @ 1389 NONAME _ZNK22QDeclarativeTransition9fromStateEv @ 1390 NONAME _ZNK23QDeclarativeDebugClient10metaObjectEv @ 1391 NONAME - _ZNK23QDeclarativeDebugClient11isConnectedEv @ 1392 NONAME + _ZNK23QDeclarativeDebugClient11isConnectedEv @ 1392 NONAME ABSENT _ZNK23QDeclarativeDebugClient4nameEv @ 1393 NONAME - _ZNK23QDeclarativeDebugClient9isEnabledEv @ 1394 NONAME + _ZNK23QDeclarativeDebugClient9isEnabledEv @ 1394 NONAME ABSENT _ZNK23QDeclarativeDomDocument10rootObjectEv @ 1395 NONAME _ZNK23QDeclarativeDomDocument6errorsEv @ 1396 NONAME _ZNK23QDeclarativeDomDocument7importsEv @ 1397 NONAME @@ -1427,7 +1427,7 @@ EXPORTS _ZNK24QDeclarativeCustomParser12evaluateEnumERK10QByteArray @ 1426 NONAME _ZNK24QDeclarativeDebugService10metaObjectEv @ 1427 NONAME _ZNK24QDeclarativeDebugService4nameEv @ 1428 NONAME - _ZNK24QDeclarativeDebugService9isEnabledEv @ 1429 NONAME + _ZNK24QDeclarativeDebugService9isEnabledEv @ 1429 NONAME ABSENT _ZNK24QDeclarativeDomComponent13componentRootEv @ 1430 NONAME _ZNK24QDeclarativeScriptString11scopeObjectEv @ 1431 NONAME _ZNK24QDeclarativeScriptString6scriptEv @ 1432 NONAME @@ -1749,4 +1749,138 @@ EXPORTS _ZNK21QDeclarativeListModel14inWorkerThreadEv @ 1748 NONAME _ZN23QDeclarativeDebugHelper15getScriptEngineEP18QDeclarativeEngine @ 1749 NONAME _ZN23QDeclarativeDebugHelper26setAnimationSlowDownFactorEf @ 1750 NONAME + _ZN17QDeclarativeTimer10classBeginEv @ 1751 NONAME + _ZN17QDeclarativeTimer10setRunningEb @ 1752 NONAME + _ZN17QDeclarativeTimer11qt_metacallEN11QMetaObject4CallEiPPv @ 1753 NONAME + _ZN17QDeclarativeTimer11qt_metacastEPKc @ 1754 NONAME + _ZN17QDeclarativeTimer11setIntervalEi @ 1755 NONAME + _ZN17QDeclarativeTimer12setRepeatingEb @ 1756 NONAME + _ZN17QDeclarativeTimer13repeatChangedEv @ 1757 NONAME + _ZN17QDeclarativeTimer14runningChangedEv @ 1758 NONAME + _ZN17QDeclarativeTimer15intervalChangedEv @ 1759 NONAME + _ZN17QDeclarativeTimer16staticMetaObjectE @ 1760 NONAME DATA 16 + _ZN17QDeclarativeTimer17componentCompleteEv @ 1761 NONAME + _ZN17QDeclarativeTimer19getStaticMetaObjectEv @ 1762 NONAME + _ZN17QDeclarativeTimer19setTriggeredOnStartEb @ 1763 NONAME + _ZN17QDeclarativeTimer23triggeredOnStartChangedEv @ 1764 NONAME + _ZN17QDeclarativeTimer4stopEv @ 1765 NONAME + _ZN17QDeclarativeTimer5startEv @ 1766 NONAME + _ZN17QDeclarativeTimer6tickedEv @ 1767 NONAME + _ZN17QDeclarativeTimer6updateEv @ 1768 NONAME + _ZN17QDeclarativeTimer7restartEv @ 1769 NONAME + _ZN17QDeclarativeTimer8finishedEv @ 1770 NONAME + _ZN17QDeclarativeTimer9triggeredEv @ 1771 NONAME + _ZN17QDeclarativeTimerC1EP7QObject @ 1772 NONAME + _ZN17QDeclarativeTimerC2EP7QObject @ 1773 NONAME + _ZN23QDeclarativeDebugClient13statusChangedENS_6StatusE @ 1774 NONAME + _ZN23QDeclarativeDebugClientD0Ev @ 1775 NONAME + _ZN23QDeclarativeDebugClientD1Ev @ 1776 NONAME + _ZN23QDeclarativeDebugClientD2Ev @ 1777 NONAME + _ZN23QDeclarativeEngineDebug13statusChangedENS_6StatusE @ 1778 NONAME + _ZN24QDeclarativeDebugService13statusChangedENS_6StatusE @ 1779 NONAME + _ZN24QDeclarativeDebugServiceD0Ev @ 1780 NONAME + _ZN24QDeclarativeDebugServiceD1Ev @ 1781 NONAME + _ZN24QDeclarativeDebugServiceD2Ev @ 1782 NONAME + _ZN26QDeclarativeBasePositioner10addChangedEv @ 1783 NONAME + _ZN26QDeclarativeBasePositioner10itemChangeEN13QGraphicsItem18GraphicsItemChangeERK8QVariant @ 1784 NONAME + _ZN26QDeclarativeBasePositioner10setSpacingEi @ 1785 NONAME + _ZN26QDeclarativeBasePositioner11moveChangedEv @ 1786 NONAME + _ZN26QDeclarativeBasePositioner11qt_metacallEN11QMetaObject4CallEiPPv @ 1787 NONAME + _ZN26QDeclarativeBasePositioner11qt_metacastEPKc @ 1788 NONAME + _ZN26QDeclarativeBasePositioner14prePositioningEv @ 1789 NONAME + _ZN26QDeclarativeBasePositioner14spacingChangedEv @ 1790 NONAME + _ZN26QDeclarativeBasePositioner16staticMetaObjectE @ 1791 NONAME DATA 16 + _ZN26QDeclarativeBasePositioner17componentCompleteEv @ 1792 NONAME + _ZN26QDeclarativeBasePositioner19getStaticMetaObjectEv @ 1793 NONAME + _ZN26QDeclarativeBasePositioner22finishApplyTransitionsEv @ 1794 NONAME + _ZN26QDeclarativeBasePositioner29graphicsWidgetGeometryChangedEv @ 1795 NONAME + _ZN26QDeclarativeBasePositioner6setAddEP22QDeclarativeTransition @ 1796 NONAME + _ZN26QDeclarativeBasePositioner7setMoveEP22QDeclarativeTransition @ 1797 NONAME + _ZN26QDeclarativeBasePositioner9positionXEiRKNS_14PositionedItemE @ 1798 NONAME + _ZN26QDeclarativeBasePositioner9positionYEiRKNS_14PositionedItemE @ 1799 NONAME + _ZN26QDeclarativeBasePositionerC2ENS_14PositionerTypeEP16QDeclarativeItem @ 1800 NONAME + _ZN26QDeclarativeBasePositionerC2ER33QDeclarativeBasePositionerPrivateNS_14PositionerTypeEP16QDeclarativeItem @ 1801 NONAME + _ZN26QDeclarativeBasePositionerD0Ev @ 1802 NONAME + _ZN26QDeclarativeBasePositionerD1Ev @ 1803 NONAME + _ZN26QDeclarativeBasePositionerD2Ev @ 1804 NONAME + _ZN27QDeclarativeDebugConnectionD0Ev @ 1805 NONAME + _ZN27QDeclarativeDebugConnectionD1Ev @ 1806 NONAME + _ZN27QDeclarativeDebugConnectionD2Ev @ 1807 NONAME + _ZN29QDeclarativeAbstractAnimation10classBeginEv @ 1808 NONAME + _ZN29QDeclarativeAbstractAnimation10setRunningEb @ 1809 NONAME + _ZN29QDeclarativeAbstractAnimation10transitionER5QListI18QDeclarativeActionERS0_I20QDeclarativePropertyENS_19TransitionDirectionE @ 1810 NONAME + _ZN29QDeclarativeAbstractAnimation11currentTimeEv @ 1811 NONAME + _ZN29QDeclarativeAbstractAnimation11qt_metacallEN11QMetaObject4CallEiPPv @ 1812 NONAME + _ZN29QDeclarativeAbstractAnimation11qt_metacastEPKc @ 1813 NONAME + _ZN29QDeclarativeAbstractAnimation13pausedChangedEb @ 1814 NONAME + _ZN29QDeclarativeAbstractAnimation14runningChangedEb @ 1815 NONAME + _ZN29QDeclarativeAbstractAnimation14setCurrentTimeEi @ 1816 NONAME + _ZN29QDeclarativeAbstractAnimation16loopCountChangedEi @ 1817 NONAME + _ZN29QDeclarativeAbstractAnimation16setDefaultTargetERK20QDeclarativeProperty @ 1818 NONAME + _ZN29QDeclarativeAbstractAnimation16staticMetaObjectE @ 1819 NONAME DATA 16 + _ZN29QDeclarativeAbstractAnimation16timelineCompleteEv @ 1820 NONAME + _ZN29QDeclarativeAbstractAnimation17componentCompleteEv @ 1821 NONAME + _ZN29QDeclarativeAbstractAnimation17setAlwaysRunToEndEb @ 1822 NONAME + _ZN29QDeclarativeAbstractAnimation18componentFinalizedEv @ 1823 NONAME + _ZN29QDeclarativeAbstractAnimation19getStaticMetaObjectEv @ 1824 NONAME + _ZN29QDeclarativeAbstractAnimation20notifyRunningChangedEb @ 1825 NONAME + _ZN29QDeclarativeAbstractAnimation21alwaysRunToEndChangedEb @ 1826 NONAME + _ZN29QDeclarativeAbstractAnimation21setDisableUserControlEv @ 1827 NONAME + _ZN29QDeclarativeAbstractAnimation4stopEv @ 1828 NONAME + _ZN29QDeclarativeAbstractAnimation5pauseEv @ 1829 NONAME + _ZN29QDeclarativeAbstractAnimation5startEv @ 1830 NONAME + _ZN29QDeclarativeAbstractAnimation6resumeEv @ 1831 NONAME + _ZN29QDeclarativeAbstractAnimation7restartEv @ 1832 NONAME + _ZN29QDeclarativeAbstractAnimation7startedEv @ 1833 NONAME + _ZN29QDeclarativeAbstractAnimation8completeEv @ 1834 NONAME + _ZN29QDeclarativeAbstractAnimation8setGroupEP26QDeclarativeAnimationGroup @ 1835 NONAME + _ZN29QDeclarativeAbstractAnimation8setLoopsEi @ 1836 NONAME + _ZN29QDeclarativeAbstractAnimation9completedEv @ 1837 NONAME + _ZN29QDeclarativeAbstractAnimation9setPausedEb @ 1838 NONAME + _ZN29QDeclarativeAbstractAnimation9setTargetERK20QDeclarativeProperty @ 1839 NONAME + _ZN29QDeclarativeAbstractAnimationC2EP7QObject @ 1840 NONAME + _ZN29QDeclarativeAbstractAnimationC2ER36QDeclarativeAbstractAnimationPrivateP7QObject @ 1841 NONAME + _ZN29QDeclarativeAbstractAnimationD0Ev @ 1842 NONAME + _ZN29QDeclarativeAbstractAnimationD1Ev @ 1843 NONAME + _ZN29QDeclarativeAbstractAnimationD2Ev @ 1844 NONAME + _ZNK16QDeclarativeType20attachedPropertiesIdEv @ 1845 NONAME + _ZNK17QDeclarativeTimer10metaObjectEv @ 1846 NONAME + _ZNK17QDeclarativeTimer11isRepeatingEv @ 1847 NONAME + _ZNK17QDeclarativeTimer16triggeredOnStartEv @ 1848 NONAME + _ZNK17QDeclarativeTimer8intervalEv @ 1849 NONAME + _ZNK17QDeclarativeTimer9isRunningEv @ 1850 NONAME + _ZNK23QDeclarativeDebugClient6statusEv @ 1851 NONAME + _ZNK23QDeclarativeEngineDebug6statusEv @ 1852 NONAME + _ZNK24QDeclarativeDebugService6statusEv @ 1853 NONAME + _ZNK26QDeclarativeBasePositioner10metaObjectEv @ 1854 NONAME + _ZNK26QDeclarativeBasePositioner3addEv @ 1855 NONAME + _ZNK26QDeclarativeBasePositioner4moveEv @ 1856 NONAME + _ZNK26QDeclarativeBasePositioner7spacingEv @ 1857 NONAME + _ZNK29QDeclarativeAbstractAnimation10metaObjectEv @ 1858 NONAME + _ZNK29QDeclarativeAbstractAnimation14alwaysRunToEndEv @ 1859 NONAME + _ZNK29QDeclarativeAbstractAnimation5groupEv @ 1860 NONAME + _ZNK29QDeclarativeAbstractAnimation5loopsEv @ 1861 NONAME + _ZNK29QDeclarativeAbstractAnimation8isPausedEv @ 1862 NONAME + _ZNK29QDeclarativeAbstractAnimation9isRunningEv @ 1863 NONAME + _ZTI17QDeclarativeTimer @ 1864 NONAME + _ZTI26QDeclarativeBasePositioner @ 1865 NONAME + _ZTI29QDeclarativeAbstractAnimation @ 1866 NONAME + _ZTV17QDeclarativeTimer @ 1867 NONAME + _ZTV26QDeclarativeBasePositioner @ 1868 NONAME + _ZTV29QDeclarativeAbstractAnimation @ 1869 NONAME + _ZThn12_N29QDeclarativeAbstractAnimation10classBeginEv @ 1870 NONAME + _ZThn12_N29QDeclarativeAbstractAnimation17componentCompleteEv @ 1871 NONAME + _ZThn12_N29QDeclarativeAbstractAnimationD0Ev @ 1872 NONAME + _ZThn12_N29QDeclarativeAbstractAnimationD1Ev @ 1873 NONAME + _ZThn16_N26QDeclarativeBasePositioner17componentCompleteEv @ 1874 NONAME + _ZThn16_N26QDeclarativeBasePositionerD0Ev @ 1875 NONAME + _ZThn16_N26QDeclarativeBasePositionerD1Ev @ 1876 NONAME + _ZThn8_N17QDeclarativeTimer10classBeginEv @ 1877 NONAME + _ZThn8_N17QDeclarativeTimer17componentCompleteEv @ 1878 NONAME + _ZThn8_N26QDeclarativeBasePositioner10itemChangeEN13QGraphicsItem18GraphicsItemChangeERK8QVariant @ 1879 NONAME + _ZThn8_N26QDeclarativeBasePositionerD0Ev @ 1880 NONAME + _ZThn8_N26QDeclarativeBasePositionerD1Ev @ 1881 NONAME + _ZThn8_N29QDeclarativeAbstractAnimation9setTargetERK20QDeclarativeProperty @ 1882 NONAME + _ZThn8_N29QDeclarativeAbstractAnimationD0Ev @ 1883 NONAME + _ZThn8_N29QDeclarativeAbstractAnimationD1Ev @ 1884 NONAME -- cgit v0.12 From 512e44f4595a807b0eae968521a28659a70eb387 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Tue, 5 Oct 2010 16:43:33 +0300 Subject: QS60Style: QDateEdit - Layout issues In portrait orientation, QDateEdit's calendar popup (QCalendarWidget) does not fit into screen. As a fix, the pixel metric PM_FocusFrameHMargin, is reduced from 13 to 3 in qHD screens (640*360). Also, the explicit halving of the pixel metric for QTableViews is removed. The pixel metric resulted in 27 pixel text margins (2 * pm + 1)for calendar widgets, which is clearly a bit too much. Task-number: QTBUG-14126 Reviewed-by: Miikka Heikkinen (cherry picked from commit b3f895fd97deda0c7c5bfd704c04450e7afee748) --- src/gui/styles/qs60style.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 5996032..866e922 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -106,8 +106,8 @@ const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { // *** generated pixel metrics *** {5,0,-909,0,0,2,0,0,-1,7,12,22,15,15,7,198,-909,-909,-909,20,13,2,0,0,21,7,18,30,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,4,4,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1,106}, {5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,28,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,3,3,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1,106}, -{7,0,-909,0,0,2,0,0,-1,25,69,46,37,37,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,44,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,13,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, -{7,0,-909,0,0,2,0,0,-1,25,68,46,37,37,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,52,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,12,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, +{7,0,-909,0,0,2,0,0,-1,25,69,46,37,37,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,44,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,3,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, +{7,0,-909,0,0,2,0,0,-1,25,68,46,37,37,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,52,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,3,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, {7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,30,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1,106} // *** End of generated data *** }; @@ -2530,11 +2530,6 @@ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const //without having to define custom pixel metric metricValue *= 2; - if (widget && (metric == PM_FocusFrameHMargin)) - if (qobject_cast(widget)) - //Halve the focus frame margin for table items - metricValue /= 2; - return metricValue; } -- cgit v0.12 From d566c9cd0a5f403c30cdb65a024cec489bfc46aa Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Mon, 4 Oct 2010 15:42:51 +0300 Subject: Revert "When using complex transformations rendering goes easily off by one pixel." This reverts commit 2acdc634ee895af4a9738c0f6c2496e388afba38. Originally this fixed QT-3791 but it caused lots of problems in other sites. So reverting this will fix QT-4001 but reopens QT-3791. QT-4001 blocks Qt 4.7.1 but QT-3791 doesn't. Task-number: QT-4001 Reviewed-by: Jason Barron (cherry picked from commit 25ddfb434f13aa3bbc6ac303aa17dbe9582bf3f0) --- src/openvg/qpaintengine_vg.cpp | 158 +++++++++++++++++------------------------ 1 file changed, 66 insertions(+), 92 deletions(-) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 74395a2..f6d2435 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -196,9 +196,7 @@ public: #endif QTransform transform; // Currently active transform. - bool affineTransform; // True if the transform is non-projective. - bool simpleTransform; // True if the transform is simple translate - // or 0, 90, 180, and 270 degree rotation + bool simpleTransform; // True if the transform is simple (non-projective). qreal penScale; // Pen scaling factor from "transform". QTransform pathTransform; // Calculated VG path transformation. @@ -379,7 +377,6 @@ void QVGPaintEnginePrivate::init() roundRectPath = 0; #endif - affineTransform = true; simpleTransform = true; pathTransformSet = false; penScale = 1.0; @@ -532,59 +529,12 @@ void QVGPaintEnginePrivate::setTransform vgLoadMatrix(mat); } -// Determine if a co-ordinate transform is simple enough to allow -// rectangle-based clipping with vgMask() and rounding translation -// to integers. Simple transforms most often result from origin translations. -static inline bool transformIsSimple(const QTransform& transform) -{ - QTransform::TransformationType type = transform.type(); - if (type == QTransform::TxNone || type == QTransform::TxTranslate) { - return true; - } else if (type == QTransform::TxScale) { - // Check for 0 and 180 degree rotations. - // (0 might happen after 4 rotations of 90 degrees). - qreal m11 = transform.m11(); - qreal m12 = transform.m12(); - qreal m21 = transform.m21(); - qreal m22 = transform.m22(); - if (m12 == 0.0f && m21 == 0.0f) { - if (m11 == 1.0f && m22 == 1.0f) - return true; // 0 degrees - else if (m11 == -1.0f && m22 == -1.0f) - return true; // 180 degrees. - if(m11 == 1.0f && m22 == -1.0f) - return true; // 0 degrees inverted y. - else if(m11 == -1.0f && m22 == 1.0f) - return true; // 180 degrees inverted y. - } - } else if (type == QTransform::TxRotate) { - // Check for 90, and 270 degree rotations. - qreal m11 = transform.m11(); - qreal m12 = transform.m12(); - qreal m21 = transform.m21(); - qreal m22 = transform.m22(); - if (m11 == 0.0f && m22 == 0.0f) { - if (m12 == 1.0f && m21 == -1.0f) - return true; // 90 degrees. - else if (m12 == -1.0f && m21 == 1.0f) - return true; // 270 degrees. - else if (m12 == -1.0f && m21 == -1.0f) - return true; // 90 degrees inverted y. - else if (m12 == 1.0f && m21 == 1.0f) - return true; // 270 degrees inverted y. - } - } - return false; -} - Q_DECL_IMPORT extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev) { VGfloat devh = pdev->height(); - simpleTransform = transformIsSimple(transform); - // Construct the VG transform by combining the Qt transform with // the following viewport transformation: // | 1 0 0 | @@ -607,9 +557,9 @@ void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev) // so we will have to convert the co-ordinates ourselves. // Change the matrix to just the viewport transformation. pathTransform = viewport; - affineTransform = false; + simpleTransform = false; } else { - affineTransform = true; + simpleTransform = true; } pathTransformSet = false; @@ -638,7 +588,7 @@ VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path) // Size is sufficient segments for drawRoundedRect() paths. QVarLengthArray segments; - if (sizeof(qreal) == sizeof(VGfloat) && elements && affineTransform) { + if (sizeof(qreal) == sizeof(VGfloat) && elements && simpleTransform) { // If Qt was compiled with qreal the same size as VGfloat, // then convert the segment types and use the incoming // points array directly. @@ -673,7 +623,7 @@ VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path) int curvePos = 0; QPointF temp; - if (elements && affineTransform) { + if (elements && simpleTransform) { // Convert the members of the element array. for (int i = 0; i < count; ++i) { switch (elements[i]) { @@ -717,7 +667,7 @@ VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path) } points += 2; } - } else if (elements && !affineTransform) { + } else if (elements && !simpleTransform) { // Convert the members of the element array after applying the // current transform to the path locally. for (int i = 0; i < count; ++i) { @@ -766,7 +716,7 @@ VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path) } points += 2; } - } else if (count > 0 && affineTransform) { + } else if (count > 0 && simpleTransform) { // If there is no element array, then the path is assumed // to be a MoveTo followed by several LineTo's. coords.append(points[0]); @@ -779,7 +729,7 @@ VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path) segments.append(VG_LINE_TO_ABS); --count; } - } else if (count > 0 && !affineTransform) { + } else if (count > 0 && !simpleTransform) { // Convert a simple path, and apply the transform locally. temp = transform.map(QPointF(points[0], points[1])); coords.append(temp.x()); @@ -840,7 +790,7 @@ VGPath QVGPaintEnginePrivate::painterPathToVGPath(const QPainterPath& path) bool haveStart = false; bool haveEnd = false; - if (affineTransform) { + if (simpleTransform) { // Convert the members of the element array. for (int i = 0; i < count; ++i) { switch (elements[i].type) { @@ -1615,6 +1565,36 @@ void QVGPaintEngine::stroke(const QVectorPath &path, const QPen &pen) vgDestroyPath(vgpath); } +// Determine if a co-ordinate transform is simple enough to allow +// rectangle-based clipping with vgMask(). Simple transforms most +// often result from origin translations. +static inline bool clipTransformIsSimple(const QTransform& transform) +{ + QTransform::TransformationType type = transform.type(); + if (type == QTransform::TxNone || type == QTransform::TxTranslate) + return true; + if (type == QTransform::TxRotate) { + // Check for 0, 90, 180, and 270 degree rotations. + // (0 might happen after 4 rotations of 90 degrees). + qreal m11 = transform.m11(); + qreal m12 = transform.m12(); + qreal m21 = transform.m21(); + qreal m22 = transform.m22(); + if (m11 == 0.0f && m22 == 0.0f) { + if (m12 == 1.0f && m21 == -1.0f) + return true; // 90 degrees. + else if (m12 == -1.0f && m21 == 1.0f) + return true; // 270 degrees. + } else if (m12 == 0.0f && m21 == 0.0f) { + if (m11 == -1.0f && m22 == -1.0f) + return true; // 180 degrees. + else if (m11 == 1.0f && m22 == 1.0f) + return true; // 0 degrees. + } + } + return false; +} + #if defined(QVG_SCISSOR_CLIP) void QVGPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) @@ -1632,7 +1612,7 @@ void QVGPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) // We aren't using masking, so handle simple QRectF's only. if (path.shape() == QVectorPath::RectangleHint && - path.elementCount() == 4 && d->simpleTransform) { + path.elementCount() == 4 && clipTransformIsSimple(d->transform)) { // Clipping region that resulted from QPainter::setClipRect(QRectF). // Convert it into a QRect and apply. const qreal *points = path.points(); @@ -1782,7 +1762,7 @@ void QVGPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) // We don't have vgRenderToMask(), so handle simple QRectF's only. if (path.shape() == QVectorPath::RectangleHint && - path.elementCount() == 4 && d->simpleTransform) { + path.elementCount() == 4 && clipTransformIsSimple(d->transform)) { // Clipping region that resulted from QPainter::setClipRect(QRectF). // Convert it into a QRect and apply. const qreal *points = path.points(); @@ -1834,7 +1814,7 @@ void QVGPaintEngine::clip(const QRect &rect, Qt::ClipOperation op) d->dirty |= QPaintEngine::DirtyClipRegion; // If we have a non-simple transform, then use path-based clipping. - if (op != Qt::NoClip && !d->simpleTransform) { + if (op != Qt::NoClip && !clipTransformIsSimple(d->transform)) { QPaintEngineEx::clip(rect, op); return; } @@ -1953,7 +1933,7 @@ void QVGPaintEngine::clip(const QRegion ®ion, Qt::ClipOperation op) d->dirty |= QPaintEngine::DirtyClipRegion; // If we have a non-simple transform, then use path-based clipping. - if (op != Qt::NoClip && !d->simpleTransform) { + if (op != Qt::NoClip && !clipTransformIsSimple(d->transform)) { QPaintEngineEx::clip(region, op); return; } @@ -2530,14 +2510,14 @@ void QVGPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) // Check to see if we can use vgClear() for faster filling. if (brush.style() == Qt::SolidPattern && brush.isOpaque() && - d->simpleTransform && d->opacity == 1.0f && + clipTransformIsSimple(d->transform) && d->opacity == 1.0f && clearRect(rect, brush.color())) { return; } #if !defined(QVG_NO_MODIFY_PATH) VGfloat coords[8]; - if (d->affineTransform) { + if (d->simpleTransform) { coords[0] = rect.x(); coords[1] = rect.y(); coords[2] = rect.x() + rect.width(); @@ -2572,14 +2552,14 @@ void QVGPaintEngine::fillRect(const QRectF &rect, const QColor &color) Q_D(QVGPaintEngine); // Check to see if we can use vgClear() for faster filling. - if (d->simpleTransform && d->opacity == 1.0f && color.alpha() == 255 && + if (clipTransformIsSimple(d->transform) && d->opacity == 1.0f && color.alpha() == 255 && clearRect(rect, color)) { return; } #if !defined(QVG_NO_MODIFY_PATH) VGfloat coords[8]; - if (d->affineTransform) { + if (d->simpleTransform) { coords[0] = rect.x(); coords[1] = rect.y(); coords[2] = rect.x() + rect.width(); @@ -2612,7 +2592,7 @@ void QVGPaintEngine::fillRect(const QRectF &rect, const QColor &color) void QVGPaintEngine::drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode) { Q_D(QVGPaintEngine); - if (d->affineTransform) { + if (d->simpleTransform) { QVGPainterState *s = state(); VGPath vgpath = d->roundedRectPath(rect, xrad, yrad, mode); d->draw(vgpath, s->pen, s->brush); @@ -2631,7 +2611,7 @@ void QVGPaintEngine::drawRects(const QRect *rects, int rectCount) QVGPainterState *s = state(); for (int i = 0; i < rectCount; ++i, ++rects) { VGfloat coords[8]; - if (d->affineTransform) { + if (d->simpleTransform) { coords[0] = rects->x(); coords[1] = rects->y(); coords[2] = rects->x() + rects->width(); @@ -2672,7 +2652,7 @@ void QVGPaintEngine::drawRects(const QRectF *rects, int rectCount) QVGPainterState *s = state(); for (int i = 0; i < rectCount; ++i, ++rects) { VGfloat coords[8]; - if (d->affineTransform) { + if (d->simpleTransform) { coords[0] = rects->x(); coords[1] = rects->y(); coords[2] = rects->x() + rects->width(); @@ -2710,7 +2690,7 @@ void QVGPaintEngine::drawLines(const QLine *lines, int lineCount) QVGPainterState *s = state(); for (int i = 0; i < lineCount; ++i, ++lines) { VGfloat coords[4]; - if (d->affineTransform) { + if (d->simpleTransform) { coords[0] = lines->x1(); coords[1] = lines->y1(); coords[2] = lines->x2(); @@ -2738,7 +2718,7 @@ void QVGPaintEngine::drawLines(const QLineF *lines, int lineCount) QVGPainterState *s = state(); for (int i = 0; i < lineCount; ++i, ++lines) { VGfloat coords[4]; - if (d->affineTransform) { + if (d->simpleTransform) { coords[0] = lines->x1(); coords[1] = lines->y1(); coords[2] = lines->x2(); @@ -2764,7 +2744,7 @@ void QVGPaintEngine::drawEllipse(const QRectF &r) // Based on the description of vguEllipse() in the OpenVG specification. // We don't use vguEllipse(), to avoid unnecessary library dependencies. Q_D(QVGPaintEngine); - if (d->affineTransform) { + if (d->simpleTransform) { QVGPainterState *s = state(); VGPath path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, @@ -2837,7 +2817,7 @@ void QVGPaintEngine::drawPoints(const QPointF *points, int pointCount) for (int i = 0; i < pointCount; ++i, ++points) { VGfloat coords[4]; - if (d->affineTransform) { + if (d->simpleTransform) { coords[0] = points->x(); coords[1] = points->y(); coords[2] = coords[0]; @@ -2871,7 +2851,7 @@ void QVGPaintEngine::drawPoints(const QPoint *points, int pointCount) for (int i = 0; i < pointCount; ++i, ++points) { VGfloat coords[4]; - if (d->affineTransform) { + if (d->simpleTransform) { coords[0] = points->x(); coords[1] = points->y(); coords[2] = coords[0]; @@ -2905,7 +2885,7 @@ void QVGPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonD QVarLengthArray coords; QVarLengthArray segments; for (int i = 0; i < pointCount; ++i, ++points) { - if (d->affineTransform) { + if (d->simpleTransform) { coords.append(points->x()); coords.append(points->y()); } else { @@ -2952,7 +2932,7 @@ void QVGPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDr QVarLengthArray coords; QVarLengthArray segments; for (int i = 0; i < pointCount; ++i, ++points) { - if (d->affineTransform) { + if (d->simpleTransform) { coords.append(points->x()); coords.append(points->y()); } else { @@ -2987,7 +2967,7 @@ void QVGPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDr void QVGPaintEnginePrivate::setImageOptions() { - if (opacity != 1.0f && affineTransform) { + if (opacity != 1.0f && simpleTransform) { if (opacity != paintOpacity) { VGfloat values[4]; values[0] = 1.0f; @@ -3034,10 +3014,7 @@ static void drawVGImage(QVGPaintEnginePrivate *d, QTransform transform(d->imageTransform); VGfloat scaleX = sr.width() == 0.0f ? 0.0f : r.width() / sr.width(); VGfloat scaleY = sr.height() == 0.0f ? 0.0f : r.height() / sr.height(); - if (d->simpleTransform) - transform.translate(qRound(r.x()), qRound(r.y())); - else - transform.translate(r.x(), r.y()); + transform.translate(r.x(), r.y()); transform.scale(scaleX, scaleY); d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform); @@ -3055,10 +3032,7 @@ static void drawVGImage(QVGPaintEnginePrivate *d, return; QTransform transform(d->imageTransform); - if(d->simpleTransform) - transform.translate(qRound(pos.x()), qRound(pos.y())); - else - transform.translate(pos.x(), pos.y()); + transform.translate(pos.x(), pos.y()); d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform); d->setImageOptions(); @@ -3101,7 +3075,7 @@ void QVGPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF QVGPixmapData *vgpd = static_cast(pd); if (!vgpd->isValid()) return; - if (d->affineTransform) + if (d->simpleTransform) drawVGImage(d, r, vgpd->toVGImage(), vgpd->size(), sr); else drawVGImage(d, r, vgpd->toVGImage(d->opacity), vgpd->size(), sr); @@ -3120,7 +3094,7 @@ void QVGPaintEngine::drawPixmap(const QPointF &pos, const QPixmap &pm) QVGPixmapData *vgpd = static_cast(pd); if (!vgpd->isValid()) return; - if (d->affineTransform) + if (d->simpleTransform) drawVGImage(d, pos, vgpd->toVGImage()); else drawVGImage(d, pos, vgpd->toVGImage(d->opacity)); @@ -3135,7 +3109,7 @@ void QVGPaintEngine::drawImage { Q_D(QVGPaintEngine); VGImage vgImg; - if (d->affineTransform || d->opacity == 1.0f) + if (d->simpleTransform || d->opacity == 1.0f) vgImg = toVGImageSubRect(image, sr.toRect(), flags); else vgImg = toVGImageWithOpacitySubRect(image, d->opacity, sr.toRect()); @@ -3158,7 +3132,7 @@ void QVGPaintEngine::drawImage(const QPointF &pos, const QImage &image) { Q_D(QVGPaintEngine); VGImage vgImg; - if (d->affineTransform || d->opacity == 1.0f) + if (d->simpleTransform || d->opacity == 1.0f) vgImg = toVGImage(image); else vgImg = toVGImageWithOpacity(image, d->opacity); @@ -3191,7 +3165,7 @@ void QVGPaintEngine::drawPixmapFragments(const QPainter::PixmapFragment *drawing QPixmapData *pd = pixmap.pixmapData(); if (!pd) return; // null QPixmap - if (pd->classId() != QPixmapData::OpenVGClass || !d->affineTransform) { + if (pd->classId() != QPixmapData::OpenVGClass || !d->simpleTransform) { QPaintEngineEx::drawPixmapFragments(drawingData, dataCount, pixmap, hints); return; } @@ -3416,7 +3390,7 @@ void QVGPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) // If we are not using a simple transform, then fall back // to the default Qt path stroking algorithm. - if (!d->affineTransform) { + if (!d->simpleTransform) { QPaintEngineEx::drawTextItem(p, textItem); return; } -- cgit v0.12 From 371b528ffd53cc28ca621739d6c3fc33a1fb9fa0 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Wed, 6 Oct 2010 10:35:47 +0200 Subject: Doc: Fixing bug in QML tutorial The code snippet for the simple button was not correctly linked. --- doc/src/getting-started/gettingstartedqml.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/getting-started/gettingstartedqml.qdoc b/doc/src/getting-started/gettingstartedqml.qdoc index 9d4f6a7..69658f6 100644 --- a/doc/src/getting-started/gettingstartedqml.qdoc +++ b/doc/src/getting-started/gettingstartedqml.qdoc @@ -71,7 +71,7 @@ In QML, the basic visual item is the \l {Rectangle}{Rectangle} element. The \c Rectangle element has properties to control the element's appearance and location. - \snippet examples/tutorials/gettingStarted/gsQml/part0/Button.qml document + \snippet examples/tutorials/gettingStarted/gsQml/core/Button.qml document First, the \c { import QtQuick 1.0 } allows the qmlviewer tool to import the QML elements we will later use. This line must exist for every QML file. Notice that the version -- cgit v0.12 From fe0319a84082cb97a2007ca82af153a785a0938e Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Wed, 6 Oct 2010 13:11:33 +0200 Subject: Doc: Fixing spacing bug in columns --- doc/src/template/style/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index c07385c..3dcea96 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -982,7 +982,7 @@ min-width:250px; line-height: 1.2; min-width:100%; - + min-height:15px; } .flowList dd a{ -- cgit v0.12 From 64b2aba90b86a62be961dc7fc77aa6b37915e144 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Wed, 6 Oct 2010 13:44:27 +0200 Subject: Added installation section and fixed some whitespace. Reviewed-by: David Boddie --- doc/src/getting-started/gettingstartedqml.qdoc | 82 +++++++++++++++----------- 1 file changed, 46 insertions(+), 36 deletions(-) diff --git a/doc/src/getting-started/gettingstartedqml.qdoc b/doc/src/getting-started/gettingstartedqml.qdoc index c7c73e9..0da8f53 100644 --- a/doc/src/getting-started/gettingstartedqml.qdoc +++ b/doc/src/getting-started/gettingstartedqml.qdoc @@ -35,6 +35,16 @@ After reading this guide, you should be ready to develop your own applications using QML and Qt C++. + \section1 Installation + + First, we would need to install the latest version of Qt that includes \l{Qt + Quick}, which is Qt 4.7. The \l{Installation} {installation} guide contains + installation instructions and requirements for different platforms. + + Qt Quick includes a declarative language called + \l{Introduction to the QML language}{QML}, the \l{QtDeclarative Module}, and + \l{QML Viewer}. + \section1 QML to Build User Interfaces The application we are building is a simple text editor that will load, save, @@ -68,8 +78,8 @@ We start our text editor by building a button. Functionally, a button has a mouse sensitive area and a label. Buttons perform actions when a user presses the button. - In QML, the basic visual item is the \l {Rectangle}{Rectangle} element. The - \c Rectangle element has properties to control the element's appearance and location. + In QML, the basic visual item is the \l {Rectangle}{Rectangle} element. The + \c Rectangle element has properties to control the element's appearance and location. \snippet examples/tutorials/gettingStarted/gsQml/part0/Button.qml document @@ -88,7 +98,7 @@ \c text property. The label is contained within the Rectangle and in order to center it in the middle, we assign the \c anchors of the Text element to its parent, which is called \c simplebutton. Anchors may bind to other items' anchors, allowing layout - assignments simpler. + assignments simpler. We shall save this code as \c SimpleButton.qml. Running qmlviewer with the file as the argument will display the grey rectangle with a text label. @@ -104,7 +114,7 @@ id:simplebutton ... - MouseArea{ + MouseArea{ id: buttonMouseArea anchors.fill: parent //anchor all sides of the mouse area to the rectangle's anchors @@ -126,7 +136,7 @@ whenever the acceptable mouse button is clicked, the left click being the default. We can bind actions to the onClicked handler. In our example, \c console.log() outputs text whenever the mouse area is clicked. The function \c console.log() is a useful tool for - debugging purposes and for outputting text. + debugging purposes and for outputting text. The code in \c SimpleButton.qml is sufficient to display a button on the screen and output text whenever it is clicked with a mouse. @@ -136,7 +146,7 @@ id:Button ... - property color buttonColor: "lightblue" + property color buttonColor: "lightblue" property color onHoverColor: "gold" property color borderColor: "white" @@ -145,8 +155,8 @@ console.log(buttonLabel.text + " clicked" ) } - MouseArea{ - onClicked: buttonClick() + MouseArea{ + onClicked: buttonClick() hoverEnabled: true onEntered: parent.border.color = onHoverColor onExited: parent.border.color = borderColor @@ -210,12 +220,12 @@ \code import QtQuick 1.0 \\import the main Qt QML module - import "folderName" \\import the contents of the folder + import "folderName" \\import the contents of the folder import "script.js" as Script \\import a Javascript file and name it as Script \endcode The syntax shown above shows how to use the \c import keyword. This is required to - use JavaScript files, or QML files that are not within the same directory. Since + use JavaScript files, or QML files that are not within the same directory. Since \c Button.qml is in the same directory as \c FileMenu.qml, we do not need to import the \c Button.qml file to use it. We can directly create a \c Button element by declaring \c Button{}, similar to a \c Rectangle{} declaration. @@ -242,7 +252,7 @@ label: "Exit" buttonColor: "darkgrey" - onButtonClick: Qt.quit() + onButtonClick: Qt.quit() } } \endcode @@ -266,7 +276,7 @@ The declaration of the edit menu is very similar at this stage. The menu has buttons that have the labels: \c Copy, \c Paste, and \c {Select All}. - \image qml-texteditor1_editmenu.png + \image qml-texteditor1_editmenu.png Armed with our knowledge of importing and customizing previously made components, we may now combine these menu pages to create a menu bar, @@ -333,7 +343,7 @@ //control the movement of the menu switching snapMode: ListView.SnapOneItem orientation: ListView.Horizontal - boundsBehavior: Flickable.StopAtBounds + boundsBehavior: Flickable.StopAtBounds flickDeceleration: 5000 highlightFollowsCurrentItem: true highlightMoveDuration:240 @@ -346,7 +356,7 @@ code above sets \c Flickable properties to create the desired flicking movement to our view. In particular,the property \c highlightMoveDuration changes the duration of the flick transition. A higher \c highlightMoveDuration value - results in slower menu switching. + results in slower menu switching. The \c ListView maintains the model items through an \c index and each visual item in the model is accessible through the \c index, in the order of the @@ -380,7 +390,7 @@ id: editButton label: "Edit" ... - onButtonClick: menuListView.currentIndex = 1 + onButtonClick: menuListView.currentIndex = 1 } } } @@ -389,7 +399,7 @@ The menu bar we just created can be flicked to access the menus or by clicking on the menu names at the top. Switching menu screens feel intuitive and responsive. - \image qml-texteditor2_menubar.png + \image qml-texteditor2_menubar.png \section1 Building a Text Editor @@ -402,7 +412,7 @@ \code TextEdit{ - id: textEditor + id: textEditor anchors.fill:parent width:parent.width; height:parent.height color:"midnightblue" @@ -475,14 +485,14 @@ that already have defined behaviors. Using this approach, application layouts and UI components can be created easily. - \image qml-texteditor3_texteditor.png + \image qml-texteditor3_texteditor.png \section1 Decorating the Text Editor \section2 Implementing a Drawer Interface Our text editor looks simple and we need to decorate it. Using QML, we can declare transitions and animate our text editor. Our menu bar is occupying one-third of the - screen and it would be nice to have it only appear when we want it. + screen and it would be nice to have it only appear when we want it. We can add a drawer interface, that will contract or expand the menu bar when clicked. In our implementation, we have a thin rectangle that responds to mouse clicks. The @@ -537,7 +547,7 @@ the item's \c transitions property. Our text editor has a state transition whenever the state changes to either \c DRAWER_OPEN or \c DRAWER_CLOSED. Importantly, the transition needs a \c from and a \c to state but for our transitions, we can use - the wild card \c * symbol to denote that the transition applies to all state changes. + the wild card \c * symbol to denote that the transition applies to all state changes. During transitions, we can assign animations to the property changes. Our \c menuBar switches position from \c {y:0} to \c {y:-partition} and we can animate @@ -561,7 +571,7 @@ Behavior{ NumberAnimation{property: "rotation";easing.type: Easing.OutExpo } - } + } \endcode Going back to our components with knowledge of states and animations, we can improve @@ -607,9 +617,9 @@ We are finished building the user interface of a very simple text editor. Going forward, the user interface is complete, and we can implement the application logic using regular Qt and C++. QML works nicely as a prototyping - tool, separating the application logic away from the UI design. + tool, separating the application logic away from the UI design. - \image qml-texteditor4_texteditor.png + \image qml-texteditor4_texteditor.png \section2 Extending QML using Qt C++ @@ -622,7 +632,7 @@ we shall implement the load and save functions in C++ and export it as a plugin. This way, we only need to load the QML file directly instead of running an executable. - \section3 Exposing C++ Classes to QML + \section3 Exposing C++ Classes to QML We will be implementing file loading and saving using Qt and C++. C++ classes and functions can be used in QML by registering them. The class also needs to be @@ -762,7 +772,7 @@ Similarly, we have the other properties declared according to their uses. The \c filesCount property indicates the number of files in a directory. The filename property is set to the currently selected file's name and the loaded/saved file - content is stored in \c fileContent property. + content is stored in \c fileContent property. \code Q_PROPERTY(QDeclarativeListProperty files READ files CONSTANT ) @@ -811,10 +821,10 @@ Regular C++ functions are also accessible from QML. The file loading and saving functions are implemented in C++ and declared using the \l {Q_INVOKABLE}{Q_INVOKABLE} macro. Alternatively, we can declare the functions - as a \c slot and the functions will be accessible from QML. + as a \c slot and the functions will be accessible from QML. \code - In Directory.h: + In Directory.h: Q_INVOKABLE void saveFile(); Q_INVOKABLE void loadFile(); @@ -848,9 +858,9 @@ The constructor passes pointers to functions that will append the list, count the list, retrieve the item using an index, and empty the list. Only the append function is mandatory. Note that the function pointers must match the definition - of \l {QDeclarativeListProperty::AppendFunction}{AppendFunction}, - \l {QDeclarativeListProperty::CountFunction}{CountFunction}, - \l {QDeclarativeListProperty::AtFunction}{AtFunction}, or + of \l {QDeclarativeListProperty::AppendFunction}{AppendFunction}, + \l {QDeclarativeListProperty::CountFunction}{CountFunction}, + \l {QDeclarativeListProperty::AtFunction}{AtFunction}, or \l {QDeclarativeListProperty::ClearFunction}{ClearFunction}. \code @@ -883,7 +893,7 @@ plugins and other resources. \code - In qmldir: + In qmldir: Button ./Button.qml FileDialog ./FileDialog.qml @@ -895,7 +905,7 @@ \endcode The plugin we just created is called \c FileDialog, as indicated by the - \c TARGET field in the project file. The compiled plugin is in the \c plugins directory. + \c TARGET field in the project file. The compiled plugin is in the \c plugins directory. \section3 Integrating a File Dialog into the File Menu @@ -910,7 +920,7 @@ \c FileDialog element that the directory refreshed its contents. This notification is performed in the signal handler, \c onDirectoryChanged. - \code + \code In FileMenu.qml: Directory{ @@ -922,7 +932,7 @@ Keeping with the simplicity of our application, the file dialog will always be visible and will not display invalid text files, which do not have a \c .txt - extension to their filenames. + extension to their filenames. \code In FileDialog.qml: @@ -981,10 +991,10 @@ will transfer the text from the \c TextEdit onto the directory's \c fileContent property, then copy its file name from the editable text input. Finally, the button calls the \c saveFile() function, saving the file. The \c loadButton has a similar - execution. Also, the \c New action will empty the contents of the \c TextEdit. + execution. Also, the \c New action will empty the contents of the \c TextEdit. Further, the \c EditMenu buttons are connected to the \c TextEdit functions to copy, - paste, and select all the text in the text editor. + paste, and select all the text in the text editor. \image qml-texteditor5_filemenu.png -- cgit v0.12 From f6d9c3f0dd014c409c43150b3a10866f47ea54a6 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Wed, 6 Oct 2010 14:13:02 +0200 Subject: Clarified the auto connect enumeration regarding which type of connection is made. Task-number: QTBUG-14223 Reviewed-by: David Boddie --- src/corelib/global/qnamespace.qdoc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index ad0ffd7..32e85db 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -511,9 +511,11 @@ delivery at a later time. \value AutoConnection - (default) Same as DirectConnection, if the emitter and - receiver are in the same thread. Same as QueuedConnection, - if the emitter and receiver are in different threads. + (default) If the object sending the signal is in a different thread + than the receiving object, the signal is queued, behaving as + Qt::QueuedConnection. If both objects are in the same thread, + the slot is invoked directly, behaving as Qt::DirectConnection. The + type of connection is determined when the signal is emitted. \value DirectConnection The slot is invoked immediately, when the signal is -- cgit v0.12 From 52111401594472503ce21096fc720807a9253b8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Wed, 6 Oct 2010 15:04:31 +0200 Subject: Add support for blacklisting/whitelisting tests on the report page. Also changed how the GL tests are run: they now render into a multisampled FBO, which seems to be more stable than to a plain GL widget. --- tests/arthur/baselineserver/src/baselineserver.cpp | 92 +++++++++++++++++++--- tests/arthur/baselineserver/src/baselineserver.h | 6 ++ tests/arthur/baselineserver/src/htmlpage.cpp | 71 ++++++++++++++--- tests/arthur/baselineserver/src/htmlpage.h | 3 +- tests/auto/lancelot/tst_lancelot.cpp | 20 ++--- 5 files changed, 156 insertions(+), 36 deletions(-) diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp index 41e48eb..072e216 100644 --- a/tests/arthur/baselineserver/src/baselineserver.cpp +++ b/tests/arthur/baselineserver/src/baselineserver.cpp @@ -143,11 +143,6 @@ void BaselineHandler::provideBaselineChecksums(const QByteArray &itemListBlock) << itemList.at(0).engineAsString() << "pixel format" << itemList.at(0).formatAsString(); for (ImageItemList::iterator i = itemList.begin(); i != itemList.end(); ++i) { - if (i->scriptName.startsWith(QLS("porter_duff"))) { - // Example of blacklisting on server. - i->status = ImageItem::IgnoreItem; - continue; - } i->imageChecksums.clear(); QString prefix = pathForItem(*i, true); QFile file(prefix + QLS("metadata")); @@ -161,11 +156,29 @@ void BaselineHandler::provideBaselineChecksums(const QByteArray &itemListBlock) i->status = ImageItem::BaselineNotFound; } + // Find and mark blacklisted items + if (itemList.count() > 0) { + QString prefix = pathForItem(itemList.at(0), true).section(QLC('/'), 0, -2); + QFile file(prefix + QLS("/.blacklist")); + if (file.open(QIODevice::ReadOnly)) { + QTextStream in(&file); + do { + QString scriptName = in.readLine(); + if (!scriptName.isNull()) { + for (ImageItemList::iterator i = itemList.begin(); i != itemList.end(); ++i) { + if (i->scriptName == scriptName) + i->status = ImageItem::IgnoreItem; + } + } + } while (!in.atEnd()); + } + } + QByteArray block; QDataStream ods(&block, QIODevice::WriteOnly); ods << itemList; proto.sendBlock(BaselineProtocol::Ack, block); - report.start(BaselineServer::storagePath(), runId, plat); + report.start(BaselineServer::storagePath(), runId, plat, itemList); } @@ -216,6 +229,14 @@ void BaselineHandler::receiveDisconnect() } +QString BaselineHandler::itemSubPath(const QString &engine, const QString &format, bool isBaseline) +{ + if (isBaseline) + return QString(QLS("baselines_%1_%2/")).arg(engine, format); + else + return QString(QLS("mismatches_%1_%2/")).arg(engine, format); +} + QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline, bool absolute) { if (pathForRun.isNull()) { @@ -233,9 +254,9 @@ QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline, boo QString storePath = pathForRun; if (isBaseline) - storePath += QString(QLS("baselines_%1_%2/")).arg(item.engineAsString(), item.formatAsString()); + storePath += itemSubPath(item.engineAsString(), item.formatAsString(), isBaseline); else - storePath += QString(QLS("mismatches_%1_%2/")).arg(item.engineAsString(), item.formatAsString()) + runId + QLC('/'); + storePath += itemSubPath(item.engineAsString(), item.formatAsString(), isBaseline) + runId + QLC('/'); QString itemName = item.scriptName; if (itemName.contains(QLC('.'))) @@ -253,11 +274,8 @@ QString BaselineHandler::updateAllBaselines(const QString &host, const QString & const QString &engine, const QString &format) { QString basePath(BaselineServer::storagePath()); - QString srcDir(basePath + host + QLC('/') - + QString(QLS("mismatches_%1_%2/")).arg(engine, format) - + id); - QString dstDir(basePath + host + QLC('/') - + QString(QLS("baselines_%1_%2/")).arg(engine, format)); + QString srcDir(basePath + host + QLC('/') + itemSubPath(engine, format, false) + id); + QString dstDir(basePath + host + QLC('/') + itemSubPath(engine, format)); QDir dir(srcDir); QStringList nameFilter; @@ -307,6 +325,54 @@ QString BaselineHandler::updateSingleBaseline(const QString &oldBaseline, const return res; } +QString BaselineHandler::blacklistTest(const QString &scriptName, const QString &host, const QString &engine, + const QString &format) +{ + QString configFile(BaselineServer::storagePath() + host + QLC('/') + + itemSubPath(engine, format) + QLS(".blacklist")); + QFile file(configFile); + if (file.open(QIODevice::Append)) { + QTextStream out(&file); + out << scriptName << endl; + return QLS("Blacklisted ") + scriptName; + } else { + return QLS("Unable to update blacklisted tests."); + } +} + +QString BaselineHandler::whitelistTest(const QString &scriptName, const QString &host, const QString &engine, + const QString &format) +{ + QString configFile(BaselineServer::storagePath() + host + QLC('/') + + itemSubPath(engine, format) + QLS(".blacklist")); + QFile file(configFile); + QStringList tests; + if (file.open(QIODevice::ReadOnly)) { + QTextStream in(&file); + do { + tests << in.readLine(); + } while (!in.atEnd()); + if (tests.count() != 0) { + QMutableStringListIterator it(tests); + while (it.hasNext()) { + it.next(); + if (it.value() == scriptName) + it.remove(); + } + } + file.close(); + if (file.open(QIODevice::WriteOnly | QIODevice::Truncate)) { + QTextStream out(&file); + for (int i=0; iBuild key: " << plat.buildKey << "\n"; out << "

Engine: " << item.engineAsString() << "

\n"; out << "

Format: " << item.formatAsString() << "

\n\n"; - out << "

Update all baselines

\n\n"; + << "\">Update all baselines
"; out << "
\n" "\n" "\n" "\n" "\n" "\n" - "\n" - "\n" - "\n" - "\n\n"; + "\n" + "
"; } @@ -82,23 +81,53 @@ void HTMLPage::addItem(const QString &baseline, const QString &rendered, const I headerWritten = true; } QString compared = generateCompared(baseline, rendered); - QString fuzzy = generateCompared(baseline, rendered, true); QString pageUrl = BaselineServer::baseUrl() + path; out << "\n"; out << "\n"; - QStringList images = QStringList() << baseline << rendered << compared << fuzzy; + QStringList images = QStringList() << baseline << rendered << compared; foreach(const QString& img, images) out << "\n"; - out << "\n"; + out << "\n"; out << "\n\n"; + + QMutableVectorIterator it(imageItems); + while (it.hasNext()) { + it.next(); + if (it.value().scriptName == item.scriptName) { + it.remove(); + break; + } + } } void HTMLPage::end() { if (file.isOpen()) { + // Add the names of the scripts that passed the test, or were blacklisted + QString pageUrl = BaselineServer::baseUrl() + path; + for (int i=0; i"; + } + writeFooter(); out.flush(); file.close(); @@ -132,14 +161,30 @@ void HTMLPage::handleCGIQuery(const QString &query) // << "Contents of QUERY_STRING:
" // << "Full string = " << query << "
"; - if (cgiUrl.queryItemValue(QLS("update")) == QLS("single")) { + QString command(cgiUrl.queryItemValue("cmd")); + + if (command == QLS("updateSingleBaseline")) { s << BaselineHandler::updateSingleBaseline(cgiUrl.queryItemValue(QLS("oldBaseline")), cgiUrl.queryItemValue(QLS("newBaseline"))); - } else { + } else if (command == QLS("updateAllBaselines")) { s << BaselineHandler::updateAllBaselines(cgiUrl.queryItemValue(QLS("host")), cgiUrl.queryItemValue(QLS("id")), cgiUrl.queryItemValue(QLS("engine")), cgiUrl.queryItemValue(QLS("format"))); + } else if (command == QLS("blacklist")) { + // blacklist a test + s << BaselineHandler::blacklistTest(cgiUrl.queryItemValue(QLS("scriptName")), + cgiUrl.queryItemValue(QLS("host")), + cgiUrl.queryItemValue(QLS("engine")), + cgiUrl.queryItemValue(QLS("format"))); + } else if (command == QLS("whitelist")) { + // whitelist a test + s << BaselineHandler::whitelistTest(cgiUrl.queryItemValue(QLS("scriptName")), + cgiUrl.queryItemValue(QLS("host")), + cgiUrl.queryItemValue(QLS("engine")), + cgiUrl.queryItemValue(QLS("format"))); + } else { + s << "Unknown query:
" << query << "
"; } s << "

Back to report"; s << ""; diff --git a/tests/arthur/baselineserver/src/htmlpage.h b/tests/arthur/baselineserver/src/htmlpage.h index 29b4ff5..a937052 100644 --- a/tests/arthur/baselineserver/src/htmlpage.h +++ b/tests/arthur/baselineserver/src/htmlpage.h @@ -11,7 +11,7 @@ public: HTMLPage(); ~HTMLPage(); - void start(const QString &storagePath, const QString &runId, const PlatformInfo pinfo); + void start(const QString &storagePath, const QString &runId, const PlatformInfo pinfo, const ImageItemList &itemList); void addItem(const QString &baseline, const QString &rendered, const ImageItem &item); void end(); QString filePath(); @@ -29,6 +29,7 @@ private: QTextStream out; QString id; PlatformInfo plat; + ImageItemList imageItems; bool headerWritten; }; diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index d7a675d..21044d4 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -189,10 +189,11 @@ void tst_Lancelot::testOpenGL_data() void tst_Lancelot::testOpenGL() { bool ok = false; - QGLWidget glWidget; + QGLWidget glWidget; if (glWidget.isValid() && glWidget.format().directRendering() && ((QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0) - || (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0))) + || (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0)) + && QGLFramebufferObject::hasOpenGLFramebufferObjects()) { glWidget.makeCurrent(); if (!QByteArray((const char *)glGetString(GL_VERSION)).contains("Mesa")) @@ -272,13 +273,13 @@ ImageItem tst_Lancelot::render(const ImageItem &item) } else if (item.engine == ImageItem::OpenGL) { QGLWidget glWidget; if (glWidget.isValid()) { - glWidget.resize(800, 800); - glWidget.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&glWidget); -#endif - paint(&glWidget, script, QFileInfo(filePath).absoluteFilePath()); // eh yuck (filePath stuff) - res.image = glWidget.grabFrameBuffer().convertToFormat(item.renderFormat); + glWidget.makeCurrent(); + QGLFramebufferObjectFormat fboFormat; + fboFormat.setSamples(16); + fboFormat.setAttachment(QGLFramebufferObject::CombinedDepthStencil); + QGLFramebufferObject fbo(800, 800, fboFormat); + paint(&fbo, script, QFileInfo(filePath).absoluteFilePath()); // eh yuck (filePath stuff) + res.image = fbo.toImage().convertToFormat(item.renderFormat); res.imageChecksums.append(ImageItem::computeChecksum(res.image)); } } @@ -290,6 +291,7 @@ void tst_Lancelot::paint(QPaintDevice *device, const QStringList &script, const { QPainter p(device); PaintCommands pcmd(script, 800, 800); + pcmd.setType(ImageType); pcmd.setPainter(&p); pcmd.setFilePath(filePath); pcmd.runCommands(); -- cgit v0.12 From 8f82eb0dd996fe312192199b11abbba2b01943f0 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Wed, 6 Oct 2010 15:17:57 +0200 Subject: Added a project file for the Getting Started with QML and changed the old file name references. --- doc/src/getting-started/gettingstartedqml.qdoc | 4 ++-- .../gettingStarted/gsQml/filedialog/cppPlugins.pro | 17 ----------------- .../gettingStarted/gsQml/filedialog/filedialog.pro | 17 +++++++++++++++++ examples/tutorials/gettingStarted/gsQml/texteditor.pro | 4 ++++ 4 files changed, 23 insertions(+), 19 deletions(-) delete mode 100644 examples/tutorials/gettingStarted/gsQml/filedialog/cppPlugins.pro create mode 100644 examples/tutorials/gettingStarted/gsQml/filedialog/filedialog.pro create mode 100644 examples/tutorials/gettingStarted/gsQml/texteditor.pro diff --git a/doc/src/getting-started/gettingstartedqml.qdoc b/doc/src/getting-started/gettingstartedqml.qdoc index 0ebb448..065628a 100644 --- a/doc/src/getting-started/gettingstartedqml.qdoc +++ b/doc/src/getting-started/gettingstartedqml.qdoc @@ -655,7 +655,7 @@ directory. \code - In cppPlugins.pro: + In filedialog.pro: TEMPLATE = lib CONFIG += qt plugin @@ -881,7 +881,7 @@ text files is in the application directory, get the file's name and content as a string, and be notified whenever there are changes in the directory contents. - To build the plugin, run \c qmake on the \c cppPlugins.pro project file, then run + To build the plugin, run \c qmake on the \c filedialog.pro project file, then run \c make to build and transfer the plugin to the \c plugins directory. diff --git a/examples/tutorials/gettingStarted/gsQml/filedialog/cppPlugins.pro b/examples/tutorials/gettingStarted/gsQml/filedialog/cppPlugins.pro deleted file mode 100644 index d85787d..0000000 --- a/examples/tutorials/gettingStarted/gsQml/filedialog/cppPlugins.pro +++ /dev/null @@ -1,17 +0,0 @@ -TEMPLATE = lib -CONFIG += qt plugin -QT += declarative - -DESTDIR += ../plugins -OBJECTS_DIR = tmp -MOC_DIR = tmp - -TARGET = FileDialog - -HEADERS += directory.h \ - file.h \ - dialogPlugin.h - -SOURCES += directory.cpp \ - file.cpp \ - dialogPlugin.cpp diff --git a/examples/tutorials/gettingStarted/gsQml/filedialog/filedialog.pro b/examples/tutorials/gettingStarted/gsQml/filedialog/filedialog.pro new file mode 100644 index 0000000..d85787d --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/filedialog/filedialog.pro @@ -0,0 +1,17 @@ +TEMPLATE = lib +CONFIG += qt plugin +QT += declarative + +DESTDIR += ../plugins +OBJECTS_DIR = tmp +MOC_DIR = tmp + +TARGET = FileDialog + +HEADERS += directory.h \ + file.h \ + dialogPlugin.h + +SOURCES += directory.cpp \ + file.cpp \ + dialogPlugin.cpp diff --git a/examples/tutorials/gettingStarted/gsQml/texteditor.pro b/examples/tutorials/gettingStarted/gsQml/texteditor.pro new file mode 100644 index 0000000..aa5306c --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/texteditor.pro @@ -0,0 +1,4 @@ +TEMPLATE = subdirs +SUBDIRS = \ + filedialog\ + -- cgit v0.12 From 1c23776a78801d9466fa85af36919125de12a77f Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Wed, 6 Oct 2010 16:06:23 +0200 Subject: Doc: Fix broken links in QSslConfiguration Task-number: QTBUG-14213 Reviewed-by: David Boddie --- src/network/ssl/qsslconfiguration.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/network/ssl/qsslconfiguration.cpp b/src/network/ssl/qsslconfiguration.cpp index f8f67bb..1760b53 100644 --- a/src/network/ssl/qsslconfiguration.cpp +++ b/src/network/ssl/qsslconfiguration.cpp @@ -485,9 +485,10 @@ void QSslConfiguration::setCiphers(const QList &ciphers) /*! Returns this connection's CA certificate database. The CA certificate database is used by the socket during the handshake phase to - validate the peer's certificate. It can be moodified prior to the - handshake with addCaCertificate(), addCaCertificates(), and - setCaCertificates(). + validate the peer's certificate. It can be modified prior to the + handshake with setCaCertificates(), or with \l{QSslSocket}'s + \l{QSslSocket::}{addCaCertificate()} and + \l{QSslSocket::}{addCaCertificates()}. \sa setCaCertificates() */ -- cgit v0.12 From d0cefe5e80259f089cba73e98610a6bbf93f706a Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Wed, 6 Oct 2010 16:08:52 +0200 Subject: Doc: Fixed doc references to non-existing API Task-number: QTBUG-13632 Reviewed-by: David Boddie --- src/corelib/kernel/qabstractitemmodel.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp index 9a99ea1..6e37aee 100644 --- a/src/corelib/kernel/qabstractitemmodel.cpp +++ b/src/corelib/kernel/qabstractitemmodel.cpp @@ -1336,14 +1336,13 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent, layoutChanged(). In other words, when the structure changes: \list - \o Call beginLayoutChanged() + \o emit layoutAboutToBeChanged \o Remember the QModelIndex that will change \o Update your internal data \o Call changePersistentIndex() - \o Call endLayoutChanged() + \o emit layoutChanged \endlist - \sa layoutAboutToBeChanged(), dataChanged(), headerDataChanged(), modelReset(), changePersistentIndex() */ -- cgit v0.12 From 96226ad15202770f72e257d1a75654be9582326c Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 6 Oct 2010 16:43:06 +0200 Subject: Doc: Added missing examples and snippets. Task-number: QTBUG-14238 --- .../gettingStarted/gsQml/parts/part0/Button.qml | 55 +++++ .../gettingStarted/gsQml/parts/part1/Button.qml | 97 +++++++++ .../gettingStarted/gsQml/parts/part1/EditMenu.qml | 76 +++++++ .../gettingStarted/gsQml/parts/part1/FileMenu.qml | 91 ++++++++ .../gsQml/parts/part1/SimpleButton.qml | 73 +++++++ .../parts/part1/pics/qml-texteditor1_button.png | Bin 0 -> 1670 bytes .../parts/part1/pics/qml-texteditor1_editmenu.png | Bin 0 -> 6177 bytes .../parts/part1/pics/qml-texteditor1_filemenu.png | Bin 0 -> 6062 bytes .../part1/pics/qml-texteditor1_simplebutton.png | Bin 0 -> 1055 bytes .../gsQml/parts/part1/qml-texteditor.qmlproject | 16 ++ .../gettingStarted/gsQml/parts/part2/Button.qml | 99 +++++++++ .../gettingStarted/gsQml/parts/part2/EditMenu.qml | 77 +++++++ .../gettingStarted/gsQml/parts/part2/FileMenu.qml | 92 ++++++++ .../gettingStarted/gsQml/parts/part2/MenuBar.qml | 140 +++++++++++++ .../parts/part2/pics/qml-texteditor2_menubar.png | Bin 0 -> 6079 bytes .../gsQml/parts/part2/qml-texteditor2.qmlproject | 16 ++ .../gettingStarted/gsQml/parts/part3/Button.qml | 99 +++++++++ .../gettingStarted/gsQml/parts/part3/EditMenu.qml | 77 +++++++ .../gettingStarted/gsQml/parts/part3/FileMenu.qml | 92 ++++++++ .../gettingStarted/gsQml/parts/part3/MenuBar.qml | 140 +++++++++++++ .../gettingStarted/gsQml/parts/part3/TextArea.qml | 80 +++++++ .../gsQml/parts/part3/TextEditor.qml | 68 ++++++ .../gsQml/parts/part3/images/arrow.png | Bin 0 -> 583 bytes .../part3/pics/qml-texteditor3_texteditor.png | Bin 0 -> 59345 bytes .../gsQml/parts/part3/qml-texteditor3.qmlproject | 16 ++ .../gettingStarted/gsQml/parts/part4/Button.qml | 109 ++++++++++ .../gettingStarted/gsQml/parts/part4/EditMenu.qml | 81 +++++++ .../gettingStarted/gsQml/parts/part4/FileMenu.qml | 96 +++++++++ .../gettingStarted/gsQml/parts/part4/MenuBar.qml | 146 +++++++++++++ .../gsQml/parts/part4/SimpleButton.qml | 59 ++++++ .../gettingStarted/gsQml/parts/part4/TextArea.qml | 80 +++++++ .../gsQml/parts/part4/TextEditor.qml | 146 +++++++++++++ .../gsQml/parts/part4/images/arrow.png | Bin 0 -> 583 bytes .../part4/pics/qml-texteditor4_texteditor.png | Bin 0 -> 63629 bytes .../gsQml/parts/part4/qml-texteditor4.qmlproject | 16 ++ .../gsQml/parts/part5/TextEditor.qml | 127 +++++++++++ .../gsQml/parts/part5/core/Button.qml | 109 ++++++++++ .../gsQml/parts/part5/core/EditMenu.qml | 110 ++++++++++ .../gsQml/parts/part5/core/FileDialog.qml | 170 +++++++++++++++ .../gsQml/parts/part5/core/FileMenu.qml | 232 +++++++++++++++++++++ .../gsQml/parts/part5/core/MenuBar.qml | 148 +++++++++++++ .../gsQml/parts/part5/core/TextArea.qml | 86 ++++++++ .../gettingStarted/gsQml/parts/part5/core/qmldir | 13 ++ .../gsQml/parts/part5/filedialog/cppPlugins.pro | 17 ++ .../gsQml/parts/part5/filedialog/dialogPlugin.cpp | 57 +++++ .../gsQml/parts/part5/filedialog/dialogPlugin.h | 57 +++++ .../gsQml/parts/part5/filedialog/directory.cpp | 219 +++++++++++++++++++ .../gsQml/parts/part5/filedialog/directory.h | 108 ++++++++++ .../gsQml/parts/part5/filedialog/file.cpp | 56 +++++ .../gsQml/parts/part5/filedialog/file.h | 67 ++++++ .../gsQml/parts/part5/filedialog/qmldir | 1 + .../gsQml/parts/part5/images/arrow.png | Bin 0 -> 583 bytes .../parts/part5/pics/qml-texteditor5_editmenu.png | Bin 0 -> 65123 bytes .../parts/part5/pics/qml-texteditor5_filemenu.png | Bin 0 -> 21367 bytes .../parts/part5/pics/qml-texteditor5_newfile.png | Bin 0 -> 76693 bytes .../gsQml/parts/part5/qml-texteditor5.qmlproject | 18 ++ 56 files changed, 3732 insertions(+) create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part0/Button.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/Button.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/EditMenu.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/FileMenu.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/SimpleButton.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_button.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_editmenu.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_filemenu.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_simplebutton.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/qml-texteditor.qmlproject create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part2/Button.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part2/EditMenu.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part2/FileMenu.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part2/MenuBar.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part2/pics/qml-texteditor2_menubar.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part2/qml-texteditor2.qmlproject create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/Button.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/EditMenu.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/FileMenu.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/MenuBar.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/TextArea.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/TextEditor.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/images/arrow.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/pics/qml-texteditor3_texteditor.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/qml-texteditor3.qmlproject create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/Button.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/EditMenu.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/FileMenu.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/MenuBar.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/SimpleButton.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/TextArea.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/TextEditor.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/images/arrow.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/pics/qml-texteditor4_texteditor.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/qml-texteditor4.qmlproject create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/TextEditor.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/core/Button.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/core/EditMenu.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/core/FileDialog.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/core/FileMenu.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/core/MenuBar.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/core/TextArea.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/core/qmldir create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/cppPlugins.pro create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.cpp create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.h create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.cpp create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.h create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.cpp create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.h create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/qmldir create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/images/arrow.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_editmenu.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_filemenu.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_newfile.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/qml-texteditor5.qmlproject diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part0/Button.qml b/examples/tutorials/gettingStarted/gsQml/parts/part0/Button.qml new file mode 100644 index 0000000..ffd4be4 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part0/Button.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import QtQuick 1.0 + +Rectangle { + id: simplebutton + color: "grey" + width: 150; height: 75 + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: "button label" + } +} +//! [document] diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/Button.qml b/examples/tutorials/gettingStarted/gsQml/parts/part1/Button.qml new file mode 100644 index 0000000..bb70cfd --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part1/Button.qml @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + + //identifier of the item + id: button + + property string label: "button label" + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "gold" + property color borderColor: "white" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + //set appearance properties + radius: 10 + smooth: true + border{color: "white"; width: 3} + width: buttonWidth; height: buttonHeight + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: label + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + onButtonClick: { + console.log(buttonLabel.text + " clicked" ) + } + + //define the clickable area to be the whole rectangle + MouseArea{ + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/EditMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part1/EditMenu.qml new file mode 100644 index 0000000..460f5e9 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part1/EditMenu.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: editMenu + height: 480; width:1000 + color: "powderblue" + property string menuName:"Edit" + + Rectangle{ + id:actionContainer + color:"transparent" + anchors.centerIn: parent + + width: parent.width; height: parent.height / 5 + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Cut" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Paste" + } + Button{ + id: exitButton + label: "Select All" + buttonColor: "darkgrey" + } + } + } +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/FileMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part1/FileMenu.qml new file mode 100644 index 0000000..65de4f1 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part1/FileMenu.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: fileMenu + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //generous amount of screen space that will allow the buttons to fit + height: 480; width:1000 + + color: "#6C646A" + + //a sub-rectangle allows the flexibility of setting the row area + Rectangle{ + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.centerIn: parent + + //the height is a good proportion that creates more space at the top of the row of buttons + width: parent.width; height: parent.height / 5 + + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Load" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Save" + } + Button{ + id: exitButton + label: "Exit" + buttonColor: "darkgrey" + + //exit the application if the exitButton is clicked + onButtonClick:{ + Qt.quit() + } + } + } + } +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/SimpleButton.qml b/examples/tutorials/gettingStarted/gsQml/parts/part1/SimpleButton.qml new file mode 100644 index 0000000..5bb50f8 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part1/SimpleButton.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + + //identifier of the item + id: simplebutton + + //the rectangle's fill color + color: "grey" + + //dimensions of the button + width: 150; height: 75 + + //A text element contains functionalities for creating texts + Text { + id: buttonLabel + + //center the text inside the parent + anchors.centerIn: parent + + //text property binds to the label displayed on the button + text: "button label" + } + + //define the clickable area to be the whole rectangle + MouseArea { + id: buttonMouseArea + anchors.fill: parent //anchor all sides of the mouse area to the rectangle's anchors + + //onClicked handles valid mouse button clicks + onClicked: console.log(buttonLabel.text + " clicked" ) + } +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_button.png b/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_button.png new file mode 100644 index 0000000..aab64bc Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_button.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_editmenu.png b/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_editmenu.png new file mode 100644 index 0000000..d3ff66f Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_editmenu.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_filemenu.png b/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_filemenu.png new file mode 100644 index 0000000..f2e2b0d Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_filemenu.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_simplebutton.png b/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_simplebutton.png new file mode 100644 index 0000000..21ce509 Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_simplebutton.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/qml-texteditor.qmlproject b/examples/tutorials/gettingStarted/gsQml/parts/part1/qml-texteditor.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part1/qml-texteditor.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part2/Button.qml b/examples/tutorials/gettingStarted/gsQml/parts/part2/Button.qml new file mode 100644 index 0000000..39ac591 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part2/Button.qml @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + + //identifier of the item + id: button + + property string label: "button label" + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "gold" + property color borderColor: "white" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + //set appearance properties + radius:10 + smooth: true + border{color: "white"; width: 3} + width: buttonWidth; height: buttonHeight + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: label + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + onButtonClick: { + console.log(buttonLabel.text + " clicked" ) + } + + //define the clickable area to be the whole rectangle + MouseArea{ + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part2/EditMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part2/EditMenu.qml new file mode 100644 index 0000000..fdd06d5 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part2/EditMenu.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: editMenu + height: 480; width:1000 + color: "powderblue" + property string menuName:"Edit" + + Rectangle{ + id:actionContainer + color:"transparent" + anchors.centerIn: parent + + width: parent.width; height: parent.height / 5 + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Cut" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Paste" + } + Button{ + id: exitButton + label: "Select All" + buttonColor: "darkgrey" + } + } + } + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part2/FileMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part2/FileMenu.qml new file mode 100644 index 0000000..bd6669b --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part2/FileMenu.qml @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: fileMenu + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //generous amount of screen space that will allow the buttons to fit + height: 480; width:1000 + + color: "#6C646A" + + //a sub-rectangle allows the flexibility of setting the row area + Rectangle{ + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.centerIn: parent + + //the height is a good proportion that creates more space at the top of the row of buttons + width: parent.width; height: parent.height / 5 + + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Load" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Save" + } + Button{ + id: exitButton + label: "Exit" + buttonColor: "darkgrey" + + //exit the application if the exitButton is clicked + onButtonClick:{ + Qt.quit() + } + } + } + } + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part2/MenuBar.qml b/examples/tutorials/gettingStarted/gsQml/parts/part2/MenuBar.qml new file mode 100644 index 0000000..8065804 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part2/MenuBar.qml @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: menuBar + width: 1000 + height:300 + + property color fileColor: "thistle" + property color editColor: "powderblue" + + //container for the header and the buttons + Rectangle{ + + id: labelList + height:parent.height/10 + width: parent.width + color: "steelblue" + + //default z is 0, items with higher z values are shown on top of items with lower z values + z: 1 + + //row displays its children in a vertical row + Row{ + anchors.centerIn: parent + spacing:40 + Button{ + height: 20 + width: 50 + label: "File" + id: fileButton + buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) + scale: menuListView.currentIndex == 0? 1.25: 1 + radius: 1 + + //on a button click, change the list's currently selected item to FileMenu + onButtonClick: { + menuListView.currentIndex = 0 + } + } + Button{ + height: 20 + width: 50 + id: editButton + buttonColor : menuListView.currentIndex == 1? editColor : Qt.darker(editColor, 1.5) + scale: menuListView.currentIndex == 1? 1.25: 1 + label: "Edit" + radius: 1 + + //on a button click, change the list's currently selected item to EditMenu + onButtonClick: { + menuListView.currentIndex = 1 + } + + + } + + + } + } + + //a list of visual items already have delegates handling their display + VisualItemModel{ + id: menuListModel + + FileMenu{ + width: menuListView.width + height: menuBar.height + color: fileColor + } + EditMenu{ + color: editColor + width: menuListView.width + height: menuBar.height + + } + } + + //list view will display a model according to a delegate + ListView{ + id: menuListView + anchors.fill:parent + anchors.bottom: parent.bottom + width:parent.width + height: parent.height + + //the model contains the data + model: menuListModel + + //control the movement of the menu switching + snapMode: ListView.SnapOneItem + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickDeceleration: 5000 + highlightFollowsCurrentItem: true + highlightMoveDuration:240 + highlightRangeMode: ListView.StrictlyEnforceRange + } + + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part2/pics/qml-texteditor2_menubar.png b/examples/tutorials/gettingStarted/gsQml/parts/part2/pics/qml-texteditor2_menubar.png new file mode 100644 index 0000000..da959a3 Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part2/pics/qml-texteditor2_menubar.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part2/qml-texteditor2.qmlproject b/examples/tutorials/gettingStarted/gsQml/parts/part2/qml-texteditor2.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part2/qml-texteditor2.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/Button.qml b/examples/tutorials/gettingStarted/gsQml/parts/part3/Button.qml new file mode 100644 index 0000000..39ac591 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part3/Button.qml @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + + //identifier of the item + id: button + + property string label: "button label" + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "gold" + property color borderColor: "white" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + //set appearance properties + radius:10 + smooth: true + border{color: "white"; width: 3} + width: buttonWidth; height: buttonHeight + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: label + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + onButtonClick: { + console.log(buttonLabel.text + " clicked" ) + } + + //define the clickable area to be the whole rectangle + MouseArea{ + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/EditMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part3/EditMenu.qml new file mode 100644 index 0000000..fdd06d5 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part3/EditMenu.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: editMenu + height: 480; width:1000 + color: "powderblue" + property string menuName:"Edit" + + Rectangle{ + id:actionContainer + color:"transparent" + anchors.centerIn: parent + + width: parent.width; height: parent.height / 5 + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Cut" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Paste" + } + Button{ + id: exitButton + label: "Select All" + buttonColor: "darkgrey" + } + } + } + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/FileMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part3/FileMenu.qml new file mode 100644 index 0000000..bd6669b --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part3/FileMenu.qml @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: fileMenu + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //generous amount of screen space that will allow the buttons to fit + height: 480; width:1000 + + color: "#6C646A" + + //a sub-rectangle allows the flexibility of setting the row area + Rectangle{ + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.centerIn: parent + + //the height is a good proportion that creates more space at the top of the row of buttons + width: parent.width; height: parent.height / 5 + + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Load" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Save" + } + Button{ + id: exitButton + label: "Exit" + buttonColor: "darkgrey" + + //exit the application if the exitButton is clicked + onButtonClick:{ + Qt.quit() + } + } + } + } + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/MenuBar.qml b/examples/tutorials/gettingStarted/gsQml/parts/part3/MenuBar.qml new file mode 100644 index 0000000..8065804 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part3/MenuBar.qml @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: menuBar + width: 1000 + height:300 + + property color fileColor: "thistle" + property color editColor: "powderblue" + + //container for the header and the buttons + Rectangle{ + + id: labelList + height:parent.height/10 + width: parent.width + color: "steelblue" + + //default z is 0, items with higher z values are shown on top of items with lower z values + z: 1 + + //row displays its children in a vertical row + Row{ + anchors.centerIn: parent + spacing:40 + Button{ + height: 20 + width: 50 + label: "File" + id: fileButton + buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) + scale: menuListView.currentIndex == 0? 1.25: 1 + radius: 1 + + //on a button click, change the list's currently selected item to FileMenu + onButtonClick: { + menuListView.currentIndex = 0 + } + } + Button{ + height: 20 + width: 50 + id: editButton + buttonColor : menuListView.currentIndex == 1? editColor : Qt.darker(editColor, 1.5) + scale: menuListView.currentIndex == 1? 1.25: 1 + label: "Edit" + radius: 1 + + //on a button click, change the list's currently selected item to EditMenu + onButtonClick: { + menuListView.currentIndex = 1 + } + + + } + + + } + } + + //a list of visual items already have delegates handling their display + VisualItemModel{ + id: menuListModel + + FileMenu{ + width: menuListView.width + height: menuBar.height + color: fileColor + } + EditMenu{ + color: editColor + width: menuListView.width + height: menuBar.height + + } + } + + //list view will display a model according to a delegate + ListView{ + id: menuListView + anchors.fill:parent + anchors.bottom: parent.bottom + width:parent.width + height: parent.height + + //the model contains the data + model: menuListModel + + //control the movement of the menu switching + snapMode: ListView.SnapOneItem + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickDeceleration: 5000 + highlightFollowsCurrentItem: true + highlightMoveDuration:240 + highlightRangeMode: ListView.StrictlyEnforceRange + } + + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/TextArea.qml b/examples/tutorials/gettingStarted/gsQml/parts/part3/TextArea.qml new file mode 100644 index 0000000..b0bf664 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part3/TextArea.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id:textArea + + width :400 + height:400 + color: "white" + + Flickable{ + id: flickArea + + width: parent.width + height: parent.height + anchors.fill:parent + + function ensureVisible(r){ + if (contentX >= r.x) + contentX = r.x; + else if (contentX+width <= r.x+r.width) + contentX = r.x+r.width-width; + if (contentY >= r.y) + contentY = r.y; + else if (contentY+height <= r.y+r.height) + contentY = r.y+r.height-height; + } + + TextEdit{ + id: textEditor + anchors.fill:parent + width:parent.width; height:parent.height + color:"midnightblue" + focus: true + + wrapMode: TextEdit.Wrap + + onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) + } + } +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/TextEditor.qml b/examples/tutorials/gettingStarted/gsQml/parts/part3/TextEditor.qml new file mode 100644 index 0000000..7f0e650 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part3/TextEditor.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + + id: screen + width: 1000; height: 1000 + border.color:"black" + //the screen is partitioned into the MenuBar and TextArea. 1/3 of the screen is assigned to the MenuBar + property int partition: height/3 + + MenuBar{ + id:menuBar + height: partition + width:parent.width + z: 1 + } + + + TextArea{ + id:textArea + anchors.bottom:parent.bottom + y: partition + color: "azure" + height: partition*2 + width:parent.width + } + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/images/arrow.png b/examples/tutorials/gettingStarted/gsQml/parts/part3/images/arrow.png new file mode 100644 index 0000000..14978c2 Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part3/images/arrow.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/pics/qml-texteditor3_texteditor.png b/examples/tutorials/gettingStarted/gsQml/parts/part3/pics/qml-texteditor3_texteditor.png new file mode 100644 index 0000000..d0623b5 Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part3/pics/qml-texteditor3_texteditor.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/qml-texteditor3.qmlproject b/examples/tutorials/gettingStarted/gsQml/parts/part3/qml-texteditor3.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part3/qml-texteditor3.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/Button.qml b/examples/tutorials/gettingStarted/gsQml/parts/part4/Button.qml new file mode 100644 index 0000000..36833f5 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part4/Button.qml @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + + //identifier of the item + id: button + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //attaches to the Text element's text content + property string label + property color textColor: buttonLabel.color + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "gold" + property color borderColor: "white" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + //set appearance properties + radius:10 + smooth: true + border.color: "white" + border.width: 3 + width: buttonWidth; height: buttonHeight + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: label //"button label" //bind the text to the parent's text + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + onButtonClick: { + console.log(buttonLabel.text + " clicked" ) + } + + //define the clickable area to be the whole rectangle + MouseArea{ + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor + //animate the color whenever the color property changes + Behavior on color { ColorAnimation{ duration: 55} } + + //scale the button when pressed + scale: buttonMouseArea.pressed ? 1.1 : 1.00 + //Animate the scale property change + Behavior on scale { NumberAnimation{ duration: 55} } + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/EditMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part4/EditMenu.qml new file mode 100644 index 0000000..f0a0e36 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part4/EditMenu.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: editMenu + height: 480; width:1000 + color: "powderblue" + property string menuName:"Edit" + gradient: Gradient{ + GradientStop { position: 0.0; color: "#6A6F70" } + GradientStop { position: 1.0; color: Qt.darker("#6A6D67") } + } + + Rectangle{ + id:actionContainer + color:"transparent" + anchors.centerIn: parent + + width: parent.width; height: parent.height / 5 + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Cut" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Paste" + } + Button{ + id: exitButton + label: "Select All" + buttonColor: "darkgrey" + } + } + } + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/FileMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part4/FileMenu.qml new file mode 100644 index 0000000..d257d6a --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part4/FileMenu.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: fileMenu + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //generous amount of screen space that will allow the buttons to fit + height: 480; width:1000 + + color: "#6C646A" + gradient: Gradient{ + GradientStop { position: 0.0; color: "#6C646A" } + GradientStop { position: 1.0; color: Qt.darker("#6A6D6A") } + } + + //a sub-rectangle allows the flexibility of setting the row area + Rectangle{ + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.centerIn: parent + + //the height is a good proportion that creates more space at the top of the row of buttons + width: parent.width; height: parent.height / 5 + + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Load" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Save" + } + Button{ + id: exitButton + label: "Exit" + buttonColor: "darkgrey" + + //exit the application if the exitButton is clicked + onButtonClick:{ + Qt.quit() + } + } + } + } + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/MenuBar.qml b/examples/tutorials/gettingStarted/gsQml/parts/part4/MenuBar.qml new file mode 100644 index 0000000..5b0dbf8 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part4/MenuBar.qml @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: menuBar + width: 1000 + height:300 + + property color fileColor: "plum" + property color editColor: "powderblue" + + //container for the header and the buttons + Rectangle{ + + id: labelList + height:parent.height/10 + width: parent.width + color: "beige" + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.98;color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#0e1B20" } + } + + //default z is 0, items with higher z values are shown on top of items with lower z values + z: 1 + + //row displays its children in a vertical row + Row{ + anchors.centerIn: parent + spacing:40 + Button{ + height: 20 + width: 50 + label: "File" + id: fileButton + buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) + scale: menuListView.currentIndex == 0? 1.25: 1 + radius: 1 + + //on a button click, change the list's currently selected item to FileMenu + onButtonClick: { + menuListView.currentIndex = 0 + } + } + Button{ + height: 20 + width: 50 + id: editButton + buttonColor : menuListView.currentIndex == 1? editColor : Qt.darker(editColor, 1.5) + scale: menuListView.currentIndex == 1? 1.25: 1 + label: "Edit" + radius: 1 + + //on a button click, change the list's currently selected item to EditMenu + onButtonClick: { + menuListView.currentIndex = 1 + } + + + } + + + } + } + + //a list of visual items already have delegates handling their display + VisualItemModel{ + id: menuListModel + + FileMenu{ + width: menuListView.width + height: menuBar.height + color: fileColor + } + EditMenu{ + color: editColor + width: menuListView.width + height: menuBar.height + + } + } + + //list view will display a model according to a delegate + ListView{ + id: menuListView + anchors.fill:parent + anchors.bottom: parent.bottom + width:parent.width + height: parent.height + + //the model contains the data + model: menuListModel + + //control the movement of the menu switching + snapMode: ListView.SnapOneItem + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickDeceleration: 5000 + highlightFollowsCurrentItem: true + highlightMoveDuration:240 + highlightRangeMode: ListView.StrictlyEnforceRange + } + + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/SimpleButton.qml b/examples/tutorials/gettingStarted/gsQml/parts/part4/SimpleButton.qml new file mode 100644 index 0000000..d360faa --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part4/SimpleButton.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: simplebutton + color: "grey" + width: 150; height: 75 + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: "button label" + } + + MouseArea{ + id: buttonMouseArea + anchors.fill: parent + onClicked: console.log(buttonLabel.text + " clicked" ) + } +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/TextArea.qml b/examples/tutorials/gettingStarted/gsQml/parts/part4/TextArea.qml new file mode 100644 index 0000000..4eedf34 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part4/TextArea.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id:textArea + + width :400 + height:400 + property color fontColor: "white" + + Flickable{ + id: flickArea + + width: parent.width + height: parent.height + anchors.fill:parent + + function ensureVisible(r){ + if (contentX >= r.x) + contentX = r.x; + else if (contentX+width <= r.x+r.width) + contentX = r.x+r.width-width; + if (contentY >= r.y) + contentY = r.y; + else if (contentY+height <= r.y+r.height) + contentY = r.y+r.height-height; + } + + TextEdit{ + id: textEditor + anchors.fill:parent + width:parent.width; height:parent.height + color:fontColor + focus: true + + wrapMode: TextEdit.Wrap + + onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) + } + } +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/TextEditor.qml b/examples/tutorials/gettingStarted/gsQml/parts/part4/TextEditor.qml new file mode 100644 index 0000000..d218bba --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part4/TextEditor.qml @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: screen + width: 1000; height: 1000 + property int partition: height/3 + state: "DRAWER_CLOSED" + + + //Item 1: MenuBar on the top portion of the screen + MenuBar{ + id:menuBar + height: partition + //anchors.top:parent.top + width:parent.width + z:1 + } + + + //Item 2: The editable text area + TextArea{ + id:textArea + y:drawer.height + border.color: Qt.darker(color, 1.4) + border.width: 2 + color: "#3F3F3F" + fontColor: "#DCDCCC" + height: partition*2 + width:parent.width + } + + //Item 3: The drawer handle + Rectangle{ + id:drawer + height:15 + width: parent.width + border.color : "#6A6D6A" + border.width: 1 + + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.77; color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#6A6D6A" } + } + + Image{ + id: arrowIcon + source: "images/arrow.png" + anchors.horizontalCenter: parent.horizontalCenter + + Behavior{NumberAnimation{property: "rotation";easing.type: Easing.OutExpo }} + } + + MouseArea{ + id: drawerMouseArea + anchors.fill:parent + onClicked:{ + if (screen.state == "DRAWER_CLOSED"){ + screen.state = "DRAWER_OPEN" + console.log("drawer OPEN") + } + else if (screen.state == "DRAWER_OPEN"){ + screen.state = "DRAWER_CLOSED" + console.log("drawer closed") + } + } + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = Qt.lighter("#6A6D6A") + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = "#6A6D6A" + } + + } + states:[ + State{ + name: "DRAWER_OPEN" + PropertyChanges { target: menuBar; y:0} + PropertyChanges { target: textArea; y: partition + drawer.height} + PropertyChanges { target: drawer; y: partition} + PropertyChanges { target: arrowIcon; rotation: 180} + }, + State{ + name: "DRAWER_CLOSED" + PropertyChanges { target: menuBar; y:-partition} + PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height} + PropertyChanges { target: drawer; y: 0} + PropertyChanges { target: arrowIcon; rotation: 0} + } + + ] + transitions: [ + Transition{ + to: "*" + NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type:Easing.OutExpo } + NumberAnimation { target: menuBar; properties: "y"; duration: 100;easing.type: Easing.OutExpo } + NumberAnimation { target: drawer; properties: "y"; duration: 100;easing.type: Easing.OutExpo } + } + + ] +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/images/arrow.png b/examples/tutorials/gettingStarted/gsQml/parts/part4/images/arrow.png new file mode 100644 index 0000000..14978c2 Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part4/images/arrow.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/pics/qml-texteditor4_texteditor.png b/examples/tutorials/gettingStarted/gsQml/parts/part4/pics/qml-texteditor4_texteditor.png new file mode 100644 index 0000000..a195fb8 Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part4/pics/qml-texteditor4_texteditor.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/qml-texteditor4.qmlproject b/examples/tutorials/gettingStarted/gsQml/parts/part4/qml-texteditor4.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part4/qml-texteditor4.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/TextEditor.qml b/examples/tutorials/gettingStarted/gsQml/parts/part5/TextEditor.qml new file mode 100644 index 0000000..4adcf05 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/TextEditor.qml @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "core" + +Rectangle { + id: screen + width: 1000; height: 1000 + property int partition: height/3 + state: "DRAWER_CLOSED" + + //Item 1: MenuBar on the top portion of the screen + MenuBar{ + id:menuBar + height: screen.partition; width: screen.width + z:1 + } + //Item 2: The editable text area + TextArea{ + id:textArea + y:drawer.height + color: "#3F3F3F" + fontColor: "#DCDCCC" + height: partition*2; width:parent.width + } + //Item 3: The drawer handle + Rectangle{ + id:drawer + height:15; width: parent.width + border.color : "#6A6D6A" + border.width: 1 + z:1 + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.77; color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#6A6D6A" } + } + Image{ + id: arrowIcon + source: "images/arrow.png" + anchors.horizontalCenter: parent.horizontalCenter + + Behavior{NumberAnimation{property: "rotation";easing.type: Easing.OutExpo }} + } + + MouseArea{ + id: drawerMouseArea + anchors.fill:parent + hoverEnabled: true + onEntered: parent.border.color = Qt.lighter("#6A6D6A") + onExited: parent.border.color = "#6A6D6A" + onClicked:{ + if (screen.state == "DRAWER_CLOSED"){ + screen.state = "DRAWER_OPEN" + } + else if (screen.state == "DRAWER_OPEN"){ + screen.state = "DRAWER_CLOSED" + } + } + } + } + + states:[ + State{ + name: "DRAWER_OPEN" + PropertyChanges { target: menuBar; y: 0} + PropertyChanges { target: textArea; y: partition + drawer.height} + PropertyChanges { target: drawer; y: partition} + PropertyChanges { target: arrowIcon; rotation: 180} + }, + State{ + name: "DRAWER_CLOSED" + PropertyChanges { target: menuBar; y:-height; } + PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height} + PropertyChanges { target: drawer; y: 0} + PropertyChanges { target: arrowIcon; rotation: 0} + } + ] + + transitions: [ + Transition{ + to: "*" + NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type:Easing.OutExpo } + NumberAnimation { target: menuBar; properties: "y"; duration: 100;easing.type: Easing.OutExpo } + NumberAnimation { target: drawer; properties: "y"; duration: 100;easing.type: Easing.OutExpo } + } + ] +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/Button.qml b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/Button.qml new file mode 100644 index 0000000..c0c1f77 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/Button.qml @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + + //identifier of the item + id: button + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //attaches to the Text element's text content + property string label + property color textColor: buttonLabel.color + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "lightsteelblue" + property color borderColor: "transparent" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + property real labelSize: 14 + //set appearance properties + radius:6 + smooth: true + border.width: 2 + border.color: borderColor + width: buttonWidth; height: buttonHeight + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: label //bind the text to the parent's text + color: "#DCDCCC" + font.pointSize: labelSize + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + + //define the clickable area to be the whole rectangle + MouseArea{ + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor + //animate the color whenever the color property changes + Behavior on color { ColorAnimation{ duration: 55} } + + //scale the button when pressed + scale: buttonMouseArea.pressed ? 1.1 : 1.00 + //Animate the scale property change + Behavior on scale { NumberAnimation{ duration: 55} } + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/EditMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/EditMenu.qml new file mode 100644 index 0000000..4338d25 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/EditMenu.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: editMenu + height: 480; width:1000 + color: "powderblue" + property color buttonBorderColor: "#7A8182" + property color buttonFillColor: "#61BDCACD" + property string menuName:"Edit" + + gradient: Gradient{ + GradientStop { position: 0.0; color: "#6A7570" } + GradientStop { position: 1.0; color: Qt.darker("#6A7570") } + } + + Rectangle{ + id:actionContainer + color:"transparent" + anchors.centerIn: parent + width: parent.width; height: parent.height / 5 + Row{ + anchors.centerIn: parent + spacing: parent.width/9 + Button{ + id: loadButton + buttonColor: buttonFillColor + label: "Copy" + labelSize:16 + borderColor:buttonBorderColor + height: actionContainer.height + width: actionContainer.width/6 + onButtonClick:textArea.copy() + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + + Button{ + id: saveButton + height: actionContainer.height + width: actionContainer.width/6 + buttonColor: buttonFillColor + label: "Paste" + borderColor:buttonBorderColor + labelSize:16 + onButtonClick:textArea.paste() + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + Button{ + id: exitButton + label: "Select All" + height: actionContainer.height + width: actionContainer.width/6 + labelSize:16 + buttonColor: buttonFillColor + borderColor:buttonBorderColor + onButtonClick:textArea.selectAll() + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + } + } + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/FileDialog.qml b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/FileDialog.qml new file mode 100644 index 0000000..af9d82c --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/FileDialog.qml @@ -0,0 +1,170 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id:dialog + height: 200 * partition; width: 200 + color: "transparent" + + signal selectChanged() + signal notifyRefresh() + onNotifyRefresh:dirView.model = directory.files + + property string selectedFile + property int selectedIndex: 0 + + Rectangle{ + id: dirBox + radius: 10 + anchors.centerIn:parent + height: parent.height -15; width: parent.width -30 + + Rectangle{ + id:header + height:parent.height*0.1 + width: parent.width + radius:3 + z:1 + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.98;color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#0e1B20" } + } + Text{ + height: header.height + anchors.centerIn: header + text: "files:" + color: "lightblue" + font.weight: Font.Light + font.italic: true + } + } + GridView{ + id:dirView + width:parent.width + height:parent.height*.9 + anchors.top: header.bottom + cellWidth: 100 + cellHeight: 75 +// highlight: Rectangle { width:cellWidth; height: cellHeight; color: "lightsteelblue" ;radius: 13} + model: directory.files + delegate: dirDelegate + clip: true + highlightMoveDuration:40 + } + + Component{ + id:dirDelegate + + Rectangle{ + id:file + color: "transparent" + width: GridView.view.cellWidth; height: GridView.view.cellHeight + + Text{ + id:fileName + width: parent.width + anchors.centerIn:parent + text: name + color: "#BDCACD" + font.weight: GridView.view.currentIndex == index ? Font.DemiBold : Font.Normal + font.pointSize: GridView.view.currentIndex == index ? 12 : 10 + elide: Text.ElideMiddle + horizontalAlignment: Text.AlignHCenter + } + Rectangle{ + id:selection + width:parent.width; height:parent.height + anchors.centerIn: parent + radius: 10 + smooth: true + scale: GridView.view.currentIndex == index ? 1 : 0.5 + opacity: GridView.view.currentIndex == index ? 1 : 0 + Text{ + id:overlay + width: parent.width + anchors.centerIn:parent + text: name + color: "#696167" + font.weight: Font.DemiBold + font.pointSize: 12 + smooth:true + elide: Text.ElideMiddle + horizontalAlignment: Text.AlignHCenter + } + Behavior on opacity{ NumberAnimation{ duration: 45} } + Behavior on scale { NumberAnimation{ duration: 45} } + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter("lightsteelblue",1.25) } + GradientStop { position: 0.67; color: Qt.darker("lightsteelblue",1.3) } + } + border.color:"lightsteelblue" + border.width:1 + } + MouseArea{ + id:fileMouseArea + anchors.fill:parent + hoverEnabled: true + + onClicked:{ + GridView.view.currentIndex = index + selectedFile = directory.files[index].name + selectChanged() + } + onEntered:{ + fileName.color = "lightsteelblue" + fileName.font.weight = Font.DemiBold + } + onExited: { + fileName.font.weight = Font.Normal + fileName.color = "#BDCACD" + } + } + } + } + gradient: Gradient{ + GradientStop { position: 0.0; color: "#A5333333" } + GradientStop { position: 1.0; color: "#03333333" } + } + } +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/FileMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/FileMenu.qml new file mode 100644 index 0000000..1d671e4 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/FileMenu.qml @@ -0,0 +1,232 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: fileMenu + height: 480; width:1000 + property color buttonBorderColor: "#7F8487" + property color buttonFillColor: "#8FBDCACD" + property string fileContent:directory.fileContent + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //used to divide the screen into parts. + property real partition: 1/3 + + color: "#6C646A" + gradient: Gradient{ + GradientStop { position: 0.0; color: "#6C646A" } + GradientStop { position: 1.0; color: Qt.darker("#6A6D6A") } + } + + Directory{ + id:directory + filename: textInput.text + onDirectoryChanged:fileDialog.notifyRefresh() + } + + Rectangle{ + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.left: parent.left + + //the height is a good proportion that creates more space at the top of the column of buttons + width: fileMenu.width * partition; height: fileMenu.height + + Column{ + anchors.centerIn: parent + spacing: parent.height/32 + Button{ + id: saveButton + label: "Save" + borderColor: buttonBorderColor + buttonColor: buttonFillColor + width: actionContainer.width/ 1.3 + height:actionContainer.height / 8 + labelSize:24 + onButtonClick:{ + directory.fileContent = textArea.textContent + directory.filename = textInput.text + directory.saveFile() + } + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + + } + Button{ + id: loadButton + width: actionContainer.width/ 1.3 + height:actionContainer.height/ 8 + buttonColor: buttonFillColor + borderColor: buttonBorderColor + label: "Load" + labelSize:24 + onButtonClick:{ + directory.filename = textInput.text + directory.loadFile() + textArea.textContent = directory.fileContent + } + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + Button{ + id: newButton + width: actionContainer.width/ 1.3 + height:actionContainer.height/ 8 + buttonColor: buttonFillColor + borderColor: buttonBorderColor + label: "New" + labelSize:24 + onButtonClick:{ + textArea.textContent = "" + textInput.text = "" + } + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + + } + Rectangle{ + id: space + width: actionContainer.width/ 1.3 + height:actionContainer.height / 16 + color:"transparent" + } + Button{ + id: exitButton + width: actionContainer.width/ 1.3 + height:actionContainer.height/ 8 + label: "Exit" + labelSize:24 + buttonColor: buttonFillColor + borderColor: buttonBorderColor + onButtonClick:Qt.quit() + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + } + } + + Rectangle{ + id:dialogContainer + + width: 2*fileMenu.width * partition; height: fileMenu.height + anchors.right:parent.right + color:"transparent" + + Column { + anchors.centerIn: parent + spacing: parent.height /640 + FileDialog{ + id:fileDialog + height: 2*dialogContainer.height * partition; width: dialogContainer.width + onSelectChanged: textInput.text = selectedFile + } + + Rectangle{ + id:lowerPartition + height: dialogContainer.height * partition; width: dialogContainer.width + color: "transparent" + + Rectangle{ + id: nameField + gradient: Gradient{ + GradientStop { position: 0.0; color: "#806F6F6F" } + GradientStop { position: 1.0; color: "#136F6F6F" } + } + + radius: 10 + anchors {centerIn:parent; leftMargin: 15; rightMargin: 15; topMargin: 15} + height: parent.height-15; width: parent.width -20 + border {color:"#4A4A4A"; width:1} + + TextInput{ + id: textInput + z:2 + anchors {bottom: parent.bottom; topMargin: 10; horizontalCenter:parent.horizontalCenter} + width: parent.width - 10 + height: parent.height -10 + font.pointSize: 40 + color:"lightsteelblue" + focus:true + } + Text{ + id: textInstruction + anchors.centerIn:parent + text: "Select file name and press save or load" + font {pointSize: 11; weight:Font.Light; italic: true} + color: "lightblue" + z:2 + opacity: (textInput.text == "") ? 1: 0 + } + Text{ + id:fieldLabel + anchors {top: parent.top; left: parent.left} + text: " file name: " + font {pointSize: 11; weight: Font.Light; italic: true} + color: "lightblue" + z:2 + } + MouseArea{ + anchors.centerIn:parent + width: nameField.width; height: nameField.height + onClicked:{ + textInput.text = "" + textInput.focus = true + textInput.forceFocus() + } + } + } + } + } + } +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/MenuBar.qml b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/MenuBar.qml new file mode 100644 index 0000000..657e5dc --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/MenuBar.qml @@ -0,0 +1,148 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: menuBar + width: 1000; height:300 + color:"transparent" + property color fileColor: "plum" + property color editColor: "powderblue" + + property real partition: 1/10 + + Column{ + anchors.fill: parent + //container for the header and the buttons + z: 1 + Rectangle{ + id: labelList + height:menuBar.height*partition + width: menuBar.width + color: "beige" + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.98;color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#0e1B20" } + } + Text{ + height: parent.height + anchors {right: labelRow.left ; verticalCenter: parent.bottom} + text: "menu: " + color: "lightblue" + font {weight: Font.Light; italic: true} + smooth: true + } + + //row displays its children in a vertical row + Row{ + id: labelRow + anchors.centerIn: parent + spacing:40 + Button{ + id: fileButton + height: 20; width: 50 + label: "File" + buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) + scale: menuListView.currentIndex == 0? 1.25: 1 + labelSize: menuListView.currentIndex == 0? 16:12 + radius: 1 + smooth:true + //on a button click, change the list's currently selected item to FileMenu + onButtonClick: menuListView.currentIndex = 0 + gradient: Gradient{ + GradientStop { position: 0.0; color: fileColor } + GradientStop { position: 1.0; color: "#136F6F6F" } + } + } + Button{ + id: editButton + height: 20; width: 50 + buttonColor : menuListView.currentIndex == 1? Qt.darker(editColor, 1.5) : Qt.darker(editColor, 1.9) + scale: menuListView.currentIndex == 1? 1.25: 1 + label: "Edit" + radius: 1 + labelSize: menuListView.currentIndex == 1? 16:12 + smooth:true + //on a button click, change the list's currently selected item to EditMenu + onButtonClick: menuListView.currentIndex = 1 + gradient: Gradient{ + GradientStop { position: 0.0; color: editColor } + GradientStop { position: 1.0; color: "#136F6F6F" } + } + } + } + } + + //list view will display a model according to a delegate + ListView{ + id: menuListView + width:menuBar.width; height: 9*menuBar.height*partition + + //the model contains the data + model: menuListModel + + //control the movement of the menu switching + snapMode: ListView.SnapOneItem + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickDeceleration: 5000 + highlightFollowsCurrentItem: true + highlightMoveDuration:240 + highlightRangeMode: ListView.StrictlyEnforceRange + } + } + //a list of visual items already have delegates handling their display + VisualItemModel{ + id: menuListModel + + FileMenu{ + id:fileMenu + width: menuListView.width; height: menuListView.height + color: fileColor + } + EditMenu{ + color: editColor + width: menuListView.width; height: menuListView.height + } + } +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/TextArea.qml b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/TextArea.qml new file mode 100644 index 0000000..d58c159 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/TextArea.qml @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id:textArea + + function paste(){ textEdit.paste()} + function copy() { textEdit.copy() } + function selectAll() { textEdit.selectAll() } + + width :400; height:400 + + property color fontColor: "white" + property alias textContent: textEdit.text + Flickable{ + id: flickArea + width: parent.width; height: parent.height + anchors.fill:parent + + boundsBehavior: Flickable.StopAtBounds + flickableDirection: Flickable.HorizontalFlick + interactive: true + //Will move the text Edit area to make the area visible when scrolled with keyboard strokes + function ensureVisible(r){ + if (contentX >= r.x) + contentX = r.x; + else if (contentX+width <= r.x+r.width) + contentX = r.x+r.width-width; + if (contentY >= r.y) + contentY = r.y; + else if (contentY+height <= r.y+r.height) + contentY = r.y+r.height-height; + } + + TextEdit{ + id: textEdit + anchors.fill:parent + width:parent.width; height:parent.height + color:fontColor + focus: true + wrapMode: TextEdit.Wrap + font.pointSize:10 + onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) + selectByMouse: true + } + } +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/qmldir b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/qmldir new file mode 100644 index 0000000..3f22778 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/qmldir @@ -0,0 +1,13 @@ + +Button ./Button.qml +FileDialog ./FileDialog.qml +TextArea ./TextArea.qml +TextEditor ./TextEditor.qml +EditMenu ./EditMenu.qml +MenuBar ./MenuBar.qml + +plugin FileDialog ../plugins + + + + diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/cppPlugins.pro b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/cppPlugins.pro new file mode 100644 index 0000000..6247747 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/cppPlugins.pro @@ -0,0 +1,17 @@ +TEMPLATE = lib +CONFIG += qt plugin +QT += declarative + +DESTDIR += ../plugins +OBJECTS_DIR = tmp +MOC_DIR = tmp + +TARGET = FileDialog + +HEADERS += directory.h \ + file.h \ + dialogPlugin.h + +SOURCES += directory.cpp \ + file.cpp \ + dialogPlugin.cpp diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.cpp b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.cpp new file mode 100644 index 0000000..7ea44ce --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "dialogPlugin.h" +#include "directory.h" +#include "file.h" +#include + +void DialogPlugin::registerTypes(const char *uri){ + + //register the class Directory into QML as a "Directory" element version 1.0 + qmlRegisterType(uri, 1, 0, "Directory"); + qmlRegisterType(uri,1,0,"File"); + + //qRegisterMetaType > ("QDeclarativeListProperty"); + +} + +//FileDialog is the plugin name (same as the TARGET in the project file) and DialogPlugin is the plugin classs +Q_EXPORT_PLUGIN2(FileDialog, DialogPlugin); \ No newline at end of file diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.h b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.h new file mode 100644 index 0000000..188e070 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef DIALOGPLUGIN_H +#define DIALOGPLUGIN_H + +#include + +class DialogPlugin : public QDeclarativeExtensionPlugin +{ + Q_OBJECT + + public: + //registerTypes is inherited from QDeclarativeExtensionPlugin + void registerTypes(const char *uri); + +}; + +#endif + diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.cpp b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.cpp new file mode 100644 index 0000000..cddfa03 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.cpp @@ -0,0 +1,219 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "directory.h" +#include + +/* +Directory constructor + +Initialize the saves directory and creates the file list +*/ +Directory::Directory(QObject *parent) : QObject(parent) +{ + + + m_dir.cd( QDir::currentPath()); + + //go to the saved directory. if not found, create save directory + m_saveDir = "saves"; + if (m_dir.cd(m_saveDir) == 0){ + m_dir.mkdir(m_saveDir); + m_dir.cd(m_saveDir); + } + m_filterList << "*.txt"; + + refresh(); +} + +/* +Directory::filesNumber +Return the number of Files +*/ +int Directory:: filesCount() const{ + return m_fileList.size(); +} + +/* +Function called to append data onto list property +*/ +void appendFiles(QDeclarativeListProperty * property, File * file){ + //Do nothing. can't add to a directory using this method +} + +/* +Function called to retrieve file in the list using an index +*/ +File* fileAt(QDeclarativeListProperty * property, int index){ + return static_cast< QList *>(property->data)->at(index); +} + +/* +Returns the number of files in the list +*/ +int filesSize(QDeclarativeListProperty * property){ + return static_cast< QList *>(property->data)->size(); +} + +/* +Function called to empty the list property contents +*/ +void clearFilesPtr(QDeclarativeListProperty *property){ + return static_cast< QList *>(property->data)->clear(); +} + +/* +Returns the list of files as a QDeclarativeListProperty. +*/ +QDeclarativeListProperty Directory::files(){ + + refresh(); +// return QDeclarativeListProperty(this,m_filePtrList); //not recommended in the docs + return QDeclarativeListProperty( this, &m_fileList, &appendFiles, &filesSize, &fileAt, &clearFilesPtr ); +} + +/* +Return te name of the currently selected file +*/ +QString Directory::filename() const{ + return currentFile.name(); +} + +/* +Return the file's content as a string. +*/ +QString Directory::fileContent() const{ + return m_fileContent; +} + +/* +Set the file name of the current file +*/ +void Directory::setFilename(const QString &str){ + if(str != currentFile.name()){ + currentFile.setName(str); + emit filenameChanged(); + } +} + +/* +Set the content of the file as a string +*/ +void Directory::setFileContent(const QString &str){ + if(str != m_fileContent){ + m_fileContent = str; + emit fileContentChanged(); + } +} + +/* +Called from QML to save the file using the filename and file content. +Saving makes sure that the file has a .txt extension. +*/ +void Directory::saveFile(){ + + if(currentFile.name().size() == 0){ + qWarning()<< "Empty filename. no save"; + return; + } + + QString extendedName = currentFile.name(); + if(!currentFile.name().endsWith(".txt")){ + extendedName.append(".txt"); + } + + QFile file( m_dir.filePath(extendedName) ); + if (file.open(QFile::WriteOnly | QFile::Truncate)){ + QTextStream outStream(&file); + outStream << m_fileContent; + } + file.close(); + refresh(); + emit directoryChanged(); +} + +/* +Load the contents of a file. +Only loads files with a .txt extension +*/ +void Directory::loadFile(){ + + m_fileContent.clear(); + QString extendedName = currentFile.name(); + if(!currentFile.name().endsWith(".txt")){ + extendedName.append(".txt"); + } + + QFile file( m_dir.filePath(extendedName) ); + if (file.open(QFile::ReadOnly )){ + QTextStream inStream(&file); + + QString line; + do{ + line = inStream.read(75); + m_fileContent.append(line); + }while (!line .isNull()); + } + file.close(); +} + +/* +Reloads the content of the files list. This is to ensure that the newly +created files are added onto the list. +*/ +void Directory::refresh(){ + m_dirFiles = m_dir.entryList(m_filterList,QDir::Files,QDir::Name); + m_fileList.clear(); + + File * file; + for(int i = 0; i < m_dirFiles.size() ; i ++){ + + file = new File(); + + if(m_dirFiles.at(i).endsWith(".txt")){ + QString name = m_dirFiles.at(i); + file->setName( name.remove(".txt",Qt::CaseSensitive)); + } + else{ + file->setName(m_dirFiles.at(i)); + } + m_fileList.append(file); + } +} \ No newline at end of file diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.h b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.h new file mode 100644 index 0000000..417df68 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.h @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef DIRECTORY_H +#define DIRECTORY_H + +#include "file.h" + +#include +#include +#include +#include +#include + +class Directory : public QObject{ + + Q_OBJECT + + //number of files in the directory + Q_PROPERTY(int filesCount READ filesCount) + + //list property containing file names as QString + Q_PROPERTY(QDeclarativeListProperty files READ files CONSTANT ) + + //file name of the text file to read/write + Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged) + + //text content of the file + Q_PROPERTY(QString fileContent READ fileContent WRITE setFileContent NOTIFY fileContentChanged) + + public: + Directory(QObject *parent = 0); + + //properties' read functions + int filesCount() const; + QString filename() const; + QString fileContent() const; + QDeclarativeListProperty files(); + + //properties' write functions + void setFilename(const QString &str); + void setFileContent(const QString &str); + + //accessible from QML + Q_INVOKABLE void saveFile(); + Q_INVOKABLE void loadFile(); + + signals: + void directoryChanged(); + void filenameChanged(); + void fileContentChanged(); + + private: + QDir m_dir; + QStringList m_dirFiles; + File currentFile; + QString m_saveDir; + QStringList m_filterList; + + //contains the file data in QString format + QString m_fileContent; + + //Registered to QML in a plugin. Accessible from QML as a property of Directory + QList m_fileList; + + //refresh content of the directory + void refresh(); +}; + + +#endif diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.cpp b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.cpp new file mode 100644 index 0000000..f4a360a --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "file.h" + +File::File(QObject *parent) : QObject(parent) +{ + m_name = ""; +} + +QString File::name() const{ + return m_name; +} +void File::setName(const QString &str){ + if(str != m_name){ + m_name = str; + emit nameChanged(); + } +} \ No newline at end of file diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.h b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.h new file mode 100644 index 0000000..b27a143 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef FILE_H +#define FILE_H + + +#include +#include + +class File : public QObject{ + + Q_OBJECT + + Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + + public: + File(QObject *parent = 0); + + QString name() const; + void setName(const QString &str); + + signals: + void nameChanged(); + + private: + QString m_name; +}; + +#endif \ No newline at end of file diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/qmldir b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/qmldir new file mode 100644 index 0000000..c2b27da --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/qmldir @@ -0,0 +1 @@ +plugin FileDialog plugins diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/images/arrow.png b/examples/tutorials/gettingStarted/gsQml/parts/part5/images/arrow.png new file mode 100644 index 0000000..14978c2 Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part5/images/arrow.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_editmenu.png b/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_editmenu.png new file mode 100644 index 0000000..27feed5 Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_editmenu.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_filemenu.png b/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_filemenu.png new file mode 100644 index 0000000..4d8f9f2 Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_filemenu.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_newfile.png b/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_newfile.png new file mode 100644 index 0000000..680acfe Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_newfile.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/qml-texteditor5.qmlproject b/examples/tutorials/gettingStarted/gsQml/parts/part5/qml-texteditor5.qmlproject new file mode 100644 index 0000000..ed034df --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/qml-texteditor5.qmlproject @@ -0,0 +1,18 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + directory: "core" + directory: "filedialog" + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + importPaths: [ " ./plugins " ] +} -- cgit v0.12 From 9d1b4359fc602e85412d1b6d60243d2e65bc5f59 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 6 Oct 2010 16:45:10 +0200 Subject: Doc: Renamed a project file. Task-number: QTBUG-14238 --- .../gsQml/parts/part5/filedialog/cppPlugins.pro | 17 ----------------- .../gsQml/parts/part5/filedialog/filedialog.pro | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 17 deletions(-) delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/cppPlugins.pro create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/filedialog.pro diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/cppPlugins.pro b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/cppPlugins.pro deleted file mode 100644 index 6247747..0000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/cppPlugins.pro +++ /dev/null @@ -1,17 +0,0 @@ -TEMPLATE = lib -CONFIG += qt plugin -QT += declarative - -DESTDIR += ../plugins -OBJECTS_DIR = tmp -MOC_DIR = tmp - -TARGET = FileDialog - -HEADERS += directory.h \ - file.h \ - dialogPlugin.h - -SOURCES += directory.cpp \ - file.cpp \ - dialogPlugin.cpp diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/filedialog.pro b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/filedialog.pro new file mode 100644 index 0000000..6247747 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/filedialog.pro @@ -0,0 +1,17 @@ +TEMPLATE = lib +CONFIG += qt plugin +QT += declarative + +DESTDIR += ../plugins +OBJECTS_DIR = tmp +MOC_DIR = tmp + +TARGET = FileDialog + +HEADERS += directory.h \ + file.h \ + dialogPlugin.h + +SOURCES += directory.cpp \ + file.cpp \ + dialogPlugin.cpp -- cgit v0.12 From bf5d0fa36d257b6deb8531f9b80bbdae07a69434 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 23 Sep 2010 11:00:11 +0200 Subject: My Qt 4.7.1 changes (cherry picked from commit 77b9b5dc93662d505b2c69211d001e5672d8a2cb) --- dist/changes-4.7.1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index c8b26c2..fd5a9f2 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -40,6 +40,15 @@ QtCore QtGui ----- + - QGraphicsWidget + * [QTBUG-13188] Make sure a font that has propagated from a parent can + be set on a QPainter. + + + - QStaticText + * [QTBUG-12614] Fix crash with zero-width string. + * [QTBUG-12540] Fix rendering of large glyphs with OpenGL2 paint engine. + QtDBus ------ -- cgit v0.12 From c3c4e685361dfc8aa609dac9a3ef0545acdfc01f Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Thu, 23 Sep 2010 11:15:45 +0200 Subject: my changes for 4.7.1 (cherry picked from commit f2be9f394972edffa0eebc9c30fe00a4fce81abc) --- dist/changes-4.7.1 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index fd5a9f2..30c2efd 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -60,6 +60,10 @@ QtMultimedia QtNetwork --------- + - QSslConfiguration + * [QTBUG-13265] fix crash with empty configuration + - QSslCertificate + * [QTBUG-12489] support dates > 2049 QtOpenGL @@ -81,6 +85,12 @@ QtSql QtSvg ----- +QtXmlPatterns +------------- + - XML Schema internals: + * [QTBUG-11559] Only parse 3 digits of time fraction + + Qt Plugins ---------- -- cgit v0.12 From 5abb4bdbaf306c7b40e4f18728a4a2a6768094ec Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Thu, 23 Sep 2010 12:22:15 +0200 Subject: Update the changelog with the SSE work done for Qt 4.7.1 (cherry picked from commit 9c97aa4946a1d6b22bdcd8475f32b5ead7051976) --- dist/changes-4.7.1 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index 30c2efd..d3ae280 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -26,6 +26,11 @@ Optimizations - Improved the benchmarking library's timing code * Uses a faster access to the system clock + - Introduction of SSSE3 for alpha blending of images. + + - On x86 and 86_64, the memory access has been improved for alpha blending + and for some composition functions. + * See list of Important Behavior Changes below @@ -107,7 +112,7 @@ Qt for Unix (X11 and Mac OS X) Qt for Linux/X11 ---------------- - + - The configure script now detects all vector extensions of x86 and x86_64 Qt for Windows -------------- @@ -115,7 +120,7 @@ Qt for Windows Qt for Mac OS X --------------- - + - The configure script now detects all vector extensions of x86 and x86_64 Qt for Symbian -------------- -- cgit v0.12 From 6daecd573fb3663bf3f6305a8cf73bea52e7eede Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 23 Sep 2010 15:49:46 +0200 Subject: Changelog: 4.7.1 (uic/Designer). (cherry picked from commit f160e04ebe2926d09c20ef3960def1388a566db7) --- dist/changes-4.7.1 | 1 + 1 file changed, 1 insertion(+) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index d3ae280..7676368 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -134,6 +134,7 @@ Qt for Symbian - Designer - uic + * Improve warnings and error reports **************************************************************************** * Important Behavior Changes * -- cgit v0.12 From c770ad8124bce99b45bdbe72ebaa067fb17bf23d Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Fri, 24 Sep 2010 12:27:34 +0200 Subject: Updated changes-4.7.1. (cherry picked from commit bed3d1eca213f24dae13cbd4cda4df94d9f0738b) --- dist/changes-4.7.1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index 7676368..fdfecb7 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -100,7 +100,9 @@ QtXmlPatterns Qt Plugins ---------- - + - Jpeg image IO plugin + * [QTBUG-13653] Fixed infinite loop when loading jpeg without EOI marker + from memory. **************************************************************************** * Platform Specific Changes * -- cgit v0.12 From f843d4e1703533d208b538a615abf8ea20bfa836 Mon Sep 17 00:00:00 2001 From: Lasse Holmstedt Date: Fri, 24 Sep 2010 12:44:17 +0200 Subject: dist/changes: QML Debugging changes (cherry picked from commit baa2d6bee64e458f547b290d7cd1acdfc6292e05) --- dist/changes-4.7.1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index fdfecb7..5f33ce8 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -95,7 +95,11 @@ QtXmlPatterns - XML Schema internals: * [QTBUG-11559] Only parse 3 digits of time fraction - +QtDeclarative +------------- + - QML debugging: + * [QTBUG-5162] The debugger is now activated with -qmljsdebugger command + line arg to enable support for platforms without environment variables Qt Plugins ---------- -- cgit v0.12 From fece9253d419ad450ee87a033c3623ee7b3f6ed1 Mon Sep 17 00:00:00 2001 From: axis Date: Mon, 27 Sep 2010 16:34:04 +0200 Subject: Added my changes to the changelog. (cherry picked from commit fbf91dc787c15f561686cd708735ff8f45984aba) --- dist/changes-4.7.1 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index 5f33ce8..29b4d41 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -131,6 +131,18 @@ Qt for Mac OS X Qt for Symbian -------------- + - configure + * [QTBUG-11671] Fixed audio-backend detection in configure tests. + + - qmake + * [QTBUG-13523] Added support for using -L notation in the LIBS variable + when building with the symbian/linux-armcc or gcce mkspec. + + - QInputContext + * [QTBUG-12949] Fixed a bug where passwords would not be committed when + confirming. + * [QTBUG-13472] Fixed crash in input methods when using symbols menu and + numbers only. **************************************************************************** -- cgit v0.12 From a69fd02e4e27a669b41b3c00619b242c55211994 Mon Sep 17 00:00:00 2001 From: Zeno Albisser Date: Tue, 28 Sep 2010 09:44:06 -0400 Subject: Added note to changes-4.7.1 Reviewed-by: Frederik Gladhorn (cherry picked from commit 02de74f0b2d443e410154e96321357cfe2ef9aad) --- dist/changes-4.7.1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index 29b4d41..d1ef791 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -55,6 +55,15 @@ QtGui * [QTBUG-12540] Fix rendering of large glyphs with OpenGL2 paint engine. + - QPinchGesture + * The scaleFactor and totalScaleFactor now represent a value that allows + an object to track a touchpoint during a Pinch Gesture even when using + sequences for zooming. + Therefor the scale factors are initialized to 1.0 and for every new + sequence the totalScaleFactor is multiplied with the scaleFactor of the + new sequence. + + QtDBus ------ -- cgit v0.12 From 51f31b1b41ceb4dfde5779787c64aeb79c054ac9 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 29 Sep 2010 17:02:06 +1000 Subject: My changes. (cherry picked from commit 2b70a3a6d5ebef36e90f52076c5d942d8cc171d7) --- dist/changes-4.7.1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index d1ef791..2c22fea 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -78,6 +78,8 @@ QtNetwork * [QTBUG-13265] fix crash with empty configuration - QSslCertificate * [QTBUG-12489] support dates > 2049 + - Bearer Management + * Improved reliability on Symbian and Maemo. QtOpenGL -- cgit v0.12 From 2b38401f6a68a6d087368075f9ec4ac90a552fbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 29 Sep 2010 09:49:29 +0200 Subject: Updated changes-4.7.1 (cherry picked from commit 2d1e3b9778328046d3ba94dd51c37c507e618721) --- dist/changes-4.7.1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index 2c22fea..bbf8c3d 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -48,7 +48,10 @@ QtGui - QGraphicsWidget * [QTBUG-13188] Make sure a font that has propagated from a parent can be set on a QPainter. - + + - QPainter + * [QTBUG-13429] Fixed scale point drawing with square cap in the raster + engine, plus some potential floating point overflows in the rasterizer. - QStaticText * [QTBUG-12614] Fix crash with zero-width string. -- cgit v0.12 From 1af6507a8fed1e9606566e5e595191968d6002b2 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Wed, 29 Sep 2010 10:13:22 +0200 Subject: Changes done for 4.7.1 (cherry picked from commit 583ca462caf656af17bea1c3f05d88ae7785ae91) --- dist/changes-4.7.1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index bbf8c3d..a18c4ad 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -141,6 +141,10 @@ Qt for Windows Qt for Mac OS X --------------- - The configure script now detects all vector extensions of x86 and x86_64 + * [QTBUG-10500] Fixed a bug which causes the QMainWindow geometry + to be calculated wrongly, when used with native toolbars. + * [QTBUG-13878] Application menu entries can now also be translated + using the QMenuBar context. Qt for Symbian -------------- -- cgit v0.12 From 33e4a7dcacc9e413bd6f19c8281e2855e4142490 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 29 Sep 2010 10:22:26 +0200 Subject: added my and Jan-Arve's change to changelog for 4.7.1 (cherry picked from commit c1a9c50d53ae41b19bdcd7930eec0805498e01c6) --- dist/changes-4.7.1 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index a18c4ad..e442951 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -41,6 +41,9 @@ Optimizations QtCore ------ + - QLibrary + * [QT-3825] System libraries are only loaded from the system directories + QtGui ----- @@ -66,6 +69,12 @@ QtGui sequence the totalScaleFactor is multiplied with the scaleFactor of the new sequence. + - QLineEdit + * [QTBUG-13520] Fixed the scrolling of text with right alignment + + - QPixmap + * [QTBUG-12560] Fixed a regression preventing loading images without extensions + QtDBus ------ @@ -136,6 +145,8 @@ Qt for Linux/X11 Qt for Windows -------------- + - Drag & Drop: + * [QTBUG-13787] Fixed a possible crash with mingw Qt for Mac OS X -- cgit v0.12 From f4e76aee217ddd6931516c17e62f0f4c086c1b7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Wed, 29 Sep 2010 11:22:53 +0200 Subject: My 4.7.1 changes. (cherry picked from commit 99340cf858731f531af29be1e1368e4991e8564e) --- dist/changes-4.7.1 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index e442951..2be9760 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -55,7 +55,7 @@ QtGui - QPainter * [QTBUG-13429] Fixed scale point drawing with square cap in the raster engine, plus some potential floating point overflows in the rasterizer. - + - QStaticText * [QTBUG-12614] Fix crash with zero-width string. * [QTBUG-12540] Fix rendering of large glyphs with OpenGL2 paint engine. @@ -96,7 +96,9 @@ QtNetwork QtOpenGL -------- - + - QGL2PaintEngineEx + * Fixed drawing a large number of glyphs with the same font on systems + with small texure size limits. QtOpenVG -------- @@ -148,6 +150,13 @@ Qt for Windows - Drag & Drop: * [QTBUG-13787] Fixed a possible crash with mingw + - QPrinter + * [QTBUG-12263] Strokes were in some cases not printed with the correct + color under Windows. + + - QGLWidget + * [QTBUG-13141] Fixed multi-sampling support for ATI based cards under + Windows. Qt for Mac OS X --------------- -- cgit v0.12 From 0738176c2c3ec1fa411b8a0ae49a70d1d7ab8963 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Wed, 29 Sep 2010 11:34:29 +0200 Subject: my contributions to dist/changes-4.7.1 (cherry picked from commit 3519840ef2c5cb7cbc5b32ffc9976a8638187d64) --- dist/changes-4.7.1 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index 2be9760..ea2e949 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -44,6 +44,8 @@ QtCore - QLibrary * [QT-3825] System libraries are only loaded from the system directories + - QUuid + * [QTBUG-11213] QUuid::createUuid() should not generate identical sequences on UNIX QtGui ----- @@ -139,7 +141,8 @@ Qt Plugins Qt for Unix (X11 and Mac OS X) ------------------------------ - + - Event System: + * [QT_3553] Fix invalid memory write during recursive timer activation. Qt for Linux/X11 ---------------- @@ -147,6 +150,9 @@ Qt for Linux/X11 Qt for Windows -------------- + - Event System: + * [QTBUG-12721] Fix Qt applications freezing until mouse/keyboard events occur. + - Drag & Drop: * [QTBUG-13787] Fixed a possible crash with mingw -- cgit v0.12 From d2acbb699efae07f761762909884822aa9629718 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 29 Sep 2010 11:33:18 +0200 Subject: Update changelog (cherry picked from commit 8050dc45c8c9a134875196dcddf010d4194fd974) --- dist/changes-4.7.1 | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index ea2e949..dbfa0b3 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -41,12 +41,21 @@ Optimizations QtCore ------ + - Containers + * [QTBUG-13079] Fix assingment of a container included in the container itself + - QLibrary * [QT-3825] System libraries are only loaded from the system directories + - QUuid * [QTBUG-11213] QUuid::createUuid() should not generate identical sequences on UNIX + - QEventDispatcherUnix + * [QTBUG-13633] Do not process too many timer events if other events need + to be processed first + + QtGui ----- @@ -57,6 +66,7 @@ QtGui - QPainter * [QTBUG-13429] Fixed scale point drawing with square cap in the raster engine, plus some potential floating point overflows in the rasterizer. + * Optimized pixmap drawing with SmoothPixmapTransform. - QStaticText * [QTBUG-12614] Fix crash with zero-width string. @@ -77,6 +87,9 @@ QtGui - QPixmap * [QTBUG-12560] Fixed a regression preventing loading images without extensions + - QTreeView + * [QTBUG-13567] Do not scroll to top if last item is removed + QtDBus ------ @@ -117,6 +130,10 @@ QtSql QtSvg ----- +QtXml +----- + * Fixed a crash when parsing invalid tag names. + QtXmlPatterns ------------- - XML Schema internals: @@ -127,6 +144,10 @@ QtDeclarative - QML debugging: * [QTBUG-5162] The debugger is now activated with -qmljsdebugger command line arg to enable support for platforms without environment variables + * Various improvements to ease debugging in creator + - QDeclarativeImageProvider: + * Fixed memory leak + * Improved concurrency when using in assynchronus mode. Qt Plugins ---------- @@ -198,6 +219,9 @@ Qt for Symbian - uic * Improve warnings and error reports + - moc + * Show an error if NOTIFY refer to a wrong signal in Q_PROPERTY + **************************************************************************** * Important Behavior Changes * **************************************************************************** -- cgit v0.12 From cbfdce47d2e348341358d308bfaea9ba603421fe Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 29 Sep 2010 13:58:51 +0200 Subject: updated changes-4.7.1 (cherry picked from commit 0ce33ebfa8b99c2988b56d0157ddc039a9ab06ae) --- dist/changes-4.7.1 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index dbfa0b3..c68f9e0 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -197,11 +197,19 @@ Qt for Symbian -------------- - configure + * [QTBUG-4586] Fixed wrong paths in include/ActiveQt/headers.pri. * [QTBUG-11671] Fixed audio-backend detection in configure tests. - qmake * [QTBUG-13523] Added support for using -L notation in the LIBS variable when building with the symbian/linux-armcc or gcce mkspec. + * [QTBUG-12851] Fix assertion on Windows when DESTDIR is empty in static + libs. + * [QTBUG-12802] Fix vcxproj generator when using /Fd in QMAKE_CXXFLAGS. + * [QTBUG-13080] vcxproj generator: fix bug when using CharacterSet=1 in + .pro file. + * [QTBUG-13081] vc[x]proj generators: support /MAP option without file + name. - QInputContext * [QTBUG-12949] Fixed a bug where passwords would not be committed when @@ -209,6 +217,10 @@ Qt for Symbian * [QTBUG-13472] Fixed crash in input methods when using symbols menu and numbers only. +Qt for Windows CE +----------------- + - Gui + * [QTBUG-8408] Show the [X] button on Windows mobile when maximizing. **************************************************************************** * Tools * -- cgit v0.12 From 4bb9c55b0105aebfe9004fc82585ab72d5149675 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 29 Sep 2010 14:31:46 +0200 Subject: My changelog entries for 4.7.1 (cherry picked from commit 646c37a670b101487a76b1e787fd298187b49430) --- dist/changes-4.7.1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index c68f9e0..e9458c9 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -107,6 +107,10 @@ QtNetwork * [QTBUG-12489] support dates > 2049 - Bearer Management * Improved reliability on Symbian and Maemo. + - IPv6 + * Disable on Symbian until OpenC properly supports it + - QNetworkAccessManager + * [QTBUG-12285] Crash fix related to aborted uploads QtOpenGL -- cgit v0.12 From 6978061fdfbaf97b1b887e43b2f4d0ac7f2b2890 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Thu, 30 Sep 2010 15:00:47 +1000 Subject: connman backend (cherry picked from commit ba698e20b32defcb0840293fc4ac5948f7c190c9) --- dist/changes-4.7.1 | 1 + 1 file changed, 1 insertion(+) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index e9458c9..993e596 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -107,6 +107,7 @@ QtNetwork * [QTBUG-12489] support dates > 2049 - Bearer Management * Improved reliability on Symbian and Maemo. + * Added connman/meego backend. - IPv6 * Disable on Symbian until OpenC properly supports it - QNetworkAccessManager -- cgit v0.12 From 745bc005d988daee0df2a31951fc6b80851d8ad5 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Thu, 30 Sep 2010 18:03:43 +1000 Subject: Add declarative changelog entries for 4.7.1 Task-number: Reviewed-by: Yann Bodson (cherry picked from commit 753d366ced1a62a97d5207eb2708817efc35bc4d) --- dist/changes-4.7.1 | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index 993e596..9a3e543 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -146,10 +146,97 @@ QtXmlPatterns QtDeclarative ------------- + - QML language + * [QTBUG-13799] QML core module renamed to QtQuick to decouple it from Qt releases. + Old "import Qt 4.7" will co-exist with "import QtQuick 1.0' at least during Qt 4.7 releases. + * [QTBUG-13047] Support passing QObject derived types to QML methods + * [QTBUG-12837] Support JS "in" operator on QML objects + * [QTBUG-13045] Prevent calling deleteLater() from QML + * [QTBUG-13043] Ignore non-scriptable properties in QML + * [QTBUG-13114] Don't double call classBegin() + * [QTBUG-12946] Ensure the onDestruction handlers are called before the expressions are cleared + * [QTBUG-12599] Re-enabled script program caching on Symbian + * [QTBUG-13374] Don't modify the signal order on the second dynamic meta object pass + * Support for qsTrId and meta-data in comments for QML - QML debugging: * [QTBUG-5162] The debugger is now activated with -qmljsdebugger command line arg to enable support for platforms without environment variables * Various improvements to ease debugging in creator + - AnchorAnimation + * [QTBUG-13398] Fix AnchorAnimation for multiple AnchorChanges with dependancies + - AnchorChanges + * [QTBUG-11834] Restore any absolute geometry changed by AnchorChanges when returning to the base state + - Component + * [QTBUG-13170] Complete Component::createObject() creation after setting the parent + - GridView + * [QTBUG-13166] GridView.view property should not be writable + - Flickable + * [QTBUG-13095] Ensure Flickable visibleArea is updated when view height changes + * [QTBUG-13176] Avoid Flickable view jumping when drag threashold is exceeded + * [QTBUG-13078] Fix poor flicking behavior with slower flicks + * Handle QGraphicsWidgets in Flickable + - FocusScope + * [QTBUG-12649] Make sure onFocusChanged is correctly emitted for items in a FocusScope. + - FontLoader + * [QTBUG-13419] Don't add the same font to the font database multiple times + - ListModel + * [QTBUG-12363] Modifying an object returned by ListModel.get(0) didn't update the view + * [QTBUG-13666] Calling set() and setProperty() on ListModel from a WorkerScript didn't update the view + * Fix Worker ListModel to emit the right signal when items change + * Fix crash with invalid role indexes + * improved ListModel error messages + - ListView + * [QTBUG-13664] Models with a single role didn't always update correctly + * [QTBUG-13543] Ensure flickable velocity is updated when view is moved by setCurrentIndex + * [QTBUG-12664] Ensure highlight is positioned correctly in positionViewAtIndex() + * [QTBUG-13166] Fix ListView.view attached property with VisualItemModel + * [QTBUG-13039] Fix crash in synchronization of ListModel in WorkerThread + * [QTBUG-11341] Flicking a ListView sometimes made it loose focus + * [QTBUG-13166] ListView.view property should not be writable + - PathView + * [QTBUG-13689] Moving items in a PathView caused PathView.onPath to be set to false + * [QTBUG-13687] PathView didn't accept mouse events, preventing it from working in a Flickable + * [QTBUG-13416] Fix PathView item position on insertion and removal + * [QTBUG-13017] Fix PathView when setting an empty model that is later filled + * [QTBUG-12747] PathView required some diagonal movement before a drag was initiated + - Positioners + * made positioners work with QGraphicsWidgets + - PropertyChanges + * [QTBUG-12559] Correctly apply PropertyChanges when entering an extended state directly from the base state + - VisualDataModel + * [QTBUG-13754] Fixed a crash when updating a property in ListModel with multiple roles + * [QTBUG-13038] Fix VisualDataModel model update handling when rootIndex is specified + * [QTBUG-13146] Handle layoutChanged() properly in QML views + - XmlListModel + * [QTBUG-13041] XmlListModel thread was left hanging on Symbian application exit + - ParentChange + * [QTBUG-13554] ParentChange fails to apply rotation changes of exactly 180 degrees + - MouseArea + * [QTBUG-12250] When onDoubleClicked: is handled don't emit a second onPressed/onClicked + - Image + * [QTBUG-13454] Changing the Image 'source' no longer goes through the 'Loading' state if the image is cached. + * [QTBUG-13383] Do not reset sourceSize when changing image source url + * [QTBUG-13002] Setting one dimension of the sourceSize should set the other dimensio + * [QTBUG-12302] Fix remote image url redirects are done in the right thread + * Ensure all image states are updated before emitting statusChanged signals + - NumberAnimation + * [QTBUG-12805] Clear previous animation data for non-triggering animations + - Repeater + * [QTBUG-12905] Emit countChanged where appropriate in Repeater + - SmoothedAnimation + * [QTBUG-12336] Update running animations if a SmoothedAnimation is changed + - SpringAnimation + * [QTBUG-13044] SpringAnimation velocity animation stop logic was fragile + - Text + * [QTBUG-13453] Fix jerky scrolling caused by unnecessary repaints of Text element + * [QTBUG-13142] Fix alignment of shadow for rich text when using text styles + * [QTBUG-11002] Improve QML text rendering when LCD smoothing is enabled for OS X + - TextInput + * [QTBUG-11127] Fix autoScroll implementation + - XmlHttpRequest + * [QTBUG-13117] Fix responseText to check the charset encoding field and also to not assume that the data is xml + - WebView + * [QTBUG-13342] Ensure WebView gets focus when an editable node is clicked on - QDeclarativeImageProvider: * Fixed memory leak * Improved concurrency when using in assynchronus mode. @@ -239,6 +326,11 @@ Qt for Windows CE - moc * Show an error if NOTIFY refer to a wrong signal in Q_PROPERTY + - QML Viewer + * [QTBUG-13347] Paused orientation sensors in Qml Viewer when the application window is not active to save device battery + * [QTBUG-11019] Add a menu option to open remote files in the QML viewer + * QML Viewer is deployed under QtDemos folder instead of QtExamples folder in Symbian application menu + **************************************************************************** * Important Behavior Changes * **************************************************************************** -- cgit v0.12 From 42e1282f210d9a9a30b02c274af60edf3d785de9 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Thu, 30 Sep 2010 11:00:33 +0200 Subject: Update changes (cherry picked from commit 7d5afd371d634e35192ab27f65c6dc895f7bbb5c) --- dist/changes-4.7.1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index 9a3e543..2c25699 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -90,6 +90,8 @@ QtGui - QTreeView * [QTBUG-13567] Do not scroll to top if last item is removed + - QGtkStyle + * [QTBUG-13125] Fixed a regression with custom itemview background color. QtDBus ------ -- cgit v0.12 From c3d2287f3bd9a3a0bb00fdc3f6214a4bdf76b01d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Thu, 30 Sep 2010 16:46:26 +0200 Subject: Some 4.7.1 changes. (cherry picked from commit 72fd8399aa36395e41f497fff79842496d6f9b03) --- dist/changes-4.7.1 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index 2c25699..2d79ac1 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -62,6 +62,16 @@ QtGui - QGraphicsWidget * [QTBUG-13188] Make sure a font that has propagated from a parent can be set on a QPainter. + * [QT-3808] Issues when applying effects in combination with ItemHasNoContents flag. + + - QGraphicsItem + * [QTBUG-3633, QT-3828] Wrong children bounding rect when applying effects. + + - QGraphicsEffect + * [QT-3633] Wrong bounding rect. + + - QGraphicsScene + * [QT-3674] Spurious assert triggered from render(). - QPainter * [QTBUG-13429] Fixed scale point drawing with square cap in the raster -- cgit v0.12 From 33cdcafb24f21278d2ab34fa04cbf82ba57fa2aa Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 7 Oct 2010 08:28:46 +0200 Subject: use swapInterval=1 by default in EglFS to potentially avoid tearing --- src/plugins/platforms/eglfs/qeglfsscreen.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp index 1b64e7e..b31b204 100644 --- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp +++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp @@ -121,6 +121,8 @@ QEglFSScreen::QEglFSScreen(EGLNativeDisplayType display) platformFormat.setRedBufferSize(8); platformFormat.setGreenBufferSize(8); platformFormat.setBlueBufferSize(8); + platformFormat.setSwapInterval(1); + EGLConfig config = q_configFromQPlatformWindowFormat(m_dpy, platformFormat); EGLNativeWindowType eglWindow = 0; -- cgit v0.12 From d6f4a6e6be5d70e31c70415e637a6f7f312a997d Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 7 Oct 2010 09:25:37 +0200 Subject: Doc: Fixing snippet bug. Path pointing to the wrong snippet --- src/corelib/tools/qelapsedtimer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qelapsedtimer.cpp b/src/corelib/tools/qelapsedtimer.cpp index cb5e701..ee7c9b9 100644 --- a/src/corelib/tools/qelapsedtimer.cpp +++ b/src/corelib/tools/qelapsedtimer.cpp @@ -83,7 +83,7 @@ QT_BEGIN_NAMESPACE function, which can be used to determine if a certain number of milliseconds has already elapsed: - \snippet doc/src/snippets/qelapsedtimer/main.cpp 1 + \snippet doc/src/snippets/qelapsedtimer/main.cpp 2 \section1 Reference clocks -- cgit v0.12 From 86d845cf8b8dd13672c27103af7cb576a3e7a17e Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 7 Oct 2010 09:28:59 +0200 Subject: Doc: Fixing typo --- doc/src/overviews.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/overviews.qdoc b/doc/src/overviews.qdoc index 7b02f1a..b9bd3b4 100644 --- a/doc/src/overviews.qdoc +++ b/doc/src/overviews.qdoc @@ -54,7 +54,7 @@ \brief The Qt components for constructing native look & feel desktop UI's. These pages are about Qt's traditional set of GUI components for - building both native look ^ feel and custom UI's for the desktop + building both native look & feel and custom UI's for the desktop environment. Use \l{Qt Quick} for building UI's for mobile devices. \generatelist {related} -- cgit v0.12 From 08ba207866358e95d320749da5aac0514a9db5a6 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 7 Oct 2010 09:36:30 +0200 Subject: Doc: Fixing bug - line too long and not visible. Breaking the line in two --- examples/declarative/i18n/i18n.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/declarative/i18n/i18n.qml b/examples/declarative/i18n/i18n.qml index 8dac88d..219deda 100644 --- a/examples/declarative/i18n/i18n.qml +++ b/examples/declarative/i18n/i18n.qml @@ -65,7 +65,8 @@ Rectangle { anchors.fill: parent; spacing: 20 Text { - text: "If a translation is available for the system language (eg. French) then the string below will translated (eg. 'Bonjour'). Otherwise it will show 'Hello'." + text: "If a translation is available for the system language (eg. French) then the + string below will translated (eg. 'Bonjour'). Otherwise it will show 'Hello'." width: parent.width; wrapMode: Text.WordWrap } -- cgit v0.12 From 51633dc7aadae91ade11c4e28947f739c59c10a4 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 7 Oct 2010 10:19:30 +0200 Subject: Doc: correcting typo --- doc/src/howtos/unix-signal-handlers.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/howtos/unix-signal-handlers.qdoc b/doc/src/howtos/unix-signal-handlers.qdoc index fe01772..ca34bfb 100644 --- a/doc/src/howtos/unix-signal-handlers.qdoc +++ b/doc/src/howtos/unix-signal-handlers.qdoc @@ -78,7 +78,7 @@ In your Unix signal handlers, you write a byte to the \e write end of a socket pair and return. This will cause the corresponding QSocketNotifier to emit its activated() signal, which will in turn - cause the appropriate Qt slott function to run. + cause the appropriate Qt slot function to run. \snippet doc/src/snippets/code/doc_src_unix-signal-handlers.qdoc 3 -- cgit v0.12 From b16ac8de0633b6c10574a0c5bfda479729b99925 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 7 Oct 2010 10:39:50 +0200 Subject: Doc: adding note to function QWSKeyboardHandler::processKeycode - that it was added in Qt 4.6 --- src/gui/embedded/qkbd_qws.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/embedded/qkbd_qws.cpp b/src/gui/embedded/qkbd_qws.cpp index b28e293..a6c8002 100644 --- a/src/gui/embedded/qkbd_qws.cpp +++ b/src/gui/embedded/qkbd_qws.cpp @@ -450,6 +450,8 @@ void QWSKeyboardHandler::endAutoRepeat() /*! \fn QWSKeyboardHandler::KeycodeAction QWSKeyboardHandler::processKeycode(quint16 keycode, bool isPress, bool autoRepeat) + \since 4.6 + Maps \a keycode according to a keymap and sends that key event to the \l{Qt for Embedded Linux} server application. -- cgit v0.12 From 21c14e8de6b7e5a5a8bbc4424227e7103605f948 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 7 Oct 2010 10:50:51 +0200 Subject: Doc: correcting broken link to labs --- doc/src/development/qtestlib.qdoc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/src/development/qtestlib.qdoc b/doc/src/development/qtestlib.qdoc index 23d6670..cc5afd2 100644 --- a/doc/src/development/qtestlib.qdoc +++ b/doc/src/development/qtestlib.qdoc @@ -749,9 +749,10 @@ \section1 External Tools Tools for handling and visualizing test data are available as part of - the \l{qtestlib-tools} project on the Qt Labs Web site. These include - a tool for comparing performance data obtained from test runs and a - utility to generate Web-based graphs of performance data. + the qtestlib-tools project on the + \l{http://labs.qt.nokia.com/}{http://labs.qt.nokia.com/}Qt Labs Web site. + These include a tool for comparing performance data obtained from test + runs and a utility to generate Web-based graphs of performance data. See the \l{qtestlib-tools Announcement} for more information on these tools and a simple graphing example. -- cgit v0.12 From b65a598e0c580585bd16babfd46967b0f4cf8931 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 7 Oct 2010 10:54:38 +0200 Subject: Doc: correcting grammar on the installation pages --- doc/src/getting-started/installation.qdoc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index 3eb761d..c6e79d9 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -392,10 +392,10 @@ must be run as root. */ /*! \page install-wince.html -\title Installing Qt on Windows CE +\title Installing Qt for Windows CE \ingroup installation \ingroup qtce -\brief How to install Qt on Windows CE. +\brief How to install Qt for Windows CE. \previouspage Installation \tableofcontents @@ -492,9 +492,9 @@ in the \l{Qt for Windows CE Requirements} document. */ /*! \page install-Symbian-installer.html -\title Installing Qt on the Symbian platform from a Binary Package +\title Installing Qt for the Symbian platform from a Binary Package \ingroup qtsymbian -\brief How to install Qt on the Symbian platform from a binary package. +\brief How to install Qt for the Symbian platform from a binary package. \previouspage Installation \tableofcontents @@ -551,10 +551,10 @@ Symbian platform, */ /*! \page install-Symbian.html -\title Installing Qt on the Symbian platform +\title Installing Qt for the Symbian platform \ingroup installation \ingroup qtsymbian -\brief How to install Qt on the Symbian platform. +\brief How to install Qt for the Symbian platform. \previouspage Installation \tableofcontents @@ -685,10 +685,10 @@ Binary Package} document. */ /*! \page install-Symbian-linux.html -\title Installing Qt on the Symbian platform using Linux (experimental) +\title Installing Qt for the Symbian platform using Linux (experimental) \ingroup installation \ingroup qtsymbian -\brief How to install Qt on the Symbian platform using Linux. +\brief How to install Qt for the Symbian platform using Linux. \previouspage Installation \tableofcontents -- cgit v0.12 From d6369f9faa28c40c4e7dd002b07556d3f730a858 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 7 Oct 2010 10:58:49 +0200 Subject: Doc: correcting spelling - qdbusxml2dcpp to qdbusxml2cpp --- tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp b/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp index d9343e3..a259096 100644 --- a/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp +++ b/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp @@ -1130,11 +1130,11 @@ int main(int argc, char **argv) static code representing those interfaces, which can then be used to make calls to remote objects or implement said interfaces. - \c qdbusxml2dcpp has two modes of operation, that correspond to the two possible outputs it can + \c qdbusxml2cpp has two modes of operation, that correspond to the two possible outputs it can produce: the interface (proxy) class or the adaptor class. The latter consists of both a C++ header and a source file, which are meant to be edited and adapted to your needs. - The \c qdbusxml2dcpp tool is not meant to be run every time you compile your + The \c qdbusxml2cpp tool is not meant to be run every time you compile your application. Instead, it's meant to be used when developing the code or when the interface changes. -- cgit v0.12 From 1fef5048ba6bf9a55985103c28fea3a74bf558d2 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 7 Oct 2010 11:07:04 +0200 Subject: Doc: correct spelling --- doc/src/examples/basiclayouts.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/examples/basiclayouts.qdoc b/doc/src/examples/basiclayouts.qdoc index 1ecf394..cbc9297 100644 --- a/doc/src/examples/basiclayouts.qdoc +++ b/doc/src/examples/basiclayouts.qdoc @@ -66,7 +66,7 @@ horizontal layout. Next we use the \c createGridGroupBox() function to create a group box containing several line edits and a small text editor which are displayed in a grid layout. Finally, we use the - \c createFormGroupBox() function to createa a group box with + \c createFormGroupBox() function to create a group box with three labels and three input fields: a line edit, a combo box and a spin box. -- cgit v0.12 From 8c8bfec2083e10bc9869940c1b91b6e7897ab9d8 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 7 Oct 2010 11:12:18 +0200 Subject: Doc: correcting bug - lenght() pointed to setLength() in "See also" section. Correct link is resize() --- src/corelib/tools/qstring.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index d1060d2..ff9d877 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -4275,7 +4275,7 @@ QString& QString::fill(QChar ch, int size) Returns the number of characters in this string. Equivalent to size(). - \sa setLength() + \sa resize() */ /*! -- cgit v0.12 From 8b80b6e87f187f2066cfba0123dbfd8948e9e220 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 7 Oct 2010 11:37:38 +0200 Subject: Doc: Correcting Windows CE 6.0 to Windows Embedded CE 6.0 --- doc/src/platforms/supported-platforms.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/platforms/supported-platforms.qdoc b/doc/src/platforms/supported-platforms.qdoc index e7de4c3..31866c4 100644 --- a/doc/src/platforms/supported-platforms.qdoc +++ b/doc/src/platforms/supported-platforms.qdoc @@ -115,8 +115,8 @@ \o gcc (\l{http://www.scratchbox.org/}{Scratchbox)} \row \o Windows CE 5.0 (ARMv4i, x86, MIPS) \o MSVC 2005 WinCE 5.0 Standard (x86, pocket, smart, mipsii) - \row \o Windows CE 6.0 (ARMv4i, x86, MIPS) - \o MSVC 2008 WinCE 6.0 Professional + \row \o Windows Embedded CE 6.0 (ARMv4i, x86, MIPS) + \o MSVC 2008 WinCE Embedded 6.0 Professional \row \o Maemo 5(Linux, ARM, X11) \o gcc (\l{http://www.scratchbox.org/}{Scratchbox)} \row \o Symbian (Symbian/S60 3.1, 3.2) -- cgit v0.12 From 93b40aa12270714abe722bbc4e47166f5a47bdf4 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 7 Oct 2010 14:06:53 +0200 Subject: qdoc: Don't generate html output for png files. --- tools/qdoc3/pagegenerator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp index a187c2e..37dc191 100644 --- a/tools/qdoc3/pagegenerator.cpp +++ b/tools/qdoc3/pagegenerator.cpp @@ -310,10 +310,10 @@ PageGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker) const FakeNode *fakeNode = static_cast(node); if (fakeNode->subType() == Node::ExternalPage) return; -#ifdef QDOC_QML + if (fakeNode->subType() == Node::Image) + return; if (fakeNode->subType() == Node::QmlPropertyGroup) return; -#endif if (fakeNode->subType() == Node::Page) { if (node->count() > 0) qDebug("PAGE %s HAS CHILDREN", qPrintable(fakeNode->title())); -- cgit v0.12 From c235ecf5bae30fbd88845ec60e2ba2eaf2e8079e Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 7 Oct 2010 14:42:13 +0200 Subject: Make it possible to choose some EGLFS configuration options via envvars --- src/plugins/platforms/eglfs/qeglfsscreen.cpp | 36 +++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp index b31b204..682f2f4 100644 --- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp +++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE -//#define QEGL_EXTRA_DEBUG +// #define QEGL_EXTRA_DEBUG #ifdef QEGL_EXTRA_DEBUG struct AttrInfo { EGLint attr; const char *name; }; @@ -116,12 +116,36 @@ QEglFSScreen::QEglFSScreen(EGLNativeDisplayType display) qWarning("Initialized display %d %d\n", major, minor); QPlatformWindowFormat platformFormat; - platformFormat.setDepth(32); platformFormat.setWindowApi(QPlatformWindowFormat::OpenGL); - platformFormat.setRedBufferSize(8); - platformFormat.setGreenBufferSize(8); - platformFormat.setBlueBufferSize(8); - platformFormat.setSwapInterval(1); + + QByteArray depthString = qgetenv("QT_QPA_EGLFS_DEPTH"); + if (depthString.toInt() == 16) { + platformFormat.setDepth(16); + platformFormat.setRedBufferSize(5); + platformFormat.setGreenBufferSize(6); + platformFormat.setBlueBufferSize(5); + m_depth = 16; + m_format = QImage::Format_RGB16; + } else { + platformFormat.setDepth(32); + platformFormat.setRedBufferSize(8); + platformFormat.setGreenBufferSize(8); + platformFormat.setBlueBufferSize(8); + } + + if (!qgetenv("QT_QPA_EGLFS_MULTISAMPLE").isEmpty()) { + platformFormat.setSampleBuffers(true); + } + + int swapInterval = 1; + QByteArray swapIntervalString = qgetenv("QT_QPA_EGLFS_SWAPINTERVAL"); + if (!swapIntervalString.isEmpty()) { + bool ok; + swapInterval = swapIntervalString.toInt(&ok); + if (!ok) + swapInterval = 1; + } + platformFormat.setSwapInterval(swapInterval); EGLConfig config = q_configFromQPlatformWindowFormat(m_dpy, platformFormat); -- cgit v0.12 From 5ebb9bca00f401fc3657cc95a2cfafae5a14916e Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 7 Oct 2010 15:28:40 +0200 Subject: Doc: Marked some new properties as internal for now. --- src/gui/kernel/qgesture.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index 5725a22..e3339c4 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -260,6 +260,27 @@ QGesture::GestureCancelPolicy QGesture::gestureCancelPolicy() const /*! \property QPanGesture::acceleration + \brief the acceleration in the motion of the touch point for this gesture +*/ + +/*! + \property QPanGesture::horizontalVelocity + \brief the horizontal component of the motion of the touch point for this + gesture + \since 4.7.1 + \internal + + \sa verticalVelocity, acceleration +*/ + +/*! + \property QPanGesture::verticalVelocity + \brief the vertical component of the motion of the touch point for this + gesture + \since 4.7.1 + \internal + + \sa horizontalVelocity, acceleration */ /*! @@ -633,6 +654,12 @@ void QPinchGesture::setRotationAngle(qreal value) */ /*! + \property QSwipeGesture::velocity + \since 4.7.1 + \internal +*/ + +/*! \internal */ QSwipeGesture::QSwipeGesture(QObject *parent) -- cgit v0.12 From 0ffaf436d3a90a2f8c6cd81e70ba94f47539f4d3 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 7 Oct 2010 15:32:55 +0200 Subject: Doc: Re-added a link to the Qt site related to testing tools. --- doc/src/development/qtestlib.qdoc | 25 +++++++++++++------------ doc/src/qt-webpages.qdoc | 4 ++-- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/doc/src/development/qtestlib.qdoc b/doc/src/development/qtestlib.qdoc index 23d6670..8e2089a 100644 --- a/doc/src/development/qtestlib.qdoc +++ b/doc/src/development/qtestlib.qdoc @@ -32,7 +32,7 @@ \ingroup frameworks-technologies \ingroup qt-basic-concepts - + \keyword qtestlib The QTestLib framework, provided by Nokia, is a tool for unit @@ -40,10 +40,6 @@ all the functionality commonly found in unit testing frameworks as well as extensions for testing graphical user interfaces. - Table of contents: - - \tableofcontents - \section1 QTestLib Features QTestLib is designed to ease the writing of unit tests for Qt @@ -88,6 +84,10 @@ \o Custom types can easily be added to the test data and test output. \endtable + \note For higher-level GUI and application testing needs, please + see the \l{Partner Directory} for Qt testing products provided by + Nokia partners. + \section1 QTestLib API @@ -213,17 +213,17 @@ \endlist \section2 Creating a Benchmark - + To create a benchmark, follow the instructions for creating a test and then add a QBENCHMARK macro to the test function that you want to benchmark. - + \snippet doc/src/snippets/code/doc_src_qtestlib.qdoc 12 - + The code inside the QBENCHMARK macro will be measured, and possibly also repeated several times in order to get an accurate measurement. This depends on the selected measurement back-end. Several back-ends are available. They can be selected on the command line: - + \target testlib-benchmarking-measurement \table @@ -243,7 +243,7 @@ \o -eventcounter \o All platforms \endtable - + In short, walltime is always available but requires many repetitions to get a useful result. Tick counters are usually available and can provide @@ -255,7 +255,7 @@ Event counting is available on all platforms and it provides the number of events that were received by the event loop before they are sent to their corresponding targets (this might include non-Qt events). - + \note Depending on the device configuration, Tick counters on the Windows CE platform may not be as fine-grained, compared to other platforms. Devices that do not support high-resolution timers default to @@ -334,7 +334,7 @@ The CPU tick counters used for benchmarking is licensed under the following license: (from src/testlib/3rdparty/cycle.h) - + \legalese Copyright (c) 2003, 2006 Matteo Frigo\br Copyright (c) 2003, 2006 Massachusetts Institute of Technology @@ -365,6 +365,7 @@ \brief A short introduction to testing with QTestLib. \contentspage QTestLib Manual \nextpage {Chapter 1: Writing a Unit Test}{Chapter 1} + \ingroup best-practices \title QTestLib Tutorial diff --git a/doc/src/qt-webpages.qdoc b/doc/src/qt-webpages.qdoc index 9947d7b..05817df 100644 --- a/doc/src/qt-webpages.qdoc +++ b/doc/src/qt-webpages.qdoc @@ -46,8 +46,8 @@ */ /*! - \externalpage http://qt.nokia.com/products/add-on-products/add-on-products/ - \title Third-Party Tools + \externalpage http://qt.nokia.com/services-partners/partners/partner-directory + \title Partner Directory */ /*! -- cgit v0.12 From 86d121aebedfa2dec1affa5879e4274780f2cc28 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 7 Oct 2010 15:34:22 +0200 Subject: Doc: Fixed qdoc warnings. --- src/declarative/graphicsitems/qdeclarativepath.cpp | 2 +- src/declarative/qml/qdeclarativeinfo.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativepath.cpp b/src/declarative/graphicsitems/qdeclarativepath.cpp index d526688..966c51b 100644 --- a/src/declarative/graphicsitems/qdeclarativepath.cpp +++ b/src/declarative/graphicsitems/qdeclarativepath.cpp @@ -871,7 +871,7 @@ void QDeclarativePathCubic::addToPath(QPainterPath &path) */ /*! - \qmlproperty real value + \qmlproperty real PathPercent::value The proporation of items that should be laid out up to this point. This value should always be higher than the last value specified diff --git a/src/declarative/qml/qdeclarativeinfo.cpp b/src/declarative/qml/qdeclarativeinfo.cpp index c6560dd..56c0599 100644 --- a/src/declarative/qml/qdeclarativeinfo.cpp +++ b/src/declarative/qml/qdeclarativeinfo.cpp @@ -55,7 +55,8 @@ QT_BEGIN_NAMESPACE \fn QDeclarativeInfo qmlInfo(const QObject *object) \relates QDeclarativeEngine - \brief Prints warnings messages that include the file and line number for QML types. + Prints warning messages that include the file and line number for the + specified QML \a object. When QML types display warning messages, it improves traceability if they include the QML file and line number on which the -- cgit v0.12 From 6a23ac7ea68bc87ebceb58c28c398d3f364a3a1f Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 7 Oct 2010 15:36:22 +0200 Subject: Doc: Fixed links to the online BSD license information. --- doc/src/getting-started/examples.qdoc | 3 ++- doc/src/legal/opensourceedition.qdoc | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index 398eee8..aa0b695 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -53,7 +53,8 @@ deliberately show off Qt's features. You might want to look at these as well. - These examples are provided under the terms of the \l{BSD License}. + These examples are provided under the terms of the + \l{New and Modified BSD Licenses}{Modified BSD License}. \section1 Examples by Functional Area diff --git a/doc/src/legal/opensourceedition.qdoc b/doc/src/legal/opensourceedition.qdoc index e3a3e27..602e6d3 100644 --- a/doc/src/legal/opensourceedition.qdoc +++ b/doc/src/legal/opensourceedition.qdoc @@ -46,7 +46,7 @@ that are compatible with these free software licenses. Additionally, the \l{Qt Examples}{examples} included with Qt are provided under - the terms of the \l{BSD License}. + the terms of the \l{New and Modified BSD Licenses}{Modified BSD License}. The support of open source with the Open Source Versions of Qt has enabled large successful software projects like KDE to thrive, with thousands of developers -- cgit v0.12 From 509dedfe7b8af7bfb8b583dd3d672b5285b044f2 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 7 Oct 2010 17:15:56 +0200 Subject: Doc: Fixed qdoc warnings. --- doc/src/classes/phonon-api.qdoc | 50 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/doc/src/classes/phonon-api.qdoc b/doc/src/classes/phonon-api.qdoc index a429e5a..6c9c8de 100644 --- a/doc/src/classes/phonon-api.qdoc +++ b/doc/src/classes/phonon-api.qdoc @@ -4114,7 +4114,7 @@ */ /*! - \fn Phonon::VideoWidget::snapshot() + \fn Phonon::VideoWidget::snapshot() const \since 4.7 Returns a snapshot of the current frame shown in the widget. @@ -4312,6 +4312,16 @@ */ /*! + \class Phonon::VideoWidgetInterface44 + \inmodule Phonon + \since 4.7 +*/ + +/*! + \fn Phonon::VideoWidgetInterface44::snapshot() const +*/ + +/*! \typedef Phonon::VideoWidgetInterfaceLatest \inmodule Phonon \since 4.7 @@ -5076,6 +5086,22 @@ */ /*! + \fn int Phonon::AudioDataOutput::sampleRate() const + + Returns the sample rate measured in Hertz, as reported by the backend. + If the backend is unavailable -1 is returned. +*/ + +/*! + \fn void Phonon::AudioDataOutput::endOfMedia(int remainingSamples) + + This signal is emitted before the final dataReady() signal is emitted for + a media. The \a remainingSamples value sent by the signal contains the + number of samples that will be sent in the final dataReady() signal for + the media. +*/ + +/*! \fn Phonon::AudioDataOutput::dataReady(const QMap > &data) This signal is emitted whenever there is data available to read. The @@ -5084,13 +5110,28 @@ */ /*! + \fn Phonon::AudioDataOutputPrivate::AudioDataOutputPrivate() + \internal +*/ + +/*! \fn Phonon::AudioDataOutputInterface::~AudioDataOutputInterface() Destroys the data interface. */ /*! - \fn Phonon::AudioDataOutputInterface::frontendObject() + \fn Phonon::AudioDataOutputInterface::frontendObject() const + \internal +*/ + +/*! + \fn Phonon::AudioDataOutputInterface::setFrontendObject(AudioDataOutput *) + \internal +*/ + +/*! + \fn Phonon::GlobalConfigPrivate::GlobalConfigPrivate() \internal */ @@ -5098,3 +5139,8 @@ \fn Phonon::GlobalConfigPrivate::~GlobalConfigPrivate() \internal */ + +/*! + \fn Phonon::SwiftSlider::~SwiftSlider() + \internal +*/ -- cgit v0.12 From ba7bec67c4ff68efa0abf3e204c39324fd6caf55 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 7 Oct 2010 17:49:00 +0200 Subject: Doc: Renamed an external reference to work around an auto-linking issue. --- doc/src/external-resources.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/external-resources.qdoc b/doc/src/external-resources.qdoc index 3041046..7d1b5bb 100644 --- a/doc/src/external-resources.qdoc +++ b/doc/src/external-resources.qdoc @@ -436,7 +436,7 @@ /*! \externalpage https://developer.mozilla.org/en/JavaScript - \title JavaScript + \title JavaScript Resources */ /*! -- cgit v0.12 From f447ae026637a75d565e9347eb19f33d09557039 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 7 Oct 2010 19:07:06 +0200 Subject: Doc: Fixed warnings caused by an earlier change. Made docs consistent. Change b65a598e0c580585bd16babfd46967b0f4cf8931 broke some links. --- doc/src/platforms/emb-deployment.qdoc | 2 +- doc/src/platforms/emb-install.qdoc | 6 +++--- doc/src/platforms/emb-qvfb.qdoc | 4 ++-- doc/src/platforms/emb-running.qdoc | 2 +- doc/src/platforms/mac-differences.qdoc | 2 +- doc/src/platforms/qt-embedded-linux.qdoc | 2 +- doc/src/platforms/symbian-introduction.qdoc | 12 ++++++------ doc/src/platforms/wince-customization.qdoc | 2 +- doc/src/platforms/wince-introduction.qdoc | 6 +++--- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/doc/src/platforms/emb-deployment.qdoc b/doc/src/platforms/emb-deployment.qdoc index 6b22ba4..9a36097 100644 --- a/doc/src/platforms/emb-deployment.qdoc +++ b/doc/src/platforms/emb-deployment.qdoc @@ -58,7 +58,7 @@ directory relative to the path set using the \c -prefix parameter when running the \c configure script; ensure that this is a sensible path in the target device environment. See the - \l {Installing Qt on Embedded Linux#Step 3: Building the + \l {Installing Qt for Embedded Linux#Step 3: Building the Library}{installation} documentation for more details. \section1 Environment Variables diff --git a/doc/src/platforms/emb-install.qdoc b/doc/src/platforms/emb-install.qdoc index 11392b4..b5b408a 100644 --- a/doc/src/platforms/emb-install.qdoc +++ b/doc/src/platforms/emb-install.qdoc @@ -28,10 +28,10 @@ /*! \page qt-embedded-install.html - \title Installing Qt on Embedded Linux + \title Installing Qt for Embedded Linux \ingroup qt-embedded-linux \ingroup installation - \brief How to install Qt on Embedded Linux. + \brief How to install Qt for Embedded Linux. This document describes how to install \l{Qt for Embedded Linux} in your development environment: @@ -152,7 +152,7 @@ \endlist Note that the virtual framebuffer requires a Qt for X11 - installation. See \l {Installing Qt on X11 Platforms} for details. + installation. See \l {Installing Qt for X11 Platforms} for details. The Linux framebuffer, on the other hand, is enabled by default on all modern Linux distributions. For information on older versions, diff --git a/doc/src/platforms/emb-qvfb.qdoc b/doc/src/platforms/emb-qvfb.qdoc index 4be2f64..418d2d2 100644 --- a/doc/src/platforms/emb-qvfb.qdoc +++ b/doc/src/platforms/emb-qvfb.qdoc @@ -40,8 +40,8 @@ QVFb is an X11 application supplied with Qt for X11 that provides a virtual framebuffer for Qt for Embedded Linux to use. To use it, - you need to \l{Installing Qt on X11 Platforms}{configure and - install Qt on X11 platforms} appropriately. Further requirements + you need to \l{Installing Qt for X11 Platforms}{configure and + install Qt for X11 platforms} appropriately. Further requirements can be found in the \l{Qt for Embedded Linux Requirements} document. diff --git a/doc/src/platforms/emb-running.qdoc b/doc/src/platforms/emb-running.qdoc index 269f4f3..12222a6 100644 --- a/doc/src/platforms/emb-running.qdoc +++ b/doc/src/platforms/emb-running.qdoc @@ -63,7 +63,7 @@ \row \o Provided that the environment variables are adjusted properly - during the \l {Installing Qt on Embedded Linux}{installation process}, you + during the \l {Installing Qt for Embedded Linux}{installation process}, you should see the \l {Text Edit} demo appear. It might be that the hardware drivers must be specified explicitly diff --git a/doc/src/platforms/mac-differences.qdoc b/doc/src/platforms/mac-differences.qdoc index dfcecca..8436043 100644 --- a/doc/src/platforms/mac-differences.qdoc +++ b/doc/src/platforms/mac-differences.qdoc @@ -32,7 +32,7 @@ \ingroup platform-specific This file outlines known issues and possible workarounds when - using Qt on Mac OS X. Contact Qt's technical support team if you find + using Qt for Mac OS X. Contact Qt's technical support team if you find additional issues which are not covered here. (See also the document \l{qtmac-as-native.html} {Qt is Mac OS X Native}.) diff --git a/doc/src/platforms/qt-embedded-linux.qdoc b/doc/src/platforms/qt-embedded-linux.qdoc index 553c4b1..cd20917 100644 --- a/doc/src/platforms/qt-embedded-linux.qdoc +++ b/doc/src/platforms/qt-embedded-linux.qdoc @@ -67,7 +67,7 @@ \o \list \o \l {Qt for Embedded Linux Architecture}{Architecture Overview} - \o \l {Installing Qt on Embedded Linux}{Installation} + \o \l {Installing Qt for Embedded Linux}{Installation} \o \l {Running Qt for Embedded Linux Applications}{Running Applications} \o \l {Qt for Embedded Linux Examples}{Examples} \endlist diff --git a/doc/src/platforms/symbian-introduction.qdoc b/doc/src/platforms/symbian-introduction.qdoc index 8932747..7bc5303 100644 --- a/doc/src/platforms/symbian-introduction.qdoc +++ b/doc/src/platforms/symbian-introduction.qdoc @@ -29,7 +29,7 @@ \group qtsymbian \title Qt for the Symbian platform \ingroup qt-embedded - \brief Documents related to Qt on the Symbian platform + \brief Documents related to Qt for the Symbian platform Qt for Symbian is a C++ framework for GUI and application development for embedded devices running Symbian. Qt for Symbian provides all @@ -42,14 +42,14 @@ \o \list \o \l {Qt for the Symbian platform Requirements} - \o \l {Installing Qt on the Symbian platform from a Binary Package} - \o \l {Installing Qt on the Symbian platform} + \o \l {Installing Qt for the Symbian platform from a Binary Package} + \o \l {Installing Qt for the Symbian platform} \o \l {The Symbian platform - Introduction to Qt}{Introduction to using Qt} \endlist \o \list \o \l {Exception Safety with Symbian} - \o \l {Platform Notes - Symbian} {Qt for the Symbian platform - state of support} + \o \l {Platform and Compiler Notes - Symbian} {Qt for the Symbian platform - state of support} \o \l {qmake Platform Notes#Symbian platform} {Qt for Symbian extensions for qmake} \o \l {Symbian Platform Security Requirements} {Symbian Platform Security Requirements} \endlist @@ -93,10 +93,10 @@ \section1 Installing Qt and Running Demos - Follow the instructions found in \l{Installing Qt on the Symbian platform from a Binary Package} + Follow the instructions found in \l{Installing Qt for the Symbian platform from a Binary Package} to learn how to install Qt using a binary package and how to build and run Qt demos. - Follow the instructions found in \l{Installing Qt on the Symbian platform} to learn how to install Qt using + Follow the instructions found in \l{Installing Qt for the Symbian platform} to learn how to install Qt using using source package and how to build and run the Qt demos. \section1 Building Your Own Applications diff --git a/doc/src/platforms/wince-customization.qdoc b/doc/src/platforms/wince-customization.qdoc index a674350..b3b9170 100644 --- a/doc/src/platforms/wince-customization.qdoc +++ b/doc/src/platforms/wince-customization.qdoc @@ -33,7 +33,7 @@ When working with a custom SDK for Windows CE, Qt provides an easy way to add support for it to your development environment. The following is - a tutorial that covers how to create a specification for Qt on Windows + a tutorial that covers how to create a specification for Qt for Windows CE platforms. \tableofcontents diff --git a/doc/src/platforms/wince-introduction.qdoc b/doc/src/platforms/wince-introduction.qdoc index cd66242..2e9da59 100644 --- a/doc/src/platforms/wince-introduction.qdoc +++ b/doc/src/platforms/wince-introduction.qdoc @@ -29,7 +29,7 @@ \group qtce \title Qt for Windows CE \ingroup qt-embedded - \brief Documents related to Qt on Windows CE + \brief Documents related to Qt for Windows CE Qt for Windows CE is a C++ framework for GUI and application development for embedded devices running Windows CE. It runs on a variety of processors, @@ -41,7 +41,7 @@ \o \list \o \l {Qt for Windows CE Requirements} - \o \l {Installing Qt on Windows CE} + \o \l {Installing Qt for Windows CE} \o \l {Windows CE - Introduction to using Qt}{Introduction to using Qt} \endlist \o @@ -81,7 +81,7 @@ \section1 Installing Qt - Follow the instructions found in \l{Installing Qt on Windows CE}. + Follow the instructions found in \l{Installing Qt for Windows CE}. \section1 Building your own applications -- cgit v0.12 From 6b75ccad5829571eb6df9a0bbb05be2ac1480032 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 7 Oct 2010 19:10:07 +0200 Subject: Doc: Fixed warnings caused by an earlier change. Made docs consistent. Related to change f447ae026637a75d565e9347eb19f33d09557039. --- doc/src/development/qtestlib.qdoc | 2 +- doc/src/getting-started/installation.qdoc | 8 ++++---- doc/src/qt4-intro.qdoc | 2 +- doc/src/sql-programming/sql-driver.qdoc | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/src/development/qtestlib.qdoc b/doc/src/development/qtestlib.qdoc index 0379027..e53957f 100644 --- a/doc/src/development/qtestlib.qdoc +++ b/doc/src/development/qtestlib.qdoc @@ -320,7 +320,7 @@ host computer and the device. Thus header files and libraries are needed to compile cetest and QtRemote successfully. - Prior to \l{Installing Qt on Windows CE}{installation} of Qt, you need to set your + Prior to \l{Installing Qt for Windows CE}{installation} of Qt, you need to set your \c INCLUDE and \c LIB environment variables properly. A default installation of Windows Mobile 5 for Pocket PC can be obtained by: diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index c6e79d9..8f6f16a 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -40,7 +40,7 @@ for your platform from the following list. */ /*! \page install-x11.html -\title Installing Qt on X11 Platforms +\title Installing Qt for X11 Platforms \ingroup installation \brief How to install Qt on platforms with X11. \previouspage Installation @@ -151,7 +151,7 @@ for your platform from the following list. /*! \page install-win.html -\title Installing Qt on Windows +\title Installing Qt for Windows \ingroup installation \brief How to install Qt on Windows. \previouspage Installation @@ -269,7 +269,7 @@ for your platform from the following list. */ /*! \page install-mac.html -\title Installing Qt on Mac OS X +\title Installing Qt for Mac OS X \ingroup installation \brief How to install Qt on Mac OS X. \previouspage Installation @@ -563,7 +563,7 @@ in the \l{Qt for the Symbian platform Requirements} document. This document describes how to install and configure Qt for the Symbian platform from scratch. If you are using pre-built binaries, follow -the instructions given in the \l{Installing Qt on the Symbian platform from a +the instructions given in the \l{Installing Qt for the Symbian platform from a Binary Package} document. \section1 Step 1: Set Up the Development Environment diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc index 7d55f82..2384051 100644 --- a/doc/src/qt4-intro.qdoc +++ b/doc/src/qt4-intro.qdoc @@ -157,7 +157,7 @@ \l{QtUiTools}{dynamic user interface building}. \o New \l{Proxy Models}{proxy models} to enable view-specific sorting and filtering of data displayed using item views. - \o Support for \l{Installing Qt on Mac OS X}{universal binaries} on Mac OS X. + \o Support for \l{Installing Qt for Mac OS X}{universal binaries} on Mac OS X. \o Additional features for developers using \l{QtOpenGL}{OpenGL}, such as support for pixel and sample buffers. \o A flexible \l{QSyntaxHighlighter}{syntax highlighting class} based on the diff --git a/doc/src/sql-programming/sql-driver.qdoc b/doc/src/sql-programming/sql-driver.qdoc index 21b106a..9c99ad2 100644 --- a/doc/src/sql-programming/sql-driver.qdoc +++ b/doc/src/sql-programming/sql-driver.qdoc @@ -153,7 +153,7 @@ \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 3 - After installing Qt, as described in the \l{Installing Qt on X11 + After installing Qt, as described in the \l{Installing Qt for X11 Platforms} document, you also need to install the plugin in the standard location: @@ -478,7 +478,7 @@ \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 13 - After installing Qt, as described in the \l{Installing Qt on X11 Platforms} document, + After installing Qt, as described in the \l{Installing Qt for X11 Platforms} document, you also need to install the plugin in the standard location: \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 14 @@ -565,7 +565,7 @@ \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 18 - After installing Qt, as described in the \l{Installing Qt on X11 Platforms} document, + After installing Qt, as described in the \l{Installing Qt for X11 Platforms} document, you also need to install the plugin in the standard location: \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 19 @@ -638,7 +638,7 @@ \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 21 - After installing Qt, as described in the \l{Installing Qt on X11 Platforms} document, + After installing Qt, as described in the \l{Installing Qt for X11 Platforms} document, you also need to install the plugin in the standard location: \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 22 -- cgit v0.12 From 2a4c0afc95d1cbed3161efd43bb781758bc7566d Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 7 Oct 2010 19:15:59 +0200 Subject: Doc: Fixed snippet reference for the Getting Started QML guide. Related to change 96226ad15202770f72e257d1a75654be9582326c. --- doc/src/getting-started/gettingstartedqml.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/getting-started/gettingstartedqml.qdoc b/doc/src/getting-started/gettingstartedqml.qdoc index 065628a..c555627 100644 --- a/doc/src/getting-started/gettingstartedqml.qdoc +++ b/doc/src/getting-started/gettingstartedqml.qdoc @@ -81,7 +81,7 @@ In QML, the basic visual item is the \l {Rectangle}{Rectangle} element. The \c Rectangle element has properties to control the element's appearance and location. - \snippet examples/tutorials/gettingStarted/gsQml/core/Button.qml document + \snippet examples/tutorials/gettingStarted/gsQml/parts/part0/Button.qml document First, the \c { import QtQuick 1.0 } allows the qmlviewer tool to import the QML elements we will later use. This line must exist for every QML file. Notice that the version -- cgit v0.12 From 3973481089f9101668c20a9317b759e09a784070 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 7 Oct 2010 19:19:15 +0200 Subject: Doc: Fixed qdoc warnings. --- src/declarative/util/qlistmodelinterface.cpp | 8 ++------ src/plugins/accessible/widgets/simplewidgets.cpp | 6 +++--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/declarative/util/qlistmodelinterface.cpp b/src/declarative/util/qlistmodelinterface.cpp index acf4dd6..1e2dfb7 100644 --- a/src/declarative/util/qlistmodelinterface.cpp +++ b/src/declarative/util/qlistmodelinterface.cpp @@ -46,6 +46,7 @@ QT_BEGIN_NAMESPACE /*! \internal \class QListModelInterface + \since 4.7 \brief The QListModelInterface class can be subclassed to provide C++ models to QDeclarativeGraphics Views This class is comprised primarily of pure virtual functions which @@ -70,15 +71,10 @@ QT_BEGIN_NAMESPACE Returns the number of data entries in the model. */ -/*! \fn QHash QListModelInterface::data(int index, const QList& roles) const +/*! \fn QVariant QListModelInterface::data(int index, int role) const Returns the data at the given \a index for the specified \a roles. */ -/*! \fn bool QListModelInterface::setData(int index, const QHash& values) - Sets the data at the given \a index. \a values is a mapping of - QVariant values to roles. Returns false. -*/ - /*! \fn QList QListModelInterface::roles() const Returns the list of roles for which the list model interface provides data. diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp index f39d538..4a3acbb 100644 --- a/src/plugins/accessible/widgets/simplewidgets.cpp +++ b/src/plugins/accessible/widgets/simplewidgets.cpp @@ -602,7 +602,7 @@ int QAccessibleDisplay::navigate(RelationFlag rel, int entry, QAccessibleInterfa return QAccessibleWidgetEx::navigate(rel, entry, target); } -/*! \reimp */ +/*! \internal */ QString QAccessibleDisplay::imageDescription() { #ifndef QT_NO_TOOLTIP @@ -612,7 +612,7 @@ QString QAccessibleDisplay::imageDescription() #endif } -/*! \reimp */ +/*! \internal */ QSize QAccessibleDisplay::imageSize() { QLabel *label = qobject_cast(widget()); @@ -624,7 +624,7 @@ QSize QAccessibleDisplay::imageSize() return pixmap->size(); } -/*! \reimp */ +/*! \internal */ QRect QAccessibleDisplay::imagePosition(QAccessible2::CoordinateType coordType) { QLabel *label = qobject_cast(widget()); -- cgit v0.12 From 0f9d642e105da1644f4ed846a696510f9a9f1daf Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 7 Oct 2010 21:23:14 +0200 Subject: Doc: tuning search reasult box --- doc/src/template/style/style.css | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 3dcea96..ec0202a 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -664,6 +664,7 @@ #resultdialog.active { display: block; + width:30%; } #resultdialog #resultclose { -- cgit v0.12 From eca7559542584a5675d22d619a7710e0f17cfba0 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 8 Oct 2010 09:08:34 +1000 Subject: Fix dragging items within a PathView The test to determine whether the mouse had moved greater than startDragDistance() compared the starting point on the path to the current mouse position. Fix to compare nearest path position. Task-number: QTBUG-14220 Reviewed-by: Michael Brasser --- src/declarative/graphicsitems/qdeclarativepathview.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 31943b2..81c84f5 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -1112,16 +1112,16 @@ void QDeclarativePathViewPrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent if (!interactive || !lastPosTime.isValid()) return; + qreal newPc; + QPointF pathPoint = pointNear(event->pos(), &newPc); if (!stealMouse) { - QPointF delta = event->pos() - startPoint; + QPointF delta = pathPoint - startPoint; if (qAbs(delta.x()) > QApplication::startDragDistance() || qAbs(delta.y()) > QApplication::startDragDistance()) stealMouse = true; } if (stealMouse) { moveReason = QDeclarativePathViewPrivate::Mouse; - qreal newPc; - pointNear(event->pos(), &newPc); qreal diff = (newPc - startPc)*modelCount*mappedRange; if (diff) { setOffset(offset + diff); -- cgit v0.12 From 8480eb288990c44c9ab337f42898bc4ef6dc62f4 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 8 Oct 2010 11:06:34 +1000 Subject: Don't allow multiple values to be assigned to a singular property Task-number: QTBUG-14005 --- src/declarative/qml/qdeclarativecompiler.cpp | 3 +++ .../declarative/qdeclarativebehaviors/data/reassignedAnimation.qml | 7 ++++++- .../qdeclarativelanguage/data/singularProperty.2.errors.txt | 1 + .../declarative/qdeclarativelanguage/data/singularProperty.2.qml | 7 +++++++ .../qdeclarativelanguage/data/singularProperty.errors.txt | 1 + .../declarative/qdeclarativelanguage/data/singularProperty.qml | 6 ++++++ .../declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp | 2 ++ 7 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/singularProperty.2.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/singularProperty.2.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/singularProperty.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/singularProperty.qml diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index dc28e22..7a29f24 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -1932,6 +1932,9 @@ bool QDeclarativeCompiler::buildPropertyAssignment(QDeclarativeParser::Property { obj->addValueProperty(prop); + if (prop->values.count() > 1) + COMPILE_EXCEPTION(prop->values.at(0), tr( "Cannot assign multiple values to a singular property") ); + for (int ii = 0; ii < prop->values.count(); ++ii) { Value *v = prop->values.at(ii); if (v->object) { diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml b/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml index 9fca5c3..56ac216 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml @@ -7,9 +7,9 @@ Rectangle { objectName: "MyRect" width: 100; height: 100; color: "green" Behavior on x { + id: myBehavior objectName: "MyBehavior" NumberAnimation {id: na1; duration: 200 } - NumberAnimation {id: na2; duration: 1000 } } } MouseArea { @@ -24,4 +24,9 @@ Rectangle { x: 200 } } + + NumberAnimation {id: na2; duration: 1000 } + Component.onCompleted: { + myBehavior.animation = na2; + } } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/singularProperty.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/singularProperty.2.errors.txt new file mode 100644 index 0000000..beae562 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/singularProperty.2.errors.txt @@ -0,0 +1 @@ +5:10:Cannot assign multiple values to a singular property diff --git a/tests/auto/declarative/qdeclarativelanguage/data/singularProperty.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/singularProperty.2.qml new file mode 100644 index 0000000..2fd7fd2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/singularProperty.2.qml @@ -0,0 +1,7 @@ +import QtQuick 1.0 + +QtObject { + property QtObject a + a: [ QtObject {}, QtObject {} ] +} + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/singularProperty.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/singularProperty.errors.txt new file mode 100644 index 0000000..beae562 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/singularProperty.errors.txt @@ -0,0 +1 @@ +5:10:Cannot assign multiple values to a singular property diff --git a/tests/auto/declarative/qdeclarativelanguage/data/singularProperty.qml b/tests/auto/declarative/qdeclarativelanguage/data/singularProperty.qml new file mode 100644 index 0000000..da56cb8 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/singularProperty.qml @@ -0,0 +1,6 @@ +import QtQuick 1.0 + +QtObject { + property variant a + a: [ QtObject {}, QtObject {} ] +} diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 9a8c944..bb1312b 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -380,6 +380,8 @@ void tst_qdeclarativelanguage::errors_data() QTest::newRow("invalidProperty") << "invalidProperty.qml" << "invalidProperty.errors.txt" << false; QTest::newRow("nonScriptableProperty") << "nonScriptableProperty.qml" << "nonScriptableProperty.errors.txt" << false; QTest::newRow("notAvailable") << "notAvailable.qml" << "notAvailable.errors.txt" << false; + QTest::newRow("singularProperty") << "singularProperty.qml" << "singularProperty.errors.txt" << false; + QTest::newRow("singularProperty.2") << "singularProperty.2.qml" << "singularProperty.2.errors.txt" << false; } -- cgit v0.12 From a5b0d58bbba508d708b2711124c61a74e3b4f310 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 8 Oct 2010 11:26:57 +1000 Subject: Ensure Flickable.contentX and Flickable.contentY return correct values. The animation value was used previously, but this isn't the actual position of the contentItem. Task-number: QTBUG-13603 Reviewed-by: Michael Brasser --- src/declarative/graphicsitems/qdeclarativeflickable.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 33c21b1..001abca 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -466,7 +466,7 @@ QDeclarativeFlickable::~QDeclarativeFlickable() qreal QDeclarativeFlickable::contentX() const { Q_D(const QDeclarativeFlickable); - return -d->hData.move.value(); + return -d->contentItem->x(); } void QDeclarativeFlickable::setContentX(qreal pos) @@ -484,7 +484,7 @@ void QDeclarativeFlickable::setContentX(qreal pos) qreal QDeclarativeFlickable::contentY() const { Q_D(const QDeclarativeFlickable); - return -d->vData.move.value(); + return -d->contentItem->y(); } void QDeclarativeFlickable::setContentY(qreal pos) -- cgit v0.12 From e38185424bda5b97bca4c381abbb6f4c577d55cf Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 8 Oct 2010 11:44:16 +1000 Subject: Remove some unnecessary includes in cpp files --- src/declarative/graphicsitems/qdeclarativeimagebase.cpp | 2 -- src/declarative/graphicsitems/qdeclarativeitem.cpp | 1 - src/declarative/graphicsitems/qdeclarativepainteditem.cpp | 1 - src/declarative/qml/qdeclarativecomponent.cpp | 1 - src/declarative/util/qdeclarativefontloader.cpp | 1 - 5 files changed, 6 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp index 02b4807..b06e2f7 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp @@ -46,8 +46,6 @@ #include #include -#include - QT_BEGIN_NAMESPACE QDeclarativeImageBase::QDeclarativeImageBase(QDeclarativeImageBasePrivate &dd, QDeclarativeItem *parent) diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 250a43b..735698e 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -56,7 +56,6 @@ #include #include -#include #include #include #include diff --git a/src/declarative/graphicsitems/qdeclarativepainteditem.cpp b/src/declarative/graphicsitems/qdeclarativepainteditem.cpp index a6db1fa..b470b3a 100644 --- a/src/declarative/graphicsitems/qdeclarativepainteditem.cpp +++ b/src/declarative/graphicsitems/qdeclarativepainteditem.cpp @@ -44,7 +44,6 @@ #include #include -#include #include #include #include diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index b532b0c..cfef9cf 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -57,7 +57,6 @@ #include #include -#include #include #include diff --git a/src/declarative/util/qdeclarativefontloader.cpp b/src/declarative/util/qdeclarativefontloader.cpp index 3e4a81a..d2f65ef 100644 --- a/src/declarative/util/qdeclarativefontloader.cpp +++ b/src/declarative/util/qdeclarativefontloader.cpp @@ -49,7 +49,6 @@ #include #include #include -#include #include #include -- cgit v0.12 From 0bf05331d901ca27e358ec22569a07489a70b7a5 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 8 Oct 2010 11:46:36 +1000 Subject: emit currentSectionChanged when section changes in ListView. Task-number: QTBUG-13981 Reviewed-by: Michael Brasser --- src/declarative/graphicsitems/qdeclarativelistview.cpp | 15 ++++++++++++--- .../qdeclarativelistview/tst_qdeclarativelistview.cpp | 6 ++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 6b46bc5..4943aef 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1009,18 +1009,27 @@ void QDeclarativeListViewPrivate::updateSections() void QDeclarativeListViewPrivate::updateCurrentSection() { + Q_Q(QDeclarativeListView); if (!sectionCriteria || visibleItems.isEmpty()) { - currentSection.clear(); + if (!currentSection.isEmpty()) { + currentSection.clear(); + emit q->currentSectionChanged(); + } return; } int index = 0; while (index < visibleItems.count() && visibleItems.at(index)->endPosition() < position()) ++index; + QString newSection = currentSection; if (index < visibleItems.count()) - currentSection = visibleItems.at(index)->attached->section(); + newSection = visibleItems.at(index)->attached->section(); else - currentSection = visibleItems.first()->attached->section(); + newSection = visibleItems.first()->attached->section(); + if (newSection != currentSection) { + currentSection = newSection; + emit q->currentSectionChanged(); + } } void QDeclarativeListViewPrivate::updateCurrent(int modelIndex) diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 6452bae..65ff635 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -937,6 +937,8 @@ void tst_QDeclarativeListView::sections() QCOMPARE(next->text().toInt(), (i+1)/5); } + QSignalSpy currentSectionChangedSpy(listview, SIGNAL(currentSectionChanged())); + // Remove section boundary model.removeItem(5); @@ -972,9 +974,13 @@ void tst_QDeclarativeListView::sections() listview->setContentY(140); QTRY_COMPARE(listview->currentSection(), QString("1")); + QTRY_COMPARE(currentSectionChangedSpy.count(), 1); + listview->setContentY(20); QTRY_COMPARE(listview->currentSection(), QString("0")); + QTRY_COMPARE(currentSectionChangedSpy.count(), 2); + item = findItem(contentItem, "wrapper", 1); QTRY_VERIFY(item); QTRY_COMPARE(item->height(), 20.0); -- cgit v0.12 From 6ac4acce8a759f32cd70336065f77d38a9baf2df Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 7 Oct 2010 19:05:27 +1000 Subject: Support device orientation in harmattan Task-number: QTBUG-14137 Reviewed-by: Aaron Kennedy (cherry picked from commit f9a8c4ec598a0070b9d2d861efe5ee69d5045a1f) --- tools/qml/deviceorientation_harmattan.cpp | 161 ++++++++++++++++++++++++++++++ tools/qml/qml.pri | 5 + 2 files changed, 166 insertions(+) create mode 100644 tools/qml/deviceorientation_harmattan.cpp diff --git a/tools/qml/deviceorientation_harmattan.cpp b/tools/qml/deviceorientation_harmattan.cpp new file mode 100644 index 0000000..22f9f4c --- /dev/null +++ b/tools/qml/deviceorientation_harmattan.cpp @@ -0,0 +1,161 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "deviceorientation.h" +#include +#include + +#define ORIENTATION_SERVICE "com.nokia.SensorService" +#define ORIENTATION_PATH "/org/maemo/contextkit/Screen/TopEdge" +#define CONTEXT_INTERFACE "org.maemo.contextkit.Property" +#define CONTEXT_CHANGED "ValueChanged" +#define CONTEXT_SUBSCRIBE "Subscribe" +#define CONTEXT_UNSUBSCRIBE "Unsubscribe" +#define CONTEXT_GET "Get" + + +class HarmattanOrientation : public DeviceOrientation +{ + Q_OBJECT +public: + HarmattanOrientation() + : o(UnknownOrientation), sensorEnabled(false) + { + resumeListening(); + // connect to the orientation change signal + bool ok = QDBusConnection::systemBus().connect(ORIENTATION_SERVICE, ORIENTATION_PATH, + CONTEXT_INTERFACE, + CONTEXT_CHANGED, + this, + SLOT(deviceOrientationChanged(QList,quint64))); +// qDebug() << "connection OK" << ok; + QDBusMessage reply = QDBusConnection::systemBus().call( + QDBusMessage::createMethodCall(ORIENTATION_SERVICE, ORIENTATION_PATH, + CONTEXT_INTERFACE, CONTEXT_GET)); + if (reply.type() != QDBusMessage::ErrorMessage) { + QList args; + qvariant_cast(reply.arguments().at(0)) >> args; + deviceOrientationChanged(args, 0); + } + } + + ~HarmattanOrientation() + { + // unsubscribe from the orientation sensor + if (sensorEnabled) + QDBusConnection::systemBus().call( + QDBusMessage::createMethodCall(ORIENTATION_SERVICE, ORIENTATION_PATH, + CONTEXT_INTERFACE, CONTEXT_UNSUBSCRIBE)); + } + + inline Orientation orientation() const + { + return o; + } + + void setOrientation(Orientation) + { + } + + void pauseListening() { + if (sensorEnabled) { + // unsubscribe from the orientation sensor + QDBusConnection::systemBus().call( + QDBusMessage::createMethodCall(ORIENTATION_SERVICE, ORIENTATION_PATH, + CONTEXT_INTERFACE, CONTEXT_UNSUBSCRIBE)); + sensorEnabled = false; + } + } + + void resumeListening() { + if (!sensorEnabled) { + // subscribe to the orientation sensor + QDBusMessage reply = QDBusConnection::systemBus().call( + QDBusMessage::createMethodCall(ORIENTATION_SERVICE, ORIENTATION_PATH, + CONTEXT_INTERFACE, CONTEXT_SUBSCRIBE)); + + if (reply.type() == QDBusMessage::ErrorMessage) { + qWarning("Unable to retrieve device orientation: %s", qPrintable(reply.errorMessage())); + } else { + sensorEnabled = true; + } + } + } + +private Q_SLOTS: + void deviceOrientationChanged(QList args,quint64) + { + if (args.count() == 0) + return; + Orientation newOrientation = toOrientation(args.at(0).toString()); + if (newOrientation != o) { + o = newOrientation; + emit orientationChanged(); + } +// qDebug() << "orientation" << args.at(0).toString(); + } + +private: + static Orientation toOrientation(const QString &nativeOrientation) + { + if (nativeOrientation == "top") + return Landscape; + else if (nativeOrientation == "left") + return Portrait; + else if (nativeOrientation == "bottom") + return LandscapeInverted; + else if (nativeOrientation == "right") + return PortraitInverted; + return UnknownOrientation; + } + +private: + Orientation o; + bool sensorEnabled; +}; + +DeviceOrientation* DeviceOrientation::instance() +{ + static HarmattanOrientation *o = new HarmattanOrientation; + return o; +} + +#include "deviceorientation_harmattan.moc" diff --git a/tools/qml/qml.pri b/tools/qml/qml.pri index e5b2c7f..5db7678 100644 --- a/tools/qml/qml.pri +++ b/tools/qml/qml.pri @@ -29,6 +29,11 @@ symbian:!contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) { SOURCES += $$PWD/deviceorientation_maemo5.cpp FORMS = $$PWD/recopts_maemo5.ui \ $$PWD/proxysettings_maemo5.ui +} else:linux-g++-maemo { + QT += dbus + SOURCES += $$PWD/deviceorientation_harmattan.cpp + FORMS = $$PWD/recopts.ui \ + $$PWD/proxysettings.ui } else { SOURCES += $$PWD/deviceorientation.cpp FORMS = $$PWD/recopts.ui \ -- cgit v0.12 From 4652008c01b23eefdba3b02fe8101c5bde857d41 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 6 Oct 2010 13:59:19 +1000 Subject: Ensure PathView updates positions when path changes. Fixes regression caused by optimization added in commit 35a51442ed21f58c06b21293eeb56e843251ee82. Task-number: QTBUG-14239 Reviewed-by: Martin Jones --- src/declarative/graphicsitems/qdeclarativepathview.cpp | 17 +++++++++++++++-- src/declarative/graphicsitems/qdeclarativepathview_p.h | 1 + .../qdeclarativepathview/data/pathUpdate.qml | 18 ++++++++++++++++++ .../qdeclarativepathview/tst_qdeclarativepathview.cpp | 18 ++++++++++++++++++ 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativepathview/data/pathUpdate.qml diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index d134929..3ae8788 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -300,6 +300,19 @@ void QDeclarativePathViewPrivate::setHighlightPosition(qreal pos) } } +void QDeclarativePathView::pathUpdated() +{ + Q_D(QDeclarativePathView); + QList::iterator it = d->items.begin(); + while (it != d->items.end()) { + QDeclarativeItem *item = *it; + if (QDeclarativePathViewAttached *att = d->attached(item)) + att->m_percent = -1; + ++it; + } + refill(); +} + void QDeclarativePathViewPrivate::updateItem(QDeclarativeItem *item, qreal percent) { if (QDeclarativePathViewAttached *att = attached(item)) { @@ -526,9 +539,9 @@ void QDeclarativePathView::setPath(QDeclarativePath *path) if (d->path == path) return; if (d->path) - disconnect(d->path, SIGNAL(changed()), this, SLOT(refill())); + disconnect(d->path, SIGNAL(changed()), this, SLOT(pathUpdated())); d->path = path; - connect(d->path, SIGNAL(changed()), this, SLOT(refill())); + connect(d->path, SIGNAL(changed()), this, SLOT(pathUpdated())); if (d->isValid() && isComponentComplete()) { d->clear(); if (d->attType) { diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p.h index 62a8c44..7775b1c 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview_p.h +++ b/src/declarative/graphicsitems/qdeclarativepathview_p.h @@ -186,6 +186,7 @@ private Q_SLOTS: void modelReset(); void createdItem(int index, QDeclarativeItem *item); void destroyingItem(QDeclarativeItem *item); + void pathUpdated(); private: friend class QDeclarativePathViewAttached; diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathUpdate.qml b/tests/auto/declarative/qdeclarativepathview/data/pathUpdate.qml new file mode 100644 index 0000000..0c99e7f --- /dev/null +++ b/tests/auto/declarative/qdeclarativepathview/data/pathUpdate.qml @@ -0,0 +1,18 @@ +import Qt 4.7 + +Rectangle { + width: 400 + height: 400 + + PathView { + id: view + objectName: "pathView" + anchors.fill: parent + model: 10 + delegate: Rectangle { objectName: "wrapper"; color: "green"; width: 100; height: 100 } + path: Path { + startX: view.width/2; startY: 0 + PathLine { x: view.width/2; y: view.height } + } + } +} diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index 3b5d438..eb4bdbb 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -85,6 +85,7 @@ private slots: void pathUpdateOnStartChanged(); void package(); void emptyModel(); + void pathUpdate(); private: QDeclarativeView *createView(); @@ -787,6 +788,23 @@ void tst_QDeclarativePathView::emptyModel() } +// QTBUG-14239 +void tst_QDeclarativePathView::pathUpdate() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathUpdate.qml")); + + QDeclarativePathView *pathView = canvas->rootObject()->findChild("pathView"); + QVERIFY(pathView); + + QDeclarativeItem *item = findItem(pathView, "wrapper", 0); + QVERIFY(item); + QCOMPARE(item->x(), 150.0); + + delete canvas; +} + QDeclarativeView *tst_QDeclarativePathView::createView() { QDeclarativeView *canvas = new QDeclarativeView(0); -- cgit v0.12 From 10f0cc708b8e7fc2206d1a141dfd4122e7a6f4b0 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 8 Oct 2010 12:55:21 +1000 Subject: Ensure that onRelease is called for doubleClick events. Also ensures that the pressed property is updated appropriately and the double click and hold is possible. Task-number: QTBUG-14279 Reviewed-by: Michael Brasser --- src/declarative/graphicsitems/qdeclarativemousearea.cpp | 12 ++++++------ src/declarative/graphicsitems/qdeclarativemousearea_p_p.h | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index a0208ef..1533d55 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -557,6 +557,7 @@ void QDeclarativeMouseArea::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) ungrabMouse(); setKeepMouseGrab(false); } + d->doubleClick = false; } void QDeclarativeMouseArea::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) @@ -565,14 +566,12 @@ void QDeclarativeMouseArea::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *even if (!d->absorb) { QDeclarativeItem::mouseDoubleClickEvent(event); } else { + d->doubleClick = true; d->saveEvent(event); QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, true, false); me.setAccepted(d->isDoubleClickConnected()); emit this->doubleClicked(&me); - if (!me.isAccepted()) { - // Only deliver the press event if we haven't accepted the double click. - QDeclarativeItem::mouseDoubleClickEvent(event); - } + QDeclarativeItem::mouseDoubleClickEvent(event); } } @@ -841,7 +840,8 @@ bool QDeclarativeMouseArea::setPressed(bool p) d->pressed = p; QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, isclick, d->longPress); if (d->pressed) { - emit pressed(&me); + if (!d->doubleClick) + emit pressed(&me); me.setX(d->lastPos.x()); me.setY(d->lastPos.y()); emit mousePositionChanged(&me); @@ -849,7 +849,7 @@ bool QDeclarativeMouseArea::setPressed(bool p) emit released(&me); me.setX(d->lastPos.x()); me.setY(d->lastPos.y()); - if (isclick && !d->longPress) + if (isclick && !d->longPress && !d->doubleClick) emit clicked(&me); } diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h index 48a56d9..06a01d3 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h @@ -68,7 +68,7 @@ class QDeclarativeMouseAreaPrivate : public QDeclarativeItemPrivate public: QDeclarativeMouseAreaPrivate() : absorb(true), hovered(false), pressed(false), longPress(false), - moved(false), stealMouse(false), drag(0) + moved(false), stealMouse(false), doubleClick(false), drag(0) { } @@ -109,6 +109,7 @@ public: bool dragX : 1; bool dragY : 1; bool stealMouse : 1; + bool doubleClick : 1; QDeclarativeDrag *drag; QPointF startScene; qreal startX; -- cgit v0.12 From b3ccb9f7b7795dab6520e7328c75537d58d08577 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Wed, 6 Oct 2010 14:01:56 +1000 Subject: Fix minehunt execution from QtDemo Task-number: QTBUG-14250 Reviewed-by: Martin Jones (cherry picked from commit 695b54e671b55bd8103dee8b30ee76309dbd26c1) --- demos/declarative/minehunt/main.cpp | 2 +- demos/declarative/minehunt/minehunt.pro | 1 + demos/declarative/minehunt/minehunt.qrc | 20 ++++++++++++++++++++ demos/qtdemo/menumanager.cpp | 1 + demos/qtdemo/xml/examples.xml | 2 +- 5 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 demos/declarative/minehunt/minehunt.qrc diff --git a/demos/declarative/minehunt/main.cpp b/demos/declarative/minehunt/main.cpp index 8bbaee9..2b286ef 100644 --- a/demos/declarative/minehunt/main.cpp +++ b/demos/declarative/minehunt/main.cpp @@ -58,7 +58,7 @@ int main(int argc, char *argv[]) canvas.setResizeMode(QDeclarativeView::SizeRootObjectToView); #endif canvas.engine()->rootContext()->setContextObject(game); - canvas.setSource(QString("minehunt.qml")); + canvas.setSource(QString("qrc:minehunt.qml")); QObject::connect(canvas.engine(), SIGNAL(quit()), &app, SLOT(quit())); #ifdef Q_OS_SYMBIAN diff --git a/demos/declarative/minehunt/minehunt.pro b/demos/declarative/minehunt/minehunt.pro index 7a491ab..753ca4e 100644 --- a/demos/declarative/minehunt/minehunt.pro +++ b/demos/declarative/minehunt/minehunt.pro @@ -6,6 +6,7 @@ CONFIG += qt plugin # Input HEADERS += minehunt.h SOURCES += main.cpp minehunt.cpp +RESOURCES = minehunt.qrc sources.files = minehunt.qml minehunt.pro MinehuntCore sources.path = $$[QT_INSTALL_DEMOS]/declarative/minehunt diff --git a/demos/declarative/minehunt/minehunt.qrc b/demos/declarative/minehunt/minehunt.qrc new file mode 100644 index 0000000..fa8e27d --- /dev/null +++ b/demos/declarative/minehunt/minehunt.qrc @@ -0,0 +1,20 @@ + + + minehunt.qml + MinehuntCore/Explosion.qml + MinehuntCore/Tile.qml + MinehuntCore/qmldir + MinehuntCore/pics/background.png + MinehuntCore/pics/back.png + MinehuntCore/pics/bomb-color.png + MinehuntCore/pics/bomb.png + MinehuntCore/pics/face-sad.png + MinehuntCore/pics/face-smile-big.png + MinehuntCore/pics/face-smile.png + MinehuntCore/pics/flag-color.png + MinehuntCore/pics/flag.png + MinehuntCore/pics/front.png + MinehuntCore/pics/quit.png + MinehuntCore/pics/star.png + + diff --git a/demos/qtdemo/menumanager.cpp b/demos/qtdemo/menumanager.cpp index fe3c5aa..ea9146e 100644 --- a/demos/qtdemo/menumanager.cpp +++ b/demos/qtdemo/menumanager.cpp @@ -518,6 +518,7 @@ QString MenuManager::resolveExeFile(const QString &name) dir.cd(dirName); dir.cd(fileName); + fileName = fileName.split("/").last(); QFile unixFile(dir.path() + "/" + fileName); if (unixFile.exists()) return unixFile.fileName(); QFile winR(dir.path() + "\\release\\" + fileName + ".exe"); diff --git a/demos/qtdemo/xml/examples.xml b/demos/qtdemo/xml/examples.xml index 0ab048e..27f72bb 100644 --- a/demos/qtdemo/xml/examples.xml +++ b/demos/qtdemo/xml/examples.xml @@ -18,7 +18,7 @@ - + -- cgit v0.12 From 5447a9590dc0efa1a79fde6235fdcf76d3ae81fe Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 8 Oct 2010 13:01:11 +1000 Subject: Add test for QTBUG-14279 Task-number: QTBUG-14279 --- tests/auto/declarative/qdeclarativemousearea/data/doubleclick.qml | 2 ++ .../declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/tests/auto/declarative/qdeclarativemousearea/data/doubleclick.qml b/tests/auto/declarative/qdeclarativemousearea/data/doubleclick.qml index 2348444..55b0812 100644 --- a/tests/auto/declarative/qdeclarativemousearea/data/doubleclick.qml +++ b/tests/auto/declarative/qdeclarativemousearea/data/doubleclick.qml @@ -4,11 +4,13 @@ Item { id: root property int clicked: 0 property int doubleClicked: 0 + property int released: 0 MouseArea { width: 200; height: 200 onClicked: { root.clicked++ } onDoubleClicked: { root.doubleClicked++ } + onReleased: { root.released++ } } } diff --git a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp index 5e88450..5a50e0d 100644 --- a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp +++ b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp @@ -413,14 +413,19 @@ void tst_QDeclarativeMouseArea::doubleClick() releaseEvent.setButtons(Qt::LeftButton); QApplication::sendEvent(scene, &releaseEvent); + QCOMPARE(canvas->rootObject()->property("released").toInt(), 1); + QGraphicsSceneMouseEvent dblClickEvent(QEvent::GraphicsSceneMouseDoubleClick); dblClickEvent.setScenePos(QPointF(100, 100)); dblClickEvent.setButton(Qt::LeftButton); dblClickEvent.setButtons(Qt::LeftButton); QApplication::sendEvent(scene, &dblClickEvent); + QApplication::sendEvent(scene, &releaseEvent); + QCOMPARE(canvas->rootObject()->property("clicked").toInt(), 1); QCOMPARE(canvas->rootObject()->property("doubleClicked").toInt(), 1); + QCOMPARE(canvas->rootObject()->property("released").toInt(), 2); } QTEST_MAIN(tst_QDeclarativeMouseArea) -- cgit v0.12 From 000540cfd13bfdb7743fc5c9e931989ba982dbc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Wed, 6 Oct 2010 14:19:44 +0200 Subject: QGraphicsItem device coordinate cache unefficient in portrait mode Problem was that we always invalidated the cache whenever the item was rotated. This is however not required for simple rotations such as 90, 180 and 270 degrees. This commit also removes the somewhat arbitrary logic which takes the desktop size into account. We now use the viewport size instead. Auto test included. Task-number: QT-3779 Reviewed-by: yoann (cherry picked from commit e84ab1fee7f44a28ee82793f83b0b27d04d28c09) --- src/gui/graphicsview/qgraphicsscene.cpp | 76 ++++++++++++++++++++------ tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 76 ++++++++++++++++++++++++++ 2 files changed, 134 insertions(+), 18 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index c166c30..83fe56a 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4362,6 +4362,50 @@ static void _q_paintIntoCache(QPixmap *pix, QGraphicsItem *item, const QRegion & } } +// Copied from qpaintengine_vg.cpp +// Returns true for 90, 180, and 270 degree rotations. +static inline bool transformIsSimple(const QTransform& transform) +{ + QTransform::TransformationType type = transform.type(); + if (type == QTransform::TxNone || type == QTransform::TxTranslate) { + return true; + } else if (type == QTransform::TxScale) { + // Check for 0 and 180 degree rotations. + // (0 might happen after 4 rotations of 90 degrees). + qreal m11 = transform.m11(); + qreal m12 = transform.m12(); + qreal m21 = transform.m21(); + qreal m22 = transform.m22(); + if (m12 == 0.0f && m21 == 0.0f) { + if (m11 == 1.0f && m22 == 1.0f) + return true; // 0 degrees + else if (m11 == -1.0f && m22 == -1.0f) + return true; // 180 degrees. + if(m11 == 1.0f && m22 == -1.0f) + return true; // 0 degrees inverted y. + else if(m11 == -1.0f && m22 == 1.0f) + return true; // 180 degrees inverted y. + } + } else if (type == QTransform::TxRotate) { + // Check for 90, and 270 degree rotations. + qreal m11 = transform.m11(); + qreal m12 = transform.m12(); + qreal m21 = transform.m21(); + qreal m22 = transform.m22(); + if (m11 == 0.0f && m22 == 0.0f) { + if (m12 == 1.0f && m21 == -1.0f) + return true; // 90 degrees. + else if (m12 == -1.0f && m21 == 1.0f) + return true; // 270 degrees. + else if (m12 == -1.0f && m21 == -1.0f) + return true; // 90 degrees inverted y. + else if (m12 == 1.0f && m21 == 1.0f) + return true; // 270 degrees inverted y. + } + } + return false; +} + /*! \internal @@ -4530,32 +4574,28 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte if (invertable) diff *= painter->worldTransform(); deviceData->lastTransform = painter->worldTransform(); - if (!invertable - || diff.type() > QTransform::TxTranslate - || painter->worldTransform().type() > QTransform::TxScale) { + bool allowPartialCacheExposure = false; + bool simpleTransform = invertable && diff.type() <= QTransform::TxTranslate + && transformIsSimple(painter->worldTransform()); + if (!simpleTransform) { pixModified = true; itemCache->allExposed = true; itemCache->exposed.clear(); + deviceData->cacheIndent = QPoint(); pix = QPixmap(); + } else { + allowPartialCacheExposure = deviceData->cacheIndent != QPoint(); } - // ### This is a pretty bad way to determine when to start partial - // exposure for DeviceCoordinateCache but it's the least intrusive - // approach for now. -#if 0 - // Only if the device rect isn't fully contained. - bool allowPartialCacheExposure = !viewRect.contains(deviceRect); -#else - // Only if deviceRect is 20% taller or wider than the desktop. - bool allowPartialCacheExposure = false; - if (widget) { - QRect desktopRect = QApplication::desktop()->availableGeometry(widget); - allowPartialCacheExposure = (desktopRect.width() * 1.2 < deviceRect.width() - || desktopRect.height() * 1.2 < deviceRect.height()); + // Allow partial cache exposure if the device rect isn't fully contained and + // deviceRect is 20% taller or wider than the viewRect. + if (!allowPartialCacheExposure && !viewRect.contains(deviceRect)) { + allowPartialCacheExposure = (viewRect.width() * 1.2 < deviceRect.width()) + || (viewRect.height() * 1.2 < deviceRect.height()); } -#endif + QRegion scrollExposure; - if (deviceData->cacheIndent != QPoint() || allowPartialCacheExposure) { + if (allowPartialCacheExposure) { // Part of pixmap is drawn. Either device contains viewrect (big // item covers whole screen) or parts of device are outside the // viewport. In either case the device rect must be the intersect diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 4476084..a1909e7 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -444,6 +444,7 @@ private slots: void textItem_shortcuts(); void scroll(); void stopClickFocusPropagation(); + void deviceCoordinateCache_simpleRotations(); // task specific tests below me void task141694_textItemEnsureVisible(); @@ -10372,6 +10373,81 @@ void tst_QGraphicsItem::stopClickFocusPropagation() QVERIFY(itemWithFocus->hasFocus()); } +void tst_QGraphicsItem::deviceCoordinateCache_simpleRotations() +{ + // Make sure we don't invalidate the cache when applying simple + // (90, 180, 270, 360) rotation transforms to the item. + QGraphicsRectItem *item = new QGraphicsRectItem(0, 0, 300, 200); + item->setBrush(Qt::red); + item->setCacheMode(QGraphicsItem::DeviceCoordinateCache); + + QGraphicsScene scene; + scene.setSceneRect(0, 0, 300, 200); + scene.addItem(item); + + MyGraphicsView view(&scene); + view.show(); + QTest::qWaitForWindowShown(&view); + QTRY_VERIFY(view.repaints > 0); + + QGraphicsItemCache *itemCache = QGraphicsItemPrivate::get(item)->extraItemCache(); + Q_ASSERT(itemCache); + QPixmapCache::Key currentKey = itemCache->deviceData.value(view.viewport()).key; + + // Trigger an update and verify that the cache is unchanged. + QPixmapCache::Key oldKey = currentKey; + view.reset(); + view.viewport()->update(); + QTRY_VERIFY(view.repaints > 0); + currentKey = itemCache->deviceData.value(view.viewport()).key; + QCOMPARE(currentKey, oldKey); + + // Check 90, 180, 270 and 360 degree rotations. + for (int angle = 90; angle <= 360; angle += 90) { + // Rotate item and verify that the cache was invalidated. + oldKey = currentKey; + view.reset(); + QTransform transform; + transform.translate(150, 100); + transform.rotate(angle); + transform.translate(-150, -100); + item->setTransform(transform); + QTRY_VERIFY(view.repaints > 0); + currentKey = itemCache->deviceData.value(view.viewport()).key; + QVERIFY(currentKey != oldKey); + + // IMPORTANT PART: + // Trigger an update and verify that the cache is unchanged. + oldKey = currentKey; + view.reset(); + view.viewport()->update(); + QTRY_VERIFY(view.repaints > 0); + currentKey = itemCache->deviceData.value(view.viewport()).key; + QCOMPARE(currentKey, oldKey); + } + + // 45 degree rotation. + oldKey = currentKey; + view.reset(); + QTransform transform; + transform.translate(150, 100); + transform.rotate(45); + transform.translate(-150, -100); + item->setTransform(transform); + QTRY_VERIFY(view.repaints > 0); + currentKey = itemCache->deviceData.value(view.viewport()).key; + QVERIFY(currentKey != oldKey); + + // Trigger an update and verify that the cache was invalidated. + // We should always invalidate the cache for non-trivial transforms. + oldKey = currentKey; + view.reset(); + view.viewport()->update(); + QTRY_VERIFY(view.repaints > 0); + currentKey = itemCache->deviceData.value(view.viewport()).key; + QVERIFY(currentKey != oldKey); +} + void tst_QGraphicsItem::QTBUG_5418_textItemSetDefaultColor() { struct Item : public QGraphicsTextItem -- cgit v0.12 From c4cbd04275906b1bfa1a55147a0a4bb626033a20 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 8 Oct 2010 13:47:17 +1000 Subject: Check plugin and QML file case on Mac and Windows This test should prevent the case where a QML app that is developed on a case insensitive filesystem (like on Mac or Windows) and then run on a case sensitive filesystem (like on Linux) fails to find module plugins, imports and QML files. Task-number: QTBUG-13517 --- src/declarative/qml/qdeclarativeengine.cpp | 26 +++++++ src/declarative/qml/qdeclarativeglobal_p.h | 13 ++++ src/declarative/qml/qdeclarativeimport.cpp | 11 ++- src/declarative/qml/qdeclarativetypeloader.cpp | 8 +++ .../data/importIncorrectCase.qml | 5 ++ .../data/incorrectCase.errors.insensitive.txt | 2 + .../data/incorrectCase.errors.sensitive.txt | 1 + .../qdeclarativelanguage/data/incorrectCase.qml | 4 ++ .../data/incorrectCaseType.qml | 4 ++ .../tst_qdeclarativelanguage.cpp | 24 +++++++ .../data/incorrectCase.qml | 4 ++ .../imports/com/nokia/WrongCase/qmldir | 1 + .../pluginWrongCase/plugin.cpp | 83 ++++++++++++++++++++++ .../pluginWrongCase/pluginWrongCase.pro | 10 +++ .../qdeclarativemoduleplugin.pro | 2 +- .../tst_qdeclarativemoduleplugin.cpp | 20 ++++++ 16 files changed, 216 insertions(+), 2 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/importIncorrectCase.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/incorrectCase.errors.insensitive.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/incorrectCase.errors.sensitive.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/incorrectCase.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/incorrectCaseType.qml create mode 100644 tests/auto/declarative/qdeclarativemoduleplugin/data/incorrectCase.qml create mode 100644 tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/WrongCase/qmldir create mode 100644 tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/plugin.cpp create mode 100644 tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/pluginWrongCase.pro diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 584c5ec..0749767 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -2159,4 +2159,30 @@ const QMetaObject *QDeclarativeEnginePrivate::metaObjectForType(int t) const } } +bool QDeclarative_isFileCaseCorrect(const QString &fileName) +{ +#if defined(Q_OS_MAC) || defined(Q_OS_WIN) + QFileInfo info(fileName); + + QString absolute = info.absoluteFilePath(); + QString canonical = info.canonicalFilePath(); + + int absoluteLength = absolute.length(); + int canonicalLength = canonical.length(); + + int length = qMin(absoluteLength, canonicalLength); + for (int ii = 0; ii < length; ++ii) { + const QChar &a = absolute.at(absoluteLength - 1 - ii); + const QChar &c = canonical.at(canonicalLength - 1 - ii); + + if (a.toLower() != c.toLower()) + return true; + if (a != c) + return false; + } +#endif + + return true; +} + QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativeglobal_p.h b/src/declarative/qml/qdeclarativeglobal_p.h index 1041992..65d9b24 100644 --- a/src/declarative/qml/qdeclarativeglobal_p.h +++ b/src/declarative/qml/qdeclarativeglobal_p.h @@ -75,6 +75,19 @@ struct QDeclarativeGraphics_DerivedObject : public QObject }; /*! + Returns true if the case of \a fileName is equivalent to the file case of + \a fileName on disk, and false otherwise. + + This is used to ensure that the behavior of QML on a case-insensitive file + system is the same as on a case-sensitive file system. This function + performs a "best effort" attempt to determine the real case of the file. + It may have false positives (say the case is correct when it isn't), but it + should never have a false negative (say the case is incorrect when it is + correct). +*/ +bool QDeclarative_isFileCaseCorrect(const QString &fileName); + +/*! Makes the \a object a child of \a parent. Note that when using this method, neither \a parent nor the object's previous parent (if it had one) will receive ChildRemoved or ChildAdded events. diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp index fe4ed48..6f5216a 100644 --- a/src/declarative/qml/qdeclarativeimport.cpp +++ b/src/declarative/qml/qdeclarativeimport.cpp @@ -351,7 +351,11 @@ bool QDeclarativeImportsPrivate::importExtension(const QString &absoluteFilePath { QFile file(absoluteFilePath); QString filecontent; - if (file.open(QFile::ReadOnly)) { + if (!QDeclarative_isFileCaseCorrect(absoluteFilePath)) { + if (errorString) + *errorString = QDeclarativeImportDatabase::tr("cannot load module \"%1\": File name case mismatch for \"%2\"").arg(uri).arg(absoluteFilePath); + return false; + } else if (file.open(QFile::ReadOnly)) { filecontent = QString::fromUtf8(file.readAll()); if (qmlImportTrace()) qDebug().nospace() << "QDeclarativeImports(" << qPrintable(base.toString()) << "::importExtension: " @@ -913,6 +917,11 @@ bool QDeclarativeImportDatabase::importPlugin(const QString &filePath, const QSt } if (!engineInitialized || !typesRegistered) { + if (!QDeclarative_isFileCaseCorrect(absoluteFilePath)) { + if (errorString) + *errorString = tr("File name case mismatch for \"%2\"").arg(absoluteFilePath); + return false; + } QPluginLoader loader(absoluteFilePath); if (!loader.load()) { diff --git a/src/declarative/qml/qdeclarativetypeloader.cpp b/src/declarative/qml/qdeclarativetypeloader.cpp index 061f309..c8e1a07 100644 --- a/src/declarative/qml/qdeclarativetypeloader.cpp +++ b/src/declarative/qml/qdeclarativetypeloader.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -493,6 +494,13 @@ void QDeclarativeDataLoader::load(QDeclarativeDataBlob *blob) QString lf = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(blob->m_url); if (!lf.isEmpty()) { + if (!QDeclarative_isFileCaseCorrect(lf)) { + QDeclarativeError error; + error.setUrl(blob->m_url); + error.setDescription(QLatin1String("File name case mismatch")); + blob->setError(error); + return; + } QFile file(lf); if (file.open(QFile::ReadOnly)) { QByteArray data = file.readAll(); diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importIncorrectCase.qml b/tests/auto/declarative/qdeclarativelanguage/data/importIncorrectCase.qml new file mode 100644 index 0000000..247f527 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importIncorrectCase.qml @@ -0,0 +1,5 @@ +import QtQuick 1.0 +import com.Nokia.installedtest 1.0 + +QtObject { +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/incorrectCase.errors.insensitive.txt b/tests/auto/declarative/qdeclarativelanguage/data/incorrectCase.errors.insensitive.txt new file mode 100644 index 0000000..3813680 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/incorrectCase.errors.insensitive.txt @@ -0,0 +1,2 @@ +3:1:Type IncorrectCaseType unavailable +-1:-1:File name case mismatch diff --git a/tests/auto/declarative/qdeclarativelanguage/data/incorrectCase.errors.sensitive.txt b/tests/auto/declarative/qdeclarativelanguage/data/incorrectCase.errors.sensitive.txt new file mode 100644 index 0000000..abed1a7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/incorrectCase.errors.sensitive.txt @@ -0,0 +1 @@ +3:1:IncorrectCaseType is not a type diff --git a/tests/auto/declarative/qdeclarativelanguage/data/incorrectCase.qml b/tests/auto/declarative/qdeclarativelanguage/data/incorrectCase.qml new file mode 100644 index 0000000..d11000b --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/incorrectCase.qml @@ -0,0 +1,4 @@ +import QtQuick 1.0 + +IncorrectCaseType { +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/incorrectCaseType.qml b/tests/auto/declarative/qdeclarativelanguage/data/incorrectCaseType.qml new file mode 100644 index 0000000..cf32b45 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/incorrectCaseType.qml @@ -0,0 +1,4 @@ +import QtQuick 1.0 + +QtObject { +} diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index bb1312b..2aac27e 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -144,6 +144,7 @@ private slots: void importsInstalled(); void importsOrder_data(); void importsOrder(); + void importIncorrectCase(); void qmlAttachedPropertiesObjectMethod(); void customOnProperty(); @@ -382,6 +383,13 @@ void tst_qdeclarativelanguage::errors_data() QTest::newRow("notAvailable") << "notAvailable.qml" << "notAvailable.errors.txt" << false; QTest::newRow("singularProperty") << "singularProperty.qml" << "singularProperty.errors.txt" << false; QTest::newRow("singularProperty.2") << "singularProperty.2.qml" << "singularProperty.2.errors.txt" << false; + QTest::newRow("incorrectCase") << "incorrectCase.qml" +#if defined(Q_OS_MAC) || defined(Q_OS_WIN) + << "incorrectCase.errors.insensitive.txt" +#else + << "incorrectCase.errors.sensitive.txt" +#endif + << false; } @@ -1724,6 +1732,22 @@ void tst_qdeclarativelanguage::importsOrder() testType(qml,type,error); } +void tst_qdeclarativelanguage::importIncorrectCase() +{ + QDeclarativeComponent component(&engine, TEST_FILE("importIncorrectCase.qml")); + + QList errors = component.errors(); + QCOMPARE(errors.count(), 1); + +#if defined(Q_OS_MAC) || defined(Q_OS_WIN) + QString expectedError = QLatin1String("cannot load module \"com.Nokia.installedtest\": File name case mismatch for \"") + QFileInfo(__FILE__).absoluteDir().filePath("data/lib/com/Nokia/installedtest/qmldir") + QLatin1String("\""); +#else + QString expectedError = QLatin1String("module \"com.Nokia.installedtest\" is not installed"); +#endif + + QCOMPARE(errors.at(0).description(), expectedError); +} + void tst_qdeclarativelanguage::qmlAttachedPropertiesObjectMethod() { QObject object; diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/data/incorrectCase.qml b/tests/auto/declarative/qdeclarativemoduleplugin/data/incorrectCase.qml new file mode 100644 index 0000000..a21ece7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemoduleplugin/data/incorrectCase.qml @@ -0,0 +1,4 @@ +import com.nokia.WrongCase 1.0 + +MyPluginType { value: 123 } + diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/WrongCase/qmldir b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/WrongCase/qmldir new file mode 100644 index 0000000..6c87874 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/WrongCase/qmldir @@ -0,0 +1 @@ +plugin PluGin diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/plugin.cpp new file mode 100644 index 0000000..5e91f4e --- /dev/null +++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/plugin.cpp @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include +#include +#include + +class MyPluginType : public QObject +{ + Q_OBJECT + Q_PROPERTY(int value READ value WRITE setValue) + +public: + MyPluginType(QObject *parent=0) : QObject(parent) + { + qWarning("import worked"); + } + + int value() const { return v; } + void setValue(int i) { v = i; } + +private: + int v; +}; + + +class MyPlugin : public QDeclarativeExtensionPlugin +{ + Q_OBJECT +public: + MyPlugin() + { + qWarning("plugin created"); + } + + void registerTypes(const char *uri) + { + Q_ASSERT(QLatin1String(uri) == "com.nokia.WrongCase"); + qmlRegisterType(uri, 1, 0, "MyPluginType"); + } +}; + +#include "plugin.moc" + +Q_EXPORT_PLUGIN2(plugin, MyPlugin); diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/pluginWrongCase.pro b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/pluginWrongCase.pro new file mode 100644 index 0000000..c7337ca --- /dev/null +++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginWrongCase/pluginWrongCase.pro @@ -0,0 +1,10 @@ +TEMPLATE = lib +CONFIG += plugin +SOURCES = plugin.cpp +QT = core declarative +TARGET = Plugin +DESTDIR = ../imports/com/nokia/WrongCase + +symbian: { + TARGET.EPOCALLOWDLLDATA=1 +} diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro b/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro index 824b402..221e465 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro +++ b/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro @@ -1,6 +1,6 @@ QT = core TEMPLATE = subdirs -SUBDIRS = plugin +SUBDIRS = plugin pluginWrongCase tst_qdeclarativemoduleplugin_pro.depends += plugin SUBDIRS += tst_qdeclarativemoduleplugin.pro diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp index e1022e0..587a86a 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp +++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp @@ -54,6 +54,7 @@ public: private slots: void importsPlugin(); + void incorrectPluginCase(); }; #ifdef Q_OS_SYMBIAN @@ -120,6 +121,25 @@ void tst_qdeclarativemoduleplugin::importsPlugin() delete object; } +void tst_qdeclarativemoduleplugin::incorrectPluginCase() +{ + QDeclarativeEngine engine; + engine.addImportPath(QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("imports")); + + QDeclarativeComponent component(&engine, TEST_FILE("data/incorrectCase.qml")); + + QList errors = component.errors(); + QCOMPARE(errors.count(), 1); + +#if defined(Q_OS_MAC) || defined(Q_OS_WIN) + QString expectedError = QLatin1String("plugin cannot be loaded for module \"com.nokia.WrongCase\": File name case mismatch for \"") + QFileInfo(__FILE__).absoluteDir().filePath("imports/com/nokia/WrongCase/libPluGin.dylib") + QLatin1String("\""); +#else + QString expectedError = QLatin1String("module \"com.nokia.WrongCase\" plugin \"PluGin\" not found"); +#endif + + QCOMPARE(errors.at(0).description(), expectedError); +} + QTEST_MAIN(tst_qdeclarativemoduleplugin) #include "tst_qdeclarativemoduleplugin.moc" -- cgit v0.12 From a139b9aff0d658758cc7a8063377824178a8ea92 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 8 Oct 2010 14:03:37 +1000 Subject: Disable Text {} image caching by default Task-number: QTBUG-14050 --- src/declarative/graphicsitems/qdeclarativetext.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 65f1564..54cb062 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -82,7 +82,7 @@ private: static QSet errors; }; -DEFINE_BOOL_CONFIG_OPTION(disableImageCache, QML_DISABLE_IMAGE_CACHE); +DEFINE_BOOL_CONFIG_OPTION(enableImageCache, QML_ENABLE_TEXT_IMAGE_CACHE); QDeclarativeTextPrivate::QDeclarativeTextPrivate() : color((QRgb)0), style(QDeclarativeText::Normal), @@ -90,7 +90,7 @@ QDeclarativeTextPrivate::QDeclarativeTextPrivate() imgDirty(true), dirty(true), richText(false), singleline(false), cache(true), internalWidthUpdate(false), doc(0), format(QDeclarativeText::AutoText), wrapMode(QDeclarativeText::NoWrap) { - cache = !disableImageCache(); + cache = enableImageCache(); QGraphicsItemPrivate::acceptedMouseButtons = Qt::LeftButton; QGraphicsItemPrivate::flags = QGraphicsItemPrivate::flags & ~QGraphicsItem::ItemHasNoContents; } -- cgit v0.12 From 762b03e1ae83ffd66965810e1d70326b364115f5 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 8 Oct 2010 14:17:05 +1000 Subject: Don't forward keys to invisible items. Task-number: QTBUG-13685 Reviewed-by: Michael Brasser --- src/declarative/graphicsitems/qdeclarativeitem.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 735698e..51eb5f2 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -1180,7 +1180,7 @@ void QDeclarativeKeysAttached::keyPressed(QKeyEvent *event, bool post) d->inPress = true; for (int ii = 0; ii < d->targets.count(); ++ii) { QGraphicsItem *i = d->finalFocusProxy(d->targets.at(ii)); - if (i) { + if (i && i->isVisible()) { d->item->scene()->sendEvent(i, event); if (event->isAccepted()) { d->inPress = false; @@ -1222,7 +1222,7 @@ void QDeclarativeKeysAttached::keyReleased(QKeyEvent *event, bool post) d->inRelease = true; for (int ii = 0; ii < d->targets.count(); ++ii) { QGraphicsItem *i = d->finalFocusProxy(d->targets.at(ii)); - if (i) { + if (i && i->isVisible()) { d->item->scene()->sendEvent(i, event); if (event->isAccepted()) { d->inRelease = false; @@ -1247,7 +1247,7 @@ void QDeclarativeKeysAttached::inputMethodEvent(QInputMethodEvent *event, bool p d->inIM = true; for (int ii = 0; ii < d->targets.count(); ++ii) { QGraphicsItem *i = d->finalFocusProxy(d->targets.at(ii)); - if (i && (i->flags() & QGraphicsItem::ItemAcceptsInputMethod)) { + if (i && i->isVisible() && (i->flags() & QGraphicsItem::ItemAcceptsInputMethod)) { d->item->scene()->sendEvent(i, event); if (event->isAccepted()) { d->imeItem = i; @@ -1275,7 +1275,7 @@ QVariant QDeclarativeKeysAttached::inputMethodQuery(Qt::InputMethodQuery query) if (d->item) { for (int ii = 0; ii < d->targets.count(); ++ii) { QGraphicsItem *i = d->finalFocusProxy(d->targets.at(ii)); - if (i && (i->flags() & QGraphicsItem::ItemAcceptsInputMethod) && i == d->imeItem) { //### how robust is i == d->imeItem check? + if (i && i->isVisible() && (i->flags() & QGraphicsItem::ItemAcceptsInputMethod) && i == d->imeItem) { //### how robust is i == d->imeItem check? QVariant v = static_cast(i)->doInputMethodQuery(query); if (v.userType() == QVariant::RectF) v = d->item->mapRectFromItem(i, v.toRectF()); //### cost? -- cgit v0.12 From fd2d104988955e4e94252abd8d90507aa33dc10d Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 8 Oct 2010 14:34:48 +1000 Subject: Test for QTBUG-13685 Task-number: QTBUG-13685 --- tests/auto/declarative/qdeclarativeitem/data/keystest.qml | 1 + .../declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/tests/auto/declarative/qdeclarativeitem/data/keystest.qml b/tests/auto/declarative/qdeclarativeitem/data/keystest.qml index 3927f42..9af6e9f 100644 --- a/tests/auto/declarative/qdeclarativeitem/data/keystest.qml +++ b/tests/auto/declarative/qdeclarativeitem/data/keystest.qml @@ -17,6 +17,7 @@ Item { Item { id: item2 + visible: forwardeeVisible Keys.onPressed: keysTestObject.forwardedKey(event.key) Keys.onReleased: keysTestObject.forwardedKey(event.key) } diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp index bbbf73e..b4903ae 100644 --- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp @@ -204,6 +204,7 @@ void tst_QDeclarativeItem::keys() canvas->rootContext()->setContextProperty("keysTestObject", testObject); canvas->rootContext()->setContextProperty("enableKeyHanding", QVariant(true)); + canvas->rootContext()->setContextProperty("forwardeeVisible", QVariant(true)); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keystest.qml")); canvas->show(); @@ -287,6 +288,17 @@ void tst_QDeclarativeItem::keys() testObject->reset(); + canvas->rootContext()->setContextProperty("forwardeeVisible", QVariant(false)); + key = QKeyEvent(QEvent::KeyPress, Qt::Key_A, Qt::NoModifier, "A", false, 1); + QApplication::sendEvent(canvas, &key); + QCOMPARE(testObject->mKey, int(Qt::Key_A)); + QCOMPARE(testObject->mForwardedKey, 0); + QCOMPARE(testObject->mText, QLatin1String("A")); + QVERIFY(testObject->mModifiers == Qt::NoModifier); + QVERIFY(!key.isAccepted()); + + testObject->reset(); + canvas->rootContext()->setContextProperty("enableKeyHanding", QVariant(false)); QCOMPARE(canvas->rootObject()->property("isEnabled").toBool(), false); -- cgit v0.12 From e17a5398bf20b89834d4d6c7f4d9203f192b101f Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Fri, 8 Oct 2010 14:50:43 +1000 Subject: Image.sourceSize is incorrect after changing Image.source Task-number: QTBUG-14303 --- .../graphicsitems/qdeclarativeimagebase.cpp | 13 +++++---- .../graphicsitems/qdeclarativeimagebase_p_p.h | 2 ++ .../qdeclarativeimage/tst_qdeclarativeimage.cpp | 34 ++++++++++++++++++++-- 3 files changed, 41 insertions(+), 8 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp index b06e2f7..c3bac2d 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp @@ -113,6 +113,7 @@ void QDeclarativeImageBase::setSourceSize(const QSize& size) return; d->sourcesize = size; + d->explicitSourceSize = true; emit sourceSizeChanged(); if (isComponentComplete()) load(); @@ -121,7 +122,10 @@ void QDeclarativeImageBase::setSourceSize(const QSize& size) QSize QDeclarativeImageBase::sourceSize() const { Q_D(const QDeclarativeImageBase); - return d->sourcesize.isValid() ? d->sourcesize : QSize(implicitWidth(),implicitHeight()); + + int width = d->sourcesize.width(); + int height = d->sourcesize.height(); + return QSize(width != -1 ? width : implicitWidth(), height != -1 ? height : implicitHeight()); } void QDeclarativeImageBase::load() @@ -139,7 +143,7 @@ void QDeclarativeImageBase::load() pixmapChange(); update(); } else { - d->pix.load(qmlEngine(this), d->url, d->sourcesize, d->async); + d->pix.load(qmlEngine(this), d->url, d->explicitSourceSize ? sourceSize() : QSize(), d->async); if (d->pix.isLoading()) { d->progress = 0.0; @@ -184,11 +188,8 @@ void QDeclarativeImageBase::requestFinished() setImplicitWidth(d->pix.width()); setImplicitHeight(d->pix.height()); - if (d->sourcesize.width() != d->pix.width() || d->sourcesize.height() != d->pix.height()) { - d->sourcesize.setWidth(d->pix.width()); - d->sourcesize.setHeight(d->pix.height()); + if (d->sourcesize.width() != d->pix.width() || d->sourcesize.height() != d->pix.height()) emit sourceSizeChanged(); - } if (d->status != oldStatus) emit statusChanged(d->status); diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h index aee8b28..3d23ba9 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h @@ -69,6 +69,7 @@ public: QDeclarativeImageBasePrivate() : status(QDeclarativeImageBase::Null), progress(0.0), + explicitSourceSize(false), async(false) { QGraphicsItemPrivate::flags = QGraphicsItemPrivate::flags & ~QGraphicsItem::ItemHasNoContents; @@ -79,6 +80,7 @@ public: QUrl url; qreal progress; QSize sourcesize; + bool explicitSourceSize : 1; bool async : 1; }; diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index 8f9b2ea..f1e026f 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -84,6 +84,7 @@ private slots: void tiling_QTBUG_6716(); void noLoading(); void paintedWidthHeight(); + void sourceSize_QTBUG_14303(); private: template @@ -377,7 +378,7 @@ void tst_qdeclarativeimage::noLoading() QTRY_COMPARE(statusSpy.count(), 0); // Loading remote file - ctxt->setContextProperty("srcImage", QString(SERVER_ADDR) + "/oldcolors.png"); + ctxt->setContextProperty("srcImage", QString(SERVER_ADDR) + "/heart200.png"); QTRY_VERIFY(obj->status() == QDeclarativeImage::Loading); QTRY_VERIFY(obj->progress() == 0.0); QTRY_VERIFY(obj->status() == QDeclarativeImage::Ready); @@ -388,7 +389,7 @@ void tst_qdeclarativeimage::noLoading() // Loading remote file again - should not go through 'Loading' state. ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png")); - ctxt->setContextProperty("srcImage", QString(SERVER_ADDR) + "/oldcolors.png"); + ctxt->setContextProperty("srcImage", QString(SERVER_ADDR) + "/heart200.png"); QTRY_VERIFY(obj->status() == QDeclarativeImage::Ready); QTRY_VERIFY(obj->progress() == 1.0); QTRY_COMPARE(sourceSpy.count(), 4); @@ -436,6 +437,35 @@ void tst_qdeclarativeimage::paintedWidthHeight() } } +void tst_qdeclarativeimage::sourceSize_QTBUG_14303() +{ + QString componentStr = "import QtQuick 1.0\nImage { source: srcImage }"; + QDeclarativeContext *ctxt = engine.rootContext(); + ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/heart200.png")); + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeImage *obj = qobject_cast(component.create()); + + QSignalSpy sourceSizeSpy(obj, SIGNAL(sourceSizeChanged())); + + QTRY_VERIFY(obj != 0); + QTRY_VERIFY(obj->status() == QDeclarativeImage::Ready); + + QTRY_COMPARE(obj->sourceSize().width(), 200); + QTRY_COMPARE(obj->sourceSize().height(), 200); + QTRY_COMPARE(sourceSizeSpy.count(), 0); + + ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png")); + QTRY_COMPARE(obj->sourceSize().width(), 120); + QTRY_COMPARE(obj->sourceSize().height(), 120); + QTRY_COMPARE(sourceSizeSpy.count(), 1); + + ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/heart200.png")); + QTRY_COMPARE(obj->sourceSize().width(), 200); + QTRY_COMPARE(obj->sourceSize().height(), 200); + QTRY_COMPARE(sourceSizeSpy.count(), 2); +} + /* Find an item with the specified objectName. If index is supplied then the item must also evaluate the {index} expression equal to index -- cgit v0.12 From e1568b04816465df45b7f974a1031791943bf4f0 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 6 Oct 2010 11:48:24 +0200 Subject: Fixes assert in QDeclarativeWebView If QDeclarativeWebView was instantiated twice an assert was triggered by QWebSettings::enablePersistentStorage(); This patch is crtical for tooling (Bauhaus) Task-number: QTBUG-14278 Reviewed-by: Aaron Kennedy (cherry picked from commit f532679ca11914b453e22342f2ae5e9f790ce47a) --- src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp index 94f08bd..e4f70de 100644 --- a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp @@ -249,7 +249,11 @@ void QDeclarativeWebView::init() { d = new QDeclarativeWebViewPrivate(this); - QWebSettings::enablePersistentStorage(); + if (QWebSettings::iconDatabasePath().isNull() && + QWebSettings::globalSettings()->localStoragePath().isNull() && + QWebSettings::offlineStoragePath().isNull() && + QWebSettings::offlineWebApplicationCachePath().isNull()) + QWebSettings::enablePersistentStorage(); setAcceptedMouseButtons(Qt::LeftButton); setFlag(QGraphicsItem::ItemHasNoContents, true); -- cgit v0.12 From 63e6b999144dfbd4ab230973d7e682361e8fe182 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 8 Oct 2010 15:06:17 +1000 Subject: Allow aliases to value type properties Task-number: QTBUG-14254 --- src/declarative/qml/qdeclarativecompiler.cpp | 27 +++++++++++-- src/declarative/qml/qdeclarativevmemetaobject.cpp | 25 +++++++++--- src/declarative/qml/qdeclarativevmemetaobject_p.h | 19 ++++++++++ .../qdeclarativelanguage/data/alias.10.qml | 8 ++++ .../qdeclarativelanguage/data/alias.11.qml | 8 ++++ .../data/invalidAlias.10.errors.txt | 1 + .../qdeclarativelanguage/data/invalidAlias.10.qml | 6 +++ .../data/invalidAlias.3.errors.txt | 2 +- .../qdeclarativelanguage/data/invalidAlias.3.qml | 2 +- .../data/invalidAlias.4.errors.txt | 2 +- .../data/invalidAlias.8.errors.txt | 1 + .../qdeclarativelanguage/data/invalidAlias.8.qml | 7 ++++ .../data/invalidAlias.9.errors.txt | 1 + .../qdeclarativelanguage/data/invalidAlias.9.qml | 6 +++ .../tst_qdeclarativelanguage.cpp | 44 ++++++++++++++++++++++ 15 files changed, 147 insertions(+), 12 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/alias.10.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/alias.11.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.10.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.10.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.8.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.8.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.9.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.9.qml diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 7a29f24..74bc5bd 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -2565,8 +2565,8 @@ bool QDeclarativeCompiler::compileAlias(QMetaObjectBuilder &builder, QStringList alias = astNodeToStringList(node); - if (alias.count() != 1 && alias.count() != 2) - COMPILE_EXCEPTION(prop.defaultValue, tr("Invalid alias reference. An alias reference must be specified as or .")); + if (alias.count() < 1 || alias.count() > 3) + COMPILE_EXCEPTION(prop.defaultValue, tr("Invalid alias reference. An alias reference must be specified as , . or ..")); if (!compileState.ids.contains(alias.at(0))) COMPILE_EXCEPTION(prop.defaultValue, tr("Invalid alias reference. Unable to find id \"%1\"").arg(alias.at(0))); @@ -2578,11 +2578,14 @@ bool QDeclarativeCompiler::compileAlias(QMetaObjectBuilder &builder, int propIdx = -1; int flags = 0; bool writable = false; - if (alias.count() == 2) { + if (alias.count() == 2 || alias.count() == 3) { propIdx = idObject->metaObject()->indexOfProperty(alias.at(1).toUtf8().constData()); - if (-1 == propIdx) + if (-1 == propIdx) { COMPILE_EXCEPTION(prop.defaultValue, tr("Invalid alias location")); + } else if (propIdx > 0xFFFF) { + COMPILE_EXCEPTION(prop.defaultValue, tr("Alias property exceeds alias bounds")); + } QMetaProperty aliasProperty = idObject->metaObject()->property(propIdx); if (!aliasProperty.isScriptable()) @@ -2590,6 +2593,22 @@ bool QDeclarativeCompiler::compileAlias(QMetaObjectBuilder &builder, writable = aliasProperty.isWritable(); + if (alias.count() == 3) { + QDeclarativeValueType *valueType = enginePrivate->valueTypes[aliasProperty.type()]; + if (!valueType) + COMPILE_EXCEPTION(prop.defaultValue, tr("Invalid alias location")); + + propIdx |= ((unsigned int)aliasProperty.type()) << 24; + + int valueTypeIndex = valueType->metaObject()->indexOfProperty(alias.at(2).toUtf8().constData()); + if (valueTypeIndex == -1) + COMPILE_EXCEPTION(prop.defaultValue, tr("Invalid alias location")); + Q_ASSERT(valueTypeIndex <= 0xFF); + + aliasProperty = valueType->metaObject()->property(valueTypeIndex); + propIdx |= (valueTypeIndex << 16); + } + if (aliasProperty.isEnumType()) typeName = "int"; // Avoid introducing a dependency on the aliased metaobject else diff --git a/src/declarative/qml/qdeclarativevmemetaobject.cpp b/src/declarative/qml/qdeclarativevmemetaobject.cpp index 37f08fc..e28062b 100644 --- a/src/declarative/qml/qdeclarativevmemetaobject.cpp +++ b/src/declarative/qml/qdeclarativevmemetaobject.cpp @@ -459,7 +459,7 @@ int QDeclarativeVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a) id -= propOffset; if (id < metaData->propertyCount) { - int t = (metaData->propertyData() + id)->propertyType; + int t = (metaData->propertyData() + id)->propertyType; bool needActivate = false; if (t == -1) { @@ -586,11 +586,26 @@ int QDeclarativeVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a) connectAlias(id); - if (d->propertyIdx == -1) { + if (d->isObjectAlias()) { *reinterpret_cast(a[0]) = target; return -1; + } else if (d->isValueTypeAlias()) { + // Value type property + QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(ctxt->engine); + + QDeclarativeValueType *valueType = ep->valueTypes[d->valueType()]; + Q_ASSERT(valueType); + + valueType->read(target, d->propertyIndex()); + int rv = QMetaObject::metacall(valueType, c, d->valueTypeIndex(), a); + + if (c == QMetaObject::WriteProperty) + valueType->write(target, d->propertyIndex(), 0x00); + + return rv; + } else { - return QMetaObject::metacall(target, c, d->propertyIdx, a); + return QMetaObject::metacall(target, c, d->propertyIndex(), a); } } @@ -823,8 +838,8 @@ void QDeclarativeVMEMetaObject::connectAlias(int aliasId) int sigIdx = methodOffset + aliasId + metaData->propertyCount; QMetaObject::connect(context, d->contextIdx + ctxtPriv->notifyIndex, object, sigIdx); - if (d->propertyIdx != -1) { - QMetaProperty prop = target->metaObject()->property(d->propertyIdx); + if (!d->isObjectAlias()) { + QMetaProperty prop = target->metaObject()->property(d->propertyIndex()); if (prop.hasNotifySignal()) QDeclarativePropertyPrivate::connect(target, prop.notifySignalIndex(), object, sigIdx); } diff --git a/src/declarative/qml/qdeclarativevmemetaobject_p.h b/src/declarative/qml/qdeclarativevmemetaobject_p.h index 4ccaa73..5134763 100644 --- a/src/declarative/qml/qdeclarativevmemetaobject_p.h +++ b/src/declarative/qml/qdeclarativevmemetaobject_p.h @@ -84,6 +84,25 @@ struct QDeclarativeVMEMetaData int contextIdx; int propertyIdx; int flags; + + bool isObjectAlias() const { + return propertyIdx == -1; + } + bool isPropertyAlias() const { + return !isObjectAlias() && !(propertyIdx & 0xFF000000); + } + bool isValueTypeAlias() const { + return !isObjectAlias() && (propertyIdx & 0xFF000000); + } + int propertyIndex() const { + return propertyIdx & 0x0000FFFF; + } + int valueTypeIndex() const { + return (propertyIdx & 0x00FF0000) >> 16; + } + int valueType() const { + return ((unsigned int)propertyIdx) >> 24; + } }; struct PropertyData { diff --git a/tests/auto/declarative/qdeclarativelanguage/data/alias.10.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.10.qml new file mode 100644 index 0000000..bf6352e --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.10.qml @@ -0,0 +1,8 @@ +import Test 1.0 + +MyTypeObject { + id: root + property alias valueAlias: root.rectProperty + + rectProperty: "10,11,9x8" +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/alias.11.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.11.qml new file mode 100644 index 0000000..fbd50d9 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.11.qml @@ -0,0 +1,8 @@ +import Test 1.0 + +MyTypeObject { + id: root + + property alias aliasProperty: root.rectProperty.x + rectProperty: "19,13,100x120" +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.10.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.10.errors.txt new file mode 100644 index 0000000..93652a7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.10.errors.txt @@ -0,0 +1 @@ +5:23:Invalid alias location diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.10.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.10.qml new file mode 100644 index 0000000..3ff7b16 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.10.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + id: root + property alias a: root.rectProperty.blah +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.3.errors.txt index 7260be4..fbf1b58 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.3.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.3.errors.txt @@ -1 +1 @@ -5:23:Invalid alias reference. An alias reference must be specified as or . +5:23:Invalid alias reference. An alias reference must be specified as , . or .. diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.3.qml index cc71753..a363373 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.3.qml @@ -2,5 +2,5 @@ import Test 1.0 MyTypeObject { id: root - property alias a: root.rectProperty.x + property alias a: root.rectProperty.x.y } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.4.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.4.errors.txt index 7260be4..fbf1b58 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.4.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.4.errors.txt @@ -1 +1 @@ -5:23:Invalid alias reference. An alias reference must be specified as or . +5:23:Invalid alias reference. An alias reference must be specified as , . or .. diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.8.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.8.errors.txt new file mode 100644 index 0000000..93652a7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.8.errors.txt @@ -0,0 +1 @@ +5:23:Invalid alias location diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.8.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.8.qml new file mode 100644 index 0000000..4faa52d --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.8.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + id: root + property alias a: root.imaginary.x +} + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.9.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.9.errors.txt new file mode 100644 index 0000000..93652a7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.9.errors.txt @@ -0,0 +1 @@ +5:23:Invalid alias location diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.9.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.9.qml new file mode 100644 index 0000000..f183912 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.9.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + id: root + property alias a: root.floatProperty.x +} diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 2aac27e..6a45957 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -349,6 +349,9 @@ void tst_qdeclarativelanguage::errors_data() QTest::newRow("invalidAlias.5") << "invalidAlias.5.qml" << "invalidAlias.5.errors.txt" << false; QTest::newRow("invalidAlias.6") << "invalidAlias.6.qml" << "invalidAlias.6.errors.txt" << false; QTest::newRow("invalidAlias.7") << "invalidAlias.7.qml" << "invalidAlias.7.errors.txt" << false; + QTest::newRow("invalidAlias.8") << "invalidAlias.8.qml" << "invalidAlias.8.errors.txt" << false; + QTest::newRow("invalidAlias.9") << "invalidAlias.9.qml" << "invalidAlias.9.errors.txt" << false; + QTest::newRow("invalidAlias.10") << "invalidAlias.10.qml" << "invalidAlias.10.errors.txt" << false; QTest::newRow("invalidAttachedProperty.1") << "invalidAttachedProperty.1.qml" << "invalidAttachedProperty.1.errors.txt" << false; QTest::newRow("invalidAttachedProperty.2") << "invalidAttachedProperty.2.qml" << "invalidAttachedProperty.2.errors.txt" << false; @@ -1064,6 +1067,47 @@ void tst_qdeclarativelanguage::aliasProperties() delete object; } + + // Valuetype alias + // Simple "int" alias + { + QDeclarativeComponent component(&engine, TEST_FILE("alias.10.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + // Read through alias + QCOMPARE(object->property("valueAlias").toRect(), QRect(10, 11, 9, 8)); + object->setProperty("rectProperty", QVariant(QRect(33, 12, 99, 100))); + QCOMPARE(object->property("valueAlias").toRect(), QRect(33, 12, 99, 100)); + + // Write throught alias + object->setProperty("valueAlias", QVariant(QRect(3, 3, 4, 9))); + QCOMPARE(object->property("valueAlias").toRect(), QRect(3, 3, 4, 9)); + QCOMPARE(object->property("rectProperty").toRect(), QRect(3, 3, 4, 9)); + + delete object; + } + + // Valuetype sub-alias + { + QDeclarativeComponent component(&engine, TEST_FILE("alias.11.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + // Read through alias + QCOMPARE(object->property("aliasProperty").toInt(), 19); + object->setProperty("rectProperty", QVariant(QRect(33, 8, 102, 111))); + QCOMPARE(object->property("aliasProperty").toInt(), 33); + + // Write throught alias + object->setProperty("aliasProperty", QVariant(4)); + QCOMPARE(object->property("aliasProperty").toInt(), 4); + QCOMPARE(object->property("rectProperty").toRect(), QRect(4, 8, 102, 111)); + + delete object; + } } // QTBUG-13374 Test that alias properties and signals can coexist -- cgit v0.12 From 09bf0e548a5542ac594e5d44639cb0aeaecdf661 Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Fri, 8 Oct 2010 15:37:05 +1000 Subject: Add header guards to audio example headers. Task-number: QTBUG-13413 Reviewed-by: Andrew den Exter --- examples/multimedia/audiodevices/audiodevices.h | 4 ++++ examples/multimedia/audioinput/audioinput.h | 5 +++++ examples/multimedia/audiooutput/audiooutput.h | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/examples/multimedia/audiodevices/audiodevices.h b/examples/multimedia/audiodevices/audiodevices.h index b5b5204..d448a41 100644 --- a/examples/multimedia/audiodevices/audiodevices.h +++ b/examples/multimedia/audiodevices/audiodevices.h @@ -39,6 +39,8 @@ ** ****************************************************************************/ +#ifndef AUDIODEVICES_H +#define AUDIODEVICES_H #include #include @@ -78,3 +80,5 @@ private slots: }; +#endif + diff --git a/examples/multimedia/audioinput/audioinput.h b/examples/multimedia/audioinput/audioinput.h index be721de..bc3d702 100644 --- a/examples/multimedia/audioinput/audioinput.h +++ b/examples/multimedia/audioinput/audioinput.h @@ -39,6 +39,9 @@ ** ****************************************************************************/ +#ifndef AUDIOINPUT_H +#define AUDIOINPUT_H + #include #include #include @@ -133,3 +136,5 @@ private: static const QString ResumeLabel; }; +#endif + diff --git a/examples/multimedia/audiooutput/audiooutput.h b/examples/multimedia/audiooutput/audiooutput.h index 889482b..bfcbf62 100644 --- a/examples/multimedia/audiooutput/audiooutput.h +++ b/examples/multimedia/audiooutput/audiooutput.h @@ -39,6 +39,9 @@ ** ****************************************************************************/ +#ifndef AUDIOOUTPUT_H +#define AUDIOOUTPUT_H + #include #include @@ -116,3 +119,5 @@ private slots: void deviceChanged(int index); }; +#endif + -- cgit v0.12 From 11536f150887266b6a6f5cf00b22f9d1fcc1aaeb Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 8 Oct 2010 16:12:31 +1000 Subject: Ensure GridView header is visible at the top of the view. The view was scrolled to the top of the first item, rather than the top of the header. Task-number: QTBUG-13906 Reviewed-by: Michael Brasser --- .../graphicsitems/qdeclarativegridview.cpp | 9 +++++- .../qdeclarativegridview/data/header.qml | 32 ++++++++++++++++++++ .../tst_qdeclarativegridview.cpp | 35 ++++++++++++++++++++++ 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 tests/auto/declarative/qdeclarativegridview/data/header.qml diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 8216ab7..6ee6b0d 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -218,7 +218,14 @@ public: return visibleItems.last()->rowPos() + rows * rowSize(); } } else { - return (modelIndex / columns) * rowSize(); + qreal pos = (modelIndex / columns) * rowSize(); + if (header) { + qreal headerSize = flow == QDeclarativeGridView::LeftToRight + ? header->item->height() + : header->item->width(); + pos += headerSize; + } + return pos; } return 0; } diff --git a/tests/auto/declarative/qdeclarativegridview/data/header.qml b/tests/auto/declarative/qdeclarativegridview/data/header.qml new file mode 100644 index 0000000..99baacd --- /dev/null +++ b/tests/auto/declarative/qdeclarativegridview/data/header.qml @@ -0,0 +1,32 @@ +import QtQuick 1.0 + +Rectangle { + width: 240 + height: 320 + color: "#ffffff" + Component { + id: myDelegate + Rectangle { + id: wrapper + objectName: "wrapper" + width: 80 + height: 60 + border.color: "blue" + Text { + text: index + } + color: GridView.isCurrentItem ? "lightsteelblue" : "white" + } + } + GridView { + id: grid + objectName: "grid" + width: 240 + height: 320 + cellWidth: 80 + cellHeight: 60 + model: testModel + delegate: myDelegate + header: Text { objectName: "header"; text: "Header"; height: 30 } + } +} diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index 975cf8f..f7acd87 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -82,6 +82,7 @@ private slots: void QTBUG_8456(); void manualHighlight(); void footer(); + void header(); private: QDeclarativeView *createView(); @@ -1214,6 +1215,40 @@ void tst_QDeclarativeGridView::footer() QTRY_COMPARE(footer->y(), 0.0); } +void tst_QDeclarativeGridView::header() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + for (int i = 0; i < 7; i++) + model.addItem("Item" + QString::number(i), ""); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/header.qml")); + qApp->processEvents(); + + QDeclarativeGridView *gridview = findItem(canvas->rootObject(), "grid"); + QTRY_VERIFY(gridview != 0); + + QDeclarativeItem *contentItem = gridview->contentItem(); + QTRY_VERIFY(contentItem != 0); + + QDeclarativeText *header = findItem(contentItem, "header"); + QVERIFY(header); + + QCOMPARE(header->y(), 0.0); + QCOMPARE(gridview->contentY(), 0.0); + + QDeclarativeItem *item = findItem(contentItem, "wrapper", 0); + QVERIFY(item); + QCOMPARE(item->y(), 30.0); + + model.clear(); + QTRY_COMPARE(header->y(), 0.0); +} + QDeclarativeView *tst_QDeclarativeGridView::createView() { -- cgit v0.12 From 91396846206e6b41d32fa8a30888261581bd28dc Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Fri, 8 Oct 2010 09:13:48 +0200 Subject: Doc: Update to Phonon overview --- doc/src/frameworks-technologies/phonon.qdoc | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/doc/src/frameworks-technologies/phonon.qdoc b/doc/src/frameworks-technologies/phonon.qdoc index 83afb91..9620136 100644 --- a/doc/src/frameworks-technologies/phonon.qdoc +++ b/doc/src/frameworks-technologies/phonon.qdoc @@ -524,24 +524,5 @@ the QtOpenGL shared library. If this is not what you want, it is possible to configure Qt without OpenGL support. In that case, you need to run \c configure with the \c -no-opengl option. - - \section1 Work in Progress - - Phonon and its Qt backends, though fully functional for - multimedia playback, are still under development. Functionality to - come is the possibility to capture media and more processors for - both music and video files. - - Another important consideration is to implement support for - storing media to files; i.e., not playing back media directly. - - We also hope in the future to be able to support direct - manipulation of media streams. This will give the programmer more - freedom to manipulate streams than just through processors. - - Currently, the multimedia framework supports one input source. It will be - possible to include several sources. This is useful in, for example, audio - mixer applications where several audio sources can be sent, processed and - output as a single audio stream. */ -- cgit v0.12 From 69ae7469eebda30dbf430ca67d193a62969f516c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 7 Oct 2010 10:09:23 +0200 Subject: QGradientCache: Optimize choosing of which gradient to evict from cache MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use iterator arithmetic instead of QMultiHash::keys() to remove a random gradient color table from the cache. Reviewed-by: Samuel Rødal --- src/gui/painting/qpaintengine_raster.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index dbf7b26..23be51b 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -4960,8 +4960,8 @@ protected: int size, int opacity) const; uint *addCacheElement(quint64 hash_val, const QGradient &gradient, int opacity) { if (cache.size() == maxCacheSize()) { - int elem_to_remove = qrand() % maxCacheSize(); - cache.remove(cache.keys()[elem_to_remove]); // may remove more than 1, but OK + // may remove more than 1, but OK + cache.erase(cache.begin() + (qrand() % maxCacheSize())); } CacheInfo cache_entry(gradient.stops(), opacity, gradient.interpolationMode()); generateGradientColorTable(gradient, cache_entry.buffer, paletteSize(), opacity); -- cgit v0.12 From fcf4b598a169b336344393958f67320f5f9652ce Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 28 Sep 2010 11:01:20 +0100 Subject: Progressive download in Phonon MMF backend: added download managers This patch adds a Download class which uses the RHttpDownloadMgr API to download a media clip over HTTP. Task-number: QTBUG-10769 Reviewed-by: Derick Hawcroft --- src/3rdparty/phonon/mmf/download.cpp | 194 +++++++++++++++++++++++++++++++++++ src/3rdparty/phonon/mmf/download.h | 111 ++++++++++++++++++++ src/plugins/phonon/mmf/mmf.pro | 3 + 3 files changed, 308 insertions(+) create mode 100644 src/3rdparty/phonon/mmf/download.cpp create mode 100644 src/3rdparty/phonon/mmf/download.h diff --git a/src/3rdparty/phonon/mmf/download.cpp b/src/3rdparty/phonon/mmf/download.cpp new file mode 100644 index 0000000..7b80e4a --- /dev/null +++ b/src/3rdparty/phonon/mmf/download.cpp @@ -0,0 +1,194 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see . + +*/ + +#include "download.h" +#include "utils.h" +#include +#include + +QT_BEGIN_NAMESPACE + +using namespace Phonon; +using namespace Phonon::MMF; + +static const TBool InheritDownloads = EFalse; + +DownloadPrivate::DownloadPrivate(Download *parent) + : QObject(parent) + , m_parent(parent) + , m_download(0) + , m_length(0) +{ + +} + +DownloadPrivate::~DownloadPrivate() +{ + m_downloadManager.Disconnect(); + m_downloadManager.Close(); +} + +bool DownloadPrivate::start() +{ + TRACE_CONTEXT(DownloadPrivate::start, EVideoApi); + Q_ASSERT(!m_download); + // Connect to download manager + RProcess process; + const TUid uid3 = process.SecureId(); + TRAPD(err, m_downloadManager.ConnectL(uid3, *this, InheritDownloads)); + TRACE("connect err %d", err); + if (KErrNone == err) { + // Start download + QHBufC url(m_parent->sourceUrl().toString()); + TPtr8 url8 = url->Des().Collapse(); + TRAP(err, m_download = &m_downloadManager.CreateDownloadL(url8)); + TRACE("start err %d", err); + if (KErrNone == err) + m_download->Start(); + } + return (KErrNone == err); +} + +void DownloadPrivate::resume() +{ + +} + +void DownloadPrivate::HandleDMgrEventL(RHttpDownload &aDownload, THttpDownloadEvent aEvent) +{ + TRACE_CONTEXT(DownloadPrivate::HandleDMgrEventL, EVideoApi); + Q_ASSERT(&aDownload == m_download); + switch (aEvent.iDownloadState) { + case EHttpDlPaused: + if (EHttpContentTypeReceived == aEvent.iProgressState) { + TRACE_0("paused, content type received"); + m_download->Start(); + } + break; + case EHttpDlInprogress: + switch (aEvent.iProgressState) { + case EHttpProgResponseHeaderReceived: + { + TFileName fileName; + m_download->GetStringAttribute(EDlAttrDestFilename, fileName); + TRACE("in progress, response header received, filename %S", &fileName); + const QString fileNameQt = QDir::fromNativeSeparators(qt_TDesC2QString(fileName)); + m_parent->downloadStarted(fileNameQt); + } + break; + case EHttpProgResponseBodyReceived: + { + TInt32 length = 0; + m_download->GetIntAttribute(EDlAttrDownloadedSize, length); + if (length != m_length) { + TRACE("in progress, length %d", length); + m_length = length; + emit lengthChanged(m_length); + } + } + break; + } + break; + case EHttpDlCompleted: + TRACE_0("complete"); + m_parent->complete(); + break; + case EHttpDlFailed: + TRACE_0("failed"); + m_parent->error(); + break; + } +} + +Download::Download(const QUrl &url, QObject *parent) + : QObject(parent) + , m_private(new DownloadPrivate(this)) + , m_sourceUrl(url) + , m_state(Idle) +{ + qRegisterMetaType(); + connect(m_private, SIGNAL(lengthChanged(qint64)), this, SIGNAL(lengthChanged(qint64))); +} + +Download::~Download() +{ + +} + +const QUrl &Download::sourceUrl() const +{ + return m_sourceUrl; +} + +const QString &Download::targetFileName() const +{ + return m_targetFileName; +} + +void Download::start() +{ + TRACE_CONTEXT(Download::start, EVideoApi); + TRACE_ENTRY_0(); + Q_ASSERT(Idle == m_state); + const bool ok = m_private->start(); + setState(ok ? Initializing : Error); + TRACE_EXIT_0(); +} + +void Download::resume() +{ + TRACE_CONTEXT(Download::resume, EVideoApi); + TRACE_ENTRY_0(); + m_private->resume(); + TRACE_EXIT_0(); +} + +void Download::setState(State state) +{ + TRACE_CONTEXT(Download::setState, EVideoApi); + TRACE("oldState %d newState %d", m_state, state); + const State oldState = m_state; + m_state = state; + if (oldState != m_state) + emit stateChanged(m_state); +} + +void Download::error() +{ + TRACE_CONTEXT(Download::error, EVideoApi); + TRACE_0(""); + setState(Error); +} + +void Download::downloadStarted(const QString &targetFileName) +{ + TRACE_CONTEXT(Download::downloadStarted, EVideoApi); + TRACE_0("downloadStarted"); + m_targetFileName = targetFileName; + setState(Downloading); +} + +void Download::complete() +{ + TRACE_CONTEXT(Download::complete, EVideoApi); + TRACE_0(""); + setState(Complete); +} + +QT_END_NAMESPACE + diff --git a/src/3rdparty/phonon/mmf/download.h b/src/3rdparty/phonon/mmf/download.h new file mode 100644 index 0000000..b57348b --- /dev/null +++ b/src/3rdparty/phonon/mmf/download.h @@ -0,0 +1,111 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see . + +*/ + +#ifndef PHONON_MMF_DOWNLOAD_H +#define PHONON_MMF_DOWNLOAD_H + +#include +#include +#include +#include + +QT_FORWARD_DECLARE_CLASS(QByteArray) +QT_FORWARD_DECLARE_CLASS(QFile) + +QT_BEGIN_NAMESPACE + +namespace Phonon +{ +namespace MMF +{ + +class Download; + +class DownloadPrivate : public QObject + , public MHttpDownloadMgrObserver +{ + Q_OBJECT +public: + DownloadPrivate(Download *parent); + ~DownloadPrivate(); + bool start(); + void resume(); +signals: + void error(); + void targetFileNameChanged(); + void lengthChanged(qint64 length); + void complete(); +private: + // MHttpDownloadMgrObserver + void HandleDMgrEventL(RHttpDownload &aDownload, THttpDownloadEvent aEvent); +private: + Download *m_parent; + RHttpDownloadMgr m_downloadManager; + RHttpDownload *m_download; + qint64 m_length; +}; + +class Download : public QObject +{ + Q_OBJECT + friend class DownloadPrivate; +public: + Download(const QUrl &url, QObject *parent = 0); + ~Download(); + const QUrl &sourceUrl() const; + const QString &targetFileName() const; + void start(); + + // Only has effect when QT_PHONON_MMF_DOWNLOAD_DUMMY is defined + void resume(); + + enum State { + Idle, + Initializing, + Downloading, + Complete, + Error + }; + +signals: + void lengthChanged(qint64 length); + void stateChanged(Download::State state); + +private: + void setState(State state); + + // Called by DownloadPrivate + void error(); + void downloadStarted(const QString &targetFileName); + void complete(); + +private: + DownloadPrivate *m_private; + QUrl m_sourceUrl; + QString m_targetFileName; + State m_state; +}; + +} +} + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(Phonon::MMF::Download::State) + +#endif diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro index 7a6fdf8..902354f 100644 --- a/src/plugins/phonon/mmf/mmf.pro +++ b/src/plugins/phonon/mmf/mmf.pro @@ -36,6 +36,7 @@ symbian { $$PHONON_MMF_DIR/backend.h \ $$PHONON_MMF_DIR/bassboost.h \ $$PHONON_MMF_DIR/defs.h \ + $$PHONON_MMF_DIR/download.h \ $$PHONON_MMF_DIR/dummyplayer.h \ $$PHONON_MMF_DIR/effectfactory.h \ $$PHONON_MMF_DIR/effectparameter.h \ @@ -61,6 +62,7 @@ symbian { $$PHONON_MMF_DIR/abstractvideoplayer.cpp \ $$PHONON_MMF_DIR/backend.cpp \ $$PHONON_MMF_DIR/bassboost.cpp \ + $$PHONON_MMF_DIR/download.cpp \ $$PHONON_MMF_DIR/dummyplayer.cpp \ $$PHONON_MMF_DIR/effectfactory.cpp \ $$PHONON_MMF_DIR/effectparameter.cpp \ @@ -111,6 +113,7 @@ symbian { LIBS += -lapgrfx -lapmime # For recognizer LIBS += -lmmfcontrollerframework # For CMMFMetaDataEntry LIBS += -lmediaclientaudiostream # For CMdaAudioOutputStream + LIBS += -ldownloadmgr # These are for effects. LIBS += -lAudioEqualizerEffect -lBassBoostEffect -lDistanceAttenuationEffect -lDopplerBase -lEffectBase -lEnvironmentalReverbEffect -lListenerDopplerEffect -lListenerLocationEffect -lListenerOrientationEffect -lLocationBase -lLoudnessEffect -lOrientationBase -lSourceDopplerEffect -lSourceLocationEffect -lSourceOrientationEffect -lStereoWideningEffect -- cgit v0.12 From bb994a5e2a260911ed3c5603d3414c63a28faab4 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 28 Sep 2010 11:05:41 +0100 Subject: Progressive download in Phonon MMF backend: integrated with player This commit integrates the Download class with the media playback classes in the backend, to implement Progressive Download. Note that this PDL implementation has one drawback: when video playback is paused due to shortage of data (i.e. due to the download being temporarily stalled), the display goes black. This is because, when the end of the currently-downloaded data is reached, the playback session is closed. When more data becomes available, the clip is re-opened, a seek is done to reach the previous playback position, and playback is re-started. Closing the playback session closes the video stack's connection to the display, thereby causing the video widget to go black while more data is buffered. This is a consequence of the level in the native video stack at which the Phonon integration is done: managing a network stall without requiring the playback session to be closed would require integration below the MMF client API, specifically at the MMF controller level. Task-number: QTBUG-10769 Reviewed-by: Derick Hawcroft --- src/3rdparty/phonon/mmf/abstractmediaplayer.cpp | 148 +++++++++++++++++++++--- src/3rdparty/phonon/mmf/abstractmediaplayer.h | 17 +++ src/3rdparty/phonon/mmf/abstractvideoplayer.cpp | 24 +++- src/3rdparty/phonon/mmf/abstractvideoplayer.h | 5 +- src/3rdparty/phonon/mmf/audioplayer.cpp | 18 ++- src/3rdparty/phonon/mmf/audioplayer.h | 5 +- src/3rdparty/phonon/mmf/mediaobject.cpp | 36 +++--- src/3rdparty/phonon/mmf/mediaobject.h | 1 + 8 files changed, 211 insertions(+), 43 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp index 3702560..a728423 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp @@ -51,10 +51,13 @@ MMF::AbstractMediaPlayer::AbstractMediaPlayer , m_parent(parent) , m_pending(NothingPending) , m_positionTimer(new QTimer(this)) + , m_position(0) , m_bufferStatusTimer(new QTimer(this)) , m_mmfMaxVolume(NullMaxVolume) , m_prefinishMarkSent(false) , m_aboutToFinishSent(false) + , m_download(0) + , m_downloadStalled(false) { connect(m_positionTimer.data(), SIGNAL(timeout()), this, SLOT(positionTick())); connect(m_bufferStatusTimer.data(), SIGNAL(timeout()), this, SLOT(bufferStatusTick())); @@ -183,6 +186,7 @@ void MMF::AbstractMediaPlayer::seek(qint64 ms) } doSeek(ms); + m_position = ms; resetMarksIfRewound(); if(wasPlaying && state() != ErrorState) { @@ -207,6 +211,11 @@ bool MMF::AbstractMediaPlayer::isSeekable() const return true; } +qint64 MMF::AbstractMediaPlayer::currentTime() const +{ + return m_position; +} + void MMF::AbstractMediaPlayer::doSetTickInterval(qint32 interval) { TRACE_CONTEXT(AbstractMediaPlayer::doSetTickInterval, EAudioApi); @@ -247,6 +256,14 @@ void MMF::AbstractMediaPlayer::open() symbianErr = openFile(*file); if (KErrNone != symbianErr) errorMessage = tr("Error opening file"); + } else if (url.scheme() == QLatin1String("http")) { + Q_ASSERT(!m_download); + m_download = new Download(url, this); + connect(m_download, SIGNAL(lengthChanged(qint64)), + this, SLOT(downloadLengthChanged(qint64))); + connect(m_download, SIGNAL(stateChanged(Download::State)), + this, SLOT(downloadStateChanged(Download::State))); + m_download->start(); } else { symbianErr = openUrl(url.toString()); if (KErrNone != symbianErr) @@ -288,6 +305,14 @@ void MMF::AbstractMediaPlayer::open() TRACE_EXIT_0(); } +void MMF::AbstractMediaPlayer::close() +{ + doClose(); + delete m_download; + m_download = 0; + m_position = 0; +} + void MMF::AbstractMediaPlayer::volumeChanged(qreal volume) { TRACE_CONTEXT(AbstractMediaPlayer::volumeChanged, EAudioInternal); @@ -374,7 +399,8 @@ void MMF::AbstractMediaPlayer::bufferingComplete() { stopBufferStatusTimer(); emit MMF::AbstractPlayer::bufferStatus(100); - changeState(m_stateBeforeBuffering); + if (!progressiveDownloadStalled()) + changeState(m_stateBeforeBuffering); } void MMF::AbstractMediaPlayer::maxVolumeChanged(int mmfMaxVolume) @@ -385,13 +411,28 @@ void MMF::AbstractMediaPlayer::maxVolumeChanged(int mmfMaxVolume) void MMF::AbstractMediaPlayer::loadingComplete(int error) { - Q_ASSERT(Phonon::LoadingState == state()); - - if (KErrNone == error) { - updateMetaData(); - changeState(StoppedState); + TRACE_CONTEXT(AbstractMediaPlayer::loadingComplete, EAudioApi); + TRACE_ENTRY("state %d error %d", state(), error); + if (progressiveDownloadStalled()) { + Q_ASSERT(Phonon::BufferingState == state()); + if (KErrNone == error) { + bufferingComplete(); + doSeek(m_position); + startPlayback(); + m_downloadStalled = false; + } } else { - setError(tr("Loading clip failed"), error); + Q_ASSERT(Phonon::LoadingState == state()); + if (KErrNone == error) { + updateMetaData(); + changeState(StoppedState); + } else { + if (isProgressiveDownload() && KErrCorrupt == error) { + setProgressiveDownloadStalled(); + } else { + setError(tr("Loading clip failed"), error); + } + } } } @@ -415,8 +456,12 @@ void MMF::AbstractMediaPlayer::playbackComplete(int error) QMetaObject::invokeMethod(m_parent, "switchToNextSource", Qt::QueuedConnection); } else { - setError(tr("Playback complete"), error); - emit finished(); + if (isProgressiveDownload() && KErrCorrupt == error) { + setProgressiveDownloadStalled(); + } else { + setError(tr("Playback complete"), error); + emit finished(); + } } } @@ -425,15 +470,28 @@ qint64 MMF::AbstractMediaPlayer::toMilliSeconds(const TTimeIntervalMicroSeconds return in.Int64() / 1000; } +bool MMF::AbstractMediaPlayer::isProgressiveDownload() const +{ + return (0 != m_download); +} + +bool MMF::AbstractMediaPlayer::progressiveDownloadStalled() const +{ + return m_downloadStalled; +} + //----------------------------------------------------------------------------- // Slots //----------------------------------------------------------------------------- void MMF::AbstractMediaPlayer::positionTick() { - const qint64 current = currentTime(); - emitMarksIfReached(current); - emit MMF::AbstractPlayer::tick(current); + const qint64 pos = getCurrentTime(); + if (pos > m_position) { + m_position = pos; + emitMarksIfReached(m_position); + emit MMF::AbstractPlayer::tick(m_position); + } } void MMF::AbstractMediaPlayer::emitMarksIfReached(qint64 current) @@ -458,7 +516,7 @@ void MMF::AbstractMediaPlayer::emitMarksIfReached(qint64 current) void MMF::AbstractMediaPlayer::resetMarksIfRewound() { - const qint64 current = currentTime(); + const qint64 current = getCurrentTime(); const qint64 total = totalTime(); const qint64 remaining = total - current; @@ -487,9 +545,71 @@ void MMF::AbstractMediaPlayer::startPlayback() changeState(PlayingState); } +void MMF::AbstractMediaPlayer::setProgressiveDownloadStalled() +{ + TRACE_CONTEXT(AbstractMediaPlayer::setProgressiveDownloadStalled, EAudioApi); + TRACE_ENTRY("state %d", state()); + Q_ASSERT(isProgressiveDownload()); + m_downloadStalled = true; + doClose(); + bufferingStarted(); + // Video player loses window handle when closed - need to reapply it here + videoOutputChanged(); +#ifdef QT_PHONON_MMF_DOWNLOAD_DUMMY + m_download->resume(); +#endif +} + void MMF::AbstractMediaPlayer::bufferStatusTick() { - emit MMF::AbstractPlayer::bufferStatus(bufferStatus()); + // During progressive download, there is no way to detect the buffering status. + // Phonon does not support a "buffering; amount unknown" signal, therefore we + // return a buffering status of zero. + const int status = progressiveDownloadStalled() ? 0 : bufferStatus(); + emit MMF::AbstractPlayer::bufferStatus(status); +} + +void MMF::AbstractMediaPlayer::downloadLengthChanged(qint64 length) +{ + TRACE_CONTEXT(AbstractMediaPlayer::downloadLengthChanged, EAudioApi); + TRACE_ENTRY("length %Ld", length); + Q_UNUSED(length) + if (m_downloadStalled) { + bufferingComplete(); + int err = m_parent->openFileHandle(m_download->targetFileName()); + if (KErrNone == err) + err = openFile(*m_parent->file()); + if (KErrNone != err) + setError(tr("Error opening file")); + } +} + +void MMF::AbstractMediaPlayer::downloadStateChanged(Download::State state) +{ + TRACE_CONTEXT(AbstractMediaPlayer::downloadStateChanged, EAudioApi); + TRACE_ENTRY("state %d", state); + switch (state) { + case Download::Idle: + case Download::Initializing: + break; + case Download::Downloading: + { + int err = m_parent->openFileHandle(m_download->targetFileName()); + if (KErrNone == err) + err = openFile(*m_parent->file()); + else if (KErrCorrupt == err) + // Insufficient data downloaded - enter Buffering state + setProgressiveDownloadStalled(); + if (KErrNone != err) + setError(tr("Error opening file")); + } + break; + case Download::Complete: + break; + case Download::Error: + setError(tr("Download error")); + break; + } } Phonon::State MMF::AbstractMediaPlayer::phononState(PrivateState state) const diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.h b/src/3rdparty/phonon/mmf/abstractmediaplayer.h index e795ecb..99fc101 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.h +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.h @@ -23,6 +23,7 @@ along with this library. If not, see . #include #include #include "abstractplayer.h" +#include "download.h" class RFile; @@ -48,6 +49,7 @@ protected: public: virtual void open(); + virtual void close(); // MediaObjectInterface virtual void play(); @@ -55,6 +57,7 @@ public: virtual void stop(); virtual void seek(qint64 milliseconds); virtual bool isSeekable() const; + virtual qint64 currentTime() const; virtual void volumeChanged(qreal volume); protected: @@ -68,12 +71,15 @@ protected: virtual void doStop() = 0; virtual void doSeek(qint64 pos) = 0; virtual int setDeviceVolume(int mmfVolume) = 0; + virtual int openFile(const QString &fileName) = 0; virtual int openFile(RFile& file) = 0; virtual int openUrl(const QString& url) = 0; virtual int openDescriptor(const TDesC8 &des) = 0; virtual int bufferStatus() const = 0; + virtual void doClose() = 0; void updateMetaData(); + virtual qint64 getCurrentTime() const = 0; virtual int numberOfMetaDataEntries() const = 0; virtual QPair metaDataEntry(int index) const = 0; @@ -86,6 +92,9 @@ protected: static qint64 toMilliSeconds(const TTimeIntervalMicroSeconds &); + bool isProgressiveDownload() const; + bool progressiveDownloadStalled() const; + private: void startPositionTimer(); void stopPositionTimer(); @@ -96,6 +105,7 @@ private: void emitMarksIfReached(qint64 position); void resetMarksIfRewound(); void startPlayback(); + void setProgressiveDownloadStalled(); enum Pending { NothingPending, @@ -108,6 +118,8 @@ private: private Q_SLOTS: void positionTick(); void bufferStatusTick(); + void downloadLengthChanged(qint64); + void downloadStateChanged(Download::State); private: MediaObject *const m_parent; @@ -115,6 +127,7 @@ private: Pending m_pending; QScopedPointer m_positionTimer; + qint64 m_position; QScopedPointer m_bufferStatusTimer; PrivateState m_stateBeforeBuffering; @@ -127,6 +140,10 @@ private: // Used for playback of resource files TPtrC8 m_buffer; + // Used for progressive download + Download *m_download; + bool m_downloadStalled; + QMultiMap m_metaData; }; diff --git a/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp b/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp index fb20bea..1ab5bae 100644 --- a/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp @@ -16,6 +16,7 @@ along with this library. If not, see . */ +#include #include #include #include @@ -132,6 +133,13 @@ int MMF::AbstractVideoPlayer::setDeviceVolume(int mmfVolume) return err; } +int MMF::AbstractVideoPlayer::openFile(const QString &fileName) +{ + const QHBufC nativeFileName(QDir::toNativeSeparators(fileName)); + TRAPD(err, m_player->OpenFileL(*nativeFileName)); + return err; +} + int MMF::AbstractVideoPlayer::openFile(RFile &file) { TRAPD(err, m_player->OpenFileL(file)); @@ -157,7 +165,7 @@ int MMF::AbstractVideoPlayer::bufferStatus() const return result; } -void MMF::AbstractVideoPlayer::close() +void MMF::AbstractVideoPlayer::doClose() { m_player->Close(); } @@ -167,9 +175,9 @@ bool MMF::AbstractVideoPlayer::hasVideo() const return true; } -qint64 MMF::AbstractVideoPlayer::currentTime() const +qint64 MMF::AbstractVideoPlayer::getCurrentTime() const { - TRACE_CONTEXT(AbstractVideoPlayer::currentTime, EVideoApi); + TRACE_CONTEXT(AbstractVideoPlayer::getCurrentTime, EVideoApi); TTimeIntervalMicroSeconds us; TRAPD(err, us = m_player->PositionL()) @@ -246,7 +254,9 @@ void MMF::AbstractVideoPlayer::MvpuoOpenComplete(TInt aError) TRACE_CONTEXT(AbstractVideoPlayer::MvpuoOpenComplete, EVideoApi); TRACE_ENTRY("state %d error %d", state(), aError); - __ASSERT_ALWAYS(LoadingState == state(), Utils::panic(InvalidStatePanic)); + __ASSERT_ALWAYS(LoadingState == state() || + progressiveDownloadStalled() && BufferingState == state(), + Utils::panic(InvalidStatePanic)); if (KErrNone == aError) m_player->Prepare(); @@ -261,7 +271,9 @@ void MMF::AbstractVideoPlayer::MvpuoPrepareComplete(TInt aError) TRACE_CONTEXT(AbstractVideoPlayer::MvpuoPrepareComplete, EVideoApi); TRACE_ENTRY("state %d error %d", state(), aError); - __ASSERT_ALWAYS(LoadingState == state(), Utils::panic(InvalidStatePanic)); + __ASSERT_ALWAYS(LoadingState == state() || + progressiveDownloadStalled() && BufferingState == state(), + Utils::panic(InvalidStatePanic)); TRAPD(err, getVideoClipParametersL(aError)); @@ -470,7 +482,7 @@ void MMF::AbstractVideoPlayer::updateScaleFactors(const QSize &windowSize, bool void MMF::AbstractVideoPlayer::parametersChanged(VideoParameters parameters) { - if (state() == LoadingState) + if (state() == LoadingState || progressiveDownloadStalled() && BufferingState == state()) m_pendingChanges |= parameters; else handleParametersChanged(parameters); diff --git a/src/3rdparty/phonon/mmf/abstractvideoplayer.h b/src/3rdparty/phonon/mmf/abstractvideoplayer.h index 3ff3c75..3bc5c7c 100644 --- a/src/3rdparty/phonon/mmf/abstractvideoplayer.h +++ b/src/3rdparty/phonon/mmf/abstractvideoplayer.h @@ -64,21 +64,22 @@ public: virtual void doStop(); virtual void doSeek(qint64 milliseconds); virtual int setDeviceVolume(int mmfVolume); + virtual int openFile(const QString &fileName); virtual int openFile(RFile &file); virtual int openUrl(const QString &url); virtual int openDescriptor(const TDesC8 &des); virtual int bufferStatus() const; - virtual void close(); + virtual void doClose(); // MediaObjectInterface virtual bool hasVideo() const; - virtual qint64 currentTime() const; virtual qint64 totalTime() const; // AbstractPlayer virtual void videoOutputChanged(); // AbstractMediaPlayer + virtual qint64 getCurrentTime() const; virtual int numberOfMetaDataEntries() const; virtual QPair metaDataEntry(int index) const; diff --git a/src/3rdparty/phonon/mmf/audioplayer.cpp b/src/3rdparty/phonon/mmf/audioplayer.cpp index 7c8b9bd..dc5c800 100644 --- a/src/3rdparty/phonon/mmf/audioplayer.cpp +++ b/src/3rdparty/phonon/mmf/audioplayer.cpp @@ -16,6 +16,7 @@ along with this library. If not, see . */ +#include #include #include "audioplayer.h" @@ -109,6 +110,13 @@ int MMF::AudioPlayer::setDeviceVolume(int mmfVolume) #endif } +int MMF::AudioPlayer::openFile(const QString &fileName) +{ + const QHBufC nativeFileName(QDir::toNativeSeparators(fileName)); + TRAPD(err, m_player->OpenFileL(*nativeFileName)); + return err; +} + int MMF::AudioPlayer::openFile(RFile& file) { TRAPD(err, m_player->OpenFileL(file)); @@ -150,7 +158,7 @@ int MMF::AudioPlayer::bufferStatus() const return result; } -void MMF::AudioPlayer::close() +void MMF::AudioPlayer::doClose() { m_player->Close(); } @@ -160,9 +168,9 @@ bool MMF::AudioPlayer::hasVideo() const return false; } -qint64 MMF::AudioPlayer::currentTime() const +qint64 MMF::AudioPlayer::getCurrentTime() const { - TRACE_CONTEXT(AudioPlayer::currentTime, EAudioApi); + TRACE_CONTEXT(AudioPlayer::getCurrentTime, EAudioApi); TTimeIntervalMicroSeconds us; const TInt err = m_player->GetPosition(us); @@ -203,7 +211,9 @@ void MMF::AudioPlayer::MapcInitComplete(TInt aError, TRACE_CONTEXT(AudioPlayer::MapcInitComplete, EAudioInternal); TRACE_ENTRY("state %d error %d", state(), aError); - __ASSERT_ALWAYS(LoadingState == state(), Utils::panic(InvalidStatePanic)); + __ASSERT_ALWAYS(LoadingState == state() || + progressiveDownloadStalled() && BufferingState == state(), + Utils::panic(InvalidStatePanic)); if (KErrNone == aError) { maxVolumeChanged(m_player->MaxVolume()); diff --git a/src/3rdparty/phonon/mmf/audioplayer.h b/src/3rdparty/phonon/mmf/audioplayer.h index e43cadd..cf4f6d5 100644 --- a/src/3rdparty/phonon/mmf/audioplayer.h +++ b/src/3rdparty/phonon/mmf/audioplayer.h @@ -65,18 +65,19 @@ typedef CMdaAudioPlayerUtility NativePlayer; virtual void doStop(); virtual void doSeek(qint64 milliseconds); virtual int setDeviceVolume(int mmfVolume); + virtual int openFile(const QString &fileName); virtual int openFile(RFile& file); virtual int openUrl(const QString& url); virtual int openDescriptor(const TDesC8 &des); virtual int bufferStatus() const; - virtual void close(); + virtual void doClose(); // MediaObjectInterface virtual bool hasVideo() const; - virtual qint64 currentTime() const; virtual qint64 totalTime() const; // AbstractMediaPlayer + virtual qint64 getCurrentTime() const; virtual int numberOfMetaDataEntries() const; virtual QPair metaDataEntry(int index) const; diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp index 98326b8..2c7a7ef 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.cpp +++ b/src/3rdparty/phonon/mmf/mediaobject.cpp @@ -61,6 +61,9 @@ MMF::MediaObject::MediaObject(QObject *parent) : MMF::MediaNode::MediaNode(paren TRACE_CONTEXT(MediaObject::MediaObject, EAudioApi); TRACE_ENTRY_0(); + const int err = m_fileServer.Connect(); + QT_TRAP_THROWING(User::LeaveIfError(err)); + Q_UNUSED(parent); TRACE_EXIT_0(); @@ -99,12 +102,6 @@ bool MMF::MediaObject::openRecognizer() return false; } - err = m_fileServer.Connect(); - if (KErrNone != err) { - TRACE("RFs::Connect error %d", err); - return false; - } - // This must be called in order to be able to share file handles with // the recognizer server (see fileMediaType function). err = m_fileServer.ShareProtected(); @@ -127,13 +124,8 @@ MMF::MediaType MMF::MediaObject::fileMediaType MediaType result = MediaTypeUnknown; if (openRecognizer()) { - - const QHBufC fileNameSymbian(QDir::toNativeSeparators(fileName)); - - Q_ASSERT(!m_file); - m_file = new RFile; - TInt err = m_file->Open(m_fileServer, *fileNameSymbian, EFileRead | EFileShareReadersOnly); - + TInt err = openFileHandle(fileName); + const QHBufC nativeFileName(QDir::toNativeSeparators(fileName)); if (KErrNone == err) { TDataRecognitionResult recognizerResult; err = m_recognizer.RecognizeData(*m_file, recognizerResult); @@ -141,16 +133,30 @@ MMF::MediaType MMF::MediaObject::fileMediaType const TPtrC mimeType = recognizerResult.iDataType.Des(); result = Utils::mimeTypeToMediaType(mimeType); } else { - TRACE("RApaLsSession::RecognizeData filename %S error %d", fileNameSymbian.data(), err); + TRACE("RApaLsSession::RecognizeData filename %S error %d", nativeFileName.data(), err); } } else { - TRACE("RFile::Open filename %S error %d", fileNameSymbian.data(), err); + TRACE("RFile::Open filename %S error %d", nativeFileName.data(), err); } } return result; } +int MMF::MediaObject::openFileHandle(const QString &fileName) +{ + TRACE_CONTEXT(MediaObject::openFileHandle, EAudioInternal); + const QHBufC nativeFileName(QDir::toNativeSeparators(fileName)); + TRACE_ENTRY("filename %S", nativeFileName.data()); + if (m_file) + m_file->Close(); + delete m_file; + m_file = 0; + m_file = new RFile; + TInt err = m_file->Open(m_fileServer, *nativeFileName, EFileRead | EFileShareReadersOrWriters); + return err; +} + MMF::MediaType MMF::MediaObject::bufferMediaType(const uchar *data, qint64 size) { TRACE_CONTEXT(MediaObject::bufferMediaType, EAudioInternal); diff --git a/src/3rdparty/phonon/mmf/mediaobject.h b/src/3rdparty/phonon/mmf/mediaobject.h index 5399e27..5d785fb 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.h +++ b/src/3rdparty/phonon/mmf/mediaobject.h @@ -89,6 +89,7 @@ public: void setVideoOutput(AbstractVideoOutput* videoOutput); + int openFileHandle(const QString &fileName); RFile* file() const; QResource* resource() const; -- cgit v0.12 From d1b6c5d5e101c9ffdfdfb7b712ea69025150ab05 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 27 Sep 2010 18:07:35 +0100 Subject: qmediaplayer: show buffer status of 0% During progressive download, it is not possible for the Symbian MMF Phonon backend to determine the buffering status, so it returns a value of 0%. This change causes qmediaplayer to display this value in the UI, thereby giving a visible notification of buffering during progressive download. Task-number: QTBUG-10769 Reviewed-by: Derick Hawcroft --- demos/qmediaplayer/mediaplayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/qmediaplayer/mediaplayer.cpp b/demos/qmediaplayer/mediaplayer.cpp index 3cb0616..97a8e35 100644 --- a/demos/qmediaplayer/mediaplayer.cpp +++ b/demos/qmediaplayer/mediaplayer.cpp @@ -716,7 +716,7 @@ void MediaPlayer::openFile() void MediaPlayer::bufferStatus(int percent) { - if (percent == 0 || percent == 100) + if (percent == 100) progressLabel->setText(QString()); else { QString str = QString::fromLatin1("(%1%)").arg(percent); -- cgit v0.12 From 71af72bc037db6bac023bf9a0bbf6032c06b2d29 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Sun, 3 Oct 2010 19:43:29 +0100 Subject: Added qmake check for presence of RHttpDownloadMgr header downloadmgrclient.h is not found on S^4 baselines, causing a build failure. This commit is a temporary workaround, which disables progressive download support if the header is not found. The correct solution is to determine whether the RHttpDownloadMgr definition has moved, and if so, to modify the .pro file to include the new path. Task-number: QTBUG-10769 Reviewed-by: TrustMe --- src/3rdparty/phonon/mmf/abstractmediaplayer.cpp | 26 ++++++++++-- src/3rdparty/phonon/mmf/abstractmediaplayer.h | 9 ++++- src/3rdparty/phonon/mmf/download.h | 2 - src/plugins/phonon/mmf/mmf.pro | 53 +++++++++++++++---------- 4 files changed, 61 insertions(+), 29 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp index a728423..dfc5840 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp @@ -56,8 +56,10 @@ MMF::AbstractMediaPlayer::AbstractMediaPlayer , m_mmfMaxVolume(NullMaxVolume) , m_prefinishMarkSent(false) , m_aboutToFinishSent(false) +#ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD , m_download(0) , m_downloadStalled(false) +#endif { connect(m_positionTimer.data(), SIGNAL(timeout()), this, SLOT(positionTick())); connect(m_bufferStatusTimer.data(), SIGNAL(timeout()), this, SLOT(bufferStatusTick())); @@ -256,7 +258,9 @@ void MMF::AbstractMediaPlayer::open() symbianErr = openFile(*file); if (KErrNone != symbianErr) errorMessage = tr("Error opening file"); - } else if (url.scheme() == QLatin1String("http")) { + } +#ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD + else if (url.scheme() == QLatin1String("http")) { Q_ASSERT(!m_download); m_download = new Download(url, this); connect(m_download, SIGNAL(lengthChanged(qint64)), @@ -264,7 +268,9 @@ void MMF::AbstractMediaPlayer::open() connect(m_download, SIGNAL(stateChanged(Download::State)), this, SLOT(downloadStateChanged(Download::State))); m_download->start(); - } else { + } +#endif + else { symbianErr = openUrl(url.toString()); if (KErrNone != symbianErr) errorMessage = tr("Error opening URL"); @@ -308,8 +314,10 @@ void MMF::AbstractMediaPlayer::open() void MMF::AbstractMediaPlayer::close() { doClose(); +#ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD delete m_download; m_download = 0; +#endif m_position = 0; } @@ -419,7 +427,9 @@ void MMF::AbstractMediaPlayer::loadingComplete(int error) bufferingComplete(); doSeek(m_position); startPlayback(); +#ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD m_downloadStalled = false; +#endif } } else { Q_ASSERT(Phonon::LoadingState == state()); @@ -472,12 +482,20 @@ qint64 MMF::AbstractMediaPlayer::toMilliSeconds(const TTimeIntervalMicroSeconds bool MMF::AbstractMediaPlayer::isProgressiveDownload() const { +#ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD return (0 != m_download); +#else + return false; +#endif } bool MMF::AbstractMediaPlayer::progressiveDownloadStalled() const { +#ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD return m_downloadStalled; +#else + return false; +#endif } //----------------------------------------------------------------------------- @@ -547,6 +565,7 @@ void MMF::AbstractMediaPlayer::startPlayback() void MMF::AbstractMediaPlayer::setProgressiveDownloadStalled() { +#ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD TRACE_CONTEXT(AbstractMediaPlayer::setProgressiveDownloadStalled, EAudioApi); TRACE_ENTRY("state %d", state()); Q_ASSERT(isProgressiveDownload()); @@ -555,7 +574,6 @@ void MMF::AbstractMediaPlayer::setProgressiveDownloadStalled() bufferingStarted(); // Video player loses window handle when closed - need to reapply it here videoOutputChanged(); -#ifdef QT_PHONON_MMF_DOWNLOAD_DUMMY m_download->resume(); #endif } @@ -569,6 +587,7 @@ void MMF::AbstractMediaPlayer::bufferStatusTick() emit MMF::AbstractPlayer::bufferStatus(status); } +#ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD void MMF::AbstractMediaPlayer::downloadLengthChanged(qint64 length) { TRACE_CONTEXT(AbstractMediaPlayer::downloadLengthChanged, EAudioApi); @@ -611,6 +630,7 @@ void MMF::AbstractMediaPlayer::downloadStateChanged(Download::State state) break; } } +#endif // PHONON_MMF_PROGRESSIVE_DOWNLOAD Phonon::State MMF::AbstractMediaPlayer::phononState(PrivateState state) const { diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.h b/src/3rdparty/phonon/mmf/abstractmediaplayer.h index 99fc101..c3b4528 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.h +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.h @@ -23,7 +23,9 @@ along with this library. If not, see . #include #include #include "abstractplayer.h" -#include "download.h" +#ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD +# include "download.h" +#endif class RFile; @@ -118,8 +120,10 @@ private: private Q_SLOTS: void positionTick(); void bufferStatusTick(); +#ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD void downloadLengthChanged(qint64); void downloadStateChanged(Download::State); +#endif private: MediaObject *const m_parent; @@ -140,9 +144,10 @@ private: // Used for playback of resource files TPtrC8 m_buffer; - // Used for progressive download +#ifdef PHONON_MMF_PROGRESSIVE_DOWNLOAD Download *m_download; bool m_downloadStalled; +#endif QMultiMap m_metaData; diff --git a/src/3rdparty/phonon/mmf/download.h b/src/3rdparty/phonon/mmf/download.h index b57348b..bda7963 100644 --- a/src/3rdparty/phonon/mmf/download.h +++ b/src/3rdparty/phonon/mmf/download.h @@ -70,8 +70,6 @@ public: const QUrl &sourceUrl() const; const QString &targetFileName() const; void start(); - - // Only has effect when QT_PHONON_MMF_DOWNLOAD_DUMMY is defined void resume(); enum State { diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro index 902354f..ac11188 100644 --- a/src/plugins/phonon/mmf/mmf.pro +++ b/src/plugins/phonon/mmf/mmf.pro @@ -36,7 +36,6 @@ symbian { $$PHONON_MMF_DIR/backend.h \ $$PHONON_MMF_DIR/bassboost.h \ $$PHONON_MMF_DIR/defs.h \ - $$PHONON_MMF_DIR/download.h \ $$PHONON_MMF_DIR/dummyplayer.h \ $$PHONON_MMF_DIR/effectfactory.h \ $$PHONON_MMF_DIR/effectparameter.h \ @@ -62,7 +61,6 @@ symbian { $$PHONON_MMF_DIR/abstractvideoplayer.cpp \ $$PHONON_MMF_DIR/backend.cpp \ $$PHONON_MMF_DIR/bassboost.cpp \ - $$PHONON_MMF_DIR/download.cpp \ $$PHONON_MMF_DIR/dummyplayer.cpp \ $$PHONON_MMF_DIR/effectfactory.cpp \ $$PHONON_MMF_DIR/effectparameter.cpp \ @@ -77,25 +75,37 @@ symbian { $$PHONON_MMF_DIR/utils.cpp \ $$PHONON_MMF_DIR/videowidget.cpp - # Test for whether the build environment supports video rendering to graphics - # surfaces. - symbian:exists($${EPOCROOT}epoc32/include/platform/videoplayer2.h) { - HEADERS += \ - $$PHONON_MMF_DIR/videooutput_surface.h \ - $$PHONON_MMF_DIR/videoplayer_surface.h - SOURCES += \ - $$PHONON_MMF_DIR/videooutput_surface.cpp \ - $$PHONON_MMF_DIR/videoplayer_surface.cpp - DEFINES += PHONON_MMF_VIDEO_SURFACES - } else { - HEADERS += \ - $$PHONON_MMF_DIR/ancestormovemonitor.h \ - $$PHONON_MMF_DIR/videooutput_dsa.h \ - $$PHONON_MMF_DIR/videoplayer_dsa.h - SOURCES += \ - $$PHONON_MMF_DIR/ancestormovemonitor.cpp \ - $$PHONON_MMF_DIR/videooutput_dsa.cpp \ - $$PHONON_MMF_DIR/videoplayer_dsa.cpp \ + symbian { + # Test for whether the build environment supports video rendering to graphics + # surfaces. + exists($${EPOCROOT}epoc32/include/platform/videoplayer2.h) { + HEADERS += \ + $$PHONON_MMF_DIR/videooutput_surface.h \ + $$PHONON_MMF_DIR/videoplayer_surface.h + SOURCES += \ + $$PHONON_MMF_DIR/videooutput_surface.cpp \ + $$PHONON_MMF_DIR/videoplayer_surface.cpp + DEFINES += PHONON_MMF_VIDEO_SURFACES + } else { + HEADERS += \ + $$PHONON_MMF_DIR/ancestormovemonitor.h \ + $$PHONON_MMF_DIR/videooutput_dsa.h \ + $$PHONON_MMF_DIR/videoplayer_dsa.h + SOURCES += \ + $$PHONON_MMF_DIR/ancestormovemonitor.cpp \ + $$PHONON_MMF_DIR/videooutput_dsa.cpp \ + $$PHONON_MMF_DIR/videoplayer_dsa.cpp \ + } + + # Test whether the build environment includes support for the Download Manager + # API, required for Progressive Download + exists($${EPOCROOT}epoc32/include/downloadmgrclient.h) | \ + exists($${EPOCROOT}epoc32/include/mw/downloadmgrclient.h) { + HEADERS += $$PHONON_MMF_DIR/download.h + SOURCES += $$PHONON_MMF_DIR/download.cpp + LIBS += -ldownloadmgr + DEFINES += PHONON_MMF_PROGRESSIVE_DOWNLOAD + } } LIBS += -lcone @@ -113,7 +123,6 @@ symbian { LIBS += -lapgrfx -lapmime # For recognizer LIBS += -lmmfcontrollerframework # For CMMFMetaDataEntry LIBS += -lmediaclientaudiostream # For CMdaAudioOutputStream - LIBS += -ldownloadmgr # These are for effects. LIBS += -lAudioEqualizerEffect -lBassBoostEffect -lDistanceAttenuationEffect -lDopplerBase -lEffectBase -lEnvironmentalReverbEffect -lListenerDopplerEffect -lListenerLocationEffect -lListenerOrientationEffect -lLocationBase -lLoudnessEffect -lOrientationBase -lSourceDopplerEffect -lSourceLocationEffect -lSourceOrientationEffect -lStereoWideningEffect -- cgit v0.12 From a5dc543041511c73b87fbda685c041febc81b7d9 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Fri, 8 Oct 2010 10:57:04 +0200 Subject: Fixed grammar mistake. Task-number: QTBUG-13712 --- src/corelib/tools/qsharedpointer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index 5fac960..0310baa 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -395,7 +395,7 @@ \section1 Tracking QObject - QWeakPointer can be used to track deletion classes derives from QObject, + QWeakPointer can be used to track deletion classes that derive from QObject, even if they are not managed by QSharedPointer. When used in that role, QWeakPointer replaces the older QPointer in all use-cases. QWeakPointer is also more efficient than QPointer, so it should be preferred in all @@ -1163,7 +1163,7 @@ \since 4.6 \brief The qSharedPointerObjectCast function is for casting a shared pointer. - + Returns a shared pointer to the pointer held by \a other, using a \l qobject_cast() to type \tt X to obtain an internal pointer of the appropriate type. If the \tt qobject_cast fails, the object @@ -1432,7 +1432,7 @@ void QtSharedPointer::internalSafetyCheckAdd2(const void *d_ptr, const volatile Q_ASSERT(!kp->dPointers.contains(d_ptr)); //qDebug("Adding d=%p value=%p", d_ptr, ptr); - + const void *other_d_ptr = kp->dataPointers.value(ptr, 0); if (other_d_ptr) { # ifdef BACKTRACE_SUPPORTED -- cgit v0.12 From 978416807b7e92d9317036cb4348ee172dde7d4e Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Fri, 8 Oct 2010 09:08:54 +0200 Subject: Fix memory leak in QPixmap::toSymbianRSgImage() when an error occurs. In the cases where an error occured while converting a QPixmap to a VGImage this function would return without deleting the RSgImage pointer that it created. Fix is to use a QScopedPointer instead. Also don't use q_check_ptr() since this isn't a CBase derived class. In case you are wondering why I didn't use a custom deleter here so that Close() was also called, we need to make sure that Close() is called on the RSgImage instance before calling Close() on the driver. Reviewed-by: mread --- src/openvg/qvg_symbian.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/openvg/qvg_symbian.cpp b/src/openvg/qvg_symbian.cpp index ef0160c..a9625b2 100644 --- a/src/openvg/qvg_symbian.cpp +++ b/src/openvg/qvg_symbian.cpp @@ -228,7 +228,7 @@ void* QVGPixmapData::toNativeType(NativeType type) sgInfo.iSizeInPixels.SetSize(w, h); sgInfo.iUsage = ESgUsageBitOpenVgImage | ESgUsageBitOpenVgSurface; - RSgImage *sgImage = q_check_ptr(new RSgImage()); + QScopedPointer sgImage(new RSgImage()); err = sgImage->Create(sgInfo, NULL, NULL); if (err != KErrNone) { driver.Close(); @@ -239,7 +239,7 @@ void* QVGPixmapData::toNativeType(NativeType type) EGLImageKHR eglImage = QEgl::eglCreateImageKHR(QEgl::display(), EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, - (EGLClientBuffer)sgImage, + (EGLClientBuffer)sgImage.data(), (EGLint*)KEglImageAttribs); if (!eglImage || eglGetError() != EGL_SUCCESS) { sgImage->Close(); @@ -261,13 +261,14 @@ void* QVGPixmapData::toNativeType(NativeType type) if (vgGetError() != VG_NO_ERROR) { sgImage->Close(); - sgImage = 0; + sgImage.reset(); } + // release stuff vgDestroyImage(dstVgImage); QEgl::eglDestroyImageKHR(QEgl::display(), eglImage); driver.Close(); - return reinterpret_cast(sgImage); + return reinterpret_cast(sgImage.take()); #endif } else if (type == QPixmapData::FbsBitmap) { CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap); -- cgit v0.12 From 76e1b6a93a36080e39c3d1e7cb1e754aa0131999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Fri, 8 Oct 2010 11:58:16 +0200 Subject: Don't include the arthur/common.pri file. Including the arthur/common.pri file pulls in many files we don't actually need. --- tests/auto/lancelot/lancelot.pro | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/auto/lancelot/lancelot.pro b/tests/auto/lancelot/lancelot.pro index d0138bd..3859a55 100644 --- a/tests/auto/lancelot/lancelot.pro +++ b/tests/auto/lancelot/lancelot.pro @@ -2,9 +2,11 @@ load(qttest_p4) QT += xml svg contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2):QT += opengl -SOURCES += tst_lancelot.cpp +SOURCES += tst_lancelot.cpp \ + $$QT_SOURCE_TREE/tests/arthur/common/paintcommands.cpp +HEADERS += $$QT_SOURCE_TREE/tests/arthur/common/paintcommands.h +RESOURCES += $$QT_SOURCE_TREE/tests/arthur/common/images.qrc -include($$QT_SOURCE_TREE/tests/arthur/common/common.pri) include($$QT_SOURCE_TREE/tests/arthur/common/baselineprotocol.pri) !symbian:!wince*:DEFINES += SRCDIR=\\\"$$PWD\\\" -- cgit v0.12 From 18e4aaebb8cd1764eba1fce64bb202b63d2a74b8 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Fri, 8 Oct 2010 12:16:51 +0200 Subject: Resized image, added missing files, and reformatted documentation of QtWebKit Image Analyzer example. --- doc/src/examples/webkit-bridge-imageanalyzer.qdoc | 24 ++-- doc/src/images/webkit-imageanalyzer-screenshot.png | Bin 190353 -> 56053 bytes examples/webkit/imageanalyzer/imageanalyzer.cpp | 8 +- examples/webkit/imageanalyzer/imageanalyzer.h | 73 +++++------ examples/webkit/imageanalyzer/mainwindow.h | 21 ++-- .../imageanalyzer/resources/imageanalyzer.qrc | 10 ++ examples/webkit/imageanalyzer/resources/index.html | 133 +++++++++++++++++++++ 7 files changed, 212 insertions(+), 57 deletions(-) create mode 100644 examples/webkit/imageanalyzer/resources/imageanalyzer.qrc create mode 100644 examples/webkit/imageanalyzer/resources/index.html diff --git a/doc/src/examples/webkit-bridge-imageanalyzer.qdoc b/doc/src/examples/webkit-bridge-imageanalyzer.qdoc index efc5623..b8c42c6 100644 --- a/doc/src/examples/webkit-bridge-imageanalyzer.qdoc +++ b/doc/src/examples/webkit-bridge-imageanalyzer.qdoc @@ -37,6 +37,9 @@ user interface, displaying web content written in HTML/JavaScript. The application uses QtConcurrent to distribute its work across as many CPU cores as are available from the system, so it can process each image in parallel. +For the full reference documentation of QtWebKit hybrid development, see +\l{qtwebkit-bridge.html}{The QtWebKit Bridge}. + Initially, you will see a user interface with an empty list of images. Clicking on some of the images in the lower pane below adds them to the list view above, as shown in the screenshot below. @@ -54,8 +57,8 @@ each image are shown. \image webkit-imageanalyzer-complete.png -The MainWindow is defined in C++, and creates a \c QNetworkCache and a -\c QWebView, and tells the \c QWebView to load the starting page, providing us +The MainWindow is defined in C++, and creates a \l QNetworkDiskCache and a +\l QWebView, and tells the \l QWebView to load the starting page, providing us with a user interface for the client. \snippet examples/webkit/imageanalyzer/mainwindow.cpp MainWindow - constructor @@ -67,8 +70,8 @@ likely be retrieved from the network rather than from resources. We wish to initialize an object reference in the JavaScript web page to point to our \tt ImageAnalyzer before any other scripts are run. To do this, we -connect the \c javaScriptWindowObjectCleared() signal to a slot which does the -object creation and handoff to JavaScript. +connect the \l{QWebFrame::}{javaScriptWindowObjectCleared()} signal to a slot +which does the object creation and handoff to JavaScript. \snippet examples/webkit/imageanalyzer/mainwindow.cpp MainWindow - addJSObject @@ -94,14 +97,15 @@ When the user clicks the \bold {Analyze} button, \c analyzeImages() is called, another regular JavaScript method, shown below. Notice it assumes the \c imageAnalyzer object is already defined and initialized in JavaScript space, but we guaranteed that by connecting our setup slot to the -appropriate signal, \c javaScriptWindowObjectCleared(). +appropriate signal, \l{QWebFrame::}{javaScriptWindowObjectCleared()}. \snippet examples/webkit/imageanalyzer/resources/index.html analyzeImages The only methods on \c ImageAnalyzer that we can or do call from JavaScript are -those which are exposed through Qt's MetaObject system: property getter/setter -methods, -\c public \c slots, \c signals, and other \c Q_INVOKABLE functions. +those which are exposed through \{The Meta-Object System}{Qt's MetaObject} +system: \l{The Property System}{property} getter/setter methods, +\c public \l {Signals & Slots}{signals and slots}, and other +\l{Q_INVOKABLE}{Q_INVOKABLE} functions. \snippet examples/webkit/imageanalyzer/imageanalyzer.h ImageAnalyzer - public interface \dots @@ -138,13 +142,13 @@ will load them into a QImage when the data is ready. \snippet examples/webkit/imageanalyzer/imageanalyzer.cpp ImageAnalyzer - handleReply After the images are loaded, they are queued up in preparation to be -sent in a batch for analysis to a \c QFutureWatcher, which will distribute the +sent in a batch for analysis to a \l QFutureWatcher, which will distribute the processing across multiple threads and cores, depending on how many are available. \snippet examples/webkit/imageanalyzer/imageanalyzer.cpp ImageAnalyzer - queueImage The function that gets performed on each image is \c averageRGB(), -as specified in argument 2 to the \c QtConcurrent::mapped() function. +as specified in argument 2 to the \l{QtConcurrent::mapped()} function. Notice it repeats the same calculations 100 times on each pixel to keep the CPU very busy. This is done only for the purposes of the demo so that the analysis takes a noticeable time to complete. diff --git a/doc/src/images/webkit-imageanalyzer-screenshot.png b/doc/src/images/webkit-imageanalyzer-screenshot.png index 987f8a2..c96371a 100644 Binary files a/doc/src/images/webkit-imageanalyzer-screenshot.png and b/doc/src/images/webkit-imageanalyzer-screenshot.png differ diff --git a/examples/webkit/imageanalyzer/imageanalyzer.cpp b/examples/webkit/imageanalyzer/imageanalyzer.cpp index c663cf3..1d0ee45 100644 --- a/examples/webkit/imageanalyzer/imageanalyzer.cpp +++ b/examples/webkit/imageanalyzer/imageanalyzer.cpp @@ -57,7 +57,7 @@ //! [ ImageAnalyzer - Constructor ] ImageAnalyzer::ImageAnalyzer(QNetworkDiskCache* netcache, QObject* parent) -: QObject(parent), m_cache(netcache), m_outstandingFetches(0) + : QObject(parent), m_cache(netcache), m_outstandingFetches(0) { /* ImageAnalyzer only wants to receive http responses for requests that it makes, so that's why it has its own @@ -69,11 +69,11 @@ ImageAnalyzer::ImageAnalyzer(QNetworkDiskCache* netcache, QObject* parent) m_network->setCache(m_cache); QObject::connect(m_network, SIGNAL(finished(QNetworkReply*)), - this, SLOT(handleReply(QNetworkReply*))); + this, SLOT(handleReply(QNetworkReply*))); QObject::connect(m_watcher, SIGNAL(finished()), - this, SLOT(doneProcessing())); + this, SLOT(doneProcessing())); QObject::connect(m_watcher, SIGNAL(progressValueChanged(int)), - this, SLOT(progressStatus(int))); + this, SLOT(progressStatus(int))); } //! [ ImageAnalyzer - Constructor ] ImageAnalyzer::~ImageAnalyzer() diff --git a/examples/webkit/imageanalyzer/imageanalyzer.h b/examples/webkit/imageanalyzer/imageanalyzer.h index f228c0e..1bb25dc 100644 --- a/examples/webkit/imageanalyzer/imageanalyzer.h +++ b/examples/webkit/imageanalyzer/imageanalyzer.h @@ -47,48 +47,53 @@ class QNetworkAccessManager; class QNetworkReply; class QNetworkDiskCache; + //! [ ImageAnalyzer - public interface ] class ImageAnalyzer : public QObject { Q_OBJECT - public: - ImageAnalyzer(QNetworkDiskCache * netcache, QObject * parent=0); +public: + ImageAnalyzer(QNetworkDiskCache * netcache, QObject * parent=0); + + QRgb lastResults(); + float lastRed(); + float lastGreen(); + float lastBlue(); + bool isBusy(); + Q_PROPERTY(bool busy READ isBusy); + Q_PROPERTY(float red READ lastRed); + Q_PROPERTY(float green READ lastGreen); + Q_PROPERTY(float blue READ lastBlue); + ~ImageAnalyzer(); + +public slots: + /*! initiates analysis of all the urls in the list */ + void startAnalysis(const QStringList & urls); + +signals: + void finishedAnalysis(); + void updateProgress(int completed, int total); + //! [ ImageAnalyzer - public interface ] + +private slots: + void handleReply(QNetworkReply*); + void doneProcessing(); + void progressStatus(int); - QRgb lastResults(); - float lastRed(); - float lastGreen(); - float lastBlue(); - bool isBusy(); - Q_PROPERTY(bool busy READ isBusy); - Q_PROPERTY(float red READ lastRed); - Q_PROPERTY(float green READ lastGreen); - Q_PROPERTY(float blue READ lastBlue); - ~ImageAnalyzer(); - public slots: - /*! initiates analysis of all the urls in the list */ - void startAnalysis(const QStringList & urls); - signals: - void finishedAnalysis(); - void updateProgress(int completed, int total); -//! [ ImageAnalyzer - public interface ] - private slots: - void handleReply(QNetworkReply*); - void doneProcessing(); - void progressStatus(int); private: - QRgb processImages(); - void fetchURLs(); - void queueImage(QImage img); + QRgb processImages(); + void fetchURLs(); + void queueImage(QImage img); -//! [ ImageAnalyzer - private members ] + //! [ ImageAnalyzer - private members ] private: - QNetworkAccessManager* m_network; - QNetworkDiskCache* m_cache; - QStringList m_URLQueue; - QList m_imageQueue; - int m_outstandingFetches; - QFutureWatcher * m_watcher; -//! [ ImageAnalyzer - private members ] + QNetworkAccessManager* m_network; + QNetworkDiskCache* m_cache; + QStringList m_URLQueue; + QList m_imageQueue; + int m_outstandingFetches; + QFutureWatcher * m_watcher; + //! [ ImageAnalyzer - private members ] }; QRgb averageRGB(const QImage &img); diff --git a/examples/webkit/imageanalyzer/mainwindow.h b/examples/webkit/imageanalyzer/mainwindow.h index 4c6b950..076e586 100644 --- a/examples/webkit/imageanalyzer/mainwindow.h +++ b/examples/webkit/imageanalyzer/mainwindow.h @@ -41,8 +41,8 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include +#include class ImageAnalyzer; class QNetworkDiskCache; @@ -50,14 +50,17 @@ class QNetworkDiskCache; class MainWin : public QWebView { Q_OBJECT + +public: + explicit MainWin(QWidget * parent = 0); + +private: + ImageAnalyzer * m_analyzer; + QNetworkAccessManager * m_network; + QNetworkDiskCache * m_cache; + +private slots: + void addJSObject(); - public: - explicit MainWin(QWidget * parent = 0); - private: - ImageAnalyzer * m_analyzer; - QNetworkAccessManager * m_network; - QNetworkDiskCache * m_cache; - private slots: - void addJSObject(); }; #endif diff --git a/examples/webkit/imageanalyzer/resources/imageanalyzer.qrc b/examples/webkit/imageanalyzer/resources/imageanalyzer.qrc new file mode 100644 index 0000000..fe9a5df --- /dev/null +++ b/examples/webkit/imageanalyzer/resources/imageanalyzer.qrc @@ -0,0 +1,10 @@ + + + index.html + images/mtRainier.jpg + images/bellaCoola.jpg + images/trees.jpg + images/flower.jpg + images/seaShell.jpg + + diff --git a/examples/webkit/imageanalyzer/resources/index.html b/examples/webkit/imageanalyzer/resources/index.html new file mode 100644 index 0000000..6532951 --- /dev/null +++ b/examples/webkit/imageanalyzer/resources/index.html @@ -0,0 +1,133 @@ + + + + +

+
+
Images to be analyzed:
+ +
+ +
+
+ +
+
+

Image Analyzer

+
+
+

Status: Idle

+
+ Latest Results:
+ Red: n/a
+ Green: n/a
+ Blue: n/a
+
+

Click on images below to select for analysis

+
+
+ +
+
+ + + + + + +
+ + + + + + + -- cgit v0.12 From 4cff91c66207b870e12365421e63cd978e162e64 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 8 Oct 2010 10:55:54 +0200 Subject: Fix infinite loop when justifying undisplayable Arabic text If the Arabic text is for some reason undisplayable, e.g. because of QTBUG-13132, the font engine will be unable to find the tatweel character and the kashida width may be returned as 0. This would potentially cause an infinite loop, as "need" would remain >= minKashida forever because x - 0 is still >= 0. Task-number: QTBUG-13130 Reviewed-by: Lars --- src/gui/text/qtextengine.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 05de8f5..3bd6122 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1949,9 +1949,11 @@ void QTextEngine::justify(const QScriptLine &line) if (kashida_pos >= 0) { // qDebug("kashida position at %d in word", kashida_pos); set(&justificationPoints[nPoints], kashida_type, g.mid(kashida_pos), fontEngine(si)); - minKashida = qMin(minKashida, justificationPoints[nPoints].kashidaWidth); - maxJustify = qMax(maxJustify, justificationPoints[nPoints].type); - ++nPoints; + if (justificationPoints[nPoints].kashidaWidth > 0) { + minKashida = qMin(minKashida, justificationPoints[nPoints].kashidaWidth); + maxJustify = qMax(maxJustify, justificationPoints[nPoints].type); + ++nPoints; + } } kashida_pos = -1; kashida_type = HB_Arabic_Normal; @@ -1975,9 +1977,11 @@ void QTextEngine::justify(const QScriptLine &line) } if (kashida_pos >= 0) { set(&justificationPoints[nPoints], kashida_type, g.mid(kashida_pos), fontEngine(si)); - minKashida = qMin(minKashida, justificationPoints[nPoints].kashidaWidth); - maxJustify = qMax(maxJustify, justificationPoints[nPoints].type); - ++nPoints; + if (justificationPoints[nPoints].kashidaWidth > 0) { + minKashida = qMin(minKashida, justificationPoints[nPoints].kashidaWidth); + maxJustify = qMax(maxJustify, justificationPoints[nPoints].type); + ++nPoints; + } } } -- cgit v0.12 From 269821d9a1eda2893f84fdeff76edef576f9847d Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 8 Oct 2010 11:12:52 +0300 Subject: Inconsistency with deployment keyword .sources and .files. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The DEPLOYMENT instruction uses .sources, while INSTALLS uses .files. This is inconsistent, and we fix it in Qt 4 by adding .files as a supported alternative for DEPLOYMENT. This commit will be followed by a second, which aligns Qt build system. For Qt 5, this needs to be cleaned up by removing support for .sources. Task-number: QTBUG-3216 Reviewed-by: João Abecasis Cherry-picked from 730a5d562fcb7be6428458962456033054f99e4c by Frans Englich. Conflicts: qmake/generators/symbian/initprojectdeploy_symbian.cpp --- doc/src/snippets/code/doc_src_qmake-manual.qdoc | 16 ++++++++-------- qmake/generators/symbian/initprojectdeploy_symbian.cpp | 3 ++- qmake/generators/symbian/symbian_makefile.h | 4 +++- qmake/generators/symbian/symmake.cpp | 4 +++- qmake/generators/win32/msvc_vcproj.cpp | 3 ++- tools/qtestlib/wince/cetest/deployment.cpp | 10 +++++----- 6 files changed, 23 insertions(+), 17 deletions(-) diff --git a/doc/src/snippets/code/doc_src_qmake-manual.qdoc b/doc/src/snippets/code/doc_src_qmake-manual.qdoc index 4f74e9c..1d2fbb4 100644 --- a/doc/src/snippets/code/doc_src_qmake-manual.qdoc +++ b/doc/src/snippets/code/doc_src_qmake-manual.qdoc @@ -193,15 +193,15 @@ DEFINES += USE_MY_STUFF QT_DLL //! [28] -myFiles.sources = path\*.png +myFiles.files = path\*.png DEPLOYMENT += myFiles //! [28] //! [29] -myFiles.sources = path\file1.ext1 path2\file2.ext1 path3\* +myFiles.files = path\file1.ext1 path2\file2.ext1 path3\* myFiles.path = \some\path\on\device -someother.sources = C:\additional\files\* +someother.files = C:\additional\files\* someother.path = \myFiles\path2 DEPLOYMENT += myFiles someother //! [29] @@ -849,12 +849,12 @@ CONFIG(debug, debug|release) { //! [127] //! [128] -customplugin.sources = customimageplugin.dll -customplugin.sources += c:\myplugins\othercustomimageplugin.dll +customplugin.files = customimageplugin.dll +customplugin.files += c:\myplugins\othercustomimageplugin.dll customplugin.path = imageformats -dynamiclibrary.sources = mylib.dll helper.exe +dynamiclibrary.files = mylib.dll helper.exe dynamiclibrary.path = \sys\bin -globalplugin.sources = someglobalimageplugin.dll +globalplugin.files = someglobalimageplugin.dll globalplugin.path = \resource\qt\plugins\imageformats DEPLOYMENT += customplugin dynamiclibrary globalplugin //! [128] @@ -923,7 +923,7 @@ MMP_RULES += myIfdefBlock //! [139] //! [140] -somelib.sources = somelib.dll +somelib.files = somelib.dll somelib.path = \sys\bin somelib.pkg_prerules = "(0x12345678), 2, 2, 0, {\"Some Package\"}" \ "(0x87654321), 1, *, * ~ 2, 2, 0, {\"Some Other Package\"}" diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.cpp b/qmake/generators/symbian/initprojectdeploy_symbian.cpp index 5a6f66f..cd51e42 100644 --- a/qmake/generators/symbian/initprojectdeploy_symbian.cpp +++ b/qmake/generators/symbian/initprojectdeploy_symbian.cpp @@ -250,7 +250,8 @@ void initProjectDeploySymbian(QMakeProject* project, QStringList flags = project->values(item + ".flags"); - foreach(QString source, project->values(item + ".sources")) { + // ### Qt 5: remove .sources, inconsistent with INSTALLS + foreach(QString source, project->values(item + ".sources") + project->values(item + ".files")) { source = Option::fixPathToLocalOS(source); QString nameFilter; QFileInfo info(source); diff --git a/qmake/generators/symbian/symbian_makefile.h b/qmake/generators/symbian/symbian_makefile.h index 94f0145..63cede2 100644 --- a/qmake/generators/symbian/symbian_makefile.h +++ b/qmake/generators/symbian/symbian_makefile.h @@ -72,7 +72,9 @@ public: } else { const QStringList deployments = this->project->values("DEPLOYMENT"); for (int i = 0; i < deployments.count(); ++i) { - if (!this->project->values(deployments.at(i) + ".sources").isEmpty()) { + // ### Qt 5: remove .sources, inconsistent with INSTALLS + if (!this->project->values(deployments.at(i) + ".sources").isEmpty() || + !this->project->values(deployments.at(i) + ".files").isEmpty()) { generatePkg = true; break; } diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index 09a3fc8..0d63cdf 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -197,7 +197,9 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) generatePkg = true; } else { foreach(QString item, project->values("DEPLOYMENT")) { - if (!project->values(item + ".sources").isEmpty()) { + // ### Qt 5: remove .sources, inconsistent with INSTALLS + if (!project->values(item + ".sources").isEmpty() || + !project->values(item + ".files").isEmpty()) { generatePkg = true; break; } diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 06b726f..8582ce1 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1174,7 +1174,8 @@ void VcprojGenerator::initDeploymentTool() devicePath = Option::fixPathToLocalOS(QDir::cleanPath(targetPath + QLatin1Char('\\') + devicePath)); } // foreach d in item.sources - foreach(QString source, project->values(item + ".sources")) { + // ### Qt 5: remove .sources, inconsistent with INSTALLS + foreach(QString source, project->values(item + ".sources") + project->values(item + ".files")) { QString itemDevicePath = devicePath; source = Option::fixPathToLocalOS(source); QString nameFilter; diff --git a/tools/qtestlib/wince/cetest/deployment.cpp b/tools/qtestlib/wince/cetest/deployment.cpp index 95768f9..e74c72b 100644 --- a/tools/qtestlib/wince/cetest/deployment.cpp +++ b/tools/qtestlib/wince/cetest/deployment.cpp @@ -227,9 +227,9 @@ void DeploymentHandler::initProjectDeploy(QMakeProject* project, DeploymentList return; for (int it = 0; it < list.size(); ++it) { - QString argSource = list.at(it) + QString(".sources"); + QString argSource = list.at(it); QString argPath = list.at(it) + QString(".path"); - if ((project->values(argSource).isEmpty() || project->values(argPath).isEmpty()) && list.at(it) != "deploy") { + if (((project->values(argSource + QString(".files")).isEmpty() && project->values(argSource + QString(".sources")).isEmpty()) || project->values(argPath).isEmpty()) && list.at(it) != "deploy") { debugOutput(QString::fromLatin1("cannot deploy \"%1\" because of missing data.").arg(list.at(it)), 0); continue; } @@ -240,7 +240,7 @@ void DeploymentHandler::initProjectDeploy(QMakeProject* project, DeploymentList if (!addPath.startsWith("/") && !addPath.startsWith(QLatin1String("\\"))) addPath = targetPath + "/" + addPath; - QStringList addSources = project->values(argSource); + QStringList addSources = project->values(argSource + QString(".files")) + project->values(argSource + QString(".sources")); addSources.replaceInStrings(QLatin1String("/"), QLatin1String("\\")); for(int index=0; index < addSources.size(); ++index) { QString dirstr = qmake_getpwd(); @@ -264,7 +264,7 @@ void DeploymentHandler::initProjectDeploy(QMakeProject* project, DeploymentList continue; } QString appendedQmakeDeploy = QString::fromLatin1("_q_make_additional_deploy_%1").arg(addQMakeDeployCounter++); - project->parse(appendedQmakeDeploy + QLatin1String(".sources = \"") + wildInfo.absoluteFilePath()); + project->parse(appendedQmakeDeploy + QLatin1String(".files = \"") + wildInfo.absoluteFilePath()); project->parse(appendedQmakeDeploy + QLatin1String(".path = \"") + addPath); list.append(appendedQmakeDeploy); } @@ -276,7 +276,7 @@ void DeploymentHandler::initProjectDeploy(QMakeProject* project, DeploymentList QStringList additionalEntries = additionalDir.entryList(QDir::NoDotAndDotDot | QDir::AllEntries | QDir::NoSymLinks); foreach(QString item, additionalEntries) { QString appendedDeploy = QString::fromLatin1("_q_make_additional_deploy_%1").arg(addQMakeDeployCounter++); - project->parse(appendedDeploy + QLatin1String(".sources = \"") + Option::fixPathToLocalOS(additionalDir.absoluteFilePath(item)) + QLatin1String("\"")); + project->parse(appendedDeploy + QLatin1String(".files = \"") + Option::fixPathToLocalOS(additionalDir.absoluteFilePath(item)) + QLatin1String("\"")); QString appendTargetPath = project->values(argPath).join(QLatin1String(" ")); if (appendTargetPath == QLatin1String(".")) appendTargetPath = filestr; -- cgit v0.12 From f8a6897cf79821b2c5a8443ce18cf66aa5a8d0d8 Mon Sep 17 00:00:00 2001 From: Bruno Abinader Date: Fri, 8 Oct 2010 14:09:25 +0200 Subject: Added missing native separator transforms. This patch fixes the deployment of files when using Qt For Symbian SDK on Linux. Merge-request: 839 Reviewed-by: Oswald Buddenhagen --- qmake/generators/symbian/initprojectdeploy_symbian.cpp | 7 ++++++- qmake/generators/symbian/symmake_abld.cpp | 10 ++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.cpp b/qmake/generators/symbian/initprojectdeploy_symbian.cpp index 776a646..5963773 100644 --- a/qmake/generators/symbian/initprojectdeploy_symbian.cpp +++ b/qmake/generators/symbian/initprojectdeploy_symbian.cpp @@ -59,7 +59,12 @@ static QString fixPathToEpocOS(const QString &src) { QString ret = Option::fixPathToTargetOS(src); - return ret.replace('/', '\\'); + + bool pathHasDriveLetter = false; + if (ret.size() > 1) + pathHasDriveLetter = (ret.at(1) == QLatin1Char(':')); + + return pathHasDriveLetter ? ret.replace('/', '\\') : QDir::toNativeSeparators(ret); } static bool isPlugin(const QFileInfo& info, const QString& devicePath) diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp index 7416cbe..127d5c0 100644 --- a/qmake/generators/symbian/symmake_abld.cpp +++ b/qmake/generators/symbian/symmake_abld.cpp @@ -427,7 +427,8 @@ bool SymbianAbldMakefileGenerator::writeDeploymentTargets(QTextStream &t, bool i t << WINSCW_DEPLOYMENT_TARGET ":" << endl; QString remoteTestPath = epocRoot() - + QLatin1String(isRom ? "epoc32\\data\\z\\private\\" : "epoc32\\winscw\\c\\private\\") + + QDir::toNativeSeparators(QLatin1String(isRom ? "epoc32/data/z/private/" + : "epoc32/winscw/c/private/")) + privateDirUid; DeploymentList depList; @@ -439,11 +440,16 @@ bool SymbianAbldMakefileGenerator::writeDeploymentTargets(QTextStream &t, bool i t << "\t-echo Deploying changed files..." << endl; for (int i = 0; i < depList.size(); ++i) { +#ifdef Q_OS_WIN32 // Xcopy prompts for selecting file or directory if target doesn't exist, // and doesn't provide switch to force file selection. It does provide dir forcing, though, // so strip the last part of the destination. t << "\t-$(XCOPY) \"" << depList.at(i).from << "\" \"" << depList.at(i).to.left(depList.at(i).to.lastIndexOf("\\") + 1) << "\"" << endl; +#else + t << "\t-$(XCOPY) \"" << QDir::toNativeSeparators(depList.at(i).from) << "\" \"" + << QDir::toNativeSeparators(depList.at(i).to) << "\"" << endl; +#endif } t << endl; @@ -455,7 +461,7 @@ bool SymbianAbldMakefileGenerator::writeDeploymentTargets(QTextStream &t, bool i QStringList cleanList; for (int i = 0; i < depList.size(); ++i) { - cleanList.append(depList.at(i).to); + cleanList.append(QDir::toNativeSeparators(depList.at(i).to)); } generateCleanCommands(t, cleanList, "$(DEL_FILE)", "", "", ""); -- cgit v0.12 From f8596b2269631b9522e51bb0a68d86588d4696c7 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 8 Oct 2010 12:58:41 +0300 Subject: Align .pro with qmake: s/\.sources/.files/. Complement previous commit by aligning Qt itself to use .files consistently for DEPLOYMENT as well as INSTALLS. This excludes changes to webkit. Task-number: QTBUG-3216 Reviewed-by: axis --- demos/books/books.pro | 4 +- demos/declarative/minehunt/minehunt.pro | 2 +- demos/embedded/desktopservices/desktopservices.pro | 4 +- demos/embedded/fluidlauncher/fluidlauncher.pro | 80 +++++++++++----------- demos/embedded/qmlcalculator/deployment.pri | 2 +- demos/embedded/qmlclocks/deployment.pri | 2 +- demos/embedded/qmldialcontrol/deployment.pri | 2 +- demos/embedded/qmleasing/deployment.pri | 2 +- demos/embedded/qmlflickr/deployment.pri | 2 +- demos/embedded/qmlphotoviewer/deployment.pri | 2 +- demos/embedded/qmltwitter/deployment.pri | 2 +- demos/qmediaplayer/qmediaplayer.pro | 2 +- demos/spectrum/app/app.pro | 2 +- doc/src/snippets/code/doc_src_qmake-manual.qdoc | 2 +- .../cppextensions/imageprovider/imageprovider.pro | 2 +- .../cppextensions/qwidgets/qwidgets.pro | 2 +- examples/desktop/systray/systray.pro | 4 +- examples/draganddrop/puzzle/puzzle.pro | 4 +- examples/painting/svgviewer/svgviewer.pro | 4 +- .../syntaxhighlighter/syntaxhighlighter.pro | 2 +- examples/richtext/textobject/textobject.pro | 2 +- examples/script/context2d/context2d.pro | 2 +- examples/widgets/icons/icons.pro | 2 +- examples/widgets/movie/movie.pro | 2 +- examples/xml/dombookmarks/dombookmarks.pro | 2 +- examples/xml/htmlinfo/htmlinfo.pro | 2 +- examples/xml/saxbookmarks/saxbookmarks.pro | 4 +- mkspecs/features/qt.prf | 4 +- mkspecs/features/symbian/application_icon.prf | 6 +- mkspecs/features/symbian/data_caging_paths.prf | 4 +- mkspecs/features/symbian/default_post.prf | 2 +- mkspecs/features/symbian/run_on_phone.prf | 3 +- mkspecs/features/symbian/sis_targets.prf | 3 +- src/imports/folderlistmodel/folderlistmodel.pro | 4 +- src/imports/gestures/gestures.pro | 4 +- src/imports/particles/particles.pro | 4 +- src/qbase.pri | 2 +- src/s60installs/s60installs.pro | 56 +++++++-------- tests/arthur/lance/lance.pro | 2 +- tests/auto/checkxmlfiles/checkxmlfiles.pro | 2 +- tests/auto/declarative/examples/examples.pro | 2 +- tests/auto/declarative/moduleqt47/moduleqt47.pro | 2 +- .../auto/declarative/parserstress/parserstress.pro | 2 +- .../qdeclarativeanchors/qdeclarativeanchors.pro | 2 +- .../qdeclarativeanimatedimage.pro | 2 +- .../qdeclarativeanimations.pro | 2 +- .../qdeclarativebehaviors.pro | 2 +- .../qdeclarativebinding/qdeclarativebinding.pro | 2 +- .../qdeclarativeborderimage.pro | 2 +- .../qdeclarativeconnection.pro | 2 +- .../qdeclarativedom/qdeclarativedom.pro | 2 +- .../qdeclarativeecmascript.pro | 2 +- .../qdeclarativeflickable.pro | 2 +- .../qdeclarativeflipable/qdeclarativeflipable.pro | 2 +- .../qdeclarativefocusscope.pro | 2 +- .../qdeclarativefolderlistmodel.pro | 2 +- .../qdeclarativefontloader.pro | 2 +- .../qdeclarativegridview/qdeclarativegridview.pro | 2 +- .../qdeclarativeimage/qdeclarativeimage.pro | 2 +- .../qdeclarativeinfo/qdeclarativeinfo.pro | 2 +- .../qdeclarativeitem/qdeclarativeitem.pro | 2 +- .../qdeclarativelanguage/qdeclarativelanguage.pro | 2 +- .../qdeclarativelayoutitem.pro | 2 +- .../qdeclarativelistmodel.pro | 2 +- .../qdeclarativelistview/qdeclarativelistview.pro | 2 +- .../qdeclarativeloader/qdeclarativeloader.pro | 2 +- .../tst_qdeclarativemoduleplugin.pro | 2 +- .../qdeclarativemousearea.pro | 2 +- .../qdeclarativeparticles.pro | 2 +- .../qdeclarativepathview/qdeclarativepathview.pro | 2 +- .../qdeclarativepixmapcache.pro | 2 +- .../qdeclarativepositioners.pro | 2 +- .../qdeclarativeproperty/qdeclarativeproperty.pro | 2 +- .../declarative/qdeclarativeqt/qdeclarativeqt.pro | 2 +- .../qdeclarativerepeater/qdeclarativerepeater.pro | 2 +- .../qdeclarativescriptdebugging.pro | 2 +- .../qdeclarativesmoothedanimation.pro | 2 +- .../qdeclarativespringanimation.pro | 2 +- .../qdeclarativesqldatabase.pro | 2 +- .../qdeclarativestates/qdeclarativestates.pro | 2 +- .../qdeclarativetext/qdeclarativetext.pro | 2 +- .../qdeclarativetextedit/qdeclarativetextedit.pro | 2 +- .../qdeclarativetextinput.pro | 2 +- .../qdeclarativevaluetypes.pro | 2 +- .../qdeclarativeview/qdeclarativeview.pro | 2 +- .../qdeclarativeviewer/qdeclarativeviewer.pro | 2 +- .../qdeclarativevisualdatamodel.pro | 2 +- .../qdeclarativewebview/qdeclarativewebview.pro | 2 +- .../qdeclarativeworkerscript.pro | 2 +- .../qdeclarativexmlhttprequest.pro | 2 +- .../qdeclarativexmllistmodel.pro | 2 +- tests/auto/declarative/qmlvisual/qmlvisual.pro | 2 +- tests/auto/mediaobject/mediaobject.pro | 2 +- tests/auto/networkselftest/networkselftest.pro | 4 +- .../auto/patternistexamples/patternistexamples.pro | 12 ++-- .../qabstractnetworkcache.pro | 2 +- .../qabstractxmlnodemodel.pro | 2 +- tests/auto/qaccessibility/qaccessibility.pro | 2 +- tests/auto/qapplication/test/test.pro | 10 +-- tests/auto/qaudioinput/qaudioinput.pro | 2 +- tests/auto/qaudiooutput/qaudiooutput.pro | 2 +- tests/auto/qbytearray/qbytearray.pro | 2 +- tests/auto/qchar/qchar.pro | 2 +- tests/auto/qclipboard/test/test.pro | 12 ++-- tests/auto/qcssparser/qcssparser.pro | 4 +- tests/auto/qdatastream/qdatastream.pro | 4 +- tests/auto/qdesktopservices/qdesktopservices.pro | 12 ++-- tests/auto/qdir/qdir.pro | 2 +- tests/auto/qdiriterator/qdiriterator.pro | 2 +- tests/auto/qdirmodel/qdirmodel.pro | 6 +- tests/auto/qdom/qdom.pro | 2 +- tests/auto/qfile/test/test.pro | 4 +- tests/auto/qfiledialog/qfiledialog.pro | 4 +- tests/auto/qfiledialog2/qfiledialog2.pro | 4 +- tests/auto/qfileinfo/qfileinfo.pro | 4 +- tests/auto/qfilesystemmodel/qfilesystemmodel.pro | 2 +- tests/auto/qfontdatabase/qfontdatabase.pro | 2 +- tests/auto/qftp/qftp.pro | 4 +- tests/auto/qgraphicsscene/qgraphicsscene.pro | 4 +- tests/auto/qhelpcontentmodel/qhelpcontentmodel.pro | 4 +- tests/auto/qhelpenginecore/qhelpenginecore.pro | 4 +- tests/auto/qhttp/qhttp.pro | 12 ++-- tests/auto/qicoimageformat/qicoimageformat.pro | 10 +-- tests/auto/qicon/qicon.pro | 12 ++-- tests/auto/qimage/qimage.pro | 6 +- tests/auto/qimagereader/qimagereader.pro | 8 +-- tests/auto/qimagewriter/qimagewriter.pro | 6 +- tests/auto/qiodevice/qiodevice.pro | 4 +- tests/auto/qitemmodel/qitemmodel.pro | 4 +- tests/auto/qlabel/qlabel.pro | 2 +- tests/auto/qlayout/qlayout.pro | 2 +- tests/auto/qlibrary/tst/tst.pro | 6 +- tests/auto/qlocale/test/test.pro | 2 +- tests/auto/qlocalsocket/test/test.pro | 6 +- tests/auto/qmovie/qmovie.pro | 6 +- tests/auto/qnetworkreply/test/test.pro | 6 +- tests/auto/qobject/tst_qobject.pro | 4 +- tests/auto/qpainter/qpainter.pro | 2 +- tests/auto/qpixmap/qpixmap.pro | 8 +-- tests/auto/qpixmapfilter/qpixmapfilter.pro | 2 +- tests/auto/qplugin/tst_qplugin.pro | 4 +- tests/auto/qpluginloader/tst/tst.pro | 6 +- tests/auto/qprocess/test/test.pro | 40 +++++------ tests/auto/qresourceengine/qresourceengine.pro | 18 ++--- tests/auto/qscriptengine/qscriptengine.pro | 2 +- .../auto/qscriptjstestsuite/qscriptjstestsuite.pro | 2 +- .../auto/qscriptv8testsuite/qscriptv8testsuite.pro | 2 +- tests/auto/qsound/qsound.pro | 2 +- tests/auto/qsplitter/qsplitter.pro | 2 +- tests/auto/qsql/qsql.pro | 2 +- tests/auto/qsqldatabase/qsqldatabase.pro | 4 +- tests/auto/qsqldriver/qsqldriver.pro | 4 +- tests/auto/qsqlerror/qsqlerror.pro | 2 +- tests/auto/qsqlfield/qsqlfield.pro | 2 +- tests/auto/qsqlquery/qsqlquery.pro | 4 +- tests/auto/qsqlquerymodel/qsqlquerymodel.pro | 2 +- tests/auto/qsqlrecord/qsqlrecord.pro | 2 +- .../qsqlrelationaltablemodel.pro | 4 +- tests/auto/qsqltablemodel/qsqltablemodel.pro | 4 +- tests/auto/qsqlthread/qsqlthread.pro | 4 +- tests/auto/qsslcertificate/qsslcertificate.pro | 2 +- tests/auto/qsslkey/qsslkey.pro | 4 +- tests/auto/qsslsocket/qsslsocket.pro | 4 +- tests/auto/qstyle/qstyle.pro | 2 +- tests/auto/qsvggenerator/qsvggenerator.pro | 2 +- tests/auto/qsvgrenderer/qsvgrenderer.pro | 2 +- tests/auto/qtcpserver/test/test.pro | 4 +- tests/auto/qtemporaryfile/qtemporaryfile.pro | 2 +- .../qtextboundaryfinder/qtextboundaryfinder.pro | 2 +- tests/auto/qtextbrowser/qtextbrowser.pro | 4 +- tests/auto/qtextcodec/test/test.pro | 2 +- tests/auto/qtextedit/qtextedit.pro | 2 +- tests/auto/qtextstream/test/test.pro | 6 +- tests/auto/qtipc/qsharedmemory/test/test.pro | 6 +- .../qtipc/qsystemsemaphore/qsystemsemaphore.pro | 4 +- tests/auto/qtranslator/qtranslator.pro | 2 +- tests/auto/qudpsocket/test/test.pro | 2 +- tests/auto/quuid/test/test.pro | 4 +- tests/auto/qxml/qxml.pro | 2 +- tests/auto/qxmlformatter/qxmlformatter.pro | 2 +- tests/auto/qxmlquery/qxmlquery.pro | 4 +- tests/auto/qxmlsimplereader/qxmlsimplereader.pro | 2 +- tests/auto/qxmlstream/qxmlstream.pro | 2 +- tests/auto/qzip/qzip.pro | 2 +- tests/auto/uiloader/uiloader/uiloader.pro | 4 +- tests/auto/windowsmobile/test/test.pro | 2 +- tests/auto/xmlpatterns.pri | 4 +- .../xmlpatternsdiagnosticsts.pro | 2 +- tests/auto/xmlpatternsview/xmlpatternsview.pro | 2 +- tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro | 2 +- .../corelib/codecs/qtextcodec/qtextcodec.pro | 2 +- .../corelib/io/qdiriterator/qdiriterator.pro | 2 +- tests/benchmarks/corelib/tools/qstring/qstring.pro | 2 +- tests/benchmarks/declarative/binding/binding.pro | 2 +- .../declarative/compilation/compilation.pro | 2 +- tests/benchmarks/declarative/creation/creation.pro | 2 +- .../qdeclarativecomponent.pro | 2 +- .../qdeclarativeimage/qdeclarativeimage.pro | 2 +- .../qdeclarativemetaproperty.pro | 2 +- tests/benchmarks/declarative/qmltime/qmltime.pro | 2 +- tests/benchmarks/declarative/script/script.pro | 2 +- .../declarative/typeimports/typeimports.pro | 2 +- .../graphicsview/qgraphicsview/qgraphicsview.pro | 2 +- .../gui/image/qimagereader/qimagereader.pro | 6 +- tests/benchmarks/gui/text/qtext/qtext.pro | 2 +- .../textrendering/glyphshaping/glyphshaping.pro | 2 +- 206 files changed, 405 insertions(+), 403 deletions(-) diff --git a/demos/books/books.pro b/demos/books/books.pro index a5e44e5..06718d1 100644 --- a/demos/books/books.pro +++ b/demos/books/books.pro @@ -16,8 +16,8 @@ INSTALLS += target sources symbian: include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) wince*: { - CONFIG(debug, debug|release):sqlPlugins.sources = $$QT_BUILD_TREE/plugins/sqldrivers/*d4.dll - CONFIG(release, debug|release):sqlPlugins.sources = $$QT_BUILD_TREE/plugins/sqldrivers/*[^d]4.dll + CONFIG(debug, debug|release):sqlPlugins.files = $$QT_BUILD_TREE/plugins/sqldrivers/*d4.dll + CONFIG(release, debug|release):sqlPlugins.files = $$QT_BUILD_TREE/plugins/sqldrivers/*[^d]4.dll sqlPlugins.path = sqldrivers DEPLOYMENT += sqlPlugins } diff --git a/demos/declarative/minehunt/minehunt.pro b/demos/declarative/minehunt/minehunt.pro index 753ca4e..7984315 100644 --- a/demos/declarative/minehunt/minehunt.pro +++ b/demos/declarative/minehunt/minehunt.pro @@ -18,7 +18,7 @@ symbian:{ TARGET.EPOCALLOWDLLDATA = 1 TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) - qmlminehuntfiles.sources = MinehuntCore minehunt.qml + qmlminehuntfiles.files = MinehuntCore minehunt.qml DEPLOYMENT = qmlminehuntfiles } \ No newline at end of file diff --git a/demos/embedded/desktopservices/desktopservices.pro b/demos/embedded/desktopservices/desktopservices.pro index 94ddedd..e66db1c 100644 --- a/demos/embedded/desktopservices/desktopservices.pro +++ b/demos/embedded/desktopservices/desktopservices.pro @@ -7,8 +7,8 @@ SOURCES += desktopwidget.cpp contenttab.cpp linktab.cpp main.cpp RESOURCES += desktopservices.qrc -music.sources = data/*.mp3 data/*.wav -image.sources = data/*.png +music.files = data/*.mp3 data/*.wav +image.files = data/*.png target.path = $$[QT_INSTALL_DEMOS]/embedded/desktopservices sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro diff --git a/demos/embedded/fluidlauncher/fluidlauncher.pro b/demos/embedded/fluidlauncher/fluidlauncher.pro index ca74c38..0799ed9 100644 --- a/demos/embedded/fluidlauncher/fluidlauncher.pro +++ b/demos/embedded/fluidlauncher/fluidlauncher.pro @@ -33,7 +33,7 @@ wince*{ BUILD_DIR = debug } - executables.sources = \ + executables.files = \ $$QT_BUILD_TREE/demos/embedded/embeddedsvgviewer/$${BUILD_DIR}/embeddedsvgviewer.exe \ $$QT_BUILD_TREE/demos/embedded/styledemo/$${BUILD_DIR}/styledemo.exe \ $$QT_BUILD_TREE/demos/deform/$${BUILD_DIR}/deform.exe \ @@ -45,10 +45,10 @@ wince*{ executables.path = . - files.sources = $$PWD/screenshots $$PWD/slides $$PWD/../embeddedsvgviewer/shapes.svg + files.files = $$PWD/screenshots $$PWD/slides $$PWD/../embeddedsvgviewer/shapes.svg files.path = . - config.sources = $$PWD/config_wince/config.xml + config.files = $$PWD/config_wince/config.xml config.path = . DEPLOYMENT += config files executables @@ -79,7 +79,7 @@ symbian { } } - executables.sources = \ + executables.files = \ $$QT_BUILD_TREE/demos/embedded/styledemo/styledemo.exe \ $$QT_BUILD_TREE/demos/deform/deform.exe \ $$QT_BUILD_TREE/demos/pathstroke/pathstroke.exe \ @@ -97,7 +97,7 @@ symbian { executables.path = /sys/bin - reg_resource.sources = \ + reg_resource.files = \ $$regResourceDir(demos/embedded/styledemo/styledemo_reg.rsc) \ $$regResourceDir(demos/deform/deform_reg.rsc) \ $$regResourceDir(demos/pathstroke/pathstroke_reg.rsc) \ @@ -114,17 +114,17 @@ symbian { $$regResourceDir(demos/embedded/flightinfo/flightinfo_reg.rsc) contains(QT_CONFIG, phonon) { - reg_resource.sources += $$regResourceDir(demos/qmediaplayer/qmediaplayer_reg.rsc) + reg_resource.files += $$regResourceDir(demos/qmediaplayer/qmediaplayer_reg.rsc) } contains(QT_CONFIG, multimedia) { - reg_resource.sources += $$regResourceDir(demos/spectrum/app/spectrum_reg.rsc) + reg_resource.files += $$regResourceDir(demos/spectrum/app/spectrum_reg.rsc) } reg_resource.path = $$REG_RESOURCE_IMPORT_DIR - resource.sources = \ + resource.files = \ $$appResourceDir(demos/embedded/styledemo/styledemo.rsc) \ $$appResourceDir(demos/deform/deform.rsc) \ $$appResourceDir(demos/pathstroke/pathstroke.rsc) \ @@ -143,7 +143,7 @@ symbian { resource.path = $$APP_RESOURCE_DIR - mifs.sources = \ + mifs.files = \ $$appResourceDir(demos/embedded/fluidlauncher/fluidlauncher.mif) \ $$appResourceDir(demos/embedded/styledemo/styledemo.mif) \ $$appResourceDir(demos/deform/deform.mif) \ @@ -162,28 +162,28 @@ symbian { mifs.path = $$APP_RESOURCE_DIR contains(QT_CONFIG, svg) { - executables.sources += \ + executables.files += \ $$QT_BUILD_TREE/demos/embedded/embeddedsvgviewer/embeddedsvgviewer.exe \ $$QT_BUILD_TREE/demos/embedded/weatherinfo/weatherinfo.exe - reg_resource.sources += \ + reg_resource.files += \ $$regResourceDir(demos/embedded/embeddedsvgviewer/embeddedsvgviewer_reg.rsc) \ $$regResourceDir(demos/embedded/weatherinfo/weatherinfo_reg.rsc) - resource.sources += \ + resource.files += \ $$appResourceDir(demos/embedded/embeddedsvgviewer/embeddedsvgviewer.rsc) \ $$appResourceDir(demos/embedded/weatherinfo/weatherinfo.rsc) - mifs.sources += \ + mifs.files += \ $$appResourceDir(demos/embedded/embeddedsvgviewer/embeddedsvgviewer.mif) \ $$appResourceDir(demos/embedded/weatherinfo/weatherinfo.mif) } contains(QT_CONFIG, webkit) { - executables.sources += $$QT_BUILD_TREE/demos/embedded/anomaly/anomaly.exe - reg_resource.sources += $$regResourceDir(demos/embedded/anomaly/anomaly_reg.rsc) - resource.sources += $$appResourceDir(demos/embedded/anomaly/anomaly.rsc) - mifs.sources += \ + executables.files += $$QT_BUILD_TREE/demos/embedded/anomaly/anomaly.exe + reg_resource.files += $$regResourceDir(demos/embedded/anomaly/anomaly_reg.rsc) + resource.files += $$appResourceDir(demos/embedded/anomaly/anomaly.rsc) + mifs.files += \ $$appResourceDir(demos/embedded/anomaly/anomaly.mif) isEmpty(QT_LIBINFIX) { @@ -195,61 +195,61 @@ symbian { } contains(QT_CONFIG, phonon) { - executables.sources += $$QT_BUILD_TREE/demos/qmediaplayer/qmediaplayer.exe - resource.sources += $$appResourceDir(demos/qmediaplayer/qmediaplayer.rsc) - mifs.sources += \ + executables.files += $$QT_BUILD_TREE/demos/qmediaplayer/qmediaplayer.exe + resource.files += $$appResourceDir(demos/qmediaplayer/qmediaplayer.rsc) + mifs.files += \ $$appResourceDir(demos/qmediaplayer/qmediaplayer.mif) } contains(QT_CONFIG, multimedia) { - executables.sources += $$QT_BUILD_TREE/demos/spectrum/app/spectrum.exe - executables.sources += $$QT_BUILD_TREE/demos/spectrum/3rdparty/fftreal/fftreal.dll - resource.sources += $$appResourceDir(demos/spectrum/app/spectrum.rsc) - mifs.sources += \ + executables.files += $$QT_BUILD_TREE/demos/spectrum/app/spectrum.exe + executables.files += $$QT_BUILD_TREE/demos/spectrum/3rdparty/fftreal/fftreal.dll + resource.files += $$appResourceDir(demos/spectrum/app/spectrum.rsc) + mifs.files += \ $$appResourceDir(demos/spectrum/app/spectrum.mif) } contains(QT_CONFIG, script) { - executables.sources += $$QT_BUILD_TREE/examples/script/context2d/context2d.exe - reg_resource.sources += $$regResourceDir(examples/script/context2d/context2d_reg.rsc) - resource.sources += $$appResourceDir(examples/script/context2d/context2d.rsc) - mifs.sources += \ + executables.files += $$QT_BUILD_TREE/examples/script/context2d/context2d.exe + reg_resource.files += $$regResourceDir(examples/script/context2d/context2d_reg.rsc) + resource.files += $$appResourceDir(examples/script/context2d/context2d.rsc) + mifs.files += \ $$appResourceDir(examples/script/context2d/context2d.mif) } qmldemos = qmlcalculator qmlclocks qmldialcontrol qmleasing qmlflickr qmlphotoviewer qmltwitter contains(QT_CONFIG, declarative) { for(qmldemo, qmldemos) { - executables.sources += $$QT_BUILD_TREE/demos/embedded/$${qmldemo}/$${qmldemo}.exe - reg_resource.sources += $$regResourceDir(demos/embedded/$${qmldemo}/$${qmldemo}_reg.rsc) - resource.sources += $$appResourceDir(demos/embedded/$${qmldemo}/$${qmldemo}.rsc) - mifs.sources += $$appResourceDir(demos/embedded/$${qmldemo}/$${qmldemo}.mif) + executables.files += $$QT_BUILD_TREE/demos/embedded/$${qmldemo}/$${qmldemo}.exe + reg_resource.files += $$regResourceDir(demos/embedded/$${qmldemo}/$${qmldemo}_reg.rsc) + resource.files += $$appResourceDir(demos/embedded/$${qmldemo}/$${qmldemo}.rsc) + mifs.files += $$appResourceDir(demos/embedded/$${qmldemo}/$${qmldemo}.mif) } } - files.sources = $$PWD/screenshots $$PWD/slides + files.files = $$PWD/screenshots $$PWD/slides files.path = . - config.sources = $$PWD/config_s60/config.xml + config.files = $$PWD/config_s60/config.xml config.path = . - viewerimages.sources = $$PWD/../embeddedsvgviewer/shapes.svg + viewerimages.files = $$PWD/../embeddedsvgviewer/shapes.svg viewerimages.path = /data/images/qt/demos/embeddedsvgviewer # demos/mediaplayer make also use of these files. - desktopservices_music.sources = \ + desktopservices_music.files = \ $$PWD/../desktopservices/data/*.mp3 \ $$PWD/../desktopservices/data/*.wav desktopservices_music.path = /data/sounds - desktopservices_images.sources = $$PWD/../desktopservices/data/*.png + desktopservices_images.files = $$PWD/../desktopservices/data/*.png desktopservices_images.path = /data/images - saxbookmarks.sources = $$PWD/../../../examples/xml/saxbookmarks/frank.xbel - saxbookmarks.sources += $$PWD/../../../examples/xml/saxbookmarks/jennifer.xbel + saxbookmarks.files = $$PWD/../../../examples/xml/saxbookmarks/frank.xbel + saxbookmarks.files += $$PWD/../../../examples/xml/saxbookmarks/jennifer.xbel saxbookmarks.path = /data/qt/saxbookmarks - fluidbackup.sources = backup_registration.xml + fluidbackup.files = backup_registration.xml fluidbackup.path = /private/$$replace(TARGET.UID3, 0x,) DEPLOYMENT += config files executables viewerimages saxbookmarks reg_resource resource \ diff --git a/demos/embedded/qmlcalculator/deployment.pri b/demos/embedded/qmlcalculator/deployment.pri index a31303d..a97498e 100644 --- a/demos/embedded/qmlcalculator/deployment.pri +++ b/demos/embedded/qmlcalculator/deployment.pri @@ -4,5 +4,5 @@ symbian { qmlcalculator_uid3 = A000E3FB qmlcalculator_files.path = $$APP_PRIVATE_DIR_BASE/$$qmlcalculator_uid3 } -qmlcalculator_files.sources = $$qmlcalculator_src/calculator.qml $$qmlcalculator_src/Core +qmlcalculator_files.files = $$qmlcalculator_src/calculator.qml $$qmlcalculator_src/Core DEPLOYMENT += qmlcalculator_files diff --git a/demos/embedded/qmlclocks/deployment.pri b/demos/embedded/qmlclocks/deployment.pri index 0946733..6c6704c 100644 --- a/demos/embedded/qmlclocks/deployment.pri +++ b/demos/embedded/qmlclocks/deployment.pri @@ -4,5 +4,5 @@ symbian { qmlclocks_uid3 = A000E3FC qmlclocks_files.path = $$APP_PRIVATE_DIR_BASE/$$qmlclocks_uid3 } -qmlclocks_files.sources = $$qmlclocks_src/clocks.qml $$qmlclocks_src/content +qmlclocks_files.files = $$qmlclocks_src/clocks.qml $$qmlclocks_src/content DEPLOYMENT += qmlclocks_files diff --git a/demos/embedded/qmldialcontrol/deployment.pri b/demos/embedded/qmldialcontrol/deployment.pri index e0e72e6..a978443 100644 --- a/demos/embedded/qmldialcontrol/deployment.pri +++ b/demos/embedded/qmldialcontrol/deployment.pri @@ -4,5 +4,5 @@ symbian { qmldialcontrol_uid3 = A000E3FD qmldialcontrol_files.path = $$APP_PRIVATE_DIR_BASE/$$qmldialcontrol_uid3 } -qmldialcontrol_files.sources = $$qmldialcontrol_src/dialcontrol.qml $$qmldialcontrol_src/content +qmldialcontrol_files.files = $$qmldialcontrol_src/dialcontrol.qml $$qmldialcontrol_src/content DEPLOYMENT += qmldialcontrol_files diff --git a/demos/embedded/qmleasing/deployment.pri b/demos/embedded/qmleasing/deployment.pri index d3621cb..946fcd9 100644 --- a/demos/embedded/qmleasing/deployment.pri +++ b/demos/embedded/qmleasing/deployment.pri @@ -4,5 +4,5 @@ symbian { qmleasing_uid3 = A000E3FE qmleasing_files.path = $$APP_PRIVATE_DIR_BASE/$$qmleasing_uid3 } -qmleasing_files.sources = $$qmleasing_src/easing.qml $$qmleasing_src/content +qmleasing_files.files = $$qmleasing_src/easing.qml $$qmleasing_src/content DEPLOYMENT += qmleasing_files diff --git a/demos/embedded/qmlflickr/deployment.pri b/demos/embedded/qmlflickr/deployment.pri index b508292..a38dc95 100644 --- a/demos/embedded/qmlflickr/deployment.pri +++ b/demos/embedded/qmlflickr/deployment.pri @@ -4,5 +4,5 @@ symbian { qmlflickr_uid3 = A000E3FF qmlflickr_files.path = $$APP_PRIVATE_DIR_BASE/$$qmlflickr_uid3 } -qmlflickr_files.sources = $$qmlflickr_src/flickr.qml $$qmlflickr_src/common $$qmlflickr_src/mobile +qmlflickr_files.files = $$qmlflickr_src/flickr.qml $$qmlflickr_src/common $$qmlflickr_src/mobile DEPLOYMENT += qmlflickr_files diff --git a/demos/embedded/qmlphotoviewer/deployment.pri b/demos/embedded/qmlphotoviewer/deployment.pri index 35937a8..23882e3 100644 --- a/demos/embedded/qmlphotoviewer/deployment.pri +++ b/demos/embedded/qmlphotoviewer/deployment.pri @@ -4,5 +4,5 @@ symbian { qmlphotoviewer_uid3 = A000E400 qmlphotoviewer_files.path = $$APP_PRIVATE_DIR_BASE/$$qmlphotoviewer_uid3 } -qmlphotoviewer_files.sources = $$qmlphotoviewer_src/photoviewer.qml $$qmlphotoviewer_src/PhotoViewerCore +qmlphotoviewer_files.files = $$qmlphotoviewer_src/photoviewer.qml $$qmlphotoviewer_src/PhotoViewerCore DEPLOYMENT += qmlphotoviewer_files diff --git a/demos/embedded/qmltwitter/deployment.pri b/demos/embedded/qmltwitter/deployment.pri index 4404e33..3edc0e5 100644 --- a/demos/embedded/qmltwitter/deployment.pri +++ b/demos/embedded/qmltwitter/deployment.pri @@ -4,5 +4,5 @@ symbian { qmltwitter_uid3 = A000E401 qmltwitter_files.path = $$APP_PRIVATE_DIR_BASE/$$qmltwitter_uid3 } -qmltwitter_files.sources = $$qmltwitter_src/twitter.qml $$qmltwitter_src/TwitterCore +qmltwitter_files.files = $$qmltwitter_src/twitter.qml $$qmltwitter_src/TwitterCore DEPLOYMENT += qmltwitter_files diff --git a/demos/qmediaplayer/qmediaplayer.pro b/demos/qmediaplayer/qmediaplayer.pro index 9407a81..8803d2e 100644 --- a/demos/qmediaplayer/qmediaplayer.pro +++ b/demos/qmediaplayer/qmediaplayer.pro @@ -27,7 +27,7 @@ DEPLOYMENT_PLUGIN += phonon_ds9 phonon_waveout symbian { TARGET.UID3 = 0xA000C613 - addFiles.sources = ../embedded/desktopservices/data/sax.mp3 + addFiles.files = ../embedded/desktopservices/data/sax.mp3 addFiles.path = /data/sounds/ DEPLOYMENT += addFiles diff --git a/demos/spectrum/app/app.pro b/demos/spectrum/app/app.pro index 4fe8b6d..1ae16e9 100644 --- a/demos/spectrum/app/app.pro +++ b/demos/spectrum/app/app.pro @@ -86,7 +86,7 @@ symbian { !contains(DEFINES, DISABLE_FFT) { # Include FFTReal DLL in the SIS file - fftreal.sources = ../fftreal.dll + fftreal.files = ../fftreal.dll fftreal.path = !:/sys/bin DEPLOYMENT += fftreal } diff --git a/doc/src/snippets/code/doc_src_qmake-manual.qdoc b/doc/src/snippets/code/doc_src_qmake-manual.qdoc index 1d2fbb4..ab67a3d 100644 --- a/doc/src/snippets/code/doc_src_qmake-manual.qdoc +++ b/doc/src/snippets/code/doc_src_qmake-manual.qdoc @@ -1021,7 +1021,7 @@ DEPLOYMENT -= default_bin_deployment default_resource_deployment default_reg_dep //! [155] default_bin_deployment.flags += FILERUN RUNINSTALL -dep_note.sources = install_note.txt +dep_note.files = install_note.txt dep_note.flags = FILETEXT TEXTEXIT DEPLOYMENT += dep_note //! [155] diff --git a/examples/declarative/cppextensions/imageprovider/imageprovider.pro b/examples/declarative/cppextensions/imageprovider/imageprovider.pro index 7149986..f6e09a2 100644 --- a/examples/declarative/cppextensions/imageprovider/imageprovider.pro +++ b/examples/declarative/cppextensions/imageprovider/imageprovider.pro @@ -22,7 +22,7 @@ symbian:{ include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) TARGET.EPOCALLOWDLLDATA = 1 - importFiles.sources = ImageProviderCore/qmlimageproviderplugin.dll ImageProviderCore/qmldir + importFiles.files = ImageProviderCore/qmlimageproviderplugin.dll ImageProviderCore/qmldir importFiles.path = ImageProviderCore DEPLOYMENT = importFiles } diff --git a/examples/declarative/cppextensions/qwidgets/qwidgets.pro b/examples/declarative/cppextensions/qwidgets/qwidgets.pro index 2e610f9..0f5398b 100644 --- a/examples/declarative/cppextensions/qwidgets/qwidgets.pro +++ b/examples/declarative/cppextensions/qwidgets/qwidgets.pro @@ -17,7 +17,7 @@ symbian:{ include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) TARGET.EPOCALLOWDLLDATA = 1 - importFiles.sources = QWidgets/qmlqwidgetsplugin.dll QWidgets/qmldir + importFiles.files = QWidgets/qmlqwidgetsplugin.dll QWidgets/qmldir importFiles.path = QWidgets DEPLOYMENT = importFiles diff --git a/examples/desktop/systray/systray.pro b/examples/desktop/systray/systray.pro index 9b25916..710452b 100644 --- a/examples/desktop/systray/systray.pro +++ b/examples/desktop/systray/systray.pro @@ -14,10 +14,10 @@ symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) wince* { CONFIG(debug, release|debug) { - addPlugins.sources = $$QT_BUILD_TREE/plugins/imageformats/qsvgd4.dll + addPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/qsvgd4.dll } CONFIG(release, release|debug) { - addPlugins.sources = $$QT_BUILD_TREE/plugins/imageformats/qsvg4.dll + addPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/qsvg4.dll } addPlugins.path = imageformats DEPLOYMENT += addPlugins diff --git a/examples/draganddrop/puzzle/puzzle.pro b/examples/draganddrop/puzzle/puzzle.pro index ec88f7a..c0400d8 100644 --- a/examples/draganddrop/puzzle/puzzle.pro +++ b/examples/draganddrop/puzzle/puzzle.pro @@ -18,12 +18,12 @@ INSTALLS += target sources symbian:{ TARGET.UID3 = 0xA000CF65 include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) - addFile.sources = example.jpg + addFile.files = example.jpg addFile.path = . DEPLOYMENT += addFile } wince*: { - addFile.sources = example.jpg + addFile.files = example.jpg addFile.path = . DEPLOYMENT += addFile } diff --git a/examples/painting/svgviewer/svgviewer.pro b/examples/painting/svgviewer/svgviewer.pro index 4809b91..6417849 100644 --- a/examples/painting/svgviewer/svgviewer.pro +++ b/examples/painting/svgviewer/svgviewer.pro @@ -17,7 +17,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/painting/svgviewer INSTALLS += target sources wince*: { - addFiles.sources = files\\*.svg + addFiles.files = files\\*.svg addFiles.path = "\\My Documents" DEPLOYMENT += addFiles } @@ -25,7 +25,7 @@ wince*: { symbian: { TARGET.UID3 = 0xA000A64E include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) - addFiles.sources = files\\*.svg + addFiles.files = files\\*.svg addFiles.path = . DEPLOYMENT += addFiles } diff --git a/examples/richtext/syntaxhighlighter/syntaxhighlighter.pro b/examples/richtext/syntaxhighlighter/syntaxhighlighter.pro index 0574b2d..67aa1ff 100644 --- a/examples/richtext/syntaxhighlighter/syntaxhighlighter.pro +++ b/examples/richtext/syntaxhighlighter/syntaxhighlighter.pro @@ -13,7 +13,7 @@ INSTALLS += target sources symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) wince*: { - addFiles.sources = main.cpp mainwindow.cpp + addFiles.files = main.cpp mainwindow.cpp addFiles.path = . DEPLOYMENT += addFiles } diff --git a/examples/richtext/textobject/textobject.pro b/examples/richtext/textobject/textobject.pro index 4fa9cb0..222b0fe 100644 --- a/examples/richtext/textobject/textobject.pro +++ b/examples/richtext/textobject/textobject.pro @@ -12,7 +12,7 @@ sources.files = $$SOURCES $$HEADERS *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/richtext/textobject INSTALLS += target sources -filesToDeploy.sources = files/*.svg +filesToDeploy.files = files/*.svg filesToDeploy.path = files DEPLOYMENT += filesToDeploy diff --git a/examples/script/context2d/context2d.pro b/examples/script/context2d/context2d.pro index 54f5c31..6a0e397 100644 --- a/examples/script/context2d/context2d.pro +++ b/examples/script/context2d/context2d.pro @@ -27,6 +27,6 @@ symbian:{ include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) TARGET.EPOCHEAPSIZE = 0x200000 0xA00000 contextScripts.path = . - contextScripts.sources = scripts + contextScripts.files = scripts DEPLOYMENT += contextScripts } diff --git a/examples/widgets/icons/icons.pro b/examples/widgets/icons/icons.pro index 39c7ab2..48b2da9 100644 --- a/examples/widgets/icons/icons.pro +++ b/examples/widgets/icons/icons.pro @@ -17,7 +17,7 @@ INSTALLS += target sources symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) wince*: { - imageFiles.sources = images/* + imageFiles.files = images/* wincewm*: { imageFiles.path = "/My Documents/My Pictures" } else { diff --git a/examples/widgets/movie/movie.pro b/examples/widgets/movie/movie.pro index 517fec7..d59bf2e 100644 --- a/examples/widgets/movie/movie.pro +++ b/examples/widgets/movie/movie.pro @@ -11,7 +11,7 @@ INSTALLS += target sources symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) wince*: { - addFiles.sources += *.mng + addFiles.files += *.mng addFiles.path = . DEPLOYMENT += addFiles DEPLOYMENT_PLUGIN += qmng diff --git a/examples/xml/dombookmarks/dombookmarks.pro b/examples/xml/dombookmarks/dombookmarks.pro index f906d2f..80bbec4 100644 --- a/examples/xml/dombookmarks/dombookmarks.pro +++ b/examples/xml/dombookmarks/dombookmarks.pro @@ -14,7 +14,7 @@ INSTALLS += target sources symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) wince*: { - addFiles.sources = frank.xbel jennifer.xbel + addFiles.files = frank.xbel jennifer.xbel addFiles.path = "\\My Documents" DEPLOYMENT += addFiles } diff --git a/examples/xml/htmlinfo/htmlinfo.pro b/examples/xml/htmlinfo/htmlinfo.pro index 5e9c8ca..94b3a07 100644 --- a/examples/xml/htmlinfo/htmlinfo.pro +++ b/examples/xml/htmlinfo/htmlinfo.pro @@ -2,7 +2,7 @@ SOURCES += main.cpp QT -= gui wince*|symbian:{ - htmlfiles.sources = *.html + htmlfiles.files = *.html htmlfiles.path = . DEPLOYMENT += htmlfiles } diff --git a/examples/xml/saxbookmarks/saxbookmarks.pro b/examples/xml/saxbookmarks/saxbookmarks.pro index 7293bd1..d4b09b6 100644 --- a/examples/xml/saxbookmarks/saxbookmarks.pro +++ b/examples/xml/saxbookmarks/saxbookmarks.pro @@ -14,7 +14,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/xml/saxbookmarks INSTALLS += target sources wince*: { - addFiles.sources = frank.xbel jennifer.xbel + addFiles.files = frank.xbel jennifer.xbel addFiles.path = "\\My Documents" DEPLOYMENT += addFiles } @@ -22,7 +22,7 @@ wince*: { symbian: { TARGET.UID3 = 0xA000C60A include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) - addFiles.sources = frank.xbel jennifer.xbel + addFiles.files = frank.xbel jennifer.xbel addFiles.path = /data/qt/saxbookmarks DEPLOYMENT += addFiles } diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index e59319f..191a449 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -113,7 +113,7 @@ for(QT_CURRENT_VERIFY, $$list($$QT_PLUGIN_VERIFY)) { CONFIG(debug, debug|release): QT_ITEM = $${QTPLUG}d4.dll else: QT_ITEM = $${QTPLUG}4.dll - eval(qt_additional_plugin_$${QTPLUG}.sources = $$[QT_INSTALL_PLUGINS]/$${QT_PLUGINPATH}/$${QT_ITEM}) + eval(qt_additional_plugin_$${QTPLUG}.files = $$[QT_INSTALL_PLUGINS]/$${QT_PLUGINPATH}/$${QT_ITEM}) eval(qt_additional_plugin_$${QTPLUG}.path = $${QT_PLUGINPATH}) DEPLOYMENT *= qt_additional_plugin_$${QTPLUG} @@ -121,7 +121,7 @@ for(QT_CURRENT_VERIFY, $$list($$QT_PLUGIN_VERIFY)) { isEqual(QT_CURRENT_VERIFY, DEPLOYMENT_PLUGIN):shared:symbian: { QT_ITEM = $${QTPLUG}.dll - eval(qt_additional_plugin_$${QTPLUG}.sources = $${QT_ITEM}) + eval(qt_additional_plugin_$${QTPLUG}.files = $${QT_ITEM}) eval(qt_additional_plugin_$${QTPLUG}.path = $${QT_PLUGINPATH}) DEPLOYMENT *= qt_additional_plugin_$${QTPLUG} diff --git a/mkspecs/features/symbian/application_icon.prf b/mkspecs/features/symbian/application_icon.prf index 2948811..f43ec3d 100644 --- a/mkspecs/features/symbian/application_icon.prf +++ b/mkspecs/features/symbian/application_icon.prf @@ -23,9 +23,9 @@ contains(CONFIG, no_icon) { regZDir = $$resourceZDir } - default_resource_deployment.sources += $$resourceZDir/$${baseTarget}.rsc + default_resource_deployment.files += $$resourceZDir/$${baseTarget}.rsc default_resource_deployment.path = $$APP_RESOURCE_DIR - default_reg_deployment.sources += $$regZDir/$${baseTarget}_reg.rsc + default_reg_deployment.files += $$regZDir/$${baseTarget}_reg.rsc default_reg_deployment.path = $$REG_RESOURCE_IMPORT_DIR !isEmpty(ICON) { @@ -70,7 +70,7 @@ contains(CONFIG, no_icon) { RSS_RULES.number_of_icons = $$size(ICON_backslashed) RSS_RULES.icon_file = $$APP_RESOURCE_DIR/$${baseTarget}.mif - default_resource_deployment.sources += $$resourceZDir/$${baseTarget}.mif + default_resource_deployment.files += $$resourceZDir/$${baseTarget}.mif } } diff --git a/mkspecs/features/symbian/data_caging_paths.prf b/mkspecs/features/symbian/data_caging_paths.prf index 2f03128..7f5420c 100644 --- a/mkspecs/features/symbian/data_caging_paths.prf +++ b/mkspecs/features/symbian/data_caging_paths.prf @@ -13,7 +13,7 @@ # # # These variables are mostly useful when specifying deployment # -# myLib.sources = myLib.dll +# myLib.files = myLib.dll # myLib.path = $$SHARED_LIB_DIR # DEPLOYMENT += myLib # @@ -21,7 +21,7 @@ # # $$QT_PUBLIC_PLUGINS_BASE specifies the public base directory for Qt # # plugin stubs: # -# myPublicImageFormatPlugin.sources = myImageFormat.dll +# myPublicImageFormatPlugin.files = myImageFormat.dll # myPublicImageFormatPlugin.path = $$QT_PLUGINS_BASE_DIR/imageformats # DEPLOYMENT += myPublicImageFormatPlugin # diff --git a/mkspecs/features/symbian/default_post.prf b/mkspecs/features/symbian/default_post.prf index a9b6d0e..548fd51 100644 --- a/mkspecs/features/symbian/default_post.prf +++ b/mkspecs/features/symbian/default_post.prf @@ -10,7 +10,7 @@ contains(TEMPLATE, ".*app") { QMAKE_LIBS += $$QMAKE_LIBS_QT_ENTRY } - default_bin_deployment.sources += $$symbianRemoveSpecialCharacters($$basename(TARGET)).exe + default_bin_deployment.files += $$symbianRemoveSpecialCharacters($$basename(TARGET)).exe default_bin_deployment.path += /sys/bin load(application_icon.prf) diff --git a/mkspecs/features/symbian/run_on_phone.prf b/mkspecs/features/symbian/run_on_phone.prf index d845277..ba88a66 100644 --- a/mkspecs/features/symbian/run_on_phone.prf +++ b/mkspecs/features/symbian/run_on_phone.prf @@ -5,7 +5,8 @@ GENERATE_RUN_TARGETS = false contains(TEMPLATE, app): GENERATE_RUN_TARGETS = true else:!equals(DEPLOYMENT, default_deployment) { for(dep_item, $$list($$DEPLOYMENT)) { - dep_item_sources = $$eval($${dep_item}.sources) + ### Qt 5: remove .sources, inconsistent with INSTALLS + dep_item_sources = $$eval($${dep_item}.files) $$eval($${dep_item}.sources) !isEmpty(dep_item_sources): GENERATE_RUN_TARGETS = true } } diff --git a/mkspecs/features/symbian/sis_targets.prf b/mkspecs/features/symbian/sis_targets.prf index e838e10..e5a33cb 100644 --- a/mkspecs/features/symbian/sis_targets.prf +++ b/mkspecs/features/symbian/sis_targets.prf @@ -4,7 +4,8 @@ GENERATE_SIS_TARGETS = false contains(TEMPLATE, app): GENERATE_SIS_TARGETS = true else:!equals(DEPLOYMENT, default_deployment) { for(dep_item, $$list($$DEPLOYMENT)) { - dep_item_sources = $$eval($${dep_item}.sources) + ### Qt 5: remove .sources, inconsistent with INSTALLS + dep_item_sources = $$eval($${dep_item}.files) $$eval($${dep_item}.sources) !isEmpty(dep_item_sources): GENERATE_SIS_TARGETS = true } } diff --git a/src/imports/folderlistmodel/folderlistmodel.pro b/src/imports/folderlistmodel/folderlistmodel.pro index b2e5360..ef58226 100644 --- a/src/imports/folderlistmodel/folderlistmodel.pro +++ b/src/imports/folderlistmodel/folderlistmodel.pro @@ -17,8 +17,8 @@ symbian:{ TARGET.UID3 = 0x20021320 include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) - isEmpty(DESTDIR):importFiles.sources = qmlfolderlistmodelplugin$${QT_LIBINFIX}.dll qmldir - else:importFiles.sources = $$DESTDIR/qmlfolderlistmodelplugin$${QT_LIBINFIX}.dll qmldir + isEmpty(DESTDIR):importFiles.files = qmlfolderlistmodelplugin$${QT_LIBINFIX}.dll qmldir + else:importFiles.files = $$DESTDIR/qmlfolderlistmodelplugin$${QT_LIBINFIX}.dll qmldir importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH DEPLOYMENT = importFiles diff --git a/src/imports/gestures/gestures.pro b/src/imports/gestures/gestures.pro index 18ffcb9..5722b68 100644 --- a/src/imports/gestures/gestures.pro +++ b/src/imports/gestures/gestures.pro @@ -17,8 +17,8 @@ symbian:{ TARGET.UID3 = 0x2002131F include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) - isEmpty(DESTDIR):importFiles.sources = qmlgesturesplugin$${QT_LIBINFIX}.dll qmldir - else:importFiles.sources = $$DESTDIR/qmlgesturesplugin$${QT_LIBINFIX}.dll qmldir + isEmpty(DESTDIR):importFiles.files = qmlgesturesplugin$${QT_LIBINFIX}.dll qmldir + else:importFiles.files = $$DESTDIR/qmlgesturesplugin$${QT_LIBINFIX}.dll qmldir importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH DEPLOYMENT = importFiles diff --git a/src/imports/particles/particles.pro b/src/imports/particles/particles.pro index a3eb0d1..fd6f0f6 100644 --- a/src/imports/particles/particles.pro +++ b/src/imports/particles/particles.pro @@ -21,8 +21,8 @@ symbian:{ TARGET.UID3 = 0x2002131E include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) - isEmpty(DESTDIR):importFiles.sources = qmlparticlesplugin$${QT_LIBINFIX}.dll qmldir - else:importFiles.sources = $$DESTDIR/qmlparticlesplugin$${QT_LIBINFIX}.dll qmldir + isEmpty(DESTDIR):importFiles.files = qmlparticlesplugin$${QT_LIBINFIX}.dll qmldir + else:importFiles.files = $$DESTDIR/qmlparticlesplugin$${QT_LIBINFIX}.dll qmldir importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH DEPLOYMENT = importFiles diff --git a/src/qbase.pri b/src/qbase.pri index 1e13149..30f3337 100644 --- a/src/qbase.pri +++ b/src/qbase.pri @@ -198,7 +198,7 @@ symbian { pu_header = "; Partial upgrade package for testing $${TARGET} changes without reinstalling everything" \ "$${LITERAL_HASH}{\"$${TARGET}\"}, (0x2001E61C), $${QT_MAJOR_VERSION},$${QT_MINOR_VERSION},$${QT_PATCH_VERSION}, TYPE=PU" partial_upgrade.pkg_prerules = pu_header vendorinfo - partial_upgrade.sources = $$QMAKE_LIBDIR_QT/$${TARGET}.dll + partial_upgrade.files = $$QMAKE_LIBDIR_QT/$${TARGET}.dll partial_upgrade.path = c:/sys/bin DEPLOYMENT += partial_upgrade } diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index c73ed06..bc9d98b 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -35,7 +35,7 @@ symbian: { } VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} - qtlibraries.sources = \ + qtlibraries.files = \ $$QMAKE_LIBDIR_QT/QtCore$${QT_LIBINFIX}.dll \ $$QMAKE_LIBDIR_QT/QtXml$${QT_LIBINFIX}.dll \ $$QMAKE_LIBDIR_QT/QtGui$${QT_LIBINFIX}.dll \ @@ -80,7 +80,7 @@ symbian: { qts60plugindeployment = \ " \"$$pluginLocations/qts60plugin_5_0$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qts60plugin_5_0$${QT_LIBINFIX}.dll\"" - bearer_plugin.sources = $$QT_BUILD_TREE/plugins/bearer/qsymbianbearer$${QT_LIBINFIX}.dll + bearer_plugin.files = $$QT_BUILD_TREE/plugins/bearer/qsymbianbearer$${QT_LIBINFIX}.dll bearer_plugin.path = c:$$QT_PLUGINS_BASE_DIR/bearer DEPLOYMENT += bearer_plugin } @@ -113,25 +113,25 @@ symbian: { } qtlibraries.pkg_prerules += "(0x2002af5f), 0, 5, 0, {\"sqlite3\"}" - !contains(QT_CONFIG, no-jpeg): imageformats_plugins.sources += $$QT_BUILD_TREE/plugins/imageformats/qjpeg$${QT_LIBINFIX}.dll - !contains(QT_CONFIG, no-gif): imageformats_plugins.sources += $$QT_BUILD_TREE/plugins/imageformats/qgif$${QT_LIBINFIX}.dll - !contains(QT_CONFIG, no-mng): imageformats_plugins.sources += $$QT_BUILD_TREE/plugins/imageformats/qmng$${QT_LIBINFIX}.dll - !contains(QT_CONFIG, no-tiff): imageformats_plugins.sources += $$QT_BUILD_TREE/plugins/imageformats/qtiff$${QT_LIBINFIX}.dll - !contains(QT_CONFIG, no-ico): imageformats_plugins.sources += $$QT_BUILD_TREE/plugins/imageformats/qico$${QT_LIBINFIX}.dll + !contains(QT_CONFIG, no-jpeg): imageformats_plugins.files += $$QT_BUILD_TREE/plugins/imageformats/qjpeg$${QT_LIBINFIX}.dll + !contains(QT_CONFIG, no-gif): imageformats_plugins.files += $$QT_BUILD_TREE/plugins/imageformats/qgif$${QT_LIBINFIX}.dll + !contains(QT_CONFIG, no-mng): imageformats_plugins.files += $$QT_BUILD_TREE/plugins/imageformats/qmng$${QT_LIBINFIX}.dll + !contains(QT_CONFIG, no-tiff): imageformats_plugins.files += $$QT_BUILD_TREE/plugins/imageformats/qtiff$${QT_LIBINFIX}.dll + !contains(QT_CONFIG, no-ico): imageformats_plugins.files += $$QT_BUILD_TREE/plugins/imageformats/qico$${QT_LIBINFIX}.dll imageformats_plugins.path = c:$$QT_PLUGINS_BASE_DIR/imageformats - codecs_plugins.sources = $$QT_BUILD_TREE/plugins/codecs/qcncodecs$${QT_LIBINFIX}.dll $$QT_BUILD_TREE/plugins/codecs/qjpcodecs$${QT_LIBINFIX}.dll $$QT_BUILD_TREE/plugins/codecs/qtwcodecs$${QT_LIBINFIX}.dll $$QT_BUILD_TREE/plugins/codecs/qkrcodecs$${QT_LIBINFIX}.dll + codecs_plugins.files = $$QT_BUILD_TREE/plugins/codecs/qcncodecs$${QT_LIBINFIX}.dll $$QT_BUILD_TREE/plugins/codecs/qjpcodecs$${QT_LIBINFIX}.dll $$QT_BUILD_TREE/plugins/codecs/qtwcodecs$${QT_LIBINFIX}.dll $$QT_BUILD_TREE/plugins/codecs/qkrcodecs$${QT_LIBINFIX}.dll codecs_plugins.path = c:$$QT_PLUGINS_BASE_DIR/codecs contains(QT_CONFIG, phonon-backend) { - phonon_backend_plugins.sources += $$QMAKE_LIBDIR_QT/phonon_mmf$${QT_LIBINFIX}.dll + phonon_backend_plugins.files += $$QMAKE_LIBDIR_QT/phonon_mmf$${QT_LIBINFIX}.dll phonon_backend_plugins.path = c:$$QT_PLUGINS_BASE_DIR/phonon_backend DEPLOYMENT += phonon_backend_plugins } # Support backup & restore for Qt libraries - qtbackup.sources = backup_registration.xml + qtbackup.files = backup_registration.xml qtbackup.path = c:/private/10202D56/import/packages/$$replace(TARGET.UID3, 0x,) DEPLOYMENT += qtlibraries \ @@ -141,35 +141,35 @@ symbian: { graphicssystems_plugins contains(QT_CONFIG, svg): { - qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtSvg$${QT_LIBINFIX}.dll - imageformats_plugins.sources += $$QT_BUILD_TREE/plugins/imageformats/qsvg$${QT_LIBINFIX}.dll - iconengines_plugins.sources = $$QT_BUILD_TREE/plugins/iconengines/qsvgicon$${QT_LIBINFIX}.dll + qtlibraries.files += $$QMAKE_LIBDIR_QT/QtSvg$${QT_LIBINFIX}.dll + imageformats_plugins.files += $$QT_BUILD_TREE/plugins/imageformats/qsvg$${QT_LIBINFIX}.dll + iconengines_plugins.files = $$QT_BUILD_TREE/plugins/iconengines/qsvgicon$${QT_LIBINFIX}.dll iconengines_plugins.path = c:$$QT_PLUGINS_BASE_DIR/iconengines DEPLOYMENT += iconengines_plugins } contains(QT_CONFIG, phonon): { - qtlibraries.sources += $$QMAKE_LIBDIR_QT/phonon$${QT_LIBINFIX}.dll + qtlibraries.files += $$QMAKE_LIBDIR_QT/phonon$${QT_LIBINFIX}.dll } contains(QT_CONFIG, script): { - qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtScript$${QT_LIBINFIX}.dll + qtlibraries.files += $$QMAKE_LIBDIR_QT/QtScript$${QT_LIBINFIX}.dll } contains(QT_CONFIG, xmlpatterns): { - qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtXmlPatterns$${QT_LIBINFIX}.dll + qtlibraries.files += $$QMAKE_LIBDIR_QT/QtXmlPatterns$${QT_LIBINFIX}.dll } contains(QT_CONFIG, declarative): { - qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtDeclarative$${QT_LIBINFIX}.dll + qtlibraries.files += $$QMAKE_LIBDIR_QT/QtDeclarative$${QT_LIBINFIX}.dll - folderlistmodelImport.sources = $$QT_BUILD_TREE/imports/Qt/labs/folderlistmodel/qmlfolderlistmodelplugin$${QT_LIBINFIX}.dll - gesturesImport.sources = $$QT_BUILD_TREE/imports/Qt/labs/gestures/qmlgesturesplugin$${QT_LIBINFIX}.dll - particlesImport.sources = $$QT_BUILD_TREE/imports/Qt/labs/particles/qmlparticlesplugin$${QT_LIBINFIX}.dll + folderlistmodelImport.files = $$QT_BUILD_TREE/imports/Qt/labs/folderlistmodel/qmlfolderlistmodelplugin$${QT_LIBINFIX}.dll + gesturesImport.files = $$QT_BUILD_TREE/imports/Qt/labs/gestures/qmlgesturesplugin$${QT_LIBINFIX}.dll + particlesImport.files = $$QT_BUILD_TREE/imports/Qt/labs/particles/qmlparticlesplugin$${QT_LIBINFIX}.dll - folderlistmodelImport.sources += $$QT_SOURCE_TREE/src/imports/folderlistmodel/qmldir - gesturesImport.sources += $$QT_SOURCE_TREE/src/imports/gestures/qmldir - particlesImport.sources += $$QT_SOURCE_TREE/src/imports/particles/qmldir + folderlistmodelImport.files += $$QT_SOURCE_TREE/src/imports/folderlistmodel/qmldir + gesturesImport.files += $$QT_SOURCE_TREE/src/imports/gestures/qmldir + particlesImport.files += $$QT_SOURCE_TREE/src/imports/particles/qmldir folderlistmodelImport.path = c:$$QT_IMPORTS_BASE_DIR/Qt/labs/folderlistmodel gesturesImport.path = c:$$QT_IMPORTS_BASE_DIR/Qt/labs/gestures @@ -180,8 +180,8 @@ symbian: { graphicssystems_plugins.path = c:$$QT_PLUGINS_BASE_DIR/graphicssystems contains(QT_CONFIG, openvg) { - qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtOpenVG$${QT_LIBINFIX}.dll - graphicssystems_plugins.sources += $$QT_BUILD_TREE/plugins/graphicssystems/qvggraphicssystem$${QT_LIBINFIX}.dll + qtlibraries.files += $$QMAKE_LIBDIR_QT/QtOpenVG$${QT_LIBINFIX}.dll + graphicssystems_plugins.files += $$QT_BUILD_TREE/plugins/graphicssystems/qvggraphicssystem$${QT_LIBINFIX}.dll # OpenVG requires Symbian^3 or later pkg_platform_dependencies -= \ "[0x101F7961],0,0,0,{\"S60ProductID\"}" \ @@ -191,12 +191,12 @@ symbian: { } contains(QT_CONFIG, opengl) { - qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtOpenGL$${QT_LIBINFIX}.dll - graphicssystems_plugins.sources += $$QT_BUILD_TREE/plugins/graphicssystems/qglgraphicssystem$${QT_LIBINFIX}.dll + qtlibraries.files += $$QMAKE_LIBDIR_QT/QtOpenGL$${QT_LIBINFIX}.dll + graphicssystems_plugins.files += $$QT_BUILD_TREE/plugins/graphicssystems/qglgraphicssystem$${QT_LIBINFIX}.dll } contains(QT_CONFIG, multimedia){ - qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtMultimedia$${QT_LIBINFIX}.dll + qtlibraries.files += $$QMAKE_LIBDIR_QT/QtMultimedia$${QT_LIBINFIX}.dll } BLD_INF_RULES.prj_exports += "qt.iby $$CORE_MW_LAYER_IBY_EXPORT_PATH(qt.iby)" diff --git a/tests/arthur/lance/lance.pro b/tests/arthur/lance/lance.pro index 3692f21..56b7f25 100644 --- a/tests/arthur/lance/lance.pro +++ b/tests/arthur/lance/lance.pro @@ -13,7 +13,7 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, o contains(QT_CONFIG, qt3support):QT += qt3support symbian*: { - testData.sources = $$QT_BUILD_TREE/tests/arthur/data/qps + testData.files = $$QT_BUILD_TREE/tests/arthur/data/qps testData.path = . DEPLOYMENT += testData } diff --git a/tests/auto/checkxmlfiles/checkxmlfiles.pro b/tests/auto/checkxmlfiles/checkxmlfiles.pro index 319ba9b..ab932f5 100644 --- a/tests/auto/checkxmlfiles/checkxmlfiles.pro +++ b/tests/auto/checkxmlfiles/checkxmlfiles.pro @@ -8,7 +8,7 @@ include (../xmlpatterns.pri) wince*|symbian: { QT += network -addFiles.sources = \ +addFiles.files = \ $$QT_SOURCE_TREE/examples/sql/masterdetail/albumdetails.xml \ $$QT_SOURCE_TREE/examples/xmlpatterns/xquery/globalVariables/globals.gccxml \ $$QT_SOURCE_TREE/doc/src/diagrams/stylesheet/treeview.svg \ diff --git a/tests/auto/declarative/examples/examples.pro b/tests/auto/declarative/examples/examples.pro index 2e243b4..8ed33da 100644 --- a/tests/auto/declarative/examples/examples.pro +++ b/tests/auto/declarative/examples/examples.pro @@ -7,7 +7,7 @@ SOURCES += tst_examples.cpp include(../../../../tools/qml/qml.pri) symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/moduleqt47/moduleqt47.pro b/tests/auto/declarative/moduleqt47/moduleqt47.pro index 4ee634e..808f263 100644 --- a/tests/auto/declarative/moduleqt47/moduleqt47.pro +++ b/tests/auto/declarative/moduleqt47/moduleqt47.pro @@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_moduleqt47.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/parserstress/parserstress.pro b/tests/auto/declarative/parserstress/parserstress.pro index bb1d69f..1e323f7 100644 --- a/tests/auto/declarative/parserstress/parserstress.pro +++ b/tests/auto/declarative/parserstress/parserstress.pro @@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_parserstress.cpp symbian: { - importFiles.sources = ..\\..\\qscriptjstestsuite\\tests + importFiles.files = ..\\..\\qscriptjstestsuite\\tests importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro b/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro index 9798bb6..141e25d 100644 --- a/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro +++ b/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro @@ -4,7 +4,7 @@ SOURCES += tst_qdeclarativeanchors.cpp macx:CONFIG -= app_bundle symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro b/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro index 0a2f0f2..ad9509a 100644 --- a/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro +++ b/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro @@ -5,7 +5,7 @@ SOURCES += tst_qdeclarativeanimatedimage.cpp ../shared/testhttpserver.cpp macx:CONFIG -= app_bundle symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro b/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro index ed47dca..84cd498 100644 --- a/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro +++ b/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro @@ -4,7 +4,7 @@ SOURCES += tst_qdeclarativeanimations.cpp macx:CONFIG -= app_bundle symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro b/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro index cfb59ef..e4125fd 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro +++ b/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro @@ -4,7 +4,7 @@ SOURCES += tst_qdeclarativebehaviors.cpp macx:CONFIG -= app_bundle symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro b/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro index a7ba2a8..25bdbec 100644 --- a/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro +++ b/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro @@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativebinding.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro b/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro index a21761b..05d4cac 100644 --- a/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro +++ b/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro @@ -6,7 +6,7 @@ HEADERS += ../shared/testhttpserver.h SOURCES += tst_qdeclarativeborderimage.cpp ../shared/testhttpserver.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro b/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro index d06ce4f..c614571 100644 --- a/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro +++ b/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro @@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeconnection.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro b/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro index 415d4e2..e8f24a5 100644 --- a/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro +++ b/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro @@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativedom.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro b/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro index 58cad34..e7f8636 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro +++ b/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro @@ -13,7 +13,7 @@ INCLUDEPATH += ../shared # LIBS += -lgcov symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro b/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro index be0ba6c..1fb99d0 100644 --- a/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro +++ b/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro @@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeflickable.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro b/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro index 759e80b..eddd053 100644 --- a/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro +++ b/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro @@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeflipable.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro b/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro index 24749c6..fd7f6b8 100644 --- a/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro +++ b/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro @@ -4,7 +4,7 @@ SOURCES += tst_qdeclarativefocusscope.cpp macx:CONFIG -= app_bundle symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro b/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro index 91bf4a7..50c7ca0 100644 --- a/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro +++ b/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro @@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativefolderlistmodel.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro b/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro index 01dca26..f245a0d 100644 --- a/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro +++ b/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro @@ -6,7 +6,7 @@ HEADERS += ../shared/testhttpserver.h SOURCES += tst_qdeclarativefontloader.cpp ../shared/testhttpserver.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro b/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro index a99a1b9..b775b3d 100644 --- a/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro +++ b/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro @@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativegridview.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro b/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro index 244a1e1..c87c1d9 100644 --- a/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro +++ b/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro @@ -6,7 +6,7 @@ HEADERS += ../shared/testhttpserver.h SOURCES += tst_qdeclarativeimage.cpp ../shared/testhttpserver.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro b/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro index 2c20e7e..888596f 100644 --- a/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro +++ b/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro @@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeinfo.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro b/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro index f4901c4..0fd871e 100644 --- a/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro +++ b/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro @@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeitem.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro b/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro index 43c451f..aa69337 100644 --- a/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro +++ b/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro @@ -12,7 +12,7 @@ HEADERS += ../shared/testhttpserver.h SOURCES += ../shared/testhttpserver.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativelayoutitem/qdeclarativelayoutitem.pro b/tests/auto/declarative/qdeclarativelayoutitem/qdeclarativelayoutitem.pro index 5076e51..42d9a80 100644 --- a/tests/auto/declarative/qdeclarativelayoutitem/qdeclarativelayoutitem.pro +++ b/tests/auto/declarative/qdeclarativelayoutitem/qdeclarativelayoutitem.pro @@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativelayoutitem.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro b/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro index e90db49..8a39555 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro +++ b/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro @@ -6,7 +6,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativelistmodel.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro b/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro index 2c5a859..99eba67 100644 --- a/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro +++ b/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro @@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativelistview.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro b/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro index b07bf9e..1e7808a 100644 --- a/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro +++ b/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro @@ -8,7 +8,7 @@ SOURCES += tst_qdeclarativeloader.cpp \ ../shared/testhttpserver.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro index fb3630f..ec2d25e 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro +++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro @@ -4,7 +4,7 @@ QT += declarative CONFIG -= app_bundle symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro b/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro index 3d39aa8..a93f7af 100644 --- a/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro +++ b/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro @@ -6,7 +6,7 @@ HEADERS += ../shared/testhttpserver.h SOURCES += tst_qdeclarativemousearea.cpp ../shared/testhttpserver.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro b/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro index f9ca90f..8f13573 100644 --- a/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro +++ b/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro @@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeparticles.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro b/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro index 04fd26b..4f70a6f 100644 --- a/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro +++ b/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro @@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativepathview.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro b/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro index 3130364..47b1b7b 100644 --- a/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro +++ b/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro @@ -10,7 +10,7 @@ HEADERS += ../shared/testhttpserver.h SOURCES += ../shared/testhttpserver.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro b/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro index 5dc7bb8..e98aa5c 100644 --- a/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro +++ b/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro @@ -4,7 +4,7 @@ SOURCES += tst_qdeclarativepositioners.cpp macx:CONFIG -= app_bundle symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro index 4121a33..9dd727c 100644 --- a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro +++ b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro @@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeproperty.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro index 6af6500..a12c439 100644 --- a/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro +++ b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro @@ -4,7 +4,7 @@ SOURCES += tst_qdeclarativeqt.cpp macx:CONFIG -= app_bundle symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro b/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro index f3ff9ed..385b8da 100644 --- a/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro +++ b/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro @@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativerepeater.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativescriptdebugging/qdeclarativescriptdebugging.pro b/tests/auto/declarative/qdeclarativescriptdebugging/qdeclarativescriptdebugging.pro index c2d30a0..dedb263 100644 --- a/tests/auto/declarative/qdeclarativescriptdebugging/qdeclarativescriptdebugging.pro +++ b/tests/auto/declarative/qdeclarativescriptdebugging/qdeclarativescriptdebugging.pro @@ -9,7 +9,7 @@ INCLUDEPATH += ../shared # LIBS += -lgcov symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro b/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro index 872aeb9..69f331b 100644 --- a/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro +++ b/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro @@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativesmoothedanimation.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativespringanimation/qdeclarativespringanimation.pro b/tests/auto/declarative/qdeclarativespringanimation/qdeclarativespringanimation.pro index 213b262..a59522b 100644 --- a/tests/auto/declarative/qdeclarativespringanimation/qdeclarativespringanimation.pro +++ b/tests/auto/declarative/qdeclarativespringanimation/qdeclarativespringanimation.pro @@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativespringanimation.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro b/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro index 1462c9a..d938692 100644 --- a/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro +++ b/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro @@ -6,7 +6,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativesqldatabase.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro b/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro index 2bae041..2f32178 100644 --- a/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro +++ b/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro @@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativestates.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro b/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro index c1a36fd..362886e 100644 --- a/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro +++ b/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro @@ -10,7 +10,7 @@ HEADERS += ../shared/testhttpserver.h SOURCES += ../shared/testhttpserver.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativetextedit/qdeclarativetextedit.pro b/tests/auto/declarative/qdeclarativetextedit/qdeclarativetextedit.pro index 4b6bd49..cf706ba 100644 --- a/tests/auto/declarative/qdeclarativetextedit/qdeclarativetextedit.pro +++ b/tests/auto/declarative/qdeclarativetextedit/qdeclarativetextedit.pro @@ -6,7 +6,7 @@ SOURCES += tst_qdeclarativetextedit.cpp ../shared/testhttpserver.cpp HEADERS += ../shared/testhttpserver.h symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro b/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro index 8f42448..5c45f57 100644 --- a/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro +++ b/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro @@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativetextinput.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro b/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro index 90e46d3..a208254 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro +++ b/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro @@ -8,7 +8,7 @@ SOURCES += tst_qdeclarativevaluetypes.cpp \ testtypes.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro b/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro index 21a9195..4436d54 100644 --- a/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro +++ b/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro @@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeview.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativeviewer/qdeclarativeviewer.pro b/tests/auto/declarative/qdeclarativeviewer/qdeclarativeviewer.pro index 6189916..5ba416e 100644 --- a/tests/auto/declarative/qdeclarativeviewer/qdeclarativeviewer.pro +++ b/tests/auto/declarative/qdeclarativeviewer/qdeclarativeviewer.pro @@ -7,7 +7,7 @@ include(../../../../tools/qml/qml.pri) SOURCES += tst_qdeclarativeviewer.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/qdeclarativevisualdatamodel.pro b/tests/auto/declarative/qdeclarativevisualdatamodel/qdeclarativevisualdatamodel.pro index 92e5f60..16154f3 100644 --- a/tests/auto/declarative/qdeclarativevisualdatamodel/qdeclarativevisualdatamodel.pro +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/qdeclarativevisualdatamodel.pro @@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativevisualdatamodel.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro b/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro index 562a9fb..cc7fa43 100644 --- a/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro +++ b/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro @@ -6,7 +6,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativewebview.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro b/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro index 2f8f23d..eca8a68 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro +++ b/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro @@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeworkerscript.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro b/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro index 619b239..fbcc597 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro @@ -9,7 +9,7 @@ SOURCES += tst_qdeclarativexmlhttprequest.cpp \ ../shared/testhttpserver.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro b/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro index 472cffb..23173f3 100644 --- a/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro +++ b/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro @@ -9,7 +9,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativexmllistmodel.cpp symbian: { - importFiles.sources = data + importFiles.files = data importFiles.path = . DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qmlvisual/qmlvisual.pro b/tests/auto/declarative/qmlvisual/qmlvisual.pro index cb7e5d7..a424b8f 100644 --- a/tests/auto/declarative/qmlvisual/qmlvisual.pro +++ b/tests/auto/declarative/qmlvisual/qmlvisual.pro @@ -6,7 +6,7 @@ SOURCES += tst_qmlvisual.cpp symbian: { importFiles.path = . - importFiles.sources = animation \ + importFiles.files = animation \ fillmode \ focusscope \ ListView \ diff --git a/tests/auto/mediaobject/mediaobject.pro b/tests/auto/mediaobject/mediaobject.pro index e887df4..ea78e63 100755 --- a/tests/auto/mediaobject/mediaobject.pro +++ b/tests/auto/mediaobject/mediaobject.pro @@ -15,7 +15,7 @@ wince*{ } symbian:{ - addFiles.sources = media/test.sdp + addFiles.files = media/test.sdp addFiles.path = media DEPLOYMENT += addFiles } diff --git a/tests/auto/networkselftest/networkselftest.pro b/tests/auto/networkselftest/networkselftest.pro index d7cb7f3..b7c70a1 100644 --- a/tests/auto/networkselftest/networkselftest.pro +++ b/tests/auto/networkselftest/networkselftest.pro @@ -4,12 +4,12 @@ SOURCES += tst_networkselftest.cpp QT = core network wince*: { - addFiles.sources = rfc3252.txt + addFiles.files = rfc3252.txt addFiles.path = . DEPLOYMENT = addFiles DEFINES += SRCDIR=\\\"\\\" } else:symbian { - addFiles.sources = rfc3252.txt + addFiles.files = rfc3252.txt addFiles.path = . DEPLOYMENT = addFiles } else:vxworks*: { diff --git a/tests/auto/patternistexamples/patternistexamples.pro b/tests/auto/patternistexamples/patternistexamples.pro index f83e0aa..098b0fe 100644 --- a/tests/auto/patternistexamples/patternistexamples.pro +++ b/tests/auto/patternistexamples/patternistexamples.pro @@ -2,17 +2,17 @@ load(qttest_p4) SOURCES += tst_patternistexamples.cpp CONFIG += qtestlib wince*|symbian: { - snippets.sources = $$QT_SOURCE_TREE/doc/src/snippets/patternist/* + snippets.files = $$QT_SOURCE_TREE/doc/src/snippets/patternist/* snippets.path = patternist - widgetRen.sources = $$QT_SOURCE_TREE/examples/xmlpatterns/xquery/widgetRenderer/* + widgetRen.files = $$QT_SOURCE_TREE/examples/xmlpatterns/xquery/widgetRenderer/* widgetRen.path = widgetRenderer - globVar.sources = $$QT_SOURCE_TREE/examples/xmlpatterns/xquery/globalVariables/* + globVar.files = $$QT_SOURCE_TREE/examples/xmlpatterns/xquery/globalVariables/* globVar.path = globalVariables - filetree.sources = $$QT_SOURCE_TREE/examples/xmlpatterns/filetree/* + filetree.files = $$QT_SOURCE_TREE/examples/xmlpatterns/filetree/* filetree.path = filetree - recipes.sources = $$QT_SOURCE_TREE/examples/xmlpatterns/recipes/* + recipes.files = $$QT_SOURCE_TREE/examples/xmlpatterns/recipes/* recipes.path = recipes - files.sources = $$QT_SOURCE_TREE/examples/xmlpatterns/recipes/files/* + files.files = $$QT_SOURCE_TREE/examples/xmlpatterns/recipes/files/* files.path = recipes\\files DEPLOYMENT += snippets widgetRen globVar filetree recipes files diff --git a/tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro b/tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro index 2e2577d..6f5044f 100644 --- a/tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro +++ b/tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro @@ -4,7 +4,7 @@ QT -= gui SOURCES += tst_qabstractnetworkcache.cpp wince*|symbian: { - testFiles.sources = tests + testFiles.files = tests testFiles.path = . DEPLOYMENT += testFiles } diff --git a/tests/auto/qabstractxmlnodemodel/qabstractxmlnodemodel.pro b/tests/auto/qabstractxmlnodemodel/qabstractxmlnodemodel.pro index a18f4ca..b8f509d 100644 --- a/tests/auto/qabstractxmlnodemodel/qabstractxmlnodemodel.pro +++ b/tests/auto/qabstractxmlnodemodel/qabstractxmlnodemodel.pro @@ -7,7 +7,7 @@ HEADERS += TestNodeModel.h LoadingModel.h include (../xmlpatterns.pri) wince*: { - addFiles.sources = tree.xml + addFiles.files = tree.xml addFiles.path = . DEPLOYMENT += addFiles diff --git a/tests/auto/qaccessibility/qaccessibility.pro b/tests/auto/qaccessibility/qaccessibility.pro index 1b30beb..a4f606c 100644 --- a/tests/auto/qaccessibility/qaccessibility.pro +++ b/tests/auto/qaccessibility/qaccessibility.pro @@ -5,7 +5,7 @@ unix:!mac:LIBS+=-lm contains(QT_CONFIG, qt3support): QT += qt3support wince*: { - accessneeded.sources = $$QT_BUILD_TREE\\plugins\\accessible\\*.dll + accessneeded.files = $$QT_BUILD_TREE\\plugins\\accessible\\*.dll accessneeded.path = accessible DEPLOYMENT += accessneeded } \ No newline at end of file diff --git a/tests/auto/qapplication/test/test.pro b/tests/auto/qapplication/test/test.pro index 2c54c37..4c8e9b0 100644 --- a/tests/auto/qapplication/test/test.pro +++ b/tests/auto/qapplication/test/test.pro @@ -4,19 +4,19 @@ SOURCES += ../tst_qapplication.cpp TARGET = ../tst_qapplication wince* { - additional.sources = ../desktopsettingsaware/desktopsettingsaware.exe + additional.files = ../desktopsettingsaware/desktopsettingsaware.exe additional.path = desktopsettingsaware - someTest.sources = test.pro + someTest.files = test.pro someTest.path = test DEPLOYMENT = additional deploy someTest } symbian: { - additional.sources = $$OUT_PWD/../desktopsettingsaware/desktopsettingsaware.exe + additional.files = $$OUT_PWD/../desktopsettingsaware/desktopsettingsaware.exe additional.path = desktopsettingsaware - someTest.sources = test.pro + someTest.files = test.pro someTest.path = test - windowIcon.sources = ../heart.svg + windowIcon.files = ../heart.svg DEPLOYMENT = additional deploy someTest windowIcon LIBS += -lcone -lavkon } diff --git a/tests/auto/qaudioinput/qaudioinput.pro b/tests/auto/qaudioinput/qaudioinput.pro index 5eb1613..922c3e4 100644 --- a/tests/auto/qaudioinput/qaudioinput.pro +++ b/tests/auto/qaudioinput/qaudioinput.pro @@ -5,7 +5,7 @@ SOURCES += tst_qaudioinput.cpp QT = core multimedia wince* { - deploy.sources += 4.wav + deploy.files += 4.wav DEPLOYMENT = deploy DEFINES += SRCDIR=\\\"\\\" QT += gui diff --git a/tests/auto/qaudiooutput/qaudiooutput.pro b/tests/auto/qaudiooutput/qaudiooutput.pro index e1734e0..0bd0151 100644 --- a/tests/auto/qaudiooutput/qaudiooutput.pro +++ b/tests/auto/qaudiooutput/qaudiooutput.pro @@ -5,7 +5,7 @@ SOURCES += tst_qaudiooutput.cpp QT = core multimedia wince*|symbian: { - deploy.sources += 4.wav + deploy.files += 4.wav DEPLOYMENT = deploy !symbian { DEFINES += SRCDIR=\\\"\\\" diff --git a/tests/auto/qbytearray/qbytearray.pro b/tests/auto/qbytearray/qbytearray.pro index a0c143e..35e48ad 100644 --- a/tests/auto/qbytearray/qbytearray.pro +++ b/tests/auto/qbytearray/qbytearray.pro @@ -5,7 +5,7 @@ SOURCES += tst_qbytearray.cpp QT = core wince*|symbian { - addFile.sources = rfc3252.txt + addFile.files = rfc3252.txt addFile.path = . DEPLOYMENT += addFile } diff --git a/tests/auto/qchar/qchar.pro b/tests/auto/qchar/qchar.pro index 3813e4e..9cfccc2 100644 --- a/tests/auto/qchar/qchar.pro +++ b/tests/auto/qchar/qchar.pro @@ -4,7 +4,7 @@ SOURCES += tst_qchar.cpp QT = core wince*|symbian: { -deploy.sources += NormalizationTest.txt +deploy.files += NormalizationTest.txt DEPLOYMENT = deploy } diff --git a/tests/auto/qclipboard/test/test.pro b/tests/auto/qclipboard/test/test.pro index 0f8cad1..7d5c2f3 100644 --- a/tests/auto/qclipboard/test/test.pro +++ b/tests/auto/qclipboard/test/test.pro @@ -11,18 +11,18 @@ win32 { } wince*|symbian: { - copier.sources = ../copier/copier.exe + copier.files = ../copier/copier.exe copier.path = copier - paster.sources = ../paster/paster.exe + paster.files = ../paster/paster.exe paster.path = paster symbian: { load(data_caging_paths) - rsc.sources = $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/copier.rsc - rsc.sources += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/paster.rsc + rsc.files = $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/copier.rsc + rsc.files += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/paster.rsc rsc.path = $$APP_RESOURCE_DIR - reg_resource.sources = $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/copier_reg.rsc - reg_resource.sources += $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/paster_reg.rsc + reg_resource.files = $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/copier_reg.rsc + reg_resource.files += $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/paster_reg.rsc reg_resource.path = $$REG_RESOURCE_IMPORT_DIR } diff --git a/tests/auto/qcssparser/qcssparser.pro b/tests/auto/qcssparser/qcssparser.pro index 674064f..f696f19 100644 --- a/tests/auto/qcssparser/qcssparser.pro +++ b/tests/auto/qcssparser/qcssparser.pro @@ -8,9 +8,9 @@ requires(contains(QT_CONFIG,private_tests)) } wince*|symbian: { - addFiles.sources = testdata + addFiles.files = testdata addFiles.path = . - timesFont.sources = C:/Windows/Fonts/times.ttf + timesFont.files = C:/Windows/Fonts/times.ttf timesFont.path = . DEPLOYMENT += addFiles timesFont } diff --git a/tests/auto/qdatastream/qdatastream.pro b/tests/auto/qdatastream/qdatastream.pro index c132073..eba7c00 100644 --- a/tests/auto/qdatastream/qdatastream.pro +++ b/tests/auto/qdatastream/qdatastream.pro @@ -12,13 +12,13 @@ QT += svg wince*: { - addFiles.sources = datastream.q42 tests2.svg + addFiles.files = datastream.q42 tests2.svg addFiles.path = . DEPLOYMENT += addFiles DEFINES += SRCDIR=\\\"\\\" } else:symbian { # SRCDIR and SVGFILE defined in code in symbian - addFiles.sources = datastream.q42 tests2.svg + addFiles.files = datastream.q42 tests2.svg addFiles.path = . DEPLOYMENT += addFiles TARGET.EPOCHEAPSIZE = 1000000 10000000 diff --git a/tests/auto/qdesktopservices/qdesktopservices.pro b/tests/auto/qdesktopservices/qdesktopservices.pro index d32ed4c..43f6cba 100644 --- a/tests/auto/qdesktopservices/qdesktopservices.pro +++ b/tests/auto/qdesktopservices/qdesktopservices.pro @@ -3,22 +3,22 @@ CONFIG += qttest_p4 SOURCES += tst_qdesktopservices.cpp TARGET = tst_qdesktopservices symbian: { - dummy.sources = text\\testfile.txt + dummy.files = text\\testfile.txt dummy.path = . - text.sources = text\\* + text.files = text\\* text.path = \\data\\others - image.sources = image\\* + image.files = image\\* image.path = \\data\\images - audio.sources = audio\\* + audio.files = audio\\* audio.path = \\data\\sounds - video.sources = video\\* + video.files = video\\* video.path = \\data\\videos - install.sources = install\\* + install.files = install\\* install.path = \\data\\installs DEPLOYMENT += image audio video install diff --git a/tests/auto/qdir/qdir.pro b/tests/auto/qdir/qdir.pro index cf612f1..818f52c 100644 --- a/tests/auto/qdir/qdir.pro +++ b/tests/auto/qdir/qdir.pro @@ -4,7 +4,7 @@ RESOURCES += qdir.qrc QT = core wince*|symbian { - DirFiles.sources = testdir testdata searchdir resources entrylist types tst_qdir.cpp + DirFiles.files = testdir testdata searchdir resources entrylist types tst_qdir.cpp DirFiles.path = . DEPLOYMENT += DirFiles } diff --git a/tests/auto/qdiriterator/qdiriterator.pro b/tests/auto/qdiriterator/qdiriterator.pro index d60b52d..020b229 100644 --- a/tests/auto/qdiriterator/qdiriterator.pro +++ b/tests/auto/qdiriterator/qdiriterator.pro @@ -4,7 +4,7 @@ RESOURCES += qdiriterator.qrc QT = core wince*|symbian: { - addFiles.sources = entrylist recursiveDirs foo + addFiles.files = entrylist recursiveDirs foo addFiles.path = . DEPLOYMENT += addFiles wince*mips*|wincewm50smart-msvc200*: DEFINES += WINCE_BROKEN_ITERATE=1 diff --git a/tests/auto/qdirmodel/qdirmodel.pro b/tests/auto/qdirmodel/qdirmodel.pro index 36929b9..7037a79 100644 --- a/tests/auto/qdirmodel/qdirmodel.pro +++ b/tests/auto/qdirmodel/qdirmodel.pro @@ -2,11 +2,11 @@ load(qttest_p4) SOURCES += tst_qdirmodel.cpp wince*|symbian { - addit.sources = dirtest\\test1\\* + addit.files = dirtest\\test1\\* addit.path = dirtest\\test1 - tests.sources = test\\* + tests.files = test\\* tests.path = test - sourceFile.sources = tst_qdirmodel.cpp + sourceFile.files = tst_qdirmodel.cpp sourceFile.path = . DEPLOYMENT += addit tests sourceFile } diff --git a/tests/auto/qdom/qdom.pro b/tests/auto/qdom/qdom.pro index 9040b91..0a3c167 100644 --- a/tests/auto/qdom/qdom.pro +++ b/tests/auto/qdom/qdom.pro @@ -5,7 +5,7 @@ QT = core xml QT -= gui wince*|symbian: { - addFiles.sources = testdata doubleNamespaces.xml umlaut.xml + addFiles.files = testdata doubleNamespaces.xml umlaut.xml addFiles.path = . DEPLOYMENT += addFiles diff --git a/tests/auto/qfile/test/test.pro b/tests/auto/qfile/test/test.pro index 70c93ce..c657e9a 100644 --- a/tests/auto/qfile/test/test.pro +++ b/tests/auto/qfile/test/test.pro @@ -3,11 +3,11 @@ SOURCES += ../tst_qfile.cpp wince*|symbian { QT = core gui - files.sources += ..\\dosfile.txt ..\\noendofline.txt ..\\testfile.txt \ + files.files += ..\\dosfile.txt ..\\noendofline.txt ..\\testfile.txt \ ..\\testlog.txt ..\\two.dots.file ..\\tst_qfile.cpp \ ..\\Makefile ..\\forCopying.txt ..\\forRenaming.txt files.path = . - resour.sources += ..\\resources\\file1.ext1 + resour.files += ..\\resources\\file1.ext1 resour.path = resources DEPLOYMENT = files resour diff --git a/tests/auto/qfiledialog/qfiledialog.pro b/tests/auto/qfiledialog/qfiledialog.pro index 2b87cf1..68f2e3c 100644 --- a/tests/auto/qfiledialog/qfiledialog.pro +++ b/tests/auto/qfiledialog/qfiledialog.pro @@ -7,9 +7,9 @@ load(qttest_p4) SOURCES += tst_qfiledialog.cpp wince*|symbian { - addFiles.sources = *.cpp + addFiles.files = *.cpp addFiles.path = . - filesInDir.sources = *.pro + filesInDir.files = *.pro filesInDir.path = someDir DEPLOYMENT += addFiles filesInDir } diff --git a/tests/auto/qfiledialog2/qfiledialog2.pro b/tests/auto/qfiledialog2/qfiledialog2.pro index 4ebf977..b8924c1 100644 --- a/tests/auto/qfiledialog2/qfiledialog2.pro +++ b/tests/auto/qfiledialog2/qfiledialog2.pro @@ -7,9 +7,9 @@ load(qttest_p4) SOURCES += tst_qfiledialog2.cpp wince*|symbian { - addFiles.sources = *.cpp + addFiles.files = *.cpp addFiles.path = . - filesInDir.sources = *.pro + filesInDir.files = *.pro filesInDir.path = someDir DEPLOYMENT += addFiles filesInDir } diff --git a/tests/auto/qfileinfo/qfileinfo.pro b/tests/auto/qfileinfo/qfileinfo.pro index 30656e2..3141db6 100644 --- a/tests/auto/qfileinfo/qfileinfo.pro +++ b/tests/auto/qfileinfo/qfileinfo.pro @@ -7,8 +7,8 @@ QT = core RESOURCES += qfileinfo.qrc wince*:|symbian: { - deploy.sources += qfileinfo.qrc tst_qfileinfo.cpp - res.sources = resources\\file1 resources\\file1.ext1 resources\\file1.ext1.ext2 + deploy.files += qfileinfo.qrc tst_qfileinfo.cpp + res.files = resources\\file1 resources\\file1.ext1 resources\\file1.ext1.ext2 res.path = resources DEPLOYMENT = deploy res } diff --git a/tests/auto/qfilesystemmodel/qfilesystemmodel.pro b/tests/auto/qfilesystemmodel/qfilesystemmodel.pro index 070eb6a..04cea48 100644 --- a/tests/auto/qfilesystemmodel/qfilesystemmodel.pro +++ b/tests/auto/qfilesystemmodel/qfilesystemmodel.pro @@ -9,7 +9,7 @@ symbian: { HEADERS += ../../../include/qtgui/private/qfileinfogatherer_p.h # need to deploy something to create the private directory - dummyDeploy.sources = tst_qfilesystemmodel.cpp + dummyDeploy.files = tst_qfilesystemmodel.cpp dummyDeploy.path = . DEPLOYMENT += dummyDeploy LIBS += -lefsrv diff --git a/tests/auto/qfontdatabase/qfontdatabase.pro b/tests/auto/qfontdatabase/qfontdatabase.pro index 35811f1..e7dfc3c 100644 --- a/tests/auto/qfontdatabase/qfontdatabase.pro +++ b/tests/auto/qfontdatabase/qfontdatabase.pro @@ -3,7 +3,7 @@ SOURCES += tst_qfontdatabase.cpp !symbian:DEFINES += SRCDIR=\\\"$$PWD\\\" wince*|symbian { - additionalFiles.sources = FreeMono.ttf + additionalFiles.files = FreeMono.ttf additionalFiles.path = . DEPLOYMENT += additionalFiles } diff --git a/tests/auto/qftp/qftp.pro b/tests/auto/qftp/qftp.pro index 9618962..ac1702e 100644 --- a/tests/auto/qftp/qftp.pro +++ b/tests/auto/qftp/qftp.pro @@ -5,12 +5,12 @@ SOURCES += tst_qftp.cpp QT = core network wince*: { - addFiles.sources = rfc3252.txt + addFiles.files = rfc3252.txt addFiles.path = . DEPLOYMENT += addFiles DEFINES += SRCDIR=\\\"\\\" } else:symbian { - addFiles.sources = rfc3252.txt + addFiles.files = rfc3252.txt addFiles.path = . DEPLOYMENT += addFiles TARGET.EPOCHEAPSIZE="0x100 0x1000000" diff --git a/tests/auto/qgraphicsscene/qgraphicsscene.pro b/tests/auto/qgraphicsscene/qgraphicsscene.pro index cc6f585..82fa423 100644 --- a/tests/auto/qgraphicsscene/qgraphicsscene.pro +++ b/tests/auto/qgraphicsscene/qgraphicsscene.pro @@ -7,9 +7,9 @@ win32:!wince*: LIBS += -lUser32 DEFINES += QT_NO_CAST_TO_ASCII wince*|symbian: { - rootFiles.sources = Ash_European.jpg graphicsScene_selection.data + rootFiles.files = Ash_European.jpg graphicsScene_selection.data rootFiles.path = . - renderFiles.sources = testData\\render\\* + renderFiles.files = testData\\render\\* renderFiles.path = testData\\render DEPLOYMENT += rootFiles renderFiles } diff --git a/tests/auto/qhelpcontentmodel/qhelpcontentmodel.pro b/tests/auto/qhelpcontentmodel/qhelpcontentmodel.pro index 889aac9..a9a8ed9 100644 --- a/tests/auto/qhelpcontentmodel/qhelpcontentmodel.pro +++ b/tests/auto/qhelpcontentmodel/qhelpcontentmodel.pro @@ -9,9 +9,9 @@ DEFINES += QT_USE_USING_NAMESPACE wince*: { DEFINES += SRCDIR=\\\"./\\\" QT += network - addFiles.sources = $$PWD/data/*.* + addFiles.files = $$PWD/data/*.* addFiles.path = data - clucene.sources = $$QT_BUILD_TREE/lib/QtCLucene*.dll + clucene.files = $$QT_BUILD_TREE/lib/QtCLucene*.dll DEPLOYMENT += addFiles DEPLOYMENT += clucene diff --git a/tests/auto/qhelpenginecore/qhelpenginecore.pro b/tests/auto/qhelpenginecore/qhelpenginecore.pro index 27ebd0f..4166fe2 100644 --- a/tests/auto/qhelpenginecore/qhelpenginecore.pro +++ b/tests/auto/qhelpenginecore/qhelpenginecore.pro @@ -10,9 +10,9 @@ DEFINES += QT_USE_USING_NAMESPACE wince*: { DEFINES += SRCDIR=\\\"./\\\" QT += network - addFiles.sources = $$PWD/data/*.* + addFiles.files = $$PWD/data/*.* addFiles.path = data - clucene.sources = $$QT_BUILD_TREE/lib/QtCLucene*.dll + clucene.files = $$QT_BUILD_TREE/lib/QtCLucene*.dll DEPLOYMENT += addFiles DEPLOYMENT += clucene diff --git a/tests/auto/qhttp/qhttp.pro b/tests/auto/qhttp/qhttp.pro index c0be518..5b102ce 100644 --- a/tests/auto/qhttp/qhttp.pro +++ b/tests/auto/qhttp/qhttp.pro @@ -5,20 +5,20 @@ SOURCES += tst_qhttp.cpp QT = core network wince*: { - webFiles.sources = webserver/* + webFiles.files = webserver/* webFiles.path = webserver - cgi.sources = webserver/cgi-bin/* + cgi.files = webserver/cgi-bin/* cgi.path = webserver/cgi-bin - addFiles.sources = rfc3252.txt trolltech + addFiles.files = rfc3252.txt trolltech addFiles.path = . DEPLOYMENT = addFiles webFiles cgi DEFINES += SRCDIR=\\\"\\\" } else:symbian { - webFiles.sources = webserver/* + webFiles.files = webserver/* webFiles.path = webserver - cgi.sources = webserver/cgi-bin/* + cgi.files = webserver/cgi-bin/* cgi.path = webserver/cgi-bin - addFiles.sources = rfc3252.txt trolltech + addFiles.files = rfc3252.txt trolltech addFiles.path = . DEPLOYMENT = addFiles webFiles cgi TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qicoimageformat/qicoimageformat.pro b/tests/auto/qicoimageformat/qicoimageformat.pro index cabab3f..c150c9a 100644 --- a/tests/auto/qicoimageformat/qicoimageformat.pro +++ b/tests/auto/qicoimageformat/qicoimageformat.pro @@ -3,21 +3,21 @@ SOURCES+= tst_qicoimageformat.cpp wince*: { DEFINES += SRCDIR=\\\".\\\" - addFiles.sources = icons + addFiles.files = icons addFiles.path = . CONFIG(debug, debug|release):{ - addPlugins.sources = $$QT_BUILD_TREE/plugins/imageformats/qico4d.dll + addPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/qico4d.dll } else { - addPlugins.sources = $$QT_BUILD_TREE/plugins/imageformats/qico4.dll + addPlugins.files = $$QT_BUILD_TREE/plugins/imageformats/qico4.dll } addPlugins.path = imageformats DEPLOYMENT += addFiles addPlugins } else:symbian { - addFiles.sources = icons + addFiles.files = icons addFiles.path = . DEPLOYMENT += addFiles qt_not_deployed { - addPlugins.sources = qico.dll + addPlugins.files = qico.dll addPlugins.path = imageformats DEPLOYMENT += addPlugins } diff --git a/tests/auto/qicon/qicon.pro b/tests/auto/qicon/qicon.pro index 68b888d..975aaf2 100644 --- a/tests/auto/qicon/qicon.pro +++ b/tests/auto/qicon/qicon.pro @@ -5,10 +5,10 @@ RESOURCES = tst_qicon.qrc wince* { QT += xml svg - addFiles.sources += $$_PRO_FILE_PWD_/*.png - addFiles.sources += $$_PRO_FILE_PWD_/*.svg - addFiles.sources += $$_PRO_FILE_PWD_/*.svgz - addFiles.sources += $$_PRO_FILE_PWD_/tst_qicon.cpp + addFiles.files += $$_PRO_FILE_PWD_/*.png + addFiles.files += $$_PRO_FILE_PWD_/*.svg + addFiles.files += $$_PRO_FILE_PWD_/*.svgz + addFiles.files += $$_PRO_FILE_PWD_/tst_qicon.cpp addFiles.path = . DEPLOYMENT += addFiles @@ -16,11 +16,11 @@ wince* { DEFINES += SRCDIR=\\\".\\\" } else:symbian { QT += xml svg - addFiles.sources = *.png tst_qicon.cpp *.svg *.svgz + addFiles.files = *.png tst_qicon.cpp *.svg *.svgz addFiles.path = . DEPLOYMENT += addFiles qt_not_deployed { - plugins.sources = qsvgicon.dll + plugins.files = qsvgicon.dll plugins.path = iconengines DEPLOYMENT += plugins } diff --git a/tests/auto/qimage/qimage.pro b/tests/auto/qimage/qimage.pro index 6469211..798c82e 100644 --- a/tests/auto/qimage/qimage.pro +++ b/tests/auto/qimage/qimage.pro @@ -2,17 +2,17 @@ load(qttest_p4) SOURCES += tst_qimage.cpp wince*: { - addImages.sources = images/* + addImages.files = images/* addImages.path = images DEPLOYMENT += addImages DEFINES += SRCDIR=\\\".\\\" } else:symbian { TARGET.EPOCHEAPSIZE = 0x200000 0x800000 - addImages.sources = images/* + addImages.files = images/* addImages.path = images DEPLOYMENT += addImages qt_not_deployed { - imagePlugins.sources = qjpeg.dll qgif.dll qmng.dll qtiff.dll qico.dll + imagePlugins.files = qjpeg.dll qgif.dll qmng.dll qtiff.dll qico.dll imagePlugins.path = imageformats DEPLOYMENT += imagePlugins } diff --git a/tests/auto/qimagereader/qimagereader.pro b/tests/auto/qimagereader/qimagereader.pro index f8fc7fa..827819d 100644 --- a/tests/auto/qimagereader/qimagereader.pro +++ b/tests/auto/qimagereader/qimagereader.pro @@ -17,10 +17,10 @@ win32-msvc.net:QMAKE_CXXFLAGS -= -Zm300 win32-msvc.net:QMAKE_CXXFLAGS += -Zm1100 wince*: { - images.sources = images + images.files = images images.path = . - imagePlugins.sources = $$QT_BUILD_TREE/plugins/imageformats/*.dll + imagePlugins.files = $$QT_BUILD_TREE/plugins/imageformats/*.dll imagePlugins.path = imageformats DEPLOYMENT += images imagePlugins @@ -28,13 +28,13 @@ wince*: { } symbian: { - images.sources = images + images.files = images images.path = . DEPLOYMENT += images qt_not_deployed { - imagePlugins.sources = qjpeg.dll qgif.dll qmng.dll + imagePlugins.files = qjpeg.dll qgif.dll qmng.dll imagePlugins.path = imageformats DEPLOYMENT += imagePlugins diff --git a/tests/auto/qimagewriter/qimagewriter.pro b/tests/auto/qimagewriter/qimagewriter.pro index f25472f..bab2419 100644 --- a/tests/auto/qimagewriter/qimagewriter.pro +++ b/tests/auto/qimagewriter/qimagewriter.pro @@ -6,16 +6,16 @@ win32-msvc:QMAKE_CXXFLAGS -= -Zm200 win32-msvc:QMAKE_CXXFLAGS += -Zm800 wince*: { - addFiles.sources = images\\*.* + addFiles.files = images\\*.* addFiles.path = images DEPLOYMENT += addFiles DEFINES += SRCDIR=\\\".\\\" } else:symbian { - addFiles.sources = images\\*.* + addFiles.files = images\\*.* addFiles.path = images DEPLOYMENT += addFiles qt_not_deployed { - imagePlugins.sources = qjpeg.dll qtiff.dll + imagePlugins.files = qjpeg.dll qtiff.dll imagePlugins.path = imageformats DEPLOYMENT += imagePlugins } diff --git a/tests/auto/qiodevice/qiodevice.pro b/tests/auto/qiodevice/qiodevice.pro index 716cdce..29b0a05 100644 --- a/tests/auto/qiodevice/qiodevice.pro +++ b/tests/auto/qiodevice/qiodevice.pro @@ -4,14 +4,14 @@ SOURCES += tst_qiodevice.cpp QT = core network wince*: { - addFiles.sources = tst_qiodevice.cpp + addFiles.files = tst_qiodevice.cpp addFiles.path = . DEPLOYMENT += addFiles DEFINES += SRCDIR=\\\"\\\" !wince50standard-x86-msvc2005: DEFINES += WINCE_EMULATOR_TEST=1 } else:symbian { # SRCDIR defined in code in symbian - addFiles.sources = tst_qiodevice.cpp + addFiles.files = tst_qiodevice.cpp addFiles.path = . DEPLOYMENT += addFiles TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qitemmodel/qitemmodel.pro b/tests/auto/qitemmodel/qitemmodel.pro index 92709fe..b348a18 100644 --- a/tests/auto/qitemmodel/qitemmodel.pro +++ b/tests/auto/qitemmodel/qitemmodel.pro @@ -9,7 +9,7 @@ QT += sql # memory on Windows Mobile 5. #wince*: { -# plugFiles.sources = $$QT_BUILD_TREE/plugins/sqldrivers/*.dll +# plugFiles.files = $$QT_BUILD_TREE/plugins/sqldrivers/*.dll # plugFiles.path = sqldrivers # DEPLOYMENT += plugFiles #} @@ -19,7 +19,7 @@ symbian { qt_not_deployed { contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll + sqlite.files = sqlite3.dll DEPLOYMENT += sqlite } } diff --git a/tests/auto/qlabel/qlabel.pro b/tests/auto/qlabel/qlabel.pro index 297f868..057a6f1 100644 --- a/tests/auto/qlabel/qlabel.pro +++ b/tests/auto/qlabel/qlabel.pro @@ -3,7 +3,7 @@ SOURCES += tst_qlabel.cpp wince*::DEFINES += SRCDIR=\\\"\\\" else:!symbian:DEFINES += SRCDIR=\\\"$$PWD/\\\" wince*|symbian { - addFiles.sources = *.png \ + addFiles.files = *.png \ testdata addFiles.path = . DEPLOYMENT += addFiles diff --git a/tests/auto/qlayout/qlayout.pro b/tests/auto/qlayout/qlayout.pro index c99f1d9..dfa8584 100644 --- a/tests/auto/qlayout/qlayout.pro +++ b/tests/auto/qlayout/qlayout.pro @@ -7,7 +7,7 @@ load(qttest_p4) SOURCES += tst_qlayout.cpp contains(QT_CONFIG, qt3support): QT += qt3support wince*|symbian: { - addFiles.sources = baseline + addFiles.files = baseline addFiles.path = . DEPLOYMENT += addFiles } diff --git a/tests/auto/qlibrary/tst/tst.pro b/tests/auto/qlibrary/tst/tst.pro index 4c647c0..28c40b0 100644 --- a/tests/auto/qlibrary/tst/tst.pro +++ b/tests/auto/qlibrary/tst/tst.pro @@ -12,18 +12,18 @@ win32 { } wince*: { - addFiles.sources = ../*.dll ../*.dl2 ../mylib_noextension + addFiles.files = ../*.dll ../*.dl2 ../mylib_noextension addFiles.path = . DEPLOYMENT += addFiles DEFINES += SRCDIR=\\\"\\\" }else:symbian { - binDep.sources = \ + binDep.files = \ mylib.dll \ system.trolltech.test.mylib.dll binDep.path = /sys/bin #mylib.dl2 nonstandard binary deployment will cause warning in emulator, #but it can be safely ignored. - custBinDep.sources = mylib.dl2 + custBinDep.files = mylib.dl2 custBinDep.path = /sys/bin DEPLOYMENT += binDep custBinDep diff --git a/tests/auto/qlocale/test/test.pro b/tests/auto/qlocale/test/test.pro index 6512e19..8117708 100644 --- a/tests/auto/qlocale/test/test.pro +++ b/tests/auto/qlocale/test/test.pro @@ -22,7 +22,7 @@ QT += network embedded: QT += gui wince*: { - addFiles.sources = \ + addFiles.files = \ ../syslocaleapp addFiles.path = "\\Program Files\\tst_qlocale" diff --git a/tests/auto/qlocalsocket/test/test.pro b/tests/auto/qlocalsocket/test/test.pro index 687aae2..f91fe58 100644 --- a/tests/auto/qlocalsocket/test/test.pro +++ b/tests/auto/qlocalsocket/test/test.pro @@ -28,19 +28,19 @@ CONFIG(debug_and_release) { } wince* { - additionalFiles.sources = ../lackey/lackey.exe + additionalFiles.files = ../lackey/lackey.exe additionalFiles.path = lackey } symbian { - additionalFiles.sources = lackey.exe + additionalFiles.files = lackey.exe additionalFiles.path = \\sys\\bin TARGET.UID3 = 0xE0340005 DEFINES += SYMBIAN_SRCDIR_UID=$$lower($$replace(TARGET.UID3,"0x","")) } wince*|symbian { - scriptFiles.sources = ../lackey/scripts/*.js + scriptFiles.files = ../lackey/scripts/*.js scriptFiles.path = lackey/scripts DEPLOYMENT = additionalFiles scriptFiles QT += script # for easy deployment of QtScript diff --git a/tests/auto/qmovie/qmovie.pro b/tests/auto/qmovie/qmovie.pro index 510a70e..6973955 100644 --- a/tests/auto/qmovie/qmovie.pro +++ b/tests/auto/qmovie/qmovie.pro @@ -7,19 +7,19 @@ MOC_DIR=tmp !contains(QT_CONFIG, no-mng):DEFINES += QTEST_HAVE_MNG wince*: { - addFiles.sources = animations\\* + addFiles.files = animations\\* addFiles.path = animations DEPLOYMENT += addFiles } symbian: { - addFiles.sources = animations\\* + addFiles.files = animations\\* addFiles.path = animations DEPLOYMENT += addFiles qt_not_deployed { - imagePlugins.sources = qjpeg.dll qgif.dll qmng.dll + imagePlugins.files = qjpeg.dll qgif.dll qmng.dll imagePlugins.path = imageformats DEPLOYMENT += imagePlugins } diff --git a/tests/auto/qnetworkreply/test/test.pro b/tests/auto/qnetworkreply/test/test.pro index 6e1b1e3..7efc2fb 100644 --- a/tests/auto/qnetworkreply/test/test.pro +++ b/tests/auto/qnetworkreply/test/test.pro @@ -16,17 +16,17 @@ QT = core network RESOURCES += ../qnetworkreply.qrc wince*: { - addFiles.sources = ../empty ../rfc3252.txt ../resource + addFiles.files = ../empty ../rfc3252.txt ../resource addFiles.path = . DEPLOYMENT += addFiles } symbian:{ - addFiles.sources = ../empty ../rfc3252.txt ../resource ../bigfile + addFiles.files = ../empty ../rfc3252.txt ../resource ../bigfile addFiles.path = . DEPLOYMENT += addFiles - certFiles.sources = ../certs + certFiles.files = ../certs certFiles.path = . DEPLOYMENT += certFiles diff --git a/tests/auto/qobject/tst_qobject.pro b/tests/auto/qobject/tst_qobject.pro index 1d6993a..5745e67 100644 --- a/tests/auto/qobject/tst_qobject.pro +++ b/tests/auto/qobject/tst_qobject.pro @@ -10,12 +10,12 @@ QT = core \ gui contains(QT_CONFIG, qt3support):DEFINES += QT_HAS_QT3SUPPORT wince*: { - addFiles.sources = signalbug.exe + addFiles.files = signalbug.exe addFiles.path = . DEPLOYMENT += addFiles } symbian: { - addFiles.sources = signalbug.exe + addFiles.files = signalbug.exe addFiles.path = \\sys\\bin DEPLOYMENT += addFiles } diff --git a/tests/auto/qpainter/qpainter.pro b/tests/auto/qpainter/qpainter.pro index 69dc98d..ee624e1 100644 --- a/tests/auto/qpainter/qpainter.pro +++ b/tests/auto/qpainter/qpainter.pro @@ -2,7 +2,7 @@ load(qttest_p4) contains(QT_CONFIG, qt3support): QT += qt3support SOURCES += tst_qpainter.cpp wince*|symbian: { - addFiles.sources = drawEllipse drawLine_rop_bitmap drawPixmap_rop drawPixmap_rop_bitmap task217400.png + addFiles.files = drawEllipse drawLine_rop_bitmap drawPixmap_rop drawPixmap_rop_bitmap task217400.png addFiles.path = . DEPLOYMENT += addFiles } diff --git a/tests/auto/qpixmap/qpixmap.pro b/tests/auto/qpixmap/qpixmap.pro index ff8258f..185ec1a 100644 --- a/tests/auto/qpixmap/qpixmap.pro +++ b/tests/auto/qpixmap/qpixmap.pro @@ -3,16 +3,16 @@ SOURCES += tst_qpixmap.cpp contains(QT_CONFIG, qt3support): QT += qt3support wince*|symbian: { - task31722_0.sources = convertFromImage/task31722_0/*.png + task31722_0.files = convertFromImage/task31722_0/*.png task31722_0.path = convertFromImage/task31722_0 - task31722_1.sources = convertFromImage/task31722_1/*.png + task31722_1.files = convertFromImage/task31722_1/*.png task31722_1.path = convertFromImage/task31722_1 - icons.sources = convertFromToHICON/* + icons.files = convertFromToHICON/* icons.path = convertFromToHICON - loadFromData.sources = loadFromData/* + loadFromData.files = loadFromData/* loadFromData.path = loadFromData DEPLOYMENT += task31722_0 task31722_1 icons loadFromData diff --git a/tests/auto/qpixmapfilter/qpixmapfilter.pro b/tests/auto/qpixmapfilter/qpixmapfilter.pro index e64d68d..964e56d 100644 --- a/tests/auto/qpixmapfilter/qpixmapfilter.pro +++ b/tests/auto/qpixmapfilter/qpixmapfilter.pro @@ -2,7 +2,7 @@ load(qttest_p4) SOURCES += tst_qpixmapfilter.cpp wince*: { - addFiles.sources = noise.png + addFiles.files = noise.png addFiles.path = . DEPLOYMENT += addFiles } diff --git a/tests/auto/qplugin/tst_qplugin.pro b/tests/auto/qplugin/tst_qplugin.pro index 0d9d809..3629fb3 100644 --- a/tests/auto/qplugin/tst_qplugin.pro +++ b/tests/auto/qplugin/tst_qplugin.pro @@ -4,13 +4,13 @@ SOURCES = tst_qplugin.cpp QT = core wince*: { - plugins.sources = plugins/* + plugins.files = plugins/* plugins.path = plugins DEPLOYMENT += plugins } symbian: { - rpDep.sources = releaseplugin.dll debugplugin.dll + rpDep.files = releaseplugin.dll debugplugin.dll rpDep.path = plugins DEPLOYMENT += rpDep dpDep } diff --git a/tests/auto/qpluginloader/tst/tst.pro b/tests/auto/qpluginloader/tst/tst.pro index e270120..be243b8 100644 --- a/tests/auto/qpluginloader/tst/tst.pro +++ b/tests/auto/qpluginloader/tst/tst.pro @@ -14,15 +14,15 @@ win32 { wince*: { - addFiles.sources = $$OUT_PWD/../bin/*.dll + addFiles.files = $$OUT_PWD/../bin/*.dll addFiles.path = bin DEPLOYMENT += addFiles } symbian: { - libDep.sources = tst_qpluginloaderlib.dll + libDep.files = tst_qpluginloaderlib.dll libDep.path = /sys/bin - pluginDep.sources = theplugin.dll + pluginDep.files = theplugin.dll pluginDep.path = bin DEPLOYMENT += libDep pluginDep diff --git a/tests/auto/qprocess/test/test.pro b/tests/auto/qprocess/test/test.pro index d555067..a91cadd 100644 --- a/tests/auto/qprocess/test/test.pro +++ b/tests/auto/qprocess/test/test.pro @@ -27,61 +27,61 @@ embedded: QT += gui wince*: { - addFile_fileWriterProcess.sources = $$OUT_PWD/../fileWriterProcess/fileWriterProcess.exe + addFile_fileWriterProcess.files = $$OUT_PWD/../fileWriterProcess/fileWriterProcess.exe addFile_fileWriterProcess.path = fileWriterProcess - addFile_testBatFiles.sources = $$PWD/../testBatFiles/* + addFile_testBatFiles.files = $$PWD/../testBatFiles/* addFile_testBatFiles.path = testBatFiles - addFile_testDetached.sources = $$OUT_PWD/../testDetached/testDetached.exe + addFile_testDetached.files = $$OUT_PWD/../testDetached/testDetached.exe addFile_testDetached.path = testDetached - addFile_testExitCodes.sources = $$OUT_PWD/../testExitCodes/testExitCodes.exe + addFile_testExitCodes.files = $$OUT_PWD/../testExitCodes/testExitCodes.exe addFile_testExitCodes.path = testExitCodes - addFile_testGuiProcess.sources = $$OUT_PWD/../testGuiProcess/testGuiProcess.exe + addFile_testGuiProcess.files = $$OUT_PWD/../testGuiProcess/testGuiProcess.exe addFile_testGuiProcess.path = testGuiProcess - addFile_testProcessCrash.sources = $$OUT_PWD/../testProcessCrash/testProcessCrash.exe + addFile_testProcessCrash.files = $$OUT_PWD/../testProcessCrash/testProcessCrash.exe addFile_testProcessCrash.path = testProcessCrash - addFile_testProcessDeadWhileReading.sources = $$OUT_PWD/../testProcessDeadWhileReading/testProcessDeadWhileReading.exe + addFile_testProcessDeadWhileReading.files = $$OUT_PWD/../testProcessDeadWhileReading/testProcessDeadWhileReading.exe addFile_testProcessDeadWhileReading.path = testProcessDeadWhileReading - addFile_testProcessEcho.sources = $$OUT_PWD/../testProcessEcho/testProcessEcho.exe + addFile_testProcessEcho.files = $$OUT_PWD/../testProcessEcho/testProcessEcho.exe addFile_testProcessEcho.path = testProcessEcho - addFile_testProcessEcho2.sources = $$OUT_PWD/../testProcessEcho2/testProcessEcho2.exe + addFile_testProcessEcho2.files = $$OUT_PWD/../testProcessEcho2/testProcessEcho2.exe addFile_testProcessEcho2.path = testProcessEcho2 - addFile_testProcessEcho3.sources = $$OUT_PWD/../testProcessEcho3/testProcessEcho3.exe + addFile_testProcessEcho3.files = $$OUT_PWD/../testProcessEcho3/testProcessEcho3.exe addFile_testProcessEcho3.path = testProcessEcho3 - addFile_testProcessEOF.sources = $$OUT_PWD/../testProcessEOF/testProcessEOF.exe + addFile_testProcessEOF.files = $$OUT_PWD/../testProcessEOF/testProcessEOF.exe addFile_testProcessEOF.path = testProcessEOF - addFile_testProcessLoopback.sources = $$OUT_PWD/../testProcessLoopback/testProcessLoopback.exe + addFile_testProcessLoopback.files = $$OUT_PWD/../testProcessLoopback/testProcessLoopback.exe addFile_testProcessLoopback.path = testProcessLoopback - addFile_testProcessNormal.sources = $$OUT_PWD/../testProcessNormal/testProcessNormal.exe + addFile_testProcessNormal.files = $$OUT_PWD/../testProcessNormal/testProcessNormal.exe addFile_testProcessNormal.path = testProcessNormal - addFile_testProcessOutput.sources = $$OUT_PWD/../testProcessOutput/testProcessOutput.exe + addFile_testProcessOutput.files = $$OUT_PWD/../testProcessOutput/testProcessOutput.exe addFile_testProcessOutput.path = testProcessOutput - addFile_testProcessNoSpacesArgs.sources = $$OUT_PWD/../testProcessSpacesArgs/nospace.exe + addFile_testProcessNoSpacesArgs.files = $$OUT_PWD/../testProcessSpacesArgs/nospace.exe addFile_testProcessNoSpacesArgs.path = testProcessSpacesArgs - addFile_testProcessOneSpacesArgs.sources = $$OUT_PWD/../testProcessSpacesArgs/"one space".exe + addFile_testProcessOneSpacesArgs.files = $$OUT_PWD/../testProcessSpacesArgs/"one space".exe addFile_testProcessOneSpacesArgs.path = testProcessSpacesArgs - addFile_testProcessTwoSpacesArgs.sources = $$OUT_PWD/../testProcessSpacesArgs/"two space s".exe + addFile_testProcessTwoSpacesArgs.files = $$OUT_PWD/../testProcessSpacesArgs/"two space s".exe addFile_testProcessTwoSpacesArgs.path = testProcessSpacesArgs - addFile_testSoftExit.sources = $$OUT_PWD/../testSoftExit/testSoftExit.exe + addFile_testSoftExit.files = $$OUT_PWD/../testSoftExit/testSoftExit.exe addFile_testSoftExit.path = testSoftExit - addFile_testSpaceInName.sources = $$OUT_PWD/../"test Space In Name"/testSpaceInName.exe + addFile_testSpaceInName.files = $$OUT_PWD/../"test Space In Name"/testSpaceInName.exe addFile_testSpaceInName.path = "test Space In Name" @@ -108,7 +108,7 @@ wince*: { } symbian: { - binDep.sources = \ + binDep.files = \ fileWriterProcess.exe \ testDetached.exe \ testExitCodes.exe \ diff --git a/tests/auto/qresourceengine/qresourceengine.pro b/tests/auto/qresourceengine/qresourceengine.pro index 17e36af..6bdeb1e 100644 --- a/tests/auto/qresourceengine/qresourceengine.pro +++ b/tests/auto/qresourceengine/qresourceengine.pro @@ -21,22 +21,22 @@ PRE_TARGETDEPS += $${runtime_resource.target} QT = core wince*|symbian:{ - deploy.sources += runtime_resource.rcc parentdir.txt - test.sources = testqrc/* + deploy.files += runtime_resource.rcc parentdir.txt + test.files = testqrc/* test.path = testqrc - alias.sources = testqrc/aliasdir/* + alias.files = testqrc/aliasdir/* alias.path = testqrc/aliasdir - other.sources = testqrc/otherdir/* + other.files = testqrc/otherdir/* other.path = testqrc/otherdir - search1.sources = testqrc/searchpath1/* + search1.files = testqrc/searchpath1/* search1.path = testqrc/searchpath1 - search2.sources = testqrc/searchpath2/* + search2.files = testqrc/searchpath2/* search2.path = testqrc/searchpath2 - sub.sources = testqrc/subdir/* + sub.files = testqrc/subdir/* sub.path = testqrc/subdir - testsub.sources = testqrc/test/* + testsub.files = testqrc/test/* testsub.path = testqrc/test - testsub2.sources = testqrc/test/test/* + testsub2.files = testqrc/test/test/* testsub2.path = testqrc/test/test DEPLOYMENT = deploy test alias other search1 search2 sub testsub testsub2 !symbian:DEFINES += SRCDIR=\\\"\\\" diff --git a/tests/auto/qscriptengine/qscriptengine.pro b/tests/auto/qscriptengine/qscriptengine.pro index fc35f66..c5c2861 100644 --- a/tests/auto/qscriptengine/qscriptengine.pro +++ b/tests/auto/qscriptengine/qscriptengine.pro @@ -10,7 +10,7 @@ wince* { } wince*|symbian: { - addFiles.sources = script + addFiles.files = script addFiles.path = . DEPLOYMENT += addFiles } diff --git a/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro b/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro index 07a4672..b1ddd64 100644 --- a/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro +++ b/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro @@ -5,7 +5,7 @@ SOURCES += tst_qscriptjstestsuite.cpp !symbian: DEFINES += SRCDIR=\\\"$$PWD\\\" wince*|symbian: { -testFiles.sources = tests +testFiles.files = tests testFiles.path = . DEPLOYMENT += testFiles } diff --git a/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro b/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro index 03e26bd..5d8e5af4 100644 --- a/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro +++ b/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro @@ -4,7 +4,7 @@ SOURCES += tst_qscriptv8testsuite.cpp !symbian:DEFINES += SRCDIR=\\\"$$PWD\\\" wince*|symbian: { -testFiles.sources = tests +testFiles.files = tests testFiles.path = . DEPLOYMENT += testFiles } diff --git a/tests/auto/qsound/qsound.pro b/tests/auto/qsound/qsound.pro index bb1981c..a1760f8 100644 --- a/tests/auto/qsound/qsound.pro +++ b/tests/auto/qsound/qsound.pro @@ -2,7 +2,7 @@ load(qttest_p4) SOURCES += tst_qsound.cpp wince*|symbian: { - deploy.sources += 4.wav + deploy.files += 4.wav DEPLOYMENT = deploy !symbian:DEFINES += SRCDIR=\\\"\\\" } else { diff --git a/tests/auto/qsplitter/qsplitter.pro b/tests/auto/qsplitter/qsplitter.pro index b11e408..5422fae 100644 --- a/tests/auto/qsplitter/qsplitter.pro +++ b/tests/auto/qsplitter/qsplitter.pro @@ -5,7 +5,7 @@ SOURCES += tst_qsplitter.cpp contains(QT_CONFIG, qt3support): QT += qt3support wince*|symbian: { - addFiles.sources = extradata.txt setSizes3.dat + addFiles.files = extradata.txt setSizes3.dat addFiles.path = . DEPLOYMENT += addFiles !symbian:DEFINES += SRCDIR=\\\"./\\\" diff --git a/tests/auto/qsql/qsql.pro b/tests/auto/qsql/qsql.pro index 0ec581d..9bf30f8 100644 --- a/tests/auto/qsql/qsql.pro +++ b/tests/auto/qsql/qsql.pro @@ -13,7 +13,7 @@ symbian { qt_not_deployed { contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll + sqlite.files = sqlite3.dll DEPLOYMENT += sqlite } } diff --git a/tests/auto/qsqldatabase/qsqldatabase.pro b/tests/auto/qsqldatabase/qsqldatabase.pro index 6381219..066c24f 100644 --- a/tests/auto/qsqldatabase/qsqldatabase.pro +++ b/tests/auto/qsqldatabase/qsqldatabase.pro @@ -13,7 +13,7 @@ win32: { wince*: { DEPLOYMENT_PLUGIN += qsqlite - testData.sources = testdata + testData.files = testdata testData.path = . DEPLOYMENT += testData @@ -26,7 +26,7 @@ symbian { qt_not_deployed { contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll + sqlite.files = sqlite3.dll DEPLOYMENT += sqlite } } diff --git a/tests/auto/qsqldriver/qsqldriver.pro b/tests/auto/qsqldriver/qsqldriver.pro index 2e9ed67..c02d74a 100644 --- a/tests/auto/qsqldriver/qsqldriver.pro +++ b/tests/auto/qsqldriver/qsqldriver.pro @@ -4,7 +4,7 @@ SOURCES += tst_qsqldriver.cpp QT += sql wince*: { - plugFiles.sources = ../../../plugins/sqldrivers + plugFiles.files = ../../../plugins/sqldrivers plugFiles.path = . DEPLOYMENT += plugFiles LIBS += -lws2 @@ -20,7 +20,7 @@ symbian { qt_not_deployed { contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll + sqlite.files = sqlite3.dll DEPLOYMENT += sqlite } } diff --git a/tests/auto/qsqlerror/qsqlerror.pro b/tests/auto/qsqlerror/qsqlerror.pro index 456f585..ebf6d24 100644 --- a/tests/auto/qsqlerror/qsqlerror.pro +++ b/tests/auto/qsqlerror/qsqlerror.pro @@ -11,7 +11,7 @@ symbian { qt_not_deployed { contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll + sqlite.files = sqlite3.dll DEPLOYMENT += sqlite } } diff --git a/tests/auto/qsqlfield/qsqlfield.pro b/tests/auto/qsqlfield/qsqlfield.pro index 7339854..2359151 100644 --- a/tests/auto/qsqlfield/qsqlfield.pro +++ b/tests/auto/qsqlfield/qsqlfield.pro @@ -7,7 +7,7 @@ symbian { qt_not_deployed { contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll + sqlite.files = sqlite3.dll DEPLOYMENT += sqlite } } diff --git a/tests/auto/qsqlquery/qsqlquery.pro b/tests/auto/qsqlquery/qsqlquery.pro index 97646ed..fbcc998 100644 --- a/tests/auto/qsqlquery/qsqlquery.pro +++ b/tests/auto/qsqlquery/qsqlquery.pro @@ -8,7 +8,7 @@ QT = core sql wince*: { - plugFiles.sources = ../../../plugins/sqldrivers + plugFiles.files = ../../../plugins/sqldrivers plugFiles.path = . DEPLOYMENT += plugFiles LIBS += -lws2 @@ -18,7 +18,7 @@ symbian { qt_not_deployed { contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll + sqlite.files = sqlite3.dll DEPLOYMENT += sqlite } } diff --git a/tests/auto/qsqlquerymodel/qsqlquerymodel.pro b/tests/auto/qsqlquerymodel/qsqlquerymodel.pro index cda8cab..4b23e94 100644 --- a/tests/auto/qsqlquerymodel/qsqlquerymodel.pro +++ b/tests/auto/qsqlquerymodel/qsqlquerymodel.pro @@ -10,7 +10,7 @@ wince*: { qt_not_deployed { contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll + sqlite.files = sqlite3.dll DEPLOYMENT += sqlite } } diff --git a/tests/auto/qsqlrecord/qsqlrecord.pro b/tests/auto/qsqlrecord/qsqlrecord.pro index f36f076..16e3ae4 100644 --- a/tests/auto/qsqlrecord/qsqlrecord.pro +++ b/tests/auto/qsqlrecord/qsqlrecord.pro @@ -5,7 +5,7 @@ symbian { qt_not_deployed { contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll + sqlite.files = sqlite3.dll DEPLOYMENT += sqlite } } diff --git a/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro b/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro index c6681d5..dad42d5 100644 --- a/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro +++ b/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro @@ -4,7 +4,7 @@ SOURCES += tst_qsqlrelationaltablemodel.cpp QT += sql wince*: { - plugFiles.sources = ../../../plugins/sqldrivers + plugFiles.files = ../../../plugins/sqldrivers plugFiles.path = . DEPLOYMENT += plugFiles LIBS += -lws2 @@ -12,7 +12,7 @@ wince*: { qt_not_deployed { contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll + sqlite.files = sqlite3.dll DEPLOYMENT += sqlite } } diff --git a/tests/auto/qsqltablemodel/qsqltablemodel.pro b/tests/auto/qsqltablemodel/qsqltablemodel.pro index 9a23237..e49020f 100644 --- a/tests/auto/qsqltablemodel/qsqltablemodel.pro +++ b/tests/auto/qsqltablemodel/qsqltablemodel.pro @@ -4,7 +4,7 @@ SOURCES += tst_qsqltablemodel.cpp QT += sql wince*: { - plugFiles.sources = ../../../plugins/sqldrivers + plugFiles.files = ../../../plugins/sqldrivers plugFiles.path = . DEPLOYMENT += plugFiles LIBS += -lws2 @@ -12,7 +12,7 @@ wince*: { qt_not_deployed { contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll + sqlite.files = sqlite3.dll DEPLOYMENT += sqlite } } diff --git a/tests/auto/qsqlthread/qsqlthread.pro b/tests/auto/qsqlthread/qsqlthread.pro index 5522232..2e4c72a 100644 --- a/tests/auto/qsqlthread/qsqlthread.pro +++ b/tests/auto/qsqlthread/qsqlthread.pro @@ -5,7 +5,7 @@ QT = core sql wince*: { - plugFiles.sources = ../../../plugins/sqldrivers + plugFiles.files = ../../../plugins/sqldrivers plugFiles.path = . DEPLOYMENT += plugFiles LIBS += -lws2 @@ -13,7 +13,7 @@ wince*: { qt_not_deployed { contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll + sqlite.files = sqlite3.dll DEPLOYMENT += sqlite } } diff --git a/tests/auto/qsslcertificate/qsslcertificate.pro b/tests/auto/qsslcertificate/qsslcertificate.pro index d7671ea..e21587b 100644 --- a/tests/auto/qsslcertificate/qsslcertificate.pro +++ b/tests/auto/qsslcertificate/qsslcertificate.pro @@ -15,7 +15,7 @@ win32 { } wince*|symbian: { - certFiles.sources = certificates more-certificates + certFiles.files = certificates more-certificates certFiles.path = . DEPLOYMENT += certFiles } diff --git a/tests/auto/qsslkey/qsslkey.pro b/tests/auto/qsslkey/qsslkey.pro index dff0db1..5a90b76 100644 --- a/tests/auto/qsslkey/qsslkey.pro +++ b/tests/auto/qsslkey/qsslkey.pro @@ -15,10 +15,10 @@ win32 { } wince*|symbian: { - keyFiles.sources = keys + keyFiles.files = keys keyFiles.path = . - passphraseFiles.sources = rsa-without-passphrase.pem rsa-with-passphrase.pem + passphraseFiles.files = rsa-without-passphrase.pem rsa-with-passphrase.pem passphraseFiles.path = . DEPLOYMENT += keyFiles passphraseFiles diff --git a/tests/auto/qsslsocket/qsslsocket.pro b/tests/auto/qsslsocket/qsslsocket.pro index accfa89..aeeae8f 100644 --- a/tests/auto/qsslsocket/qsslsocket.pro +++ b/tests/auto/qsslsocket/qsslsocket.pro @@ -18,7 +18,7 @@ win32 { wince* { DEFINES += SRCDIR=\\\"./\\\" - certFiles.sources = certs ssl.tar.gz + certFiles.files = certs ssl.tar.gz certFiles.path = . DEPLOYMENT += certFiles } else:symbian { @@ -26,7 +26,7 @@ wince* { TARGET.EPOCHEAPSIZE="0x100 0x1000000" TARGET.CAPABILITY=NetworkServices - certFiles.sources = certs ssl.tar.gz + certFiles.files = certs ssl.tar.gz certFiles.path = . DEPLOYMENT += certFiles INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE # Needed for e32svr.h in S^3 envs diff --git a/tests/auto/qstyle/qstyle.pro b/tests/auto/qstyle/qstyle.pro index 11f5943..eb198e2 100644 --- a/tests/auto/qstyle/qstyle.pro +++ b/tests/auto/qstyle/qstyle.pro @@ -4,7 +4,7 @@ SOURCES += tst_qstyle.cpp wince*|symbian: { !symbian:DEFINES += SRCDIR=\\\".\\\" - addPixmap.sources = task_25863.png + addPixmap.files = task_25863.png addPixmap.path = . DEPLOYMENT += addPixmap } else { diff --git a/tests/auto/qsvggenerator/qsvggenerator.pro b/tests/auto/qsvggenerator/qsvggenerator.pro index 1ccf8e9..2e899a9 100644 --- a/tests/auto/qsvggenerator/qsvggenerator.pro +++ b/tests/auto/qsvggenerator/qsvggenerator.pro @@ -8,7 +8,7 @@ QT += svg xml SOURCES += tst_qsvggenerator.cpp wince*|symbian { - addFiles.sources = referenceSvgs + addFiles.files = referenceSvgs addFiles.path = . DEPLOYMENT += addFiles } diff --git a/tests/auto/qsvgrenderer/qsvgrenderer.pro b/tests/auto/qsvgrenderer/qsvgrenderer.pro index 0b785e3..49337e2 100644 --- a/tests/auto/qsvgrenderer/qsvgrenderer.pro +++ b/tests/auto/qsvgrenderer/qsvgrenderer.pro @@ -9,7 +9,7 @@ SOURCES += tst_qsvgrenderer.cpp RESOURCES += resources.qrc wince*|symbian { - addFiles.sources = *.svg *.svgz + addFiles.files = *.svg *.svgz addFiles.path = . DEPLOYMENT += addFiles diff --git a/tests/auto/qtcpserver/test/test.pro b/tests/auto/qtcpserver/test/test.pro index 123c79e..e91ba20 100644 --- a/tests/auto/qtcpserver/test/test.pro +++ b/tests/auto/qtcpserver/test/test.pro @@ -4,7 +4,7 @@ SOURCES += ../tst_qtcpserver.cpp win32: { wince*: { LIBS += -lws2 - crashApp.sources = ../crashingServer/crashingServer.exe + crashApp.files = ../crashingServer/crashingServer.exe crashApp.path = crashingServer DEPLOYMENT += crashApp } else { @@ -13,7 +13,7 @@ wince*: { } symbian { - crashApp.sources = $$QT_BUILD_TREE/examples/widgets/wiggly/$${BUILD_DIR}/crashingServer.exe + crashApp.files = $$QT_BUILD_TREE/examples/widgets/wiggly/$${BUILD_DIR}/crashingServer.exe crashApp.path = . DEPLOYMENT += crashApp } diff --git a/tests/auto/qtemporaryfile/qtemporaryfile.pro b/tests/auto/qtemporaryfile/qtemporaryfile.pro index c93a2e5..543c143 100644 --- a/tests/auto/qtemporaryfile/qtemporaryfile.pro +++ b/tests/auto/qtemporaryfile/qtemporaryfile.pro @@ -4,7 +4,7 @@ QT = core symbian { - testData.sources = tst_qtemporaryfile.cpp + testData.files = tst_qtemporaryfile.cpp testData.path = . DEPLOYMENT += testData }else { diff --git a/tests/auto/qtextboundaryfinder/qtextboundaryfinder.pro b/tests/auto/qtextboundaryfinder/qtextboundaryfinder.pro index aa1fbb5..e8fb9cb 100644 --- a/tests/auto/qtextboundaryfinder/qtextboundaryfinder.pro +++ b/tests/auto/qtextboundaryfinder/qtextboundaryfinder.pro @@ -5,7 +5,7 @@ SOURCES += tst_qtextboundaryfinder.cpp !symbian:*:DEFINES += SRCDIR=\\\"$$PWD\\\" wince*|symbian:{ - addFiles.sources = data + addFiles.files = data addFiles.path = . DEPLOYMENT += addFiles } diff --git a/tests/auto/qtextbrowser/qtextbrowser.pro b/tests/auto/qtextbrowser/qtextbrowser.pro index 88061a9..773fb97 100644 --- a/tests/auto/qtextbrowser/qtextbrowser.pro +++ b/tests/auto/qtextbrowser/qtextbrowser.pro @@ -6,9 +6,9 @@ contains(QT_CONFIG, qt3support): QT += qt3support wince*|symbian: { - addFiles.sources = *.html + addFiles.files = *.html addFiles.path = . - addDir.sources = subdir/* + addDir.files = subdir/* addDir.path = subdir DEPLOYMENT += addFiles addDir } diff --git a/tests/auto/qtextcodec/test/test.pro b/tests/auto/qtextcodec/test/test.pro index b85032a..2188d2f 100644 --- a/tests/auto/qtextcodec/test/test.pro +++ b/tests/auto/qtextcodec/test/test.pro @@ -17,7 +17,7 @@ win32: { } wince*|symbian { - addFiles.sources = ../*.txt + addFiles.files = ../*.txt addFiles.path = . DEPLOYMENT += addFiles wince*|qt_not_deployed { diff --git a/tests/auto/qtextedit/qtextedit.pro b/tests/auto/qtextedit/qtextedit.pro index 43813da..e7d6c03 100644 --- a/tests/auto/qtextedit/qtextedit.pro +++ b/tests/auto/qtextedit/qtextedit.pro @@ -6,7 +6,7 @@ HEADERS += SOURCES += tst_qtextedit.cpp wince*|symbian: { - addImages.sources = fullWidthSelection/* + addImages.files = fullWidthSelection/* addImages.path = fullWidthSelection DEPLOYMENT += addImages } diff --git a/tests/auto/qtextstream/test/test.pro b/tests/auto/qtextstream/test/test.pro index 20823de..8805fb9 100644 --- a/tests/auto/qtextstream/test/test.pro +++ b/tests/auto/qtextstream/test/test.pro @@ -18,9 +18,9 @@ QT = core network wince*|symbian: { - addFiles.sources = ../rfc3261.txt ../shift-jis.txt ../task113817.txt ../qtextstream.qrc ../tst_qtextstream.cpp + addFiles.files = ../rfc3261.txt ../shift-jis.txt ../task113817.txt ../qtextstream.qrc ../tst_qtextstream.cpp addFiles.path = . - res.sources = ../resources + res.files = ../resources res.path = . DEPLOYMENT += addFiles } @@ -30,7 +30,7 @@ wince*: { }else:symbian { # Symbian can't define SRCDIR meaningfully here qt_not_deployed { - codecs_plugins.sources = qcncodecs.dll qjpcodecs.dll qtwcodecs.dll qkrcodecs.dll + codecs_plugins.files = qcncodecs.dll qjpcodecs.dll qtwcodecs.dll qkrcodecs.dll codecs_plugins.path = $$QT_PLUGINS_BASE_DIR/codecs DEPLOYMENT += codecs_plugins } diff --git a/tests/auto/qtipc/qsharedmemory/test/test.pro b/tests/auto/qtipc/qsharedmemory/test/test.pro index 68a5362..50c2669 100644 --- a/tests/auto/qtipc/qsharedmemory/test/test.pro +++ b/tests/auto/qtipc/qsharedmemory/test/test.pro @@ -20,16 +20,16 @@ TARGET = ../tst_qsharedmemory wince*:{ requires(contains(QT_CONFIG,script)) QT += gui script -addFiles.sources = $$OUT_PWD/../../lackey/lackey.exe ../../lackey/scripts +addFiles.files = $$OUT_PWD/../../lackey/lackey.exe ../../lackey/scripts addFiles.path = . DEPLOYMENT += addFiles DEFINES += SRCDIR=\\\".\\\" }else:symbian{ requires(contains(QT_CONFIG,script)) QT += gui script -addFiles.sources = ../../lackey/scripts +addFiles.files = ../../lackey/scripts addFiles.path = /data/qsharedmemorytemp/lackey -addBin.sources = lackey.exe +addBin.files = lackey.exe addBin.path = /sys/bin DEPLOYMENT += addFiles addBin } else { diff --git a/tests/auto/qtipc/qsystemsemaphore/qsystemsemaphore.pro b/tests/auto/qtipc/qsystemsemaphore/qsystemsemaphore.pro index 8a5f8b2..bb319ee 100644 --- a/tests/auto/qtipc/qsystemsemaphore/qsystemsemaphore.pro +++ b/tests/auto/qtipc/qsystemsemaphore/qsystemsemaphore.pro @@ -17,7 +17,7 @@ requires(contains(QT_CONFIG,script)) # this test calls lackey, which then again depends on QtScript. # let's add it here so that it gets deployed easily QT += script -lackey.sources = $$OUT_PWD/../lackey/lackey.exe ../lackey/scripts +lackey.files = $$OUT_PWD/../lackey/lackey.exe ../lackey/scripts lackey.path = . DEPLOYMENT += lackey } @@ -28,7 +28,7 @@ requires(contains(QT_CONFIG,script)) # let's add it here so that it gets deployed easily QT += script -lackey.sources = ../lackey/lackey.exe +lackey.files = ../lackey/lackey.exe lackey.path = /sys/bin DEPLOYMENT += lackey } diff --git a/tests/auto/qtranslator/qtranslator.pro b/tests/auto/qtranslator/qtranslator.pro index 5b742f7..0001d1c 100644 --- a/tests/auto/qtranslator/qtranslator.pro +++ b/tests/auto/qtranslator/qtranslator.pro @@ -3,7 +3,7 @@ SOURCES += tst_qtranslator.cpp RESOURCES += qtranslator.qrc wince*|symbian: { - addFiles.sources = hellotr_la.qm msgfmt_from_po.qm + addFiles.files = hellotr_la.qm msgfmt_from_po.qm addFiles.path = . DEPLOYMENT += addFiles } diff --git a/tests/auto/qudpsocket/test/test.pro b/tests/auto/qudpsocket/test/test.pro index 9c0d009..7e5ffe4 100644 --- a/tests/auto/qudpsocket/test/test.pro +++ b/tests/auto/qudpsocket/test/test.pro @@ -15,7 +15,7 @@ win32 { } wince*|symbian: { - addApp.sources = ../clientserver/clientserver.exe + addApp.files = ../clientserver/clientserver.exe addApp.path = clientserver DEPLOYMENT += addApp } diff --git a/tests/auto/quuid/test/test.pro b/tests/auto/quuid/test/test.pro index 123aa50..06ae3bd 100644 --- a/tests/auto/quuid/test/test.pro +++ b/tests/auto/quuid/test/test.pro @@ -15,14 +15,14 @@ CONFIG(debug_and_release_target) { } wince* { - addFile_processUniqueness.sources = $$OUT_PWD/../testProcessUniqueness/testProcessUniqueness.exe + addFile_processUniqueness.files = $$OUT_PWD/../testProcessUniqueness/testProcessUniqueness.exe addFile_processUniqueness.path = testProcessUniqueness DEPLOYMENT += addFile_processUniqueness } symbian { - binDep.sources = testProcessUniqueness.exe + binDep.files = testProcessUniqueness.exe binDep.path = \\sys\\bin DEPLOYMENT += binDep diff --git a/tests/auto/qxml/qxml.pro b/tests/auto/qxml/qxml.pro index 5fb7fe2..c87518a 100644 --- a/tests/auto/qxml/qxml.pro +++ b/tests/auto/qxml/qxml.pro @@ -4,7 +4,7 @@ SOURCES += tst_qxml.cpp QT = core xml wince*|symbian: { - addFiles.sources = 0x010D.xml + addFiles.files = 0x010D.xml addFiles.path = . DEPLOYMENT += addFiles } diff --git a/tests/auto/qxmlformatter/qxmlformatter.pro b/tests/auto/qxmlformatter/qxmlformatter.pro index 339fa55..bcab0b4 100644 --- a/tests/auto/qxmlformatter/qxmlformatter.pro +++ b/tests/auto/qxmlformatter/qxmlformatter.pro @@ -4,7 +4,7 @@ SOURCES += tst_qxmlformatter.cpp include (../xmlpatterns.pri) wince*|symbian:{ - addFiles.sources = baselines input + addFiles.files = baselines input addFiles.path = . DEPLOYMENT += addFiles } diff --git a/tests/auto/qxmlquery/qxmlquery.pro b/tests/auto/qxmlquery/qxmlquery.pro index 044b7ce..d5e8228 100644 --- a/tests/auto/qxmlquery/qxmlquery.pro +++ b/tests/auto/qxmlquery/qxmlquery.pro @@ -19,10 +19,10 @@ wince* { include (../xmlpatterns.pri) wince*|symbian: { - addFiles.sources = pushBaselines input.xml + addFiles.files = pushBaselines input.xml addFiles.path = . - patternistFiles.sources = ../xmlpatterns/queries + patternistFiles.files = ../xmlpatterns/queries symbian: { #../xmlpatterns resolves to an illegal path for deployment patternistFiles.path = xmlpatterns diff --git a/tests/auto/qxmlsimplereader/qxmlsimplereader.pro b/tests/auto/qxmlsimplereader/qxmlsimplereader.pro index c107470..bc3cbd2 100644 --- a/tests/auto/qxmlsimplereader/qxmlsimplereader.pro +++ b/tests/auto/qxmlsimplereader/qxmlsimplereader.pro @@ -13,7 +13,7 @@ QT -= gui wince*|symbian: { - addFiles.sources = encodings parser xmldocs + addFiles.files = encodings parser xmldocs addFiles.path = . DEPLOYMENT += addFiles } diff --git a/tests/auto/qxmlstream/qxmlstream.pro b/tests/auto/qxmlstream/qxmlstream.pro index 8f076be..31d77e7 100644 --- a/tests/auto/qxmlstream/qxmlstream.pro +++ b/tests/auto/qxmlstream/qxmlstream.pro @@ -5,7 +5,7 @@ QT = core xml network wince*|symbian: { - addFiles.sources = data XML-Test-Suite + addFiles.files = data XML-Test-Suite addFiles.path = . DEPLOYMENT += addFiles DEFINES += SRCDIR=\\\"\\\" diff --git a/tests/auto/qzip/qzip.pro b/tests/auto/qzip/qzip.pro index 632c743..683da62 100644 --- a/tests/auto/qzip/qzip.pro +++ b/tests/auto/qzip/qzip.pro @@ -2,7 +2,7 @@ load(qttest_p4) SOURCES += tst_qzip.cpp wince*|symbian: { - addFiles.sources = testdata + addFiles.files = testdata addFiles.path = . DEPLOYMENT += addFiles !symbian:DEFINES += SRCDIR=\\\".\\\" diff --git a/tests/auto/uiloader/uiloader/uiloader.pro b/tests/auto/uiloader/uiloader/uiloader.pro index d99df00..4e95956 100644 --- a/tests/auto/uiloader/uiloader/uiloader.pro +++ b/tests/auto/uiloader/uiloader/uiloader.pro @@ -17,10 +17,10 @@ QT += xml svg network contains(QT_CONFIG, qt3support): QT += qt3support wince*|symbian: { - configuration.sources = ../*.ini + configuration.files = ../*.ini configuration.path = . - screenapp.sources = ../tst_screenshot/tst_screenshot.exe + screenapp.files = ../tst_screenshot/tst_screenshot.exe screenapp.path = tst_screenshot DEPLOYMENT += configuration screenapp diff --git a/tests/auto/windowsmobile/test/test.pro b/tests/auto/windowsmobile/test/test.pro index f3124a3..b0536a5 100644 --- a/tests/auto/windowsmobile/test/test.pro +++ b/tests/auto/windowsmobile/test/test.pro @@ -8,7 +8,7 @@ RESOURCES += windowsmobile.qrc TARGET = ../tst_windowsmobile wincewm*: { - addFiles.sources = $$OUT_PWD/../testQMenuBar/*.exe + addFiles.files = $$OUT_PWD/../testQMenuBar/*.exe addFiles.path = "\\Program Files\\tst_windowsmobile" diff --git a/tests/auto/xmlpatterns.pri b/tests/auto/xmlpatterns.pri index 8c8ccad..57b8517 100644 --- a/tests/auto/xmlpatterns.pri +++ b/tests/auto/xmlpatterns.pri @@ -4,9 +4,9 @@ contains(QT_CONFIG,xmlpatterns) { } wince*: { - patternsdk.sources = $$QT_BUILD_TREE/lib/QtXmlPatternsSDK*.dll + patternsdk.files = $$QT_BUILD_TREE/lib/QtXmlPatternsSDK*.dll patternsdk.path = . - basedata.sources = xmlpaternsxqts/Baseline.xml + basedata.files = xmlpaternsxqts/Baseline.xml basedata.path = . DEPLOYMENT += patternsdk QT += network diff --git a/tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro b/tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro index 981adab..3e252f6 100644 --- a/tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro +++ b/tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro @@ -21,7 +21,7 @@ INCLUDEPATH += $$(QTSRCDIR)/tests/auto/xmlpatternssdk \ ../xmlpatternssdk wince*|symbian { - catalog.sources = TestSuite Baseline.xml + catalog.files = TestSuite Baseline.xml catalog.path = . DEPLOYMENT += catalog } diff --git a/tests/auto/xmlpatternsview/xmlpatternsview.pro b/tests/auto/xmlpatternsview/xmlpatternsview.pro index d93cba3..5ab0f0e 100644 --- a/tests/auto/xmlpatternsview/xmlpatternsview.pro +++ b/tests/auto/xmlpatternsview/xmlpatternsview.pro @@ -6,7 +6,7 @@ include (../xmlpatterns.pri) TARGET = tst_xmlpatternsview wince*: { - viewexe.sources = $$QT_BUILD_TREE/xmlpatternsview.exe + viewexe.files = $$QT_BUILD_TREE/xmlpatternsview.exe viewexe.path = . DEPLOYMENT += viewexe } diff --git a/tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro b/tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro index 940cc31..44c4754 100644 --- a/tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro +++ b/tests/auto/xmlpatternsxslts/xmlpatternsxslts.pro @@ -18,7 +18,7 @@ INCLUDEPATH += $$(QTSRCDIR)/tests/auto/xmlpatternssdk \ ../xmlpatternssdk wince*: { - testdata.sources = XSLTS Baseline.xml + testdata.files = XSLTS Baseline.xml testdata.path = . DEPLOYMENT += testdata } diff --git a/tests/benchmarks/corelib/codecs/qtextcodec/qtextcodec.pro b/tests/benchmarks/corelib/codecs/qtextcodec/qtextcodec.pro index 23f0e00..f26d623 100644 --- a/tests/benchmarks/corelib/codecs/qtextcodec/qtextcodec.pro +++ b/tests/benchmarks/corelib/codecs/qtextcodec/qtextcodec.pro @@ -6,7 +6,7 @@ SOURCES += main.cpp wince*:{ DEFINES += SRCDIR=\\\"\\\" } else:symbian* { - addFiles.sources = utf-8.txt + addFiles.files = utf-8.txt addFiles.path = . DEPLOYMENT += addFiles TARGET.EPOCHEAPSIZE="0x100 0x1000000" diff --git a/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro b/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro index 320746c..17d164d 100755 --- a/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro +++ b/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro @@ -16,7 +16,7 @@ SOURCES += qfilesystemiterator.cpp HEADERS += qfilesystemiterator.h wince*|symbian: { - corelibdir.sources = $$QT_SOURCE_TREE/src/corelib + corelibdir.files = $$QT_SOURCE_TREE/src/corelib corelibdir.path = ./depot/src DEPLOYMENT += corelibdir } diff --git a/tests/benchmarks/corelib/tools/qstring/qstring.pro b/tests/benchmarks/corelib/tools/qstring/qstring.pro index e8720e1..e43e400 100644 --- a/tests/benchmarks/corelib/tools/qstring/qstring.pro +++ b/tests/benchmarks/corelib/tools/qstring/qstring.pro @@ -6,7 +6,7 @@ SOURCES += main.cpp data.cpp wince*:{ DEFINES += SRCDIR=\\\"\\\" } else:symbian* { - addFiles.sources = utf-8.txt + addFiles.files = utf-8.txt addFiles.path = . DEPLOYMENT += addFiles TARGET.EPOCHEAPSIZE="0x100 0x1000000" diff --git a/tests/benchmarks/declarative/binding/binding.pro b/tests/benchmarks/declarative/binding/binding.pro index c1a8223..ceaabeb 100644 --- a/tests/benchmarks/declarative/binding/binding.pro +++ b/tests/benchmarks/declarative/binding/binding.pro @@ -8,7 +8,7 @@ SOURCES += tst_binding.cpp testtypes.cpp HEADERS += testtypes.h symbian { - data.sources = data + data.files = data data.path = . DEPLOYMENT = data } else { diff --git a/tests/benchmarks/declarative/compilation/compilation.pro b/tests/benchmarks/declarative/compilation/compilation.pro index 9277187..9ab2a25 100644 --- a/tests/benchmarks/declarative/compilation/compilation.pro +++ b/tests/benchmarks/declarative/compilation/compilation.pro @@ -9,7 +9,7 @@ CONFIG += release SOURCES += tst_compilation.cpp symbian { - data.sources += data + data.files += data data.path = . DEPLOYMENT += data } else { diff --git a/tests/benchmarks/declarative/creation/creation.pro b/tests/benchmarks/declarative/creation/creation.pro index 6540fa2..74cb47f 100644 --- a/tests/benchmarks/declarative/creation/creation.pro +++ b/tests/benchmarks/declarative/creation/creation.pro @@ -7,7 +7,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_creation.cpp symbian { - data.sources = data + data.files = data data.path = . DEPLOYMENT += data } else { diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro b/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro index b2f39c1..4693a82 100644 --- a/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro +++ b/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro @@ -8,7 +8,7 @@ SOURCES += tst_qdeclarativecomponent.cpp testtypes.cpp HEADERS += testtypes.h symbian { - data.sources = data + data.files = data data.path = . DEPLOYMENT += data } else { diff --git a/tests/benchmarks/declarative/qdeclarativeimage/qdeclarativeimage.pro b/tests/benchmarks/declarative/qdeclarativeimage/qdeclarativeimage.pro index a68792b..c4d5609 100644 --- a/tests/benchmarks/declarative/qdeclarativeimage/qdeclarativeimage.pro +++ b/tests/benchmarks/declarative/qdeclarativeimage/qdeclarativeimage.pro @@ -8,7 +8,7 @@ CONFIG += release SOURCES += tst_qdeclarativeimage.cpp symbian { - importFiles.sources = image.png + importFiles.files = image.png importFiles.path = DEPLOYMENT = importFiles } else { diff --git a/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro b/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro index 65ee7e0..765e37a 100644 --- a/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro +++ b/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro @@ -7,7 +7,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativemetaproperty.cpp symbian { - data.sources += data + data.files += data data.path = . DEPLOYMENT += data } else { diff --git a/tests/benchmarks/declarative/qmltime/qmltime.pro b/tests/benchmarks/declarative/qmltime/qmltime.pro index 6f5ad5e..273a60a 100644 --- a/tests/benchmarks/declarative/qmltime/qmltime.pro +++ b/tests/benchmarks/declarative/qmltime/qmltime.pro @@ -8,7 +8,7 @@ SOURCES += qmltime.cpp symbian { TARGET.CAPABILITY = "All -TCB" - example.sources = example.qml tests + example.files = example.qml tests example.path = . DEPLOYMENT += example } diff --git a/tests/benchmarks/declarative/script/script.pro b/tests/benchmarks/declarative/script/script.pro index 685ba03..d6cb708 100644 --- a/tests/benchmarks/declarative/script/script.pro +++ b/tests/benchmarks/declarative/script/script.pro @@ -8,7 +8,7 @@ CONFIG += release SOURCES += tst_script.cpp symbian { - importFiles.sources = data + importFiles.files = data importFiles.path = DEPLOYMENT = importFiles } else { diff --git a/tests/benchmarks/declarative/typeimports/typeimports.pro b/tests/benchmarks/declarative/typeimports/typeimports.pro index a5df3f0..56834e6 100644 --- a/tests/benchmarks/declarative/typeimports/typeimports.pro +++ b/tests/benchmarks/declarative/typeimports/typeimports.pro @@ -7,7 +7,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_typeimports.cpp symbian { - data.sources = data + data.files = data data.path = . DEPLOYMENT += data } else { diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.pro b/tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.pro index 6e044f9..bfa374c 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.pro +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.pro @@ -9,7 +9,7 @@ include(chiptester/chiptester.pri) symbian { qt_not_deployed { - plugins.sources = qjpeg.dll + plugins.files = qjpeg.dll plugins.path = imageformats DEPLOYMENT += plugins } diff --git a/tests/benchmarks/gui/image/qimagereader/qimagereader.pro b/tests/benchmarks/gui/image/qimagereader/qimagereader.pro index d67f4be..db5ffcd 100644 --- a/tests/benchmarks/gui/image/qimagereader/qimagereader.pro +++ b/tests/benchmarks/gui/image/qimagereader/qimagereader.pro @@ -11,15 +11,15 @@ SOURCES += tst_qimagereader.cpp QT += network wince*: { - addFiles.sources = images + addFiles.files = images addFiles.path = . CONFIG(debug, debug|release):{ - imageFormatsPlugins.sources = $$(QTDIR)/plugins/imageformats/*d4.dll + imageFormatsPlugins.files = $$(QTDIR)/plugins/imageformats/*d4.dll } CONFIG(release, debug|release):{ - imageFormatsPlugins.sources = $$(QTDIR)/plugins/imageformats/*[^d]4.dll + imageFormatsPlugins.files = $$(QTDIR)/plugins/imageformats/*[^d]4.dll } imageFormatsPlugins.path = imageformats DEPLOYMENT += addFiles imageFormatsPlugins diff --git a/tests/benchmarks/gui/text/qtext/qtext.pro b/tests/benchmarks/gui/text/qtext/qtext.pro index a1b6a22..1c18302 100644 --- a/tests/benchmarks/gui/text/qtext/qtext.pro +++ b/tests/benchmarks/gui/text/qtext/qtext.pro @@ -6,7 +6,7 @@ SOURCES += main.cpp symbian* { TARGET.CAPABILITY = ALL -TCB - addFiles.sources = bidi.txt + addFiles.files = bidi.txt addFiles.path = . DEPLOYMENT += addFiles } else { diff --git a/tests/manual/textrendering/glyphshaping/glyphshaping.pro b/tests/manual/textrendering/glyphshaping/glyphshaping.pro index caa9028..1d78aa3 100644 --- a/tests/manual/textrendering/glyphshaping/glyphshaping.pro +++ b/tests/manual/textrendering/glyphshaping/glyphshaping.pro @@ -1,5 +1,5 @@ SOURCES = main.cpp OTHER_FILES = glyphshaping_data.xml glyphshaping_data.path = . -glyphshaping_data.sources = $$PWD/glyphshaping_data.xml +glyphshaping_data.files = $$PWD/glyphshaping_data.xml DEPLOYMENT += glyphshaping_data -- cgit v0.12 From 4d974ff0a748b22e668a4cb7ef38101122c85b3b Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Fri, 8 Oct 2010 14:21:10 +0200 Subject: Avoid in-place convertion of images with multiple references The decoding from image reader was assuming the image reader do not keep the image internally. This is not true for the GIF plugins because the previous image can be used to compose the current image. This was causing crash on ARM because the 16 bits color depth causes the image memory to be reduce by half. When the plugin was accessing the memory, it assumes the images has not changed and is on 32 bits. This patch disable the in-place conversion if a detach is required. Regular conversion is the correct solution in this case, and it can also be made faster by converting while copying. Reviewed-by: Andreas Kling --- src/gui/image/qimage.cpp | 4 ++++ tests/auto/qpixmap/tst_qpixmap.cpp | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index ac148ee..1157b93 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -6607,6 +6607,10 @@ bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFla if (format == newFormat) return true; + // No in-place conversion if we have to detach + if (ref > 1) + return false; + const InPlace_Image_Converter *const converterPtr = &inplace_converter_map[format][newFormat]; InPlace_Image_Converter converter = *converterPtr; if (converter) diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 8005ec5..24cbb21 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -179,6 +179,7 @@ private slots: void fromImageReader_data(); void fromImageReader(); + void fromImageReaderAnimatedGif_data(); void fromImageReaderAnimatedGif(); void preserveDepth(); @@ -1605,6 +1606,8 @@ void tst_QPixmap::fromImageReader_data() QTest::newRow("designer_indexed8_no_alpha.gif") << prefix + "/designer_indexed8_no_alpha.gif"; QTest::newRow("designer_indexed8_with_alpha.gif") << prefix + "/designer_indexed8_with_alpha.gif"; QTest::newRow("designer_rgb32.jpg") << prefix + "/designer_rgb32.jpg"; + QTest::newRow("designer_indexed8_with_alpha_animated") << prefix + "/designer_indexed8_with_alpha_animated.gif"; + QTest::newRow("designer_indexed8_with_alpha_animated") << prefix + "/designer_indexed8_no_alpha_animated.gif"; } void tst_QPixmap::fromImageReader() @@ -1621,14 +1624,22 @@ void tst_QPixmap::fromImageReader() QVERIFY(pixmapsAreEqual(&pixmapWithCopy, &directLoadingPixmap)); } +void tst_QPixmap::fromImageReaderAnimatedGif_data() +{ + QTest::addColumn("imagePath"); + QTest::newRow("gif with alpha") << QString::fromLatin1("/designer_indexed8_with_alpha_animated.gif"); + QTest::newRow("gif without alpha") << QString::fromLatin1("/designer_indexed8_no_alpha_animated.gif"); +} + void tst_QPixmap::fromImageReaderAnimatedGif() { + QFETCH(QString, imagePath); #ifdef Q_OS_SYMBIAN const QString prefix = QLatin1String(SRCDIR) + "loadFromData"; #else const QString prefix = QLatin1String(SRCDIR) + "/loadFromData"; #endif - const QString path = prefix + QString::fromLatin1("/designer_indexed8_with_alpha_animated.gif"); + const QString path = prefix + imagePath; QImageReader referenceReader(path); QImageReader pixmapReader(path); -- cgit v0.12 From b546a7c8c57fdfe18b3293c8fef8c4a58ad77f59 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Fri, 8 Oct 2010 14:53:02 +0200 Subject: Made several QMenuBar functions visible to qdoc and added documentation. Task-number: QTBUG-14026 Reviewed-by: David Boddie --- src/gui/widgets/qmenubar.cpp | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index df16f7f..ae56fa5 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -1628,10 +1628,10 @@ bool QMenuBar::eventFilter(QObject *object, QEvent *event) } /*! - \internal + Returns the QAction at \a pt. Returns 0 if there is no action at \a pt or if +the location has a separator. - Return the item at \a pt, or 0 if there is no item there or if it is - a separator item. + \sa addAction(), addSeparator() */ QAction *QMenuBar::actionAt(const QPoint &pt) const { @@ -1640,9 +1640,9 @@ QAction *QMenuBar::actionAt(const QPoint &pt) const } /*! - \internal + Returns the geometry of action \a act as a QRect. - Returns the geometry of action \a act. + \sa actionAt() */ QRect QMenuBar::actionGeometry(QAction *act) const { @@ -1836,10 +1836,17 @@ void QMenuBarPrivate::_q_updateLayout() } /*! - \internal + \fn void QMenuBar::setCornerWidget(QWidget *widget, Qt::Corner corner) - This sets widget \a w to be shown directly on the left of the first or - the right of the last menu item, depending on \a corner. + This sets the given \a widget to be shown directly on the left of the first + menu item, or on the right of the last menu item, depending on \a corner. + + The menu bar takes ownership of \a widget, reparenting it into the menu bar. + However, if the \a corner already contains a widget, this previous widget + will no longer be managed and will still be a visible child of the menu bar. + + \note Using a corner other than Qt::TopRightCorner or Qt::TopLeftCorner + will result in a warning. */ void QMenuBar::setCornerWidget(QWidget *w, Qt::Corner corner) { @@ -1869,10 +1876,11 @@ void QMenuBar::setCornerWidget(QWidget *w, Qt::Corner corner) } /*! - \internal + Returns the widget on the left of the first or on the right of the last menu + item, depending on \a corner. - Returns the widget in the left of the first or the right of the last menu - item, depending on \a corner. + \note Using a corner other than Qt::TopRightCorner or Qt::TopLeftCorner + will result in a warning. */ QWidget *QMenuBar::cornerWidget(Qt::Corner corner) const { -- cgit v0.12 From 7ca4e9622c4b2e4142d401fa10d50a0a45906615 Mon Sep 17 00:00:00 2001 From: axis Date: Thu, 7 Oct 2010 15:26:47 +0200 Subject: Fixed missing QMAKE_MOC definition in certain mkspecs. Also removed the use of DIR_SEPARATOR. It does not get defined until after symbian.conf has finished parsing. RevBy: Miikka Heikkinen --- mkspecs/common/symbian/symbian-mmp.conf | 10 ---------- mkspecs/common/symbian/symbian.conf | 8 ++++++++ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/mkspecs/common/symbian/symbian-mmp.conf b/mkspecs/common/symbian/symbian-mmp.conf index 5292781..1fbd302 100644 --- a/mkspecs/common/symbian/symbian-mmp.conf +++ b/mkspecs/common/symbian/symbian-mmp.conf @@ -4,16 +4,6 @@ include(symbian.conf) -contains(QMAKE_HOST.os, "Windows") { - QMAKE_MOC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}moc.exe - QMAKE_UIC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}uic.exe - QMAKE_IDC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}idc.exe -} else { - QMAKE_MOC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}moc - QMAKE_UIC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}uic - QMAKE_IDC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}idc -} - load(symbian/add_mmp_rules) symbian-abld { diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index cc5b788..d8c38f4 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -95,6 +95,10 @@ contains(QMAKE_HOST.os,Windows) { QMAKE_DEL_DIR = rmdir QMAKE_DEL_TREE = rmdir /s /q QMAKE_CHK_DIR_EXISTS = if not exist + + QMAKE_MOC = $$[QT_INSTALL_BINS]\\moc.exe + QMAKE_UIC = $$[QT_INSTALL_BINS]\\uic.exe + QMAKE_IDC = $$[QT_INSTALL_BINS]\\idc.exe } else { QMAKE_COPY = cp QMAKE_COPY_DIR = cp -r @@ -104,6 +108,10 @@ contains(QMAKE_HOST.os,Windows) { QMAKE_DEL_DIR = rmdir QMAKE_DEL_TREE = rm -rf QMAKE_CHK_DIR_EXISTS = test -d + + QMAKE_MOC = $$[QT_INSTALL_BINS]/moc + QMAKE_UIC = $$[QT_INSTALL_BINS]/uic + QMAKE_IDC = $$[QT_INSTALL_BINS]/idc } QMAKE_IDL = midl -- cgit v0.12 From aa0f3a7745472ea8c9ca43bb7d690a0591bde83b Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 8 Oct 2010 14:58:44 +0200 Subject: Fixed some preprocessor parameters for Mac support. RevBy: Liang Qi --- mkspecs/features/symbian/symbian_building.prf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mkspecs/features/symbian/symbian_building.prf b/mkspecs/features/symbian/symbian_building.prf index 614fb65..1a51cb2 100644 --- a/mkspecs/features/symbian/symbian_building.prf +++ b/mkspecs/features/symbian/symbian_building.prf @@ -229,7 +229,7 @@ symbian_resources_INCLUDES = $$replace(symbian_resources_INCLUDES, ",", " -I") symbian_resources_INCLUDES += $$join(INCLUDEPATH, " -I", "-I") symbian_resources_DEFINES = $$join(DEFINES, " -D", "-D") symbian_resources_RCC_DIR = $$replace(RCC_DIR, "/$", "") -symbian_resources_INCLUDES += "-I $$symbian_resources_RCC_DIR" +symbian_resources_INCLUDES += "-I$$symbian_resources_RCC_DIR" for(symbian_resource, SYMBIAN_RESOURCES) { symbian_resource = $$basename(symbian_resource) @@ -245,7 +245,7 @@ symbianresources.commands = cpp -nostdinc -undef \ $$symbian_resources_INCLUDES \ $$symbian_resources_DEFINES \ ${QMAKE_FILE_NAME} \ - -o $${symbian_resources_RCC_DIR}/${QMAKE_FILE_BASE}.rpp \ + > $${symbian_resources_RCC_DIR}/${QMAKE_FILE_BASE}.rpp \ && rcomp -u -m045,046,047 \ -s$${symbian_resources_RCC_DIR}/${QMAKE_FILE_BASE}.rpp \ -o$${symbianDestdir}/${QMAKE_FILE_BASE}$${QT_LIBINFIX}.rsc \ @@ -265,7 +265,7 @@ contains(TEMPLATE, "app"):!contains(CONFIG, "no_icon") { $$symbian_resources_INCLUDES \ $$symbian_resources_DEFINES \ $${baseTarget}.rss \ - -o $${symbian_resources_RCC_DIR}/$${baseTarget}.rpp \ + > $${symbian_resources_RCC_DIR}/$${baseTarget}.rpp \ && rcomp -u -m045,046,047 \ -s$${symbian_resources_RCC_DIR}/$${baseTarget}.rpp \ -o$${symbianDestdir}/$${baseTarget}.rsc \ @@ -284,7 +284,7 @@ contains(TEMPLATE, "app"):!contains(CONFIG, "no_icon") { $$symbian_resources_INCLUDES \ $$symbian_resources_DEFINES \ $${baseTarget}_reg.rss \ - -o $${symbian_resources_RCC_DIR}/$${baseTarget}_reg.rpp \ + > $${symbian_resources_RCC_DIR}/$${baseTarget}_reg.rpp \ && rcomp -u -m045,046,047 \ -s$${symbian_resources_RCC_DIR}/$${baseTarget}_reg.rpp \ -o$${symbianDestdir}/$${baseTarget}_reg.rsc \ -- cgit v0.12 From 4ee912a752a4b7f129e98e180328f1f46f053d4f Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 1 Oct 2010 13:25:28 +0200 Subject: Added support for using inputMethodHints in QInputDialog edit widget. AutoTest: Included Task: QTBUG-13200 RevBy: Denis Dzyubenko --- src/gui/dialogs/qinputdialog.cpp | 6 ++++++ src/gui/kernel/qwidget.cpp | 11 +++++++++-- src/gui/kernel/qwidget_p.h | 3 +++ tests/auto/qinputdialog/tst_qinputdialog.cpp | 20 ++++++++++++++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/gui/dialogs/qinputdialog.cpp b/src/gui/dialogs/qinputdialog.cpp index e996ee9..700b234 100644 --- a/src/gui/dialogs/qinputdialog.cpp +++ b/src/gui/dialogs/qinputdialog.cpp @@ -244,6 +244,9 @@ void QInputDialogPrivate::ensureLineEdit() Q_Q(QInputDialog); if (!lineEdit) { lineEdit = new QLineEdit(q); +#ifndef QT_NO_IM + qt_widget_private(lineEdit)->inheritsInputMethodHints = 1; +#endif lineEdit->hide(); QObject::connect(lineEdit, SIGNAL(textChanged(QString)), q, SLOT(_q_textChanged(QString))); @@ -255,6 +258,9 @@ void QInputDialogPrivate::ensureComboBox() Q_Q(QInputDialog); if (!comboBox) { comboBox = new QComboBox(q); +#ifndef QT_NO_IM + qt_widget_private(comboBox)->inheritsInputMethodHints = 1; +#endif comboBox->hide(); QObject::connect(comboBox, SIGNAL(editTextChanged(QString)), q, SLOT(_q_textChanged(QString))); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index dc0dbf4..330d699 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -273,6 +273,9 @@ QWidgetPrivate::QWidgetPrivate(int version) , isMoved(0) , isGLWidget(0) , usesDoubleBufferedGLContext(0) +#ifndef QT_NO_IM + , inheritsInputMethodHints(0) +#endif #if defined(Q_WS_X11) , picture(0) #elif defined(Q_WS_WIN) @@ -9228,9 +9231,13 @@ QVariant QWidget::inputMethodQuery(Qt::InputMethodQuery query) const */ Qt::InputMethodHints QWidget::inputMethodHints() const { - Q_D(const QWidget); #ifndef QT_NO_IM - return d->imHints; + const QWidgetPrivate *priv = d_func(); + while (priv->inheritsInputMethodHints) { + priv = priv->q_func()->parentWidget()->d_func(); + Q_ASSERT(priv); + } + return priv->imHints; #else //QT_NO_IM return 0; #endif //QT_NO_IM diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 4a79dc7..6c89659 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -748,6 +748,9 @@ public: uint isMoved : 1; uint isGLWidget : 1; uint usesDoubleBufferedGLContext : 1; +#ifndef QT_NO_IM + uint inheritsInputMethodHints : 1; +#endif // *************************** Platform specific ************************************ #if defined(Q_WS_X11) // <----------------------------------------------------------- X11 diff --git a/tests/auto/qinputdialog/tst_qinputdialog.cpp b/tests/auto/qinputdialog/tst_qinputdialog.cpp index 0d6644a..5d03142 100644 --- a/tests/auto/qinputdialog/tst_qinputdialog.cpp +++ b/tests/auto/qinputdialog/tst_qinputdialog.cpp @@ -74,6 +74,7 @@ private slots: void getItem_data(); void getItem(); void task256299_getTextReturnNullStringOnRejected(); + void inputMethodHintsOfChildWidget(); }; QString stripFraction(const QString &s) @@ -404,5 +405,24 @@ void tst_QInputDialog::getItem() delete parent; } +void tst_QInputDialog::inputMethodHintsOfChildWidget() +{ + QInputDialog dialog; + dialog.setInputMode(QInputDialog::TextInput); + QList children = dialog.children(); + QLineEdit *editWidget = 0; + for (int c = 0; c < children.size(); c++) { + editWidget = qobject_cast(children.at(c)); + if (editWidget) + break; + } + QVERIFY(editWidget); + QCOMPARE(editWidget->inputMethodHints(), dialog.inputMethodHints()); + QCOMPARE(editWidget->inputMethodHints(), Qt::ImhNone); + dialog.setInputMethodHints(Qt::ImhDigitsOnly); + QCOMPARE(editWidget->inputMethodHints(), dialog.inputMethodHints()); + QCOMPARE(editWidget->inputMethodHints(), Qt::ImhDigitsOnly); +} + QTEST_MAIN(tst_QInputDialog) #include "tst_qinputdialog.moc" -- cgit v0.12 From 0fcee2f495eb2e1c4b76aa8c3e5462595aed0ab3 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Fri, 8 Oct 2010 13:25:04 +0100 Subject: Account for native child widgets when handling focus events The code previously contained an implicit assumption that the control which received the FocusChanged event was a top-level widget. This meant that focus events delivered to native child widgets could cause unexpected changes in visibility of the statusbar and CBA. Task-number: QTBUG-13761 Reviewed-by: Jason Barron --- src/gui/kernel/qapplication_s60.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 296f24f..5ff2fd4 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1237,10 +1237,11 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */) qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle()); #ifdef Q_WS_S60 // If widget is fullscreen/minimized, hide status pane and button container otherwise show them. - const bool visible = !(qwidget->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized)); + QWidget *const window = qwidget->window(); + const bool visible = !(window->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized)); const bool statusPaneVisibility = visible; - const bool isFullscreen = qwidget->windowState() & Qt::WindowFullScreen; - const bool cbaVisibilityHint = qwidget->windowFlags() & Qt::WindowSoftkeysVisibleHint; + const bool isFullscreen = window->windowState() & Qt::WindowFullScreen; + const bool cbaVisibilityHint = window->windowFlags() & Qt::WindowSoftkeysVisibleHint; const bool buttonGroupVisibility = (visible || (isFullscreen && cbaVisibilityHint)); S60->setStatusPaneAndButtonGroupVisibility(statusPaneVisibility, buttonGroupVisibility); #endif -- cgit v0.12 From 4b73e816189d924bd499fc8b7fb29365539d5e38 Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 1 Oct 2010 14:50:52 +0200 Subject: Extended the convenience functions for QInputDialog for IM hints. Input method hints make a lot of sense when requesting specific information from the user, such as for example a URL. Therefore we include input method hints in the static convenience function. To maintain BC we need to keep the old symbol around, so a new function was added. To maintain SC, there cannot be any ambiguities when deciding which function to link to, therefore the function with the fewest arguments get to keep all the default arguments, whereas the new function gets a new explicit argument. AutoTest: Passed Task: QTBUG-13200 RevBy: Denis Dzyubenko --- src/gui/dialogs/qinputdialog.cpp | 32 ++++++++++++++++++++++++++++++-- src/gui/dialogs/qinputdialog.h | 25 ++++++++++++++++++++++--- 2 files changed, 52 insertions(+), 5 deletions(-) diff --git a/src/gui/dialogs/qinputdialog.cpp b/src/gui/dialogs/qinputdialog.cpp index 700b234..2d13c9a 100644 --- a/src/gui/dialogs/qinputdialog.cpp +++ b/src/gui/dialogs/qinputdialog.cpp @@ -1128,6 +1128,8 @@ void QInputDialog::done(int result) be entered). \a text is the default text which is placed in the line edit. \a mode is the echo mode the line edit will use. + \a inputMethodHints is the input method hints that will be used in the + edit widget if an input method is active. If \a ok is nonnull \e *\a ok will be set to true if the user pressed \gui OK and to false if the user pressed \gui Cancel. The dialog's parent @@ -1150,13 +1152,14 @@ void QInputDialog::done(int result) QString QInputDialog::getText(QWidget *parent, const QString &title, const QString &label, QLineEdit::EchoMode mode, const QString &text, bool *ok, - Qt::WindowFlags flags) + Qt::WindowFlags flags, Qt::InputMethodHints inputMethodHints) { QInputDialog dialog(parent, flags); dialog.setWindowTitle(title); dialog.setLabelText(label); dialog.setTextValue(text); dialog.setTextEchoMode(mode); + dialog.setInputMethodHints(inputMethodHints); int ret = dialog.exec(); if (ok) @@ -1169,6 +1172,17 @@ QString QInputDialog::getText(QWidget *parent, const QString &title, const QStri } /*! + \internal +*/ +// ### Qt 5: Use only the version above. +QString QInputDialog::getText(QWidget *parent, const QString &title, const QString &label, + QLineEdit::EchoMode mode, const QString &text, bool *ok, + Qt::WindowFlags flags) +{ + return getText(parent, title, label, mode, text, ok, flags, Qt::ImhNone); +} + +/*! \since 4.5 Static convenience function to get an integer input from the user. @@ -1278,6 +1292,8 @@ double QInputDialog::getDouble(QWidget *parent, const QString &title, const QStr be entered). \a items is the string list which is inserted into the combobox. \a current is the number of the item which should be the current item. + \a inputMethodHints is the input method hints that will be used if the + combobox is editable and an input method is active. If \a editable is true the user can enter their own text; otherwise the user may only select one of the existing items. @@ -1302,7 +1318,7 @@ double QInputDialog::getDouble(QWidget *parent, const QString &title, const QStr QString QInputDialog::getItem(QWidget *parent, const QString &title, const QString &label, const QStringList &items, int current, bool editable, bool *ok, - Qt::WindowFlags flags) + Qt::WindowFlags flags, Qt::InputMethodHints inputMethodHints) { QString text(items.value(current)); @@ -1312,6 +1328,7 @@ QString QInputDialog::getItem(QWidget *parent, const QString &title, const QStri dialog.setComboBoxItems(items); dialog.setTextValue(text); dialog.setComboBoxEditable(editable); + dialog.setInputMethodHints(inputMethodHints); int ret = dialog.exec(); if (ok) @@ -1324,6 +1341,17 @@ QString QInputDialog::getItem(QWidget *parent, const QString &title, const QStri } /*! + \internal +*/ +// ### Qt 5: Use only the version above. +QString QInputDialog::getItem(QWidget *parent, const QString &title, const QString &label, + const QStringList &items, int current, bool editable, bool *ok, + Qt::WindowFlags flags) +{ + return getItem(parent, title, label, items, current, editable, ok, flags, Qt::ImhNone); +} + +/*! \obsolete Use getInt() instead. diff --git a/src/gui/dialogs/qinputdialog.h b/src/gui/dialogs/qinputdialog.h index 02868c1..25e27b0 100644 --- a/src/gui/dialogs/qinputdialog.h +++ b/src/gui/dialogs/qinputdialog.h @@ -167,18 +167,37 @@ public: void setVisible(bool visible); +#ifdef Q_QDOC + static QString getText(QWidget *parent, const QString &title, const QString &label, + QLineEdit::EchoMode echo = QLineEdit::Normal, + const QString &text = QString(), bool *ok = 0, Qt::WindowFlags flags = 0, + Qt::InputMethodHints inputMethodHints = Qt::ImhNone); + static QString getItem(QWidget *parent, const QString &title, const QString &label, + const QStringList &items, int current = 0, bool editable = true, + bool *ok = 0, Qt::WindowFlags flags = 0, + Qt::InputMethodHints inputMethodHints = Qt::ImhNone); +#else static QString getText(QWidget *parent, const QString &title, const QString &label, QLineEdit::EchoMode echo = QLineEdit::Normal, const QString &text = QString(), bool *ok = 0, Qt::WindowFlags flags = 0); + static QString getItem(QWidget *parent, const QString &title, const QString &label, + const QStringList &items, int current = 0, bool editable = true, + bool *ok = 0, Qt::WindowFlags flags = 0); + static QString getText(QWidget *parent, const QString &title, const QString &label, + QLineEdit::EchoMode echo, + const QString &text, bool *ok, Qt::WindowFlags flags, + Qt::InputMethodHints inputMethodHints); + static QString getItem(QWidget *parent, const QString &title, const QString &label, + const QStringList &items, int current, bool editable, + bool *ok, Qt::WindowFlags flags, + Qt::InputMethodHints inputMethodHints); +#endif static int getInt(QWidget *parent, const QString &title, const QString &label, int value = 0, int minValue = -2147483647, int maxValue = 2147483647, int step = 1, bool *ok = 0, Qt::WindowFlags flags = 0); static double getDouble(QWidget *parent, const QString &title, const QString &label, double value = 0, double minValue = -2147483647, double maxValue = 2147483647, int decimals = 1, bool *ok = 0, Qt::WindowFlags flags = 0); - static QString getItem(QWidget *parent, const QString &title, const QString &label, - const QStringList &items, int current = 0, bool editable = true, - bool *ok = 0, Qt::WindowFlags flags = 0); // obsolete static int getInteger(QWidget *parent, const QString &title, const QString &label, int value = 0, -- cgit v0.12 From d11a15081c6385bb32ce78c8501fc259f56b2be2 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Fri, 8 Oct 2010 16:37:34 +0200 Subject: Added Q_INVOKABLE to ignore file. Task-number: QTBUG-14281 Reviewed-by: David Boddie --- tools/qdoc3/test/qt-cpp-ignore.qdocconf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/qdoc3/test/qt-cpp-ignore.qdocconf b/tools/qdoc3/test/qt-cpp-ignore.qdocconf index b78b512..5d52a47 100644 --- a/tools/qdoc3/test/qt-cpp-ignore.qdocconf +++ b/tools/qdoc3/test/qt-cpp-ignore.qdocconf @@ -71,8 +71,9 @@ Cpp.ignoretokens = QAXFACTORY_EXPORT \ QT_END_INCLUDE_NAMESPACE \ PHONON_EXPORT \ Q_DECLARATIVE_EXPORT \ - Q_GADGET \ - QWEBKIT_EXPORT + Q_GADGET \ + QWEBKIT_EXPORT \ + Q_INVOKABLE Cpp.ignoredirectives = Q_DECLARE_HANDLE \ Q_DECLARE_INTERFACE \ Q_DECLARE_METATYPE \ -- cgit v0.12 From 7702bd86f2c0a9b2dc1ddcd745445f8c3fd2602f Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 8 Oct 2010 17:05:27 +0200 Subject: Doc: Fixed qdoc warning. Reviewed-by: hjk --- src/corelib/tools/qcryptographichash.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qcryptographichash.cpp b/src/corelib/tools/qcryptographichash.cpp index f418de9..8b1464f 100644 --- a/src/corelib/tools/qcryptographichash.cpp +++ b/src/corelib/tools/qcryptographichash.cpp @@ -147,7 +147,7 @@ void QCryptographicHash::addData(const char *data, int length) } /*! - /overload + \overload */ void QCryptographicHash::addData(const QByteArray &data) { -- cgit v0.12 From 436d41eabc5c4953f578c9ca1cbfb065d6fe8612 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 8 Oct 2010 18:16:23 +0200 Subject: Doc: Fixed qdoc warnings. --- doc/src/examples/webkit-bridge-imageanalyzer.qdoc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/src/examples/webkit-bridge-imageanalyzer.qdoc b/doc/src/examples/webkit-bridge-imageanalyzer.qdoc index b8c42c6..cee2659 100644 --- a/doc/src/examples/webkit-bridge-imageanalyzer.qdoc +++ b/doc/src/examples/webkit-bridge-imageanalyzer.qdoc @@ -24,9 +24,10 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + /*! \example webkit/imageanalyzer - \startpage {index.html} {Qt Reference Documentation} + \startpage {index.html}{Qt Reference Documentation} \title The Webkit Bridge Tutorial - Hybrid Client Application In this example, we will show how to write a hybrid application using @@ -84,7 +85,7 @@ page's mainFrame with \c addToJavaScriptWindowObject(). \snippet examples/webkit/imageanalyzer/resources/index.html sample images - Clicking an image adds it to an images list. +Clicking an image adds it to an images list. \snippet examples/webkit/imageanalyzer/resources/index.html addImage -- cgit v0.12 From e8cbed0e9cb3f074405bdc67772d449e312a3b78 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 8 Oct 2010 18:37:15 +0200 Subject: Doc: Fixed documentation style and qdoc warnings. Task-number: QTBUG-12071 --- doc/src/frameworks-technologies/dnd.qdoc | 2 +- doc/src/frameworks-technologies/model-view-programming.qdoc | 12 ++++++------ src/corelib/kernel/qabstractitemmodel.cpp | 10 +++++----- src/gui/itemviews/qabstractitemview.cpp | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/doc/src/frameworks-technologies/dnd.qdoc b/doc/src/frameworks-technologies/dnd.qdoc index 56b461e..356bf9b 100644 --- a/doc/src/frameworks-technologies/dnd.qdoc +++ b/doc/src/frameworks-technologies/dnd.qdoc @@ -44,7 +44,7 @@ outlines the approach used to enable it in custom widgets. Drag and drop operations are also supported by Qt's item views and by the graphics view framework. More information is available in - \l{Using drag & drop with item views} and \l{Graphics View + \l{Using drag and drop with item views} and \l{Graphics View Framework}. \section1 Drag and Drop Classes diff --git a/doc/src/frameworks-technologies/model-view-programming.qdoc b/doc/src/frameworks-technologies/model-view-programming.qdoc index 6de567c..cc98432 100644 --- a/doc/src/frameworks-technologies/model-view-programming.qdoc +++ b/doc/src/frameworks-technologies/model-view-programming.qdoc @@ -32,7 +32,7 @@ /*! \page model-view-programming.html - \ingroup qt-basic-concepts + \ingroup qt-basic-concepts \title Model/View Programming \brief A guide to Qt's extensible model/view architecture. @@ -1635,7 +1635,7 @@ contain the text given in the search string. This pattern can also be used in the list and table widgets. - \section1 Using drag & drop with item views + \section1 Using Drag and Drop with Item Views Qt's drag and drop infrastructure is fully supported by the model/view framework. Items in lists, tables, and trees can be dragged within the views, and data can be @@ -1715,7 +1715,7 @@ of QAbstractItemModel::removeRows(), either directly or by inheriting the implementation from its base class. - \section3 Enabling drag & drop for items + \section3 Enabling drag and drop for items Models indicate to views which items can be dragged, and which will accept drops, by reimplementing the QAbstractItemModel::flags() function to provide suitable @@ -2154,7 +2154,7 @@ models to supply some unique identifier to this function to ensure that the model index can be re-associated with its corresponding item later on. - \section2 Drag & drop support and MIME type handling + \section2 Drag and drop support and MIME type handling The model/view classes support drag and drop operations, providing default behavior that is sufficient for many applications. However, it is also possible to customize @@ -2283,7 +2283,7 @@ \endlist For more information about drag and drop with item views, refer to - \l{Using drag & drop with item views}. + \l{Using drag and drop with item views}. \section3 Convenience views @@ -2294,7 +2294,7 @@ the existing contents with the data being transferred, the underlying model will set the data of the target items rather than insert new rows and columns into the model. For more information on drag and drop in convenience views, - you can see \l{Using drag & drop with item views}. + you can see \l{Using drag and drop with item views}. \section2 Performance optimization for large amounts of data diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp index 6e37aee..a0f7893 100644 --- a/src/corelib/kernel/qabstractitemmodel.cpp +++ b/src/corelib/kernel/qabstractitemmodel.cpp @@ -1197,7 +1197,7 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent, \l{QAbstractItemModel::}{endInsertRows()} must be called. \sa {Model Classes}, {Model Subclassing Reference}, QModelIndex, - QAbstractItemView, {Using drag & drop with item views}, + QAbstractItemView, {Using drag and drop with item views}, {Simple DOM Model Example}, {Simple Tree Model Example}, {Editable Tree Model Example}, {Fetch More Example} */ @@ -1760,7 +1760,7 @@ QMimeData *QAbstractItemModel::mimeData(const QModelIndexList &indexes) const where to place the data. This can occur in a tree when data is dropped on a parent. Models will usually append the data to the parent in this case. - \sa supportedDropActions(), {Using drag & drop with item views} + \sa supportedDropActions(), {Using drag and drop with item views} */ bool QAbstractItemModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) @@ -1797,7 +1797,7 @@ bool QAbstractItemModel::dropMimeData(const QMimeData *data, Qt::DropAction acti reimplement the dropMimeData() function to handle the additional operations. - \sa dropMimeData(), Qt::DropActions, {Using drag & drop with item + \sa dropMimeData(), Qt::DropActions, {Using drag and drop with item views} */ Qt::DropActions QAbstractItemModel::supportedDropActions() const @@ -1814,7 +1814,7 @@ Qt::DropActions QAbstractItemModel::supportedDropActions() const supportedDragActions() is used by QAbstractItemView::startDrag() as the default values when a drag occurs. - \sa Qt::DropActions, {Using drag & drop with item views} + \sa Qt::DropActions, {Using drag and drop with item views} */ Qt::DropActions QAbstractItemModel::supportedDragActions() const { @@ -1830,7 +1830,7 @@ Qt::DropActions QAbstractItemModel::supportedDragActions() const Sets the supported drag \a actions for the items in the model. - \sa supportedDragActions(), {Using drag & drop with item views} + \sa supportedDragActions(), {Using drag and drop with item views} */ void QAbstractItemModel::setSupportedDragActions(Qt::DropActions actions) { diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 4ffd284..95e92c9 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -1363,7 +1363,7 @@ bool QAbstractItemView::dragEnabled() const Note that the model used needs to provide support for drag and drop operations. - \sa setDragDropMode() {Using drag & drop with item views} + \sa setDragDropMode() {Using drag and drop with item views} */ /*! -- cgit v0.12 From 1966b88611bb45d18d586847eeb3597d6e022eb7 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Fri, 8 Oct 2010 18:37:25 +0200 Subject: Experimental support of the unified toolbar with the raster engine on Mac OS X. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-12615 Reviewed-by: Samuel Rødal --- src/gui/graphicsview/qgraphicsview_p.h | 2 +- src/gui/image/qnativeimage.cpp | 13 +- src/gui/kernel/qcocoaview_mac.mm | 11 +- src/gui/kernel/qt_cocoa_helpers_mac.mm | 7 + src/gui/kernel/qt_cocoa_helpers_mac_p.h | 2 + src/gui/kernel/qwidget.cpp | 14 +- src/gui/kernel/qwidget.h | 4 + src/gui/kernel/qwidget_p.h | 7 + src/gui/painting/painting.pri | 6 + src/gui/painting/qunifiedtoolbarsurface_mac.cpp | 233 ++++++++++++++++++++++++ src/gui/painting/qunifiedtoolbarsurface_mac_p.h | 95 ++++++++++ src/gui/painting/qwindowsurface.cpp | 4 +- src/gui/painting/qwindowsurface_p.h | 2 +- src/gui/painting/qwindowsurface_raster.cpp | 41 ++++- src/gui/painting/qwindowsurface_raster_p.h | 2 +- src/gui/widgets/qmainwindow.cpp | 11 +- src/gui/widgets/qmainwindowlayout_mac.mm | 12 ++ src/gui/widgets/qmainwindowlayout_p.h | 10 +- 18 files changed, 461 insertions(+), 15 deletions(-) create mode 100644 src/gui/painting/qunifiedtoolbarsurface_mac.cpp create mode 100644 src/gui/painting/qunifiedtoolbarsurface_mac_p.h diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h index 62be800..38c3bca 100644 --- a/src/gui/graphicsview/qgraphicsview_p.h +++ b/src/gui/graphicsview/qgraphicsview_p.h @@ -184,7 +184,7 @@ public: #ifdef Q_WS_MAC // QWidget::update() works slightly different on the Mac without the raster engine; // it's not part of our backing store so it needs special threatment. - if (QApplicationPrivate::graphics_system_name != "raster") { + if (QApplicationPrivate::graphics_system_name != QLatin1String("raster")) { // At this point either HIViewSetNeedsDisplay (Carbon) or setNeedsDisplay: YES (Cocoa) // is called, which means there's a pending update request. We want to dispatch it // now because otherwise graphics view updates would require two diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp index 8446387..5978a1b 100644 --- a/src/gui/image/qnativeimage.cpp +++ b/src/gui/image/qnativeimage.cpp @@ -241,8 +241,19 @@ QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool /* : image(width, height, format) { - uint cgflags = kCGImageAlphaNoneSkipFirst; + switch (format) { + case QImage::Format_ARGB32: + cgflags = kCGImageAlphaFirst; + break; + case QImage::Format_ARGB32_Premultiplied: + case QImage::Format_ARGB8565_Premultiplied: + case QImage::Format_ARGB6666_Premultiplied: + case QImage::Format_ARGB8555_Premultiplied: + case QImage::Format_ARGB4444_Premultiplied: + cgflags = kCGImageAlphaPremultipliedFirst; + break; + } #ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version cgflags |= kCGBitmapByteOrder32Host; diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 8576f52..2016d40 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -534,7 +534,7 @@ static int qCocoaViewCount = 0; return; // We use a different graphics system. - if (QApplicationPrivate::graphicsSystem() != 0) { + if (QApplicationPrivate::graphicsSystem() != 0 && !qwidgetprivate->isInUnifiedToolbar) { // Qt handles the painting occuring inside the window. // Cocoa also keeps track of all widgets as NSView and therefore might @@ -558,6 +558,15 @@ static int qCocoaViewCount = 0; CGContextRef cg = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; qwidgetprivate->hd = cg; + + // We steal the CGContext for flushing in the unified toolbar with the raster engine. + if (QApplicationPrivate::graphicsSystem() != 0 && qwidgetprivate->isInUnifiedToolbar) { + qwidgetprivate->cgContext = cg; + qwidgetprivate->hasOwnContext = true; + qwidgetprivate->unifiedSurface->flush(qwidget, qwidgetprivate->ut_rg, qwidgetprivate->ut_pt); + return; + } + CGContextSaveGState(cg); if (qwidget->isVisible() && qwidget->updatesEnabled()) { //process the actual paint event. diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 2dd3791..cce9daa 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -1561,6 +1561,13 @@ void qt_cocoaStackChildWindowOnTopOfOtherChildren(QWidget *childWidget) } } +void qt_mac_display(QWidget *widget) +{ + NSView *theNSView = qt_mac_nativeview_for(widget); + [theNSView display]; + return; +} + #endif // QT_MAC_USE_COCOA QT_END_NAMESPACE diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h index 5c23392..04c2d06 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h +++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h @@ -227,6 +227,8 @@ void qt_cocoaPostMessage(id target, SEL selector, int argCount=0, id arg1=0, id void qt_mac_post_retranslateAppMenu(); +void qt_mac_display(QWidget *widget); + QT_END_NAMESPACE #endif // QT_COCOA_HELPERS_MAC_P_H diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index cffad1d..2c31fd0 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -301,6 +301,9 @@ QWidgetPrivate::QWidgetPrivate(int version) drawRectOriginalAdded = false; originalDrawMethod = true; changeMethods = false; + hasOwnContext = false; + isInUnifiedToolbar = false; + unifiedSurface = 0; #endif // QT_MAC_USE_COCOA #ifdef QWIDGET_EXTRA_DEBUG static int count = 0; @@ -5316,6 +5319,14 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP if (rgn.isEmpty()) return; +#ifdef Q_WS_MAC + // We disable the rendering of QToolBar in the backingStore if + // it's supposed to be in the unified toolbar on Mac OS X. + if (backingStore && isInUnifiedToolbar) + return; +#endif // Q_WS_MAC + + Q_Q(QWidget); #ifndef QT_NO_GRAPHICSEFFECT if (graphicsEffect && graphicsEffect->isEnabled()) { @@ -5378,6 +5389,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP QPaintEngine *paintEngine = pdev->paintEngine(); if (paintEngine) { setRedirected(pdev, -offset); + #ifdef Q_WS_MAC // (Alien support) Special case for Mac when redirecting: If the paint device // is of the Widget type we need to set WA_WState_InPaintEvent since painting @@ -5420,7 +5432,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP //actually send the paint event QPaintEvent e(toBePainted); QCoreApplication::sendSpontaneousEvent(q, &e); -#if !defined(Q_WS_MAC) && !defined(Q_WS_QWS) +#if !defined(Q_WS_QWS) if (backingStore && !onScreen && !asRoot && (q->internalWinId() || !q->nativeParentWidget()->isWindow())) backingStore->markDirtyOnScreen(toBePainted, q, offset); #endif diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index 980f40f..81b3618 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -97,6 +97,8 @@ class QWindowSurface; class QLocale; class QGraphicsProxyWidget; class QGraphicsEffect; +class QRasterWindowSurface; +class QUnifiedToolbarSurface; #if defined(Q_WS_X11) class QX11Info; #endif @@ -758,6 +760,8 @@ private: friend OSViewRef qt_mac_nativeview_for(const QWidget *w); friend void qt_event_request_window_change(QWidget *widget); friend bool qt_mac_sendMacEventToWidget(QWidget *widget, EventRef ref); + friend class QRasterWindowSurface; + friend class QUnifiedToolbarSurface; #endif #ifdef Q_WS_QWS friend class QWSBackingStore; diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index c943bd8..1433ce3 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -840,6 +840,13 @@ public: bool originalDrawMethod; // Do we need to change the methods? bool changeMethods; + bool hasOwnContext; + CGContextRef cgContext; + QRegion ut_rg; + QPoint ut_pt; + bool isInUnifiedToolbar; + QWindowSurface *unifiedSurface; + QPoint toolbar_offset; #endif void determineWindowClass(); void transferChildren(); diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 793d380..10c6f40 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -247,6 +247,12 @@ symbian { QMAKE_CXXFLAGS.ARMCC *= -O3 } +mac { + HEADERS += painting/qunifiedtoolbarsurface_mac_p.h + SOURCES += painting/qunifiedtoolbarsurface_mac.cpp +} + + NEON_SOURCES += painting/qdrawhelper_neon.cpp NEON_HEADERS += painting/qdrawhelper_neon_p.h NEON_ASM += ../3rdparty/pixman/pixman-arm-neon-asm.S painting/qdrawhelper_neon_asm.S diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp new file mode 100644 index 0000000..722355e --- /dev/null +++ b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp @@ -0,0 +1,233 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qunifiedtoolbarsurface_mac_p.h" +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +QUnifiedToolbarSurface::QUnifiedToolbarSurface(QWidget *widget) + : QRasterWindowSurface(widget, false), d_ptr(new QUnifiedToolbarSurfacePrivate) +{ + d_ptr->image = 0; + d_ptr->inSetGeometry = false; + setStaticContentsSupport(true); + + setGeometry(QRect(QPoint(0, 0), QSize(widget->width(), 100))); // FIXME: Fix height. +} + +QUnifiedToolbarSurface::~QUnifiedToolbarSurface() +{ + if (d_ptr->image) + delete d_ptr->image; +} + +QPaintDevice *QUnifiedToolbarSurface::paintDevice() +{ + return &d_ptr->image->image; +} + +void QUnifiedToolbarSurface::recursiveRedirect(QObject *object, const QPoint &offset) +{ + if (object != 0) { + if (object->isWidgetType()) { + QWidget *widget = qobject_cast(object); + widget->d_func()->unifiedSurface = this; + widget->d_func()->isInUnifiedToolbar = true; + widget->d_func()->toolbar_offset = offset; + } + + for (int i = 0; i < object->children().size(); ++i) { + recursiveRedirect(object->children().at(i), offset); + } + } +} + +void QUnifiedToolbarSurface::insertToolbar(QWidget *toolbar, const QPoint &offset) +{ + setGeometry(QRect(QPoint(0, 0), QSize(offset.x() + toolbar->width(), 100))); // FIXME + recursiveRedirect(toolbar, offset); +// toolbar->d_func()->toolbar_offset = offset; +} + +void QUnifiedToolbarSurface::setGeometry(const QRect &rect) +{ + QWindowSurface::setGeometry(rect); + Q_D(QUnifiedToolbarSurface); + d->inSetGeometry = true; + if (d->image == 0 || d->image->width() < rect.width() || d->image->height() < rect.height()) + prepareBuffer(QImage::Format_ARGB32_Premultiplied, window()); + d->inSetGeometry = false; +} + +void QUnifiedToolbarSurface::beginPaint(const QRegion &rgn) +{ + QPainter p(&d_ptr->image->image); + p.setCompositionMode(QPainter::CompositionMode_Source); + const QVector rects = rgn.rects(); + const QColor blank = Qt::transparent; + for (QVector::const_iterator it = rects.begin(); it != rects.end(); ++it) { + p.fillRect(*it, blank); + } +} + +void QUnifiedToolbarSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &offset) +{ + Q_D(QUnifiedToolbarSurface); + + if (!d->image || rgn.rectCount() == 0) { + return; + } + + Q_UNUSED(offset); + + // Get a context for the widget. + CGContextRef context; + if (!(widget->d_func()->hasOwnContext)) { + widget->d_func()->ut_rg = rgn; + widget->d_func()->ut_pt = offset; + qt_mac_display(widget); + return; + } else { + context = widget->d_func()->cgContext; + widget->render(widget->d_func()->unifiedSurface->paintDevice(), widget->d_func()->toolbar_offset, QRegion(), QWidget::DrawChildren); + } + + CGContextSaveGState(context); + + int areaX = widget->geometry().x() + widget->d_func()->toolbar_offset.x(); + int areaY = widget->geometry().y() + widget->d_func()->toolbar_offset.y(); + int areaWidth = widget->geometry().width(); + int areaHeight = widget->geometry().height(); + const CGRect area = CGRectMake(areaX, areaY, areaWidth, areaHeight); + + // Clip to region. + const QVector &rects = rgn.rects(); + for (int i = 0; i < rects.size(); ++i) { + const QRect &rect = rects.at(i); + // CGContextAddRect(context, CGRectMake(rect.x(), rect.y(), rect.width(), rect.height())); + CGContextAddRect(context, CGRectMake(0, 0, 1000, 1000)); //FIXME: Set correct size. + } + CGContextAddRect(context, area); + CGContextClip(context); + + + CGImageRef image = CGBitmapContextCreateImage(d->image->cg); + CGImageRef subImage = CGImageCreateWithImageInRect(image, area); + + const CGRect drawingArea = CGRectMake(0, 0, areaWidth, areaHeight); + qt_mac_drawCGImage(context, &drawingArea, subImage); + + CGImageRelease(subImage); + CGImageRelease(image); + + CGContextFlush(context); + + // Restore context. + CGContextRestoreGState(context); + widget->d_func()->hasOwnContext = false; +} + +void QUnifiedToolbarSurface::prepareBuffer(QImage::Format format, QWidget *widget) +{ + Q_D(QUnifiedToolbarSurface); + + int width = geometry().width(); + int height = geometry().height(); + if (d->image) { + width = qMax(d->image->width(), width); + height = qMax(d->image->height(), height); + } + + if (width == 0 || height == 0) { + delete d->image; + d->image = 0; + return; + } + + QNativeImage *oldImage = d->image; + + d->image = new QNativeImage(width, height, format, false, widget); + + if (oldImage && d->inSetGeometry && hasStaticContents()) { + // Make sure we use the const version of bits() (no detach). + const uchar *src = const_cast(oldImage->image).bits(); + uchar *dst = d->image->image.bits(); + + const int srcBytesPerLine = oldImage->image.bytesPerLine(); + const int dstBytesPerLine = d->image->image.bytesPerLine(); + const int bytesPerPixel = oldImage->image.depth() >> 3; + + QRegion staticRegion(staticContents()); + // Make sure we're inside the boundaries of the old image. + staticRegion &= QRect(0, 0, oldImage->image.width(), oldImage->image.height()); + const QVector &rects = staticRegion.rects(); + const QRect *srcRect = rects.constData(); + + // Copy the static content of the old image into the new one. + int numRectsLeft = rects.size(); + do { + const int bytesOffset = srcRect->x() * bytesPerPixel; + const int dy = srcRect->y(); + + // Adjust src and dst to point to the right offset. + const uchar *s = src + dy * srcBytesPerLine + bytesOffset; + uchar *d = dst + dy * dstBytesPerLine + bytesOffset; + const int numBytes = srcRect->width() * bytesPerPixel; + + int numScanLinesLeft = srcRect->height(); + do { + ::memcpy(d, s, numBytes); + d += dstBytesPerLine; + s += srcBytesPerLine; + } while (--numScanLinesLeft); + + ++srcRect; + } while (--numRectsLeft); + } + + delete oldImage; +} + +QT_END_NAMESPACE diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h new file mode 100644 index 0000000..d7805e8 --- /dev/null +++ b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QUNIFIEDTOOLBARSURFACE_MAC_P_H +#define QUNIFIEDTOOLBARSURFACE_MAC_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 +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QNativeImage; + + +class QUnifiedToolbarSurfacePrivate +{ +public: + QNativeImage *image; + uint inSetGeometry : 1; +}; + +class Q_GUI_EXPORT QUnifiedToolbarSurface : public QRasterWindowSurface +{ +public: + QUnifiedToolbarSurface(QWidget *widget); + ~QUnifiedToolbarSurface(); + + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void setGeometry(const QRect &rect); + void beginPaint(const QRegion &rgn); + void insertToolbar(QWidget *toolbar, const QPoint &offset); + +private: + QPaintDevice *paintDevice(); + void prepareBuffer(QImage::Format format, QWidget *widget); + void recursiveRedirect(QObject *widget, const QPoint &offset); + + Q_DECLARE_PRIVATE(QUnifiedToolbarSurface) + QScopedPointer d_ptr; +}; + +QT_END_NAMESPACE + +#endif // QUNIFIEDTOOLBARSURFACE_MAC_P_H diff --git a/src/gui/painting/qwindowsurface.cpp b/src/gui/painting/qwindowsurface.cpp index 02a8b80..8cf3977 100644 --- a/src/gui/painting/qwindowsurface.cpp +++ b/src/gui/painting/qwindowsurface.cpp @@ -114,11 +114,11 @@ public: /*! Constructs an empty surface for the given top-level \a window. */ -QWindowSurface::QWindowSurface(QWidget *window) +QWindowSurface::QWindowSurface(QWidget *window, bool setDefaultSurface) : d_ptr(new QWindowSurfacePrivate(window)) { if (!QApplicationPrivate::runtime_graphics_system) { - if(window) + if(setDefaultSurface && window) window->setWindowSurface(this); } } diff --git a/src/gui/painting/qwindowsurface_p.h b/src/gui/painting/qwindowsurface_p.h index 6171ae8..ab84527 100644 --- a/src/gui/painting/qwindowsurface_p.h +++ b/src/gui/painting/qwindowsurface_p.h @@ -67,7 +67,7 @@ class QWindowSurfacePrivate; class Q_GUI_EXPORT QWindowSurface { public: - QWindowSurface(QWidget *window); + QWindowSurface(QWidget *window, bool setDefaultSurface = true); virtual ~QWindowSurface(); QWidget *window() const; diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp index 6a2cb1e..99f8597 100644 --- a/src/gui/painting/qwindowsurface_raster.cpp +++ b/src/gui/painting/qwindowsurface_raster.cpp @@ -64,6 +64,9 @@ #ifdef Q_WS_MAC #include +#include +#include +#include #endif QT_BEGIN_NAMESPACE @@ -82,8 +85,8 @@ public: uint inSetGeometry : 1; }; -QRasterWindowSurface::QRasterWindowSurface(QWidget *window) - : QWindowSurface(window), d_ptr(new QRasterWindowSurfacePrivate) +QRasterWindowSurface::QRasterWindowSurface(QWidget *window, bool setDefaultSurface) + : QWindowSurface(window, setDefaultSurface), d_ptr(new QRasterWindowSurfacePrivate) { #ifdef Q_WS_X11 d_ptr->gc = XCreateGC(X11->display, window->handle(), 0, 0); @@ -248,6 +251,23 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi #ifdef Q_WS_MAC + // Unified toolbar hack. + QMainWindow* mWindow = qobject_cast(widget->window()); + if (mWindow) { + QMainWindowLayout *mLayout = qobject_cast(mWindow->layout()); + QList toolbarList = mLayout->qtoolbarsInUnifiedToolbarList; + + for (int i = 0; i < toolbarList.size(); ++i) { + QToolBar* toolbar = toolbarList.at(i); + if (mLayout->toolBarArea(toolbar) == Qt::TopToolBarArea) { + QWidget* tbWidget = (QWidget*) toolbar; + if (tbWidget->d_func()->unifiedSurface) { + tbWidget->d_func()->unifiedSurface->flush(tbWidget, rgn, offset); + } + } + } + } + Q_UNUSED(offset); // Get a context for the widget. #ifndef QT_MAC_USE_COCOA @@ -318,6 +338,23 @@ void QRasterWindowSurface::setGeometry(const QRect &rect) prepareBuffer(QNativeImage::systemFormat(), window()); } d->inSetGeometry = false; +#ifdef Q_WS_MAC + QMainWindow* mWindow = qobject_cast(window()); + if (mWindow) { + QMainWindowLayout *mLayout = qobject_cast(mWindow->layout()); + QList toolbarList = mLayout->qtoolbarsInUnifiedToolbarList; + + for (int i = 0; i < toolbarList.size(); ++i) { + QToolBar* toolbar = toolbarList.at(i); + if (mLayout->toolBarArea(toolbar) == Qt::TopToolBarArea) { + QWidget* tbWidget = (QWidget*) toolbar; + if (tbWidget->d_func()->unifiedSurface) { + tbWidget->d_func()->unifiedSurface->setGeometry(rect); + } + } + } + } +#endif // Q_WS_MAC } // from qwindowsurface.cpp diff --git a/src/gui/painting/qwindowsurface_raster_p.h b/src/gui/painting/qwindowsurface_raster_p.h index 2b932a9..a7c3b9f 100644 --- a/src/gui/painting/qwindowsurface_raster_p.h +++ b/src/gui/painting/qwindowsurface_raster_p.h @@ -97,7 +97,7 @@ class QNativeImage; class Q_GUI_EXPORT QRasterWindowSurface : public QWindowSurface { public: - QRasterWindowSurface(QWidget *widget); + QRasterWindowSurface(QWidget *widget, bool setDefaultSurface = true); ~QRasterWindowSurface(); QPaintDevice *paintDevice(); diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index 4ca11b0..861cfaa 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -1516,14 +1516,19 @@ void QMainWindow::setUnifiedTitleAndToolBarOnMac(bool set) if (!isWindow() || d->useHIToolBar == set || QSysInfo::MacintoshVersion < QSysInfo::MV_10_3) return; - // ### Disable the unified toolbar when using anything but the native graphics system. - // ### Disable when using alien widgets as well - if (windowSurface() || testAttribute(Qt::WA_NativeWindow) == false) + // ### Disable when using alien widgets + if (testAttribute(Qt::WA_NativeWindow) == false) { return; + } d->useHIToolBar = set; createWinId(); // We need the hiview for down below. + // Activate the unified toolbar with the raster engine. + if (windowSurface()) { + d->layout->unifiedSurface = new QUnifiedToolbarSurface(this); + } + d->layout->updateHIToolBarStatus(); // Enabling the unified toolbar clears the opaque size grip setting, update it. d->macUpdateOpaqueSizeGrip(); diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm index 1bfc746..b2c4cea 100644 --- a/src/gui/widgets/qmainwindowlayout_mac.mm +++ b/src/gui/widgets/qmainwindowlayout_mac.mm @@ -49,6 +49,7 @@ #else #include #import +#include #endif QT_BEGIN_NAMESPACE @@ -408,6 +409,7 @@ void QMainWindowLayout::insertIntoMacToolbar(QToolBar *before, QToolBar *toolbar beforeIndex = qtoolbarsInUnifiedToolbarList.size(); int toolbarIndex = qtoolbarsInUnifiedToolbarList.indexOf(toolbar); + #ifndef QT_MAC_USE_COCOA HIToolbarRef macToolbar = NULL; if ((GetWindowToolbar(window, &macToolbar) == noErr) && !macToolbar) { @@ -444,6 +446,16 @@ void QMainWindowLayout::insertIntoMacToolbar(QToolBar *before, QToolBar *toolbar #endif } qtoolbarsInUnifiedToolbarList.insert(beforeIndex, toolbar); + + // Adding to the unified toolbar surface for the raster engine. + if (layoutState.mainWindow->windowSurface()) { + QPoint offset(0, 0); + for (int i = 0; i < beforeIndex; ++i) { + offset.setX(offset.x() + qtoolbarsInUnifiedToolbarList.at(i)->size().width()); + } + unifiedSurface->insertToolbar(toolbar, offset); + } + #ifndef QT_MAC_USE_COCOA QCFType outItem; const QObject *stupidArray[] = { toolbar, this }; diff --git a/src/gui/widgets/qmainwindowlayout_p.h b/src/gui/widgets/qmainwindowlayout_p.h index e1b981c..3eb2545 100644 --- a/src/gui/widgets/qmainwindowlayout_p.h +++ b/src/gui/widgets/qmainwindowlayout_p.h @@ -85,7 +85,11 @@ typedef HIObjectRef HIToolbarItemRef; typedef const void * CFTypeRef; typedef const struct __CFString * CFStringRef; -#endif +# ifdef QT_MAC_USE_COCOA +#include +# endif // QT_MAC_USE_COCOA + +#endif // Q_WS_MAC QT_BEGIN_NAMESPACE @@ -337,7 +341,9 @@ public: bool useHIToolBar; void syncUnifiedToolbarVisibility(); bool blockVisiblityCheck; -#endif + + QUnifiedToolbarSurface *unifiedSurface; +#endif // Q_WS_MAC }; QT_END_NAMESPACE -- cgit v0.12 From 227416bd859bca799ca1361ea1cb9b9cf9aa6977 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 8 Oct 2010 18:39:09 +0200 Subject: Doc: Removed non-ASCII characters and reformatted the text. --- doc/src/platforms/emb-hardwareacceleration.qdocinc | 280 ++++++++++----------- 1 file changed, 140 insertions(+), 140 deletions(-) diff --git a/doc/src/platforms/emb-hardwareacceleration.qdocinc b/doc/src/platforms/emb-hardwareacceleration.qdocinc index fb00e09..83ecef5 100644 --- a/doc/src/platforms/emb-hardwareacceleration.qdocinc +++ b/doc/src/platforms/emb-hardwareacceleration.qdocinc @@ -1,140 +1,140 @@ - \section1 Hardware Acceleration - - When designing applications for embedded devices there is often a - compromise between graphics effects and performance. On most - devices, you cannot have both simply because the hardware needed - for such operations just is not there. With a growing number of - devices that use hardware dedicated to graphics operations there is - less need to compromise. - - In addition to enabling dynamic graphics effects, there are two - other benefits to using graphics acceleration. One is that graphics - acceleration hardware is more power efficient than using the CPU. - The reason for this is that the CPU might require a clock speed - that is up to 20 times higher than the GPU, achieving the same - results. E.g. a typical hardware accelerated mobile graphics unit - can rasterize one or two bilinear texture fetches in one cycle, - while a software implementation takes easily more than 20 cycles. - Typical \e {System-on-a-chip} (SoC) graphics hardware generally have - a much lower clock speed and memory bandwidth, and different level - of acceleration than desktop GPUs. One example is that many GPUs - leave out transformation and lighting from the graphics pipeline - and only implements rasterization. - - Another reason to use a GPU is to offload the main CPU, either for - power saving or to perform other operations in parallel. Often - drawing speed with a GPU is not that much faster than a CPU but - the clear benefit of using the GPU is to free up the CPU to perform - other tasks which can be used to create a more responsive use - experience. - - The key to writing good applications for devices is therefore to - limit the wow factor down to what the target hardware can handle, - and to take advantage of any graphics dedicated hardware. Qt - provides several ways to both render advanced effects on the screen - and speed up your application using hardware accelerated graphics. - - \tableofcontents - - \section2 Qt for Embedded Graphics pipeline - - Qt uses QPainter for all graphics operations. By using the same API - regardless of platform, the code can be reused on different devices. - QPainter use different paint engines implemented in the QPaintEngine API to - do the actual painting. - - The QPaintEngine API provides paint engines for each window system and - painting framework supported by Qt. In regards to Qt for Embedded, this - also includes implementations for OpenGL ES versions 1.1 and 2.0, as well - as OpenVG and DirectFB(Embedded Linux only). - - By using one of these paint engines, you will be able to improve the - graphics performance of your Qt application. However, if the graphics - operations used are not supported, this might as well be a trap, slowing - down your application significantly. This all depends on what kind of - graphics operations that are supported by the target devices hardware - configuration. - - \image platformHWAcc.png - - The paint engine will direct all graphics operations supported by the - devices hardware to the GPU, and from there they are sent to the - framebuffer. Unsupported graphics operations falls back to the - QRasterPaintEngine and are handled by the CPU before sent to the - framebuffer. In the end, the operating system sends the paint updates off - to the screen/display. The fallback operation is quite expensive in regards - to memory consumption, and should be avoided. - - \section2 Hardware configuration requirements - - Before implementing any application using hardware acceleration, it is wise - to get an overview of what kind of hardware accelerated graphics operations - that are available for the target device. - - \note On devices with no hardware acceleration, Qt will use - QRasterPaintEngine, which handles the acceleration using software. On - devices supporting OpenGL ES, OpenVG or DirectFB(not supported by Windows - CE), Qt will use the - respective paint engines to accelerate painting. However, hardware - configurations that only support a limited set of hardware acceleration - features, might slow the application graphics down rather than speeding it - up when using unsupported operations that must fall back to the raster - engine. - - \section3 Different architectures - - Based on the architecture used in a device we can make a recommendation on - which hardware acceleration techniques to use. There are mainly two - different architectures on embedded devices. These are devices with a - Unified Memory Architecture (UMA), and devices with dedicated graphics - memory. Generally, high-end devices will have dedicated graphics memory. - Low-end devices will just use system memory, sometimes reserving a memory - region and sometimes not. - - In addition to this, we can categorize the devices into five types based on - the different graphics operations supported by their hardware. - - \list 1 - \o No support for graphics acceleration. - \o Support for blitter and alpha blending. - \o Support for path based 2D vector graphics. - \o Support for fixed function 3D graphics. - \o Support for programmable 3D graphics. - \endlist - - Based on these characteristics the table below recommends which paint - engines to use with the different types of hardware configurations. - - \section3 Recommended use of hardware acceleration based on hardware - - \table - \header - \o Type - \o UMA - \o Non-UMA - \row - \o \bold {None} - \o Qt Raster Engine - \o Qt Raster Engine - \row - \o \bold {Blitter} - \o DirectFB - \o DirectFB - \row - \o \bold {2D Vector} - \o OpenVG - \o OpenVG - \row - \o \bold {Fixed 3D} - \o OpenGL (ES) 1.x - \o OpenGL (ES) 1.x - \row - \o \bold {Programmable 3D} - \o OpenGL (ES) 2.x - \o OpenGL (ES) 2.x - \endtable - - \note Since the DirectFB API is quite primitive, the raster paint engine - handles most of the operations. - - \note Blitter and Alpha blending is currently not supported on Windows CE. +\section1 Hardware Acceleration + +When designing applications for embedded devices there is often a +compromise between graphics effects and performance. On most +devices, you cannot have both simply because the hardware needed +for such operations just is not there. With a growing number of +devices that use hardware dedicated to graphics operations there is +less need to compromise. + +In addition to enabling dynamic graphics effects, there are two +other benefits to using graphics acceleration. One is that graphics +acceleration hardware is more power efficient than using the CPU. +The reason for this is that the CPU might require a clock speed +that is up to 20 times higher than the GPU, achieving the same +results. E.g. a typical hardware accelerated mobile graphics unit +can rasterize one or two bilinear texture fetches in one cycle, +while a software implementation takes easily more than 20 cycles. +Typical \e {System-on-a-chip} (SoC) graphics hardware generally have +a much lower clock speed and memory bandwidth, and different level +of acceleration than desktop GPUs. One example is that many GPUs +leave out transformation and lighting from the graphics pipeline +and only implements rasterization. + +Another reason to use a GPU is to offload the main CPU, either for +power saving or to perform other operations in parallel. Often +drawing speed with a GPU is not that much faster than a CPU but +the clear benefit of using the GPU is to free up the CPU to perform +other tasks which can be used to create a more responsive use +experience. + +The key to writing good applications for devices is therefore to +limit the wow factor down to what the target hardware can handle, +and to take advantage of any graphics dedicated hardware. Qt +provides several ways to both render advanced effects on the screen +and speed up your application using hardware accelerated graphics. + +\tableofcontents + +\section2 Qt for Embedded Graphics pipeline + +Qt uses QPainter for all graphics operations. By using the same API +regardless of platform, the code can be reused on different devices. +QPainter use different paint engines implemented in the QPaintEngine API to +do the actual painting. + +The QPaintEngine API provides paint engines for each window system and +painting framework supported by Qt. In regards to Qt for Embedded, this +also includes implementations for OpenGL ES versions 1.1 and 2.0, as well +as OpenVG and DirectFB(Embedded Linux only). + +By using one of these paint engines, you will be able to improve the +graphics performance of your Qt application. However, if the graphics +operations used are not supported, this might as well be a trap, slowing +down your application significantly. This all depends on what kind of +graphics operations that are supported by the target devices hardware +configuration. + +\image platformHWAcc.png + +The paint engine will direct all graphics operations supported by the +devices hardware to the GPU, and from there they are sent to the +framebuffer. Unsupported graphics operations falls back to the +QRasterPaintEngine and are handled by the CPU before sent to the +framebuffer. In the end, the operating system sends the paint updates off +to the screen/display. The fallback operation is quite expensive in regards +to memory consumption, and should be avoided. + +\section2 Hardware configuration requirements + +Before implementing any application using hardware acceleration, it is wise +to get an overview of what kind of hardware accelerated graphics operations +that are available for the target device. + +\note On devices with no hardware acceleration, Qt will use +QRasterPaintEngine, which handles the acceleration using software. On +devices supporting OpenGL ES, OpenVG or DirectFB(not supported by Windows +CE), Qt will use the +respective paint engines to accelerate painting. However, hardware +configurations that only support a limited set of hardware acceleration +features, might slow the application graphics down rather than speeding it +up when using unsupported operations that must fall back to the raster +engine. + +\section3 Different architectures + +Based on the architecture used in a device we can make a recommendation on +which hardware acceleration techniques to use. There are mainly two +different architectures on embedded devices. These are devices with a +Unified Memory Architecture (UMA), and devices with dedicated graphics +memory. Generally, high-end devices will have dedicated graphics memory. +Low-end devices will just use system memory, sometimes reserving a memory +region and sometimes not. + +In addition to this, we can categorize the devices into five types based on +the different graphics operations supported by their hardware. + +\list 1 + \o No support for graphics acceleration. + \o Support for blitter and alpha blending. + \o Support for path based 2D vector graphics. + \o Support for fixed function 3D graphics. + \o Support for programmable 3D graphics. +\endlist + +Based on these characteristics the table below recommends which paint +engines to use with the different types of hardware configurations. + +\section3 Recommended use of hardware acceleration based on hardware + +\table + \header + \o Type + \o UMA + \o Non-UMA + \row + \o \bold {None} + \o Qt Raster Engine + \o Qt Raster Engine + \row + \o \bold {Blitter} + \o DirectFB + \o DirectFB + \row + \o \bold {2D Vector} + \o OpenVG + \o OpenVG + \row + \o \bold {Fixed 3D} + \o OpenGL (ES) 1.x + \o OpenGL (ES) 1.x + \row + \o \bold {Programmable 3D} + \o OpenGL (ES) 2.x + \o OpenGL (ES) 2.x +\endtable + +\note Since the DirectFB API is quite primitive, the raster paint engine +handles most of the operations. + +\note Blitter and Alpha blending is currently not supported on Windows CE. -- cgit v0.12 From 740b794259eb41845e7529371de3f3e20235f7b4 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 8 Oct 2010 20:11:27 +0200 Subject: Doc: Reorganized the platform and compiler notes pages. Errors and omissions will be fixed in later commits. The idea here is to merge the compiler notes into the platform notes because the platform is usually fixed and the compiler is often determined by the platform. In addition, notes about compilers are not always applicable to multiple platforms, so collating notes by compiler does not save much space, and it only makes maintenance of the notes more difficult. --- doc/src/bughowto.qdoc | 2 +- doc/src/development/developing-with-qt.qdoc | 6 +- doc/src/platforms/compiler-notes.qdoc | 269 +-------------------- doc/src/platforms/platform-notes-rtos.qdoc | 8 +- doc/src/platforms/platform-notes.qdoc | 346 +++++++++++++++++++++++----- doc/src/platforms/supported-platforms.qdoc | 5 +- doc/src/platforms/winsystem.qdoc | 4 +- 7 files changed, 311 insertions(+), 329 deletions(-) diff --git a/doc/src/bughowto.qdoc b/doc/src/bughowto.qdoc index a7b5569..1793fce 100644 --- a/doc/src/bughowto.qdoc +++ b/doc/src/bughowto.qdoc @@ -34,7 +34,7 @@ about it so that we can fix it. Before reporting a bug, please check the \l{FAQs}, \l{Platform - Notes}, and the \l{Qt Bug Tracker} on the Qt website to see + and Compiler Notes}, and the \l{Qt Bug Tracker} on the Qt website to see if the issue is already known. The first thing you should do is to sign up for an account for diff --git a/doc/src/development/developing-with-qt.qdoc b/doc/src/development/developing-with-qt.qdoc index 3972b59..6793abd 100644 --- a/doc/src/development/developing-with-qt.qdoc +++ b/doc/src/development/developing-with-qt.qdoc @@ -81,8 +81,8 @@ \o \l {Compiler Notes} \o \l {Developing Qt Applications for Mac OS X} \o \l {Known Issues} - \o \l {Platform Notes} - \o \l {Platform Notes - Symbian} + \o \l {Platform and Compiler Notes} + \o \l {Platform and Compiler Notes - Symbian} \o \l {ActiveX in Qt} \o \l {Qt for Embedded Linux Classes} \o \l {Qt for Embedded Platforms} @@ -112,4 +112,4 @@ \endtable -*/ \ No newline at end of file +*/ diff --git a/doc/src/platforms/compiler-notes.qdoc b/doc/src/platforms/compiler-notes.qdoc index 5ff3112..fb534df 100644 --- a/doc/src/platforms/compiler-notes.qdoc +++ b/doc/src/platforms/compiler-notes.qdoc @@ -31,273 +31,14 @@ \title Compiler Notes \brief Information about the C++ compilers and tools used to build Qt. - This page contains information about the C++ compilers and tools used - to build Qt on various platforms. + This page used to contain information about the C++ compilers and tools + used to build Qt on various platforms. This information is now maintained + in the \l{Platform and Compiler Notes} for each platform. - \tableofcontents - - Please refer to the \l{Platform Notes} for information on the platforms - Qt is currently known to run on, and see the \l{Supported Platforms} - page for information about the status of each platform. + Please refer to the \l{Supported Platforms} page for information about the + status of each platform. If you have anything to add to this list or any of the platform or compiler-specific pages, please submit it via the \l{Bug Report Form} or through the \l{Public Qt Repository}. - - \section1 Supported Features - - Not all compilers used to build Qt are able to compile all modules. The following table - shows the compiler support for five modules that are not uniformly available for all - platforms and compilers. - - \table - \header \o Compiler \o{5,1} Features - \header \o \o Concurrent \o XmlPatterns \o WebKit(*) \o CLucene \o Phonon - \row \o g++ 3.3 \o \o \bold{X} \o \o \bold{X} \o \bold{X} - \row \o g++ 3.4 and up \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} - \row - \row \o SunCC 5.5 \o \o \o \o \bold{X} \o \bold{X} - \row - \row \o aCC series 3 \o \o \o \o \bold{X} \o \bold{X} - \row \o aCC series 6 \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} - \row \o xlC 6 \o \o \o \o \bold{X} \o \bold{X} - \row \o Intel CC 10 \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} - \row - \row \o MSVC 2003 \o \bold{X} \o \bold{X} \o \o \bold{X} \o \bold{X} - \row \o MSVC 2005 and up \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} - \endtable - - * WebKit is only supported as a dynamically built library. Static linkage is not supported. - - \target GCC - \section1 GCC - - \section2 GCC on Windows (MinGW) - - We have tested Qt with this compiler on Windows XP. - The minimal version of MinGW supported is: - - \list - \o GCC 3.4.2 - \o MinGW runtime 3.7 - \o win32api 3.2 - \o binutils 2.15.91 - \o mingw32-make 3.80.0-3 - \endlist - - \note For users of the MinGW binary package: This package is now - based on MinGW 4.4. The installer no longer offers to download - MinGW for you, but rather offers to use a version of MinGW that - you already have installed on your machine. You just tell the - installer which directory MinGW is installed in. If you don't - already have MinGW 4.4 installed, you can download a .zip archive - from our \l{ftp://ftp.trolltech.com/misc/MinGW-gcc440_1.zip} {ftp - site}. This archive provides fixes to MinGW and support for - missing API, See the _patches directory in the archive for - details. - - \note A MinGW installation is only needed to build against the - binary pacakge, not to run the pre-compiled binaries that are in - the package. - - \section2 GCC 4.0.0 - - The released package of the compiler has some bugs that lead to - miscompilations. We recommend using GCC 4.0.1 or later, or to use - a recent CVS snapshot of the GCC 4.0 branch. The version of GCC - 4.0.0 that is shipped with Mac OS X 10.4 "Tiger" is known to work - with Qt for Mac OS X. - - \section2 HP-UX - - The hpux-g++ platform is tested with GCC 3.4.4. - - \section2 Solaris - - Please use GCC 3.4.2 or later. - Please not that WebKit is not supported for Solaris, regardless of which compiler is used. - - \section2 Mac OS X - - Please use the latest GCC 3.3 from Apple or a later version of GCC 3. - The gcc 3.3 that is provided with Xcode 1.5 is known to generate bad code. - Use the November 2004 GCC 3.3 updater \l{http://connect.apple.com}{available from Apple}. - - \section2 GCC 3.4.6 (Debian 3.4.6-5) on AMD64 (x86_64) - - This compiler is known to miscompile some parts of Qt when doing a - release build. There are several workarounds: - - \list 1 - \o Use a debug build instead. - \o For each miscompilation encountered, recompile the file, removing the -O2 option. - \o Add -fno-gcse to the QMAKE_CXXFLAGS_RELEASE. - \endlist - - \section1 HP ANSI C++ (aCC) - - The hpux-acc-32 and hpux-acc-64 platforms are tested with aCC A.03.57. The - hpuxi-acc-32 and hpuxi-acc-64 platforms are tested with aCC A.06.10. - - \section1 Intel C++ Compiler - - Qt supports the Intel C++ compiler on both Windows and Linux. - However, there are a few issues on Linux (see the following - section). - - \section2 Intel C++ Compiler for Linux - - Nokia currently tests the following compilers: - - \list - - \o Intel(R) C++ Compiler for applications running on IA-32, - Version 10.1 Build 20080602 Package ID: l_cc_p_10.1.017 - - \o Intel(R) C++ Compiler for applications running on Intel(R) 64, - Version 10.1 Build 20080602 Package ID: l_cc_p_10.1.017 - - \endlist - - We do not currently test the IA-64 (Itanium) compiler. - - \section2 Known Issues with Intel C++ Compiler for Linux - - \list - - \o Precompiled header support does not work in version 10.0.025 - and older. For these compilers, you should configure Qt with - -no-pch. Precompiled header support works properly in version - 10.0.026 and later. - \o Version 10.0.026 for Intel 64 is known to miscompile qmake when - building in release mode. For now, configure Qt with - -debug. Version 10.1.008 and later can compile qmake in release - mode. - \o Versions 10.1.008 to 10.1.015 for both IA-32 and Intel 64 are - known crash with "(0): internal error: 0_47021" when compiling - QtXmlPatterns, QtWebKit, and Designer in release mode. Version - 10.1.017 compiles these modules correctly in release mode. - \endlist - - \section2 Intel C++ Compiler (Windows, Altix) - - Qt 4 has been tested successfully with: - - \list - \o Windows - Intel(R) C++ Compiler for 32-bit applications, - Version 9.1.040. - \o Altix - Intel(R) C++ Itanium(R) Compiler for Itanium(R)-based - applications Version 8.1 Build 20050406 Package ID: l_cc_pc_8.1.030 - \endlist - - We currently only test the Intel compiler on 32-bit Windows versions. - - \section1 MIPSpro (IRIX) - - \bold{IRIX is an unsupported platform. See the \l{Supported Platforms} page - and Qt's Software's online \l{Platform Support Policy} page for details.} - - Qt 4.4.x requires MIPSpro version 7.4.2m. - - Note that MIPSpro version 7.4.4m is currently not supported, since it has - introduced a number of problems that have not yet been resolved. - We recommend using 7.4.2m for Qt development. However, please note the - unsupported status of this platform. - - \target Sun Studio - \section1 Forte Developer / Sun Studio (Solaris) - - \section2 Sun Studio - - Qt is tested using Sun Studio 12 (Sun CC 5.9). Go to - \l{Sun Studio Patches} page on Sun's Web site to download - the latest patches for your Sun compiler. - - Please note that Qt 4.6 is stricter in its STL requirements and - that the default STL implementation used by Sun CC does not pass - those requirements. This does not affect binary compatibility and - you can continue to use STL in your own code, but Qt's - STL-compatibility functions will be disabled. - - Sun CC ships with a secondary STL implementation (called stlport4) - which is standards-compliant and can be used by Qt. You can enable - it by passing the -library=stlport4 option to the compiler. Note - that this does not affect Qt's binary compatibility, but it may - affect that of other libraries and programs that use STL. - - \section2 Sun WorkShop 5.0 - - Sun WorkShop 5.0 is not supported with Qt 4. - - \section1 Visual Studio (Windows) - - We do most of our Windows development on Windows XP, using Microsoft - Visual Studio .NET 2005 and Visual Studio 2008 (both the 32- and 64-bit - versions). - - Qt works with the Standard Edition, the Professional Edition and Team - System Edition of Visual Studio 2005. - - In order to use Qt with the Visual Studio 2005/2008 Express Edition you need - to download and install the platform SDK. Due to limitations in the - Express Edition it is not possible for us to install the Qt Visual - Studio Integration. You will need to use our command line tools to - build Qt applications with this edition. - - The Visual C++ Linker doesn't understand filenames with spaces (as in - \c{C:\Program files\Qt\}) so you will have to move it to another place, - or explicitly set the path yourself; for example: - - \snippet doc/src/snippets/code/doc_src_compiler-notes.qdoc 0 - - If you are experiencing strange problems with using special flags that - modify the alignment of structure and union members (such as \c{/Zp2}) - then you will need to recompile Qt with the flags set for the - application as well. - - If you're using Visual Studio .NET (2002) Standard Edition, you should be - using the Qt binary package provided, and not the source package. - As the Standard Edition does not optimize compiled code, your compiled - version of Qt would perform suboptimally with respect to speed. - - With Visual Studio 2005 Service Pack 1 a bug was introduced which - causes Qt not to compile, this has been fixed with a hotfix available - from Microsoft. See this - \l{http://qt.nokia.com/developer/faqs/faq.2006-12-18.3281869860}{Knowledge Base entry} - for more information. - - There currently is a problem when compiling Qt with Visual Studio 2010 for 64-bit. - Its optimizer causes trouble and generates code that crashes for the release builds. - To avoid the crashes, You need to apply the hotfix in the following article - http://support.microsoft.com/kb/2280741. - - \section1 IBM xlC (AIX) - - The makeC++SharedLib utility must be in your PATH and be up to date to - build shared libraries. From IBM's - \l{http://www.redbooks.ibm.com/abstracts/sg245674.html}{C and C++ Application Development on AIX} - Redbook: - - \list - \o "The second step is to use the makeC++SharedLib command to create the - shared object. The command has many optional arguments, but in its - simplest form, can be used as follows:" - \snippet doc/src/snippets/code/doc_src_compiler-notes.qdoc 1 - \o "The full path name to the command is not required; however, to avoid - this, you will have to add the directory in which it is located to - your PATH environment variable. The command is located in the - /usr/vacpp/bin directory with the VisualAge C++ Professional for AIX, - Version 5 compiler." - \endlist - - \section2 VisualAge C++ for AIX, Version 6.0 - - Make sure you have the - \l{http://www-1.ibm.com/support/search.wss?rs=32&tc=SSEP5D&dc=D400}{latest upgrades} - installed. - - \section2 GCCE (Symbian) - - GCCE cannot be used to compile Qt libaries for the Symbian platform, but GCCE is supported - when compiling Qt applications for Symbian platform. */ diff --git a/doc/src/platforms/platform-notes-rtos.qdoc b/doc/src/platforms/platform-notes-rtos.qdoc index 4a34ece..8c30701 100644 --- a/doc/src/platforms/platform-notes-rtos.qdoc +++ b/doc/src/platforms/platform-notes-rtos.qdoc @@ -27,8 +27,8 @@ /*! \page platform-notes-vxworks.html - \title Platform Notes - VxWorks - \contentspage Platform Notes + \title Platform and Compiler Notes - VxWorks + \contentspage Platform and Compiler Notes \target VxWorks \note VxWorks is a community supported platform. See the @@ -143,8 +143,8 @@ /*! \page platform-notes-qnx.html - \title Platform Notes - QNX - \contentspage Platform Notes + \title Platform and Compiler Notes - QNX + \contentspage Platform and Compiler Notes \target QNX \note QNX is a community supported platform. See the diff --git a/doc/src/platforms/platform-notes.qdoc b/doc/src/platforms/platform-notes.qdoc index dff1b5b..dbedc1d 100644 --- a/doc/src/platforms/platform-notes.qdoc +++ b/doc/src/platforms/platform-notes.qdoc @@ -39,35 +39,91 @@ /*! \page platform-notes.html \ingroup platform-specific - \title Platform Notes + \title Platform and Compiler Notes \brief Information about the platforms on which Qt can be used. This page contains information about the platforms Qt is currently known to run on, with links to platform-specific notes, including any known bugs or incompatibilities. + Information about the combinations of platforms and compilers + supported by Qt can be found on the \l{Supported Platforms} page. + \list - \o \l{Platform Notes - X11} - \tableofcontents{1 Platform Notes - X11} - \o \l{Platform Notes - Windows} - \tableofcontents{1 Platform Notes - Windows} - \o \l{Platform Notes - Mac OS X} - \tableofcontents{1 Platform Notes - Mac OS X} - \o \l{Platform Notes - Symbian} - \tableofcontents{1 Platform Notes - Symbian} - \o \l{Platform Notes - Embedded Linux} - \tableofcontents{1 Platform Notes - Embedded Linux} - \o \l{Platform Notes - Windows CE} - \tableofcontents{1 Platform Notes - Windows CE} - \o \l{Platform Notes - QNX} - \tableofcontents{1 Platform Notes - QNX} - \o \l{Platform Notes - VxWorks} - \tableofcontents{1 Platform Notes - VxWorks} + \o \l{Platform and Compiler Notes - X11} + \tableofcontents{1 Platform and Compiler Notes - X11} + \o \l{Platform and Compiler Notes - Windows} + \tableofcontents{1 Platform and Compiler Notes - Windows} + \o \l{Platform and Compiler Notes - Mac OS X} + \tableofcontents{1 Platform and Compiler Notes - Mac OS X} + \o \l{Platform and Compiler Notes - Symbian} + \tableofcontents{1 Platform and Compiler Notes - Symbian} + \o \l{Platform and Compiler Notes - Embedded Linux} + \tableofcontents{1 Platform and Compiler Notes - Embedded Linux} + \o \l{Platform and Compiler Notes - Windows CE} + \tableofcontents{1 Platform and Compiler Notes - Windows CE} + \o \l{Platform and Compiler Notes - QNX} + \tableofcontents{1 Platform and Compiler Notes - QNX} + \o \l{Platform and Compiler Notes - VxWorks} + \tableofcontents{1 Platform and Compiler Notes - VxWorks} \endlist - See also the \l{Compiler Notes} for information about compiler-specific - build issues. Information about the combinations of platforms and compilers - supported by Qt can be found on the \l{Supported Platforms} page. + \section1 General Compiler Notes + + \section2 Supported Features + + Not all compilers used to build Qt are able to compile all modules. The following table + shows the compiler support for five modules that are not uniformly available for all + platforms and compilers. + + \table + \header \o Compiler \o{5,1} Features + \header \o \o Concurrent \o XmlPatterns \o WebKit(*) \o CLucene \o Phonon + \row \o g++ 3.3 \o \o \bold{X} \o \o \bold{X} \o \bold{X} + \row \o g++ 3.4 and up \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} + \row + \row \o SunCC 5.5 \o \o \o \o \bold{X} \o \bold{X} + \row + \row \o aCC series 3 \o \o \o \o \bold{X} \o \bold{X} + \row \o aCC series 6 \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} + \row \o xlC 6 \o \o \o \o \bold{X} \o \bold{X} + \row \o Intel CC 10 \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} + \row + \row \o MSVC 2003 \o \bold{X} \o \bold{X} \o \o \bold{X} \o \bold{X} + \row \o MSVC 2005 and up \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} + \endtable + + * WebKit is only supported as a dynamically built library. Static linkage is not supported. + + \section2 GCC 3.4.6 (Debian 3.4.6-5) on AMD64 (x86_64) + + This compiler is known to miscompile some parts of Qt when doing a + release build. There are several workarounds: + + \list 1 + \o Use a debug build instead. + \o For each miscompilation encountered, recompile the file, removing the \c{-O2} option. + \o Add \c{-fno-gcse} to the + \l{qmake Variable Reference#QMAKE_CXXFLAGS_RELEASE}{QMAKE_CXXFLAGS_RELEASE} qmake + variable. + \endlist + + \section2 GCC 4.0.0 + + The released package of the compiler has some bugs that lead to + miscompilations. We recommend using GCC 4.0.1 or later, or to use + a recent CVS snapshot of the GCC 4.0 branch. The version of GCC + 4.0.0 that is shipped with Mac OS X 10.4 "Tiger" is known to work + with Qt for Mac OS X. + + \section2 Intel C++ Compiler + + Qt supports the Intel C++ compiler on both Windows and Linux. + However, there are a few issues on Linux; see + \l{Platform and Compiler Notes - X11#Intel C++ Compiler for Linux}{Intel C++ Compiler for Linux} + for details. + + \section1 Feedback and Corrections If you have anything to add to this list or any of the platform or compiler-specific pages, please submit it via the \l{Bug Report Form} @@ -76,8 +132,8 @@ /*! \page platform-notes-x11.html - \title Platform Notes - X11 - \contentspage Platform Notes + \title Platform and Compiler Notes - X11 + \contentspage Platform and Compiler Notes This page contains information about the X11 platforms Qt is currently known to run on, with links to platform-specific notes. More information @@ -89,8 +145,7 @@ \target AIX \section1 AIX - 5.2 - Qt has been tested on AIX 5.2, using the - \l{Compiler Notes#IBM xlC (AIX)}{xlC} compiler. + Qt has been tested on AIX 5.2, using the xlC compiler. \table \header \o Compiler \o Notes @@ -113,13 +168,38 @@ either \c{-no-stl} or \c{-no-largefile}. \endtable + \section2 IBM xlC + + The makeC++SharedLib utility must be in your PATH and be up to date to + build shared libraries. From IBM's + \l{http://www.redbooks.ibm.com/abstracts/sg245674.html}{C and C++ Application Development on AIX} + Redbook: + + \list + \o "The second step is to use the makeC++SharedLib command to create the + shared object. The command has many optional arguments, but in its + simplest form, can be used as follows:" + \snippet doc/src/snippets/code/doc_src_compiler-notes.qdoc 1 + \o "The full path name to the command is not required; however, to avoid + this, you will have to add the directory in which it is located to + your PATH environment variable. The command is located in the + /usr/vacpp/bin directory with the VisualAge C++ Professional for AIX, + Version 5 compiler." + \endlist + + \section2 VisualAge C++ for AIX, Version 6.0 + + Make sure you have the + \l{http://www-1.ibm.com/support/search.wss?rs=32&tc=SSEP5D&dc=D400}{latest upgrades} + installed. + \target FreeBSD \section1 FreeBSD - 6.0-RELEASE \note FreeBSD is a community supported platform. See the \l{Supported Platforms} page for more information. - The system compiler on FreeBSD 4.x is gcc 2.95.4, which is not + The system compiler on FreeBSD 4.x is GCC 2.95.4, which is not officially supported by Qt 4. We develop using and recommend ports/lang/gcc34. You will need to run configure with the \c{-platform freebsd-g++34} arguments. Optionally, you may use @@ -132,7 +212,6 @@ Note that we do not actively test FreeBSD 4.x and 5.x. Our developers migrated to 6.x after the Qt 4 launch. FreeBSD-CURRENT is not supported. - \target HP-UX \section1 HP-UX Qt supports HP-UX on both PA-RISC and the Itanium (IA64) architectures. @@ -140,17 +219,26 @@ \section2 PA-RISC - B.11.11 or later You can configure Qt for aCC in 32 and 64 bit mode (hpux-acc-64 or - hpux-acc-32), or gcc in 32 bit mode (hpux-g++). The default platform is + hpux-acc-32), or GCC in 32 bit mode (hpux-g++). The default platform is hpux-acc-32. The minimum required version for aCC (HP ANSI C++) on PA-RISC - is A.03.57. The supported gcc compiler is gcc 3.4.3. + is A.03.57. The supported GCC compiler is GCC 3.4.3. \section2 Itanium - B.11.23 or later You can configure Qt for aCC in 32 and 64 bit mode (hpuxi-acc-64 or - hpuxi-acc-32). gcc is currently unsupported. The default platform is + hpuxi-acc-32). GCC is currently unsupported. The default platform is hpuxi-acc-64. The minimum required version for aCC (HP ANSI C++) on Itanium is A.06.12. + \section2 HP ANSI C++ (aCC) + + The hpux-acc-32 and hpux-acc-64 platforms are tested with aCC A.03.57. The + hpuxi-acc-32 and hpuxi-acc-64 platforms are tested with aCC A.06.10. + + \section2 GCC + + The hpux-g++ platform is tested with GCC 3.4.4. + \section2 OpenGL Support Qt's \l{QtOpenGL}{OpenGL} module requires GLX 1.3 or later to be installed. @@ -161,20 +249,29 @@ \target IRIX \section1 IRIX - 6.5.x - \bold{IRIX is an unsupported platform - please see Qt's online - \l{Platform Support Policy} for details.} + \bold{IRIX is an unsupported platform. See the \l{Supported Platforms} page + and Qt's Software's online \l{Platform Support Policy} page for details.} Unpackaging and IRIX tar: Because of long filenames some files will be cut off incorrectly with IRIX tar. Please use GNU tar to unpack Qt packages. + \section2 MIPSpro + + Qt 4.4.x requires MIPSpro version 7.4.2m. + + Note that MIPSpro version 7.4.4m is currently not supported, since it has + introduced a number of problems that have not yet been resolved. + We recommend using 7.4.2m for Qt development. However, please note the + unsupported status of this platform. + \section1 Linux There are no known problems with using Qt on production versions of Linux/x86, Linux/ppc, Linux/amd64 and Linux/ia64 (including Altix(R)). - For the gcc/g++ compiler, please also see the relevant - \l{Compiler Notes#GCC}{compiler page}. + For the GCC compiler, please also see the relevant + \l{Platform and Compiler Notes#General Compiler Notes}{General Compiler Notes}. \section2 Installation problems @@ -198,6 +295,40 @@ "Failed Dependency". Use the \c{--nodeps} option to \c rpm to workaround this problem. + \section2 Intel C++ Compiler for Linux + + Nokia currently tests the following compilers: + + \list + + \o Intel(R) C++ Compiler for applications running on IA-32, + Version 10.1 Build 20080602 Package ID: l_cc_p_10.1.017 + + \o Intel(R) C++ Compiler for applications running on Intel(R) 64, + Version 10.1 Build 20080602 Package ID: l_cc_p_10.1.017 + + \endlist + + We do not currently test the IA-64 (Itanium) compiler. + + \section2 Known Issues with Intel C++ Compiler for Linux + + \list + + \o Precompiled header support does not work in version 10.0.025 + and older. For these compilers, you should configure Qt with + -no-pch. Precompiled header support works properly in version + 10.0.026 and later. + \o Version 10.0.026 for Intel 64 is known to miscompile qmake when + building in release mode. For now, configure Qt with + -debug. Version 10.1.008 and later can compile qmake in release + mode. + \o Versions 10.1.008 to 10.1.015 for both IA-32 and Intel 64 are + known crash with "(0): internal error: 0_47021" when compiling + QtXmlPatterns, QtWebKit, and Designer in release mode. Version + 10.1.017 compiles these modules correctly in release mode. + \endlist + \target Solaris \section1 Solaris - 9 or later @@ -207,25 +338,50 @@ to truncate long filenames. We recommend using star instead (http://star.berlios.de). - \section2 CC on Solaris + Please note that WebKit is not supported for Solaris, regardless of + which compiler is used. + + \section2 CC - Be sure to check our \l{Compiler Notes#Sun Studio}{Forte Developer / Sun Studio} - notes. + See the notes for \l{Forte Developer / Sun Studio}. - \section2 GCC on Solaris + \section2 GCC + + Please use GCC 3.4.2 or later. - Be sure to check the installation notes for \l{GCC on Solaris}. Do not use GCC with Sun's assembler/linker, this will result in link-time errors in shared libraries. Use GNU binutils instead. GCC 3.2.* is known to miscompile Qt due to an optimizer bug that will - cause the resulting binaries to hang. Please use GCC 3.4.2 or later. + cause the resulting binaries to hang. + + \section2 Forte Developer / Sun Studio + + Qt is tested using Sun Studio 12 (Sun CC 5.9). Go to + \l{Sun Studio Patches} page on Sun's Web site to download + the latest patches for your Sun compiler. + + Please note that Qt 4.6 is stricter in its STL requirements and + that the default STL implementation used by Sun CC does not pass + those requirements. This does not affect binary compatibility and + you can continue to use STL in your own code, but Qt's + STL-compatibility functions will be disabled. + + Sun CC ships with a secondary STL implementation (called stlport4) + which is standards-compliant and can be used by Qt. You can enable + it by passing the -library=stlport4 option to the compiler. Note + that this does not affect Qt's binary compatibility, but it may + affect that of other libraries and programs that use STL. + + \section2 Sun WorkShop 5.0 + + Sun WorkShop 5.0 is not supported with Qt 4. */ /*! \page platform-notes-windows.html - \title Platform Notes - Windows - \contentspage Platform Notes + \title Platform and Compiler Notes - Windows + \contentspage Platform and Compiler Notes This page contains information about the Windows platforms Qt is currently known to run on, with links to platform-specific notes. More information @@ -255,12 +411,87 @@ and other applications that require screen grabbing while direct rendering is enabled. Other GL-applications may not work as expected, unless direct rendering is disabled. + + \section2 GCC (MinGW) + + We have tested Qt with this compiler on Windows XP. + The minimal version of MinGW supported is GCC 4.4. + + \note For users of the MinGW binary package: This package is now + based on MinGW 4.4. The installer no longer offers to download + MinGW for you, but rather offers to use a version of MinGW that + you already have installed on your machine. You just tell the + installer which directory MinGW is installed in. If you don't + already have MinGW 4.4 installed, you can download a .zip archive + from our \l{ftp://ftp.trolltech.com/misc/MinGW-gcc440_1.zip}{FTP + site}. This archive provides fixes to MinGW and support for + missing API, See the _patches directory in the archive for + details. + + \note A MinGW installation is only needed to build against the + binary pacakge, not to run the pre-compiled binaries that are in + the package. + + \section2 Intel C++ Compiler (Windows, Altix) + + Qt 4 has been tested successfully with: + + \list + \o Windows - Intel(R) C++ Compiler for 32-bit applications, + Version 9.1.040. + \o Altix - Intel(R) C++ Itanium(R) Compiler for Itanium(R)-based + applications Version 8.1 Build 20050406 Package ID: l_cc_pc_8.1.030 + \endlist + + We currently only test the Intel compiler on 32-bit Windows versions. + + \section2 Visual Studio (Windows) + + We do most of our Windows development on Windows XP, using Microsoft + Visual Studio .NET 2005 and Visual Studio 2008 (both the 32- and 64-bit + versions). + + Qt works with the Standard Edition, the Professional Edition and Team + System Edition of Visual Studio 2005. + + In order to use Qt with the Visual Studio 2005/2008 Express Edition you need + to download and install the platform SDK. Due to limitations in the + Express Edition it is not possible for us to install the Qt Visual + Studio Integration. You will need to use our command line tools to + build Qt applications with this edition. + + The Visual C++ Linker doesn't understand filenames with spaces (as in + \c{C:\Program files\Qt\}) so you will have to move it to another place, + or explicitly set the path yourself; for example: + + \snippet doc/src/snippets/code/doc_src_compiler-notes.qdoc 0 + + If you are experiencing strange problems with using special flags that + modify the alignment of structure and union members (such as \c{/Zp2}) + then you will need to recompile Qt with the flags set for the + application as well. + + If you're using Visual Studio .NET (2002) Standard Edition, you should be + using the Qt binary package provided, and not the source package. + As the Standard Edition does not optimize compiled code, your compiled + version of Qt would perform suboptimally with respect to speed. + + With Visual Studio 2005 Service Pack 1 a bug was introduced which + causes Qt not to compile, this has been fixed with a hotfix available + from Microsoft. See this + \l{http://qt.nokia.com/developer/faqs/faq.2006-12-18.3281869860}{Knowledge Base entry} + for more information. + + There currently is a problem when compiling Qt with Visual Studio 2010 for 64-bit. + Its optimizer causes trouble and generates code that crashes for the release builds. + To avoid the crashes, You need to apply the hotfix in the following article + http://support.microsoft.com/kb/2280741. */ /*! \page platform-notes-mac.html - \title Platform Notes - Mac OS X - \contentspage Platform Notes + \title Platform and Compiler Notes - Mac OS X + \contentspage Platform and Compiler Notes This page contains information about the Mac OS X versions Qt is currently known to run on, with links to platform-specific notes. More information @@ -287,11 +518,15 @@ \section2 Required GCC version - Apple's gcc 4 that is shipped with the Xcode Tools for both Mac OS X 10.4 - and 10.5 will compile Qt. There is preliminary support for gcc 4.2 which + Apple's GCC 4 that is shipped with the Xcode Tools for both Mac OS X 10.4 + and 10.5 will compile Qt. There is preliminary support for GCC 4.2 which is included with Xcode Tools 3.1+ (configurable with \c{-platform macx-g++42}). + Please use the latest GCC 3.3 from Apple or a later version of GCC 3. + The GCC 3.3 that is provided with Xcode 1.5 is known to generate bad code. + Use the November 2004 GCC 3.3 updater \l{http://connect.apple.com}{available from Apple}. + \section2 Binary Package The binary package requires that you have your .qt-license file in your @@ -300,7 +535,7 @@ this file in the email they receive. The binary package was built on Mac OS X 10.4 with Xcode Tools 2.1 - (gcc 4.0.0) for Qt 4.1.0, Xcode Tools 2.2 (gcc 4.0.1) for Qt 4.1.1-4.1.4 + (GCC 4.0.0) for Qt 4.1.0, Xcode Tools 2.2 (GCC 4.0.1) for Qt 4.1.1-4.1.4 and Xcode Tools 2.3 for 4.2.0. It will only link executables built against 10.4 (or a 10.4 SDK). You should be able to run applications linked against these frameworks on Mac OS X 10.3.9 and Mac OS X 10.4+. @@ -374,8 +609,8 @@ /*! \page platform-notes-windows-ce.html - \title Platform Notes - Windows CE - \contentspage Platform Notes + \title Platform and Compiler Notes - Windows CE + \contentspage Platform and Compiler Notes This page contains information about the Windows CE and Windows Mobile platforms Qt is currently known to run on, with links to platform-specific @@ -385,8 +620,8 @@ /*! \page platform-notes-symbian.html - \title Platform Notes - Symbian - \contentspage Platform Notes + \title Platform and Compiler Notes - Symbian + \contentspage Platform and Compiler Notes \ingroup platform-specific \brief Information about the state of support for the Symbian platform. @@ -468,6 +703,13 @@ for Phonon. \endtable + \section1 Compiler Notes + + \section2 GCCE (Symbian) + + GCCE cannot be used to compile Qt libaries for the Symbian platform, but GCCE is supported + when compiling Qt applications for the Symbian platform. + \section1 Known Issues Known issues can be found by visiting the @@ -580,8 +822,8 @@ /*! \page platform-notes-embedded-linux.html - \title Platform Notes - Embedded Linux - \contentspage Platform Notes + \title Platform and Compiler Notes - Embedded Linux + \contentspage Platform and Compiler Notes This page contains information about the Embedded Linux platforms Qt is currently known to run on, with links to platform-specific notes. More diff --git a/doc/src/platforms/supported-platforms.qdoc b/doc/src/platforms/supported-platforms.qdoc index 31866c4..4918e18 100644 --- a/doc/src/platforms/supported-platforms.qdoc +++ b/doc/src/platforms/supported-platforms.qdoc @@ -44,9 +44,8 @@ \tableofcontents - Information about the specific platforms Qt runs on can be found on the - \l{Platform Notes} page. Information about the compilers used on each platform - can be found on the \l{Compiler Notes} page. + Information about the specific platforms Qt runs on, and the compilers used + on each platform, can be found on the \l{Platform and Compiler Notes} page. \section1 Tier 1 Platforms diff --git a/doc/src/platforms/winsystem.qdoc b/doc/src/platforms/winsystem.qdoc index 2919bb7..64e35c5 100644 --- a/doc/src/platforms/winsystem.qdoc +++ b/doc/src/platforms/winsystem.qdoc @@ -44,8 +44,8 @@ \tableofcontents For information about which platforms are supported by Qt, see the - \l{Platform Notes}. For information on distributing Qt applications, see - \l{Deploying Qt Applications}. + \l{Platform and Compiler Notes}. For information on distributing Qt + applications, see \l{Deploying Qt Applications}. \target x11 \section1 Qt for X11 -- cgit v0.12 From 868ab8bbe563427d6f742dbc48b10cc483257d3a Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Sat, 9 Oct 2010 14:36:21 +0200 Subject: Added missing QtWebKit example files and some whitespace fixes. --- examples/webkit/imageanalyzer/imageanalyzer.cpp | 8 +- examples/webkit/imageanalyzer/imageanalyzer.h | 73 +++++------ examples/webkit/imageanalyzer/mainwindow.h | 21 ++-- .../imageanalyzer/resources/imageanalyzer.qrc | 10 ++ examples/webkit/imageanalyzer/resources/index.html | 133 +++++++++++++++++++++ 5 files changed, 198 insertions(+), 47 deletions(-) create mode 100644 examples/webkit/imageanalyzer/resources/imageanalyzer.qrc create mode 100644 examples/webkit/imageanalyzer/resources/index.html diff --git a/examples/webkit/imageanalyzer/imageanalyzer.cpp b/examples/webkit/imageanalyzer/imageanalyzer.cpp index c663cf3..1d0ee45 100644 --- a/examples/webkit/imageanalyzer/imageanalyzer.cpp +++ b/examples/webkit/imageanalyzer/imageanalyzer.cpp @@ -57,7 +57,7 @@ //! [ ImageAnalyzer - Constructor ] ImageAnalyzer::ImageAnalyzer(QNetworkDiskCache* netcache, QObject* parent) -: QObject(parent), m_cache(netcache), m_outstandingFetches(0) + : QObject(parent), m_cache(netcache), m_outstandingFetches(0) { /* ImageAnalyzer only wants to receive http responses for requests that it makes, so that's why it has its own @@ -69,11 +69,11 @@ ImageAnalyzer::ImageAnalyzer(QNetworkDiskCache* netcache, QObject* parent) m_network->setCache(m_cache); QObject::connect(m_network, SIGNAL(finished(QNetworkReply*)), - this, SLOT(handleReply(QNetworkReply*))); + this, SLOT(handleReply(QNetworkReply*))); QObject::connect(m_watcher, SIGNAL(finished()), - this, SLOT(doneProcessing())); + this, SLOT(doneProcessing())); QObject::connect(m_watcher, SIGNAL(progressValueChanged(int)), - this, SLOT(progressStatus(int))); + this, SLOT(progressStatus(int))); } //! [ ImageAnalyzer - Constructor ] ImageAnalyzer::~ImageAnalyzer() diff --git a/examples/webkit/imageanalyzer/imageanalyzer.h b/examples/webkit/imageanalyzer/imageanalyzer.h index f228c0e..1bb25dc 100644 --- a/examples/webkit/imageanalyzer/imageanalyzer.h +++ b/examples/webkit/imageanalyzer/imageanalyzer.h @@ -47,48 +47,53 @@ class QNetworkAccessManager; class QNetworkReply; class QNetworkDiskCache; + //! [ ImageAnalyzer - public interface ] class ImageAnalyzer : public QObject { Q_OBJECT - public: - ImageAnalyzer(QNetworkDiskCache * netcache, QObject * parent=0); +public: + ImageAnalyzer(QNetworkDiskCache * netcache, QObject * parent=0); + + QRgb lastResults(); + float lastRed(); + float lastGreen(); + float lastBlue(); + bool isBusy(); + Q_PROPERTY(bool busy READ isBusy); + Q_PROPERTY(float red READ lastRed); + Q_PROPERTY(float green READ lastGreen); + Q_PROPERTY(float blue READ lastBlue); + ~ImageAnalyzer(); + +public slots: + /*! initiates analysis of all the urls in the list */ + void startAnalysis(const QStringList & urls); + +signals: + void finishedAnalysis(); + void updateProgress(int completed, int total); + //! [ ImageAnalyzer - public interface ] + +private slots: + void handleReply(QNetworkReply*); + void doneProcessing(); + void progressStatus(int); - QRgb lastResults(); - float lastRed(); - float lastGreen(); - float lastBlue(); - bool isBusy(); - Q_PROPERTY(bool busy READ isBusy); - Q_PROPERTY(float red READ lastRed); - Q_PROPERTY(float green READ lastGreen); - Q_PROPERTY(float blue READ lastBlue); - ~ImageAnalyzer(); - public slots: - /*! initiates analysis of all the urls in the list */ - void startAnalysis(const QStringList & urls); - signals: - void finishedAnalysis(); - void updateProgress(int completed, int total); -//! [ ImageAnalyzer - public interface ] - private slots: - void handleReply(QNetworkReply*); - void doneProcessing(); - void progressStatus(int); private: - QRgb processImages(); - void fetchURLs(); - void queueImage(QImage img); + QRgb processImages(); + void fetchURLs(); + void queueImage(QImage img); -//! [ ImageAnalyzer - private members ] + //! [ ImageAnalyzer - private members ] private: - QNetworkAccessManager* m_network; - QNetworkDiskCache* m_cache; - QStringList m_URLQueue; - QList m_imageQueue; - int m_outstandingFetches; - QFutureWatcher * m_watcher; -//! [ ImageAnalyzer - private members ] + QNetworkAccessManager* m_network; + QNetworkDiskCache* m_cache; + QStringList m_URLQueue; + QList m_imageQueue; + int m_outstandingFetches; + QFutureWatcher * m_watcher; + //! [ ImageAnalyzer - private members ] }; QRgb averageRGB(const QImage &img); diff --git a/examples/webkit/imageanalyzer/mainwindow.h b/examples/webkit/imageanalyzer/mainwindow.h index 4c6b950..076e586 100644 --- a/examples/webkit/imageanalyzer/mainwindow.h +++ b/examples/webkit/imageanalyzer/mainwindow.h @@ -41,8 +41,8 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include +#include class ImageAnalyzer; class QNetworkDiskCache; @@ -50,14 +50,17 @@ class QNetworkDiskCache; class MainWin : public QWebView { Q_OBJECT + +public: + explicit MainWin(QWidget * parent = 0); + +private: + ImageAnalyzer * m_analyzer; + QNetworkAccessManager * m_network; + QNetworkDiskCache * m_cache; + +private slots: + void addJSObject(); - public: - explicit MainWin(QWidget * parent = 0); - private: - ImageAnalyzer * m_analyzer; - QNetworkAccessManager * m_network; - QNetworkDiskCache * m_cache; - private slots: - void addJSObject(); }; #endif diff --git a/examples/webkit/imageanalyzer/resources/imageanalyzer.qrc b/examples/webkit/imageanalyzer/resources/imageanalyzer.qrc new file mode 100644 index 0000000..fe9a5df --- /dev/null +++ b/examples/webkit/imageanalyzer/resources/imageanalyzer.qrc @@ -0,0 +1,10 @@ + + + index.html + images/mtRainier.jpg + images/bellaCoola.jpg + images/trees.jpg + images/flower.jpg + images/seaShell.jpg + + diff --git a/examples/webkit/imageanalyzer/resources/index.html b/examples/webkit/imageanalyzer/resources/index.html new file mode 100644 index 0000000..6532951 --- /dev/null +++ b/examples/webkit/imageanalyzer/resources/index.html @@ -0,0 +1,133 @@ + + + + +
+
+
Images to be analyzed:
+ +
+ +
+
+ +
+
+

Image Analyzer

+
+
+

Status: Idle

+
+ Latest Results:
+ Red: n/a
+ Green: n/a
+ Blue: n/a
+
+

Click on images below to select for analysis

+
+
+ +
+
+ + + + + + +
+ + + + + + + -- cgit v0.12 From f0c1f381af7d6338ded9f65d00ed54b1b9405ba9 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Sat, 9 Oct 2010 17:28:06 +0200 Subject: Add missing data for the autotest of in-place conversion for Pixmap The commit 4d974ff0a748b22e668a4cb7ef38101122c85b3b uses an new image which was not commited with the patch. --- .../loadFromData/designer_indexed8_no_alpha_animated.gif | Bin 0 -> 4075 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha_animated.gif diff --git a/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha_animated.gif b/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha_animated.gif new file mode 100644 index 0000000..86a3a2e Binary files /dev/null and b/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha_animated.gif differ -- cgit v0.12 From dc5299e1a59e066e4b804c081114edaa8b104438 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Sat, 9 Oct 2010 17:28:06 +0200 Subject: Add missing data for the autotest of in-place conversion for Pixmap The commit 4d974ff0a748b22e668a4cb7ef38101122c85b3b uses an new image which was not commited with the patch. (cherry picked from commit f0c1f381af7d6338ded9f65d00ed54b1b9405ba9) --- .../loadFromData/designer_indexed8_no_alpha_animated.gif | Bin 0 -> 4075 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha_animated.gif diff --git a/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha_animated.gif b/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha_animated.gif new file mode 100644 index 0000000..86a3a2e Binary files /dev/null and b/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha_animated.gif differ -- cgit v0.12 From 6f596b07a7c035b36bc1005a83b283057669e4ac Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Fri, 8 Oct 2010 14:21:10 +0200 Subject: Avoid in-place convertion of images with multiple references The decoding from image reader was assuming the image reader do not keep the image internally. This is not true for the GIF plugins because the previous image can be used to compose the current image. This was causing crash on ARM because the 16 bits color depth causes the image memory to be reduce by half. When the plugin was accessing the memory, it assumes the images has not changed and is on 32 bits. This patch disable the in-place conversion if a detach is required. Regular conversion is the correct solution in this case, and it can also be made faster by converting while copying. Reviewed-by: Andreas Kling (cherry picked from commit 4d974ff0a748b22e668a4cb7ef38101122c85b3b) --- src/gui/image/qimage.cpp | 4 ++++ tests/auto/qpixmap/tst_qpixmap.cpp | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index ac148ee..1157b93 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -6607,6 +6607,10 @@ bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFla if (format == newFormat) return true; + // No in-place conversion if we have to detach + if (ref > 1) + return false; + const InPlace_Image_Converter *const converterPtr = &inplace_converter_map[format][newFormat]; InPlace_Image_Converter converter = *converterPtr; if (converter) diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 8005ec5..24cbb21 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -179,6 +179,7 @@ private slots: void fromImageReader_data(); void fromImageReader(); + void fromImageReaderAnimatedGif_data(); void fromImageReaderAnimatedGif(); void preserveDepth(); @@ -1605,6 +1606,8 @@ void tst_QPixmap::fromImageReader_data() QTest::newRow("designer_indexed8_no_alpha.gif") << prefix + "/designer_indexed8_no_alpha.gif"; QTest::newRow("designer_indexed8_with_alpha.gif") << prefix + "/designer_indexed8_with_alpha.gif"; QTest::newRow("designer_rgb32.jpg") << prefix + "/designer_rgb32.jpg"; + QTest::newRow("designer_indexed8_with_alpha_animated") << prefix + "/designer_indexed8_with_alpha_animated.gif"; + QTest::newRow("designer_indexed8_with_alpha_animated") << prefix + "/designer_indexed8_no_alpha_animated.gif"; } void tst_QPixmap::fromImageReader() @@ -1621,14 +1624,22 @@ void tst_QPixmap::fromImageReader() QVERIFY(pixmapsAreEqual(&pixmapWithCopy, &directLoadingPixmap)); } +void tst_QPixmap::fromImageReaderAnimatedGif_data() +{ + QTest::addColumn("imagePath"); + QTest::newRow("gif with alpha") << QString::fromLatin1("/designer_indexed8_with_alpha_animated.gif"); + QTest::newRow("gif without alpha") << QString::fromLatin1("/designer_indexed8_no_alpha_animated.gif"); +} + void tst_QPixmap::fromImageReaderAnimatedGif() { + QFETCH(QString, imagePath); #ifdef Q_OS_SYMBIAN const QString prefix = QLatin1String(SRCDIR) + "loadFromData"; #else const QString prefix = QLatin1String(SRCDIR) + "/loadFromData"; #endif - const QString path = prefix + QString::fromLatin1("/designer_indexed8_with_alpha_animated.gif"); + const QString path = prefix + imagePath; QImageReader referenceReader(path); QImageReader pixmapReader(path); -- cgit v0.12 From aa7fa8608939676ba56e130214b85f5d0c3745df Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 11 Oct 2010 11:24:05 +1000 Subject: Add a declarative callback for when a QObject's objectName changes Task-number: QTBUG-13999 Reviewed-by: Martin Jones --- src/corelib/kernel/qobject.cpp | 6 ++++++ src/corelib/kernel/qobject_p.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 8330e47..579c225 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -127,6 +127,7 @@ extern "C" Q_CORE_EXPORT void qt_removeObject(QObject *) void (*QAbstractDeclarativeData::destroyed)(QAbstractDeclarativeData *, QObject *) = 0; void (*QAbstractDeclarativeData::parentChanged)(QAbstractDeclarativeData *, QObject *, QObject *) = 0; +void (*QAbstractDeclarativeData::objectNameChanged)(QAbstractDeclarativeData *, QObject *) = 0; QObjectData::~QObjectData() {} @@ -1094,7 +1095,12 @@ QString QObject::objectName() const void QObject::setObjectName(const QString &name) { Q_D(QObject); + bool objectNameChanged = d->declarativeData && d->objectName != name; + d->objectName = name; + + if (objectNameChanged) + d->declarativeData->objectNameChanged(d->declarativeData, this); } diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h index 4800e6a..814769c 100644 --- a/src/corelib/kernel/qobject_p.h +++ b/src/corelib/kernel/qobject_p.h @@ -89,6 +89,7 @@ class Q_CORE_EXPORT QAbstractDeclarativeData public: static void (*destroyed)(QAbstractDeclarativeData *, QObject *); static void (*parentChanged)(QAbstractDeclarativeData *, QObject *, QObject *); + static void (*objectNameChanged)(QAbstractDeclarativeData *, QObject *); }; class Q_CORE_EXPORT QObjectPrivate : public QObjectData -- cgit v0.12 From e11ee40cefc981fbdcfb10816039d4efb080fb17 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 11 Oct 2010 10:26:34 +1000 Subject: Don't give focus to a FocusScope that has had focus explicitly cleared. If focus was explicitly cleared on a non-visible FocusScope, and then it was made visible, it would incorrectly grab focus. Task-number: QTBUG-13380 --- src/gui/graphicsview/qgraphicsitem.cpp | 16 ++++++++----- src/gui/graphicsview/qgraphicsitem_p.h | 2 +- .../qdeclarativefocusscope/data/qtBug13380.qml | 24 ++++++++++++++++++++ .../tst_qdeclarativefocusscope.cpp | 26 ++++++++++++++++++++++ tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 3 +++ 5 files changed, 64 insertions(+), 7 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativefocusscope/data/qtBug13380.qml diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 60cd020..e63acac 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -2365,7 +2365,7 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo while (fsi->d_ptr->focusScopeItem && fsi->d_ptr->focusScopeItem->isVisible()) fsi = fsi->d_ptr->focusScopeItem; fsi->d_ptr->setFocusHelper(Qt::OtherFocusReason, /* climb = */ true, - /* focusFromShow = */ true); + /* focusFromHide = */ false); } break; } @@ -2375,6 +2375,10 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo QGraphicsItem *fi = subFocusItem; if (fi && fi != scene->focusItem()) { scene->setFocusItem(fi); + } else if (flags & QGraphicsItem::ItemIsFocusScope && + !scene->focusItem() && + q->isAncestorOf(scene->d_func()->lastFocusItem)) { + q_ptr->setFocus(); } } } else { @@ -2385,7 +2389,7 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo if (p->flags() & QGraphicsItem::ItemIsFocusScope) { if (p->d_ptr->visible) { p->d_ptr->setFocusHelper(Qt::OtherFocusReason, /* climb = */ true, - /* focusFromShow = */ true); + /* focusFromHide = */ true); } break; } @@ -3245,13 +3249,13 @@ bool QGraphicsItem::hasFocus() const */ void QGraphicsItem::setFocus(Qt::FocusReason focusReason) { - d_ptr->setFocusHelper(focusReason, /* climb = */ true, /* focusFromShow = */ false); + d_ptr->setFocusHelper(focusReason, /* climb = */ true, /* focusFromHide = */ false); } /*! \internal */ -void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool climb, bool focusFromShow) +void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool climb, bool focusFromHide) { // Disabled / unfocusable items cannot accept focus. if (!q_ptr->isEnabled() || !(flags & QGraphicsItem::ItemIsFocusable)) @@ -3272,7 +3276,7 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim if (p->flags() & QGraphicsItem::ItemIsFocusScope) { QGraphicsItem *oldFocusScopeItem = p->d_ptr->focusScopeItem; p->d_ptr->focusScopeItem = q_ptr; - if (!p->focusItem() && !focusFromShow) { + if (!p->focusItem() && !focusFromHide) { if (oldFocusScopeItem) oldFocusScopeItem->d_ptr->focusScopeItemChange(false); focusScopeItemChange(true); @@ -3334,7 +3338,7 @@ void QGraphicsItemPrivate::clearFocusHelper(bool giveFocusToParent) while (p) { if (p->flags() & QGraphicsItem::ItemIsFocusScope) { p->d_ptr->setFocusHelper(Qt::OtherFocusReason, /* climb = */ false, - /* focusFromShow = */ false); + /* focusFromHide = */ false); return; } p = p->d_ptr->parent; diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index c8a7699..8480c19 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -477,7 +477,7 @@ public: inline void markParentDirty(bool updateBoundingRect = false); - void setFocusHelper(Qt::FocusReason focusReason, bool climb, bool focusFromShow); + void setFocusHelper(Qt::FocusReason focusReason, bool climb, bool focusFromHide); void clearFocusHelper(bool giveFocusToParent); void setSubFocus(QGraphicsItem *rootItem = 0); void clearSubFocus(QGraphicsItem *rootItem = 0); diff --git a/tests/auto/declarative/qdeclarativefocusscope/data/qtBug13380.qml b/tests/auto/declarative/qdeclarativefocusscope/data/qtBug13380.qml new file mode 100644 index 0000000..1784202 --- /dev/null +++ b/tests/auto/declarative/qdeclarativefocusscope/data/qtBug13380.qml @@ -0,0 +1,24 @@ +import QtQuick 1.0 + +Rectangle { + width: 400; height: 400 + + property bool showRect: false + onShowRectChanged: if (showRect) rect.visible = true + property bool noFocus: !fs2.activeFocus + + FocusScope { + id: fs1 + focus: true + } + Rectangle { + id: rect + visible: false + FocusScope { + id: fs2 + Rectangle { + focus: true + } + } + } +} diff --git a/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp b/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp index ec8f048..4cafbd9 100644 --- a/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp +++ b/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp @@ -70,6 +70,7 @@ private slots: void forceFocus(); void noParentFocus(); void signalEmission(); + void qtBug13380(); }; /* @@ -400,6 +401,31 @@ void tst_qdeclarativefocusscope::signalEmission() delete view; } +void tst_qdeclarativefocusscope::qtBug13380() +{ + QDeclarativeView *view = new QDeclarativeView; + view->setSource(QUrl::fromLocalFile(SRCDIR "/data/qtBug13380.qml")); + + view->show(); + QVERIFY(view->rootObject()); + qApp->setActiveWindow(view); + qApp->processEvents(); + +#ifdef Q_WS_X11 + // to be safe and avoid failing setFocus with window managers + qt_x11_wait_for_window_manager(view); +#endif + + QVERIFY(view->hasFocus()); + QVERIFY(view->scene()->hasFocus()); + QVERIFY(view->rootObject()->property("noFocus").toBool()); + + view->rootObject()->setProperty("showRect", true); + QVERIFY(view->rootObject()->property("noFocus").toBool()); + + delete view; +} + QTEST_MAIN(tst_qdeclarativefocusscope) #include "tst_qdeclarativefocusscope.moc" diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 2901dd5..2ddccd2 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -9065,6 +9065,9 @@ void tst_QGraphicsItem::focusScope() scope2->hide(); scope2->show(); QVERIFY(!scope2->hasFocus()); + QVERIFY(scope1->hasFocus()); + scope2->setFocus(); + scope3->setFocus(); QVERIFY(scope3->hasFocus()); QGraphicsRectItem *rect4 = new QGraphicsRectItem; -- cgit v0.12 From f69eeec7030a5df12803a9128819207e3fc5bead Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 11 Oct 2010 11:43:59 +1000 Subject: Install the declarative objectNameChanged callback Task-number: QTBUG-13999 --- src/declarative/qml/qdeclarativedata_p.h | 2 ++ src/declarative/qml/qdeclarativeengine.cpp | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/declarative/qml/qdeclarativedata_p.h b/src/declarative/qml/qdeclarativedata_p.h index e916273..c7857b7 100644 --- a/src/declarative/qml/qdeclarativedata_p.h +++ b/src/declarative/qml/qdeclarativedata_p.h @@ -82,10 +82,12 @@ public: static inline void init() { QAbstractDeclarativeData::destroyed = destroyed; QAbstractDeclarativeData::parentChanged = parentChanged; + QAbstractDeclarativeData::objectNameChanged = objectNameChanged; } static void destroyed(QAbstractDeclarativeData *, QObject *); static void parentChanged(QAbstractDeclarativeData *, QObject *, QObject *); + static void objectNameChanged(QAbstractDeclarativeData *, QObject *); void destroyed(QObject *); void parentChanged(QObject *, QObject *); diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 0749767..dfc29c4 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -468,6 +468,10 @@ void QDeclarativeData::parentChanged(QAbstractDeclarativeData *d, QObject *o, QO static_cast(d)->parentChanged(o, p); } +void QDeclarativeData::objectNameChanged(QAbstractDeclarativeData *d, QObject *o) +{ +} + void QDeclarativeEnginePrivate::init() { Q_Q(QDeclarativeEngine); -- cgit v0.12 From 759da9b325f19670a3d79ede5f06fb3fa1f95495 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 11 Oct 2010 12:07:24 +1000 Subject: Allow objectName to be used in QML bindings Task-number: QTBUG-13999 --- src/declarative/qml/qdeclarativedata_p.h | 18 +++++++-- src/declarative/qml/qdeclarativeengine.cpp | 43 ++++++++++++++++++---- src/declarative/qml/qdeclarativefastproperties.cpp | 9 +++++ .../qml/qdeclarativeobjectscriptclass.cpp | 9 ++++- .../qdeclarativeecmascript/data/objectName.qml | 8 ++++ .../tst_qdeclarativeecmascript.cpp | 19 ++++++++++ 6 files changed, 93 insertions(+), 13 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/objectName.qml diff --git a/src/declarative/qml/qdeclarativedata_p.h b/src/declarative/qml/qdeclarativedata_p.h index c7857b7..def4188 100644 --- a/src/declarative/qml/qdeclarativedata_p.h +++ b/src/declarative/qml/qdeclarativedata_p.h @@ -64,6 +64,7 @@ class QDeclarativeAbstractBinding; class QDeclarativeContext; class QDeclarativePropertyCache; class QDeclarativeContextData; +class QDeclarativeNotifier; // This class is structured in such a way, that simply zero'ing it is the // default state for elemental object allocations. This is crucial in the // workings of the QDeclarativeInstruction::CreateSimpleObject instruction. @@ -75,7 +76,7 @@ public: : ownMemory(true), ownContext(false), indestructible(true), explicitIndestructibleSet(false), context(0), outerContext(0), bindings(0), nextContextObject(0), prevContextObject(0), bindingBitsSize(0), bindingBits(0), lineNumber(0), columnNumber(0), deferredComponent(0), deferredIdx(0), - attachedProperties(0), scriptValue(0), objectDataRefCount(0), propertyCache(0), guards(0) { + scriptValue(0), objectDataRefCount(0), propertyCache(0), guards(0), extendedData(0) { init(); } @@ -91,6 +92,7 @@ public: void destroyed(QObject *); void parentChanged(QObject *, QObject *); + void objectNameChanged(QObject *); void setImplicitDestructible() { if (!explicitIndestructibleSet) indestructible = false; @@ -125,8 +127,6 @@ public: QDeclarativeCompiledData *deferredComponent; // Can't this be found from the context? unsigned int deferredIdx; - QHash *attachedProperties; - // ### Can we make this QScriptValuePrivate so we incur no additional allocation // cost? QScriptValue *scriptValue; @@ -149,6 +149,18 @@ public: return 0; } } + + QDeclarativeNotifier *objectNameNotifier() const; + QHash *attachedProperties() const; + + struct ExtendedData { + ExtendedData(); + ~ExtendedData(); + + QHash attachedProperties; + void *objectNameNotifier; + }; + mutable ExtendedData *extendedData; }; template diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index dfc29c4..7ed925a 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -68,6 +68,7 @@ #include "private/qdeclarativelist_p.h" #include "private/qdeclarativetypenamecache_p.h" #include "private/qdeclarativeinclude_p.h" +#include "private/qdeclarativenotifier_p.h" #include #include @@ -470,6 +471,7 @@ void QDeclarativeData::parentChanged(QAbstractDeclarativeData *d, QObject *o, QO void QDeclarativeData::objectNameChanged(QAbstractDeclarativeData *d, QObject *o) { + static_cast(d)->objectNameChanged(o); } void QDeclarativeEnginePrivate::init() @@ -953,7 +955,7 @@ QObject *qmlAttachedPropertiesObjectById(int id, const QObject *object, bool cre if (!data) return 0; // Attached properties are only on objects created by QML - QObject *rv = data->attachedProperties?data->attachedProperties->value(id):0; + QObject *rv = data->extendedData?data->attachedProperties()->value(id):0; if (rv || !create) return rv; @@ -963,11 +965,8 @@ QObject *qmlAttachedPropertiesObjectById(int id, const QObject *object, bool cre rv = pf(const_cast(object)); - if (rv) { - if (!data->attachedProperties) - data->attachedProperties = new QHash(); - data->attachedProperties->insert(id, rv); - } + if (rv) + data->attachedProperties()->insert(id, rv); return rv; } @@ -988,8 +987,6 @@ void QDeclarativeData::destroyed(QObject *object) { if (deferredComponent) deferredComponent->release(); - if (attachedProperties) - delete attachedProperties; if (nextContextObject) nextContextObject->prevContextObject = prevContextObject; @@ -1023,6 +1020,9 @@ void QDeclarativeData::destroyed(QObject *object) if (scriptValue) delete scriptValue; + if (extendedData) + delete extendedData; + if (ownMemory) delete this; } @@ -1032,6 +1032,11 @@ void QDeclarativeData::parentChanged(QObject *, QObject *parent) if (!parent && scriptValue) { delete scriptValue; scriptValue = 0; } } +void QDeclarativeData::objectNameChanged(QObject *) +{ + if (extendedData) objectNameNotifier()->notify(); +} + bool QDeclarativeData::hasBindingBit(int bit) const { if (bindingBitsSize > bit) @@ -1068,6 +1073,28 @@ void QDeclarativeData::setBindingBit(QObject *obj, int bit) bindingBits[bit / 32] |= (1 << (bit % 32)); } +QDeclarativeData::ExtendedData::ExtendedData() +: objectNameNotifier(0) +{ +} + +QDeclarativeData::ExtendedData::~ExtendedData() +{ + ((QDeclarativeNotifier *)&objectNameNotifier)->~QDeclarativeNotifier(); +} + +QDeclarativeNotifier *QDeclarativeData::objectNameNotifier() const +{ + if (!extendedData) extendedData = new ExtendedData; + return (QDeclarativeNotifier *)&extendedData->objectNameNotifier; +} + +QHash *QDeclarativeData::attachedProperties() const +{ + if (!extendedData) extendedData = new ExtendedData; + return &extendedData->attachedProperties; +} + /*! Creates a QScriptValue allowing you to use \a object in QML script. \a engine is the QDeclarativeEngine it is to be created in. diff --git a/src/declarative/qml/qdeclarativefastproperties.cpp b/src/declarative/qml/qdeclarativefastproperties.cpp index eb69b6a..78e3afd 100644 --- a/src/declarative/qml/qdeclarativefastproperties.cpp +++ b/src/declarative/qml/qdeclarativefastproperties.cpp @@ -51,10 +51,19 @@ QT_BEGIN_NAMESPACE // primarily read from bindings is a candidate for inclusion as a fast // property. +static void QObject_objectName(QObject *object, void *output, QDeclarativeNotifierEndpoint *endpoint) +{ + if (endpoint) + endpoint->connect(QDeclarativeData::get(object, true)->objectNameNotifier()); + *((QString *)output) = object->objectName(); +} + QDeclarativeFastProperties::QDeclarativeFastProperties() { add(&QDeclarativeItem::staticMetaObject, QDeclarativeItem::staticMetaObject.indexOfProperty("parent"), QDeclarativeItemPrivate::parentProperty); + add(&QObject::staticMetaObject, QObject::staticMetaObject.indexOfProperty("objectName"), + QObject_objectName); } int QDeclarativeFastProperties::accessorIndexForProperty(const QMetaObject *metaObject, int propertyIndex) diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index ab6ff74..61a1f55 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -239,8 +239,13 @@ QDeclarativeObjectScriptClass::property(QObject *obj, const Identifier &name) } } else { if (enginePriv->captureProperties && !(lastData->flags & QDeclarativePropertyCache::Data::IsConstant)) { - enginePriv->capturedProperties << - QDeclarativeEnginePrivate::CapturedProperty(obj, lastData->coreIndex, lastData->notifyIndex); + if (lastData->coreIndex == 0) { + enginePriv->capturedProperties << + QDeclarativeEnginePrivate::CapturedProperty(QDeclarativeData::get(obj, true)->objectNameNotifier()); + } else { + enginePriv->capturedProperties << + QDeclarativeEnginePrivate::CapturedProperty(obj, lastData->coreIndex, lastData->notifyIndex); + } } if (QDeclarativeValueTypeFactory::isValueType((uint)lastData->propType)) { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/objectName.qml b/tests/auto/declarative/qdeclarativeecmascript/data/objectName.qml new file mode 100644 index 0000000..ca8c90d --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/objectName.qml @@ -0,0 +1,8 @@ +import QtQuick 1.0 + +QtObject { + objectName: "hello" + + property string test1: objectName + property string test2: objectName.substr(1, 3) +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 4feb630..02832f3 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -162,6 +162,7 @@ private slots: void deleteLater(); void in(); void sharedAttachedObject(); + void objectName(); void include(); @@ -2594,6 +2595,24 @@ void tst_qdeclarativeecmascript::sharedAttachedObject() delete o; } +// QTBUG-13999 +void tst_qdeclarativeecmascript::objectName() +{ + QDeclarativeComponent component(&engine, TEST_FILE("objectName.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test1").toString(), QString("hello")); + QCOMPARE(o->property("test2").toString(), QString("ell")); + + o->setObjectName("world"); + + QCOMPARE(o->property("test1").toString(), QString("world")); + QCOMPARE(o->property("test2").toString(), QString("orl")); + + delete o; +} + QTEST_MAIN(tst_qdeclarativeecmascript) #include "tst_qdeclarativeecmascript.moc" -- cgit v0.12 From e67800d9e0dc82a38b01c9b8eff4dc1a10f306d8 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 11 Oct 2010 13:29:04 +1000 Subject: Test for absent qmldir Task-number: QTBUG-13051 --- .../qtest/declarative/qmllanguage/noqmldir/Test.qml | 2 ++ .../auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp | 1 + 2 files changed, 3 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/noqmldir/Test.qml diff --git a/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/noqmldir/Test.qml b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/noqmldir/Test.qml new file mode 100644 index 0000000..0b054d0 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/noqmldir/Test.qml @@ -0,0 +1,2 @@ +import QtQuick 1.0 +Rectangle { } diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 6a45957..be04dee 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -1569,6 +1569,7 @@ void tst_qdeclarativelanguage::basicRemote_data() QString serverdir = "http://127.0.0.1:14447/qtest/declarative/qmllanguage/"; QTest::newRow("no need for qmldir") << QUrl(serverdir+"Test.qml") << "" << ""; + QTest::newRow("absent qmldir") << QUrl(serverdir+"/noqmldir/Test.qml") << "" << ""; QTest::newRow("need qmldir") << QUrl(serverdir+"TestLocal.qml") << "" << ""; } -- cgit v0.12 From 9849d8f5f1c0c3f03d3f83cc51eea2beb3d9cbbc Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 11 Oct 2010 18:07:35 +1000 Subject: Fix autotest on windows --- src/declarative/qml/qdeclarativeengine.cpp | 12 ++++++++++++ .../tst_qdeclarativemoduleplugin.cpp | 7 ++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 7ed925a..d768882 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -2196,7 +2196,19 @@ bool QDeclarative_isFileCaseCorrect(const QString &fileName) QFileInfo info(fileName); QString absolute = info.absoluteFilePath(); + +#if defined(Q_OS_MAC) QString canonical = info.canonicalFilePath(); +#elif defined(Q_OS_WIN) + wchar_t buffer[1024]; + + DWORD rv = ::GetShortPathName((wchar_t*)absolute.utf16(), buffer, 1024); + if (rv == 0 || rv >= 1024) return true; + rv = ::GetLongPathName(buffer, buffer, 1024); + if (rv == 0 || rv >= 1024) return true; + + QString canonical((QChar *)buffer); +#endif int absoluteLength = absolute.length(); int canonicalLength = canonical.length(); diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp index 587a86a..51f66a5 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp +++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp @@ -132,7 +132,12 @@ void tst_qdeclarativemoduleplugin::incorrectPluginCase() QCOMPARE(errors.count(), 1); #if defined(Q_OS_MAC) || defined(Q_OS_WIN) - QString expectedError = QLatin1String("plugin cannot be loaded for module \"com.nokia.WrongCase\": File name case mismatch for \"") + QFileInfo(__FILE__).absoluteDir().filePath("imports/com/nokia/WrongCase/libPluGin.dylib") + QLatin1String("\""); +#if defined(Q_OS_MAC) + QString libname = "libPluGin.dylib"; +#elif defined(Q_OS_WIN) + QString libname = "PluGin.dll"; +#endif + QString expectedError = QLatin1String("plugin cannot be loaded for module \"com.nokia.WrongCase\": File name case mismatch for \"") + QFileInfo(__FILE__).absoluteDir().filePath("imports/com/nokia/WrongCase/" + libname) + QLatin1String("\""); #else QString expectedError = QLatin1String("module \"com.nokia.WrongCase\" plugin \"PluGin\" not found"); #endif -- cgit v0.12 From d7657d8506bf06efef6b7636d1b1cbaea0f0cfc7 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Mon, 11 Oct 2010 10:18:00 +0200 Subject: Remove references of qunifiedtoolbarcontainer_mac_p.h Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/widgets/qmainwindowlayout_mac.mm | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm index b2c4cea..21f6067 100644 --- a/src/gui/widgets/qmainwindowlayout_mac.mm +++ b/src/gui/widgets/qmainwindowlayout_mac.mm @@ -49,7 +49,6 @@ #else #include #import -#include #endif QT_BEGIN_NAMESPACE -- cgit v0.12 From 36438bc216f939acd4e6772847d435e2e77d41c3 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 11 Oct 2010 10:48:54 +0200 Subject: Designer: Fix a crash when copying empty page-based containers. Reviewed-by: Jarek Kobus Task-number: QTBUG-14208 --- tools/designer/src/components/formeditor/formwindow.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tools/designer/src/components/formeditor/formwindow.cpp b/tools/designer/src/components/formeditor/formwindow.cpp index 15775f6..38a0544 100644 --- a/tools/designer/src/components/formeditor/formwindow.cpp +++ b/tools/designer/src/components/formeditor/formwindow.cpp @@ -1683,10 +1683,13 @@ void FormWindow::cut() // for cases like QMainWindow (central widget is an inner container) or QStackedWidget (page is an inner container) QWidget *FormWindow::innerContainer(QWidget *outerContainer) const { - bool isContainer = m_core->widgetDataBase()->isContainer(outerContainer); - if (isContainer) - if (QDesignerContainerExtension *container = qt_extension(m_core->extensionManager(), outerContainer)) - return container->widget(container->currentIndex()); + if (m_core->widgetDataBase()->isContainer(outerContainer)) + if (const QDesignerContainerExtension *container = qt_extension(m_core->extensionManager(), outerContainer)) { + const int currentIndex = container->currentIndex(); + return currentIndex >= 0 ? + container->widget(currentIndex) : + static_cast(0); + } return outerContainer; } @@ -1706,8 +1709,10 @@ QWidget *FormWindow::containerForPaste() const QWidget *containerOfW = findContainer(selection.first(), /* exclude layouts */ true); if (!containerOfW || containerOfW == mainContainer()) break; - // No layouts, must be container + // No layouts, must be container. No empty page-based containers. containerOfW = innerContainer(containerOfW); + if (!containerOfW) + break; if (LayoutInfo::layoutType(m_core, containerOfW) != LayoutInfo::NoLayout || !m_core->widgetDataBase()->isContainer(containerOfW)) break; w = containerOfW; @@ -1716,6 +1721,8 @@ QWidget *FormWindow::containerForPaste() const // and the like as the central widget has the layout). w = innerContainer(w); + if (!w) + return 0; if (LayoutInfo::layoutType(m_core, w) != LayoutInfo::NoLayout) return 0; // Go up via container extension (also includes step from QMainWindow to its central widget) -- cgit v0.12 From 22fd9b9780389f51ab3dd1865d2b5686fa34e6ff Mon Sep 17 00:00:00 2001 From: Carlos Manuel Duclos Vergara Date: Fri, 8 Oct 2010 15:05:14 +0200 Subject: [QCocoaView scrollWheel:] can end up recursing infinitely when a scrollWheel event is sent to two stacked MDI windows The problem is the fact that we were propagating the event through the class hierarchy. This means calling the super class implementation, which does nothing but pass the event to the next guy, which is the other window, which in turn does the same thing... The point is, there is no need to propagate this event on the class hierarchy. If anything, this should be propagated on the widgets hierarchy, which is already handled by Qt. Removing the code so this problem does not happen again. Task-number: QTBUG-12952 Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qcocoaview_mac.mm | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index a552ce7..f759fe0 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -939,10 +939,6 @@ static int qCocoaViewCount = 0; } } #endif //QT_NO_WHEELEVENT - - if (!wheelOK) { - return [super scrollWheel:theEvent]; - } } - (void)tabletProximity:(NSEvent *)tabletEvent -- cgit v0.12 From a6e371076a3b2410af2424efc1407c6f5d0b6407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Topi=20Reini=C3=B6?= Date: Mon, 11 Oct 2010 12:39:49 +0200 Subject: Add TIFFClose to QTIffHandler::option() to avoid memory leak Task-number: QTBUG-14261 Reviewed-by: aavit --- src/gui/image/qtiffhandler.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/image/qtiffhandler.cpp b/src/gui/image/qtiffhandler.cpp index de4f680..1627917 100644 --- a/src/gui/image/qtiffhandler.cpp +++ b/src/gui/image/qtiffhandler.cpp @@ -608,6 +608,7 @@ QVariant QTiffHandler::option(ImageOption option) const TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &width); TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &height); imageSize = QSize(width, height); + TIFFClose(tiff); } device()->seek(pos); if (imageSize.isValid()) -- cgit v0.12 From 48f18622b6fbfd19ccc77574d3750a8c0c1f6a7d Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Fri, 8 Oct 2010 16:59:44 +0100 Subject: Spectrum demo: put binaries into correct locations on Windows Task-number: QTBUG-13483 Reviewed-by: Miikka Heikkinen --- demos/spectrum/3rdparty/fftreal/fftreal.pro | 2 +- demos/spectrum/app/app.pro | 9 ++------- demos/spectrum/spectrum.pri | 12 ++++++++++++ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/demos/spectrum/3rdparty/fftreal/fftreal.pro b/demos/spectrum/3rdparty/fftreal/fftreal.pro index 6305af4..e5093ba 100644 --- a/demos/spectrum/3rdparty/fftreal/fftreal.pro +++ b/demos/spectrum/3rdparty/fftreal/fftreal.pro @@ -40,7 +40,7 @@ symbian { macx { CONFIG += lib_bundle } else { - !symbian: DESTDIR = ../.. + !symbian: DESTDIR = ../..$${spectrum_build_dir} } # Install diff --git a/demos/spectrum/app/app.pro b/demos/spectrum/app/app.pro index 4fe8b6d..57be114 100644 --- a/demos/spectrum/app/app.pro +++ b/demos/spectrum/app/app.pro @@ -65,7 +65,7 @@ symbian { LIBS += -F$${fftreal_dir} LIBS += -framework fftreal } else { - LIBS += -L.. + LIBS += -L..$${spectrum_build_dir} LIBS += -lfftreal } } @@ -91,10 +91,8 @@ symbian { DEPLOYMENT += fftreal } } else { + DESTDIR = ..$${spectrum_build_dir} macx { - # Specify directory in which to create spectrum.app bundle - DESTDIR = .. - !contains(DEFINES, DISABLE_FFT) { # Relocate fftreal.framework into spectrum.app bundle framework_dir = ../spectrum.app/Contents/Frameworks @@ -110,9 +108,6 @@ symbian { ../spectrum.app/Contents/MacOS/spectrum } } else { - # Specify directory in which to create spectrum application - DESTDIR = .. - unix: { # Provide relative path from application to fftreal library QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN diff --git a/demos/spectrum/spectrum.pri b/demos/spectrum/spectrum.pri index c09aa0d..5773900 100644 --- a/demos/spectrum/spectrum.pri +++ b/demos/spectrum/spectrum.pri @@ -35,3 +35,15 @@ DEFINES += SPECTRUM_ANALYSER_SEPARATE_THREAD # Suppress warnings about strncpy potentially being unsafe, emitted by MSVC win32: DEFINES += _CRT_SECURE_NO_WARNINGS +win32 { + # spectrum_build_dir is defined with a leading slash so that it can + # be used in contexts such as + # ..$${spectrum_build_dir} + # without the result having a trailing slash where spectrum_build_dir + # is undefined. + spectrum_build_dir = /release + if (!debug_and_release|build_pass): CONFIG(debug, debug|release) { + spectrum_build_dir = /debug + } +} + -- cgit v0.12 From 3c2296647d2e7ddda4df6679a622b0bf46b34c35 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Fri, 8 Oct 2010 15:10:56 +0100 Subject: Spectrum demo: only use --rpath for linux-g++* mkspecs Task-number: QTBUG-13940 Reviewed-by: Martin Pejcoch --- demos/spectrum/app/app.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/spectrum/app/app.pro b/demos/spectrum/app/app.pro index 57be114..b3ff227 100644 --- a/demos/spectrum/app/app.pro +++ b/demos/spectrum/app/app.pro @@ -108,7 +108,7 @@ symbian { ../spectrum.app/Contents/MacOS/spectrum } } else { - unix: { + linux-g++*: { # Provide relative path from application to fftreal library QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN } -- cgit v0.12 From 76e2668a621b03ee4da423c10afac0ceb66e6a33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=AA=E0=A5=8D=E0=A4=B0=E0=A4=B5=E0=A4=BF=E0=A4=A3=20?= =?UTF-8?q?=E0=A4=B8=E0=A4=BE=E0=A4=A4=E0=A4=AA=E0=A5=81=E0=A4=A4=E0=A5=87?= Date: Mon, 11 Oct 2010 13:25:29 +0200 Subject: Fix several errors with shaping of Indic scripts 1. The opentype init feature was applied to some characters even when the character appeared inside a word. 2. Using the ZWJ to separate Ra and Halant Ya should connect the two latter characters and form a Yaphala 3. Some Oriya chars were not correctly marked as below-base form. Task-number: QTBUG-13620, QTBUG-13616, QTBUG-13542 Merge-request: 2484 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp index 4d8418b..817fb0d 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp @@ -37,7 +37,7 @@ static HB_Bool isLetter(HB_UChar16 ucs) FLAG(HB_Letter_Titlecase) | FLAG(HB_Letter_Modifier) | FLAG(HB_Letter_Other); - return FLAG(HB_GetUnicodeCharCategory(ucs)) & test; + return (FLAG(HB_GetUnicodeCharCategory(ucs)) & test) != 0; } static HB_Bool isMark(HB_UChar16 ucs) @@ -660,18 +660,18 @@ static const unsigned char indicPosition[0xe00-0x900] = { None, None, None, None, None, None, None, None, - None, None, None, None, - None, None, None, None, - None, None, None, None, + None, Below, Below, Below, + Below, Below, Below, Below, + Below, Below, None, Below, - None, None, None, None, - Below, None, None, None, - Below, None, None, None, + Below, Below, Below, Below, + Below, Below, Below, Below, + Below, None, Below, Below, Below, Below, Below, Post, Below, None, Below, Below, - None, None, None, None, - None, None, None, None, + None, Below, Below, Below, + Below, Below, None, None, None, None, Post, Above, Post, Below, Below, Below, @@ -1741,6 +1741,11 @@ static int indic_nextSyllableBoundary(HB_Script script, const HB_UChar16 *s, int if (state == Halant && uc[pos] == 0x200d /* ZWJ */) break; // the control character should be the last char in the item + if (state == Consonant && script == HB_Script_Bengali && uc[pos-1] == 0x09B0 && uc[pos] == 0x200d /* ZWJ */) + break; + if (state == Consonant && script == HB_Script_Kannada && uc[pos-1] == 0x0CB0 && uc[pos] == 0x200d /* ZWJ */) + break; + // Bengali and Kannada has a special exception for rendering yaphala with ra (to avoid reph) see http://www.unicode.org/faq/indic.html#15 ++pos; goto finish; case Consonant: -- cgit v0.12 From ae37a39a16c0d28d69fe9e0295ec619d899dc518 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 11 Oct 2010 13:25:31 +0200 Subject: Add some tests for Indic shaping in Harfbuzz These were added to confirm the behavior in merge request 2484. Their validity depends on the validity of the merge request. Task-number: QTBUG-13620, QTBUG-13616, QTBUG-13542 --- src/3rdparty/harfbuzz/tests/shaping/main.cpp | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/3rdparty/harfbuzz/tests/shaping/main.cpp b/src/3rdparty/harfbuzz/tests/shaping/main.cpp index 28f8e07..73760a8 100644 --- a/src/3rdparty/harfbuzz/tests/shaping/main.cpp +++ b/src/3rdparty/harfbuzz/tests/shaping/main.cpp @@ -642,6 +642,10 @@ void tst_QScriptEngine::bengali() { { 0x9f1, 0x9cd, 0x9ad, 0x0 }, { 0x191, 0x17d, 0x168, 0x0 } }, + // Ra ZWJ Halant Ya + { { 0x09b0, 0x200d, 0x09cd, 0x09af, 0x0 }, + { 0x016b, 0x01cf, 0x0 } }, + { {0}, {0} } }; @@ -749,6 +753,13 @@ void tst_QScriptEngine::bengali() { { 0x09b0, 0x09cd, 0x09ac, 0x09cd, 0x09ac, 0x0 }, { 0x013b, 0x00e1, 0x0 } }, + // Init feature for vowel sign E should only be + // applied when it's initial character (QTBUG-13620) + { { 0x09a8, 0x09c7, 0x0 }, + { 0x0232, 0x0086, 0x0 } }, + { { 0x09a8, 0x09a8, 0x09c7, 0x0 }, + { 0x0086, 0x009b, 0x0086, 0x0 } }, + { {0}, {0} } }; @@ -847,6 +858,19 @@ void tst_QScriptEngine::oriya() { 0x177, 0x0 } }, { { 0xb28, 0xb4d, 0xb24, 0xb4d, 0xb30, 0xb4d, 0xb2f, 0x0 }, { 0x176, 0x124, 0x0 } }, + + // QTBUG-13542 + { { 0x0b2c, 0x0b4d, 0x0b21, 0x0 }, + { 0x0089, 0x00fc, 0x0 } }, + { { 0x0b36, 0x0b4d, 0x0b2b, 0x0 }, + { 0x0092, 0x0105, 0x0 } }, + { { 0x0b36, 0x0b4d, 0x0b1f, 0x0 }, + { 0x0092, 0x00fa, 0x0 } }, + { { 0x0b39, 0x0b4d, 0x0b1f, 0x0 }, + { 0x0095, 0x00fa, 0x0 } }, + { { 0x0b15, 0x0b4d, 0x0b16, 0x0 }, + { 0x0073, 0x00f1, 0x0 } }, + { {0}, {0} } }; @@ -1005,6 +1029,11 @@ void tst_QScriptEngine::kannada() { 0x0036, 0x00c1, 0x0 } }, { { 0x0cb0, 0x0ccd, 0x200d, 0x0c95, 0x0 }, { 0x0050, 0x00a7, 0x0 } }, + + // Kaphala + { { 0x0cb0, 0x200d, 0x0ccd, 0x0c95, 0x0 }, + { 0x0050, 0x00a7, 0x0 } }, + { {0}, {0} } }; -- cgit v0.12 From c27f1586d7c4c56af1f46fa09ad77f03b7736e5d Mon Sep 17 00:00:00 2001 From: mread Date: Fri, 8 Oct 2010 15:31:09 +0100 Subject: Making the hybrid allocator change compatible across all 4.7.x The hybrid allocator introduced a new export to qtcore.dll and made all apps link to it when they linked with the corresponding qtmain.lib. However, this made all apps depend on this new export, and since that export is not present in early 4.7.x release, these apps would not run with the Qt DLLs from those releases, which breaks Qt's compatibility guarantees for patch releases. This change makes apps compatible with all 4.7.x releases again. For export frozen Qt builds (the sort that should be compatible across all 4.7.x releases), qtmain.lib no longer forces a static import link to qt_symbian_SetupThreadHeap(). Instead it dynamically loads qtcore.dll, looks up qt_symbian_SetupThreadHeap(), and calls it if present. If the function is not present, or on emulator builds where we know that qtcore will use the system allocator creation function, we call the system allocator creation function. For export unfrozen builds, there is no compatibility between builds or releases, so we do use a static import link to qt_symbian_SetupThreadHeap(), as we have to use the qtcore dll we have built with it anyway. This has been tested as follows: S60 3.1 SDK, def files not frozen. App compiled against latest code runs on the corresponding DLLs, and does not start with 4.7.0, which is what we expect. S60 3.2 SDK, def files frozen. App compiled against latest code runs on the corresponding DLLs with the new allocator, and runs on 4.7.0 DLLs with the old allocator. Which demonstrates compatibility. S60 5.0 SDK, def files not frozen, debug build. Same result as for the 3.1 SDK, which demonstrates debug build working too (all other tests are release build tests). S60 5.0 SDK, def files frozen, debug build. Same result as on S60 3.2 SDK, which demonstrates debug build working with def files. Symbian^3 SDK, def files frozen. Same result as on S60 3.2 SDK, demonstrating Symbian^3 compatibility. Symbian^4, code and tests compile and does not affect running. *** This change is only required for 4.7. It is not needed for 4.8+ *** *** If this change appears in 4.8+, it can be reverted. *** Task-number: QT-4080 Reviewed-by: Shane Kearns --- src/s60main/newallocator_hook.cpp | 87 ++++++++++++++++++++++++++++++++++++++- src/s60main/s60main.pro | 3 ++ 2 files changed, 89 insertions(+), 1 deletion(-) diff --git a/src/s60main/newallocator_hook.cpp b/src/s60main/newallocator_hook.cpp index 9cc6afb..9ea2ef0 100644 --- a/src/s60main/newallocator_hook.cpp +++ b/src/s60main/newallocator_hook.cpp @@ -41,6 +41,11 @@ #include #include +#ifdef QT_EXPORTS_NOT_FROZEN +// If exports in Qt DLLs are not frozen in this build, then we have to pick up the +// allocator creation function by import link. We know the function will be present +// in the DLLs we test with, as we have to use the DLLs we have built. + struct SStdEpocThreadCreateInfo; Q_CORE_EXPORT TInt qt_symbian_SetupThreadHeap(TBool aNotFirst, SStdEpocThreadCreateInfo& aInfo); @@ -51,8 +56,88 @@ Q_CORE_EXPORT TInt qt_symbian_SetupThreadHeap(TBool aNotFirst, SStdEpocThreadCre * Uses link-time symbol preemption to capture a call from the application * startup. On return, there is some kind of heap allocator installed on the * thread. -*/ +*/ TInt UserHeap::SetupThreadHeap(TBool aNotFirst, SStdEpocThreadCreateInfo& aInfo) { return qt_symbian_SetupThreadHeap(aNotFirst, aInfo); } + +#else // QT_EXPORTS_NOT_FROZEN +// If we are using an export frozen build, it should be compatible with all 4.7.x Qt releases. +// We want to use the allocator creation function introduced in qtcore.dll after 4.7.1. But we +// can't import link to it, as it may not be present in whatever 4.7.x DLLs we are running with. +// So the function is found and called dynamically, by library lookup. If it is not found, we +// use the OS allocator creation functions instead. + +struct SThreadCreateInfo + { + TAny* iHandle; + TInt iType; + TThreadFunction iFunction; + TAny* iPtr; + TAny* iSupervisorStack; + TInt iSupervisorStackSize; + TAny* iUserStack; + TInt iUserStackSize; + TInt iInitialThreadPriority; + TPtrC iName; + TInt iTotalSize; // Size including any extras (must be a multiple of 8 bytes) + }; + +struct SStdEpocThreadCreateInfo : public SThreadCreateInfo + { + RAllocator* iAllocator; + TInt iHeapInitialSize; + TInt iHeapMaxSize; + TInt iPadding; // Make structure size a multiple of 8 bytes + }; + + +/* \internal + * + * Uses link-time symbol preemption to capture a call from the application + * startup. On return, there is some kind of heap allocator installed on the + * thread. +*/ +TInt UserHeap::SetupThreadHeap(TBool aNotFirst, SStdEpocThreadCreateInfo& aInfo) +{ + TInt r = KErrNone; + +#ifndef __WINS__ + // attempt to create the fast allocator through a known export ordinal in qtcore.dll + RLibrary qtcore; + if (qtcore.Load(_L("qtcore.dll")) == KErrNone) + { + const int qt_symbian_SetupThreadHeap_eabi_ordinal = 3713; + TLibraryFunction libFunc = qtcore.Lookup(qt_symbian_SetupThreadHeap_eabi_ordinal); + if (libFunc) + { + typedef int (*TSetupThreadHeapFunc)(TBool aNotFirst, SStdEpocThreadCreateInfo& aInfo); + TSetupThreadHeapFunc p_qt_symbian_SetupThreadHeap = TSetupThreadHeapFunc(libFunc); + r = (*p_qt_symbian_SetupThreadHeap)(aNotFirst, aInfo); + } + qtcore.Close(); + if (libFunc) + return r; + } +#endif + + // no fast allocator support - use default allocator creation + if (!aInfo.iAllocator && aInfo.iHeapInitialSize>0) + { + // new heap required + RHeap* pH = NULL; + r = UserHeap::CreateThreadHeap(aInfo, pH); + } + else if (aInfo.iAllocator) + { + // sharing a heap + RAllocator* pA = aInfo.iAllocator; + pA->Open(); + User::SwitchAllocator(pA); + r = KErrNone; + } + return r; +} + +#endif // QT_EXPORTS_NOT_FROZEN diff --git a/src/s60main/s60main.pro b/src/s60main/s60main.pro index 664f155..8ab3bd3 100644 --- a/src/s60main/s60main.pro +++ b/src/s60main/s60main.pro @@ -31,6 +31,9 @@ symbian { # against GCCE apps, so remove it MMP_RULES -= $$MMP_RULES_DONT_EXPORT_ALL_CLASS_IMPEDIMENTA linux-armcc:QMAKE_CXXFLAGS *= --export_all_vtbl + + # Flag if exports are not frozen to avoid lookup of qtcore allocator creation function by ordinal + contains(CONFIG, def_files_disabled): DEFINES += QT_EXPORTS_NOT_FROZEN } else { error("$$_FILE_ is intended only for Symbian!") } -- cgit v0.12 From 791ff94dc3b3a01798ce0bf1243de228b3c19e25 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 11 Oct 2010 14:28:05 +0200 Subject: The completer in an itemview would not be activated right away If you have set the edit triggers to AnyKeyPressed and you press a key the completer would not kick in because the key event would come before the lineedit gets focus. The completer is only active when the lineedit has focus. Task-number: QTBUG14363 Reviewed-by: ogoffart --- src/gui/itemviews/qabstractitemview.cpp | 6 ++--- tests/auto/qlistwidget/tst_qlistwidget.cpp | 40 ++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 0842ee8..b5ca812 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -4101,13 +4101,13 @@ bool QAbstractItemViewPrivate::openEditor(const QModelIndex &index, QEvent *even if (!w) return false; - if (event) - QApplication::sendEvent(w->focusProxy() ? w->focusProxy() : w, event); - q->setState(QAbstractItemView::EditingState); w->show(); w->setFocus(); + if (event) + QApplication::sendEvent(w->focusProxy() ? w->focusProxy() : w, event); + return true; } diff --git a/tests/auto/qlistwidget/tst_qlistwidget.cpp b/tests/auto/qlistwidget/tst_qlistwidget.cpp index eb3fb6b..8aa50d3 100644 --- a/tests/auto/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/qlistwidget/tst_qlistwidget.cpp @@ -133,6 +133,7 @@ private slots: void task217070_scrollbarsAdjusted(); void task258949_keypressHangup(); void QTBUG8086_currentItemChangedOnClick(); + void QTBUG14363_completerWithAnyKeyPressedEditTriggers(); protected slots: @@ -1640,5 +1641,44 @@ void tst_QListWidget::QTBUG8086_currentItemChangedOnClick() } +class ItemDelegate : public QItemDelegate +{ +public: + ItemDelegate(QObject *parent = 0) : QItemDelegate(parent) + {} + virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const + { + QLineEdit *lineEdit = new QLineEdit(parent); + lineEdit->setFrame(false); + QCompleter *completer = new QCompleter(QStringList() << "completer", lineEdit); + completer->setCompletionMode(QCompleter::InlineCompletion); + lineEdit->setCompleter(completer); + return lineEdit; + } +}; + +void tst_QListWidget::QTBUG14363_completerWithAnyKeyPressedEditTriggers() +{ + QListWidget listWidget; + listWidget.setEditTriggers(QAbstractItemView::AnyKeyPressed); + listWidget.setItemDelegate(new ItemDelegate); + QListWidgetItem *item = new QListWidgetItem(QLatin1String("select an item (don't start editing)"), &listWidget); + item->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable|Qt::ItemIsEditable); + new QListWidgetItem(QLatin1String("try to type the letter 'c'"), &listWidget); + new QListWidgetItem(QLatin1String("completer"), &listWidget); + listWidget.show(); + listWidget.setCurrentItem(item); + QTest::qWaitForWindowShown(&listWidget); + + QTest::keyClick(listWidget.viewport(), Qt::Key_C); + + QLineEdit *le = qobject_cast(listWidget.itemWidget(item)); + QVERIFY(le); + QCOMPARE(le->text(), QString("completer")); + QCOMPARE(le->completer()->currentCompletion(), QString("completer")); +} + + + QTEST_MAIN(tst_QListWidget) #include "tst_qlistwidget.moc" -- cgit v0.12 From 062b8cfa9b1ece569fe2a8ae18230c862ca6f857 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Mon, 11 Oct 2010 15:14:56 +0200 Subject: Moved the property documentation to its proper location. Task-number: QTBUG-14351 Reviewed-by: David Boddie --- src/gui/graphicsview/qgraphicswidget.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 1bfe266..4a733be 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -750,6 +750,22 @@ QSizeF QGraphicsWidget::sizeHint(Qt::SizeHint which, const QSizeF &constraint) c /*! \property QGraphicsWidget::layout \brief The layout of the widget + + Any existing layout manager is deleted before the new layout is assigned. If + \a layout is 0, the widget is left without a layout. Existing subwidgets' + geometries will remain unaffected. + + QGraphicsWidget takes ownership of \a layout. + + All widgets that are currently managed by \a layout or all of its + sublayouts, are automatically reparented to this item. The layout is then + invalidated, and the child widget geometries are adjusted according to + this item's geometry() and contentsMargins(). Children who are not + explicitly managed by \a layout remain unaffected by the layout after + it has been assigned to this widget. + + If no layout is currently managing this widget, layout() will return 0. + */ /*! -- cgit v0.12 From 0644896a666b1215dad9c04d73dd44f03554060d Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Mon, 11 Oct 2010 16:00:22 +0200 Subject: Added the default format of QTime::toString(). Task-number: QTBUG-13710 Reviewed-by: David Boddie --- src/corelib/tools/qdatetime.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index ab7530d..c252e64 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -1630,6 +1630,7 @@ QString QTime::toString(Qt::DateFormat format) const \endtable If the datetime is invalid, an empty string will be returned. + If \a format is empty, the default format "hh:mm:ss" is used. \sa QDate::toString() QDateTime::toString() */ -- cgit v0.12 From ef7df41b11c4f5e026b85ca9b02a9c05b427a301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 8 Oct 2010 15:33:25 +0200 Subject: Compile fix for OpenVG without VGFont. ShivaVG doesn't have VGFont support for example. Reviewed-by: Jason Barron --- src/openvg/qpaintengine_vg.cpp | 9 ++------- src/openvg/qvg_p.h | 5 +++++ src/openvg/qvgfontglyphcache_p.h | 6 ++++++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index f6d2435..ce9d11a 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -61,11 +61,6 @@ QT_BEGIN_NAMESPACE -// vgDrawGlyphs() only exists in OpenVG 1.1 and higher. -#if !defined(OPENVG_VERSION_1_1) && !defined(QVG_NO_DRAW_GLYPHS) -#define QVG_NO_DRAW_GLYPHS 1 -#endif - // vgRenderToMask() only exists in OpenVG 1.1 and higher. // Also, disable masking completely if we are using the scissor to clip. #if !defined(OPENVG_VERSION_1_1) && !defined(QVG_NO_RENDER_TO_MASK) @@ -75,11 +70,11 @@ QT_BEGIN_NAMESPACE #define QVG_NO_RENDER_TO_MASK 1 #endif -#if !defined(QVG_NO_DRAW_GLYPHS) - // use the same rounding as in qrasterizer.cpp (6 bit fixed point) static const qreal aliasedCoordinateDelta = 0.5 - 0.015625; +#if !defined(QVG_NO_DRAW_GLYPHS) + Q_DECL_IMPORT extern int qt_defaultDpiX(); Q_DECL_IMPORT extern int qt_defaultDpiY(); diff --git a/src/openvg/qvg_p.h b/src/openvg/qvg_p.h index 51abbee..94d1eae 100644 --- a/src/openvg/qvg_p.h +++ b/src/openvg/qvg_p.h @@ -55,6 +55,11 @@ // We mean it. // +// vgDrawGlyphs() only exists in OpenVG 1.1 and higher. +#if !defined(OPENVG_VERSION_1_1) && !defined(QVG_NO_DRAW_GLYPHS) +#define QVG_NO_DRAW_GLYPHS 1 +#endif + #include #if !defined(QT_NO_EGL) diff --git a/src/openvg/qvgfontglyphcache_p.h b/src/openvg/qvgfontglyphcache_p.h index b32a873..8bcdcc7 100644 --- a/src/openvg/qvgfontglyphcache_p.h +++ b/src/openvg/qvgfontglyphcache_p.h @@ -56,10 +56,14 @@ #include #include +#include + QT_BEGIN_NAMESPACE class QVGPaintEnginePrivate; +#ifndef QVG_NO_DRAW_GLYPHS + class QVGFontGlyphCache { public: @@ -90,6 +94,8 @@ public: }; #endif +#endif + QT_END_NAMESPACE #endif // QVGFONTGLYPHCACHE_H -- cgit v0.12 From eb46137d89b0acfb8874445d7d9a591f81fe5520 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 11 Oct 2010 16:49:01 +0200 Subject: remove exec bits again ... --- translations/assistant_ja.ts | 0 translations/linguist_ja.ts | 0 translations/qt_ja.ts | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 translations/assistant_ja.ts mode change 100755 => 100644 translations/linguist_ja.ts mode change 100755 => 100644 translations/qt_ja.ts diff --git a/translations/assistant_ja.ts b/translations/assistant_ja.ts old mode 100755 new mode 100644 diff --git a/translations/linguist_ja.ts b/translations/linguist_ja.ts old mode 100755 new mode 100644 diff --git a/translations/qt_ja.ts b/translations/qt_ja.ts old mode 100755 new mode 100644 -- cgit v0.12 From 6a23821f82e3e609c3e51df0068b188d81219812 Mon Sep 17 00:00:00 2001 From: Victor Ostashevsky Date: Mon, 11 Oct 2010 16:54:12 +0200 Subject: Make qtconfig help messages translatable Merge-request: 851 Reviewed-by: Oswald Buddenhagen --- tools/qtconfig/mainwindow.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/qtconfig/mainwindow.cpp b/tools/qtconfig/mainwindow.cpp index 9675f99..4fe2868 100644 --- a/tools/qtconfig/mainwindow.cpp +++ b/tools/qtconfig/mainwindow.cpp @@ -81,7 +81,7 @@ QT_BEGIN_NAMESPACE // external use ignore them // extern bool Q_CORE_EXPORT qt_resolve_symlinks; -static const char *appearance_text = +static const char *appearance_text = QT_TRANSLATE_NOOP("MainWindow", "

Appearance

" "
" "

Use this tab to customize the appearance of your Qt applications.

" @@ -95,9 +95,9 @@ static const char *appearance_text = "To customize colors further, press the Tune Palette button to open " "the advanced palette editor." "

The Preview Window shows what the selected Style and colors look " -"like."; +"like."); -static const char *font_text = +static const char *font_text = QT_TRANSLATE_NOOP("MainWindow", "

Fonts

" "
" "

Use this tab to select the default font for your Qt applications. " @@ -114,9 +114,9 @@ static const char *font_text = "Korean characters that are not found in the Lucida font will be taken " "from the Mincho font. Because the font substitutions are " "lists, you can also select multiple families, such as Song Ti (for " -"use with Chinese text)."; +"use with Chinese text)."); -static const char *interface_text = +static const char *interface_text = QT_TRANSLATE_NOOP("MainWindow", "

Interface

" "
" "

Use this tab to customize the feel of your Qt applications.

" @@ -131,10 +131,10 @@ static const char *interface_text = "at 0 will disable the Global Strut feature

" "

XIM (Extended Input Methods) are used for entering characters in " "languages that have large character sets, for example, Chinese and " -"Japanese."; +"Japanese."); // ### What does the 'Enhanced support for languages written R2L do? -static const char *printer_text = +static const char *printer_text = QT_TRANSLATE_NOOP("MainWindow", "

Printer

" "
" "

Use this tab to configure the way Qt generates output for the printer." @@ -145,14 +145,14 @@ static const char *printer_text = "size will be bigger." "

When using font embedding you can select additional directories where " "Qt should search for embeddable font files. By default, the X " -"server font path is used."; +"server font path is used."); -static const char *phonon_text = +static const char *phonon_text = QT_TRANSLATE_NOOP("MainWindow", "

Phonon

" "
" "

Use this tab to configure the Phonon GStreamer multimedia backend. " "

It is reccommended to leave all settings on \"Auto\" to let " -"Phonon determine your settings automatically."; +"Phonon determine your settings automatically."); static QColorGroup::ColorRole centralFromItem( int item ) { -- cgit v0.12 From b1a8c2e50a7d8768da97a9782c393a0cb29458f6 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Mon, 11 Oct 2010 16:55:01 +0200 Subject: qmake/symbian: Add icons with backslashes in pkg files The destination path in pkg files always uses backslashes, not the path separator native to the build system. Merge-request: 853 Reviewed-by: Oswald Buddenhagen --- qmake/generators/symbian/symbiancommon.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp index 9af3fe4..6fea8fd 100644 --- a/qmake/generators/symbian/symbiancommon.cpp +++ b/qmake/generators/symbian/symbiancommon.cpp @@ -428,9 +428,9 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB t << QString("\"%1epoc32/data/z%2\" - \"!:%3\"") .arg(epocRoot()) .arg(iconFile) - .arg(QDir::toNativeSeparators(iconFile)) << endl << endl; + .arg(QString(iconFile).replace('/', '\\')) << endl << endl; ts << QString("\"\" - \"%1\"") - .arg(romPath(QDir::toNativeSeparators(iconFile))) << endl << endl; + .arg(romPath(QString(iconFile).replace('/', '\\'))) << endl << endl; } else { QDir mifIconDir(project->first("DESTDIR")); QFileInfo mifIcon(mifIconDir.relativeFilePath(project->first("TARGET"))); @@ -439,9 +439,9 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB t << QString("\"%1/%2\" - \"!:%3\"") .arg(mifIcon.path()) .arg(mifIconFileName) - .arg(QDir::toNativeSeparators(iconFile)) << endl << endl; + .arg(QString(iconFile).replace('/', '\\')) << endl << endl; ts << QString("\"\" - \"%1\"") - .arg(romPath(QDir::toNativeSeparators(iconFile))) << endl << endl; + .arg(romPath(QString(iconFile).replace('/', '\\'))) << endl << endl; } } } -- cgit v0.12 From e2ba67cd1d2887cec84058e260dd0f76cbab8771 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 11 Oct 2010 16:58:18 +0200 Subject: Add keycodes for some additional multimedia keys --- src/gui/embedded/qkbd_defaultmap_qws_p.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/embedded/qkbd_defaultmap_qws_p.h b/src/gui/embedded/qkbd_defaultmap_qws_p.h index 16c3459..703dfcd 100644 --- a/src/gui/embedded/qkbd_defaultmap_qws_p.h +++ b/src/gui/embedded/qkbd_defaultmap_qws_p.h @@ -642,7 +642,14 @@ const QWSKeyboard::Mapping QWSKbPrivate::s_keymap_default[] = { { 111, 0xffff, 0x01000007, 0x00, 0x00, 0x0000 }, { 111, 0xffff, 0x01000000, 0x06, 0x08, 0x0200 }, { 111, 0xffff, 0x01000000, 0x0c, 0x08, 0x0200 }, + { 113, 0xffff, 0x01000071, 0x00, 0x00, 0x0000 }, + { 114, 0xffff, 0x01000070, 0x00, 0x00, 0x0000 }, + { 115, 0xffff, 0x01000072, 0x00, 0x00, 0x0000 }, + { 116, 0xffff, 0x0100010b, 0x00, 0x00, 0x0000 }, { 119, 0xffff, 0x01000008, 0x00, 0x00, 0x0000 }, + { 138, 0xffff, 0x01000058, 0x00, 0x00, 0x0000 }, + { 139, 0xffff, 0x01000055, 0x00, 0x00, 0x0000 }, + }; const QWSKeyboard::Composing QWSKbPrivate::s_keycompose_default[] = { -- cgit v0.12 From 89a853370d94373c6ef1c9fabcfb5bf19c20f7c9 Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Mon, 11 Oct 2010 17:15:44 +0200 Subject: use specified pkg-config Respect the pkg-config tool specified in qmake.conf. This is useful when crossbuilding. Merge-request: 850 Reviewed-by: Oswald Buddenhagen --- mkspecs/features/link_pkgconfig.prf | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mkspecs/features/link_pkgconfig.prf b/mkspecs/features/link_pkgconfig.prf index 4c528aa..d70e5de 100644 --- a/mkspecs/features/link_pkgconfig.prf +++ b/mkspecs/features/link_pkgconfig.prf @@ -1,6 +1,7 @@ # handle pkg-config files +isEmpty(PKG_CONFIG):PKG_CONFIG = pkg-config for(PKGCONFIG_LIB, $$list($$unique(PKGCONFIG))) { - QMAKE_CXXFLAGS += $$system(pkg-config --cflags $$PKGCONFIG_LIB) - QMAKE_CFLAGS += $$system(pkg-config --cflags $$PKGCONFIG_LIB) - LIBS += $$system(pkg-config --libs $$PKGCONFIG_LIB) + QMAKE_CXXFLAGS += $$system($$PKG_CONFIG --cflags $$PKGCONFIG_LIB) + QMAKE_CFLAGS += $$system($$PKG_CONFIG --cflags $$PKGCONFIG_LIB) + LIBS += $$system($$PKG_CONFIG --libs $$PKGCONFIG_LIB) } -- cgit v0.12 From cd4eaa9c8274559aa2b0ceaeed1644966b9a2d94 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 11 Oct 2010 17:00:35 +0200 Subject: qmake: pass include directories to MS resource compiler Task-number: QTBUG-13776 Reviewed-by: ossi --- qmake/generators/win32/msvc_vcproj.cpp | 1 + qmake/generators/win32/msvc_vcxproj.cpp | 1 + qmake/generators/win32/winmakefile.cpp | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index cff7a14..cd42d4d 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1004,6 +1004,7 @@ void VcprojGenerator::initResourceTool() { VCConfiguration &conf = vcProject.Configuration; conf.resource.PreprocessorDefinitions = conf.compiler.PreprocessorDefinitions; + conf.resource.AdditionalIncludeDirectories = conf.compiler.AdditionalIncludeDirectories; // We need to add _DEBUG for the debug version of the project, since the normal compiler defines // do not contain it. (The compiler defines this symbol automatically, which is wy we don't need diff --git a/qmake/generators/win32/msvc_vcxproj.cpp b/qmake/generators/win32/msvc_vcxproj.cpp index 396d2bf..00702ae 100644 --- a/qmake/generators/win32/msvc_vcxproj.cpp +++ b/qmake/generators/win32/msvc_vcxproj.cpp @@ -365,6 +365,7 @@ void VcxprojGenerator::initResourceTool() { VCXConfiguration &conf = vcxProject.Configuration; conf.resource.PreprocessorDefinitions = conf.compiler.PreprocessorDefinitions; + conf.resource.AdditionalIncludeDirectories = conf.compiler.AdditionalIncludeDirectories; // We need to add _DEBUG for the debug version of the project, since the normal compiler defines // do not contain it. (The compiler defines this symbol automatically, which is wy we don't need diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index ecb20c7..8f148ad 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -760,7 +760,8 @@ void Win32MakefileGenerator::writeRcFilePart(QTextStream &t) // since the compiler defines this symbol by itself, and we use it in the automatically // created rc file when VERSION is define the .pro file. t << res_file << ": " << rc_file << "\n\t" - << var("QMAKE_RC") << (project->isActiveConfig("debug") ? " -D_DEBUG" : "") << " $(DEFINES) -fo " << res_file << " " << rc_file; + << var("QMAKE_RC") << (project->isActiveConfig("debug") ? " -D_DEBUG" : "") + << " $(DEFINES) $(INCPATH) -fo " << res_file << " " << rc_file; t << endl << endl; } } -- cgit v0.12 From 624267441e94e87ddb79f5e3748fc17a9a98c311 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 11 Oct 2010 17:26:13 +0200 Subject: qmake: delete .pdb file when making 'distclean' instead of 'clean' In Visual Studio builds "nmake clean" will now keep the .pdb files. Calling "nmake distclean" will delete them. Task-number: QTBUG-13853 Reviewed-by: ossi --- qmake/generators/win32/msvc_nmake.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index 907f8dc..b707607 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -213,7 +213,7 @@ void NmakeMakefileGenerator::init() project->values("QMAKE_CLEAN").append(project->first("DESTDIR") + project->first("TARGET") + version + ".exp"); } if(project->isActiveConfig("debug")) { - project->values("QMAKE_CLEAN").append(project->first("DESTDIR") + project->first("TARGET") + version + ".pdb"); + project->values("QMAKE_DISTCLEAN").append(project->first("DESTDIR") + project->first("TARGET") + version + ".pdb"); project->values("QMAKE_CLEAN").append(project->first("DESTDIR") + project->first("TARGET") + version + ".ilk"); project->values("QMAKE_CLEAN").append("vc*.pdb"); project->values("QMAKE_CLEAN").append("vc*.idb"); -- cgit v0.12 From 650a0078e2cef43eff107fe8d2505f64a0bfedf0 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 12 Oct 2010 13:11:38 +1000 Subject: Update sections if model content changes. We didn't handle the section property changing, e.g. due to asynchronous model. Task-number: QT-4093 Reviewed-by: Aaron Kennedy --- .../graphicsitems/qdeclarativelistview.cpp | 40 ++++++++++++++++++++-- .../graphicsitems/qdeclarativelistview_p.h | 2 ++ .../graphicsitems/qdeclarativevisualitemmodel.cpp | 21 ++++++++++++ .../graphicsitems/qdeclarativevisualitemmodel_p.h | 4 +++ .../tst_qdeclarativelistview.cpp | 11 ++++++ 5 files changed, 75 insertions(+), 3 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 4943aef..6fd3b71 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -775,7 +775,6 @@ void QDeclarativeListViewPrivate::layout() setPosition(0); return; } - updateSections(); if (!visibleItems.isEmpty()) { qreal oldEnd = visibleItems.last()->endPosition(); qreal pos = visibleItems.first()->endPosition() + spacing + 1; @@ -934,6 +933,7 @@ void QDeclarativeListViewPrivate::createSection(FxListItem *listItem) return; if (listItem->attached->m_prevSection != listItem->attached->m_section) { if (!listItem->section) { + qreal pos = listItem->position(); int i = sectionCacheSize-1; while (i >= 0 && !sectionCache[i]) --i; @@ -961,8 +961,10 @@ void QDeclarativeListViewPrivate::createSection(FxListItem *listItem) delete context; } } + listItem->setPosition(pos); } } else if (listItem->section) { + qreal pos = listItem->position(); int i = 0; do { if (!sectionCache[i]) { @@ -975,12 +977,13 @@ void QDeclarativeListViewPrivate::createSection(FxListItem *listItem) } while (i < sectionCacheSize); delete listItem->section; listItem->section = 0; + listItem->setPosition(pos); } } void QDeclarativeListViewPrivate::updateSections() { - if (sectionCriteria) { + if (sectionCriteria && !visibleItems.isEmpty()) { QString prevSection; if (visibleIndex > 0) prevSection = sectionAt(visibleIndex-1); @@ -990,6 +993,8 @@ void QDeclarativeListViewPrivate::updateSections() if (visibleItems.at(i)->index != -1) { QDeclarativeListViewAttached *attached = visibleItems.at(i)->attached; attached->setPrevSection(prevSection); + QString propValue = model->stringValue(visibleItems.at(i)->index, sectionCriteria->property()); + attached->setSection(sectionCriteria->sectionString(propValue)); if (prevAtt) prevAtt->setNextSection(attached->section()); createSection(visibleItems.at(i)); @@ -1560,6 +1565,7 @@ void QDeclarativeListView::setModel(const QVariant &model) disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); disconnect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int))); + disconnect(d->model, SIGNAL(itemsChanged(int,int)), this, SLOT(itemsChanged(int,int))); disconnect(d->model, SIGNAL(modelReset()), this, SLOT(modelReset())); disconnect(d->model, SIGNAL(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); disconnect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*))); @@ -1590,6 +1596,7 @@ void QDeclarativeListView::setModel(const QVariant &model) if (d->model) { d->bufferMode = QDeclarativeListViewPrivate::BufferBefore | QDeclarativeListViewPrivate::BufferAfter; if (isComponentComplete()) { + updateSections(); refill(); if (d->currentIndex >= d->model->count() || d->currentIndex < 0) { setCurrentIndex(0); @@ -1605,6 +1612,7 @@ void QDeclarativeListView::setModel(const QVariant &model) connect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); connect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); connect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int))); + connect(d->model, SIGNAL(itemsChanged(int,int)), this, SLOT(itemsChanged(int,int))); connect(d->model, SIGNAL(modelReset()), this, SLOT(modelReset())); connect(d->model, SIGNAL(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); connect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*))); @@ -1662,6 +1670,7 @@ void QDeclarativeListView::setDelegate(QDeclarativeComponent *delegate) d->visibleItems.clear(); d->releaseItem(d->currentItem); d->currentItem = 0; + updateSections(); refill(); d->moveReason = QDeclarativeListViewPrivate::SetIndex; d->updateCurrent(d->currentIndex); @@ -2075,8 +2084,10 @@ void QDeclarativeListView::setCacheBuffer(int b) QDeclarativeViewSection *QDeclarativeListView::sectionCriteria() { Q_D(QDeclarativeListView); - if (!d->sectionCriteria) + if (!d->sectionCriteria) { d->sectionCriteria = new QDeclarativeViewSection(this); + connect(d->sectionCriteria, SIGNAL(propertyChanged()), this, SLOT(updateSections())); + } return d->sectionCriteria; } @@ -2669,6 +2680,7 @@ void QDeclarativeListView::componentComplete() { Q_D(QDeclarativeListView); QDeclarativeFlickable::componentComplete(); + updateSections(); if (d->isValid()) { refill(); d->moveReason = QDeclarativeListViewPrivate::SetIndex; @@ -2685,6 +2697,18 @@ void QDeclarativeListView::componentComplete() } } +void QDeclarativeListView::updateSections() +{ + Q_D(QDeclarativeListView); + if (isComponentComplete() && d->model) { + QList roles; + if (d->sectionCriteria && !d->sectionCriteria->property().isEmpty()) + roles << d->sectionCriteria->property().toUtf8(); + d->model->setWatchedRoles(roles); + d->updateSections(); + } +} + void QDeclarativeListView::refill() { Q_D(QDeclarativeListView); @@ -2894,6 +2918,7 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count) for (int j = 0; j < added.count(); ++j) added.at(j)->attached->emitAdd(); + d->updateSections(); d->itemCount += count; emit countChanged(); } @@ -2986,6 +3011,7 @@ void QDeclarativeListView::itemsRemoved(int modelIndex, int count) } } + d->updateSections(); emit countChanged(); } @@ -3107,6 +3133,14 @@ void QDeclarativeListView::itemsMoved(int from, int to, int count) // Ensure we don't cause an ugly list scroll. d->visibleItems.first()->setPosition(d->visibleItems.first()->position() + moveBy); + d->updateSections(); + d->layout(); +} + +void QDeclarativeListView::itemsChanged(int, int) +{ + Q_D(QDeclarativeListView); + d->updateSections(); d->layout(); } diff --git a/src/declarative/graphicsitems/qdeclarativelistview_p.h b/src/declarative/graphicsitems/qdeclarativelistview_p.h index 735b248..2678b90 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview_p.h +++ b/src/declarative/graphicsitems/qdeclarativelistview_p.h @@ -250,11 +250,13 @@ protected: virtual void componentComplete(); private Q_SLOTS: + void updateSections(); void refill(); void trackedPositionChanged(); void itemsInserted(int index, int count); void itemsRemoved(int index, int count); void itemsMoved(int from, int to, int count); + void itemsChanged(int index, int count); void modelReset(); void destroyRemoved(); void createdItem(int index, QDeclarativeItem *item); diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 439f500..e569dd2 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -403,6 +403,8 @@ public: QDeclarativeListAccessor *m_listAccessor; QModelIndex m_root; + QList watchedRoles; + QList watchedRoleIds; }; class QDeclarativeVisualDataModelDataMetaObject : public QDeclarativeOpenMetaObject @@ -1170,10 +1172,25 @@ int QDeclarativeVisualDataModel::indexOf(QDeclarativeItem *item, QObject *) cons return -1; } +void QDeclarativeVisualDataModel::setWatchedRoles(QList roles) +{ + Q_D(QDeclarativeVisualDataModel); + d->watchedRoles = roles; + d->watchedRoleIds.clear(); +} + void QDeclarativeVisualDataModel::_q_itemsChanged(int index, int count, const QList &roles) { Q_D(QDeclarativeVisualDataModel); + bool changed = false; + if (!d->watchedRoles.isEmpty() && d->watchedRoleIds.isEmpty()) { + foreach (QByteArray r, d->watchedRoles) { + if (d->m_roleNames.contains(r)) + d->watchedRoleIds << d->m_roleNames.value(r); + } + } + for (QHash::ConstIterator iter = d->m_cache.begin(); iter != d->m_cache.end(); ++iter) { const int idx = iter.key(); @@ -1183,6 +1200,8 @@ void QDeclarativeVisualDataModel::_q_itemsChanged(int index, int count, QDeclarativeVisualDataModelData *data = d->data(objRef.obj); for (int roleIdx = 0; roleIdx < roles.count(); ++roleIdx) { int role = roles.at(roleIdx); + if (!changed && !d->watchedRoleIds.isEmpty() && d->watchedRoleIds.contains(role)) + changed = true; int propId = data->propForRole(role); if (propId != -1) { if (data->hasValue(propId)) { @@ -1217,6 +1236,8 @@ void QDeclarativeVisualDataModel::_q_itemsChanged(int index, int count, } } } + if (changed) + emit itemsChanged(index, count); } void QDeclarativeVisualDataModel::_q_itemsInserted(int index, int count) diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h b/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h index f09d8dd..5e187c2 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h @@ -79,6 +79,7 @@ public: virtual bool completePending() const = 0; virtual void completeItem() = 0; virtual QString stringValue(int, const QString &) = 0; + virtual void setWatchedRoles(QList roles) = 0; virtual int indexOf(QDeclarativeItem *item, QObject *objectContext) const = 0; @@ -87,6 +88,7 @@ Q_SIGNALS: void itemsInserted(int index, int count); void itemsRemoved(int index, int count); void itemsMoved(int from, int to, int count); + void itemsChanged(int index, int count); void modelReset(); void createdItem(int index, QDeclarativeItem *item); void destroyingItem(QDeclarativeItem *item); @@ -120,6 +122,7 @@ public: virtual bool completePending() const; virtual void completeItem(); virtual QString stringValue(int index, const QString &role); + virtual void setWatchedRoles(QList) {} virtual int indexOf(QDeclarativeItem *item, QObject *objectContext) const; @@ -174,6 +177,7 @@ public: bool completePending() const; void completeItem(); virtual QString stringValue(int index, const QString &role); + virtual void setWatchedRoles(QList roles); int indexOf(QDeclarativeItem *item, QObject *objectContext) const; diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 65ff635..7a58773 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -985,6 +985,17 @@ void tst_QDeclarativeListView::sections() QTRY_VERIFY(item); QTRY_COMPARE(item->height(), 20.0); + // check that headers change when item changes + listview->setContentY(0); + model.modifyItem(0, "changed", "2"); + + canvas->show(); + qApp->exec(); + + item = findItem(contentItem, "wrapper", 1); + QTRY_VERIFY(item); + QTRY_COMPARE(item->height(), 40.0); + delete canvas; } -- cgit v0.12 From 7ed040dd9f4769be9b254623d295aa93dbd569b8 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 12 Oct 2010 13:31:44 +1000 Subject: Rename .pro file to match directory name. Task-number: none Reviewed-by: Trust Me --- tests/manual/qtouchevent/multitouch.pro | 5 ----- tests/manual/qtouchevent/qtouchevent.pro | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) delete mode 100644 tests/manual/qtouchevent/multitouch.pro create mode 100644 tests/manual/qtouchevent/qtouchevent.pro diff --git a/tests/manual/qtouchevent/multitouch.pro b/tests/manual/qtouchevent/multitouch.pro deleted file mode 100644 index de1ee06..0000000 --- a/tests/manual/qtouchevent/multitouch.pro +++ /dev/null @@ -1,5 +0,0 @@ -QT += testlib -SOURCES = main.cpp \ - touchwidget.cpp -FORMS += form.ui -HEADERS += touchwidget.h diff --git a/tests/manual/qtouchevent/qtouchevent.pro b/tests/manual/qtouchevent/qtouchevent.pro new file mode 100644 index 0000000..de1ee06 --- /dev/null +++ b/tests/manual/qtouchevent/qtouchevent.pro @@ -0,0 +1,5 @@ +QT += testlib +SOURCES = main.cpp \ + touchwidget.cpp +FORMS += form.ui +HEADERS += touchwidget.h -- cgit v0.12 From e4dbf0c82b46e7a32e21185c8f633506229be944 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Tue, 12 Oct 2010 14:35:22 +1000 Subject: Bug: TextEdit ignores plain text format when pasting text Task-number: QTBUG-14003 Reviewed-by: Michael Brasser --- .../graphicsitems/qdeclarativetextedit.cpp | 1 + .../tst_qdeclarativetextedit.cpp | 25 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 6f5608a..e05f4e4 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -319,6 +319,7 @@ void QDeclarativeTextEdit::setTextFormat(TextFormat format) updateSize(); } d->format = format; + d->control->setAcceptRichText(d->format != PlainText); emit textFormatChanged(d->format); } diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 472c5ef..a7971cc 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -56,6 +56,8 @@ #include #include #include +#include +#include #include #include @@ -119,6 +121,8 @@ private slots: void openInputPanelOnClick(); void openInputPanelOnFocus(); void geometrySignals(); + void pastingRichText_QTBUG_14003(); + private: void simulateKey(QDeclarativeView *, int key); QDeclarativeView *createView(const QString &filename); @@ -1174,6 +1178,27 @@ void tst_qdeclarativetextedit::geometrySignals() delete o; } +void tst_qdeclarativetextedit::pastingRichText_QTBUG_14003() +{ +#ifndef QT_NO_CLIPBOARD + QString componentStr = "import QtQuick 1.0\nTextEdit { textFormat: TextEdit.PlainText }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeTextEdit *obj = qobject_cast(component.create()); + + QTRY_VERIFY(obj != 0); + QTRY_VERIFY(obj->textFormat() == QDeclarativeTextEdit::PlainText); + + QMimeData *mData = new QMimeData; + mData->setHtml("Hello"); + QApplication::clipboard()->setMimeData(mData); + + obj->paste(); + QTRY_VERIFY(obj->text() == ""); + QTRY_VERIFY(obj->textFormat() == QDeclarativeTextEdit::PlainText); +#endif +} + QTEST_MAIN(tst_qdeclarativetextedit) #include "tst_qdeclarativetextedit.moc" -- cgit v0.12 From 99390f4d639e35f3b0606df4d2abbcd3879f128f Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 12 Oct 2010 16:06:07 +1000 Subject: Compile on MSVC2008 --- src/declarative/qml/qdeclarativeengine.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index d768882..ec583f9 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -105,6 +105,7 @@ #ifdef Q_OS_WIN // for %APPDATA% #include #include +#include #define CSIDL_APPDATA 0x001a // \Application Data #endif @@ -2202,9 +2203,7 @@ bool QDeclarative_isFileCaseCorrect(const QString &fileName) #elif defined(Q_OS_WIN) wchar_t buffer[1024]; - DWORD rv = ::GetShortPathName((wchar_t*)absolute.utf16(), buffer, 1024); - if (rv == 0 || rv >= 1024) return true; - rv = ::GetLongPathName(buffer, buffer, 1024); + DWORD rv = ::GetLongPathName((wchar_t*)absolute.utf16(), buffer, 1024); if (rv == 0 || rv >= 1024) return true; QString canonical((QChar *)buffer); -- cgit v0.12 From 912085070b97af83a88d7de181cb0c5ef946589c Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Tue, 12 Oct 2010 17:14:15 +1000 Subject: Update QtCore def files --- src/s60installs/bwins/QtCoreu.def | 1 + src/s60installs/eabi/QtCoreu.def | 1 + 2 files changed, 2 insertions(+) diff --git a/src/s60installs/bwins/QtCoreu.def b/src/s60installs/bwins/QtCoreu.def index 5eeb244..f4e3a28 100644 --- a/src/s60installs/bwins/QtCoreu.def +++ b/src/s60installs/bwins/QtCoreu.def @@ -4483,4 +4483,5 @@ EXPORTS ?msecsSinceReference@QElapsedTimer@@QBE_JXZ @ 4482 NONAME ; long long QElapsedTimer::msecsSinceReference(void) const ?selectThread@QEventDispatcherSymbian@@AAEAAVQSelectThread@@XZ @ 4483 NONAME ; class QSelectThread & QEventDispatcherSymbian::selectThread(void) ?qt_symbian_SetupThreadHeap@@YAHHAAUSStdEpocThreadCreateInfo@@@Z @ 4484 NONAME ; int qt_symbian_SetupThreadHeap(int, struct SStdEpocThreadCreateInfo &) + ?objectNameChanged@QAbstractDeclarativeData@@2P6AXPAV1@PAVQObject@@@ZA @ 4485 NONAME ; void (*QAbstractDeclarativeData::objectNameChanged)(class QAbstractDeclarativeData *, class QObject *) diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def index f496839..eb53dca 100644 --- a/src/s60installs/eabi/QtCoreu.def +++ b/src/s60installs/eabi/QtCoreu.def @@ -3712,4 +3712,5 @@ EXPORTS _ZltRK13QElapsedTimerS1_ @ 3711 NONAME _ZrsR11QDataStreamR12QEasingCurve @ 3712 NONAME _Z26qt_symbian_SetupThreadHeapiR24SStdEpocThreadCreateInfo @ 3713 NONAME + _ZN24QAbstractDeclarativeData17objectNameChangedE @ 3714 NONAME DATA 4 -- cgit v0.12 From c284a54ac24b6ff800b66c193016cc98d6305293 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Tue, 12 Oct 2010 17:14:33 +1000 Subject: Update QtDeclarative def files --- src/s60installs/bwins/QtDeclarativeu.def | 1 + src/s60installs/eabi/QtDeclarativeu.def | 1 + 2 files changed, 2 insertions(+) diff --git a/src/s60installs/bwins/QtDeclarativeu.def b/src/s60installs/bwins/QtDeclarativeu.def index cf0398a..b72147e 100644 --- a/src/s60installs/bwins/QtDeclarativeu.def +++ b/src/s60installs/bwins/QtDeclarativeu.def @@ -1838,4 +1838,5 @@ EXPORTS ?addChanged@QDeclarativeBasePositioner@@IAEXXZ @ 1837 NONAME ; void QDeclarativeBasePositioner::addChanged(void) ?start@QDeclarativeAbstractAnimation@@QAEXXZ @ 1838 NONAME ; void QDeclarativeAbstractAnimation::start(void) ?qt_metacall@QDeclarativeAbstractAnimation@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1839 NONAME ; int QDeclarativeAbstractAnimation::qt_metacall(enum QMetaObject::Call, int, void * *) + ?connect@QDeclarativePropertyPrivate@@SA_NPBVQObject@@H0HHPAH@Z @ 1840 NONAME ; bool QDeclarativePropertyPrivate::connect(class QObject const *, int, class QObject const *, int, int, int *) diff --git a/src/s60installs/eabi/QtDeclarativeu.def b/src/s60installs/eabi/QtDeclarativeu.def index d4084cc..cbfafdc 100644 --- a/src/s60installs/eabi/QtDeclarativeu.def +++ b/src/s60installs/eabi/QtDeclarativeu.def @@ -1883,4 +1883,5 @@ EXPORTS _ZThn8_N29QDeclarativeAbstractAnimation9setTargetERK20QDeclarativeProperty @ 1882 NONAME _ZThn8_N29QDeclarativeAbstractAnimationD0Ev @ 1883 NONAME _ZThn8_N29QDeclarativeAbstractAnimationD1Ev @ 1884 NONAME + _ZN27QDeclarativePropertyPrivate7connectEPK7QObjectiS2_iiPi @ 1885 NONAME -- cgit v0.12 From 1113344ece060bb7386ea540becbf59f9c8320ea Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Fri, 8 Oct 2010 11:39:49 +0200 Subject: Crash fix when using the runtime graphics system on Symbian. If QWidget::destroy() is called (perhaps by setParent) then the window surface is deleted by the destructor of QSymbianControl instead of in the "normal" place which is ~QWidget(). This means that we should not attempt to use the RWindow in the window surface because it is in the process of being destroyed. Reviewed-by: Jani Hautakangas --- src/gui/painting/qwindowsurface_s60.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index 8bac1f5..ea19fcd 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -101,9 +101,11 @@ QS60WindowSurface::~QS60WindowSurface() // Issue empty redraw to clear the UI surface QWidget *w = window(); - RWindow *const window = static_cast(w->winId()->DrawableWindow()); - window->BeginRedraw(); - window->EndRedraw(); + if (w->testAttribute(Qt::WA_WState_Created)) { + RWindow *const window = static_cast(w->winId()->DrawableWindow()); + window->BeginRedraw(); + window->EndRedraw(); + } } } #endif -- cgit v0.12 From edddadd88950f22f6d813e50acdcf2711d3d5a84 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Tue, 12 Oct 2010 10:58:11 +0200 Subject: Add support for Qt::WA_TranslucentBackground with OpenVG on Symbian^3 S^3 does not have a client side API to support semi-transparent EGL surfaces so if this flag is enabled for a particular widget, then we should return a raster surface instead of a VG surface. Raster surfaces can still be semi-transparent but will be slower to render to. Task-number: QTBUG-14400 Reviewed-by: Jani Hautakangas Reviewed-by: Gareth Stockwell Reviewed-by: Sami Merila --- src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp b/src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp index 2c7c0b7..9674233 100644 --- a/src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp +++ b/src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp @@ -42,6 +42,9 @@ #include "qgraphicssystem_vg_p.h" #include #include +#if defined(Q_OS_SYMBIAN) && !defined(Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE) +#include +#endif QT_BEGIN_NAMESPACE @@ -64,6 +67,11 @@ QPixmapData *QVGGraphicsSystem::createPixmapData(QPixmapData::PixelType type) co QWindowSurface *QVGGraphicsSystem::createWindowSurface(QWidget *widget) const { +#if defined(Q_OS_SYMBIAN) && !defined(Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE) + QWidgetPrivate *d = qt_widget_private(widget); + if (!d->isOpaque && widget->testAttribute(Qt::WA_TranslucentBackground)) + return d->createDefaultWindowSurface_sys(); +#endif return new QVGWindowSurface(widget); } -- cgit v0.12 From 825e138da5376245d7ea58e5858365524e6753d9 Mon Sep 17 00:00:00 2001 From: mread Date: Tue, 12 Oct 2010 10:13:28 +0100 Subject: Revert "Making the hybrid allocator change compatible across all 4.7.x" This reverts commit c27f1586d7c4c56af1f46fa09ad77f03b7736e5d. The change to make the hybrid allocator change compatible across all 4.7.x releases is not needed after 4.7. The exported function added for the hybrid allocator will always be present now. --- src/s60main/newallocator_hook.cpp | 87 +-------------------------------------- src/s60main/s60main.pro | 3 -- 2 files changed, 1 insertion(+), 89 deletions(-) diff --git a/src/s60main/newallocator_hook.cpp b/src/s60main/newallocator_hook.cpp index 9ea2ef0..9cc6afb 100644 --- a/src/s60main/newallocator_hook.cpp +++ b/src/s60main/newallocator_hook.cpp @@ -41,11 +41,6 @@ #include #include -#ifdef QT_EXPORTS_NOT_FROZEN -// If exports in Qt DLLs are not frozen in this build, then we have to pick up the -// allocator creation function by import link. We know the function will be present -// in the DLLs we test with, as we have to use the DLLs we have built. - struct SStdEpocThreadCreateInfo; Q_CORE_EXPORT TInt qt_symbian_SetupThreadHeap(TBool aNotFirst, SStdEpocThreadCreateInfo& aInfo); @@ -56,88 +51,8 @@ Q_CORE_EXPORT TInt qt_symbian_SetupThreadHeap(TBool aNotFirst, SStdEpocThreadCre * Uses link-time symbol preemption to capture a call from the application * startup. On return, there is some kind of heap allocator installed on the * thread. -*/ +*/ TInt UserHeap::SetupThreadHeap(TBool aNotFirst, SStdEpocThreadCreateInfo& aInfo) { return qt_symbian_SetupThreadHeap(aNotFirst, aInfo); } - -#else // QT_EXPORTS_NOT_FROZEN -// If we are using an export frozen build, it should be compatible with all 4.7.x Qt releases. -// We want to use the allocator creation function introduced in qtcore.dll after 4.7.1. But we -// can't import link to it, as it may not be present in whatever 4.7.x DLLs we are running with. -// So the function is found and called dynamically, by library lookup. If it is not found, we -// use the OS allocator creation functions instead. - -struct SThreadCreateInfo - { - TAny* iHandle; - TInt iType; - TThreadFunction iFunction; - TAny* iPtr; - TAny* iSupervisorStack; - TInt iSupervisorStackSize; - TAny* iUserStack; - TInt iUserStackSize; - TInt iInitialThreadPriority; - TPtrC iName; - TInt iTotalSize; // Size including any extras (must be a multiple of 8 bytes) - }; - -struct SStdEpocThreadCreateInfo : public SThreadCreateInfo - { - RAllocator* iAllocator; - TInt iHeapInitialSize; - TInt iHeapMaxSize; - TInt iPadding; // Make structure size a multiple of 8 bytes - }; - - -/* \internal - * - * Uses link-time symbol preemption to capture a call from the application - * startup. On return, there is some kind of heap allocator installed on the - * thread. -*/ -TInt UserHeap::SetupThreadHeap(TBool aNotFirst, SStdEpocThreadCreateInfo& aInfo) -{ - TInt r = KErrNone; - -#ifndef __WINS__ - // attempt to create the fast allocator through a known export ordinal in qtcore.dll - RLibrary qtcore; - if (qtcore.Load(_L("qtcore.dll")) == KErrNone) - { - const int qt_symbian_SetupThreadHeap_eabi_ordinal = 3713; - TLibraryFunction libFunc = qtcore.Lookup(qt_symbian_SetupThreadHeap_eabi_ordinal); - if (libFunc) - { - typedef int (*TSetupThreadHeapFunc)(TBool aNotFirst, SStdEpocThreadCreateInfo& aInfo); - TSetupThreadHeapFunc p_qt_symbian_SetupThreadHeap = TSetupThreadHeapFunc(libFunc); - r = (*p_qt_symbian_SetupThreadHeap)(aNotFirst, aInfo); - } - qtcore.Close(); - if (libFunc) - return r; - } -#endif - - // no fast allocator support - use default allocator creation - if (!aInfo.iAllocator && aInfo.iHeapInitialSize>0) - { - // new heap required - RHeap* pH = NULL; - r = UserHeap::CreateThreadHeap(aInfo, pH); - } - else if (aInfo.iAllocator) - { - // sharing a heap - RAllocator* pA = aInfo.iAllocator; - pA->Open(); - User::SwitchAllocator(pA); - r = KErrNone; - } - return r; -} - -#endif // QT_EXPORTS_NOT_FROZEN diff --git a/src/s60main/s60main.pro b/src/s60main/s60main.pro index 8ab3bd3..664f155 100644 --- a/src/s60main/s60main.pro +++ b/src/s60main/s60main.pro @@ -31,9 +31,6 @@ symbian { # against GCCE apps, so remove it MMP_RULES -= $$MMP_RULES_DONT_EXPORT_ALL_CLASS_IMPEDIMENTA linux-armcc:QMAKE_CXXFLAGS *= --export_all_vtbl - - # Flag if exports are not frozen to avoid lookup of qtcore allocator creation function by ordinal - contains(CONFIG, def_files_disabled): DEFINES += QT_EXPORTS_NOT_FROZEN } else { error("$$_FILE_ is intended only for Symbian!") } -- cgit v0.12 From 8bac84cba1cc1de4c3d0b87772168184a2540076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Tue, 12 Oct 2010 12:54:15 +0200 Subject: Revert "Don't define highp/mediump/lowp if desktop GL has them" This reverts commit 6155050f68cc86c445552da61a5f240c16f5e2cd. The GL_ARB_ES2_compatibility extension does not mention the lowp, mediump or highp keywords. Task-number: QTBUG-14384 Reviewed-by: Samuel Reviewed-by: Prasanth --- dist/changes-4.6.4 | 4 +--- src/opengl/qgl.cpp | 3 --- src/opengl/qgl_p.h | 3 +-- src/opengl/qglshaderprogram.cpp | 10 ++-------- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/dist/changes-4.6.4 b/dist/changes-4.6.4 index 389aa3a..3949b9a 100644 --- a/dist/changes-4.6.4 +++ b/dist/changes-4.6.4 @@ -66,8 +66,6 @@ QtOpenGL - QGLShaderProgram * [QTBUG-12478] Don't resolve GLSL extensions if no shaders. * [QTBUG-12591] setUniformValue(QSize) was setting (w,w) not (w,h). - * [QTBUG-12862] Don't #define highp/mediump/lowp if the desktop OpenGL - implementation has the GL_ARB_ES2_compatibility extension. * [QTBUG-12554] Wrong OpenGLVersionFlags on OpenGL 4.0 systems. QtScript @@ -109,7 +107,7 @@ Third party components Qt for Unix (X11 and Mac OS X) ------------------------------ - - + - Qt for Linux/X11 ---------------- diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index f3d0d81..49a362c 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -4933,8 +4933,6 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions() glExtensions |= FragmentShader; if (extensions.match("GL_ARB_shader_objects")) glExtensions |= FragmentShader; - if (extensions.match("GL_ARB_ES2_compatibility")) - glExtensions |= ES2Compatibility; if (extensions.match("GL_ARB_texture_mirrored_repeat")) glExtensions |= MirroredRepeat; if (extensions.match("GL_EXT_framebuffer_object")) @@ -4953,7 +4951,6 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions() glExtensions |= FramebufferObject; glExtensions |= GenerateMipmap; glExtensions |= FragmentShader; - glExtensions |= ES2Compatibility; #endif #if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_1_CL) if (extensions.match("GL_OES_framebuffer_object")) diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 1603ca1..4facb65 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -291,8 +291,7 @@ public: DDSTextureCompression = 0x00008000, ETC1TextureCompression = 0x00010000, PVRTCTextureCompression = 0x00020000, - FragmentShader = 0x00040000, - ES2Compatibility = 0x00080000 + FragmentShader = 0x00040000 }; Q_DECLARE_FLAGS(Extensions, Extension) diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index 9bfe027..edbb635 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -97,10 +97,6 @@ QT_BEGIN_NAMESPACE to just features that are present in GLSL/ES, and avoid standard variable names that only work on the desktop. - If the \c{GL_ARB_ES2_compatibility} extension is present, - then the above prefix is not added because the desktop OpenGL - implementation supports precision qualifiers. - \section1 Simple shader example \snippet doc/src/snippets/code/src_opengl_qglshaderprogram.cpp 1 @@ -394,10 +390,8 @@ bool QGLShader::compileSourceCode(const char *source) srclen.append(GLint(headerLen)); } #ifdef QGL_DEFINE_QUALIFIERS - if (!(QGLExtensions::glExtensions() & QGLExtensions::ES2Compatibility)) { - src.append(qualifierDefines); - srclen.append(GLint(sizeof(qualifierDefines) - 1)); - } + src.append(qualifierDefines); + srclen.append(GLint(sizeof(qualifierDefines) - 1)); #endif #ifdef QGL_REDEFINE_HIGHP if (d->shaderType == Fragment) { -- cgit v0.12 From 71de6cd879f2f79900bda83cc4ba48f6df051d66 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Tue, 12 Oct 2010 12:41:26 +0300 Subject: Fix for CFbsBitmap to QPixmap conversion. Symbian bitmap formats may have different scanline length when compared to QImage formats. We need to define scanline length for intermediate QImage when converting from CFbsBitmap to QPixmap. Task-number: QTBUG-14218 Reviewed-by: Jason Barron --- src/gui/image/qpixmap_s60.cpp | 3 ++- src/openvg/qvg_symbian.cpp | 3 ++- tests/auto/qpixmap/tst_qpixmap.cpp | 11 +++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 47249d9..b7c8acb 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -968,11 +968,12 @@ void QS60PixmapData::fromNativeType(void* pixmap, NativeType nativeType) if (needsCopy) { TSize size = sourceBitmap->SizeInPixels(); + int bytesPerLine = sourceBitmap->ScanLineLength(size.iWidth, displayMode); QSymbianBitmapDataAccess da; da.beginDataAccess(sourceBitmap); uchar *bytes = (uchar*)sourceBitmap->DataAddress(); - QImage img = QImage(bytes, size.iWidth, size.iHeight, format); + QImage img = QImage(bytes, size.iWidth, size.iHeight, bytesPerLine, format); img = img.copy(); da.endDataAccess(sourceBitmap); diff --git a/src/openvg/qvg_symbian.cpp b/src/openvg/qvg_symbian.cpp index a9625b2..41b35fc 100644 --- a/src/openvg/qvg_symbian.cpp +++ b/src/openvg/qvg_symbian.cpp @@ -185,10 +185,11 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) QImage::Format format = qt_TDisplayMode2Format(displayMode); TSize size = bitmap->SizeInPixels(); + int bytesPerLine = bitmap->ScanLineLength(size.iWidth, displayMode); bitmap->BeginDataAccess(); uchar *bytes = (uchar*)bitmap->DataAddress(); - QImage img = QImage(bytes, size.iWidth, size.iHeight, format); + QImage img = QImage(bytes, size.iWidth, size.iHeight, bytesPerLine, format); img = img.copy(); bitmap->EndDataAccess(); diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 24cbb21..fdf8311 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -1160,6 +1160,8 @@ void tst_QPixmap::fromSymbianCFbsBitmap_data() const int smallHeight = 20; const int largeWidth = 240; const int largeHeight = 320; + const int notAlignedWidth = 250; + const int notAlignedHeight = 250; // Indexed Color Formats - Disabled since images seem to be blank -> no palette? // QTest::newRow("EGray2 small") << EGray2 << smallWidth << smallHeight << QColor(Qt::black); @@ -1172,14 +1174,19 @@ void tst_QPixmap::fromSymbianCFbsBitmap_data() // Direct Color Formats QTest::newRow("EColor4K small") << EColor4K << smallWidth << smallHeight << QColor(Qt::red); QTest::newRow("EColor4K big") << EColor4K << largeWidth << largeHeight << QColor(Qt::red); + QTest::newRow("EColor4K not aligned") << EColor4K << notAlignedWidth << notAlignedHeight << QColor(Qt::red); QTest::newRow("EColor64K small") << EColor64K << smallWidth << smallHeight << QColor(Qt::green); QTest::newRow("EColor64K big") << EColor64K << largeWidth << largeHeight << QColor(Qt::green); + QTest::newRow("EColor64K not aligned") << EColor64K << notAlignedWidth << notAlignedHeight << QColor(Qt::green); QTest::newRow("EColor16M small") << EColor16M << smallWidth << smallHeight << QColor(Qt::yellow); QTest::newRow("EColor16M big") << EColor16M << largeWidth << largeHeight << QColor(Qt::yellow); + QTest::newRow("EColor16M not aligned") << EColor16M << notAlignedWidth << notAlignedHeight << QColor(Qt::yellow); QTest::newRow("EColor16MU small") << EColor16MU << smallWidth << smallHeight << QColor(Qt::red); QTest::newRow("EColor16MU big") << EColor16MU << largeWidth << largeHeight << QColor(Qt::red); + QTest::newRow("EColor16MU not aligned") << EColor16MU << notAlignedWidth << notAlignedHeight << QColor(Qt::red); QTest::newRow("EColor16MA small opaque") << EColor16MA << smallWidth << smallHeight << QColor(255, 255, 0); QTest::newRow("EColor16MA big opaque") << EColor16MA << largeWidth << largeHeight << QColor(255, 255, 0); + QTest::newRow("EColor16MA not aligned opaque") << EColor16MA << notAlignedWidth << notAlignedHeight << QColor(255, 255, 0); // Semi-transparent Colors - Disabled for now, since the QCOMPARE fails, but visually confirmed to work // QTest::newRow("EColor16MA small semi") << EColor16MA << smallWidth << smallHeight << QColor(255, 255, 0, 127); @@ -1237,6 +1244,10 @@ void tst_QPixmap::fromSymbianCFbsBitmap() QColor actualColor(image.pixel(1, 1)); QCOMPARE(actualColor, color); + + QImage shouldBe(pixmap.width(), pixmap.height(), image.format()); + shouldBe.fill(color.rgba()); + QCOMPARE(image, shouldBe); } __UHEAP_MARKEND; -- cgit v0.12 From 354246566cf86f687ee897f95586ac17b5deb35c Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 12 Oct 2010 12:30:45 +0200 Subject: Fix text position with OpenGL engine and Freetype If you use the OpenGL engine, the left bearing of the glyph was incorrectly retrieved from the system as the glyph was queried with the wrong format, and adjustments for antialiasing were not applied. To make the position identical to painting with, new API was added to QFontEngine (The bounding box of a glyph is also not logically necessarily the same thing as the bounding box of the rasterized glyph.) Done-with: Trond Task-number: QTBUG-14410 --- src/gui/painting/qtextureglyphcache.cpp | 9 ++++++++- src/gui/text/qfontengine_ft.cpp | 25 +++++++++++++++++++++---- src/gui/text/qfontengine_ft_p.h | 11 +++-------- src/gui/text/qfontengine_p.h | 13 +++++++++++++ 4 files changed, 45 insertions(+), 13 deletions(-) diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 9219876..78c1019 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -143,6 +143,13 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const QHash listItemCoordinates; int rowHeight = 0; + QFontEngine::GlyphFormat format; + switch (m_type) { + case Raster_A8: format = QFontEngine::Format_A8; break; + case Raster_RGBMask: format = QFontEngine::Format_A32; break; + default: format = QFontEngine::Format_Mono; break; + } + // check each glyph for its metrics and get the required rowHeight. for (int i=0; i < numGlyphs; ++i) { const glyph_t glyph = glyphs[i]; @@ -157,7 +164,7 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const continue; if (listItemCoordinates.contains(GlyphAndSubPixelPosition(glyph, subPixelPosition))) continue; - glyph_metrics_t metrics = fontEngine->boundingBox(glyph, m_transform); + glyph_metrics_t metrics = fontEngine->alphaMapBoundingBox(glyph, m_transform, format); #ifdef CACHE_DEBUG printf("(%4x): w=%.2f, h=%.2f, xoff=%.2f, yoff=%.2f, x=%.2f, y=%.2f\n", diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 512afc8..6991143 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -755,10 +755,10 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format) return true; } -QFontEngineFT::Glyph *QFontEngineFT::loadGlyphMetrics(QGlyphSet *set, uint glyph) const +QFontEngineFT::Glyph *QFontEngineFT::loadGlyphMetrics(QGlyphSet *set, uint glyph, GlyphFormat format) const { Glyph *g = set->getGlyph(glyph); - if (g) + if (g && g->format == format) return g; int load_flags = FT_LOAD_DEFAULT | default_load_flags; @@ -766,6 +766,18 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyphMetrics(QGlyphSet *set, uint glyph ? FT_LOAD_TARGET_LIGHT : FT_LOAD_TARGET_NORMAL; + if (format == Format_Mono) { + load_target = FT_LOAD_TARGET_MONO; + } else if (format == Format_A32) { + if (subpixelType == QFontEngineFT::Subpixel_RGB || subpixelType == QFontEngineFT::Subpixel_BGR) { + if (default_hint_style == HintFull) + load_target = FT_LOAD_TARGET_LCD; + } else if (subpixelType == QFontEngineFT::Subpixel_VRGB || subpixelType == QFontEngineFT::Subpixel_VBGR) { + if (default_hint_style == HintFull) + load_target = FT_LOAD_TARGET_LCD_V; + } + } + if (set->outline_drawing) load_flags = FT_LOAD_NO_BITMAP; @@ -1767,6 +1779,11 @@ glyph_metrics_t QFontEngineFT::boundingBox(glyph_t glyph) glyph_metrics_t QFontEngineFT::boundingBox(glyph_t glyph, const QTransform &matrix) { + return alphaMapBoundingBox(glyph, matrix, QFontEngine::Format_None); +} + +glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, const QTransform &matrix, QFontEngine::GlyphFormat format) +{ FT_Face face = 0; glyph_metrics_t overall; QGlyphSet *glyphSet = 0; @@ -1810,9 +1827,9 @@ glyph_metrics_t QFontEngineFT::boundingBox(glyph_t glyph, const QTransform &matr glyphSet = &defaultGlyphSet; } Glyph * g = glyphSet->getGlyph(glyph); - if (!g) { + if (!g || g->format != format) { face = lockFace(); - g = loadGlyphMetrics(glyphSet, glyph); + g = loadGlyphMetrics(glyphSet, glyph, format); } if (g) { diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index 72f7d9f..1a1cadb 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -130,13 +130,6 @@ private: class Q_GUI_EXPORT QFontEngineFT : public QFontEngine { public: - enum GlyphFormat { - Format_None, - Format_Render = Format_None, - Format_Mono, - Format_A8, - Format_A32 - }; /* we don't cache glyphs that are too large anyway, so we can make this struct rather small */ struct Glyph { @@ -242,6 +235,8 @@ private: virtual void recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const; virtual QImage alphaMapForGlyph(glyph_t); virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, int margin, const QTransform &t); + virtual glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, const QTransform &matrix, + QFontEngine::GlyphFormat format); virtual void removeGlyphFromCache(glyph_t glyph); virtual int glyphCount() const; @@ -311,7 +306,7 @@ protected: bool embeddedbitmap; private: - QFontEngineFT::Glyph *loadGlyphMetrics(QGlyphSet *set, uint glyph) const; + QFontEngineFT::Glyph *loadGlyphMetrics(QGlyphSet *set, uint glyph, GlyphFormat format) const; GlyphFormat defaultFormat; FT_Matrix matrix; diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index d07c8c9..d1ec4c1 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -120,6 +120,14 @@ public: TestFontEngine = 0x1000 }; + enum GlyphFormat { + Format_None, + Format_Render = Format_None, + Format_Mono, + Format_A8, + Format_A32 + }; + QFontEngine(); virtual ~QFontEngine(); @@ -191,6 +199,11 @@ public: virtual QImage alphaMapForGlyph(glyph_t, const QTransform &t); virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, int margin, const QTransform &t); + virtual glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, const QTransform &matrix, GlyphFormat /*format*/) + { + return boundingBox(glyph, matrix); + } + virtual void removeGlyphFromCache(glyph_t); virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) = 0; -- cgit v0.12 From 61d23b1740780b3c7970c9dd5d089002a35f339e Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 12 Oct 2010 13:01:42 +0200 Subject: Fix memory leak in QFontEngineS60::addGlyphsToPath() An "Open()"ed RGlyphOutlineIterator needs to be "Close()"d before destroying the iterator. Otherwise some allocated memory does not get freed. The RGlyphOutlineIterator destructor does not close an open iterator. Task-Number: QTBUG-14408 Done-by: Colleague from Nokia, Oulu Reviewed-by: Alessandro Portale --- src/gui/text/qfontengine_s60.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index 5980f20..653965e 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -308,6 +308,7 @@ void QFontEngineS60::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, parseGlyphPathData(outlineChar, outlineEnd, *path, fontSizeInPixels, positions[count++].toPointF(), false); } while(KErrNone == iterator.Next() && count <= nglyphs); + iterator.Close(); #else // Q_SYMBIAN_HAS_GLYPHOUTLINE_API QFontEngine::addGlyphsToPath(glyphs, positions, nglyphs, path, flags); #endif //Q_SYMBIAN_HAS_GLYPHOUTLINE_API -- cgit v0.12 From 7cd0a90344d340f22b6b2d3afeef092dbaf2cd51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Tue, 12 Oct 2010 12:54:15 +0200 Subject: Revert "Don't define highp/mediump/lowp if desktop GL has them" This reverts commit 6155050f68cc86c445552da61a5f240c16f5e2cd. The GL_ARB_ES2_compatibility extension does not mention the lowp, mediump or highp keywords. Task-number: QTBUG-14384 Reviewed-by: Samuel Reviewed-by: Prasanth --- dist/changes-4.6.4 | 4 +--- src/opengl/qgl.cpp | 3 --- src/opengl/qgl_p.h | 3 +-- src/opengl/qglshaderprogram.cpp | 10 ++-------- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/dist/changes-4.6.4 b/dist/changes-4.6.4 index 389aa3a..3949b9a 100644 --- a/dist/changes-4.6.4 +++ b/dist/changes-4.6.4 @@ -66,8 +66,6 @@ QtOpenGL - QGLShaderProgram * [QTBUG-12478] Don't resolve GLSL extensions if no shaders. * [QTBUG-12591] setUniformValue(QSize) was setting (w,w) not (w,h). - * [QTBUG-12862] Don't #define highp/mediump/lowp if the desktop OpenGL - implementation has the GL_ARB_ES2_compatibility extension. * [QTBUG-12554] Wrong OpenGLVersionFlags on OpenGL 4.0 systems. QtScript @@ -109,7 +107,7 @@ Third party components Qt for Unix (X11 and Mac OS X) ------------------------------ - - + - Qt for Linux/X11 ---------------- diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 9e74e04..7f25887 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -5264,8 +5264,6 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions() glExtensions |= FragmentShader; if (extensions.match("GL_ARB_shader_objects")) glExtensions |= FragmentShader; - if (extensions.match("GL_ARB_ES2_compatibility")) - glExtensions |= ES2Compatibility; if (extensions.match("GL_ARB_texture_mirrored_repeat")) glExtensions |= MirroredRepeat; if (extensions.match("GL_EXT_framebuffer_object")) @@ -5286,7 +5284,6 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions() glExtensions |= FramebufferObject; glExtensions |= GenerateMipmap; glExtensions |= FragmentShader; - glExtensions |= ES2Compatibility; #endif #if defined(QT_OPENGL_ES_1) if (extensions.match("GL_OES_framebuffer_object")) diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 623eeaf..387c8f7 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -284,8 +284,7 @@ public: DDSTextureCompression = 0x00008000, ETC1TextureCompression = 0x00010000, PVRTCTextureCompression = 0x00020000, - FragmentShader = 0x00040000, - ES2Compatibility = 0x00080000 + FragmentShader = 0x00040000 }; Q_DECLARE_FLAGS(Extensions, Extension) diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index bc1c009..74382b0 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -97,10 +97,6 @@ QT_BEGIN_NAMESPACE to just features that are present in GLSL/ES, and avoid standard variable names that only work on the desktop. - If the \c{GL_ARB_ES2_compatibility} extension is present, - then the above prefix is not added because the desktop OpenGL - implementation supports precision qualifiers. - \section1 Simple shader example \snippet doc/src/snippets/code/src_opengl_qglshaderprogram.cpp 1 @@ -398,10 +394,8 @@ bool QGLShader::compileSourceCode(const char *source) srclen.append(GLint(headerLen)); } #ifdef QGL_DEFINE_QUALIFIERS - if (!(QGLExtensions::glExtensions() & QGLExtensions::ES2Compatibility)) { - src.append(qualifierDefines); - srclen.append(GLint(sizeof(qualifierDefines) - 1)); - } + src.append(qualifierDefines); + srclen.append(GLint(sizeof(qualifierDefines) - 1)); #endif #ifdef QGL_REDEFINE_HIGHP if (d->shaderType == Fragment) { -- cgit v0.12 From ab057be7228d20d909246183505b72e821cc440f Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 12 Oct 2010 14:00:38 +0200 Subject: Remove unnecessary calls to GetHorizBounds() + boundingBox() QFontEngineS60::boundingBox_const(): The metrics that CFont::getCharacterData() returns is equivalent to what TOpenFontCharMetrics::GetHorizBounds() returns. So, remove the use of TRect glyphBounds, and TOpenFontCharMetrics::GetHorizBounds(). Implementation of TOpenFontCharMetrics::GetHorizBounds(): http://developer.symbian.org/oss/API_REF/Public_API/file/837f303aceeb/epoc32/include/openfont.h#l1352 QRasterPaintEngine::drawGlyphsS60(): The metrics that QFontEngineS60::getCharacterData() returns are equivalent to what QFontEngineS60::boundingBox() returns. So, remove the use of glyph_metrics_t metrics, and QFontEngineS60::boundingBox(). These changes increase the Fps in qt\tests\manual\textrendering\textperformance "Latin" from 16.2 to 16.5 Fps on an XM5800. And they do that by removing code :) Task-number: QTBUG-14378 Reviewed-by: Jason Barron --- src/gui/painting/qpaintengine_raster.cpp | 6 ++---- src/gui/text/qfontengine_s60.cpp | 10 ++++------ 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 9749244..c92d291 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3164,10 +3164,8 @@ void QRasterPaintEngine::drawGlyphsS60(const QPointF &p, const QTextItemInt &ti) const TUint8 *glyphBitmapBytes; TSize glyphBitmapSize; fe->getCharacterData(glyphs[i], tmetrics, glyphBitmapBytes, glyphBitmapSize); - const glyph_metrics_t metrics = ti.fontEngine->boundingBox(glyphs[i]); - const int x = qFloor(positions[i].x + metrics.x + aliasDelta); - const int y = qFloor(positions[i].y + metrics.y + aliasDelta); - + const int x = qFloor(positions[i].x + tmetrics.HorizBearingX() + aliasDelta); + const int y = qFloor(positions[i].y - tmetrics.HorizBearingY() + aliasDelta); alphaPenBlt(glyphBitmapBytes, glyphBitmapSize.iWidth, 8, x, y, glyphBitmapSize.iWidth, glyphBitmapSize.iHeight); } diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index 653965e..32fcb82 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -360,13 +360,11 @@ glyph_metrics_t QFontEngineS60::boundingBox_const(glyph_t glyph) const const TUint8 *glyphBitmapBytes; TSize glyphBitmapSize; getCharacterData(glyph, metrics, glyphBitmapBytes, glyphBitmapSize); - TRect glyphBounds; - metrics.GetHorizBounds(glyphBounds); const glyph_metrics_t result( - glyphBounds.iTl.iX, - glyphBounds.iTl.iY, - glyphBounds.Width(), - glyphBounds.Height(), + metrics.HorizBearingX(), + -metrics.HorizBearingY(), + metrics.Width(), + metrics.Height(), metrics.HorizAdvance(), 0 ); -- cgit v0.12 From ea5281e6cd1ebc63e080f7232d4eb28f1610539e Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 12 Oct 2010 14:18:54 +0200 Subject: Implement QFontEngineS60::emSquareSize() Some glyph position tweaks during the shaping phase require the "Units per Em" information for the font. QFontEngineS60 did not reimplement emSquareSize(), therefore, some combined glyphs were rendered incorrectly (see QTBUG-10725) This patch implements QFontEngineS60::emSquareSize() Since Symbian does not provide the "Units per Em" via public Api, we have to pick that out of the 'head' font table. The value is cached per font. Task-Number: QTBUG-10725 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qfontengine_s60.cpp | 26 ++++++++++++++++++++++++++ src/gui/text/qfontengine_s60_p.h | 3 +++ 2 files changed, 29 insertions(+) diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index 32fcb82..824a8e2 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -41,6 +41,7 @@ #include "qfontengine_s60_p.h" #include "qtextengine_p.h" +#include "qendian.h" #include "qglobal.h" #include #include "qimage.h" @@ -176,6 +177,24 @@ CFont *QSymbianTypeFaceExtras::fontOwner() const return m_cFont; } +QFixed QSymbianTypeFaceExtras::unitsPerEm() const +{ + if (m_unitsPerEm.value() != 0) + return m_unitsPerEm; + const QByteArray head = getSfntTable(MAKE_TAG('h', 'e', 'a', 'd')); + const int unitsPerEmOffset = 18; + if (head.size() > unitsPerEmOffset + sizeof(quint16)) { + const uchar* tableData = reinterpret_cast(head.constData()); + const uchar* unitsPerEm = tableData + unitsPerEmOffset; + m_unitsPerEm = qFromBigEndian(unitsPerEm); + } else { + // Bitmap font? Corrupt font? + // We return -1 and let the QFontEngineS60 return the pixel size. + m_unitsPerEm = -1; + } + return m_unitsPerEm; +} + // duplicated from qfontengine_xyz.cpp static inline unsigned int getChar(const QChar *str, int &i, const int len) { @@ -248,6 +267,13 @@ QFontEngineS60::~QFontEngineS60() releaseFont(m_scaledFont); } +QFixed QFontEngineS60::emSquareSize() const +{ + const QFixed unitsPerEm = m_extras->unitsPerEm(); + return unitsPerEm.toInt() == -1 ? + QFixed::fromReal(m_originalFontSizeInPixels) : unitsPerEm; +} + bool QFontEngineS60::stringToCMap(const QChar *characters, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const { if (*nglyphs < len) { diff --git a/src/gui/text/qfontengine_s60_p.h b/src/gui/text/qfontengine_s60_p.h index d05c23c..c65ce55 100644 --- a/src/gui/text/qfontengine_s60_p.h +++ b/src/gui/text/qfontengine_s60_p.h @@ -82,11 +82,13 @@ public: const uchar *cmap() const; CFont *fontOwner() const; bool isSymbolCMap() const; + QFixed unitsPerEm() const; private: CFont* m_cFont; mutable bool m_symbolCMap; mutable QByteArray m_cmapTable; + mutable QFixed m_unitsPerEm; #ifndef Q_SYMBIAN_HAS_FONTTABLE_API COpenFont *m_openFont; mutable MOpenFontTrueTypeExtension *m_trueTypeExtension; @@ -99,6 +101,7 @@ public: QFontEngineS60(const QFontDef &fontDef, const QSymbianTypeFaceExtras *extras); ~QFontEngineS60(); + QFixed emSquareSize() const; bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const; void recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const; -- cgit v0.12 From 601fc892705c3aeb751f8bec9924200822f1a85d Mon Sep 17 00:00:00 2001 From: kh1 Date: Tue, 12 Oct 2010 14:25:24 +0200 Subject: Assistant: Insert all keywords with empty ids, as ids are not mendatory. Task-number: QTBUG-14393 Reviewed-by: ck --- tools/assistant/lib/qhelpgenerator.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/assistant/lib/qhelpgenerator.cpp b/tools/assistant/lib/qhelpgenerator.cpp index 85bdd75..f94031b 100644 --- a/tools/assistant/lib/qhelpgenerator.cpp +++ b/tools/assistant/lib/qhelpgenerator.cpp @@ -712,14 +712,15 @@ bool QHelpGenerator::insertKeywords(const QList &keywords, d->query->exec(QLatin1String("BEGIN")); QSet indices; foreach (const QHelpDataIndexItem &itm, keywords) { - - /* - * Identical ids make no sense and just confuse the Assistant user, - * so we ignore all repetitions. - */ + // Identical ids make no sense and just confuse the Assistant user, + // so we ignore all repetitions. if (indices.contains(itm.identifier)) continue; - indices.insert(itm.identifier); + + // Still empty ids should be ignored, as otherwise we will include only + // the first keyword with an empty id. + if (!itm.identifier.isEmpty()) + indices.insert(itm.identifier); pos = itm.reference.indexOf(QLatin1Char('#')); fileName = itm.reference.left(pos); -- cgit v0.12 From 6594e39808aecde42c1310f1ad800ffa4d7f0768 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 12 Oct 2010 14:33:27 +0200 Subject: Doc: Fixed minor documentation issues. --- src/corelib/tools/qstring.cpp | 2 +- src/gui/widgets/qdatetimeedit.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index d8dab43..bfbdb73 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -567,7 +567,7 @@ const QString::Null QString::null = { }; strings from a string list that contain a particular substring or that match a particular QRegExp using the QStringList::filter() function. -: + \section1 Querying String Data If you want to see if a QString starts or ends with a particular diff --git a/src/gui/widgets/qdatetimeedit.cpp b/src/gui/widgets/qdatetimeedit.cpp index bd6c577..8043747 100644 --- a/src/gui/widgets/qdatetimeedit.cpp +++ b/src/gui/widgets/qdatetimeedit.cpp @@ -832,11 +832,11 @@ QString QDateTimeEdit::sectionText(Section section) const This format is the same as the one used described in QDateTime::toString() and QDateTime::fromString() - Example format strings(assuming that the date is 2nd of July 1969): + Example format strings (assuming that the date is 2nd of July 1969): \table \header \i Format \i Result - \row \i dd.MM.yyyy \i 02.07.1969 + \row \i dd.MM.yyyy \i 02.07.1969 \row \i MMM d yy \i Jul 2 69 \row \i MMMM d yy \i July 2 69 \endtable -- cgit v0.12 From 0b3402f2ff0db1de747e9d38021a5c9300c8a011 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 12 Oct 2010 15:33:44 +0300 Subject: Added bearer plugin deployment to qt.iby Reviewed-by: TrustMe --- src/s60installs/qt.iby | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/s60installs/qt.iby b/src/s60installs/qt.iby index b6cdce9..4afbf05 100644 --- a/src/s60installs/qt.iby +++ b/src/s60installs/qt.iby @@ -53,6 +53,9 @@ file=ABI_DIR\BUILD_DIR\qaudio.dll SHARED_LIB_DIR\qaudio.dll file=ABI_DIR\BUILD_DIR\qvggraphicssystem.dll SHARED_LIB_DIR\qvggraphicssystem.dll file=ABI_DIR\BUILD_DIR\qglgraphicssystem.dll SHARED_LIB_DIR\qglgraphicssystem.dll +// bearer +file=ABI_DIR\BUILD_DIR\qsymbianbearer.dll SHARED_LIB_DIR\qsymbianbearer.dll + // S60 version compatibility plugins for 5.0 (3.1 and 3.2 devices are never likely to have this in ROM, // so don't bother including those plugins file=ABI_DIR\BUILD_DIR\qts60plugin_5_0.dll SHARED_LIB_DIR\qts60plugin_5_0.dll @@ -99,6 +102,9 @@ data=\epoc32\data\qt\qtlibspluginstubs\qaudio.qtplugin resource\qt\plugins\audio data=\epoc32\data\z\resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin data=\epoc32\data\z\resource\qt\plugins\graphicssystems\qglgraphicssystem.qtplugin resource\qt\plugins\graphicssystems\qglgraphicssystem.qtplugin +// bearer stub +data=\epoc32\data\z\resource\qt\plugins\bearer\qsymbianbearer.qtplugin resource\qt\plugins\bearer\qsymbianbearer.qtplugin + // Stub sis file data=ZSYSTEM\install\qt_stub.sis System\Install\qt_stub.sis data=ZSYSTEM\install\qtwebkit_stub.sis System\Install\qtwebkit_stub.sis -- cgit v0.12 From e39f273b921a36b307b2b2adddd7135f0c5a8858 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Tue, 12 Oct 2010 14:39:12 +0200 Subject: Delete qtdemoapps.iby. This file was used to deploy certain Qt demo applications to a Symbian ROM image and was always being exported to the epoc32 tree when Qt was compiled. This doesn't make sense since these will never (hopefully) be deployed on any real device. If someone wants demo apps deployed, they should create their own IBY file. Reviewed-by: Shane Kearns Reviewed-by: Miikka Heikkinen --- src/s60installs/qtdemoapps.iby | 15 --------------- src/s60installs/s60installs.pro | 1 - 2 files changed, 16 deletions(-) delete mode 100644 src/s60installs/qtdemoapps.iby diff --git a/src/s60installs/qtdemoapps.iby b/src/s60installs/qtdemoapps.iby deleted file mode 100644 index d888135..0000000 --- a/src/s60installs/qtdemoapps.iby +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef QTDEMOAPPS_IBY -#define QTDEMOAPPS_IBY - -// A subset of Qt demo & example applications - -// Note that star requires OpenVG and the Qt OpenVG paint engine -S60_APP_EXE(star) -S60_APP_RESOURCE(star) -data=\epoc32\data\Z\private\10003a3f\import\Apps\star_reg.rsc \private\10003a3f\import\apps\star_reg.rsc - -S60_APP_EXE(wiggly) -S60_APP_RESOURCE(wiggly) -data=\epoc32\data\Z\private\10003a3f\import\Apps\wiggly_reg.rsc \private\10003a3f\import\apps\wiggly_reg.rsc - -#endif // QTDEMOAPPS_IBY diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index c73ed06..d63b97c 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -200,5 +200,4 @@ symbian: { } BLD_INF_RULES.prj_exports += "qt.iby $$CORE_MW_LAYER_IBY_EXPORT_PATH(qt.iby)" - BLD_INF_RULES.prj_exports += "qtdemoapps.iby $$CUSTOMER_VARIANT_APP_LAYER_IBY_EXPORT_PATH(qtdemoapps.iby)" } -- cgit v0.12 From 5c92ff774eadca40e6f33b5e096df01ecc5da717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Tue, 12 Oct 2010 12:54:15 +0200 Subject: Revert "Don't define highp/mediump/lowp if desktop GL has them" This reverts commit 6155050f68cc86c445552da61a5f240c16f5e2cd. The GL_ARB_ES2_compatibility extension does not mention the lowp, mediump or highp keywords. Task-number: QTBUG-14384 Reviewed-by: Samuel Reviewed-by: Prasanth --- dist/changes-4.6.4 | 4 +--- src/opengl/qgl.cpp | 3 --- src/opengl/qgl_p.h | 3 +-- src/opengl/qglshaderprogram.cpp | 10 ++-------- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/dist/changes-4.6.4 b/dist/changes-4.6.4 index 389aa3a..3949b9a 100644 --- a/dist/changes-4.6.4 +++ b/dist/changes-4.6.4 @@ -66,8 +66,6 @@ QtOpenGL - QGLShaderProgram * [QTBUG-12478] Don't resolve GLSL extensions if no shaders. * [QTBUG-12591] setUniformValue(QSize) was setting (w,w) not (w,h). - * [QTBUG-12862] Don't #define highp/mediump/lowp if the desktop OpenGL - implementation has the GL_ARB_ES2_compatibility extension. * [QTBUG-12554] Wrong OpenGLVersionFlags on OpenGL 4.0 systems. QtScript @@ -109,7 +107,7 @@ Third party components Qt for Unix (X11 and Mac OS X) ------------------------------ - - + - Qt for Linux/X11 ---------------- diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index cb31491..c4d2bd5 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -5325,8 +5325,6 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions() glExtensions |= FragmentShader; if (extensions.match("GL_ARB_shader_objects")) glExtensions |= FragmentShader; - if (extensions.match("GL_ARB_ES2_compatibility")) - glExtensions |= ES2Compatibility; if (extensions.match("GL_ARB_texture_mirrored_repeat")) glExtensions |= MirroredRepeat; if (extensions.match("GL_EXT_framebuffer_object")) @@ -5347,7 +5345,6 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions() glExtensions |= FramebufferObject; glExtensions |= GenerateMipmap; glExtensions |= FragmentShader; - glExtensions |= ES2Compatibility; #endif #if defined(QT_OPENGL_ES_1) if (extensions.match("GL_OES_framebuffer_object")) diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 78f888a..f86a848 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -282,8 +282,7 @@ public: DDSTextureCompression = 0x00008000, ETC1TextureCompression = 0x00010000, PVRTCTextureCompression = 0x00020000, - FragmentShader = 0x00040000, - ES2Compatibility = 0x00080000 + FragmentShader = 0x00040000 }; Q_DECLARE_FLAGS(Extensions, Extension) diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index bc1c009..74382b0 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -97,10 +97,6 @@ QT_BEGIN_NAMESPACE to just features that are present in GLSL/ES, and avoid standard variable names that only work on the desktop. - If the \c{GL_ARB_ES2_compatibility} extension is present, - then the above prefix is not added because the desktop OpenGL - implementation supports precision qualifiers. - \section1 Simple shader example \snippet doc/src/snippets/code/src_opengl_qglshaderprogram.cpp 1 @@ -398,10 +394,8 @@ bool QGLShader::compileSourceCode(const char *source) srclen.append(GLint(headerLen)); } #ifdef QGL_DEFINE_QUALIFIERS - if (!(QGLExtensions::glExtensions() & QGLExtensions::ES2Compatibility)) { - src.append(qualifierDefines); - srclen.append(GLint(sizeof(qualifierDefines) - 1)); - } + src.append(qualifierDefines); + srclen.append(GLint(sizeof(qualifierDefines) - 1)); #endif #ifdef QGL_REDEFINE_HIGHP if (d->shaderType == Fragment) { -- cgit v0.12 From 92fb7e405a93785af162e5dff0a6b2a2d40060bc Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 12 Oct 2010 16:27:31 +0200 Subject: Optimize QFontEngineS60::recalcAdvances() (Addition to ab057be7228d20d909246183505b72e821cc440f) Instead of using a glyph_metrics_t (which gets filled with data from a TOpenFontCharMetrics), we use a TOpenFontCharMetrics, directly. Also, the advances_y gets set to 0. Like on the other platforms. These change increases the Fps in qt\tests\manual\textrendering\textperformance "Latin" from 16.5 to 16.6 Fps on an XM5800. I am sure that I can construct a benchmark where the speed gain is bigger. Task-number: QTBUG-14378 Reviewed-by: TrustMe --- src/gui/text/qfontengine_s60.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index 824a8e2..3705136 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -303,10 +303,13 @@ bool QFontEngineS60::stringToCMap(const QChar *characters, int len, QGlyphLayout void QFontEngineS60::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const { Q_UNUSED(flags); + TOpenFontCharMetrics metrics; + const TUint8 *glyphBitmapBytes; + TSize glyphBitmapSize; for (int i = 0; i < glyphs->numGlyphs; i++) { - const glyph_metrics_t bbox = boundingBox_const(glyphs->glyphs[i]); - glyphs->advances_x[i] = bbox.xoff; - glyphs->advances_y[i] = bbox.yoff; + getCharacterData(glyphs->glyphs[i], metrics, glyphBitmapBytes, glyphBitmapSize); + glyphs->advances_x[i] = metrics.HorizAdvance(); + glyphs->advances_y[i] = 0; } } -- cgit v0.12 From 087414e3ee4dd4c9f8f13c5a9eb69c5f70fb3d59 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Tue, 12 Oct 2010 17:19:46 +0200 Subject: Doc - remove disclaimer Task-number: QTBUG-14407 Reviewed-by: Friedemann Kleint Reviewed-by: Henry Haverinen --- doc/src/porting/qt4-designer.qdoc | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/doc/src/porting/qt4-designer.qdoc b/doc/src/porting/qt4-designer.qdoc index fff3e89..ea5147a 100644 --- a/doc/src/porting/qt4-designer.qdoc +++ b/doc/src/porting/qt4-designer.qdoc @@ -36,18 +36,14 @@ \QD has been completely re-written based on our experience with the previous versions of the product for Qt 3. One of the main new - ideas behind this new version is to release the application as a + ideas is to release the application as a collection of interchangeable components that include the property editor, the widget box, and other useful tools for creating graphical user interfaces with Qt. These components can either be used together in the \QD application, or independently integrated into other systems. As a result, certain features such as the project editor and code editor have been removed from the version - included with this release. - - The current version of \QD is near feature complete and can be used for - many tasks. However, it is still under continuous development. This - document will explain what is already in place. + included with release 4. See also the \l{Qt Designer Manual}. @@ -128,7 +124,7 @@ \row \i \bold{Widget Editing Mode} - The new \QD allows widgets to be dropped into existing layouts on + \QD now allows widgets to be dropped into existing layouts on the form. Previously, it was necessary to break layouts in order to add new widgets to them. @@ -189,7 +185,7 @@ \row \i \bold{The Resource Editor} - The new \QD fully supports The Qt Resource System, and provide the + \QD now fully supports The Qt Resource System, and provides the Resource Editor to help designers and developers manage the resources that are needed by their applications. @@ -210,8 +206,8 @@ \i \inlineimage designer-action-editor.png \i \bold{The Action Editor} - With the release of Qt 4.1, \QD introduces the Action Editor - simplifying the management of actions when creating main window + With the release of Qt 4.1, \QD the Action Editor was introduced + to simplify the management of actions when creating main window applications. When creating a main window, you can add a menu bar and toolbars @@ -261,7 +257,7 @@ \section1 Run-Time Support for Forms - With the Qt 4.1 release, the new QtUiTools module is introduced to + With the Qt 4.1 release, the new QtUiTools module was introduced to provide classes handling forms created with \QD. Currently the module only contains the QUiLoader class. -- cgit v0.12 From 8b2ec1a88db8b2b932e2218080adf6202fd9f559 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 12 Oct 2010 17:43:54 +0200 Subject: Mouse event compression Compression turned on by default, can be turned off by adding "nocompress" to the specification. Also turn off experimental touch event support by default. --- src/plugins/generic/linuxinput/qlinuxinput.cpp | 41 +++++++++++++++++++------- src/plugins/generic/linuxinput/qlinuxinput.h | 1 + 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/plugins/generic/linuxinput/qlinuxinput.cpp b/src/plugins/generic/linuxinput/qlinuxinput.cpp index 2b01973..782194d 100644 --- a/src/plugins/generic/linuxinput/qlinuxinput.cpp +++ b/src/plugins/generic/linuxinput/qlinuxinput.cpp @@ -65,9 +65,9 @@ QT_BEGIN_NAMESPACE -#define QT_QPA_EXPERIMENTAL_MULTITOUCH +//#define QT_QPA_EXPERIMENTAL_TOUCHEVENT -#ifdef QT_QPA_EXPERIMENTAL_MULTITOUCH +#ifdef QT_QPA_EXPERIMENTAL_TOUCHEVENT class QLinuxInputMouseHandlerData { public: @@ -139,8 +139,15 @@ QLinuxInputMouseHandler::QLinuxInputMouseHandler(const QString &key, setObjectName(QLatin1String("LinuxInputSubsystem Mouse Handler")); QString dev = QLatin1String("/dev/input/event0"); - if (specification.startsWith(QLatin1String("/dev/"))) - dev = specification; + m_compression = true; + + QStringList args = specification.split(QLatin1Char(':')); + foreach (const QString &arg, args) { + if (arg == "nocompress") + m_compression = false; + else if (arg.startsWith(QLatin1String("/dev/"))) + dev = arg; + } m_fd = QT_OPEN(dev.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0); if (m_fd >= 0) { @@ -150,7 +157,7 @@ QLinuxInputMouseHandler::QLinuxInputMouseHandler(const QString &key, qWarning("Cannot open mouse input device '%s': %s", qPrintable(dev), strerror(errno)); return; } -#ifdef QT_QPA_EXPERIMENTAL_MULTITOUCH +#ifdef QT_QPA_EXPERIMENTAL_TOUCHEVENT d = new QLinuxInputMouseHandlerData; #endif } @@ -160,7 +167,9 @@ QLinuxInputMouseHandler::~QLinuxInputMouseHandler() { if (m_fd >= 0) QT_CLOSE(m_fd); +#ifdef QT_QPA_EXPERIMENTAL_TOUCHEVENT delete d; +#endif } void QLinuxInputMouseHandler::readMouseData() @@ -168,7 +177,7 @@ void QLinuxInputMouseHandler::readMouseData() struct ::input_event buffer[32]; int n = 0; bool posChanged = false; - + bool pendingMouseEvent = false; forever { n = QT_READ(m_fd, reinterpret_cast(buffer) + n, sizeof(buffer) - n); @@ -204,7 +213,7 @@ void QLinuxInputMouseHandler::readMouseData() //ignore for now... } else if (data->code == ABS_HAT0Y) { //ignore for now... -#ifdef QT_QPA_EXPERIMENTAL_MULTITOUCH +#ifdef QT_QPA_EXPERIMENTAL_TOUCHEVENT } else if (data->code == ABS_MT_POSITION_X) { d->currentX = data->value; d->seenMT = true; @@ -248,6 +257,7 @@ void QLinuxInputMouseHandler::readMouseData() QWindowSystemInterface::handleMouseEvent(0, QPoint(m_x, m_y), QPoint(m_x, m_y), m_buttons); + pendingMouseEvent = false; } else if (data->type == EV_KEY && data->code >= BTN_LEFT && data->code <= BTN_MIDDLE) { Qt::MouseButton button = Qt::NoButton; switch (data->code) { @@ -262,16 +272,19 @@ void QLinuxInputMouseHandler::readMouseData() QWindowSystemInterface::handleMouseEvent(0, QPoint(m_x, m_y), QPoint(m_x, m_y), m_buttons); + pendingMouseEvent = false; } else if (data->type == EV_SYN && data->code == SYN_REPORT) { if (posChanged) { posChanged = false; QPoint pos(m_x, m_y); - - QWindowSystemInterface::handleMouseEvent(0, pos, pos, m_buttons); + if (m_compression) + pendingMouseEvent = true; + else + QWindowSystemInterface::handleMouseEvent(0, pos, pos, m_buttons); } -#ifdef QT_QPA_EXPERIMENTAL_MULTITOUCH +#ifdef QT_QPA_EXPERIMENTAL_TOUCHEVENT if (d->state == QEvent::TouchBegin && !d->seenMT) { - //no multi-touch events to send + //no multipoint-touch events to send } else { if (!d->seenMT) d->state = QEvent::TouchEnd; @@ -316,9 +329,15 @@ void QLinuxInputMouseHandler::readMouseData() } else { unknown = true; } +#ifdef QLINUXINPUT_EXTRA_DEBUG if (unknown) { qWarning("unknown mouse event type=%x, code=%x, value=%x", data->type, data->code, data->value); } +#endif + } + if (m_compression && pendingMouseEvent) { + QPoint pos(m_x, m_y); + QWindowSystemInterface::handleMouseEvent(0, pos, pos, m_buttons); } } diff --git a/src/plugins/generic/linuxinput/qlinuxinput.h b/src/plugins/generic/linuxinput/qlinuxinput.h index 535816d..4b7d7de 100644 --- a/src/plugins/generic/linuxinput/qlinuxinput.h +++ b/src/plugins/generic/linuxinput/qlinuxinput.h @@ -69,6 +69,7 @@ private: int m_fd; int m_x, m_y; Qt::MouseButtons m_buttons; + bool m_compression; QLinuxInputMouseHandlerData *d; }; -- cgit v0.12 From 7d21b598d299ee61d61f15c69b41b8b38daf9bea Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 12 Oct 2010 22:55:20 +0200 Subject: Remove obsolete tweak in QFontEngineS60::alphaMapForGlyph On some Symbian versions (apparently <= Symbian^1), CFont::GetCharacterData() returns 8-bit data with gray values 0x00, 0x10 ... 0xe0, 0xf0 due to a bug. The glyphs are nowhere perfectly opaque, which is bad for blitting. This has been however been fixed for Symbian^3. The funny thing about this tweak was that it was only executed on Symbian^3 (with the OpenVG/OpenGL paintengines). On Symbian^1 and below (rasterpaintengine), QFontEngineS60::alphaMapForGlyph() does not get called at all, anymore. Therefore, the removal of this tweak should not be noticable anywhere, except that on Symbian^3, quite a few CPU cycles are now saved. See the attachments in QTBUG-14419 for details. Task-Number: QTBUG-14419 Reviewed-By: TrustMe --- src/gui/text/qfontengine_s60.cpp | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index 3705136..bf30e1c 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -345,29 +345,17 @@ void QFontEngineS60::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, QImage QFontEngineS60::alphaMapForGlyph(glyph_t glyph) { + // Note: On some Symbian versions (apparently <= Symbian^1), this + // function will return gray values 0x00, 0x10 ... 0xe0, 0xf0 due + // to a bug. The glyphs are nowhere perfectly opaque. + // This has been fixed for Symbian^3. + TOpenFontCharMetrics metrics; const TUint8 *glyphBitmapBytes; TSize glyphBitmapSize; getCharacterData(glyph, metrics, glyphBitmapBytes, glyphBitmapSize); QImage result(glyphBitmapBytes, glyphBitmapSize.iWidth, glyphBitmapSize.iHeight, glyphBitmapSize.iWidth, QImage::Format_Indexed8); result.setColorTable(grayPalette()); - - // The above setColorTable() call detached the image data anyway, so why not shape tha data a bit, while we can. - // CFont::GetCharacterData() returns 8-bit data that obviously was 4-bit data before, and converted to 8-bit incorrectly. - // The data values are 0x00, 0x10 ... 0xe0, 0xf0. So, a real opaque 0xff is never reached, which we get punished - // for every time we want to blit this glyph in the raster paint engine. - // "Fix" is to convert all 0xf0 to 0xff. Is fine, quality wise, and I assume faster than correcting all values. - // Blitting is however, evidentially faster now. - const int bpl = result.bytesPerLine(); - for (int row = 0; row < result.height(); ++row) { - uchar *scanLine = result.scanLine(row); - for (int column = 0; column < bpl; ++column) { - if (*scanLine == 0xf0) - *scanLine = 0xff; - scanLine++; - } - } - return result; } -- cgit v0.12 From a311b854e0886f0498c068af5b489af36a96b845 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 13 Oct 2010 10:52:16 +1000 Subject: Compile on WinCE --- src/declarative/qml/qdeclarativeengine.cpp | 4 ++-- .../declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp | 4 ++-- .../qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index ec583f9..8e1416e 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -2193,14 +2193,14 @@ const QMetaObject *QDeclarativeEnginePrivate::metaObjectForType(int t) const bool QDeclarative_isFileCaseCorrect(const QString &fileName) { -#if defined(Q_OS_MAC) || defined(Q_OS_WIN) +#if defined(Q_OS_MAC) || defined(Q_OS_WIN32) QFileInfo info(fileName); QString absolute = info.absoluteFilePath(); #if defined(Q_OS_MAC) QString canonical = info.canonicalFilePath(); -#elif defined(Q_OS_WIN) +#elif defined(Q_OS_WIN32) wchar_t buffer[1024]; DWORD rv = ::GetLongPathName((wchar_t*)absolute.utf16(), buffer, 1024); diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index be04dee..061ac48 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -387,7 +387,7 @@ void tst_qdeclarativelanguage::errors_data() QTest::newRow("singularProperty") << "singularProperty.qml" << "singularProperty.errors.txt" << false; QTest::newRow("singularProperty.2") << "singularProperty.2.qml" << "singularProperty.2.errors.txt" << false; QTest::newRow("incorrectCase") << "incorrectCase.qml" -#if defined(Q_OS_MAC) || defined(Q_OS_WIN) +#if defined(Q_OS_MAC) || defined(Q_OS_WIN32) << "incorrectCase.errors.insensitive.txt" #else << "incorrectCase.errors.sensitive.txt" @@ -1784,7 +1784,7 @@ void tst_qdeclarativelanguage::importIncorrectCase() QList errors = component.errors(); QCOMPARE(errors.count(), 1); -#if defined(Q_OS_MAC) || defined(Q_OS_WIN) +#if defined(Q_OS_MAC) || defined(Q_OS_WIN32) QString expectedError = QLatin1String("cannot load module \"com.Nokia.installedtest\": File name case mismatch for \"") + QFileInfo(__FILE__).absoluteDir().filePath("data/lib/com/Nokia/installedtest/qmldir") + QLatin1String("\""); #else QString expectedError = QLatin1String("module \"com.Nokia.installedtest\" is not installed"); diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp index 51f66a5..85fa718 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp +++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp @@ -131,10 +131,10 @@ void tst_qdeclarativemoduleplugin::incorrectPluginCase() QList errors = component.errors(); QCOMPARE(errors.count(), 1); -#if defined(Q_OS_MAC) || defined(Q_OS_WIN) +#if defined(Q_OS_MAC) || defined(Q_OS_WIN32) #if defined(Q_OS_MAC) QString libname = "libPluGin.dylib"; -#elif defined(Q_OS_WIN) +#elif defined(Q_OS_WIN32) QString libname = "PluGin.dll"; #endif QString expectedError = QLatin1String("plugin cannot be loaded for module \"com.nokia.WrongCase\": File name case mismatch for \"") + QFileInfo(__FILE__).absoluteDir().filePath("imports/com/nokia/WrongCase/" + libname) + QLatin1String("\""); -- cgit v0.12 From ca53010303bca1b686fdd0488e0549c0a42a60a1 Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Wed, 13 Oct 2010 11:43:25 +1000 Subject: Demo Spectrum wav data size is not calculated correctly - Grab length of audio data from Data chunk size - Read from the device no greater than the audio Data chunk size Task-number: QTBUG-13779 Reviewed-by: Andrew den Exter --- demos/spectrum/app/wavfile.cpp | 168 ++++++++++++++++++++++------------------- demos/spectrum/app/wavfile.h | 1 + 2 files changed, 90 insertions(+), 79 deletions(-) diff --git a/demos/spectrum/app/wavfile.cpp b/demos/spectrum/app/wavfile.cpp index b9467e3..74d5918 100644 --- a/demos/spectrum/app/wavfile.cpp +++ b/demos/spectrum/app/wavfile.cpp @@ -76,80 +76,84 @@ struct CombinedHeader { RIFFHeader riff; WAVEHeader wave; - DATAHeader data; }; -static const int HeaderLength = sizeof(CombinedHeader); WavFile::WavFile(const QAudioFormat &format, qint64 dataLength) - : m_format(format) - , m_dataLength(dataLength) + : m_format(format) + , m_dataLength(dataLength) + , m_dataPosition(0) { - } bool WavFile::readHeader(QIODevice &device) { - bool result = true; - - if (!device.isSequential()) - result = device.seek(0); - // else, assume that current position is the start of the header - - if (result) { - CombinedHeader header; - result = (device.read(reinterpret_cast(&header), HeaderLength) == HeaderLength); - if (result) { - if ((memcmp(&header.riff.descriptor.id, "RIFF", 4) == 0 - || memcmp(&header.riff.descriptor.id, "RIFX", 4) == 0) - && memcmp(&header.riff.type, "WAVE", 4) == 0 - && memcmp(&header.wave.descriptor.id, "fmt ", 4) == 0 - && header.wave.audioFormat == 1 // PCM - ) { - if (memcmp(&header.riff.descriptor.id, "RIFF", 4) == 0) - m_format.setByteOrder(QAudioFormat::LittleEndian); - else - m_format.setByteOrder(QAudioFormat::BigEndian); - - m_format.setChannels(qFromLittleEndian(header.wave.numChannels)); - m_format.setCodec("audio/pcm"); - m_format.setFrequency(qFromLittleEndian(header.wave.sampleRate)); - m_format.setSampleSize(qFromLittleEndian(header.wave.bitsPerSample)); - - switch(header.wave.bitsPerSample) { - case 8: - m_format.setSampleType(QAudioFormat::UnSignedInt); - break; - case 16: - m_format.setSampleType(QAudioFormat::SignedInt); - break; - default: - result = false; - } - - m_dataLength = device.size() - HeaderLength; - } else { - result = false; - } + if (!device.isSequential()) { + if (!device.seek(0)) + return false; + // XXX: else, assume that current position is the start of the header + } + + CombinedHeader header; + if (device.read(reinterpret_cast(&header), sizeof(CombinedHeader)) != sizeof(CombinedHeader)) + return false; + + if ((memcmp(&header.riff.descriptor.id, "RIFF", 4) == 0 + || memcmp(&header.riff.descriptor.id, "RIFX", 4) == 0) + && memcmp(&header.riff.type, "WAVE", 4) == 0 + && memcmp(&header.wave.descriptor.id, "fmt ", 4) == 0 + && (header.wave.audioFormat == 1 || header.wave.audioFormat == 0)) { + + // Read off remaining header information + DATAHeader dataHeader; + + if (qFromLittleEndian(header.wave.descriptor.size) > sizeof(WAVEHeader)) { + // Extended data available + quint16 extraFormatBytes; + if (device.peek((char*)&extraFormatBytes, sizeof(quint16)) != sizeof(quint16)) + return false; + const qint64 throwAwayBytes = sizeof(quint16) + qFromLittleEndian(extraFormatBytes); + if (device.read(throwAwayBytes).size() != throwAwayBytes) + return false; } + + if (device.read((char*)&dataHeader, sizeof(DATAHeader)) != sizeof(DATAHeader)) + return false; + + // Establish format + if (memcmp(&header.riff.descriptor.id, "RIFF", 4) == 0) + m_format.setByteOrder(QAudioFormat::LittleEndian); + else + m_format.setByteOrder(QAudioFormat::BigEndian); + + int bps = qFromLittleEndian(header.wave.bitsPerSample); + m_format.setChannels(qFromLittleEndian(header.wave.numChannels)); + m_format.setCodec("audio/pcm"); + m_format.setFrequency(qFromLittleEndian(header.wave.sampleRate)); + m_format.setSampleSize(qFromLittleEndian(header.wave.bitsPerSample)); + m_format.setSampleType(bps == 8 ? QAudioFormat::UnSignedInt : QAudioFormat::SignedInt); + + m_dataLength = qFromLittleEndian(dataHeader.descriptor.size); + m_dataPosition = 0; } - return result; + return true; } bool WavFile::writeHeader(QIODevice &device) { CombinedHeader header; + DATAHeader dataHeader; - memset(&header, 0, HeaderLength); + memset(&header, 0, sizeof(CombinedHeader)); // RIFF header if (m_format.byteOrder() == QAudioFormat::LittleEndian) strncpy(&header.riff.descriptor.id[0], "RIFF", 4); else strncpy(&header.riff.descriptor.id[0], "RIFX", 4); - qToLittleEndian(quint32(m_dataLength + HeaderLength - 8), + qToLittleEndian(quint32(m_dataLength + sizeof(CombinedHeader) + sizeof(DATAHeader) - sizeof(chunk)), reinterpret_cast(&header.riff.descriptor.size)); strncpy(&header.riff.type[0], "WAVE", 4); @@ -171,11 +175,12 @@ bool WavFile::writeHeader(QIODevice &device) reinterpret_cast(&header.wave.bitsPerSample)); // DATA header - strncpy(&header.data.descriptor.id[0], "data", 4); + strncpy(dataHeader.descriptor.id, "data", 4); qToLittleEndian(quint32(m_dataLength), - reinterpret_cast(&header.data.descriptor.size)); + reinterpret_cast(&dataHeader.descriptor.size)); - return (device.write(reinterpret_cast(&header), HeaderLength) == HeaderLength); + return device.write(reinterpret_cast(&header), sizeof(CombinedHeader)) == sizeof(CombinedHeader) + && device.write(reinterpret_cast(&dataHeader), sizeof(DATAHeader)) == sizeof(DATAHeader); } const QAudioFormat& WavFile::format() const @@ -190,7 +195,7 @@ qint64 WavFile::dataLength() const qint64 WavFile::headerLength() { - return HeaderLength; + return sizeof(CombinedHeader); } bool WavFile::writeDataLength(QIODevice &device, qint64 dataLength) @@ -205,42 +210,47 @@ bool WavFile::writeDataLength(QIODevice &device, qint64 dataLength) return result; } -#include -#include - qint64 WavFile::readData(QIODevice &device, QByteArray &buffer, QAudioFormat outputFormat) { - if (QAudioFormat() == outputFormat) + // Sanity checks + if (!outputFormat.isValid()) outputFormat = m_format; + if (!isPCMS16LE(outputFormat) || !isPCMS16LE(m_format)) + return 0; + + if (m_dataPosition == m_dataLength) + return 0; + + // Process qint64 result = 0; - QFile file("wav.txt"); - file.open(QIODevice::WriteOnly | QIODevice::Text); - QTextStream stream; - stream.setDevice(&file); - - if (isPCMS16LE(outputFormat) && isPCMS16LE(m_format)) { - QVector inputSample(2 * m_format.channels()); - - qint16 *output = reinterpret_cast(buffer.data()); - - while (result < buffer.size()) { - if (device.read(inputSample.data(), inputSample.count())) { - int inputIdx = 0; - for (int outputIdx = 0; outputIdx < outputFormat.channels(); ++outputIdx) { - const qint16* input = reinterpret_cast(inputSample.data() + 2 * inputIdx); - *output++ = qFromLittleEndian(*input); - result += 2; - if (inputIdx < m_format.channels()) - ++inputIdx; - } - } else { - break; + const int frameSize = 2 * m_format.channels(); // 16 bit samples + QVector inputSample(frameSize); + + qint16 *output = reinterpret_cast(buffer.data()); + + while (result < buffer.size()) { + if (m_dataPosition == m_dataLength) + break; + + // XXX only working with particular alignments + if (device.read(inputSample.data(), inputSample.count())) { + int inputIdx = 0; + for (int outputIdx = 0; outputIdx < outputFormat.channels(); ++outputIdx) { + const qint16* input = reinterpret_cast(inputSample.data() + 2 * inputIdx); + *output++ = qFromLittleEndian(*input); + result += 2; + if (inputIdx < m_format.channels()) + ++inputIdx; } + m_dataPosition += frameSize; + } else { + break; } } + return result; } diff --git a/demos/spectrum/app/wavfile.h b/demos/spectrum/app/wavfile.h index f2f3304..fc14b08 100644 --- a/demos/spectrum/app/wavfile.h +++ b/demos/spectrum/app/wavfile.h @@ -77,6 +77,7 @@ public: private: QAudioFormat m_format; qint64 m_dataLength; + qint64 m_dataPosition; }; #endif -- cgit v0.12 From 47827b076d3546e630dbfd6cfcfb8b627f41d13e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Tue, 12 Oct 2010 12:54:15 +0200 Subject: Revert "Don't define highp/mediump/lowp if desktop GL has them" This reverts commit 6155050f68cc86c445552da61a5f240c16f5e2cd. The GL_ARB_ES2_compatibility extension does not mention the lowp, mediump or highp keywords. Task-number: QTBUG-14384 Reviewed-by: Samuel Reviewed-by: Prasanth (cherry picked from commit 7cd0a90344d340f22b6b2d3afeef092dbaf2cd51) --- dist/changes-4.6.4 | 4 +--- src/opengl/qgl.cpp | 3 --- src/opengl/qgl_p.h | 3 +-- src/opengl/qglshaderprogram.cpp | 10 ++-------- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/dist/changes-4.6.4 b/dist/changes-4.6.4 index 389aa3a..3949b9a 100644 --- a/dist/changes-4.6.4 +++ b/dist/changes-4.6.4 @@ -66,8 +66,6 @@ QtOpenGL - QGLShaderProgram * [QTBUG-12478] Don't resolve GLSL extensions if no shaders. * [QTBUG-12591] setUniformValue(QSize) was setting (w,w) not (w,h). - * [QTBUG-12862] Don't #define highp/mediump/lowp if the desktop OpenGL - implementation has the GL_ARB_ES2_compatibility extension. * [QTBUG-12554] Wrong OpenGLVersionFlags on OpenGL 4.0 systems. QtScript @@ -109,7 +107,7 @@ Third party components Qt for Unix (X11 and Mac OS X) ------------------------------ - - + - Qt for Linux/X11 ---------------- diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 15070d4..3a4a244 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -5261,8 +5261,6 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions() glExtensions |= FragmentShader; if (extensions.match("GL_ARB_shader_objects")) glExtensions |= FragmentShader; - if (extensions.match("GL_ARB_ES2_compatibility")) - glExtensions |= ES2Compatibility; if (extensions.match("GL_ARB_texture_mirrored_repeat")) glExtensions |= MirroredRepeat; if (extensions.match("GL_EXT_framebuffer_object")) @@ -5283,7 +5281,6 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions() glExtensions |= FramebufferObject; glExtensions |= GenerateMipmap; glExtensions |= FragmentShader; - glExtensions |= ES2Compatibility; #endif #if defined(QT_OPENGL_ES_1) if (extensions.match("GL_OES_framebuffer_object")) diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 623eeaf..387c8f7 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -284,8 +284,7 @@ public: DDSTextureCompression = 0x00008000, ETC1TextureCompression = 0x00010000, PVRTCTextureCompression = 0x00020000, - FragmentShader = 0x00040000, - ES2Compatibility = 0x00080000 + FragmentShader = 0x00040000 }; Q_DECLARE_FLAGS(Extensions, Extension) diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index bc1c009..74382b0 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -97,10 +97,6 @@ QT_BEGIN_NAMESPACE to just features that are present in GLSL/ES, and avoid standard variable names that only work on the desktop. - If the \c{GL_ARB_ES2_compatibility} extension is present, - then the above prefix is not added because the desktop OpenGL - implementation supports precision qualifiers. - \section1 Simple shader example \snippet doc/src/snippets/code/src_opengl_qglshaderprogram.cpp 1 @@ -398,10 +394,8 @@ bool QGLShader::compileSourceCode(const char *source) srclen.append(GLint(headerLen)); } #ifdef QGL_DEFINE_QUALIFIERS - if (!(QGLExtensions::glExtensions() & QGLExtensions::ES2Compatibility)) { - src.append(qualifierDefines); - srclen.append(GLint(sizeof(qualifierDefines) - 1)); - } + src.append(qualifierDefines); + srclen.append(GLint(sizeof(qualifierDefines) - 1)); #endif #ifdef QGL_REDEFINE_HIGHP if (d->shaderType == Fragment) { -- cgit v0.12 From 2553ca41a05afb28e49d813a1aebed12474f6b00 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 13 Oct 2010 14:55:07 +1000 Subject: Remove debug code added by 650a0078e2cef43eff107fe8d2505f64a0bfedf0 Task-number: QT-4093 --- .../auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 7a58773..2649c0d 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -989,9 +989,6 @@ void tst_QDeclarativeListView::sections() listview->setContentY(0); model.modifyItem(0, "changed", "2"); - canvas->show(); - qApp->exec(); - item = findItem(contentItem, "wrapper", 1); QTRY_VERIFY(item); QTRY_COMPARE(item->height(), 40.0); -- cgit v0.12 From cdcc5bc1a82b70d27752370d83b4b21c912f6153 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 13 Oct 2010 15:01:19 +1000 Subject: Fix alignment bugs in Text element Task-number: QTBUG-14374 --- src/declarative/graphicsitems/qdeclarativetext.cpp | 961 +++++++++++---------- .../graphicsitems/qdeclarativetext_p_p.h | 48 +- 2 files changed, 526 insertions(+), 483 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 54cb062..308aefa 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -85,12 +85,13 @@ private: DEFINE_BOOL_CONFIG_OPTION(enableImageCache, QML_ENABLE_TEXT_IMAGE_CACHE); QDeclarativeTextPrivate::QDeclarativeTextPrivate() -: color((QRgb)0), style(QDeclarativeText::Normal), - hAlign(QDeclarativeText::AlignLeft), vAlign(QDeclarativeText::AlignTop), elideMode(QDeclarativeText::ElideNone), - imgDirty(true), dirty(true), richText(false), singleline(false), cache(true), internalWidthUpdate(false), doc(0), - format(QDeclarativeText::AutoText), wrapMode(QDeclarativeText::NoWrap) +: color((QRgb)0), style(QDeclarativeText::Normal), hAlign(QDeclarativeText::AlignLeft), + vAlign(QDeclarativeText::AlignTop), elideMode(QDeclarativeText::ElideNone), + format(QDeclarativeText::AutoText), wrapMode(QDeclarativeText::NoWrap), imageCacheDirty(true), + updateOnComponentComplete(true), richText(false), singleline(false), cacheAllTextAsImage(true), + internalWidthUpdate(false), doc(0) { - cache = enableImageCache(); + cacheAllTextAsImage = enableImageCache(); QGraphicsItemPrivate::acceptedMouseButtons = Qt::LeftButton; QGraphicsItemPrivate::flags = QGraphicsItemPrivate::flags & ~QGraphicsItem::ItemHasNoContents; } @@ -151,7 +152,6 @@ void QTextDocumentWithImageResources::requestFinished() #endif QDeclarativeTextPrivate *d = QDeclarativeTextPrivate::get(textItem); d->updateLayout(); - d->markImgDirty(); } } @@ -172,6 +172,382 @@ void QTextDocumentWithImageResources::setText(const QString &text) QSet QTextDocumentWithImageResources::errors; +QDeclarativeTextPrivate::~QDeclarativeTextPrivate() +{ +} + +void QDeclarativeTextPrivate::updateLayout() +{ + Q_Q(QDeclarativeText); + if (!q->isComponentComplete()) { + updateOnComponentComplete = true; + return; + } + + // Setup instance of QTextLayout for all cases other than richtext + if (!richText) { + layout.clearLayout(); + layout.setFont(font); + if (format != QDeclarativeText::StyledText) { + QString tmp = text; + tmp.replace(QLatin1Char('\n'), QChar::LineSeparator); + singleline = !tmp.contains(QChar::LineSeparator); + if (singleline && elideMode != QDeclarativeText::ElideNone && q->widthValid()) { + QFontMetrics fm(font); + tmp = fm.elidedText(tmp,(Qt::TextElideMode)elideMode,q->width()); // XXX still worth layout...? + } + layout.setText(tmp); + } else { + singleline = false; + QDeclarativeStyledText::parse(text, layout); + } + } + + updateSize(); +} + +void QDeclarativeTextPrivate::updateSize() +{ + Q_Q(QDeclarativeText); + + if (!q->isComponentComplete()) { + updateOnComponentComplete = true; + return; + } + + invalidateImageCache(); + + QFontMetrics fm(font); + if (text.isEmpty()) { + q->setImplicitHeight(fm.height()); + emit q->paintedSizeChanged(); + return; + } + + int dy = q->height(); + QSize size(0, 0); + + //setup instance of QTextLayout for all cases other than richtext + if (!richText) { + size = setupTextLayout(); + if (layedOutTextSize != size) { + q->prepareGeometryChange(); + layedOutTextSize = size; + } + dy -= size.height(); + } else { + singleline = false; // richtext can't elide or be optimized for single-line case + ensureDoc(); + doc->setDefaultFont(font); + QTextOption option((Qt::Alignment)int(hAlign | vAlign)); + option.setWrapMode(QTextOption::WrapMode(wrapMode)); + doc->setDefaultTextOption(option); + if (wrapMode != QDeclarativeText::NoWrap && q->widthValid()) + doc->setTextWidth(q->width()); + else + doc->setTextWidth(doc->idealWidth()); // ### Text does not align if width is not set (QTextDoc bug) + dy -= (int)doc->size().height(); + QSize dsize = doc->size().toSize(); + if (dsize != layedOutTextSize) { + q->prepareGeometryChange(); + layedOutTextSize = dsize; + } + size = QSize(int(doc->idealWidth()),dsize.height()); + } + int yoff = 0; + + if (q->heightValid()) { + if (vAlign == QDeclarativeText::AlignBottom) + yoff = dy; + else if (vAlign == QDeclarativeText::AlignVCenter) + yoff = dy/2; + } + q->setBaselineOffset(fm.ascent() + yoff); + + //### need to comfirm cost of always setting these for richText + internalWidthUpdate = true; + q->setImplicitWidth(size.width()); + internalWidthUpdate = false; + q->setImplicitHeight(size.height()); + emit q->paintedSizeChanged(); +} + +/*! + Lays out the QDeclarativeTextPrivate::layout QTextLayout in the constraints of the QDeclarativeText. + + Returns the size of the final text. This can be used to position the text vertically (the text is + already absolutely positioned horizontally). +*/ +QSize QDeclarativeTextPrivate::setupTextLayout() +{ + // ### text layout handling should be profiled and optimized as needed + // what about QStackTextEngine engine(tmp, d->font.font()); QTextLayout textLayout(&engine); + + Q_Q(QDeclarativeText); + layout.setCacheEnabled(true); + + int height = 0; + qreal widthUsed = 0; + qreal lineWidth = 0; + + //set manual width + if ((wrapMode != QDeclarativeText::NoWrap || elideMode != QDeclarativeText::ElideNone) && q->widthValid()) + lineWidth = q->width(); + + QTextOption textOption = layout.textOption(); + textOption.setWrapMode(QTextOption::WrapMode(wrapMode)); + layout.setTextOption(textOption); + + layout.beginLayout(); + while (1) { + QTextLine line = layout.createLine(); + if (!line.isValid()) + break; + + if ((wrapMode != QDeclarativeText::NoWrap || elideMode != QDeclarativeText::ElideNone) && q->widthValid()) + line.setLineWidth(lineWidth); + } + layout.endLayout(); + + for (int i = 0; i < layout.lineCount(); ++i) { + QTextLine line = layout.lineAt(i); + widthUsed = qMax(widthUsed, line.naturalTextWidth()); + } + + qreal layoutWidth = q->widthValid()?q->width():widthUsed; + + int x = 0; + for (int i = 0; i < layout.lineCount(); ++i) { + QTextLine line = layout.lineAt(i); + line.setPosition(QPointF(0, height)); + height += int(line.height()); + + if (!cacheAllTextAsImage) { + if (hAlign == QDeclarativeText::AlignLeft) { + x = 0; + } else if (hAlign == QDeclarativeText::AlignRight) { + x = layoutWidth - (int)line.naturalTextWidth(); + } else if (hAlign == QDeclarativeText::AlignHCenter) { + x = (layoutWidth - (int)line.naturalTextWidth()) / 2; + } + line.setPosition(QPoint(x, (int)line.y())); + } + } + + return QSize(qCeil(widthUsed), height); +} + +/*! + Returns a painted version of the QDeclarativeTextPrivate::layout QTextLayout. + If \a drawStyle is true, the style color overrides all colors in the document. +*/ +QPixmap QDeclarativeTextPrivate::textLayoutImage(bool drawStyle) +{ + //do layout + QSize size = layedOutTextSize; + + int x = 0; + for (int i = 0; i < layout.lineCount(); ++i) { + QTextLine line = layout.lineAt(i); + if (hAlign == QDeclarativeText::AlignLeft) { + x = 0; + } else if (hAlign == QDeclarativeText::AlignRight) { + x = size.width() - (int)line.naturalTextWidth(); + } else if (hAlign == QDeclarativeText::AlignHCenter) { + x = (size.width() - (int)line.naturalTextWidth()) / 2; + } + line.setPosition(QPoint(x, (int)line.y())); + } + + //paint text + QPixmap img(size); + if (!size.isEmpty()) { + img.fill(Qt::transparent); +#ifdef Q_WS_MAC + bool oldSmooth = qt_applefontsmoothing_enabled; + qt_applefontsmoothing_enabled = false; +#endif + QPainter p(&img); +#ifdef Q_WS_MAC + qt_applefontsmoothing_enabled = oldSmooth; +#endif + drawTextLayout(&p, QPointF(0,0), drawStyle); + } + return img; +} + +/*! + Paints the QDeclarativeTextPrivate::layout QTextLayout into \a painter at \a pos. If + \a drawStyle is true, the style color overrides all colors in the document. +*/ +void QDeclarativeTextPrivate::drawTextLayout(QPainter *painter, const QPointF &pos, bool drawStyle) +{ + if (drawStyle) + painter->setPen(styleColor); + else + painter->setPen(color); + painter->setFont(font); + layout.draw(painter, pos); +} + +/*! + Returns a painted version of the QDeclarativeTextPrivate::doc QTextDocument. + If \a drawStyle is true, the style color overrides all colors in the document. +*/ +QPixmap QDeclarativeTextPrivate::textDocumentImage(bool drawStyle) +{ + QSize size = doc->size().toSize(); + + //paint text + QPixmap img(size); + img.fill(Qt::transparent); +#ifdef Q_WS_MAC + bool oldSmooth = qt_applefontsmoothing_enabled; + qt_applefontsmoothing_enabled = false; +#endif + QPainter p(&img); +#ifdef Q_WS_MAC + qt_applefontsmoothing_enabled = oldSmooth; +#endif + + QAbstractTextDocumentLayout::PaintContext context; + + QTextOption oldOption(doc->defaultTextOption()); + if (drawStyle) { + context.palette.setColor(QPalette::Text, styleColor); + QTextOption colorOption(doc->defaultTextOption()); + colorOption.setFlags(QTextOption::SuppressColors); + doc->setDefaultTextOption(colorOption); + } else { + context.palette.setColor(QPalette::Text, color); + } + doc->documentLayout()->draw(&p, context); + if (drawStyle) + doc->setDefaultTextOption(oldOption); + return img; +} + +/*! + Mark the image cache as dirty. +*/ +void QDeclarativeTextPrivate::invalidateImageCache() +{ + Q_Q(QDeclarativeText); + + if (imageCacheDirty) + return; + + imageCacheDirty = true; + imageCache = QPixmap(); + + if (q->isComponentComplete()) + q->update(); +} + +/*! + Tests if the image cache is dirty, and repaints it if it is. +*/ +void QDeclarativeTextPrivate::checkImageCache() +{ + if (!imageCacheDirty) + return; + + if (text.isEmpty()) { + + imageCache = QPixmap(); + + } else { + + QPixmap textImage; + QPixmap styledImage; + + if (richText) { + textImage = textDocumentImage(false); + if (style != QDeclarativeText::Normal) + styledImage = textDocumentImage(true); //### should use styleColor + } else { + textImage = textLayoutImage(false); + if (style != QDeclarativeText::Normal) + styledImage = textLayoutImage(true); //### should use styleColor + } + + switch (style) { + case QDeclarativeText::Outline: + imageCache = drawOutline(textImage, styledImage); + break; + case QDeclarativeText::Sunken: + imageCache = drawOutline(textImage, styledImage, -1); + break; + case QDeclarativeText::Raised: + imageCache = drawOutline(textImage, styledImage, 1); + break; + default: + imageCache = textImage; + break; + } + + } + + imageCacheDirty = false; +} + +/*! + Ensures the QDeclarativeTextPrivate::doc variable is set to a valid text document +*/ +void QDeclarativeTextPrivate::ensureDoc() +{ + if (!doc) { + Q_Q(QDeclarativeText); + doc = new QTextDocumentWithImageResources(q); + doc->setDocumentMargin(0); + } +} + +/*! + Draw \a styleSource as an outline around \a source and return the new image. +*/ +QPixmap QDeclarativeTextPrivate::drawOutline(const QPixmap &source, const QPixmap &styleSource) +{ + QPixmap img = QPixmap(styleSource.width() + 2, styleSource.height() + 2); + img.fill(Qt::transparent); + + QPainter ppm(&img); + + QPoint pos(0, 0); + pos += QPoint(-1, 0); + ppm.drawPixmap(pos, styleSource); + pos += QPoint(2, 0); + ppm.drawPixmap(pos, styleSource); + pos += QPoint(-1, -1); + ppm.drawPixmap(pos, styleSource); + pos += QPoint(0, 2); + ppm.drawPixmap(pos, styleSource); + + pos += QPoint(0, -1); + ppm.drawPixmap(pos, source); + ppm.end(); + + return img; +} + +/*! + Draw \a styleSource below \a source at \a yOffset and return the new image. +*/ +QPixmap QDeclarativeTextPrivate::drawOutline(const QPixmap &source, const QPixmap &styleSource, int yOffset) +{ + QPixmap img = QPixmap(styleSource.width() + 2, styleSource.height() + 2); + img.fill(Qt::transparent); + + QPainter ppm(&img); + + ppm.drawPixmap(QPoint(0, yOffset), styleSource); + ppm.drawPixmap(0, 0, source); + + ppm.end(); + + return img; +} + /*! \qmlclass Text QDeclarativeText \ingroup qml-basic-visual-elements @@ -211,10 +587,44 @@ QDeclarativeText::~QDeclarativeText() { } +/*! + \qmlproperty bool Text::clip + This property holds whether the text is clipped. -QDeclarativeTextPrivate::~QDeclarativeTextPrivate() -{ -} + Note that if the text does not fit in the bounding rectangle it will be abruptly chopped. + + If you want to display potentially long text in a limited space, you probably want to use \c elide instead. +*/ + +/*! + \qmlproperty bool Text::smooth + + This property holds whether the text is smoothly scaled or transformed. + + Smooth filtering gives better visual quality, but is slower. If + the item is displayed at its natural size, this property has no visual or + performance effect. + + \note Generally scaling artifacts are only visible if the item is stationary on + the screen. A common pattern when animating an item is to disable smooth + filtering at the beginning of the animation and reenable it at the conclusion. +*/ + +/*! + \qmlsignal Text::onLinkActivated(string link) + + This handler is called when the user clicks on a link embedded in the text. + The link must be in rich text or HTML format and the + \a link string provides access to the particular link. + + \snippet doc/src/snippets/declarative/text/onLinkActivated.qml 0 + + The example code will display the text + "The main website is at \l{http://qt.nokia.com}{Nokia Qt DF}." + + Clicking on the highlighted link will output + \tt{http://qt.nokia.com link activated} to the console. +*/ /*! \qmlproperty string Text::font.family @@ -320,7 +730,6 @@ QDeclarativeTextPrivate::~QDeclarativeTextPrivate() Text { text: "Hello"; font.capitalization: Font.AllLowercase } \endqml */ - QFont QDeclarativeText::font() const { Q_D(const QDeclarativeText); @@ -334,30 +743,9 @@ void QDeclarativeText::setFont(const QFont &font) return; d->font = font; - d->updateLayout(); - d->markImgDirty(); - emit fontChanged(d->font); -} - -void QDeclarativeText::setText(const QString &n) -{ - Q_D(QDeclarativeText); - if (d->text == n) - return; - d->richText = d->format == RichText || (d->format == AutoText && Qt::mightBeRichText(n)); - if (d->richText) { - if (isComponentComplete()) { - d->ensureDoc(); - d->doc->setText(n); - } - } - - d->text = n; - d->updateLayout(); - d->markImgDirty(); - emit textChanged(d->text); + emit fontChanged(d->font); } /*! @@ -374,17 +762,25 @@ QString QDeclarativeText::text() const return d->text; } -void QDeclarativeText::setColor(const QColor &color) +void QDeclarativeText::setText(const QString &n) { Q_D(QDeclarativeText); - if (d->color == color) + if (d->text == n) return; - d->color = color; - d->markImgDirty(); - emit colorChanged(d->color); + d->richText = d->format == RichText || (d->format == AutoText && Qt::mightBeRichText(n)); + if (d->richText && isComponentComplete()) { + d->ensureDoc(); + d->doc->setText(n); + } + + d->text = n; + d->updateLayout(); + + emit textChanged(d->text); } + /*! \qmlproperty color Text::color @@ -398,13 +794,23 @@ void QDeclarativeText::setColor(const QColor &color) Text { color: "steelblue"; ... } \endqml */ - QColor QDeclarativeText::color() const { Q_D(const QDeclarativeText); return d->color; } +void QDeclarativeText::setColor(const QColor &color) +{ + Q_D(QDeclarativeText); + if (d->color == color) + return; + + d->color = color; + d->invalidateImageCache(); + emit colorChanged(d->color); +} + /*! \qmlproperty enumeration Text::style @@ -445,21 +851,10 @@ void QDeclarativeText::setStyle(QDeclarativeText::TextStyle style) if (isComponentComplete() && (d->style == Normal || style == Normal)) prepareGeometryChange(); d->style = style; - d->markImgDirty(); + d->invalidateImageCache(); emit styleChanged(d->style); } -void QDeclarativeText::setStyleColor(const QColor &color) -{ - Q_D(QDeclarativeText); - if (d->styleColor == color) - return; - - d->styleColor = color; - d->markImgDirty(); - emit styleColorChanged(d->styleColor); -} - /*! \qmlproperty color Text::styleColor @@ -481,6 +876,18 @@ QColor QDeclarativeText::styleColor() const return d->styleColor; } +void QDeclarativeText::setStyleColor(const QColor &color) +{ + Q_D(QDeclarativeText); + if (d->styleColor == color) + return; + + d->styleColor = color; + d->invalidateImageCache(); + emit styleColorChanged(d->styleColor); +} + + /*! \qmlproperty enumeration Text::horizontalAlignment \qmlproperty enumeration Text::verticalAlignment @@ -511,7 +918,10 @@ void QDeclarativeText::setHAlign(HAlignment align) if (isComponentComplete()) prepareGeometryChange(); + d->hAlign = align; + d->updateLayout(); + emit horizontalAlignmentChanged(align); } @@ -559,9 +969,8 @@ void QDeclarativeText::setWrapMode(WrapMode mode) return; d->wrapMode = mode; - d->updateLayout(); - d->markImgDirty(); + emit wrapModeChanged(); } @@ -621,7 +1030,6 @@ Column { \o \image declarative-textformat.png \endtable */ - QDeclarativeText::TextFormat QDeclarativeText::textFormat() const { Q_D(const QDeclarativeText); @@ -635,21 +1043,15 @@ void QDeclarativeText::setTextFormat(TextFormat format) return; d->format = format; bool wasRich = d->richText; - d->richText = format == RichText || (format == AutoText && Qt::mightBeRichText(d->text)); - - if (wasRich && !d->richText) { - //### delete control? (and vice-versa below) - d->updateLayout(); - d->markImgDirty(); - } else if (!wasRich && d->richText) { - if (isComponentComplete()) { - d->ensureDoc(); - d->doc->setText(d->text); - } - d->updateLayout(); - d->markImgDirty(); + d->richText = format == RichText || (format == AutoText && Qt::mightBeRichText(d->text)); + + if (!wasRich && d->richText && isComponentComplete()) { + d->ensureDoc(); + d->doc->setText(d->text); } + d->updateLayout(); + emit textFormatChanged(d->format); } @@ -688,12 +1090,12 @@ void QDeclarativeText::setElideMode(QDeclarativeText::TextElideMode mode) return; d->elideMode = mode; - d->updateLayout(); - d->markImgDirty(); + emit elideModeChanged(d->elideMode); } +/*! \internal */ QRectF QDeclarativeText::boundingRect() const { Q_D(const QDeclarativeText); @@ -704,7 +1106,7 @@ QRectF QDeclarativeText::boundingRect() const int x = 0; int y = 0; - QSize size = d->cachedLayoutSize; + QSize size = d->layedOutTextSize; if (d->style != Normal) size += QSize(2,2); @@ -737,117 +1139,23 @@ QRectF QDeclarativeText::boundingRect() const return QRectF(x,y,size.width(),size.height()); } -void QDeclarativeText::geometryChanged(const QRectF &newGeometry, - const QRectF &oldGeometry) +/*! \internal */ +void QDeclarativeText::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { Q_D(QDeclarativeText); - if (!d->internalWidthUpdate && newGeometry.width() != oldGeometry.width()) { - if (d->wrapMode != QDeclarativeText::NoWrap || d->elideMode != QDeclarativeText::ElideNone) { - //re-elide if needed - if (d->singleline && d->elideMode != QDeclarativeText::ElideNone && - isComponentComplete() && widthValid()) { - - QFontMetrics fm(d->font); - QString tmp = fm.elidedText(d->text,(Qt::TextElideMode)d->elideMode,width()); // XXX still worth layout...? - d->layout.setText(tmp); - } + if (!d->internalWidthUpdate && newGeometry.width() != oldGeometry.width() && + (d->wrapMode != QDeclarativeText::NoWrap || d->elideMode != QDeclarativeText::ElideNone)) { - d->imgDirty = true; + if (d->singleline && d->elideMode != QDeclarativeText::ElideNone && widthValid()) { + // We need to re-elide + d->updateLayout(); + } else { + // We just need to re-layout d->updateSize(); } } - QDeclarativeItem::geometryChanged(newGeometry, oldGeometry); -} - -void QDeclarativeTextPrivate::updateLayout() -{ - Q_Q(QDeclarativeText); - if (q->isComponentComplete()) { - //setup instance of QTextLayout for all cases other than richtext - if (!richText) { - layout.clearLayout(); - layout.setFont(font); - if (format != QDeclarativeText::StyledText) { - QString tmp = text; - tmp.replace(QLatin1Char('\n'), QChar::LineSeparator); - singleline = !tmp.contains(QChar::LineSeparator); - if (singleline && elideMode != QDeclarativeText::ElideNone && q->widthValid()) { - QFontMetrics fm(font); - tmp = fm.elidedText(tmp,(Qt::TextElideMode)elideMode,q->width()); // XXX still worth layout...? - } - layout.setText(tmp); - } else { - singleline = false; - QDeclarativeStyledText::parse(text, layout); - } - } - updateSize(); - } else { - dirty = true; - } -} - - -void QDeclarativeTextPrivate::updateSize() -{ - Q_Q(QDeclarativeText); - if (q->isComponentComplete()) { - QFontMetrics fm(font); - if (text.isEmpty()) { - q->setImplicitHeight(fm.height()); - emit q->paintedSizeChanged(); - return; - } - - int dy = q->height(); - QSize size(0, 0); - - //setup instance of QTextLayout for all cases other than richtext - if (!richText) { - size = setupTextLayout(); - if (cachedLayoutSize != size) { - q->prepareGeometryChange(); - cachedLayoutSize = size; - } - dy -= size.height(); - } else { - singleline = false; // richtext can't elide or be optimized for single-line case - ensureDoc(); - doc->setDefaultFont(font); - QTextOption option((Qt::Alignment)int(hAlign | vAlign)); - option.setWrapMode(QTextOption::WrapMode(wrapMode)); - doc->setDefaultTextOption(option); - if (wrapMode != QDeclarativeText::NoWrap && q->widthValid()) - doc->setTextWidth(q->width()); - else - doc->setTextWidth(doc->idealWidth()); // ### Text does not align if width is not set (QTextDoc bug) - dy -= (int)doc->size().height(); - QSize dsize = doc->size().toSize(); - if (dsize != cachedLayoutSize) { - q->prepareGeometryChange(); - cachedLayoutSize = dsize; - } - size = QSize(int(doc->idealWidth()),dsize.height()); - } - int yoff = 0; - if (q->heightValid()) { - if (vAlign == QDeclarativeText::AlignBottom) - yoff = dy; - else if (vAlign == QDeclarativeText::AlignVCenter) - yoff = dy/2; - } - q->setBaselineOffset(fm.ascent() + yoff); - - //### need to comfirm cost of always setting these for richText - internalWidthUpdate = true; - q->setImplicitWidth(size.width()); - internalWidthUpdate = false; - q->setImplicitHeight(size.height()); - emit q->paintedSizeChanged(); - } else { - dirty = true; - } + QDeclarativeItem::geometryChanged(newGeometry, oldGeometry); } /*! @@ -872,228 +1180,6 @@ qreal QDeclarativeText::paintedHeight() const return implicitHeight(); } - - -// ### text layout handling should be profiled and optimized as needed -// what about QStackTextEngine engine(tmp, d->font.font()); QTextLayout textLayout(&engine); - -void QDeclarativeTextPrivate::drawOutline() -{ - QPixmap img = QPixmap(imgStyleCache.width()+2,imgStyleCache.height()+2); - img.fill(Qt::transparent); - - QPainter ppm(&img); - - QPoint pos(imgCache.rect().topLeft()); - pos += QPoint(-1, 0); - ppm.drawPixmap(pos, imgStyleCache); - pos += QPoint(2, 0); - ppm.drawPixmap(pos, imgStyleCache); - pos += QPoint(-1, -1); - ppm.drawPixmap(pos, imgStyleCache); - pos += QPoint(0, 2); - ppm.drawPixmap(pos, imgStyleCache); - - pos += QPoint(0, -1); - ppm.drawPixmap(pos, imgCache); - ppm.end(); - - imgCache = img; -} - -void QDeclarativeTextPrivate::drawOutline(int yOffset) -{ - QPixmap img = QPixmap(imgStyleCache.width()+2,imgStyleCache.height()+2); - img.fill(Qt::transparent); - - QPainter ppm(&img); - - QPoint pos(imgCache.rect().topLeft()); - pos += QPoint(0, yOffset); - ppm.drawPixmap(pos, imgStyleCache); - - pos += QPoint(0, -yOffset); - ppm.drawPixmap(pos, imgCache); - ppm.end(); - - imgCache = img; -} - -QSize QDeclarativeTextPrivate::setupTextLayout() -{ - Q_Q(QDeclarativeText); - layout.setCacheEnabled(true); - - int height = 0; - qreal widthUsed = 0; - qreal lineWidth = 0; - - //set manual width - if ((wrapMode != QDeclarativeText::NoWrap || elideMode != QDeclarativeText::ElideNone) && q->widthValid()) - lineWidth = q->width(); - - QTextOption textOption = layout.textOption(); - textOption.setWrapMode(QTextOption::WrapMode(wrapMode)); - layout.setTextOption(textOption); - - layout.beginLayout(); - - while (1) { - QTextLine line = layout.createLine(); - if (!line.isValid()) - break; - - if ((wrapMode != QDeclarativeText::NoWrap || elideMode != QDeclarativeText::ElideNone) && q->widthValid()) - line.setLineWidth(lineWidth); - } - layout.endLayout(); - - int x = 0; - for (int i = 0; i < layout.lineCount(); ++i) { - QTextLine line = layout.lineAt(i); - widthUsed = qMax(widthUsed, line.naturalTextWidth()); - line.setPosition(QPointF(0, height)); - height += int(line.height()); - - if (!cache) { - if (hAlign == QDeclarativeText::AlignLeft) { - x = 0; - } else if (hAlign == QDeclarativeText::AlignRight) { - x = q->width() - (int)line.naturalTextWidth(); - } else if (hAlign == QDeclarativeText::AlignHCenter) { - x = (q->width() - (int)line.naturalTextWidth()) / 2; - } - line.setPosition(QPoint(x, (int)line.y())); - } - } - - return QSize(qCeil(widthUsed), height); -} - -QPixmap QDeclarativeTextPrivate::wrappedTextImage(bool drawStyle) -{ - //do layout - QSize size = cachedLayoutSize; - - int x = 0; - for (int i = 0; i < layout.lineCount(); ++i) { - QTextLine line = layout.lineAt(i); - if (hAlign == QDeclarativeText::AlignLeft) { - x = 0; - } else if (hAlign == QDeclarativeText::AlignRight) { - x = size.width() - (int)line.naturalTextWidth(); - } else if (hAlign == QDeclarativeText::AlignHCenter) { - x = (size.width() - (int)line.naturalTextWidth()) / 2; - } - line.setPosition(QPoint(x, (int)line.y())); - } - - //paint text - QPixmap img(size); - if (!size.isEmpty()) { - img.fill(Qt::transparent); -#ifdef Q_WS_MAC - bool oldSmooth = qt_applefontsmoothing_enabled; - qt_applefontsmoothing_enabled = false; -#endif - QPainter p(&img); -#ifdef Q_WS_MAC - qt_applefontsmoothing_enabled = oldSmooth; -#endif - drawWrappedText(&p, QPointF(0,0), drawStyle); - } - return img; -} - -void QDeclarativeTextPrivate::drawWrappedText(QPainter *p, const QPointF &pos, bool drawStyle) -{ - if (drawStyle) - p->setPen(styleColor); - else - p->setPen(color); - p->setFont(font); - layout.draw(p , pos); -} - -QPixmap QDeclarativeTextPrivate::richTextImage(bool drawStyle) -{ - QSize size = doc->size().toSize(); - - //paint text - QPixmap img(size); - img.fill(Qt::transparent); -#ifdef Q_WS_MAC - bool oldSmooth = qt_applefontsmoothing_enabled; - qt_applefontsmoothing_enabled = false; -#endif - QPainter p(&img); -#ifdef Q_WS_MAC - qt_applefontsmoothing_enabled = oldSmooth; -#endif - - QAbstractTextDocumentLayout::PaintContext context; - - QTextOption oldOption(doc->defaultTextOption()); - if (drawStyle) { - context.palette.setColor(QPalette::Text, styleColor); - QTextOption colorOption(doc->defaultTextOption()); - colorOption.setFlags(QTextOption::SuppressColors); - doc->setDefaultTextOption(colorOption); - } else { - context.palette.setColor(QPalette::Text, color); - } - doc->documentLayout()->draw(&p, context); - if (drawStyle) - doc->setDefaultTextOption(oldOption); - return img; -} - -void QDeclarativeTextPrivate::checkImgCache() -{ - if (!imgDirty) - return; - - bool empty = text.isEmpty(); - QPixmap newImgCache; - if (empty) { - imgStyleCache = QPixmap(); - } else if (richText) { - newImgCache = richTextImage(false); - if (style != QDeclarativeText::Normal) - imgStyleCache = richTextImage(true); //### should use styleColor - } else { - newImgCache = wrappedTextImage(false); - if (style != QDeclarativeText::Normal) - imgStyleCache = wrappedTextImage(true); //### should use styleColor - } - imgCache = newImgCache; - if (!empty) - switch (style) { - case QDeclarativeText::Outline: - drawOutline(); - break; - case QDeclarativeText::Sunken: - drawOutline(-1); - break; - case QDeclarativeText::Raised: - drawOutline(1); - break; - default: - break; - } - - imgDirty = false; -} - -void QDeclarativeTextPrivate::ensureDoc() -{ - if (!doc) { - Q_Q(QDeclarativeText); - doc = new QTextDocumentWithImageResources(q); - doc->setDocumentMargin(0); - } -} - /*! Returns the number of resources (images) that are being loaded asynchronously. */ @@ -1103,22 +1189,14 @@ int QDeclarativeText::resourcesLoading() const return d->doc ? d->doc->resourcesLoading() : 0; } -/*! - \qmlproperty bool Text::clip - This property holds whether the text is clipped. - - Note that if the text does not fit in the bounding rectangle it will be abruptly chopped. - - If you want to display potentially long text in a limited space, you probably want to use \c elide instead. -*/ - +/*! \internal */ void QDeclarativeText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) { Q_D(QDeclarativeText); - if (d->cache || d->style != Normal) { - d->checkImgCache(); - if (d->imgCache.isNull()) + if (d->cacheAllTextAsImage || d->style != Normal) { + d->checkImageCache(); + if (d->imageCache.isNull()) return; bool oldAA = p->testRenderHint(QPainter::Antialiasing); @@ -1128,23 +1206,23 @@ void QDeclarativeText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWid QRect br = boundingRect().toRect(); - bool needClip = clip() && (d->imgCache.width() > width() || - d->imgCache.height() > height()); + bool needClip = clip() && (d->imageCache.width() > width() || + d->imageCache.height() > height()); if (needClip) - p->drawPixmap(0, 0, width(), height(), d->imgCache, -br.x(), -br.y(), width(), height()); + p->drawPixmap(0, 0, width(), height(), d->imageCache, -br.x(), -br.y(), width(), height()); else - p->drawPixmap(br.x(), br.y(), d->imgCache); + p->drawPixmap(br.x(), br.y(), d->imageCache); if (d->smooth) { p->setRenderHint(QPainter::Antialiasing, oldAA); p->setRenderHint(QPainter::SmoothPixmapTransform, oldSmooth); } } else { - qreal y = boundingRect().y(); + QRectF bounds = boundingRect(); - bool needClip = clip() && (d->cachedLayoutSize.width() > width() || - d->cachedLayoutSize.height() > height()); + bool needClip = clip() && (d->layedOutTextSize.width() > width() || + d->layedOutTextSize.height() > height()); if (needClip) { p->save(); @@ -1153,49 +1231,35 @@ void QDeclarativeText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWid if (d->richText) { QAbstractTextDocumentLayout::PaintContext context; context.palette.setColor(QPalette::Text, d->color); - p->translate(0, y); + p->translate(bounds.x(), bounds.y()); d->doc->documentLayout()->draw(p, context); - p->translate(0, -y); + p->translate(-bounds.x(), -bounds.y()); } else { - d->drawWrappedText(p, QPointF(0,y), false); + d->drawTextLayout(p, QPointF(0, bounds.y()), false); } - if (needClip) + + if (needClip) { p->restore(); + } } } -/*! - \qmlproperty bool Text::smooth - - This property holds whether the text is smoothly scaled or transformed. - - Smooth filtering gives better visual quality, but is slower. If - the item is displayed at its natural size, this property has no visual or - performance effect. - - \note Generally scaling artifacts are only visible if the item is stationary on - the screen. A common pattern when animating an item is to disable smooth - filtering at the beginning of the animation and reenable it at the conclusion. -*/ - +/*! \internal */ void QDeclarativeText::componentComplete() { Q_D(QDeclarativeText); QDeclarativeItem::componentComplete(); - if (d->dirty) { + if (d->updateOnComponentComplete) { + d->updateOnComponentComplete = false; if (d->richText) { d->ensureDoc(); d->doc->setText(d->text); } d->updateLayout(); - d->dirty = false; } } -/*! - \overload - Handles the given mouse \a event. - */ +/*! \internal */ void QDeclarativeText::mousePressEvent(QGraphicsSceneMouseEvent *event) { Q_D(QDeclarativeText); @@ -1214,26 +1278,7 @@ void QDeclarativeText::mousePressEvent(QGraphicsSceneMouseEvent *event) } -/*! - \qmlsignal Text::onLinkActivated(string link) - - This handler is called when the user clicks on a link embedded in the text. - The link must be in rich text or HTML format and the - \a link string provides access to the particular link. - - \snippet doc/src/snippets/declarative/text/onLinkActivated.qml 0 - - The example code will display the text - "The main website is at \l{http://qt.nokia.com}{Nokia Qt DF}." - - Clicking on the highlighted link will output - \tt{http://qt.nokia.com link activated} to the console. -*/ - -/*! - \overload - Handles the given mouse \a event. - */ +/*! \internal */ void QDeclarativeText::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { Q_D(QDeclarativeText); diff --git a/src/declarative/graphicsitems/qdeclarativetext_p_p.h b/src/declarative/graphicsitems/qdeclarativetext_p_p.h index db68558..e37f477 100644 --- a/src/declarative/graphicsitems/qdeclarativetext_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetext_p_p.h @@ -74,24 +74,8 @@ public: ~QDeclarativeTextPrivate(); - void ensureDoc(); void updateSize(); void updateLayout(); - void markImgDirty() { - Q_Q(QDeclarativeText); - imgDirty = true; - if (q->isComponentComplete()) - q->update(); - } - void checkImgCache(); - - void drawOutline(); - void drawOutline(int yOffset); - - QPixmap wrappedTextImage(bool drawStyle); - void drawWrappedText(QPainter *p, const QPointF &pos, bool drawStyle); - QPixmap richTextImage(bool drawStyle); - QSize setupTextLayout(); QString text; QFont font; @@ -99,23 +83,37 @@ public: QDeclarativeText::TextStyle style; QColor styleColor; QString activeLink; - QPixmap imgCache; - QPixmap imgStyleCache; QDeclarativeText::HAlignment hAlign; QDeclarativeText::VAlignment vAlign; QDeclarativeText::TextElideMode elideMode; - bool imgDirty:1; - bool dirty:1; + QDeclarativeText::TextFormat format; + QDeclarativeText::WrapMode wrapMode; + + void invalidateImageCache(); + void checkImageCache(); + QPixmap imageCache; + + bool imageCacheDirty:1; + bool updateOnComponentComplete:1; bool richText:1; bool singleline:1; - bool cache:1; + bool cacheAllTextAsImage:1; bool internalWidthUpdate:1; + + QSize layedOutTextSize; + + void ensureDoc(); + QPixmap textDocumentImage(bool drawStyle); QTextDocumentWithImageResources *doc; + + QSize setupTextLayout(); + QPixmap textLayoutImage(bool drawStyle); + void drawTextLayout(QPainter *p, const QPointF &pos, bool drawStyle); QDeclarativeTextLayout layout; - QSize cachedLayoutSize; - QDeclarativeText::TextFormat format; - QDeclarativeText::WrapMode wrapMode; - + + static QPixmap drawOutline(const QPixmap &source, const QPixmap &styleSource); + static QPixmap drawOutline(const QPixmap &source, const QPixmap &styleSource, int yOffset); + static inline QDeclarativeTextPrivate *get(QDeclarativeText *t) { return t->d_func(); } -- cgit v0.12 From befbf33a0170de28631adb01c49491197595d20c Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Wed, 13 Oct 2010 15:12:28 +1000 Subject: Update reference bitmaps used in bitmap comparison tests to follow changes in Text painting Task-number: QTBUG-14374 --- .../declarative/qdeclarativetext/data/alignments_cb.png | Bin 496 -> 496 bytes .../declarative/qdeclarativetext/data/alignments_cc.png | Bin 556 -> 556 bytes .../declarative/qdeclarativetext/data/alignments_ct.png | Bin 533 -> 533 bytes 3 files changed, 0 insertions(+), 0 deletions(-) diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_cb.png b/tests/auto/declarative/qdeclarativetext/data/alignments_cb.png index 99de219..cf6199a 100644 Binary files a/tests/auto/declarative/qdeclarativetext/data/alignments_cb.png and b/tests/auto/declarative/qdeclarativetext/data/alignments_cb.png differ diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_cc.png b/tests/auto/declarative/qdeclarativetext/data/alignments_cc.png index cb85251..f81ccb4 100644 Binary files a/tests/auto/declarative/qdeclarativetext/data/alignments_cc.png and b/tests/auto/declarative/qdeclarativetext/data/alignments_cc.png differ diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_ct.png b/tests/auto/declarative/qdeclarativetext/data/alignments_ct.png index ddca549..9ba6412 100644 Binary files a/tests/auto/declarative/qdeclarativetext/data/alignments_ct.png and b/tests/auto/declarative/qdeclarativetext/data/alignments_ct.png differ -- cgit v0.12 From deb92145c5bc69b7ee252687cf5b763b33f17775 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 28 Sep 2010 10:40:49 +1000 Subject: Update color type docs to mention transparency --- doc/src/declarative/basictypes.qdoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/src/declarative/basictypes.qdoc b/doc/src/declarative/basictypes.qdoc index e327d4a..e8aceb3 100644 --- a/doc/src/declarative/basictypes.qdoc +++ b/doc/src/declarative/basictypes.qdoc @@ -156,8 +156,10 @@ Example: \qml Rectangle { color: "steelblue" } + Rectangle { color: "transparent" } Rectangle { color: "#FF0000" } Rectangle { color: "#800000FF" } + Rectangle { color: "#00000000" } // ARGB fully transparent \endqml Or with the \l{QML:Qt::rgba()}{Qt.rgba()}, \l{QML:Qt::hsla()}{Qt.hsla()}, \l{QML:Qt::darker()}{Qt.darker()}, -- cgit v0.12 From a47835bf8cabffc127c2879b758f6730aca3d52b Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Wed, 13 Oct 2010 16:47:03 +1000 Subject: Fix worker ListModels to property emit countChanged() Task-number: QT-4094 --- src/declarative/util/qdeclarativelistmodelworkeragent.cpp | 2 +- .../qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/declarative/util/qdeclarativelistmodelworkeragent.cpp b/src/declarative/util/qdeclarativelistmodelworkeragent.cpp index 6804d4a..852b055 100644 --- a/src/declarative/util/qdeclarativelistmodelworkeragent.cpp +++ b/src/declarative/util/qdeclarativelistmodelworkeragent.cpp @@ -208,7 +208,7 @@ bool QDeclarativeListModelWorkerAgent::event(QEvent *e) const QList &changes = s->data.changes; if (m_copy) { - bool cc = m_copy->count() != s->list->count(); + bool cc = m_orig->count() != s->list->count(); FlatListModel *orig = m_orig->m_flat; FlatListModel *copy = s->list->m_flat; diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index be77f8e..4b8d772 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -320,11 +320,16 @@ void tst_qdeclarativelistmodel::dynamic() if (!warning.isEmpty()) QTest::ignoreMessage(QtWarningMsg, warning.toLatin1()); + QSignalSpy spyCount(&model, SIGNAL(countChanged())); + int actual = e.evaluate().toInt(); if (e.hasError()) qDebug() << e.error(); // errors not expected QCOMPARE(actual,result); + + if (model.count() > 0) + QVERIFY(spyCount.count() > 0); } void tst_qdeclarativelistmodel::dynamic_worker_data() @@ -351,6 +356,8 @@ void tst_qdeclarativelistmodel::dynamic_worker() QDeclarativeItem *item = createWorkerTest(&eng, &component, &model); QVERIFY(item != 0); + QSignalSpy spyCount(&model, SIGNAL(countChanged())); + if (script[0] == QLatin1Char('{') && script[script.length()-1] == QLatin1Char('}')) script = script.mid(1, script.length() - 2); QVariantList operations; @@ -367,6 +374,9 @@ void tst_qdeclarativelistmodel::dynamic_worker() waitForWorker(item); QCOMPARE(QDeclarativeProperty(item, "result").read().toInt(), result); + if (model.count() > 0) + QVERIFY(spyCount.count() > 0); + delete item; qApp->processEvents(); } -- cgit v0.12 From 4c9651219140141da49d0ea965544d8f64dbf323 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 13 Oct 2010 16:57:35 +1000 Subject: Fix User 46 Panic in bearer management on Symbian. The active object made a request before it was set as active. Task-number: QT-3996 Written-by: Perttu Pohjonen --- src/plugins/bearer/symbian/symbianengine.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index f759a95..ef273c1 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -1365,16 +1365,12 @@ void AccessPointsAvailabilityScanner::StartScanning() // don't need time-consuming scans (WLAN). // Note: EBearerIdWCDMA covers also GPRS bearer iConnectionMonitor.GetPckgAttribute(EBearerIdWCDMA, 0, KIapAvailability, iIapBuf, iStatus); - User::WaitForRequest(iStatus); - if (iStatus.Int() == KErrNone) { - iOwner.accessPointScanningReady(true,iIapBuf()); - } } else { iConnectionMonitor.GetPckgAttribute(EBearerIdAll, 0, KIapAvailability, iIapBuf, iStatus); - if (!IsActive()) { - SetActive(); - } } + + if (!IsActive()) + SetActive(); } void AccessPointsAvailabilityScanner::RunL() -- cgit v0.12 From 1eb194d0b29e1bb3c5bafe711cea2c116cb2ea16 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Wed, 13 Oct 2010 09:48:18 +0200 Subject: Doc: adjusting the search field width --- doc/src/template/style/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index ec0202a..12d297d 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -650,7 +650,7 @@ margin-top: 5px; _margin: 0 0 0 -20px; padding: 10px; - width: 220px; + width: 30%; _width: 196px; height: 250px; overflow: auto; -- cgit v0.12 From 9abacb24b4e88e6811b90881d9e55764061607b2 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 13 Oct 2010 11:42:57 +0300 Subject: Added --remove-destination to qmake_emulator_deployment.flm This will fix the issue with deploying files when destination is owned by another user. Reviewed-by: TrustMe --- mkspecs/symbian-sbsv2/flm/qt/qmake_emulator_deployment.flm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/symbian-sbsv2/flm/qt/qmake_emulator_deployment.flm b/mkspecs/symbian-sbsv2/flm/qt/qmake_emulator_deployment.flm index 3877edb..a557cbb 100644 --- a/mkspecs/symbian-sbsv2/flm/qt/qmake_emulator_deployment.flm +++ b/mkspecs/symbian-sbsv2/flm/qt/qmake_emulator_deployment.flm @@ -21,7 +21,7 @@ CLEAN_TARGET:=$(1) $(1): $(2) $(call startrule,qmake_emulator_deployment) \ - $(GNUCP) --no-preserve=mode $(2) "$$@" && \ + $(GNUCP) --remove-destination --no-preserve=mode $(2) "$$@" && \ $(GNUCHMOD) a+rw "$$@" \ $(call endrule,qmake_emulator_deployment) endef -- cgit v0.12 From 0f81945563441082551c65f964531c16e185d3de Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 13 Oct 2010 18:50:46 +1000 Subject: Fix autotest on windows --- src/declarative/qml/qdeclarativeengine.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 8e1416e..c3fdf36 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -2203,7 +2203,9 @@ bool QDeclarative_isFileCaseCorrect(const QString &fileName) #elif defined(Q_OS_WIN32) wchar_t buffer[1024]; - DWORD rv = ::GetLongPathName((wchar_t*)absolute.utf16(), buffer, 1024); + DWORD rv = ::GetShortPathName((wchar_t*)absolute.utf16(), buffer, 1024); + if (rv == 0 || rv >= 1024) return true; + rv = ::GetLongPathName(buffer, buffer, 1024); if (rv == 0 || rv >= 1024) return true; QString canonical((QChar *)buffer); -- cgit v0.12 From 0cb3705195b54f199280ab0b8554c793f67425e2 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 13 Oct 2010 11:09:58 +0200 Subject: Jitter removal --- src/plugins/generic/linuxinput/qlinuxinput.cpp | 40 +++++++++++++++++--------- src/plugins/generic/linuxinput/qlinuxinput.h | 5 ++++ 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/src/plugins/generic/linuxinput/qlinuxinput.cpp b/src/plugins/generic/linuxinput/qlinuxinput.cpp index 782194d..07f7a43 100644 --- a/src/plugins/generic/linuxinput/qlinuxinput.cpp +++ b/src/plugins/generic/linuxinput/qlinuxinput.cpp @@ -131,7 +131,7 @@ private: QLinuxInputMouseHandler::QLinuxInputMouseHandler(const QString &key, const QString &specification) - : m_notify(0), m_x(0), m_y(0), m_buttons(0), d(0) + : m_notify(0), m_x(0), m_y(0), m_prevx(0), m_prevy(0), m_buttons(0), d(0) { qDebug() << "QLinuxInputMouseHandler" << key << specification; @@ -140,15 +140,20 @@ QLinuxInputMouseHandler::QLinuxInputMouseHandler(const QString &key, QString dev = QLatin1String("/dev/input/event0"); m_compression = true; + m_smooth = false; + int jitterLimit = 0; QStringList args = specification.split(QLatin1Char(':')); foreach (const QString &arg, args) { if (arg == "nocompress") m_compression = false; + else if (arg.startsWith("dejitter=")) + jitterLimit = arg.mid(9).toInt(); else if (arg.startsWith(QLatin1String("/dev/"))) dev = arg; } - + m_jitterLimitSquared = jitterLimit*jitterLimit; + m_fd = QT_OPEN(dev.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0); if (m_fd >= 0) { m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this); @@ -172,12 +177,21 @@ QLinuxInputMouseHandler::~QLinuxInputMouseHandler() #endif } +void QLinuxInputMouseHandler::sendMouseEvent(int x, int y, Qt::MouseButtons buttons) +{ + QPoint pos(x, y); + QWindowSystemInterface::handleMouseEvent(0, pos, pos, m_buttons); + m_prevx = x; + m_prevy = y; +} + void QLinuxInputMouseHandler::readMouseData() { struct ::input_event buffer[32]; int n = 0; bool posChanged = false; bool pendingMouseEvent = false; + int eventCompressCount = 0; forever { n = QT_READ(m_fd, reinterpret_cast(buffer) + n, sizeof(buffer) - n); @@ -255,8 +269,7 @@ void QLinuxInputMouseHandler::readMouseData() } else if (data->type == EV_KEY && data->code == BTN_TOUCH) { m_buttons = data->value ? Qt::LeftButton : Qt::NoButton; - QWindowSystemInterface::handleMouseEvent(0, QPoint(m_x, m_y), - QPoint(m_x, m_y), m_buttons); + sendMouseEvent(m_x, m_y, m_buttons); pendingMouseEvent = false; } else if (data->type == EV_KEY && data->code >= BTN_LEFT && data->code <= BTN_MIDDLE) { Qt::MouseButton button = Qt::NoButton; @@ -269,18 +282,17 @@ void QLinuxInputMouseHandler::readMouseData() m_buttons |= button; else m_buttons &= ~button; - - QWindowSystemInterface::handleMouseEvent(0, QPoint(m_x, m_y), - QPoint(m_x, m_y), m_buttons); + sendMouseEvent(m_x, m_y, m_buttons); pendingMouseEvent = false; } else if (data->type == EV_SYN && data->code == SYN_REPORT) { if (posChanged) { posChanged = false; - QPoint pos(m_x, m_y); - if (m_compression) + if (m_compression) { pendingMouseEvent = true; - else - QWindowSystemInterface::handleMouseEvent(0, pos, pos, m_buttons); + eventCompressCount++; + } else { + sendMouseEvent(m_x, m_y, m_buttons); + } } #ifdef QT_QPA_EXPERIMENTAL_TOUCHEVENT if (d->state == QEvent::TouchBegin && !d->seenMT) { @@ -336,8 +348,9 @@ void QLinuxInputMouseHandler::readMouseData() #endif } if (m_compression && pendingMouseEvent) { - QPoint pos(m_x, m_y); - QWindowSystemInterface::handleMouseEvent(0, pos, pos, m_buttons); + int distanceSquared = (m_x - m_prevx)*(m_x - m_prevx) + (m_y - m_prevy)*(m_y - m_prevy); + if (distanceSquared > m_jitterLimitSquared) + sendMouseEvent(m_x, m_y, m_buttons); } } @@ -531,3 +544,4 @@ void QLinuxInputKeyboardHandler::readKeycode() QT_END_NAMESPACE + diff --git a/src/plugins/generic/linuxinput/qlinuxinput.h b/src/plugins/generic/linuxinput/qlinuxinput.h index 4b7d7de..37123f1 100644 --- a/src/plugins/generic/linuxinput/qlinuxinput.h +++ b/src/plugins/generic/linuxinput/qlinuxinput.h @@ -65,11 +65,16 @@ private slots: void readMouseData(); private: + void sendMouseEvent(int x, int y, Qt::MouseButtons buttons); QSocketNotifier * m_notify; int m_fd; int m_x, m_y; + int m_prevx, m_prevy; + int m_smoothx, m_smoothy; Qt::MouseButtons m_buttons; bool m_compression; + bool m_smooth; + int m_jitterLimitSquared; QLinuxInputMouseHandlerData *d; }; -- cgit v0.12 From 40b5c05b9921b5fa3ceae7f723c0b26c4861bda7 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 12 Oct 2010 16:38:30 +0200 Subject: tst_qcompleter: Add a test for QFileSystemModel Copied from the test for QDirModel Reviewed-by: Thierry --- tests/auto/qcompleter/tst_qcompleter.cpp | 82 +++++++++++++++++++++++++++++--- 1 file changed, 76 insertions(+), 6 deletions(-) diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index 1590528..3e05fbc 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -119,6 +119,8 @@ private slots: void directoryModel_data(); void directoryModel(); + void fileSystemModel_data(); + void fileSystemModel(); void changingModel_data(); void changingModel(); @@ -151,13 +153,14 @@ private slots: void task247560_keyboardNavigation(); private: - void filter(); + void filter(bool assync = false); void testRowCount(); enum ModelType { CASE_SENSITIVELY_SORTED_MODEL, CASE_INSENSITIVELY_SORTED_MODEL, DIRECTORY_MODEL, - HISTORY_MODEL + HISTORY_MODEL, + FILESYSTEM_MODEL }; void setSourceModel(ModelType); @@ -233,12 +236,21 @@ void tst_QCompleter::setSourceModel(ModelType type) completer->setModel(new QDirModel(completer)); completer->setCompletionColumn(0); break; + case FILESYSTEM_MODEL: + completer->setCsvCompletion(false); + { + QFileSystemModel *m = new QFileSystemModel(completer); + m->setRootPath("/"); + completer->setModel(m); + } + completer->setCompletionColumn(0); + break; default: qDebug() << "Invalid type"; } } -void tst_QCompleter::filter() +void tst_QCompleter::filter(bool assync) { QFETCH(QString, filterText); QFETCH(QString, step); @@ -250,6 +262,9 @@ void tst_QCompleter::filter() return; } + int times = 0; +retry: + completer->setCompletionPrefix(filterText); for (int i = 0; i < step.length(); i++) { @@ -265,9 +280,13 @@ void tst_QCompleter::filter() completer->setCurrentRow(row); } - //QModelIndex si = completer->currentIndex(); - //QCOMPARE(completer->model()->data(si).toString(), completion); - QVERIFY(0 == QString::compare(completer->currentCompletion(), completionText, completer->caseSensitivity())); + int r = QString::compare(completer->currentCompletion(), completionText, completer->caseSensitivity()); + if (assync && r && times < 10) { + times++; + QTest::qWait(50*times); + goto retry; + } + QVERIFY(!r); } // Testing get/set functions @@ -598,6 +617,57 @@ void tst_QCompleter::directoryModel() filter(); } +void tst_QCompleter::fileSystemModel_data() +{ + delete completer; + completer = new CsvCompleter; + completer->setModelSorting(QCompleter::CaseSensitivelySortedModel); + setSourceModel(FILESYSTEM_MODEL); + completer->setCaseSensitivity(Qt::CaseInsensitive); + + QTest::addColumn("filterText"); + QTest::addColumn("step"); + QTest::addColumn("completion"); + QTest::addColumn("completionText"); + + // NOTE: Add tests carefully, ensurely the paths exist on all systems + // Output is the sourceText; currentCompletionText() + + for (int i = 0; i < 2; i++) { + if (i == 1) + QTest::newRow("FILTERING_OFF") << "FILTERING_OFF" << "" << "" << ""; + +#if defined(Q_OS_WINCE) + QTest::newRow("()") << "" << "" << "/" << "/"; + QTest::newRow("()") << "\\Program" << "" << "Program Files" << "\\Program Files"; +#elif defined(Q_OS_WIN) + QTest::newRow("()") << "C" << "" << "C:" << "C:"; + QTest::newRow("()") << "C:\\Program" << "" << "Program Files" << "C:\\Program Files"; +#elif defined(Q_OS_SYMBIAN) + QTest::newRow("()") << "C" << "" << "C:" << "C:"; + QTest::newRow("()") << "C:\\re" << "" << "resource" << "C:\\resource"; +#elif defined (Q_OS_MAC) + QTest::newRow("()") << "" << "" << "/" << "/"; + QTest::newRow("(/a)") << "/a" << "" << "Applications" << "/Applications"; + QTest::newRow("(/d)") << "/d" << "" << "Developer" << "/Developer"; +#else + QTest::newRow("()") << "" << "" << "/" << "/"; +#if !defined(Q_OS_IRIX) && !defined(Q_OS_AIX) && !defined(Q_OS_HPUX) + QTest::newRow("(/h)") << "/h" << "" << "home" << "/home"; +#endif + QTest::newRow("(/et)") << "/et" << "" << "etc" << "/etc"; + QTest::newRow("(/etc/passw)") << "/etc/passw" << "" << "passwd" << "/etc/passwd"; +#endif + } +} + +void tst_QCompleter::fileSystemModel() +{ + //QFileSystemModel is assync. + filter(true); +} + + void tst_QCompleter::changingModel_data() { } -- cgit v0.12 From c416ec00e7c859a844a5bcb24c7a31147aed974c Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 13 Oct 2010 11:00:29 +0200 Subject: QCompleter: do not auto complete when directory is changed. Fixed regression for QCompleter associated with a QFileSystemModel. It would popup a popup each time the directory is changed. This was a regression in Qt 4.7.0, introduced with 319b0262418d74cc416a7d Task-number: QTBUG-14292 Reviewed-by: Thierry --- src/gui/util/qcompleter.cpp | 18 +++++--- src/gui/util/qcompleter_p.h | 1 + tests/auto/qcompleter/tst_qcompleter.cpp | 74 ++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 6 deletions(-) diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp index e718212..bcd601b 100644 --- a/src/gui/util/qcompleter.cpp +++ b/src/gui/util/qcompleter.cpp @@ -782,7 +782,8 @@ QMatchData QUnsortedModelEngine::filter(const QString& part, const QModelIndex& /////////////////////////////////////////////////////////////////////////////// QCompleterPrivate::QCompleterPrivate() : widget(0), proxy(0), popup(0), cs(Qt::CaseSensitive), role(Qt::EditRole), column(0), - maxVisibleItems(7), sorting(QCompleter::UnsortedModel), wrap(true), eatFocusOut(true) + maxVisibleItems(7), sorting(QCompleter::UnsortedModel), wrap(true), eatFocusOut(true), + hiddenBecauseNoMatch(false) { } @@ -921,12 +922,14 @@ void QCompleterPrivate::showPopup(const QRect& rect) void QCompleterPrivate::_q_fileSystemModelDirectoryLoaded(const QString &path) { Q_Q(QCompleter); -#ifndef QT_NO_LINEEDIT - QLineEdit *lineEdit = qobject_cast(widget); - //the path given by QFileSystemModel does not end with / - if (lineEdit && !lineEdit->text().isEmpty() && !q->completionPrefix().isEmpty() && q->completionPrefix() != path + QLatin1Char('/')) + // Slot called when QFileSystemModel has finished loading. + // If we hide the popup because there was no match because the model was not loaded yet, + // we re-start the completion when we get the results + if (hiddenBecauseNoMatch + && prefix.startsWith(path) && prefix != (path + '/') + && widget) { q->complete(); -#endif + } } /*! @@ -1200,6 +1203,7 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e) Q_D(QCompleter); if (d->eatFocusOut && o == d->widget && e->type() == QEvent::FocusOut) { + d->hiddenBecauseNoMatch = false; if (d->popup && d->popup->isVisible()) return true; } @@ -1378,6 +1382,7 @@ void QCompleter::complete(const QRect& rect) { Q_D(QCompleter); QModelIndex idx = d->proxy->currentIndex(false); + d->hiddenBecauseNoMatch = false; if (d->mode == QCompleter::InlineCompletion) { if (idx.isValid()) d->_q_complete(idx, true); @@ -1389,6 +1394,7 @@ void QCompleter::complete(const QRect& rect) || (d->mode == QCompleter::UnfilteredPopupCompletion && d->proxy->rowCount() == 0)) { if (d->popup) d->popup->hide(); // no suggestion, hide + d->hiddenBecauseNoMatch = true; return; } diff --git a/src/gui/util/qcompleter_p.h b/src/gui/util/qcompleter_p.h index 8f00793..19b76e5 100644 --- a/src/gui/util/qcompleter_p.h +++ b/src/gui/util/qcompleter_p.h @@ -93,6 +93,7 @@ public: bool eatFocusOut; QRect popupRect; + bool hiddenBecauseNoMatch; void showPopup(const QRect&); void _q_complete(QModelIndex, bool = false); diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index 3e05fbc..6d28f9f 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -151,6 +151,7 @@ private slots: void task253125_lineEditCompletion_data(); void task253125_lineEditCompletion(); void task247560_keyboardNavigation(); + void QTBUG_14292_filesystem(); private: void filter(bool assync = false); @@ -571,6 +572,7 @@ void tst_QCompleter::csMatchingOnCiSortedModel() void tst_QCompleter::directoryModel_data() { delete completer; + completer = new CsvCompleter; completer->setModelSorting(QCompleter::CaseSensitivelySortedModel); setSourceModel(DIRECTORY_MODEL); @@ -1451,5 +1453,77 @@ void tst_QCompleter::task247560_keyboardNavigation() QCOMPARE(edit.text(), QString("row 3 column 1")); } +void tst_QCompleter::QTBUG_14292_filesystem() +{ + QDir tmpDir = QDir::temp(); + qsrand(QTime::currentTime().msec()); + QString d = "tst_QCompleter_" + QString::number(qrand()); + QVERIFY(tmpDir.mkdir(d)); + +#if 0 + struct Cleanup { + QString dir; + ~Cleanup() { + qDebug() << dir << + QFile::remove(dir); } + } cleanup; + cleanup.dir = tmpDir.absolutePath()+"/" +d; +#endif + + QVERIFY(tmpDir.cd(d)); + QVERIFY(tmpDir.mkdir("hello")); + QVERIFY(tmpDir.mkdir("holla")); + + QLineEdit edit; + QCompleter comp; + QFileSystemModel model; + model.setRootPath(tmpDir.path()); + comp.setModel(&model); + edit.setCompleter(&comp); + + edit.show(); + QApplication::setActiveWindow(&edit); + QTest::qWaitForWindowShown(&edit); + QTRY_VERIFY(QApplication::activeWindow() == &edit); + + QVERIFY(!comp.popup()->isVisible()); + edit.setText(tmpDir.path()); + QTest::keyClick(&edit, '/'); + QTRY_VERIFY(comp.popup()->isVisible()); + QCOMPARE(comp.popup()->model()->rowCount(), 2); + QTest::keyClick(&edit, 'h'); + QCOMPARE(comp.popup()->model()->rowCount(), 2); + QTest::keyClick(&edit, 'e'); + QCOMPARE(comp.popup()->model()->rowCount(), 1); + QTest::keyClick(&edit, 'r'); + QTRY_VERIFY(!comp.popup()->isVisible()); + QVERIFY(tmpDir.mkdir("hero")); + QTRY_VERIFY(comp.popup()->isVisible()); + QCOMPARE(comp.popup()->model()->rowCount(), 1); + QTest::keyClick(comp.popup(), Qt::Key_Escape); + QTRY_VERIFY(!comp.popup()->isVisible()); + QVERIFY(tmpDir.mkdir("nothingThere")); + //there is no reason creating a file should open a popup, it did in Qt 4.7.0 + QTest::qWait(60); + QVERIFY(!comp.popup()->isVisible()); + + QTest::keyClick(&edit, Qt::Key_Backspace); + QTRY_VERIFY(comp.popup()->isVisible()); + QCOMPARE(comp.popup()->model()->rowCount(), 2); + QTest::keyClick(&edit, 'm'); + QTRY_VERIFY(!comp.popup()->isVisible()); + + QWidget w; + w.show(); + QApplication::setActiveWindow(&w); + QTest::qWaitForWindowShown(&w); + QTRY_VERIFY(!edit.hasFocus() && !comp.popup()->hasFocus()); + + QVERIFY(tmpDir.mkdir("hemo")); + //there is no reason creating a file should open a popup, it did in Qt 4.7.0 + QTest::qWait(60); + QVERIFY(!comp.popup()->isVisible()); +} + QTEST_MAIN(tst_QCompleter) #include "tst_qcompleter.moc" -- cgit v0.12 From ab3304c663a62acb26af139d120f27a49a9d22ff Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Wed, 13 Oct 2010 11:38:38 +0200 Subject: In meego graphics system, use always 16bit textures. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use GL_RGB16 for no-alpha images and RGBA4 for alpha images. Merge-request: 854 Reviewed-by: Samuel Rødal --- .../graphicssystems/meego/qmeegopixmapdata.cpp | 48 ++++++++++++++++++---- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp b/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp index 84fc593..799a28e 100644 --- a/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp +++ b/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp @@ -51,6 +51,24 @@ static EGLint preserved_image_attribs[] = { EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, E QHash QMeeGoPixmapData::sharedImagesMap; +// This helper method converts (in place) a QImage::Format_ARGB4444_Premultiplied to +// GL-friendly Format_RGBA4444_Premultiplied. Just swaps the bits around really. +static void qARGBA4ToRGBA4(QImage *image) +{ + unsigned char *raw = static_cast (image->data_ptr()->data); + // FIXME image.bytesPerLine() is broken. Returns 512 for 128x128 image while it should + // return 256 + int bytesPerLine = image->width() * 2; + + for (int y = 0; y < image->height(); y++) { + for (int x = 0; x < image->width(); x++) { + unsigned short *target = (unsigned short *) (raw + (y * bytesPerLine + (x * 2))); + // FIXME Oh yeah, that's broken with endianness. + *target = (*target << 4) | (* target >> 12); + } + } +} + /* Public */ QMeeGoPixmapData::QMeeGoPixmapData() : QGLPixmapData(QPixmapData::PixmapType) @@ -108,8 +126,6 @@ void QMeeGoPixmapData::fromEGLImage(Qt::HANDLE handle) QMeeGoExtensions::eglQueryImageNOK(QEgl::display(), (EGLImageKHR) handle, EGL_HEIGHT, &newHeight); if (textureIsBound) { - // FIXME Remove this ugly hasAlphaChannel check when Qt lands the NoOpaqueCheck flag fix - // for QGLPixmapData. fromTexture(newTextureId, newWidth, newHeight, true); } else { qWarning("Failed to create a texture from an egl image!"); @@ -152,10 +168,9 @@ void QMeeGoPixmapData::fromEGLSharedImage(Qt::HANDLE handle, const QImage &si) } if (textureIsBound) { - // FIXME Remove this ugly hasAlphaChannel check when Qt lands the NoOpaqueCheck flag fix - // for QGLPixmapData. fromTexture(newTextureId, newWidth, newHeight, - (si.hasAlphaChannel() && const_cast(si).data_ptr()->checkForAlphaPixels())); + si.hasAlphaChannel()); + texture()->options &= ~QGLContext::InvertedYBindOption; softImage = si; QMeeGoPixmapData::registerSharedImage(handle, softImage); } else { @@ -171,15 +186,31 @@ Qt::HANDLE QMeeGoPixmapData::imageToEGLSharedImage(const QImage &image) QMeeGoExtensions::ensureInitialized(); glFinish(); - QGLPixmapData pixmapData(QPixmapData::PixmapType); - pixmapData.fromImage(image, 0); - GLuint textureId = pixmapData.bind(); + + GLuint textureId; + + glGenTextures(1, &textureId); + glBindTexture(GL_TEXTURE_2D, textureId); + if (image.hasAlphaChannel()) { + QImage convertedImage = image.convertToFormat(QImage::Format_ARGB4444_Premultiplied, Qt::NoOpaqueDetection); + qARGBA4ToRGBA4(&convertedImage); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, convertedImage.bits()); + } else { + QImage convertedImage = image.convertToFormat(QImage::Format_RGB16, Qt::NoOpaqueDetection); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image.width(), image.height(), 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, convertedImage.bits()); + } + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glFinish(); + + glBindTexture(GL_TEXTURE_2D, textureId); EGLImageKHR eglimage = QEgl::eglCreateImageKHR(QEgl::display(), QEglContext::currentContext(QEgl::OpenGL)->context(), EGL_GL_TEXTURE_2D_KHR, (EGLClientBuffer) textureId, preserved_image_attribs); + glDeleteTextures(1, &textureId); glFinish(); if (eglimage) { @@ -195,6 +226,7 @@ Qt::HANDLE QMeeGoPixmapData::imageToEGLSharedImage(const QImage &image) void QMeeGoPixmapData::updateFromSoftImage() { + // FIXME That's broken with recent 16bit textures changes. m_dirty = true; m_source = softImage; ensureCreated(); -- cgit v0.12 From 1af2d09523e3808e4589f05a4b8d42c308eb0841 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Wed, 13 Oct 2010 11:38:39 +0200 Subject: Proper dither & proper alpha checking. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 854 Reviewed-by: Samuel Rødal --- src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp b/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp index 799a28e..5473d09 100644 --- a/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp +++ b/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp @@ -169,7 +169,7 @@ void QMeeGoPixmapData::fromEGLSharedImage(Qt::HANDLE handle, const QImage &si) if (textureIsBound) { fromTexture(newTextureId, newWidth, newHeight, - si.hasAlphaChannel()); + (si.hasAlphaChannel() && const_cast(si).data_ptr()->checkForAlphaPixels())); texture()->options &= ~QGLContext::InvertedYBindOption; softImage = si; QMeeGoPixmapData::registerSharedImage(handle, softImage); @@ -191,12 +191,12 @@ Qt::HANDLE QMeeGoPixmapData::imageToEGLSharedImage(const QImage &image) glGenTextures(1, &textureId); glBindTexture(GL_TEXTURE_2D, textureId); - if (image.hasAlphaChannel()) { - QImage convertedImage = image.convertToFormat(QImage::Format_ARGB4444_Premultiplied, Qt::NoOpaqueDetection); + if (image.hasAlphaChannel() && (image.hasAlphaChannel() && const_cast(image).data_ptr()->checkForAlphaPixels())) { + QImage convertedImage = image.convertToFormat(QImage::Format_ARGB4444_Premultiplied, Qt::DiffuseAlphaDither | Qt::DiffuseDither | Qt::PreferDither); qARGBA4ToRGBA4(&convertedImage); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, convertedImage.bits()); } else { - QImage convertedImage = image.convertToFormat(QImage::Format_RGB16, Qt::NoOpaqueDetection); + QImage convertedImage = image.convertToFormat(QImage::Format_RGB16, Qt::DiffuseAlphaDither | Qt::DiffuseDither | Qt::PreferDither); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image.width(), image.height(), 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, convertedImage.bits()); } -- cgit v0.12 From fa6bad3c703fdb2d0218972c5774ed0a61948f84 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Wed, 13 Oct 2010 11:40:51 +0200 Subject: Correctly remove the egl alpha surface flags in meego graphics system. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 856 Reviewed-by: Samuel Rødal --- src/plugins/graphicssystems/meego/qmeegographicssystem.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp index f8b228c..b378b13 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp +++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp @@ -363,7 +363,9 @@ EGLSurface QMeeGoGraphicsSystem::getSurfaceForLiveTexturePixmap(QPixmap *pixmap) pixmapData->gl_surface = (void*)QEgl::createSurface(pixmap, config); if (hasAlpha) - pixmapData->flags = pixmapData->flags | QX11PixmapData::GlSurfaceCreatedWithAlpha; + pixmapData->flags |= QX11PixmapData::GlSurfaceCreatedWithAlpha; + else + pixmapData->flags &= ~QX11PixmapData::GlSurfaceCreatedWithAlpha; if (pixmapData->gl_surface == (void*)EGL_NO_SURFACE) return NULL; -- cgit v0.12 From 6f1f1317e68a261173ddb24a045dcc823b16a3bd Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Wed, 13 Oct 2010 11:40:51 +0200 Subject: Correctly handle both 16bit and 32bit live pixmaps in meego graphics system. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 856 Reviewed-by: Samuel Rødal --- src/plugins/graphicssystems/meego/qmeegographicssystem.cpp | 14 +++++++++++--- src/plugins/graphicssystems/meego/qmeegographicssystem.h | 4 ++-- tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp | 6 +++--- tools/qmeegographicssystemhelper/qmeegoruntime.cpp | 6 +++--- tools/qmeegographicssystemhelper/qmeegoruntime.h | 2 +- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp index b378b13..27e728a 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp +++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp @@ -275,7 +275,7 @@ bool QMeeGoGraphicsSystem::unlockLiveTexture(Qt::HANDLE h) } } -void QMeeGoGraphicsSystem::queryLiveTexture(Qt::HANDLE h, void **data, int *pitch) +void QMeeGoGraphicsSystem::queryLiveTexture(Qt::HANDLE h, void **data, int *pitch, QImage::Format *f) { // FIXME Only allow this on locked surfaces if (! liveTexturePixmaps.contains(h)) { @@ -289,6 +289,14 @@ void QMeeGoGraphicsSystem::queryLiveTexture(Qt::HANDLE h, void **data, int *pitc EGLSurface surface = getSurfaceForLiveTexturePixmap(liveTexturePixmaps.value(h)); eglQuerySurface(QEgl::display(), surface, EGL_BITMAP_POINTER_KHR, (EGLint*) data); eglQuerySurface(QEgl::display(), surface, EGL_BITMAP_PITCH_KHR, (EGLint*) pitch); + + // Ok, here we know we just support those two formats. Real solution would be: + // in liveTexturePixmaps store a small structure containing the pixmap and the + // original Qt format. + if (liveTexturePixmaps.value(h)->depth() > 16) + *f = QImage::Format_ARGB32_Premultiplied; + else + *f = QImage::Format_RGB16; } Qt::HANDLE QMeeGoGraphicsSystem::liveTextureToEGLImage(Qt::HANDLE h) @@ -441,9 +449,9 @@ bool qt_meego_live_texture_unlock(Qt::HANDLE h) return QMeeGoGraphicsSystem::unlockLiveTexture(h); } -void qt_meego_live_texture_query(Qt::HANDLE h, void **data, int *pitch) +void qt_meego_live_texture_query(Qt::HANDLE h, void **data, int *pitch, QImage::Format *f) { - return QMeeGoGraphicsSystem::queryLiveTexture(h, data, pitch); + return QMeeGoGraphicsSystem::queryLiveTexture(h, data, pitch, f); } Qt::HANDLE qt_meego_live_texture_to_egl_image(Qt::HANDLE h) diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.h b/src/plugins/graphicssystems/meego/qmeegographicssystem.h index 934d32d..fad0db6 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystem.h +++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.h @@ -71,7 +71,7 @@ public: static void destroyLiveTexture(Qt::HANDLE h); static bool lockLiveTexture(Qt::HANDLE h); static bool unlockLiveTexture(Qt::HANDLE h); - static void queryLiveTexture(Qt::HANDLE h, void **data, int *pitch); + static void queryLiveTexture(Qt::HANDLE h, void **data, int *pitch, QImage::Format *format); static Qt::HANDLE liveTextureToEGLImage(Qt::HANDLE h); private: @@ -99,7 +99,7 @@ extern "C" { Q_DECL_EXPORT void m_live_texture_destroy(Qt::HANDLE h); Q_DECL_EXPORT bool m_live_texture_lock(Qt::HANDLE h); Q_DECL_EXPORT bool m_live_texture_unlock(Qt::HANDLE h); - Q_DECL_EXPORT void m_live_texture_query(Qt::HANDLE h, void **data, int *pitch); + Q_DECL_EXPORT void m_live_texture_query(Qt::HANDLE h, void **data, int *pitch, QImage::Format *f); Q_DECL_EXPORT Qt::HANDLE m_live_texture_to_egl_image(Qt::HANDLE h); } diff --git a/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp b/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp index b9dbb2b..5e36631 100644 --- a/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp +++ b/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp @@ -118,20 +118,20 @@ QImage* QMeeGoLivePixmap::lock() void *data = NULL; int pitch = 0; + QImage::Format format; if (! QMeeGoRuntime::lockLiveTexture(d->handle)) { qWarning("Failed to lock a live texture!"); return new QImage(); } - QMeeGoRuntime::queryLiveTexture(d->handle, &data, &pitch); + QMeeGoRuntime::queryLiveTexture(d->handle, &data, &pitch, &format); if (data == NULL || pitch == 0) { qWarning("Failed to query the live texture!"); return new QImage(); } - // FIXME Bug here! FIX FIX FIX FIX FIX FIX - return new QImage((uchar *) data, width(), height(), QImage::Format_RGB16); + return new QImage((uchar *) data, width(), height(), format); } void QMeeGoLivePixmap::release(QImage *img) diff --git a/tools/qmeegographicssystemhelper/qmeegoruntime.cpp b/tools/qmeegographicssystemhelper/qmeegoruntime.cpp index 44f9f58..215dffc 100644 --- a/tools/qmeegographicssystemhelper/qmeegoruntime.cpp +++ b/tools/qmeegographicssystemhelper/qmeegoruntime.cpp @@ -62,7 +62,7 @@ typedef Qt::HANDLE (*QMeeGoLiveTextureCreateFunc) (int w, int h, QImage::Format typedef bool (*QMeeGoLiveTextureLockFunc) (Qt::HANDLE h); typedef bool (*QMeeGoLiveTextureUnlockFunc) (Qt::HANDLE h); typedef void (*QMeeGoLiveTextureDestroyFunc) (Qt::HANDLE h); -typedef void (*QMeeGoLiveTextureQueryFunc) (Qt::HANDLE h, void **data, int *pitch); +typedef void (*QMeeGoLiveTextureQueryFunc) (Qt::HANDLE h, void **data, int *pitch, QImage::Format *format); typedef Qt::HANDLE (*QMeeGoLiveTextureToEglImageFunc) (Qt::HANDLE h); static QMeeGoImageToEglSharedImageFunc qt_meego_image_to_egl_shared_image = NULL; @@ -216,11 +216,11 @@ void QMeeGoRuntime::destroyLiveTexture(Qt::HANDLE h) qt_meego_live_texture_destroy(h); } -void QMeeGoRuntime::queryLiveTexture(Qt::HANDLE h, void **data, int *pitch) +void QMeeGoRuntime::queryLiveTexture(Qt::HANDLE h, void **data, int *pitch, QImage::Format *format) { ENSURE_INITIALIZED; Q_ASSERT(qt_meego_live_texture_query); - qt_meego_live_texture_query(h, data, pitch); + qt_meego_live_texture_query(h, data, pitch, format); } Qt::HANDLE QMeeGoRuntime::liveTextureToEGLImage(Qt::HANDLE handle) diff --git a/tools/qmeegographicssystemhelper/qmeegoruntime.h b/tools/qmeegographicssystemhelper/qmeegoruntime.h index 048b9be..9f2d505 100644 --- a/tools/qmeegographicssystemhelper/qmeegoruntime.h +++ b/tools/qmeegographicssystemhelper/qmeegoruntime.h @@ -60,7 +60,7 @@ public: static bool lockLiveTexture(Qt::HANDLE h); static bool unlockLiveTexture(Qt::HANDLE h); static void destroyLiveTexture(Qt::HANDLE h); - static void queryLiveTexture(Qt::HANDLE h, void **data, int *pitch); + static void queryLiveTexture(Qt::HANDLE h, void **data, int *pitch, QImage::Format *format); static Qt::HANDLE liveTextureToEGLImage(Qt::HANDLE); private: -- cgit v0.12 From 62dc9c9602987f4381481cc5642e3ea0782bb418 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 13 Oct 2010 11:42:10 +0200 Subject: Adjust the parent index for the itemsMoved call. Not doing this causes the parent QModelIndexes to be out of sync with the model. The fix in fe350ca756df6392b3d0b7840351fccc89f9ef6f is extended to also use adjusted indexes in the itemMove call. Merge-request: 849 Reviewed-by: Olivier Goffart --- src/corelib/kernel/qabstractitemmodel.cpp | 8 ++++---- tests/auto/modeltest/dynamictreemodel.cpp | 7 +++++++ tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp | 6 ++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp index 9a99ea1..05cb271 100644 --- a/src/corelib/kernel/qabstractitemmodel.cpp +++ b/src/corelib/kernel/qabstractitemmodel.cpp @@ -2637,8 +2637,6 @@ void QAbstractItemModel::endMoveRows() QAbstractItemModelPrivate::Change insertChange = d->changes.pop(); QAbstractItemModelPrivate::Change removeChange = d->changes.pop(); - d->itemsMoved(removeChange.parent, removeChange.first, removeChange.last, insertChange.parent, insertChange.first, Qt::Vertical); - QModelIndex adjustedSource = removeChange.parent; QModelIndex adjustedDestination = insertChange.parent; @@ -2649,6 +2647,8 @@ void QAbstractItemModel::endMoveRows() if (removeChange.needsAdjust) adjustedSource = createIndex(adjustedSource.row() + numMoved, adjustedSource.column(), adjustedSource.internalPointer()); + d->itemsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first, Qt::Vertical); + emit rowsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first); emit layoutChanged(); } @@ -2861,8 +2861,6 @@ void QAbstractItemModel::endMoveColumns() QAbstractItemModelPrivate::Change insertChange = d->changes.pop(); QAbstractItemModelPrivate::Change removeChange = d->changes.pop(); - d->itemsMoved(removeChange.parent, removeChange.first, removeChange.last, insertChange.parent, insertChange.first, Qt::Horizontal); - QModelIndex adjustedSource = removeChange.parent; QModelIndex adjustedDestination = insertChange.parent; @@ -2873,6 +2871,8 @@ void QAbstractItemModel::endMoveColumns() if (removeChange.needsAdjust) adjustedSource = createIndex(adjustedSource.row(), adjustedSource.column() + numMoved, adjustedSource.internalPointer()); + d->itemsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first, Qt::Horizontal); + emit columnsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first); emit layoutChanged(); } diff --git a/tests/auto/modeltest/dynamictreemodel.cpp b/tests/auto/modeltest/dynamictreemodel.cpp index b572eb1..fa634b6 100644 --- a/tests/auto/modeltest/dynamictreemodel.cpp +++ b/tests/auto/modeltest/dynamictreemodel.cpp @@ -63,6 +63,13 @@ QModelIndex DynamicTreeModel::index(int row, int column, const QModelIndex &pare QList > childIdColumns = m_childItems.value(parent.internalId()); + const qint64 grandParent = findParentId(parent.internalId()); + if (grandParent >= 0) { + QList > parentTable = m_childItems.value(grandParent); + Q_ASSERT(parent.column() < parentTable.size()); + QList parentSiblings = parentTable.at(parent.column()); + Q_ASSERT(parent.row() < parentSiblings.size()); + } if (childIdColumns.size() == 0) return QModelIndex(); diff --git a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp index dbcccc9..b723253 100644 --- a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp +++ b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp @@ -1167,6 +1167,7 @@ void tst_QAbstractItemModel::testMoveToGrandParent_data() // Moving everything from one parent to another QTest::newRow("move12") << 0 << 9 << 10; + QTest::newRow("move13") << 0 << 9 << 0; } void tst_QAbstractItemModel::testMoveToGrandParent() @@ -1314,6 +1315,11 @@ void tst_QAbstractItemModel::testMoveToSibling_data() QTest::newRow("move09") << 8 << 8 << 4; QTest::newRow("move10") << 8 << 8 << 5; QTest::newRow("move11") << 8 << 8 << 6; + + // Move such that the destination parent no longer valid after the move. + // The destination parent is always QMI(5, 0), but after this move the + // row count is 5, so (5, 0) (used internally in QAIM) no longer refers to a valid index. + QTest::newRow("move12") << 0 << 4 << 0; } void tst_QAbstractItemModel::testMoveToSibling() -- cgit v0.12 From 378b1608e7962da9ee295101be40c84606a8a6c0 Mon Sep 17 00:00:00 2001 From: kh1 Date: Wed, 13 Oct 2010 11:58:21 +0200 Subject: Fix potential crash in case we had opened pages but run now without docs. --- tools/assistant/tools/assistant/openpagesmanager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/assistant/tools/assistant/openpagesmanager.cpp b/tools/assistant/tools/assistant/openpagesmanager.cpp index 3b69b50..75b8653 100644 --- a/tools/assistant/tools/assistant/openpagesmanager.cpp +++ b/tools/assistant/tools/assistant/openpagesmanager.cpp @@ -167,7 +167,8 @@ void OpenPagesManager::setupInitialPages(bool defaultCollection, m_model->addPage(helpEngine.homePage()); for (int i = 0; i < m_model->rowCount(); ++i) CentralWidget::instance()->addPage(m_model->pageAt(i)); - setCurrentPage(initialPage); + setCurrentPage((initialPage >= m_model->rowCount()) + ? m_model->rowCount() - 1 : initialPage); m_openPagesSwitcher->selectCurrentPage(); } -- cgit v0.12 From 1c86defda1d9cd3577898ec5f63c4d9bd250564b Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Wed, 13 Oct 2010 13:12:34 +0200 Subject: Fixed statement about const_iterator and some whitespace fixes. Task-number: QTBUG-14252 Reviewed-by: David Boddie --- src/corelib/tools/qlinkedlist.cpp | 4 ++-- src/corelib/tools/qlist.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qlinkedlist.cpp b/src/corelib/tools/qlinkedlist.cpp index 909d940..7213c6e 100644 --- a/src/corelib/tools/qlinkedlist.cpp +++ b/src/corelib/tools/qlinkedlist.cpp @@ -254,7 +254,7 @@ QLinkedListData QLinkedListData::shared_null = { \sa insert() */ -/*! +/*! \fn bool QLinkedList::removeOne(const T &value) \since 4.4 @@ -830,7 +830,7 @@ QLinkedListData QLinkedListData::shared_null = { QLinkedList\::const_iterator allows you to iterate over a QLinkedList\. If you want modify the QLinkedList as you iterate - over it, you must use QLinkedList::const_iterator instead. It is + over it, you must use QLinkedList::iterator instead. It is generally good practice to use QLinkedList::const_iterator on a non-const QLinkedList as well, unless you need to change the QLinkedList through the iterator. Const iterators are slightly diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp index 6cc6fc1..9ba3768 100644 --- a/src/corelib/tools/qlist.cpp +++ b/src/corelib/tools/qlist.cpp @@ -936,7 +936,7 @@ 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 + Note that QList uses 0-based indexes, just like C++ arrays. Negative indexes are not supported with the exception of the value mentioned above. -- cgit v0.12 From 9f766c977a329c84023a15fc66f52d26ff03447b Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 13 Oct 2010 13:27:06 +0200 Subject: Revert "Revert "Fix (implement!) hfw/wfh in QGridLayoutEngine"" This reverts commit 5bd6f7eb5c7d87c08539b6c2df416990cc417ec7. This is a revert of the revert. It is required apply the merge-request 847, which itself revert back part of this commit but fixing it the (hopefuly) right way --- src/gui/graphicsview/qgraphicslayoutitem.cpp | 51 ++- src/gui/graphicsview/qgraphicslayoutitem_p.h | 6 + src/gui/graphicsview/qgridlayoutengine.cpp | 251 +++++++++++++- src/gui/graphicsview/qgridlayoutengine_p.h | 23 +- .../tst_qgraphicsgridlayout.cpp | 364 ++++++++++++++++++++- 5 files changed, 678 insertions(+), 17 deletions(-) diff --git a/src/gui/graphicsview/qgraphicslayoutitem.cpp b/src/gui/graphicsview/qgraphicslayoutitem.cpp index ad4b2b5..634f68c 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem.cpp +++ b/src/gui/graphicsview/qgraphicslayoutitem.cpp @@ -48,6 +48,7 @@ #include "qgraphicslayoutitem.h" #include "qgraphicslayoutitem_p.h" #include "qwidget.h" +#include "qgraphicswidget.h" #include @@ -139,9 +140,11 @@ QSizeF *QGraphicsLayoutItemPrivate::effectiveSizeHints(const QSizeF &constraint) if (!sizeHintCacheDirty && cachedConstraint == constraint) return cachedSizeHints; + const bool hasConstraint = constraint.width() >= 0 || constraint.height() >= 0; + for (int i = 0; i < Qt::NSizeHints; ++i) { cachedSizeHints[i] = constraint; - if (userSizeHints) + if (userSizeHints && !hasConstraint) combineSize(cachedSizeHints[i], userSizeHints[i]); } @@ -259,6 +262,52 @@ void QGraphicsLayoutItemPrivate::setSizeComponent( q->updateGeometry(); } + +bool QGraphicsLayoutItemPrivate::hasHeightForWidth() const +{ + Q_Q(const QGraphicsLayoutItem); + if (isLayout) { + const QGraphicsLayout *l = static_cast(q); + for (int i = l->count() - 1; i >= 0; --i) { + if (QGraphicsLayoutItemPrivate::get(l->itemAt(i))->hasHeightForWidth()) + return true; + } + } else if (QGraphicsItem *item = q->graphicsItem()) { + if (item->isWidget()) { + QGraphicsWidget *w = static_cast(item); + if (w->layout()) { + return QGraphicsLayoutItemPrivate::get(w->layout())->hasHeightForWidth(); + } + } + } + return q->sizePolicy().hasHeightForWidth(); +} + +bool QGraphicsLayoutItemPrivate::hasWidthForHeight() const +{ + // enable this code when we add QSizePolicy::hasWidthForHeight() (For 4.8) +#if 1 + return false; +#else + Q_Q(const QGraphicsLayoutItem); + if (isLayout) { + const QGraphicsLayout *l = static_cast(q); + for (int i = l->count() - 1; i >= 0; --i) { + if (QGraphicsLayoutItemPrivate::get(l->itemAt(i))->hasWidthForHeight()) + return true; + } + } else if (QGraphicsItem *item = q->graphicsItem()) { + if (item->isWidget()) { + QGraphicsWidget *w = static_cast(item); + if (w->layout()) { + return QGraphicsLayoutItemPrivate::get(w->layout())->hasWidthForHeight(); + } + } + } + return q->sizePolicy().hasWidthForHeight(); +#endif +} + /*! \class QGraphicsLayoutItem \brief The QGraphicsLayoutItem class can be inherited to allow your custom diff --git a/src/gui/graphicsview/qgraphicslayoutitem_p.h b/src/gui/graphicsview/qgraphicslayoutitem_p.h index 15cc7a5..b752e03 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem_p.h +++ b/src/gui/graphicsview/qgraphicslayoutitem_p.h @@ -65,6 +65,9 @@ class Q_AUTOTEST_EXPORT QGraphicsLayoutItemPrivate public: virtual ~QGraphicsLayoutItemPrivate(); QGraphicsLayoutItemPrivate(QGraphicsLayoutItem *parent, bool isLayout); + static QGraphicsLayoutItemPrivate *get(QGraphicsLayoutItem *q) { return q->d_func();} + static const QGraphicsLayoutItemPrivate *get(const QGraphicsLayoutItem *q) { return q->d_func();} + void init(); QSizeF *effectiveSizeHints(const QSizeF &constraint) const; QGraphicsItem *parentItem() const; @@ -73,6 +76,9 @@ public: enum SizeComponent { Width, Height }; void setSizeComponent(Qt::SizeHint which, SizeComponent component, qreal value); + bool hasHeightForWidth() const; + bool hasWidthForHeight() const; + QSizePolicy sizePolicy; QGraphicsLayoutItem *parent; diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp index ae5bf90..1e3addc 100644 --- a/src/gui/graphicsview/qgridlayoutengine.cpp +++ b/src/gui/graphicsview/qgridlayoutengine.cpp @@ -545,6 +545,24 @@ QSizePolicy::Policy QGridLayoutItem::sizePolicy(Qt::Orientation orientation) con : sizePolicy.verticalPolicy(); } +/* + returns true if the size policy returns true for either hasHeightForWidth() + or hasWidthForHeight() + */ +bool QGridLayoutItem::hasDynamicConstraint() const +{ + return QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth() + || QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasWidthForHeight(); +} + +Qt::Orientation QGridLayoutItem::dynamicConstraintOrientation() const +{ + if (QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth()) + return Qt::Vertical; + else //if (QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasWidthForHeight()) + return Qt::Horizontal; +} + QSizePolicy::ControlTypes QGridLayoutItem::controlTypes(LayoutSide /* side */) const { return q_layoutItem->sizePolicy().controlType(); @@ -613,7 +631,14 @@ QRectF QGridLayoutItem::geometryWithin(qreal x, qreal y, qreal width, qreal heig qreal cellWidth = width; qreal cellHeight = height; - QSizeF size = effectiveMaxSize().boundedTo(QSizeF(cellWidth, cellHeight)); + QSize constraint; + if (hasDynamicConstraint()) { + if (dynamicConstraintOrientation() == Qt::Vertical) + constraint.setWidth(cellWidth); + else + constraint.setHeight(cellHeight); + } + QSizeF size = effectiveMaxSize(constraint).boundedTo(QSizeF(cellWidth, cellHeight)); width = size.width(); height = size.height(); @@ -675,13 +700,13 @@ void QGridLayoutItem::insertOrRemoveRows(int row, int delta, Qt::Orientation ori Note that effectiveSizeHint does not take sizePolicy into consideration, (since it only evaluates the hints, as the name implies) */ -QSizeF QGridLayoutItem::effectiveMaxSize() const +QSizeF QGridLayoutItem::effectiveMaxSize(const QSizeF &constraint) const { - QSizeF size; + QSizeF size = constraint; bool vGrow = (sizePolicy(Qt::Vertical) & QSizePolicy::GrowFlag) == QSizePolicy::GrowFlag; bool hGrow = (sizePolicy(Qt::Horizontal) & QSizePolicy::GrowFlag) == QSizePolicy::GrowFlag; if (!vGrow || !hGrow) { - QSizeF pref = layoutItem()->effectiveSizeHint(Qt::PreferredSize); + QSizeF pref = layoutItem()->effectiveSizeHint(Qt::PreferredSize, constraint); if (!vGrow) size.setHeight(pref.height()); if (!hGrow) @@ -689,7 +714,7 @@ QSizeF QGridLayoutItem::effectiveMaxSize() const } if (!size.isValid()) { - QSizeF maxSize = layoutItem()->effectiveSizeHint(Qt::MaximumSize); + QSizeF maxSize = layoutItem()->effectiveSizeHint(Qt::MaximumSize, constraint); if (size.width() == -1) size.setWidth(maxSize.width()); if (size.height() == -1) @@ -1010,6 +1035,7 @@ void QGridLayoutEngine::invalidate() q_cachedEffectiveLastRows[Ver] = -1; q_cachedDataForStyleInfo.invalidate(); q_cachedSize = QSizeF(); + q_cachedConstraintOrientation = UnknownConstraint; } static void visualRect(QRectF *geom, Qt::LayoutDirection dir, const QRectF &contentsRect) @@ -1074,10 +1100,13 @@ QRectF QGridLayoutEngine::cellRect(const QLayoutStyleInfo &styleInfo, } QSizeF QGridLayoutEngine::sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHint which, - const QSizeF & /* constraint */) const + const QSizeF &constraint) const { ensureColumnAndRowData(styleInfo); + if (hasDynamicConstraint()) + return dynamicallyConstrainedSizeHint(which, constraint); + switch (which) { case Qt::MinimumSize: return QSizeF(q_totalBoxes[Hor].q_minimumSize, q_totalBoxes[Ver].q_minimumSize); @@ -1375,7 +1404,11 @@ void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData, const QLayoutSt box = &multiCell.q_box; multiCell.q_stretch = itemStretch; } - box->combine(item->box(orientation)); + // Items with constraints are not included in the orientation that + // they are constrained (since it depends on the hfw/constraint function). + // They must be combined at a later stage. + if (!item->hasDynamicConstraint() || orientation != item->dynamicConstraintOrientation()) + box->combine(item->box(orientation)); if (effectiveRowSpan == 1) { QSizePolicy::ControlTypes controls = item->controlTypes(top); @@ -1532,6 +1565,138 @@ void QGridLayoutEngine::ensureColumnAndRowData(const QLayoutStyleInfo &styleInfo q_cachedDataForStyleInfo = styleInfo; } +QSizeF QGridLayoutEngine::dynamicallyConstrainedSizeHint(Qt::SizeHint which, + const QSizeF &constraint) const +{ + Q_ASSERT(hasDynamicConstraint()); + if (constraint.width() < 0 && constraint.height() < 0) { + // Process the hfw / wfh items that we did not process in fillRowData() + const Qt::Orientation constraintOrient = constraintOrientation(); + + QGridLayoutRowData rowData = constraintOrient == Qt::Vertical ? q_rowData : q_columnData; + for (int i = q_items.count() - 1; i >= 0; --i) { + QGridLayoutItem *item = q_items.at(i); + if (item->hasDynamicConstraint()) { + QGridLayoutBox box = item->box(constraintOrient); + QGridLayoutBox &rowBox = rowData.boxes[item->firstRow(constraintOrient)]; + rowBox.combine(box); + } + } + + QGridLayoutBox totalBoxes[2]; + if (constraintOrient == Qt::Vertical) { + totalBoxes[Hor] = q_columnData.totalBox(0, columnCount()); + totalBoxes[Ver] = rowData.totalBox(0, rowCount()); + } else { + totalBoxes[Hor] = rowData.totalBox(0, columnCount()); + totalBoxes[Ver] = q_rowData.totalBox(0, rowCount()); + } + return QSizeF(totalBoxes[Hor].q_sizes(which), totalBoxes[Ver].q_sizes(which)); + } + + + Q_ASSERT(constraint.width() >= 0 || constraint.height() >= 0); + q_xx.resize(columnCount()); + q_yy.resize(rowCount()); + q_widths.resize(columnCount()); + q_heights.resize(rowCount()); + q_descents.resize(rowCount()); + + + const Qt::Orientation orientation = constraintOrientation(); + QGridLayoutRowData *colData; + QGridLayoutRowData constrainedRowData; + QGridLayoutBox *totalBox; + qreal *sizes; + qreal *pos; + qreal *descents; + qreal targetSize; + qreal cCount; + qreal rCount; + + if (orientation == Qt::Vertical) { + // height for width + colData = &q_columnData; + totalBox = &q_totalBoxes[Hor]; + sizes = q_widths.data(); + pos = q_xx.data(); + descents = 0; + targetSize = constraint.width(); + cCount = columnCount(); + rCount = rowCount(); + constrainedRowData = q_rowData; + } else { + // width for height + colData = &q_rowData; + totalBox = &q_totalBoxes[Ver]; + sizes = q_heights.data(); + pos = q_yy.data(); + descents = q_descents.data(); + targetSize = constraint.height(); + cCount = rowCount(); + rCount = columnCount(); + constrainedRowData = q_columnData; + } + colData->calculateGeometries(0, cCount, targetSize, pos, sizes, descents, *totalBox); + for (int i = q_items.count() - 1; i >= 0; --i) { + QGridLayoutItem *item = q_items.at(i); + + if (item->hasDynamicConstraint()) { + const qreal size = sizes[item->firstColumn(orientation)]; + QGridLayoutBox box = item->box(orientation, size); + QGridLayoutBox &rowBox = constrainedRowData.boxes[item->firstRow(orientation)]; + rowBox.combine(box); + } + } + const qreal newSize = constrainedRowData.totalBox(0, rCount).q_sizes(which); + + return (orientation == Qt::Vertical) ? QSizeF(targetSize, newSize) : QSizeF(newSize, targetSize); +} + + +/** + returns false if the layout has contradicting constraints (i.e. some items with a horizontal + constraint and other items with a vertical constraint) + */ +bool QGridLayoutEngine::ensureDynamicConstraint() const +{ + if (q_cachedConstraintOrientation == UnknownConstraint) { + for (int i = q_items.count() - 1; i >= 0; --i) { + QGridLayoutItem *item = q_items.at(i); + if (item->hasDynamicConstraint()) { + Qt::Orientation itemConstraintOrientation = item->dynamicConstraintOrientation(); + if (q_cachedConstraintOrientation == UnknownConstraint) { + q_cachedConstraintOrientation = itemConstraintOrientation; + } else if (q_cachedConstraintOrientation != itemConstraintOrientation) { + q_cachedConstraintOrientation = UnfeasibleConstraint; + qWarning("QGridLayoutEngine: Unfeasible, cannot mix horizontal and" + " vertical constraint in the same layout"); + return false; + } + } + } + if (q_cachedConstraintOrientation == UnknownConstraint) + q_cachedConstraintOrientation = NoConstraint; + } + return true; +} + +bool QGridLayoutEngine::hasDynamicConstraint() const +{ + if (!ensureDynamicConstraint()) + return false; + return q_cachedConstraintOrientation != NoConstraint; +} + +/* + * return value is only valid if hasConstraint() returns true + */ +Qt::Orientation QGridLayoutEngine::constraintOrientation() const +{ + (void)ensureDynamicConstraint(); + return (Qt::Orientation)q_cachedConstraintOrientation; +} + void QGridLayoutEngine::ensureGeometries(const QLayoutStyleInfo &styleInfo, const QSizeF &size) const { @@ -1544,10 +1709,74 @@ void QGridLayoutEngine::ensureGeometries(const QLayoutStyleInfo &styleInfo, q_widths.resize(columnCount()); q_heights.resize(rowCount()); q_descents.resize(rowCount()); - q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(), - 0, q_totalBoxes[Hor]); - q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(), - q_descents.data(), q_totalBoxes[Ver]); + + + Qt::Orientation orientation = Qt::Vertical; + if (hasDynamicConstraint()) + orientation = constraintOrientation(); + + /* + In order to do hfw we need to first distribute the columns, then the rows. + In order to do wfh we need to first distribute the rows, then the columns. + + If there is no constraint, the order of distributing the rows or columns first is irrelevant. + We choose horizontal just to keep the same behaviour as before (however, there shouldn't + be any behaviour difference). + */ + + QGridLayoutRowData *colData; + QGridLayoutRowData rowData; + qreal *widths; + qreal *heights; + qreal *xx; + qreal *yy; + qreal *xdescents = 0; + qreal *ydescents = 0; + qreal cCount; + qreal rCount; + QSizeF oSize = size; + if (orientation == Qt::Vertical) { + // height for width + colData = &q_columnData; + rowData = q_rowData; + widths = q_widths.data(); + heights = q_heights.data(); + xx = q_xx.data(); + yy = q_yy.data(); + cCount = columnCount(); + rCount = rowCount(); + ydescents = q_descents.data(); + } else { + // width for height + colData = &q_rowData; + rowData = q_columnData; + widths = q_heights.data(); + heights = q_widths.data(); + xx = q_yy.data(); + yy = q_xx.data(); + cCount = rowCount(); + rCount = columnCount(); + xdescents = q_descents.data(); + oSize.transpose(); + } + + colData->calculateGeometries(0, cCount, oSize.width(), xx, widths, + xdescents, q_totalBoxes[orientation == Qt::Horizontal]); + for (int i = q_items.count() - 1; i >= 0; --i) { + QGridLayoutItem *item = q_items.at(i); + const int col = item->firstColumn(orientation); + const int row = item->firstRow(orientation); + if (item->hasDynamicConstraint()) { + const qreal sz = widths[col]; + QGridLayoutBox box = item->box(orientation, sz); + rowData.boxes[row].combine(box); + } + } + + QGridLayoutBox &totalBox = q_totalBoxes[orientation == Qt::Vertical]; + totalBox = rowData.totalBox(0, rCount); + rowData.calculateGeometries(0, rCount, oSize.height(), yy, heights, + ydescents, totalBox); q_cachedSize = size; } diff --git a/src/gui/graphicsview/qgridlayoutengine_p.h b/src/gui/graphicsview/qgridlayoutengine_p.h index 9ac9a8e..580af7e 100644 --- a/src/gui/graphicsview/qgridlayoutengine_p.h +++ b/src/gui/graphicsview/qgridlayoutengine_p.h @@ -91,6 +91,14 @@ enum LayoutSide { Bottom }; +enum { + NoConstraint, + HorizontalConstraint, + VerticalConstraint, + UnknownConstraint, // need to update cache + UnfeasibleConstraint // not feasible, it be has some items with Vertical and others with Horizontal constraints +}; + template class QLayoutParameter { @@ -270,6 +278,10 @@ public: inline void setAlignment(Qt::Alignment alignment) { q_alignment = alignment; } QSizePolicy::Policy sizePolicy(Qt::Orientation orientation) const; + + bool hasDynamicConstraint() const; + Qt::Orientation dynamicConstraintOrientation() const; + QSizePolicy::ControlTypes controlTypes(LayoutSide side) const; QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; QGridLayoutBox box(Qt::Orientation orientation, qreal constraint = -1.0) const; @@ -280,7 +292,7 @@ public: void setGeometry(const QRectF &rect); void transpose(); void insertOrRemoveRows(int row, int delta, Qt::Orientation orientation = Qt::Vertical); - QSizeF effectiveMaxSize() const; + QSizeF effectiveMaxSize(const QSizeF &constraint) const; #ifdef QT_DEBUG void dump(int indent = 0) const; @@ -372,6 +384,14 @@ public: int column, int rowSpan, int columnSpan) const; QSizeF sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHint which, const QSizeF &constraint) const; + + // heightForWidth / widthForHeight support + QSizeF dynamicallyConstrainedSizeHint(Qt::SizeHint which, const QSizeF &constraint) const; + bool ensureDynamicConstraint() const; + bool hasDynamicConstraint() const; + Qt::Orientation constraintOrientation() const; + + QSizePolicy::ControlTypes controlTypes(LayoutSide side) const; void transpose(); void setVisualDirection(Qt::LayoutDirection direction); @@ -405,6 +425,7 @@ private: // Lazily computed from the above user input mutable int q_cachedEffectiveFirstRows[NOrientations]; mutable int q_cachedEffectiveLastRows[NOrientations]; + mutable quint8 q_cachedConstraintOrientation : 2; // Layout item input mutable QLayoutStyleInfo q_cachedDataForStyleInfo; diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp index 5b03767..03c1d5b 100644 --- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp +++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp @@ -107,12 +107,13 @@ private slots: void avoidRecursionInInsertItem(); void styleInfoLeak(); void task236367_maxSizeHint(); + void heightForWidth(); }; class RectWidget : public QGraphicsWidget { public: - RectWidget(QGraphicsItem *parent = 0) : QGraphicsWidget(parent){} + RectWidget(QGraphicsItem *parent = 0) : QGraphicsWidget(parent), m_fnConstraint(0) {} void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { @@ -125,9 +126,12 @@ public: QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const { - if (m_sizeHints[which].isValid()) { + if (constraint.width() < 0 && constraint.height() < 0 && m_sizeHints[which].isValid()) { return m_sizeHints[which]; } + if (m_fnConstraint) { + return m_fnConstraint(which, constraint); + } return QGraphicsWidget::sizeHint(which, constraint); } @@ -136,7 +140,13 @@ public: updateGeometry(); } + void setConstraintFunction(QSizeF (*fnConstraint)(Qt::SizeHint, const QSizeF &)) { + m_fnConstraint = fnConstraint; + } + QSizeF m_sizeHints[Qt::NSizeHints]; + QSizeF (*m_fnConstraint)(Qt::SizeHint, const QSizeF &); + }; struct ItemDesc @@ -146,7 +156,8 @@ struct ItemDesc m_rowSpan(1), m_colSpan(1), m_sizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred)), - m_align(0) + m_align(0), + m_fnConstraint(0) { } @@ -213,8 +224,20 @@ struct ItemDesc return (*this); } + ItemDesc &heightForWidth(QSizeF (*fnConstraint)(Qt::SizeHint, const QSizeF &)) { + m_fnConstraint = fnConstraint; + m_constraintOrientation = Qt::Vertical; + return (*this); + } + void apply(QGraphicsGridLayout *layout, QGraphicsWidget *item) { - item->setSizePolicy(m_sizePolicy); + QSizePolicy sp = m_sizePolicy; + if (m_fnConstraint) { + sp.setHeightForWidth(m_constraintOrientation == Qt::Vertical); + //sp.setWidthForHeight(m_constraintOrientation == Qt::Horizontal); + } + + item->setSizePolicy(sp); for (int i = 0; i < Qt::NSizeHints; ++i) { if (!m_sizes[i].isValid()) continue; @@ -233,6 +256,7 @@ struct ItemDesc break; } } + layout->addItem(item, m_pos.first, m_pos.second, m_rowSpan, m_colSpan); layout->setAlignment(item, m_align); } @@ -240,6 +264,7 @@ struct ItemDesc void apply(QGraphicsGridLayout *layout, RectWidget *item) { for (int i = 0; i < Qt::NSizeHints; ++i) item->setSizeHint((Qt::SizeHint)i, m_sizeHints[i]); + item->setConstraintFunction(m_fnConstraint); apply(layout, static_cast(item)); } @@ -251,6 +276,9 @@ struct ItemDesc QSizeF m_sizeHints[Qt::NSizeHints]; QSizeF m_sizes[Qt::NSizeHints]; Qt::Alignment m_align; + + Qt::Orientation m_constraintOrientation; + QSizeF (*m_fnConstraint)(Qt::SizeHint, const QSizeF &); }; typedef QList ItemList; @@ -2116,6 +2144,17 @@ void tst_QGraphicsGridLayout::alignment2() delete widget; } +static QSizeF hfw1(Qt::SizeHint, const QSizeF &constraint) +{ + QSizeF result(constraint); + if (constraint.width() < 0 && constraint.height() < 0) { + return QSizeF(50, 400); + } else if (constraint.width() >= 0) { + result.setHeight(20000./constraint.width()); + } + return result; +} + void tst_QGraphicsGridLayout::geometries_data() { @@ -2145,6 +2184,186 @@ void tst_QGraphicsGridLayout::geometries_data() << QRectF(0, 0, 60,10) << QRectF(0, 10, 60,10) ); + // change layout height and verify + QTest::newRow("hfw-h401") << (ItemList() + << ItemDesc(0,0) + .minSize(QSizeF(1,1)) + .preferredSize(QSizeF(50,10)) + .maxSize(QSizeF(100, 100)) + << ItemDesc(0,1) + .minSize(QSizeF(1,1)) + .preferredSize(QSizeF(50,10)) + .maxSize(QSizeF(100, 100)) + << ItemDesc(1,0) + .minSize(QSizeF(1,1)) + .preferredSize(QSizeF(50,10)) + .maxSize(QSizeF(100, 100)) + << ItemDesc(1,1) + .minSize(QSizeF(40,40)) + .preferredSize(QSizeF(50,400)) + .maxSize(QSizeF(500, 500)) + .heightForWidth(hfw1) + ) + << QSizeF(100, 401) + << (RectList() + << QRectF(0, 0, 50, 1) << QRectF(50, 0, 50, 1) + << QRectF(0, 1, 50,100) << QRectF(50, 1, 50,400) + ); + + + QTest::newRow("hfw-h408") << (ItemList() + << ItemDesc(0,0) + .minSize(QSizeF(1,1)) + .preferredSize(QSizeF(50,10)) + .maxSize(QSizeF(100, 100)) + << ItemDesc(0,1) + .minSize(QSizeF(1,1)) + .preferredSize(QSizeF(50,10)) + .maxSize(QSizeF(100, 100)) + << ItemDesc(1,0) + .minSize(QSizeF(1,1)) + .preferredSize(QSizeF(50,10)) + .maxSize(QSizeF(100, 100)) + << ItemDesc(1,1) + .minSize(QSizeF(40,40)) + .preferredSize(QSizeF(50,400)) + .maxSize(QSizeF(500, 500)) + .heightForWidth(hfw1) + ) + << QSizeF(100, 408) + << (RectList() + << QRectF(0, 0, 50, 8) << QRectF(50, 0, 50, 8) + << QRectF(0, 8, 50,100) << QRectF(50, 8, 50,400) + ); + + QTest::newRow("hfw-h410") << (ItemList() + << ItemDesc(0,0) + .minSize(QSizeF(1,1)) + .preferredSize(QSizeF(50,10)) + .maxSize(QSizeF(100, 100)) + << ItemDesc(0,1) + .minSize(QSizeF(1,1)) + .preferredSize(QSizeF(50,10)) + .maxSize(QSizeF(100, 100)) + << ItemDesc(1,0) + .minSize(QSizeF(1,1)) + .preferredSize(QSizeF(50,10)) + .maxSize(QSizeF(100, 100)) + << ItemDesc(1,1) + .minSize(QSizeF(40,40)) + .preferredSize(QSizeF(50,400)) + .maxSize(QSizeF(500, 500)) + .heightForWidth(hfw1) + ) + << QSizeF(100, 410) + << (RectList() + << QRectF(0, 0, 50,10) << QRectF(50, 0, 50,10) + << QRectF(0, 10, 50,100) << QRectF(50, 10, 50,400) + ); + + QTest::newRow("hfw-h470") << (ItemList() + << ItemDesc(0,0) + .minSize(QSizeF(1,1)) + .preferredSize(QSizeF(50,10)) + .maxSize(QSizeF(100, 100)) + << ItemDesc(0,1) + .minSize(QSizeF(1,1)) + .preferredSize(QSizeF(50,10)) + .maxSize(QSizeF(100, 100)) + << ItemDesc(1,0) + .minSize(QSizeF(1,1)) + .preferredSize(QSizeF(50,10)) + .maxSize(QSizeF(100, 100)) + << ItemDesc(1,1) + .minSize(QSizeF(40,40)) + .preferredSize(QSizeF(50,400)) + .maxSize(QSizeF(500, 500)) + .heightForWidth(hfw1) + ) + << QSizeF(100, 470) + << (RectList() + << QRectF(0, 0, 50,70) << QRectF(50, 0, 50,70) + << QRectF(0, 70, 50,100) << QRectF(50, 70, 50,400) + ); + + + // change layout width and verify + QTest::newRow("hfw-w100") << (ItemList() + << ItemDesc(0,0) + .minSize(QSizeF(1,1)) + .preferredSize(QSizeF(50,10)) + .maxSize(QSizeF(100, 100)) + << ItemDesc(0,1) + .minSize(QSizeF(1,1)) + .preferredSize(QSizeF(50,10)) + .maxSize(QSizeF(100, 100)) + << ItemDesc(1,0) + .minSize(QSizeF(1,1)) + .preferredSize(QSizeF(50,10)) + .maxSize(QSizeF(100, 100)) + << ItemDesc(1,1) + .minSize(QSizeF(40,40)) + .preferredSize(QSizeF(50,400)) + .maxSize(QSizeF(5000, 5000)) + .heightForWidth(hfw1) + ) + << QSizeF(100, 401) + << (RectList() + << QRectF( 0, 0, 50, 1) << QRectF( 50, 0, 50, 1) + << QRectF( 0, 1, 50, 100) << QRectF( 50, 1, 50, 400) + ); + + QTest::newRow("hfw-w160") << (ItemList() + << ItemDesc(0,0) + .minSize(QSizeF(1,1)) + .preferredSize(QSizeF(50,10)) + .maxSize(QSizeF(100, 100)) + << ItemDesc(0,1) + .minSize(QSizeF(1,1)) + .preferredSize(QSizeF(50,10)) + .maxSize(QSizeF(100, 100)) + << ItemDesc(1,0) + .minSize(QSizeF(1,1)) + .preferredSize(QSizeF(50,10)) + .maxSize(QSizeF(100, 100)) + << ItemDesc(1,1) + .minSize(QSizeF(40,40)) + .preferredSize(QSizeF(50,400)) + .maxSize(QSizeF(5000, 5000)) + .heightForWidth(hfw1) + ) + << QSizeF(160, 401) + << (RectList() + << QRectF( 0, 0, 80, 100) << QRectF( 80, 0, 80, 100) + << QRectF( 0, 100, 80, 100) << QRectF( 80, 100, 80, 250) + ); + + + QTest::newRow("hfw-w500") << (ItemList() + << ItemDesc(0,0) + .minSize(QSizeF(1,1)) + .preferredSize(QSizeF(50,10)) + .maxSize(QSizeF(100, 100)) + << ItemDesc(0,1) + .minSize(QSizeF(1,1)) + .preferredSize(QSizeF(50,10)) + .maxSize(QSizeF(100, 100)) + << ItemDesc(1,0) + .minSize(QSizeF(1,1)) + .preferredSize(QSizeF(50,10)) + .maxSize(QSizeF(100, 100)) + << ItemDesc(1,1) + .minSize(QSizeF(40,40)) + .preferredSize(QSizeF(50,400)) + .maxSize(QSizeF(5000, 5000)) + .heightForWidth(hfw1) + ) + << QSizeF(500, 401) + << (RectList() + << QRectF( 0, 0, 100, 100) << QRectF(100, 0, 100, 100) + << QRectF( 0, 100, 100, 100) << QRectF(100, 100, 400, 50) + ); + } void tst_QGraphicsGridLayout::geometries() @@ -2215,6 +2434,143 @@ void tst_QGraphicsGridLayout::task236367_maxSizeHint() QCOMPARE(widget->size(), QSizeF(w, h)); } +/* +static qreal hfw(qreal w) +{ + if (w == 0) + return 20000; + return 20000/w; +} +*/ +static QSizeF hfw(Qt::SizeHint /*which*/, const QSizeF &constraint) +{ + QSizeF result(constraint); + const qreal cw = constraint.width(); + const qreal ch = constraint.height(); + if (cw < 0 && ch < 0) { + return QSizeF(200, 100); + } else if (cw >= 0) { + result.setHeight(20000./cw); + } else if (cw == 0) { + result.setHeight(20000); + } else if (ch >= 0) { + result.setWidth(20000./ch); + } else if (ch == 0) { + result.setWidth(20000); + } + + return result; +} + +static qreal growthFactorBelowPreferredSize(qreal desired, qreal sumAvailable, qreal sumDesired) +{ + Q_ASSERT(sumDesired != 0.0); + return desired * qPow(sumAvailable / sumDesired, desired / sumDesired); +} + +static void expectedWidth(qreal minSize1, qreal prefSize1, + qreal minSize2, qreal prefSize2, + qreal targetSize, qreal *width1, qreal *width2) +{ + qreal sumAvail,factor1,factor2; + // stretch behaviour is different below and above preferred size... + if (targetSize < prefSize1 + prefSize2) { + sumAvail = targetSize - minSize1 - minSize2; + const qreal desired1 = prefSize1 - minSize1; + const qreal desired2 = prefSize2 - minSize2; + const qreal sumDesired = desired1 + desired2; + factor1 = growthFactorBelowPreferredSize(desired1, sumAvail, sumDesired); + factor2 = growthFactorBelowPreferredSize(desired2, sumAvail, sumDesired); + const qreal sumFactors = factor1 + factor2; + *width1 = sumAvail*factor1/sumFactors + minSize1; + *width2 = sumAvail*factor2/sumFactors + minSize2; + } else { + sumAvail = targetSize - prefSize1 - prefSize2; + factor1 = prefSize1; + factor2 = prefSize2; + const qreal sumFactors = factor1 + factor2; + *width1 = sumAvail*factor1/sumFactors + prefSize1; + *width2 = sumAvail*factor2/sumFactors + prefSize2; + } +} + + +bool qFuzzyCompare(const QSizeF &a, const QSizeF &b) +{ + return qFuzzyCompare(a.width(), b.width()) && qFuzzyCompare(a.height(), b.height()); +} + +void tst_QGraphicsGridLayout::heightForWidth() +{ + QGraphicsWidget *widget = new QGraphicsWidget; + QGraphicsGridLayout *layout = new QGraphicsGridLayout; + widget->setLayout(layout); + layout->setContentsMargins(0, 0, 0, 0); + layout->setSpacing(0); + RectWidget *w00 = new RectWidget; + w00->setSizeHint(Qt::MinimumSize, QSizeF(1,1)); + w00->setSizeHint(Qt::PreferredSize, QSizeF(10,10)); + w00->setSizeHint(Qt::MaximumSize, QSizeF(100,100)); + layout->addItem(w00, 0, 0); + + RectWidget *w01 = new RectWidget; + w01->setSizeHint(Qt::MinimumSize, QSizeF(1,1)); + w01->setSizeHint(Qt::PreferredSize, QSizeF(10,10)); + w01->setSizeHint(Qt::MaximumSize, QSizeF(100,100)); + layout->addItem(w01, 0, 1); + + RectWidget *w10 = new RectWidget; + w10->setSizeHint(Qt::MinimumSize, QSizeF(1,1)); + w10->setSizeHint(Qt::PreferredSize, QSizeF(10,10)); + w10->setSizeHint(Qt::MaximumSize, QSizeF(100,100)); + layout->addItem(w10, 1, 0); + + RectWidget *w11 = new RectWidget; + w11->setSizeHint(Qt::MinimumSize, QSizeF(1,1)); + w11->setSizeHint(Qt::MaximumSize, QSizeF(30000,30000)); + w11->setConstraintFunction(hfw); + QSizePolicy sp(QSizePolicy::Preferred, QSizePolicy::Preferred); + sp.setHeightForWidth(true); + w11->setSizePolicy(sp); + layout->addItem(w11, 1, 1); + + QSizeF prefSize = layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(-1, -1)); + QCOMPARE(prefSize, QSizeF(10+200, 10+100)); + + QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(2, -1)), QSizeF(2, 20001)); + QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(2, -1)), QSizeF(2, 20010)); + QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(2, -1)), QSizeF(2, 20100)); + qreal width1; + qreal width2; + expectedWidth(1, 10, 1, 200, 20, &width1, &width2); + QSizeF expectedSize = hfw(Qt::MinimumSize, QSizeF(width2, -1)) + QSizeF(width1, 1); + QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(20, -1)), expectedSize); + expectedSize.rheight()+=9; + QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(20, -1)), expectedSize); + expectedSize.rheight()+=90; + QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(20, -1)), expectedSize); + + expectedWidth(1, 10, 1, 200, 300, &width1, &width2); + expectedSize = hfw(Qt::MinimumSize, QSizeF(width2, -1)) + QSizeF(width1, 1); + QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(300, -1)), expectedSize); + expectedSize.rheight()+=9; + QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(300, -1)), expectedSize); + // the height of the hfw widget is shorter than the one to the left, which is 100, so + // the total height of the last row is 100 (which leaves the layout height to be 200) + QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(300, -1)), QSizeF(300, 200)); + + // the hfw item is shorter than the item to the left + expectedWidth(1, 10, 1, 200, 500, &width1, &width2); + expectedSize = hfw(Qt::MinimumSize, QSizeF(width2, -1)) + QSizeF(width1, 1); + QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(500, -1)), expectedSize); + expectedSize.rheight()+=9; + QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(500, -1)), expectedSize); + // the height of the hfw widget is shorter than the one to the left, which is 100, so + // the total height of the last row is 100 (which leaves the layout height to be 200) + QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(500, -1)), QSizeF(500, 200)); + +} + QTEST_MAIN(tst_QGraphicsGridLayout) #include "tst_qgraphicsgridlayout.moc" -- cgit v0.12 From 6d4d265e7e67dde58e45d7d89f4974d0bd8b70e4 Mon Sep 17 00:00:00 2001 From: John Tapsell Date: Mon, 4 Oct 2010 01:03:41 +0100 Subject: QGridLayoutEngine - Rework height-for-width support so that row/col spanning works Task-number: QTBUG-13547 Reviewed-by: Olivier Goffart Merge-request: 847 --- src/gui/graphicsview/qgridlayoutengine.cpp | 300 ++++++++------------- src/gui/graphicsview/qgridlayoutengine_p.h | 13 +- .../tst_qgraphicsgridlayout.cpp | 35 +++ 3 files changed, 157 insertions(+), 191 deletions(-) diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp index 1e3addc..acac46f 100644 --- a/src/gui/graphicsview/qgridlayoutengine.cpp +++ b/src/gui/graphicsview/qgridlayoutengine.cpp @@ -1102,20 +1102,76 @@ QRectF QGridLayoutEngine::cellRect(const QLayoutStyleInfo &styleInfo, QSizeF QGridLayoutEngine::sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHint which, const QSizeF &constraint) const { - ensureColumnAndRowData(styleInfo); + QGridLayoutBox sizehint_totalBoxes[NOrientations]; - if (hasDynamicConstraint()) - return dynamicallyConstrainedSizeHint(which, constraint); + if(rowCount() < 1 || columnCount() < 1 || !hasDynamicConstraint()) { + //No items with height for width, so it doesn't matter which order we do these in + if(q_cachedDataForStyleInfo != styleInfo) { + ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, NULL, NULL, Qt::Horizontal); + ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, NULL, NULL, Qt::Vertical); + } else { + sizehint_totalBoxes[Hor] = q_totalBoxes[Hor]; + sizehint_totalBoxes[Ver] = q_totalBoxes[Ver]; + } + } else if(constraintOrientation() == Qt::Vertical) { + //We have items whose width depends on their height + if(q_cachedDataForStyleInfo != styleInfo) + ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, NULL, NULL, Qt::Horizontal); + else + sizehint_totalBoxes[Hor] = q_totalBoxes[Hor]; + QVector sizehint_xx; + QVector sizehint_widths; + + sizehint_xx.resize(columnCount()); + sizehint_widths.resize(columnCount()); + qreal width = constraint.width(); + if(width < 0) { + /* It's not obvious what the behaviour should be. */ +/* if(which == Qt::MaximumSize) + width = sizehint_totalBoxes[Hor].q_maximumSize; + else if(which == Qt::MinimumSize) + width = sizehint_totalBoxes[Hor].q_minimumSize; + else*/ + width = sizehint_totalBoxes[Hor].q_preferredSize; + } + //Calculate column widths and positions, and put results in q_xx.data() and q_widths.data() so that we can use this information as + //constraints to find the row heights + q_columnData.calculateGeometries(0, columnCount(), width, sizehint_xx.data(), sizehint_widths.data(), + 0, sizehint_totalBoxes[Hor]); + ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, sizehint_xx.data(), sizehint_widths.data(), Qt::Vertical); + } else { + //We have items whose height depends on their width + ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, NULL, NULL, Qt::Vertical); + QVector sizehint_yy; + QVector sizehint_heights; + + sizehint_yy.resize(rowCount()); + sizehint_heights.resize(rowCount()); + qreal height = constraint.height(); + if(height < 0) { +/* if(which == Qt::MaximumSize) + height = sizehint_totalBoxes[Ver].q_maximumSize; + else if(which == Qt::MinimumSize) + height = sizehint_totalBoxes[Ver].q_minimumSize; + else*/ + height = sizehint_totalBoxes[Ver].q_preferredSize; + } + //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() so that we can use this information as + //constraints to find the column widths + q_rowData.calculateGeometries(0, rowCount(), height, sizehint_yy.data(), sizehint_heights.data(), + 0, sizehint_totalBoxes[Ver]); + ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, sizehint_yy.data(), sizehint_heights.data(), Qt::Vertical); + } switch (which) { case Qt::MinimumSize: - return QSizeF(q_totalBoxes[Hor].q_minimumSize, q_totalBoxes[Ver].q_minimumSize); + return QSizeF(sizehint_totalBoxes[Hor].q_minimumSize, sizehint_totalBoxes[Ver].q_minimumSize); case Qt::PreferredSize: - return QSizeF(q_totalBoxes[Hor].q_preferredSize, q_totalBoxes[Ver].q_preferredSize); + return QSizeF(sizehint_totalBoxes[Hor].q_preferredSize, sizehint_totalBoxes[Ver].q_preferredSize); case Qt::MaximumSize: - return QSizeF(q_totalBoxes[Hor].q_maximumSize, q_totalBoxes[Ver].q_maximumSize); + return QSizeF(sizehint_totalBoxes[Hor].q_maximumSize, sizehint_totalBoxes[Ver].q_maximumSize); case Qt::MinimumDescent: - return QSizeF(-1.0, q_totalBoxes[Hor].q_minimumDescent); // ### doesn't work + return QSizeF(-1.0, sizehint_totalBoxes[Hor].q_minimumDescent); // ### doesn't work default: break; } @@ -1291,6 +1347,7 @@ void QGridLayoutEngine::insertOrRemoveRows(int row, int delta, Qt::Orientation o } void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData, const QLayoutStyleInfo &styleInfo, + qreal *colPositions, qreal *colSizes, Qt::Orientation orientation) const { const int ButtonMask = QSizePolicy::ButtonBox | QSizePolicy::PushButton; @@ -1404,11 +1461,21 @@ void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData, const QLayoutSt box = &multiCell.q_box; multiCell.q_stretch = itemStretch; } - // Items with constraints are not included in the orientation that - // they are constrained (since it depends on the hfw/constraint function). - // They must be combined at a later stage. - if (!item->hasDynamicConstraint() || orientation != item->dynamicConstraintOrientation()) + // Items with constraints need to be passed the constraint + if (colSizes && colPositions && item->hasDynamicConstraint() && orientation == item->dynamicConstraintOrientation()) { + /* Get the width of the item by summing up the widths of the columns that it spans. + * We need to have already calculated the widths of the columns by calling + * q_columns->calculateGeometries() before hand and passing the value in the colSizes + * and colPositions parameters. + * The variable name is still colSizes even when it actually has the row sizes + */ + qreal length = colSizes[item->lastColumn(orientation)]; + if (item->columnSpan(orientation) != 1) + length += colPositions[item->lastColumn(orientation)] - colPositions[item->firstColumn(orientation)]; + box->combine(item->box(orientation, length)); + } else { box->combine(item->box(orientation)); + } if (effectiveRowSpan == 1) { QSizePolicy::ControlTypes controls = item->controlTypes(top); @@ -1545,115 +1612,18 @@ void QGridLayoutEngine::ensureEffectiveFirstAndLastRows() const } } -void QGridLayoutEngine::ensureColumnAndRowData(const QLayoutStyleInfo &styleInfo) const +void QGridLayoutEngine::ensureColumnAndRowData(QGridLayoutRowData *rowData, QGridLayoutBox *totalBox, + const QLayoutStyleInfo &styleInfo, + qreal *colPositions, qreal *colSizes, + Qt::Orientation orientation) const { - if (q_cachedDataForStyleInfo == styleInfo) - return; - - q_columnData.reset(columnCount()); - q_rowData.reset(rowCount()); - - fillRowData(&q_columnData, styleInfo, Qt::Horizontal); - fillRowData(&q_rowData, styleInfo, Qt::Vertical); - - q_columnData.distributeMultiCells(); - q_rowData.distributeMultiCells(); - - q_totalBoxes[Hor] = q_columnData.totalBox(0, columnCount()); - q_totalBoxes[Ver] = q_rowData.totalBox(0, rowCount()); - - q_cachedDataForStyleInfo = styleInfo; + rowData->reset(rowCount(orientation)); + fillRowData(rowData, styleInfo, colPositions, colSizes, orientation); + rowData->distributeMultiCells(); + *totalBox = rowData->totalBox(0, rowCount(orientation)); + //We have items whose width depends on their height } -QSizeF QGridLayoutEngine::dynamicallyConstrainedSizeHint(Qt::SizeHint which, - const QSizeF &constraint) const -{ - Q_ASSERT(hasDynamicConstraint()); - if (constraint.width() < 0 && constraint.height() < 0) { - // Process the hfw / wfh items that we did not process in fillRowData() - const Qt::Orientation constraintOrient = constraintOrientation(); - - QGridLayoutRowData rowData = constraintOrient == Qt::Vertical ? q_rowData : q_columnData; - for (int i = q_items.count() - 1; i >= 0; --i) { - QGridLayoutItem *item = q_items.at(i); - if (item->hasDynamicConstraint()) { - QGridLayoutBox box = item->box(constraintOrient); - QGridLayoutBox &rowBox = rowData.boxes[item->firstRow(constraintOrient)]; - rowBox.combine(box); - } - } - - QGridLayoutBox totalBoxes[2]; - if (constraintOrient == Qt::Vertical) { - totalBoxes[Hor] = q_columnData.totalBox(0, columnCount()); - totalBoxes[Ver] = rowData.totalBox(0, rowCount()); - } else { - totalBoxes[Hor] = rowData.totalBox(0, columnCount()); - totalBoxes[Ver] = q_rowData.totalBox(0, rowCount()); - } - return QSizeF(totalBoxes[Hor].q_sizes(which), totalBoxes[Ver].q_sizes(which)); - } - - - Q_ASSERT(constraint.width() >= 0 || constraint.height() >= 0); - q_xx.resize(columnCount()); - q_yy.resize(rowCount()); - q_widths.resize(columnCount()); - q_heights.resize(rowCount()); - q_descents.resize(rowCount()); - - - const Qt::Orientation orientation = constraintOrientation(); - QGridLayoutRowData *colData; - QGridLayoutRowData constrainedRowData; - QGridLayoutBox *totalBox; - qreal *sizes; - qreal *pos; - qreal *descents; - qreal targetSize; - qreal cCount; - qreal rCount; - - if (orientation == Qt::Vertical) { - // height for width - colData = &q_columnData; - totalBox = &q_totalBoxes[Hor]; - sizes = q_widths.data(); - pos = q_xx.data(); - descents = 0; - targetSize = constraint.width(); - cCount = columnCount(); - rCount = rowCount(); - constrainedRowData = q_rowData; - } else { - // width for height - colData = &q_rowData; - totalBox = &q_totalBoxes[Ver]; - sizes = q_heights.data(); - pos = q_yy.data(); - descents = q_descents.data(); - targetSize = constraint.height(); - cCount = rowCount(); - rCount = columnCount(); - constrainedRowData = q_columnData; - } - colData->calculateGeometries(0, cCount, targetSize, pos, sizes, descents, *totalBox); - for (int i = q_items.count() - 1; i >= 0; --i) { - QGridLayoutItem *item = q_items.at(i); - - if (item->hasDynamicConstraint()) { - const qreal size = sizes[item->firstColumn(orientation)]; - QGridLayoutBox box = item->box(orientation, size); - QGridLayoutBox &rowBox = constrainedRowData.boxes[item->firstRow(orientation)]; - rowBox.combine(box); - } - } - const qreal newSize = constrainedRowData.totalBox(0, rCount).q_sizes(which); - - return (orientation == Qt::Vertical) ? QSizeF(targetSize, newSize) : QSizeF(newSize, targetSize); -} - - /** returns false if the layout has contradicting constraints (i.e. some items with a horizontal constraint and other items with a vertical constraint) @@ -1700,85 +1670,41 @@ Qt::Orientation QGridLayoutEngine::constraintOrientation() const void QGridLayoutEngine::ensureGeometries(const QLayoutStyleInfo &styleInfo, const QSizeF &size) const { - ensureColumnAndRowData(styleInfo); - if (q_cachedSize == size) + if (q_cachedDataForStyleInfo == styleInfo && q_cachedSize == size) return; + q_cachedDataForStyleInfo = styleInfo; + q_cachedSize = size; + q_xx.resize(columnCount()); - q_yy.resize(rowCount()); q_widths.resize(columnCount()); + q_yy.resize(rowCount()); q_heights.resize(rowCount()); q_descents.resize(rowCount()); - - Qt::Orientation orientation = Qt::Vertical; - if (hasDynamicConstraint()) - orientation = constraintOrientation(); - - /* - In order to do hfw we need to first distribute the columns, then the rows. - In order to do wfh we need to first distribute the rows, then the columns. - - If there is no constraint, the order of distributing the rows or columns first is irrelevant. - We choose horizontal just to keep the same behaviour as before (however, there shouldn't - be any behaviour difference). - */ - - QGridLayoutRowData *colData; - QGridLayoutRowData rowData; - qreal *widths; - qreal *heights; - qreal *xx; - qreal *yy; - qreal *xdescents = 0; - qreal *ydescents = 0; - qreal cCount; - qreal rCount; - QSizeF oSize = size; - if (orientation == Qt::Vertical) { - // height for width - colData = &q_columnData; - rowData = q_rowData; - widths = q_widths.data(); - heights = q_heights.data(); - xx = q_xx.data(); - yy = q_yy.data(); - cCount = columnCount(); - rCount = rowCount(); - ydescents = q_descents.data(); + if(constraintOrientation() != Qt::Horizontal) { + //We might have items whose width depends on their height + ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], styleInfo, NULL, NULL, Qt::Horizontal); + //Calculate column widths and positions, and put results in q_xx.data() and q_widths.data() so that we can use this information as + //constraints to find the row heights + q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(), + 0, q_totalBoxes[Hor]); + ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], styleInfo, q_xx.data(), q_widths.data(), Qt::Vertical); + //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() + q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(), + q_descents.data(), q_totalBoxes[Ver]); } else { - // width for height - colData = &q_rowData; - rowData = q_columnData; - widths = q_heights.data(); - heights = q_widths.data(); - xx = q_yy.data(); - yy = q_xx.data(); - cCount = rowCount(); - rCount = columnCount(); - xdescents = q_descents.data(); - oSize.transpose(); + //We have items whose height depends on their width + ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], styleInfo, NULL, NULL, Qt::Vertical); + //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() so that we can use this information as + //constraints to find the column widths + q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(), + q_descents.data(), q_totalBoxes[Ver]); + ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], styleInfo, q_yy.data(), q_heights.data(), Qt::Horizontal); + //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() + q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(), + 0, q_totalBoxes[Hor]); } - - colData->calculateGeometries(0, cCount, oSize.width(), xx, widths, - xdescents, q_totalBoxes[orientation == Qt::Horizontal]); - for (int i = q_items.count() - 1; i >= 0; --i) { - QGridLayoutItem *item = q_items.at(i); - const int col = item->firstColumn(orientation); - const int row = item->firstRow(orientation); - if (item->hasDynamicConstraint()) { - const qreal sz = widths[col]; - QGridLayoutBox box = item->box(orientation, sz); - rowData.boxes[row].combine(box); - } - } - - QGridLayoutBox &totalBox = q_totalBoxes[orientation == Qt::Vertical]; - totalBox = rowData.totalBox(0, rCount); - rowData.calculateGeometries(0, rCount, oSize.height(), yy, heights, - ydescents, totalBox); - - q_cachedSize = size; } QT_END_NAMESPACE diff --git a/src/gui/graphicsview/qgridlayoutengine_p.h b/src/gui/graphicsview/qgridlayoutengine_p.h index 580af7e..02c74b0 100644 --- a/src/gui/graphicsview/qgridlayoutengine_p.h +++ b/src/gui/graphicsview/qgridlayoutengine_p.h @@ -93,8 +93,8 @@ enum LayoutSide { enum { NoConstraint, - HorizontalConstraint, - VerticalConstraint, + HorizontalConstraint, // Width depends on the height + VerticalConstraint, // Height depends on the width UnknownConstraint, // need to update cache UnfeasibleConstraint // not feasible, it be has some items with Vertical and others with Horizontal constraints }; @@ -410,9 +410,14 @@ private: void setItemAt(int row, int column, QGridLayoutItem *item); void insertOrRemoveRows(int row, int delta, Qt::Orientation orientation = Qt::Vertical); void fillRowData(QGridLayoutRowData *rowData, const QLayoutStyleInfo &styleInfo, - Qt::Orientation orientation = Qt::Vertical) const; + qreal *colPositions, qreal *colSizes, + Qt::Orientation orientation = Qt::Vertical) const; void ensureEffectiveFirstAndLastRows() const; - void ensureColumnAndRowData(const QLayoutStyleInfo &styleInfo) const; + void ensureColumnAndRowData(QGridLayoutRowData *rowData, QGridLayoutBox *totalBox, + const QLayoutStyleInfo &styleInfo, + qreal *colPositions, qreal *colSizes, + Qt::Orientation orientation) const; + void ensureGeometries(const QLayoutStyleInfo &styleInfo, const QSizeF &size) const; // User input diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp index 03c1d5b..3827018 100644 --- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp +++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp @@ -108,6 +108,7 @@ private slots: void styleInfoLeak(); void task236367_maxSizeHint(); void heightForWidth(); + void heightForWidthWithSpanning(); }; class RectWidget : public QGraphicsWidget @@ -2571,6 +2572,40 @@ void tst_QGraphicsGridLayout::heightForWidth() } +void tst_QGraphicsGridLayout::heightForWidthWithSpanning() +{ + QGraphicsWidget *widget = new QGraphicsWidget; + QGraphicsGridLayout *layout = new QGraphicsGridLayout; + widget->setLayout(layout); + layout->setContentsMargins(0, 0, 0, 0); + layout->setSpacing(0); + + RectWidget *w = new RectWidget; + w->setSizeHint(Qt::MinimumSize, QSizeF(1,1)); + w->setSizeHint(Qt::MaximumSize, QSizeF(30000,30000)); + w->setConstraintFunction(hfw); + QSizePolicy sp(QSizePolicy::Preferred, QSizePolicy::Preferred); + sp.setHeightForWidth(true); + w->setSizePolicy(sp); + layout->addItem(w, 0,0,2,2); + + QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(-1, -1)), QSizeF(1, 100)); + QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(-1, -1)), QSizeF(200, 100)); + QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(-1, -1)), QSizeF(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX)); + + QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(200, -1)), QSizeF(200, 100)); + QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(200, -1)), QSizeF(200, 100)); + QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(200, -1)), QSizeF(200, QWIDGETSIZE_MAX)); + + QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(2, -1)), QSizeF(2, 10000)); + QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(2, -1)), QSizeF(2, 10000)); + QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(2, -1)), QSizeF(2, QWIDGETSIZE_MAX)); + + QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(200, -1)), QSizeF(200, 100)); + QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(200, -1)), QSizeF(200, 100)); + QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(200, -1)), QSizeF(200, QWIDGETSIZE_MAX)); +} + QTEST_MAIN(tst_QGraphicsGridLayout) #include "tst_qgraphicsgridlayout.moc" -- cgit v0.12 From fcda1b785bd7d86011f49bfe96cb22b04202933f Mon Sep 17 00:00:00 2001 From: John Tapsell Date: Fri, 8 Oct 2010 15:10:20 +0100 Subject: QGraphicsLayoutItem - user set sizes should always override, even if there's a constraint Notes: * I have had to remove some of the old unit tests because the tested for strange behaviour. Now that height for width items behave more like normal items, it's no longer so easy to calculate what the geometries should be in strangely-sized layouts. * This also fixes alignment of height-for-width objects and adds a unit test for this. This couldn't be done in a seperate commit since the two fixes are related. Merge-request: 847 Reviewed-by: Olivier Goffart --- src/gui/graphicsview/qgraphicslayoutitem.cpp | 4 +- src/gui/graphicsview/qgridlayoutengine.cpp | 17 +- .../tst_qgraphicsgridlayout.cpp | 333 +++++++++++---------- 3 files changed, 188 insertions(+), 166 deletions(-) diff --git a/src/gui/graphicsview/qgraphicslayoutitem.cpp b/src/gui/graphicsview/qgraphicslayoutitem.cpp index 634f68c..e43f7fa 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem.cpp +++ b/src/gui/graphicsview/qgraphicslayoutitem.cpp @@ -140,11 +140,9 @@ QSizeF *QGraphicsLayoutItemPrivate::effectiveSizeHints(const QSizeF &constraint) if (!sizeHintCacheDirty && cachedConstraint == constraint) return cachedSizeHints; - const bool hasConstraint = constraint.width() >= 0 || constraint.height() >= 0; - for (int i = 0; i < Qt::NSizeHints; ++i) { cachedSizeHints[i] = constraint; - if (userSizeHints && !hasConstraint) + if (userSizeHints) combineSize(cachedSizeHints[i], userSizeHints[i]); } diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp index acac46f..e486b4d 100644 --- a/src/gui/graphicsview/qgridlayoutengine.cpp +++ b/src/gui/graphicsview/qgridlayoutengine.cpp @@ -631,14 +631,17 @@ QRectF QGridLayoutItem::geometryWithin(qreal x, qreal y, qreal width, qreal heig qreal cellWidth = width; qreal cellHeight = height; - QSize constraint; + + QSizeF size = effectiveMaxSize(QSizeF(-1,-1)); if (hasDynamicConstraint()) { - if (dynamicConstraintOrientation() == Qt::Vertical) - constraint.setWidth(cellWidth); - else - constraint.setHeight(cellHeight); + if (dynamicConstraintOrientation() == Qt::Vertical) { + if (size.width() > cellWidth) + size = effectiveMaxSize(QSizeF(cellWidth, -1)); + } else if(size.height() > cellHeight) { + size = effectiveMaxSize(QSizeF(-1, cellHeight)); + } } - QSizeF size = effectiveMaxSize(constraint).boundedTo(QSizeF(cellWidth, cellHeight)); + size = size.boundedTo(QSizeF(cellWidth, cellHeight)); width = size.width(); height = size.height(); @@ -714,7 +717,7 @@ QSizeF QGridLayoutItem::effectiveMaxSize(const QSizeF &constraint) const } if (!size.isValid()) { - QSizeF maxSize = layoutItem()->effectiveSizeHint(Qt::MaximumSize, constraint); + QSizeF maxSize = layoutItem()->effectiveSizeHint(Qt::MaximumSize, size); if (size.width() == -1) size.setWidth(maxSize.width()); if (size.height() == -1) diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp index 3827018..174e4aa 100644 --- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp +++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp @@ -61,13 +61,19 @@ private slots: void qgraphicsgridlayout(); void addItem_data(); void addItem(); + void alignment_data(); void alignment(); void alignment2(); void alignment2_data(); + void columnAlignment_data(); void columnAlignment(); + void columnCount_data(); void columnCount(); + void columnMaximumWidth_data(); void columnMaximumWidth(); + void columnMinimumWidth_data(); void columnMinimumWidth(); + void columnPreferredWidth_data(); void columnPreferredWidth(); void setColumnFixedWidth(); void columnSpacing(); @@ -78,12 +84,18 @@ private slots: void horizontalSpacing(); void itemAt(); void removeAt(); + void rowAlignment_data(); void rowAlignment(); + void rowCount_data(); void rowCount(); + void rowMaximumHeight_data(); void rowMaximumHeight(); + void rowMinimumHeight_data(); void rowMinimumHeight(); + void rowPreferredHeight_data(); void rowPreferredHeight(); void rowSpacing(); + void rowStretchFactor_data(); void rowStretchFactor(); void setColumnSpacing_data(); void setColumnSpacing(); @@ -98,6 +110,7 @@ private slots: void sizeHint(); void verticalSpacing_data(); void verticalSpacing(); + void layoutDirection_data(); void layoutDirection(); void removeLayout(); void defaultStretchFactors_data(); @@ -371,7 +384,7 @@ void tst_QGraphicsGridLayout::qgraphicsgridlayout() layout.verticalSpacing(); } -static void populateLayout(QGraphicsGridLayout *gridLayout, int width, int height) +static void populateLayout(QGraphicsGridLayout *gridLayout, int width, int height, bool hasHeightForWidth = false) { for (int y = 0; y < height; ++y) { for (int x = 0; x < width; ++x) { @@ -380,6 +393,9 @@ static void populateLayout(QGraphicsGridLayout *gridLayout, int width, int heigh item->setPreferredSize(25, 25); item->setMaximumSize(50, 50); gridLayout->addItem(item, y, x); + QSizePolicy policy = item->sizePolicy(); + policy.setHeightForWidth(hasHeightForWidth); + item->setSizePolicy(policy); } } } @@ -396,18 +412,22 @@ static void populateLayout(QGraphicsGridLayout *gridLayout, int width, int heigh * |xxxx|+---|---+| * +----+----+----+ */ -static void populateLayoutWithSpansAndHoles(QGraphicsGridLayout *gridLayout) +static void populateLayoutWithSpansAndHoles(QGraphicsGridLayout *gridLayout, bool hasHeightForWidth = false) { QGraphicsWidget *item = new RectWidget(); item->setMinimumSize(10, 10); item->setPreferredSize(25, 25); item->setMaximumSize(50, 50); + QSizePolicy sizepolicy = item->sizePolicy(); + sizepolicy.setHeightForWidth(hasHeightForWidth); + item->setSizePolicy(sizepolicy); gridLayout->addItem(item, 0, 0, 1, 2); item = new RectWidget(); item->setMinimumSize(10, 10); item->setPreferredSize(25, 25); item->setMaximumSize(50, 50); + item->setSizePolicy(sizepolicy); gridLayout->addItem(item, 1, 1, 1, 2); } @@ -460,19 +480,28 @@ void tst_QGraphicsGridLayout::addItem() delete layout; } +void tst_QGraphicsGridLayout::alignment_data() +{ + QTest::addColumn("hasHeightForWidth"); + + QTest::newRow("") << false; + QTest::newRow("hasHeightForWidth") << true; +} + // public Qt::Alignment alignment(QGraphicsLayoutItem* item) const void tst_QGraphicsGridLayout::alignment() { #ifdef Q_WS_MAC QSKIP("Resizing a QGraphicsWidget to effectiveSizeHint(Qt::MaximumSize) is currently not supported on mac", SkipAll); #endif + QFETCH(bool, hasHeightForWidth); QGraphicsScene scene; QGraphicsView view(&scene); QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window); QGraphicsGridLayout *layout = new QGraphicsGridLayout(); scene.addItem(widget); widget->setLayout(layout); - populateLayout(layout, 3, 2); + populateLayout(layout, 3, 2, hasHeightForWidth); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); @@ -524,6 +553,14 @@ void tst_QGraphicsGridLayout::alignment() delete widget; } +void tst_QGraphicsGridLayout::columnAlignment_data() +{ + QTest::addColumn("hasHeightForWidth"); + + QTest::newRow("") << false; + QTest::newRow("hasHeightForWidth") << true; +} + // public void setColumnAlignment(int column, Qt::Alignment alignment) // public Qt::Alignment columnAlignment(int column) const void tst_QGraphicsGridLayout::columnAlignment() @@ -531,13 +568,14 @@ void tst_QGraphicsGridLayout::columnAlignment() #ifdef Q_WS_MAC QSKIP("Resizing a QGraphicsWidget to effectiveSizeHint(Qt::MaximumSize) is currently not supported on mac", SkipAll); #endif + QFETCH(bool, hasHeightForWidth); QGraphicsScene scene; QGraphicsView view(&scene); QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window); QGraphicsGridLayout *layout = new QGraphicsGridLayout(); scene.addItem(widget); widget->setLayout(layout); - populateLayout(layout, 3, 2); + populateLayout(layout, 3, 2, hasHeightForWidth); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(1); widget->setContentsMargins(0, 0, 0, 0); @@ -583,9 +621,17 @@ void tst_QGraphicsGridLayout::columnAlignment() delete widget; } +void tst_QGraphicsGridLayout::columnCount_data() +{ + QTest::addColumn("hasHeightForWidth"); + + QTest::newRow("") << false; + QTest::newRow("hasHeightForWidth") << true; +} // public int columnCount() const void tst_QGraphicsGridLayout::columnCount() { + QFETCH(bool, hasHeightForWidth); QGraphicsScene scene; QGraphicsView view(&scene); QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window); @@ -617,7 +663,7 @@ void tst_QGraphicsGridLayout::columnCount() // ### Talk with Jasmin. Not sure if removeAt() should adjust columnCount(). widget->setLayout(0); layout = new QGraphicsGridLayout(); - populateLayout(layout, 3, 2); + populateLayout(layout, 3, 2, hasHeightForWidth); QCOMPARE(layout->columnCount(), 3); layout->removeAt(5); layout->removeAt(3); @@ -632,16 +678,24 @@ void tst_QGraphicsGridLayout::columnCount() delete widget; } +void tst_QGraphicsGridLayout::columnMaximumWidth_data() +{ + QTest::addColumn("hasHeightForWidth"); + + QTest::newRow("") << false; + QTest::newRow("hasHeightForWidth") << true; +} // public qreal columnMaximumWidth(int column) const void tst_QGraphicsGridLayout::columnMaximumWidth() { + QFETCH(bool, hasHeightForWidth); QGraphicsScene scene; QGraphicsView view(&scene); QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window); QGraphicsGridLayout *layout = new QGraphicsGridLayout(); scene.addItem(widget); widget->setLayout(layout); - populateLayout(layout, 3, 2); + populateLayout(layout, 3, 2, hasHeightForWidth); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); @@ -667,16 +721,24 @@ void tst_QGraphicsGridLayout::columnMaximumWidth() delete widget; } +void tst_QGraphicsGridLayout::columnMinimumWidth_data() +{ + QTest::addColumn("hasHeightForWidth"); + + QTest::newRow("") << false; + QTest::newRow("hasHeightForWidth") << true; +} // public qreal columnMinimumWidth(int column) const void tst_QGraphicsGridLayout::columnMinimumWidth() { + QFETCH(bool, hasHeightForWidth); QGraphicsScene scene; QGraphicsView view(&scene); QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window); QGraphicsGridLayout *layout = new QGraphicsGridLayout(); scene.addItem(widget); widget->setLayout(layout); - populateLayout(layout, 3, 2); + populateLayout(layout, 3, 2, hasHeightForWidth); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); @@ -702,16 +764,24 @@ void tst_QGraphicsGridLayout::columnMinimumWidth() delete widget; } +void tst_QGraphicsGridLayout::columnPreferredWidth_data() +{ + QTest::addColumn("hasHeightForWidth"); + + QTest::newRow("") << false; + QTest::newRow("hasHeightForWidth") << true; +} // public qreal columnPreferredWidth(int column) const void tst_QGraphicsGridLayout::columnPreferredWidth() { + QFETCH(bool, hasHeightForWidth); QGraphicsScene scene; QGraphicsView view(&scene); QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window); QGraphicsGridLayout *layout = new QGraphicsGridLayout(); scene.addItem(widget); widget->setLayout(layout); - populateLayout(layout, 3, 2); + populateLayout(layout, 3, 2, hasHeightForWidth); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); @@ -1021,16 +1091,25 @@ void tst_QGraphicsGridLayout::removeAt() delete widget; } +void tst_QGraphicsGridLayout::rowAlignment_data() +{ + QTest::addColumn("hasHeightForWidth"); + + QTest::newRow("") << false; + QTest::newRow("hasHeightForWidth") << true; +} + // public Qt::Alignment rowAlignment(int row) const void tst_QGraphicsGridLayout::rowAlignment() { + QFETCH(bool, hasHeightForWidth); QGraphicsScene scene; QGraphicsView view(&scene); QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window); QGraphicsGridLayout *layout = new QGraphicsGridLayout(); scene.addItem(widget); widget->setLayout(layout); - populateLayout(layout, 2, 3); + populateLayout(layout, 2, 3, hasHeightForWidth); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(1); widget->setContentsMargins(0, 0, 0, 0); @@ -1080,17 +1159,26 @@ void tst_QGraphicsGridLayout::rowAlignment() delete widget; } +void tst_QGraphicsGridLayout::rowCount_data() +{ + QTest::addColumn("hasHeightForWidth"); + + QTest::newRow("") << false; + QTest::newRow("hasHeightForWidth") << true; +} + // public int rowCount() const // public int columnCount() const void tst_QGraphicsGridLayout::rowCount() { + QFETCH(bool, hasHeightForWidth); QGraphicsScene scene; QGraphicsView view(&scene); QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window); QGraphicsGridLayout *layout = new QGraphicsGridLayout(); scene.addItem(widget); widget->setLayout(layout); - populateLayout(layout, 2, 3); + populateLayout(layout, 2, 3, hasHeightForWidth); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); widget->setContentsMargins(0, 0, 0, 0); @@ -1100,23 +1188,32 @@ void tst_QGraphicsGridLayout::rowCount() // with spans and holes... widget->setLayout(0); layout = new QGraphicsGridLayout(); - populateLayoutWithSpansAndHoles(layout); + populateLayoutWithSpansAndHoles(layout, hasHeightForWidth); QCOMPARE(layout->rowCount(), 2); QCOMPARE(layout->columnCount(), 3); delete widget; } +void tst_QGraphicsGridLayout::rowMaximumHeight_data() +{ + QTest::addColumn("hasHeightForWidth"); + + QTest::newRow("") << false; + QTest::newRow("hasHeightForWidth") << true; +} + // public qreal rowMaximumHeight(int row) const void tst_QGraphicsGridLayout::rowMaximumHeight() { + QFETCH(bool, hasHeightForWidth); QGraphicsScene scene; QGraphicsView view(&scene); QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window); QGraphicsGridLayout *layout = new QGraphicsGridLayout; scene.addItem(widget); widget->setLayout(layout); - populateLayout(layout, 2, 3); + populateLayout(layout, 2, 3, hasHeightForWidth); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); @@ -1142,16 +1239,24 @@ void tst_QGraphicsGridLayout::rowMaximumHeight() delete widget; } +void tst_QGraphicsGridLayout::rowMinimumHeight_data() +{ + QTest::addColumn("hasHeightForWidth"); + + QTest::newRow("") << false; + QTest::newRow("hasHeightForWidth") << true; +} // public qreal rowMinimumHeight(int row) const void tst_QGraphicsGridLayout::rowMinimumHeight() { + QFETCH(bool, hasHeightForWidth); QGraphicsScene scene; QGraphicsView view(&scene); QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window); QGraphicsGridLayout *layout = new QGraphicsGridLayout(); scene.addItem(widget); widget->setLayout(layout); - populateLayout(layout, 2, 3); + populateLayout(layout, 2, 3, hasHeightForWidth); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); @@ -1177,16 +1282,24 @@ void tst_QGraphicsGridLayout::rowMinimumHeight() delete widget; } +void tst_QGraphicsGridLayout::rowPreferredHeight_data() +{ + QTest::addColumn("hasHeightForWidth"); + + QTest::newRow("") << false; + QTest::newRow("hasHeightForWidth") << true; +} // public qreal rowPreferredHeight(int row) const void tst_QGraphicsGridLayout::rowPreferredHeight() { + QFETCH(bool, hasHeightForWidth); QGraphicsScene scene; QGraphicsView view(&scene); QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window); QGraphicsGridLayout *layout = new QGraphicsGridLayout(); scene.addItem(widget); widget->setLayout(layout); - populateLayout(layout, 2, 3); + populateLayout(layout, 2, 3, hasHeightForWidth); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); @@ -1275,16 +1388,25 @@ void tst_QGraphicsGridLayout::rowSpacing() } +void tst_QGraphicsGridLayout::rowStretchFactor_data() +{ + QTest::addColumn("hasHeightForWidth"); + + QTest::newRow("") << false; + QTest::newRow("hasHeightForWidth") << true; +} + // public int rowStretchFactor(int row) const void tst_QGraphicsGridLayout::rowStretchFactor() { + QFETCH(bool, hasHeightForWidth); QGraphicsScene scene; QGraphicsView view(&scene); QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window); QGraphicsGridLayout *layout = new QGraphicsGridLayout(); scene.addItem(widget); widget->setLayout(layout); - populateLayout(layout, 2, 3); + populateLayout(layout, 2, 3, hasHeightForWidth); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); @@ -1308,9 +1430,12 @@ void tst_QGraphicsGridLayout::setColumnSpacing_data() { QTest::addColumn("column"); QTest::addColumn("spacing"); - QTest::newRow("null") << 0 << qreal(0.0); - QTest::newRow("10") << 0 << qreal(10.0); + QTest::addColumn("hasHeightForWidth"); + QTest::newRow("null") << 0 << qreal(0.0) << false; + QTest::newRow("10") << 0 << qreal(10.0) << false; + QTest::newRow("null, hasHeightForWidth") << 0 << qreal(0.0) << true; + QTest::newRow("10, hasHeightForWidth") << 0 << qreal(10.0) << true; } // public void setColumnSpacing(int column, qreal spacing) @@ -1318,6 +1443,7 @@ void tst_QGraphicsGridLayout::setColumnSpacing() { QFETCH(int, column); QFETCH(qreal, spacing); + QFETCH(bool, hasHeightForWidth); QGraphicsScene scene; QGraphicsView view(&scene); @@ -1325,7 +1451,7 @@ void tst_QGraphicsGridLayout::setColumnSpacing() QGraphicsGridLayout *layout = new QGraphicsGridLayout(); scene.addItem(widget); widget->setLayout(layout); - populateLayout(layout, 3, 2); + populateLayout(layout, 3, 2, hasHeightForWidth); layout->setSpacing(0); layout->setContentsMargins(0, 0, 0, 0); qreal oldSpacing = layout->columnSpacing(column); @@ -1362,9 +1488,12 @@ void tst_QGraphicsGridLayout::setRowSpacing_data() { QTest::addColumn("row"); QTest::addColumn("spacing"); - QTest::newRow("null") << 0 << qreal(0.0); - QTest::newRow("10") << 0 << qreal(10.0); + QTest::addColumn("hasHeightForWidth"); + QTest::newRow("null") << 0 << qreal(0.0) << false; + QTest::newRow("10") << 0 << qreal(10.0) << false; + QTest::newRow("null, hasHeightForWidth") << 0 << qreal(0.0) << true; + QTest::newRow("10, hasHeightForWidth") << 0 << qreal(10.0) << true; } // public void setRowSpacing(int row, qreal spacing) @@ -1372,6 +1501,7 @@ void tst_QGraphicsGridLayout::setRowSpacing() { QFETCH(int, row); QFETCH(qreal, spacing); + QFETCH(bool, hasHeightForWidth); QGraphicsScene scene; QGraphicsView view(&scene); @@ -1379,7 +1509,7 @@ void tst_QGraphicsGridLayout::setRowSpacing() QGraphicsGridLayout *layout = new QGraphicsGridLayout(); scene.addItem(widget); widget->setLayout(layout); - populateLayout(layout, 3, 2); + populateLayout(layout, 3, 2, hasHeightForWidth); layout->setSpacing(0); layout->setContentsMargins(0, 0, 0, 0); qreal oldSpacing = layout->rowSpacing(row); @@ -1393,21 +1523,25 @@ void tst_QGraphicsGridLayout::setRowSpacing() void tst_QGraphicsGridLayout::setSpacing_data() { QTest::addColumn("spacing"); - QTest::newRow("zero") << qreal(0.0); - QTest::newRow("17") << qreal(17.0); + QTest::addColumn("hasHeightForWidth"); + QTest::newRow("zero") << qreal(0.0) << false; + QTest::newRow("17") << qreal(17.0) << false; + QTest::newRow("zero, hasHeightForWidth") << qreal(0.0) << true; + QTest::newRow("17, hasHeightForWidth") << qreal(17.0) << true; } // public void setSpacing(qreal spacing) void tst_QGraphicsGridLayout::setSpacing() { QFETCH(qreal, spacing); + QFETCH(bool, hasHeightForWidth); QGraphicsScene scene; QGraphicsView view(&scene); QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window); QGraphicsGridLayout *layout = new QGraphicsGridLayout(); scene.addItem(widget); widget->setLayout(layout); - populateLayout(layout, 3, 2); + populateLayout(layout, 3, 2, hasHeightForWidth); layout->setContentsMargins(0, 0, 0, 0); QSizeF sh = layout->sizeHint(Qt::PreferredSize, QSizeF()); qreal oldVSpacing = layout->verticalSpacing(); @@ -1538,8 +1672,18 @@ void tst_QGraphicsGridLayout::verticalSpacing() delete widget; } +void tst_QGraphicsGridLayout::layoutDirection_data() +{ + QTest::addColumn("hasHeightForWidth"); + + QTest::newRow("") << false; + QTest::newRow("hasHeightForWidth") << true; +} + void tst_QGraphicsGridLayout::layoutDirection() { + QFETCH(bool, hasHeightForWidth); + QGraphicsScene scene; QGraphicsView view(&scene); @@ -1562,6 +1706,12 @@ void tst_QGraphicsGridLayout::layoutDirection() w4->setMinimumSize(30, 20); layout->addItem(w4, 1, 1); + QSizePolicy policy = w1->sizePolicy(); + policy.setHeightForWidth(hasHeightForWidth); + w1->setSizePolicy(policy); + w2->setSizePolicy(policy); + w4->setSizePolicy(policy); + layout->setAlignment(w2, Qt::AlignRight); layout->setAlignment(w3, Qt::AlignLeft); @@ -2200,9 +2350,9 @@ void tst_QGraphicsGridLayout::geometries_data() .preferredSize(QSizeF(50,10)) .maxSize(QSizeF(100, 100)) << ItemDesc(1,1) - .minSize(QSizeF(40,40)) - .preferredSize(QSizeF(50,400)) - .maxSize(QSizeF(500, 500)) + .minSize(QSizeF(40,-1)) + .preferredSize(QSizeF(50,-1)) + .maxSize(QSizeF(500, -1)) .heightForWidth(hfw1) ) << QSizeF(100, 401) @@ -2211,32 +2361,6 @@ void tst_QGraphicsGridLayout::geometries_data() << QRectF(0, 1, 50,100) << QRectF(50, 1, 50,400) ); - - QTest::newRow("hfw-h408") << (ItemList() - << ItemDesc(0,0) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(0,1) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(1,0) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(1,1) - .minSize(QSizeF(40,40)) - .preferredSize(QSizeF(50,400)) - .maxSize(QSizeF(500, 500)) - .heightForWidth(hfw1) - ) - << QSizeF(100, 408) - << (RectList() - << QRectF(0, 0, 50, 8) << QRectF(50, 0, 50, 8) - << QRectF(0, 8, 50,100) << QRectF(50, 8, 50,400) - ); - QTest::newRow("hfw-h410") << (ItemList() << ItemDesc(0,0) .minSize(QSizeF(1,1)) @@ -2262,109 +2386,6 @@ void tst_QGraphicsGridLayout::geometries_data() << QRectF(0, 10, 50,100) << QRectF(50, 10, 50,400) ); - QTest::newRow("hfw-h470") << (ItemList() - << ItemDesc(0,0) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(0,1) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(1,0) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(1,1) - .minSize(QSizeF(40,40)) - .preferredSize(QSizeF(50,400)) - .maxSize(QSizeF(500, 500)) - .heightForWidth(hfw1) - ) - << QSizeF(100, 470) - << (RectList() - << QRectF(0, 0, 50,70) << QRectF(50, 0, 50,70) - << QRectF(0, 70, 50,100) << QRectF(50, 70, 50,400) - ); - - - // change layout width and verify - QTest::newRow("hfw-w100") << (ItemList() - << ItemDesc(0,0) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(0,1) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(1,0) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(1,1) - .minSize(QSizeF(40,40)) - .preferredSize(QSizeF(50,400)) - .maxSize(QSizeF(5000, 5000)) - .heightForWidth(hfw1) - ) - << QSizeF(100, 401) - << (RectList() - << QRectF( 0, 0, 50, 1) << QRectF( 50, 0, 50, 1) - << QRectF( 0, 1, 50, 100) << QRectF( 50, 1, 50, 400) - ); - - QTest::newRow("hfw-w160") << (ItemList() - << ItemDesc(0,0) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(0,1) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(1,0) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(1,1) - .minSize(QSizeF(40,40)) - .preferredSize(QSizeF(50,400)) - .maxSize(QSizeF(5000, 5000)) - .heightForWidth(hfw1) - ) - << QSizeF(160, 401) - << (RectList() - << QRectF( 0, 0, 80, 100) << QRectF( 80, 0, 80, 100) - << QRectF( 0, 100, 80, 100) << QRectF( 80, 100, 80, 250) - ); - - - QTest::newRow("hfw-w500") << (ItemList() - << ItemDesc(0,0) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(0,1) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(1,0) - .minSize(QSizeF(1,1)) - .preferredSize(QSizeF(50,10)) - .maxSize(QSizeF(100, 100)) - << ItemDesc(1,1) - .minSize(QSizeF(40,40)) - .preferredSize(QSizeF(50,400)) - .maxSize(QSizeF(5000, 5000)) - .heightForWidth(hfw1) - ) - << QSizeF(500, 401) - << (RectList() - << QRectF( 0, 0, 100, 100) << QRectF(100, 0, 100, 100) - << QRectF( 0, 100, 100, 100) << QRectF(100, 100, 400, 50) - ); - } void tst_QGraphicsGridLayout::geometries() -- cgit v0.12 From 5a8078cb2cf1c95e8d853b9b0bd8c8303f52aceb Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 13 Oct 2010 13:37:37 +0200 Subject: Add touch offset --- src/plugins/generic/linuxinput/qlinuxinput.cpp | 8 ++++++-- src/plugins/generic/linuxinput/qlinuxinput.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/plugins/generic/linuxinput/qlinuxinput.cpp b/src/plugins/generic/linuxinput/qlinuxinput.cpp index 07f7a43..b3ef6bd 100644 --- a/src/plugins/generic/linuxinput/qlinuxinput.cpp +++ b/src/plugins/generic/linuxinput/qlinuxinput.cpp @@ -131,7 +131,7 @@ private: QLinuxInputMouseHandler::QLinuxInputMouseHandler(const QString &key, const QString &specification) - : m_notify(0), m_x(0), m_y(0), m_prevx(0), m_prevy(0), m_buttons(0), d(0) + : m_notify(0), m_x(0), m_y(0), m_prevx(0), m_prevy(0), m_xoffset(0), m_yoffset(0), m_buttons(0), d(0) { qDebug() << "QLinuxInputMouseHandler" << key << specification; @@ -149,6 +149,10 @@ QLinuxInputMouseHandler::QLinuxInputMouseHandler(const QString &key, m_compression = false; else if (arg.startsWith("dejitter=")) jitterLimit = arg.mid(9).toInt(); + else if (arg.startsWith("xoffset=")) + m_xoffset = arg.mid(8).toInt(); + else if (arg.startsWith("yoffset=")) + m_yoffset = arg.mid(8).toInt(); else if (arg.startsWith(QLatin1String("/dev/"))) dev = arg; } @@ -179,7 +183,7 @@ QLinuxInputMouseHandler::~QLinuxInputMouseHandler() void QLinuxInputMouseHandler::sendMouseEvent(int x, int y, Qt::MouseButtons buttons) { - QPoint pos(x, y); + QPoint pos(x+m_xoffset, y+m_yoffset); QWindowSystemInterface::handleMouseEvent(0, pos, pos, m_buttons); m_prevx = x; m_prevy = y; diff --git a/src/plugins/generic/linuxinput/qlinuxinput.h b/src/plugins/generic/linuxinput/qlinuxinput.h index 37123f1..c94c0f4 100644 --- a/src/plugins/generic/linuxinput/qlinuxinput.h +++ b/src/plugins/generic/linuxinput/qlinuxinput.h @@ -70,6 +70,7 @@ private: int m_fd; int m_x, m_y; int m_prevx, m_prevy; + int m_xoffset, m_yoffset; int m_smoothx, m_smoothy; Qt::MouseButtons m_buttons; bool m_compression; -- cgit v0.12 From e3edb0f6f10d8ae25dad3e4dfe0026313dab8f39 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 13 Oct 2010 13:58:38 +0200 Subject: Revert "qmake: pass include directories to MS resource compiler" This reverts commit cd4eaa9c8274559aa2b0ceaeed1644966b9a2d94. We need a better plan to handle the command-line-is-too-long case. Reviewed-by: ossi --- qmake/generators/win32/msvc_vcproj.cpp | 1 - qmake/generators/win32/msvc_vcxproj.cpp | 1 - qmake/generators/win32/winmakefile.cpp | 3 +-- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index cd42d4d..cff7a14 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1004,7 +1004,6 @@ void VcprojGenerator::initResourceTool() { VCConfiguration &conf = vcProject.Configuration; conf.resource.PreprocessorDefinitions = conf.compiler.PreprocessorDefinitions; - conf.resource.AdditionalIncludeDirectories = conf.compiler.AdditionalIncludeDirectories; // We need to add _DEBUG for the debug version of the project, since the normal compiler defines // do not contain it. (The compiler defines this symbol automatically, which is wy we don't need diff --git a/qmake/generators/win32/msvc_vcxproj.cpp b/qmake/generators/win32/msvc_vcxproj.cpp index 00702ae..396d2bf 100644 --- a/qmake/generators/win32/msvc_vcxproj.cpp +++ b/qmake/generators/win32/msvc_vcxproj.cpp @@ -365,7 +365,6 @@ void VcxprojGenerator::initResourceTool() { VCXConfiguration &conf = vcxProject.Configuration; conf.resource.PreprocessorDefinitions = conf.compiler.PreprocessorDefinitions; - conf.resource.AdditionalIncludeDirectories = conf.compiler.AdditionalIncludeDirectories; // We need to add _DEBUG for the debug version of the project, since the normal compiler defines // do not contain it. (The compiler defines this symbol automatically, which is wy we don't need diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 8f148ad..ecb20c7 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -760,8 +760,7 @@ void Win32MakefileGenerator::writeRcFilePart(QTextStream &t) // since the compiler defines this symbol by itself, and we use it in the automatically // created rc file when VERSION is define the .pro file. t << res_file << ": " << rc_file << "\n\t" - << var("QMAKE_RC") << (project->isActiveConfig("debug") ? " -D_DEBUG" : "") - << " $(DEFINES) $(INCPATH) -fo " << res_file << " " << rc_file; + << var("QMAKE_RC") << (project->isActiveConfig("debug") ? " -D_DEBUG" : "") << " $(DEFINES) -fo " << res_file << " " << rc_file; t << endl << endl; } } -- cgit v0.12 From a6006b9b97634ae93e2ccc2dd93c0161e69d55dc Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Wed, 13 Oct 2010 13:35:30 +0200 Subject: Disable selection of Libraries on Windows 7 in getExistingDirectory(). The Libraries on Windows 7 are user-defined collection of folders, which is only a logical representation. There are no file system entries associated with it . This patch makes sure that user cannot choose a library when using the QFileDialog::getExistingDirectory(), in such cases it will show a standard windows warning message. Task-number: QTBUG-12655 Reviewed-by: Thierry Bastian --- src/gui/dialogs/qfiledialog_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/dialogs/qfiledialog_win.cpp b/src/gui/dialogs/qfiledialog_win.cpp index 5b192b4..98860c4 100644 --- a/src/gui/dialogs/qfiledialog_win.cpp +++ b/src/gui/dialogs/qfiledialog_win.cpp @@ -603,7 +603,7 @@ QString qt_win_CID_get_existing_directory(const QFileDialogArgs &args) // Set the FOS_PICKFOLDERS flag DWORD newOptions; hr = pfd->GetOptions(&newOptions); - newOptions |= FOS_PICKFOLDERS; + newOptions |= (FOS_PICKFOLDERS | FOS_FORCEFILESYSTEM); if (SUCCEEDED(hr) && SUCCEEDED((hr = pfd->SetOptions(newOptions)))) { QWidget *parentWindow = args.parent; if (parentWindow) -- cgit v0.12 From c118708a9886643db887a89b02f31a1879604116 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 13 Oct 2010 15:34:38 +0200 Subject: Don't clobber the tty by default Add a ttymode option to LinuxInputKeyboard which turns on setting the keyboard mode and turns off Ctrl-C --- src/plugins/generic/linuxinput/qlinuxinput.cpp | 62 ++++++++++++++------------ 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/src/plugins/generic/linuxinput/qlinuxinput.cpp b/src/plugins/generic/linuxinput/qlinuxinput.cpp index b3ef6bd..bd57fa3 100644 --- a/src/plugins/generic/linuxinput/qlinuxinput.cpp +++ b/src/plugins/generic/linuxinput/qlinuxinput.cpp @@ -404,12 +404,16 @@ QLinuxInputKeyboardHandler::QLinuxInputKeyboardHandler(const QString &key, const int repeat_delay = -1; int repeat_rate = -1; + bool ttymode = false; + QStringList args = specification.split(QLatin1Char(':')); foreach (const QString &arg, args) { if (arg.startsWith(QLatin1String("repeat-delay="))) repeat_delay = arg.mid(13).toInt(); else if (arg.startsWith(QLatin1String("repeat-rate="))) repeat_rate = arg.mid(12).toInt(); + else if (arg.startsWith(QLatin1String("ttymode"))) + ttymode = true; else if (arg.startsWith(QLatin1String("/dev/"))) dev = arg; } @@ -427,34 +431,36 @@ QLinuxInputKeyboardHandler::QLinuxInputKeyboardHandler(const QString &key, const notifier = new QSocketNotifier(m_fd, QSocketNotifier::Read, this); connect(notifier, SIGNAL(activated(int)), this, SLOT(readKeycode())); - // play nice in case we are started from a shell (e.g. for debugging) - m_tty_fd = isatty(0) ? 0 : -1; - - if (m_tty_fd >= 0) { - // save tty config for restore. - tcgetattr(m_tty_fd, &m_tty_attr); - - struct ::termios termdata; - tcgetattr(m_tty_fd, &termdata); - - // record the original mode so we can restore it again in the destructor. - ::ioctl(m_tty_fd, KDGKBMODE, &m_orig_kbmode); - - // setting this tranlation mode is even needed in INPUT mode to prevent - // the shell from also interpreting codes, if the process has a tty - // attached: e.g. Ctrl+C wouldn't copy, but kill the application. - ::ioctl(m_tty_fd, KDSKBMODE, K_MEDIUMRAW); - - // set the tty layer to pass-through - termdata.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP); - termdata.c_oflag = 0; - termdata.c_cflag = CREAD | CS8; - termdata.c_lflag = 0; - termdata.c_cc[VTIME]=0; - termdata.c_cc[VMIN]=1; - cfsetispeed(&termdata, 9600); - cfsetospeed(&termdata, 9600); - tcsetattr(m_tty_fd, TCSANOW, &termdata); + if (ttymode) { + // play nice in case we are started from a shell (e.g. for debugging) + m_tty_fd = isatty(0) ? 0 : -1; + + if (m_tty_fd >= 0) { + // save tty config for restore. + tcgetattr(m_tty_fd, &m_tty_attr); + + struct ::termios termdata; + tcgetattr(m_tty_fd, &termdata); + + // record the original mode so we can restore it again in the destructor. + ::ioctl(m_tty_fd, KDGKBMODE, &m_orig_kbmode); + + // setting this tranlation mode is even needed in INPUT mode to prevent + // the shell from also interpreting codes, if the process has a tty + // attached: e.g. Ctrl+C wouldn't copy, but kill the application. + ::ioctl(m_tty_fd, KDSKBMODE, K_MEDIUMRAW); + + // set the tty layer to pass-through + termdata.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP); + termdata.c_oflag = 0; + termdata.c_cflag = CREAD | CS8; + termdata.c_lflag = 0; + termdata.c_cc[VTIME]=0; + termdata.c_cc[VMIN]=1; + cfsetispeed(&termdata, 9600); + cfsetospeed(&termdata, 9600); + tcsetattr(m_tty_fd, TCSANOW, &termdata); + } } } else { qWarning("Cannot open keyboard input device '%s': %s", qPrintable(dev), strerror(errno)); -- cgit v0.12 From 2def16770a623df4e5fc0dcd5f0e55c485251992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 13 Oct 2010 18:28:36 +0200 Subject: Add manual test for mkspecs to visualize the effect of the final config Reviewed-by: ossi --- qmake/generators/mac/pbuilder_pbx.cpp | 1 + qmake/generators/metamakefile.cpp | 1 + qmake/generators/win32/msvc_vcproj.cpp | 1 + tests/manual/mkspecs/.gitignore | 2 ++ tests/manual/mkspecs/test.sh | 64 ++++++++++++++++++++++++++++++++++ 5 files changed, 69 insertions(+) create mode 100644 tests/manual/mkspecs/.gitignore create mode 100755 tests/manual/mkspecs/test.sh diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index aa55f51..c659adb 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -167,6 +167,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) } if(tmp_proj.read(fn)) { if(Option::debug_level) { + debug_msg(1, "Dumping all variables:"); QMap &vars = tmp_proj.variables(); for(QMap::Iterator it = vars.begin(); it != vars.end(); ++it) { diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index e98831d..df05550 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -217,6 +217,7 @@ BuildsMetaMakefileGenerator::write(const QString &oldpwd) // debugging if(Option::debug_level) { + debug_msg(1, "Dumping all variables:"); QMap &vars = project->variables(); for(QMap::Iterator it = vars.begin(); it != vars.end(); ++it) { if(!it.key().startsWith(".") && !it.value().isEmpty()) diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 8582ce1..c98251b 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -459,6 +459,7 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) tmp_vcproj.setProjectFile(&tmp_proj); Option::qmake_mode = old_mode; if(Option::debug_level) { + debug_msg(1, "Dumping all variables:"); QMap &vars = tmp_proj.variables(); for(QMap::Iterator it = vars.begin(); it != vars.end(); ++it) { diff --git a/tests/manual/mkspecs/.gitignore b/tests/manual/mkspecs/.gitignore new file mode 100644 index 0000000..403e028 --- /dev/null +++ b/tests/manual/mkspecs/.gitignore @@ -0,0 +1,2 @@ +tmp +specs diff --git a/tests/manual/mkspecs/test.sh b/tests/manual/mkspecs/test.sh new file mode 100755 index 0000000..4b723c0 --- /dev/null +++ b/tests/manual/mkspecs/test.sh @@ -0,0 +1,64 @@ +#!/bin/bash + +if [ "$1" == "--help" ]; then + echo "Init a clean git repository somewhere and run this test script from that directory. The first run will" + echo "produce a bunch of specs. This is your baseline. Run 'git add specs' and commit the baseline. Then run" + echo "this script again, after making changes to the mkspecs. You should see any diffs you produced." + exit 0 +fi + + +QMAKE_ARGS="-nocache -d" +SPECS_DIR=$(qmake -query QMAKE_MKSPECS) +SPECS=$(find -L $SPECS_DIR | grep "qmake.conf" | grep -Ev "common|default" | grep "$1") + +SEDI="sed -i" +if [ $(uname) == "Darwin" ]; then + # Mac OS X requires an extension, Linux will barf on it being present + SEDI='sed -i .backup' +fi + +if [ ! -d tmp ]; then + mkdir tmp + touch tmp/empty.pro +fi + +if [ ! -d specs ]; then + mkdir specs +fi + +git checkout -- specs > /dev/null 2>&1 + +cd tmp +for spec in $SPECS; do + spec=$(echo $spec | sed "s|$SPECS_DIR/||" | sed "s|/qmake.conf||") + output_file=$(echo "$spec.txt" | sed "s|/|-|g") + echo "Dumping qmake variables for spec '$spec' to 'specs/$output_file'..." + qmake $QMAKE_ARGS -spec $spec empty.pro 2>&1 | + sed -n '/Dumping all variables/,$p' | + grep -Ev "(QMAKE_INTERNAL_INCLUDED_FILES|DISTFILES) ===" > ../specs/$output_file + + if [ -n $QTDIR ]; then + $SEDI "s|$QTDIR|\$QTDIR|g" ../specs/$output_file + fi + + if [ -n $QTSRCDIR ]; then + $SEDI "s|$QTSRCDIR|\$QTDIR|g" ../specs/$output_file + fi +done +cd .. + +rm -f specs/*.backup + +git diff --exit-code -- specs > /dev/null +exit_code=$? + +if [ $exit_code -eq 0 ]; then + echo -e "\nNo diff produced (you did good)" +else + # Show the resulting diff + git diff -- specs +fi + +exit $exit_code + -- cgit v0.12 From 86636e0c4ab91bfb60be1e18d6daff34d41a5927 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 13 Oct 2010 14:09:10 +0200 Subject: Refactor GCC mkspecs to share more configuration options The g++ and llvm mkspecs now share the common parts in common/gcc-base.conf Each top level mkspec includes a platform-specific version of this base, either common/gcc-base-unix.conf or common/gcc-base-mac.conf, and these platform specific bases will include the cross-platform one. The same pattern is then used for the g++ specific configurations, which are split up into common/g++.conf, common/g++-unix.conf and common/g++-mac.conf The qplatformdefs.h for mac was also shared where possible. The test in tests/manual/mkspecs was used to ensure that the final output of all the mkspecs was the same after the refactoring as before. Reviewed-by: ossi --- mkspecs/common/g++-mac.conf | 27 ++++++ mkspecs/common/g++-unix.conf | 14 ++++ mkspecs/common/g++.conf | 56 +++---------- mkspecs/common/gcc-base-mac.conf | 48 +++++++++++ mkspecs/common/gcc-base-unix.conf | 21 +++++ mkspecs/common/gcc-base.conf | 73 ++++++++++++++++ mkspecs/common/llvm.conf | 49 +---------- mkspecs/common/mac-g++.conf | 81 ------------------ mkspecs/common/mac-llvm.conf | 76 ----------------- mkspecs/common/mac/qplatformdefs.h | 97 ++++++++++++++++++++++ mkspecs/freebsd-g++/qmake.conf | 3 +- mkspecs/linux-g++-32/qmake.conf | 3 +- mkspecs/linux-g++-64/qmake.conf | 4 +- mkspecs/linux-g++-maemo/qmake.conf | 3 +- mkspecs/linux-g++/qmake.conf | 3 +- mkspecs/linux-llvm/qmake.conf | 3 +- mkspecs/macx-g++/qmake.conf | 5 +- mkspecs/macx-g++/qplatformdefs.h | 56 +------------ mkspecs/macx-g++40/qmake.conf | 4 +- mkspecs/macx-g++40/qplatformdefs.h | 56 +------------ mkspecs/macx-g++42/qmake.conf | 4 +- mkspecs/macx-g++42/qplatformdefs.h | 56 +------------ mkspecs/macx-icc/qplatformdefs.h | 2 +- mkspecs/macx-llvm/qmake.conf | 4 +- mkspecs/macx-llvm/qplatformdefs.h | 56 +------------ mkspecs/macx-xcode/qmake.conf | 12 ++- mkspecs/macx-xcode/qplatformdefs.h | 56 +------------ mkspecs/qws/linux-arm-g++/qmake.conf | 3 +- mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf | 3 +- mkspecs/qws/linux-armv6-g++/qmake.conf | 3 +- mkspecs/qws/linux-avr32-g++/qmake.conf | 3 +- mkspecs/qws/linux-cellon-g++/qmake.conf | 3 +- mkspecs/qws/linux-dm7000-g++/qmake.conf | 3 +- mkspecs/qws/linux-dm800-g++/qmake.conf | 3 +- mkspecs/qws/linux-generic-g++-32/qmake.conf | 3 +- mkspecs/qws/linux-generic-g++/qmake.conf | 3 +- mkspecs/qws/linux-ipaq-g++/qmake.conf | 3 +- mkspecs/qws/linux-lsb-g++/qmake.conf | 4 +- mkspecs/qws/linux-mips-g++/qmake.conf | 3 +- mkspecs/qws/linux-powerpc-g++/qmake.conf | 3 +- mkspecs/qws/linux-sh-g++/qmake.conf | 3 +- mkspecs/qws/linux-sh4al-g++/qmake.conf | 3 +- mkspecs/qws/linux-sharp-g++/qmake.conf | 3 +- mkspecs/qws/linux-x86-g++/qmake.conf | 3 +- mkspecs/qws/linux-x86_64-g++/qmake.conf | 3 +- mkspecs/qws/linux-zylonite-g++/qmake.conf | 3 +- mkspecs/symbian/linux-gcce/qmake.conf | 3 +- .../unsupported/linux-scratchbox2-g++/qmake.conf | 3 +- mkspecs/unsupported/qnx-g++/qmake.conf | 3 +- mkspecs/unsupported/vxworks-ppc-g++/qmake.conf | 3 +- .../unsupported/vxworks-simpentium-g++/qmake.conf | 3 +- 51 files changed, 383 insertions(+), 562 deletions(-) create mode 100644 mkspecs/common/g++-mac.conf create mode 100644 mkspecs/common/g++-unix.conf create mode 100644 mkspecs/common/gcc-base-mac.conf create mode 100644 mkspecs/common/gcc-base-unix.conf create mode 100644 mkspecs/common/gcc-base.conf delete mode 100644 mkspecs/common/mac-g++.conf delete mode 100644 mkspecs/common/mac-llvm.conf create mode 100644 mkspecs/common/mac/qplatformdefs.h diff --git a/mkspecs/common/g++-mac.conf b/mkspecs/common/g++-mac.conf new file mode 100644 index 0000000..1b8ec6e --- /dev/null +++ b/mkspecs/common/g++-mac.conf @@ -0,0 +1,27 @@ +# +# Qmake configuration for the GNU C++ compiler on Mac OS X +# +# Before making changes to this file, please read the comment in +# gcc-base.conf, to make sure the change goes in the right place. +# +# To verify that your change has the desired effect on the final configuration +# you can use the manual test in tests/manual/mkspecs. +# + +include(g++.conf) + +QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_DWARF2 +QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_DWARF2 +QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO += -g $$QMAKE_CFLAGS_DWARF2 + +QMAKE_LFLAGS_STATIC_LIB += -all_load + +QMAKE_CFLAGS_X86_64 += -Xarch_x86_64 -mmacosx-version-min=10.5 +QMAKE_CFLAGS_PPC_64 += -Xarch_ppc64 -mmacosx-version-min=10.5 + +QMAKE_CXXFLAGS_X86_64 = $$QMAKE_CFLAGS_X86_64 +QMAKE_CXXFLAGS_PPC_64 = $$QMAKE_CFLAGS_PPC_64 +QMAKE_OBJECTIVE_CFLAGS_X86_64 = $$QMAKE_CFLAGS_X86_64 +QMAKE_OBJECTIVE_CFLAGS_PPC_64 = $$QMAKE_CFLAGS_PPC_64 +QMAKE_LFLAGS_X86_64 = $$QMAKE_CFLAGS_X86_64 +QMAKE_LFLAGS_PPC_64 = $$QMAKE_CFLAGS_PPC_64 diff --git a/mkspecs/common/g++-unix.conf b/mkspecs/common/g++-unix.conf new file mode 100644 index 0000000..09b3e90 --- /dev/null +++ b/mkspecs/common/g++-unix.conf @@ -0,0 +1,14 @@ +# +# Qmake configuration for the GNU C++ compiler on *nix-systems +# +# Before making changes to this file, please read the comment in +# gcc-base.conf, to make sure the change goes in the right place. +# +# To verify that your change has the desired effect on the final configuration +# you can use the manual test in tests/manual/mkspecs. +# + +include(g++.conf) + +QMAKE_LFLAGS_RELEASE += -Wl,-O1 +QMAKE_LFLAGS_NOUNDEF += -Wl,--no-undefined diff --git a/mkspecs/common/g++.conf b/mkspecs/common/g++.conf index 0d511fc..cb82180 100644 --- a/mkspecs/common/g++.conf +++ b/mkspecs/common/g++.conf @@ -1,54 +1,18 @@ # -# qmake configuration for common gcc +# Qmake configuration for the GNU C++ compiler +# +# Before making changes to this file, please read the comment in +# gcc-base.conf, to make sure the change goes in the right place. +# +# To verify that your change has the desired effect on the final configuration +# you can use the manual test in tests/manual/mkspecs. # -QMAKE_CC = gcc -QMAKE_CFLAGS += -pipe -QMAKE_CFLAGS_DEPS += -M -QMAKE_CFLAGS_WARN_ON += -Wall -W -QMAKE_CFLAGS_WARN_OFF += -w -QMAKE_CFLAGS_RELEASE += -O2 QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -g -QMAKE_CFLAGS_DEBUG += -g -QMAKE_CFLAGS_SHLIB += -fPIC -QMAKE_CFLAGS_STATIC_LIB += -fPIC -QMAKE_CFLAGS_YACC += -Wno-unused -Wno-parentheses -QMAKE_CFLAGS_HIDESYMS += -fvisibility=hidden -QMAKE_CFLAGS_PRECOMPILE += -x c-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} -QMAKE_CFLAGS_USE_PRECOMPILE += -include ${QMAKE_PCH_OUTPUT_BASE} -QMAKE_CXX = g++ -QMAKE_CXXFLAGS += $$QMAKE_CFLAGS -QMAKE_CXXFLAGS_DEPS += $$QMAKE_CFLAGS_DEPS -QMAKE_CXXFLAGS_WARN_ON += $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF += $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO -QMAKE_CXXFLAGS_DEBUG += $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_SHLIB += $$QMAKE_CFLAGS_SHLIB -QMAKE_CXXFLAGS_STATIC_LIB += $$QMAKE_CFLAGS_STATIC_LIB -QMAKE_CXXFLAGS_YACC += $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_HIDESYMS += $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden -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_LFLAGS += -QMAKE_LFLAGS_RELEASE += -Wl,-O1 -QMAKE_LFLAGS_DEBUG += -QMAKE_LFLAGS_APP += -QMAKE_LFLAGS_SHLIB += -shared -QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB -QMAKE_LFLAGS_SONAME += -Wl,-soname, -QMAKE_LFLAGS_THREAD += -QMAKE_LFLAGS_NOUNDEF += -Wl,--no-undefined -QMAKE_LFLAGS_RPATH = -Wl,-rpath, -QMAKE_PCH_OUTPUT_EXT = .gch +QMAKE_LINK_C = $$QMAKE_CC +QMAKE_LINK_C_SHLIB = $$QMAKE_CC -# -Bsymbolic-functions (ld) support -QMAKE_LFLAGS_BSYMBOLIC_FUNC = -Wl,-Bsymbolic-functions -QMAKE_LFLAGS_DYNAMIC_LIST = -Wl,--dynamic-list, +QMAKE_PCH_OUTPUT_EXT = .gch diff --git a/mkspecs/common/gcc-base-mac.conf b/mkspecs/common/gcc-base-mac.conf new file mode 100644 index 0000000..b65cc5e --- /dev/null +++ b/mkspecs/common/gcc-base-mac.conf @@ -0,0 +1,48 @@ +# +# Base qmake configuration for GCC on Mac OS X +# +# Before making changes to this file, please read the comment in +# gcc-base.conf, to make sure the change goes in the right place. +# +# To verify that your change has the desired effect on the final configuration +# you can use the manual test in tests/manual/mkspecs. +# + +include(gcc-base.conf) + +QMAKE_COMPILER_DEFINES += __APPLE__ __GNUC__ + +QMAKE_CFLAGS_X86 += -arch i386 +QMAKE_CFLAGS_X86_64 += -arch x86_64 +QMAKE_CFLAGS_PPC += -arch ppc +QMAKE_CFLAGS_PPC_64 += -arch ppc64 +QMAKE_CFLAGS_DWARF2 += -gdwarf-2 + +QMAKE_CXXFLAGS_X86 += $$QMAKE_CFLAGS_X86 +QMAKE_CXXFLAGS_X86_64 += $$QMAKE_CFLAGS_X86_64 +QMAKE_CXXFLAGS_PPC += $$QMAKE_CFLAGS_PPC +QMAKE_CXXFLAGS_PPC_64 += $$QMAKE_CFLAGS_PPC_64 +QMAKE_CXXFLAGS_DWARF2 += $$QMAKE_CFLAGS_DWARF2 + +QMAKE_OBJECTIVE_CFLAGS_X86 += $$QMAKE_CFLAGS_X86 +QMAKE_OBJECTIVE_CFLAGS_X86_64 += $$QMAKE_CFLAGS_X86_64 +QMAKE_OBJECTIVE_CFLAGS_PPC += $$QMAKE_CFLAGS_PPC +QMAKE_OBJECTIVE_CFLAGS_PPC_64 += $$QMAKE_CFLAGS_PPC_64 + +QMAKE_LFLAGS_X86 += $$QMAKE_CFLAGS_X86 +QMAKE_LFLAGS_X86_64 += $$QMAKE_CFLAGS_X86_64 +QMAKE_LFLAGS_PPC += $$QMAKE_CFLAGS_PPC +QMAKE_LFLAGS_PPC_64 += $$QMAKE_CFLAGS_PPC_64 + +QMAKE_LFLAGS += -headerpad_max_install_names +QMAKE_LFLAGS_SHLIB += -single_module -dynamiclib +QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB +QMAKE_LFLAGS_INCREMENTAL += -undefined suppress -flat_namespace +QMAKE_LFLAGS_SONAME += -install_name$${LITERAL_WHITESPACE} +QMAKE_LFLAGS_VERSION += -current_version$${LITERAL_WHITESPACE} +QMAKE_LFLAGS_COMPAT_VERSION += -compatibility_version$${LITERAL_WHITESPACE} + +QMAKE_OBJCFLAGS_PRECOMPILE += -x objective-c-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} +QMAKE_OBJCFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE +QMAKE_OBJCXXFLAGS_PRECOMPILE += -x objective-c++-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} +QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE diff --git a/mkspecs/common/gcc-base-unix.conf b/mkspecs/common/gcc-base-unix.conf new file mode 100644 index 0000000..dc8d7e4 --- /dev/null +++ b/mkspecs/common/gcc-base-unix.conf @@ -0,0 +1,21 @@ +# +# Base qmake configuration for GCC on *nix-systems +# +# Before making changes to this file, please read the comment in +# gcc-base.conf, to make sure the change goes in the right place. +# +# To verify that your change has the desired effect on the final configuration +# you can use the manual test in tests/manual/mkspecs. +# + +include(gcc-base.conf) + +QMAKE_LFLAGS_SHLIB += -shared +QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB +QMAKE_LFLAGS_SONAME += -Wl,-soname, +QMAKE_LFLAGS_THREAD += +QMAKE_LFLAGS_RPATH = -Wl,-rpath, + +# -Bsymbolic-functions (ld) support +QMAKE_LFLAGS_BSYMBOLIC_FUNC = -Wl,-Bsymbolic-functions +QMAKE_LFLAGS_DYNAMIC_LIST = -Wl,--dynamic-list, diff --git a/mkspecs/common/gcc-base.conf b/mkspecs/common/gcc-base.conf new file mode 100644 index 0000000..2afe9d6 --- /dev/null +++ b/mkspecs/common/gcc-base.conf @@ -0,0 +1,73 @@ +# +# This file is used as a basis for the following compilers: +# +# - The GNU C++ compiler (g++) +# - LLVM +# - Clang +# +# Platform-specific options shared by these compilers are put into: +# +# - gcc-base-mac.conf +# - gcc-base-unix.conf +# +# These base files are then combined with configurations for each compiler: +# +# - g++.conf +# - g++-mac.conf +# - g++-unix.conf +# - llvm.conf +# - clang.conf +# +# The combination happens in the top level mkspec, by including a platform- +# specific version of the base-file, for example gcc-base-mac.conf, and then +# a (possibly platform-specific) version of the actual compiler configuration, +# for example g++-mac.conf. +# +# If you are making changes to any of these files, please consider the +# possible effect it may have due to these include-rules, and whether it +# might make more sense to share the rule or make it more specific. +# +# To verify that your change has the desired effect on the final configuration +# you can use the manual test in tests/manual/mkspecs. +# + +# Allow including configurations to override +isEmpty(QMAKE_CC): QMAKE_CC = gcc + +QMAKE_CFLAGS += -pipe +QMAKE_CFLAGS_DEPS += -M +QMAKE_CFLAGS_WARN_ON += -Wall -W +QMAKE_CFLAGS_WARN_OFF += -w +QMAKE_CFLAGS_RELEASE += -O2 +QMAKE_CFLAGS_DEBUG += -g +QMAKE_CFLAGS_SHLIB += -fPIC +QMAKE_CFLAGS_STATIC_LIB += -fPIC +QMAKE_CFLAGS_YACC += -Wno-unused -Wno-parentheses +QMAKE_CFLAGS_HIDESYMS += -fvisibility=hidden +QMAKE_CFLAGS_PRECOMPILE += -x c-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} +QMAKE_CFLAGS_USE_PRECOMPILE += -include ${QMAKE_PCH_OUTPUT_BASE} + +isEmpty(QMAKE_CXX): QMAKE_CXX = g++ + +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS +QMAKE_CXXFLAGS_DEPS += $$QMAKE_CFLAGS_DEPS +QMAKE_CXXFLAGS_WARN_ON += $$QMAKE_CFLAGS_WARN_ON +QMAKE_CXXFLAGS_WARN_OFF += $$QMAKE_CFLAGS_WARN_OFF +QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE +QMAKE_CXXFLAGS_DEBUG += $$QMAKE_CFLAGS_DEBUG +QMAKE_CXXFLAGS_SHLIB += $$QMAKE_CFLAGS_SHLIB +QMAKE_CXXFLAGS_STATIC_LIB += $$QMAKE_CFLAGS_STATIC_LIB +QMAKE_CXXFLAGS_YACC += $$QMAKE_CFLAGS_YACC +QMAKE_CXXFLAGS_HIDESYMS += $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden +QMAKE_CXXFLAGS_PRECOMPILE += -x c++-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} + +QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE + +QMAKE_LINK = $$QMAKE_CXX +QMAKE_LINK_SHLIB = $$QMAKE_CXX + +QMAKE_LFLAGS += +QMAKE_LFLAGS_DEBUG += +QMAKE_LFLAGS_APP += +QMAKE_LFLAGS_RELEASE += + diff --git a/mkspecs/common/llvm.conf b/mkspecs/common/llvm.conf index 70f52aa..4e54703 100644 --- a/mkspecs/common/llvm.conf +++ b/mkspecs/common/llvm.conf @@ -1,49 +1,8 @@ # -# qmake configuration for common gcc +# Qmake configuration for LLVM on Linux and Mac # -QMAKE_CC = llvm-gcc -QMAKE_CFLAGS += -pipe -QMAKE_CFLAGS_DEPS += -M -QMAKE_CFLAGS_WARN_ON += -Wall -W -QMAKE_CFLAGS_WARN_OFF += -w -QMAKE_CFLAGS_RELEASE += -O2 -QMAKE_CFLAGS_DEBUG += -g -QMAKE_CFLAGS_SHLIB += -fPIC -QMAKE_CFLAGS_STATIC_LIB += -fPIC -QMAKE_CFLAGS_YACC += -Wno-unused -Wno-parentheses -QMAKE_CFLAGS_HIDESYMS += -fvisibility=hidden -QMAKE_CFLAGS_PRECOMPILE += -x c-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} -QMAKE_CFLAGS_USE_PRECOMPILE += -include ${QMAKE_PCH_OUTPUT_BASE} +QMAKE_CC = llvm-gcc +QMAKE_CXX = llvm-g++ -QMAKE_CXX = llvm-g++ -QMAKE_CXXFLAGS += $$QMAKE_CFLAGS -QMAKE_CXXFLAGS_DEPS += $$QMAKE_CFLAGS_DEPS -QMAKE_CXXFLAGS_WARN_ON += $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF += $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG += $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_SHLIB += $$QMAKE_CFLAGS_SHLIB -QMAKE_CXXFLAGS_STATIC_LIB += $$QMAKE_CFLAGS_STATIC_LIB -QMAKE_CXXFLAGS_YACC += $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_HIDESYMS += $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden -QMAKE_CXXFLAGS_PRECOMPILE += -x c++-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} -QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE - -QMAKE_LINK = llvm-g++ -QMAKE_LINK_SHLIB = llvm-g++ -QMAKE_LFLAGS += -QMAKE_LFLAGS_RELEASE += -QMAKE_LFLAGS_DEBUG += -QMAKE_LFLAGS_APP += -QMAKE_LFLAGS_SHLIB += -shared -QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB -QMAKE_LFLAGS_SONAME += -Wl,-soname, -QMAKE_LFLAGS_THREAD += -QMAKE_LFLAGS_RPATH = -Wl,-rpath, - -QMAKE_PCH_OUTPUT_EXT = .gch - -# -Bsymbolic-functions (ld) support -QMAKE_LFLAGS_BSYMBOLIC_FUNC = -Wl,-Bsymbolic-functions -QMAKE_LFLAGS_DYNAMIC_LIST = -Wl,--dynamic-list, +QMAKE_PCH_OUTPUT_EXT = .gch diff --git a/mkspecs/common/mac-g++.conf b/mkspecs/common/mac-g++.conf deleted file mode 100644 index 29b7408..0000000 --- a/mkspecs/common/mac-g++.conf +++ /dev/null @@ -1,81 +0,0 @@ -# -# qmake configuration for common gcc on Mac OS X -# - -include(mac.conf) - -QMAKE_COMPILER_DEFINES += __APPLE__ __GNUC__ -QMAKE_CFLAGS += -pipe -QMAKE_CFLAGS_DEPS += -M -QMAKE_CFLAGS_WARN_ON += -Wall -W -QMAKE_CFLAGS_WARN_OFF += -w -QMAKE_CFLAGS_RELEASE += -O2 -QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -g -gdwarf-2 -QMAKE_CFLAGS_DEBUG += -g -QMAKE_CFLAGS_SHLIB += -fPIC -QMAKE_CFLAGS_STATIC_LIB += -fPIC -QMAKE_CFLAGS_YACC += -Wno-unused -Wno-parentheses -QMAKE_CFLAGS_HIDESYMS += -fvisibility=hidden -QMAKE_CFLAGS_PRECOMPILE += -x c-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} -QMAKE_CFLAGS_USE_PRECOMPILE += -include ${QMAKE_PCH_OUTPUT_BASE} - -QMAKE_CFLAGS_PPC_64 += -arch ppc64 -Xarch_ppc64 -mmacosx-version-min=10.5 -QMAKE_OBJECTIVE_CFLAGS_PPC_64 += -arch ppc64 -Xarch_ppc64 -mmacosx-version-min=10.5 -QMAKE_CFLAGS_X86_64 += -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -QMAKE_OBJECTIVE_CFLAGS_X86_64 += -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -QMAKE_CFLAGS_PPC += -arch ppc -QMAKE_OBJECTIVE_CFLAGS_PPC += -arch ppc -QMAKE_CFLAGS_X86 += -arch i386 -QMAKE_OBJECTIVE_CFLAGS_X86 += -arch i386 -QMAKE_CFLAGS_DWARF2 += -gdwarf-2 - -QMAKE_CXXFLAGS += $$QMAKE_CFLAGS -QMAKE_CXXFLAGS_DEPS += $$QMAKE_CFLAGS_DEPS -QMAKE_CXXFLAGS_WARN_ON += $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF += $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO -QMAKE_CXXFLAGS_DEBUG += $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_SHLIB += $$QMAKE_CFLAGS_SHLIB -QMAKE_CXXFLAGS_STATIC_LIB += $$QMAKE_CFLAGS_STATIC_LIB -QMAKE_CXXFLAGS_YACC += $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_HIDESYMS += $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden -QMAKE_CXXFLAGS_PPC_64 += -arch ppc64 -Xarch_ppc64 -mmacosx-version-min=10.5 -QMAKE_CXXFLAGS_X86_64 += -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -QMAKE_CXXFLAGS_PPC += -arch ppc -QMAKE_CXXFLAGS_X86 += -arch i386 -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 = $$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_RELEASE_WITH_DEBUGINFO += -g -gdwarf-2 -QMAKE_LFLAGS_DEBUG += -QMAKE_LFLAGS_APP += -QMAKE_LFLAGS_SHLIB += -single_module -dynamiclib -QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB -QMAKE_LFLAGS_THREAD += -QMAKE_LFLAGS_INCREMENTAL+= -undefined suppress -flat_namespace -QMAKE_LFLAGS_SONAME += -install_name$${LITERAL_WHITESPACE} -QMAKE_LFLAGS_PPC_64 += -arch ppc64 -Xarch_ppc64 -mmacosx-version-min=10.5 -QMAKE_LFLAGS_X86_64 += -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -QMAKE_LFLAGS_PPC += -arch ppc -QMAKE_LFLAGS_X86 += -arch i386 -QMAKE_LFLAGS_VERSION += -current_version$${LITERAL_WHITESPACE} -QMAKE_LFLAGS_COMPAT_VERSION += -compatibility_version$${LITERAL_WHITESPACE} -# -all_load requred to make Objective-C categories work in static builds. -QMAKE_LFLAGS_STATIC_LIB += -all_load -QMAKE_LFLAGS_RPATH += - -QMAKE_PCH_OUTPUT_EXT = .gch - -QMAKE_OBJCFLAGS_PRECOMPILE += -x objective-c-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} -QMAKE_OBJCFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE - -QMAKE_OBJCXXFLAGS_PRECOMPILE += -x objective-c++-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} -QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE diff --git a/mkspecs/common/mac-llvm.conf b/mkspecs/common/mac-llvm.conf deleted file mode 100644 index 4ff088c..0000000 --- a/mkspecs/common/mac-llvm.conf +++ /dev/null @@ -1,76 +0,0 @@ -# -# qmake configuration for common gcc on Mac OS X -# - -include(mac.conf) - -QMAKE_COMPILER_DEFINES += __APPLE__ __GNUC__ -QMAKE_CC = llvm-gcc -QMAKE_CFLAGS += -pipe -QMAKE_CFLAGS_DEPS += -M -QMAKE_CFLAGS_WARN_ON += -Wall -W -QMAKE_CFLAGS_WARN_OFF += -w -QMAKE_CFLAGS_RELEASE += -O2 -QMAKE_CFLAGS_DEBUG += -g -QMAKE_CFLAGS_SHLIB += -fPIC -QMAKE_CFLAGS_STATIC_LIB += -fPIC -QMAKE_CFLAGS_YACC += -Wno-unused -Wno-parentheses -QMAKE_CFLAGS_HIDESYMS += -fvisibility=hidden -QMAKE_CFLAGS_PRECOMPILE += -x c-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} -QMAKE_CFLAGS_USE_PRECOMPILE += -include ${QMAKE_PCH_OUTPUT_BASE} - -QMAKE_CFLAGS_PPC_64 += -arch ppc64 -QMAKE_OBJECTIVE_CFLAGS_PPC_64 += -arch ppc64 -QMAKE_CFLAGS_X86_64 += -arch x86_64 -QMAKE_OBJECTIVE_CFLAGS_X86_64 += -arch x86_64 -QMAKE_CFLAGS_PPC += -arch ppc -QMAKE_OBJECTIVE_CFLAGS_PPC += -arch ppc -QMAKE_CFLAGS_X86 += -arch i386 -QMAKE_OBJECTIVE_CFLAGS_X86 += -arch i386 -QMAKE_CFLAGS_DWARF2 += -gdwarf-2 - -QMAKE_CXX = llvm-g++ -QMAKE_CXXFLAGS += $$QMAKE_CFLAGS -QMAKE_CXXFLAGS_DEPS += $$QMAKE_CFLAGS_DEPS -QMAKE_CXXFLAGS_WARN_ON += $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF += $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG += $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_SHLIB += $$QMAKE_CFLAGS_SHLIB -QMAKE_CXXFLAGS_STATIC_LIB += $$QMAKE_CFLAGS_STATIC_LIB -QMAKE_CXXFLAGS_YACC += $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_HIDESYMS += $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden -QMAKE_CXXFLAGS_PPC_64 += -arch ppc64 -QMAKE_CXXFLAGS_X86_64 += -arch x86_64 -QMAKE_CXXFLAGS_PPC += -arch ppc -QMAKE_CXXFLAGS_X86 += -arch i386 -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 = $$QMAKE_CXX -QMAKE_LINK_SHLIB = $$QMAKE_CXX -QMAKE_LFLAGS += -headerpad_max_install_names -QMAKE_LFLAGS_RELEASE += -QMAKE_LFLAGS_DEBUG += -QMAKE_LFLAGS_APP += -QMAKE_LFLAGS_SHLIB += -single_module -dynamiclib -QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB -QMAKE_LFLAGS_THREAD += -QMAKE_LFLAGS_INCREMENTAL+= -undefined suppress -flat_namespace -QMAKE_LFLAGS_SONAME += -install_name$${LITERAL_WHITESPACE} -QMAKE_LFLAGS_PPC_64 += -arch ppc64 -QMAKE_LFLAGS_X86_64 += -arch x86_64 -QMAKE_LFLAGS_PPC += -arch ppc -QMAKE_LFLAGS_X86 += -arch i386 -QMAKE_LFLAGS_VERSION += -current_version$${LITERAL_WHITESPACE} -QMAKE_LFLAGS_COMPAT_VERSION += -compatibility_version$${LITERAL_WHITESPACE} -QMAKE_LFLAGS_RPATH += - -QMAKE_PCH_OUTPUT_EXT = .gch - -QMAKE_OBJCFLAGS_PRECOMPILE += -x objective-c-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} -QMAKE_OBJCFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE - -QMAKE_OBJCXXFLAGS_PRECOMPILE += -x objective-c++-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} -QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE diff --git a/mkspecs/common/mac/qplatformdefs.h b/mkspecs/common/mac/qplatformdefs.h new file mode 100644 index 0000000..99d64ef --- /dev/null +++ b/mkspecs/common/mac/qplatformdefs.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMDEFS_H +#define QPLATFORMDEFS_H + +// Get Qt defines/settings + +#include "qglobal.h" + +// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs + +#include + + +// We are hot - unistd.h should have turned on the specific APIs we requested + + +#include +#include +#include +#include +#include +#include +#define QT_NO_LIBRARY_UNLOAD + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef QT_NO_IPV6IFNAME +#include +#endif + +#include "../common/posix/qplatformdefs.h" + +#undef QT_OPEN_LARGEFILE +#undef QT_SOCKLEN_T +#undef QT_SIGNAL_IGNORE + +#define QT_OPEN_LARGEFILE 0 + +#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) +#define QT_SOCKLEN_T socklen_t +#else +#define QT_SOCKLEN_T int +#endif + +#define QT_SIGNAL_IGNORE (void (*)(int))1 + +#define QT_SNPRINTF ::snprintf +#define QT_VSNPRINTF ::vsnprintf + +#endif // QPLATFORMDEFS_H diff --git a/mkspecs/freebsd-g++/qmake.conf b/mkspecs/freebsd-g++/qmake.conf index 9de93d4..9d7c443 100644 --- a/mkspecs/freebsd-g++/qmake.conf +++ b/mkspecs/freebsd-g++/qmake.conf @@ -48,6 +48,7 @@ QMAKE_DEL_FILE = rm -f QMAKE_DEL_DIR = rmdir QMAKE_CHK_DIR_EXISTS = test -d QMAKE_MKDIR = mkdir -p -include(../common/g++.conf) include(../common/unix.conf) +include(../common/gcc-base-unix.conf) +include(../common/g++-unix.conf) load(qt_config) diff --git a/mkspecs/linux-g++-32/qmake.conf b/mkspecs/linux-g++-32/qmake.conf index f425c0d..cdf8914 100644 --- a/mkspecs/linux-g++-32/qmake.conf +++ b/mkspecs/linux-g++-32/qmake.conf @@ -12,6 +12,7 @@ QMAKE_INCREMENTAL_STYLE = sublib QMAKE_CFLAGS = -m32 QMAKE_LFLAGS = -m32 -include(../common/g++.conf) include(../common/linux.conf) +include(../common/gcc-base-unix.conf) +include(../common/g++-unix.conf) load(qt_config) diff --git a/mkspecs/linux-g++-64/qmake.conf b/mkspecs/linux-g++-64/qmake.conf index b8877a9..222f6b7 100644 --- a/mkspecs/linux-g++-64/qmake.conf +++ b/mkspecs/linux-g++-64/qmake.conf @@ -15,8 +15,10 @@ QMAKE_INCREMENTAL_STYLE = sublib QMAKE_CFLAGS = -m64 QMAKE_LFLAGS = -m64 -include(../common/g++.conf) include(../common/linux.conf) +include(../common/gcc-base-unix.conf) +include(../common/g++-unix.conf) + QMAKE_LIBDIR_X11 = /usr/X11R6/lib64 QMAKE_LIBDIR_OPENGL = /usr/X11R6/lib64 diff --git a/mkspecs/linux-g++-maemo/qmake.conf b/mkspecs/linux-g++-maemo/qmake.conf index 8f85c54..d91db07 100644 --- a/mkspecs/linux-g++-maemo/qmake.conf +++ b/mkspecs/linux-g++-maemo/qmake.conf @@ -10,8 +10,9 @@ CONFIG += nostrip QT += core gui QMAKE_INCREMENTAL_STYLE = sublib -include(../common/g++.conf) include(../common/linux.conf) +include(../common/gcc-base-unix.conf) +include(../common/g++-unix.conf) # Override the default lib/include directories for scratchbox: diff --git a/mkspecs/linux-g++/qmake.conf b/mkspecs/linux-g++/qmake.conf index d772b5e..00df894 100644 --- a/mkspecs/linux-g++/qmake.conf +++ b/mkspecs/linux-g++/qmake.conf @@ -9,6 +9,7 @@ CONFIG += qt warn_on release incremental link_prl gdb_dwarf_index QT += core gui QMAKE_INCREMENTAL_STYLE = sublib -include(../common/g++.conf) include(../common/linux.conf) +include(../common/gcc-base-unix.conf) +include(../common/g++-unix.conf) load(qt_config) diff --git a/mkspecs/linux-llvm/qmake.conf b/mkspecs/linux-llvm/qmake.conf index 77f8d81..17db1bb 100644 --- a/mkspecs/linux-llvm/qmake.conf +++ b/mkspecs/linux-llvm/qmake.conf @@ -9,6 +9,7 @@ CONFIG += qt warn_on release incremental link_prl gdb_dwarf_index QT += core gui QMAKE_INCREMENTAL_STYLE = sublib -include(../common/llvm.conf) include(../common/linux.conf) +include(../common/llvm.conf) +include(../common/gcc-base-unix.conf) load(qt_config) diff --git a/mkspecs/macx-g++/qmake.conf b/mkspecs/macx-g++/qmake.conf index 4464686..fd36b70 100644 --- a/mkspecs/macx-g++/qmake.conf +++ b/mkspecs/macx-g++/qmake.conf @@ -16,6 +16,7 @@ QMAKE_INCREMENTAL_STYLE = sublib QMAKE_CC = gcc QMAKE_CXX = g++ -include(../common/mac-g++.conf) - +include(../common/mac.conf) +include(../common/gcc-base-mac.conf) +include(../common/g++-mac.conf) load(qt_config) diff --git a/mkspecs/macx-g++/qplatformdefs.h b/mkspecs/macx-g++/qplatformdefs.h index 99d64ef..5bdef57 100644 --- a/mkspecs/macx-g++/qplatformdefs.h +++ b/mkspecs/macx-g++/qplatformdefs.h @@ -39,59 +39,5 @@ ** ****************************************************************************/ -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H +#include "../common/mac/qplatformdefs.h" -// Get Qt defines/settings - -#include "qglobal.h" - -// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs - -#include - - -// We are hot - unistd.h should have turned on the specific APIs we requested - - -#include -#include -#include -#include -#include -#include -#define QT_NO_LIBRARY_UNLOAD - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef QT_NO_IPV6IFNAME -#include -#endif - -#include "../common/posix/qplatformdefs.h" - -#undef QT_OPEN_LARGEFILE -#undef QT_SOCKLEN_T -#undef QT_SIGNAL_IGNORE - -#define QT_OPEN_LARGEFILE 0 - -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) -#define QT_SOCKLEN_T socklen_t -#else -#define QT_SOCKLEN_T int -#endif - -#define QT_SIGNAL_IGNORE (void (*)(int))1 - -#define QT_SNPRINTF ::snprintf -#define QT_VSNPRINTF ::vsnprintf - -#endif // QPLATFORMDEFS_H diff --git a/mkspecs/macx-g++40/qmake.conf b/mkspecs/macx-g++40/qmake.conf index 784f5fc..cfdd724 100644 --- a/mkspecs/macx-g++40/qmake.conf +++ b/mkspecs/macx-g++40/qmake.conf @@ -16,6 +16,8 @@ QMAKE_INCREMENTAL_STYLE = sublib QMAKE_CC = gcc-4.0 QMAKE_CXX = g++-4.0 -include(../common/mac-g++.conf) +include(../common/mac.conf) +include(../common/gcc-base-mac.conf) +include(../common/g++-mac.conf) load(qt_config) diff --git a/mkspecs/macx-g++40/qplatformdefs.h b/mkspecs/macx-g++40/qplatformdefs.h index 99d64ef..5bdef57 100644 --- a/mkspecs/macx-g++40/qplatformdefs.h +++ b/mkspecs/macx-g++40/qplatformdefs.h @@ -39,59 +39,5 @@ ** ****************************************************************************/ -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H +#include "../common/mac/qplatformdefs.h" -// Get Qt defines/settings - -#include "qglobal.h" - -// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs - -#include - - -// We are hot - unistd.h should have turned on the specific APIs we requested - - -#include -#include -#include -#include -#include -#include -#define QT_NO_LIBRARY_UNLOAD - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef QT_NO_IPV6IFNAME -#include -#endif - -#include "../common/posix/qplatformdefs.h" - -#undef QT_OPEN_LARGEFILE -#undef QT_SOCKLEN_T -#undef QT_SIGNAL_IGNORE - -#define QT_OPEN_LARGEFILE 0 - -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) -#define QT_SOCKLEN_T socklen_t -#else -#define QT_SOCKLEN_T int -#endif - -#define QT_SIGNAL_IGNORE (void (*)(int))1 - -#define QT_SNPRINTF ::snprintf -#define QT_VSNPRINTF ::vsnprintf - -#endif // QPLATFORMDEFS_H diff --git a/mkspecs/macx-g++42/qmake.conf b/mkspecs/macx-g++42/qmake.conf index fb93697..08305ba 100644 --- a/mkspecs/macx-g++42/qmake.conf +++ b/mkspecs/macx-g++42/qmake.conf @@ -16,6 +16,8 @@ QMAKE_INCREMENTAL_STYLE = sublib QMAKE_CC = gcc-4.2 QMAKE_CXX = g++-4.2 -include(../common/mac-g++.conf) +include(../common/mac.conf) +include(../common/gcc-base-mac.conf) +include(../common/g++-mac.conf) load(qt_config) diff --git a/mkspecs/macx-g++42/qplatformdefs.h b/mkspecs/macx-g++42/qplatformdefs.h index 99d64ef..5bdef57 100644 --- a/mkspecs/macx-g++42/qplatformdefs.h +++ b/mkspecs/macx-g++42/qplatformdefs.h @@ -39,59 +39,5 @@ ** ****************************************************************************/ -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H +#include "../common/mac/qplatformdefs.h" -// Get Qt defines/settings - -#include "qglobal.h" - -// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs - -#include - - -// We are hot - unistd.h should have turned on the specific APIs we requested - - -#include -#include -#include -#include -#include -#include -#define QT_NO_LIBRARY_UNLOAD - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef QT_NO_IPV6IFNAME -#include -#endif - -#include "../common/posix/qplatformdefs.h" - -#undef QT_OPEN_LARGEFILE -#undef QT_SOCKLEN_T -#undef QT_SIGNAL_IGNORE - -#define QT_OPEN_LARGEFILE 0 - -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) -#define QT_SOCKLEN_T socklen_t -#else -#define QT_SOCKLEN_T int -#endif - -#define QT_SIGNAL_IGNORE (void (*)(int))1 - -#define QT_SNPRINTF ::snprintf -#define QT_VSNPRINTF ::vsnprintf - -#endif // QPLATFORMDEFS_H diff --git a/mkspecs/macx-icc/qplatformdefs.h b/mkspecs/macx-icc/qplatformdefs.h index d46381c..5bdef57 100644 --- a/mkspecs/macx-icc/qplatformdefs.h +++ b/mkspecs/macx-icc/qplatformdefs.h @@ -39,5 +39,5 @@ ** ****************************************************************************/ -#include "../macx-g++/qplatformdefs.h" +#include "../common/mac/qplatformdefs.h" diff --git a/mkspecs/macx-llvm/qmake.conf b/mkspecs/macx-llvm/qmake.conf index d46baea..0064fb0 100644 --- a/mkspecs/macx-llvm/qmake.conf +++ b/mkspecs/macx-llvm/qmake.conf @@ -13,6 +13,8 @@ CONFIG += qt warn_on release app_bundle incremental global_init_link_order lib QT += core gui QMAKE_INCREMENTAL_STYLE = sublib -include(../common/mac-llvm.conf) +include(../common/mac.conf) +include(../common/llvm.conf) +include(../common/gcc-base-mac.conf) load(qt_config) diff --git a/mkspecs/macx-llvm/qplatformdefs.h b/mkspecs/macx-llvm/qplatformdefs.h index 99d64ef..5bdef57 100644 --- a/mkspecs/macx-llvm/qplatformdefs.h +++ b/mkspecs/macx-llvm/qplatformdefs.h @@ -39,59 +39,5 @@ ** ****************************************************************************/ -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H +#include "../common/mac/qplatformdefs.h" -// Get Qt defines/settings - -#include "qglobal.h" - -// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs - -#include - - -// We are hot - unistd.h should have turned on the specific APIs we requested - - -#include -#include -#include -#include -#include -#include -#define QT_NO_LIBRARY_UNLOAD - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef QT_NO_IPV6IFNAME -#include -#endif - -#include "../common/posix/qplatformdefs.h" - -#undef QT_OPEN_LARGEFILE -#undef QT_SOCKLEN_T -#undef QT_SIGNAL_IGNORE - -#define QT_OPEN_LARGEFILE 0 - -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) -#define QT_SOCKLEN_T socklen_t -#else -#define QT_SOCKLEN_T int -#endif - -#define QT_SIGNAL_IGNORE (void (*)(int))1 - -#define QT_SNPRINTF ::snprintf -#define QT_VSNPRINTF ::vsnprintf - -#endif // QPLATFORMDEFS_H diff --git a/mkspecs/macx-xcode/qmake.conf b/mkspecs/macx-xcode/qmake.conf index 3a4a500..dc79b3d 100755 --- a/mkspecs/macx-xcode/qmake.conf +++ b/mkspecs/macx-xcode/qmake.conf @@ -9,10 +9,16 @@ TEMPLATE = app CONFIG += qt warn_on release lib_version_first incremental plugin_no_soname link_prl app_bundle QT += core gui -include(../common/mac-g++.conf) +include(../common/mac.conf) +include(../common/gcc-base-mac.conf) +include(../common/g++-mac.conf) -QMAKE_CC = -QMAKE_CXX = +QMAKE_CC = +QMAKE_CXX = +QMAKE_LINK = +QMAKE_LINK_C = +QMAKE_LINK_C_SHLIB = +QMAKE_LINK_SHLIB = QMAKE_CFLAGS_HIDESYMS = QMAKE_CFLAGS_PPC_64 = QMAKE_CFLAGS_X86_64 = diff --git a/mkspecs/macx-xcode/qplatformdefs.h b/mkspecs/macx-xcode/qplatformdefs.h index 99d64ef..5bdef57 100644 --- a/mkspecs/macx-xcode/qplatformdefs.h +++ b/mkspecs/macx-xcode/qplatformdefs.h @@ -39,59 +39,5 @@ ** ****************************************************************************/ -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H +#include "../common/mac/qplatformdefs.h" -// Get Qt defines/settings - -#include "qglobal.h" - -// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs - -#include - - -// We are hot - unistd.h should have turned on the specific APIs we requested - - -#include -#include -#include -#include -#include -#include -#define QT_NO_LIBRARY_UNLOAD - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef QT_NO_IPV6IFNAME -#include -#endif - -#include "../common/posix/qplatformdefs.h" - -#undef QT_OPEN_LARGEFILE -#undef QT_SOCKLEN_T -#undef QT_SIGNAL_IGNORE - -#define QT_OPEN_LARGEFILE 0 - -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) -#define QT_SOCKLEN_T socklen_t -#else -#define QT_SOCKLEN_T int -#endif - -#define QT_SIGNAL_IGNORE (void (*)(int))1 - -#define QT_SNPRINTF ::snprintf -#define QT_VSNPRINTF ::vsnprintf - -#endif // QPLATFORMDEFS_H diff --git a/mkspecs/qws/linux-arm-g++/qmake.conf b/mkspecs/qws/linux-arm-g++/qmake.conf index 7e0a3b4..7b37813 100644 --- a/mkspecs/qws/linux-arm-g++/qmake.conf +++ b/mkspecs/qws/linux-arm-g++/qmake.conf @@ -2,8 +2,9 @@ # qmake configuration for building with arm-linux-g++ # -include(../../common/g++.conf) include(../../common/linux.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) include(../../common/qws.conf) # modifications to g++.conf diff --git a/mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf b/mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf index 3611421..e1ad837 100644 --- a/mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf +++ b/mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf @@ -2,8 +2,9 @@ # qmake configuration for building with arm-none-linux-gnueabi-g++ # -include(../../common/g++.conf) include(../../common/linux.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) include(../../common/qws.conf) # modifications to g++.conf diff --git a/mkspecs/qws/linux-armv6-g++/qmake.conf b/mkspecs/qws/linux-armv6-g++/qmake.conf index cd7ecca..0e2473c 100644 --- a/mkspecs/qws/linux-armv6-g++/qmake.conf +++ b/mkspecs/qws/linux-armv6-g++/qmake.conf @@ -2,8 +2,9 @@ # qmake configuration for building for ARMv6 devices with arm-linux-g++ # -include(../../common/g++.conf) include(../../common/linux.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) include(../../common/qws.conf) # modifications to g++.conf diff --git a/mkspecs/qws/linux-avr32-g++/qmake.conf b/mkspecs/qws/linux-avr32-g++/qmake.conf index 057c938..32c0444 100644 --- a/mkspecs/qws/linux-avr32-g++/qmake.conf +++ b/mkspecs/qws/linux-avr32-g++/qmake.conf @@ -2,8 +2,9 @@ # qmake configuration for building with avr32-linux-g++ # -include(../../common/g++.conf) include(../../common/linux.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) include(../../common/qws.conf) # modifications to g++.conf diff --git a/mkspecs/qws/linux-cellon-g++/qmake.conf b/mkspecs/qws/linux-cellon-g++/qmake.conf index 363a3ce..ad66c3c 100644 --- a/mkspecs/qws/linux-cellon-g++/qmake.conf +++ b/mkspecs/qws/linux-cellon-g++/qmake.conf @@ -6,8 +6,9 @@ # qmake configuration for building with arm-linux-g++ # -include(../../common/g++.conf) include(../../common/linux.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) include(../../common/qws.conf) # modifications to g++.conf diff --git a/mkspecs/qws/linux-dm7000-g++/qmake.conf b/mkspecs/qws/linux-dm7000-g++/qmake.conf index aea2647..c897091 100644 --- a/mkspecs/qws/linux-dm7000-g++/qmake.conf +++ b/mkspecs/qws/linux-dm7000-g++/qmake.conf @@ -2,8 +2,9 @@ # qmake configuration for linux-dm7000-g++, for Dream Multimedia's DM7000S # -include(../../common/g++.conf) include(../../common/linux.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) include(../../common/qws.conf) # modifications to g++.conf diff --git a/mkspecs/qws/linux-dm800-g++/qmake.conf b/mkspecs/qws/linux-dm800-g++/qmake.conf index fca93b4..002e4c7 100644 --- a/mkspecs/qws/linux-dm800-g++/qmake.conf +++ b/mkspecs/qws/linux-dm800-g++/qmake.conf @@ -2,8 +2,9 @@ # qmake configuration for linux-dm800-g++, for Dream Multimedia's DM800 # -include(../../common/g++.conf) include(../../common/linux.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) include(../../common/qws.conf) # modifications to g++.conf diff --git a/mkspecs/qws/linux-generic-g++-32/qmake.conf b/mkspecs/qws/linux-generic-g++-32/qmake.conf index 81af4ab..249c10aa 100644 --- a/mkspecs/qws/linux-generic-g++-32/qmake.conf +++ b/mkspecs/qws/linux-generic-g++-32/qmake.conf @@ -2,8 +2,9 @@ # qmake configuration for building with arm-linux-g++ # -include(../../common/g++.conf) include(../../common/linux.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) include(../../common/qws.conf) # modifications to g++.conf diff --git a/mkspecs/qws/linux-generic-g++/qmake.conf b/mkspecs/qws/linux-generic-g++/qmake.conf index a026e88..e803d0d 100644 --- a/mkspecs/qws/linux-generic-g++/qmake.conf +++ b/mkspecs/qws/linux-generic-g++/qmake.conf @@ -2,8 +2,9 @@ # qmake configuration for building with g++ # -include(../../common/g++.conf) include(../../common/linux.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) include(../../common/qws.conf) load(qt_config) diff --git a/mkspecs/qws/linux-ipaq-g++/qmake.conf b/mkspecs/qws/linux-ipaq-g++/qmake.conf index 59f4e6e..f9d33b3 100644 --- a/mkspecs/qws/linux-ipaq-g++/qmake.conf +++ b/mkspecs/qws/linux-ipaq-g++/qmake.conf @@ -2,8 +2,9 @@ # qmake configuration for building with arm-linux-g++ # -include(../../common/g++.conf) include(../../common/linux.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) include(../../common/qws.conf) # modifications to g++.conf diff --git a/mkspecs/qws/linux-lsb-g++/qmake.conf b/mkspecs/qws/linux-lsb-g++/qmake.conf index 8b66228..4b35925 100644 --- a/mkspecs/qws/linux-lsb-g++/qmake.conf +++ b/mkspecs/qws/linux-lsb-g++/qmake.conf @@ -3,10 +3,12 @@ # -include(../../common/g++.conf) include(../../common/linux.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) include(../../common/qws.conf) + QMAKE_LSB = 1 # modifications to g++.conf diff --git a/mkspecs/qws/linux-mips-g++/qmake.conf b/mkspecs/qws/linux-mips-g++/qmake.conf index 3c55342..1a86078 100644 --- a/mkspecs/qws/linux-mips-g++/qmake.conf +++ b/mkspecs/qws/linux-mips-g++/qmake.conf @@ -2,8 +2,9 @@ # qmake configuration for building with mipsel-linux-g++ # -include(../../common/g++.conf) include(../../common/linux.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) include(../../common/qws.conf) # modifications to g++.conf diff --git a/mkspecs/qws/linux-powerpc-g++/qmake.conf b/mkspecs/qws/linux-powerpc-g++/qmake.conf index e1926b4..6a6310a 100644 --- a/mkspecs/qws/linux-powerpc-g++/qmake.conf +++ b/mkspecs/qws/linux-powerpc-g++/qmake.conf @@ -2,8 +2,9 @@ # qmake configuration for building with g++ # -include(../../common/g++.conf) include(../../common/linux.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) include(../../common/qws.conf) # modifications to g++.conf diff --git a/mkspecs/qws/linux-sh-g++/qmake.conf b/mkspecs/qws/linux-sh-g++/qmake.conf index 61b57a3..004780a 100644 --- a/mkspecs/qws/linux-sh-g++/qmake.conf +++ b/mkspecs/qws/linux-sh-g++/qmake.conf @@ -2,8 +2,9 @@ # qmake configuration for building for SH devices with sh3-linux-g++ # -include(../../common/g++.conf) include(../../common/linux.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) include(../../common/qws.conf) # modifications to g++.conf diff --git a/mkspecs/qws/linux-sh4al-g++/qmake.conf b/mkspecs/qws/linux-sh4al-g++/qmake.conf index 9caebdf..71f6b3d 100644 --- a/mkspecs/qws/linux-sh4al-g++/qmake.conf +++ b/mkspecs/qws/linux-sh4al-g++/qmake.conf @@ -2,8 +2,9 @@ # qmake configuration for building for SH4AL-DSP devices with sh3-linux-g++ # -include(../../common/g++.conf) include(../../common/linux.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) include(../../common/qws.conf) # modifications to g++.conf diff --git a/mkspecs/qws/linux-sharp-g++/qmake.conf b/mkspecs/qws/linux-sharp-g++/qmake.conf index 083e4e8..6a000b9 100644 --- a/mkspecs/qws/linux-sharp-g++/qmake.conf +++ b/mkspecs/qws/linux-sharp-g++/qmake.conf @@ -2,8 +2,9 @@ # qmake configuration for building with arm-linux-g++ # -include(../../common/g++.conf) include(../../common/linux.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) include(../../common/qws.conf) # modifications to g++.conf diff --git a/mkspecs/qws/linux-x86-g++/qmake.conf b/mkspecs/qws/linux-x86-g++/qmake.conf index 7e28d4e..55011ec 100644 --- a/mkspecs/qws/linux-x86-g++/qmake.conf +++ b/mkspecs/qws/linux-x86-g++/qmake.conf @@ -2,8 +2,9 @@ # qmake configuration for building with linux-g++ # -include(../../common/g++.conf) include(../../common/linux.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) include(../../common/qws.conf) load(qt_config) diff --git a/mkspecs/qws/linux-x86_64-g++/qmake.conf b/mkspecs/qws/linux-x86_64-g++/qmake.conf index d4e6189..e18d055 100644 --- a/mkspecs/qws/linux-x86_64-g++/qmake.conf +++ b/mkspecs/qws/linux-x86_64-g++/qmake.conf @@ -2,8 +2,9 @@ # qmake configuration for building with linux-g++ # -include(../../common/g++.conf) include(../../common/linux.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) include(../../common/qws.conf) # modifications to g++.conf diff --git a/mkspecs/qws/linux-zylonite-g++/qmake.conf b/mkspecs/qws/linux-zylonite-g++/qmake.conf index 97ae600..f50b70f 100644 --- a/mkspecs/qws/linux-zylonite-g++/qmake.conf +++ b/mkspecs/qws/linux-zylonite-g++/qmake.conf @@ -2,8 +2,9 @@ # qmake configuration for building with arm-linux-g++ # -include(../../common/g++.conf) include(../../common/linux.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) include(../../common/qws.conf) # modifications to g++.conf diff --git a/mkspecs/symbian/linux-gcce/qmake.conf b/mkspecs/symbian/linux-gcce/qmake.conf index faac2f1..10d8ffd 100644 --- a/mkspecs/symbian/linux-gcce/qmake.conf +++ b/mkspecs/symbian/linux-gcce/qmake.conf @@ -4,7 +4,8 @@ include(../../common/symbian/symbian-makefile.conf) -include(../../common/g++.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) QMAKE_CC = arm-none-symbianelf-gcc QMAKE_CXX = arm-none-symbianelf-g++ diff --git a/mkspecs/unsupported/linux-scratchbox2-g++/qmake.conf b/mkspecs/unsupported/linux-scratchbox2-g++/qmake.conf index 28e7754..c362634 100644 --- a/mkspecs/unsupported/linux-scratchbox2-g++/qmake.conf +++ b/mkspecs/unsupported/linux-scratchbox2-g++/qmake.conf @@ -18,8 +18,9 @@ CONFIG += qt warn_on release incremental link_prl QT += core gui QMAKE_INCREMENTAL_STYLE = sublib -include(../../common/g++.conf) include(../../common/linux.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) # modifications to g++.conf QMAKE_CC = sb2 gcc diff --git a/mkspecs/unsupported/qnx-g++/qmake.conf b/mkspecs/unsupported/qnx-g++/qmake.conf index dfe9bed..83c4a26 100644 --- a/mkspecs/unsupported/qnx-g++/qmake.conf +++ b/mkspecs/unsupported/qnx-g++/qmake.conf @@ -10,7 +10,8 @@ TEMPLATE = app CONFIG += qt warn_on release link_prl QT += core gui -include(../common/g++.conf) +include(../common/gcc-base-unix.conf) +include(../common/g++-unix.conf) include(../common/unix.conf) QMAKE_CFLAGS_THREAD = -D_REENTRANT diff --git a/mkspecs/unsupported/vxworks-ppc-g++/qmake.conf b/mkspecs/unsupported/vxworks-ppc-g++/qmake.conf index 80b5f3e..7a77c81 100644 --- a/mkspecs/unsupported/vxworks-ppc-g++/qmake.conf +++ b/mkspecs/unsupported/vxworks-ppc-g++/qmake.conf @@ -14,7 +14,8 @@ VXWORKS_ARCH = ppc VXWORKS_CPU = PPC32 VXWORKS_ARCH_MUNCH = ppc -include(../../common/g++.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) include(../../common/linux.conf) QMAKE_CC = cc$$VXWORKS_ARCH_MUNCH diff --git a/mkspecs/unsupported/vxworks-simpentium-g++/qmake.conf b/mkspecs/unsupported/vxworks-simpentium-g++/qmake.conf index 83f46c0..2a96a1a 100644 --- a/mkspecs/unsupported/vxworks-simpentium-g++/qmake.conf +++ b/mkspecs/unsupported/vxworks-simpentium-g++/qmake.conf @@ -14,7 +14,8 @@ VXWORKS_ARCH = simlinux VXWORKS_CPU = SIMLINUX VXWORKS_ARCH_MUNCH = pentium -include(../../common/g++.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) include(../../common/linux.conf) QMAKE_CC = cc$$VXWORKS_ARCH_MUNCH -- cgit v0.12 From 133f510ce7e310d3bbd6aeb57de510d491fe6022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 13 Oct 2010 22:48:24 +0200 Subject: configure: Don't assume that QMAKE_CXX will be found at the start of line Change 86636e0c4ab introduced "isEmpty(QMAKE_CXX): QMAKE_CXX = g++" instead of "QMAKE_CXX = g++", which failed when configure was looking for QMAKE_CXX at the beginning of the line. We now allow either the beginning of the line or a space before QMAKE_CXX. --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index bf81e26..f6f5cfb 100755 --- a/configure +++ b/configure @@ -3162,7 +3162,7 @@ else CFG_FRAMEWORK=no fi -QMAKE_CONF_COMPILER=`getQMakeConf "$XQMAKESPEC" | grep "^QMAKE_CXX[^_A-Z0-9]" | sed "s,.* *= *\(.*\)$,\1," | tail -1` +QMAKE_CONF_COMPILER=`getQMakeConf "$XQMAKESPEC" | grep "\(^\|\s\)QMAKE_CXX[^_A-Z0-9]" | sed "s,.* *= *\(.*\)$,\1," | tail -1` TEST_COMPILER="$CXX" [ -z "$TEST_COMPILER" ] && TEST_COMPILER=$QMAKE_CONF_COMPILER -- cgit v0.12 From 7f579703df80e54a61404702f854f91e2b33bb73 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Thu, 14 Oct 2010 09:46:38 +1000 Subject: Add new behavior example. --- .../declarative/animation/behaviors/wigglytext.qml | 108 +++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 examples/declarative/animation/behaviors/wigglytext.qml diff --git a/examples/declarative/animation/behaviors/wigglytext.qml b/examples/declarative/animation/behaviors/wigglytext.qml new file mode 100644 index 0000000..6cd93ab --- /dev/null +++ b/examples/declarative/animation/behaviors/wigglytext.qml @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: container + + property string text: "Drag this text..." + property bool animated: true + + width: 640; height: 480; color: "#474747"; focus: true + + Keys.onPressed: { + if (event.key == Qt.Key_Delete || event.key == Qt.Key_Backspace) + container.remove() + else if (event.text != "") { + container.append(event.text) + } + } + + function append(text) { + container.animated = false + var lastLetter = container.children[container.children.length - 1] + var newLetter = letterComponent.createObject(container) + newLetter.text = text + newLetter.follow = lastLetter + container.animated = true + } + + function remove() { + if (container.children.length) + container.children[container.children.length - 1].destroy() + } + + function doLayout() { + var follow = null + for (var i = 0; i < container.text.length; ++i) { + var newLetter = letterComponent.createObject(container) + newLetter.text = container.text[i] + newLetter.follow = follow + follow = newLetter + } + } + + Component { + id: letterComponent + Text { + id: letter + property variant follow + + x: follow ? follow.x + follow.width : container.width / 3 + y: follow ? follow.y : container.height / 2 + + font.pixelSize: 40; font.bold: true + color: "#999999"; styleColor: "#222222"; style: Text.Raised + + MouseArea { + anchors.fill: parent + drag.target: letter; drag.axis: Drag.XandYAxis + onPressed: letter.color = "#dddddd" + onReleased: letter.color = "#999999" + } + + Behavior on x { enabled: container.animated; SpringAnimation { spring: 3; damping: 0.3; mass: 1.0 } } + Behavior on y { enabled: container.animated; SpringAnimation { spring: 3; damping: 0.3; mass: 1.0 } } + } + } + + Component.onCompleted: doLayout() +} -- cgit v0.12 From d2a8898e4d42fcf2c4cb51e9117690ae1616e350 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 14 Oct 2010 10:01:14 +1000 Subject: Make minehunt less cheerful An instance of failure being improperly shown as victory was rectified. Task-number: QT-3956 --- demos/declarative/minehunt/minehunt.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/demos/declarative/minehunt/minehunt.cpp b/demos/declarative/minehunt/minehunt.cpp index 9c82f30..709d945 100644 --- a/demos/declarative/minehunt/minehunt.cpp +++ b/demos/declarative/minehunt/minehunt.cpp @@ -195,6 +195,7 @@ bool MinehuntGame::flip(int row, int col) won = false; hasWonChanged(); setPlaying(false); + return true; } remaining--; @@ -202,6 +203,7 @@ bool MinehuntGame::flip(int row, int col) won = true; hasWonChanged(); setPlaying(false); + return true; } return true; } @@ -209,7 +211,7 @@ bool MinehuntGame::flip(int row, int col) bool MinehuntGame::flag(int row, int col) { TileData *t = tile(row, col); - if(!t) + if(!t || !playing) return false; t->setHasFlag(!t->hasFlag()); -- cgit v0.12 From 5dc99c2de83860c39abe56f4ad5d445508a25dd3 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 14 Oct 2010 10:08:57 +1000 Subject: Fix samegame tutorial js Turns out that subtraction is not commutative. Who knew? Task-number: QTBUG-13532 --- examples/declarative/tutorials/samegame/samegame4/content/samegame.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js index 79ff0c1..ccc3f9d 100755 --- a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js @@ -145,7 +145,7 @@ function shuffleDown() { obj = board[index(column, row)]; if (obj == null) continue; - obj.x = (fallDist - column) * gameCanvas.blockSize; + obj.x = (column - fallDist) * gameCanvas.blockSize; board[index(column - fallDist, row)] = obj; board[index(column, row)] = null; } -- cgit v0.12 From 6fb13041677f00884746e7bc36e2c73f3fc5c991 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 14 Oct 2010 13:04:37 +1000 Subject: TextInput autoscroll now scrolls when the cursor moves Previously needed some actual text changes to scroll, which is incorrect Task-number: QTBUG-14230 --- src/declarative/graphicsitems/qdeclarativetextinput.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 637dd77..0903427 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -1464,6 +1464,7 @@ void QDeclarativeTextInputPrivate::init() void QDeclarativeTextInput::cursorPosChanged() { Q_D(QDeclarativeTextInput); + d->updateHorizontalScroll(); updateRect();//TODO: Only update rect between pos's updateMicroFocus(); emit cursorPositionChanged(); -- cgit v0.12 From 896cf6f1523afcf5237efc1ca135672ca3cb8058 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 14 Oct 2010 14:41:15 +1000 Subject: Optimization: Don't generate intermediate QDeclarativeComponent's --- src/declarative/qml/qdeclarativecompileddata.cpp | 2 +- src/declarative/qml/qdeclarativecompiler.cpp | 8 ++-- src/declarative/qml/qdeclarativecompiler_p.h | 5 ++- src/declarative/qml/qdeclarativecomponent.cpp | 57 +++++++++++++----------- src/declarative/qml/qdeclarativecomponent_p.h | 7 +-- src/declarative/qml/qdeclarativetypeloader.cpp | 19 +------- src/declarative/qml/qdeclarativetypeloader_p.h | 2 - src/declarative/qml/qdeclarativevme.cpp | 12 +++-- 8 files changed, 48 insertions(+), 64 deletions(-) diff --git a/src/declarative/qml/qdeclarativecompileddata.cpp b/src/declarative/qml/qdeclarativecompileddata.cpp index 5d73d89..a4ecc77 100644 --- a/src/declarative/qml/qdeclarativecompileddata.cpp +++ b/src/declarative/qml/qdeclarativecompileddata.cpp @@ -205,7 +205,7 @@ const QMetaObject *QDeclarativeCompiledData::TypeReference::metaObject() const return type->metaObject(); } else { Q_ASSERT(component); - return static_cast(QObjectPrivate::get(component))->cc->root; + return component->root; } } diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 74bc5bd..b2740b8 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -590,7 +590,7 @@ bool QDeclarativeCompiler::compile(QDeclarativeEngine *engine, COMPILE_EXCEPTION(parserRef->refObjects.first(), err); } } else if (tref.typeData) { - ref.component = tref.typeData->component(); + ref.component = tref.typeData->compiledData(); ref.ref = tref.typeData; ref.ref->addref(); } @@ -722,7 +722,7 @@ bool QDeclarativeCompiler::buildObject(Object *obj, const BindingContext &ctxt) obj->metatype = tr.metaObject(); if (tr.component) - obj->url = tr.component->url(); + obj->url = tr.component->url; if (tr.type) obj->typeName = tr.type->qmlTypeName(); obj->className = tr.className; @@ -940,7 +940,7 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj) // ### Surely the creation of this property cache could be more efficient QDeclarativePropertyCache *propertyCache = 0; if (tr.component) - propertyCache = QDeclarativeComponentPrivate::get(tr.component)->cc->rootPropertyCache->copy(); + propertyCache = tr.component->rootPropertyCache->copy(); else propertyCache = enginePrivate->cache(obj->metaObject()->superClass())->copy(); @@ -957,7 +957,7 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj) output->bytecode << meta; } else if (obj == unitRoot) { if (tr.component) - output->rootPropertyCache = QDeclarativeComponentPrivate::get(tr.component)->cc->rootPropertyCache; + output->rootPropertyCache = tr.component->rootPropertyCache; else output->rootPropertyCache = enginePrivate->cache(obj->metaObject()); diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h index 89eef09..43a0901 100644 --- a/src/declarative/qml/qdeclarativecompiler_p.h +++ b/src/declarative/qml/qdeclarativecompiler_p.h @@ -93,10 +93,11 @@ public: QByteArray className; QDeclarativeType *type; - QDeclarativeComponent *component; +// QDeclarativeComponent *component; + QDeclarativeCompiledData *component; QDeclarativeRefCount *ref; - QObject *createInstance(QDeclarativeContextData *, const QBitField &) const; + QObject *createInstance(QDeclarativeContextData *, const QBitField &, QList *) const; const QMetaObject *metaObject() const; }; QList types; diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index cfef9cf..0a2a6db 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -733,48 +733,45 @@ QDeclarativeComponentPrivate::beginCreate(QDeclarativeContextData *context, cons return 0; } - QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); + return begin(context, creationContext, cc, start, count, &state, 0, bindings); +} + +QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *parentContext, + QDeclarativeContextData *componentCreationContext, + QDeclarativeCompiledData *component, int start, int count, + ConstructionState *state, QList *errors, + const QBitField &bindings) +{ + QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(parentContext->engine); + bool isRoot = !enginePriv->inBeginCreate; + + Q_ASSERT(!isRoot || state); // Either this isn't a root component, or a state data must be provided + Q_ASSERT((state != 0) ^ (errors != 0)); // One of state or errors (but not both) must be provided - bool isRoot = !ep->inBeginCreate; if (isRoot) QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::Creating); - QDeclarativeDebugTrace::rangeData(QDeclarativeDebugTrace::Creating, cc->url); QDeclarativeContextData *ctxt = new QDeclarativeContextData; ctxt->isInternal = true; - ctxt->url = cc->url; - ctxt->imports = cc->importCache; + ctxt->url = component->url; + ctxt->imports = component->importCache; // Nested global imports - if (creationContext && start != -1) - ctxt->importedScripts = creationContext->importedScripts; - - cc->importCache->addref(); - ctxt->setParent(context); + if (componentCreationContext && start != -1) + ctxt->importedScripts = componentCreationContext->importedScripts; - QObject *rv = begin(ctxt, ep, cc, start, count, &state, bindings); + component->importCache->addref(); + ctxt->setParent(parentContext); - if (ep->isDebugging && rv) { - if (!context->isInternal) - context->asQDeclarativeContextPrivate()->instances.append(rv); - QDeclarativeEngineDebugServer::instance()->objectCreated(engine, rv); - } - - return rv; -} - -QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *ctxt, QDeclarativeEnginePrivate *enginePriv, - QDeclarativeCompiledData *component, int start, int count, - ConstructionState *state, const QBitField &bindings) -{ - bool isRoot = !enginePriv->inBeginCreate; enginePriv->inBeginCreate = true; QDeclarativeVME vme; QObject *rv = vme.run(ctxt, component, start, count, bindings); - if (vme.isError()) - state->errors = vme.errors(); + if (vme.isError()) { + if(errors) *errors = vme.errors(); + else state->errors = vme.errors(); + } if (isRoot) { enginePriv->inBeginCreate = false; @@ -794,6 +791,12 @@ QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *ctxt, QDe enginePriv->inProgressCreations++; } + if (enginePriv->isDebugging && rv) { + if (!parentContext->isInternal) + parentContext->asQDeclarativeContextPrivate()->instances.append(rv); + QDeclarativeEngineDebugServer::instance()->objectCreated(parentContext->engine, rv); + } + return rv; } diff --git a/src/declarative/qml/qdeclarativecomponent_p.h b/src/declarative/qml/qdeclarativecomponent_p.h index a551cc8..7b30bad 100644 --- a/src/declarative/qml/qdeclarativecomponent_p.h +++ b/src/declarative/qml/qdeclarativecomponent_p.h @@ -109,9 +109,10 @@ public: }; ConstructionState state; - static QObject *begin(QDeclarativeContextData *ctxt, QDeclarativeEnginePrivate *enginePriv, - QDeclarativeCompiledData *component, int start, int count, - ConstructionState *state, const QBitField &bindings = QBitField()); + static QObject *begin(QDeclarativeContextData *parentContext, QDeclarativeContextData *componentCreationContext, + QDeclarativeCompiledData *component, int start, int count, + ConstructionState *state, QList *errors, + const QBitField &bindings = QBitField()); static void beginDeferred(QDeclarativeEnginePrivate *enginePriv, QObject *object, ConstructionState *state); static void complete(QDeclarativeEnginePrivate *enginePriv, ConstructionState *state); diff --git a/src/declarative/qml/qdeclarativetypeloader.cpp b/src/declarative/qml/qdeclarativetypeloader.cpp index c8e1a07..c015519 100644 --- a/src/declarative/qml/qdeclarativetypeloader.cpp +++ b/src/declarative/qml/qdeclarativetypeloader.cpp @@ -719,7 +719,7 @@ void QDeclarativeTypeLoader::clearCache() QDeclarativeTypeData::QDeclarativeTypeData(const QUrl &url, QDeclarativeTypeLoader::Options options, QDeclarativeTypeLoader *manager) : QDeclarativeDataBlob(url, QmlFile), m_options(options), m_typesResolved(false), - m_compiledData(0), m_component(0), m_typeLoader(manager) + m_compiledData(0), m_typeLoader(manager) { } @@ -768,23 +768,6 @@ QDeclarativeCompiledData *QDeclarativeTypeData::compiledData() const return m_compiledData; } -QDeclarativeComponent *QDeclarativeTypeData::component() const -{ - if (!m_component) { - - if (m_compiledData) { - m_component = new QDeclarativeComponent(typeLoader()->engine(), m_compiledData, -1, -1, 0); - } else { - m_component = new QDeclarativeComponent(typeLoader()->engine()); - QDeclarativeComponentPrivate::get(m_component)->url = finalUrl(); - QDeclarativeComponentPrivate::get(m_component)->state.errors = errors(); - } - - } - - return m_component; -} - void QDeclarativeTypeData::registerCallback(TypeDataCallback *callback) { Q_ASSERT(!m_callbacks.contains(callback)); diff --git a/src/declarative/qml/qdeclarativetypeloader_p.h b/src/declarative/qml/qdeclarativetypeloader_p.h index 7381f28..718537a 100644 --- a/src/declarative/qml/qdeclarativetypeloader_p.h +++ b/src/declarative/qml/qdeclarativetypeloader_p.h @@ -243,7 +243,6 @@ public: const QList &resolvedScripts() const; QDeclarativeCompiledData *compiledData() const; - QDeclarativeComponent *component() const; // Used by QDeclarativeComponent to get notifications struct TypeDataCallback { @@ -278,7 +277,6 @@ private: bool m_typesResolved:1; QDeclarativeCompiledData *m_compiledData; - mutable QDeclarativeComponent *m_component; QList m_callbacks; diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp index 360186c..db90aff 100644 --- a/src/declarative/qml/qdeclarativevme.cpp +++ b/src/declarative/qml/qdeclarativevme.cpp @@ -185,12 +185,9 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, bindings = bindings.united(bindingSkipList); QObject *o = - types.at(instr.create.type).createInstance(ctxt, bindings); + types.at(instr.create.type).createInstance(ctxt, bindings, &vmeErrors); if (!o) { - if(types.at(instr.create.type).component) - vmeErrors << types.at(instr.create.type).component->errors(); - VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Unable to create object of type %1").arg(QString::fromLatin1(types.at(instr.create.type).className))); } @@ -933,8 +930,9 @@ QList QDeclarativeVME::errors() const } QObject * -QDeclarativeCompiledData::TypeReference::createInstance(QDeclarativeContextData *ctxt, - const QBitField &bindings) const +QDeclarativeCompiledData::TypeReference::createInstance(QDeclarativeContextData *ctxt, + const QBitField &bindings, + QList *errors) const { if (type) { QObject *rv = 0; @@ -948,7 +946,7 @@ QDeclarativeCompiledData::TypeReference::createInstance(QDeclarativeContextData return rv; } else { Q_ASSERT(component); - return QDeclarativeComponentPrivate::get(component)->create(ctxt, bindings); + return QDeclarativeComponentPrivate::begin(ctxt, 0, component, -1, -1, 0, errors, bindings); } } -- cgit v0.12 From bccb1a82fd796ca31b8b4777c29344bafc6d71d6 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 14 Oct 2010 14:54:33 +1000 Subject: Fix consistency of setting currentIndex in ListView and GridView. The behaviour of setting the currentIndex out of bounds, was different depending upon whether it was set -ve, beyond the end, or before component completed. The behaviour is now consistent - setting the currentIndex out of bounds is allowed and will cause the currentItem and highlightItem to become null. Task-number: QTBUG-12571 Reviewed-by: Michael Brasser --- .../graphicsitems/qdeclarativegridview.cpp | 67 ++++++++++++++-------- .../graphicsitems/qdeclarativelistview.cpp | 35 +++++++---- .../data/gridview-noCurrent.qml | 52 +++++++++++++++++ .../tst_qdeclarativegridview.cpp | 43 ++++++++++++++ .../data/listview-noCurrent.qml | 50 ++++++++++++++++ .../tst_qdeclarativelistview.cpp | 44 ++++++++++++++ 6 files changed, 257 insertions(+), 34 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativegridview/data/gridview-noCurrent.qml create mode 100644 tests/auto/declarative/qdeclarativelistview/data/listview-noCurrent.qml diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 6ee6b0d..f53625f 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -112,7 +112,7 @@ public: , bufferMode(BufferBefore | BufferAfter), snapMode(QDeclarativeGridView::NoSnap) , ownModel(false), wrap(false), autoHighlight(true) , fixCurrentVisibility(false), lazyRelease(false), layoutScheduled(false) - , deferredRelease(false), haveHighlightRange(false) {} + , deferredRelease(false), haveHighlightRange(false), currentIndexSet(false) {} void init(); void clear(); @@ -392,6 +392,7 @@ public: bool layoutScheduled : 1; bool deferredRelease : 1; bool haveHighlightRange : 1; + bool currentIndexSet : 1; }; void QDeclarativeGridViewPrivate::init() @@ -730,6 +731,8 @@ void QDeclarativeGridViewPrivate::createHighlight() QDeclarative_setParent_noEvent(item, q->contentItem()); item->setParentItem(q->contentItem()); highlight = new FxGridItem(item, q); + if (currentItem) + highlight->setPosition(currentItem->colPos(), currentItem->rowPos()); highlightXAnimator = new QSmoothedAnimation(q); highlightXAnimator->target = QDeclarativeProperty(highlight->item, QLatin1String("x")); highlightXAnimator->userDuration = highlightMoveDuration; @@ -771,8 +774,11 @@ void QDeclarativeGridViewPrivate::updateCurrent(int modelIndex) currentItem->attached->setIsCurrentItem(false); releaseItem(currentItem); currentItem = 0; - currentIndex = -1; + currentIndex = modelIndex; + emit q->currentIndexChanged(); updateHighlight(); + } else if (currentIndex != modelIndex) { + currentIndex = modelIndex; emit q->currentIndexChanged(); } return; @@ -1236,7 +1242,7 @@ void QDeclarativeGridView::setModel(const QVariant &model) d->bufferMode = QDeclarativeGridViewPrivate::BufferBefore | QDeclarativeGridViewPrivate::BufferAfter; if (isComponentComplete()) { refill(); - if (d->currentIndex >= d->model->count() || d->currentIndex < 0) { + if ((d->currentIndex >= d->model->count() || d->currentIndex < 0) && !d->currentIndexSet) { setCurrentIndex(0); } else { d->moveReason = QDeclarativeGridViewPrivate::SetIndex; @@ -1344,10 +1350,13 @@ void QDeclarativeGridView::setCurrentIndex(int index) Q_D(QDeclarativeGridView); if (d->requestedIndex >= 0) // currently creating item return; - if (isComponentComplete() && d->isValid() && index != d->currentIndex && index < d->model->count() && index >= 0) { + d->currentIndexSet = true; + if (index == d->currentIndex) + return; + if (isComponentComplete() && d->isValid()) { d->moveReason = QDeclarativeGridViewPrivate::SetIndex; d->updateCurrent(index); - } else if (index != d->currentIndex) { + } else { d->currentIndex = index; emit currentIndexChanged(); } @@ -1983,22 +1992,25 @@ void QDeclarativeGridView::keyPressEvent(QKeyEvent *event) Move the currentIndex up one item in the view. The current index will wrap if keyNavigationWraps is true and it - is currently at the end. + is currently at the end. This method has no effect if the \l count is zero. \bold Note: methods should only be called after the Component has completed. */ void QDeclarativeGridView::moveCurrentIndexUp() { Q_D(QDeclarativeGridView); + const int count = d->model ? d->model->count() : 0; + if (!count) + return; if (d->flow == QDeclarativeGridView::LeftToRight) { if (currentIndex() >= d->columns || d->wrap) { int index = currentIndex() - d->columns; - setCurrentIndex(index >= 0 ? index : d->model->count()-1); + setCurrentIndex((index >= 0 && index < count) ? index : count-1); } } else { if (currentIndex() > 0 || d->wrap) { int index = currentIndex() - 1; - setCurrentIndex(index >= 0 ? index : d->model->count()-1); + setCurrentIndex((index >= 0 && index < count) ? index : count-1); } } } @@ -2008,22 +2020,25 @@ void QDeclarativeGridView::moveCurrentIndexUp() Move the currentIndex down one item in the view. The current index will wrap if keyNavigationWraps is true and it - is currently at the end. + is currently at the end. This method has no effect if the \l count is zero. \bold Note: methods should only be called after the Component has completed. */ void QDeclarativeGridView::moveCurrentIndexDown() { Q_D(QDeclarativeGridView); + const int count = d->model ? d->model->count() : 0; + if (!count) + return; if (d->flow == QDeclarativeGridView::LeftToRight) { - if (currentIndex() < d->model->count() - d->columns || d->wrap) { + if (currentIndex() < count - d->columns || d->wrap) { int index = currentIndex()+d->columns; - setCurrentIndex(index < d->model->count() ? index : 0); + setCurrentIndex((index >= 0 && index < count) ? index : 0); } } else { - if (currentIndex() < d->model->count() - 1 || d->wrap) { + if (currentIndex() < count - 1 || d->wrap) { int index = currentIndex() + 1; - setCurrentIndex(index < d->model->count() ? index : 0); + setCurrentIndex((index >= 0 && index < count) ? index : 0); } } } @@ -2033,22 +2048,25 @@ void QDeclarativeGridView::moveCurrentIndexDown() Move the currentIndex left one item in the view. The current index will wrap if keyNavigationWraps is true and it - is currently at the end. + is currently at the end. This method has no effect if the \l count is zero. \bold Note: methods should only be called after the Component has completed. */ void QDeclarativeGridView::moveCurrentIndexLeft() { Q_D(QDeclarativeGridView); + const int count = d->model ? d->model->count() : 0; + if (!count) + return; if (d->flow == QDeclarativeGridView::LeftToRight) { if (currentIndex() > 0 || d->wrap) { int index = currentIndex() - 1; - setCurrentIndex(index >= 0 ? index : d->model->count()-1); + setCurrentIndex((index >= 0 && index < count) ? index : count-1); } } else { if (currentIndex() >= d->columns || d->wrap) { int index = currentIndex() - d->columns; - setCurrentIndex(index >= 0 ? index : d->model->count()-1); + setCurrentIndex((index >= 0 && index < count) ? index : count-1); } } } @@ -2058,22 +2076,25 @@ void QDeclarativeGridView::moveCurrentIndexLeft() Move the currentIndex right one item in the view. The current index will wrap if keyNavigationWraps is true and it - is currently at the end. + is currently at the end. This method has no effect if the \l count is zero. \bold Note: methods should only be called after the Component has completed. */ void QDeclarativeGridView::moveCurrentIndexRight() { Q_D(QDeclarativeGridView); + const int count = d->model ? d->model->count() : 0; + if (!count) + return; if (d->flow == QDeclarativeGridView::LeftToRight) { - if (currentIndex() < d->model->count() - 1 || d->wrap) { + if (currentIndex() < count - 1 || d->wrap) { int index = currentIndex() + 1; - setCurrentIndex(index < d->model->count() ? index : 0); + setCurrentIndex((index >= 0 && index < count) ? index : 0); } } else { - if (currentIndex() < d->model->count() - d->columns || d->wrap) { + if (currentIndex() < count - d->columns || d->wrap) { int index = currentIndex()+d->columns; - setCurrentIndex(index < d->model->count() ? index : 0); + setCurrentIndex((index >= 0 && index < count) ? index : 0); } } } @@ -2201,7 +2222,7 @@ void QDeclarativeGridView::componentComplete() if (d->isValid()) { refill(); d->moveReason = QDeclarativeGridViewPrivate::SetIndex; - if (d->currentIndex < 0) + if (d->currentIndex < 0 && !d->currentIndexSet) d->updateCurrent(0); else d->updateCurrent(d->currentIndex); @@ -2282,7 +2303,7 @@ void QDeclarativeGridView::itemsInserted(int modelIndex, int count) if (d->currentItem) d->currentItem->index = d->currentIndex; emit currentIndexChanged(); - } else if (d->currentIndex < 0) { + } else if (d->currentIndex < 0 && !d->currentIndexSet) { d->updateCurrent(0); } d->itemCount += count; diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 6fd3b71..7dd5c75 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -182,7 +182,8 @@ public: , bufferMode(BufferBefore | BufferAfter) , ownModel(false), wrap(false), autoHighlight(true), haveHighlightRange(false) , correctFlick(false), inFlickCorrection(false), lazyRelease(false) - , deferredRelease(false), layoutScheduled(false), minExtentDirty(true), maxExtentDirty(true) + , deferredRelease(false), layoutScheduled(false), currentIndexSet(false) + , minExtentDirty(true), maxExtentDirty(true) {} void init(); @@ -544,6 +545,7 @@ public: bool lazyRelease : 1; bool deferredRelease : 1; bool layoutScheduled : 1; + bool currentIndexSet : 1; mutable bool minExtentDirty : 1; mutable bool maxExtentDirty : 1; }; @@ -881,6 +883,7 @@ void QDeclarativeListViewPrivate::createHighlight() } else { highlight->item->setWidth(currentItem->item->width()); } + highlight->setPosition(currentItem->itemPosition()); } QDeclarativeItemPrivate *itemPrivate = static_cast(QGraphicsItemPrivate::get(item)); itemPrivate->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry); @@ -1045,8 +1048,11 @@ void QDeclarativeListViewPrivate::updateCurrent(int modelIndex) currentItem->attached->setIsCurrentItem(false); releaseItem(currentItem); currentItem = 0; - currentIndex = -1; + currentIndex = modelIndex; + emit q->currentIndexChanged(); updateHighlight(); + } else if (currentIndex != modelIndex) { + currentIndex = modelIndex; emit q->currentIndexChanged(); } return; @@ -1598,7 +1604,7 @@ void QDeclarativeListView::setModel(const QVariant &model) if (isComponentComplete()) { updateSections(); refill(); - if (d->currentIndex >= d->model->count() || d->currentIndex < 0) { + if ((d->currentIndex >= d->model->count() || d->currentIndex < 0) && !d->currentIndexSet) { setCurrentIndex(0); } else { d->moveReason = QDeclarativeListViewPrivate::SetIndex; @@ -1708,10 +1714,13 @@ void QDeclarativeListView::setCurrentIndex(int index) Q_D(QDeclarativeListView); if (d->requestedIndex >= 0) // currently creating item return; - if (isComponentComplete() && d->isValid() && index != d->currentIndex && index < d->model->count() && index >= 0) { + d->currentIndexSet = true; + if (index == d->currentIndex) + return; + if (isComponentComplete() && d->isValid()) { d->moveReason = QDeclarativeListViewPrivate::SetIndex; d->updateCurrent(index); - } else if (index != d->currentIndex) { + } else { d->currentIndex = index; emit currentIndexChanged(); } @@ -2523,16 +2532,18 @@ void QDeclarativeListView::geometryChanged(const QRectF &newGeometry, Increments the current index. The current index will wrap if keyNavigationWraps is true and it is currently at the end. + This method has no effect if the \l count is zero. \bold Note: methods should only be called after the Component has completed. */ void QDeclarativeListView::incrementCurrentIndex() { Q_D(QDeclarativeListView); - if (currentIndex() < d->model->count() - 1 || d->wrap) { + int count = d->model ? d->model->count() : 0; + if (count && (currentIndex() < count - 1 || d->wrap)) { d->moveReason = QDeclarativeListViewPrivate::SetIndex; int index = currentIndex()+1; - d->updateCurrent(index < d->model->count() ? index : 0); + d->updateCurrent((index >= 0 && index < count) ? index : 0); } } @@ -2541,16 +2552,18 @@ void QDeclarativeListView::incrementCurrentIndex() Decrements the current index. The current index will wrap if keyNavigationWraps is true and it is currently at the beginning. + This method has no effect if the \l count is zero. \bold Note: methods should only be called after the Component has completed. */ void QDeclarativeListView::decrementCurrentIndex() { Q_D(QDeclarativeListView); - if (currentIndex() > 0 || d->wrap) { + int count = d->model ? d->model->count() : 0; + if (count && (currentIndex() > 0 || d->wrap)) { d->moveReason = QDeclarativeListViewPrivate::SetIndex; int index = currentIndex()-1; - d->updateCurrent(index >= 0 ? index : d->model->count()-1); + d->updateCurrent((index >= 0 && index < count) ? index : count-1); } } @@ -2684,7 +2697,7 @@ void QDeclarativeListView::componentComplete() if (d->isValid()) { refill(); d->moveReason = QDeclarativeListViewPrivate::SetIndex; - if (d->currentIndex < 0) + if (d->currentIndex < 0 && !d->currentIndexSet) d->updateCurrent(0); else d->updateCurrent(d->currentIndex); @@ -2790,7 +2803,7 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count) if (d->currentItem) d->currentItem->index = d->currentIndex; emit currentIndexChanged(); - } else if (d->currentIndex < 0) { + } else if (d->currentIndex < 0 && !d->currentIndexSet) { d->updateCurrent(0); } d->itemCount += count; diff --git a/tests/auto/declarative/qdeclarativegridview/data/gridview-noCurrent.qml b/tests/auto/declarative/qdeclarativegridview/data/gridview-noCurrent.qml new file mode 100644 index 0000000..1189649 --- /dev/null +++ b/tests/auto/declarative/qdeclarativegridview/data/gridview-noCurrent.qml @@ -0,0 +1,52 @@ +import QtQuick 1.0 + +Rectangle { + property int current: grid.currentIndex + width: 240 + height: 320 + color: "#ffffff" + resources: [ + Component { + id: myDelegate + Rectangle { + id: wrapper + objectName: "wrapper" + width: 80 + height: 60 + border.color: "blue" + Text { + text: index + } + Text { + x: 40 + text: wrapper.x + ", " + wrapper.y + } + Text { + y: 20 + id: textName + objectName: "textName" + text: name + } + Text { + y: 40 + id: textNumber + objectName: "textNumber" + text: number + } + color: GridView.isCurrentItem ? "lightsteelblue" : "white" + } + } + ] + GridView { + id: grid + objectName: "grid" + focus: true + width: 240 + height: 320 + currentIndex: -1 + cellWidth: 80 + cellHeight: 60 + delegate: myDelegate + model: testModel + } +} diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index f7acd87..327bba2 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -71,6 +71,7 @@ private slots: void moved(); void changeFlow(); void currentIndex(); + void noCurrentIndex(); void defaultValues(); void properties(); void propertyChanges(); @@ -696,9 +697,51 @@ void tst_QDeclarativeGridView::currentIndex() model.insertItem(0, "Foo", "1111"); QTRY_COMPARE(canvas->rootObject()->property("current").toInt(), 29); + // check removing highlight by setting currentIndex to -1; + gridview->setCurrentIndex(-1); + + QCOMPARE(gridview->currentIndex(), -1); + QVERIFY(!gridview->highlightItem()); + QVERIFY(!gridview->currentItem()); + delete canvas; } +void tst_QDeclarativeGridView::noCurrentIndex() +{ + TestModel model; + for (int i = 0; i < 60; i++) + model.addItem("Item" + QString::number(i), QString::number(i)); + + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->setFixedSize(240,320); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + QString filename(SRCDIR "/data/gridview-noCurrent.qml"); + canvas->setSource(QUrl::fromLocalFile(filename)); + + qApp->processEvents(); + + QDeclarativeGridView *gridview = findItem(canvas->rootObject(), "grid"); + QVERIFY(gridview != 0); + + QDeclarativeItem *contentItem = gridview->contentItem(); + QVERIFY(contentItem != 0); + + // current index should be -1 + QCOMPARE(gridview->currentIndex(), -1); + QVERIFY(!gridview->currentItem()); + QVERIFY(!gridview->highlightItem()); + QCOMPARE(gridview->contentY(), 0.0); + + gridview->setCurrentIndex(5); + QCOMPARE(gridview->currentIndex(), 5); + QVERIFY(gridview->currentItem()); + QVERIFY(gridview->highlightItem()); +} + void tst_QDeclarativeGridView::changeFlow() { QDeclarativeView *canvas = createView(); diff --git a/tests/auto/declarative/qdeclarativelistview/data/listview-noCurrent.qml b/tests/auto/declarative/qdeclarativelistview/data/listview-noCurrent.qml new file mode 100644 index 0000000..1997010 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistview/data/listview-noCurrent.qml @@ -0,0 +1,50 @@ +import QtQuick 1.0 + +Rectangle { + property int current: list.currentIndex + width: 240 + height: 320 + color: "#ffffff" + resources: [ + Component { + id: myDelegate + Rectangle { + id: wrapper + objectName: "wrapper" + height: 20 + width: 240 + Text { + text: index + } + Text { + x: 30 + id: textName + objectName: "textName" + text: name + } + Text { + x: 120 + id: textNumber + objectName: "textNumber" + text: number + } + Text { + x: 200 + text: wrapper.y + } + color: ListView.isCurrentItem ? "lightsteelblue" : "white" + } + } + ] + ListView { + id: list + objectName: "list" + focus: true + currentIndex: -1 + width: 240 + height: 320 + delegate: myDelegate + highlightMoveSpeed: 1000 + model: testModel + } +} diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 2649c0d..080631c 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -85,6 +85,7 @@ private slots: void itemList(); void currentIndex(); + void noCurrentIndex(); void enforceRange(); void spacing(); void sections(); @@ -1087,9 +1088,52 @@ void tst_QDeclarativeListView::currentIndex() model.insertItem(0, "Foo", "1111"); QTRY_COMPARE(canvas->rootObject()->property("current").toInt(), 29); + // check removing highlight by setting currentIndex to -1; + listview->setCurrentIndex(-1); + + QCOMPARE(listview->currentIndex(), -1); + QVERIFY(!listview->highlightItem()); + QVERIFY(!listview->currentItem()); + delete canvas; } +void tst_QDeclarativeListView::noCurrentIndex() +{ + TestModel model; + for (int i = 0; i < 30; i++) + model.addItem("Item" + QString::number(i), QString::number(i)); + + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->setFixedSize(240,320); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + QString filename(SRCDIR "/data/listview-noCurrent.qml"); + canvas->setSource(QUrl::fromLocalFile(filename)); + + qApp->processEvents(); + + QDeclarativeListView *listview = findItem(canvas->rootObject(), "list"); + QTRY_VERIFY(listview != 0); + + QDeclarativeItem *contentItem = listview->contentItem(); + QTRY_VERIFY(contentItem != 0); + + // current index should be -1 at startup + // and we should not have a currentItem or highlightItem + QCOMPARE(listview->currentIndex(), -1); + QCOMPARE(listview->contentY(), 0.0); + QVERIFY(!listview->highlightItem()); + QVERIFY(!listview->currentItem()); + + listview->setCurrentIndex(2); + QCOMPARE(listview->currentIndex(), 2); + QVERIFY(listview->highlightItem()); + QVERIFY(listview->currentItem()); +} + void tst_QDeclarativeListView::itemList() { QDeclarativeView *canvas = createView(); -- cgit v0.12 From c407d79f79c67f2f2bb84efc93061fd57fe4cf54 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 14 Oct 2010 18:22:57 +1000 Subject: Correctly splice properties from derived metaobjects together Task-number: QTBUG-14449 --- src/declarative/qml/qdeclarativepropertycache.cpp | 77 ++++++---------------- src/declarative/qml/qdeclarativepropertycache_p.h | 9 ++- .../data/propertySplicing.qml | 10 +++ .../qdeclarativeecmascript/testtypes.cpp | 1 + .../declarative/qdeclarativeecmascript/testtypes.h | 9 +++ .../tst_qdeclarativeecmascript.cpp | 13 ++++ 6 files changed, 61 insertions(+), 58 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/propertySplicing.qml diff --git a/src/declarative/qml/qdeclarativepropertycache.cpp b/src/declarative/qml/qdeclarativepropertycache.cpp index 9e1ceb8..82fa98f 100644 --- a/src/declarative/qml/qdeclarativepropertycache.cpp +++ b/src/declarative/qml/qdeclarativepropertycache.cpp @@ -252,7 +252,8 @@ void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaOb } int methodCount = metaObject->methodCount(); - int methodOffset = qMax(2, metaObject->methodOffset()); // 2 to block the destroyed signal + // 3 to block the destroyed signal and the deleteLater() slot + int methodOffset = qMax(3, metaObject->methodOffset()); methodIndexCache.resize(methodCount); for (int ii = methodOffset; ii < methodCount; ++ii) { @@ -268,17 +269,17 @@ void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaOb RData *data = new RData; data->identifier = enginePriv->objectClass->createPersistentIdentifier(methodName); - if (stringCache.contains(methodName)) { - stringCache[methodName]->release(); - identifierCache[data->identifier.identifier]->release(); - } - data->load(m); if (m.methodType() == QMetaMethod::Slot || m.methodType() == QMetaMethod::Method) data->flags |= methodFlags; else if (m.methodType() == QMetaMethod::Signal) data->flags |= signalFlags; + if (stringCache.contains(methodName)) { + stringCache[methodName]->release(); + identifierCache[data->identifier.identifier]->release(); + } + methodIndexCache[ii] = data; stringCache.insert(methodName, data); @@ -287,6 +288,16 @@ void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaOb } } +void QDeclarativePropertyCache::updateRecur(QDeclarativeEngine *engine, const QMetaObject *metaObject) +{ + if (!metaObject) + return; + + updateRecur(engine, metaObject->superClass()); + + append(engine, metaObject); +} + void QDeclarativePropertyCache::update(QDeclarativeEngine *engine, const QMetaObject *metaObject) { Q_ASSERT(engine); @@ -295,57 +306,11 @@ void QDeclarativePropertyCache::update(QDeclarativeEngine *engine, const QMetaOb clear(); - // ### The properties/methods should probably be spliced on a per-metaobject basis - int propCount = metaObject->propertyCount(); - - indexCache.resize(propCount); - for (int ii = propCount - 1; ii >= 0; --ii) { - QMetaProperty p = metaObject->property(ii); - if (!p.isScriptable()) { - indexCache[ii] = 0; - continue; - } - QString propName = QString::fromUtf8(p.name()); + // Optimization to prevent unnecessary reallocation of lists + indexCache.reserve(metaObject->propertyCount()); + methodIndexCache.reserve(metaObject->methodCount()); - RData *data = new RData; - data->identifier = enginePriv->objectClass->createPersistentIdentifier(propName); - - data->load(p, engine); - - indexCache[ii] = data; - - if (stringCache.contains(propName)) - continue; - - stringCache.insert(propName, data); - identifierCache.insert(data->identifier.identifier, data); - data->addref(); - data->addref(); - } - - int methodCount = metaObject->methodCount(); - for (int ii = methodCount - 1; ii >= 3; --ii) { // >=3 to block the destroyed signal and deleteLater() slot - QMetaMethod m = metaObject->method(ii); - if (m.access() == QMetaMethod::Private) - continue; - QString methodName = QString::fromUtf8(m.signature()); - - int parenIdx = methodName.indexOf(QLatin1Char('(')); - Q_ASSERT(parenIdx != -1); - methodName = methodName.left(parenIdx); - - if (stringCache.contains(methodName)) - continue; - - RData *data = new RData; - data->identifier = enginePriv->objectClass->createPersistentIdentifier(methodName); - - data->load(m); - - stringCache.insert(methodName, data); - identifierCache.insert(data->identifier.identifier, data); - data->addref(); - } + updateRecur(engine,metaObject); } QDeclarativePropertyCache::Data * diff --git a/src/declarative/qml/qdeclarativepropertycache_p.h b/src/declarative/qml/qdeclarativepropertycache_p.h index 79b126d..922010d 100644 --- a/src/declarative/qml/qdeclarativepropertycache_p.h +++ b/src/declarative/qml/qdeclarativepropertycache_p.h @@ -96,7 +96,7 @@ public: IsVMEFunction = 0x00000400, HasArguments = 0x00000800, IsSignal = 0x00001000, - IsVMESignal = 0x00002000, + IsVMESignal = 0x00002000 }; Q_DECLARE_FLAGS(Flags, Flag) @@ -105,7 +105,10 @@ public: Flags flags; int propType; int coreIndex; - int notifyIndex; + union { + int notifyIndex; // When !IsFunction + int relatedIndex; // When IsFunction + }; static Flags flagsForProperty(const QMetaProperty &, QDeclarativeEngine *engine = 0); void load(const QMetaProperty &, QDeclarativeEngine *engine = 0); @@ -152,6 +155,8 @@ private: typedef QHash StringCache; typedef QHash IdentifierCache; + void updateRecur(QDeclarativeEngine *, const QMetaObject *); + QDeclarativeEngine *engine; IndexCache indexCache; IndexCache methodIndexCache; diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/propertySplicing.qml b/tests/auto/declarative/qdeclarativeecmascript/data/propertySplicing.qml new file mode 100644 index 0000000..7deb84a --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/propertySplicing.qml @@ -0,0 +1,10 @@ +import Qt.test 1.0 +import QtQuick 1.0 + +MyDerivedObject { + property bool test: false + + Component.onCompleted: { + test = intProperty() + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp index 810a0f7..94135f9 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp @@ -109,6 +109,7 @@ void registerTypes() qmlRegisterExtendedType("Qt.test", 1,0, "MyBaseExtendedObject"); qmlRegisterExtendedType("Qt.test", 1,0, "MyExtendedObject"); qmlRegisterType("Qt.test", 1,0, "MyTypeObject"); + qmlRegisterType("Qt.test", 1,0, "MyDerivedObject"); qmlRegisterType("Qt.test", 1,0, "NumberAssignment"); qmlRegisterExtendedType("Qt.test", 1,0, "DefaultPropertyExtendedObject"); qmlRegisterType("Qt.test", 1,0, "OverrideDefaultPropertyObject"); diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index 220318d..182c4fa 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -562,6 +562,15 @@ signals: }; Q_DECLARE_OPERATORS_FOR_FLAGS(MyTypeObject::MyFlags) +class MyDerivedObject : public MyTypeObject +{ + Q_OBJECT +public: + Q_INVOKABLE bool intProperty() const { + return true; + } +}; + Q_DECLARE_METATYPE(QScriptValue); class MyInvokableObject : public QObject { diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 02832f3..66dc160 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -139,6 +139,7 @@ private slots: void strictlyEquals(); void compiled(); void numberAssignment(); + void propertySplicing(); void bug1(); void bug2(); @@ -2175,6 +2176,18 @@ void tst_qdeclarativeecmascript::numberAssignment() delete object; } +void tst_qdeclarativeecmascript::propertySplicing() +{ + QDeclarativeComponent component(&engine, TEST_FILE("propertySplicing.qml")); + + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test").toBool(), true); + + delete object; +} + // Test that assigning a null object works // Regressed with: df1788b4dbbb2826ae63f26bdf166342595343f4 void tst_qdeclarativeecmascript::nullObjectBinding() -- cgit v0.12 From 0a0842ce6bc6a2d2731092c50c69a5ff3dc9b010 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 14 Oct 2010 19:00:02 +1000 Subject: Fix potential memory corruption in QDeclarativePropertyCache Task-number: QTBUG-14449 --- src/declarative/qml/qdeclarativepropertycache.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/declarative/qml/qdeclarativepropertycache.cpp b/src/declarative/qml/qdeclarativepropertycache.cpp index 82fa98f..259e492 100644 --- a/src/declarative/qml/qdeclarativepropertycache.cpp +++ b/src/declarative/qml/qdeclarativepropertycache.cpp @@ -140,6 +140,10 @@ void QDeclarativePropertyCache::clear() if (indexCache.at(ii)) indexCache.at(ii)->release(); } + for (int ii = 0; ii < methodIndexCache.count(); ++ii) { + if (methodIndexCache.at(ii)) methodIndexCache.at(ii)->release(); + } + for (StringCache::ConstIterator iter = stringCache.begin(); iter != stringCache.end(); ++iter) (*iter)->release(); @@ -234,12 +238,11 @@ void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaOb RData *data = new RData; data->identifier = enginePriv->objectClass->createPersistentIdentifier(propName); + indexCache[ii] = data; data->load(p, engine); data->flags |= propertyFlags; - indexCache[ii] = data; - if (stringCache.contains(propName)) { stringCache[propName]->release(); identifierCache[data->identifier.identifier]->release(); @@ -268,6 +271,7 @@ void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaOb RData *data = new RData; data->identifier = enginePriv->objectClass->createPersistentIdentifier(methodName); + methodIndexCache[ii] = data; data->load(m); if (m.methodType() == QMetaMethod::Slot || m.methodType() == QMetaMethod::Method) @@ -280,11 +284,10 @@ void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaOb identifierCache[data->identifier.identifier]->release(); } - methodIndexCache[ii] = data; - stringCache.insert(methodName, data); identifierCache.insert(data->identifier.identifier, data); data->addref(); + data->addref(); } } -- cgit v0.12 From af9e4976bea7193a6f4ad09d823aaa1ffee25a3b Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 14 Oct 2010 11:01:33 +0200 Subject: Fixed autotest that was missing focus on Windows Reviewed-by: ogoffart --- tests/auto/qcompleter/tst_qcompleter.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index 6d28f9f..bdd105c 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -1483,8 +1483,10 @@ void tst_QCompleter::QTBUG_14292_filesystem() edit.show(); QApplication::setActiveWindow(&edit); + edit.setFocus(); QTest::qWaitForWindowShown(&edit); QTRY_VERIFY(QApplication::activeWindow() == &edit); + QTRY_VERIFY(edit.hasFocus()); QVERIFY(!comp.popup()->isVisible()); edit.setText(tmpDir.path()); -- cgit v0.12 From f3180713921f73ea529b22379ce5f87392ce749a Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 14 Oct 2010 10:44:35 +0200 Subject: tst_qcompleter.cpp: fix test on mac. Disable the one that does not work --- tests/auto/qcompleter/tst_qcompleter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index bdd105c..425a230 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -651,7 +651,7 @@ void tst_QCompleter::fileSystemModel_data() #elif defined (Q_OS_MAC) QTest::newRow("()") << "" << "" << "/" << "/"; QTest::newRow("(/a)") << "/a" << "" << "Applications" << "/Applications"; - QTest::newRow("(/d)") << "/d" << "" << "Developer" << "/Developer"; +// QTest::newRow("(/d)") << "/d" << "" << "Developer" << "/Developer"; #else QTest::newRow("()") << "" << "" << "/" << "/"; #if !defined(Q_OS_IRIX) && !defined(Q_OS_AIX) && !defined(Q_OS_HPUX) -- cgit v0.12 From 845aea67f6743c6bd095e68035985a31b56fb810 Mon Sep 17 00:00:00 2001 From: mread Date: Thu, 14 Oct 2010 13:48:29 +0100 Subject: Giving Qt a default app server when Avkon is removed Avkon provides a default app server when an app is started as a server app. This allows any app to be started as a server app. The Qt Avkon removal bypassed this, calling the base-class function instead, which prevented apps from starting as server app unless they explictly created a server. Now Qt also creates a default app server, which implements no services, so that any app can be started as a server app, even if Avkon is not present. This allows Symbian^4, configured with -no-s60, to boot. Task-number: QTBUG-14457 Reviewed-by: Jason Barron --- src/gui/s60framework/qs60mainapplication.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/s60framework/qs60mainapplication.cpp b/src/gui/s60framework/qs60mainapplication.cpp index 74432af..24d2496 100644 --- a/src/gui/s60framework/qs60mainapplication.cpp +++ b/src/gui/s60framework/qs60mainapplication.cpp @@ -47,6 +47,9 @@ #include "qs60mainapplication.h" #include #include +#ifndef Q_WS_S60 +# include +#endif QT_BEGIN_NAMESPACE @@ -152,7 +155,11 @@ CDictionaryStore *QS60MainApplication::OpenIniFileLC(RFs &aFs) const */ void QS60MainApplication::NewAppServerL(CApaAppServer *&aAppServer) { +#ifdef Q_WS_S60 QS60MainApplicationBase::NewAppServerL(aAppServer); +#else + aAppServer = new(ELeave) CEikAppServer; +#endif } QT_END_NAMESPACE -- cgit v0.12 From f38e8394eae20f7290688629ab66720ebacd64c9 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Thu, 14 Oct 2010 15:21:28 +0200 Subject: Workaround for QFileSystemWatcher regression Don't call removePath() when it was not added before. Reviewed-by: con Task-number: QTBUG-14435 --- tools/designer/src/lib/shared/qtresourcemodel.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/designer/src/lib/shared/qtresourcemodel.cpp b/tools/designer/src/lib/shared/qtresourcemodel.cpp index 709f389..e3fc805 100644 --- a/tools/designer/src/lib/shared/qtresourcemodel.cpp +++ b/tools/designer/src/lib/shared/qtresourcemodel.cpp @@ -428,10 +428,10 @@ void QtResourceModelPrivate::removeOldPaths(QtResourceSet *resourceSet, const QS void QtResourceModelPrivate::setWatcherEnabled(const QString &path, bool enable) { - m_fileWatcher->removePath(path); - - if (!enable) + if (!enable) { + m_fileWatcher->removePath(path); return; + } QFileInfo fi(path); if (fi.exists()) -- cgit v0.12 From ac49d6c1df2ed81f0916333635f800b96b962ed2 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 14 Oct 2010 15:48:46 +0200 Subject: Doc: Adding note to tier 2: The ppc architecture on Mac has been downgraded from tier 1 to tier 2 for 4.7. Task-number: QTBUG-13803 --- doc/src/platforms/supported-platforms.qdoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/src/platforms/supported-platforms.qdoc b/doc/src/platforms/supported-platforms.qdoc index 31866c4..5218690 100644 --- a/doc/src/platforms/supported-platforms.qdoc +++ b/doc/src/platforms/supported-platforms.qdoc @@ -123,6 +123,8 @@ \o RVCT 2.2 [build 686 or later], WINSCW 3.2.5 [build 482 or later], GCCE (for applications) \endtable + \note The PPC architecture on Mac has been downgraded from tier 1 to tier 2 for 4.7. + \section1 Tier 3 Platforms (Not supported by Nokia) All platforms not specifically listed above are not supported by Nokia. Nokia does -- cgit v0.12 From d8a4d9813cb7771947aa065113310b312b9eb2f8 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 14 Oct 2010 16:07:26 +0200 Subject: Doc: Fixing doc bugs for the symbian platform Task-number:QTBUG-10925 --- doc/src/development/qmake-manual.qdoc | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index 018362e..d65967d 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -939,7 +939,9 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 130 - The default values depend on the version of the Symbian SDK you're using. + The default values depend on the version of the Symbian SDK you're using, + however, the Qt toolchain sets this to the maximum possible value and this + should not be changed. \section2 Compiler specific options @@ -958,23 +960,30 @@ Symbian applications may have unique identifiers attached to them. Here is how to define them in a project file: - There are four types of IDs supported: \c UID2, \c UID3, \c SID, and \c VID. They + There are four available types of IDs supported: \c UID2, \c UID3, \c SID, and \c VID. They are specified like this: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 132 - If \c UID2 is not specified, it defaults to the same value as \c UID3. + If \c SID is not specified, it defaults to the same value as \c UID3. If \c UID3 is not specified, qmake will automatically generate a \c UID3 suitable for development and debugging. This value should be manually specified for applications that are to be released. In order to obtain - an official UID, please contact Nokia. Both \c SID and \c VID default to empty values. - - For more information about unique identifiers and their meaning for - Symbian applications, please refer to the Symbian SDK documentation. - + an official UID, please contact \l{Symbian}{http:\\www.symbiansigned.com}. + Both \c SID and \c VID default to empty values. + + There exists one UID1 too, but this should not be touched by any application. + + The UID2 has a specific value for different types of files - e.g. apps/exes + are always 0x100039CE. The toolchain will set this for value for the most common file types like, + EXE/APP and shared library DLL. + + For more information about unique identifiers and their meaning for Symbian applications, + please refer to the \l{Symbian SDK documentation}{http://developer.symbian.org/main/documentation/reference/s3/pdk/GUID-380A8C4F-3EB6-5E1C-BCFB-ED5B866136D9.html} + \section2 Capabilities - Capabilities define extra priviledges for the application, such as the + Capabilities define extra privileges for the application, such as the ability to list all files on the file system. Capabilities are defined in the project file like this: -- cgit v0.12 From c089696d8de41762a1e8abb067b2721ce3de4d27 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 14 Oct 2010 15:46:22 +0200 Subject: QNAM: Do not need QNetworkSession for data:// This was already fixed in 4.8, this is a hotfix for 4.7 Task-Number: QT-4096 Reviewed-by: Olivier Goffart --- src/network/access/qnetworkaccessmanager.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index a637474..12fe094 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -944,6 +944,22 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera { Q_D(QNetworkAccessManager); + // 4.7 only hotfix fast path for data:// URLs + // In 4.8 this is solved with QNetworkReplyDataImpl and will work there + // This hotfix is done for not needing a QNetworkSession for data:// + if ((op == QNetworkAccessManager::GetOperation || op == QNetworkAccessManager::HeadOperation) + && (req.url().scheme() == QLatin1String("data"))) { + QNetworkReplyImpl *reply = new QNetworkReplyImpl(this); + QNetworkReplyImplPrivate *priv = reply->d_func(); + priv->manager = this; + priv->backend = new QNetworkAccessDataBackend(); + priv->backend->manager = this->d_func(); + priv->backend->setParent(reply); + priv->backend->reply = priv; + priv->setup(op, req, outgoingData); + return reply; + } + // fast path for GET on file:// URLs // Also if the scheme is empty we consider it a file. // The QNetworkAccessFileBackend will right now only be used for PUT -- cgit v0.12 From 169953bd25d22e27794dc395f7708f4befe538a2 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 14 Oct 2010 16:22:55 +0200 Subject: Doc: making links more visible when they are visited. Task-number:QTBUG-10717 --- doc/src/template/style/style.css | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 12d297d..536b3c8 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -926,6 +926,15 @@ color: #4c0033; text-decoration: underline; } + descr p a + { + text-decoration: underline; + } + + .descr p a:visited + { + text-decoration: underline; + } .feedback { float: none; -- cgit v0.12 From 4ab3154c2e9d777d8e84101852866809dce44074 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 14 Oct 2010 16:35:09 +0200 Subject: Doc: Clearing details around default settings. Task-number:QTBUG-9856 --- doc/src/deployment/deployment.qdoc | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/src/deployment/deployment.qdoc b/doc/src/deployment/deployment.qdoc index 664f002..c078316 100644 --- a/doc/src/deployment/deployment.qdoc +++ b/doc/src/deployment/deployment.qdoc @@ -756,6 +756,7 @@ \snippet doc/src/snippets/code/doc_src_deployment.qdoc 21 to your .pro file. The \c embed_manifest_dll option is enabled by default. + The \c embed_manifest_exe option is NOT enabled by default. You can find more information about manifest files and side-by-side assemblies at the -- cgit v0.12 From 78f3600423e6e48cd7d99c631f634c7949eb4227 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 14 Oct 2010 17:08:13 +0200 Subject: Update sections if model content changes. We didn't handle the section property changing, e.g. due to asynchronous model. Task-number: QT-4093 Reviewed-by: Aaron Kennedy Conflicts: src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h --- .../graphicsitems/qdeclarativelistview.cpp | 40 ++++++++++++++++++++-- .../graphicsitems/qdeclarativelistview_p.h | 2 ++ .../graphicsitems/qdeclarativevisualitemmodel.cpp | 21 ++++++++++++ .../graphicsitems/qdeclarativevisualitemmodel_p.h | 6 +++- .../tst_qdeclarativelistview.cpp | 11 ++++++ 5 files changed, 76 insertions(+), 4 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index c1e6aaa..3261dd7 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -775,7 +775,6 @@ void QDeclarativeListViewPrivate::layout() setPosition(0); return; } - updateSections(); if (!visibleItems.isEmpty()) { qreal oldEnd = visibleItems.last()->endPosition(); qreal pos = visibleItems.first()->endPosition() + spacing + 1; @@ -934,6 +933,7 @@ void QDeclarativeListViewPrivate::createSection(FxListItem *listItem) return; if (listItem->attached->m_prevSection != listItem->attached->m_section) { if (!listItem->section) { + qreal pos = listItem->position(); int i = sectionCacheSize-1; while (i >= 0 && !sectionCache[i]) --i; @@ -961,8 +961,10 @@ void QDeclarativeListViewPrivate::createSection(FxListItem *listItem) delete context; } } + listItem->setPosition(pos); } } else if (listItem->section) { + qreal pos = listItem->position(); int i = 0; do { if (!sectionCache[i]) { @@ -975,12 +977,13 @@ void QDeclarativeListViewPrivate::createSection(FxListItem *listItem) } while (i < sectionCacheSize); delete listItem->section; listItem->section = 0; + listItem->setPosition(pos); } } void QDeclarativeListViewPrivate::updateSections() { - if (sectionCriteria) { + if (sectionCriteria && !visibleItems.isEmpty()) { QString prevSection; if (visibleIndex > 0) prevSection = sectionAt(visibleIndex-1); @@ -990,6 +993,8 @@ void QDeclarativeListViewPrivate::updateSections() if (visibleItems.at(i)->index != -1) { QDeclarativeListViewAttached *attached = visibleItems.at(i)->attached; attached->setPrevSection(prevSection); + QString propValue = model->stringValue(visibleItems.at(i)->index, sectionCriteria->property()); + attached->setSection(sectionCriteria->sectionString(propValue)); if (prevAtt) prevAtt->setNextSection(attached->section()); createSection(visibleItems.at(i)); @@ -1551,6 +1556,7 @@ void QDeclarativeListView::setModel(const QVariant &model) disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); disconnect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int))); + disconnect(d->model, SIGNAL(itemsChanged(int,int)), this, SLOT(itemsChanged(int,int))); disconnect(d->model, SIGNAL(modelReset()), this, SLOT(modelReset())); disconnect(d->model, SIGNAL(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); disconnect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*))); @@ -1581,6 +1587,7 @@ void QDeclarativeListView::setModel(const QVariant &model) if (d->model) { d->bufferMode = QDeclarativeListViewPrivate::BufferBefore | QDeclarativeListViewPrivate::BufferAfter; if (isComponentComplete()) { + updateSections(); refill(); if (d->currentIndex >= d->model->count() || d->currentIndex < 0) { setCurrentIndex(0); @@ -1596,6 +1603,7 @@ void QDeclarativeListView::setModel(const QVariant &model) connect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); connect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); connect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int))); + connect(d->model, SIGNAL(itemsChanged(int,int)), this, SLOT(itemsChanged(int,int))); connect(d->model, SIGNAL(modelReset()), this, SLOT(modelReset())); connect(d->model, SIGNAL(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); connect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*))); @@ -1653,6 +1661,7 @@ void QDeclarativeListView::setDelegate(QDeclarativeComponent *delegate) d->visibleItems.clear(); d->releaseItem(d->currentItem); d->currentItem = 0; + updateSections(); refill(); d->moveReason = QDeclarativeListViewPrivate::SetIndex; d->updateCurrent(d->currentIndex); @@ -2066,8 +2075,10 @@ void QDeclarativeListView::setCacheBuffer(int b) QDeclarativeViewSection *QDeclarativeListView::sectionCriteria() { Q_D(QDeclarativeListView); - if (!d->sectionCriteria) + if (!d->sectionCriteria) { d->sectionCriteria = new QDeclarativeViewSection(this); + connect(d->sectionCriteria, SIGNAL(propertyChanged()), this, SLOT(updateSections())); + } return d->sectionCriteria; } @@ -2660,6 +2671,7 @@ void QDeclarativeListView::componentComplete() { Q_D(QDeclarativeListView); QDeclarativeFlickable::componentComplete(); + updateSections(); if (d->isValid()) { refill(); d->moveReason = QDeclarativeListViewPrivate::SetIndex; @@ -2676,6 +2688,18 @@ void QDeclarativeListView::componentComplete() } } +void QDeclarativeListView::updateSections() +{ + Q_D(QDeclarativeListView); + if (isComponentComplete() && d->model) { + QList roles; + if (d->sectionCriteria && !d->sectionCriteria->property().isEmpty()) + roles << d->sectionCriteria->property().toUtf8(); + d->model->setWatchedRoles(roles); + d->updateSections(); + } +} + void QDeclarativeListView::refill() { Q_D(QDeclarativeListView); @@ -2885,6 +2909,7 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count) for (int j = 0; j < added.count(); ++j) added.at(j)->attached->emitAdd(); + d->updateSections(); d->itemCount += count; emit countChanged(); } @@ -2977,6 +3002,7 @@ void QDeclarativeListView::itemsRemoved(int modelIndex, int count) } } + d->updateSections(); emit countChanged(); } @@ -3098,6 +3124,14 @@ void QDeclarativeListView::itemsMoved(int from, int to, int count) // Ensure we don't cause an ugly list scroll. d->visibleItems.first()->setPosition(d->visibleItems.first()->position() + moveBy); + d->updateSections(); + d->layout(); +} + +void QDeclarativeListView::itemsChanged(int, int) +{ + Q_D(QDeclarativeListView); + d->updateSections(); d->layout(); } diff --git a/src/declarative/graphicsitems/qdeclarativelistview_p.h b/src/declarative/graphicsitems/qdeclarativelistview_p.h index 735b248..2678b90 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview_p.h +++ b/src/declarative/graphicsitems/qdeclarativelistview_p.h @@ -250,11 +250,13 @@ protected: virtual void componentComplete(); private Q_SLOTS: + void updateSections(); void refill(); void trackedPositionChanged(); void itemsInserted(int index, int count); void itemsRemoved(int index, int count); void itemsMoved(int from, int to, int count); + void itemsChanged(int index, int count); void modelReset(); void destroyRemoved(); void createdItem(int index, QDeclarativeItem *item); diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 439f500..e569dd2 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -403,6 +403,8 @@ public: QDeclarativeListAccessor *m_listAccessor; QModelIndex m_root; + QList watchedRoles; + QList watchedRoleIds; }; class QDeclarativeVisualDataModelDataMetaObject : public QDeclarativeOpenMetaObject @@ -1170,10 +1172,25 @@ int QDeclarativeVisualDataModel::indexOf(QDeclarativeItem *item, QObject *) cons return -1; } +void QDeclarativeVisualDataModel::setWatchedRoles(QList roles) +{ + Q_D(QDeclarativeVisualDataModel); + d->watchedRoles = roles; + d->watchedRoleIds.clear(); +} + void QDeclarativeVisualDataModel::_q_itemsChanged(int index, int count, const QList &roles) { Q_D(QDeclarativeVisualDataModel); + bool changed = false; + if (!d->watchedRoles.isEmpty() && d->watchedRoleIds.isEmpty()) { + foreach (QByteArray r, d->watchedRoles) { + if (d->m_roleNames.contains(r)) + d->watchedRoleIds << d->m_roleNames.value(r); + } + } + for (QHash::ConstIterator iter = d->m_cache.begin(); iter != d->m_cache.end(); ++iter) { const int idx = iter.key(); @@ -1183,6 +1200,8 @@ void QDeclarativeVisualDataModel::_q_itemsChanged(int index, int count, QDeclarativeVisualDataModelData *data = d->data(objRef.obj); for (int roleIdx = 0; roleIdx < roles.count(); ++roleIdx) { int role = roles.at(roleIdx); + if (!changed && !d->watchedRoleIds.isEmpty() && d->watchedRoleIds.contains(role)) + changed = true; int propId = data->propForRole(role); if (propId != -1) { if (data->hasValue(propId)) { @@ -1217,6 +1236,8 @@ void QDeclarativeVisualDataModel::_q_itemsChanged(int index, int count, } } } + if (changed) + emit itemsChanged(index, count); } void QDeclarativeVisualDataModel::_q_itemsInserted(int index, int count) diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h b/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h index e159786..1d15dba 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h @@ -79,7 +79,8 @@ public: virtual ReleaseFlags release(QDeclarativeItem *item) = 0; virtual bool completePending() const = 0; virtual void completeItem() = 0; - virtual QString stringValue(int, const QString &) { return QString(); } + virtual QString stringValue(int, const QString &) = 0; + virtual void setWatchedRoles(QList roles) = 0; virtual int indexOf(QDeclarativeItem *item, QObject *objectContext) const = 0; @@ -88,6 +89,7 @@ Q_SIGNALS: void itemsInserted(int index, int count); void itemsRemoved(int index, int count); void itemsMoved(int from, int to, int count); + void itemsChanged(int index, int count); void modelReset(); void createdItem(int index, QDeclarativeItem *item); void destroyingItem(QDeclarativeItem *item); @@ -121,6 +123,7 @@ public: virtual bool completePending() const; virtual void completeItem(); virtual QString stringValue(int index, const QString &role); + virtual void setWatchedRoles(QList) {} virtual int indexOf(QDeclarativeItem *item, QObject *objectContext) const; @@ -175,6 +178,7 @@ public: bool completePending() const; void completeItem(); virtual QString stringValue(int index, const QString &role); + virtual void setWatchedRoles(QList roles); int indexOf(QDeclarativeItem *item, QObject *objectContext) const; diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 6452bae..3b2ab6d 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -979,6 +979,17 @@ void tst_QDeclarativeListView::sections() QTRY_VERIFY(item); QTRY_COMPARE(item->height(), 20.0); + // check that headers change when item changes + listview->setContentY(0); + model.modifyItem(0, "changed", "2"); + + canvas->show(); + qApp->exec(); + + item = findItem(contentItem, "wrapper", 1); + QTRY_VERIFY(item); + QTRY_COMPARE(item->height(), 40.0); + delete canvas; } -- cgit v0.12 From 74768276a7b69ad54b93188abcf2ca4bf50dff8a Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 13 Oct 2010 14:55:07 +1000 Subject: Remove debug code added by 650a0078e2cef43eff107fe8d2505f64a0bfedf0 Task-number: QT-4093 --- .../auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 3b2ab6d..ec8ee82 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -983,9 +983,6 @@ void tst_QDeclarativeListView::sections() listview->setContentY(0); model.modifyItem(0, "changed", "2"); - canvas->show(); - qApp->exec(); - item = findItem(contentItem, "wrapper", 1); QTRY_VERIFY(item); QTRY_COMPARE(item->height(), 40.0); -- cgit v0.12 From 17ff53f665ad5de15ce7b073edd1b10b2b397b05 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 14 Oct 2010 17:57:34 +0200 Subject: Doc: Made Qt::TextLongestVariant internal again. This undoes change 43e6ec9f01693044f7bc1. This enum value is internal and not generally supported by Qt. Reviewed-by: Olivier Goffart --- src/corelib/global/qnamespace.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 1c41eca..73f28d6 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -470,9 +470,9 @@ text; otherwise this width is excluded. \value TextIncludeTrailingSpaces Same as IncludeTrailingSpaces \value TextJustificationForced Ensures that text lines are justified. - \value TextLongestVariant Ensures that the longest variant is always used - when computing the size of a multi-variant string. + \omitvalue TextLongestVariant Ensures that the longest variant is always used + when computing the size of a multi-variant string. (Internal) \omitvalue TextBypassShaping \omitvalue BreakAnywhere \omitvalue DontClip -- cgit v0.12 From 830df741afc987f12d744bfab8a4b9ee538c212a Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 14 Oct 2010 18:29:32 +0200 Subject: tst_qcompleter: Fix the QTBUG_14292_filesystem test on X11 The last fix on Windows broke it on linux Reviewed-by: thierry --- tests/auto/qcompleter/tst_qcompleter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index 425a230..650c328 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -1483,9 +1483,9 @@ void tst_QCompleter::QTBUG_14292_filesystem() edit.show(); QApplication::setActiveWindow(&edit); - edit.setFocus(); QTest::qWaitForWindowShown(&edit); QTRY_VERIFY(QApplication::activeWindow() == &edit); + edit.setFocus(); QTRY_VERIFY(edit.hasFocus()); QVERIFY(!comp.popup()->isVisible()); @@ -1493,6 +1493,7 @@ void tst_QCompleter::QTBUG_14292_filesystem() QTest::keyClick(&edit, '/'); QTRY_VERIFY(comp.popup()->isVisible()); QCOMPARE(comp.popup()->model()->rowCount(), 2); + QApplication::processEvents(); QTest::keyClick(&edit, 'h'); QCOMPARE(comp.popup()->model()->rowCount(), 2); QTest::keyClick(&edit, 'e'); -- cgit v0.12 From 8c48c7b9bca8074c48b78f6d089a3882b2d73a9d Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Fri, 15 Oct 2010 11:32:07 +1000 Subject: Recalculate Text Element's alignment when width changes Task-number: QTBUG-14463 Reviewed-by: Aaron Kennedy --- src/declarative/graphicsitems/qdeclarativetext.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 308aefa..22282d2 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -1143,9 +1143,10 @@ QRectF QDeclarativeText::boundingRect() const void QDeclarativeText::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { Q_D(QDeclarativeText); - if (!d->internalWidthUpdate && newGeometry.width() != oldGeometry.width() && - (d->wrapMode != QDeclarativeText::NoWrap || d->elideMode != QDeclarativeText::ElideNone)) { - + if ((!d->internalWidthUpdate && newGeometry.width() != oldGeometry.width()) + && (d->wrapMode != QDeclarativeText::NoWrap + || d->elideMode != QDeclarativeText::ElideNone + || d->hAlign != Qt::AlignLeft)) { if (d->singleline && d->elideMode != QDeclarativeText::ElideNone && widthValid()) { // We need to re-elide d->updateLayout(); -- cgit v0.12 From 64a05cfa97b1192ac247558c0601ba0e4ec464c9 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Fri, 15 Oct 2010 13:04:23 +1000 Subject: Snake demo now pauses when the window loses focus. Task-number: QTBUG-11592 --- demos/declarative/snake/content/pics/pause.png | Bin 0 -> 4327 bytes demos/declarative/snake/content/snake.js | 4 ++-- demos/declarative/snake/snake.qml | 12 +++++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 demos/declarative/snake/content/pics/pause.png diff --git a/demos/declarative/snake/content/pics/pause.png b/demos/declarative/snake/content/pics/pause.png new file mode 100644 index 0000000..056d97d Binary files /dev/null and b/demos/declarative/snake/content/pics/pause.png differ diff --git a/demos/declarative/snake/content/snake.js b/demos/declarative/snake/content/snake.js index c2e9d3a..5c089de 100644 --- a/demos/declarative/snake/content/snake.js +++ b/demos/declarative/snake/content/snake.js @@ -32,7 +32,7 @@ function startNewGame() if (state == "starting") return; - if (heartbeat.running) { + if (activeGame) { endGame(); startNewGameTimer.running = true; state = ""; @@ -87,7 +87,7 @@ function startNewGame() function endGame() { - heartbeat.running = false; + activeGame = false; for(var i in snake) snake[i].dying = true; if (cookie) { diff --git a/demos/declarative/snake/snake.qml b/demos/declarative/snake/snake.qml index 5b69217..6eaa976 100644 --- a/demos/declarative/snake/snake.qml +++ b/demos/declarative/snake/snake.qml @@ -47,6 +47,7 @@ Rectangle { id: screen; SystemPalette { id: activePalette } color: activePalette.window + property bool activeGame: false property int gridSize : 34 property int margin: 4 @@ -75,6 +76,7 @@ Rectangle { Timer { id: heartbeat; interval: heartbeatInterval; + running: activeGame && runtime.isActiveWindow repeat: true onTriggered: { Logic.move() } } @@ -94,9 +96,17 @@ Rectangle { Timer { id: startHeartbeatTimer; interval: 1000 ; - onTriggered: { state = "running"; heartbeat.running = true; } + onTriggered: { state = "running"; activeGame = true; } } + Image{ + id: pauseDialog + z: 1 + source: "content/pics/pause.png" + anchors.centerIn: parent; + //opacity is deliberately not animated + opacity: gameActive && !runtime.isActiveWindow + } Image { Image { -- cgit v0.12 From 11c3a750147f9f79d555a60915d8229e86108ca9 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Fri, 1 Oct 2010 17:18:39 +1000 Subject: Update change log. (cherry picked from commit 976391c5ce2bbe3b992298e140bbbbc596ca756f) --- dist/changes-4.7.1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index 2d79ac1..68b23ba 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -109,7 +109,11 @@ QtDBus QtMultimedia ------------ - + - QAudioOutput + * [QTBUG-11586] Support audio with more than two channels. + * [QTBUG-11755] Fixed outputing audio in push mode with ALSA. + * [QTBUG-11883] Fixed segmentation fault when closing a QAudioInput or + QAudioOutput. QtNetwork --------- -- cgit v0.12 From 9559ec4082563b4b46d13d179dc13360f63566d3 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 4 Oct 2010 14:27:10 +0300 Subject: My changes for 4.7.1 Reviewed-by: TrustMe (cherry picked from commit 0b905d602ffb24b8cad4f09d84a5f762cc6a6603) --- dist/changes-4.7.1 | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index 68b23ba..51a10a3 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -308,7 +308,7 @@ Qt for Symbian * [QTBUG-4586] Fixed wrong paths in include/ActiveQt/headers.pri. * [QTBUG-11671] Fixed audio-backend detection in configure tests. - - qmake + - qmake & mkspecs * [QTBUG-13523] Added support for using -L notation in the LIBS variable when building with the symbian/linux-armcc or gcce mkspec. * [QTBUG-12851] Fix assertion on Windows when DESTDIR is empty in static @@ -318,6 +318,31 @@ Qt for Symbian .pro file. * [QTBUG-13081] vc[x]proj generators: support /MAP option without file name. + * [QTBUG-13902] Added support for unsigned smart installer package creation. + * [QTBUG-13991] No longer need to manually edit smart installer pkg file for publishing. + * [QT-3949] Load environment.prf from Symbian SDK if it exists there. + * [QTBUG-13499] Provide a way to compile with RVCT 4.0 using generated Makefile. + * [QTBUG-13336] Ignore MAKEFILE variable for Symbian abld and sbsv2 builds. + * [QTBUG-13363] Fix Symbian handling of projects with special characters in TARGET. + * [QTBUG-12762 & QTBUG-13307] Gcce building support for symbian-sbsv2 + * [QTBUG-13147] Added support for DEPLOYMENT.pkg_build_version + * [QTBUG-12884] Fix "installer_sis" and "deploy" targets when TARGET has path. + * [QTBUG-12879] Fix check to remove unnecessary deployments in Symbian. + * [QTBUG-12716] Make bld.inf target in Symbian mkspecs to depend on .pro file. + * [QTBUG-12715] Rename Symbian generated mmp/mk files to include target in filename. + * [QTBUG-12617] Fix package header in cases where VERSION doesn't contain all values. + * Fix run and runonphone targets for projects that have TARGET with path. + * Fix QT_LIBINFIX for QT_PLUGINS_BASE_DIR. + * No longer require PRE_TARGETDEPS items to be absolute for symbian-sbsv2 mkspec. + * Do smart command replacement for commands containing $$QMAKE_* + command variables, such as $$QMAKE_COPY, when generating bld.inf + extensions for QMAKE_EXTRA_* variables for symbian-sbsv2 mkspec. + + - s60installs + * Fixed qsymbianbearer.qtplugin exports in s60installs.pro. + + - patch_capabilities.pl + * [QTBUG-13760] Improved output of patch_capabilities.pl script. - QInputContext * [QTBUG-12949] Fixed a bug where passwords would not be committed when @@ -325,6 +350,23 @@ Qt for Symbian * [QTBUG-13472] Fixed crash in input methods when using symbols menu and numbers only. + - QDesktopWidget + * [QTBUG-14058] Fix QApplication::desktop()->availableGeometry(). + + - QtCore + * [QTBUG-13802] Symbian^4 platform detection for QSysInfo::symbianVersion(). + * [QTBUG-13612] Do not wait for QThread exit when destroying global statics. + * [QT-3895] Change RLibrary handle in QS60PluginResolver to be process wide. + * [QTBUG-11218] Fix QProcessManager destruction. + + - Qt Plugins + * [QT-3949] Remove pre-Symbian3 plugins from Symbian3 and later builds and + Check S60_VERSION instead of existence of certain files in bearer plugin. + + - Demos & Examples + * [QTBUG-13461] Remove some .pro statements left behind after IAP usage cleanup + * [QTBUG-12276] Assigned valid UID3 for fortuneserver example. + Qt for Windows CE ----------------- - Gui -- cgit v0.12 From eb625b3112c241047e8d08146b63545165d33ebf Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Fri, 15 Oct 2010 13:36:02 +1000 Subject: Cleanup changelog for 4.7.1. --- dist/changes-4.7.1 | 328 ++++++++++++++++++++++++++++------------------------- 1 file changed, 173 insertions(+), 155 deletions(-) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index 51a10a3..b25b95c 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -13,7 +13,6 @@ corresponding to tasks in the Qt Bug Tracker, the (now obsolete) Task Tracker, or the Merge Request queue of the public source repository. Qt Bug Tracker: http://bugreports.qt.nokia.com -Task Tracker: http://qt.nokia.com/developer/task-tracker Merge Request: http://qt.gitorious.org **************************************************************************** @@ -31,8 +30,6 @@ Optimizations - On x86 and 86_64, the memory access has been improved for alpha blending and for some composition functions. - * See list of Important Behavior Changes below - **************************************************************************** * Library * @@ -42,69 +39,68 @@ QtCore ------ - Containers - * [QTBUG-13079] Fix assingment of a container included in the container itself + * [QTBUG-13079] Fix assignment of a container included in the container + itself. - - QLibrary - * [QT-3825] System libraries are only loaded from the system directories + - QEventDispatcherUnix + * [QTBUG-13633] Do not process too many timer events if other events need + to be processed first. + - QLibrary + * [QT-3825] System libraries are only loaded from the system directories. - QUuid - * [QTBUG-11213] QUuid::createUuid() should not generate identical sequences on UNIX - - - QEventDispatcherUnix - * [QTBUG-13633] Do not process too many timer events if other events need - to be processed first + * [QTBUG-11213] QUuid::createUuid() should not generate identical sequences + on UNIX. QtGui ----- - - QGraphicsWidget - * [QTBUG-13188] Make sure a font that has propagated from a parent can - be set on a QPainter. - * [QT-3808] Issues when applying effects in combination with ItemHasNoContents flag. + - QGraphicsEffect + * [QT-3633] Wrong bounding rect. - QGraphicsItem * [QTBUG-3633, QT-3828] Wrong children bounding rect when applying effects. - - QGraphicsEffect - * [QT-3633] Wrong bounding rect. - - QGraphicsScene * [QT-3674] Spurious assert triggered from render(). + - QGraphicsWidget + * [QTBUG-13188] Make sure a font that has propagated from a parent can + be set on a QPainter. + * [QT-3808] Issues when applying effects in combination with + ItemHasNoContents flag. + + - QGtkStyle + * [QTBUG-13125] Fixed a regression with custom itemview background color. + + - QLineEdit + * [QTBUG-13520] Fixed the scrolling of text with right alignment. + - QPainter * [QTBUG-13429] Fixed scale point drawing with square cap in the raster engine, plus some potential floating point overflows in the rasterizer. * Optimized pixmap drawing with SmoothPixmapTransform. - - QStaticText - * [QTBUG-12614] Fix crash with zero-width string. - * [QTBUG-12540] Fix rendering of large glyphs with OpenGL2 paint engine. - - - QPinchGesture * The scaleFactor and totalScaleFactor now represent a value that allows an object to track a touchpoint during a Pinch Gesture even when using sequences for zooming. - Therefor the scale factors are initialized to 1.0 and for every new + Therefore the scale factors are initialized to 1.0 and for every new sequence the totalScaleFactor is multiplied with the scaleFactor of the new sequence. - - QLineEdit - * [QTBUG-13520] Fixed the scrolling of text with right alignment - - QPixmap - * [QTBUG-12560] Fixed a regression preventing loading images without extensions + * [QTBUG-12560] Fixed a regression preventing loading images without + extensions. - - QTreeView - * [QTBUG-13567] Do not scroll to top if last item is removed - - - QGtkStyle - * [QTBUG-13125] Fixed a regression with custom itemview background color. + - QStaticText + * [QTBUG-12614] Fix crash with zero-width string. + * [QTBUG-12540] Fix rendering of large glyphs with OpenGL2 paint engine. -QtDBus ------- + - QTreeView + * [QTBUG-13567] Do not scroll to top if last item is removed. QtMultimedia @@ -115,151 +111,170 @@ QtMultimedia * [QTBUG-11883] Fixed segmentation fault when closing a QAudioInput or QAudioOutput. + QtNetwork --------- - - QSslConfiguration - * [QTBUG-13265] fix crash with empty configuration - - QSslCertificate - * [QTBUG-12489] support dates > 2049 - Bearer Management * Improved reliability on Symbian and Maemo. * Added connman/meego backend. - IPv6 - * Disable on Symbian until OpenC properly supports it + * Disable on Symbian until OpenC properly supports it. + - QSslConfiguration + * [QTBUG-13265] Fixed crash with empty configuration. + - QSslCertificate + * [QTBUG-12489] Support dates > 2049. - QNetworkAccessManager - * [QTBUG-12285] Crash fix related to aborted uploads + * [QTBUG-12285] Crash fix related to aborted uploads. QtOpenGL -------- - QGL2PaintEngineEx * Fixed drawing a large number of glyphs with the same font on systems - with small texure size limits. - -QtOpenVG --------- - - -QtWebKit --------- - - -QtSql ------ - + with small texture size limits. -QtSvg ------ QtXml ----- * Fixed a crash when parsing invalid tag names. + QtXmlPatterns ------------- - XML Schema internals: - * [QTBUG-11559] Only parse 3 digits of time fraction + * [QTBUG-11559] Only parse 3 digits of time fraction. + QtDeclarative ------------- - QML language - * [QTBUG-13799] QML core module renamed to QtQuick to decouple it from Qt releases. - Old "import Qt 4.7" will co-exist with "import QtQuick 1.0' at least during Qt 4.7 releases. - * [QTBUG-13047] Support passing QObject derived types to QML methods - * [QTBUG-12837] Support JS "in" operator on QML objects - * [QTBUG-13045] Prevent calling deleteLater() from QML - * [QTBUG-13043] Ignore non-scriptable properties in QML - * [QTBUG-13114] Don't double call classBegin() - * [QTBUG-12946] Ensure the onDestruction handlers are called before the expressions are cleared - * [QTBUG-12599] Re-enabled script program caching on Symbian - * [QTBUG-13374] Don't modify the signal order on the second dynamic meta object pass - * Support for qsTrId and meta-data in comments for QML - - QML debugging: + * [QTBUG-13799] QML core module renamed to QtQuick to decouple it from Qt + releases. Old "import Qt 4.7" will co-exist with "import QtQuick 1.0' at + least during Qt 4.7 releases. + * [QTBUG-13047] Support passing QObject derived types to QML methods. + * [QTBUG-12837] Support JS "in" operator on QML objects. + * [QTBUG-13045] Prevent calling deleteLater() from QML. + * [QTBUG-13043] Ignore non-scriptable properties in QML. + * [QTBUG-13114] Don't double call classBegin(). + * [QTBUG-12946] Ensure the onDestruction handlers are called before the + expressions are cleared. + * [QTBUG-12599] Re-enabled script program caching on Symbian. + * [QTBUG-13374] Don't modify the signal order on the second dynamic meta + object pass. + * Support for qsTrId and meta-data in comments for QML. + - QML debugging * [QTBUG-5162] The debugger is now activated with -qmljsdebugger command - line arg to enable support for platforms without environment variables - * Various improvements to ease debugging in creator + line arg to enable support for platforms without environment variables. + * Various improvements to ease debugging in creator. - AnchorAnimation - * [QTBUG-13398] Fix AnchorAnimation for multiple AnchorChanges with dependancies + * [QTBUG-13398] Fix AnchorAnimation for multiple AnchorChanges with + dependancies. - AnchorChanges - * [QTBUG-11834] Restore any absolute geometry changed by AnchorChanges when returning to the base state + * [QTBUG-11834] Restore any absolute geometry changed by AnchorChanges when + returning to the base state. - Component - * [QTBUG-13170] Complete Component::createObject() creation after setting the parent + * [QTBUG-13170] Complete Component::createObject() creation after setting + the parent. - GridView - * [QTBUG-13166] GridView.view property should not be writable + * [QTBUG-13166] GridView.view property should not be writable. - Flickable - * [QTBUG-13095] Ensure Flickable visibleArea is updated when view height changes - * [QTBUG-13176] Avoid Flickable view jumping when drag threashold is exceeded - * [QTBUG-13078] Fix poor flicking behavior with slower flicks - * Handle QGraphicsWidgets in Flickable + * [QTBUG-13095] Ensure Flickable visibleArea is updated when view height + changes. + * [QTBUG-13176] Avoid Flickable view jumping when drag threashold is + exceeded. + * [QTBUG-13078] Fix poor flicking behavior with slower flicks. + * Handle QGraphicsWidgets in Flickable. - FocusScope - * [QTBUG-12649] Make sure onFocusChanged is correctly emitted for items in a FocusScope. + * [QTBUG-12649] Make sure onFocusChanged is correctly emitted for items + in a FocusScope. - FontLoader - * [QTBUG-13419] Don't add the same font to the font database multiple times + * [QTBUG-13419] Don't add the same font to the font database multiple + times. + - Image + * [QTBUG-13454] Changing the Image 'source' no longer goes through the + 'Loading' state if the image is cached. + * [QTBUG-13383] Do not reset sourceSize when changing image source url. + * [QTBUG-13002] Setting one dimension of the sourceSize should set the other + dimension. + * [QTBUG-12302] Fix remote image url redirects are done in the right thread. + * Ensure all image states are updated before emitting statusChanged signals. - ListModel - * [QTBUG-12363] Modifying an object returned by ListModel.get(0) didn't update the view - * [QTBUG-13666] Calling set() and setProperty() on ListModel from a WorkerScript didn't update the view - * Fix Worker ListModel to emit the right signal when items change - * Fix crash with invalid role indexes - * improved ListModel error messages + * [QTBUG-12363] Modifying an object returned by ListModel.get(0) didn't + update the view. + * [QTBUG-13666] Calling set() and setProperty() on ListModel from a + WorkerScript didn't update the view. + * Fix Worker ListModel to emit the right signal when items change. + * Fix crash with invalid role indexes. + * improved ListModel error messages. - ListView - * [QTBUG-13664] Models with a single role didn't always update correctly - * [QTBUG-13543] Ensure flickable velocity is updated when view is moved by setCurrentIndex - * [QTBUG-12664] Ensure highlight is positioned correctly in positionViewAtIndex() - * [QTBUG-13166] Fix ListView.view attached property with VisualItemModel - * [QTBUG-13039] Fix crash in synchronization of ListModel in WorkerThread - * [QTBUG-11341] Flicking a ListView sometimes made it loose focus - * [QTBUG-13166] ListView.view property should not be writable + * [QTBUG-13664] Models with a single role didn't always update correctly. + * [QTBUG-13543] Ensure flickable velocity is updated when view is moved by + setCurrentIndex. + * [QTBUG-12664] Ensure highlight is positioned correctly in + positionViewAtIndex(). + * [QTBUG-13166] Fix ListView.view attached property with VisualItemModel. + * [QTBUG-13039] Fix crash in synchronization of ListModel in WorkerThread. + * [QTBUG-11341] Flicking a ListView sometimes made it lose focus. + * [QTBUG-13166] ListView.view property should not be writable. + - MouseArea + * [QTBUG-12250] When onDoubleClicked: is handled don't emit a second + onPressed/onClicked. + - NumberAnimation + * [QTBUG-12805] Clear previous animation data for non-triggering animations. + - ParentChange + * [QTBUG-13554] ParentChange fails to apply rotation changes of exactly 180 + degrees. - PathView - * [QTBUG-13689] Moving items in a PathView caused PathView.onPath to be set to false - * [QTBUG-13687] PathView didn't accept mouse events, preventing it from working in a Flickable - * [QTBUG-13416] Fix PathView item position on insertion and removal - * [QTBUG-13017] Fix PathView when setting an empty model that is later filled - * [QTBUG-12747] PathView required some diagonal movement before a drag was initiated + * [QTBUG-13689] Moving items in a PathView caused PathView.onPath to be set + to false. + * [QTBUG-13687] PathView didn't accept mouse events, preventing it from + working in a Flickable. + * [QTBUG-13416] Fix PathView item position on insertion and removal. + * [QTBUG-13017] Fix PathView when setting an empty model that is later + filled. + * [QTBUG-12747] PathView required some diagonal movement before a drag was + initiated. - Positioners - * made positioners work with QGraphicsWidgets + * made positioners work with QGraphicsWidgets. - PropertyChanges - * [QTBUG-12559] Correctly apply PropertyChanges when entering an extended state directly from the base state - - VisualDataModel - * [QTBUG-13754] Fixed a crash when updating a property in ListModel with multiple roles - * [QTBUG-13038] Fix VisualDataModel model update handling when rootIndex is specified - * [QTBUG-13146] Handle layoutChanged() properly in QML views - - XmlListModel - * [QTBUG-13041] XmlListModel thread was left hanging on Symbian application exit - - ParentChange - * [QTBUG-13554] ParentChange fails to apply rotation changes of exactly 180 degrees - - MouseArea - * [QTBUG-12250] When onDoubleClicked: is handled don't emit a second onPressed/onClicked - - Image - * [QTBUG-13454] Changing the Image 'source' no longer goes through the 'Loading' state if the image is cached. - * [QTBUG-13383] Do not reset sourceSize when changing image source url - * [QTBUG-13002] Setting one dimension of the sourceSize should set the other dimensio - * [QTBUG-12302] Fix remote image url redirects are done in the right thread - * Ensure all image states are updated before emitting statusChanged signals - - NumberAnimation - * [QTBUG-12805] Clear previous animation data for non-triggering animations + * [QTBUG-12559] Correctly apply PropertyChanges when entering an extended + state directly from the base state. + - QDeclarativeImageProvider: + * Fixed memory leak. + * Improved concurrency when using in asynchronus mode. - Repeater - * [QTBUG-12905] Emit countChanged where appropriate in Repeater + * [QTBUG-12905] Emit countChanged where appropriate in Repeater. - SmoothedAnimation - * [QTBUG-12336] Update running animations if a SmoothedAnimation is changed + * [QTBUG-12336] Update running animations if a SmoothedAnimation is changed. - SpringAnimation - * [QTBUG-13044] SpringAnimation velocity animation stop logic was fragile + * [QTBUG-13044] SpringAnimation velocity animation stop logic was fragile. - Text - * [QTBUG-13453] Fix jerky scrolling caused by unnecessary repaints of Text element - * [QTBUG-13142] Fix alignment of shadow for rich text when using text styles - * [QTBUG-11002] Improve QML text rendering when LCD smoothing is enabled for OS X + * [QTBUG-13453] Fix jerky scrolling caused by unnecessary repaints of Text + element. + * [QTBUG-13142] Fix alignment of shadow for rich text when using text + styles. + * [QTBUG-11002] Improve QML text rendering when LCD smoothing is enabled + for OS X. - TextInput - * [QTBUG-11127] Fix autoScroll implementation - - XmlHttpRequest - * [QTBUG-13117] Fix responseText to check the charset encoding field and also to not assume that the data is xml + * [QTBUG-11127] Fix autoScroll implementation. + - VisualDataModel + * [QTBUG-13754] Fixed a crash when updating a property in ListModel with + multiple roles. + * [QTBUG-13038] Fix VisualDataModel model update handling when rootIndex is + specified. + * [QTBUG-13146] Handle layoutChanged() properly in QML views. - WebView - * [QTBUG-13342] Ensure WebView gets focus when an editable node is clicked on - - QDeclarativeImageProvider: - * Fixed memory leak - * Improved concurrency when using in assynchronus mode. + * [QTBUG-13342] Ensure WebView gets focus when an editable node is clicked. + - XmlHttpRequest + * [QTBUG-13117] Fix responseText to check the charset encoding field and + also to not assume that the data is xml. + - XmlListModel + * [QTBUG-13041] XmlListModel thread was left hanging on Symbian application + exit. + Qt Plugins ---------- - - Jpeg image IO plugin * [QTBUG-13653] Fixed infinite loop when loading jpeg without EOI marker from memory. @@ -275,15 +290,16 @@ Qt for Unix (X11 and Mac OS X) Qt for Linux/X11 ---------------- - - The configure script now detects all vector extensions of x86 and x86_64 + - The configure script now detects all vector extensions of x86 and x86_64. Qt for Windows -------------- - Event System: - * [QTBUG-12721] Fix Qt applications freezing until mouse/keyboard events occur. + * [QTBUG-12721] Fix Qt applications freezing until mouse/keyboard events + occur. - Drag & Drop: - * [QTBUG-13787] Fixed a possible crash with mingw + * [QTBUG-13787] Fixed a possible crash with mingw. - QPrinter * [QTBUG-12263] Strokes were in some cases not printed with the correct @@ -303,7 +319,6 @@ Qt for Mac OS X Qt for Symbian -------------- - - configure * [QTBUG-4586] Fixed wrong paths in include/ActiveQt/headers.pri. * [QTBUG-11671] Fixed audio-backend detection in configure tests. @@ -319,21 +334,27 @@ Qt for Symbian * [QTBUG-13081] vc[x]proj generators: support /MAP option without file name. * [QTBUG-13902] Added support for unsigned smart installer package creation. - * [QTBUG-13991] No longer need to manually edit smart installer pkg file for publishing. + * [QTBUG-13991] No longer need to manually edit smart installer pkg file for + publishing. * [QT-3949] Load environment.prf from Symbian SDK if it exists there. - * [QTBUG-13499] Provide a way to compile with RVCT 4.0 using generated Makefile. + * [QTBUG-13499] Provide a way to compile with RVCT 4.0 using generated + Makefile. * [QTBUG-13336] Ignore MAKEFILE variable for Symbian abld and sbsv2 builds. - * [QTBUG-13363] Fix Symbian handling of projects with special characters in TARGET. + * [QTBUG-13363] Fix Symbian handling of projects with special characters in + TARGET. * [QTBUG-12762 & QTBUG-13307] Gcce building support for symbian-sbsv2 * [QTBUG-13147] Added support for DEPLOYMENT.pkg_build_version * [QTBUG-12884] Fix "installer_sis" and "deploy" targets when TARGET has path. * [QTBUG-12879] Fix check to remove unnecessary deployments in Symbian. * [QTBUG-12716] Make bld.inf target in Symbian mkspecs to depend on .pro file. - * [QTBUG-12715] Rename Symbian generated mmp/mk files to include target in filename. - * [QTBUG-12617] Fix package header in cases where VERSION doesn't contain all values. + * [QTBUG-12715] Rename Symbian generated mmp/mk files to include target in + filename. + * [QTBUG-12617] Fix package header in cases where VERSION doesn't contain all + values. * Fix run and runonphone targets for projects that have TARGET with path. * Fix QT_LIBINFIX for QT_PLUGINS_BASE_DIR. - * No longer require PRE_TARGETDEPS items to be absolute for symbian-sbsv2 mkspec. + * No longer require PRE_TARGETDEPS items to be absolute for symbian-sbsv2 + mkspec. * Do smart command replacement for commands containing $$QMAKE_* command variables, such as $$QMAKE_COPY, when generating bld.inf extensions for QMAKE_EXTRA_* variables for symbian-sbsv2 mkspec. @@ -364,7 +385,8 @@ Qt for Symbian Check S60_VERSION instead of existence of certain files in bearer plugin. - Demos & Examples - * [QTBUG-13461] Remove some .pro statements left behind after IAP usage cleanup + * [QTBUG-13461] Remove some .pro statements left behind after IAP usage + cleanup. * [QTBUG-12276] Assigned valid UID3 for fortuneserver example. Qt for Windows CE @@ -372,25 +394,21 @@ Qt for Windows CE - Gui * [QTBUG-8408] Show the [X] button on Windows mobile when maximizing. + **************************************************************************** * Tools * **************************************************************************** - - Designer - - uic - * Improve warnings and error reports + * Improve warnings and error reports. - moc - * Show an error if NOTIFY refer to a wrong signal in Q_PROPERTY + * Show an error if NOTIFY refer to a wrong signal in Q_PROPERTY. - QML Viewer - * [QTBUG-13347] Paused orientation sensors in Qml Viewer when the application window is not active to save device battery - * [QTBUG-11019] Add a menu option to open remote files in the QML viewer - * QML Viewer is deployed under QtDemos folder instead of QtExamples folder in Symbian application menu - -**************************************************************************** -* Important Behavior Changes * -**************************************************************************** - + * [QTBUG-13347] Paused orientation sensors in Qml Viewer when the + application window is not active to save device battery. + * [QTBUG-11019] Add a menu option to open remote files in the QML viewer. + * QML Viewer is deployed under QtDemos folder instead of QtExamples + folder in Symbian application menu. -- cgit v0.12 From 88c9c3c1d8db356e69573c626618a979ac005b21 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Fri, 15 Oct 2010 13:37:49 +1000 Subject: Actually call update in the Text Element Task-number: QTBUG-14469 Reviewed-by: Aaron Kennedy --- src/declarative/graphicsitems/qdeclarativetext.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 22282d2..0717b78 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -270,6 +270,7 @@ void QDeclarativeTextPrivate::updateSize() internalWidthUpdate = false; q->setImplicitHeight(size.height()); emit q->paintedSizeChanged(); + q->update(); } /*! -- cgit v0.12 From 671e13acdd0b5b65e1842bad7e47d2f8c170f586 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Fri, 15 Oct 2010 13:36:02 +1000 Subject: Cleanup changelog for 4.7.1. (cherry picked from commit eb625b3112c241047e8d08146b63545165d33ebf) --- dist/changes-4.7.1 | 328 ++++++++++++++++++++++++++++------------------------- 1 file changed, 173 insertions(+), 155 deletions(-) diff --git a/dist/changes-4.7.1 b/dist/changes-4.7.1 index 51a10a3..b25b95c 100644 --- a/dist/changes-4.7.1 +++ b/dist/changes-4.7.1 @@ -13,7 +13,6 @@ corresponding to tasks in the Qt Bug Tracker, the (now obsolete) Task Tracker, or the Merge Request queue of the public source repository. Qt Bug Tracker: http://bugreports.qt.nokia.com -Task Tracker: http://qt.nokia.com/developer/task-tracker Merge Request: http://qt.gitorious.org **************************************************************************** @@ -31,8 +30,6 @@ Optimizations - On x86 and 86_64, the memory access has been improved for alpha blending and for some composition functions. - * See list of Important Behavior Changes below - **************************************************************************** * Library * @@ -42,69 +39,68 @@ QtCore ------ - Containers - * [QTBUG-13079] Fix assingment of a container included in the container itself + * [QTBUG-13079] Fix assignment of a container included in the container + itself. - - QLibrary - * [QT-3825] System libraries are only loaded from the system directories + - QEventDispatcherUnix + * [QTBUG-13633] Do not process too many timer events if other events need + to be processed first. + - QLibrary + * [QT-3825] System libraries are only loaded from the system directories. - QUuid - * [QTBUG-11213] QUuid::createUuid() should not generate identical sequences on UNIX - - - QEventDispatcherUnix - * [QTBUG-13633] Do not process too many timer events if other events need - to be processed first + * [QTBUG-11213] QUuid::createUuid() should not generate identical sequences + on UNIX. QtGui ----- - - QGraphicsWidget - * [QTBUG-13188] Make sure a font that has propagated from a parent can - be set on a QPainter. - * [QT-3808] Issues when applying effects in combination with ItemHasNoContents flag. + - QGraphicsEffect + * [QT-3633] Wrong bounding rect. - QGraphicsItem * [QTBUG-3633, QT-3828] Wrong children bounding rect when applying effects. - - QGraphicsEffect - * [QT-3633] Wrong bounding rect. - - QGraphicsScene * [QT-3674] Spurious assert triggered from render(). + - QGraphicsWidget + * [QTBUG-13188] Make sure a font that has propagated from a parent can + be set on a QPainter. + * [QT-3808] Issues when applying effects in combination with + ItemHasNoContents flag. + + - QGtkStyle + * [QTBUG-13125] Fixed a regression with custom itemview background color. + + - QLineEdit + * [QTBUG-13520] Fixed the scrolling of text with right alignment. + - QPainter * [QTBUG-13429] Fixed scale point drawing with square cap in the raster engine, plus some potential floating point overflows in the rasterizer. * Optimized pixmap drawing with SmoothPixmapTransform. - - QStaticText - * [QTBUG-12614] Fix crash with zero-width string. - * [QTBUG-12540] Fix rendering of large glyphs with OpenGL2 paint engine. - - - QPinchGesture * The scaleFactor and totalScaleFactor now represent a value that allows an object to track a touchpoint during a Pinch Gesture even when using sequences for zooming. - Therefor the scale factors are initialized to 1.0 and for every new + Therefore the scale factors are initialized to 1.0 and for every new sequence the totalScaleFactor is multiplied with the scaleFactor of the new sequence. - - QLineEdit - * [QTBUG-13520] Fixed the scrolling of text with right alignment - - QPixmap - * [QTBUG-12560] Fixed a regression preventing loading images without extensions + * [QTBUG-12560] Fixed a regression preventing loading images without + extensions. - - QTreeView - * [QTBUG-13567] Do not scroll to top if last item is removed - - - QGtkStyle - * [QTBUG-13125] Fixed a regression with custom itemview background color. + - QStaticText + * [QTBUG-12614] Fix crash with zero-width string. + * [QTBUG-12540] Fix rendering of large glyphs with OpenGL2 paint engine. -QtDBus ------- + - QTreeView + * [QTBUG-13567] Do not scroll to top if last item is removed. QtMultimedia @@ -115,151 +111,170 @@ QtMultimedia * [QTBUG-11883] Fixed segmentation fault when closing a QAudioInput or QAudioOutput. + QtNetwork --------- - - QSslConfiguration - * [QTBUG-13265] fix crash with empty configuration - - QSslCertificate - * [QTBUG-12489] support dates > 2049 - Bearer Management * Improved reliability on Symbian and Maemo. * Added connman/meego backend. - IPv6 - * Disable on Symbian until OpenC properly supports it + * Disable on Symbian until OpenC properly supports it. + - QSslConfiguration + * [QTBUG-13265] Fixed crash with empty configuration. + - QSslCertificate + * [QTBUG-12489] Support dates > 2049. - QNetworkAccessManager - * [QTBUG-12285] Crash fix related to aborted uploads + * [QTBUG-12285] Crash fix related to aborted uploads. QtOpenGL -------- - QGL2PaintEngineEx * Fixed drawing a large number of glyphs with the same font on systems - with small texure size limits. - -QtOpenVG --------- - - -QtWebKit --------- - - -QtSql ------ - + with small texture size limits. -QtSvg ------ QtXml ----- * Fixed a crash when parsing invalid tag names. + QtXmlPatterns ------------- - XML Schema internals: - * [QTBUG-11559] Only parse 3 digits of time fraction + * [QTBUG-11559] Only parse 3 digits of time fraction. + QtDeclarative ------------- - QML language - * [QTBUG-13799] QML core module renamed to QtQuick to decouple it from Qt releases. - Old "import Qt 4.7" will co-exist with "import QtQuick 1.0' at least during Qt 4.7 releases. - * [QTBUG-13047] Support passing QObject derived types to QML methods - * [QTBUG-12837] Support JS "in" operator on QML objects - * [QTBUG-13045] Prevent calling deleteLater() from QML - * [QTBUG-13043] Ignore non-scriptable properties in QML - * [QTBUG-13114] Don't double call classBegin() - * [QTBUG-12946] Ensure the onDestruction handlers are called before the expressions are cleared - * [QTBUG-12599] Re-enabled script program caching on Symbian - * [QTBUG-13374] Don't modify the signal order on the second dynamic meta object pass - * Support for qsTrId and meta-data in comments for QML - - QML debugging: + * [QTBUG-13799] QML core module renamed to QtQuick to decouple it from Qt + releases. Old "import Qt 4.7" will co-exist with "import QtQuick 1.0' at + least during Qt 4.7 releases. + * [QTBUG-13047] Support passing QObject derived types to QML methods. + * [QTBUG-12837] Support JS "in" operator on QML objects. + * [QTBUG-13045] Prevent calling deleteLater() from QML. + * [QTBUG-13043] Ignore non-scriptable properties in QML. + * [QTBUG-13114] Don't double call classBegin(). + * [QTBUG-12946] Ensure the onDestruction handlers are called before the + expressions are cleared. + * [QTBUG-12599] Re-enabled script program caching on Symbian. + * [QTBUG-13374] Don't modify the signal order on the second dynamic meta + object pass. + * Support for qsTrId and meta-data in comments for QML. + - QML debugging * [QTBUG-5162] The debugger is now activated with -qmljsdebugger command - line arg to enable support for platforms without environment variables - * Various improvements to ease debugging in creator + line arg to enable support for platforms without environment variables. + * Various improvements to ease debugging in creator. - AnchorAnimation - * [QTBUG-13398] Fix AnchorAnimation for multiple AnchorChanges with dependancies + * [QTBUG-13398] Fix AnchorAnimation for multiple AnchorChanges with + dependancies. - AnchorChanges - * [QTBUG-11834] Restore any absolute geometry changed by AnchorChanges when returning to the base state + * [QTBUG-11834] Restore any absolute geometry changed by AnchorChanges when + returning to the base state. - Component - * [QTBUG-13170] Complete Component::createObject() creation after setting the parent + * [QTBUG-13170] Complete Component::createObject() creation after setting + the parent. - GridView - * [QTBUG-13166] GridView.view property should not be writable + * [QTBUG-13166] GridView.view property should not be writable. - Flickable - * [QTBUG-13095] Ensure Flickable visibleArea is updated when view height changes - * [QTBUG-13176] Avoid Flickable view jumping when drag threashold is exceeded - * [QTBUG-13078] Fix poor flicking behavior with slower flicks - * Handle QGraphicsWidgets in Flickable + * [QTBUG-13095] Ensure Flickable visibleArea is updated when view height + changes. + * [QTBUG-13176] Avoid Flickable view jumping when drag threashold is + exceeded. + * [QTBUG-13078] Fix poor flicking behavior with slower flicks. + * Handle QGraphicsWidgets in Flickable. - FocusScope - * [QTBUG-12649] Make sure onFocusChanged is correctly emitted for items in a FocusScope. + * [QTBUG-12649] Make sure onFocusChanged is correctly emitted for items + in a FocusScope. - FontLoader - * [QTBUG-13419] Don't add the same font to the font database multiple times + * [QTBUG-13419] Don't add the same font to the font database multiple + times. + - Image + * [QTBUG-13454] Changing the Image 'source' no longer goes through the + 'Loading' state if the image is cached. + * [QTBUG-13383] Do not reset sourceSize when changing image source url. + * [QTBUG-13002] Setting one dimension of the sourceSize should set the other + dimension. + * [QTBUG-12302] Fix remote image url redirects are done in the right thread. + * Ensure all image states are updated before emitting statusChanged signals. - ListModel - * [QTBUG-12363] Modifying an object returned by ListModel.get(0) didn't update the view - * [QTBUG-13666] Calling set() and setProperty() on ListModel from a WorkerScript didn't update the view - * Fix Worker ListModel to emit the right signal when items change - * Fix crash with invalid role indexes - * improved ListModel error messages + * [QTBUG-12363] Modifying an object returned by ListModel.get(0) didn't + update the view. + * [QTBUG-13666] Calling set() and setProperty() on ListModel from a + WorkerScript didn't update the view. + * Fix Worker ListModel to emit the right signal when items change. + * Fix crash with invalid role indexes. + * improved ListModel error messages. - ListView - * [QTBUG-13664] Models with a single role didn't always update correctly - * [QTBUG-13543] Ensure flickable velocity is updated when view is moved by setCurrentIndex - * [QTBUG-12664] Ensure highlight is positioned correctly in positionViewAtIndex() - * [QTBUG-13166] Fix ListView.view attached property with VisualItemModel - * [QTBUG-13039] Fix crash in synchronization of ListModel in WorkerThread - * [QTBUG-11341] Flicking a ListView sometimes made it loose focus - * [QTBUG-13166] ListView.view property should not be writable + * [QTBUG-13664] Models with a single role didn't always update correctly. + * [QTBUG-13543] Ensure flickable velocity is updated when view is moved by + setCurrentIndex. + * [QTBUG-12664] Ensure highlight is positioned correctly in + positionViewAtIndex(). + * [QTBUG-13166] Fix ListView.view attached property with VisualItemModel. + * [QTBUG-13039] Fix crash in synchronization of ListModel in WorkerThread. + * [QTBUG-11341] Flicking a ListView sometimes made it lose focus. + * [QTBUG-13166] ListView.view property should not be writable. + - MouseArea + * [QTBUG-12250] When onDoubleClicked: is handled don't emit a second + onPressed/onClicked. + - NumberAnimation + * [QTBUG-12805] Clear previous animation data for non-triggering animations. + - ParentChange + * [QTBUG-13554] ParentChange fails to apply rotation changes of exactly 180 + degrees. - PathView - * [QTBUG-13689] Moving items in a PathView caused PathView.onPath to be set to false - * [QTBUG-13687] PathView didn't accept mouse events, preventing it from working in a Flickable - * [QTBUG-13416] Fix PathView item position on insertion and removal - * [QTBUG-13017] Fix PathView when setting an empty model that is later filled - * [QTBUG-12747] PathView required some diagonal movement before a drag was initiated + * [QTBUG-13689] Moving items in a PathView caused PathView.onPath to be set + to false. + * [QTBUG-13687] PathView didn't accept mouse events, preventing it from + working in a Flickable. + * [QTBUG-13416] Fix PathView item position on insertion and removal. + * [QTBUG-13017] Fix PathView when setting an empty model that is later + filled. + * [QTBUG-12747] PathView required some diagonal movement before a drag was + initiated. - Positioners - * made positioners work with QGraphicsWidgets + * made positioners work with QGraphicsWidgets. - PropertyChanges - * [QTBUG-12559] Correctly apply PropertyChanges when entering an extended state directly from the base state - - VisualDataModel - * [QTBUG-13754] Fixed a crash when updating a property in ListModel with multiple roles - * [QTBUG-13038] Fix VisualDataModel model update handling when rootIndex is specified - * [QTBUG-13146] Handle layoutChanged() properly in QML views - - XmlListModel - * [QTBUG-13041] XmlListModel thread was left hanging on Symbian application exit - - ParentChange - * [QTBUG-13554] ParentChange fails to apply rotation changes of exactly 180 degrees - - MouseArea - * [QTBUG-12250] When onDoubleClicked: is handled don't emit a second onPressed/onClicked - - Image - * [QTBUG-13454] Changing the Image 'source' no longer goes through the 'Loading' state if the image is cached. - * [QTBUG-13383] Do not reset sourceSize when changing image source url - * [QTBUG-13002] Setting one dimension of the sourceSize should set the other dimensio - * [QTBUG-12302] Fix remote image url redirects are done in the right thread - * Ensure all image states are updated before emitting statusChanged signals - - NumberAnimation - * [QTBUG-12805] Clear previous animation data for non-triggering animations + * [QTBUG-12559] Correctly apply PropertyChanges when entering an extended + state directly from the base state. + - QDeclarativeImageProvider: + * Fixed memory leak. + * Improved concurrency when using in asynchronus mode. - Repeater - * [QTBUG-12905] Emit countChanged where appropriate in Repeater + * [QTBUG-12905] Emit countChanged where appropriate in Repeater. - SmoothedAnimation - * [QTBUG-12336] Update running animations if a SmoothedAnimation is changed + * [QTBUG-12336] Update running animations if a SmoothedAnimation is changed. - SpringAnimation - * [QTBUG-13044] SpringAnimation velocity animation stop logic was fragile + * [QTBUG-13044] SpringAnimation velocity animation stop logic was fragile. - Text - * [QTBUG-13453] Fix jerky scrolling caused by unnecessary repaints of Text element - * [QTBUG-13142] Fix alignment of shadow for rich text when using text styles - * [QTBUG-11002] Improve QML text rendering when LCD smoothing is enabled for OS X + * [QTBUG-13453] Fix jerky scrolling caused by unnecessary repaints of Text + element. + * [QTBUG-13142] Fix alignment of shadow for rich text when using text + styles. + * [QTBUG-11002] Improve QML text rendering when LCD smoothing is enabled + for OS X. - TextInput - * [QTBUG-11127] Fix autoScroll implementation - - XmlHttpRequest - * [QTBUG-13117] Fix responseText to check the charset encoding field and also to not assume that the data is xml + * [QTBUG-11127] Fix autoScroll implementation. + - VisualDataModel + * [QTBUG-13754] Fixed a crash when updating a property in ListModel with + multiple roles. + * [QTBUG-13038] Fix VisualDataModel model update handling when rootIndex is + specified. + * [QTBUG-13146] Handle layoutChanged() properly in QML views. - WebView - * [QTBUG-13342] Ensure WebView gets focus when an editable node is clicked on - - QDeclarativeImageProvider: - * Fixed memory leak - * Improved concurrency when using in assynchronus mode. + * [QTBUG-13342] Ensure WebView gets focus when an editable node is clicked. + - XmlHttpRequest + * [QTBUG-13117] Fix responseText to check the charset encoding field and + also to not assume that the data is xml. + - XmlListModel + * [QTBUG-13041] XmlListModel thread was left hanging on Symbian application + exit. + Qt Plugins ---------- - - Jpeg image IO plugin * [QTBUG-13653] Fixed infinite loop when loading jpeg without EOI marker from memory. @@ -275,15 +290,16 @@ Qt for Unix (X11 and Mac OS X) Qt for Linux/X11 ---------------- - - The configure script now detects all vector extensions of x86 and x86_64 + - The configure script now detects all vector extensions of x86 and x86_64. Qt for Windows -------------- - Event System: - * [QTBUG-12721] Fix Qt applications freezing until mouse/keyboard events occur. + * [QTBUG-12721] Fix Qt applications freezing until mouse/keyboard events + occur. - Drag & Drop: - * [QTBUG-13787] Fixed a possible crash with mingw + * [QTBUG-13787] Fixed a possible crash with mingw. - QPrinter * [QTBUG-12263] Strokes were in some cases not printed with the correct @@ -303,7 +319,6 @@ Qt for Mac OS X Qt for Symbian -------------- - - configure * [QTBUG-4586] Fixed wrong paths in include/ActiveQt/headers.pri. * [QTBUG-11671] Fixed audio-backend detection in configure tests. @@ -319,21 +334,27 @@ Qt for Symbian * [QTBUG-13081] vc[x]proj generators: support /MAP option without file name. * [QTBUG-13902] Added support for unsigned smart installer package creation. - * [QTBUG-13991] No longer need to manually edit smart installer pkg file for publishing. + * [QTBUG-13991] No longer need to manually edit smart installer pkg file for + publishing. * [QT-3949] Load environment.prf from Symbian SDK if it exists there. - * [QTBUG-13499] Provide a way to compile with RVCT 4.0 using generated Makefile. + * [QTBUG-13499] Provide a way to compile with RVCT 4.0 using generated + Makefile. * [QTBUG-13336] Ignore MAKEFILE variable for Symbian abld and sbsv2 builds. - * [QTBUG-13363] Fix Symbian handling of projects with special characters in TARGET. + * [QTBUG-13363] Fix Symbian handling of projects with special characters in + TARGET. * [QTBUG-12762 & QTBUG-13307] Gcce building support for symbian-sbsv2 * [QTBUG-13147] Added support for DEPLOYMENT.pkg_build_version * [QTBUG-12884] Fix "installer_sis" and "deploy" targets when TARGET has path. * [QTBUG-12879] Fix check to remove unnecessary deployments in Symbian. * [QTBUG-12716] Make bld.inf target in Symbian mkspecs to depend on .pro file. - * [QTBUG-12715] Rename Symbian generated mmp/mk files to include target in filename. - * [QTBUG-12617] Fix package header in cases where VERSION doesn't contain all values. + * [QTBUG-12715] Rename Symbian generated mmp/mk files to include target in + filename. + * [QTBUG-12617] Fix package header in cases where VERSION doesn't contain all + values. * Fix run and runonphone targets for projects that have TARGET with path. * Fix QT_LIBINFIX for QT_PLUGINS_BASE_DIR. - * No longer require PRE_TARGETDEPS items to be absolute for symbian-sbsv2 mkspec. + * No longer require PRE_TARGETDEPS items to be absolute for symbian-sbsv2 + mkspec. * Do smart command replacement for commands containing $$QMAKE_* command variables, such as $$QMAKE_COPY, when generating bld.inf extensions for QMAKE_EXTRA_* variables for symbian-sbsv2 mkspec. @@ -364,7 +385,8 @@ Qt for Symbian Check S60_VERSION instead of existence of certain files in bearer plugin. - Demos & Examples - * [QTBUG-13461] Remove some .pro statements left behind after IAP usage cleanup + * [QTBUG-13461] Remove some .pro statements left behind after IAP usage + cleanup. * [QTBUG-12276] Assigned valid UID3 for fortuneserver example. Qt for Windows CE @@ -372,25 +394,21 @@ Qt for Windows CE - Gui * [QTBUG-8408] Show the [X] button on Windows mobile when maximizing. + **************************************************************************** * Tools * **************************************************************************** - - Designer - - uic - * Improve warnings and error reports + * Improve warnings and error reports. - moc - * Show an error if NOTIFY refer to a wrong signal in Q_PROPERTY + * Show an error if NOTIFY refer to a wrong signal in Q_PROPERTY. - QML Viewer - * [QTBUG-13347] Paused orientation sensors in Qml Viewer when the application window is not active to save device battery - * [QTBUG-11019] Add a menu option to open remote files in the QML viewer - * QML Viewer is deployed under QtDemos folder instead of QtExamples folder in Symbian application menu - -**************************************************************************** -* Important Behavior Changes * -**************************************************************************** - + * [QTBUG-13347] Paused orientation sensors in Qml Viewer when the + application window is not active to save device battery. + * [QTBUG-11019] Add a menu option to open remote files in the QML viewer. + * QML Viewer is deployed under QtDemos folder instead of QtExamples + folder in Symbian application menu. -- cgit v0.12 From 98161f191ba6f3353404c61829e88419d7c4688a Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Thu, 14 Oct 2010 15:21:28 +0200 Subject: Workaround for QFileSystemWatcher regression Don't call removePath() when it was not added before. Reviewed-by: con Task-number: QTBUG-14435 (cherry picked from commit f38e8394eae20f7290688629ab66720ebacd64c9) --- tools/designer/src/lib/shared/qtresourcemodel.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/designer/src/lib/shared/qtresourcemodel.cpp b/tools/designer/src/lib/shared/qtresourcemodel.cpp index 709f389..e3fc805 100644 --- a/tools/designer/src/lib/shared/qtresourcemodel.cpp +++ b/tools/designer/src/lib/shared/qtresourcemodel.cpp @@ -428,10 +428,10 @@ void QtResourceModelPrivate::removeOldPaths(QtResourceSet *resourceSet, const QS void QtResourceModelPrivate::setWatcherEnabled(const QString &path, bool enable) { - m_fileWatcher->removePath(path); - - if (!enable) + if (!enable) { + m_fileWatcher->removePath(path); return; + } QFileInfo fi(path); if (fi.exists()) -- cgit v0.12 From f2b11f645531ec5c31c839faa933cebde1440c8e Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 15 Oct 2010 14:17:31 +1000 Subject: Additional autotests for VisualDataModel. --- .../data/modelproperties.qml | 17 ++++ .../data/modelproperties2.qml | 17 ++++ .../tst_qdeclarativevisualdatamodel.cpp | 108 +++++++++++++++++++++ 3 files changed, 142 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativevisualdatamodel/data/modelproperties.qml create mode 100644 tests/auto/declarative/qdeclarativevisualdatamodel/data/modelproperties2.qml diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/data/modelproperties.qml b/tests/auto/declarative/qdeclarativevisualdatamodel/data/modelproperties.qml new file mode 100644 index 0000000..8cd5763 --- /dev/null +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/data/modelproperties.qml @@ -0,0 +1,17 @@ +import QtQuick 1.0 + +ListView { + model: myModel + delegate: Item { + objectName: "delegate" + property variant test1: name + property variant test2: model.name + property variant test3: modelData + property variant test4: model.modelData + property variant test5: modelData.name + property variant test6: model + property variant test7: index + property variant test8: model.index + property variant test9: model.modelData.name + } +} diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/data/modelproperties2.qml b/tests/auto/declarative/qdeclarativevisualdatamodel/data/modelproperties2.qml new file mode 100644 index 0000000..67721c9 --- /dev/null +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/data/modelproperties2.qml @@ -0,0 +1,17 @@ +import QtQuick 1.0 + +ListView { + model: myModel + delegate: Item { + objectName: "delegate" + property variant test1: display + property variant test2: model.display + property variant test3: modelData + property variant test4: model.modelData + property variant test5: modelData.display + property variant test6: model + property variant test7: index + property variant test8: model.index + property variant test9: model.modelData.display + } +} diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp index d73a872..0aad099 100644 --- a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp @@ -120,6 +120,7 @@ private slots: void childChanged(); void objectListModel(); void singleRole(); + void modelProperties(); private: QDeclarativeEngine engine; @@ -364,6 +365,113 @@ void tst_qdeclarativevisualdatamodel::singleRole() } } +void tst_qdeclarativevisualdatamodel::modelProperties() +{ + { + QDeclarativeView view; + + SingleRoleModel model; + + QDeclarativeContext *ctxt = view.rootContext(); + ctxt->setContextProperty("myModel", &model); + + view.setSource(QUrl::fromLocalFile(SRCDIR "/data/modelproperties.qml")); + + QDeclarativeListView *listview = qobject_cast(view.rootObject()); + QVERIFY(listview != 0); + + QDeclarativeItem *contentItem = listview->contentItem(); + QVERIFY(contentItem != 0); + + QDeclarativeItem *delegate = findItem(contentItem, "delegate", 1); + QCOMPARE(delegate->property("test1").toString(),QString("two")); + QCOMPARE(delegate->property("test2").toString(),QString("two")); + QCOMPARE(delegate->property("test3").toString(),QString("two")); + QCOMPARE(delegate->property("test4").toString(),QString("two")); + QVERIFY(!delegate->property("test9").isValid()); + QCOMPARE(delegate->property("test5").toString(),QString("")); + QVERIFY(delegate->property("test6").value() != 0); + QCOMPARE(delegate->property("test7").toInt(),1); + QCOMPARE(delegate->property("test8").toInt(),1); + } + + { + QDeclarativeView view; + + QList dataList; + dataList.append(new DataObject("Item 1", "red")); + dataList.append(new DataObject("Item 2", "green")); + dataList.append(new DataObject("Item 3", "blue")); + dataList.append(new DataObject("Item 4", "yellow")); + + QDeclarativeContext *ctxt = view.rootContext(); + ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); + + view.setSource(QUrl::fromLocalFile(SRCDIR "/data/modelproperties.qml")); + + QDeclarativeListView *listview = qobject_cast(view.rootObject()); + QVERIFY(listview != 0); + + QDeclarativeItem *contentItem = listview->contentItem(); + QVERIFY(contentItem != 0); + + QDeclarativeItem *delegate = findItem(contentItem, "delegate", 1); + QCOMPARE(delegate->property("test1").toString(),QString("Item 2")); + QEXPECT_FAIL("", "QTBUG-13576", Continue); + QCOMPARE(delegate->property("test2").toString(),QString("Item 2")); + QVERIFY(qobject_cast(delegate->property("test3").value()) != 0); + QVERIFY(qobject_cast(delegate->property("test4").value()) != 0); + QCOMPARE(delegate->property("test5").toString(),QString("Item 2")); + QCOMPARE(delegate->property("test9").toString(),QString("Item 2")); + QVERIFY(delegate->property("test6").value() != 0); + QCOMPARE(delegate->property("test7").toInt(),1); + QCOMPARE(delegate->property("test8").toInt(),1); + } + + { + QDeclarativeView view; + + QStandardItemModel model; + initStandardTreeModel(&model); + + view.rootContext()->setContextProperty("myModel", &model); + + QUrl source(QUrl::fromLocalFile(SRCDIR "/data/modelproperties2.qml")); + + //3 items, 3 warnings each + QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":11: ReferenceError: Can't find variable: modelData"); + QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":11: ReferenceError: Can't find variable: modelData"); + QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":11: ReferenceError: Can't find variable: modelData"); + QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":9: ReferenceError: Can't find variable: modelData"); + QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":9: ReferenceError: Can't find variable: modelData"); + QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":9: ReferenceError: Can't find variable: modelData"); + QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":15: TypeError: Result of expression 'model.modelData' [undefined] is not an object."); + QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":15: TypeError: Result of expression 'model.modelData' [undefined] is not an object."); + QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":15: TypeError: Result of expression 'model.modelData' [undefined] is not an object."); + + view.setSource(source); + + QDeclarativeListView *listview = qobject_cast(view.rootObject()); + QVERIFY(listview != 0); + + QDeclarativeItem *contentItem = listview->contentItem(); + QVERIFY(contentItem != 0); + + QDeclarativeItem *delegate = findItem(contentItem, "delegate", 1); + QCOMPARE(delegate->property("test1").toString(),QString("Row 2 Item")); + QCOMPARE(delegate->property("test2").toString(),QString("Row 2 Item")); + QVERIFY(!delegate->property("test3").isValid()); + QVERIFY(!delegate->property("test4").isValid()); + QVERIFY(!delegate->property("test5").isValid()); + QVERIFY(!delegate->property("test9").isValid()); + QVERIFY(delegate->property("test6").value() != 0); + QCOMPARE(delegate->property("test7").toInt(),1); + QCOMPARE(delegate->property("test8").toInt(),1); + } + + //### should also test QStringList and QVariantList +} + template T *tst_qdeclarativevisualdatamodel::findItem(QGraphicsObject *parent, const QString &objectName, int index) { -- cgit v0.12 From 6a007684823298721ba2bdb26c8c0f726201547a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 13 Oct 2010 11:42:10 +0200 Subject: Adjust the parent index for the itemsMoved call. Not doing this causes the parent QModelIndexes to be out of sync with the model. The fix in fe350ca756df6392b3d0b7840351fccc89f9ef6f is extended to also use adjusted indexes in the itemMove call. Merge-request: 849 Reviewed-by: Olivier Goffart (cherry picked from commit 62dc9c9602987f4381481cc5642e3ea0782bb418) --- src/corelib/kernel/qabstractitemmodel.cpp | 8 ++++---- tests/auto/modeltest/dynamictreemodel.cpp | 7 +++++++ tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp | 6 ++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp index 9a99ea1..05cb271 100644 --- a/src/corelib/kernel/qabstractitemmodel.cpp +++ b/src/corelib/kernel/qabstractitemmodel.cpp @@ -2637,8 +2637,6 @@ void QAbstractItemModel::endMoveRows() QAbstractItemModelPrivate::Change insertChange = d->changes.pop(); QAbstractItemModelPrivate::Change removeChange = d->changes.pop(); - d->itemsMoved(removeChange.parent, removeChange.first, removeChange.last, insertChange.parent, insertChange.first, Qt::Vertical); - QModelIndex adjustedSource = removeChange.parent; QModelIndex adjustedDestination = insertChange.parent; @@ -2649,6 +2647,8 @@ void QAbstractItemModel::endMoveRows() if (removeChange.needsAdjust) adjustedSource = createIndex(adjustedSource.row() + numMoved, adjustedSource.column(), adjustedSource.internalPointer()); + d->itemsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first, Qt::Vertical); + emit rowsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first); emit layoutChanged(); } @@ -2861,8 +2861,6 @@ void QAbstractItemModel::endMoveColumns() QAbstractItemModelPrivate::Change insertChange = d->changes.pop(); QAbstractItemModelPrivate::Change removeChange = d->changes.pop(); - d->itemsMoved(removeChange.parent, removeChange.first, removeChange.last, insertChange.parent, insertChange.first, Qt::Horizontal); - QModelIndex adjustedSource = removeChange.parent; QModelIndex adjustedDestination = insertChange.parent; @@ -2873,6 +2871,8 @@ void QAbstractItemModel::endMoveColumns() if (removeChange.needsAdjust) adjustedSource = createIndex(adjustedSource.row(), adjustedSource.column() + numMoved, adjustedSource.internalPointer()); + d->itemsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first, Qt::Horizontal); + emit columnsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first); emit layoutChanged(); } diff --git a/tests/auto/modeltest/dynamictreemodel.cpp b/tests/auto/modeltest/dynamictreemodel.cpp index b572eb1..fa634b6 100644 --- a/tests/auto/modeltest/dynamictreemodel.cpp +++ b/tests/auto/modeltest/dynamictreemodel.cpp @@ -63,6 +63,13 @@ QModelIndex DynamicTreeModel::index(int row, int column, const QModelIndex &pare QList > childIdColumns = m_childItems.value(parent.internalId()); + const qint64 grandParent = findParentId(parent.internalId()); + if (grandParent >= 0) { + QList > parentTable = m_childItems.value(grandParent); + Q_ASSERT(parent.column() < parentTable.size()); + QList parentSiblings = parentTable.at(parent.column()); + Q_ASSERT(parent.row() < parentSiblings.size()); + } if (childIdColumns.size() == 0) return QModelIndex(); diff --git a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp index dbcccc9..b723253 100644 --- a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp +++ b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp @@ -1167,6 +1167,7 @@ void tst_QAbstractItemModel::testMoveToGrandParent_data() // Moving everything from one parent to another QTest::newRow("move12") << 0 << 9 << 10; + QTest::newRow("move13") << 0 << 9 << 0; } void tst_QAbstractItemModel::testMoveToGrandParent() @@ -1314,6 +1315,11 @@ void tst_QAbstractItemModel::testMoveToSibling_data() QTest::newRow("move09") << 8 << 8 << 4; QTest::newRow("move10") << 8 << 8 << 5; QTest::newRow("move11") << 8 << 8 << 6; + + // Move such that the destination parent no longer valid after the move. + // The destination parent is always QMI(5, 0), but after this move the + // row count is 5, so (5, 0) (used internally in QAIM) no longer refers to a valid index. + QTest::newRow("move12") << 0 << 4 << 0; } void tst_QAbstractItemModel::testMoveToSibling() -- cgit v0.12 From c23962debbc856ce8b808c5f1c6e8a9cdd4f5dbe Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Fri, 15 Oct 2010 14:32:01 +1000 Subject: Update some tests to modern syntax --- tests/auto/declarative/qmlvisual/qdeclarativetext/elide/elide2.qml | 2 +- tests/auto/declarative/qmlvisual/qdeclarativetext/elide/multilength.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/elide/elide2.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/elide/elide2.qml index edf0cb5..b772982 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetext/elide/elide2.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/elide/elide2.qml @@ -5,7 +5,7 @@ Rectangle { height: 100 Text { - width: NumberAnimation { from: 500; to: 0; loops: Animation.Infinite; duration: 5000 } + NumberAnimation on width { from: 500; to: 0; loops: Animation.Infinite; duration: 5000 } elide: Text.ElideRight text: 'Here is some very long text that we should truncate when sizing window' } diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/elide/multilength.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/elide/multilength.qml index 6698421..3ef64ef 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetext/elide/multilength.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/elide/multilength.qml @@ -11,7 +11,7 @@ Rectangle { anchors.centerIn: parent Text { id: myText - width: NumberAnimation { from: 500; to: 0; loops: Animation.Infinite; duration: 1000 } + NumberAnimation on width { from: 500; to: 0; loops: Animation.Infinite; duration: 5000 } elide: "ElideRight" text: "Brevity is the soul of wit, and tediousness the limbs and outward flourishes.\x9CBrevity is a great charm of eloquence.\x9CBe concise!\x9CSHHHHHHHHHHHHHHHHHHHHHHHHHHHH" } -- cgit v0.12 From de8c9d69fa7c7cc50e9a238e58f6e9370f158fc4 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Fri, 15 Oct 2010 14:40:25 +1000 Subject: Keep qmlviewer from disappearing qmlviewer was disappearing if the scene was 0x0. Now it's just unusably small, which is correct as it will highlight the problem to the developer. --- tools/qml/qmlruntime.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 5e169d8..9f9eba0 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -1518,6 +1518,7 @@ void QDeclarativeViewer::updateSizeHints(bool initial) //qWarning() << "USH: R2V: setting free size "; layout()->setSizeConstraint(QLayout::SetNoConstraint); layout()->activate(); + setMinimumSize(QSize(1,1)); setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX)); canvas->setMinimumSize(QSize(0,0)); canvas->setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX)); -- cgit v0.12 From d22741b4bee0e526aefbbd7b851c2aa1b0b1c5b6 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 15 Oct 2010 07:19:08 +0200 Subject: actually set egl swap interval --- src/plugins/platforms/eglfs/qeglfsscreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp index 682f2f4..2d23cca 100644 --- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp +++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp @@ -145,9 +145,9 @@ QEglFSScreen::QEglFSScreen(EGLNativeDisplayType display) if (!ok) swapInterval = 1; } - platformFormat.setSwapInterval(swapInterval); EGLConfig config = q_configFromQPlatformWindowFormat(m_dpy, platformFormat); + eglSwapInterval(display, swapInterval); EGLNativeWindowType eglWindow = 0; #ifdef Q_OPENKODE -- cgit v0.12 From eafec04685e0a1e5ea1fe32dbc562c5dfa2abfb1 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Fri, 15 Oct 2010 15:52:05 +1000 Subject: Fix autotest failure caused by commit 92365268 --- doc/src/snippets/declarative/keys/keys-handler.qml | 2 +- doc/src/snippets/declarative/keys/keys-pressed.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/snippets/declarative/keys/keys-handler.qml b/doc/src/snippets/declarative/keys/keys-handler.qml index 9e3a3b4..be0eedb 100644 --- a/doc/src/snippets/declarative/keys/keys-handler.qml +++ b/doc/src/snippets/declarative/keys/keys-handler.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { width: 400; height: 400 diff --git a/doc/src/snippets/declarative/keys/keys-pressed.qml b/doc/src/snippets/declarative/keys/keys-pressed.qml index 523c95b..90a4e37 100644 --- a/doc/src/snippets/declarative/keys/keys-pressed.qml +++ b/doc/src/snippets/declarative/keys/keys-pressed.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { width: 400; height: 400 -- cgit v0.12 From 4c4734cae65b7c5907dc786e02b13b020eb22aaf Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 15 Oct 2010 16:25:58 +1000 Subject: Allow overloaded methods, and methods with default params, to be called in QML Task-number: QTBUG-11604 --- .../qml/qdeclarativeobjectscriptclass.cpp | 298 ++++++++++++++++++++- .../qml/qdeclarativeobjectscriptclass_p.h | 9 + src/declarative/qml/qdeclarativepropertycache.cpp | 31 ++- .../declarative/qdeclarativeecmascript/testtypes.h | 32 ++- .../tst_qdeclarativeecmascript.cpp | 40 ++- 5 files changed, 382 insertions(+), 28 deletions(-) diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index 61a1f55..ea92111 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -838,9 +838,19 @@ QDeclarativeObjectMethodScriptClass::Value QDeclarativeObjectMethodScriptClass:: { MethodData *method = static_cast(o); - if (method->data.flags & QDeclarativePropertyCache::Data::HasArguments) { + if (method->data.relatedIndex == -1) + return callPrecise(method->object, method->data, ctxt); + else + return callOverloaded(method, ctxt); +} - QMetaMethod m = method->object->metaObject()->method(method->data.coreIndex); +QDeclarativeObjectMethodScriptClass::Value +QDeclarativeObjectMethodScriptClass::callPrecise(QObject *object, const QDeclarativePropertyCache::Data &data, + QScriptContext *ctxt) +{ + if (data.flags & QDeclarativePropertyCache::Data::HasArguments) { + + QMetaMethod m = object->metaObject()->method(data.coreIndex); QList argTypeNames = m.parameterTypes(); QVarLengthArray argTypes(argTypeNames.count()); @@ -848,7 +858,7 @@ QDeclarativeObjectMethodScriptClass::Value QDeclarativeObjectMethodScriptClass:: for (int ii = 0; ii < argTypeNames.count(); ++ii) { argTypes[ii] = QMetaType::type(argTypeNames.at(ii)); if (argTypes[ii] == QVariant::Invalid) - argTypes[ii] = enumType(method->object->metaObject(), QString::fromLatin1(argTypeNames.at(ii))); + argTypes[ii] = enumType(object->metaObject(), QString::fromLatin1(argTypeNames.at(ii))); if (argTypes[ii] == QVariant::Invalid) return Value(ctxt, ctxt->throwError(QString::fromLatin1("Unknown method parameter type: %1").arg(QLatin1String(argTypeNames.at(ii))))); } @@ -856,39 +866,301 @@ QDeclarativeObjectMethodScriptClass::Value QDeclarativeObjectMethodScriptClass:: if (argTypes.count() > ctxt->argumentCount()) return Value(ctxt, ctxt->throwError(QLatin1String("Insufficient arguments"))); - QVarLengthArray args(argTypes.count() + 1); - args[0].initAsType(method->data.propType, engine); + return callMethod(object, data.coreIndex, data.propType, argTypes.count(), argTypes.data(), ctxt); + + } else { + + return callMethod(object, data.coreIndex, data.propType, 0, 0, ctxt); + + } +} + +QDeclarativeObjectMethodScriptClass::Value +QDeclarativeObjectMethodScriptClass::callMethod(QObject *object, int index, + int returnType, int argCount, int *argTypes, + QScriptContext *ctxt) +{ + if (argCount > 0) { - for (int ii = 0; ii < argTypes.count(); ++ii) + QVarLengthArray args(argCount + 1); + args[0].initAsType(returnType, engine); + + for (int ii = 0; ii < argCount; ++ii) args[ii + 1].fromScriptValue(argTypes[ii], engine, ctxt->argument(ii)); QVarLengthArray argData(args.count()); for (int ii = 0; ii < args.count(); ++ii) argData[ii] = args[ii].dataPtr(); - QMetaObject::metacall(method->object, QMetaObject::InvokeMetaMethod, method->data.coreIndex, argData.data()); + QMetaObject::metacall(object, QMetaObject::InvokeMetaMethod, index, argData.data()); return args[0].toValue(engine); - } else if (method->data.propType != 0) { - + } else if (returnType != 0) { + MetaCallArgument arg; - arg.initAsType(method->data.propType, engine); + arg.initAsType(returnType, engine); void *args[] = { arg.dataPtr() }; - QMetaObject::metacall(method->object, QMetaObject::InvokeMetaMethod, method->data.coreIndex, args); + QMetaObject::metacall(object, QMetaObject::InvokeMetaMethod, index, args); return arg.toValue(engine); } else { void *args[] = { 0 }; - QMetaObject::metacall(method->object, QMetaObject::InvokeMetaMethod, method->data.coreIndex, args); + QMetaObject::metacall(object, QMetaObject::InvokeMetaMethod, index, args); return Value(); } - return Value(); +} + +/*! +Resolve the overloaded method to call. The algorithm works conceptually like this: + 1. Resolve the set of overloads it is *possible* to call. + Impossible overloads include those that have too many parameters or have parameters + of unknown type. + 2. Filter the set of overloads to only contain those with the closest number of + parameters. + For example, if we are called with 3 parameters and there are 2 overloads that + take 2 parameters and one that takes 3, eliminate the 2 parameter overloads. + 3. Find the best remaining overload based on its match score. + If two or more overloads have the same match score, call the last one. The match + score is constructed by adding the matchScore() result for each of the parameters. +*/ +QDeclarativeObjectMethodScriptClass::Value +QDeclarativeObjectMethodScriptClass::callOverloaded(MethodData *method, QScriptContext *ctxt) +{ + int argumentCount = ctxt->argumentCount(); + + QDeclarativePropertyCache::Data *best = 0; + int bestParameterScore = INT_MAX; + int bestMatchScore = INT_MAX; + + QDeclarativePropertyCache::Data dummy; + QDeclarativePropertyCache::Data *attempt = &method->data; + + do { + QList methodArgTypeNames; + + if (attempt->flags & QDeclarativePropertyCache::Data::HasArguments) + methodArgTypeNames = method->object->metaObject()->method(attempt->coreIndex).parameterTypes(); + + int methodArgumentCount = methodArgTypeNames.count(); + + if (methodArgumentCount > argumentCount) + continue; // We don't have sufficient arguments to call this method + + int methodParameterScore = argumentCount - methodArgumentCount; + if (methodParameterScore > bestParameterScore) + continue; // We already have a better option + + int methodMatchScore = 0; + QVarLengthArray methodArgTypes(methodArgumentCount); + + bool unknownArgument = false; + for (int ii = 0; ii < methodArgumentCount; ++ii) { + methodArgTypes[ii] = QMetaType::type(methodArgTypeNames.at(ii)); + if (methodArgTypes[ii] == QVariant::Invalid) + methodArgTypes[ii] = enumType(method->object->metaObject(), + QString::fromLatin1(methodArgTypeNames.at(ii))); + if (methodArgTypes[ii] == QVariant::Invalid) { + unknownArgument = true; + break; + } + methodMatchScore += matchScore(ctxt->argument(ii), methodArgTypes[ii], methodArgTypeNames.at(ii)); + } + if (unknownArgument) + continue; // We don't understand all the parameters + + if (bestParameterScore > methodParameterScore || bestMatchScore > methodMatchScore) { + best = attempt; + bestParameterScore = methodParameterScore; + bestMatchScore = methodMatchScore; + } + + if (bestParameterScore == 0 && bestMatchScore == 0) + break; // We can't get better than that + + } while((attempt = relatedMethod(method->object, attempt, dummy)) != 0); + + if (best) { + return callPrecise(method->object, *best, ctxt); + } else { + QString error = QLatin1String("Unable to determine callable overload. Candidates are:"); + QDeclarativePropertyCache::Data *candidate = &method->data; + while (candidate) { + error += QLatin1String("\n ") + QString::fromUtf8(method->object->metaObject()->method(candidate->coreIndex).signature()); + candidate = relatedMethod(method->object, candidate, dummy); + } + return Value(ctxt, ctxt->throwError(error)); + } +} + +/*! + Returns the match score for converting \a actual to be of type \a conversionType. A + zero score means "perfect match" whereas a higher score is worse. + + The conversion table is copied out of the QtScript callQtMethod() function. +*/ +int QDeclarativeObjectMethodScriptClass::matchScore(const QScriptValue &actual, int conversionType, + const QByteArray &conversionTypeName) +{ + if (actual.isNumber()) { + switch (conversionType) { + case QMetaType::Double: + return 0; + case QMetaType::Float: + return 1; + case QMetaType::LongLong: + case QMetaType::ULongLong: + return 2; + case QMetaType::Long: + case QMetaType::ULong: + return 3; + case QMetaType::Int: + case QMetaType::UInt: + return 4; + case QMetaType::Short: + case QMetaType::UShort: + return 5; + break; + case QMetaType::Char: + case QMetaType::UChar: + return 6; + default: + return 10; + } + } else if (actual.isString()) { + switch (conversionType) { + case QMetaType::QString: + return 0; + default: + return 10; + } + } else if (actual.isBoolean()) { + switch (conversionType) { + case QMetaType::Bool: + return 0; + default: + return 10; + } + } else if (actual.isDate()) { + switch (conversionType) { + case QMetaType::QDateTime: + return 0; + case QMetaType::QDate: + return 1; + case QMetaType::QTime: + return 2; + default: + return 10; + } + } else if (actual.isRegExp()) { + switch (conversionType) { + case QMetaType::QRegExp: + return 0; + default: + return 10; + } + } else if (actual.isVariant()) { + if (conversionType == qMetaTypeId()) + return 0; + else if (actual.toVariant().userType() == conversionType) + return 0; + else + return 10; + } else if (actual.isArray()) { + switch (conversionType) { + case QMetaType::QStringList: + case QMetaType::QVariantList: + return 5; + default: + return 10; + } + } else if (actual.isQObject()) { + switch (conversionType) { + case QMetaType::QObjectStar: + return 0; + default: + return 10; + } + } else if (actual.isNull()) { + switch (conversionType) { + case QMetaType::VoidStar: + case QMetaType::QObjectStar: + return 0; + default: + if (!conversionTypeName.endsWith('*')) + return 10; + else + return 0; + } + } else { + return 10; + } +} + +static inline int QMetaObject_methods(const QMetaObject *metaObject) +{ + struct Private + { + int revision; + int className; + int classInfoCount, classInfoData; + int methodCount, methodData; + }; + + return reinterpret_cast(metaObject->d.data)->methodCount; +} + +static QByteArray QMetaMethod_name(const QMetaMethod &m) +{ + QByteArray sig = m.signature(); + int paren = sig.indexOf('('); + if (paren == -1) + return sig; + else + return sig.left(paren); +} + +/*! +Returns the next related method, if one, or 0. +*/ +QDeclarativePropertyCache::Data * +QDeclarativeObjectMethodScriptClass::relatedMethod(QObject *object, QDeclarativePropertyCache::Data *current, + QDeclarativePropertyCache::Data &dummy) +{ + QDeclarativePropertyCache *cache = QDeclarativeData::get(object)->propertyCache; + if (current->relatedIndex == -1) + return 0; + + if (cache) { + return cache->method(current->relatedIndex); + } else { + const QMetaObject *mo = object->metaObject(); + int methodOffset = mo->methodCount() - QMetaObject_methods(mo); + + while (methodOffset > current->relatedIndex) { + mo = mo->superClass(); + methodOffset -= QMetaObject_methods(mo); + } + + QMetaMethod method = mo->method(current->relatedIndex); + dummy.load(method); + + // Look for overloaded methods + QByteArray methodName = QMetaMethod_name(method); + for (int ii = current->relatedIndex - 1; ii >= methodOffset; --ii) { + if (methodName == QMetaMethod_name(mo->method(ii))) { + dummy.relatedIndex = ii; + return &dummy; + } + } + + return &dummy; + } } QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass_p.h b/src/declarative/qml/qdeclarativeobjectscriptclass_p.h index 75e384c..7956c40 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass_p.h +++ b/src/declarative/qml/qdeclarativeobjectscriptclass_p.h @@ -65,6 +65,7 @@ class QDeclarativeEngine; class QScriptContext; class QScriptEngine; class QDeclarativeContextData; +class MethodData; class Q_AUTOTEST_EXPORT QDeclarativeObjectMethodScriptClass : public QScriptDeclarativeClass { @@ -82,6 +83,14 @@ protected: private: int enumType(const QMetaObject *, const QString &); + Value callPrecise(QObject *, const QDeclarativePropertyCache::Data &, QScriptContext *); + Value callOverloaded(MethodData *, QScriptContext *); + Value callMethod(QObject *, int index, int returnType, int argCount, int *argTypes, QScriptContext *ctxt); + + int matchScore(const QScriptValue &, int, const QByteArray &); + QDeclarativePropertyCache::Data *relatedMethod(QObject *, QDeclarativePropertyCache::Data *current, + QDeclarativePropertyCache::Data &dummy); + PersistentIdentifier m_connectId; PersistentIdentifier m_disconnectId; QScriptValue m_connect; diff --git a/src/declarative/qml/qdeclarativepropertycache.cpp b/src/declarative/qml/qdeclarativepropertycache.cpp index 259e492..91aaaa4 100644 --- a/src/declarative/qml/qdeclarativepropertycache.cpp +++ b/src/declarative/qml/qdeclarativepropertycache.cpp @@ -93,6 +93,7 @@ void QDeclarativePropertyCache::Data::load(const QMetaProperty &p, QDeclarativeE void QDeclarativePropertyCache::Data::load(const QMetaMethod &m) { coreIndex = m.methodIndex(); + relatedIndex = -1; flags |= Data::IsFunction; if (m.methodType() == QMetaMethod::Signal) flags |= Data::IsSignal; @@ -141,18 +142,24 @@ void QDeclarativePropertyCache::clear() } for (int ii = 0; ii < methodIndexCache.count(); ++ii) { - if (methodIndexCache.at(ii)) methodIndexCache.at(ii)->release(); + RData *data = methodIndexCache.at(ii); + if (data) data->release(); } for (StringCache::ConstIterator iter = stringCache.begin(); - iter != stringCache.end(); ++iter) - (*iter)->release(); + iter != stringCache.end(); ++iter) { + RData *data = (*iter); + data->release(); + } for (IdentifierCache::ConstIterator iter = identifierCache.begin(); - iter != identifierCache.end(); ++iter) - (*iter)->release(); + iter != identifierCache.end(); ++iter) { + RData *data = (*iter); + data->release(); + } indexCache.clear(); + methodIndexCache.clear(); stringCache.clear(); identifierCache.clear(); } @@ -206,12 +213,16 @@ QDeclarativePropertyCache *QDeclarativePropertyCache::copy() const { QDeclarativePropertyCache *cache = new QDeclarativePropertyCache(engine); cache->indexCache = indexCache; + cache->methodIndexCache = methodIndexCache; cache->stringCache = stringCache; cache->identifierCache = identifierCache; for (int ii = 0; ii < indexCache.count(); ++ii) { if (indexCache.at(ii)) indexCache.at(ii)->addref(); } + for (int ii = 0; ii < methodIndexCache.count(); ++ii) { + if (methodIndexCache.at(ii)) methodIndexCache.at(ii)->addref(); + } for (StringCache::ConstIterator iter = stringCache.begin(); iter != stringCache.end(); ++iter) (*iter)->addref(); for (IdentifierCache::ConstIterator iter = identifierCache.begin(); iter != identifierCache.end(); ++iter) @@ -231,7 +242,7 @@ void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaOb indexCache.resize(propCount); for (int ii = propOffset; ii < propCount; ++ii) { QMetaProperty p = metaObject->property(ii); - if (!p.isScriptable()) + if (!p.isScriptable()) continue; QString propName = QString::fromUtf8(p.name()); @@ -261,7 +272,7 @@ void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaOb methodIndexCache.resize(methodCount); for (int ii = methodOffset; ii < methodCount; ++ii) { QMetaMethod m = metaObject->method(ii); - if (m.access() == QMetaMethod::Private) + if (m.access() == QMetaMethod::Private) continue; QString methodName = QString::fromUtf8(m.signature()); @@ -271,7 +282,7 @@ void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaOb RData *data = new RData; data->identifier = enginePriv->objectClass->createPersistentIdentifier(methodName); - methodIndexCache[ii] = data; + methodIndexCache[ii] = data; data->load(m); if (m.methodType() == QMetaMethod::Slot || m.methodType() == QMetaMethod::Method) @@ -280,6 +291,10 @@ void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaOb data->flags |= signalFlags; if (stringCache.contains(methodName)) { + RData *old = stringCache[methodName]; + // We only overload methods in the same class, exactly like C++ + if (old->flags & Data::IsFunction && old->coreIndex >= methodOffset) + data->relatedIndex = old->coreIndex; stringCache[methodName]->release(); identifierCache[data->identifier.identifier]->release(); } diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index 182c4fa..40451c3 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -572,7 +572,17 @@ public: }; Q_DECLARE_METATYPE(QScriptValue); -class MyInvokableObject : public QObject +class MyInvokableBaseObject : public QObject +{ + Q_OBJECT +public: + inline ~MyInvokableBaseObject() = 0; + + Q_INVOKABLE inline void method_inherited(int a); + Q_INVOKABLE inline void method_overload(); +}; + +class MyInvokableObject : public MyInvokableBaseObject { Q_OBJECT Q_ENUMS(TestEnum) @@ -608,16 +618,34 @@ public: Q_INVOKABLE void method_overload(int a) { invoke(16); m_actuals << a; } Q_INVOKABLE void method_overload(int a, int b) { invoke(17); m_actuals << a << b; } + Q_INVOKABLE void method_overload(QString a) { invoke(18); m_actuals << a; } - Q_INVOKABLE void method_with_enum(TestEnum e) { invoke(18); m_actuals << (int)e; } + Q_INVOKABLE void method_with_enum(TestEnum e) { invoke(19); m_actuals << (int)e; } + + Q_INVOKABLE int method_default(int a, int b = 19) { invoke(20); m_actuals << a << b; return b; } private: + friend class MyInvokableBaseObject; void invoke(int idx) { if (m_invoked != -1) m_invokedError = true; m_invoked = idx;} int m_invoked; bool m_invokedError; QVariantList m_actuals; }; +MyInvokableBaseObject::~MyInvokableBaseObject() {} + +void MyInvokableBaseObject::method_inherited(int a) +{ + static_cast(this)->invoke(-3); + static_cast(this)->m_actuals << a; +} + +// This is a hidden overload of the MyInvokableObject::method_overload() method +void MyInvokableBaseObject::method_overload() +{ + static_cast(this)->invoke(-2); +} + class NumberAssignment : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 66dc160..e4e5a54 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -1710,7 +1710,6 @@ void tst_qdeclarativeecmascript::callQtInvokables() QCOMPARE(o.actuals().at(0), QVariant(44)); QVERIFY(qvariant_cast(o.actuals().at(1)).isArray()); - // Test overloads - QML will always invoke the *last* method o.reset(); QCOMPARE(engine->evaluate("object.method_overload()").isError(), true); QCOMPARE(o.error(), false); @@ -1718,10 +1717,11 @@ void tst_qdeclarativeecmascript::callQtInvokables() QCOMPARE(o.actuals().count(), 0); o.reset(); - QCOMPARE(engine->evaluate("object.method_overload(10)").isError(), true); + QCOMPARE(engine->evaluate("object.method_overload(10)").isUndefined(), true); QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), -1); - QCOMPARE(o.actuals().count(), 0); + QCOMPARE(o.invoked(), 16); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), QVariant(10)); o.reset(); QCOMPARE(engine->evaluate("object.method_overload(10, 11)").isUndefined(), true); @@ -1732,10 +1732,40 @@ void tst_qdeclarativeecmascript::callQtInvokables() QCOMPARE(o.actuals().at(1), QVariant(11)); o.reset(); - QCOMPARE(engine->evaluate("object.method_with_enum(9)").isUndefined(), true); + QCOMPARE(engine->evaluate("object.method_overload(\"Hello\")").isUndefined(), true); QCOMPARE(o.error(), false); QCOMPARE(o.invoked(), 18); QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), QVariant(QString("Hello"))); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_with_enum(9)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 19); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), QVariant(9)); + + o.reset(); + QVERIFY(engine->evaluate("object.method_default(10)").strictlyEquals(QScriptValue(19))); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 20); + QCOMPARE(o.actuals().count(), 2); + QCOMPARE(o.actuals().at(0), QVariant(10)); + QCOMPARE(o.actuals().at(1), QVariant(19)); + + o.reset(); + QVERIFY(engine->evaluate("object.method_default(10, 13)").strictlyEquals(QScriptValue(13))); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 20); + QCOMPARE(o.actuals().count(), 2); + QCOMPARE(o.actuals().at(0), QVariant(10)); + QCOMPARE(o.actuals().at(1), QVariant(13)); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_inherited(9)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), -3); + QCOMPARE(o.actuals().count(), 1); QCOMPARE(o.actuals().at(0), QVariant(9)); } -- cgit v0.12 From 69005b4cbae57928df7ade8f9f60ad0aabd128bc Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Fri, 15 Oct 2010 10:06:53 +0200 Subject: Changed Javascript guide link in Intro to the QML Language page. Replaced link to commercial Javascript book. Reviewed-by: Geir Vattekar --- doc/src/declarative/qdeclarativeintro.qdoc | 6 +++--- doc/src/external-resources.qdoc | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/src/declarative/qdeclarativeintro.qdoc b/doc/src/declarative/qdeclarativeintro.qdoc index 87dafb0..1d807e3 100644 --- a/doc/src/declarative/qdeclarativeintro.qdoc +++ b/doc/src/declarative/qdeclarativeintro.qdoc @@ -37,7 +37,7 @@ interface is specified as a tree of objects with properties. This introduction is meant for those with little or no programming experience. JavaScript is used as a scripting language in QML, so you may want -to learn a bit more about it (\l{JavaScript: The Definitive Guide}) before diving +to learn a bit more about it (\l{Javascript Guide}) before diving deeper into QML. It's also helpful to have a basic understanding of other web technologies like HTML and CSS, but it's not required. @@ -65,8 +65,8 @@ types always begin with a capital letter. In the above example, there are two objects, a \l Rectangle, and an \l Image. Between the braces, we can specify information about the object, such as its properties. -Properties are specified as \c {property: value}. In the above example, we -can see the Image has a property named \c source, which has been assigned the +Properties are specified as \c {property: value}. In the above example, we +can see the Image has a property named \c source, which has been assigned the value \c "pics/logo.png". The property and its value are separated by a colon. Properties can be specified one-per-line: diff --git a/doc/src/external-resources.qdoc b/doc/src/external-resources.qdoc index 3041046..a23ae4d 100644 --- a/doc/src/external-resources.qdoc +++ b/doc/src/external-resources.qdoc @@ -440,6 +440,11 @@ */ /*! + \externalpage https://developer.mozilla.org/en/JavaScript/Guide + \title JavaScript Guide +*/ + +/*! \externalpage https://developer.mozilla.org/en/JavaScript/About_JavaScript \title About JavaScript */ -- cgit v0.12 From 0a299be472da5829e17b886450dd134302b861a0 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Fri, 15 Oct 2010 10:42:21 +0200 Subject: Changed language of the AutoConnection description. Task-number: QTBUG-14223 Reviewed-by: Olivier Goffart --- src/corelib/global/qnamespace.qdoc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 1c41eca..dd02e17 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -511,11 +511,11 @@ delivery at a later time. \value AutoConnection - (default) If the object sending the signal is in a different thread - than the receiving object, the signal is queued, behaving as - Qt::QueuedConnection. If both objects are in the same thread, - the slot is invoked directly, behaving as Qt::DirectConnection. The - type of connection is determined when the signal is emitted. + (default) If the signal is emitted from a different thread than the + receiving object, the signal is queued, behaving as + Qt::QueuedConnection. Otherwise, the slot is invoked directly, + behaving as Qt::DirectConnection. The type of connection is + determined when the signal is emitted. \value DirectConnection The slot is invoked immediately, when the signal is -- cgit v0.12 From a9cddeb760e85fbce2c1604b7e7b9b2affaaccd9 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 15 Oct 2010 10:43:07 +0200 Subject: Fix tst_moduleqt47::accidentalImport --- doc/src/snippets/declarative/keys/keys-handler.qml | 2 +- doc/src/snippets/declarative/keys/keys-pressed.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/snippets/declarative/keys/keys-handler.qml b/doc/src/snippets/declarative/keys/keys-handler.qml index 9e3a3b4..be0eedb 100644 --- a/doc/src/snippets/declarative/keys/keys-handler.qml +++ b/doc/src/snippets/declarative/keys/keys-handler.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { width: 400; height: 400 diff --git a/doc/src/snippets/declarative/keys/keys-pressed.qml b/doc/src/snippets/declarative/keys/keys-pressed.qml index 523c95b..90a4e37 100644 --- a/doc/src/snippets/declarative/keys/keys-pressed.qml +++ b/doc/src/snippets/declarative/keys/keys-pressed.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import Qt 4.7 +import QtQuick 1.0 Item { width: 400; height: 400 -- cgit v0.12 From 2c9ac0221562581b7d14c0b74b3f498725b5dff3 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 15 Oct 2010 11:16:25 +0200 Subject: tst_qdeclarativetext: Regenerate the baselines after the merge. This need to be checked. --- .../declarative/qdeclarativetext/data/alignments_cb.png | Bin 496 -> 529 bytes .../declarative/qdeclarativetext/data/alignments_cc.png | Bin 556 -> 550 bytes .../declarative/qdeclarativetext/data/alignments_ct.png | Bin 533 -> 565 bytes .../declarative/qdeclarativetext/data/alignments_lb.png | Bin 496 -> 522 bytes .../declarative/qdeclarativetext/data/alignments_lc.png | Bin 535 -> 541 bytes .../declarative/qdeclarativetext/data/alignments_lt.png | Bin 514 -> 558 bytes .../declarative/qdeclarativetext/data/alignments_rb.png | Bin 505 -> 530 bytes .../declarative/qdeclarativetext/data/alignments_rc.png | Bin 559 -> 550 bytes .../declarative/qdeclarativetext/data/alignments_rt.png | Bin 539 -> 564 bytes 9 files changed, 0 insertions(+), 0 deletions(-) diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_cb.png b/tests/auto/declarative/qdeclarativetext/data/alignments_cb.png index cf6199a..3f143d5 100644 Binary files a/tests/auto/declarative/qdeclarativetext/data/alignments_cb.png and b/tests/auto/declarative/qdeclarativetext/data/alignments_cb.png differ diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_cc.png b/tests/auto/declarative/qdeclarativetext/data/alignments_cc.png index f81ccb4..c6e6250 100644 Binary files a/tests/auto/declarative/qdeclarativetext/data/alignments_cc.png and b/tests/auto/declarative/qdeclarativetext/data/alignments_cc.png differ diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_ct.png b/tests/auto/declarative/qdeclarativetext/data/alignments_ct.png index 9ba6412..c54058f 100644 Binary files a/tests/auto/declarative/qdeclarativetext/data/alignments_ct.png and b/tests/auto/declarative/qdeclarativetext/data/alignments_ct.png differ diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_lb.png b/tests/auto/declarative/qdeclarativetext/data/alignments_lb.png index 1b50a81..11715e9 100644 Binary files a/tests/auto/declarative/qdeclarativetext/data/alignments_lb.png and b/tests/auto/declarative/qdeclarativetext/data/alignments_lb.png differ diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_lc.png b/tests/auto/declarative/qdeclarativetext/data/alignments_lc.png index f041b86..c27e5d8 100644 Binary files a/tests/auto/declarative/qdeclarativetext/data/alignments_lc.png and b/tests/auto/declarative/qdeclarativetext/data/alignments_lc.png differ diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_lt.png b/tests/auto/declarative/qdeclarativetext/data/alignments_lt.png index c75e0d1..18694a9 100644 Binary files a/tests/auto/declarative/qdeclarativetext/data/alignments_lt.png and b/tests/auto/declarative/qdeclarativetext/data/alignments_lt.png differ diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_rb.png b/tests/auto/declarative/qdeclarativetext/data/alignments_rb.png index b06a5da..010c6ae 100644 Binary files a/tests/auto/declarative/qdeclarativetext/data/alignments_rb.png and b/tests/auto/declarative/qdeclarativetext/data/alignments_rb.png differ diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_rc.png b/tests/auto/declarative/qdeclarativetext/data/alignments_rc.png index e468857..2828bbc 100644 Binary files a/tests/auto/declarative/qdeclarativetext/data/alignments_rc.png and b/tests/auto/declarative/qdeclarativetext/data/alignments_rc.png differ diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments_rt.png b/tests/auto/declarative/qdeclarativetext/data/alignments_rt.png index 576715f..5cf3c03 100644 Binary files a/tests/auto/declarative/qdeclarativetext/data/alignments_rt.png and b/tests/auto/declarative/qdeclarativetext/data/alignments_rt.png differ -- cgit v0.12 From db8a5038137f730ba4dd8169e4b5ab96971a5dfe Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Fri, 15 Oct 2010 12:50:16 +0300 Subject: Clean up ARM SIMD drawhelper code and make sure it works. Blending argb32_pre pixmaps is now ARM SIMD boosted because it's the most crucial and most used feature in applications. ARM SIMD boosted blending is 30% faster than non ARM SIMD boosted blending. Task-number: QTBUG-4891 Reviewed-by: Samuel --- src/gui/painting/painting.pri | 7 +- src/gui/painting/qblendfunctions_armv6_rvct.s | 222 ------------ src/gui/painting/qdrawhelper.cpp | 159 ++------- src/gui/painting/qdrawhelper_arm_simd.cpp | 313 ++++++++++++++++ src/gui/painting/qdrawhelper_arm_simd_p.h | 76 ++++ src/gui/painting/qdrawhelper_armv6_p.h | 81 ----- src/gui/painting/qdrawhelper_armv6_rvct.inc | 496 -------------------------- src/gui/painting/qdrawhelper_armv6_rvct.s | 177 --------- 8 files changed, 424 insertions(+), 1107 deletions(-) delete mode 100644 src/gui/painting/qblendfunctions_armv6_rvct.s create mode 100644 src/gui/painting/qdrawhelper_arm_simd.cpp create mode 100644 src/gui/painting/qdrawhelper_arm_simd_p.h delete mode 100644 src/gui/painting/qdrawhelper_armv6_p.h delete mode 100644 src/gui/painting/qdrawhelper_armv6_rvct.inc delete mode 100644 src/gui/painting/qdrawhelper_armv6_rvct.s diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 793d380..bd37d9f 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -234,13 +234,14 @@ embedded { symbian { - HEADERS += painting/qwindowsurface_s60_p.h + HEADERS += painting/qwindowsurface_s60_p.h \ + painting/qdrawhelper_arm_simd_p.h SOURCES += painting/qwindowsurface_s60.cpp armccIfdefBlock = \ "$${LITERAL_HASH}if defined(ARMV6)" \ + "MACRO QT_HAVE_ARM_SIMD" \ "SOURCEPATH painting" \ - "SOURCE qblendfunctions_armv6_rvct.s" \ - "SOURCE qdrawhelper_armv6_rvct.s" \ + "SOURCE qdrawhelper_arm_simd.cpp" \ "$${LITERAL_HASH}endif" MMP_RULES += armccIfdefBlock diff --git a/src/gui/painting/qblendfunctions_armv6_rvct.s b/src/gui/painting/qblendfunctions_armv6_rvct.s deleted file mode 100644 index 1e3faa9..0000000 --- a/src/gui/painting/qblendfunctions_armv6_rvct.s +++ /dev/null @@ -1,222 +0,0 @@ -;**************************************************************************** -;** -;** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -;** All rights reserved. -;** Contact: Nokia Corporation (qt-info@nokia.com) -;** -;** This file is part of the QtGui module of the Qt Toolkit. -;** -;** $QT_BEGIN_LICENSE:LGPL$ -;** No Commercial Usage -;** This file contains pre-release code and may not be distributed. -;** You may use this file in accordance with the terms and conditions -;** contained in the Technology Preview License Agreement accompanying -;** this package. -;** -;** GNU Lesser General Public License Usage -;** Alternatively, this file may be used under the terms of the GNU Lesser -;** General Public License version 2.1 as published by the Free Software -;** Foundation and appearing in the file LICENSE.LGPL included in the -;** packaging of this file. Please review the following information to -;** ensure the GNU Lesser General Public License version 2.1 requirements -;** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -;** -;** In addition, as a special exception, Nokia gives you certain additional -;** rights. These rights are described in the Nokia Qt LGPL Exception -;** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -;** -;** If you have questions regarding the use of this file, please contact -;** Nokia at qt-info@nokia.com. -;** -;** -;** -;** -;** -;** -;** -;** -;** $QT_END_LICENSE$ -;** -;**************************************************************************** - -; -; 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. -; - - - ARM - PRESERVE8 - - INCLUDE qdrawhelper_armv6_rvct.inc - - -;----------------------------------------------------------------------------- -; qt_blend_rgb32_on_rgb32_arm -; -; @brief -; -; @param dest Destination pixels (r0) -; @param dbpl Destination bytes per line (r1) -; @param src Source pixels (r2) -; @param sbpl Source bytes per line (r3) -; @param w Width (s0 -> r4) -; @param h Height (s1 -> r5) -; @param const_alpha Constant alpha (s2 -> r6) -; -;--------------------------------------------------------------------------- -qt_blend_rgb32_on_rgb32_armv6 Function - stmfd sp!, {r4-r12, r14} - - ; read arguments off the stack - add r8, sp, #10 * 4 - ldmia r8, {r9-r11} - - ; Reorganize registers - - mov r4, r10 - mov r5, r1 - mov r6, r3 - - mov r1, r2 - mov r2, r9 - mov r3, r11 - - ; Now we have registers - ; @param dest Destination pixels (r0) - ; @param src Source pixels (r1) - ; @param w Width (r2) - ; @param const_alpha Constant alpha (r3) - ; @param h Height (r4) - ; @param dbpl Destination bytes per line (r5) - ; @param sbpl Source bytes per line (r6) - - cmp r3, #256 ; test if we have fully opaque constant alpha value - bne rgb32_blend_const_alpha ; branch if not - -rgb32_blend_loop - - subs r4, r4, #1 - bmi rgb32_blend_exit ; while(h--) - -rgb321 PixCpySafe r0, r1, r2 - - add r0, r0, r5 ; dest = dest + dbpl - add r1, r1, r6 ; src = src + sbpl - - b rgb32_blend_loop - - -rgb32_blend_const_alpha - - ;ldr r14, =ComponentHalf ; load 0x800080 to r14 - mov r14, #0x800000 - add r14, r14, #0x80 - - sub r3, r3, #1 ; const_alpha -= 1; - -rgb32_blend_loop_const_alpha - - subs r4, r4, #1 - bmi rgb32_blend_exit ; while(h--) - -rgb322 BlendRowSafe PixelSourceOverConstAlpha - - add r0, r0, r5 ; dest = dest + dbpl - add r1, r1, r6 ; src = src + sbpl - - b rgb32_blend_loop_const_alpha - -rgb32_blend_exit - - ldmfd sp!, {r4-r12, pc} ; pop and return - - - -;----------------------------------------------------------------------------- -; qt_blend_argb32_on_argb32_arm -; -; @brief -; -; @param dest Destination pixels (r0) -; @param dbpl Destination bytes per line (r1) -; @param src Source pixels (r2) -; @param sbpl Source bytes per line (r3) -; @param w Width (s0 -> r4) -; @param h Height (s1 -> r5) -; @param const_alpha Constant alpha (s2 -> r6) -; -;--------------------------------------------------------------------------- -qt_blend_argb32_on_argb32_armv6 Function - stmfd sp!, {r4-r12, r14} - - ; read arguments off the stack - add r8, sp, #10 * 4 - ldmia r8, {r9-r11} - - ; Reorganize registers - - mov r4, r10 - mov r5, r1 - mov r6, r3 - - mov r1, r2 - mov r2, r9 - mov r3, r11 - - ; Now we have registers - ; @param dest Destination pixels (r0) - ; @param src Source pixels (r1) - ; @param w Width (r2) - ; @param const_alpha Constant alpha (r3) - ; @param h Height (r4) - ; @param dbpl Destination bytes per line (r5) - ; @param sbpl Source bytes per line (r6) - - ;ldr r14, =ComponentHalf ; load 0x800080 to r14 - mov r14, #0x800000 - add r14, r14, #0x80 - - cmp r3, #256 ; test if we have fully opaque constant alpha value - bne argb32_blend_const_alpha ; branch if not - -argb32_blend_loop - - subs r4, r4, #1 - bmi argb32_blend_exit ; while(h--) - -argb321 BlendRowSafe PixelSourceOver - - add r0, r0, r5 ; dest = dest + dbpl - add r1, r1, r6 ; src = src + sbpl - - b argb32_blend_loop - -argb32_blend_const_alpha - - sub r3, r3, #1 ; const_alpha -= 1; - -argb32_blend_loop_const_alpha - - subs r4, r4, #1 - bmi argb32_blend_exit ; while(h--) - -argb322 BlendRowSafe PixelSourceOverConstAlpha - - add r0, r0, r5 ; dest = dest + dbpl - add r1, r1, r6 ; src = src + sbpl - - b argb32_blend_loop_const_alpha - -argb32_blend_exit - - ldmfd sp!, {r4-r12, pc} ; pop and return - - - END ; File end diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 5f190ba..a4ab278 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include #include @@ -7678,96 +7678,6 @@ static void qt_memfill16_setup(quint16 *dest, quint16 value, int count); qt_memfill32_func qt_memfill32 = qt_memfill32_setup; qt_memfill16_func qt_memfill16 = qt_memfill16_setup; -#if defined(Q_CC_RVCT) && defined(QT_HAVE_ARMV6) -// Move these to qdrawhelper_arm.c when all -// functions are implemented using arm assembly. -static CompositionFunctionSolid qt_functionForModeSolid_ARMv6[numCompositionFunctions] = { - comp_func_solid_SourceOver, - comp_func_solid_DestinationOver, - comp_func_solid_Clear, - comp_func_solid_Source, - comp_func_solid_Destination, - comp_func_solid_SourceIn, - comp_func_solid_DestinationIn, - comp_func_solid_SourceOut, - comp_func_solid_DestinationOut, - comp_func_solid_SourceAtop, - comp_func_solid_DestinationAtop, - comp_func_solid_XOR, - comp_func_solid_Plus, - comp_func_solid_Multiply, - comp_func_solid_Screen, - comp_func_solid_Overlay, - comp_func_solid_Darken, - comp_func_solid_Lighten, - comp_func_solid_ColorDodge, - comp_func_solid_ColorBurn, - comp_func_solid_HardLight, - comp_func_solid_SoftLight, - comp_func_solid_Difference, - comp_func_solid_Exclusion, - rasterop_solid_SourceOrDestination, - rasterop_solid_SourceAndDestination, - rasterop_solid_SourceXorDestination, - rasterop_solid_NotSourceAndNotDestination, - rasterop_solid_NotSourceOrNotDestination, - rasterop_solid_NotSourceXorDestination, - rasterop_solid_NotSource, - rasterop_solid_NotSourceAndDestination, - rasterop_solid_SourceAndNotDestination -}; - -static CompositionFunction qt_functionForMode_ARMv6[numCompositionFunctions] = { - comp_func_SourceOver_armv6, - comp_func_DestinationOver, - comp_func_Clear, - comp_func_Source_armv6, - comp_func_Destination, - comp_func_SourceIn, - comp_func_DestinationIn, - comp_func_SourceOut, - comp_func_DestinationOut, - comp_func_SourceAtop, - comp_func_DestinationAtop, - comp_func_XOR, - comp_func_Plus, - comp_func_Multiply, - comp_func_Screen, - comp_func_Overlay, - comp_func_Darken, - comp_func_Lighten, - comp_func_ColorDodge, - comp_func_ColorBurn, - comp_func_HardLight, - comp_func_SoftLight, - comp_func_Difference, - comp_func_Exclusion, - rasterop_SourceOrDestination, - rasterop_SourceAndDestination, - rasterop_SourceXorDestination, - rasterop_NotSourceAndNotDestination, - rasterop_NotSourceOrNotDestination, - rasterop_NotSourceXorDestination, - rasterop_NotSource, - rasterop_NotSourceAndDestination, - rasterop_SourceAndNotDestination -}; - -static void qt_blend_color_argb_armv6(int count, const QSpan *spans, void *userData) -{ - QSpanData *data = reinterpret_cast(userData); - - CompositionFunctionSolid func = qt_functionForModeSolid_ARMv6[data->rasterBuffer->compositionMode]; - while (count--) { - uint *target = ((uint *)data->rasterBuffer->scanLine(spans->y)) + spans->x; - func(target, spans->len, data->solid.color, spans->coverage); - ++spans; - } -} - -#endif // Q_CC_RVCT && QT_HAVE_ARMV6 - - void qInitDrawhelperAsm() { @@ -7938,46 +7848,39 @@ void qInitDrawhelperAsm() } #endif // IWMMXT -#if defined(Q_CC_RVCT) && defined(QT_HAVE_ARMV6) - functionForModeAsm = qt_functionForMode_ARMv6; - functionForModeSolidAsm = qt_functionForModeSolid_ARMv6; +#if defined(QT_HAVE_ARM_SIMD) + qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_arm_simd; + qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_arm_simd; + qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_arm_simd; + qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_arm_simd; +#elif defined(QT_HAVE_NEON) + if (features & NEON) { + qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; + qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; + qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; + qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; + qBlendFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_rgb16_neon; + qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB16] = qt_blend_rgb16_on_argb32_neon; + qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_neon; + + qScaleFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_rgb16_neon; + qScaleFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_scale_image_rgb16_on_rgb16_neon; - qt_memfill32 = qt_memfill32_armv6; + qTransformFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_transform_image_argb32_on_rgb16_neon; + qTransformFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_transform_image_rgb16_on_rgb16_neon; - qDrawHelper[QImage::Format_ARGB32_Premultiplied].blendColor = qt_blend_color_argb_armv6; + qDrawHelper[QImage::Format_RGB16].alphamapBlit = qt_alphamapblit_quint16_neon; - qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_armv6; - qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_armv6; - qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_armv6; - qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_armv6; -#elif defined(QT_HAVE_NEON) - if (features & NEON) { - qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; - qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; - qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; - qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; - qBlendFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_rgb16_neon; - qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB16] = qt_blend_rgb16_on_argb32_neon; - qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_neon; - - qScaleFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_rgb16_neon; - qScaleFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_scale_image_rgb16_on_rgb16_neon; - - qTransformFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_transform_image_argb32_on_rgb16_neon; - qTransformFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_transform_image_rgb16_on_rgb16_neon; - - qDrawHelper[QImage::Format_RGB16].alphamapBlit = qt_alphamapblit_quint16_neon; - - functionForMode_C[QPainter::CompositionMode_SourceOver] = qt_blend_argb32_on_argb32_scanline_neon; - functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_neon; - functionForMode_C[QPainter::CompositionMode_Plus] = comp_func_Plus_neon; - destFetchProc[QImage::Format_RGB16] = qt_destFetchRGB16_neon; - destStoreProc[QImage::Format_RGB16] = qt_destStoreRGB16_neon; - - qMemRotateFunctions[QImage::Format_RGB16][0] = qt_memrotate90_16_neon; - qMemRotateFunctions[QImage::Format_RGB16][2] = qt_memrotate270_16_neon; - qt_memfill32 = qt_memfill32_neon; - } + functionForMode_C[QPainter::CompositionMode_SourceOver] = qt_blend_argb32_on_argb32_scanline_neon; + functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_neon; + functionForMode_C[QPainter::CompositionMode_Plus] = comp_func_Plus_neon; + destFetchProc[QImage::Format_RGB16] = qt_destFetchRGB16_neon; + destStoreProc[QImage::Format_RGB16] = qt_destStoreRGB16_neon; + + qMemRotateFunctions[QImage::Format_RGB16][0] = qt_memrotate90_16_neon; + qMemRotateFunctions[QImage::Format_RGB16][2] = qt_memrotate270_16_neon; + qt_memfill32 = qt_memfill32_neon; + } #endif if (functionForModeSolidAsm) { diff --git a/src/gui/painting/qdrawhelper_arm_simd.cpp b/src/gui/painting/qdrawhelper_arm_simd.cpp new file mode 100644 index 0000000..61dac5e --- /dev/null +++ b/src/gui/painting/qdrawhelper_arm_simd.cpp @@ -0,0 +1,313 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdrawhelper_arm_simd_p.h" + +#include +#include + +#ifdef QT_HAVE_ARM_SIMD + +#if defined(Q_OS_SYMBIAN) +#include +#endif + +#if defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT) +__asm void qt_blend_argb32_on_argb32_arm_simd(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha) +{ +#ifndef __ARMCC__ + __SWITCH_TO_ARM; +#else + CODE32 +#endif // __ARMCC__ + + stmfd sp!, {r4-r12, r14} + + // read arguments off the stack + add r8, sp, #10 * 4 + ldmia r8, {r4-r6} + + // adjust dbpl and sbpl + mov r14, #4 + mul r14, r4, r14 + sub r1, r1, r14 + sub r3, r3, r14 + + // load 0xFF00FF00 to r12 + mov r12, #0xFF000000 + add r12, r12, #0xFF00 + + // load 0x800080 to r14 + mov r14, #0x800000 + add r14, r14, #0x80 + + /* + Registers: + r0 dst + r1 dbpl + r2 src + r3 sbpl + r4 w + r5 h + r6 const_alpha + r12 0xFF0000 + r14 0x800080 + */ + + cmp r6, #256 //test if we have fully opaque constant alpha value + bne argb32constalpha // branch if not + +argb32_next_row + + mov r7, r4 + +argb32_next_pixel + + ldr r8, [r2], #4 // load src pixel + + // Negate r8 and extract src alpha + mvn r11, r8 // bitwise not + uxtb r11, r11, ror #24 + + cmp r11, #0 // test for full src opacity (negated) + beq argb32_no_blend + + cmp r11, #255 // test for full src transparency (negated) + addeq r0, #4 + beq argb32_nop + + ldr r9, [r0] // load dst pixel + + // blend + uxtb16 r10, r9 + uxtb16 r6, r9, ror #8 + mla r10, r11, r10, r14 + mla r9, r6, r11, r14 + uxtab16 r10, r10, r10, ror #8 + uxtab16 r9, r9, r9, ror #8 + and r9, r9, r12 + uxtab16 r10, r9, r10, ror #8 + + uqadd8 r8, r10, r8 + +argb32_no_blend + + str r8, [r0], #4 + +argb32_nop + + subs r7, r7, #1 + bgt argb32_next_pixel + + add r0, r0, r1 // dest = dest + dbpl + add r2, r2, r3 // src = src + sbpl + + subs r5, r5, #1 + bgt argb32_next_row + + b argb32_blend_exit + +argb32constalpha + + cmp r6, #0 + beq argb32_blend_exit + + ; const_alpha = (const_alpha * 255) >> 8; + mov r11, #255 + mul r6, r6, r11 + mov r11, r6, lsr #8 + +argb32constalpha_next_row + + mov r7, r4 + +argb32constalpha_next_pixel + + ldr r9, [r2], #4 // load src pixel + + // blend + uxtb16 r10, r9 + uxtb16 r6, r9, ror #8 + mla r10, r11, r10, r14 + mla r9, r6, r11, r14 + uxtab16 r10, r10, r10, ror #8 + uxtab16 r9, r9, r9, ror #8 + and r9, r9, r12 + uxtab16 r8, r9, r10, ror #8 + + ldr r9, [r0] // load dst pixel + + // blend + uxtb16 r10, r9 + uxtb16 r6, r9, ror #8 + + // Negate r11 and extract src alpha + mvn r9, r11 // bitwise not + uxtb r9, r9, ror #24 + + mla r10, r9, r10, r14 + mla r9, r6, r9, r14 + uxtab16 r10, r10, r10, ror #8 + uxtab16 r9, r9, r9, ror #8 + and r9, r9, r12 + uxtab16 r10, r9, r10, ror #8 + + uqadd8 r8, r10, r8 + + str r8, [r0], #4 + + subs r7, r7, #1 + bgt argb32constalpha_next_pixel + + add r0, r0, r1 // dest = dest + dbpl + add r2, r2, r3 // src = src + sbpl + + subs r5, r5, #1 + bgt argb32constalpha_next_row + +argb32_blend_exit + + // Restore registers + ldmfd sp!, {r4-r12, lr} + bx lr + + __END_ARM +} + +void qt_blend_rgb32_on_rgb32_arm_simd(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha) +{ + if (const_alpha != 256) { + qt_blend_argb32_on_argb32_arm_simd(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha); + return; + } + + const uint *src = (const uint *) srcPixels; + uint *dst = (uint *) destPixels; + if (w <= 64) { + for (int y=0; y= 0xff000000) + dst[x] = s; + else if (s != 0) + dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); + } + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } + } else if (const_alpha != 0) { + const_alpha = (const_alpha * 255) >> 8; + for (int y=0; y + +QT_BEGIN_NAMESPACE + +#if defined(QT_HAVE_ARM_SIMD) + +void qt_blend_argb32_on_argb32_arm_simd(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha); + +void qt_blend_rgb32_on_rgb32_arm_simd(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha); + +#endif // QT_HAVE_ARM_SIMD + +QT_END_NAMESPACE + +#endif // QDRAWHELPER_ARM_SIMD_P_H diff --git a/src/gui/painting/qdrawhelper_armv6_p.h b/src/gui/painting/qdrawhelper_armv6_p.h deleted file mode 100644 index e58f8bb..0000000 --- a/src/gui/painting/qdrawhelper_armv6_p.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDRAWHELPER_ARMV6_P_H -#define QDRAWHELPER_ARMV6_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 - -QT_BEGIN_NAMESPACE - -#if defined(Q_CC_RVCT) && defined(QT_HAVE_ARMV6) - -extern "C" void qt_blend_rgb32_on_rgb32_armv6(uchar *destPixels, int dbpl, - const uchar *srcPixels, int sbpl, - int w, int h, - int const_alpha); - -extern "C" void qt_blend_argb32_on_argb32_armv6(uchar *destPixels, int dbpl, - const uchar *srcPixels, int sbpl, - int w, int h, - int const_alpha); - -extern "C" void qt_memfill32_armv6(quint32 *dest, quint32 value, int count); - -extern "C" void comp_func_Source_armv6(uint *dest, const uint *src, int length, uint const_alpha); -extern "C" void comp_func_SourceOver_armv6(uint *dest, const uint *src, int length, uint const_alpha); - -#endif // QT_HAVE_ARMV6 - -QT_END_NAMESPACE - -#endif // QDRAWHELPER_ARMV6_P_H diff --git a/src/gui/painting/qdrawhelper_armv6_rvct.inc b/src/gui/painting/qdrawhelper_armv6_rvct.inc deleted file mode 100644 index 8c6d803..0000000 --- a/src/gui/painting/qdrawhelper_armv6_rvct.inc +++ /dev/null @@ -1,496 +0,0 @@ -;**************************************************************************** -;** -;** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -;** All rights reserved. -;** Contact: Nokia Corporation (qt-info@nokia.com) -;** -;** This file is part of the QtGui module of the Qt Toolkit. -;** -;** $QT_BEGIN_LICENSE:LGPL$ -;** No Commercial Usage -;** This file contains pre-release code and may not be distributed. -;** You may use this file in accordance with the terms and conditions -;** contained in the Technology Preview License Agreement accompanying -;** this package. -;** -;** GNU Lesser General Public License Usage -;** Alternatively, this file may be used under the terms of the GNU Lesser -;** General Public License version 2.1 as published by the Free Software -;** Foundation and appearing in the file LICENSE.LGPL included in the -;** packaging of this file. Please review the following information to -;** ensure the GNU Lesser General Public License version 2.1 requirements -;** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -;** -;** In addition, as a special exception, Nokia gives you certain additional -;** rights. These rights are described in the Nokia Qt LGPL Exception -;** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -;** -;** If you have questions regarding the use of this file, please contact -;** Nokia at qt-info@nokia.com. -;** -;** -;** -;** -;** -;** -;** -;** -;** $QT_END_LICENSE$ -;** -;**************************************************************************** - -; -; 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. -; - -;----------------------------------------------------------------------------- -; Globals. -; Earch marcro expects that caller has loaded 0x800080 to r14. -;----------------------------------------------------------------------------- - -ComponentHalf EQU 0x800080 - -;----------------------------------------------------------------------------- -; ARM assembly implementations of accelerated graphics operations. -; -; Conventions: -; -; - r0 = Target buffer pointer -; - r1 = Source buffer pointer -; - r2 = Length of the buffer to blend -; - r3 = Constant alpha for source buffer -; -;----------------------------------------------------------------------------- - -; A macro for transparently defining ARM functions - MACRO -$func Function - AREA Function_$func, CODE - GLOBAL $func - ALIGN 4 - CODE32 -$func - MEND - - -;----------------------------------------------------------------------------- -; Armv6 boosted implementation of BYTE_MUL(...) function found in qdrawhelper_p.h. -; -; @param dst Destination register where to store the result -; @param x Value to multiply -; @param a Multiplicator byte -; @param r14 Component half 0x800080 -; -; @note Trashes x, r8 -;----------------------------------------------------------------------------- - MACRO - ByteMul $dst, $x, $a - - ; static inline uint BYTE_MUL(uint x, uint a) - - ; uint r8 = (x & 0xff00ff) * a + 0x800080 - uxtb16 r8, $x ; r8 = r8 & 0x00FF00FF - mla r8, r8, $a, r14 - - ; x = ((r >> 8) & 0xff00ff) * a + 0x800080 - uxtb16 $x, $x, ror #8 - mla $x, $x, $a, r14 - - - ; r8 = (r8 + ((r8 >> 8) & 0xff00ff) ) >> 8 - ; r8 &= 0xff00ff - uxtab16 r8, r8, r8, ror #8 - uxtb16 r8, r8, ror #8 - - ; x = x + ((x >>8) & 0xff00ff) - uxtab16 $x, $x, $x, ror #8 - - ; x &= 0xff00ff00 - ; x |= r8 - uxtb16 $x, $x, ror #8 - orr $dst, r8, $x, lsl #8 - - MEND - -;----------------------------------------------------------------------------- -; Armv6 boosted implementation of INTERPOLATE_PIXEL_255(...) function found in -; qdrawhelper_p.h. -; -; @param dst Destination register where to store the result -; @param x First value to multiply -; @param a Multiplicator byte for first value -; @param y Second value to multiply -; @param b Multiplicator byte for second value -; @param r14 Component half 0x800080 -; -; -; @note Trashes x, r8, r14 -;----------------------------------------------------------------------------- - MACRO - InterpolatePixel255 $dst, $x, $a, $y, $b - - ; static inline uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) - - ; First calculate the parts where we need 0x800080 - - ; uint r8 = (((x & 0xff00ff) * a) + 0x800080) - uxtb16 r8, $x ; r8 = r8 & 0x00FF00FF - mla r8, r8, $a, r14 - - ; x = ((((x >> 8) & 0xff00ff) * a) + 0x800080) - uxtb16 $x, $x, ror #8 - mla $x, $x, $a, r14 - - ; Now we are trashing r14 to free it for other purposes - - ; uint r14 = (y & 0xff00ff) * b - uxtb16 r14, $y ; r14 = y & 0x00FF00FF - mul r14, r14, $b - - ; r8 = r8 + r14 - add r8, r8, r14 - - ; r8 = (r8 + ((r8 >> 8) & 0xff00ff) ) >> 8 - ; r8 &= 0xff00ff - uxtab16 r8, r8, r8, ror #8 - uxtb16 r8, r8, ror #8 - - ; r14 = ((y >> 8) & 0xff00ff) * b - uxtb16 r14, $y, ror #8 ; r14 = ((y >> 8) & 0xFF00FF) - mul r14, r14, $b - - ; x = x + r14 - add $x, $x, r14 - - ; x = x + ((x >>8) & 0xff00ff) - uxtab16 $x, $x, $x, ror #8 - - ; x &= 0xff00ff00 - ; x |= r8 - uxtb16 $x, $x, ror #8 - orr $dst, r8, $x, lsl #8 - - MEND - -;----------------------------------------------------------------------------- -; -;----------------------------------------------------------------------------- - MACRO -$label Blend4Pixels $BlendPixel - - ; Blend first 4 pixels - - ldmia r1!, {r4-r7} - ldm r0, {r9-r12} - -b4p1_$label $BlendPixel r9, r4, r3 -b4p2_$label $BlendPixel r10, r5, r3 -b4p3_$label $BlendPixel r11, r6, r3 -b4p4_$label $BlendPixel r12, r7, r3 - - stmia r0!, {r9-r12} - - MEND - -;----------------------------------------------------------------------------- -; -;----------------------------------------------------------------------------- - MACRO -$label Blend8Pixels $BlendPixel - -b8p1_$label Blend4Pixels $BlendPixel -b8p2_$label Blend4Pixels $BlendPixel - - MEND - -;----------------------------------------------------------------------------- -; -;----------------------------------------------------------------------------- - MACRO -$label Blend16Pixels $BlendPixel - -b16p1_$label Blend8Pixels $BlendPixel -b16p2_$label Blend8Pixels $BlendPixel - - MEND - -;----------------------------------------------------------------------------- -; -;----------------------------------------------------------------------------- - MACRO -$label Blend32Pixels $BlendPixel - -b32p1_$label Blend16Pixels $BlendPixel -b32p2_$label Blend16Pixels $BlendPixel - - MEND - -;----------------------------------------------------------------------------- -; A macro for source over compositing one row of pixels and saving the results -; to destination buffer. -; -; @param dest Destination buffer (r0) -; @param src Source buffer (r1) -; @param length Length (r2) -; @param const_alpha Constant alpha (r3) -; @param r14 Component Half (0x800080) (r14) -; -; @note Advances r0, r1 -; @note Trashes r2, r4-r12 -;----------------------------------------------------------------------------- - MACRO -$label BlendRow $BlendPixel - - pld [r1] - -bloop_$label - ; Blend 32 pixels per loop iteration - subs r2, r2, #32 - bmi b_remaining_$label - -brp1_$label Blend32Pixels $BlendPixel - - b bloop_$label - -b_remaining_$label - - ; Remaining 31 pixels - - addmi r2, r2, #32 - - ; Blend 16 pixels - tst r2, #16 - beq b_remaining8_$label - -brp2_$label Blend16Pixels $BlendPixel - -b_remaining8_$label - - ; Blend 8 pixels - tst r2, #8 - beq b_remaining4_$label - -brp3_$label Blend8Pixels $BlendPixel - -b_remaining4_$label - - ; Blend 4 pixels - tst r2, #4 - beq b_remaining3_$label - -brp4_$label Blend4Pixels $BlendPixel - -b_remaining3_$label - - ; Remaining 3 pixels - - tst r2, #2 - beq b_last_$label - - ldmia r1!, {r4-r5} - ldm r0, {r9-r10} - -brp5_$label $BlendPixel r9, r4, r3 -brp6_$label $BlendPixel r10, r5, r3 - - stmia r0!, {r9-r10} - -b_last_$label - - tst r2, #1 - beq bexit_$label - - ldr r4, [r1] - ldr r9, [r0] - -bpl_$label $BlendPixel r9, r4, r3 - - str r9, [r0] - -bexit_$label - - MEND - -;----------------------------------------------------------------------------- -; A macro for source over compositing one row of pixels and saving the results -; to destination buffer. Restores all registers. -; -; @param dest Destination buffer (r0) -; @param src Source buffer (r1) -; @param length Length (r2) -; @param const_alpha Constant alpha (r3) -; @param r14 Component Half (0x800080) (r14) -; -; @note Advances r0, r1 -; @note Trashes r2, r4-r12 -;----------------------------------------------------------------------------- - MACRO -$label BlendRowSafe $BlendPixel - - stmfd sp!, {r0-r6} ; Preserves registers only up to r6 - -brs_$label BlendRow $BlendPixel - - ldmfd sp!, {r0-r6} - - MEND - - -;----------------------------------------------------------------------------- -; Pix Copy. -; NOTE! Cache line size of ARM1136JF-S and ARM1136J-S is 32 bytes (8 pixels). -; -; @param dst Destination pixels (r0) -; @param src Source pixels (r1) -; @param len Length (r2) -; -; @note Trashes r3-r10 -;----------------------------------------------------------------------------- - MACRO -$label PixCpy $dst, $src, $len - - pld [$src] - -pcpy_loop_$label - ; Copy 8 pixels per loop iteration - pld [$src, #96] - subs $len, $len, #8 - ldmgeia $src!, {r3-r10} - stmgeia $dst!, {r3-r10} - bgt pcpy_loop_$label - -pcpy_remaining_$label - - ; Copy up to 7 remaining pixels - - ; Copy 4 pixels - tst $len, #4 - ldmneia $src!, {r3-r6} - stmneia $dst!, {r3-r6} - - tst $len, #2 - ldmneia $src!, {r3-r4} - stmneia $dst!, {r3-r4} - - tst $len, #1 - ldrne r3, [$src] - strne r3, [$dst] - - MEND - -;----------------------------------------------------------------------------- -; General Pix Copy. Maximum 8 pixels at time. Restores all registers. -; -; @param dst Destination pixels (r0) -; @param src Source pixels (r1) -; @param len Length (r2) -; -; @note Trashes r3-r10 -;----------------------------------------------------------------------------- - MACRO -$label PixCpySafe $dst, $src, $len - - stmfd sp!, {r0-r6} ; Preserves registers only up to r6 - -pcs_$label PixCpy $dst, $src, $len - - ldmfd sp!, {r0-r6} ; pop - - MEND - - -;----------------------------------------------------------------------------- -; A macro for source over compositing one pixel and saving the result to -; dst register. -; -; @param dst Destination register, must contain destination pixel upon entry -; @param src Source register, must contain source pixel upon entry -; @param const_alpha Constant source alpha -; @param r14 Component half 0x800080 -; -; @note Trashes const_alpha, r8 -;----------------------------------------------------------------------------- - MACRO -$label PixelSourceOver $dst, $src, $const_alpha - - ; Negate src and extract alpha - mvn $const_alpha, $src ; bitwise not - uxtb $const_alpha, $const_alpha, ror #24 ; r3 = ((r3 & 0xFF000000) >> 24); - - ;cmp $const_alpha, #255 ; test for full transparency ( negated ) - ;beq exit_$label - cmp $const_alpha, #0 ; test for full opacity ( negated ) - moveq $dst, $src - beq exit_$label - - ByteMul $dst, $dst, $const_alpha - add $dst, $src, $dst - -exit_$label - MEND - -;----------------------------------------------------------------------------- -; A macro for source over compositing one pixel and saving the result to -; dst register. -; -; @param dst Destination register, must contain destination pixel upon entry -; @param src Source register, must contain source pixel upon entry -; @param const_alpha Constant source alpha -; @param r14 Component half 0x800080 -; -; @note Trashes src, const_alpha, r8 -;----------------------------------------------------------------------------- - MACRO -$label PixelSourceOverConstAlpha $dst, $src, $const_alpha - - ; store alpha because we are going to trash it - stmfd sp!, {$const_alpha} - - ByteMul $src, $src, $const_alpha - - ; Negate src and extract alpha - mvn $const_alpha, $src ; bitwise not - uxtb $const_alpha, $const_alpha, ror #24 ; r3 = ((r3 & 0xFF000000) >> 24); - - ByteMul $dst, $dst, $const_alpha - - add $dst, $src, $dst - - ; recover alpha - ldmfd sp!, {$const_alpha} - - MEND - -;----------------------------------------------------------------------------- -; A macro for source over compositing one pixel and saving the result to -; a register. -; -; @param dst Destination register, must contain destination pixel upon entry -; @param src Source register, must contain source pixel upon entry -; @param const_alpha Constant source alpha -; @param r14 Component half 0x800080 -; -; @note Trashes src, r8 -;----------------------------------------------------------------------------- - MACRO -$label PixelSourceConstAlpha $dst, $src, $const_alpha - - ; store r2 and r14 because we are going to trash them - stmfd sp!, {r2, r14} - - rsb r2, $const_alpha, #255 - InterpolatePixel255 $dst, $src, $const_alpha, $dst, r2 - - ; recover r2 and r14 - ldmfd sp!, {r2, r14} - - MEND - - END ; File end diff --git a/src/gui/painting/qdrawhelper_armv6_rvct.s b/src/gui/painting/qdrawhelper_armv6_rvct.s deleted file mode 100644 index 180980a..0000000 --- a/src/gui/painting/qdrawhelper_armv6_rvct.s +++ /dev/null @@ -1,177 +0,0 @@ -;**************************************************************************** -;** -;** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -;** All rights reserved. -;** Contact: Nokia Corporation (qt-info@nokia.com) -;** -;** This file is part of the QtGui module of the Qt Toolkit. -;** -;** $QT_BEGIN_LICENSE:LGPL$ -;** No Commercial Usage -;** This file contains pre-release code and may not be distributed. -;** You may use this file in accordance with the terms and conditions -;** contained in the Technology Preview License Agreement accompanying -;** this package. -;** -;** GNU Lesser General Public License Usage -;** Alternatively, this file may be used under the terms of the GNU Lesser -;** General Public License version 2.1 as published by the Free Software -;** Foundation and appearing in the file LICENSE.LGPL included in the -;** packaging of this file. Please review the following information to -;** ensure the GNU Lesser General Public License version 2.1 requirements -;** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -;** -;** In addition, as a special exception, Nokia gives you certain additional -;** rights. These rights are described in the Nokia Qt LGPL Exception -;** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -;** -;** If you have questions regarding the use of this file, please contact -;** Nokia at qt-info@nokia.com. -;** -;** -;** -;** -;** -;** -;** -;** -;** $QT_END_LICENSE$ -;** -;**************************************************************************** - -; -; 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. -; - - ARM - PRESERVE8 - - INCLUDE qdrawhelper_armv6_rvct.inc - -;----------------------------------------------------------------------------- -; qt_memfill32_armv6 -; -; @brief Not yet in use! -; -; @param dest Destination buffer (r0) -; @param value Value (r1) -; @param count Count (r2) -; -;--------------------------------------------------------------------------- -qt_memfill32_armv6 Function - stmfd sp!, {r4-r12, r14} - - mov r3, r1 - mov r4, r1 - mov r5, r1 - mov r6, r1 - mov r7, r1 - mov r8, r1 - mov r9, r1 - -mfill_loop - ; Fill 32 pixels per loop iteration - subs r2, r2, #32 - stmgeia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} - stmgeia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} - stmgeia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} - stmgeia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} - bgt mfill_loop - -mfill_remaining - - ; Fill up to 31 remaining pixels - - ; Fill 16 pixels - tst r2, #16 - stmneia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} - stmneia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} - - ; Fill 8 pixels - tst r2, #8 - stmneia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} - - ; Fill 4 pixels - tst r2, #4 - stmneia r0!, {r1, r3, r4, r5} - - ; Fill 2 pixels - tst r2, #2 - stmneia r0!, {r1, r3} - - ; Fill last one - tst r2, #1 - strne r1, [r0] - - ldmfd sp!, {r4-r12, pc} ; pop and return - -;----------------------------------------------------------------------------- -; comp_func_Source_arm -; -; @brief -; -; @param dest Destination buffer (r0) -; @param src Source buffer (r1) -; @param length Length (r2) -; @param const_alpha Constant alpha (r3) -; -;--------------------------------------------------------------------------- -comp_func_Source_armv6 Function - stmfd sp!, {r4-r12, r14} - - cmp r3, #255 ; if(r3 == 255) - bne src2 ; branch if not - -src1 PixCpy r0, r1, r2 - - ldmfd sp!, {r4-r12, pc} ; pop and return - -src2 - ;ldr r14, =ComponentHalf ; load 0x800080 to r14 - mov r14, #0x800000 - add r14, r14, #0x80 - -src22 BlendRow PixelSourceConstAlpha - - ldmfd sp!, {r4-r12, pc} ; pop and return - -;----------------------------------------------------------------------------- -; comp_func_SourceOver_arm -; -; @brief -; -; @param dest Destination buffer (r0) -; @param src Source buffer (r1) -; @param length Length (r2) -; @param const_alpha Constant alpha (r3) -; -;--------------------------------------------------------------------------- -comp_func_SourceOver_armv6 Function - stmfd sp!, {r4-r12, r14} - - ;ldr r14, =ComponentHalf ; load 0x800080 to r14 - mov r14, #0x800000 - add r14, r14, #0x80 - - cmp r3, #255 ; if(r3 == 255) - bne srcovr2 ; branch if not - -srcovr1 BlendRow PixelSourceOver - - ldmfd sp!, {r4-r12, pc} ; pop and return - -srcovr2 - -srcovr22 BlendRow PixelSourceOverConstAlpha - - ldmfd sp!, {r4-r12, pc} ; pop and return - - - END ; File end -- cgit v0.12 From cc6bc2c286d2638f428f4d25f7eac00875578d3f Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Fri, 15 Oct 2010 13:04:58 +0300 Subject: Implemented Qt::WA_ShowWithoutActivating for Symbian. Task-number: QTBUG-14476 Reviewed-by: Jason Barron --- src/gui/kernel/qwidget_s60.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 9a451ce..5df5e19 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -544,7 +544,7 @@ void QWidgetPrivate::show_sys() id->MakeVisible(true); - if(q->isWindow()) + if(q->isWindow()&&!q->testAttribute(Qt::WA_ShowWithoutActivating)) id->setFocusSafely(true); } -- cgit v0.12 From 9e378145294da33495d48b2c0742461ae6c2a3ba Mon Sep 17 00:00:00 2001 From: David Faure Date: Thu, 15 Jul 2010 16:08:43 +0200 Subject: QWorkspace: fix hardcoded min size overwriting the real min size The setMinimumSize call was having precedence over the minimumSizeHint, so when having a sizegrip enabled it was possible to resize a MDI window to a much smaller size than its min size (actually it would flicker between the two sizes, on each resize). Fixed by moving that min size (for the titlebar contents) to the calculations in minimumSizeHint(). Reviewed-by: mariusso --- src/gui/widgets/qworkspace.cpp | 15 +++++++++------ tests/auto/qworkspace/tst_qworkspace.cpp | 10 ++++++++++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/gui/widgets/qworkspace.cpp b/src/gui/widgets/qworkspace.cpp index 7180c4d..3a9b30c 100644 --- a/src/gui/widgets/qworkspace.cpp +++ b/src/gui/widgets/qworkspace.cpp @@ -2551,7 +2551,6 @@ QWorkspaceChild::QWorkspaceChild(QWidget* window, QWorkspace *parent, Qt::Window this, SLOT(titleBarDoubleClicked())); } - setMinimumSize(128, 0); int fw = style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, this); setContentsMargins(fw, fw, fw, fw); @@ -2702,11 +2701,15 @@ QSize QWorkspaceChild::sizeHint() const QSize QWorkspaceChild::minimumSizeHint() const { - if (!childWidget) - return QWidget::minimumSizeHint() + baseSize(); - QSize s = childWidget->minimumSize(); - if (s.isEmpty()) - s = childWidget->minimumSizeHint(); + QSize s; + if (!childWidget) { + s = QWidget::minimumSizeHint(); + } else { + s = childWidget->minimumSize(); + if (s.isEmpty()) + s = childWidget->minimumSizeHint(); + } + s = s.expandedTo(QSize(128, 0)); return s + baseSize(); } diff --git a/tests/auto/qworkspace/tst_qworkspace.cpp b/tests/auto/qworkspace/tst_qworkspace.cpp index 4cf76b5..9039eb3 100644 --- a/tests/auto/qworkspace/tst_qworkspace.cpp +++ b/tests/auto/qworkspace/tst_qworkspace.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include #if defined(QT3_SUPPORT) #include @@ -591,16 +592,25 @@ void tst_QWorkspace::childSize() MyChild *child = new MyChild(&ws); child->show(); + ws.addWindow(child); QCOMPARE(child->size(), child->sizeHint()); delete child; child = new MyChild(&ws); child->setFixedSize(200, 200); child->show(); + ws.addWindow(child); QCOMPARE(child->size(), child->minimumSize()); + QCOMPARE(child->parentWidget()->metaObject()->className(), "QWorkspaceChild"); + QVERIFY(child->parentWidget()->width() >= 200); + // check that the minimum size is respected, using closestAcceptableSize + // like QSizeGrip does. + const QSize newSize = QLayout::closestAcceptableSize(child->parentWidget(), QSize(100, 100)); + QVERIFY(newSize.width() >= 200); delete child; child = new MyChild(&ws); + ws.addWindow(child); child->resize(150, 150); child->show(); QCOMPARE(child->size(), QSize(150,150)); -- cgit v0.12 From 5fd505cac71e97cf181c0d05867a77e640814fc6 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Fri, 15 Oct 2010 13:20:42 +0200 Subject: Disable the unified toolbar before entering fullscreen on Mac OS X. We are just enforcing what the documentation recommended. Task-number: QTBUG-13772 Reviewed-by: Samuel --- src/gui/kernel/qwidget.cpp | 34 ++++++++++++++++++++++++++++++++++ src/gui/widgets/qmainwindow.cpp | 4 ++-- src/gui/widgets/qmainwindowlayout_p.h | 1 + 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index f7c795e..9b44f15 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -68,6 +68,7 @@ # include "qt_cocoa_helpers_mac_p.h" # include "qmainwindow.h" # include "qtoolbar.h" +# include #endif #if defined(Q_WS_QWS) # include "qwsdisplay_qws.h" @@ -3002,6 +3003,15 @@ bool QWidget::isFullScreen() const */ void QWidget::showFullScreen() { +#ifdef Q_WS_MAC + // If the unified toolbar is enabled, we have to disable it before going fullscreen. + QMainWindow *mainWindow = qobject_cast(this); + if (mainWindow && mainWindow->unifiedTitleAndToolBarOnMac()) { + mainWindow->setUnifiedTitleAndToolBarOnMac(false); + QMainWindowLayout *mainLayout = qobject_cast(mainWindow->layout()); + mainLayout->activateUnifiedToolbarAfterFullScreen = true; + } +#endif // Q_WS_MAC ensurePolished(); #ifdef QT3_SUPPORT if (parent()) @@ -3034,6 +3044,18 @@ void QWidget::showMaximized() setWindowState((windowState() & ~(Qt::WindowMinimized | Qt::WindowFullScreen)) | Qt::WindowMaximized); +#ifdef Q_WS_MAC + // If the unified toolbar was enabled before going fullscreen, we have to enable it back. + QMainWindow *mainWindow = qobject_cast(this); + if (mainWindow) + { + QMainWindowLayout *mainLayout = qobject_cast(mainWindow->layout()); + if (mainLayout->activateUnifiedToolbarAfterFullScreen) { + mainWindow->setUnifiedTitleAndToolBarOnMac(true); + mainLayout->activateUnifiedToolbarAfterFullScreen = false; + } + } +#endif // Q_WS_MAC show(); } @@ -3055,6 +3077,18 @@ void QWidget::showNormal() setWindowState(windowState() & ~(Qt::WindowMinimized | Qt::WindowMaximized | Qt::WindowFullScreen)); +#ifdef Q_WS_MAC + // If the unified toolbar was enabled before going fullscreen, we have to enable it back. + QMainWindow *mainWindow = qobject_cast(this); + if (mainWindow) + { + QMainWindowLayout *mainLayout = qobject_cast(mainWindow->layout()); + if (mainLayout->activateUnifiedToolbarAfterFullScreen) { + mainWindow->setUnifiedTitleAndToolBarOnMac(true); + mainLayout->activateUnifiedToolbarAfterFullScreen = false; + } + } +#endif // Q_WS_MAC show(); } diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index 1183be6..d971f61 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -78,6 +78,7 @@ public: : layout(0), explicitIconSize(false), toolButtonStyle(Qt::ToolButtonIconOnly) #ifdef Q_WS_MAC , useHIToolBar(false) + , activateUnifiedToolbarAfterFullScreen(false) #endif #if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR) , hasOldCursor(false) , cursorAdjusted(false) @@ -89,6 +90,7 @@ public: Qt::ToolButtonStyle toolButtonStyle; #ifdef Q_WS_MAC bool useHIToolBar; + bool activateUnifiedToolbarAfterFullScreen; #endif void init(); QList hoverSeparator; @@ -1501,8 +1503,6 @@ bool QMainWindow::event(QEvent *event) \i Before Qt 4.5, if you called showFullScreen() on the main window, the QToolbar would disappear since it is considered to be part of the title bar. Qt 4.5 and up will now work around this by pulling the toolbars out and back into the regular toolbar and vice versa when you swap out. - However, a good practice would be that turning off the unified toolbar before you call - showFullScreen() and restoring it after you call showNormal(). \endlist Setting this back to false will remove these restrictions. diff --git a/src/gui/widgets/qmainwindowlayout_p.h b/src/gui/widgets/qmainwindowlayout_p.h index e1b981c..3e1a95d 100644 --- a/src/gui/widgets/qmainwindowlayout_p.h +++ b/src/gui/widgets/qmainwindowlayout_p.h @@ -335,6 +335,7 @@ public: void cleanUpMacToolbarItems(); void fixSizeInUnifiedToolbar(QToolBar *tb) const; bool useHIToolBar; + bool activateUnifiedToolbarAfterFullScreen; void syncUnifiedToolbarVisibility(); bool blockVisiblityCheck; #endif -- cgit v0.12 From 13bc1e0b99dd1d32bc0fef1dbdf0813ff5f4c66c Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Fri, 15 Oct 2010 14:27:26 +0300 Subject: Make s60pixelmetrics harvester utility app more robust There were some exceptional situations where the utility app caused either a memory leak, or outright crashed. Reviewed-by: TrustMe --- util/s60pixelmetrics/pm_mapperapp.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/util/s60pixelmetrics/pm_mapperapp.cpp b/util/s60pixelmetrics/pm_mapperapp.cpp index a88499d..d68a0b0 100644 --- a/util/s60pixelmetrics/pm_mapperapp.cpp +++ b/util/s60pixelmetrics/pm_mapperapp.cpp @@ -166,6 +166,7 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand ) else bufferPtr.Append(_L("screen.")); ShowL( *buffer, last ); + CleanupStack::PopAndDestroy( buffer ); } break; case ECmdStatus: @@ -257,7 +258,7 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand ) bufferPtr.Append(_L("Orientation cannot be changed.")); ShowL( *buffer, last ); bufferPtr.Zero(); - delete buffer; + CleanupStack::PopAndDestroy( buffer ); break; } #endif //__SERIES60_31__ @@ -278,7 +279,7 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand ) bufferPtr.Append(_L("Orientation changed.")); ShowL( *buffer, last ); bufferPtr.Zero(); - delete buffer; + CleanupStack::PopAndDestroy( buffer ); break; } case ECmdStartCalculations: @@ -787,11 +788,14 @@ void CPixelMetricsMapperAppUi::CreateHeaderFileL() const CleanupStack::PopAndDestroy(); //sourceFile } - bufferLayoutHdr = bufferLayoutHdr.Left(bufferLayoutHdr.Length()-2); - bufferPMData = bufferPMData.Left(bufferPMData.Length()-2); - textFile.Write(bufferLayoutHdr); - textFile.Write(KCRLF); - textFile.Write(bufferPMData); + if (fileCount > 0) + { + bufferLayoutHdr = bufferLayoutHdr.Left(bufferLayoutHdr.Length()-2); + bufferPMData = bufferPMData.Left(bufferPMData.Length()-2); + textFile.Write(bufferLayoutHdr); + textFile.Write(KCRLF); + textFile.Write(bufferPMData); + } delete dirList; CleanupStack::PopAndDestroy(); //file -- cgit v0.12 From 71745cab0d112edf3755f1883b3f9b34c0f251c9 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Fri, 15 Oct 2010 13:38:48 +0200 Subject: Doc: fixing unclosed

--- tools/qdoc3/htmlgenerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index c804d09..7b719c8 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -4234,7 +4234,7 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node, if (qpgn->isDefault()) out() << "default"; generateQmlItem(qpn, relative, marker, false); - out() << "

"; + out() << "

"; } ++p; } -- cgit v0.12 From b44ca15776227c8d04e88e1c343a87fd6c54fee0 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Fri, 15 Oct 2010 13:42:45 +0200 Subject: tst_qnetworkreply: New auto test for unreachable IPs This test fails right now and we should fix the underlying issue :-) Task-number: QT-4155 --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 306b5f8..88714e6 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -291,6 +291,8 @@ private Q_SLOTS: void qtbug12908compressedHttpReply(); + void getFromUnreachableIp(); + // NOTE: This test must be last! void parentingRepliesToTheApp(); }; @@ -4301,6 +4303,19 @@ void tst_QNetworkReply::qtbug12908compressedHttpReply() QCOMPARE(reply->error(), QNetworkReply::NoError); } +void tst_QNetworkReply::getFromUnreachableIp() +{ + QNetworkAccessManager manager; + + QNetworkRequest request(QUrl("http://255.255.255.255/42/23/narf/narf/narf")); + QNetworkReplyPtr reply = manager.get(request); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(5); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QVERIFY(reply->error() != QNetworkReply::NoError); +} // NOTE: This test must be last testcase in tst_qnetworkreply! void tst_QNetworkReply::parentingRepliesToTheApp() -- cgit v0.12 From 2e2e6e642494dca10b6d101088b8c5237d05f036 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 8 Sep 2010 12:52:18 +0200 Subject: Don't assing 'const Foo*' to a 'Foo*' Reviewed-by: Olivier Goffart --- src/gui/dialogs/qfontdialog_mac.mm | 4 ++-- src/gui/kernel/qcocoamenuloader_mac.mm | 8 ++++---- src/gui/kernel/qcocoaview_mac.mm | 2 +- src/gui/kernel/qt_cocoa_helpers_mac.mm | 8 ++++---- src/gui/kernel/qwidget_mac.mm | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm index 9c63dfa..6fb363b 100644 --- a/src/gui/dialogs/qfontdialog_mac.mm +++ b/src/gui/dialogs/qfontdialog_mac.mm @@ -496,7 +496,7 @@ void QFontDialogPrivate::setFont(void *delegate, const QFont &font) QMacCocoaAutoReleasePool pool; QFontEngine *fe = font.d->engineForScript(QUnicodeTables::Common); NSFontManager *mgr = [NSFontManager sharedFontManager]; - NSFont *nsFont = 0; + const NSFont *nsFont = 0; #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 if (qstrcmp(fe->name(), "CoreText") == 0) { @@ -522,7 +522,7 @@ void QFontDialogPrivate::setFont(void *delegate, const QFont &font) size:fontInfo.pointSize()]; } - [mgr setSelectedFont:nsFont isMultiple:NO]; + [mgr setSelectedFont:const_cast(nsFont) isMultiple:NO]; [static_cast(delegate) setQtFont:font]; } diff --git a/src/gui/kernel/qcocoamenuloader_mac.mm b/src/gui/kernel/qcocoamenuloader_mac.mm index 8d38f45..6ee4277 100644 --- a/src/gui/kernel/qcocoamenuloader_mac.mm +++ b/src/gui/kernel/qcocoamenuloader_mac.mm @@ -70,13 +70,13 @@ QT_USE_NAMESPACE showAllItem = [[appMenu itemWithTitle:@"Show All"] retain]; // Get the names in the nib to match the app name set by Qt. - NSString *appName = reinterpret_cast(QCFString::toCFStringRef(qAppName())); + const NSString *appName = reinterpret_cast(QCFString::toCFStringRef(qAppName())); [quitItem setTitle:[[quitItem title] stringByReplacingOccurrencesOfString:@"NewApplication" - withString:appName]]; + withString:const_cast(appName)]]; [hideItem setTitle:[[hideItem title] stringByReplacingOccurrencesOfString:@"NewApplication" - withString:appName]]; + withString:const_cast(appName)]]; [aboutItem setTitle:[[aboutItem title] stringByReplacingOccurrencesOfString:@"NewApplication" - withString:appName]]; + withString:const_cast(appName)]]; [appName release]; // Disable the items that don't do anything. If someone associates a QAction with them // They should get synced back in. diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 2016d40..49f7d7f 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -1417,7 +1417,7 @@ static int qCocoaViewCount = 0; if (!selectedText.isEmpty()) { QCFString string(selectedText.mid(theRange.location, theRange.length)); const NSString *tmpString = reinterpret_cast((CFStringRef)string); - return [[[NSAttributedString alloc] initWithString:tmpString] autorelease]; + return [[[NSAttributedString alloc] initWithString:const_cast(tmpString)] autorelease]; } else { return nil; } diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index cce9daa..5a522f9 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -1365,11 +1365,11 @@ QString qt_mac_get_pasteboardString(OSPasteboardRef paste) QMacCocoaAutoReleasePool pool; NSPasteboard *pb = nil; CFStringRef pbname; - if (PasteboardCopyName (paste, &pbname)) { - pb = [NSPasteboard generalPasteboard]; + if (PasteboardCopyName(paste, &pbname) == noErr) { + pb = [NSPasteboard pasteboardWithName:const_cast(reinterpret_cast(pbname))]; + CFRelease(pbname); } else { - pb = [NSPasteboard pasteboardWithName:reinterpret_cast(pbname)]; - CFRelease (pbname); + pb = [NSPasteboard generalPasteboard]; } if (pb) { NSString *text = [pb stringForType:NSStringPboardType]; diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 5e41efa..017541c 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -3176,7 +3176,7 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset) if (iconButton == nil) { QCFString string(q->windowTitle()); const NSString *tmpString = reinterpret_cast((CFStringRef)string); - [qt_mac_window_for(q) setRepresentedURL:[NSURL fileURLWithPath:tmpString]]; + [qt_mac_window_for(q) setRepresentedURL:[NSURL fileURLWithPath:const_cast(tmpString)]]; iconButton = [qt_mac_window_for(q) standardWindowButton:NSWindowDocumentIconButton]; } if (icon.isNull()) { -- cgit v0.12 From 24e0f64b8a35ddbfeae2f0611d3f1779fb56cdb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 8 Sep 2010 12:52:50 +0200 Subject: Explicitly inherit QNSOpenSavePanelDelegate from NSOpenSavePanelDelegate Reviewed-by: Olivier Goffart --- src/gui/dialogs/qfiledialog_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm index 87850a7..0a0ed9e 100644 --- a/src/gui/dialogs/qfiledialog_mac.mm +++ b/src/gui/dialogs/qfiledialog_mac.mm @@ -84,7 +84,7 @@ QT_USE_NAMESPACE @class QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate); -@interface QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) : NSObject { +@interface QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) : NSObject { @public NSOpenPanel *mOpenPanel; NSSavePanel *mSavePanel; -- cgit v0.12 From 873065d0c93616e6cda08daf8ba7fbef2ab139b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 8 Sep 2010 12:53:20 +0200 Subject: Don't redeclare voidPtr, it's already declared in CarbonCore's Thread.h Reviewed-by: Olivier Goffart --- src/opengl/qwindowsurface_gl.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 8157b2a..848d3a3 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -355,12 +355,12 @@ void QGLWindowSurface::deleted(QObject *object) QWidgetPrivate *widgetPrivate = widget->d_func(); if (widgetPrivate->extraData()) { - union { QGLContext **ctxPtr; void **voidPtr; }; - voidPtr = &widgetPrivate->extraData()->glContext; - int index = d_ptr->contexts.indexOf(ctxPtr); + union { QGLContext **ctxPtrPtr; void **voidPtrPtr; }; + voidPtrPtr = &widgetPrivate->extraData()->glContext; + int index = d_ptr->contexts.indexOf(ctxPtrPtr); if (index != -1) { - delete *ctxPtr; - *ctxPtr = 0; + delete *ctxPtrPtr; + *ctxPtrPtr = 0; d_ptr->contexts.removeAt(index); } } @@ -398,12 +398,12 @@ void QGLWindowSurface::hijackWindow(QWidget *widget) widgetPrivate->extraData()->glContext = ctx; - union { QGLContext **ctxPtr; void **voidPtr; }; + union { QGLContext **ctxPtrPtr; void **voidPtrPtr; }; connect(widget, SIGNAL(destroyed(QObject*)), this, SLOT(deleted(QObject*))); - voidPtr = &widgetPrivate->extraData()->glContext; - d_ptr->contexts << ctxPtr; + voidPtrPtr = &widgetPrivate->extraData()->glContext; + d_ptr->contexts << ctxPtrPtr; qDebug() << "hijackWindow() context created for" << widget << d_ptr->contexts.size(); } -- cgit v0.12 From efa0b410703898cb78d48d62ef7d389be2e87a33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 8 Sep 2010 12:50:35 +0200 Subject: Don't use 'id' as variable name, it has special meaning in Objctive-C Reviewed-by: Olivier Goffart --- src/plugins/bearer/corewlan/qcorewlanengine.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 844e38b..db577fd 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -850,7 +850,7 @@ quint64 QCoreWlanEngine::bytesReceived(const QString &id) return getBytes(interfaceStr,true); } -quint64 QCoreWlanEngine::startTime(const QString &id) +quint64 QCoreWlanEngine::startTime(const QString &identifier) { QMutexLocker locker(&mutex); QMacCocoaAutoReleasePool pool; @@ -885,7 +885,7 @@ quint64 QCoreWlanEngine::startTime(const QString &id) for(int i = 0; i < dictSize; i++) { if([ssidStr isEqualToString:keys[i]]) { const QString ident = QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString(objects[i]))); - if(ident == id) { + if(ident == identifier) { ok = true; } } -- cgit v0.12 From 3cba3745ac2f2cf616d341f2982c22e9809e1725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Sun, 19 Sep 2010 11:40:32 +0200 Subject: Phonon: Export ObjectDescriptionModel to prevent link errors with Clang Workaround for http://llvm.org/bugs/show_bug.cgi?id=8177 --- src/3rdparty/phonon/phonon/objectdescriptionmodel.h | 3 ++- src/corelib/global/qglobal.h | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/phonon/phonon/objectdescriptionmodel.h b/src/3rdparty/phonon/phonon/objectdescriptionmodel.h index 8fd622f..d994600 100644 --- a/src/3rdparty/phonon/phonon/objectdescriptionmodel.h +++ b/src/3rdparty/phonon/phonon/objectdescriptionmodel.h @@ -141,10 +141,11 @@ namespace Phonon /* Required to ensure template class vtables are exported on both symbian and existing builds. */ -#if defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT) +#if (defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT)) || defined(Q_CC_CLANG) // RVCT compiler (2.2.686) requires the export declaration to be on the class to export vtables // MWC compiler works both ways // GCCE compiler is unknown (it can't compile QtCore yet) +// Clang also requires the export declaration to be on the class to export vtables #define PHONON_TEMPLATE_CLASS_EXPORT PHONON_EXPORT #define PHONON_TEMPLATE_CLASS_MEMBER_EXPORT #else diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 1b2a6a8..b983132 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -356,6 +356,7 @@ namespace QT_NAMESPACE {} GCCE - GCCE (Symbian GCCE builds) RVCT - ARM Realview Compiler Suite NOKIAX86 - Nokia x86 (Symbian WINSCW builds) + CLANG - C++ front-end for the LLVM compiler Should be sorted most to least authoritative. @@ -452,6 +453,10 @@ namespace QT_NAMESPACE {} # define Q_CC_INTEL # define Q_NO_TEMPLATE_FRIENDS # endif +# if defined(__clang__) +/* Clang also masquerades as GCC 4.2.1 */ +# define Q_CC_CLANG +# endif # ifdef __APPLE__ # define Q_NO_DEPRECATED_CONSTRUCTORS # endif -- cgit v0.12 From e6b74347dd64b87473a812926379d91786ced972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 13 Oct 2010 20:40:47 +0200 Subject: Don't assign id to NSObject*, use id instead Reviewed-by: Olivier Goffart --- src/gui/kernel/qapplication_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm index c3f3e74..e5364d0 100644 --- a/src/gui/kernel/qapplication_mac.mm +++ b/src/gui/kernel/qapplication_mac.mm @@ -1246,7 +1246,7 @@ void qt_init(QApplicationPrivate *priv, int) qt_redirectNSApplicationSendEvent(); QMacCocoaAutoReleasePool pool; - NSObject *oldDelegate = [cocoaApp delegate]; + id oldDelegate = [cocoaApp delegate]; QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) *newDelegate = [QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) sharedDelegate]; Q_ASSERT(newDelegate); [newDelegate setQtPrivate:priv]; -- cgit v0.12 From 08b716363ef16bf31d2d9df103a5904bf15bbb98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 8 Sep 2010 12:54:01 +0200 Subject: Rename a few QtScript debugger-classes in anonymouse namespaces Workaround for Clang bug http://llvm.org/bugs/show_bug.cgi?id=8192 Reviewed-by: Kent Hansen Reviewed-by: Olivier Goffart --- src/scripttools/debugging/qscriptdebuggerconsolewidget.cpp | 8 ++++---- src/scripttools/debugging/qscriptdebugoutputwidget.cpp | 8 ++++---- src/scripttools/debugging/qscripterrorlogwidget.cpp | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/scripttools/debugging/qscriptdebuggerconsolewidget.cpp b/src/scripttools/debugging/qscriptdebuggerconsolewidget.cpp index 5db012a..d0559c5 100644 --- a/src/scripttools/debugging/qscriptdebuggerconsolewidget.cpp +++ b/src/scripttools/debugging/qscriptdebuggerconsolewidget.cpp @@ -163,10 +163,10 @@ private: InputEdit *inputEdit; }; -class OutputEdit : public QPlainTextEdit +class QScriptDebuggerConsoleWidgetOutputEdit : public QPlainTextEdit { public: - OutputEdit(QWidget *parent = 0) + QScriptDebuggerConsoleWidgetOutputEdit(QWidget *parent = 0) : QPlainTextEdit(parent) { setFrameShape(QFrame::NoFrame); @@ -206,7 +206,7 @@ public: void _q_onCompletionTaskFinished(); CommandLine *commandLine; - OutputEdit *outputEdit; + QScriptDebuggerConsoleWidgetOutputEdit *outputEdit; int historyIndex; QString newInput; }; @@ -320,7 +320,7 @@ QScriptDebuggerConsoleWidget::QScriptDebuggerConsoleWidget(QWidget *parent) Q_D(QScriptDebuggerConsoleWidget); d->commandLine = new CommandLine(); d->commandLine->setPrompt(QString::fromLatin1("qsdb>")); - d->outputEdit = new OutputEdit(); + d->outputEdit = new QScriptDebuggerConsoleWidgetOutputEdit(); QVBoxLayout *vbox = new QVBoxLayout(this); vbox->setSpacing(0); vbox->setMargin(0); diff --git a/src/scripttools/debugging/qscriptdebugoutputwidget.cpp b/src/scripttools/debugging/qscriptdebugoutputwidget.cpp index 3bca96c..594a9dc 100644 --- a/src/scripttools/debugging/qscriptdebugoutputwidget.cpp +++ b/src/scripttools/debugging/qscriptdebugoutputwidget.cpp @@ -51,10 +51,10 @@ QT_BEGIN_NAMESPACE namespace { -class OutputEdit : public QPlainTextEdit +class QScriptDebugOutputWidgetOutputEdit : public QPlainTextEdit { public: - OutputEdit(QWidget *parent = 0) + QScriptDebugOutputWidgetOutputEdit(QWidget *parent = 0) : QPlainTextEdit(parent) { setReadOnly(true); @@ -85,7 +85,7 @@ public: QScriptDebugOutputWidgetPrivate(); ~QScriptDebugOutputWidgetPrivate(); - OutputEdit *outputEdit; + QScriptDebugOutputWidgetOutputEdit *outputEdit; }; QScriptDebugOutputWidgetPrivate::QScriptDebugOutputWidgetPrivate() @@ -100,7 +100,7 @@ QScriptDebugOutputWidget::QScriptDebugOutputWidget(QWidget *parent) : QScriptDebugOutputWidgetInterface(*new QScriptDebugOutputWidgetPrivate, parent, 0) { Q_D(QScriptDebugOutputWidget); - d->outputEdit = new OutputEdit(); + d->outputEdit = new QScriptDebugOutputWidgetOutputEdit(); QVBoxLayout *vbox = new QVBoxLayout(this); vbox->setMargin(0); vbox->setSpacing(0); diff --git a/src/scripttools/debugging/qscripterrorlogwidget.cpp b/src/scripttools/debugging/qscripterrorlogwidget.cpp index 735c546..fd9a939 100644 --- a/src/scripttools/debugging/qscripterrorlogwidget.cpp +++ b/src/scripttools/debugging/qscripterrorlogwidget.cpp @@ -52,10 +52,10 @@ QT_BEGIN_NAMESPACE namespace { -class OutputEdit : public QTextEdit +class QScriptErrorLogWidgetOutputEdit : public QTextEdit { public: - OutputEdit(QWidget *parent = 0) + QScriptErrorLogWidgetOutputEdit(QWidget *parent = 0) : QTextEdit(parent) { setReadOnly(true); @@ -80,7 +80,7 @@ public: QScriptErrorLogWidgetPrivate(); ~QScriptErrorLogWidgetPrivate(); - OutputEdit *outputEdit; + QScriptErrorLogWidgetOutputEdit *outputEdit; }; QScriptErrorLogWidgetPrivate::QScriptErrorLogWidgetPrivate() @@ -95,7 +95,7 @@ QScriptErrorLogWidget::QScriptErrorLogWidget(QWidget *parent) : QScriptErrorLogWidgetInterface(*new QScriptErrorLogWidgetPrivate, parent, 0) { Q_D(QScriptErrorLogWidget); - d->outputEdit = new OutputEdit(); + d->outputEdit = new QScriptErrorLogWidgetOutputEdit(); QVBoxLayout *vbox = new QVBoxLayout(this); vbox->setMargin(0); vbox->setSpacing(0); -- cgit v0.12 From 9c93d0de104bfc591def1a2ce8d477ea0a1d62eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 14 Oct 2010 18:22:34 +0200 Subject: Apply WebKit revision 60451 manually to fix Clang build issue https://bugs.webkit.org/show_bug.cgi?id=39945 This revision is already present in QtWebKit 2.1 --- src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.h b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.h index 40f7e40..0df23a2 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.h +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSDOMBinding.h @@ -225,7 +225,7 @@ namespace WebCore { { if (!node) return JSC::jsNull(); - if (JSNode* wrapper = getCachedDOMNodeWrapper(exec, node->document(), node)) + if (JSC::JSCell* wrapper = getCachedDOMNodeWrapper(exec, node->document(), node)) return wrapper; return createDOMNodeWrapper(exec, globalObject, node); } -- cgit v0.12 From 05231f486b93dfb3992bfb96568f8c71d877e104 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 15 Oct 2010 15:14:27 +0300 Subject: Fix epocroot handling in createpackage.pl script Before this fix, creating stub sis failed if epocroot was simply a forward slash. Mixing forward slashes and backslashes also caused issues. Reviewed-by: Janne Koskinen --- bin/createpackage.pl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bin/createpackage.pl b/bin/createpackage.pl index 41ba2e3..522d1fb 100755 --- a/bin/createpackage.pl +++ b/bin/createpackage.pl @@ -140,7 +140,12 @@ unless (GetOptions('i|install' => \$install, } my $epocroot = $ENV{EPOCROOT}; -$epocroot =~ s,[\\/]$,,x; +if ($epocroot ne "") { + $epocroot =~ s,\\,/,g; + if ($epocroot =~ m,[^/]$,) { + $epocroot = $epocroot."/"; + } +} my $certfilepath = abs_path(dirname($certfile)); @@ -328,11 +333,11 @@ if ($preprocessonly) { if($stub) { if(!($epocroot)) { die("ERROR: EPOCROOT must be set to create stub sis files"); } - my $systeminstall = "$epocroot/epoc32/data/z/system/install"; + my $systeminstall = "${epocroot}epoc32/data/z/system/install"; mkpath($systeminstall); my $stub_sis_name = $systeminstall."/".$stub_sis_name; # Create stub SIS. - system ("$epocroot/epoc32/tools/makesis -s $pkgoutput $stub_sis_name"); + system ("${epocroot}epoc32/tools/makesis -s $pkgoutput $stub_sis_name"); } else { if ($certtext eq "Self Signed" && !@certificates @@ -346,7 +351,7 @@ if($stub) { # Create SIS. # The 'and' is because system uses 0 to indicate success. if($epocroot) { - system ("$epocroot/epoc32/tools/makesis $pkgoutput $unsigned_sis_name") and die ("ERROR: makesis failed"); + system ("${epocroot}epoc32/tools/makesis $pkgoutput $unsigned_sis_name") and die ("ERROR: makesis failed"); } else { system ("makesis $pkgoutput $unsigned_sis_name") and die ("ERROR: makesis failed"); } -- cgit v0.12 From 534ba3c7314820604ba5aeeffa6051c91e7c1d09 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 15 Oct 2010 13:48:51 +0200 Subject: Cocoa: fix child window issues (QTBUG 13867, 14420, 13126) The main problem behind these issues is the fact that when two windows exists in a parent-child relationship (using the [NSWindow addChild] API), Cocoa will automatically hide both windows even when just hiding one of them. This turns out really bad when the child is a tool window, because those will automatically be hidden when the application becomes deactivated. And as such, the parent will hide as well, tool or not. So after a LOT of investigation, involving manually trying to level windows rather than using the addChild API, the conclusing is that we cannot do it; Cocoa and Qt just tries to outsmart each other. So instead, we now say that only normal windows and dialogs can be part of a parent-child relationship (which seems to be how Apple intended it as well). The rest, and in particular tool windows, we just ignore. This will differ from some other platforms, but at the same time, since tool windows are on a level above other windows on mac from before, and the docs specifies that this can be different from platform to platform, we see it as acceptable. Rev-By: prasanth Rev-By: msorvig --- src/gui/kernel/qwidget_mac.mm | 47 ++++++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 1e2aa9f..b3b9183 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2794,19 +2794,36 @@ void QWidgetPrivate::transferChildren() #ifdef QT_MAC_USE_COCOA void QWidgetPrivate::setSubWindowStacking(bool set) { + // This will set/remove a visual relationship between parent and child on screen. + // The reason for doing this is to ensure that a child always stacks infront of + // its parent. Unfortunatly is turns out that [NSWindow addChildWindow] has + // several unwanted side-effects, one of them being the moving of a child when + // moving the parent, which we choose to accept. A way tougher side-effect is + // that Cocoa will hide the parent if you hide the child. And in the case of + // a tool window, since it will normally hide when you deactivate the + // application, Cocoa will hide the parent upon deactivate as well. The result often + // being no more visible windows on screen. So, to make a long story short, we only + // allow parent-child relationships between windows that both are on the NSNormalWindowLevel + // (because Cocoa will also use the window level to decide upon strange behaviour). + Q_Q(QWidget); - if (!q->isWindow() || !q->testAttribute(Qt::WA_WState_Created)) + if (!q->isWindow()) + return; + NSWindow *qwin = [qt_mac_nativeview_for(q) window]; + if (!qwin) + return; + if (set && [qwin level] != NSNormalWindowLevel) + return; + if (set && ![qwin isVisible]) return; if (QWidget *parent = q->parentWidget()) { - if (parent->testAttribute(Qt::WA_WState_Created)) { + if (NSWindow *pwin = [qt_mac_nativeview_for(parent) window]) { if (set) { - if (parent->isVisible()) { - NSWindow *childwin = qt_mac_window_for(q); - [qt_mac_window_for(parent) addChildWindow:childwin ordered:NSWindowAbove]; - } + if ([pwin isVisible] && [pwin level] == NSNormalWindowLevel && ![qwin parentWindow]) + [pwin addChildWindow:qwin ordered:NSWindowAbove]; } else { - [qt_mac_window_for(parent) removeChildWindow:qt_mac_window_for(q)]; + [pwin removeChildWindow:qwin]; } } } @@ -2814,12 +2831,14 @@ void QWidgetPrivate::setSubWindowStacking(bool set) QList widgets = q->findChildren(); for (int i=0; iisWindow() && child->testAttribute(Qt::WA_WState_Created) && child->isVisibleTo(q)) { - if (set) { - NSWindow *childwin = qt_mac_window_for(child); - [qt_mac_window_for(q) addChildWindow:childwin ordered:NSWindowAbove]; - } else { - [qt_mac_window_for(q) removeChildWindow:qt_mac_window_for(child)]; + if (child && child->isWindow()) { + if (NSWindow *cwin = [qt_mac_nativeview_for(child) window]) { + if (set) { + if ([cwin isVisible] && [cwin level] == NSNormalWindowLevel && ![cwin parentWindow]) + [qwin addChildWindow:cwin ordered:NSWindowAbove]; + } else { + [qwin removeChildWindow:qt_mac_window_for(child)]; + } } } } @@ -3442,7 +3461,6 @@ void QWidgetPrivate::show_sys() #else // sync the opacity value back (in case of a fade). [window setAlphaValue:q->windowOpacity()]; - setSubWindowStacking(true); QWidget *top = 0; if (QApplicationPrivate::tryModalHelper(q, &top)) { @@ -3461,6 +3479,7 @@ void QWidgetPrivate::show_sys() [modalWin orderFront:window]; } } + setSubWindowStacking(true); #endif if (q->windowType() == Qt::Popup) { if (q->focusWidget()) -- cgit v0.12 From dfe9084344d73d59f4569c8be6104ce83ae0df95 Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Fri, 15 Oct 2010 14:56:03 +0200 Subject: removed obsolete -qt-gif configure option Since "-system-gif" is not offered, offering "-qt-gif" is unnecessary and perhaps misleading. By default the GIF handler is built from code included with Qt, unless suppressed by "-no-gif". Merge-request: 859 Reviewed-by: Oswald Buddenhagen --- configure | 7 ++----- tools/configure/configureapp.cpp | 5 +---- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/configure b/configure index f6f5cfb..5539851 100755 --- a/configure +++ b/configure @@ -1556,8 +1556,7 @@ while [ "$#" -gt 0 ]; do fi ;; gif) - [ "$VAL" = "qt" ] && VAL=auto - if [ "$VAL" = "auto" ] || [ "$VAL" = "no" ]; then + if [ "$VAL" = "no" ]; then CFG_GIF="$VAL" else UNKNOWN_OPT=yes @@ -3541,7 +3540,7 @@ Usage: $relconf [-h] [-prefix ] [-prefix-install] [-bindir ] [-libdir [-accessibility] [-no-stl] [-stl] [-no-sql-] [-sql-] [-plugin-sql-] [-system-sqlite] [-no-qt3support] [-qt3support] [-platform] [-D ] [-I ] [-L ] [-help] - [-qt-zlib] [-system-zlib] [-no-gif] [-qt-gif] [-no-libtiff] [-qt-libtiff] [-system-libtiff] + [-qt-zlib] [-system-zlib] [-no-gif] [-no-libtiff] [-qt-libtiff] [-system-libtiff] [-no-libpng] [-qt-libpng] [-system-libpng] [-no-libmng] [-qt-libmng] [-system-libmng] [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg] [-make ] [-nomake ] [-R ] [-l ] [-no-rpath] [-rpath] [-continue] @@ -3769,8 +3768,6 @@ Third Party Libraries: See http://www.gzip.org/zlib -no-gif ............ Do not compile GIF reading support. - * -qt-gif ............ Compile GIF reading support. - See also src/gui/image/qgifhandler_p.h -no-libtiff ........ Do not compile TIFF support. -qt-libtiff ........ Use the libtiff bundled with Qt. diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 31c115a..3ca57b4 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -590,8 +590,6 @@ void Configure::parseCmdLine() // Image formats -------------------------------------------- else if (configCmdLine.at(i) == "-no-gif") dictionary[ "GIF" ] = "no"; - else if (configCmdLine.at(i) == "-qt-gif") - dictionary[ "GIF" ] = "plugin"; else if (configCmdLine.at(i) == "-no-libtiff") { dictionary[ "TIFF"] = "no"; @@ -1642,7 +1640,7 @@ bool Configure::displayHelp() "[-no-qmake] [-qmake] [-dont-process] [-process]\n" "[-no-style-
ScriptBaselineRenderedComparisonFuzzy ComparisonScoreUpdate
Info/Action
" << item.scriptName << "Update baselineUpdate baseline
" + "Blacklist test
" << imageItems.at(i).scriptName << "N/AN/AN/A"; + if (imageItems.at(i).status == ImageItem::IgnoreItem) { + out << "Blacklisted
" + "Whitelist test"; + } else { + out << "Test passed"; + } + out << "